diff options
694 files changed, 11160 insertions, 20221 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index acd01f43fcd..e91ec18caee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -538,9 +538,6 @@ set(PLATFORM_LINKFLAGS "") set(PLATFORM_LINKFLAGS_DEBUG "") -# disabled for now, not supported -# option(WITH_WEBPLUGIN "Enable Web Plugin (Unix only)" OFF) - # For alternate Python locations the commandline can be used to override detected/default cache settings, e.g: # On Unix: # cmake ../blender \ @@ -1874,16 +1871,6 @@ if(WITH_IMAGE_REDCODE) set(REDCODE_INC ${REDCODE}) endif() -#----------------------------------------------------------------------------- -# Blender WebPlugin - -if(WITH_WEBPLUGIN) - set(GECKO_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path") - set(WEBPLUGIN_SANDBOX_MODE "apparmor" CACHE STRING "WEB Plugin sandbox mode, can be apparmor, privsep, none") - - set(WITH_PLAYER ON) -endif() - #----------------------------------------------------------------------------- # Configure OpenGL. @@ -1977,6 +1964,7 @@ if(CMAKE_COMPILER_IS_GNUCC) ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_NULL -Wnonnull) # C only ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs) ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero) + ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_TYPE_LIMITS -Wtype-limits) # gcc 4.2 gives annoying warnings on every file with this if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3") @@ -2003,6 +1991,7 @@ if(CMAKE_COMPILER_IS_GNUCC) ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_INIT_SELF -Winit-self) # needs -Wuninitialized ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs) ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero) + ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_TYPE_LIMITS -Wtype-limits) # gcc 4.2 gives annoying warnings on every file with this if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3") @@ -2053,6 +2042,20 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter) ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS -Wno-unused-macros) + ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations) + ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function) + ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_INT_TO_VOID_POINTER_CAST -Wno-int-to-void-pointer-cast) + ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_PROTOTYPES -Wno-missing-prototypes) + ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DUPLICATE_ENUM -Wno-duplicate-enum) + ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef) + ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn) + + ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field) + ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing) + ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor) + ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_MACROS -Wno-unused-macros) + ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_REORDER -Wno-reorder) + elseif(CMAKE_C_COMPILER_ID MATCHES "Intel") ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall) diff --git a/build_files/cmake/Modules/FindPythonLibsUnix.cmake b/build_files/cmake/Modules/FindPythonLibsUnix.cmake index 1dffd54fed1..82f74373b8b 100644 --- a/build_files/cmake/Modules/FindPythonLibsUnix.cmake +++ b/build_files/cmake/Modules/FindPythonLibsUnix.cmake @@ -2,9 +2,11 @@ # Find the native Python includes and library # # Note:, This is not _yet_ intended to be a general python module for other -# projects to use since its hard coded to python 3.2 as blender only supports -# a single python version. -# This is for blender/unix python only. +# projects to use since its hard coded to fixed Python version +# as Blender only supports a single Python version at the moment. +# +# Note: +# this is for Blender/Unix Python only. # # This module defines # PYTHON_VERSION diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 109d9244b3a..854609f1665 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -530,7 +530,9 @@ macro(remove_strict_flags_file foreach(_SOURCE ${ARGV}) - if(CMAKE_COMPILER_IS_GNUCC) + if(CMAKE_COMPILER_IS_GNUCC OR + (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) + set_source_files_properties(${_SOURCE} PROPERTIES COMPILE_FLAGS "${CC_REMOVE_STRICT_FLAGS}" diff --git a/doc/python_api/rst/bge.render.rst b/doc/python_api/rst/bge.render.rst index c3bcf19c01b..5a80b7fa5c1 100644 --- a/doc/python_api/rst/bge.render.rst +++ b/doc/python_api/rst/bge.render.rst @@ -62,6 +62,18 @@ Constants .. data:: KX_BLENDER_GLSL_MATERIAL Materials approximating blender materials with GLSL. + +.. DATA:: VSYNC_OFF + + Disables vsync + +.. DATA:: VSYNC_ON + + Enables vsync + +.. DATA:: VSYNC_ADAPTIVE + + Enables adaptive vsync if supported. Adaptive vsync enables vsync if the framerate is above the monitors refresh rate. Otherwise, vsync is diabled if the framerate is too low. ********* Functions @@ -289,3 +301,15 @@ Functions Disable the motion blur effect. +.. function:: setVsync(value) + + Set the vsync value + + :arg value: One of VSYNC_OFF, VSYNC_ON, VSYNC_ADAPTIVE + :type value: integer + +.. function:: getVsync() + + Get the current vsync value + + :rtype: One of VSYNC_OFF, VSYNC_ON, VSYNC_ADAPTIVE diff --git a/extern/libmv/libmv-capi.cc b/extern/libmv/libmv-capi.cc index 563919e1d7b..990b40df90a 100644 --- a/extern/libmv/libmv-capi.cc +++ b/extern/libmv/libmv-capi.cc @@ -62,7 +62,7 @@ # define snprintf _snprintf #endif -typedef struct libmv_Reconstruction { +struct libmv_Reconstruction { libmv::EuclideanReconstruction reconstruction; /* used for per-track average error calculation after reconstruction */ @@ -70,12 +70,12 @@ typedef struct libmv_Reconstruction { libmv::CameraIntrinsics intrinsics; double error; -} libmv_Reconstruction; +}; -typedef struct libmv_Features { +struct libmv_Features { int count, margin; libmv::Feature *features; -} libmv_Features; +}; /* ************ Logging ************ */ @@ -197,30 +197,30 @@ static void saveImage(const char *prefix, libmv::FloatImage image, int x0, int y int x, y; png_bytep *row_pointers; - row_pointers= (png_bytep*)malloc(sizeof(png_bytep)*image.Height()); + row_pointers = (png_bytep *) malloc(sizeof(png_bytep) * image.Height()); for (y = 0; y < image.Height(); y++) { - row_pointers[y]= (png_bytep)malloc(sizeof(png_byte)*4*image.Width()); + row_pointers[y] = (png_bytep) malloc(sizeof(png_byte) * 4 * image.Width()); for (x = 0; x < image.Width(); x++) { if (x0 == x && image.Height() - y0 - 1 == y) { - row_pointers[y][x*4+0]= 255; - row_pointers[y][x*4+1]= 0; - row_pointers[y][x*4+2]= 0; - row_pointers[y][x*4+3]= 255; + row_pointers[y][x * 4 + 0] = 255; + row_pointers[y][x * 4 + 1] = 0; + row_pointers[y][x * 4 + 2] = 0; + row_pointers[y][x * 4 + 3] = 255; } else { float pixel = image(image.Height() - y - 1, x, 0); - row_pointers[y][x*4+0]= pixel*255; - row_pointers[y][x*4+1]= pixel*255; - row_pointers[y][x*4+2]= pixel*255; - row_pointers[y][x*4+3]= 255; + row_pointers[y][x * 4 + 0] = pixel * 255; + row_pointers[y][x * 4 + 1] = pixel * 255; + row_pointers[y][x * 4 + 2] = pixel * 255; + row_pointers[y][x * 4 + 3] = 255; } } } { - static int a= 0; + static int a = 0; char buf[128]; snprintf(buf, sizeof(buf), "%s_%02d.png", prefix, ++a); savePNGImage(row_pointers, image.Width(), image.Height(), 8, PNG_COLOR_TYPE_RGBA, buf); @@ -237,17 +237,17 @@ static void saveBytesImage(const char *prefix, unsigned char *data, int width, i int x, y; png_bytep *row_pointers; - row_pointers= (png_bytep*)malloc(sizeof(png_bytep)*height); + row_pointers = (png_bytep *) malloc(sizeof(png_bytep) * height); for (y = 0; y < height; y++) { - row_pointers[y]= (png_bytep)malloc(sizeof(png_byte)*4*width); + row_pointers[y] = (png_bytep) malloc(sizeof(png_byte) * 4 * width); for (x = 0; x < width; x++) { - char pixel = data[width*y+x]; - row_pointers[y][x*4+0]= pixel; - row_pointers[y][x*4+1]= pixel; - row_pointers[y][x*4+2]= pixel; - row_pointers[y][x*4+3]= 255; + char pixel = data[width * y + x]; + row_pointers[y][x * 4 + 0] = pixel; + row_pointers[y][x * 4 + 1] = pixel; + row_pointers[y][x * 4 + 2] = pixel; + row_pointers[y][x * 4 + 3] = 255; } } @@ -267,12 +267,12 @@ static void saveBytesImage(const char *prefix, unsigned char *data, int width, i /* ************ Planar tracker ************ */ -/* TrackRegion (new planar tracker) */ -int libmv_trackRegion(const struct libmv_trackRegionOptions *options, +/* TrackRegion */ +int libmv_trackRegion(const libmv_TrackRegionOptions *options, const float *image1, int image1_width, int image1_height, const float *image2, int image2_width, int image2_height, const double *x1, const double *y1, - struct libmv_trackRegionResult *result, + libmv_TrackRegionResult *result, double *x2, double *y2) { double xx1[5], yy1[5]; @@ -292,7 +292,7 @@ int libmv_trackRegion(const struct libmv_trackRegionOptions *options, switch (options->motion_model) { #define LIBMV_CONVERT(the_model) \ - case libmv::TrackRegionOptions::the_model: \ + case libmv::TrackRegionOptions::the_model: \ track_region_options.mode = libmv::TrackRegionOptions::the_model; \ break; LIBMV_CONVERT(TRANSLATION) @@ -384,29 +384,28 @@ void libmv_samplePlanarPatch(const float *image, int width, int height, /* ************ Tracks ************ */ -libmv_Tracks *libmv_tracksNew(void) +struct libmv_Tracks *libmv_tracksNew(void) { libmv::Tracks *libmv_tracks = new libmv::Tracks(); - return (libmv_Tracks *)libmv_tracks; + return (struct libmv_Tracks *)libmv_tracks; } -void libmv_tracksInsert(struct libmv_Tracks *libmv_tracks, int image, int track, double x, double y) +void libmv_tracksDestroy(struct libmv_Tracks *libmv_tracks) { - ((libmv::Tracks*)libmv_tracks)->Insert(image, track, x, y); + delete (libmv::Tracks*) libmv_tracks; } -void libmv_tracksDestroy(libmv_Tracks *libmv_tracks) +void libmv_tracksInsert(struct libmv_Tracks *libmv_tracks, int image, int track, double x, double y) { - delete (libmv::Tracks*)libmv_tracks; + ((libmv::Tracks*) libmv_tracks)->Insert(image, track, x, y); } -/* ************ Reconstruction solver ************ */ +/* ************ Reconstruction ************ */ class ReconstructUpdateCallback : public libmv::ProgressUpdateCallback { public: - ReconstructUpdateCallback(reconstruct_progress_update_cb progress_update_callback, - void *callback_customdata) + ReconstructUpdateCallback(reconstruct_progress_update_cb progress_update_callback, void *callback_customdata) { progress_update_callback_ = progress_update_callback; callback_customdata_ = callback_customdata; @@ -414,7 +413,7 @@ public: void invoke(double progress, const char *message) { - if(progress_update_callback_) { + if (progress_update_callback_) { progress_update_callback_(callback_customdata_, progress, message); } } @@ -456,7 +455,7 @@ static void libmv_solveRefineIntrinsics(const libmv::Tracks &tracks, intrinsics); } -static void cameraIntrinsicsFromOptions(const libmv_cameraIntrinsicsOptions *camera_intrinsics_options, +static void cameraIntrinsicsFromOptions(const libmv_CameraIntrinsicsOptions *camera_intrinsics_options, libmv::CameraIntrinsics *camera_intrinsics) { camera_intrinsics->SetFocalLength(camera_intrinsics_options->focal_length, @@ -486,7 +485,7 @@ static libmv::Tracks getNormalizedTracks(const libmv::Tracks &tracks, const libm } static void finishReconstruction(const libmv::Tracks &tracks, const libmv::CameraIntrinsics &camera_intrinsics, - libmv_Reconstruction *libmv_reconstruction, + struct libmv_Reconstruction *libmv_reconstruction, reconstruct_progress_update_cb progress_update_callback, void *callback_customdata) { @@ -571,13 +570,13 @@ static bool selectTwoKeyframesBasedOnGRICAndVariance( return true; } -libmv_Reconstruction *libmv_solveReconstruction(const libmv_Tracks *libmv_tracks, - const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options, - libmv_reconstructionOptions *libmv_reconstruction_options, - reconstruct_progress_update_cb progress_update_callback, - void *callback_customdata) +struct libmv_Reconstruction *libmv_solveReconstruction(const struct libmv_Tracks *libmv_tracks, + const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options, + libmv_ReconstructionOptions *libmv_reconstruction_options, + reconstruct_progress_update_cb progress_update_callback, + void *callback_customdata) { - libmv_Reconstruction *libmv_reconstruction = new libmv_Reconstruction(); + struct libmv_Reconstruction *libmv_reconstruction = new libmv_Reconstruction(); libmv::Tracks &tracks = *((libmv::Tracks *) libmv_tracks); libmv::EuclideanReconstruction &reconstruction = libmv_reconstruction->reconstruction; @@ -650,16 +649,16 @@ libmv_Reconstruction *libmv_solveReconstruction(const libmv_Tracks *libmv_tracks finishReconstruction(tracks, camera_intrinsics, libmv_reconstruction, progress_update_callback, callback_customdata); - return (libmv_Reconstruction *)libmv_reconstruction; + return (struct libmv_Reconstruction *)libmv_reconstruction; } -struct libmv_Reconstruction *libmv_solveModal(const libmv_Tracks *libmv_tracks, - const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options, - const libmv_reconstructionOptions *libmv_reconstruction_options, - reconstruct_progress_update_cb progress_update_callback, - void *callback_customdata) +struct libmv_Reconstruction *libmv_solveModal(const struct libmv_Tracks *libmv_tracks, + const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options, + const libmv_ReconstructionOptions *libmv_reconstruction_options, + reconstruct_progress_update_cb progress_update_callback, + void *callback_customdata) { - libmv_Reconstruction *libmv_reconstruction = new libmv_Reconstruction(); + struct libmv_Reconstruction *libmv_reconstruction = new libmv_Reconstruction(); libmv::Tracks &tracks = *((libmv::Tracks *) libmv_tracks); libmv::EuclideanReconstruction &reconstruction = libmv_reconstruction->reconstruction; @@ -697,15 +696,20 @@ struct libmv_Reconstruction *libmv_solveModal(const libmv_Tracks *libmv_tracks, finishReconstruction(tracks, camera_intrinsics, libmv_reconstruction, progress_update_callback, callback_customdata); - return (libmv_Reconstruction *)libmv_reconstruction; + return (struct libmv_Reconstruction *)libmv_reconstruction; +} + +void libmv_reconstructionDestroy(struct libmv_Reconstruction *libmv_reconstruction) +{ + delete libmv_reconstruction; } -int libmv_reporojectionPointForTrack(const libmv_Reconstruction *libmv_reconstruction, int track, double pos[3]) +int libmv_reprojectionPointForTrack(const struct libmv_Reconstruction *libmv_reconstruction, int track, double pos[3]) { const libmv::EuclideanReconstruction *reconstruction = &libmv_reconstruction->reconstruction; const libmv::EuclideanPoint *point = reconstruction->PointForTrack(track); - if(point) { + if (point) { pos[0] = point->X[0]; pos[1] = point->X[2]; pos[2] = point->X[1]; @@ -732,7 +736,7 @@ static libmv::Marker ProjectMarker(const libmv::EuclideanPoint &point, return reprojected_marker; } -double libmv_reporojectionErrorForTrack(const libmv_Reconstruction *libmv_reconstruction, int track) +double libmv_reprojectionErrorForTrack(const struct libmv_Reconstruction *libmv_reconstruction, int track) { const libmv::EuclideanReconstruction *reconstruction = &libmv_reconstruction->reconstruction; const libmv::CameraIntrinsics *intrinsics = &libmv_reconstruction->intrinsics; @@ -755,13 +759,13 @@ double libmv_reporojectionErrorForTrack(const libmv_Reconstruction *libmv_recons double ex = reprojected_marker.x - markers[i].x; double ey = reprojected_marker.y - markers[i].y; - total_error += sqrt(ex*ex + ey*ey); + total_error += sqrt(ex * ex + ey * ey); } return total_error / num_reprojected; } -double libmv_reporojectionErrorForImage(const libmv_Reconstruction *libmv_reconstruction, int image) +double libmv_reprojectionErrorForImage(const struct libmv_Reconstruction *libmv_reconstruction, int image) { const libmv::EuclideanReconstruction *reconstruction = &libmv_reconstruction->reconstruction; const libmv::CameraIntrinsics *intrinsics = &libmv_reconstruction->intrinsics; @@ -786,19 +790,19 @@ double libmv_reporojectionErrorForImage(const libmv_Reconstruction *libmv_recons double ex = reprojected_marker.x - markers[i].x; double ey = reprojected_marker.y - markers[i].y; - total_error += sqrt(ex*ex + ey*ey); + total_error += sqrt(ex * ex + ey * ey); } return total_error / num_reprojected; } -int libmv_reporojectionCameraForImage(const libmv_Reconstruction *libmv_reconstruction, +int libmv_reprojectionCameraForImage(const struct libmv_Reconstruction *libmv_reconstruction, int image, double mat[4][4]) { const libmv::EuclideanReconstruction *reconstruction = &libmv_reconstruction->reconstruction; const libmv::EuclideanCamera *camera = reconstruction->CameraForImage(image); - if(camera) { + if (camera) { for (int j = 0; j < 3; ++j) { for (int k = 0; k < 3; ++k) { int l = k; @@ -809,7 +813,7 @@ int libmv_reporojectionCameraForImage(const libmv_Reconstruction *libmv_reconstr if (j == 2) mat[j][l] = -camera->R(j,k); else mat[j][l] = camera->R(j,k); } - mat[j][3]= 0.0; + mat[j][3] = 0.0; } libmv::Vec3 optical_center = -camera->R.transpose() * camera->t; @@ -818,7 +822,7 @@ int libmv_reporojectionCameraForImage(const libmv_Reconstruction *libmv_reconstr mat[3][1] = optical_center(2); mat[3][2] = optical_center(1); - mat[3][3]= 1.0; + mat[3][3] = 1.0; return 1; } @@ -826,17 +830,17 @@ int libmv_reporojectionCameraForImage(const libmv_Reconstruction *libmv_reconstr return 0; } -double libmv_reprojectionError(const libmv_Reconstruction *libmv_reconstruction) +double libmv_reprojectionError(const struct libmv_Reconstruction *libmv_reconstruction) { return libmv_reconstruction->error; } -void libmv_destroyReconstruction(libmv_Reconstruction *libmv_reconstruction) +struct libmv_CameraIntrinsics *libmv_reconstructionExtractIntrinsics(struct libmv_Reconstruction *libmv_reconstruction) { - delete libmv_reconstruction; + return (struct libmv_CameraIntrinsics *)&libmv_reconstruction->intrinsics; } -/* ************ feature detector ************ */ +/* ************ Feature detector ************ */ struct libmv_Features *libmv_detectFeaturesFAST(const unsigned char *data, int width, int height, int stride, @@ -844,24 +848,24 @@ struct libmv_Features *libmv_detectFeaturesFAST(const unsigned char *data, { libmv::Feature *features = NULL; std::vector<libmv::Feature> v; - libmv_Features *libmv_features = new libmv_Features(); - int i= 0, count; + struct libmv_Features *libmv_features = new libmv_Features(); + int i = 0, count; - if(margin) { - data += margin*stride+margin; - width -= 2*margin; - height -= 2*margin; + if (margin) { + data += margin * stride+margin; + width -= 2 * margin; + height -= 2 * margin; } v = libmv::DetectFAST(data, width, height, stride, min_trackness, min_distance); count = v.size(); - if(count) { - features= new libmv::Feature[count]; + if (count) { + features = new libmv::Feature[count]; for(std::vector<libmv::Feature>::iterator it = v.begin(); it != v.end(); it++) { - features[i++]= *it; + features[i++] = *it; } } @@ -869,7 +873,7 @@ struct libmv_Features *libmv_detectFeaturesFAST(const unsigned char *data, libmv_features->count = count; libmv_features->margin = margin; - return (libmv_Features *)libmv_features; + return (struct libmv_Features *)libmv_features; } struct libmv_Features *libmv_detectFeaturesMORAVEC(const unsigned char *data, @@ -877,13 +881,13 @@ struct libmv_Features *libmv_detectFeaturesMORAVEC(const unsigned char *data, int margin, int count, int min_distance) { libmv::Feature *features = NULL; - libmv_Features *libmv_features = new libmv_Features; + struct libmv_Features *libmv_features = new libmv_Features; - if(count) { - if(margin) { - data += margin*stride+margin; - width -= 2*margin; - height -= 2*margin; + if (count) { + if (margin) { + data += margin * stride+margin; + width -= 2 * margin; + height -= 2 * margin; } features = new libmv::Feature[count]; @@ -897,14 +901,22 @@ struct libmv_Features *libmv_detectFeaturesMORAVEC(const unsigned char *data, return libmv_features; } -int libmv_countFeatures(const libmv_Features *libmv_features) +void libmv_featuresDestroy(struct libmv_Features *libmv_features) +{ + if (libmv_features->features) + delete [] libmv_features->features; + + delete libmv_features; +} + +int libmv_countFeatures(const struct libmv_Features *libmv_features) { return libmv_features->count; } -void libmv_getFeature(const libmv_Features *libmv_features, int number, double *x, double *y, double *score, double *size) +void libmv_getFeature(const struct libmv_Features *libmv_features, int number, double *x, double *y, double *score, double *size) { - libmv::Feature feature= libmv_features->features[number]; + libmv::Feature feature = libmv_features->features[number]; *x = feature.x + libmv_features->margin; *y = feature.y + libmv_features->margin; @@ -912,29 +924,16 @@ void libmv_getFeature(const libmv_Features *libmv_features, int number, double * *size = feature.size; } -void libmv_destroyFeatures(libmv_Features *libmv_features) -{ - if(libmv_features->features) - delete [] libmv_features->features; +/* ************ Camera intrinsics ************ */ - delete libmv_features; -} - -/* ************ camera intrinsics ************ */ - -struct libmv_CameraIntrinsics *libmv_ReconstructionExtractIntrinsics(libmv_Reconstruction *libmv_Reconstruction) -{ - return (struct libmv_CameraIntrinsics *)&libmv_Reconstruction->intrinsics; -} - -struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNewEmpty(void) +struct libmv_CameraIntrinsics *libmv_cameraIntrinsicsNewEmpty(void) { libmv::CameraIntrinsics *camera_intrinsics = new libmv::CameraIntrinsics(); return (struct libmv_CameraIntrinsics *) camera_intrinsics; } -struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNew(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options) +struct libmv_CameraIntrinsics *libmv_cameraIntrinsicsNew(const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options) { libmv::CameraIntrinsics *camera_intrinsics = new libmv::CameraIntrinsics(); @@ -943,23 +942,23 @@ struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNew(const libmv_cameraIntri return (struct libmv_CameraIntrinsics *) camera_intrinsics; } -struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsCopy(const libmv_CameraIntrinsics *libmvIntrinsics) +struct libmv_CameraIntrinsics *libmv_cameraIntrinsicsCopy(const libmv_CameraIntrinsics *libmvIntrinsics) { libmv::CameraIntrinsics *orig_intrinsics = (libmv::CameraIntrinsics *) libmvIntrinsics; - libmv::CameraIntrinsics *new_intrinsics= new libmv::CameraIntrinsics(*orig_intrinsics); + libmv::CameraIntrinsics *new_intrinsics = new libmv::CameraIntrinsics(*orig_intrinsics); return (struct libmv_CameraIntrinsics *) new_intrinsics; } -void libmv_CameraIntrinsicsDestroy(struct libmv_CameraIntrinsics *libmvIntrinsics) +void libmv_cameraIntrinsicsDestroy(struct libmv_CameraIntrinsics *libmvIntrinsics) { libmv::CameraIntrinsics *intrinsics = (libmv::CameraIntrinsics *) libmvIntrinsics; delete intrinsics; } -void libmv_CameraIntrinsicsUpdate(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options, - libmv_CameraIntrinsics *libmv_intrinsics) +void libmv_cameraIntrinsicsUpdate(const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options, + struct libmv_CameraIntrinsics *libmv_intrinsics) { libmv::CameraIntrinsics *camera_intrinsics = (libmv::CameraIntrinsics *) libmv_intrinsics; @@ -997,15 +996,16 @@ void libmv_CameraIntrinsicsUpdate(const libmv_cameraIntrinsicsOptions *libmv_cam } } -void libmv_CameraIntrinsicsSetThreads(libmv_CameraIntrinsics *libmv_intrinsics, int threads) +void libmv_cameraIntrinsicsSetThreads(struct libmv_CameraIntrinsics *libmv_intrinsics, int threads) { libmv::CameraIntrinsics *camera_intrinsics = (libmv::CameraIntrinsics *) libmv_intrinsics; camera_intrinsics->SetThreads(threads); } -void libmv_CameraIntrinsicsExtract(const libmv_CameraIntrinsics *libmv_intrinsics, double *focal_length, - double *principal_x, double *principal_y, double *k1, double *k2, double *k3, int *width, int *height) +void libmv_cameraIntrinsicsExtract(const struct libmv_CameraIntrinsics *libmv_intrinsics, double *focal_length, + double *principal_x, double *principal_y, double *k1, double *k2, double *k3, + int *width, int *height) { libmv::CameraIntrinsics *camera_intrinsics = (libmv::CameraIntrinsics *) libmv_intrinsics; @@ -1016,40 +1016,42 @@ void libmv_CameraIntrinsicsExtract(const libmv_CameraIntrinsics *libmv_intrinsic *k2 = camera_intrinsics->k2(); } -void libmv_CameraIntrinsicsUndistortByte(const libmv_CameraIntrinsics *libmv_intrinsics, - unsigned char *src, unsigned char *dst, int width, int height, float overscan, int channels) +void libmv_cameraIntrinsicsUndistortByte(const struct libmv_CameraIntrinsics *libmv_intrinsics, + unsigned char *src, unsigned char *dst, int width, int height, + float overscan, int channels) { libmv::CameraIntrinsics *camera_intrinsics = (libmv::CameraIntrinsics *) libmv_intrinsics; camera_intrinsics->Undistort(src, dst, width, height, overscan, channels); } -void libmv_CameraIntrinsicsUndistortFloat(const libmv_CameraIntrinsics *libmvIntrinsics, - float *src, float *dst, int width, int height, float overscan, int channels) +void libmv_cameraIntrinsicsUndistortFloat(const struct libmv_CameraIntrinsics *libmvIntrinsics, + float *src, float *dst, int width, int height, + float overscan, int channels) { libmv::CameraIntrinsics *intrinsics = (libmv::CameraIntrinsics *) libmvIntrinsics; intrinsics->Undistort(src, dst, width, height, overscan, channels); } -void libmv_CameraIntrinsicsDistortByte(const libmv_CameraIntrinsics *libmvIntrinsics, - unsigned char *src, unsigned char *dst, int width, int height, float overscan, int channels) +void libmv_cameraIntrinsicsDistortByte(const struct libmv_CameraIntrinsics *libmvIntrinsics, + unsigned char *src, unsigned char *dst, int width, int height, + float overscan, int channels) { libmv::CameraIntrinsics *intrinsics = (libmv::CameraIntrinsics *) libmvIntrinsics; intrinsics->Distort(src, dst, width, height, overscan, channels); } -void libmv_CameraIntrinsicsDistortFloat(const libmv_CameraIntrinsics *libmvIntrinsics, - float *src, float *dst, int width, int height, float overscan, int channels) +void libmv_cameraIntrinsicsDistortFloat(const struct libmv_CameraIntrinsics *libmvIntrinsics, + float *src, float *dst, int width, int height, + float overscan, int channels) { libmv::CameraIntrinsics *intrinsics = (libmv::CameraIntrinsics *) libmvIntrinsics; intrinsics->Distort(src, dst, width, height, overscan, channels); } -/* ************ utils ************ */ - -void libmv_ApplyCameraIntrinsics(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options, +void libmv_cameraIntrinsicsApply(const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options, double x, double y, double *x1, double *y1) { libmv::CameraIntrinsics camera_intrinsics; @@ -1063,7 +1065,7 @@ void libmv_ApplyCameraIntrinsics(const libmv_cameraIntrinsicsOptions *libmv_came } } -void libmv_InvertCameraIntrinsics(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options, +void libmv_cameraIntrinsicsInvert(const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options, double x, double y, double *x1, double *y1) { libmv::CameraIntrinsics camera_intrinsics; diff --git a/extern/libmv/libmv-capi.h b/extern/libmv/libmv-capi.h index beac3e85468..7c91881fe71 100644 --- a/extern/libmv/libmv-capi.h +++ b/extern/libmv/libmv-capi.h @@ -41,8 +41,8 @@ void libmv_initLogging(const char *argv0); void libmv_startDebugLogging(void); void libmv_setLoggingVerbosity(int verbosity); -/* TrackRegion (new planar tracker) */ -struct libmv_trackRegionOptions { +/* Planar tracker */ +typedef struct libmv_TrackRegionOptions { int motion_model; int num_iterations; int use_brute; @@ -50,21 +50,20 @@ struct libmv_trackRegionOptions { double minimum_correlation; double sigma; float *image1_mask; -}; +} libmv_TrackRegionOptions; -struct libmv_trackRegionResult { +typedef struct libmv_TrackRegionResult { int termination; const char *termination_reason; double correlation; -}; +} libmv_TrackRegionResult; -int libmv_trackRegion(const struct libmv_trackRegionOptions *options, +int libmv_trackRegion(const libmv_TrackRegionOptions *options, const float *image1, int image1_width, int image1_height, const float *image2, int image2_width, int image2_height, const double *x1, const double *y1, - struct libmv_trackRegionResult *result, + libmv_TrackRegionResult *result, double *x2, double *y2); - void libmv_samplePlanarPatch(const float *image, int width, int height, int channels, const double *xs, const double *ys, int num_samples_x, int num_samples_y, @@ -73,25 +72,24 @@ void libmv_samplePlanarPatch(const float *image, int width, int height, /* Tracks */ struct libmv_Tracks *libmv_tracksNew(void); -void libmv_tracksInsert(struct libmv_Tracks *libmv_tracks, int image, int track, double x, double y); void libmv_tracksDestroy(struct libmv_Tracks *libmv_tracks); +void libmv_tracksInsert(struct libmv_Tracks *libmv_tracks, int image, int track, double x, double y); -/* Reconstruction solver */ - +/* Reconstruction */ #define LIBMV_REFINE_FOCAL_LENGTH (1 << 0) #define LIBMV_REFINE_PRINCIPAL_POINT (1 << 1) #define LIBMV_REFINE_RADIAL_DISTORTION_K1 (1 << 2) #define LIBMV_REFINE_RADIAL_DISTORTION_K2 (1 << 4) -typedef struct libmv_cameraIntrinsicsOptions { +typedef struct libmv_CameraIntrinsicsOptions { double focal_length; double principal_point_x, principal_point_y; double k1, k2, k3; double p1, p2; int image_width, image_height; -} libmv_cameraIntrinsicsOptions; +} libmv_CameraIntrinsicsOptions; -typedef struct libmv_reconstructionOptions { +typedef struct libmv_ReconstructionOptions { int select_keyframes; int keyframe1, keyframe2; @@ -99,72 +97,67 @@ typedef struct libmv_reconstructionOptions { double success_threshold; int use_fallback_reconstruction; -} libmv_reconstructionOptions; +} libmv_ReconstructionOptions; typedef void (*reconstruct_progress_update_cb) (void *customdata, double progress, const char *message); struct libmv_Reconstruction *libmv_solveReconstruction(const struct libmv_Tracks *libmv_tracks, - const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options, - libmv_reconstructionOptions *libmv_reconstruction_options, - reconstruct_progress_update_cb progress_update_callback, - void *callback_customdata); + const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options, + libmv_ReconstructionOptions *libmv_reconstruction_options, + reconstruct_progress_update_cb progress_update_callback, + void *callback_customdata); struct libmv_Reconstruction *libmv_solveModal(const struct libmv_Tracks *libmv_tracks, - const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options, - const libmv_reconstructionOptions *libmv_reconstruction_options, - reconstruct_progress_update_cb progress_update_callback, - void *callback_customdata); -int libmv_reporojectionPointForTrack(const struct libmv_Reconstruction *libmv_reconstruction, int track, double pos[3]); -double libmv_reporojectionErrorForTrack(const struct libmv_Reconstruction *libmv_reconstruction, int track); -double libmv_reporojectionErrorForImage(const struct libmv_Reconstruction *libmv_reconstruction, int image); -int libmv_reporojectionCameraForImage(const struct libmv_Reconstruction *libmv_reconstruction, int image, double mat[4][4]); + const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options, + const libmv_ReconstructionOptions *libmv_reconstruction_options, + reconstruct_progress_update_cb progress_update_callback, + void *callback_customdata); +void libmv_reconstructionDestroy(struct libmv_Reconstruction *libmv_reconstruction); +int libmv_reprojectionPointForTrack(const struct libmv_Reconstruction *libmv_reconstruction, int track, double pos[3]); +double libmv_reprojectionErrorForTrack(const struct libmv_Reconstruction *libmv_reconstruction, int track); +double libmv_reprojectionErrorForImage(const struct libmv_Reconstruction *libmv_reconstruction, int image); +int libmv_reprojectionCameraForImage(const struct libmv_Reconstruction *libmv_reconstruction, + int image, double mat[4][4]); double libmv_reprojectionError(const struct libmv_Reconstruction *libmv_reconstruction); -void libmv_destroyReconstruction(struct libmv_Reconstruction *libmv_reconstruction); +struct libmv_CameraIntrinsics *libmv_reconstructionExtractIntrinsics(struct libmv_Reconstruction *libmv_Reconstruction); -/* feature detector */ +/* Feature detector */ struct libmv_Features *libmv_detectFeaturesFAST(const unsigned char *data, int width, int height, int stride, - int margin, int min_trackness, int min_distance); + int margin, int min_trackness, int min_distance); struct libmv_Features *libmv_detectFeaturesMORAVEC(const unsigned char *data, int width, int height, int stride, - int margin, int count, int min_distance); + int margin, int count, int min_distance); +void libmv_featuresDestroy(struct libmv_Features *libmv_features); int libmv_countFeatures(const struct libmv_Features *libmv_features); -void libmv_getFeature(const struct libmv_Features *libmv_features, int number, double *x, double *y, double *score, double *size); -void libmv_destroyFeatures(struct libmv_Features *libmv_features); - -/* camera intrinsics */ -struct libmv_CameraIntrinsics *libmv_ReconstructionExtractIntrinsics(struct libmv_Reconstruction *libmv_Reconstruction); - -struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNewEmpty(void); - -struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNew(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options); - -struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsCopy(const struct libmv_CameraIntrinsics *libmv_intrinsics); - -void libmv_CameraIntrinsicsDestroy(struct libmv_CameraIntrinsics *libmv_intrinsics); - -void libmv_CameraIntrinsicsUpdate(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options, +void libmv_getFeature(const struct libmv_Features *libmv_features, int number, double *x, double *y, double *score, + double *size); + +/* Camera intrinsics */ +struct libmv_CameraIntrinsics *libmv_cameraIntrinsicsNewEmpty(void); +struct libmv_CameraIntrinsics *libmv_cameraIntrinsicsNew( + const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options); +struct libmv_CameraIntrinsics *libmv_cameraIntrinsicsCopy(const struct libmv_CameraIntrinsics *libmv_intrinsics); +void libmv_cameraIntrinsicsDestroy(struct libmv_CameraIntrinsics *libmv_intrinsics); +void libmv_cameraIntrinsicsUpdate(const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options, struct libmv_CameraIntrinsics *libmv_intrinsics); - -void libmv_CameraIntrinsicsSetThreads(struct libmv_CameraIntrinsics *libmv_intrinsics, int threads); - -void libmv_CameraIntrinsicsExtract(const struct libmv_CameraIntrinsics *libmv_intrinsics, double *focal_length, - double *principal_x, double *principal_y, double *k1, double *k2, double *k3, int *width, int *height); - -void libmv_CameraIntrinsicsUndistortByte(const struct libmv_CameraIntrinsics *libmv_intrinsics, - unsigned char *src, unsigned char *dst, int width, int height, float overscan, int channels); - -void libmv_CameraIntrinsicsUndistortFloat(const struct libmv_CameraIntrinsics *libmv_intrinsics, - float *src, float *dst, int width, int height, float overscan, int channels); - -void libmv_CameraIntrinsicsDistortByte(const struct libmv_CameraIntrinsics *libmv_intrinsics, - unsigned char *src, unsigned char *dst, int width, int height, float overscan, int channels); - -void libmv_CameraIntrinsicsDistortFloat(const struct libmv_CameraIntrinsics *libmv_intrinsics, - float *src, float *dst, int width, int height, float overscan, int channels); - -/* utils */ -void libmv_ApplyCameraIntrinsics(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options, - double x, double y, double *x1, double *y1); -void libmv_InvertCameraIntrinsics(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options, - double x, double y, double *x1, double *y1); +void libmv_cameraIntrinsicsSetThreads(struct libmv_CameraIntrinsics *libmv_intrinsics, int threads); +void libmv_cameraIntrinsicsExtract(const struct libmv_CameraIntrinsics *libmv_intrinsics, double *focal_length, + double *principal_x, double *principal_y, double *k1, double *k2, double *k3, + int *width, int *height); +void libmv_cameraIntrinsicsUndistortByte(const struct libmv_CameraIntrinsics *libmv_intrinsics, + unsigned char *src, unsigned char *dst, int width, int height, + float overscan, int channels); +void libmv_cameraIntrinsicsUndistortFloat(const struct libmv_CameraIntrinsics *libmv_intrinsics, + float *src, float *dst, int width, int height, + float overscan, int channels); +void libmv_cameraIntrinsicsDistortByte(const struct libmv_CameraIntrinsics *libmv_intrinsics, + unsigned char *src, unsigned char *dst, int width, int height, + float overscan, int channels); +void libmv_cameraIntrinsicsDistortFloat(const struct libmv_CameraIntrinsics *libmv_intrinsics, + float *src, float *dst, int width, int height, + float overscan, int channels); +void libmv_cameraIntrinsicsApply(const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options, + double x, double y, double *x1, double *y1); +void libmv_cameraIntrinsicsInvert(const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options, + double x, double y, double *x1, double *y1); #ifdef __cplusplus } diff --git a/extern/libmv/libmv-capi_stub.cc b/extern/libmv/libmv-capi_stub.cc index 4bc2b18081a..36977eb58ba 100644 --- a/extern/libmv/libmv-capi_stub.cc +++ b/extern/libmv/libmv-capi_stub.cc @@ -48,11 +48,11 @@ void libmv_setLoggingVerbosity(int /*verbosity*/) /* ************ Planar tracker ************ */ /* TrackRegion (new planar tracker) */ -int libmv_trackRegion(const struct libmv_trackRegionOptions * /*options*/, +int libmv_trackRegion(const libmv_TrackRegionOptions * /*options*/, const float * /*image1*/, int /*image1_width*/, int /*image1_height*/, const float * /*image2*/, int /*image2_width*/, int /*image2_height*/, const double *x1, const double *y1, - struct libmv_trackRegionResult *result, + libmv_TrackRegionResult *result, double *x2, double *y2) { /* Convert to doubles for the libmv api. The four corners and the center. */ @@ -79,7 +79,8 @@ void libmv_samplePlanarPatch(const float *image, int width, int height, /* ************ Tracks ************ */ -libmv_Tracks *libmv_tracksNew(void) { +struct libmv_Tracks *libmv_tracksNew(void) +{ return NULL; } @@ -88,73 +89,72 @@ void libmv_tracksInsert(struct libmv_Tracks * /*libmv_tracks*/, int /*image*/, { } -void libmv_tracksDestroy(libmv_Tracks * /*libmv_tracks*/) +void libmv_tracksDestroy(struct libmv_Tracks * /*libmv_tracks*/) { } /* ************ Reconstruction solver ************ */ -libmv_Reconstruction *libmv_solveReconstruction(const libmv_Tracks * /*libmv_tracks*/, - const libmv_cameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/, - libmv_reconstructionOptions * /*libmv_reconstruction_options*/, - reconstruct_progress_update_cb /*progress_update_callback*/, - void * /*callback_customdata*/) +struct libmv_Reconstruction *libmv_solveReconstruction(const struct libmv_Tracks * /*libmv_tracks*/, + const libmv_CameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/, + libmv_ReconstructionOptions * /*libmv_reconstruction_options*/, + reconstruct_progress_update_cb /*progress_update_callback*/, + void * /*callback_customdata*/) { return NULL; } struct libmv_Reconstruction *libmv_solveModal(const struct libmv_Tracks * /*libmv_tracks*/, - const libmv_cameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/, - const libmv_reconstructionOptions * /*libmv_reconstruction_options*/, - reconstruct_progress_update_cb /*progress_update_callback*/, - void * /*callback_customdata*/) + const libmv_CameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/, + const libmv_ReconstructionOptions * /*libmv_reconstruction_options*/, + reconstruct_progress_update_cb /*progress_update_callback*/, + void * /*callback_customdata*/) { return NULL; } -int libmv_reporojectionPointForTrack(const libmv_Reconstruction * /*libmv_reconstruction*/, +int libmv_reprojectionPointForTrack(const struct libmv_Reconstruction * /*libmv_reconstruction*/, int /*track*/, double /*pos*/[3]) { return 0; } -double libmv_reporojectionErrorForTrack(const libmv_Reconstruction * /*libmv_reconstruction*/, int /*track*/) +double libmv_reprojectionErrorForTrack(const struct libmv_Reconstruction * /*libmv_reconstruction*/, int /*track*/) { return 0.0; } -double libmv_reporojectionErrorForImage(const libmv_Reconstruction * /*libmv_reconstruction*/, int /*image*/) +double libmv_reprojectionErrorForImage(const struct libmv_Reconstruction * /*libmv_reconstruction*/, int /*image*/) { return 0.0; } -int libmv_reporojectionCameraForImage(const libmv_Reconstruction * /*libmv_reconstruction*/, int /*image*/, +int libmv_reprojectionCameraForImage(const struct libmv_Reconstruction * /*libmv_reconstruction*/, int /*image*/, double /*mat*/[4][4]) { return 0; } -double libmv_reprojectionError(const libmv_Reconstruction * /*libmv_reconstruction*/) +double libmv_reprojectionError(const struct libmv_Reconstruction * /*libmv_reconstruction*/) { return 0.0; } -void libmv_destroyReconstruction(libmv_Reconstruction * /*libmv_reconstruction*/) +void libmv_reconstructionDestroy(struct libmv_Reconstruction * /*libmv_reconstruction*/) { } /* ************ feature detector ************ */ -struct libmv_Features *libmv_detectFeaturesFAST(const unsigned char * /*data*/, - int /*width*/, int /*height*/, int /*stride*/, - int /*margin*/, int /*min_trackness*/, int /*min_distance*/) +struct libmv_Features *libmv_detectFeaturesFAST(const unsigned char * /*data*/, int /*width*/, int /*height*/, + int /*stride*/, int /*margin*/, int /*min_trackness*/, + int /*min_distance*/) { return NULL; } -struct libmv_Features *libmv_detectFeaturesMORAVEC(const unsigned char * /*data*/, - int /*width*/, int /*height*/, int /*stride*/, - int /*margin*/, int /*count*/, int /*min_distance*/) +struct libmv_Features *libmv_detectFeaturesMORAVEC(const unsigned char * /*data*/, int /*width*/, int /*height*/, + int /*stride*/, int /*margin*/, int /*count*/, int /*min_distance*/) { return NULL; } @@ -173,49 +173,50 @@ void libmv_getFeature(const struct libmv_Features * /*libmv_features*/, int /*nu *size = 0.0; } -void libmv_destroyFeatures(struct libmv_Features * /*libmv_features*/) +void libmv_featuresDestroy(struct libmv_Features * /*libmv_features*/) { } /* ************ camera intrinsics ************ */ -struct libmv_CameraIntrinsics *libmv_ReconstructionExtractIntrinsics( - struct libmv_Reconstruction * /*libmv_Reconstruction*/) +struct libmv_CameraIntrinsics *libmv_reconstructionExtractIntrinsics( + struct libmv_Reconstruction * /*libmv_reconstruction*/) { return NULL; } -struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNewEmpty(void) +struct libmv_CameraIntrinsics *libmv_cameraIntrinsicsNewEmpty(void) { return NULL; } -struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNew(const libmv_cameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/) +struct libmv_CameraIntrinsics *libmv_cameraIntrinsicsNew( + const libmv_CameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/) { return NULL; } -struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsCopy(const struct libmv_CameraIntrinsics * /*libmvIntrinsics*/) +struct libmv_CameraIntrinsics *libmv_cameraIntrinsicsCopy(const libmv_CameraIntrinsics * /*libmvIntrinsics*/) { return NULL; } -void libmv_CameraIntrinsicsDestroy(struct libmv_CameraIntrinsics * /*libmvIntrinsics*/) +void libmv_cameraIntrinsicsDestroy(struct libmv_CameraIntrinsics * /*libmvIntrinsics*/) { } -void libmv_CameraIntrinsicsUpdate(const libmv_cameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/, - libmv_CameraIntrinsics * /*libmv_intrinsics*/) +void libmv_cameraIntrinsicsUpdate(const libmv_CameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/, + struct libmv_CameraIntrinsics * /*libmv_intrinsics*/) { } -void libmv_CameraIntrinsicsSetThreads(struct libmv_CameraIntrinsics * /*libmv_intrinsics*/, int /*threads*/) +void libmv_cameraIntrinsicsSetThreads(struct libmv_CameraIntrinsics * /*libmv_intrinsics*/, int /*threads*/) { } -void libmv_CameraIntrinsicsExtract(const struct libmv_CameraIntrinsics * /*libmv_intrinsics*/, double * focal_length, - double * principal_x, double *principal_y, double *k1, double *k2, double *k3, - int *width, int *height) +void libmv_cameraIntrinsicsExtract(const struct libmv_CameraIntrinsics * /*libmv_intrinsics*/, double * focal_length, + double * principal_x, double *principal_y, double *k1, double *k2, double *k3, + int *width, int *height) { *focal_length = 1.0; *principal_x = 0.0; @@ -226,33 +227,35 @@ void libmv_CameraIntrinsicsExtract(const struct libmv_CameraIntrinsics * /*libmv *height = 0.0; } -void libmv_CameraIntrinsicsUndistortByte(const struct libmv_CameraIntrinsics * /*libmv_intrinsics*/, - unsigned char *src, unsigned char *dst, int width, int height, float overscan, int channels) +void libmv_cameraIntrinsicsUndistortByte(const struct libmv_CameraIntrinsics * /*libmv_intrinsics*/, + unsigned char *src, unsigned char *dst, int width, int height, + float overscan, int channels) { memcpy(dst, src, channels * width * height * sizeof(unsigned char)); } -void libmv_CameraIntrinsicsUndistortFloat(const struct libmv_CameraIntrinsics * /*libmvIntrinsics*/, - float *src, float *dst, int width, int height, float overscan, int channels) +void libmv_cameraIntrinsicsUndistortFloat(const struct libmv_CameraIntrinsics * /*libmvIntrinsics*/, + float *src, float *dst, int width, int height, float overscan, int channels) { memcpy(dst, src, channels * width * height * sizeof(float)); } -void libmv_CameraIntrinsicsDistortByte(const struct libmv_CameraIntrinsics *libmvIntrinsics, - unsigned char *src, unsigned char *dst, int width, int height, float overscan, int channels) +void libmv_cameraIntrinsicsDistortByte(const struct libmv_CameraIntrinsics *libmvIntrinsics, + unsigned char *src, unsigned char *dst, int width, int height, + float overscan, int channels) { memcpy(dst, src, channels * width * height * sizeof(unsigned char)); } -void libmv_CameraIntrinsicsDistortFloat(const struct libmv_CameraIntrinsics *libmvIntrinsics, - float *src, float *dst, int width, int height, float overscan, int channels) +void libmv_cameraIntrinsicsDistortFloat(const struct libmv_CameraIntrinsics *libmvIntrinsics, + float *src, float *dst, int width, int height, float overscan, int channels) { memcpy(dst, src, channels * width * height * sizeof(float)); } /* ************ utils ************ */ -void libmv_ApplyCameraIntrinsics(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options, +void libmv_cameraIntrinsicsApply(const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options, double x, double y, double *x1, double *y1) { double focal_length = libmv_camera_intrinsics_options->focal_length; @@ -263,7 +266,7 @@ void libmv_ApplyCameraIntrinsics(const libmv_cameraIntrinsicsOptions *libmv_came *y1 = y * focal_length + principal_y; } -void libmv_InvertCameraIntrinsics(const libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options, +void libmv_cameraIntrinsicsInvert(const libmv_CameraIntrinsicsOptions *libmv_camera_intrinsics_options, double x, double y, double *x1, double *y1) { double focal_length = libmv_camera_intrinsics_options->focal_length; diff --git a/extern/libredcode/codec.c b/extern/libredcode/codec.c index 4a2dcdd6f5b..70c875ca991 100644 --- a/extern/libredcode/codec.c +++ b/extern/libredcode/codec.c @@ -1,3 +1,25 @@ +/* ***** BEGIN GPL LICENSE BLOCK ***** + * + * Copyright 2008 Peter Schlaile + * + * This file is part of libredcode. + * + * Libredcode is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Libredcode is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with libredcode; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK *****/ + #include "codec.h" #include "format.h" #include "debayer.h" diff --git a/extern/libredcode/codec.h b/extern/libredcode/codec.h index dd239180c10..6f7092672ee 100644 --- a/extern/libredcode/codec.h +++ b/extern/libredcode/codec.h @@ -1,3 +1,25 @@ +/* ***** BEGIN GPL LICENSE BLOCK ***** + * + * Copyright 2008 Peter Schlaile + * + * This file is part of libredcode. + * + * Libredcode is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Libredcode is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Libredcode; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK *****/ + #ifndef __CODEC_H__ #define __CODEC_H__ diff --git a/extern/libredcode/debayer.c b/extern/libredcode/debayer.c index de7bec510cb..a236fed1749 100644 --- a/extern/libredcode/debayer.c +++ b/extern/libredcode/debayer.c @@ -1,3 +1,25 @@ +/* ***** BEGIN GPL LICENSE BLOCK ***** + * + * Copyright 2008 Peter Schlaile + * + * This file is part of libredcode. + * + * Libredcode is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Libredcode is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Libredcode; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK *****/ + #include "debayer.h" /* pretty simple but astonishingly very effective "debayer" function diff --git a/extern/libredcode/debayer.h b/extern/libredcode/debayer.h index 43564240cc2..31f3dd01fea 100644 --- a/extern/libredcode/debayer.h +++ b/extern/libredcode/debayer.h @@ -1,3 +1,25 @@ +/* ***** BEGIN GPL LICENSE BLOCK ***** + * + * Copyright 2008 Peter Schlaile + * + * This file is part of libredcode. + * + * Libredcode is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Libredcode is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Libredcode; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK *****/ + #ifndef __DEBAYER_H__ #define __DEBAYER_H__ diff --git a/extern/libredcode/format.c b/extern/libredcode/format.c index cf8f9d5faa7..8c6cae5234e 100644 --- a/extern/libredcode/format.c +++ b/extern/libredcode/format.c @@ -1,3 +1,25 @@ +/* ***** BEGIN GPL LICENSE BLOCK ***** + * + * Copyright 2008 Peter Schlaile + * + * This file is part of libredcode. + * + * Libredcode is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Libredcode is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Libredcode; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK *****/ + #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/extern/libredcode/format.h b/extern/libredcode/format.h index 3cee804aa9d..473a2b1a8d9 100644 --- a/extern/libredcode/format.h +++ b/extern/libredcode/format.h @@ -1,3 +1,25 @@ +/* ***** BEGIN GPL LICENSE BLOCK ***** + * + * Copyright 2008 Peter Schlaile + * + * This file is part of libredcode. + * + * Libredcode is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Libredcode is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Libredcode; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK *****/ + #ifndef __FORMAT_H__ #define __FORMAT_H__ diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp index 3d830df83e8..ba961f0cb78 100644 --- a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp +++ b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.cpp @@ -347,10 +347,6 @@ void AUD_FFMPEGReader::seek(int position) uint64_t st_time = m_formatCtx->start_time; uint64_t seek_pos = ((uint64_t)position) * ((uint64_t)AV_TIME_BASE) / ((uint64_t)m_specs.rate); - if (seek_pos < 0) { - seek_pos = 0; - } - if (st_time != AV_NOPTS_VALUE) { seek_pos += st_time; } diff --git a/intern/bsp/CMakeLists.txt b/intern/bsp/CMakeLists.txt index e3907c5273d..5a2e3538e0a 100644 --- a/intern/bsp/CMakeLists.txt +++ b/intern/bsp/CMakeLists.txt @@ -28,10 +28,10 @@ set(INC ../container ../guardedalloc ../memutil - ../moto/include ) set(INC_SYS + ../moto/include ../../extern/carve/include ) diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index cc132a2c3b2..82029e3a7af 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -25,6 +25,10 @@ elseif(CMAKE_COMPILER_IS_GNUCC) set(CYCLES_SSE2_KERNEL_FLAGS "-ffast-math -msse -msse2 -mfpmath=sse") set(CYCLES_SSE3_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3 -mfpmath=sse") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math") +elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CYCLES_SSE2_KERNEL_FLAGS "-ffast-math -msse -msse2") + set(CYCLES_SSE3_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math") endif() # for OSL diff --git a/intern/cycles/app/cycles_test.cpp b/intern/cycles/app/cycles_test.cpp index 625e8cc1706..6d7c5912cb5 100644 --- a/intern/cycles/app/cycles_test.cpp +++ b/intern/cycles/app/cycles_test.cpp @@ -181,7 +181,7 @@ static void resize(int width, int height) options.session->reset(session_buffer_params(), options.session_params.samples); } -void keyboard(unsigned char key) +static void keyboard(unsigned char key) { if(key == 'r') options.session->reset(session_buffer_params(), options.session_params.samples); diff --git a/intern/cycles/blender/addon/__init__.py b/intern/cycles/blender/addon/__init__.py index b451b8ef3bf..cefdf504206 100644 --- a/intern/cycles/blender/addon/__init__.py +++ b/intern/cycles/blender/addon/__init__.py @@ -41,6 +41,7 @@ class CyclesRender(bpy.types.RenderEngine): bl_use_shading_nodes = True bl_use_preview = True bl_use_exclude_layers = True + bl_use_save_buffers = True def __init__(self): self.session = None diff --git a/intern/cycles/blender/addon/presets.py b/intern/cycles/blender/addon/presets.py index e2836b2cc21..d1f8e7c3a6d 100644 --- a/intern/cycles/blender/addon/presets.py +++ b/intern/cycles/blender/addon/presets.py @@ -46,6 +46,36 @@ class AddPresetIntegrator(AddPresetBase, Operator): preset_subdir = "cycles/integrator" +class AddPresetSampling(AddPresetBase, Operator): + '''Add a Sampling Preset''' + bl_idname = "render.cycles_sampling_preset_add" + bl_label = "Add Sampling Preset" + preset_menu = "CYCLES_MT_sampling_presets" + + preset_defines = [ + "cycles = bpy.context.scene.cycles" + ] + + preset_values = [ + "cycles.samples", + "cycles.preview_samples", + "cycles.aa_samples", + "cycles.preview_aa_samples", + "cycles.diffuse_samples", + "cycles.glossy_samples", + "cycles.transmission_samples", + "cycles.ao_samples", + "cycles.mesh_light_samples", + "cycles.subsurface_samples", + "cycles.no_caustics", + "cycles.blur_glossy", + "cycles.squared_samples", + "cycles.progressive" + ] + + preset_subdir = "cycles/sampling" + + def register(): pass diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index ca49ffccd2a..eba94604a88 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -150,6 +150,11 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): description="Use progressive sampling of lighting", default=True, ) + cls.squared_samples = BoolProperty( + name="Squared Samples", + description="Square sampling values for easier artist control", + default=False, + ) cls.samples = IntProperty( name="Samples", diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index b80ab6b1c5e..1a17675cb71 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -23,6 +23,14 @@ import bpy from bpy.types import Panel, Menu, Operator +class CYCLES_MT_sampling_presets(Menu): + bl_label = "Sampling Presets" + preset_subdir = "cycles/sampling" + preset_operator = "script.execute_preset" + COMPAT_ENGINES = {'CYCLES'} + draw = Menu.draw_preset + + class CYCLES_MT_integrator_presets(Menu): bl_label = "Integrator Presets" preset_subdir = "cycles/integrator" @@ -52,20 +60,30 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel): scene = context.scene cscene = scene.cycles device_type = context.user_preferences.system.compute_device_type + + row = layout.row(align=True) + row.menu("CYCLES_MT_sampling_presets", text=bpy.types.CYCLES_MT_sampling_presets.bl_label) + row.operator("render.cycles_sampling_preset_add", text="", icon="ZOOMIN") + row.operator("render.cycles_sampling_preset_add", text="", icon="ZOOMOUT").remove_active = True + row = layout.row() + sub = row.row() + sub.active = (device_type == 'NONE' or cscene.device == 'CPU') + sub.prop(cscene, "progressive") + row.prop(cscene, "squared_samples") + split = layout.split() - + col = split.column() - col.prop(cscene, "progressive") - sub = col.column(align=True) + sub.label("Settings:") sub.prop(cscene, "seed") sub.prop(cscene, "sample_clamp") - if cscene.progressive: + if cscene.progressive or (device_type != 'NONE' and cscene.device == 'GPU'): col = split.column() - col.label(text="Samples:") sub = col.column(align=True) + sub.label(text="Samples:") sub.prop(cscene, "samples", text="Render") sub.prop(cscene, "preview_samples", text="Preview") else: @@ -74,8 +92,8 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel): sub.prop(cscene, "preview_aa_samples", text="Preview") col = split.column() - col.label(text="Samples:") sub = col.column(align=True) + sub.label(text="Samples:") sub.prop(cscene, "diffuse_samples", text="Diffuse") sub.prop(cscene, "glossy_samples", text="Glossy") sub.prop(cscene, "transmission_samples", text="Transmission") @@ -211,21 +229,23 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel): subsub.enabled = not rd.use_border subsub.prop(rd, "use_save_buffers") - col = split.column() + col = split.column(align=True) - sub = col.column(align=True) - sub.label(text="Acceleration structure:") - sub.prop(cscene, "debug_bvh_type", text="") - sub.prop(cscene, "debug_use_spatial_splits") - sub.prop(cscene, "use_cache") + col.label(text="Viewport:") + col.prop(cscene, "debug_bvh_type", text="") + col.separator() + col.prop(cscene, "preview_start_resolution") - sub = col.column(align=True) - sub.label(text="Viewport:") - sub.prop(cscene, "preview_start_resolution") + col.separator() - sub = col.column(align=True) - sub.label(text="Final Render:") - sub.prop(rd, "use_persistent_data", text="Persistent Images") + col.label(text="Final Render:") + col.prop(cscene, "use_cache") + col.prop(rd, "use_persistent_data", text="Persistent Images") + + col.separator() + + col.label(text="Acceleration structure:") + col.prop(cscene, "debug_use_spatial_splits") class CyclesRender_PT_opengl(CyclesButtonsPanel, Panel): @@ -628,6 +648,7 @@ class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel): lamp = context.lamp clamp = lamp.cycles cscene = context.scene.cycles + device_type = context.user_preferences.system.compute_device_type layout.prop(lamp, "type", expand=True) @@ -646,7 +667,7 @@ class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel): sub.prop(lamp, "size", text="Size X") sub.prop(lamp, "size_y", text="Size Y") - if not cscene.progressive: + if not cscene.progressive and (device_type == 'NONE' or cscene.device == 'CPU'): col.prop(clamp, "samples") col = split.column() @@ -835,6 +856,7 @@ class CyclesWorld_PT_settings(CyclesButtonsPanel, Panel): world = context.world cworld = world.cycles cscene = context.scene.cycles + device_type = context.user_preferences.system.compute_device_type col = layout.column() @@ -842,7 +864,7 @@ class CyclesWorld_PT_settings(CyclesButtonsPanel, Panel): sub = col.row(align=True) sub.active = cworld.sample_as_light sub.prop(cworld, "sample_map_resolution") - if not cscene.progressive: + if not cscene.progressive and (device_type == 'NONE' or cscene.device == 'CPU'): sub.prop(cworld, "samples") diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index d628fa04f92..55282a1ec00 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -212,13 +212,27 @@ static void mikk_compute_tangents(BL::Mesh b_mesh, BL::MeshTextureFaceLayer b_la static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<uint>& used_shaders) { - /* create vertices */ + /* count vertices and faces */ + int numverts = b_mesh.vertices.length(); + int numfaces = b_mesh.tessfaces.length(); + int numtris = 0; + BL::Mesh::vertices_iterator v; + BL::Mesh::tessfaces_iterator f; - for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end(); ++v) - mesh->verts.push_back(get_float3(v->co())); + for(b_mesh.tessfaces.begin(f); f != b_mesh.tessfaces.end(); ++f) { + int4 vi = get_int4(f->vertices_raw()); + numtris += (vi[3] == 0)? 1: 2; + } + + /* reserve memory */ + mesh->reserve(numverts, numtris, 0, 0); + + /* create vertex coordinates and normals */ + int i = 0; + for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end(); ++v, ++i) + mesh->verts[i] = get_float3(v->co()); - /* create vertex normals */ Attribute *attr_N = mesh->attributes.add(ATTR_STD_VERTEX_NORMAL); float3 *N = attr_N->data_float3(); @@ -226,10 +240,10 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector< *N = get_float3(v->normal()); /* create faces */ - BL::Mesh::tessfaces_iterator f; - vector<int> nverts; + vector<int> nverts(numfaces); + int fi = 0, ti = 0; - for(b_mesh.tessfaces.begin(f); f != b_mesh.tessfaces.end(); ++f) { + for(b_mesh.tessfaces.begin(f); f != b_mesh.tessfaces.end(); ++f, ++fi) { int4 vi = get_int4(f->vertices_raw()); int n = (vi[3] == 0)? 3: 4; int mi = clamp(f->material_index(), 0, used_shaders.size()-1); @@ -239,18 +253,18 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector< if(n == 4) { if(len_squared(cross(mesh->verts[vi[1]] - mesh->verts[vi[0]], mesh->verts[vi[2]] - mesh->verts[vi[0]])) == 0.0f || len_squared(cross(mesh->verts[vi[2]] - mesh->verts[vi[0]], mesh->verts[vi[3]] - mesh->verts[vi[0]])) == 0.0f) { - mesh->add_triangle(vi[0], vi[1], vi[3], shader, smooth); - mesh->add_triangle(vi[2], vi[3], vi[1], shader, smooth); + mesh->set_triangle(ti++, vi[0], vi[1], vi[3], shader, smooth); + mesh->set_triangle(ti++, vi[2], vi[3], vi[1], shader, smooth); } else { - mesh->add_triangle(vi[0], vi[1], vi[2], shader, smooth); - mesh->add_triangle(vi[0], vi[2], vi[3], shader, smooth); + mesh->set_triangle(ti++, vi[0], vi[1], vi[2], shader, smooth); + mesh->set_triangle(ti++, vi[0], vi[2], vi[3], shader, smooth); } } else - mesh->add_triangle(vi[0], vi[1], vi[2], shader, smooth); + mesh->set_triangle(ti++, vi[0], vi[1], vi[2], shader, smooth); - nverts.push_back(n); + nverts[fi] = n; } /* create vertex color attributes */ @@ -448,7 +462,6 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tri mesh_synced.insert(mesh); /* create derived mesh */ - bool need_undeformed = mesh->need_attribute(scene, ATTR_STD_GENERATED); PointerRNA cmesh = RNA_pointer_get(&b_ob_data.ptr, "cycles"); vector<Mesh::Triangle> oldtriangle = mesh->triangles; @@ -462,6 +475,10 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tri mesh->name = ustring(b_ob_data.name().c_str()); if(render_layer.use_surfaces || render_layer.use_hair) { + if(preview) + b_ob.update_from_editmode(); + + bool need_undeformed = mesh->need_attribute(scene, ATTR_STD_GENERATED); BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview, need_undeformed); if(b_mesh) { diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index 4a72341cd8c..b2235c36af0 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -154,10 +154,16 @@ void BlenderSync::sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSI light->shader = used_shaders[0]; /* shadow */ + PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles"); PointerRNA clamp = RNA_pointer_get(&b_lamp.ptr, "cycles"); light->cast_shadow = get_boolean(clamp, "cast_shadow"); light->use_mis = get_boolean(clamp, "use_multiple_importance_sampling"); - light->samples = get_int(clamp, "samples"); + + int samples = get_int(clamp, "samples"); + if(get_boolean(cscene, "squared_samples")) + light->samples = samples * samples; + else + light->samples = samples; /* visibility */ uint visibility = object_ray_visibility(b_ob); @@ -174,6 +180,7 @@ void BlenderSync::sync_background_light() BL::World b_world = b_scene.world(); if(b_world) { + PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles"); PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles"); bool sample_as_light = get_boolean(cworld, "sample_as_light"); @@ -188,8 +195,13 @@ void BlenderSync::sync_background_light() { light->type = LIGHT_BACKGROUND; light->map_resolution = get_int(cworld, "sample_map_resolution"); - light->samples = get_int(cworld, "samples"); light->shader = scene->default_background; + + int samples = get_int(cworld, "samples"); + if(get_boolean(cscene, "squared_samples")) + light->samples = samples * samples; + else + light->samples = samples; light->tag_update(scene); light_map.set_recalc(b_world); @@ -304,7 +316,7 @@ Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_P } if (b_dupli_ob) { - object->dupli_generated = get_float3(b_dupli_ob.orco()); + object->dupli_generated = 0.5f*get_float3(b_dupli_ob.orco()) - make_float3(0.5f, 0.5f, 0.5f); object->dupli_uv = get_float2(b_dupli_ob.uv()); } else { diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index 86bdbc0749f..3a46897fcac 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -279,6 +279,11 @@ void BlenderSession::do_write_update_render_tile(RenderTile& rtile, bool do_upda BL::RenderResult::layers_iterator b_single_rlay; b_rr.layers.begin(b_single_rlay); + + /* layer will be missing if it was disabled in the UI */ + if(b_single_rlay == b_rr.layers.end()) + return; + BL::RenderLayer b_rlay = *b_single_rlay; if (do_update_only) { diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index d0b83d9e553..469ba15d291 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -260,8 +260,8 @@ static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scen BL::ShaderNodeVectorTransform b_vector_transform_node(b_node); VectorTransformNode *vtransform = new VectorTransformNode(); vtransform->type = VectorTransformNode::type_enum[b_vector_transform_node.type()]; - vtransform->convert_from = VectorTransformNode::convert_from_enum[b_vector_transform_node.convert_from()]; - vtransform->convert_to = VectorTransformNode::convert_to_enum[b_vector_transform_node.convert_to()]; + vtransform->convert_from = VectorTransformNode::convert_space_enum[b_vector_transform_node.convert_from()]; + vtransform->convert_to = VectorTransformNode::convert_space_enum[b_vector_transform_node.convert_to()]; node = vtransform; } else if (b_node.is_a(&RNA_ShaderNodeNormal)) { diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index be5f0692dbd..11e2be5e0fb 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -191,14 +191,33 @@ void BlenderSync::sync_integrator() } #endif - integrator->diffuse_samples = get_int(cscene, "diffuse_samples"); - integrator->glossy_samples = get_int(cscene, "glossy_samples"); - integrator->transmission_samples = get_int(cscene, "transmission_samples"); - integrator->ao_samples = get_int(cscene, "ao_samples"); - integrator->mesh_light_samples = get_int(cscene, "mesh_light_samples"); - integrator->subsurface_samples = get_int(cscene, "subsurface_samples"); integrator->progressive = get_boolean(cscene, "progressive"); + int diffuse_samples = get_int(cscene, "diffuse_samples"); + int glossy_samples = get_int(cscene, "glossy_samples"); + int transmission_samples = get_int(cscene, "transmission_samples"); + int ao_samples = get_int(cscene, "ao_samples"); + int mesh_light_samples = get_int(cscene, "mesh_light_samples"); + int subsurface_samples = get_int(cscene, "subsurface_samples"); + + if(get_boolean(cscene, "squared_samples")) { + integrator->diffuse_samples = diffuse_samples * diffuse_samples; + integrator->glossy_samples = glossy_samples * glossy_samples; + integrator->transmission_samples = transmission_samples * transmission_samples; + integrator->ao_samples = ao_samples * ao_samples; + integrator->mesh_light_samples = mesh_light_samples * mesh_light_samples; + integrator->subsurface_samples = subsurface_samples * subsurface_samples; + } + else { + integrator->diffuse_samples = diffuse_samples; + integrator->glossy_samples = glossy_samples; + integrator->transmission_samples = transmission_samples; + integrator->ao_samples = ao_samples; + integrator->mesh_light_samples = mesh_light_samples; + integrator->subsurface_samples = subsurface_samples; + } + + if(experimental) integrator->sampling_pattern = (SamplingPattern)RNA_enum_get(&cscene, "sampling_pattern"); @@ -300,8 +319,13 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer) render_layer.use_localview = false; render_layer.bound_samples = (use_layer_samples == 1); - if(use_layer_samples != 2) - render_layer.samples = b_rlay->samples(); + if(use_layer_samples != 2) { + int samples = b_rlay->samples(); + if(get_boolean(cscene, "squared_samples")) + render_layer.samples = samples * samples; + else + render_layer.samples = samples; + } } first_layer = false; @@ -385,24 +409,36 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use params.background = background; /* samples */ - if(get_boolean(cscene, "progressive") == 0) { + int samples = get_int(cscene, "samples"); + int aa_samples = get_int(cscene, "aa_samples"); + int preview_samples = get_int(cscene, "preview_samples"); + int preview_aa_samples = get_int(cscene, "preview_aa_samples"); + + if(get_boolean(cscene, "squared_samples")) { + samples = samples * samples; + aa_samples = aa_samples * aa_samples; + preview_samples = preview_samples * preview_samples; + preview_aa_samples = preview_aa_samples * preview_aa_samples; + } + + if(get_boolean(cscene, "progressive") == 0 && params.device.type == DEVICE_CPU) { if(background) { - params.samples = get_int(cscene, "aa_samples"); + params.samples = aa_samples; } else { - params.samples = get_int(cscene, "preview_aa_samples"); + params.samples = preview_aa_samples; if(params.samples == 0) - params.samples = INT_MAX; + params.samples = USHRT_MAX; } } else { if(background) { - params.samples = get_int(cscene, "samples"); + params.samples = samples; } else { - params.samples = get_int(cscene, "preview_samples"); + params.samples = preview_samples; if(params.samples == 0) - params.samples = INT_MAX; + params.samples = USHRT_MAX; } } diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h index ed1f2b9d70f..da86bafa936 100644 --- a/intern/cycles/blender/blender_sync.h +++ b/intern/cycles/blender/blender_sync.h @@ -127,6 +127,7 @@ private: use_surfaces(true), use_hair(true), use_viewport_visibility(false), + use_localview(false), samples(0), bound_samples(false) {} diff --git a/intern/cycles/bvh/bvh.h b/intern/cycles/bvh/bvh.h index 00c146143b8..f2c96638b84 100644 --- a/intern/cycles/bvh/bvh.h +++ b/intern/cycles/bvh/bvh.h @@ -46,7 +46,7 @@ class Progress; struct PackedBVH { /* BVH nodes storage, one node is 4x int4, and contains two bounding boxes, - * and child, triangle or object indexes dependening on the node type */ + * and child, triangle or object indexes depending on the node type */ array<int4> nodes; /* object index to BVH node index mapping for instances */ array<int> object_node; diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h index e6d3922d3be..7b31b9ba157 100644 --- a/intern/cycles/device/device.h +++ b/intern/cycles/device/device.h @@ -53,7 +53,6 @@ public: string description; string id; int num; - int extended_images; bool display_device; bool advanced_shading; bool pack_images; @@ -64,7 +63,6 @@ public: type = DEVICE_CPU; id = "CPU"; num = 0; - extended_images = false; display_device = false; advanced_shading = true; pack_images = false; diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index e0e06683883..7bc84878dab 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -307,8 +307,7 @@ public: void task_add(DeviceTask& task) { - /* split task into smaller ones, more than number of threads for uneven - * workloads where some parts of the image render slower than others */ + /* split task into smaller ones */ list<DeviceTask> tasks; task.split(tasks, TaskScheduler::num_threads()); @@ -340,7 +339,6 @@ void device_cpu_info(vector<DeviceInfo>& devices) info.description = system_cpu_brand_string(); info.id = "CPU"; info.num = 0; - info.extended_images = true; info.advanced_shading = true; info.pack_images = false; diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp index 65dd001f70f..4441ff1c69f 100644 --- a/intern/cycles/device/device_cuda.cpp +++ b/intern/cycles/device/device_cuda.cpp @@ -1021,7 +1021,6 @@ void device_cuda_info(vector<DeviceInfo>& devices) int major, minor; cuDeviceComputeCapability(&major, &minor, num); info.advanced_shading = (major >= 2); - info.extended_images = (major >= 3); info.pack_images = false; /* if device has a kernel timeout, assume it is used for display */ diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp index 02db5b84831..807bfe578f3 100644 --- a/intern/cycles/device/device_multi.cpp +++ b/intern/cycles/device/device_multi.cpp @@ -330,7 +330,6 @@ static bool device_multi_add(vector<DeviceInfo>& devices, DeviceType type, bool info.advanced_shading = with_advanced_shading; info.pack_images = false; - info.extended_images = true; foreach(DeviceInfo& subinfo, devices) { if(subinfo.type == type) { @@ -354,7 +353,6 @@ static bool device_multi_add(vector<DeviceInfo>& devices, DeviceType type, bool if(subinfo.display_device) info.display_device = true; info.pack_images = info.pack_images || subinfo.pack_images; - info.extended_images = info.extended_images && subinfo.extended_images; num_added++; } } diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h index 4b9ef8893f7..c3cffc15ebe 100644 --- a/intern/cycles/kernel/kernel_camera.h +++ b/intern/cycles/kernel/kernel_camera.h @@ -166,6 +166,12 @@ __device void camera_sample_panorama(KernelGlobals *kg, float raster_x, float ra ray->D = panorama_to_direction(kg, Pcamera.x, Pcamera.y); + /* indicates ray should not receive any light, outside of the lens */ + if(is_zero(ray->D)) { + ray->t = 0.0f; + return; + } + /* modify ray for depth of field */ float aperturesize = kernel_data.cam.aperturesize; @@ -186,12 +192,6 @@ __device void camera_sample_panorama(KernelGlobals *kg, float raster_x, float ra ray->D = normalize(Pfocus - ray->P); } - /* indicates ray should not receive any light, outside of the lens */ - if(is_zero(ray->D)) { - ray->t = 0.0f; - return; - } - /* transform ray from camera to world */ Transform cameratoworld = kernel_data.cam.cameratoworld; diff --git a/intern/cycles/kernel/kernel_displace.h b/intern/cycles/kernel/kernel_displace.h index ae2e35e8d93..b4ece1610be 100644 --- a/intern/cycles/kernel/kernel_displace.h +++ b/intern/cycles/kernel/kernel_displace.h @@ -57,7 +57,7 @@ __device void kernel_shader_evaluate(KernelGlobals *kg, __global uint4 *input, _ #endif /* setup shader data */ - shader_setup_from_background(kg, &sd, &ray); + shader_setup_from_background(kg, &sd, &ray, 0); /* evaluate */ int flag = 0; /* we can't know which type of BSDF this is for */ diff --git a/intern/cycles/kernel/kernel_emission.h b/intern/cycles/kernel/kernel_emission.h index 77dc59d2691..a6bd3ed2850 100644 --- a/intern/cycles/kernel/kernel_emission.h +++ b/intern/cycles/kernel/kernel_emission.h @@ -21,7 +21,7 @@ CCL_NAMESPACE_BEGIN /* Direction Emission */ __device_noinline float3 direct_emissive_eval(KernelGlobals *kg, float rando, - LightSample *ls, float u, float v, float3 I, differential3 dI, float t, float time) + LightSample *ls, float u, float v, float3 I, differential3 dI, float t, float time, int bounce) { /* setup shading at emitter */ ShaderData sd; @@ -41,7 +41,7 @@ __device_noinline float3 direct_emissive_eval(KernelGlobals *kg, float rando, #ifdef __CAMERA_MOTION__ ray.time = time; #endif - shader_setup_from_background(kg, &sd, &ray); + shader_setup_from_background(kg, &sd, &ray, bounce+1); eval = shader_eval_background(kg, &sd, 0, SHADER_CONTEXT_EMISSION); } else @@ -49,10 +49,10 @@ __device_noinline float3 direct_emissive_eval(KernelGlobals *kg, float rando, { #ifdef __HAIR__ if(ls->type == LIGHT_STRAND) - shader_setup_from_sample(kg, &sd, ls->P, ls->Ng, I, ls->shader, ls->object, ls->prim, u, v, t, time, ls->prim); + shader_setup_from_sample(kg, &sd, ls->P, ls->Ng, I, ls->shader, ls->object, ls->prim, u, v, t, time, bounce+1, ls->prim); else #endif - shader_setup_from_sample(kg, &sd, ls->P, ls->Ng, I, ls->shader, ls->object, ls->prim, u, v, t, time, ~0); + shader_setup_from_sample(kg, &sd, ls->P, ls->Ng, I, ls->shader, ls->object, ls->prim, u, v, t, time, bounce+1, ~0); ls->Ng = sd.Ng; @@ -74,7 +74,7 @@ __device_noinline float3 direct_emissive_eval(KernelGlobals *kg, float rando, __device_noinline bool direct_emission(KernelGlobals *kg, ShaderData *sd, int lindex, float randt, float rando, float randu, float randv, Ray *ray, BsdfEval *eval, - bool *is_lamp) + bool *is_lamp, int bounce) { LightSample ls; @@ -97,7 +97,7 @@ __device_noinline bool direct_emission(KernelGlobals *kg, ShaderData *sd, int li differential3 dD = differential3_zero(); /* evaluate closure */ - float3 light_eval = direct_emissive_eval(kg, rando, &ls, randu, randv, -ls.D, dD, ls.t, sd->time); + float3 light_eval = direct_emissive_eval(kg, rando, &ls, randu, randv, -ls.D, dD, ls.t, sd->time, bounce); if(is_zero(light_eval)) return false; @@ -185,7 +185,7 @@ __device_noinline float3 indirect_primitive_emission(KernelGlobals *kg, ShaderDa /* Indirect Lamp Emission */ -__device_noinline bool indirect_lamp_emission(KernelGlobals *kg, Ray *ray, int path_flag, float bsdf_pdf, float randt, float3 *emission) +__device_noinline bool indirect_lamp_emission(KernelGlobals *kg, Ray *ray, int path_flag, float bsdf_pdf, float randt, float3 *emission, int bounce) { LightSample ls; int lamp = lamp_light_eval_sample(kg, randt); @@ -209,7 +209,7 @@ __device_noinline bool indirect_lamp_emission(KernelGlobals *kg, Ray *ray, int p /* todo: missing texture coordinates */ float u = 0.0f; float v = 0.0f; - float3 L = direct_emissive_eval(kg, 0.0f, &ls, u, v, -ray->D, ray->dD, ls.t, ray->time); + float3 L = direct_emissive_eval(kg, 0.0f, &ls, u, v, -ray->D, ray->dD, ls.t, ray->time, bounce); if(!(path_flag & PATH_RAY_MIS_SKIP)) { /* multiple importance sampling, get regular light pdf, @@ -224,7 +224,7 @@ __device_noinline bool indirect_lamp_emission(KernelGlobals *kg, Ray *ray, int p /* Indirect Background */ -__device_noinline float3 indirect_background(KernelGlobals *kg, Ray *ray, int path_flag, float bsdf_pdf) +__device_noinline float3 indirect_background(KernelGlobals *kg, Ray *ray, int path_flag, float bsdf_pdf, int bounce) { #ifdef __BACKGROUND__ int shader = kernel_data.background.shader; @@ -240,7 +240,7 @@ __device_noinline float3 indirect_background(KernelGlobals *kg, Ray *ray, int pa /* evaluate background closure */ ShaderData sd; - shader_setup_from_background(kg, &sd, ray); + shader_setup_from_background(kg, &sd, ray, bounce+1); float3 L = shader_eval_background(kg, &sd, path_flag, SHADER_CONTEXT_EMISSION); diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h index 4983122fb34..5091eac41db 100644 --- a/intern/cycles/kernel/kernel_light.h +++ b/intern/cycles/kernel/kernel_light.h @@ -271,7 +271,7 @@ __device void lamp_light_sample(KernelGlobals *kg, int lamp, ls->pdf = invarea; if(type == LIGHT_SPOT) { - /* spot light attentuation */ + /* spot light attenuation */ float4 data2 = kernel_tex_fetch(__light_data, lamp*LIGHT_SIZE + 2); ls->eval_fac *= spot_light_attenuation(data1, data2, ls); } diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index 6e1843df50d..40ecb1be91b 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -215,7 +215,7 @@ __device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *ra return true; ShaderData sd; - shader_setup_from_ray(kg, &sd, &isect, ray); + shader_setup_from_ray(kg, &sd, &isect, ray, state->bounce+1); shader_eval_surface(kg, &sd, 0.0f, PATH_RAY_SHADOW, SHADER_CONTEXT_SHADOW); throughput *= shader_bsdf_transparency(kg, &sd); @@ -300,7 +300,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample, float light_t = path_rng_1D(kg, rng, sample, num_samples, rng_offset + PRNG_LIGHT); float3 emission; - if(indirect_lamp_emission(kg, &light_ray, state.flag, ray_pdf, light_t, &emission)) + if(indirect_lamp_emission(kg, &light_ray, state.flag, ray_pdf, light_t, &emission, state.bounce)) path_radiance_accum_emission(&L, throughput, emission, state.bounce); } #endif @@ -318,7 +318,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample, #ifdef __BACKGROUND__ /* sample background shader */ - float3 L_background = indirect_background(kg, &ray, state.flag, ray_pdf); + float3 L_background = indirect_background(kg, &ray, state.flag, ray_pdf, state.bounce); path_radiance_accum_background(&L, throughput, L_background, state.bounce); #endif @@ -327,7 +327,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample, /* setup shading */ ShaderData sd; - shader_setup_from_ray(kg, &sd, &isect, &ray); + shader_setup_from_ray(kg, &sd, &isect, &ray, state.bounce); float rbsdf = path_rng_1D(kg, rng, sample, num_samples, rng_offset + PRNG_BSDF); shader_eval_surface(kg, &sd, rbsdf, state.flag, SHADER_CONTEXT_MAIN); @@ -464,7 +464,7 @@ __device float4 kernel_path_progressive(KernelGlobals *kg, RNG *rng, int sample, light_ray.time = sd.time; #endif - if(direct_emission(kg, &sd, -1, light_t, light_o, light_u, light_v, &light_ray, &L_light, &is_lamp)) { + if(direct_emission(kg, &sd, -1, light_t, light_o, light_u, light_v, &light_ray, &L_light, &is_lamp, state.bounce)) { /* trace shadow ray */ float3 shadow; @@ -575,7 +575,7 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray float light_t = path_rng_1D(kg, rng, sample, num_total_samples, rng_offset + PRNG_LIGHT); float3 emission; - if(indirect_lamp_emission(kg, &light_ray, state.flag, ray_pdf, light_t, &emission)) + if(indirect_lamp_emission(kg, &light_ray, state.flag, ray_pdf, light_t, &emission, state.bounce)) path_radiance_accum_emission(L, throughput, emission, state.bounce); } #endif @@ -583,7 +583,7 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray if(!hit) { #ifdef __BACKGROUND__ /* sample background shader */ - float3 L_background = indirect_background(kg, &ray, state.flag, ray_pdf); + float3 L_background = indirect_background(kg, &ray, state.flag, ray_pdf, state.bounce); path_radiance_accum_background(L, throughput, L_background, state.bounce); #endif @@ -592,7 +592,7 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray /* setup shading */ ShaderData sd; - shader_setup_from_ray(kg, &sd, &isect, &ray); + shader_setup_from_ray(kg, &sd, &isect, &ray, state.bounce); float rbsdf = path_rng_1D(kg, rng, sample, num_total_samples, rng_offset + PRNG_BSDF); shader_eval_surface(kg, &sd, rbsdf, state.flag, SHADER_CONTEXT_INDIRECT); shader_merge_closures(kg, &sd); @@ -706,7 +706,7 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray #endif /* sample random light */ - if(direct_emission(kg, &sd, -1, light_t, light_o, light_u, light_v, &light_ray, &L_light, &is_lamp)) { + if(direct_emission(kg, &sd, -1, light_t, light_o, light_u, light_v, &light_ray, &L_light, &is_lamp, state.bounce)) { /* trace shadow ray */ float3 shadow; @@ -838,7 +838,7 @@ __device_noinline void kernel_path_non_progressive_lighting(KernelGlobals *kg, R float light_u, light_v; path_rng_2D(kg, &lamp_rng, sample*num_samples + j, aa_samples*num_samples, rng_offset + PRNG_LIGHT_U, &light_u, &light_v); - if(direct_emission(kg, sd, i, 0.0f, 0.0f, light_u, light_v, &light_ray, &L_light, &is_lamp)) { + if(direct_emission(kg, sd, i, 0.0f, 0.0f, light_u, light_v, &light_ray, &L_light, &is_lamp, state.bounce)) { /* trace shadow ray */ float3 shadow; @@ -867,7 +867,7 @@ __device_noinline void kernel_path_non_progressive_lighting(KernelGlobals *kg, R if(kernel_data.integrator.num_all_lights) light_t = 0.5f*light_t; - if(direct_emission(kg, sd, -1, light_t, 0.0f, light_u, light_v, &light_ray, &L_light, &is_lamp)) { + if(direct_emission(kg, sd, -1, light_t, 0.0f, light_u, light_v, &light_ray, &L_light, &is_lamp, state.bounce)) { /* trace shadow ray */ float3 shadow; @@ -925,10 +925,7 @@ __device_noinline void kernel_path_non_progressive_lighting(KernelGlobals *kg, R path_radiance_bsdf_bounce(L, &tp, &bsdf_eval, bsdf_pdf, state.bounce, label); /* set labels */ - float min_ray_pdf = FLT_MAX; - - if(!(label & LABEL_TRANSPARENT)) - min_ray_pdf = fminf(bsdf_pdf, min_ray_pdf); + float min_ray_pdf = fminf(bsdf_pdf, FLT_MAX); /* modify path state */ PathState ps = state; @@ -1016,7 +1013,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam #ifdef __BACKGROUND__ /* sample background shader */ - float3 L_background = indirect_background(kg, &ray, state.flag, ray_pdf); + float3 L_background = indirect_background(kg, &ray, state.flag, ray_pdf, state.bounce); path_radiance_accum_background(&L, throughput, L_background, state.bounce); #endif @@ -1025,7 +1022,7 @@ __device float4 kernel_path_non_progressive(KernelGlobals *kg, RNG *rng, int sam /* setup shading */ ShaderData sd; - shader_setup_from_ray(kg, &sd, &isect, &ray); + shader_setup_from_ray(kg, &sd, &isect, &ray, state.bounce); shader_eval_surface(kg, &sd, 0.0f, state.flag, SHADER_CONTEXT_MAIN); shader_merge_closures(kg, &sd); diff --git a/intern/cycles/kernel/kernel_random.h b/intern/cycles/kernel/kernel_random.h index 6292adff6a5..c86ac34a057 100644 --- a/intern/cycles/kernel/kernel_random.h +++ b/intern/cycles/kernel/kernel_random.h @@ -141,11 +141,13 @@ __device_inline void path_rng_2D(KernelGlobals *kg, RNG *rng, int sample, int nu int p = *rng + dimension; cmj_sample_2D(sample, num_samples, p, fx, fy); } + else #endif - - /* sobol */ - *fx = path_rng_1D(kg, rng, sample, num_samples, dimension); - *fy = path_rng_1D(kg, rng, sample, num_samples, dimension + 1); + { + /* sobol */ + *fx = path_rng_1D(kg, rng, sample, num_samples, dimension); + *fy = path_rng_1D(kg, rng, sample, num_samples, dimension + 1); + } } __device_inline void path_rng_init(KernelGlobals *kg, __global uint *rng_state, int sample, int num_samples, RNG *rng, int x, int y, float *fx, float *fy) diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h index ca4d878daa0..b902230a9b9 100644 --- a/intern/cycles/kernel/kernel_shader.h +++ b/intern/cycles/kernel/kernel_shader.h @@ -64,7 +64,7 @@ __device_noinline __device #endif void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd, - const Intersection *isect, const Ray *ray) + const Intersection *isect, const Ray *ray, int bounce) { #ifdef __INSTANCING__ sd->object = (isect->object == ~0)? kernel_tex_fetch(__prim_object, isect->prim): isect->object; @@ -80,6 +80,7 @@ void shader_setup_from_ray(KernelGlobals *kg, ShaderData *sd, sd->prim = kernel_tex_fetch(__prim_index, isect->prim); sd->ray_length = isect->t; + sd->ray_depth = bounce; #ifdef __HAIR__ if(kernel_tex_fetch(__prim_segment, isect->prim) != ~0) { @@ -277,7 +278,7 @@ __device #endif void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd, const float3 P, const float3 Ng, const float3 I, - int shader, int object, int prim, float u, float v, float t, float time, int segment) + int shader, int object, int prim, float u, float v, float t, float time, int bounce, int segment) { /* vectors */ sd->P = P; @@ -300,6 +301,7 @@ void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd, sd->v = v; #endif sd->ray_length = t; + sd->ray_depth = bounce; /* detect instancing, for non-instanced the object index is -object-1 */ #ifdef __INSTANCING__ @@ -408,12 +410,12 @@ __device void shader_setup_from_displace(KernelGlobals *kg, ShaderData *sd, /* watch out: no instance transform currently */ - shader_setup_from_sample(kg, sd, P, Ng, I, shader, object, prim, u, v, 0.0f, TIME_INVALID, ~0); + shader_setup_from_sample(kg, sd, P, Ng, I, shader, object, prim, u, v, 0.0f, TIME_INVALID, 0, ~0); } /* ShaderData setup from ray into background */ -__device_inline void shader_setup_from_background(KernelGlobals *kg, ShaderData *sd, const Ray *ray) +__device_inline void shader_setup_from_background(KernelGlobals *kg, ShaderData *sd, const Ray *ray, int bounce) { /* vectors */ sd->P = ray->D; @@ -426,6 +428,7 @@ __device_inline void shader_setup_from_background(KernelGlobals *kg, ShaderData sd->time = ray->time; #endif sd->ray_length = 0.0f; + sd->ray_depth = bounce; #ifdef __INSTANCING__ sd->object = ~0; @@ -931,15 +934,8 @@ __device void shader_merge_closures(KernelGlobals *kg, ShaderData *sd) sci->sample_weight += scj->sample_weight; int size = sd->num_closure - (j+1); - if(size > 0) { -#ifdef __KERNEL_GPU__ - for(int k = 0; k < size; k++) { - scj[k] = scj[k+1]; - } -#else + if(size > 0) memmove(scj, scj+1, size*sizeof(ShaderClosure)); -#endif - } sd->num_closure--; j--; diff --git a/intern/cycles/kernel/kernel_textures.h b/intern/cycles/kernel/kernel_textures.h index f09bb95046b..55c6e15ad04 100644 --- a/intern/cycles/kernel/kernel_textures.h +++ b/intern/cycles/kernel/kernel_textures.h @@ -176,61 +176,6 @@ KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_097) KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_098) KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_099) -/* Kepler and above */ -#if defined(__KERNEL_CUDA__) && __CUDA_ARCH__ >= 300 -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_100) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_101) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_102) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_103) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_104) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_105) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_106) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_107) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_108) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_109) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_110) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_111) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_112) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_113) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_114) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_115) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_116) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_117) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_118) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_119) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_120) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_121) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_122) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_123) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_124) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_125) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_126) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_127) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_128) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_129) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_130) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_131) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_132) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_133) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_134) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_135) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_136) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_137) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_138) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_139) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_140) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_141) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_142) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_143) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_144) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_145) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_146) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_147) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_148) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_149) -KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_150) -#endif - /* packed image (opencl) */ KERNEL_TEX(uchar4, texture_uchar4, __tex_image_packed) KERNEL_TEX(uint4, texture_uint4, __tex_image_packed_info) diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 348e8b8a5f1..1010fdea627 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -44,11 +44,11 @@ CCL_NAMESPACE_BEGIN #define BSSRDF_MIN_RADIUS 1e-8f #define BSSRDF_MAX_ATTEMPTS 8 -#define BB_DRAPPER 800.0 -#define BB_MAX_TABLE_RANGE 12000.0 -#define BB_TABLE_XPOWER 1.5 -#define BB_TABLE_YPOWER 5.0 -#define BB_TABLE_SPACING 2.0 +#define BB_DRAPPER 800.0 +#define BB_MAX_TABLE_RANGE 12000.0 +#define BB_TABLE_XPOWER 1.5 +#define BB_TABLE_YPOWER 5.0 +#define BB_TABLE_SPACING 2.0 #define TEX_NUM_FLOAT_IMAGES 5 @@ -68,7 +68,6 @@ CCL_NAMESPACE_BEGIN #define __KERNEL_SHADING__ #if __CUDA_ARCH__ >= 200 #define __KERNEL_ADV_SHADING__ -#define __NON_PROGRESSIVE__ #endif #endif @@ -443,7 +442,7 @@ typedef enum AttributeStandard { /* Closure data */ -#define MAX_CLOSURE 16 +#define MAX_CLOSURE 64 typedef struct ShaderClosure { ClosureType type; @@ -547,6 +546,9 @@ typedef struct ShaderData { /* length of the ray being shaded */ float ray_length; + + /* ray bounce depth */ + int ray_depth; #ifdef __RAY_DIFFERENTIALS__ /* differential of P. these are orthogonal to Ng, not N */ @@ -814,7 +816,7 @@ typedef struct KernelBSSRDF { int pad1, pad2; } KernelBSSRDF; -typedef struct KernelBLACKBODY { +typedef struct KernelBlackbody { int table_offset; int pad1, pad2, pad3; } KernelBLACKBODY; @@ -829,7 +831,7 @@ typedef struct KernelData { KernelBVH bvh; KernelCurves curve_kernel_data; KernelBSSRDF bssrdf; - KernelBLACKBODY blackbody; + KernelBlackbody blackbody; } KernelData; CCL_NAMESPACE_END diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp index e1e43b117e7..f3b79da8894 100644 --- a/intern/cycles/kernel/osl/osl_services.cpp +++ b/intern/cycles/kernel/osl/osl_services.cpp @@ -84,6 +84,7 @@ ustring OSLRenderServices::u_curve_thickness("geom:curve_thickness"); ustring OSLRenderServices::u_curve_tangent_normal("geom:curve_tangent_normal"); #endif ustring OSLRenderServices::u_path_ray_length("path:ray_length"); +ustring OSLRenderServices::u_path_ray_depth("path:ray_depth"); ustring OSLRenderServices::u_trace("trace"); ustring OSLRenderServices::u_hit("hit"); ustring OSLRenderServices::u_hitdist("hitdist"); @@ -660,6 +661,11 @@ bool OSLRenderServices::get_background_attribute(KernelGlobals *kg, ShaderData * float f = sd->ray_length; return set_attribute_float(f, type, derivatives, val); } + else if (name == u_path_ray_depth) { + /* Ray Depth */ + int f = sd->ray_depth; + return set_attribute_int(f, type, derivatives, val); + } else if (name == u_ndc) { /* NDC coordinates with special exception for otho */ OSLThreadData *tdata = kg->osl_tdata; @@ -919,7 +925,10 @@ bool OSLRenderServices::getmessage(OSL::ShaderGlobals *sg, ustring source, ustri if(!tracedata->setup) { /* lazy shader data setup */ - shader_setup_from_ray(kg, sd, &tracedata->isect, &tracedata->ray); + ShaderData *original_sd = (ShaderData *)(sg->renderstate); + int bounce = original_sd->ray_depth + 1; + + shader_setup_from_ray(kg, sd, &tracedata->isect, &tracedata->ray, bounce); tracedata->setup = true; } diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h index ca18c85a167..5ec4673ef37 100644 --- a/intern/cycles/kernel/osl/osl_services.h +++ b/intern/cycles/kernel/osl/osl_services.h @@ -135,6 +135,7 @@ public: static ustring u_curve_thickness; static ustring u_curve_tangent_normal; static ustring u_path_ray_length; + static ustring u_path_ray_depth; static ustring u_trace; static ustring u_hit; static ustring u_hitdist; diff --git a/intern/cycles/kernel/shaders/node_blackbody.osl b/intern/cycles/kernel/shaders/node_blackbody.osl index 4a68eb973be..3eb0ec4b5e3 100644 --- a/intern/cycles/kernel/shaders/node_blackbody.osl +++ b/intern/cycles/kernel/shaders/node_blackbody.osl @@ -26,6 +26,8 @@ shader node_blackbody( /* Scale by luminance */ float l = luminance(rgb); - Color = rgb /= l; + if (l != 0.0) + rgb /= l; + Color = rgb; } diff --git a/intern/cycles/kernel/shaders/node_light_path.osl b/intern/cycles/kernel/shaders/node_light_path.osl index 9e3f6c7b4a9..ed3c6969970 100644 --- a/intern/cycles/kernel/shaders/node_light_path.osl +++ b/intern/cycles/kernel/shaders/node_light_path.osl @@ -26,7 +26,8 @@ shader node_light_path( output float IsSingularRay = 0.0, output float IsReflectionRay = 0.0, output float IsTransmissionRay = 0.0, - output float RayLength = 0.0) + output float RayLength = 0.0, + output float RayDepth = 0.0) { IsCameraRay = raytype("camera"); IsShadowRay = raytype("shadow"); @@ -37,5 +38,9 @@ shader node_light_path( IsTransmissionRay = raytype("refraction"); getattribute("path:ray_length", RayLength); + + int ray_depth; + getattribute("path:ray_depth", ray_depth); + RayDepth = (float)ray_depth; } diff --git a/intern/cycles/kernel/shaders/node_vector_transform.osl b/intern/cycles/kernel/shaders/node_vector_transform.osl index ae0cb1c7a49..2a501b25cea 100644 --- a/intern/cycles/kernel/shaders/node_vector_transform.osl +++ b/intern/cycles/kernel/shaders/node_vector_transform.osl @@ -20,31 +20,19 @@ shader node_vector_transform( string type = "Vector", - string convert_from = "World", - string convert_to = "Object", + string convert_from = "world", + string convert_to = "object", vector VectorIn = vector(0.0, 0.0, 0.0), output vector VectorOut = vector(0.0, 0.0, 0.0)) { - /* OSL uses lower case variable names here */ - string from = "world"; - string to = "object"; - - if (convert_from == "Object") - from = "object"; - else if (convert_from == "Camera") - from = "camera"; - - if (convert_to == "World") - to = "world"; - else if (convert_to == "Camera") - to = "camera"; - - if (type == "Vector") { - VectorOut = transform(from, to, VectorIn); + if (type == "Vector" || type == "Normal") { + VectorOut = transform(convert_from, convert_to, VectorIn); + if (type == "Normal") + VectorOut = normalize(VectorOut); } else if (type == "Point") { - point Point = point(VectorIn[0], VectorIn[1], VectorIn[2]); - VectorOut = transform(from, to, Point); + point Point = (point)VectorIn; + VectorOut = transform(convert_from, convert_to, Point); } } diff --git a/intern/cycles/kernel/svm/svm_blackbody.h b/intern/cycles/kernel/svm/svm_blackbody.h index 46b2f910f74..3c6e11ca683 100644 --- a/intern/cycles/kernel/svm/svm_blackbody.h +++ b/intern/cycles/kernel/svm/svm_blackbody.h @@ -47,35 +47,36 @@ __device void svm_node_blackbody(KernelGlobals *kg, ShaderData *sd, float *stack color_rgb = make_float3(1.0e-6f,0.0f,0.0f); } else if (temperature <= BB_MAX_TABLE_RANGE) { - /* This is the overall size of the table (317*3+3) */ - const int lookuptablesize = 954; - const float lookuptablesizef = 954.0f; + /* This is the overall size of the table */ + const int lookuptablesize = 956; + const float lookuptablenormalize = 1.0f/956.0f; /* reconstruct a proper index for the table lookup, compared to OSL we don't look up two colors just one (the OSL-lerp is also automatically done for us by "lookup_table_read") */ - float t = powf ((temperature - BB_DRAPPER) / BB_TABLE_SPACING, 1.0f/BB_TABLE_XPOWER); + float t = powf((temperature - BB_DRAPPER) * (1.0f / BB_TABLE_SPACING), 1.0f/BB_TABLE_XPOWER); int blackbody_table_offset = kernel_data.blackbody.table_offset; /* Retrieve colors from the lookup table */ - float lutval = t/lookuptablesizef; + float lutval = t*lookuptablenormalize; float R = lookup_table_read(kg, lutval, blackbody_table_offset, lookuptablesize); - lutval = (t + 317.0f*1.0f)/lookuptablesizef; + lutval = (t + 319.0f*1.0f)*lookuptablenormalize; float G = lookup_table_read(kg, lutval, blackbody_table_offset, lookuptablesize); - lutval = (t + 317.0f*2.0f)/lookuptablesizef; + lutval = (t + 319.0f*2.0f)*lookuptablenormalize; float B = lookup_table_read(kg, lutval, blackbody_table_offset, lookuptablesize); R = powf(R, BB_TABLE_YPOWER); G = powf(G, BB_TABLE_YPOWER); B = powf(B, BB_TABLE_YPOWER); - /* Luminance */ - float l = linear_rgb_to_gray(make_float3(R, G, B)); - color_rgb = make_float3(R, G, B); - color_rgb /= l; } + /* Luminance */ + float l = linear_rgb_to_gray(color_rgb); + if (l != 0.0f) + color_rgb /= l; + if (stack_valid(col_offset)) stack_store_float3(stack, col_offset, color_rgb); } diff --git a/intern/cycles/kernel/svm/svm_image.h b/intern/cycles/kernel/svm/svm_image.h index 037bfa2d9b9..57adaa863f1 100644 --- a/intern/cycles/kernel/svm/svm_image.h +++ b/intern/cycles/kernel/svm/svm_image.h @@ -229,60 +229,6 @@ __device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, u case 97: r = kernel_tex_image_interp(__tex_image_097, x, y); break; case 98: r = kernel_tex_image_interp(__tex_image_098, x, y); break; case 99: r = kernel_tex_image_interp(__tex_image_099, x, y); break; -#if defined(__KERNEL_CUDA__) && __CUDA_ARCH__ >= 300 - case 100: r = kernel_tex_image_interp(__tex_image_100, x, y); break; - case 101: r = kernel_tex_image_interp(__tex_image_101, x, y); break; - case 102: r = kernel_tex_image_interp(__tex_image_102, x, y); break; - case 103: r = kernel_tex_image_interp(__tex_image_103, x, y); break; - case 104: r = kernel_tex_image_interp(__tex_image_104, x, y); break; - case 105: r = kernel_tex_image_interp(__tex_image_105, x, y); break; - case 106: r = kernel_tex_image_interp(__tex_image_106, x, y); break; - case 107: r = kernel_tex_image_interp(__tex_image_107, x, y); break; - case 108: r = kernel_tex_image_interp(__tex_image_108, x, y); break; - case 109: r = kernel_tex_image_interp(__tex_image_109, x, y); break; - case 110: r = kernel_tex_image_interp(__tex_image_110, x, y); break; - case 111: r = kernel_tex_image_interp(__tex_image_111, x, y); break; - case 112: r = kernel_tex_image_interp(__tex_image_112, x, y); break; - case 113: r = kernel_tex_image_interp(__tex_image_113, x, y); break; - case 114: r = kernel_tex_image_interp(__tex_image_114, x, y); break; - case 115: r = kernel_tex_image_interp(__tex_image_115, x, y); break; - case 116: r = kernel_tex_image_interp(__tex_image_116, x, y); break; - case 117: r = kernel_tex_image_interp(__tex_image_117, x, y); break; - case 118: r = kernel_tex_image_interp(__tex_image_118, x, y); break; - case 119: r = kernel_tex_image_interp(__tex_image_119, x, y); break; - case 120: r = kernel_tex_image_interp(__tex_image_120, x, y); break; - case 121: r = kernel_tex_image_interp(__tex_image_121, x, y); break; - case 122: r = kernel_tex_image_interp(__tex_image_122, x, y); break; - case 123: r = kernel_tex_image_interp(__tex_image_123, x, y); break; - case 124: r = kernel_tex_image_interp(__tex_image_124, x, y); break; - case 125: r = kernel_tex_image_interp(__tex_image_125, x, y); break; - case 126: r = kernel_tex_image_interp(__tex_image_126, x, y); break; - case 127: r = kernel_tex_image_interp(__tex_image_127, x, y); break; - case 128: r = kernel_tex_image_interp(__tex_image_128, x, y); break; - case 129: r = kernel_tex_image_interp(__tex_image_129, x, y); break; - case 130: r = kernel_tex_image_interp(__tex_image_130, x, y); break; - case 131: r = kernel_tex_image_interp(__tex_image_131, x, y); break; - case 132: r = kernel_tex_image_interp(__tex_image_132, x, y); break; - case 133: r = kernel_tex_image_interp(__tex_image_133, x, y); break; - case 134: r = kernel_tex_image_interp(__tex_image_134, x, y); break; - case 135: r = kernel_tex_image_interp(__tex_image_135, x, y); break; - case 136: r = kernel_tex_image_interp(__tex_image_136, x, y); break; - case 137: r = kernel_tex_image_interp(__tex_image_137, x, y); break; - case 138: r = kernel_tex_image_interp(__tex_image_138, x, y); break; - case 139: r = kernel_tex_image_interp(__tex_image_139, x, y); break; - case 140: r = kernel_tex_image_interp(__tex_image_140, x, y); break; - case 141: r = kernel_tex_image_interp(__tex_image_141, x, y); break; - case 142: r = kernel_tex_image_interp(__tex_image_142, x, y); break; - case 143: r = kernel_tex_image_interp(__tex_image_143, x, y); break; - case 144: r = kernel_tex_image_interp(__tex_image_144, x, y); break; - case 145: r = kernel_tex_image_interp(__tex_image_145, x, y); break; - case 146: r = kernel_tex_image_interp(__tex_image_146, x, y); break; - case 147: r = kernel_tex_image_interp(__tex_image_147, x, y); break; - case 148: r = kernel_tex_image_interp(__tex_image_148, x, y); break; - case 149: r = kernel_tex_image_interp(__tex_image_149, x, y); break; - case 150: r = kernel_tex_image_interp(__tex_image_150, x, y); break; -#endif - default: kernel_assert(0); return make_float4(0.0f, 0.0f, 0.0f, 0.0f); diff --git a/intern/cycles/kernel/svm/svm_light_path.h b/intern/cycles/kernel/svm/svm_light_path.h index b29dc9cbd45..0f16ef83894 100644 --- a/intern/cycles/kernel/svm/svm_light_path.h +++ b/intern/cycles/kernel/svm/svm_light_path.h @@ -34,6 +34,7 @@ __device void svm_node_light_path(ShaderData *sd, float *stack, uint type, uint case NODE_LP_transmission: info = (path_flag & PATH_RAY_TRANSMIT)? 1.0f: 0.0f; break; case NODE_LP_backfacing: info = (sd->flag & SD_BACKFACING)? 1.0f: 0.0f; break; case NODE_LP_ray_length: info = sd->ray_length; break; + case NODE_LP_ray_depth: info = (float)sd->ray_depth; break; } stack_store_float(stack, out_offset, info); diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h index 6c47fbc14be..dbfb8d48fbf 100644 --- a/intern/cycles/kernel/svm/svm_types.h +++ b/intern/cycles/kernel/svm/svm_types.h @@ -157,7 +157,8 @@ typedef enum NodeLightPath { NODE_LP_reflection, NODE_LP_transmission, NODE_LP_backfacing, - NODE_LP_ray_length + NODE_LP_ray_length, + NODE_LP_ray_depth } NodeLightPath; typedef enum NodeLightFalloff { @@ -231,20 +232,15 @@ typedef enum NodeVectorMath { typedef enum NodeVectorTransformType { NODE_VECTOR_TRANSFORM_TYPE_VECTOR, - NODE_VECTOR_TRANSFORM_TYPE_POINT + NODE_VECTOR_TRANSFORM_TYPE_POINT, + NODE_VECTOR_TRANSFORM_TYPE_NORMAL } NodeVectorTransformType; -typedef enum NodeVectorTransformConvertFrom { - NODE_VECTOR_TRANSFORM_CONVERT_FROM_WORLD, - NODE_VECTOR_TRANSFORM_CONVERT_FROM_OBJECT, - NODE_VECTOR_TRANSFORM_CONVERT_FROM_CAMERA -} NodeVectorTransformConvertFrom; - -typedef enum NodeVectorTransformConvertTo { - NODE_VECTOR_TRANSFORM_CONVERT_TO_WORLD, - NODE_VECTOR_TRANSFORM_CONVERT_TO_OBJECT, - NODE_VECTOR_TRANSFORM_CONVERT_TO_CAMERA -} NodeVectorTransformConvertTo; +typedef enum NodeVectorTransformConvertSpace { + NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD, + NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT, + NODE_VECTOR_TRANSFORM_CONVERT_SPACE_CAMERA +} NodeVectorTransformConvertSpace; typedef enum NodeConvert { NODE_CONVERT_FV, diff --git a/intern/cycles/kernel/svm/svm_vector_transform.h b/intern/cycles/kernel/svm/svm_vector_transform.h index 8b5369ab626..17dd72d4f30 100644 --- a/intern/cycles/kernel/svm/svm_vector_transform.h +++ b/intern/cycles/kernel/svm/svm_vector_transform.h @@ -31,23 +31,24 @@ __device void svm_node_vector_transform(KernelGlobals *kg, ShaderData *sd, float float3 in = stack_load_float3(stack, vector_in); NodeVectorTransformType type = (NodeVectorTransformType)itype; - NodeVectorTransformConvertFrom from = (NodeVectorTransformConvertFrom)ifrom; - NodeVectorTransformConvertTo to = (NodeVectorTransformConvertTo)ito; + NodeVectorTransformConvertSpace from = (NodeVectorTransformConvertSpace)ifrom; + NodeVectorTransformConvertSpace to = (NodeVectorTransformConvertSpace)ito; Transform tfm; int is_object = (sd->object != ~0); + int is_direction = (type == NODE_VECTOR_TRANSFORM_TYPE_VECTOR || type == NODE_VECTOR_TRANSFORM_TYPE_NORMAL); /* From world */ - if(from == NODE_VECTOR_TRANSFORM_CONVERT_FROM_WORLD) { - if(to == NODE_VECTOR_TRANSFORM_CONVERT_TO_CAMERA) { + if(from == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD) { + if(to == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_CAMERA) { tfm = kernel_data.cam.worldtocamera; - if(type == NODE_VECTOR_TRANSFORM_TYPE_VECTOR) + if(is_direction) in = transform_direction(&tfm, in); else in = transform_point(&tfm, in); } - else if (to == NODE_VECTOR_TRANSFORM_CONVERT_TO_OBJECT && is_object) { - if(type == NODE_VECTOR_TRANSFORM_TYPE_VECTOR) + else if (to == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT && is_object) { + if(is_direction) object_inverse_dir_transform(kg, sd, &in); else object_inverse_position_transform(kg, sd, &in); @@ -55,16 +56,16 @@ __device void svm_node_vector_transform(KernelGlobals *kg, ShaderData *sd, float } /* From camera */ - else if (from == NODE_VECTOR_TRANSFORM_CONVERT_FROM_CAMERA) { - if(to == NODE_VECTOR_TRANSFORM_CONVERT_TO_WORLD || to == NODE_VECTOR_TRANSFORM_CONVERT_TO_OBJECT) { + else if (from == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_CAMERA) { + if(to == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD || to == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT) { tfm = kernel_data.cam.cameratoworld; - if(type == NODE_VECTOR_TRANSFORM_TYPE_VECTOR) + if(is_direction) in = transform_direction(&tfm, in); else in = transform_point(&tfm, in); } - if(to == NODE_VECTOR_TRANSFORM_CONVERT_TO_OBJECT && is_object) { - if(type == NODE_VECTOR_TRANSFORM_TYPE_VECTOR) + if(to == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT && is_object) { + if(is_direction) object_inverse_dir_transform(kg, sd, &in); else object_inverse_position_transform(kg, sd, &in); @@ -72,22 +73,26 @@ __device void svm_node_vector_transform(KernelGlobals *kg, ShaderData *sd, float } /* From object */ - else if(from == NODE_VECTOR_TRANSFORM_CONVERT_FROM_OBJECT) { - if((to == NODE_VECTOR_TRANSFORM_CONVERT_TO_WORLD || to == NODE_VECTOR_TRANSFORM_CONVERT_TO_CAMERA) && is_object) { - if(type == NODE_VECTOR_TRANSFORM_TYPE_VECTOR) + else if(from == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT) { + if((to == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD || to == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_CAMERA) && is_object) { + if(is_direction) object_dir_transform(kg, sd, &in); else object_position_transform(kg, sd, &in); } - if(to == NODE_VECTOR_TRANSFORM_CONVERT_TO_CAMERA) { + if(to == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_CAMERA) { tfm = kernel_data.cam.worldtocamera; - if(type == NODE_VECTOR_TRANSFORM_TYPE_VECTOR) + if(is_direction) in = transform_direction(&tfm, in); else in = transform_point(&tfm, in); } } + /* Normalize Normal */ + if(type == NODE_VECTOR_TRANSFORM_TYPE_NORMAL) + in = normalize(in); + /* Output */ if(stack_valid(vector_out)) { stack_store_float3(stack, vector_out, in); diff --git a/intern/cycles/render/blackbody.cpp b/intern/cycles/render/blackbody.cpp index 75b515aa3cb..467368935d7 100644 --- a/intern/cycles/render/blackbody.cpp +++ b/intern/cycles/render/blackbody.cpp @@ -93,8 +93,8 @@ vector<float> blackbody_table() // h is Planck's const, k is Boltzmann's const float dlambda = 5.0f * 1e-9; // in meters - /* Blackbody table from 800 to 12k Kelvin (317 entries) */ - vector<float> blackbody_table(317*3+3); + /* Blackbody table from 800 to 12k Kelvin (319 entries (317+2 offset) * 3) */ + vector<float> blackbody_table(956); float X, Y, Z; @@ -131,8 +131,8 @@ vector<float> blackbody_table() /* Store in table in RRRGGGBBB format */ blackbody_table[i] = col.x; - blackbody_table[i+317*1] = col.y; - blackbody_table[i+317*2] = col.z; + blackbody_table[i+319*1] = col.y; + blackbody_table[i+319*2] = col.z; } return blackbody_table; diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp index 572cfae45cd..b509134512b 100644 --- a/intern/cycles/render/buffers.cpp +++ b/intern/cycles/render/buffers.cpp @@ -223,7 +223,7 @@ bool RenderBuffers::get_pass_rect(PassType type, float exposure, int sample, int float3 f = make_float3(in[0], in[1], in[2]); float3 f_divide = make_float3(in_divide[0], in_divide[1], in_divide[2]); - f = safe_divide_color(f*exposure, f_divide); + f = safe_divide_even_color(f*exposure, f_divide); pixels[0] = f.x; pixels[1] = f.y; diff --git a/intern/cycles/render/film.cpp b/intern/cycles/render/film.cpp index 43aef755ba3..2a16b7b6c21 100644 --- a/intern/cycles/render/film.cpp +++ b/intern/cycles/render/film.cpp @@ -359,12 +359,15 @@ void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene) case PASS_BACKGROUND: kfilm->pass_background = kfilm->pass_stride; kfilm->use_light_pass = 1; + break; case PASS_AO: kfilm->pass_ao = kfilm->pass_stride; kfilm->use_light_pass = 1; + break; case PASS_SHADOW: kfilm->pass_shadow = kfilm->pass_stride; kfilm->use_light_pass = 1; + break; case PASS_NONE: break; } diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp index 515bbe92335..2e8bc77b9c9 100644 --- a/intern/cycles/render/graph.cpp +++ b/intern/cycles/render/graph.cpp @@ -347,8 +347,9 @@ void ShaderGraph::remove_unneeded_nodes() if(tonode->special_type == SHADER_SPECIAL_TYPE_AUTOCONVERT) { bool all_links_removed = true; + vector<ShaderInput*> links = tonode->outputs[0]->links; - foreach(ShaderInput *autoin, tonode->outputs[0]->links) { + foreach(ShaderInput *autoin, links) { if(autoin->default_value == ShaderInput::NONE) all_links_removed = false; else diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index 65521103df1..8e844bc788e 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -61,16 +61,11 @@ void ImageManager::set_osl_texture_system(void *texture_system) osl_texture_system = texture_system; } -void ImageManager::set_extended_image_limits(const DeviceInfo& info) +void ImageManager::set_extended_image_limits(void) { - if(info.type == DEVICE_CPU) { - tex_num_images = TEX_EXTENDED_NUM_IMAGES_CPU; - tex_num_float_images = TEX_EXTENDED_NUM_FLOAT_IMAGES; - tex_image_byte_start = TEX_EXTENDED_IMAGE_BYTE_START; - } - else if ((info.type == DEVICE_CUDA || info.type == DEVICE_MULTI) && info.extended_images) { - tex_num_images = TEX_EXTENDED_NUM_IMAGES_GPU; - } + tex_num_images = TEX_EXTENDED_NUM_IMAGES; + tex_num_float_images = TEX_EXTENDED_NUM_FLOAT_IMAGES; + tex_image_byte_start = TEX_EXTENDED_IMAGE_BYTE_START; } bool ImageManager::set_animation_frame_update(int frame) diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h index 276420abea1..b20ff23fbbb 100644 --- a/intern/cycles/render/image.h +++ b/intern/cycles/render/image.h @@ -19,7 +19,6 @@ #ifndef __IMAGE_H__ #define __IMAGE_H__ -#include "device.h" #include "device_memory.h" #include "util_string.h" @@ -30,15 +29,12 @@ CCL_NAMESPACE_BEGIN -/* Normal Image amount */ #define TEX_NUM_IMAGES 95 #define TEX_IMAGE_BYTE_START TEX_NUM_FLOAT_IMAGES -/* Extended Image amount*/ #define TEX_EXTENDED_NUM_FLOAT_IMAGES 5 +#define TEX_EXTENDED_NUM_IMAGES 512 #define TEX_EXTENDED_IMAGE_BYTE_START TEX_EXTENDED_NUM_FLOAT_IMAGES -#define TEX_EXTENDED_NUM_IMAGES_CPU 512 -#define TEX_EXTENDED_NUM_IMAGES_GPU 145 /* color to use when textures are not found */ #define TEX_IMAGE_MISSING_R 1 @@ -64,7 +60,7 @@ public: void set_osl_texture_system(void *texture_system); void set_pack_images(bool pack_images_); - void set_extended_image_limits(const DeviceInfo& info); + void set_extended_image_limits(void); bool set_animation_frame_update(int frame); bool need_update; diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index 276647e6b2f..8b831c25d28 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -53,7 +53,7 @@ static void shade_background_pixels(Device *device, DeviceScene *dscene, int res } /* compute on device */ - float4 *d_output_data = d_output.resize(width*height); + d_output.resize(width*height); memset((void*)d_output.data_pointer, 0, d_output.memory_size()); device->const_copy_to("__data", &dscene->data, sizeof(dscene->data)); @@ -82,7 +82,7 @@ static void shade_background_pixels(Device *device, DeviceScene *dscene, int res device->mem_free(d_input); device->mem_free(d_output); - d_output_data = reinterpret_cast<float4*>(d_output.data_pointer); + float4 *d_output_data = reinterpret_cast<float4*>(d_output.data_pointer); pixels.resize(width*height); diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index 4a2a64bb0f3..77d4a5fe7d2 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -98,6 +98,18 @@ void Mesh::clear() transform_normal = transform_identity(); } +void Mesh::set_triangle(int i, int v0, int v1, int v2, int shader_, bool smooth_) +{ + Triangle tri; + tri.v[0] = v0; + tri.v[1] = v1; + tri.v[2] = v2; + + triangles[i] = tri; + shader[i] = shader_; + smooth[i] = smooth_; +} + void Mesh::add_triangle(int v0, int v1, int v2, int shader_, bool smooth_) { Triangle tri; diff --git a/intern/cycles/render/mesh.h b/intern/cycles/render/mesh.h index b74c41f6453..a7703f7cabc 100644 --- a/intern/cycles/render/mesh.h +++ b/intern/cycles/render/mesh.h @@ -110,6 +110,7 @@ public: void reserve(int numverts, int numfaces, int numcurves, int numcurvekeys); void clear(); + void set_triangle(int i, int v0, int v1, int v2, int shader, bool smooth); void add_triangle(int v0, int v1, int v2, int shader, bool smooth); void add_curve_key(float3 loc, float radius); void add_curve(int first_key, int num_keys, int shader); diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index 319d8210377..b5107315d4c 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -2064,6 +2064,7 @@ LightPathNode::LightPathNode() add_output("Is Reflection Ray", SHADER_SOCKET_FLOAT); add_output("Is Transmission Ray", SHADER_SOCKET_FLOAT); add_output("Ray Length", SHADER_SOCKET_FLOAT); + add_output("Ray Depth", SHADER_SOCKET_FLOAT); } void LightPathNode::compile(SVMCompiler& compiler) @@ -2118,6 +2119,12 @@ void LightPathNode::compile(SVMCompiler& compiler) compiler.stack_assign(out); compiler.add_node(NODE_LIGHT_PATH, NODE_LP_ray_length, out->stack_offset); } + + out = output("Ray Depth"); + if(!out->links.empty()) { + compiler.stack_assign(out); + compiler.add_node(NODE_LIGHT_PATH, NODE_LP_ray_depth, out->stack_offset); + } } @@ -3231,8 +3238,8 @@ VectorTransformNode::VectorTransformNode() : ShaderNode("vector_transform") { type = ustring("Vector"); - convert_from = ustring("World"); - convert_to = ustring("Object"); + convert_from = ustring("world"); + convert_to = ustring("object"); add_input("Vector", SHADER_SOCKET_VECTOR); add_output("Vector", SHADER_SOCKET_VECTOR); @@ -3244,35 +3251,24 @@ static ShaderEnum vector_transform_type_init() enm.insert("Vector", NODE_VECTOR_TRANSFORM_TYPE_VECTOR); enm.insert("Point", NODE_VECTOR_TRANSFORM_TYPE_POINT); + enm.insert("Normal", NODE_VECTOR_TRANSFORM_TYPE_NORMAL); return enm; } -static ShaderEnum vector_transform_convert_from_init() -{ - ShaderEnum enm; - - enm.insert("World", NODE_VECTOR_TRANSFORM_CONVERT_FROM_WORLD); - enm.insert("Object", NODE_VECTOR_TRANSFORM_CONVERT_FROM_OBJECT); - enm.insert("Camera", NODE_VECTOR_TRANSFORM_CONVERT_FROM_CAMERA); - - return enm; -} - -static ShaderEnum vector_transform_convert_to_init() +static ShaderEnum vector_transform_convert_space_init() { ShaderEnum enm; - enm.insert("World", NODE_VECTOR_TRANSFORM_CONVERT_TO_WORLD); - enm.insert("Object", NODE_VECTOR_TRANSFORM_CONVERT_TO_OBJECT); - enm.insert("Camera", NODE_VECTOR_TRANSFORM_CONVERT_TO_CAMERA); + enm.insert("world", NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD); + enm.insert("object", NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT); + enm.insert("camera", NODE_VECTOR_TRANSFORM_CONVERT_SPACE_CAMERA); return enm; } ShaderEnum VectorTransformNode::type_enum = vector_transform_type_init(); -ShaderEnum VectorTransformNode::convert_from_enum = vector_transform_convert_from_init(); -ShaderEnum VectorTransformNode::convert_to_enum = vector_transform_convert_to_init(); +ShaderEnum VectorTransformNode::convert_space_enum = vector_transform_convert_space_init(); void VectorTransformNode::compile(SVMCompiler& compiler) { @@ -3283,7 +3279,7 @@ void VectorTransformNode::compile(SVMCompiler& compiler) compiler.stack_assign(vector_out); compiler.add_node(NODE_VECTOR_TRANSFORM, - compiler.encode_uchar4(type_enum[type], convert_from_enum[convert_from], convert_to_enum[convert_to]), + compiler.encode_uchar4(type_enum[type], convert_space_enum[convert_from], convert_space_enum[convert_to]), compiler.encode_uchar4(vector_in->stack_offset, vector_out->stack_offset)); } diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h index ed4d24c774a..46b426ea20b 100644 --- a/intern/cycles/render/nodes.h +++ b/intern/cycles/render/nodes.h @@ -513,8 +513,7 @@ public: ustring convert_to; static ShaderEnum type_enum; - static ShaderEnum convert_from_enum; - static ShaderEnum convert_to_enum; + static ShaderEnum convert_space_enum; }; class BumpNode : public ShaderNode { diff --git a/intern/cycles/render/scene.cpp b/intern/cycles/render/scene.cpp index feffa2a7971..a6dca62ffd0 100644 --- a/intern/cycles/render/scene.cpp +++ b/intern/cycles/render/scene.cpp @@ -63,8 +63,8 @@ Scene::Scene(const SceneParams& params_, const DeviceInfo& device_info_) else shader_manager = ShaderManager::create(this, SceneParams::SVM); - /* Extended Image limits for CPU and Kepler GPUs */ - image_manager->set_extended_image_limits(device_info_); + if (device_info_.type == DEVICE_CPU) + image_manager->set_extended_image_limits(); } Scene::~Scene() diff --git a/intern/cycles/render/scene.h b/intern/cycles/render/scene.h index 8f5bc4ead95..0790d4159c5 100644 --- a/intern/cycles/render/scene.h +++ b/intern/cycles/render/scene.h @@ -105,8 +105,8 @@ public: /* integrator */ device_vector<uint> sobol_directions; - /* CPU images */ - device_vector<uchar4> tex_image[TEX_EXTENDED_NUM_IMAGES_CPU]; + /* images */ + device_vector<uchar4> tex_image[TEX_EXTENDED_NUM_IMAGES]; device_vector<float4> tex_float_image[TEX_EXTENDED_NUM_FLOAT_IMAGES]; /* opencl images */ diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp index d13e86429d6..93d57c65363 100644 --- a/intern/cycles/render/session.cpp +++ b/intern/cycles/render/session.cpp @@ -786,7 +786,7 @@ void Session::update_status_time(bool show_pause, bool show_done) substatus += string_printf(", Sample %d/%d", sample, num_samples); } } - else if(tile_manager.num_samples == INT_MAX) + else if(tile_manager.num_samples == USHRT_MAX) substatus = string_printf("Path Tracing Sample %d", sample+1); else substatus = string_printf("Path Tracing Sample %d/%d", sample+1, tile_manager.num_samples); diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp index 72a0645c779..5b326e0a017 100644 --- a/intern/cycles/render/shader.cpp +++ b/intern/cycles/render/shader.cpp @@ -265,7 +265,7 @@ void ShaderManager::device_update_common(Device *device, DeviceScene *dscene, Sc } /* blackbody lookup table */ - KernelBLACKBODY *kblackbody = &dscene->data.blackbody; + KernelBlackbody *kblackbody = &dscene->data.blackbody; if(has_converter_blackbody && blackbody_table_offset == TABLE_OFFSET_INVALID) { vector<float> table = blackbody_table(); diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp index 30105af2910..9e887aeadf2 100644 --- a/intern/cycles/render/svm.cpp +++ b/intern/cycles/render/svm.cpp @@ -389,11 +389,6 @@ void SVMCompiler::generate_svm_nodes(const set<ShaderNode*>& nodes, set<ShaderNo nodes_done = true; foreach(ShaderNode *node, nodes) { - - /* Detect if we have a blackbody converter, to prepare lookup table */ - if(node->has_converter_blackbody()) - current_shader->has_converter_blackbody = true; - if(done.find(node) == done.end()) { bool inputs_done = true; @@ -403,6 +398,10 @@ void SVMCompiler::generate_svm_nodes(const set<ShaderNode*>& nodes, set<ShaderNo inputs_done = false; if(inputs_done) { + /* Detect if we have a blackbody converter, to prepare lookup table */ + if(node->has_converter_blackbody()) + current_shader->has_converter_blackbody = true; + node->compile(*this); stack_clear_users(node, done); stack_clear_temporary(node); diff --git a/intern/cycles/render/tables.cpp b/intern/cycles/render/tables.cpp index c7c86f68960..032fef7516e 100644 --- a/intern/cycles/render/tables.cpp +++ b/intern/cycles/render/tables.cpp @@ -99,7 +99,7 @@ void LookupTables::remove_table(size_t offset) for(table = lookup_tables.begin(); table != lookup_tables.end(); table++) { if(table->offset == offset) { lookup_tables.erase(table); - break; + return; } } diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h index 14ebf311a4b..cde547cd77c 100644 --- a/intern/cycles/util/util_math.h +++ b/intern/cycles/util/util_math.h @@ -1100,6 +1100,42 @@ __device_inline float3 safe_divide_color(float3 a, float3 b) return make_float3(x, y, z); } +__device_inline float3 safe_divide_even_color(float3 a, float3 b) +{ + float x, y, z; + + x = (b.x != 0.0f)? a.x/b.x: 0.0f; + y = (b.y != 0.0f)? a.y/b.y: 0.0f; + z = (b.z != 0.0f)? a.z/b.z: 0.0f; + + /* try to get grey even if b is zero */ + if(b.x == 0.0f) { + if(b.y == 0.0f) { + x = z; + y = z; + } + else if(b.z == 0.0f) { + x = y; + z = y; + } + else + x = 0.5f*(y + z); + } + else if(b.y == 0.0f) { + if(b.z == 0.0f) { + y = x; + z = x; + } + else + y = 0.5f*(x + z); + } + else if(b.z == 0.0f) { + z = 0.5f*(x + y); + } + + return make_float3(x, y, z); +} + /* Rotation of point around axis and angle */ __device_inline float3 rotate_around_axis(float3 p, float3 axis, float angle) diff --git a/intern/cycles/util/util_task.cpp b/intern/cycles/util/util_task.cpp index abcb05561bd..89d990cc5d9 100644 --- a/intern/cycles/util/util_task.cpp +++ b/intern/cycles/util/util_task.cpp @@ -186,13 +186,9 @@ void TaskScheduler::init(int num_threads) do_exit = false; if(num_threads == 0) { - /* automatic number of threads will be main thread + num cores */ + /* automatic number of threads */ num_threads = system_cpu_thread_count(); } - else { - /* main thread will also work, for fixed threads we count it too */ - num_threads -= 1; - } /* launch threads that will be waiting for work */ threads.resize(num_threads); diff --git a/intern/cycles/util/util_task.h b/intern/cycles/util/util_task.h index 5bca3f255af..6e002ddd5b1 100644 --- a/intern/cycles/util/util_task.h +++ b/intern/cycles/util/util_task.h @@ -94,8 +94,8 @@ public: static void init(int num_threads = 0); static void exit(); - /* number of threads that can work on tasks, main thread counts too */ - static int num_threads() { return threads.size() + 1; } + /* number of threads that can work on task */ + static int num_threads() { return threads.size(); } /* test if any session is using the scheduler */ static bool active() { return users != 0; } diff --git a/intern/cycles/util/util_view.cpp b/intern/cycles/util/util_view.cpp index 328c0c97391..d9934fa1356 100644 --- a/intern/cycles/util/util_view.cpp +++ b/intern/cycles/util/util_view.cpp @@ -136,7 +136,7 @@ static void view_keyboard(unsigned char key, int x, int y) } } -void view_idle() +static void view_idle(void) { if(V.redraw) { V.redraw = false; diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index a92d0d33b65..aae90179be5 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -666,6 +666,19 @@ extern GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle, extern GHOST_TSuccess GHOST_SwapWindowBuffers(GHOST_WindowHandle windowhandle); /** + * Sets the swap interval for swapBuffers. + * \param interval The swap interval to use. + * \return A boolean success indicator. + */ +extern GHOST_TSuccess GHOST_SetSwapInterval(GHOST_WindowHandle windowhandle, int interval); + +/** + * Gets the current swap interval for swapBuffers. + * \return An integer. + */ +extern int GHOST_GetSwapInterval(GHOST_WindowHandle windowhandle); + +/** * Activates the drawing context of this window. * \param windowhandle The handle to the window * \return An intean success indicator. diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h index a2d3e9b91fb..35577075263 100644 --- a/intern/ghost/GHOST_IWindow.h +++ b/intern/ghost/GHOST_IWindow.h @@ -205,6 +205,19 @@ public: virtual GHOST_TSuccess swapBuffers() = 0; /** + * Sets the swap interval for swapBuffers. + * \param interval The swap interval to use. + * \return A boolean success indicator. + */ + virtual GHOST_TSuccess setSwapInterval(int interval) = 0; + + /** + * Gets the current swap interval for swapBuffers. + * \return An integer. + */ + virtual int getSwapInterval() = 0; + + /** * Activates the drawing context of this window. * \return A boolean success indicator. */ diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp index b73ff26c259..8d4498ed759 100644 --- a/intern/ghost/intern/GHOST_C-api.cpp +++ b/intern/ghost/intern/GHOST_C-api.cpp @@ -691,6 +691,19 @@ GHOST_TSuccess GHOST_SwapWindowBuffers(GHOST_WindowHandle windowhandle) return window->swapBuffers(); } +GHOST_TSuccess GHOST_SetSwapInterval(GHOST_WindowHandle windowhandle, int interval) +{ + GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + + return window->setSwapInterval(interval); +} + +int GHOST_GetSwapInterval(GHOST_WindowHandle windowhandle) +{ + GHOST_IWindow *window = (GHOST_IWindow *) windowhandle; + + return window->getSwapInterval(); +} GHOST_TSuccess GHOST_ActivateWindowDrawingContext(GHOST_WindowHandle windowhandle) diff --git a/intern/ghost/intern/GHOST_DropTargetWin32.h b/intern/ghost/intern/GHOST_DropTargetWin32.h index f746a50d469..56bae1fd1b2 100644 --- a/intern/ghost/intern/GHOST_DropTargetWin32.h +++ b/intern/ghost/intern/GHOST_DropTargetWin32.h @@ -152,6 +152,10 @@ private: GHOST_SystemWin32 *m_system; /* Data type of the dragged object */ GHOST_TDragnDropTypes m_draggedObjectType; + +#ifdef WITH_CXX_GUARDEDALLOC + MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_DropTargetWin32") +#endif }; #endif // __GHOST_DROPTARGETWIN32_H__ diff --git a/intern/ghost/intern/GHOST_DropTargetX11.cpp b/intern/ghost/intern/GHOST_DropTargetX11.cpp index e2e15277a99..639fd503759 100644 --- a/intern/ghost/intern/GHOST_DropTargetX11.cpp +++ b/intern/ghost/intern/GHOST_DropTargetX11.cpp @@ -84,6 +84,9 @@ void GHOST_DropTargetX11::Initialize(void) void GHOST_DropTargetX11::Uninitialize(void) { xdnd_shut(&m_dndClass); + + delete[] m_dndActions; + delete[] m_dndTypes; } GHOST_DropTargetX11::GHOST_DropTargetX11(GHOST_WindowX11 *window, GHOST_SystemX11 *system) @@ -188,7 +191,7 @@ void GHOST_DropTargetX11::UrlDecode(char *decodedOut, int bufferSize, const char char *GHOST_DropTargetX11::FileUrlDecode(char *fileUrl) { - if (!strncpy(fileUrl, "file://", 7) == 0) { + if (strncpy(fileUrl, "file://", 7) != 0) { /* assume one character of encoded URL can be expanded to 4 chars max */ int decodedSize = 4 * strlen(fileUrl) + 1; char *decodedPath = (char *)malloc(decodedSize); diff --git a/intern/ghost/intern/GHOST_DropTargetX11.h b/intern/ghost/intern/GHOST_DropTargetX11.h index 3fed5798611..0254139bcd8 100644 --- a/intern/ghost/intern/GHOST_DropTargetX11.h +++ b/intern/ghost/intern/GHOST_DropTargetX11.h @@ -130,6 +130,10 @@ private: /* counter of references to global XDND structures */ static int m_refCounter; + +#ifdef WITH_CXX_GUARDEDALLOC + MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_DropTargetX11") +#endif }; #endif // __GHOST_DROPTARGETX11_H__ diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp index f7e035e890d..6e72e26beb4 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.cpp +++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp @@ -858,7 +858,8 @@ OSStatus GHOST_SystemCarbon::handleMouseEvent(EventRef event) break; case kEventMouseMoved: - case kEventMouseDragged: { + case kEventMouseDragged: + { Point mousePos; if (window) { diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index d00265fbd9b..2e39ee812ca 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -1139,7 +1139,8 @@ GHOST_SystemX11::processEvent(XEvent *xe) break; } - default: { + default: + { #ifdef WITH_X11_XINPUT if (xe->type == m_xtablet.MotionEvent) { XDeviceMotionEvent *data = (XDeviceMotionEvent *)xe; @@ -1505,7 +1506,7 @@ convertXKey(KeySym key) #define XCLIB_XCOUT_FALLBACK_TEXT 6 /* Retrieves the contents of a selections. */ -void GHOST_SystemX11::getClipboard_xcout(XEvent evt, +void GHOST_SystemX11::getClipboard_xcout(const XEvent *evt, Atom sel, Atom target, unsigned char **txt, unsigned long *len, unsigned int *context) const { @@ -1535,18 +1536,18 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt, return; case XCLIB_XCOUT_SENTCONVSEL: - if (evt.type != SelectionNotify) + if (evt->type != SelectionNotify) return; - if (target == m_atom.UTF8_STRING && evt.xselection.property == None) { + if (target == m_atom.UTF8_STRING && evt->xselection.property == None) { *context = XCLIB_XCOUT_FALLBACK_UTF8; return; } - else if (target == m_atom.COMPOUND_TEXT && evt.xselection.property == None) { + else if (target == m_atom.COMPOUND_TEXT && evt->xselection.property == None) { *context = XCLIB_XCOUT_FALLBACK_COMP; return; } - else if (target == m_atom.TEXT && evt.xselection.property == None) { + else if (target == m_atom.TEXT && evt->xselection.property == None) { *context = XCLIB_XCOUT_FALLBACK_TEXT; return; } @@ -1604,11 +1605,11 @@ void GHOST_SystemX11::getClipboard_xcout(XEvent evt, * then read it, delete it, etc. */ /* make sure that the event is relevant */ - if (evt.type != PropertyNotify) + if (evt->type != PropertyNotify) return; /* skip unless the property has a new value */ - if (evt.xproperty.state != PropertyNewValue) + if (evt->xproperty.state != PropertyNewValue) return; /* check size and format of the property */ @@ -1713,7 +1714,7 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const XNextEvent(m_display, &evt); /* fetch the selection, or part of it */ - getClipboard_xcout(evt, sseln, target, &sel_buf, &sel_len, &context); + getClipboard_xcout(&evt, sseln, target, &sel_buf, &sel_len, &context); /* fallback is needed. set XA_STRING to target and restart the loop. */ if (context == XCLIB_XCOUT_FALLBACK) { diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h index 6a492f64b41..1f95e4b1ce2 100644 --- a/intern/ghost/intern/GHOST_SystemX11.h +++ b/intern/ghost/intern/GHOST_SystemX11.h @@ -238,7 +238,7 @@ public: #endif /* Helped function for get data from the clipboard. */ - void getClipboard_xcout(XEvent evt, Atom sel, Atom target, + void getClipboard_xcout(const XEvent *evt, Atom sel, Atom target, unsigned char **txt, unsigned long *len, unsigned int *context) const; diff --git a/intern/ghost/intern/GHOST_Window.h b/intern/ghost/intern/GHOST_Window.h index 588de0911e3..77ee4db8543 100644 --- a/intern/ghost/intern/GHOST_Window.h +++ b/intern/ghost/intern/GHOST_Window.h @@ -67,6 +67,8 @@ public: * virtual GHOST_TWindowOrder getOrder(void) = 0; * virtual GHOST_TSuccess setOrder(GHOST_TWindowOrder order) = 0; * virtual GHOST_TSuccess swapBuffers() = 0; + * virtual GHOST_TSuccess setSwapInterval() = 0; + * virtual int getSwapInterval() = 0; * virtual GHOST_TSuccess activateDrawingContext() = 0; * virtual GHOST_TSuccess invalidate() = 0; */ @@ -110,6 +112,8 @@ public: * virtual GHOST_TSuccess setState(GHOST_TWindowState state) = 0; * virtual GHOST_TSuccess setOrder(GHOST_TWindowOrder order) = 0; * virtual GHOST_TSuccess swapBuffers() = 0; + * virtual GHOST_TSuccess setSwapInterval() = 0; + * virtual int getSwapInterval() = 0; * virtual GHOST_TSuccess activateDrawingContext() = 0; * virtual GHOST_TSuccess invalidate() = 0; */ @@ -205,6 +209,23 @@ public: } /** + * Sets the swap interval for swapBuffers. + * \param interval The swap interval to use. + * \return A boolean success indicator. + */ + virtual GHOST_TSuccess setSwapInterval(int interval) { + return GHOST_kFailure; + } + + /** + * Gets the current swap interval for swapBuffers. + * \return An integer. + */ + virtual int getSwapInterval() { + return 0; + } + + /** * Tells if the ongoing drag'n'drop object can be accepted upon mouse drop */ virtual void setAcceptDragOperation(bool canAccept); diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index 472136b8130..de2ae79d0b6 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -1032,7 +1032,8 @@ GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state) [m_window zoom:nil]; break; - case GHOST_kWindowStateFullScreen: { + case GHOST_kWindowStateFullScreen: + { #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 NSUInteger masks = [m_window styleMask]; diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index b0d0b1a5b5d..c264686fbb1 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -648,6 +648,20 @@ GHOST_TSuccess GHOST_WindowWin32::swapBuffers() return ::SwapBuffers(hDC) == TRUE ? GHOST_kSuccess : GHOST_kFailure; } +GHOST_TSuccess GHOST_WindowWin32::setSwapInterval(int interval) +{ + if (!WGL_EXT_swap_control) + return GHOST_kFailure; + return wglSwapIntervalEXT(interval) == TRUE ? GHOST_kSuccess : GHOST_kFailure; +} + +int GHOST_WindowWin32::getSwapInterval() +{ + if (WGL_EXT_swap_control) + return wglGetSwapIntervalEXT(); + + return 0; +} GHOST_TSuccess GHOST_WindowWin32::activateDrawingContext() { diff --git a/intern/ghost/intern/GHOST_WindowWin32.h b/intern/ghost/intern/GHOST_WindowWin32.h index 2fd1f5b37f4..6fdc963f30a 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.h +++ b/intern/ghost/intern/GHOST_WindowWin32.h @@ -212,6 +212,19 @@ public: virtual GHOST_TSuccess swapBuffers(); /** + * Sets the swap interval for swapBuffers. + * \param interval The swap interval to use. + * \return A boolean success indicator. + */ + virtual GHOST_TSuccess setSwapInterval(int interval); + + /** + * Gets the current swap interval for swapBuffers. + * \return An integer. + */ + virtual int getSwapInterval(); + + /** * Activates the drawing context of this window. * \return Indication of success. */ diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 25d7c181b68..3173736c2a5 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -30,6 +30,8 @@ */ +#include <GL/glxew.h> + #include "GHOST_WindowX11.h" #include "GHOST_SystemX11.h" #include "STR_String.h" @@ -1513,3 +1515,23 @@ endFullScreen() const return GHOST_kSuccess; } + +GHOST_TSuccess +GHOST_WindowX11:: +setSwapInterval(int interval) { + if (!GLX_EXT_swap_control) + return GHOST_kFailure; + glXSwapIntervalEXT(m_display, m_window, interval); + return GHOST_kSuccess; +} + +int +GHOST_WindowX11:: +getSwapInterval() { + if (GLX_EXT_swap_control) { + unsigned int value; + glXQueryDrawable(m_display, m_window, GLX_SWAP_INTERVAL_EXT, &value); + return (int)value; + } + return 0; +} diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h index b8471b41a11..7cbdcdeec21 100644 --- a/intern/ghost/intern/GHOST_WindowX11.h +++ b/intern/ghost/intern/GHOST_WindowX11.h @@ -235,6 +235,19 @@ public: GHOST_TSuccess endFullScreen() const; + /** + * Sets the swap interval for swapBuffers. + * \param interval The swap interval to use. + * \return A boolean success indicator. + */ + virtual GHOST_TSuccess setSwapInterval(int interval); + + /** + * Gets the current swap interval for swapBuffers. + * \return An integer. + */ + virtual int getSwapInterval(); + protected: /** * Tries to install a rendering context in this window. diff --git a/intern/iksolver/CMakeLists.txt b/intern/iksolver/CMakeLists.txt index 711a70ff260..9476e0379e9 100644 --- a/intern/iksolver/CMakeLists.txt +++ b/intern/iksolver/CMakeLists.txt @@ -26,11 +26,10 @@ set(INC intern ../memutil - ../moto/include ) set(INC_SYS - + ../moto/include ) set(SRC diff --git a/intern/opencl/OCL_opencl.h b/intern/opencl/OCL_opencl.h index 4ee167b2fb4..733e3527197 100644 --- a/intern/opencl/OCL_opencl.h +++ b/intern/opencl/OCL_opencl.h @@ -28,7 +28,7 @@ extern "C" { #endif #include "intern/clew.h" -void OCL_init(void); +int OCL_init(void); #ifdef __cplusplus } diff --git a/intern/opencl/intern/OCL_opencl.c b/intern/opencl/intern/OCL_opencl.c index e3130e16bde..33a936896fd 100644 --- a/intern/opencl/intern/OCL_opencl.c +++ b/intern/opencl/intern/OCL_opencl.c @@ -22,7 +22,7 @@ #include "OCL_opencl.h" -void OCL_init(void) +int OCL_init(void) { #ifdef _WIN32 const char *path = "OpenCL.dll"; @@ -32,6 +32,6 @@ void OCL_init(void) const char *path = "libOpenCL.so"; #endif - clewInit(path); + return (clewInit(path) == CLEW_SUCCESS); } diff --git a/intern/opencl/intern/clew.c b/intern/opencl/intern/clew.c index d68eb17288f..1e31ebced0a 100644 --- a/intern/opencl/intern/clew.c +++ b/intern/opencl/intern/clew.c @@ -227,6 +227,11 @@ int clewInit(const char* path) __oclEnqueueWaitForEvents = (PFNCLENQUEUEWAITFOREVENTS )CLCC_DYNLIB_IMPORT(module, "clEnqueueWaitForEvents"); __oclEnqueueBarrier = (PFNCLENQUEUEBARRIER )CLCC_DYNLIB_IMPORT(module, "clEnqueueBarrier"); __oclGetExtensionFunctionAddress = (PFNCLGETEXTENSIONFUNCTIONADDRESS )CLCC_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddress"); + + if(__oclGetPlatformIDs == NULL) return CLEW_ERROR_OPEN_FAILED; + if(__oclGetPlatformInfo == NULL) return CLEW_ERROR_OPEN_FAILED; + if(__oclGetDeviceIDs == NULL) return CLEW_ERROR_OPEN_FAILED; + if(__oclGetDeviceInfo == NULL) return CLEW_ERROR_OPEN_FAILED; return CLEW_SUCCESS; } diff --git a/intern/smoke/CMakeLists.txt b/intern/smoke/CMakeLists.txt index b6338f90ebc..2ca423dc73e 100644 --- a/intern/smoke/CMakeLists.txt +++ b/intern/smoke/CMakeLists.txt @@ -95,7 +95,7 @@ endif() if(WITH_FFTW3) add_definitions(-DWITH_FFTW3) - list(APPEND INC + list(APPEND INC_SYS ${FFTW3_INCLUDE_DIRS} ) endif() diff --git a/release/datafiles/LICENSE-droidsans.ttf.txt b/release/datafiles/LICENSE-droidsans.ttf.txt index 1f090edd309..ca0d6bbaea1 100644 --- a/release/datafiles/LICENSE-droidsans.ttf.txt +++ b/release/datafiles/LICENSE-droidsans.ttf.txt @@ -5,6 +5,7 @@ Blender Main I18n font ("droidsans.ttf") includes glyphs imported from the follo 3. Samyak-devanagari 4. Droid Sans Hebrew Regular 5. Droid Sans Ethiopic Regular +6. Samyak-tamil These were merged using FontForge in (approximately) the above order. For each glyph, a license of the font from which it was imported is applied. @@ -30,7 +31,7 @@ Copyright: License: Apache-2.0 See Appendix A. -(3) Samyak-devanagari +(3) Samyak-devanagari and (6) Samyak-tamil Copyright: 2005-2006, Rahul Bhalerao <b.rahul.pm@gmail.com> 2005-2006, Bageshri Salvi <sbageshri@gmail.com> 2005-2006, Pravin Satpute <pravin.d.s@gmail.com> diff --git a/release/datafiles/fonts/droidsans.ttf.gz b/release/datafiles/fonts/droidsans.ttf.gz Binary files differindex a0e7502cc1f..81683e6379f 100644 --- a/release/datafiles/fonts/droidsans.ttf.gz +++ b/release/datafiles/fonts/droidsans.ttf.gz diff --git a/release/datafiles/splash.png b/release/datafiles/splash.png Binary files differindex 01d903c457b..9551fad2fac 100644 --- a/release/datafiles/splash.png +++ b/release/datafiles/splash.png diff --git a/release/datafiles/startup.blend b/release/datafiles/startup.blend Binary files differindex 8b58493fe3a..c604d16829c 100644 --- a/release/datafiles/startup.blend +++ b/release/datafiles/startup.blend diff --git a/release/scripts/freestyle/style_modules/ChainingIterators.py b/release/scripts/freestyle/style_modules/ChainingIterators.py index 03ad837aa28..b908fad0b89 100644 --- a/release/scripts/freestyle/style_modules/ChainingIterators.py +++ b/release/scripts/freestyle/style_modules/ChainingIterators.py @@ -24,6 +24,8 @@ from freestyle import AdjacencyIterator, ChainingIterator, ExternalContourUP1D, Nature, TVertex from freestyle import ContextFunctions as CF +import bpy + ## the natural chaining iterator ## It follows the edges of same nature following the topology of ## objects with preseance on silhouettes, then borders, @@ -212,7 +214,7 @@ class pySketchyChainSilhouetteIterator(ChainingIterator): visitNext = 1 break if visitNext != 0: - break + break count = count+1 winner = ve it.increment() @@ -238,14 +240,22 @@ class pySketchyChainingIterator(ChainingIterator): self._timeStamp = CF.get_time_stamp()+self._nRounds def traverse(self, iter): winner = None + found = False it = AdjacencyIterator(iter) while not it.is_end: ve = it.object if ve.id == self.current_edge.id: + found = True it.increment() continue winner = ve it.increment() + if not found: + # This is a fatal error condition: self.current_edge must be found + # among the edges seen by the AdjacencyIterator [bug #35695]. + if bpy.app.debug_freestyle: + print('pySketchyChainingIterator: current edge not found') + return None if winner is None: winner = self.current_edge if winner.chaining_time_stamp == self._timeStamp: diff --git a/release/scripts/freestyle/style_modules/parameter_editor.py b/release/scripts/freestyle/style_modules/parameter_editor.py index 71cfdce43f0..5b773cd7a6d 100644 --- a/release/scripts/freestyle/style_modules/parameter_editor.py +++ b/release/scripts/freestyle/style_modules/parameter_editor.py @@ -32,7 +32,7 @@ from freestyle import BackboneStretcherShader, BezierCurveShader, BinaryPredicat FalseBP1D, FalseUP1D, GuidingLinesShader, Interface0DIterator, Nature, Noise, Normal2DF0D, Operators, \ PolygonalizationShader, QuantitativeInvisibilityF1D, QuantitativeInvisibilityUP1D, SamplingShader, \ SpatialNoiseShader, StrokeAttribute, StrokeShader, TipRemoverShader, TrueBP1D, TrueUP1D, UnaryPredicate0D, \ - UnaryPredicate1D, VertexOrientation2DF0D, WithinImageBoundaryUP1D + UnaryPredicate1D, VertexOrientation2DF0D, WithinImageBoundaryUP1D, ContextFunctions from Functions0D import CurveMaterialF0D from PredicatesU1D import pyNatureUP1D from logical_operators import AndUP1D, NotUP1D, OrUP1D @@ -1046,17 +1046,7 @@ def process(layer_name, lineset_name): selection_criteria.append(upred) # prepare selection criteria by image border if lineset.select_by_image_border: - fac = scene.render.resolution_percentage / 100.0 - w = scene.render.resolution_x * fac - h = scene.render.resolution_y * fac - if scene.render.use_border: - xmin = scene.render.border_min_x * w - xmax = scene.render.border_max_x * w - ymin = scene.render.border_min_y * h - ymax = scene.render.border_max_y * h - else: - xmin, xmax = 0.0, float(w) - ymin, ymax = 0.0, float(h) + xmin, ymin, xmax, ymax = ContextFunctions.get_border() upred = WithinImageBoundaryUP1D(xmin, ymin, xmax, ymax) selection_criteria.append(upred) # select feature edges diff --git a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py index 8c237840d96..1da45a9f415 100644 --- a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py +++ b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py @@ -40,6 +40,7 @@ class SpellChecker(): "derivate", "doesn", # doesn't "fader", + "globbing", "hasn", # hasn't "hoc", # ad-hoc "indices", @@ -59,6 +60,7 @@ class SpellChecker(): "autoclip", "autocomplete", "autoexec", + "autoexecution", "autoname", "autosave", "autoscale", diff --git a/release/scripts/modules/bpy_extras/anim_utils.py b/release/scripts/modules/bpy_extras/anim_utils.py index c9ed91d3a83..d87c207e2d0 100644 --- a/release/scripts/modules/bpy_extras/anim_utils.py +++ b/release/scripts/modules/bpy_extras/anim_utils.py @@ -31,6 +31,7 @@ def bake_action(frame_start, only_selected=False, do_pose=True, do_object=True, + do_visual_keying=True, do_constraint_clear=False, do_parents_clear=False, do_clean=False, @@ -53,7 +54,9 @@ def bake_action(frame_start, :type do_pose: bool :arg do_object: Bake objects. :type do_object: bool - :arg do_constraint_clear: Remove constraints (and do 'visual keying'). + :arg do_visual_keying: Use the final transformations for baking ('visual keying') + :type do_visual_keying: bool + :arg do_constraint_clear: Remove constraints after baking. :type do_constraint_clear: bool :arg do_parents_clear: Unparent after baking objects. :type do_parents_clear: bool @@ -83,14 +86,14 @@ def bake_action(frame_start, if do_parents_clear: def obj_frame_info(obj, do_visual_keying): parent = obj.parent - matrix = obj.matrix_local if do_visual_keying else obj.matrix_basis + matrix = obj.matrix_local if do_visual_keying else obj.matrix_local if parent: return parent.matrix_world * matrix else: return matrix.copy() else: def obj_frame_info(obj, do_visual_keying): - return obj.matrix_local.copy() if do_visual_keying else obj.matrix_basis.copy() + return obj.matrix_local.copy() if do_visual_keying else obj.matrix_local.copy() # ------------------------------------------------------------------------- # Setup the Context @@ -118,10 +121,11 @@ def bake_action(frame_start, for f in frame_range: scene.frame_set(f) + scene.update() if do_pose: - pose_info.append(pose_frame_info(obj, do_constraint_clear)) + pose_info.append(pose_frame_info(obj, do_visual_keying)) if do_object: - obj_info.append(obj_frame_info(obj, do_constraint_clear)) + obj_info.append(obj_frame_info(obj, do_visual_keying)) # ------------------------------------------------------------------------- # Create action diff --git a/release/scripts/modules/rna_keymap_ui.py b/release/scripts/modules/rna_keymap_ui.py new file mode 100644 index 00000000000..727e9935bcc --- /dev/null +++ b/release/scripts/modules/rna_keymap_ui.py @@ -0,0 +1,384 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# <pep8 compliant> + +__all__ = ( + "draw_entry", + "draw_km", + "draw_kmi", + "draw_filtered", + "draw_hierarchy", + "draw_keymaps", + ) + + +import bpy +from bpy.app.translations import pgettext_iface as iface_ +from bpy.app.translations import contexts as i18n_contexts + + +def _indented_layout(layout, level): + indentpx = 16 + if level == 0: + level = 0.0001 # Tweak so that a percentage of 0 won't split by half + indent = level * indentpx / bpy.context.region.width + + split = layout.split(percentage=indent) + col = split.column() + col = split.column() + return col + + +def draw_entry(display_keymaps, entry, col, level=0): + idname, spaceid, regionid, children = entry + + for km, kc in display_keymaps: + if km.name == idname and km.space_type == spaceid and km.region_type == regionid: + draw_km(display_keymaps, kc, km, children, col, level) + + ''' + km = kc.keymaps.find(idname, space_type=spaceid, region_type=regionid) + if not km: + kc = defkc + km = kc.keymaps.find(idname, space_type=spaceid, region_type=regionid) + + if km: + draw_km(kc, km, children, col, level) + ''' + + +def draw_km(display_keymaps, kc, km, children, layout, level): + km = km.active() + + layout.context_pointer_set("keymap", km) + + col = _indented_layout(layout, level) + + row = col.row() + row.prop(km, "show_expanded_children", text="", emboss=False) + row.label(text=km.name, text_ctxt=i18n_contexts.id_windowmanager) + + row.label() + row.label() + + if km.is_modal: + row.label(text="", icon='LINKED') + if km.is_user_modified: + row.operator("wm.keymap_restore", text="Restore") + else: + row.label() + + if km.show_expanded_children: + if children: + # Put the Parent key map's entries in a 'global' sub-category + # equal in hierarchy to the other children categories + subcol = _indented_layout(col, level + 1) + subrow = subcol.row() + subrow.prop(km, "show_expanded_items", text="", emboss=False) + subrow.label(text=iface_("%s (Global)") % km.name, translate=False) + else: + km.show_expanded_items = True + + # Key Map items + if km.show_expanded_items: + for kmi in km.keymap_items: + draw_kmi(display_keymaps, kc, km, kmi, col, level + 1) + + # "Add New" at end of keymap item list + col = _indented_layout(col, level + 1) + subcol = col.split(percentage=0.2).column() + subcol.operator("wm.keyitem_add", text="Add New", text_ctxt=i18n_contexts.id_windowmanager, + icon='ZOOMIN') + + col.separator() + + # Child key maps + if children: + subcol = col.column() + row = subcol.row() + + for entry in children: + draw_entry(display_keymaps, entry, col, level + 1) + + +def draw_kmi(display_keymaps, kc, km, kmi, layout, level): + map_type = kmi.map_type + + col = _indented_layout(layout, level) + + if kmi.show_expanded: + col = col.column(align=True) + box = col.box() + else: + box = col.column() + + split = box.split(percentage=0.05) + + # header bar + row = split.row() + row.prop(kmi, "show_expanded", text="", emboss=False) + + row = split.row() + row.prop(kmi, "active", text="", emboss=False) + + if km.is_modal: + row.prop(kmi, "propvalue", text="") + else: + row.label(text=kmi.name) + + row = split.row() + row.prop(kmi, "map_type", text="") + if map_type == 'KEYBOARD': + row.prop(kmi, "type", text="", full_event=True) + elif map_type == 'MOUSE': + row.prop(kmi, "type", text="", full_event=True) + elif map_type == 'NDOF': + row.prop(kmi, "type", text="", full_event=True) + elif map_type == 'TWEAK': + subrow = row.row() + subrow.prop(kmi, "type", text="") + subrow.prop(kmi, "value", text="") + elif map_type == 'TIMER': + row.prop(kmi, "type", text="") + else: + row.label() + + if (not kmi.is_user_defined) and kmi.is_user_modified: + row.operator("wm.keyitem_restore", text="", icon='BACK').item_id = kmi.id + else: + row.operator("wm.keyitem_remove", text="", icon='X').item_id = kmi.id + + # Expanded, additional event settings + if kmi.show_expanded: + box = col.box() + + split = box.split(percentage=0.4) + sub = split.row() + + if km.is_modal: + sub.prop(kmi, "propvalue", text="") + else: + # One day... + #~ sub.prop_search(kmi, "idname", bpy.context.window_manager, "operators_all", text="") + sub.prop(kmi, "idname", text="") + + if map_type not in {'TEXTINPUT', 'TIMER'}: + sub = split.column() + subrow = sub.row(align=True) + + if map_type == 'KEYBOARD': + subrow.prop(kmi, "type", text="", event=True) + subrow.prop(kmi, "value", text="") + elif map_type in {'MOUSE', 'NDOF'}: + subrow.prop(kmi, "type", text="") + subrow.prop(kmi, "value", text="") + + subrow = sub.row() + subrow.scale_x = 0.75 + subrow.prop(kmi, "any") + subrow.prop(kmi, "shift") + subrow.prop(kmi, "ctrl") + subrow.prop(kmi, "alt") + subrow.prop(kmi, "oskey", text="Cmd") + subrow.prop(kmi, "key_modifier", text="", event=True) + + # Operator properties + box.template_keymap_item_properties(kmi) + + # Modal key maps attached to this operator + if not km.is_modal: + kmm = kc.keymaps.find_modal(kmi.idname) + if kmm: + draw_km(display_keymaps, kc, kmm, None, layout, level + 1) + layout.context_pointer_set("keymap", km) + +_EVENT_TYPES = set() +_EVENT_TYPE_MAP = {} + + +def draw_filtered(display_keymaps, filter_type, filter_text, layout): + + if filter_type == 'NAME': + def filter_func(kmi): + return (filter_text in kmi.idname.lower() or + filter_text in kmi.name.lower()) + else: + if not _EVENT_TYPES: + enum = bpy.types.Event.bl_rna.properties["type"].enum_items + _EVENT_TYPES.update(enum.keys()) + _EVENT_TYPE_MAP.update({item.name.replace(" ", "_").upper(): key + for key, item in enum.items()}) + + del enum + _EVENT_TYPE_MAP.update({ + "`": 'ACCENT_GRAVE', + "*": 'NUMPAD_ASTERIX', + "/": 'NUMPAD_SLASH', + "RMB": 'RIGHTMOUSE', + "LMB": 'LEFTMOUSE', + "MMB": 'MIDDLEMOUSE', + }) + _EVENT_TYPE_MAP.update({ + "%d" % i: "NUMPAD_%d" % i for i in range(9) + }) + # done with once off init + + filter_text_split = filter_text.strip() + filter_text_split = filter_text.split() + + # Modifier {kmi.attribute: name} mapping + key_mod = { + "ctrl": "ctrl", + "alt": "alt", + "shift": "shift", + "cmd": "oskey", + "oskey": "oskey", + "any": "any", + } + # KeyMapItem like dict, use for comparing against + # attr: state + kmi_test_dict = {} + + # initialize? - so if a if a kmi has a MOD assigned it wont show up. + #~ for kv in key_mod.values(): + #~ kmi_test_dict[kv] = False + + # altname: attr + for kk, kv in key_mod.items(): + if kk in filter_text_split: + filter_text_split.remove(kk) + kmi_test_dict[kv] = True + # whats left should be the event type + if len(filter_text_split) > 1: + return False + elif filter_text_split: + kmi_type = filter_text_split[0].upper() + + if kmi_type not in _EVENT_TYPES: + # replacement table + kmi_type_test = _EVENT_TYPE_MAP.get(kmi_type) + if kmi_type_test is None: + # print("Unknown Type:", kmi_type) + + # Partial match + for k, v in _EVENT_TYPE_MAP.items(): + if kmi_type in k: + kmi_type_test = v + break + if kmi_type in v: + kmi_type_test = v + break + + if kmi_type_test is None: + return False + + kmi_type = kmi_type_test + del kmi_type_test + + kmi_test_dict["type"] = kmi_type + + # main filter func, runs many times + def filter_func(kmi): + for kk, ki in kmi_test_dict.items(): + if getattr(kmi, kk) != ki: + return False + return True + + for km, kc in display_keymaps: + km = km.active() + layout.context_pointer_set("keymap", km) + + filtered_items = [kmi for kmi in km.keymap_items if filter_func(kmi)] + + if filtered_items: + col = layout.column() + + row = col.row() + row.label(text=km.name, icon='DOT') + + row.label() + row.label() + + if km.is_user_modified: + row.operator("wm.keymap_restore", text="Restore") + else: + row.label() + + for kmi in filtered_items: + draw_kmi(display_keymaps, kc, km, kmi, col, 1) + + # "Add New" at end of keymap item list + col = _indented_layout(layout, 1) + subcol = col.split(percentage=0.2).column() + subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN') + return True + + +def draw_hierarchy(display_keymaps, layout): + from bpy_extras import keyconfig_utils + for entry in keyconfig_utils.KM_HIERARCHY: + draw_entry(display_keymaps, entry, layout) + + +def draw_keymaps(context, layout): + from bpy_extras import keyconfig_utils + + wm = context.window_manager + kc = wm.keyconfigs.user + spref = context.space_data + + col = layout.column() + sub = col.column() + + subsplit = sub.split() + subcol = subsplit.column() + + row = subcol.row(align=True) + + #~ row.prop_search(wm.keyconfigs, "active", wm, "keyconfigs", text="Key Config:") + text = bpy.path.display_name(wm.keyconfigs.active.name) + if not text: + text = "Blender (default)" + row.menu("USERPREF_MT_keyconfigs", text=text) + row.operator("wm.keyconfig_preset_add", text="", icon='ZOOMIN') + row.operator("wm.keyconfig_preset_add", text="", icon='ZOOMOUT').remove_active = True + + #~ layout.context_pointer_set("keyconfig", wm.keyconfigs.active) + #~ row.operator("wm.keyconfig_remove", text="", icon='X') + row.separator() + rowsub = row.split(align=True, percentage=0.33) + # postpone drawing into rowsub, so we can set alert! + + col.separator() + display_keymaps = keyconfig_utils.keyconfig_merge(kc, kc) + filter_type = spref.filter_type + filter_text = spref.filter_text.strip() + if filter_text: + filter_text = filter_text.lower() + ok = draw_filtered(display_keymaps, filter_type, filter_text, col) + else: + draw_hierarchy(display_keymaps, col) + ok = True + + # go back and fill in rowsub + rowsub.prop(spref, "filter_type", text="") + rowsubsub = rowsub.row(align=True) + if not ok: + rowsubsub.alert = True + rowsubsub.prop(spref, "filter_text", text="", icon='VIEWZOOM') diff --git a/release/scripts/presets/cycles/sampling/final.py b/release/scripts/presets/cycles/sampling/final.py new file mode 100644 index 00000000000..4bb90d106f4 --- /dev/null +++ b/release/scripts/presets/cycles/sampling/final.py @@ -0,0 +1,16 @@ +import bpy +cycles = bpy.context.scene.cycles + +cycles.squared_samples = True + +cycles.samples = 24 +cycles.preview_samples = 24 +cycles.aa_samples = 8 +cycles.preview_aa_samples = 8 + +cycles.diffuse_samples = 3 +cycles.glossy_samples = 2 +cycles.transmission_samples = 2 +cycles.ao_samples = 1 +cycles.mesh_light_samples = 2 +cycles.subsurface_samples = 2 diff --git a/release/scripts/presets/cycles/sampling/preview.py b/release/scripts/presets/cycles/sampling/preview.py new file mode 100644 index 00000000000..fbe8a011c97 --- /dev/null +++ b/release/scripts/presets/cycles/sampling/preview.py @@ -0,0 +1,16 @@ +import bpy +cycles = bpy.context.scene.cycles + +cycles.squared_samples = True + +cycles.samples = 12 +cycles.preview_samples = 12 +cycles.aa_samples = 4 +cycles.preview_aa_samples = 4 + +cycles.diffuse_samples = 3 +cycles.glossy_samples = 2 +cycles.transmission_samples = 2 +cycles.ao_samples = 1 +cycles.mesh_light_samples = 2 +cycles.subsurface_samples = 2 diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py index ed20cb22297..6193611504e 100644 --- a/release/scripts/startup/bl_operators/anim.py +++ b/release/scripts/startup/bl_operators/anim.py @@ -190,6 +190,11 @@ class BakeAction(Operator): description="Only key selected object/bones", default=True, ) + visual_keying = BoolProperty( + name="Visual Keying", + description="Keyframe from the final transformations (with constraints applied)", + default=False, + ) clear_constraints = BoolProperty( name="Clear Constraints", description="Remove all constraints from keyed object/bones, and do 'visual' keying", @@ -220,6 +225,7 @@ class BakeAction(Operator): only_selected=self.only_selected, do_pose='POSE' in self.bake_types, do_object='OBJECT' in self.bake_types, + do_visual_keying=self.visual_keying, do_constraint_clear=self.clear_constraints, do_parents_clear=self.clear_parents, do_clean=True, diff --git a/release/scripts/startup/bl_operators/node.py b/release/scripts/startup/bl_operators/node.py index cc1fa93ec2c..c70b5832bfb 100644 --- a/release/scripts/startup/bl_operators/node.py +++ b/release/scripts/startup/bl_operators/node.py @@ -66,8 +66,12 @@ class NodeAddOperator(): # convert mouse position to the View2D for later node placement if context.region.type == 'WINDOW': + # XXX, temp fix for [#35920], still fails for (U.pixelsize != 1) + dpi_fac = context.user_preferences.system.dpi / 72.0 space.cursor_location = v2d.region_to_view(event.mouse_region_x, event.mouse_region_y) + space.cursor_location /= dpi_fac + else: space.cursor_location = tree.view_center diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 3919ecdd72f..63d9aa31ddd 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -471,34 +471,29 @@ class WM_OT_context_cycle_array(Operator): return operator_path_undo_return(context, data_path) -class WM_MT_context_menu_enum(Menu): - bl_label = "" - data_path = "" # BAD DESIGN, set from operator below. +class WM_OT_context_menu_enum(Operator): + bl_idname = "wm.context_menu_enum" + bl_label = "Context Enum Menu" + bl_options = {'UNDO', 'INTERNAL'} + data_path = rna_path_prop - def draw(self, context): + def execute(self, context): data_path = self.data_path value = context_path_validate(context, data_path) + if value is Ellipsis: return {'PASS_THROUGH'} + base_path, prop_string = data_path.rsplit(".", 1) value_base = context_path_validate(context, base_path) prop = value_base.bl_rna.properties[prop_string] - layout = self.layout - layout.label(prop.name, icon=prop.icon) - layout.prop(value_base, prop_string, expand=True) + def draw_cb(self, context): + layout = self.layout + layout.prop(value_base, prop_string, expand=True) + context.window_manager.popup_menu(draw_func=draw_cb, title=prop.name, icon=prop.icon) -class WM_OT_context_menu_enum(Operator): - bl_idname = "wm.context_menu_enum" - bl_label = "Context Enum Menu" - bl_options = {'UNDO', 'INTERNAL'} - data_path = rna_path_prop - - def execute(self, context): - data_path = self.data_path - WM_MT_context_menu_enum.data_path = data_path - bpy.ops.wm.call_menu(name="WM_MT_context_menu_enum") return {'PASS_THROUGH'} diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py index 594f724c6e3..b9f2e8406c6 100644 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@ -72,7 +72,6 @@ _modules = [ "space_sequencer", "space_text", "space_time", - "space_userpref_keymap", "space_userpref", "space_view3d", "space_view3d_toolbar", diff --git a/release/scripts/startup/bl_ui/properties_data_curve.py b/release/scripts/startup/bl_ui/properties_data_curve.py index 7747ef45c4d..117a662cd07 100644 --- a/release/scripts/startup/bl_ui/properties_data_curve.py +++ b/release/scripts/startup/bl_ui/properties_data_curve.py @@ -362,7 +362,7 @@ class DATA_PT_paragraph(CurveButtonsPanel, Panel): col = split.column(align=True) col.label(text="Spacing:") - col.prop(text, "space_character", text="Character") + col.prop(text, "space_character", text="Letter") col.prop(text, "space_word", text="Word") col.prop(text, "space_line", text="Line") diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index b6ad14196cd..b5461c45433 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -33,7 +33,7 @@ class MESH_MT_vertex_group_specials(Menu): layout.operator("object.vertex_group_copy", icon='COPY_ID') layout.operator("object.vertex_group_copy_to_linked", icon='LINK_AREA') layout.operator("object.vertex_group_copy_to_selected", icon='LINK_AREA') - layout.operator("object.vertex_group_mirror", icon='ARROW_LEFTRIGHT') + layout.operator("object.vertex_group_mirror", icon='ARROW_LEFTRIGHT').use_topology = False layout.operator("object.vertex_group_mirror", text="Mirror Vertex Group (Topology)", icon='ARROW_LEFTRIGHT').use_topology = True layout.operator("object.vertex_group_remove_from", icon='X', text="Remove from All Groups").use_all_groups = True layout.operator("object.vertex_group_remove_from", icon='X', text="Clear Active Group").use_all_verts = True @@ -53,7 +53,7 @@ class MESH_MT_shape_key_specials(Menu): layout.operator("object.shape_key_transfer", icon='COPY_ID') # icon is not ideal layout.operator("object.join_shapes", icon='COPY_ID') # icon is not ideal - layout.operator("object.shape_key_mirror", icon='ARROW_LEFTRIGHT') + layout.operator("object.shape_key_mirror", icon='ARROW_LEFTRIGHT').use_topology = False layout.operator("object.shape_key_mirror", text="Mirror Shape Key (Topology)", icon='ARROW_LEFTRIGHT').use_topology = True layout.operator("object.shape_key_add", icon='ZOOMIN', text="New Shape From Mix").from_mix = True layout.operator("object.shape_key_remove", icon='X', text="Delete All Shapes").all = True diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 89e90618383..861d64382ef 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -715,9 +715,11 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): col = split.column() col.label(text="Origin:") col.prop(md, "origin", text="") - sub = col.column() - sub.active = (md.origin is not None) - sub.prop(md, "use_relative") + + if md.deform_method in {'TAPER', 'STRETCH', 'TWIST'}: + col.label(text="Lock:") + col.prop(md, "lock_x") + col.prop(md, "lock_y") col = split.column() col.label(text="Deform:") @@ -726,9 +728,6 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): else: col.prop(md, "angle") col.prop(md, "limits", slider=True) - if md.deform_method in {'TAPER', 'STRETCH', 'TWIST'}: - col.prop(md, "lock_x") - col.prop(md, "lock_y") def SMOKE(self, layout, ob, md): layout.label(text="Settings can be found inside the Physics context") diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py index 38e49853454..025d86204f2 100644 --- a/release/scripts/startup/bl_ui/properties_game.py +++ b/release/scripts/startup/bl_ui/properties_game.py @@ -414,6 +414,9 @@ class RENDER_PT_game_system(RenderButtonsPanel, Panel): col.active = gs.raster_storage != 'VERTEX_BUFFER_OBJECT' row = layout.row() + row.prop(gs, "vsync") + + row = layout.row() row.prop(gs, "raster_storage") row = layout.row() diff --git a/release/scripts/startup/bl_ui/properties_mask_common.py b/release/scripts/startup/bl_ui/properties_mask_common.py index c9b1bc0ccff..d38f5f934b4 100644 --- a/release/scripts/startup/bl_ui/properties_mask_common.py +++ b/release/scripts/startup/bl_ui/properties_mask_common.py @@ -339,6 +339,11 @@ class MASK_MT_select(Menu): layout.separator() + layout.operator("mask.select_more") + layout.operator("mask.select_less") + + layout.separator() + layout.operator("mask.select_all").action = 'TOGGLE' layout.operator("mask.select_all", text="Inverse").action = 'INVERT' diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index 31023d49340..ec2492f7365 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -205,10 +205,20 @@ class OBJECT_PT_display(ObjectButtonsPanel, Panel): layout = self.layout obj = context.object + obj_type = obj.type + is_geometry = (obj_type in {'MESH', 'CURVE', 'SURFACE', 'META', 'FONT'}) + is_empty_image = (obj_type == 'EMPTY' and obj.empty_draw_type == 'IMAGE') split = layout.split() + col = split.column() - col.prop(obj, "draw_type", text="Type") + col.prop(obj, "show_name", text="Name") + col.prop(obj, "show_axis", text="Axis") + if is_geometry: + # Makes no sense for cameras, armatures, etc.! + col.prop(obj, "show_wire", text="Wire") + if obj_type == 'MESH': + col.prop(obj, "show_all_edges") col = split.column() row = col.row() @@ -217,27 +227,24 @@ class OBJECT_PT_display(ObjectButtonsPanel, Panel): sub.active = obj.show_bounds sub.prop(obj, "draw_bounds_type", text="") + if is_geometry: + col.prop(obj, "show_texture_space", text="Texture Space") + col.prop(obj, "show_x_ray", text="X-Ray") + if obj_type == 'MESH' or is_empty_image: + col.prop(obj, "show_transparent", text="Transparency") + split = layout.split() col = split.column() - col.prop(obj, "show_name", text="Name") - col.prop(obj, "show_axis", text="Axis") - - obj_type = obj.type - - if obj_type in {'MESH', 'CURVE', 'SURFACE', 'META', 'FONT'}: - # Makes no sense for cameras, armtures, etc.! - col.prop(obj, "show_wire", text="Wire") - # Only useful with object having faces/materials... - col.prop(obj, "color", text="Object Color") + if obj_type not in {'CAMERA', 'EMPTY'}: + col.label(text="Maximum draw type:") + col.prop(obj, "draw_type", text="") col = split.column() - col.prop(obj, "show_texture_space", text="Texture Space") - col.prop(obj, "show_x_ray", text="X-Ray") - if obj_type == 'MESH' or (obj_type == 'EMPTY' and obj.empty_draw_type == 'IMAGE'): - col.prop(obj, "show_transparent", text="Transparency") - if obj_type == 'MESH': - col.prop(obj, "show_all_edges") + if is_geometry or is_empty_image: + # Only useful with object having faces/materials... + col.label(text="Object Color:") + col.prop(obj, "color", text="") class OBJECT_PT_duplication(ObjectButtonsPanel, Panel): diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index eb0d9c5082d..22e2e6e08a2 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -232,6 +232,7 @@ class IMAGE_MT_uvs_snap(Menu): layout.operator("uv.snap_selected", text="Selected to Pixels").target = 'PIXELS' layout.operator("uv.snap_selected", text="Selected to Cursor").target = 'CURSOR' + layout.operator("uv.snap_selected", text="Selected to Cursor (Offset)").target = 'CURSOR_OFFSET' layout.operator("uv.snap_selected", text="Selected to Adjacent Unselected").target = 'ADJACENT_UNSELECTED' layout.separator() diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 3477353ba0d..79191637080 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -671,13 +671,14 @@ class SEQUENCER_PT_sound(SequencerButtonsPanel, Panel): layout.separator() layout.prop(strip, "filepath", text="") - row = layout.row() - if sound.packed_file: - row.operator("sound.unpack", icon='PACKAGE', text="Unpack") - else: - row.operator("sound.pack", icon='UGLYPACKAGE', text="Pack") + if sound is not None: + row = layout.row() + if sound.packed_file: + row.operator("sound.unpack", icon='PACKAGE', text="Unpack") + else: + row.operator("sound.pack", icon='UGLYPACKAGE', text="Pack") - row.prop(sound, "use_memory_cache") + row.prop(sound, "use_memory_cache") layout.prop(strip, "show_waveform") layout.prop(strip, "volume") diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 54387f10a8d..3e281e08983 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -917,9 +917,6 @@ class USERPREF_PT_file(Panel): col.prop(system, "author", text="") -from bl_ui.space_userpref_keymap import InputKeyMapPanel - - class USERPREF_MT_ndof_settings(Menu): # accessed from the window key-bindings in C (only) bl_label = "3D Mouse Settings" @@ -960,9 +957,25 @@ class USERPREF_MT_ndof_settings(Menu): layout.prop(input_prefs, "ndof_lock_horizon", icon='NDOF_DOM') -class USERPREF_PT_input(Panel, InputKeyMapPanel): +class USERPREF_MT_keyconfigs(Menu): + bl_label = "KeyPresets" + preset_subdir = "keyconfig" + preset_operator = "wm.keyconfig_activate" + + def draw(self, context): + props = self.layout.operator("wm.context_set_value", text="Blender (default)") + props.data_path = "window_manager.keyconfigs.active" + props.value = "context.window_manager.keyconfigs.default" + + # now draw the presets + Menu.draw_preset(self, context) + + +class USERPREF_PT_input(Panel): bl_space_type = 'USER_PREFERENCES' bl_label = "Input" + bl_region_type = 'WINDOW' + bl_options = {'HIDE_HEADER'} @classmethod def poll(cls, context): @@ -1039,6 +1052,8 @@ class USERPREF_PT_input(Panel, InputKeyMapPanel): row.separator() def draw(self, context): + from rna_keymap_ui import draw_keymaps + layout = self.layout #import time @@ -1055,7 +1070,7 @@ class USERPREF_PT_input(Panel, InputKeyMapPanel): self.draw_input_prefs(inputs, split) # Keymap Settings - self.draw_keymaps(context, split) + draw_keymaps(context, split) #print("runtime", time.time() - start) diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py deleted file mode 100644 index 8d6eb2c623d..00000000000 --- a/release/scripts/startup/bl_ui/space_userpref_keymap.py +++ /dev/null @@ -1,391 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -from bpy.types import Menu -from bpy.app.translations import pgettext_iface as iface_ -from bpy.app.translations import contexts as i18n_contexts - - -class USERPREF_MT_keyconfigs(Menu): - bl_label = "KeyPresets" - preset_subdir = "keyconfig" - preset_operator = "wm.keyconfig_activate" - - def draw(self, context): - props = self.layout.operator("wm.context_set_value", text="Blender (default)") - props.data_path = "window_manager.keyconfigs.active" - props.value = "context.window_manager.keyconfigs.default" - - # now draw the presets - Menu.draw_preset(self, context) - - -class InputKeyMapPanel: - bl_space_type = 'USER_PREFERENCES' - bl_label = "Input" - bl_region_type = 'WINDOW' - bl_options = {'HIDE_HEADER'} - - def draw_entry(self, display_keymaps, entry, col, level=0): - idname, spaceid, regionid, children = entry - - for km, kc in display_keymaps: - if km.name == idname and km.space_type == spaceid and km.region_type == regionid: - self.draw_km(display_keymaps, kc, km, children, col, level) - - ''' - km = kc.keymaps.find(idname, space_type=spaceid, region_type=regionid) - if not km: - kc = defkc - km = kc.keymaps.find(idname, space_type=spaceid, region_type=regionid) - - if km: - self.draw_km(kc, km, children, col, level) - ''' - - def indented_layout(self, layout, level): - indentpx = 16 - if level == 0: - level = 0.0001 # Tweak so that a percentage of 0 won't split by half - indent = level * indentpx / bpy.context.region.width - - split = layout.split(percentage=indent) - col = split.column() - col = split.column() - return col - - def draw_km(self, display_keymaps, kc, km, children, layout, level): - km = km.active() - - layout.context_pointer_set("keymap", km) - - col = self.indented_layout(layout, level) - - row = col.row() - row.prop(km, "show_expanded_children", text="", emboss=False) - row.label(text=km.name, text_ctxt=i18n_contexts.id_windowmanager) - - row.label() - row.label() - - if km.is_modal: - row.label(text="", icon='LINKED') - if km.is_user_modified: - row.operator("wm.keymap_restore", text="Restore") - else: - row.label() - - if km.show_expanded_children: - if children: - # Put the Parent key map's entries in a 'global' sub-category - # equal in hierarchy to the other children categories - subcol = self.indented_layout(col, level + 1) - subrow = subcol.row() - subrow.prop(km, "show_expanded_items", text="", emboss=False) - subrow.label(text=iface_("%s (Global)") % km.name, translate=False) - else: - km.show_expanded_items = True - - # Key Map items - if km.show_expanded_items: - for kmi in km.keymap_items: - self.draw_kmi(display_keymaps, kc, km, kmi, col, level + 1) - - # "Add New" at end of keymap item list - col = self.indented_layout(col, level + 1) - subcol = col.split(percentage=0.2).column() - subcol.operator("wm.keyitem_add", text="Add New", text_ctxt=i18n_contexts.id_windowmanager, - icon='ZOOMIN') - - col.separator() - - # Child key maps - if children: - subcol = col.column() - row = subcol.row() - - for entry in children: - self.draw_entry(display_keymaps, entry, col, level + 1) - - def draw_kmi(self, display_keymaps, kc, km, kmi, layout, level): - map_type = kmi.map_type - - col = self.indented_layout(layout, level) - - if kmi.show_expanded: - col = col.column(align=True) - box = col.box() - else: - box = col.column() - - split = box.split(percentage=0.05) - - # header bar - row = split.row() - row.prop(kmi, "show_expanded", text="", emboss=False) - - row = split.row() - row.prop(kmi, "active", text="", emboss=False) - - if km.is_modal: - row.prop(kmi, "propvalue", text="") - else: - row.label(text=kmi.name) - - row = split.row() - row.prop(kmi, "map_type", text="") - if map_type == 'KEYBOARD': - row.prop(kmi, "type", text="", full_event=True) - elif map_type == 'MOUSE': - row.prop(kmi, "type", text="", full_event=True) - elif map_type == 'NDOF': - row.prop(kmi, "type", text="", full_event=True) - elif map_type == 'TWEAK': - subrow = row.row() - subrow.prop(kmi, "type", text="") - subrow.prop(kmi, "value", text="") - elif map_type == 'TIMER': - row.prop(kmi, "type", text="") - else: - row.label() - - if (not kmi.is_user_defined) and kmi.is_user_modified: - row.operator("wm.keyitem_restore", text="", icon='BACK').item_id = kmi.id - else: - row.operator("wm.keyitem_remove", text="", icon='X').item_id = kmi.id - - # Expanded, additional event settings - if kmi.show_expanded: - box = col.box() - - split = box.split(percentage=0.4) - sub = split.row() - - if km.is_modal: - sub.prop(kmi, "propvalue", text="") - else: - # One day... - #~ sub.prop_search(kmi, "idname", bpy.context.window_manager, "operators_all", text="") - sub.prop(kmi, "idname", text="") - - if map_type not in {'TEXTINPUT', 'TIMER'}: - sub = split.column() - subrow = sub.row(align=True) - - if map_type == 'KEYBOARD': - subrow.prop(kmi, "type", text="", event=True) - subrow.prop(kmi, "value", text="") - elif map_type in {'MOUSE', 'NDOF'}: - subrow.prop(kmi, "type", text="") - subrow.prop(kmi, "value", text="") - - subrow = sub.row() - subrow.scale_x = 0.75 - subrow.prop(kmi, "any") - subrow.prop(kmi, "shift") - subrow.prop(kmi, "ctrl") - subrow.prop(kmi, "alt") - subrow.prop(kmi, "oskey", text="Cmd") - subrow.prop(kmi, "key_modifier", text="", event=True) - - # Operator properties - box.template_keymap_item_properties(kmi) - - # Modal key maps attached to this operator - if not km.is_modal: - kmm = kc.keymaps.find_modal(kmi.idname) - if kmm: - self.draw_km(display_keymaps, kc, kmm, None, layout, level + 1) - layout.context_pointer_set("keymap", km) - - _EVENT_TYPES = set() - _EVENT_TYPE_MAP = {} - - def draw_filtered(self, display_keymaps, filter_type, filter_text, layout): - - if filter_type == 'NAME': - def filter_func(kmi): - return (filter_text in kmi.idname.lower() or - filter_text in kmi.name.lower()) - else: - if not self._EVENT_TYPES: - enum = bpy.types.Event.bl_rna.properties["type"].enum_items - self._EVENT_TYPES.update(enum.keys()) - self._EVENT_TYPE_MAP.update({item.name.replace(" ", "_").upper(): key for key, item in enum.items()}) - - del enum - self._EVENT_TYPE_MAP.update({ - "`": 'ACCENT_GRAVE', - "*": 'NUMPAD_ASTERIX', - "/": 'NUMPAD_SLASH', - "RMB": 'RIGHTMOUSE', - "LMB": 'LEFTMOUSE', - "MMB": 'MIDDLEMOUSE', - }) - self._EVENT_TYPE_MAP.update({ - "%d" % i: "NUMPAD_%d" % i for i in range(9) - }) - # done with once off init - - filter_text_split = filter_text.strip() - filter_text_split = filter_text.split() - - # Modifier {kmi.attribute: name} mapping - key_mod = { - "ctrl": "ctrl", - "alt": "alt", - "shift": "shift", - "cmd": "oskey", - "oskey": "oskey", - "any": "any", - } - # KeyMapItem like dict, use for comparing against - # attr: state - kmi_test_dict = {} - - # initialize? - so if a if a kmi has a MOD assigned it wont show up. - #~ for kv in key_mod.values(): - #~ kmi_test_dict[kv] = False - - # altname: attr - for kk, kv in key_mod.items(): - if kk in filter_text_split: - filter_text_split.remove(kk) - kmi_test_dict[kv] = True - # whats left should be the event type - if len(filter_text_split) > 1: - return False - elif filter_text_split: - kmi_type = filter_text_split[0].upper() - - if kmi_type not in self._EVENT_TYPES: - # replacement table - kmi_type_test = self._EVENT_TYPE_MAP.get(kmi_type) - if kmi_type_test is None: - # print("Unknown Type:", kmi_type) - - # Partial match - for k, v in self._EVENT_TYPE_MAP.items(): - if kmi_type in k: - kmi_type_test = v - break - if kmi_type in v: - kmi_type_test = v - break - - if kmi_type_test is None: - return False - - kmi_type = kmi_type_test - del kmi_type_test - - kmi_test_dict["type"] = kmi_type - - # main filter func, runs many times - def filter_func(kmi): - for kk, ki in kmi_test_dict.items(): - if getattr(kmi, kk) != ki: - return False - return True - - for km, kc in display_keymaps: - km = km.active() - layout.context_pointer_set("keymap", km) - - filtered_items = [kmi for kmi in km.keymap_items if filter_func(kmi)] - - if filtered_items: - col = layout.column() - - row = col.row() - row.label(text=km.name, icon='DOT') - - row.label() - row.label() - - if km.is_user_modified: - row.operator("wm.keymap_restore", text="Restore") - else: - row.label() - - for kmi in filtered_items: - self.draw_kmi(display_keymaps, kc, km, kmi, col, 1) - - # "Add New" at end of keymap item list - col = self.indented_layout(layout, 1) - subcol = col.split(percentage=0.2).column() - subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN') - return True - - def draw_hierarchy(self, display_keymaps, layout): - from bpy_extras import keyconfig_utils - for entry in keyconfig_utils.KM_HIERARCHY: - self.draw_entry(display_keymaps, entry, layout) - - def draw_keymaps(self, context, layout): - from bpy_extras import keyconfig_utils - - wm = context.window_manager - kc = wm.keyconfigs.user - spref = context.space_data - - col = layout.column() - sub = col.column() - - subsplit = sub.split() - subcol = subsplit.column() - - row = subcol.row(align=True) - - #~ row.prop_search(wm.keyconfigs, "active", wm, "keyconfigs", text="Key Config:") - text = bpy.path.display_name(wm.keyconfigs.active.name) - if not text: - text = "Blender (default)" - row.menu("USERPREF_MT_keyconfigs", text=text) - row.operator("wm.keyconfig_preset_add", text="", icon='ZOOMIN') - row.operator("wm.keyconfig_preset_add", text="", icon='ZOOMOUT').remove_active = True - - #~ layout.context_pointer_set("keyconfig", wm.keyconfigs.active) - #~ row.operator("wm.keyconfig_remove", text="", icon='X') - row.separator() - rowsub = row.split(align=True, percentage=0.33) - # postpone drawing into rowsub, so we can set alert! - - col.separator() - display_keymaps = keyconfig_utils.keyconfig_merge(kc, kc) - filter_type = spref.filter_type - filter_text = spref.filter_text.strip() - if filter_text: - filter_text = filter_text.lower() - ok = self.draw_filtered(display_keymaps, filter_type, filter_text, col) - else: - self.draw_hierarchy(display_keymaps, col) - ok = True - - # go back and fill in rowsub - rowsub.prop(spref, "filter_type", text="") - rowsubsub = rowsub.row(align=True) - if not ok: - rowsubsub.alert = True - rowsubsub.prop(spref, "filter_text", text="", icon='VIEWZOOM') - - -if __name__ == "__main__": # only for live edit. - bpy.utils.register_module(__name__) diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 20f998cd568..58eecc2641d 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -293,7 +293,10 @@ class VIEW3D_MT_snap(Menu): layout = self.layout layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid") - layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor") + props = layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor") + props.use_offset = False + props = layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor (Offset)") + props.use_offset = True layout.separator() @@ -617,8 +620,8 @@ class VIEW3D_MT_select_edit_mesh(Menu): layout.separator() - layout.operator("mesh.select_less", text="Less") layout.operator("mesh.select_more", text="More") + layout.operator("mesh.select_less", text="Less") layout.separator() @@ -723,6 +726,7 @@ class VIEW3D_MT_select_edit_lattice(Menu): layout.separator() + layout.operator("lattice.select_random") layout.operator("lattice.select_all").action = 'TOGGLE' layout.operator("lattice.select_all", text="Inverse").action = 'INVERT' @@ -747,6 +751,11 @@ class VIEW3D_MT_select_edit_armature(Menu): layout.separator() + layout.operator("armature.select_more", text="More") + layout.operator("armature.select_less", text="Less") + + layout.separator() + layout.operator("armature.select_hierarchy", text="Parent").direction = 'PARENT' layout.operator("armature.select_hierarchy", text="Child").direction = 'CHILD' @@ -1813,6 +1822,7 @@ class VIEW3D_MT_edit_mesh(Menu): layout.menu("VIEW3D_MT_edit_mesh_edges") layout.menu("VIEW3D_MT_edit_mesh_faces") layout.menu("VIEW3D_MT_edit_mesh_normals") + layout.menu("VIEW3D_MT_edit_mesh_clean") layout.separator() @@ -1963,7 +1973,9 @@ class VIEW3D_MT_edit_mesh_edges(Menu): def draw(self, context): layout = self.layout + with_freestyle = bpy.app.build_options.freestyle + scene = context.scene layout.operator_context = 'INVOKE_REGION_WIN' @@ -1988,11 +2000,10 @@ class VIEW3D_MT_edit_mesh_edges(Menu): layout.separator() - if with_freestyle: + if with_freestyle and not scene.render.use_shading_nodes: layout.operator("mesh.mark_freestyle_edge").clear = False layout.operator("mesh.mark_freestyle_edge", text="Clear Freestyle Edge").clear = True - - layout.separator() + layout.separator() layout.operator("mesh.edge_rotate", text="Rotate Edge CW").use_ccw = False layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").use_ccw = True @@ -2018,7 +2029,9 @@ class VIEW3D_MT_edit_mesh_faces(Menu): def draw(self, context): layout = self.layout + with_freestyle = bpy.app.build_options.freestyle + scene = context.scene layout.operator_context = 'INVOKE_REGION_WIN' @@ -2034,11 +2047,10 @@ class VIEW3D_MT_edit_mesh_faces(Menu): layout.separator() - if with_freestyle: + if with_freestyle and not scene.render.use_shading_nodes: layout.operator("mesh.mark_freestyle_face").clear = False layout.operator("mesh.mark_freestyle_face", text="Clear Freestyle Face").clear = True - - layout.separator() + layout.separator() layout.operator("mesh.poke") layout.operator("mesh.quads_convert_to_tris") @@ -2075,6 +2087,16 @@ class VIEW3D_MT_edit_mesh_normals(Menu): layout.operator("mesh.flip_normals") +class VIEW3D_MT_edit_mesh_clean(Menu): + bl_label = "Clean" + + def draw(self, context): + layout = self.layout + + layout.operator("mesh.fill_holes") + layout.operator("mesh.vert_connect_nonplanar") + + class VIEW3D_MT_edit_mesh_delete(Menu): bl_label = "Delete" @@ -2188,7 +2210,9 @@ class VIEW3D_MT_edit_curve_specials(Menu): layout.operator("curve.spline_weight_set") layout.operator("curve.radius_set") layout.operator("curve.smooth") + layout.operator("curve.smooth_weight") layout.operator("curve.smooth_radius") + layout.operator("curve.smooth_tilt") class VIEW3D_MT_edit_curve_showhide(ShowHideMenu, Menu): @@ -2534,7 +2558,7 @@ class VIEW3D_PT_view3d_display(Panel): view = context.space_data scene = context.scene gs = scene.game_settings - ob = context.object + obj = context.object col = layout.column() col.prop(view, "show_only_render") @@ -2574,6 +2598,8 @@ class VIEW3D_PT_view3d_display(Panel): if view.use_matcap: col.template_icon_view(view, "matcap_icon") col.prop(view, "show_backface_culling") + if obj and obj.mode == 'EDIT' and view.viewport_shade not in {'BOUNDBOX', 'WIREFRAME'}: + col.prop(view, "show_occlude_wire") layout.separator() @@ -2637,6 +2663,7 @@ class VIEW3D_PT_view3d_meshdisplay(Panel): with_freestyle = bpy.app.build_options.freestyle mesh = context.active_object.data + scene = context.scene split = layout.split() @@ -2656,7 +2683,7 @@ class VIEW3D_PT_view3d_meshdisplay(Panel): col.prop(mesh, "show_edge_seams", text="Seams") col.prop(mesh, "show_edge_sharp", text="Sharp", text_ctxt=i18n_contexts.plural) col.prop(mesh, "show_edge_bevel_weight", text="Bevel") - if with_freestyle: + if with_freestyle and not scene.render.use_shading_nodes: col.prop(mesh, "show_freestyle_edge_marks", text="Edge Marks") col.prop(mesh, "show_freestyle_face_marks", text="Face Marks") diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 1383775042d..f253801f431 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -277,7 +277,6 @@ class VIEW3D_PT_tools_curveedit(View3DPanel, Panel): col.operator("curve.switch_direction") col.operator("curve.spline_type_set") col.operator("curve.radius_set") - col.operator("curve.smooth_radius") col = layout.column(align=True) col.label(text="Handles:") diff --git a/release/scripts/templates_py/custom_nodes.py b/release/scripts/templates_py/custom_nodes.py index d5bb71416c9..5f002f37161 100644 --- a/release/scripts/templates_py/custom_nodes.py +++ b/release/scripts/templates_py/custom_nodes.py @@ -1,5 +1,5 @@ import bpy -from bpy_types import NodeTree, Node, NodeSocket +from bpy.types import NodeTree, Node, NodeSocket # Implementation of custom nodes from Python diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c index 48e64695822..6f819d438df 100644 --- a/source/blender/avi/intern/avi.c +++ b/source/blender/avi/intern/avi.c @@ -811,12 +811,16 @@ AviError AVI_open_compress(char *name, AviMovie *movie, int streams, ...) movie->streams[i].sh.fcc = FCC("strh"); movie->streams[i].sh.size = 56; movie->streams[i].sh.Type = avi_get_format_type(movie->streams[i].format); - if (movie->streams[i].sh.Type == 0) + if (movie->streams[i].sh.Type == 0) { + va_end(ap); return AVI_ERROR_FORMAT; + } movie->streams[i].sh.Handler = avi_get_format_fcc(movie->streams[i].format); - if (movie->streams[i].sh.Handler == 0) + if (movie->streams[i].sh.Handler == 0) { + va_end(ap); return AVI_ERROR_FORMAT; + } movie->streams[i].sh.Flags = 0; movie->streams[i].sh.Priority = 0; @@ -950,6 +954,8 @@ AviError AVI_open_compress(char *name, AviMovie *movie, int streams, ...) PUT_FCCN((header_pos2 - header_pos1 + 4L), movie->fp); + va_end(ap); + return AVI_ERROR_NONE; } diff --git a/source/blender/avi/intern/avi_options.c b/source/blender/avi/intern/avi_options.c index f7759a1099f..c552cbe8724 100644 --- a/source/blender/avi/intern/avi_options.c +++ b/source/blender/avi/intern/avi_options.c @@ -112,7 +112,7 @@ AviError AVI_set_compress_option(AviMovie *movie, int option_type, int stream, A awrite(movie, movie->streams[i].sf, 1, movie->streams[i].sf_size, movie->fp, AVI_BITMAPH); } } - + break; } fseek(movie->fp, movie->offset_table[0], SEEK_SET); diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 56a77d643d6..15098d50531 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -87,7 +87,7 @@ void blf_font_size(FontBLF *font, unsigned int size, unsigned int dpi) err = FT_Set_Char_Size(font->face, 0, (FT_F26Dot6)(size * 64), dpi, dpi); if (err) { /* FIXME: here we can go through the fixed size and choice a close one */ - printf("The current font don't support the size, %d and dpi, %d\n", size, dpi); + printf("The current font don't support the size, %u and dpi, %u\n", size, dpi); return; } diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index fdb43f5467e..8396380fd06 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -152,6 +152,11 @@ typedef enum DMDrawFlag { DM_DRAW_ALWAYS_SMOOTH = 2 } DMDrawFlag; +typedef enum DMForeachFlag { + DM_FOREACH_NOP = 0, + DM_FOREACH_USE_NORMAL = (1 << 0), /* foreachMappedVert, foreachMappedFaceCenter */ +} DMForeachFlag; + typedef enum DMDirtyFlag { /* dm has valid tessellated faces, but tessellated CDDATA need to be updated. */ DM_DIRTY_TESS_CDLAYERS = 1 << 0, @@ -285,7 +290,8 @@ struct DerivedMesh { void (*foreachMappedVert)(DerivedMesh *dm, void (*func)(void *userData, int index, const float co[3], const float no_f[3], const short no_s[3]), - void *userData); + void *userData, + DMForeachFlag flag); /** Iterate over each mapped edge in the derived mesh, calling the * given function with the original edge and the mapped edge's new @@ -303,7 +309,8 @@ struct DerivedMesh { void (*foreachMappedFaceCenter)(DerivedMesh *dm, void (*func)(void *userData, int index, const float cent[3], const float no[3]), - void *userData); + void *userData, + DMForeachFlag flag); /** Iterate over all vertex points, calling DO_MINMAX with given args. * @@ -323,6 +330,7 @@ struct DerivedMesh { /** Get smooth vertex normal, undefined if index is not valid */ void (*getVertNo)(DerivedMesh *dm, int index, float no_r[3]); + void (*getPolyNo)(DerivedMesh *dm, int index, float no_r[3]); /** Get a map of vertices to faces */ @@ -437,7 +445,7 @@ struct DerivedMesh { */ void (*drawMappedFacesMat)(DerivedMesh *dm, void (*setMaterial)(void *userData, int, void *attribs), - int (*setFace)(void *userData, int index), void *userData); + bool (*setFace)(void *userData, int index), void *userData); /** Release reference to the DerivedMesh. This function decides internally * if the DerivedMesh will be freed, or cached for later use. */ diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index 9e874c9aa15..a0c2908a646 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -41,7 +41,7 @@ extern "C" { /* these lines are grep'd, watch out for our not-so-awesome regex * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ -#define BLENDER_VERSION 267 +#define BLENDER_VERSION 268 #define BLENDER_SUBVERSION 1 /* 262 was the last editmesh release but it has compatibility code for bmesh data */ @@ -50,9 +50,9 @@ extern "C" { /* used by packaging tools */ /* can be left blank, otherwise a,b,c... etc with no quotes */ -#define BLENDER_VERSION_CHAR b +#define BLENDER_VERSION_CHAR a /* alpha/beta/rc/release, docs use this */ -#define BLENDER_VERSION_CYCLE rc +#define BLENDER_VERSION_CYCLE alpha extern char versionstr[]; /* from blender.c */ diff --git a/source/blender/blenkernel/BKE_bmesh.h b/source/blender/blenkernel/BKE_bmesh.h deleted file mode 100644 index 0dfab26e9f0..00000000000 --- a/source/blender/blenkernel/BKE_bmesh.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2004 Blender Foundation. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): Geoffrey Bantle. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#ifndef __BKE_BMESH_H__ -#define __BKE_BMESH_H__ - -/** \file BKE_bmesh.h - * \ingroup bke - * \since January 2007 - * \brief BMesh modeler structure and functions. - * - */ - -/*NOTE: this is the bmesh 1.0 code. it's completely outdated.*/ - -/* uncomment to use the new bevel operator as a modifier */ -#define USE_BM_BEVEL_OP_AS_MOD - -/* bevel tool defines */ -/* element flags */ -#define BME_BEVEL_ORIG 1 -#define BME_BEVEL_BEVEL (1 << 1) -#define BME_BEVEL_NONMAN (1 << 2) -#define BME_BEVEL_WIRE (1 << 3) - -/* tool options */ -#define BME_BEVEL_SELECT 1 -#define BME_BEVEL_VERT (1 << 1) -#define BME_BEVEL_RADIUS (1 << 2) -#define BME_BEVEL_ANGLE (1 << 3) -#define BME_BEVEL_WEIGHT (1 << 4) -#define BME_BEVEL_VGROUP (1 << 5) -//~ #define BME_BEVEL_EWEIGHT (1<<4) -//~ #define BME_BEVEL_VWEIGHT (1<<5) -#define BME_BEVEL_PERCENT (1 << 6) -#define BME_BEVEL_EMIN (1 << 7) -#define BME_BEVEL_EMAX (1 << 8) -#define BME_BEVEL_RUNNING (1 << 9) -#define BME_BEVEL_RES (1 << 10) - -#define BME_BEVEL_EVEN (1 << 11) /* this is a new setting not related to old (trunk bmesh bevel code) but adding - * here because they are mixed - campbell */ -#define BME_BEVEL_DIST (1 << 12) /* same as above */ - -#define BME_BEVEL_OVERLAP_OK (1 << 13) - -typedef struct BME_TransData { - struct BMesh *bm; /* the bmesh the vert belongs to */ - struct BMVert *v; /* pointer to the vert this tdata applies to */ - float co[3]; /* the original coordinate */ - float org[3]; /* the origin */ - float vec[3]; /* a directional vector; always, always normalize! */ - void *loc; /* a pointer to the data to transform (likely the vert's cos) */ - float factor; /* primary scaling factor; also accumulates number of weighted edges for beveling tool */ - float weight; /* another scaling factor; used primarily for propogating vertex weights to transforms; */ - /* weight is also used across recursive bevels to help with the math */ - float maxfactor; /* the unscaled, original factor (used only by "edge verts" in recursive beveling) */ - float *max; /* the maximum distance this vert can be transformed; negative is infinite - * it points to the "parent" maxfactor (where maxfactor makes little sense) - * where the max limit is stored (limits are stored per-corner) */ -} BME_TransData; - -typedef struct BME_TransData_Head { - struct GHash *gh; /* the hash structure for element lookup */ - struct MemArena *ma; /* the memory "pool" we will be drawing individual elements from */ - int len; -} BME_TransData_Head; - -struct BME_TransData *BME_get_transdata(struct BME_TransData_Head *td, struct BMVert *v); -void BME_free_transdata(struct BME_TransData_Head *td); -struct BMesh *BME_bevel(struct BMesh *bm, float value, int res, int options, int defgrp_index, float angle, - BME_TransData_Head **rtd); - -#endif diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index 285077f258c..c6a6b0672d1 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -200,8 +200,8 @@ void CTX_data_dir_set(bContextDataResult *result, const char **member); void CTX_data_type_set(struct bContextDataResult *result, short type); short CTX_data_type_get(struct bContextDataResult *result); -int CTX_data_equals(const char *member, const char *str); -int CTX_data_dir(const char *member); +bool CTX_data_equals(const char *member, const char *str); +bool CTX_data_dir(const char *member); #if 0 void CTX_data_pointer_set(bContextDataResult *result, void *data); diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index 3be77086336..93f9ec276aa 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -129,6 +129,14 @@ bool BKE_nurb_type_convert(struct Nurb *nu, const short type, const bool use_han void BKE_nurb_points_add(struct Nurb *nu, int number); void BKE_nurb_bezierPoints_add(struct Nurb *nu, int number); +struct BezTriple *BKE_nurb_bezt_get_next(struct Nurb *nu, struct BezTriple *bezt); +struct BezTriple *BKE_nurb_bezt_get_prev(struct Nurb *nu, struct BezTriple *bezt); +struct BPoint *BKE_nurb_bpoint_get_next(struct Nurb *nu, struct BPoint *bp); +struct BPoint *BKE_nurb_bpoint_get_prev(struct Nurb *nu, struct BPoint *bp); + +void BKE_nurb_bezt_calc_normal(struct Nurb *nu, struct BezTriple *bezt, float r_normal[3]); +void BKE_nurb_bezt_calc_plane(struct Nurb *nu, struct BezTriple *bezt, float r_plane[3]); + void BKE_nurb_handle_calc(struct BezTriple *bezt, struct BezTriple *prev, struct BezTriple *next, int mode); void BKE_nurb_handles_calc(struct Nurb *nu); diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h index 07bdbc1009b..a43a243106d 100644 --- a/source/blender/blenkernel/BKE_deform.h +++ b/source/blender/blenkernel/BKE_deform.h @@ -40,6 +40,7 @@ struct ListBase; struct bDeformGroup; struct MDeformVert; +struct bDeformGroup *BKE_defgroup_new(struct Object *ob, const char *name); void defgroup_copy_list(struct ListBase *lb1, struct ListBase *lb2); struct bDeformGroup *defgroup_duplicate(struct bDeformGroup *ingroup); struct bDeformGroup *defgroup_find_name(struct Object *ob, const char *name); diff --git a/source/blender/blenkernel/BKE_dynamicpaint.h b/source/blender/blenkernel/BKE_dynamicpaint.h index ffce16f39ff..62715c20500 100644 --- a/source/blender/blenkernel/BKE_dynamicpaint.h +++ b/source/blender/blenkernel/BKE_dynamicpaint.h @@ -29,6 +29,7 @@ struct bContext; struct wmOperator; +struct Scene; /* Actual surface point */ typedef struct PaintSurfaceData { @@ -69,8 +70,8 @@ void dynamicPaint_Modifier_copy(struct DynamicPaintModifierData *pmd, struct Dyn int dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, struct Scene *scene); struct DynamicPaintSurface *dynamicPaint_createNewSurface(struct DynamicPaintCanvasSettings *canvas, struct Scene *scene); -void dynamicPaint_clearSurface(struct DynamicPaintSurface *surface); -int dynamicPaint_resetSurface(struct DynamicPaintSurface *surface); +void dynamicPaint_clearSurface(struct Scene *scene, struct DynamicPaintSurface *surface); +int dynamicPaint_resetSurface(struct Scene *scene, struct DynamicPaintSurface *surface); void dynamicPaint_freeSurface(struct DynamicPaintSurface *surface); void dynamicPaint_freeCanvas(struct DynamicPaintModifierData *pmd); void dynamicPaint_freeBrush(struct DynamicPaintModifierData *pmd); @@ -85,7 +86,7 @@ void dynamicPaint_resetPreview(struct DynamicPaintCanvasSettings *canvas); struct DynamicPaintSurface *get_activeSurface(struct DynamicPaintCanvasSettings *canvas); /* image sequence baking */ -int dynamicPaint_createUVSurface(struct DynamicPaintSurface *surface); +int dynamicPaint_createUVSurface(struct Scene *scene, struct DynamicPaintSurface *surface); int dynamicPaint_calculateFrame(struct DynamicPaintSurface *surface, struct Scene *scene, struct Object *cObject, int frame); void dynamicPaint_outputSurfaceImage(struct DynamicPaintSurface *surface, char *filename, short output_layer); diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index d7ef04195d5..64a6811bf51 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -216,7 +216,7 @@ struct FCurve *rna_get_fcurve(struct PointerRNA *ptr, struct PropertyRNA *prop, int binarysearch_bezt_index(struct BezTriple array[], float frame, int arraylen, bool *r_replace); /* get the time extents for F-Curve */ -void calc_fcurve_range(struct FCurve *fcu, float *min, float *max, +bool calc_fcurve_range(struct FCurve *fcu, float *min, float *max, const short do_sel_only, const short do_min_length); /* get the bounding-box extents for F-Curve */ diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 0699344a887..9d33af1a0f4 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -46,7 +46,6 @@ extern "C" { /* forwards */ struct Main; struct Object; -struct BME_Glob; typedef struct Global { diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h index a159cbb13d4..de60d316426 100644 --- a/source/blender/blenkernel/BKE_key.h +++ b/source/blender/blenkernel/BKE_key.h @@ -59,6 +59,8 @@ void key_curve_position_weights(float t, float data[4], int type); void key_curve_tangent_weights(float t, float data[4], int type); void key_curve_normal_weights(float t, float data[4], int type); +float *BKE_key_evaluate_object_ex(struct Scene *scene, struct Object *ob, int *r_totelem, + float *arr, size_t arr_size); float *BKE_key_evaluate_object(struct Scene *scene, struct Object *ob, int *r_totelem); struct Key *BKE_key_from_object(struct Object *ob); diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 11c9c00613f..1c88a5c45dd 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -209,6 +209,7 @@ const char *BKE_mesh_cmp(struct Mesh *me1, struct Mesh *me2, float thresh); struct BoundBox *BKE_mesh_boundbox_get(struct Object *ob); void BKE_mesh_texspace_get(struct Mesh *me, float r_loc[3], float r_rot[3], float r_size[3]); +void BKE_mesh_texspace_copy_from_object(struct Mesh *me, struct Object *ob); /* if old, it converts mface->edcode to edge drawflags */ void BKE_mesh_make_edges(struct Mesh *me, const bool use_old); diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 463720fb8cf..992792dcb99 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -95,15 +95,16 @@ void BKE_object_mat3_to_rot(struct Object *ob, float mat[3][3], bool use_compat) void BKE_object_to_mat3(struct Object *ob, float mat[3][3]); void BKE_object_to_mat4(struct Object *ob, float mat[4][4]); void BKE_object_apply_mat4(struct Object *ob, float mat[4][4], const bool use_compat, const bool use_parent); +void BKE_object_matrix_local_get(struct Object *ob, float mat[4][4]); bool BKE_object_pose_context_check(struct Object *ob); struct Object *BKE_object_pose_armature_get(struct Object *ob); void BKE_object_where_is_calc(struct Scene *scene, struct Object *ob); -void BKE_object_where_is_calc_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob); +void BKE_object_where_is_calc_ex(struct Scene *scene, struct RigidBodyWorld *rbw, struct Object *ob, float r_originmat[3][3]); void BKE_object_where_is_calc_time(struct Scene *scene, struct Object *ob, float ctime); void BKE_object_where_is_calc_time_ex(struct Scene *scene, struct Object *ob, float ctime, - struct RigidBodyWorld *rbw); + struct RigidBodyWorld *rbw, float r_originmat[3][3]); void BKE_object_where_is_calc_simul(struct Scene *scene, struct Object *ob); void BKE_object_where_is_calc_mat4(struct Scene *scene, struct Object *ob, float obmat[4][4]); diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index 48c16f8db38..7d3d8d7dcbd 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -223,7 +223,7 @@ typedef struct PBVHVertexIter { struct CCGElem **grids; struct CCGElem *grid; struct CCGKey *key; - BLI_bitmap *grid_hidden, gh; + BLI_bitmap **grid_hidden, *gh; int *grid_indices; int totgrid; int gridsize; diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 34f34bb9951..61f665be586 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -75,7 +75,17 @@ struct Base *BKE_scene_base_add(struct Scene *sce, struct Object *ob); void BKE_scene_base_unlink(struct Scene *sce, struct Base *base); void BKE_scene_base_deselect_all(struct Scene *sce); void BKE_scene_base_select(struct Scene *sce, struct Base *selbase); -int BKE_scene_base_iter_next(struct Scene **scene, int val, struct Base **base, struct Object **ob); + +/* Scene base iteration function. + * Define struct here, so no need to bother with alloc/free it. + */ +typedef struct SceneBaseIter { + struct ListBase *duplilist; + struct DupliObject *dupob; + int fase; +} SceneBaseIter; + +int BKE_scene_base_iter_next(struct SceneBaseIter *iter, struct Scene **scene, int val, struct Base **base, struct Object **ob); void BKE_scene_base_flag_to_objects(struct Scene *scene); void BKE_scene_base_flag_from_objects(struct Scene *scene); diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 9fc0812fff7..78018f04458 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -208,6 +208,10 @@ int BKE_sequencer_recursive_apply(struct Sequence *seq, int (*apply_func)(struct void BKE_sequencer_free_clipboard(void); +void BKE_sequence_clipboard_pointers_free(struct Sequence *seq); +void BKE_sequence_clipboard_pointers_store(struct Sequence *seq); +void BKE_sequence_clipboard_pointers_restore(struct Sequence *seq, struct Main *bmain); + void BKE_sequence_free(struct Scene *scene, struct Sequence *seq); const char *BKE_sequence_give_name(struct Sequence *seq); void BKE_sequence_calc(struct Scene *scene, struct Sequence *seq); @@ -261,7 +265,7 @@ void BKE_sequencer_preprocessed_cache_cleanup_sequence(struct Sequence *seq); /* ********************************************************************** * seqeffects.c * - * Sequencer effect strip managment functions + * Sequencer effect strip management functions * ********************************************************************** */ @@ -319,8 +323,6 @@ void BKE_sequence_base_dupli_recursive(struct Scene *scene, struct Scene *scene_ bool BKE_sequence_is_valid_check(struct Sequence *seq); void BKE_sequencer_clear_scene_in_allseqs(struct Main *bmain, struct Scene *sce); -void BKE_sequencer_clear_movieclip_in_clipboard(struct MovieClip *clip); -void BKE_sequencer_clear_mask_in_clipboard(struct Mask *mask); struct Sequence *BKE_sequence_get_by_name(struct ListBase *seqbase, const char *name, int recursive); @@ -334,7 +336,7 @@ typedef struct SeqLoadInfo { int tot_success; int tot_error; int len; /* only for image strips */ - char path[512]; + char path[1024]; /* 1024 = FILE_MAX */ char name[64]; } SeqLoadInfo; diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index 2406fa51c84..24fd763d078 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -86,7 +86,6 @@ void txt_sel_all (struct Text *text); void txt_sel_line (struct Text *text); char *txt_sel_to_buf (struct Text *text); void txt_insert_buf (struct Text *text, const char *in_buffer); -void txt_print_undo (struct Text *text); void txt_undo_add_op (struct Text *text, int op); void txt_do_undo (struct Text *text); void txt_do_redo (struct Text *text); @@ -106,6 +105,10 @@ int txt_setcurr_tab_spaces(struct Text *text, int space); bool txt_cursor_is_line_start(struct Text *text); bool txt_cursor_is_line_end(struct Text *text); +#if 0 +void txt_print_undo (struct Text *text); +#endif + /* utility functions, could be moved somewhere more generic but are python/text related */ int text_check_bracket(const char ch); int text_check_delim(const char ch); diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 2f51f9f17fe..655e0d65133 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -165,7 +165,6 @@ set(SRC BKE_armature.h BKE_autoexec.h BKE_blender.h - BKE_bmesh.h BKE_bmfont.h BKE_bmfont_types.h BKE_boids.h diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 6f86b0c3f88..3422f783eeb 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -46,7 +46,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_memarena.h" -#include "BLI_array.h" #include "BLI_utildefines.h" #include "BLI_linklist.h" @@ -484,8 +483,6 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask) Mesh tmp = *me; int totvert, totedge /*, totface */ /* UNUSED */, totloop, totpoly; int did_shapekeys = 0; - float *texloc, *texrot, *texsize; - short *texflag; CustomData_reset(&tmp.vdata); CustomData_reset(&tmp.edata); @@ -533,12 +530,7 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask) } /* copy texture space */ - if (BKE_object_obdata_texspace_get(ob, &texflag, &texloc, &texsize, &texrot)) { - tmp.texflag = *texflag; - copy_v3_v3(tmp.loc, texloc); - copy_v3_v3(tmp.size, texsize); - copy_v3_v3(tmp.rot, texrot); - } + BKE_mesh_texspace_copy_from_object(&tmp, ob); /* not all DerivedMeshes store their verts/edges/faces in CustomData, so * we set them here in case they are missing */ @@ -655,21 +647,25 @@ void DM_add_poly_layer(DerivedMesh *dm, int type, int alloctype, void *layer) void *DM_get_vert_data(DerivedMesh *dm, int index, int type) { + BLI_assert(index >= 0 && index < dm->getNumVerts(dm)); return CustomData_get(&dm->vertData, index, type); } void *DM_get_edge_data(DerivedMesh *dm, int index, int type) { + BLI_assert(index >= 0 && index < dm->getNumEdges(dm)); return CustomData_get(&dm->edgeData, index, type); } void *DM_get_tessface_data(DerivedMesh *dm, int index, int type) { + BLI_assert(index >= 0 && index < dm->getNumTessFaces(dm)); return CustomData_get(&dm->faceData, index, type); } void *DM_get_poly_data(DerivedMesh *dm, int index, int type) { + BLI_assert(index >= 0 && index < dm->getNumPolys(dm)); return CustomData_get(&dm->polyData, index, type); } @@ -1948,7 +1944,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D { ModifierData *md, *previewmd = NULL; float (*deformedVerts)[3] = NULL; - CustomDataMask mask, previewmask = 0; + CustomDataMask mask, previewmask = 0, append_mask = 0; DerivedMesh *dm, *orcodm = NULL; int i, numVerts = 0, cageIndex = modifiers_getCageIndex(scene, ob, NULL, 1); CDMaskLink *datamasks, *curr; @@ -2083,6 +2079,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D } /* set the DerivedMesh to only copy needed data */ + mask |= append_mask; mask = curr->mask; /* CD_MASK_ORCO may have been cleared above */ DM_set_only_copy(dm, mask | CD_MASK_ORIGINDEX); @@ -2112,6 +2109,12 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D } } + /* In case of active preview modifier, make sure preview mask remains for following modifiers. */ + if ((md == previewmd) && (do_mod_wmcol)) { + DM_update_weight_mcol(ob, dm, draw_flag, NULL, 0, NULL); + append_mask |= CD_MASK_PREVIEW_MLOOPCOL; + } + if (cage_r && i == cageIndex) { if (dm && deformedVerts) { *cage_r = CDDM_copy(dm); @@ -3099,7 +3102,7 @@ static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm) } } else { - printf("%s: Error during creation polygon infos\n", __func__); + printf("Navmesh: Unable to generate valid Navmesh"); } /* clean up */ diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index fa85f6e4f86..70fbf2d39e8 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -930,9 +930,8 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_ if (fmd->flag & FCM_LIMIT_XMAX) { max = max_ff(max, fmd->rect.xmax); } + break; } - break; - case FMODIFIER_TYPE_CYCLES: /* Cycles F-Modifier */ { FMod_Cycles *fmd = (FMod_Cycles *)fcm->data; @@ -941,9 +940,8 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_ min = MINAFRAMEF; if (fmd->after_mode != FCM_EXTRAPOLATE_NONE) max = MAXFRAMEF; + break; } - break; - /* TODO: function modifier may need some special limits */ default: /* all other standard modifiers are on the infinite range... */ diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 9fea3d2e13f..ba680147201 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1036,7 +1036,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl if (ob->type != OB_MBALL) ob->flag |= OB_DONE; /* doesnt render */ if (me->edit_btmesh) { - dm->foreachMappedVert(dm, vertex_dupli__mapFunc, (void *) &vdd); + dm->foreachMappedVert(dm, vertex_dupli__mapFunc, (void *) &vdd, DM_FOREACH_USE_NORMAL); } else { for (a = 0; a < totvert; a++) { diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 001964087b8..4b05b0800a5 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -39,8 +39,8 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" -#include "BLI_array.h" #include "BLI_blenlib.h" +#include "BLI_alloca.h" #include "BLI_dynstr.h" #include "BLF_translation.h" diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 8fae3586439..d37ccae3089 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1329,6 +1329,7 @@ void BKE_pchan_mat3_to_rot(bPoseChannel *pchan, float mat[3][3], short use_compa mat3_to_compatible_eulO(pchan->eul, pchan->eul, pchan->rotmode, mat); else mat3_to_eulO(pchan->eul, pchan->rotmode, mat); + break; } } @@ -2100,8 +2101,8 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o /* z-axis scale */ scale = len_v3(pchan->pose_mat[2]); mul_v3_fl(poseMat[2], scale); + break; } - break; case CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC: { /* 'volume preservation' */ @@ -2123,8 +2124,8 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o /* apply the scaling */ mul_v3_fl(poseMat[0], scale); mul_v3_fl(poseMat[2], scale); + break; } - break; } /* finally, multiply the x and z scaling by the radius of the curve too, diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index dfffb7c795e..cf761bf3dab 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -981,6 +981,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa) rule = BLI_findlink(&state->rules, rand % BLI_countlist(&state->rules)); apply_boid_rule(bbd, rule, &val, pa, -1.0); + break; } case eBoidRulesetType_Average: { diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 307dbc64847..70b5d90120d 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -539,7 +539,7 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br, else if (mtex->brush_map_mode == MTEX_MAP_MODE_STENCIL) { float rotation = -mtex->rot; float point_2d[2] = {point[0], point[1]}; - float x = 0.0f, y = 0.0f; /* Quite warnings */ + float x, y; float co[3]; x = point_2d[0] - br->stencil_pos[0]; @@ -658,7 +658,7 @@ float BKE_brush_sample_masktex(const Scene *scene, Brush *br, if (mtex->brush_map_mode == MTEX_MAP_MODE_STENCIL) { float rotation = -mtex->rot; float point_2d[2] = {point[0], point[1]}; - float x = 0.0f, y = 0.0f; /* Quite warnings */ + float x, y; float co[3]; x = point_2d[0] - br->mask_stencil_pos[0]; @@ -993,7 +993,8 @@ unsigned int *BKE_brush_gen_texture_cache(Brush *br, int half_side) co[2] = 0.0f; /* This is copied from displace modifier code */ - hasrgb = multitex_ext(mtex->tex, co, NULL, NULL, 0, &texres, NULL); + /* TODO(sergey): brush are always cacheing with CM enabled for now. */ + hasrgb = multitex_ext(mtex->tex, co, NULL, NULL, 0, &texres, NULL, true); /* if the texture gave an RGB value, we assume it didn't give a valid * intensity, so calculate one (formula from do_material_tex). diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index a47cab7f236..e86561d687d 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -408,26 +408,33 @@ void BKE_camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, cons } else { /* that way it's always visible - clipsta+0.1 */ - float fac; - float half_sensor = 0.5f * ((camera->sensor_fit == CAMERA_SENSOR_FIT_VERT) ? (camera->sensor_y) : (camera->sensor_x)); + float fac, scale_x, scale_y; + float half_sensor = 0.5f * ((camera->sensor_fit == CAMERA_SENSOR_FIT_VERT) ? + (camera->sensor_y) : (camera->sensor_x)); - *r_drawsize = drawsize / ((scale[0] + scale[1] + scale[2]) / 3.0f); if (do_clip) { /* fixed depth, variable size (avoids exceeding clipping range) */ - depth = -(camera->clipsta + 0.1f); - fac = depth / (camera->lens / (-half_sensor) * scale[2]); + /* r_drawsize shouldn't be used in this case, set to dummy value */ + *r_drawsize = 1.0f; + depth = -(camera->clipsta + 0.1f) * scale[2]; + fac = depth / (camera->lens / (-half_sensor)); + scale_x = 1.0f; + scale_y = 1.0f; } else { /* fixed size, variable depth (stays a reasonable size in the 3D view) */ + *r_drawsize = drawsize / ((scale[0] + scale[1] + scale[2]) / 3.0f); depth = *r_drawsize * camera->lens / (-half_sensor) * scale[2]; fac = *r_drawsize; + scale_x = scale[0]; + scale_y = scale[1]; } - facx = fac * r_asp[0] * scale[0]; - facy = fac * r_asp[1] * scale[1]; - r_shift[0] = camera->shiftx * fac * 2 * scale[0]; - r_shift[1] = camera->shifty * fac * 2 * scale[1]; + facx = fac * r_asp[0] * scale_x; + facy = fac * r_asp[1] * scale_y; + r_shift[0] = camera->shiftx * fac * 2.0f * scale_x; + r_shift[1] = camera->shifty * fac * 2.0f * scale_y; } r_vec[0][0] = r_shift[0] + facx; r_vec[0][1] = r_shift[1] + facy; r_vec[0][2] = depth; diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 7f6dc680a74..60f6bb0a736 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -40,7 +40,6 @@ #include "BLI_blenlib.h" #include "BLI_edgehash.h" #include "BLI_math.h" -#include "BLI_array.h" #include "BLI_smallhash.h" #include "BLI_utildefines.h" #include "BLI_scanfill.h" @@ -1424,7 +1423,7 @@ static void cdDM_drawFacesGLSL(DerivedMesh *dm, DMSetMaterial setMaterial) static void cdDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *userData, int, void *attribs), - int (*setFace)(void *userData, int index), void *userData) + bool (*setFace)(void *userData, int index), void *userData) { CDDerivedMesh *cddm = (CDDerivedMesh *) dm; GPUVertexAttribs gattribs; @@ -1548,19 +1547,26 @@ static void cdDM_drawMappedEdges(DerivedMesh *dm, DMSetDrawOptions setDrawOption static void cdDM_foreachMappedVert( DerivedMesh *dm, void (*func)(void *userData, int index, const float co[3], const float no_f[3], const short no_s[3]), - void *userData) + void *userData, + DMForeachFlag flag) { MVert *mv = CDDM_get_verts(dm); - int i, orig, *index = DM_get_vert_data_layer(dm, CD_ORIGINDEX); + int *index = DM_get_vert_data_layer(dm, CD_ORIGINDEX); + int i; - for (i = 0; i < dm->numVertData; i++, mv++) { - if (index) { - orig = *index++; + if (index) { + for (i = 0; i < dm->numVertData; i++, mv++) { + const short *no = (flag & DM_FOREACH_USE_NORMAL) ? mv->no : NULL; + const int orig = *index++; if (orig == ORIGINDEX_NONE) continue; - func(userData, orig, mv->co, NULL, mv->no); + func(userData, orig, mv->co, NULL, no); + } + } + else { + for (i = 0; i < dm->numVertData; i++, mv++) { + const short *no = (flag & DM_FOREACH_USE_NORMAL) ? mv->no : NULL; + func(userData, i, mv->co, NULL, no); } - else - func(userData, i, mv->co, NULL, mv->no); } } @@ -1588,47 +1594,37 @@ static void cdDM_foreachMappedEdge( static void cdDM_foreachMappedFaceCenter( DerivedMesh *dm, void (*func)(void *userData, int index, const float cent[3], const float no[3]), - void *userData) + void *userData, + DMForeachFlag flag) { CDDerivedMesh *cddm = (CDDerivedMesh *)dm; MVert *mvert = cddm->mvert; MPoly *mp; MLoop *ml; - int i, j, orig, *index; + int i, orig, *index; index = CustomData_get_layer(&dm->polyData, CD_ORIGINDEX); mp = cddm->mpoly; for (i = 0; i < dm->numPolyData; i++, mp++) { float cent[3]; - float no[3]; + float *no, _no[3]; if (index) { orig = *index++; if (orig == ORIGINDEX_NONE) continue; } - else + else { orig = i; + } ml = &cddm->mloop[mp->loopstart]; - cent[0] = cent[1] = cent[2] = 0.0f; - for (j = 0; j < mp->totloop; j++, ml++) { - add_v3_v3v3(cent, cent, mvert[ml->v].co); - } - mul_v3_fl(cent, 1.0f / (float)j); + BKE_mesh_calc_poly_center(mp, ml, mvert, cent); - ml = &cddm->mloop[mp->loopstart]; - if (j > 3) { - normal_quad_v3(no, - mvert[(ml + 0)->v].co, - mvert[(ml + 1)->v].co, - mvert[(ml + 2)->v].co, - mvert[(ml + 3)->v].co); + if (flag & DM_FOREACH_USE_NORMAL) { + BKE_mesh_calc_poly_normal(mp, ml, mvert, (no = _no)); } else { - normal_tri_v3(no, - mvert[(ml + 0)->v].co, - mvert[(ml + 1)->v].co, - mvert[(ml + 2)->v].co); + no = NULL; } func(userData, orig, cent, no); diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index a7311d5efc7..05ffd4a6265 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -476,7 +476,6 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived BKE_ptcache_validate(cache, 0); cache->last_exact= 0; cache->flag &= ~PTCACHE_REDO_NEEDED; - return; } // unused in the moment, calculated separately in implicit.c diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 9323531e5fe..7e878e86c1e 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -328,8 +328,8 @@ void curvemap_reset(CurveMap *cuma, const rctf *clipr, int preset, int slope) cuma->curve[i].x = i / ((float)cuma->totpoint - 1); cuma->curve[i].y = 0.5; } + break; } - break; case CURVE_PRESET_ROUND: cuma->curve[0].x = 0; cuma->curve[0].y = 1; diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 0cd13d528d5..b8d851d082a 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -132,8 +132,8 @@ bConstraintOb *BKE_constraints_make_evalob(Scene *scene, Object *ob, void *subda unit_m4(cob->matrix); copy_m4_m4(cob->startmat, cob->matrix); + break; } - break; case CONSTRAINT_OBTYPE_BONE: { /* only set if we have valid bone, otherwise default */ @@ -158,9 +158,8 @@ bConstraintOb *BKE_constraints_make_evalob(Scene *scene, Object *ob, void *subda unit_m4(cob->matrix); copy_m4_m4(cob->startmat, cob->matrix); + break; } - break; - default: /* other types not yet handled */ unit_m4(cob->matrix); unit_m4(cob->startmat); @@ -195,8 +194,8 @@ void BKE_constraints_clear_evalob(bConstraintOb *cob) /* copy inverse of delta back to owner */ invert_m4_m4(cob->ob->constinv, delta); } + break; } - break; case CONSTRAINT_OBTYPE_BONE: { /* cob->ob or cob->pchan might not exist */ @@ -207,8 +206,8 @@ void BKE_constraints_clear_evalob(bConstraintOb *cob) /* copy inverse of delta back to owner */ invert_m4_m4(cob->pchan->constinv, delta); } + break; } - break; } /* free tempolary struct */ @@ -246,8 +245,8 @@ void BKE_constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[ /* call self with slightly different values */ BKE_constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, to); } + break; } - break; case CONSTRAINT_SPACE_POSE: /* ---------- FROM POSESPACE ---------- */ { /* pose to world */ @@ -267,8 +266,8 @@ void BKE_constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[ mul_m4_m4m4(mat, imat, mat); } } + break; } - break; case CONSTRAINT_SPACE_LOCAL: /* ------------ FROM LOCALSPACE --------- */ { /* local to pose - do inverse procedure that was done for pose to local */ @@ -282,8 +281,8 @@ void BKE_constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[ /* call self with slightly different values */ BKE_constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, to); } + break; } - break; case CONSTRAINT_SPACE_PARLOCAL: /* -------------- FROM LOCAL WITH PARENT ---------- */ { /* local + parent to pose */ @@ -297,8 +296,8 @@ void BKE_constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[ /* call self with slightly different values */ BKE_constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, to); } + break; } - break; } } else { @@ -2235,8 +2234,8 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[2], totmat[0], totmat[1]); + break; } - break; case TRACK_Z: /* LOCK X TRACK Z */ { /* Projection of Vector on the plane */ @@ -2249,8 +2248,8 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[1], totmat[2], totmat[0]); + break; } - break; case TRACK_nY: /* LOCK X TRACK -Y */ { /* Projection of Vector on the plane */ @@ -2264,8 +2263,8 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[2], totmat[0], totmat[1]); + break; } - break; case TRACK_nZ: /* LOCK X TRACK -Z */ { /* Projection of Vector on the plane */ @@ -2279,16 +2278,16 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[1], totmat[2], totmat[0]); + break; } - break; default: { unit_m3(totmat); + break; } - break; } + break; } - break; case LOCK_Y: /* LOCK Y */ { switch (data->trackflag) { @@ -2304,8 +2303,8 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[2], totmat[0], totmat[1]); + break; } - break; case TRACK_Z: /* LOCK Y TRACK Z */ { /* Projection of Vector on the plane */ @@ -2318,8 +2317,8 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[0], totmat[1], totmat[2]); + break; } - break; case TRACK_nX: /* LOCK Y TRACK -X */ { /* Projection of Vector on the plane */ @@ -2333,8 +2332,8 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[2], totmat[0], totmat[1]); + break; } - break; case TRACK_nZ: /* LOCK Y TRACK -Z */ { /* Projection of Vector on the plane */ @@ -2348,16 +2347,16 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[0], totmat[1], totmat[2]); + break; } - break; default: { unit_m3(totmat); + break; } - break; } + break; } - break; case LOCK_Z: /* LOCK Z */ { switch (data->trackflag) { @@ -2373,8 +2372,8 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t /* the x axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[1], totmat[2], totmat[0]); + break; } - break; case TRACK_Y: /* LOCK Z TRACK Y */ { /* Projection of Vector on the plane */ @@ -2387,8 +2386,8 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t /* the x axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[0], totmat[1], totmat[2]); + break; } - break; case TRACK_nX: /* LOCK Z TRACK -X */ { /* Projection of Vector on the plane */ @@ -2402,8 +2401,8 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t /* the x axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[1], totmat[2], totmat[0]); + break; } - break; case TRACK_nY: /* LOCK Z TRACK -Y */ { /* Projection of Vector on the plane */ @@ -2417,21 +2416,21 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t /* the x axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[0], totmat[1], totmat[2]); + break; } - break; default: { unit_m3(totmat); + break; } - break; } + break; } - break; default: { unit_m3(totmat); + break; } - break; } /* Block to keep matrix heading */ copy_m3_m4(tmpmat, cob->matrix); @@ -2519,7 +2518,7 @@ static void distlimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t /* only evaluate if there is a target */ if (VALID_CONS_TARGET(ct)) { - float dvec[3], dist = 0.0f, sfac = 1.0f; + float dvec[3], dist, sfac = 1.0f; short clamp_surf = 0; /* calculate our current distance from the target */ @@ -4414,8 +4413,8 @@ static bConstraint *add_new_constraint(Object *ob, bPoseChannel *pchan, const ch con->ownspace = CONSTRAINT_SPACE_POSE; con->flag |= CONSTRAINT_SPACEONCE; } + break; } - break; } return con; @@ -4640,8 +4639,8 @@ void BKE_get_constraint_target_matrix(Scene *scene, bConstraint *con, int index, unit_m4(cob->matrix); unit_m4(cob->startmat); } + break; } - break; case CONSTRAINT_OBTYPE_BONE: /* this may occur in some cases */ { cob->ob = NULL; /* this might not work at all :/ */ @@ -4654,8 +4653,8 @@ void BKE_get_constraint_target_matrix(Scene *scene, bConstraint *con, int index, unit_m4(cob->matrix); unit_m4(cob->startmat); } + break; } - break; } /* get targets - we only need the first one though (and there should only be one) */ diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index bbf254cd7d1..622b4f6df5a 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -531,12 +531,12 @@ ListBase CTX_data_dir_get(const bContext *C) return CTX_data_dir_get_ex(C, TRUE, FALSE, FALSE); } -int CTX_data_equals(const char *member, const char *str) +bool CTX_data_equals(const char *member, const char *str) { return (strcmp(member, str) == 0); } -int CTX_data_dir(const char *member) +bool CTX_data_dir(const char *member) { return member[0] == '\0'; } diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 3b9fbbb1c4d..43e5cc101a7 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -681,6 +681,143 @@ void BKE_nurb_bezierPoints_add(Nurb *nu, int number) nu->pntsu += number; } + +BezTriple *BKE_nurb_bezt_get_next(Nurb *nu, BezTriple *bezt) +{ + BezTriple *bezt_next; + + BLI_assert(ARRAY_HAS_ITEM(bezt, nu->bezt, nu->pntsu)); + + if (bezt == &nu->bezt[nu->pntsu - 1]) { + if (nu->flagu & CU_NURB_CYCLIC) { + bezt_next = nu->bezt; + } + else { + bezt_next = NULL; + } + } + else { + bezt_next = bezt + 1; + } + + return bezt_next; +} + +BPoint *BKE_nurb_bpoint_get_next(Nurb *nu, BPoint *bp) +{ + BPoint *bp_next; + + BLI_assert(ARRAY_HAS_ITEM(bp, nu->bp, nu->pntsu)); + + if (bp == &nu->bp[nu->pntsu - 1]) { + if (nu->flagu & CU_NURB_CYCLIC) { + bp_next = nu->bp; + } + else { + bp_next = NULL; + } + } + else { + bp_next = bp + 1; + } + + return bp_next; +} + +BezTriple *BKE_nurb_bezt_get_prev(Nurb *nu, BezTriple *bezt) +{ + BezTriple *bezt_prev; + + BLI_assert(ARRAY_HAS_ITEM(bezt, nu->bezt, nu->pntsu)); + + if (bezt == nu->bezt) { + if (nu->flagu & CU_NURB_CYCLIC) { + bezt_prev = &nu->bezt[nu->pntsu - 1]; + } + else { + bezt_prev = NULL; + } + } + else { + bezt_prev = bezt - 1; + } + + return bezt_prev; +} + +BPoint *BKE_nurb_bpoint_get_prev(Nurb *nu, BPoint *bp) +{ + BPoint *bp_prev; + + BLI_assert(ARRAY_HAS_ITEM(bp, nu->bp, nu->pntsu)); + + if (bp == nu->bp) { + if (nu->flagu & CU_NURB_CYCLIC) { + bp_prev = &nu->bp[nu->pntsu - 1]; + } + else { + bp_prev = NULL; + } + } + else { + bp_prev = bp - 1; + } + + return bp_prev; +} + +void BKE_nurb_bezt_calc_normal(struct Nurb *UNUSED(nu), struct BezTriple *bezt, float r_normal[3]) +{ + /* calculate the axis matrix from the spline */ + float dir_prev[3], dir_next[3]; + + sub_v3_v3v3(dir_prev, bezt->vec[0], bezt->vec[1]); + sub_v3_v3v3(dir_next, bezt->vec[1], bezt->vec[2]); + + normalize_v3(dir_prev); + normalize_v3(dir_next); + + add_v3_v3v3(r_normal, dir_prev, dir_next); + normalize_v3(r_normal); +} + +void BKE_nurb_bezt_calc_plane(struct Nurb *nu, struct BezTriple *bezt, float r_plane[3]) +{ + float dir_prev[3], dir_next[3]; + + sub_v3_v3v3(dir_prev, bezt->vec[0], bezt->vec[1]); + sub_v3_v3v3(dir_next, bezt->vec[1], bezt->vec[2]); + + normalize_v3(dir_prev); + normalize_v3(dir_next); + + cross_v3_v3v3(r_plane, dir_prev, dir_next); + if (normalize_v3(r_plane) < FLT_EPSILON) { + BezTriple *bezt_prev = BKE_nurb_bezt_get_prev(nu, bezt); + BezTriple *bezt_next = BKE_nurb_bezt_get_next(nu, bezt); + + if (bezt_prev) { + sub_v3_v3v3(dir_prev, bezt_prev->vec[1], bezt->vec[1]); + normalize_v3(dir_prev); + } + if (bezt_next) { + sub_v3_v3v3(dir_next, bezt->vec[1], bezt_next->vec[1]); + normalize_v3(dir_next); + } + cross_v3_v3v3(r_plane, dir_prev, dir_next); + } + + /* matches with bones more closely */ + { + float dir_mid[3], tvec[3]; + add_v3_v3v3(dir_mid, dir_prev, dir_next); + cross_v3_v3v3(tvec, r_plane, dir_mid); + copy_v3_v3(r_plane, tvec); + } + + normalize_v3(r_plane); +} + /* ~~~~~~~~~~~~~~~~~~~~Non Uniform Rational B Spline calculations ~~~~~~~~~~~ */ @@ -2173,6 +2310,7 @@ static void make_bevel_list_3D(BevList *bl, int smooth_iter, int twist_mode) break; default: /* CU_TWIST_Z_UP default, pre 2.49c */ make_bevel_list_3D_zup(bl); + break; } if (bl->poly == -1) /* check its not cyclic */ @@ -2323,6 +2461,7 @@ void BKE_curve_bevelList_make(Object *ob) bl = MEM_callocN(sizeof(BevList) + 1 * sizeof(BevPoint), "makeBevelList1"); BLI_addtail(&(cu->bev), bl); bl->nr = 0; + bl->charidx = nu->charidx; } else { if (G.is_rendering && cu->resolu_ren != 0) @@ -2335,10 +2474,10 @@ void BKE_curve_bevelList_make(Object *ob) bl = MEM_callocN(sizeof(BevList) + len * sizeof(BevPoint), "makeBevelList2"); BLI_addtail(&(cu->bev), bl); - if (nu->flagu & CU_NURB_CYCLIC) bl->poly = 0; - else bl->poly = -1; + bl->poly = (nu->flagu & CU_NURB_CYCLIC) ? 0 : -1; bl->nr = len; bl->dupe_nr = 0; + bl->charidx = nu->charidx; bevp = (BevPoint *)(bl + 1); bp = nu->bp; @@ -2358,8 +2497,8 @@ void BKE_curve_bevelList_make(Object *ob) bl = MEM_callocN(sizeof(BevList) + len * sizeof(BevPoint), "makeBevelBPoints"); BLI_addtail(&(cu->bev), bl); - if (nu->flagu & CU_NURB_CYCLIC) bl->poly = 0; - else bl->poly = -1; + bl->poly = (nu->flagu & CU_NURB_CYCLIC) ? 0 : -1; + bl->charidx = nu->charidx; bevp = (BevPoint *)(bl + 1); a = nu->pntsu - 1; @@ -2445,8 +2584,8 @@ void BKE_curve_bevelList_make(Object *ob) BLI_addtail(&(cu->bev), bl); bl->nr = len; bl->dupe_nr = 0; - if (nu->flagu & CU_NURB_CYCLIC) bl->poly = 0; - else bl->poly = -1; + bl->poly = (nu->flagu & CU_NURB_CYCLIC) ? 0 : -1; + bl->charidx = nu->charidx; bevp = (BevPoint *)(bl + 1); BKE_nurb_makeCurve(nu, &bevp->vec[0], @@ -2572,9 +2711,11 @@ void BKE_curve_bevelList_make(Object *ob) bl = sd->bl; /* is bl a hole? */ sd1 = sortdata + (a - 1); for (b = a - 1; b >= 0; b--, sd1--) { /* all polys to the left */ - if (bevelinside(sd1->bl, bl)) { - bl->hole = 1 - sd1->bl->hole; - break; + if (sd1->bl->charidx == bl->charidx) { /* for text, only check matching char */ + if (bevelinside(sd1->bl, bl)) { + bl->hole = 1 - sd1->bl->hole; + break; + } } } } diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index b6c608661cd..d69ec6a9597 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -158,7 +158,7 @@ static void layerCopy_mdeformvert(const void *source, void *dest, MDeformVert *dvert = (MDeformVert *)((char *)dest + i * size); if (dvert->totweight) { - MDeformWeight *dw = MEM_callocN(dvert->totweight * sizeof(*dw), + MDeformWeight *dw = MEM_mallocN(dvert->totweight * sizeof(*dw), "layerCopy_mdeformvert dw"); memcpy(dw, dvert->dw, dvert->totweight * sizeof(*dw)); @@ -218,9 +218,16 @@ static void layerFree_bmesh_elem_py_ptr(void *data, int count, int size) static void layerInterp_mdeformvert(void **sources, const float *weights, const float *UNUSED(sub_weights), int count, void *dest) { + /* a single linked list of MDeformWeight's + * use this to avoid double allocs (which LinkNode would do) */ + struct MDeformWeight_Link { + struct MDeformWeight_Link *next; + MDeformWeight dw; + }; + MDeformVert *dvert = dest; - LinkNode *dest_dw = NULL; /* a list of lists of MDeformWeight pointers */ - LinkNode *node; + struct MDeformWeight_Link *dest_dwlink = NULL; + struct MDeformWeight_Link *node; int i, j, totweight; if (count <= 0) return; @@ -238,8 +245,8 @@ static void layerInterp_mdeformvert(void **sources, const float *weights, if (weight == 0.0f) continue; - for (node = dest_dw; node; node = node->next) { - MDeformWeight *tmp_dw = (MDeformWeight *)node->link; + for (node = dest_dwlink; node; node = node->next) { + MDeformWeight *tmp_dw = &node->dw; if (tmp_dw->def_nr == dw->def_nr) { tmp_dw->weight += weight; @@ -249,11 +256,14 @@ static void layerInterp_mdeformvert(void **sources, const float *weights, /* if this def_nr is not in the list, add it */ if (!node) { - MDeformWeight *tmp_dw = MEM_callocN(sizeof(*tmp_dw), - "layerInterp_mdeformvert tmp_dw"); - tmp_dw->def_nr = dw->def_nr; - tmp_dw->weight = weight; - BLI_linklist_prepend(&dest_dw, tmp_dw); + struct MDeformWeight_Link *tmp_dwlink = MEM_mallocN(sizeof(*tmp_dwlink), __func__); + tmp_dwlink->dw.def_nr = dw->def_nr; + tmp_dwlink->dw.weight = weight; + + /* inline linklist */ + tmp_dwlink->next = dest_dwlink; + dest_dwlink = tmp_dwlink; + totweight++; } } @@ -262,20 +272,31 @@ static void layerInterp_mdeformvert(void **sources, const float *weights, /* delay writing to the destination incase dest is in sources */ /* now we know how many unique deform weights there are, so realloc */ - if (dvert->dw) MEM_freeN(dvert->dw); + if (dvert->dw && (dvert->totweight == totweight)) { + /* pass (fastpath if we don't need to realloc) */ + } + else { + if (dvert->dw) { + MEM_freeN(dvert->dw); + } + + if (totweight) { + dvert->dw = MEM_mallocN(sizeof(*dvert->dw) * totweight, __func__); + } + } if (totweight) { - dvert->dw = MEM_callocN(sizeof(*dvert->dw) * totweight, - "layerInterp_mdeformvert dvert->dw"); + struct MDeformWeight_Link *node_next; dvert->totweight = totweight; - - for (i = 0, node = dest_dw; node; node = node->next, ++i) - dvert->dw[i] = *((MDeformWeight *)node->link); + for (i = 0, node = dest_dwlink; node; node = node_next, i++) { + node_next = node->next; + dvert->dw[i] = node->dw; + MEM_freeN(node); + } } - else + else { memset(dvert, 0, sizeof(*dvert)); - - BLI_linklist_free(dest_dw, MEM_freeN); + } } static void layerCopy_tface(const void *source, void *dest, int count) @@ -1729,16 +1750,19 @@ bool CustomData_free_layer(CustomData *data, int type, int totelem, int index) data->totlayer--; /* if layer was last of type in array, set new active layer */ - if ((index >= data->totlayer) || (data->layers[index].type != type)) { - i = CustomData_get_layer_index__notypemap(data, type); - - if (i >= 0) - for (; i < data->totlayer && data->layers[i].type == type; i++) { - data->layers[i].active--; - data->layers[i].active_rnd--; - data->layers[i].active_clone--; - data->layers[i].active_mask--; - } + i = CustomData_get_layer_index__notypemap(data, type); + + if (i != -1) { + /* don't decrement zero index */ + const int index_nonzero = index ? index : 1; + CustomDataLayer *layer; + + for (layer = &data->layers[i]; i < data->totlayer && layer->type == type; i++, layer++) { + if (layer->active >= index_nonzero) layer->active--; + if (layer->active_rnd >= index_nonzero) layer->active_rnd--; + if (layer->active_clone >= index_nonzero) layer->active_clone--; + if (layer->active_mask >= index_nonzero) layer->active_mask--; + } } if (data->totlayer <= data->maxlayer - CUSTOMDATA_GROW) @@ -2073,6 +2097,8 @@ void *CustomData_get(const CustomData *data, int index, int type) int offset; int layer_index; + BLI_assert(index >= 0); + /* get the layer index of the active layer of type */ layer_index = CustomData_get_active_layer_index(data, type); if (layer_index < 0) return NULL; @@ -2088,6 +2114,8 @@ void *CustomData_get_n(const CustomData *data, int type, int index, int n) int layer_index; int offset; + BLI_assert(index >= 0 && n >= 0); + /* get the layer index of the first layer of type */ layer_index = data->typemap[type]; if (layer_index < 0) return NULL; @@ -2384,6 +2412,7 @@ bool CustomData_bmesh_merge(CustomData *source, CustomData *dest, BLI_assert(!"invalid type given"); iter_type = BM_VERTS_OF_MESH; totelem = bm->totvert; + break; } dest->pool = NULL; diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index b82e89d1af6..882085aa5db 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -51,6 +51,22 @@ #include "BKE_deform.h" /* own include */ +bDeformGroup *BKE_defgroup_new(Object *ob, const char *name) +{ + bDeformGroup *defgroup; + + BLI_assert(OB_TYPE_SUPPORT_VGROUP(ob->type)); + + defgroup = MEM_callocN(sizeof(bDeformGroup), __func__); + + BLI_strncpy(defgroup->name, name, sizeof(defgroup->name)); + + BLI_addtail(&ob->defbase, defgroup); + defgroup_unique_name(defgroup, ob); + + return defgroup; +} + void defgroup_copy_list(ListBase *outbase, ListBase *inbase) { bDeformGroup *defgroup, *defgroupn; @@ -521,7 +537,7 @@ void BKE_deform_split_suffix(const char string[MAX_VGROUP_NAME], char body[MAX_V body[0] = suf[0] = '\0'; - for (i = len - 1; i > 1; i--) { + for (i = len; i > 0; i--) { if (is_char_sep(string[i])) { BLI_strncpy(body, string, i + 1); BLI_strncpy(suf, string + i, (len + 1) - i); @@ -529,7 +545,7 @@ void BKE_deform_split_suffix(const char string[MAX_VGROUP_NAME], char body[MAX_V } } - BLI_strncpy(body, string, len); + memcpy(body, string, len + 1); } /* "a.b.c" -> ("a.", "b.c") */ @@ -719,7 +735,7 @@ MDeformWeight *defvert_verify_index(MDeformVert *dvert, const int defgroup) if (dw_new) return dw_new; - dw_new = MEM_callocN(sizeof(MDeformWeight) * (dvert->totweight + 1), "deformWeight"); + dw_new = MEM_mallocN(sizeof(MDeformWeight) * (dvert->totweight + 1), "deformWeight"); if (dvert->dw) { memcpy(dw_new, dvert->dw, sizeof(MDeformWeight) * dvert->totweight); MEM_freeN(dvert->dw); diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 2206770dfbd..4ce06623bae 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -558,6 +558,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O } else dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Parent"); + break; } /* exception case: parent is duplivert */ if (ob->type == OB_MBALL && (ob->parent->transflag & OB_DUPLIVERTS)) { @@ -619,8 +620,8 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O node2 = dag_get_node(dag, cam->dof_ob); dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Camera DoF"); } + break; } - break; case OB_MBALL: { Object *mom = BKE_mball_basis_find(scene, ob); @@ -629,8 +630,8 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O node2 = dag_get_node(dag, mom); dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Metaball"); /* mom depends on children! */ } + break; } - break; case OB_CURVE: case OB_FONT: { @@ -650,8 +651,8 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Texture On Curve"); } } + break; } - break; } /* material drivers */ diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 9d1c0e40d54..1d5eaf3a1fc 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -1449,12 +1449,13 @@ static void dynamicPaint_initAdjacencyData(DynamicPaintSurface *surface, int for MEM_freeN(temp_data); } -static void dynamicPaint_setInitialColor(DynamicPaintSurface *surface) +static void dynamicPaint_setInitialColor(Scene *scene, DynamicPaintSurface *surface) { PaintSurfaceData *sData = surface->data; PaintPoint *pPoint = (PaintPoint *)sData->type_data; DerivedMesh *dm = surface->canvas->dm; int i; + bool scene_color_manage = BKE_scene_check_color_management_enabled(scene); if (surface->type != MOD_DPAINT_SURFACE_T_PAINT) return; @@ -1503,7 +1504,7 @@ static void dynamicPaint_setInitialColor(DynamicPaintSurface *surface) uv[0] = tface[i].uv[j][0] * 2.0f - 1.0f; uv[1] = tface[i].uv[j][1] * 2.0f - 1.0f; - multitex_ext_safe(tex, uv, &texres, pool); + multitex_ext_safe(tex, uv, &texres, pool, scene_color_manage); if (texres.tin > pPoint[*vert].alpha) { copy_v3_v3(pPoint[*vert].color, &texres.tr); @@ -1536,8 +1537,8 @@ static void dynamicPaint_setInitialColor(DynamicPaintSurface *surface) /* remap to -1.0 to 1.0 */ uv_final[0] = uv_final[0] * 2.0f - 1.0f; uv_final[1] = uv_final[1] * 2.0f - 1.0f; - - multitex_ext_safe(tex, uv_final, &texres, NULL); + + multitex_ext_safe(tex, uv_final, &texres, NULL, scene_color_manage); /* apply color */ copy_v3_v3(pPoint[i].color, &texres.tr); @@ -1596,7 +1597,7 @@ static void dynamicPaint_setInitialColor(DynamicPaintSurface *surface) } /* clears surface data back to zero */ -void dynamicPaint_clearSurface(DynamicPaintSurface *surface) +void dynamicPaint_clearSurface(Scene *scene, DynamicPaintSurface *surface) { PaintSurfaceData *sData = surface->data; if (sData && sData->type_data) { @@ -1613,7 +1614,7 @@ void dynamicPaint_clearSurface(DynamicPaintSurface *surface) /* set initial color */ if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) - dynamicPaint_setInitialColor(surface); + dynamicPaint_setInitialColor(scene, surface); if (sData->bData) sData->bData->clear = 1; @@ -1621,7 +1622,7 @@ void dynamicPaint_clearSurface(DynamicPaintSurface *surface) } /* completely (re)initializes surface (only for point cache types)*/ -int dynamicPaint_resetSurface(DynamicPaintSurface *surface) +int dynamicPaint_resetSurface(Scene *scene, DynamicPaintSurface *surface) { int numOfPoints = dynamicPaint_surfaceNumOfPoints(surface); /* free existing data */ @@ -1642,16 +1643,16 @@ int dynamicPaint_resetSurface(DynamicPaintSurface *surface) /* set initial color */ if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) - dynamicPaint_setInitialColor(surface); + dynamicPaint_setInitialColor(scene, surface); return 1; } /* make sure allocated surface size matches current requirements */ -static int dynamicPaint_checkSurfaceData(DynamicPaintSurface *surface) +static int dynamicPaint_checkSurfaceData(Scene *scene, DynamicPaintSurface *surface) { if (!surface->data || ((dynamicPaint_surfaceNumOfPoints(surface) != surface->data->total_points))) { - return dynamicPaint_resetSurface(surface); + return dynamicPaint_resetSurface(scene, surface); } return 1; } @@ -1698,7 +1699,7 @@ static DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd, if (pmd->canvas && !(pmd->canvas->flags & MOD_DPAINT_BAKING)) { DynamicPaintSurface *surface; - int update_normals = 0; + bool update_normals = false; /* loop through surfaces */ for (surface = pmd->canvas->surfaces.first; surface; surface = surface->next) { @@ -1881,19 +1882,21 @@ static DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd, normal_short_to_float_v3(normal, mvert[i].no); madd_v3_v3fl(mvert[i].co, normal, wPoint[i].height); } - update_normals = 1; + update_normals = true; } /* displace */ if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE) { dynamicPaint_applySurfaceDisplace(surface, result); - update_normals = 1; + update_normals = true; } } } } - result->dirty |= DM_DIRTY_NORMALS; + if (update_normals) { + result->dirty |= DM_DIRTY_NORMALS; + } } /* make a copy of dm to use as brush data */ if (pmd->brush) { @@ -1940,6 +1943,7 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene /* loop through surfaces */ for (; surface; surface = surface->next) { int current_frame = (int)scene->r.cfra; + bool no_surface_data; /* free bake data if not required anymore */ surface_freeUnusedData(surface); @@ -1949,12 +1953,13 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene if (!(surface->flags & MOD_DPAINT_ACTIVE)) continue; /* make sure surface is valid */ - if (!dynamicPaint_checkSurfaceData(surface)) continue; + no_surface_data = surface->data == NULL; + if (!dynamicPaint_checkSurfaceData(scene, surface)) continue; /* limit frame range */ CLAMP(current_frame, surface->start_frame, surface->end_frame); - if (current_frame != surface->current_frame || (int)scene->r.cfra == surface->start_frame) { + if (no_surface_data || current_frame != surface->current_frame || (int)scene->r.cfra == surface->start_frame) { PointCache *cache = surface->pointcache; PTCacheID pid; surface->current_frame = current_frame; @@ -2221,7 +2226,7 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh /* * Create a surface for uv image sequence format */ -int dynamicPaint_createUVSurface(DynamicPaintSurface *surface) +int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface) { /* Antialias jitter point relative coords */ float jitter5sample[10] = {0.0f, 0.0f, @@ -2672,7 +2677,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface) } #endif - dynamicPaint_setInitialColor(surface); + dynamicPaint_setInitialColor(scene, surface); } return (error == 0); diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index 87f7da8a1fb..feb18c3babe 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -69,11 +69,120 @@ typedef struct EditDerivedBMesh { BMEditMesh *em; - float (*vertexCos)[3]; - float (*vertexNos)[3]; - float (*polyNos)[3]; + /** when set, \a vertexNos, polyNos are lazy initialized */ + const float (*vertexCos)[3]; + + /** lazy initialize (when \a vertexCos is set) */ + float const (*vertexNos)[3]; + float const (*polyNos)[3]; + /** also lazy init but dont depend on \a vertexCos */ + const float (*polyCos)[3]; } EditDerivedBMesh; +/* -------------------------------------------------------------------- */ +/* Lazy initialize datastructures */ + +static void emDM_ensurePolyNormals(EditDerivedBMesh *bmdm); + +static void emDM_ensureVertNormals(EditDerivedBMesh *bmdm) +{ + if (bmdm->vertexCos && (bmdm->vertexNos == NULL)) { + + BMesh *bm = bmdm->em->bm; + const float (*vertexCos)[3], (*polyNos)[3]; + float (*vertexNos)[3]; + + BMFace *efa; + BMVert *eve; + BMIter fiter; + BMIter viter; + int i; + + vertexCos = bmdm->vertexCos; + vertexNos = MEM_callocN(sizeof(*vertexNos) * bm->totvert, __func__); + + /* calculate vertex normals from poly normals */ + emDM_ensurePolyNormals(bmdm); + + BM_mesh_elem_index_ensure(bm, BM_FACE); + + vertexCos = bmdm->vertexCos; + polyNos = bmdm->polyNos; + + BM_ITER_MESH_INDEX (eve, &viter, bm, BM_VERTS_OF_MESH, i) { + float *no = vertexNos[i]; + BM_ITER_ELEM (efa, &fiter, eve, BM_FACES_OF_VERT) { + add_v3_v3(no, polyNos[BM_elem_index_get(efa)]); + } + + /* following Mesh convention; we use vertex coordinate itself + * for normal in this case */ + if (UNLIKELY(normalize_v3(no) == 0.0f)) { + normalize_v3_v3(no, vertexCos[i]); + } + } + + bmdm->vertexNos = (const float (*)[3])vertexNos; + } +} + +static void emDM_ensurePolyNormals(EditDerivedBMesh *bmdm) +{ + if (bmdm->vertexCos && (bmdm->polyNos == NULL)) { + BMesh *bm = bmdm->em->bm; + const float (*vertexCos)[3]; + float (*polyNos)[3]; + + BMFace *efa; + BMIter fiter; + int i; + + BM_mesh_elem_index_ensure(bm, BM_VERT); + + polyNos = MEM_mallocN(sizeof(*polyNos) * bm->totface, __func__); + + vertexCos = bmdm->vertexCos; + + BM_ITER_MESH_INDEX (efa, &fiter, bm, BM_FACES_OF_MESH, i) { + BM_elem_index_set(efa, i); /* set_inline */ + BM_face_calc_normal_vcos(bm, efa, polyNos[i], vertexCos); + } + bm->elem_index_dirty &= ~BM_FACE; + + bmdm->polyNos = (const float (*)[3])polyNos; + } +} + +static void emDM_ensurePolyCenters(EditDerivedBMesh *bmdm) +{ + if (bmdm->polyCos == NULL) { + BMesh *bm = bmdm->em->bm; + float (*polyCos)[3]; + + BMFace *efa; + BMIter fiter; + int i; + + polyCos = MEM_mallocN(sizeof(*polyCos) * bm->totface, __func__); + + if (bmdm->vertexCos) { + const float (*vertexCos)[3]; + vertexCos = bmdm->vertexCos; + + BM_ITER_MESH_INDEX (efa, &fiter, bm, BM_FACES_OF_MESH, i) { + BM_face_calc_center_mean_vcos(bm, efa, polyCos[i], vertexCos); + } + } + else { + BM_ITER_MESH_INDEX (efa, &fiter, bm, BM_FACES_OF_MESH, i) { + BM_face_calc_center_mean(efa, polyCos[i]); + } + } + + bmdm->polyCos = (const float (*)[3])polyCos; + } +} + static void emDM_calcNormals(DerivedMesh *dm) { /* Nothing to do: normals are already calculated and stored on the @@ -86,9 +195,11 @@ static void emDM_recalcTessellation(DerivedMesh *UNUSED(dm)) /* do nothing */ } -static void emDM_foreachMappedVert(DerivedMesh *dm, - void (*func)(void *userData, int index, const float co[3], const float no_f[3], const short no_s[3]), - void *userData) +static void emDM_foreachMappedVert( + DerivedMesh *dm, + void (*func)(void *userData, int index, const float co[3], const float no_f[3], const short no_s[3]), + void *userData, + DMForeachFlag flag) { EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm; BMesh *bm = bmdm->em->bm; @@ -97,13 +208,26 @@ static void emDM_foreachMappedVert(DerivedMesh *dm, int i; if (bmdm->vertexCos) { + const float (*vertexCos)[3] = bmdm->vertexCos; + const float (*vertexNos)[3]; + + if (flag & DM_FOREACH_USE_NORMAL) { + emDM_ensureVertNormals(bmdm); + vertexNos = bmdm->vertexNos; + } + else { + vertexNos = NULL; + } + BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) { - func(userData, i, bmdm->vertexCos[i], bmdm->vertexNos[i], NULL); + const float *no = (flag & DM_FOREACH_USE_NORMAL) ? vertexNos[i] : NULL; + func(userData, i, vertexCos[i], no, NULL); } } else { BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) { - func(userData, i, eve->co, eve->no, NULL); + const float *no = (flag & DM_FOREACH_USE_NORMAL) ? eve->no : NULL; + func(userData, i, eve->co, no, NULL); } } } @@ -248,56 +372,42 @@ static void emDM_drawUVEdges(DerivedMesh *dm) glEnd(); } -static void emDM__calcFaceCent(BMFace *efa, float cent[3], float (*vertexCos)[3]) -{ - BMIter liter; - BMLoop *l; - int tot = 0; - - zero_v3(cent); - - /*simple (and stupid) median (average) based method :/ */ - - if (vertexCos) { - BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { - add_v3_v3(cent, vertexCos[BM_elem_index_get(l->v)]); - tot++; - } - } - else { - BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { - add_v3_v3(cent, l->v->co); - tot++; - } - } - - if (tot == 0) return; - mul_v3_fl(cent, 1.0f / (float)tot); -} - -static void emDM_foreachMappedFaceCenter(DerivedMesh *dm, - void (*func)(void *userData, int index, const float co[3], const float no[3]), - void *userData) +static void emDM_foreachMappedFaceCenter( + DerivedMesh *dm, + void (*func)(void *userData, int index, const float co[3], const float no[3]), + void *userData, + DMForeachFlag flag) { EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm; BMesh *bm = bmdm->em->bm; - float (*polyNos)[3] = NULL; + const float (*polyNos)[3]; + const float (*polyCos)[3]; BMFace *efa; BMIter iter; - float cent[3]; int i; - /* ensure for face center calculation */ - if (bmdm->vertexCos) { - BM_mesh_elem_index_ensure(bm, BM_VERT); - polyNos = bmdm->polyNos; + emDM_ensurePolyCenters(bmdm); + polyCos = bmdm->polyCos; /* always set */ - BLI_assert(polyNos != NULL); + if (flag & DM_FOREACH_USE_NORMAL) { + emDM_ensurePolyNormals(bmdm); + polyNos = bmdm->polyNos; /* maybe NULL */ + } + else { + polyNos = NULL; } - BM_ITER_MESH_INDEX (efa, &iter, bm, BM_FACES_OF_MESH, i) { - emDM__calcFaceCent(efa, cent, bmdm->vertexCos); - func(userData, i, cent, polyNos ? polyNos[i] : efa->no); + if (polyNos) { + BM_ITER_MESH_INDEX (efa, &iter, bm, BM_FACES_OF_MESH, i) { + const float *no = polyNos[i]; + func(userData, i, polyCos[i], no); + } + } + else { + BM_ITER_MESH_INDEX (efa, &iter, bm, BM_FACES_OF_MESH, i) { + const float *no = (flag & DM_FOREACH_USE_NORMAL) ? efa->no : NULL; + func(userData, i, polyCos[i], no); + } } } @@ -349,10 +459,20 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, if (bmdm->vertexCos) { /* add direct access */ - float (*vertexCos)[3] = bmdm->vertexCos; - float (*vertexNos)[3] = bmdm->vertexNos; - float (*polyNos)[3] = bmdm->polyNos; - // int *triPolyMap = bmdm->triPolyMap; + const float (*vertexCos)[3] = bmdm->vertexCos; + const float (*vertexNos)[3]; + const float (*polyNos)[3]; + + if (skip_normals) { + vertexNos = NULL; + polyNos = NULL; + } + else { + emDM_ensureVertNormals(bmdm); + emDM_ensurePolyNormals(bmdm); + vertexNos = bmdm->vertexNos; + polyNos = bmdm->polyNos; + } BM_mesh_elem_index_ensure(bm, BM_VERT | BM_FACE); @@ -561,9 +681,6 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm, BMEditMesh *em = bmdm->em; BMesh *bm = em->bm; struct BMLoop *(*looptris)[3] = em->looptris; - float (*vertexCos)[3] = bmdm->vertexCos; - float (*vertexNos)[3] = bmdm->vertexNos; - float (*polyNos)[3] = bmdm->polyNos; BMFace *efa; MLoopUV *luv[3], dummyluv = {{0}}; MLoopCol *lcol[3] = {NULL} /* , dummylcol = {0} */; @@ -593,7 +710,17 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm, BM_mesh_elem_index_ensure(bm, BM_VERT); } - if (vertexCos) { + if (bmdm->vertexCos) { + /* add direct access */ + const float (*vertexCos)[3] = bmdm->vertexCos; + const float (*vertexNos)[3]; + const float (*polyNos)[3]; + + emDM_ensureVertNormals(bmdm); + emDM_ensurePolyNormals(bmdm); + vertexNos = bmdm->vertexNos; + polyNos = bmdm->polyNos; + BM_mesh_elem_index_ensure(bm, BM_VERT); for (i = 0; i < em->tottri; i++) { @@ -791,9 +918,11 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm, BMEditMesh *em = bmdm->em; BMesh *bm = em->bm; struct BMLoop *(*looptris)[3] = em->looptris; - float (*vertexCos)[3] = bmdm->vertexCos; - float (*vertexNos)[3] = bmdm->vertexNos; - float (*polyNos)[3] = bmdm->polyNos; + /* add direct access */ + const float (*vertexCos)[3] = bmdm->vertexCos; + const float (*vertexNos)[3]; + const float (*polyNos)[3]; + BMFace *efa; DMVertexAttribs attribs; GPUVertexAttribs gattribs; @@ -805,6 +934,11 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm, memset(&attribs, 0, sizeof(attribs)); + emDM_ensureVertNormals(bmdm); + emDM_ensurePolyNormals(bmdm); + vertexNos = bmdm->vertexNos; + polyNos = bmdm->polyNos; + /* always use smooth shading even for flat faces, else vertex colors wont interpolate */ glShadeModel(GL_SMOOTH); BM_mesh_elem_index_ensure(bm, BM_VERT | BM_FACE); @@ -920,15 +1054,15 @@ static void emdm_pass_attrib_vertex_mat(DMVertexAttribs *attribs, BMLoop *loop, static void emDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *userData, int, void *attribs), - int (*setFace)(void *userData, int index), void *userData) + bool (*setFace)(void *userData, int index), void *userData) { EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm; BMEditMesh *em = bmdm->em; BMesh *bm = em->bm; struct BMLoop *(*looptris)[3] = em->looptris; - float (*vertexCos)[3] = bmdm->vertexCos; - float (*vertexNos)[3] = bmdm->vertexNos; - float (*polyNos)[3] = bmdm->polyNos; + const float (*vertexCos)[3] = bmdm->vertexCos; + const float (*vertexNos)[3]; + const float (*polyNos)[3]; BMFace *efa; DMVertexAttribs attribs = {{{0}}}; GPUVertexAttribs gattribs; @@ -936,6 +1070,12 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm, matnr = -1; + emDM_ensureVertNormals(bmdm); + emDM_ensurePolyNormals(bmdm); + + vertexNos = bmdm->vertexNos; + polyNos = bmdm->polyNos; + /* always use smooth shading even for flat faces, else vertex colors wont interpolate */ glShadeModel(GL_SMOOTH); @@ -1109,6 +1249,69 @@ static void emDM_getVert(DerivedMesh *dm, int index, MVert *r_vert) copy_v3_v3(r_vert->co, bmdm->vertexCos[index]); } +static void emDM_getVertCo(DerivedMesh *dm, int index, float r_co[3]) +{ + EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm; + BMesh *bm = bmdm->em->bm; + + if (UNLIKELY(index < 0 || index >= bm->totvert)) { + BLI_assert(!"error in emDM_getVertCo"); + return; + } + + if (bmdm->vertexCos) { + copy_v3_v3(r_co, bmdm->vertexCos[index]); + } + else { + BMVert *ev = bmdm->em->vert_index[index]; /* should be EDBM_vert_at_index() */ + // ev = BM_vert_at_index(bm, index); /* warning, does list loop, _not_ ideal */ + copy_v3_v3(r_co, ev->co); + } +} + +static void emDM_getVertNo(DerivedMesh *dm, int index, float r_no[3]) +{ + EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm; + BMesh *bm = bmdm->em->bm; + + if (UNLIKELY(index < 0 || index >= bm->totvert)) { + BLI_assert(!"error in emDM_getVertNo"); + return; + } + + + if (bmdm->vertexCos) { + emDM_ensureVertNormals(bmdm); + copy_v3_v3(r_no, bmdm->vertexNos[index]); + } + else { + BMVert *ev = bmdm->em->vert_index[index]; /* should be EDBM_vert_at_index() */ + // ev = BM_vert_at_index(bm, index); /* warning, does list loop, _not_ ideal */ + copy_v3_v3(r_no, ev->no); + } +} + +static void emDM_getPolyNo(DerivedMesh *dm, int index, float r_no[3]) +{ + EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm; + BMesh *bm = bmdm->em->bm; + + if (UNLIKELY(index < 0 || index >= bm->totface)) { + BLI_assert(!"error in emDM_getPolyNo"); + return; + } + + if (bmdm->vertexCos) { + emDM_ensurePolyNormals(bmdm); + copy_v3_v3(r_no, bmdm->polyNos[index]); + } + else { + BMFace *efa = bmdm->em->face_index[index]; /* should be EDBM_vert_at_index() */ + // efa = BM_face_at_index(bm, index); /* warning, does list loop, _not_ ideal */ + copy_v3_v3(r_no, efa->no); + } +} + static void emDM_getEdge(DerivedMesh *dm, int index, MEdge *r_edge) { EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm; @@ -1253,18 +1456,19 @@ static void emDM_copyLoopArray(DerivedMesh *dm, MLoop *r_loop) { EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm; BMesh *bm = bmdm->em->bm; - BMIter iter, liter; + BMIter iter; BMFace *efa; - BMLoop *l; BM_mesh_elem_index_ensure(bm, BM_VERT | BM_EDGE); BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { - BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { - r_loop->v = BM_elem_index_get(l->v); - r_loop->e = BM_elem_index_get(l->e); + BMLoop *l_iter, *l_first; + l_iter = l_first = BM_FACE_FIRST_LOOP(efa); + do { + r_loop->v = BM_elem_index_get(l_iter->v); + r_loop->e = BM_elem_index_get(l_iter->e); r_loop++; - } + } while ((l_iter = l_iter->next) != l_first); } } @@ -1378,9 +1582,17 @@ static void emDM_release(DerivedMesh *dm) if (DM_release(dm)) { if (bmdm->vertexCos) { - MEM_freeN(bmdm->vertexCos); - MEM_freeN(bmdm->vertexNos); - MEM_freeN(bmdm->polyNos); + MEM_freeN((void *)bmdm->vertexCos); + if (bmdm->vertexNos) { + MEM_freeN((void *)bmdm->vertexNos); + } + if (bmdm->polyNos) { + MEM_freeN((void *)bmdm->polyNos); + } + } + + if (bmdm->polyCos) { + MEM_freeN((void *)bmdm->polyCos); } MEM_freeN(bmdm); @@ -1456,6 +1668,9 @@ DerivedMesh *getEditDerivedBMesh(BMEditMesh *em, bmdm->dm.getNumPolys = emDM_getNumPolys; bmdm->dm.getVert = emDM_getVert; + bmdm->dm.getVertCo = emDM_getVertCo; + bmdm->dm.getVertNo = emDM_getVertNo; + bmdm->dm.getPolyNo = emDM_getPolyNo; bmdm->dm.getEdge = emDM_getEdge; bmdm->dm.getTessFace = emDM_getTessFace; bmdm->dm.copyVertArray = emDM_copyVertArray; @@ -1486,7 +1701,8 @@ DerivedMesh *getEditDerivedBMesh(BMEditMesh *em, bmdm->dm.release = emDM_release; - bmdm->vertexCos = vertexCos; + bmdm->vertexCos = (const float (*)[3])vertexCos; + bmdm->dm.deformedOnly = (vertexCos != NULL); if (cd_dvert_offset != -1) { BMIter iter; @@ -1514,38 +1730,6 @@ DerivedMesh *getEditDerivedBMesh(BMEditMesh *em, } } - if (vertexCos) { - BMFace *efa; - BMVert *eve; - BMIter fiter; - BMIter viter; - int i; - - BM_mesh_elem_index_ensure(bm, BM_VERT); - - bmdm->vertexNos = MEM_callocN(sizeof(*bmdm->vertexNos) * bm->totvert, "bmdm_vno"); - bmdm->polyNos = MEM_mallocN(sizeof(*bmdm->polyNos) * bm->totface, "bmdm_pno"); - - BM_ITER_MESH_INDEX (efa, &fiter, bm, BM_FACES_OF_MESH, i) { - BM_elem_index_set(efa, i); /* set_inline */ - BM_face_normal_update_vcos(bm, efa, bmdm->polyNos[i], (float const (*)[3])vertexCos); - } - bm->elem_index_dirty &= ~BM_FACE; - - BM_ITER_MESH_INDEX (eve, &viter, bm, BM_VERTS_OF_MESH, i) { - float *no = bmdm->vertexNos[i]; - BM_ITER_ELEM (efa, &fiter, eve, BM_FACES_OF_VERT) { - add_v3_v3(no, bmdm->polyNos[BM_elem_index_get(efa)]); - } - - /* following Mesh convention; we use vertex coordinate itself - * for normal in this case */ - if (UNLIKELY(normalize_v3(no) == 0.0f)) { - normalize_v3_v3(no, vertexCos[i]); - } - } - } - return (DerivedMesh *)bmdm; } @@ -1813,7 +1997,7 @@ static void statvis_calc_intersect( static void statvis_calc_distort( BMEditMesh *em, - const float (*vertexCos)[3], + const float (*vertexCos)[3], const float (*polyNos)[3], /* values for calculating */ const float min, const float max, /* result */ @@ -1822,7 +2006,7 @@ static void statvis_calc_distort( BMIter iter; BMesh *bm = em->bm; BMFace *f; - float f_no[3]; + const float *f_no; int index; const float minmax_irange = 1.0f / (max - min); @@ -1839,10 +2023,10 @@ static void statvis_calc_distort( else { BMLoop *l_iter, *l_first; if (vertexCos) { - BM_face_normal_update_vcos(bm, f, f_no, vertexCos); + f_no = polyNos[index]; } else { - copy_v3_v3(f_no, f->no); + f_no = f->no; } fac = 0.0f; @@ -1942,7 +2126,7 @@ void BKE_editmesh_statvis_calc(BMEditMesh *em, DerivedMesh *dm, { BKE_editmesh_color_ensure(em, BM_FACE); statvis_calc_overhang( - em, bmdm ? (const float (*)[3])bmdm->polyNos : NULL, + em, bmdm ? bmdm->polyNos : NULL, statvis->overhang_min / (float)M_PI, statvis->overhang_max / (float)M_PI, statvis->overhang_axis, @@ -1954,7 +2138,7 @@ void BKE_editmesh_statvis_calc(BMEditMesh *em, DerivedMesh *dm, const float scale = 1.0f / mat4_to_scale(em->ob->obmat); BKE_editmesh_color_ensure(em, BM_FACE); statvis_calc_thickness( - em, bmdm ? (const float (*)[3])bmdm->vertexCos : NULL, + em, bmdm ? bmdm->vertexCos : NULL, statvis->thickness_min * scale, statvis->thickness_max * scale, statvis->thickness_samples, @@ -1965,15 +2149,19 @@ void BKE_editmesh_statvis_calc(BMEditMesh *em, DerivedMesh *dm, { BKE_editmesh_color_ensure(em, BM_FACE); statvis_calc_intersect( - em, bmdm ? (const float (*)[3])bmdm->vertexCos : NULL, + em, bmdm ? bmdm->vertexCos : NULL, em->derivedFaceColor); break; } case SCE_STATVIS_DISTORT: { BKE_editmesh_color_ensure(em, BM_FACE); + + if (bmdm) + emDM_ensurePolyNormals(bmdm); + statvis_calc_distort( - em, bmdm ? (const float (*)[3])bmdm->vertexCos : NULL, + em, bmdm ? bmdm->vertexCos : NULL, bmdm ? bmdm->polyNos : NULL, statvis->distort_min, statvis->distort_max, em->derivedFaceColor); @@ -1983,7 +2171,7 @@ void BKE_editmesh_statvis_calc(BMEditMesh *em, DerivedMesh *dm, { BKE_editmesh_color_ensure(em, BM_VERT); statvis_calc_sharp( - em, bmdm ? (const float (*)[3])bmdm->vertexCos : NULL, + em, bmdm ? bmdm->vertexCos : NULL, statvis->sharp_min, statvis->sharp_max, /* in this case they are vertex colors */ @@ -2001,7 +2189,7 @@ void BKE_editmesh_statvis_calc(BMEditMesh *em, DerivedMesh *dm, struct CageUserData { int totvert; float (*cos_cage)[3]; - BLI_bitmap visit_bitmap; + BLI_bitmap *visit_bitmap; }; static void cage_mapped_verts_callback(void *userData, int index, const float co[3], @@ -2018,7 +2206,7 @@ static void cage_mapped_verts_callback(void *userData, int index, const float co float (*BKE_editmesh_vertexCos_get(BMEditMesh *em, Scene *scene, int *r_numVerts))[3] { DerivedMesh *cage, *final; - BLI_bitmap visit_bitmap; + BLI_bitmap *visit_bitmap; struct CageUserData data; float (*cos_cage)[3]; @@ -2033,7 +2221,7 @@ float (*BKE_editmesh_vertexCos_get(BMEditMesh *em, Scene *scene, int *r_numVerts data.cos_cage = cos_cage; data.visit_bitmap = visit_bitmap; - cage->foreachMappedVert(cage, cage_mapped_verts_callback, &data); + cage->foreachMappedVert(cage, cage_mapped_verts_callback, &data, DM_FOREACH_NOP); MEM_freeN(visit_bitmap); diff --git a/source/blender/blenkernel/intern/editmesh.c b/source/blender/blenkernel/intern/editmesh.c index 3e925b73116..74cd8834d5d 100644 --- a/source/blender/blenkernel/intern/editmesh.c +++ b/source/blender/blenkernel/intern/editmesh.c @@ -373,5 +373,6 @@ void BKE_editmesh_color_ensure(BMEditMesh *em, const char htype) break; default: BLI_assert(0); + break; } } diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 02d1621e408..0df8684044a 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -744,6 +744,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP float nabla = eff->pd->tex_nabla; int hasrgb; short mode = eff->pd->tex_mode; + bool scene_color_manage; if (!eff->pd->tex) return; @@ -763,7 +764,9 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP mul_m4_v3(eff->ob->imat, tex_co); } - hasrgb = multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result, NULL); + scene_color_manage = BKE_scene_check_color_management_enabled(eff->scene); + + hasrgb = multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result, NULL, scene_color_manage); if (hasrgb && mode==PFIELD_TEX_RGB) { force[0] = (0.5f - result->tr) * strength; @@ -774,15 +777,15 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP strength/=nabla; tex_co[0] += nabla; - multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+1, NULL); + multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+1, NULL, scene_color_manage); tex_co[0] -= nabla; tex_co[1] += nabla; - multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+2, NULL); + multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+2, NULL, scene_color_manage); tex_co[1] -= nabla; tex_co[2] += nabla; - multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+3, NULL); + multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+3, NULL, scene_color_manage); if (mode == PFIELD_TEX_GRAD || !hasrgb) { /* if we don't have rgb fall back to grad */ /* generate intensity if texture only has rgb value */ diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index f763670baef..791c47cc551 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -577,7 +577,7 @@ short calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, flo } /* Calculate the extents of F-Curve's keyframes */ -void calc_fcurve_range(FCurve *fcu, float *start, float *end, +bool calc_fcurve_range(FCurve *fcu, float *start, float *end, const short do_sel_only, const short do_min_length) { float min = 999999999.0f, max = -999999999.0f; @@ -621,6 +621,8 @@ void calc_fcurve_range(FCurve *fcu, float *start, float *end, *start = min; *end = max; + + return foundvert; } /* ----------------- Status Checks -------------------------- */ @@ -665,17 +667,16 @@ short fcurve_are_keyframes_usable(FCurve *fcu) if ((data->flag & FCM_GENERATOR_ADDITIVE) == 0) return 0; + break; } - break; case FMODIFIER_TYPE_FN_GENERATOR: { FMod_FunctionGenerator *data = (FMod_FunctionGenerator *)fcm->data; if ((data->flag & FCM_GENERATOR_ADDITIVE) == 0) return 0; + break; } - break; - /* always harmful - cannot allow */ default: return 0; @@ -1697,13 +1698,12 @@ static float evaluate_driver(ChannelDriver *driver, const float evaltime) /* perform operations on the total if appropriate */ if (driver->type == DRIVER_TYPE_AVERAGE) - driver->curval = (value / (float)tot); + driver->curval = tot ? (value / (float)tot) : 0.0f; else driver->curval = value; } + break; } - break; - case DRIVER_TYPE_MIN: /* smallest value */ case DRIVER_TYPE_MAX: /* largest value */ { @@ -1736,9 +1736,8 @@ static float evaluate_driver(ChannelDriver *driver, const float evaltime) /* store value in driver */ driver->curval = value; + break; } - break; - case DRIVER_TYPE_PYTHON: /* expression */ { #ifdef WITH_PYTHON @@ -1757,15 +1756,15 @@ static float evaluate_driver(ChannelDriver *driver, const float evaltime) #else /* WITH_PYTHON*/ (void)evaltime; #endif /* WITH_PYTHON*/ + break; } - break; - default: { /* special 'hack' - just use stored value * This is currently used as the mechanism which allows animated settings to be able * to be changed via the UI. */ + break; } } diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 19912a19d94..915c75a0e7f 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -213,9 +213,8 @@ static void fcm_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *c /* cleanup */ if (powers) MEM_freeN(powers); + break; } - break; - case FCM_GENERATOR_POLYNOMIAL_FACTORISED: /* Factorized polynomial */ { float value = 1.0f, *cp = NULL; @@ -232,8 +231,8 @@ static void fcm_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *c else *cvalue = value; } + break; } - break; } } @@ -316,8 +315,8 @@ static void fcm_fn_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float } else fn = tan; + break; } - break; case FCM_GENERATOR_FN_LN: /* natural log */ { /* check that value is greater than 1? */ @@ -328,8 +327,8 @@ static void fcm_fn_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float if ((data->flag & FCM_GENERATOR_ADDITIVE) == 0) *cvalue = 0.0f; /* no value possible here */ } + break; } - break; case FCM_GENERATOR_FN_SQRT: /* square root */ { /* no negative numbers */ @@ -340,11 +339,12 @@ static void fcm_fn_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float if ((data->flag & FCM_GENERATOR_ADDITIVE) == 0) *cvalue = 0.0f; /* no value possible here */ } + break; } - break; - default: printf("Invalid Function-Generator for F-Modifier - %d\n", data->type); + break; + } /* execute function callback to set value if appropriate */ diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index b3edeb67928..7c23438f93d 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -516,7 +516,7 @@ struct CharTrans *BKE_vfont_to_curve(Main *bmain, Scene *scene, Object *ob, int /* Create unicode string */ utf8len = BLI_strlen_utf8(cu->str); - mem = MEM_callocN(((utf8len + 1) * sizeof(wchar_t)), "convertedmem"); + mem = MEM_mallocN(((utf8len + 1) * sizeof(wchar_t)), "convertedmem"); BLI_strncpy_wchar_from_utf8(mem, cu->str, utf8len + 1); diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index f60823edcc8..f20506af967 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -445,6 +445,7 @@ void IDP_SyncGroupValues(IDProperty *dest, IDProperty *src) IDP_FreeProperty(tmp); MEM_freeN(tmp); + break; } } } @@ -709,9 +710,7 @@ int IDP_EqualsProperties_ex(IDProperty *prop1, IDProperty *prop2, const int is_s if (prop1->len == prop2->len && prop1->subtype == prop2->subtype) { return memcmp(IDP_Array(prop1), IDP_Array(prop2), idp_size_table[(int)prop1->subtype] * prop1->len); } - else { - return 0; - } + return 0; case IDP_GROUP: { IDProperty *link1, *link2; @@ -813,9 +812,7 @@ IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *n prop->len = prop->totallen = val->array.len; break; } - else { - return NULL; - } + return NULL; } case IDP_STRING: { @@ -911,5 +908,6 @@ void IDP_UnlinkProperty(IDProperty *prop) switch (prop->type) { case IDP_ID: IDP_UnlinkID(prop); + break; } } diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index e28b1bf3f69..1a444d497a0 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -633,7 +633,7 @@ Image *BKE_image_load_exists(const char *filepath) for (ima = G.main->image.first; ima; ima = ima->id.next) { if (ima->source != IMA_SRC_VIEWER && ima->source != IMA_SRC_GENERATED) { BLI_strncpy(strtest, ima->name, sizeof(ima->name)); - BLI_path_abs(strtest, G.main->name); + BLI_path_abs(strtest, ID_BLEND_PATH(G.main, &ima->id)); if (BLI_path_cmp(strtest, str) == 0) { if (ima->anim == NULL || ima->id.us == 0) { @@ -695,6 +695,7 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char break; default: BKE_image_buf_fill_color(rect, rect_float, width, height, color); + break; } if (rect_float) { @@ -1120,6 +1121,7 @@ char BKE_imtype_valid_channels(const char imtype) case R_IMF_IMTYPE_QUICKTIME: case R_IMF_IMTYPE_DPX: chan_flag |= IMA_CHAN_FLAG_ALPHA; + break; } /* bw */ @@ -1131,6 +1133,7 @@ char BKE_imtype_valid_channels(const char imtype) case R_IMF_IMTYPE_TIFF: case R_IMF_IMTYPE_IRIS: chan_flag |= IMA_CHAN_FLAG_BW; + break; } return chan_flag; @@ -2718,8 +2721,8 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_ re = RE_GetRender(iuser->scene->id.name); channels = 4; - layer = (iuser) ? iuser->layer : 0; - pass = (iuser) ? iuser->pass : 0; + layer = iuser->layer; + pass = iuser->pass; if (from_render) { RE_AcquireResultImage(re, &rres); diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index b9064fe8ba3..c8e18bc3dee 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -48,6 +48,10 @@ #include "BKE_global.h" +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wtype-limits" +#endif + #ifdef _OPENMP # define CLOTH_OPENMP_LIMIT 512 #endif diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 10226ade786..ecc4a03d255 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1174,9 +1174,8 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i { /* just copy, as the new defines match the old ones... */ fcu->extend = icu->extrap; + break; } - break; - case IPO_CYCL: /* cyclic extrapolation */ case IPO_CYCLX: /* cyclic extrapolation + offset */ { @@ -1191,8 +1190,8 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i data->before_mode = data->after_mode = FCM_EXTRAPOLATE_CYCLIC_OFFSET; else data->before_mode = data->after_mode = FCM_EXTRAPOLATE_CYCLIC; + break; } - break; } /* -------- */ diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index e141b9dbabe..5b8929e49fe 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -533,7 +533,7 @@ static char *key_block_get_data(Key *key, KeyBlock *actkb, KeyBlock *kb, char ** if (me->edit_btmesh && me->edit_btmesh->bm->totvert == kb->totelem) { a = 0; - co = MEM_callocN(sizeof(float) * 3 * me->edit_btmesh->bm->totvert, "key_block_get_data"); + co = MEM_mallocN(sizeof(float) * 3 * me->edit_btmesh->bm->totvert, "key_block_get_data"); BM_ITER_MESH (eve, &iter, me->edit_btmesh->bm, BM_VERTS_OF_MESH) { copy_v3_v3(co[a], eve->co); @@ -1091,7 +1091,7 @@ static float *get_weights_array(Object *ob, char *vgroup) float *weights; int i; - weights = MEM_callocN(totvert * sizeof(float), "weights"); + weights = MEM_mallocN(totvert * sizeof(float), "weights"); if (em) { const int cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT); @@ -1342,7 +1342,8 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int } /* returns key coordinates (+ tilt) when key applied, NULL otherwise */ -float *BKE_key_evaluate_object(Scene *scene, Object *ob, int *r_totelem) +float *BKE_key_evaluate_object_ex(Scene *scene, Object *ob, int *r_totelem, + float *arr, size_t arr_size) { Key *key = BKE_key_from_object(ob); KeyBlock *actkb = BKE_keyblock_from_object(ob); @@ -1386,7 +1387,16 @@ float *BKE_key_evaluate_object(Scene *scene, Object *ob, int *r_totelem) return NULL; /* allocate array */ - out = MEM_callocN(size, "BKE_key_evaluate_object out"); + if (arr == NULL) { + out = MEM_callocN(size, "BKE_key_evaluate_object out"); + } + else { + if (arr_size != size) { + return NULL; + } + + out = (char *)arr; + } /* prevent python from screwing this up? anyhoo, the from pointer could be dropped */ key->from = (ID *)ob->data; @@ -1427,6 +1437,11 @@ float *BKE_key_evaluate_object(Scene *scene, Object *ob, int *r_totelem) return (float *)out; } +float *BKE_key_evaluate_object(Scene *scene, Object *ob, int *r_totelem) +{ + return BKE_key_evaluate_object_ex(scene, ob, r_totelem, NULL, 0); +} + Key *BKE_key_from_object(Object *ob) { if (ob == NULL) return NULL; @@ -1607,7 +1622,7 @@ void BKE_key_convert_from_lattice(Lattice *lt, KeyBlock *kb) if (kb->data) MEM_freeN(kb->data); - kb->data = MEM_callocN(lt->key->elemsize * tot, "kb->data"); + kb->data = MEM_mallocN(lt->key->elemsize * tot, "kb->data"); kb->totelem = tot; bp = lt->def; @@ -1649,7 +1664,7 @@ void BKE_key_convert_from_curve(Curve *cu, KeyBlock *kb, ListBase *nurb) if (kb->data) MEM_freeN(kb->data); - kb->data = MEM_callocN(cu->key->elemsize * tot, "kb->data"); + kb->data = MEM_mallocN(cu->key->elemsize * tot, "kb->data"); kb->totelem = tot; nu = nurb->first; @@ -1747,7 +1762,7 @@ void BKE_key_convert_from_mesh(Mesh *me, KeyBlock *kb) if (kb->data) MEM_freeN(kb->data); - kb->data = MEM_callocN(me->key->elemsize * me->totvert, "kb->data"); + kb->data = MEM_mallocN(me->key->elemsize * me->totvert, "kb->data"); kb->totelem = me->totvert; mvert = me->mvert; @@ -1797,7 +1812,7 @@ float (*BKE_key_convert_to_vertcos(Object *ob, KeyBlock *kb))[3] if (tot == 0) return NULL; - vertCos = MEM_callocN(tot * sizeof(*vertCos), "BKE_key_convert_to_vertcos vertCos"); + vertCos = MEM_mallocN(tot * sizeof(*vertCos), "BKE_key_convert_to_vertcos vertCos"); /* Copy coords to array */ co = (float *)vertCos; @@ -1880,7 +1895,7 @@ void BKE_key_convert_from_vertcos(Object *ob, KeyBlock *kb, float (*vertCos)[3]) return; } - fp = kb->data = MEM_callocN(tot * elemsize, "BKE_key_convert_to_vertcos vertCos"); + fp = kb->data = MEM_mallocN(tot * elemsize, "BKE_key_convert_to_vertcos vertCos"); /* Copy coords to keyblock */ diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index c9b904e76ac..a4892253c63 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -681,7 +681,7 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target, * we want either a Mesh with no derived data, or derived data with * deformverts */ - if (target && target->type == OB_MESH) { + if (target->type == OB_MESH) { /* if there's derived data without deformverts, don't use vgroups */ if (dm) { use_vgroups = (dm->getVertData(dm, 0, CD_MDEFORMVERT) != NULL); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 5b5d4f3c318..7eb4a3a2a8d 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1057,6 +1057,7 @@ void free_main(Main *mainvar) case 32: BKE_libblock_free(lb, id); break; default: BLI_assert(0); + break; } #endif } @@ -1573,7 +1574,10 @@ void BKE_library_make_local(Main *bmain, Library *lib, bool untagged_only) { if (lib == NULL || id->lib == lib) { if (id->lib) { - id_make_local(id, false); + /* for Make Local > All we should be calling id_make_local, + * but doing that breaks append (see #36003 and #36006), we + * we should make it work with all datablocks and id.us==0 */ + id_clear_lib_data(bmain, id); /* sets 'id->flag' */ /* why sort alphabetically here but not in * id_clear_lib_data() ? - campbell */ diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index f47f86744af..497554be113 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -183,7 +183,7 @@ static LineStyleModifier *new_modifier(int type, size_t size) m = (LineStyleModifier *)MEM_callocN(size, "line style modifier"); m->type = type; - strcpy(m->name, modifier_name[type]); + BLI_strncpy(m->name, modifier_name[type], sizeof(m->name)); m->influence = 1.0f; m->flags = LS_MODIFIER_ENABLED | LS_MODIFIER_EXPANDED; @@ -201,20 +201,20 @@ static LineStyleModifier *alloc_color_modifier(int type) size_t size; switch (type) { - case LS_MODIFIER_ALONG_STROKE: - size = sizeof(LineStyleColorModifier_AlongStroke); - break; - case LS_MODIFIER_DISTANCE_FROM_CAMERA: - size = sizeof(LineStyleColorModifier_DistanceFromCamera); - break; - case LS_MODIFIER_DISTANCE_FROM_OBJECT: - size = sizeof(LineStyleColorModifier_DistanceFromObject); - break; - case LS_MODIFIER_MATERIAL: - size = sizeof(LineStyleColorModifier_Material); - break; - default: - return NULL; /* unknown modifier type */ + case LS_MODIFIER_ALONG_STROKE: + size = sizeof(LineStyleColorModifier_AlongStroke); + break; + case LS_MODIFIER_DISTANCE_FROM_CAMERA: + size = sizeof(LineStyleColorModifier_DistanceFromCamera); + break; + case LS_MODIFIER_DISTANCE_FROM_OBJECT: + size = sizeof(LineStyleColorModifier_DistanceFromObject); + break; + case LS_MODIFIER_MATERIAL: + size = sizeof(LineStyleColorModifier_Material); + break; + default: + return NULL; /* unknown modifier type */ } return new_modifier(type, size); @@ -228,26 +228,26 @@ LineStyleModifier *BKE_add_linestyle_color_modifier(FreestyleLineStyle *linestyl m->blend = MA_RAMP_BLEND; switch (type) { - case LS_MODIFIER_ALONG_STROKE: - ((LineStyleColorModifier_AlongStroke *)m)->color_ramp = add_colorband(1); - break; - case LS_MODIFIER_DISTANCE_FROM_CAMERA: - ((LineStyleColorModifier_DistanceFromCamera *)m)->color_ramp = add_colorband(1); - ((LineStyleColorModifier_DistanceFromCamera *)m)->range_min = 0.0f; - ((LineStyleColorModifier_DistanceFromCamera *)m)->range_max = 10000.0f; - break; - case LS_MODIFIER_DISTANCE_FROM_OBJECT: - ((LineStyleColorModifier_DistanceFromObject *)m)->target = NULL; - ((LineStyleColorModifier_DistanceFromObject *)m)->color_ramp = add_colorband(1); - ((LineStyleColorModifier_DistanceFromObject *)m)->range_min = 0.0f; - ((LineStyleColorModifier_DistanceFromObject *)m)->range_max = 10000.0f; - break; - case LS_MODIFIER_MATERIAL: - ((LineStyleColorModifier_Material *)m)->color_ramp = add_colorband(1); - ((LineStyleColorModifier_Material *)m)->mat_attr = LS_MODIFIER_MATERIAL_DIFF; - break; - default: - return NULL; /* unknown modifier type */ + case LS_MODIFIER_ALONG_STROKE: + ((LineStyleColorModifier_AlongStroke *)m)->color_ramp = add_colorband(1); + break; + case LS_MODIFIER_DISTANCE_FROM_CAMERA: + ((LineStyleColorModifier_DistanceFromCamera *)m)->color_ramp = add_colorband(1); + ((LineStyleColorModifier_DistanceFromCamera *)m)->range_min = 0.0f; + ((LineStyleColorModifier_DistanceFromCamera *)m)->range_max = 10000.0f; + break; + case LS_MODIFIER_DISTANCE_FROM_OBJECT: + ((LineStyleColorModifier_DistanceFromObject *)m)->target = NULL; + ((LineStyleColorModifier_DistanceFromObject *)m)->color_ramp = add_colorband(1); + ((LineStyleColorModifier_DistanceFromObject *)m)->range_min = 0.0f; + ((LineStyleColorModifier_DistanceFromObject *)m)->range_max = 10000.0f; + break; + case LS_MODIFIER_MATERIAL: + ((LineStyleColorModifier_Material *)m)->color_ramp = add_colorband(1); + ((LineStyleColorModifier_Material *)m)->mat_attr = LS_MODIFIER_MATERIAL_DIFF; + break; + default: + return NULL; /* unknown modifier type */ } add_to_modifier_list(&linestyle->color_modifiers, m); @@ -264,23 +264,23 @@ LineStyleModifier *BKE_copy_linestyle_color_modifier(FreestyleLineStyle *linesty new_m->blend = m->blend; switch (m->type) { - case LS_MODIFIER_ALONG_STROKE: + case LS_MODIFIER_ALONG_STROKE: { LineStyleColorModifier_AlongStroke *p = (LineStyleColorModifier_AlongStroke *)m; LineStyleColorModifier_AlongStroke *q = (LineStyleColorModifier_AlongStroke *)new_m; q->color_ramp = MEM_dupallocN(p->color_ramp); + break; } - break; - case LS_MODIFIER_DISTANCE_FROM_CAMERA: + case LS_MODIFIER_DISTANCE_FROM_CAMERA: { LineStyleColorModifier_DistanceFromCamera *p = (LineStyleColorModifier_DistanceFromCamera *)m; LineStyleColorModifier_DistanceFromCamera *q = (LineStyleColorModifier_DistanceFromCamera *)new_m; q->color_ramp = MEM_dupallocN(p->color_ramp); q->range_min = p->range_min; q->range_max = p->range_max; + break; } - break; - case LS_MODIFIER_DISTANCE_FROM_OBJECT: + case LS_MODIFIER_DISTANCE_FROM_OBJECT: { LineStyleColorModifier_DistanceFromObject *p = (LineStyleColorModifier_DistanceFromObject *)m; LineStyleColorModifier_DistanceFromObject *q = (LineStyleColorModifier_DistanceFromObject *)new_m; @@ -290,19 +290,19 @@ LineStyleModifier *BKE_copy_linestyle_color_modifier(FreestyleLineStyle *linesty q->color_ramp = MEM_dupallocN(p->color_ramp); q->range_min = p->range_min; q->range_max = p->range_max; + break; } - break; - case LS_MODIFIER_MATERIAL: + case LS_MODIFIER_MATERIAL: { LineStyleColorModifier_Material *p = (LineStyleColorModifier_Material *)m; LineStyleColorModifier_Material *q = (LineStyleColorModifier_Material *)new_m; q->color_ramp = MEM_dupallocN(p->color_ramp); q->flags = p->flags; q->mat_attr = p->mat_attr; + break; } - break; - default: - return NULL; /* unknown modifier type */ + default: + return NULL; /* unknown modifier type */ } add_to_modifier_list(&linestyle->color_modifiers, new_m); @@ -312,18 +312,18 @@ LineStyleModifier *BKE_copy_linestyle_color_modifier(FreestyleLineStyle *linesty void BKE_remove_linestyle_color_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) { switch (m->type) { - case LS_MODIFIER_ALONG_STROKE: - MEM_freeN(((LineStyleColorModifier_AlongStroke *)m)->color_ramp); - break; - case LS_MODIFIER_DISTANCE_FROM_CAMERA: - MEM_freeN(((LineStyleColorModifier_DistanceFromCamera *)m)->color_ramp); - break; - case LS_MODIFIER_DISTANCE_FROM_OBJECT: - MEM_freeN(((LineStyleColorModifier_DistanceFromObject *)m)->color_ramp); - break; - case LS_MODIFIER_MATERIAL: - MEM_freeN(((LineStyleColorModifier_Material *)m)->color_ramp); - break; + case LS_MODIFIER_ALONG_STROKE: + MEM_freeN(((LineStyleColorModifier_AlongStroke *)m)->color_ramp); + break; + case LS_MODIFIER_DISTANCE_FROM_CAMERA: + MEM_freeN(((LineStyleColorModifier_DistanceFromCamera *)m)->color_ramp); + break; + case LS_MODIFIER_DISTANCE_FROM_OBJECT: + MEM_freeN(((LineStyleColorModifier_DistanceFromObject *)m)->color_ramp); + break; + case LS_MODIFIER_MATERIAL: + MEM_freeN(((LineStyleColorModifier_Material *)m)->color_ramp); + break; } BLI_freelinkN(&linestyle->color_modifiers, m); } @@ -333,20 +333,20 @@ static LineStyleModifier *alloc_alpha_modifier(int type) size_t size; switch (type) { - case LS_MODIFIER_ALONG_STROKE: - size = sizeof(LineStyleAlphaModifier_AlongStroke); - break; - case LS_MODIFIER_DISTANCE_FROM_CAMERA: - size = sizeof(LineStyleAlphaModifier_DistanceFromCamera); - break; - case LS_MODIFIER_DISTANCE_FROM_OBJECT: - size = sizeof(LineStyleAlphaModifier_DistanceFromObject); - break; - case LS_MODIFIER_MATERIAL: - size = sizeof(LineStyleAlphaModifier_Material); - break; - default: - return NULL; /* unknown modifier type */ + case LS_MODIFIER_ALONG_STROKE: + size = sizeof(LineStyleAlphaModifier_AlongStroke); + break; + case LS_MODIFIER_DISTANCE_FROM_CAMERA: + size = sizeof(LineStyleAlphaModifier_DistanceFromCamera); + break; + case LS_MODIFIER_DISTANCE_FROM_OBJECT: + size = sizeof(LineStyleAlphaModifier_DistanceFromObject); + break; + case LS_MODIFIER_MATERIAL: + size = sizeof(LineStyleAlphaModifier_Material); + break; + default: + return NULL; /* unknown modifier type */ } return new_modifier(type, size); } @@ -359,38 +359,38 @@ LineStyleModifier *BKE_add_linestyle_alpha_modifier(FreestyleLineStyle *linestyl m->blend = LS_VALUE_BLEND; switch (type) { - case LS_MODIFIER_ALONG_STROKE: + case LS_MODIFIER_ALONG_STROKE: { LineStyleAlphaModifier_AlongStroke *p = (LineStyleAlphaModifier_AlongStroke *)m; p->curve = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); + break; } - break; - case LS_MODIFIER_DISTANCE_FROM_CAMERA: + case LS_MODIFIER_DISTANCE_FROM_CAMERA: { LineStyleAlphaModifier_DistanceFromCamera *p = (LineStyleAlphaModifier_DistanceFromCamera *)m; p->curve = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); p->range_min = 0.0f; p->range_max = 10000.0f; + break; } - break; - case LS_MODIFIER_DISTANCE_FROM_OBJECT: + case LS_MODIFIER_DISTANCE_FROM_OBJECT: { LineStyleAlphaModifier_DistanceFromObject *p = (LineStyleAlphaModifier_DistanceFromObject *)m; p->target = NULL; p->curve = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); p->range_min = 0.0f; p->range_max = 10000.0f; + break; } - break; - case LS_MODIFIER_MATERIAL: + case LS_MODIFIER_MATERIAL: { LineStyleAlphaModifier_Material *p = (LineStyleAlphaModifier_Material *)m; p->curve = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); p->mat_attr = LS_MODIFIER_MATERIAL_DIFF; + break; } - break; - default: - return NULL; /* unknown modifier type */ + default: + return NULL; /* unknown modifier type */ } add_to_modifier_list(&linestyle->alpha_modifiers, m); @@ -407,15 +407,15 @@ LineStyleModifier *BKE_copy_linestyle_alpha_modifier(FreestyleLineStyle *linesty new_m->blend = m->blend; switch (m->type) { - case LS_MODIFIER_ALONG_STROKE: + case LS_MODIFIER_ALONG_STROKE: { LineStyleAlphaModifier_AlongStroke *p = (LineStyleAlphaModifier_AlongStroke *)m; LineStyleAlphaModifier_AlongStroke *q = (LineStyleAlphaModifier_AlongStroke *)new_m; q->curve = curvemapping_copy(p->curve); q->flags = p->flags; + break; } - break; - case LS_MODIFIER_DISTANCE_FROM_CAMERA: + case LS_MODIFIER_DISTANCE_FROM_CAMERA: { LineStyleAlphaModifier_DistanceFromCamera *p = (LineStyleAlphaModifier_DistanceFromCamera *)m; LineStyleAlphaModifier_DistanceFromCamera *q = (LineStyleAlphaModifier_DistanceFromCamera *)new_m; @@ -423,9 +423,9 @@ LineStyleModifier *BKE_copy_linestyle_alpha_modifier(FreestyleLineStyle *linesty q->flags = p->flags; q->range_min = p->range_min; q->range_max = p->range_max; + break; } - break; - case LS_MODIFIER_DISTANCE_FROM_OBJECT: + case LS_MODIFIER_DISTANCE_FROM_OBJECT: { LineStyleAlphaModifier_DistanceFromObject *p = (LineStyleAlphaModifier_DistanceFromObject *)m; LineStyleAlphaModifier_DistanceFromObject *q = (LineStyleAlphaModifier_DistanceFromObject *)new_m; @@ -436,19 +436,19 @@ LineStyleModifier *BKE_copy_linestyle_alpha_modifier(FreestyleLineStyle *linesty q->flags = p->flags; q->range_min = p->range_min; q->range_max = p->range_max; + break; } - break; - case LS_MODIFIER_MATERIAL: + case LS_MODIFIER_MATERIAL: { LineStyleAlphaModifier_Material *p = (LineStyleAlphaModifier_Material *)m; LineStyleAlphaModifier_Material *q = (LineStyleAlphaModifier_Material *)new_m; q->curve = curvemapping_copy(p->curve); q->flags = p->flags; q->mat_attr = p->mat_attr; + break; } - break; - default: - return NULL; /* unknown modifier type */ + default: + return NULL; /* unknown modifier type */ } add_to_modifier_list(&linestyle->alpha_modifiers, new_m); @@ -458,18 +458,18 @@ LineStyleModifier *BKE_copy_linestyle_alpha_modifier(FreestyleLineStyle *linesty void BKE_remove_linestyle_alpha_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) { switch (m->type) { - case LS_MODIFIER_ALONG_STROKE: - curvemapping_free(((LineStyleAlphaModifier_AlongStroke *)m)->curve); - break; - case LS_MODIFIER_DISTANCE_FROM_CAMERA: - curvemapping_free(((LineStyleAlphaModifier_DistanceFromCamera *)m)->curve); - break; - case LS_MODIFIER_DISTANCE_FROM_OBJECT: - curvemapping_free(((LineStyleAlphaModifier_DistanceFromObject *)m)->curve); - break; - case LS_MODIFIER_MATERIAL: - curvemapping_free(((LineStyleAlphaModifier_Material *)m)->curve); - break; + case LS_MODIFIER_ALONG_STROKE: + curvemapping_free(((LineStyleAlphaModifier_AlongStroke *)m)->curve); + break; + case LS_MODIFIER_DISTANCE_FROM_CAMERA: + curvemapping_free(((LineStyleAlphaModifier_DistanceFromCamera *)m)->curve); + break; + case LS_MODIFIER_DISTANCE_FROM_OBJECT: + curvemapping_free(((LineStyleAlphaModifier_DistanceFromObject *)m)->curve); + break; + case LS_MODIFIER_MATERIAL: + curvemapping_free(((LineStyleAlphaModifier_Material *)m)->curve); + break; } BLI_freelinkN(&linestyle->alpha_modifiers, m); } @@ -479,23 +479,23 @@ static LineStyleModifier *alloc_thickness_modifier(int type) size_t size; switch (type) { - case LS_MODIFIER_ALONG_STROKE: - size = sizeof(LineStyleThicknessModifier_AlongStroke); - break; - case LS_MODIFIER_DISTANCE_FROM_CAMERA: - size = sizeof(LineStyleThicknessModifier_DistanceFromCamera); - break; - case LS_MODIFIER_DISTANCE_FROM_OBJECT: - size = sizeof(LineStyleThicknessModifier_DistanceFromObject); - break; - case LS_MODIFIER_MATERIAL: - size = sizeof(LineStyleThicknessModifier_Material); - break; - case LS_MODIFIER_CALLIGRAPHY: - size = sizeof(LineStyleThicknessModifier_Calligraphy); - break; - default: - return NULL; /* unknown modifier type */ + case LS_MODIFIER_ALONG_STROKE: + size = sizeof(LineStyleThicknessModifier_AlongStroke); + break; + case LS_MODIFIER_DISTANCE_FROM_CAMERA: + size = sizeof(LineStyleThicknessModifier_DistanceFromCamera); + break; + case LS_MODIFIER_DISTANCE_FROM_OBJECT: + size = sizeof(LineStyleThicknessModifier_DistanceFromObject); + break; + case LS_MODIFIER_MATERIAL: + size = sizeof(LineStyleThicknessModifier_Material); + break; + case LS_MODIFIER_CALLIGRAPHY: + size = sizeof(LineStyleThicknessModifier_Calligraphy); + break; + default: + return NULL; /* unknown modifier type */ } return new_modifier(type, size); @@ -509,15 +509,15 @@ LineStyleModifier *BKE_add_linestyle_thickness_modifier(FreestyleLineStyle *line m->blend = LS_VALUE_BLEND; switch (type) { - case LS_MODIFIER_ALONG_STROKE: + case LS_MODIFIER_ALONG_STROKE: { LineStyleThicknessModifier_AlongStroke *p = (LineStyleThicknessModifier_AlongStroke *)m; p->curve = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); p->value_min = 0.0f; p->value_max = 1.0f; + break; } - break; - case LS_MODIFIER_DISTANCE_FROM_CAMERA: + case LS_MODIFIER_DISTANCE_FROM_CAMERA: { LineStyleThicknessModifier_DistanceFromCamera *p = (LineStyleThicknessModifier_DistanceFromCamera *)m; p->curve = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); @@ -525,9 +525,9 @@ LineStyleModifier *BKE_add_linestyle_thickness_modifier(FreestyleLineStyle *line p->range_max = 1000.0f; p->value_min = 0.0f; p->value_max = 1.0f; + break; } - break; - case LS_MODIFIER_DISTANCE_FROM_OBJECT: + case LS_MODIFIER_DISTANCE_FROM_OBJECT: { LineStyleThicknessModifier_DistanceFromObject *p = (LineStyleThicknessModifier_DistanceFromObject *)m; p->target = NULL; @@ -536,27 +536,27 @@ LineStyleModifier *BKE_add_linestyle_thickness_modifier(FreestyleLineStyle *line p->range_max = 1000.0f; p->value_min = 0.0f; p->value_max = 1.0f; + break; } - break; - case LS_MODIFIER_MATERIAL: + case LS_MODIFIER_MATERIAL: { LineStyleThicknessModifier_Material *p = (LineStyleThicknessModifier_Material *)m; p->curve = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); p->mat_attr = LS_MODIFIER_MATERIAL_DIFF; p->value_min = 0.0f; p->value_max = 1.0f; + break; } - break; - case LS_MODIFIER_CALLIGRAPHY: + case LS_MODIFIER_CALLIGRAPHY: { LineStyleThicknessModifier_Calligraphy *p = (LineStyleThicknessModifier_Calligraphy *)m; p->min_thickness = 1.0f; p->max_thickness = 10.0f; p->orientation = DEG2RADF(60.0f); + break; } - break; - default: - return NULL; /* unknown modifier type */ + default: + return NULL; /* unknown modifier type */ } add_to_modifier_list(&linestyle->thickness_modifiers, m); @@ -575,7 +575,7 @@ LineStyleModifier *BKE_copy_linestyle_thickness_modifier(FreestyleLineStyle *lin new_m->blend = m->blend; switch (m->type) { - case LS_MODIFIER_ALONG_STROKE: + case LS_MODIFIER_ALONG_STROKE: { LineStyleThicknessModifier_AlongStroke *p = (LineStyleThicknessModifier_AlongStroke *)m; LineStyleThicknessModifier_AlongStroke *q = (LineStyleThicknessModifier_AlongStroke *)new_m; @@ -583,9 +583,9 @@ LineStyleModifier *BKE_copy_linestyle_thickness_modifier(FreestyleLineStyle *lin q->flags = p->flags; q->value_min = p->value_min; q->value_max = p->value_max; + break; } - break; - case LS_MODIFIER_DISTANCE_FROM_CAMERA: + case LS_MODIFIER_DISTANCE_FROM_CAMERA: { LineStyleThicknessModifier_DistanceFromCamera *p = (LineStyleThicknessModifier_DistanceFromCamera *)m; LineStyleThicknessModifier_DistanceFromCamera *q = (LineStyleThicknessModifier_DistanceFromCamera *)new_m; @@ -595,9 +595,9 @@ LineStyleModifier *BKE_copy_linestyle_thickness_modifier(FreestyleLineStyle *lin q->range_max = p->range_max; q->value_min = p->value_min; q->value_max = p->value_max; + break; } - break; - case LS_MODIFIER_DISTANCE_FROM_OBJECT: + case LS_MODIFIER_DISTANCE_FROM_OBJECT: { LineStyleThicknessModifier_DistanceFromObject *p = (LineStyleThicknessModifier_DistanceFromObject *)m; LineStyleThicknessModifier_DistanceFromObject *q = (LineStyleThicknessModifier_DistanceFromObject *)new_m; @@ -610,9 +610,9 @@ LineStyleModifier *BKE_copy_linestyle_thickness_modifier(FreestyleLineStyle *lin q->range_max = p->range_max; q->value_min = p->value_min; q->value_max = p->value_max; + break; } - break; - case LS_MODIFIER_MATERIAL: + case LS_MODIFIER_MATERIAL: { LineStyleThicknessModifier_Material *p = (LineStyleThicknessModifier_Material *)m; LineStyleThicknessModifier_Material *q = (LineStyleThicknessModifier_Material *)new_m; @@ -621,19 +621,19 @@ LineStyleModifier *BKE_copy_linestyle_thickness_modifier(FreestyleLineStyle *lin q->mat_attr = p->mat_attr; q->value_min = p->value_min; q->value_max = p->value_max; + break; } - break; - case LS_MODIFIER_CALLIGRAPHY: + case LS_MODIFIER_CALLIGRAPHY: { LineStyleThicknessModifier_Calligraphy *p = (LineStyleThicknessModifier_Calligraphy *)m; LineStyleThicknessModifier_Calligraphy *q = (LineStyleThicknessModifier_Calligraphy *)new_m; q->min_thickness = p->min_thickness; q->max_thickness = p->max_thickness; q->orientation = p->orientation; + break; } - break; - default: - return NULL; /* unknown modifier type */ + default: + return NULL; /* unknown modifier type */ } add_to_modifier_list(&linestyle->thickness_modifiers, new_m); @@ -643,20 +643,20 @@ LineStyleModifier *BKE_copy_linestyle_thickness_modifier(FreestyleLineStyle *lin void BKE_remove_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, LineStyleModifier *m) { switch (m->type) { - case LS_MODIFIER_ALONG_STROKE: - curvemapping_free(((LineStyleThicknessModifier_AlongStroke *)m)->curve); - break; - case LS_MODIFIER_DISTANCE_FROM_CAMERA: - curvemapping_free(((LineStyleThicknessModifier_DistanceFromCamera *)m)->curve); - break; - case LS_MODIFIER_DISTANCE_FROM_OBJECT: - curvemapping_free(((LineStyleThicknessModifier_DistanceFromObject *)m)->curve); - break; - case LS_MODIFIER_MATERIAL: - curvemapping_free(((LineStyleThicknessModifier_Material *)m)->curve); - break; - case LS_MODIFIER_CALLIGRAPHY: - break; + case LS_MODIFIER_ALONG_STROKE: + curvemapping_free(((LineStyleThicknessModifier_AlongStroke *)m)->curve); + break; + case LS_MODIFIER_DISTANCE_FROM_CAMERA: + curvemapping_free(((LineStyleThicknessModifier_DistanceFromCamera *)m)->curve); + break; + case LS_MODIFIER_DISTANCE_FROM_OBJECT: + curvemapping_free(((LineStyleThicknessModifier_DistanceFromObject *)m)->curve); + break; + case LS_MODIFIER_MATERIAL: + curvemapping_free(((LineStyleThicknessModifier_Material *)m)->curve); + break; + case LS_MODIFIER_CALLIGRAPHY: + break; } BLI_freelinkN(&linestyle->thickness_modifiers, m); } @@ -666,47 +666,47 @@ static LineStyleModifier *alloc_geometry_modifier(int type) size_t size; switch (type) { - case LS_MODIFIER_SAMPLING: - size = sizeof(LineStyleGeometryModifier_Sampling); - break; - case LS_MODIFIER_BEZIER_CURVE: - size = sizeof(LineStyleGeometryModifier_BezierCurve); - break; - case LS_MODIFIER_SINUS_DISPLACEMENT: - size = sizeof(LineStyleGeometryModifier_SinusDisplacement); - break; - case LS_MODIFIER_SPATIAL_NOISE: - size = sizeof(LineStyleGeometryModifier_SpatialNoise); - break; - case LS_MODIFIER_PERLIN_NOISE_1D: - size = sizeof(LineStyleGeometryModifier_PerlinNoise1D); - break; - case LS_MODIFIER_PERLIN_NOISE_2D: - size = sizeof(LineStyleGeometryModifier_PerlinNoise2D); - break; - case LS_MODIFIER_BACKBONE_STRETCHER: - size = sizeof(LineStyleGeometryModifier_BackboneStretcher); - break; - case LS_MODIFIER_TIP_REMOVER: - size = sizeof(LineStyleGeometryModifier_TipRemover); - break; - case LS_MODIFIER_POLYGONIZATION: - size = sizeof(LineStyleGeometryModifier_Polygonalization); - break; - case LS_MODIFIER_GUIDING_LINES: - size = sizeof(LineStyleGeometryModifier_GuidingLines); - break; - case LS_MODIFIER_BLUEPRINT: - size = sizeof(LineStyleGeometryModifier_Blueprint); - break; - case LS_MODIFIER_2D_OFFSET: - size = sizeof(LineStyleGeometryModifier_2DOffset); - break; - case LS_MODIFIER_2D_TRANSFORM: - size = sizeof(LineStyleGeometryModifier_2DTransform); - break; - default: - return NULL; /* unknown modifier type */ + case LS_MODIFIER_SAMPLING: + size = sizeof(LineStyleGeometryModifier_Sampling); + break; + case LS_MODIFIER_BEZIER_CURVE: + size = sizeof(LineStyleGeometryModifier_BezierCurve); + break; + case LS_MODIFIER_SINUS_DISPLACEMENT: + size = sizeof(LineStyleGeometryModifier_SinusDisplacement); + break; + case LS_MODIFIER_SPATIAL_NOISE: + size = sizeof(LineStyleGeometryModifier_SpatialNoise); + break; + case LS_MODIFIER_PERLIN_NOISE_1D: + size = sizeof(LineStyleGeometryModifier_PerlinNoise1D); + break; + case LS_MODIFIER_PERLIN_NOISE_2D: + size = sizeof(LineStyleGeometryModifier_PerlinNoise2D); + break; + case LS_MODIFIER_BACKBONE_STRETCHER: + size = sizeof(LineStyleGeometryModifier_BackboneStretcher); + break; + case LS_MODIFIER_TIP_REMOVER: + size = sizeof(LineStyleGeometryModifier_TipRemover); + break; + case LS_MODIFIER_POLYGONIZATION: + size = sizeof(LineStyleGeometryModifier_Polygonalization); + break; + case LS_MODIFIER_GUIDING_LINES: + size = sizeof(LineStyleGeometryModifier_GuidingLines); + break; + case LS_MODIFIER_BLUEPRINT: + size = sizeof(LineStyleGeometryModifier_Blueprint); + break; + case LS_MODIFIER_2D_OFFSET: + size = sizeof(LineStyleGeometryModifier_2DOffset); + break; + case LS_MODIFIER_2D_TRANSFORM: + size = sizeof(LineStyleGeometryModifier_2DTransform); + break; + default: + return NULL; /* unknown modifier type */ } return new_modifier(type, size); @@ -719,78 +719,78 @@ LineStyleModifier *BKE_add_linestyle_geometry_modifier(FreestyleLineStyle *lines m = alloc_geometry_modifier(type); switch (type) { - case LS_MODIFIER_SAMPLING: + case LS_MODIFIER_SAMPLING: { LineStyleGeometryModifier_Sampling *p = (LineStyleGeometryModifier_Sampling *)m; p->sampling = 10.0f; + break; } - break; - case LS_MODIFIER_BEZIER_CURVE: + case LS_MODIFIER_BEZIER_CURVE: { LineStyleGeometryModifier_BezierCurve *p = (LineStyleGeometryModifier_BezierCurve *)m; p->error = 10.0f; + break; } - break; - case LS_MODIFIER_SINUS_DISPLACEMENT: + case LS_MODIFIER_SINUS_DISPLACEMENT: { LineStyleGeometryModifier_SinusDisplacement *p = (LineStyleGeometryModifier_SinusDisplacement *)m; p->wavelength = 20.0f; p->amplitude = 5.0f; p->phase = 0.0f; + break; } - break; - case LS_MODIFIER_SPATIAL_NOISE: + case LS_MODIFIER_SPATIAL_NOISE: { LineStyleGeometryModifier_SpatialNoise *p = (LineStyleGeometryModifier_SpatialNoise *)m; p->amplitude = 5.0f; p->scale = 20.0f; p->octaves = 4; p->flags = LS_MODIFIER_SPATIAL_NOISE_SMOOTH | LS_MODIFIER_SPATIAL_NOISE_PURERANDOM; + break; } - break; - case LS_MODIFIER_PERLIN_NOISE_1D: + case LS_MODIFIER_PERLIN_NOISE_1D: { LineStyleGeometryModifier_PerlinNoise1D *p = (LineStyleGeometryModifier_PerlinNoise1D *)m; p->frequency = 10.0f; p->amplitude = 10.0f; p->octaves = 4; p->angle = DEG2RADF(45.0f); + break; } - break; - case LS_MODIFIER_PERLIN_NOISE_2D: + case LS_MODIFIER_PERLIN_NOISE_2D: { LineStyleGeometryModifier_PerlinNoise2D *p = (LineStyleGeometryModifier_PerlinNoise2D *)m; p->frequency = 10.0f; p->amplitude = 10.0f; p->octaves = 4; p->angle = DEG2RADF(45.0f); + break; } - break; - case LS_MODIFIER_BACKBONE_STRETCHER: + case LS_MODIFIER_BACKBONE_STRETCHER: { LineStyleGeometryModifier_BackboneStretcher *p = (LineStyleGeometryModifier_BackboneStretcher *)m; p->backbone_length = 10.0f; + break; } - break; - case LS_MODIFIER_TIP_REMOVER: + case LS_MODIFIER_TIP_REMOVER: { LineStyleGeometryModifier_TipRemover *p = (LineStyleGeometryModifier_TipRemover *)m; p->tip_length = 10.0f; + break; } - break; - case LS_MODIFIER_POLYGONIZATION: + case LS_MODIFIER_POLYGONIZATION: { LineStyleGeometryModifier_Polygonalization *p = (LineStyleGeometryModifier_Polygonalization *)m; p->error = 10.0f; + break; } - break; - case LS_MODIFIER_GUIDING_LINES: + case LS_MODIFIER_GUIDING_LINES: { LineStyleGeometryModifier_GuidingLines *p = (LineStyleGeometryModifier_GuidingLines *)m; p->offset = 0.0f; + break; } - break; - case LS_MODIFIER_BLUEPRINT: + case LS_MODIFIER_BLUEPRINT: { LineStyleGeometryModifier_Blueprint *p = (LineStyleGeometryModifier_Blueprint *)m; p->flags = LS_MODIFIER_BLUEPRINT_CIRCLES; @@ -799,18 +799,18 @@ LineStyleModifier *BKE_add_linestyle_geometry_modifier(FreestyleLineStyle *lines p->random_radius = 3; p->random_center = 5; p->random_backbone = 5; + break; } - break; - case LS_MODIFIER_2D_OFFSET: + case LS_MODIFIER_2D_OFFSET: { LineStyleGeometryModifier_2DOffset *p = (LineStyleGeometryModifier_2DOffset *)m; p->start = 0.0f; p->end = 0.0f; p->x = 0.0f; p->y = 0.0f; + break; } - break; - case LS_MODIFIER_2D_TRANSFORM: + case LS_MODIFIER_2D_TRANSFORM: { LineStyleGeometryModifier_2DTransform *p = (LineStyleGeometryModifier_2DTransform *)m; p->pivot = LS_MODIFIER_2D_TRANSFORM_PIVOT_CENTER; @@ -820,10 +820,10 @@ LineStyleModifier *BKE_add_linestyle_geometry_modifier(FreestyleLineStyle *lines p->pivot_u = 0.5f; p->pivot_x = 0.0f; p->pivot_y = 0.0f; + break; } - break; - default: - return NULL; /* unknown modifier type */ + default: + return NULL; /* unknown modifier type */ } add_to_modifier_list(&linestyle->geometry_modifiers, m); @@ -838,30 +838,30 @@ LineStyleModifier *BKE_copy_linestyle_geometry_modifier(FreestyleLineStyle *line new_m->flags = m->flags; switch (m->type) { - case LS_MODIFIER_SAMPLING: + case LS_MODIFIER_SAMPLING: { LineStyleGeometryModifier_Sampling *p = (LineStyleGeometryModifier_Sampling *)m; LineStyleGeometryModifier_Sampling *q = (LineStyleGeometryModifier_Sampling *)new_m; q->sampling = p->sampling; + break; } - break; - case LS_MODIFIER_BEZIER_CURVE: + case LS_MODIFIER_BEZIER_CURVE: { LineStyleGeometryModifier_BezierCurve *p = (LineStyleGeometryModifier_BezierCurve *)m; LineStyleGeometryModifier_BezierCurve *q = (LineStyleGeometryModifier_BezierCurve *)new_m; q->error = p->error; + break; } - break; - case LS_MODIFIER_SINUS_DISPLACEMENT: + case LS_MODIFIER_SINUS_DISPLACEMENT: { LineStyleGeometryModifier_SinusDisplacement *p = (LineStyleGeometryModifier_SinusDisplacement *)m; LineStyleGeometryModifier_SinusDisplacement *q = (LineStyleGeometryModifier_SinusDisplacement *)new_m; q->wavelength = p->wavelength; q->amplitude = p->amplitude; q->phase = p->phase; + break; } - break; - case LS_MODIFIER_SPATIAL_NOISE: + case LS_MODIFIER_SPATIAL_NOISE: { LineStyleGeometryModifier_SpatialNoise *p = (LineStyleGeometryModifier_SpatialNoise *)m; LineStyleGeometryModifier_SpatialNoise *q = (LineStyleGeometryModifier_SpatialNoise *)new_m; @@ -869,9 +869,9 @@ LineStyleModifier *BKE_copy_linestyle_geometry_modifier(FreestyleLineStyle *line q->scale = p->scale; q->octaves = p->octaves; q->flags = p->flags; + break; } - break; - case LS_MODIFIER_PERLIN_NOISE_1D: + case LS_MODIFIER_PERLIN_NOISE_1D: { LineStyleGeometryModifier_PerlinNoise1D *p = (LineStyleGeometryModifier_PerlinNoise1D *)m; LineStyleGeometryModifier_PerlinNoise1D *q = (LineStyleGeometryModifier_PerlinNoise1D *)new_m; @@ -880,9 +880,9 @@ LineStyleModifier *BKE_copy_linestyle_geometry_modifier(FreestyleLineStyle *line q->angle = p->angle; q->octaves = p->octaves; q->seed = p->seed; + break; } - break; - case LS_MODIFIER_PERLIN_NOISE_2D: + case LS_MODIFIER_PERLIN_NOISE_2D: { LineStyleGeometryModifier_PerlinNoise2D *p = (LineStyleGeometryModifier_PerlinNoise2D *)m; LineStyleGeometryModifier_PerlinNoise2D *q = (LineStyleGeometryModifier_PerlinNoise2D *)new_m; @@ -891,37 +891,37 @@ LineStyleModifier *BKE_copy_linestyle_geometry_modifier(FreestyleLineStyle *line q->angle = p->angle; q->octaves = p->octaves; q->seed = p->seed; + break; } - break; - case LS_MODIFIER_BACKBONE_STRETCHER: + case LS_MODIFIER_BACKBONE_STRETCHER: { LineStyleGeometryModifier_BackboneStretcher *p = (LineStyleGeometryModifier_BackboneStretcher *)m; LineStyleGeometryModifier_BackboneStretcher *q = (LineStyleGeometryModifier_BackboneStretcher *)new_m; q->backbone_length = p->backbone_length; + break; } - break; - case LS_MODIFIER_TIP_REMOVER: + case LS_MODIFIER_TIP_REMOVER: { LineStyleGeometryModifier_TipRemover *p = (LineStyleGeometryModifier_TipRemover *)m; LineStyleGeometryModifier_TipRemover *q = (LineStyleGeometryModifier_TipRemover *)new_m; q->tip_length = p->tip_length; + break; } - break; - case LS_MODIFIER_POLYGONIZATION: + case LS_MODIFIER_POLYGONIZATION: { LineStyleGeometryModifier_Polygonalization *p = (LineStyleGeometryModifier_Polygonalization *)m; LineStyleGeometryModifier_Polygonalization *q = (LineStyleGeometryModifier_Polygonalization *)new_m; q->error = p->error; + break; } - break; - case LS_MODIFIER_GUIDING_LINES: + case LS_MODIFIER_GUIDING_LINES: { LineStyleGeometryModifier_GuidingLines *p = (LineStyleGeometryModifier_GuidingLines *)m; LineStyleGeometryModifier_GuidingLines *q = (LineStyleGeometryModifier_GuidingLines *)new_m; q->offset = p->offset; + break; } - break; - case LS_MODIFIER_BLUEPRINT: + case LS_MODIFIER_BLUEPRINT: { LineStyleGeometryModifier_Blueprint *p = (LineStyleGeometryModifier_Blueprint *)m; LineStyleGeometryModifier_Blueprint *q = (LineStyleGeometryModifier_Blueprint *)new_m; @@ -931,9 +931,9 @@ LineStyleModifier *BKE_copy_linestyle_geometry_modifier(FreestyleLineStyle *line q->random_radius = p->random_radius; q->random_center = p->random_center; q->random_backbone = p->random_backbone; + break; } - break; - case LS_MODIFIER_2D_OFFSET: + case LS_MODIFIER_2D_OFFSET: { LineStyleGeometryModifier_2DOffset *p = (LineStyleGeometryModifier_2DOffset *)m; LineStyleGeometryModifier_2DOffset *q = (LineStyleGeometryModifier_2DOffset *)new_m; @@ -941,9 +941,9 @@ LineStyleModifier *BKE_copy_linestyle_geometry_modifier(FreestyleLineStyle *line q->end = p->end; q->x = p->x; q->y = p->y; + break; } - break; - case LS_MODIFIER_2D_TRANSFORM: + case LS_MODIFIER_2D_TRANSFORM: { LineStyleGeometryModifier_2DTransform *p = (LineStyleGeometryModifier_2DTransform *)m; LineStyleGeometryModifier_2DTransform *q = (LineStyleGeometryModifier_2DTransform *)new_m; @@ -954,10 +954,10 @@ LineStyleModifier *BKE_copy_linestyle_geometry_modifier(FreestyleLineStyle *line q->pivot_u = p->pivot_u; q->pivot_x = p->pivot_x; q->pivot_y = p->pivot_y; + break; } - break; - default: - return NULL; /* unknown modifier type */ + default: + return NULL; /* unknown modifier type */ } add_to_modifier_list(&linestyle->geometry_modifiers, new_m); @@ -1007,20 +1007,20 @@ void BKE_list_modifier_color_ramps(FreestyleLineStyle *linestyle, ListBase *list listbase->first = listbase->last = NULL; for (m = (LineStyleModifier *)linestyle->color_modifiers.first; m; m = m->next) { switch (m->type) { - case LS_MODIFIER_ALONG_STROKE: - color_ramp = ((LineStyleColorModifier_AlongStroke *)m)->color_ramp; - break; - case LS_MODIFIER_DISTANCE_FROM_CAMERA: - color_ramp = ((LineStyleColorModifier_DistanceFromCamera *)m)->color_ramp; - break; - case LS_MODIFIER_DISTANCE_FROM_OBJECT: - color_ramp = ((LineStyleColorModifier_DistanceFromObject *)m)->color_ramp; - break; - case LS_MODIFIER_MATERIAL: - color_ramp = ((LineStyleColorModifier_Material *)m)->color_ramp; - break; - default: - continue; + case LS_MODIFIER_ALONG_STROKE: + color_ramp = ((LineStyleColorModifier_AlongStroke *)m)->color_ramp; + break; + case LS_MODIFIER_DISTANCE_FROM_CAMERA: + color_ramp = ((LineStyleColorModifier_DistanceFromCamera *)m)->color_ramp; + break; + case LS_MODIFIER_DISTANCE_FROM_OBJECT: + color_ramp = ((LineStyleColorModifier_DistanceFromObject *)m)->color_ramp; + break; + case LS_MODIFIER_MATERIAL: + color_ramp = ((LineStyleColorModifier_Material *)m)->color_ramp; + break; + default: + continue; } link = (LinkData *) MEM_callocN( sizeof(LinkData), "link to color ramp"); link->data = color_ramp; diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index b3c5ceefb2d..21e7fb3116e 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -939,8 +939,6 @@ void BKE_mask_free(Main *bmain, Mask *mask) SpaceLink *sl; Scene *scene; - BKE_sequencer_clear_mask_in_clipboard(mask); - for (scr = bmain->screen.first; scr; scr = scr->id.next) { for (area = scr->areabase.first; area; area = area->next) { for (sl = area->spacedata.first; sl; sl = sl->next) { diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index 82410d56c52..ac48eaa3185 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -496,10 +496,10 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size) /* this should _almost_ never happen but since it can in extreme cases, * we have to clamp the values or we overrun the buffer and crash */ - CLAMP(xi_min, 0, layer->buckets_x - 1); - CLAMP(xi_max, 0, layer->buckets_x - 1); - CLAMP(yi_min, 0, layer->buckets_y - 1); - CLAMP(yi_max, 0, layer->buckets_y - 1); + if (xi_min >= layer->buckets_x) xi_min = layer->buckets_x - 1; + if (xi_max >= layer->buckets_x) xi_max = layer->buckets_x - 1; + if (yi_min >= layer->buckets_y) yi_min = layer->buckets_y - 1; + if (yi_max >= layer->buckets_y) yi_max = layer->buckets_y - 1; for (yi = yi_min; yi <= yi_max; yi++) { unsigned int bucket_index = (layer->buckets_x * yi) + xi_min; @@ -530,7 +530,7 @@ static void layer_bucket_init(MaskRasterLayer *layer, const float pixel_size) if (1) { /* now convert linknodes into arrays for faster per pixel access */ - unsigned int **buckets_face = MEM_mallocN(bucket_tot * sizeof(unsigned int **), __func__); + unsigned int **buckets_face = MEM_mallocN(bucket_tot * sizeof(*buckets_face), __func__); unsigned int bucket_index; for (bucket_index = 0; bucket_index < bucket_tot; bucket_index++) { diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index c8cd65e9477..6dc3c6d7bc6 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1148,55 +1148,6 @@ void material_drivers_update(Scene *scene, Material *ma, float ctime) ma->id.flag &= ~LIB_DOIT; } - -/* ****************** */ -#if 0 /* UNUSED */ -static char colname_array[125][20] = { -"Black", "DarkRed", "HalfRed", "Red", "Red", -"DarkGreen", "DarkOlive", "Brown", "Chocolate", "OrangeRed", -"HalfGreen", "GreenOlive", "DryOlive", "Goldenrod", "DarkOrange", -"LightGreen", "Chartreuse", "YellowGreen", "Yellow", "Gold", -"Green", "LawnGreen", "GreenYellow", "LightOlive", "Yellow", -"DarkBlue", "DarkPurple", "HotPink", "VioletPink", "RedPink", -"SlateGray", "DarkGray", "PalePurple", "IndianRed", "Tomato", -"SeaGreen", "PaleGreen", "GreenKhaki", "LightBrown", "LightSalmon", -"SpringGreen", "PaleGreen", "MediumOlive", "YellowBrown", "LightGold", -"LightGreen", "LightGreen", "LightGreen", "GreenYellow", "PaleYellow", -"HalfBlue", "DarkSky", "HalfMagenta", "VioletRed", "DeepPink", -"SteelBlue", "SkyBlue", "Orchid", "LightHotPink", "HotPink", -"SeaGreen", "SlateGray", "MediumGray", "Burlywood", "LightPink", -"SpringGreen", "Aquamarine", "PaleGreen", "Khaki", "PaleOrange", -"SpringGreen", "SeaGreen", "PaleGreen", "PaleWhite", "YellowWhite", -"LightBlue", "Purple", "MediumOrchid", "Magenta", "Magenta", -"RoyalBlue", "SlateBlue", "MediumOrchid", "Orchid", "Magenta", -"DeepSkyBlue", "LightSteelBlue", "LightSkyBlue", "Violet", "LightPink", -"Cyan", "DarkTurquoise", "SkyBlue", "Gray", "Snow", -"Mint", "Mint", "Aquamarine", "MintCream", "Ivory", -"Blue", "Blue", "DarkMagenta", "DarkOrchid", "Magenta", -"SkyBlue", "RoyalBlue", "LightSlateBlue", "MediumOrchid", "Magenta", -"DodgerBlue", "SteelBlue", "MediumPurple", "PalePurple", "Plum", -"DeepSkyBlue", "PaleBlue", "LightSkyBlue", "PalePurple", "Thistle", -"Cyan", "ColdBlue", "PaleTurquoise", "GhostWhite", "White" -}; - -void automatname(Material *ma) -{ - int nr, r, g, b; - float ref; - - if (ma == NULL) return; - if (ma->mode & MA_SHLESS) ref = 1.0; - else ref = ma->ref; - - r = (int)(4.99f * (ref * ma->r)); - g = (int)(4.99f * (ref * ma->g)); - b = (int)(4.99f * (ref * ma->b)); - nr = r + 5 * g + 25 * b; - if (nr > 124) nr = 124; - new_id(&G.main->mat, (ID *)ma, colname_array[nr]); - -} -#endif int object_remove_material_slot(Object *ob) { @@ -1225,7 +1176,9 @@ int object_remove_material_slot(Object *ob) totcolp = give_totcolp(ob); matarar = give_matarar(ob); - if (*matarar == NULL) return FALSE; + if (ELEM(NULL, matarar, *matarar)) { + return false; + } /* can happen on face selection in editmode */ if (ob->actcol > ob->totcol) { @@ -1430,8 +1383,8 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3]) r_col[1] = facm * (r_col[1]) + fac * tmpg; r_col[2] = facm * (r_col[2]) + fac * tmpb; } + break; } - break; case MA_RAMP_SAT: { float rH, rS, rV; @@ -1441,8 +1394,8 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3]) rgb_to_hsv(col[0], col[1], col[2], &colH, &colS, &colV); hsv_to_rgb(rH, (facm * rS + fac * colS), rV, r_col + 0, r_col + 1, r_col + 2); } + break; } - break; case MA_RAMP_VAL: { float rH, rS, rV; @@ -1450,8 +1403,8 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3]) rgb_to_hsv(r_col[0], r_col[1], r_col[2], &rH, &rS, &rV); rgb_to_hsv(col[0], col[1], col[2], &colH, &colS, &colV); hsv_to_rgb(rH, rS, (facm * rV + fac * colV), r_col + 0, r_col + 1, r_col + 2); + break; } - break; case MA_RAMP_COLOR: { float rH, rS, rV; @@ -1465,8 +1418,8 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3]) r_col[1] = facm * (r_col[1]) + fac * tmpg; r_col[2] = facm * (r_col[2]) + fac * tmpb; } + break; } - break; case MA_RAMP_SOFT: { float scr, scg, scb; @@ -1479,8 +1432,8 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3]) r_col[0] = facm * (r_col[0]) + fac * (((1.0f - r_col[0]) * col[0] * (r_col[0])) + (r_col[0] * scr)); r_col[1] = facm * (r_col[1]) + fac * (((1.0f - r_col[1]) * col[1] * (r_col[1])) + (r_col[1] * scg)); r_col[2] = facm * (r_col[2]) + fac * (((1.0f - r_col[2]) * col[2] * (r_col[2])) + (r_col[2] * scb)); + break; } - break; case MA_RAMP_LINEAR: if (col[0] > 0.5f) r_col[0] = r_col[0] + fac * (2.0f * (col[0] - 0.5f)); @@ -2051,8 +2004,10 @@ int do_version_tface(Main *main, int fileload) printf("Warning: material \"%s\" skipped - to convert old game texface to material go to the Help menu.\n", ma->id.name + 2); nowarning = 0; } - else - convert_tfacematerial(main, ma); continue; + else { + convert_tfacematerial(main, ma); + } + continue; } /* no conflicts in this material - 90% of cases diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 31212c3a6b7..173b193b752 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -485,14 +485,15 @@ void BKE_mball_properties_copy(Scene *scene, Object *active_object) MetaBall *active_mball = (MetaBall *)active_object->data; int basisnr, obnr; char basisname[MAX_ID_NAME], obname[MAX_ID_NAME]; - + SceneBaseIter iter; + BLI_split_name_num(basisname, &basisnr, active_object->id.name + 2, '.'); /* XXX recursion check, see scene.c, just too simple code this BKE_scene_base_iter_next() */ - if (F_ERROR == BKE_scene_base_iter_next(&sce_iter, 0, NULL, NULL)) + if (F_ERROR == BKE_scene_base_iter_next(&iter, &sce_iter, 0, NULL, NULL)) return; - while (BKE_scene_base_iter_next(&sce_iter, 1, &base, &ob)) { + while (BKE_scene_base_iter_next(&iter, &sce_iter, 1, &base, &ob)) { if (ob->type == OB_MBALL) { if (ob != active_object) { BLI_split_name_num(obname, &obnr, ob->id.name + 2, '.'); @@ -529,14 +530,15 @@ Object *BKE_mball_basis_find(Scene *scene, Object *basis) Object *ob, *bob = basis; int basisnr, obnr; char basisname[MAX_ID_NAME], obname[MAX_ID_NAME]; + SceneBaseIter iter; BLI_split_name_num(basisname, &basisnr, basis->id.name + 2, '.'); /* XXX recursion check, see scene.c, just too simple code this BKE_scene_base_iter_next() */ - if (F_ERROR == BKE_scene_base_iter_next(&sce_iter, 0, NULL, NULL)) + if (F_ERROR == BKE_scene_base_iter_next(&iter, &sce_iter, 0, NULL, NULL)) return NULL; - while (BKE_scene_base_iter_next(&sce_iter, 1, &base, &ob)) { + while (BKE_scene_base_iter_next(&iter, &sce_iter, 1, &base, &ob)) { if (ob->type == OB_MBALL) { if (ob != bob) { BLI_split_name_num(obname, &obnr, ob->id.name + 2, '.'); @@ -1644,6 +1646,14 @@ BLI_INLINE void copy_v3_fl3(float v[3], float x, float y, float z) v[2] = z; } +/* TODO(sergey): Perhaps it could be general utility function in mathutils. */ +static bool has_zero_axis_m4(float matrix[4][4]) +{ + return len_squared_v3(matrix[0]) < FLT_EPSILON || + len_squared_v3(matrix[1]) < FLT_EPSILON || + len_squared_v3(matrix[2]) < FLT_EPSILON; +} + static float init_meta(PROCESS *process, Scene *scene, Object *ob) /* return totsize */ { Scene *sce_iter = scene; @@ -1655,7 +1665,8 @@ static float init_meta(PROCESS *process, Scene *scene, Object *ob) /* return //float max = 0.0f; int a, obnr, zero_size = 0; char obname[MAX_ID_NAME]; - + SceneBaseIter iter; + copy_m4_m4(obmat, ob->obmat); /* to cope with duplicators from BKE_scene_base_iter_next */ invert_m4_m4(obinv, ob->obmat); a = 0; @@ -1663,8 +1674,8 @@ static float init_meta(PROCESS *process, Scene *scene, Object *ob) /* return BLI_split_name_num(obname, &obnr, ob->id.name + 2, '.'); /* make main array */ - BKE_scene_base_iter_next(&sce_iter, 0, NULL, NULL); - while (BKE_scene_base_iter_next(&sce_iter, 1, &base, &bob)) { + BKE_scene_base_iter_next(&iter, &sce_iter, 0, NULL, NULL); + while (BKE_scene_base_iter_next(&iter, &sce_iter, 1, &base, &bob)) { if (bob->type == OB_MBALL) { zero_size = 0; @@ -1691,13 +1702,13 @@ static float init_meta(PROCESS *process, Scene *scene, Object *ob) /* return /* when metaball object has zero scale, then MetaElem to this MetaBall * will not be put to mainb array */ - if (bob->size[0] == 0.0f || bob->size[1] == 0.0f || bob->size[2] == 0.0f) { + if (has_zero_axis_m4(bob->obmat)) { zero_size = 1; } else if (bob->parent) { struct Object *pob = bob->parent; while (pob) { - if (pob->size[0] == 0.0f || pob->size[1] == 0.0f || pob->size[2] == 0.0f) { + if (has_zero_axis_m4(pob->obmat)) { zero_size = 1; break; } @@ -2225,15 +2236,16 @@ static void mball_count(PROCESS *process, Scene *scene, Object *basis) MetaElem *ml = NULL; int basisnr, obnr; char basisname[MAX_ID_NAME], obname[MAX_ID_NAME]; + SceneBaseIter iter; BLI_split_name_num(basisname, &basisnr, basis->id.name + 2, '.'); process->totelem = 0; /* XXX recursion check, see scene.c, just too simple code this BKE_scene_base_iter_next() */ - if (F_ERROR == BKE_scene_base_iter_next(&sce_iter, 0, NULL, NULL)) + if (F_ERROR == BKE_scene_base_iter_next(&iter, &sce_iter, 0, NULL, NULL)) return; - while (BKE_scene_base_iter_next(&sce_iter, 1, &base, &ob)) { + while (BKE_scene_base_iter_next(&iter, &sce_iter, 1, &base, &ob)) { if (ob->type == OB_MBALL) { if (ob == bob) { MetaBall *mb = ob->data; @@ -2434,6 +2446,7 @@ bool BKE_mball_center_median(MetaBall *mb, float r_cent[3]) for (ml = mb->elems.first; ml; ml = ml->next) { add_v3_v3(r_cent, &ml->x); + total++; } if (total) { diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index b40c3475df5..095957b40d5 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -51,6 +51,7 @@ #include "BLI_bitmap.h" #include "BLI_scanfill.h" #include "BLI_array.h" +#include "BLI_alloca.h" #include "BKE_animsys.h" #include "BKE_main.h" @@ -702,6 +703,19 @@ void BKE_mesh_texspace_get(Mesh *me, float r_loc[3], float r_rot[3], float r_siz if (r_size) copy_v3_v3(r_size, me->size); } +void BKE_mesh_texspace_copy_from_object(Mesh *me, Object *ob) +{ + float *texloc, *texrot, *texsize; + short *texflag; + + if (BKE_object_obdata_texspace_get(ob, &texflag, &texloc, &texsize, &texrot)) { + me->texflag = *texflag; + copy_v3_v3(me->loc, texloc); + copy_v3_v3(me->size, texsize); + copy_v3_v3(me->rot, texrot); + } +} + float (*BKE_mesh_orco_verts_get(Object *ob))[3] { Mesh *me = ob->data; @@ -2176,10 +2190,13 @@ static void bm_corners_to_loops_ex(ID *id, CustomData *fdata, CustomData *ldata, if (ld->disps) MEM_freeN(ld->disps); - ld->disps = MEM_callocN(sizeof(float) * 3 * side * side, "converted loop mdisps"); + ld->disps = MEM_mallocN(sizeof(float) * 3 * side * side, "converted loop mdisps"); if (fd->disps) { memcpy(ld->disps, disps, sizeof(float) * 3 * side * side); } + else { + memset(ld->disps, 0, sizeof(float) * 3 * side * side); + } } } } @@ -2450,10 +2467,11 @@ void BKE_mesh_vert_poly_map_create(MeshElemMap **r_map, int **r_mem, int totvert, int totpoly, int totloop) { MeshElemMap *map = MEM_callocN(sizeof(MeshElemMap) * totvert, "vert poly map"); - int *indices = MEM_mallocN(sizeof(int) * totloop, "vert poly map mem"); - + int *indices, *index_iter; int i, j; + indices = index_iter = MEM_mallocN(sizeof(int) * totloop, "vert poly map mem"); + /* Count number of polys for each vertex */ for (i = 0; i < totpoly; i++) { const MPoly *p = &mpoly[i]; @@ -2464,8 +2482,8 @@ void BKE_mesh_vert_poly_map_create(MeshElemMap **r_map, int **r_mem, /* Assign indices mem */ for (i = 0; i < totvert; i++) { - map[i].indices = indices; - indices += map[i].count; + map[i].indices = index_iter; + index_iter += map[i].count; /* Reset 'count' for use as index in last loop */ map[i].count = 0; @@ -2495,6 +2513,7 @@ void BKE_mesh_vert_edge_map_create(MeshElemMap **r_map, int **r_mem, { MeshElemMap *map = MEM_callocN(sizeof(MeshElemMap) * totvert, "vert-edge map"); int *indices = MEM_mallocN(sizeof(int) * totedge * 2, "vert-edge map mem"); + int *i_pt = indices; int i; @@ -2506,8 +2525,8 @@ void BKE_mesh_vert_edge_map_create(MeshElemMap **r_map, int **r_mem, /* Assign indices mem */ for (i = 0; i < totvert; i++) { - map[i].indices = indices; - indices += map[i].count; + map[i].indices = i_pt; + i_pt += map[i].count; /* Reset 'count' for use as index in last loop */ map[i].count = 0; diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index 878651cdb39..2eced15a147 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -294,7 +294,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh, # define CHECK_FACE_EDGE(a, b) \ if (!BLI_edgehash_haskey(edge_hash, mf->a, mf->b)) { \ PRINT(" face %u: edge " STRINGIFY(a) "/" STRINGIFY(b) \ - " (%u,%u) is missing egde data\n", i, mf->a, mf->b); \ + " (%u,%u) is missing edge data\n", i, mf->a, mf->b); \ do_edge_recalc = TRUE; \ } (void)0 diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index a0fa3317297..41e0acf9f7a 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -421,7 +421,7 @@ ModifierData *modifiers_getLastPreview(struct Scene *scene, ModifierData *md, in { ModifierData *tmp_md = NULL; - if (required_mode != eModifierMode_Realtime) + if ((required_mode & ~eModifierMode_Editmode) != eModifierMode_Realtime) return tmp_md; /* Find the latest modifier in stack generating preview. */ diff --git a/source/blender/blenkernel/intern/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c index b7257028316..290b0684e40 100644 --- a/source/blender/blenkernel/intern/modifiers_bmesh.c +++ b/source/blender/blenkernel/intern/modifiers_bmesh.c @@ -28,16 +28,15 @@ * \ingroup bke */ -#include "BLI_math.h" - #include "MEM_guardedalloc.h" +#include "BLI_math.h" +#include "BLI_alloca.h" + #include "DNA_object_types.h" -#include "BLI_array.h" #include "BKE_DerivedMesh.h" -#include "BKE_bmesh.h" #include "BKE_editmesh.h" /* Static function for alloc */ diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index d062f302379..e8550e12e4f 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -440,7 +440,7 @@ static void *moviecache_getprioritydata(void *key_v) MovieClipImBufCacheKey *key = (MovieClipImBufCacheKey *) key_v; MovieClipCachePriorityData *priority_data; - priority_data = MEM_callocN(sizeof(priority_data), "movie cache clip priority data"); + priority_data = MEM_callocN(sizeof(*priority_data), "movie cache clip priority data"); priority_data->framenr = key->framenr; return priority_data; @@ -1395,8 +1395,6 @@ void BKE_movieclip_build_proxy_frame_for_ibuf(MovieClip *clip, ImBuf *ibuf, stru void BKE_movieclip_free(MovieClip *clip) { - BKE_sequencer_clear_movieclip_in_clipboard(clip); - free_buffers(clip); BKE_tracking_free(&clip->tracking); diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index cba4c9206c9..95bf56d00f2 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -105,15 +105,15 @@ void multires_customdata_delete(Mesh *me) } /** Grid hiding **/ -static BLI_bitmap multires_mdisps_upsample_hidden(BLI_bitmap lo_hidden, - int lo_level, - int hi_level, +static BLI_bitmap *multires_mdisps_upsample_hidden(BLI_bitmap *lo_hidden, + int lo_level, + int hi_level, - /* assumed to be at hi_level (or - * null) */ - BLI_bitmap prev_hidden) + /* assumed to be at hi_level (or + * null) */ + BLI_bitmap *prev_hidden) { - BLI_bitmap subd; + BLI_bitmap *subd; int hi_gridsize = ccg_gridsize(hi_level); int lo_gridsize = ccg_gridsize(lo_level); int yh, xh, xl, yl, xo, yo, hi_ndx; @@ -168,11 +168,11 @@ static BLI_bitmap multires_mdisps_upsample_hidden(BLI_bitmap lo_hidden, return subd; } -static BLI_bitmap multires_mdisps_downsample_hidden(BLI_bitmap old_hidden, - int old_level, - int new_level) +static BLI_bitmap *multires_mdisps_downsample_hidden(BLI_bitmap *old_hidden, + int old_level, + int new_level) { - BLI_bitmap new_hidden; + BLI_bitmap *new_hidden; int new_gridsize = ccg_gridsize(new_level); int old_gridsize = ccg_gridsize(old_level); int x, y, factor, old_value; @@ -200,7 +200,7 @@ static void multires_output_hidden_to_ccgdm(CCGDerivedMesh *ccgdm, Mesh *me, int level) { const MDisps *mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS); - BLI_bitmap *grid_hidden = ccgdm->gridHidden; + BLI_bitmap **grid_hidden = ccgdm->gridHidden; int *gridOffset; int i, j; @@ -210,7 +210,7 @@ static void multires_output_hidden_to_ccgdm(CCGDerivedMesh *ccgdm, for (j = 0; j < me->mpoly[i].totloop; j++) { int g = gridOffset[i] + j; const MDisps *md = &mdisps[g]; - BLI_bitmap gh = md->hidden; + BLI_bitmap *gh = md->hidden; if (gh) { grid_hidden[g] = @@ -224,7 +224,7 @@ static void multires_output_hidden_to_ccgdm(CCGDerivedMesh *ccgdm, * the current level of md.hidden) */ static void multires_mdisps_subdivide_hidden(MDisps *md, int new_level) { - BLI_bitmap subd; + BLI_bitmap *subd; BLI_assert(md->hidden); @@ -647,7 +647,7 @@ static void multires_del_higher(MultiresModifierData *mmd, Object *ob, int lvl) multires_copy_grid(ndisps, hdisps, nsize, hsize); if (mdisp->hidden) { - BLI_bitmap gh = + BLI_bitmap *gh = multires_mdisps_downsample_hidden(mdisp->hidden, mdisp->level, lvl); @@ -1251,7 +1251,7 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm) void multires_modifier_update_hidden(DerivedMesh *dm) { CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm; - BLI_bitmap *grid_hidden = ccgdm->gridHidden; + BLI_bitmap **grid_hidden = ccgdm->gridHidden; Mesh *me = ccgdm->multires.ob->data; MDisps *mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS); int totlvl = ccgdm->multires.totlvl; @@ -1262,7 +1262,7 @@ void multires_modifier_update_hidden(DerivedMesh *dm) for (i = 0; i < me->totloop; i++) { MDisps *md = &mdisps[i]; - BLI_bitmap gh = grid_hidden[i]; + BLI_bitmap *gh = grid_hidden[i]; if (!gh && md->hidden) { MEM_freeN(md->hidden); diff --git a/source/blender/blenkernel/intern/navmesh_conversion.c b/source/blender/blenkernel/intern/navmesh_conversion.c index 1d662ae3116..75e6ce9837d 100644 --- a/source/blender/blenkernel/intern/navmesh_conversion.c +++ b/source/blender/blenkernel/intern/navmesh_conversion.c @@ -440,6 +440,9 @@ int buildNavMeshDataByDerivedMesh(DerivedMesh *dm, int *vertsPerPoly, int ntris = 0, *recastData = NULL; unsigned short *tris = NULL; + /* Don't bother converting if there is nothing to convert */ + if (!*nverts) return 0; + res = buildRawVertIndicesData(dm, nverts, verts, &ntris, &tris, trisToFacesMap, &recastData); if (!res) { printf("Converting navmesh: Error! Can't get vertices and indices from mesh\n"); diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 929d741282e..5001aa01653 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -349,9 +349,6 @@ static void free_dynamic_typeinfo(bNodeType *ntype) if (ntype->outputs) { MEM_freeN(ntype->outputs); } - if (ntype->ui_name) { - MEM_freeN((void *)ntype->ui_name); - } } } @@ -528,60 +525,60 @@ bNodeSocket *nodeInsertSocket(bNodeTree *ntree, bNode *node, int in_out, const c const char *nodeStaticSocketType(int type, int subtype) { switch (type) { - case SOCK_FLOAT: - switch (subtype) { - case PROP_UNSIGNED: - return "NodeSocketFloatUnsigned"; - case PROP_PERCENTAGE: - return "NodeSocketFloatPercentage"; - case PROP_FACTOR: - return "NodeSocketFloatFactor"; - case PROP_ANGLE: - return "NodeSocketFloatAngle"; - case PROP_TIME: - return "NodeSocketFloatTime"; - case PROP_NONE: - default: - return "NodeSocketFloat"; - } - case SOCK_INT: - switch (subtype) { - case PROP_UNSIGNED: - return "NodeSocketIntUnsigned"; - case PROP_PERCENTAGE: - return "NodeSocketIntPercentage"; - case PROP_FACTOR: - return "NodeSocketIntFactor"; - case PROP_NONE: - default: - return "NodeSocketInt"; - } - case SOCK_BOOLEAN: - return "NodeSocketBool"; - case SOCK_VECTOR: - switch (subtype) { - case PROP_TRANSLATION: - return "NodeSocketVectorTranslation"; - case PROP_DIRECTION: - return "NodeSocketVectorDirection"; - case PROP_VELOCITY: - return "NodeSocketVectorVelocity"; - case PROP_ACCELERATION: - return "NodeSocketVectorAcceleration"; - case PROP_EULER: - return "NodeSocketVectorEuler"; - case PROP_XYZ: - return "NodeSocketVectorXYZ"; - case PROP_NONE: - default: - return "NodeSocketVector"; - } - case SOCK_RGBA: - return "NodeSocketColor"; - case SOCK_STRING: - return "NodeSocketString"; - case SOCK_SHADER: - return "NodeSocketShader"; + case SOCK_FLOAT: + switch (subtype) { + case PROP_UNSIGNED: + return "NodeSocketFloatUnsigned"; + case PROP_PERCENTAGE: + return "NodeSocketFloatPercentage"; + case PROP_FACTOR: + return "NodeSocketFloatFactor"; + case PROP_ANGLE: + return "NodeSocketFloatAngle"; + case PROP_TIME: + return "NodeSocketFloatTime"; + case PROP_NONE: + default: + return "NodeSocketFloat"; + } + case SOCK_INT: + switch (subtype) { + case PROP_UNSIGNED: + return "NodeSocketIntUnsigned"; + case PROP_PERCENTAGE: + return "NodeSocketIntPercentage"; + case PROP_FACTOR: + return "NodeSocketIntFactor"; + case PROP_NONE: + default: + return "NodeSocketInt"; + } + case SOCK_BOOLEAN: + return "NodeSocketBool"; + case SOCK_VECTOR: + switch (subtype) { + case PROP_TRANSLATION: + return "NodeSocketVectorTranslation"; + case PROP_DIRECTION: + return "NodeSocketVectorDirection"; + case PROP_VELOCITY: + return "NodeSocketVectorVelocity"; + case PROP_ACCELERATION: + return "NodeSocketVectorAcceleration"; + case PROP_EULER: + return "NodeSocketVectorEuler"; + case PROP_XYZ: + return "NodeSocketVectorXYZ"; + case PROP_NONE: + default: + return "NodeSocketVector"; + } + case SOCK_RGBA: + return "NodeSocketColor"; + case SOCK_STRING: + return "NodeSocketString"; + case SOCK_SHADER: + return "NodeSocketShader"; } return NULL; } @@ -589,60 +586,60 @@ const char *nodeStaticSocketType(int type, int subtype) const char *nodeStaticSocketInterfaceType(int type, int subtype) { switch (type) { - case SOCK_FLOAT: - switch (subtype) { - case PROP_UNSIGNED: - return "NodeSocketInterfaceFloatUnsigned"; - case PROP_PERCENTAGE: - return "NodeSocketInterfaceFloatPercentage"; - case PROP_FACTOR: - return "NodeSocketInterfaceFloatFactor"; - case PROP_ANGLE: - return "NodeSocketInterfaceFloatAngle"; - case PROP_TIME: - return "NodeSocketInterfaceFloatTime"; - case PROP_NONE: - default: - return "NodeSocketInterfaceFloat"; - } - case SOCK_INT: - switch (subtype) { - case PROP_UNSIGNED: - return "NodeSocketInterfaceIntUnsigned"; - case PROP_PERCENTAGE: - return "NodeSocketInterfaceIntPercentage"; - case PROP_FACTOR: - return "NodeSocketInterfaceIntFactor"; - case PROP_NONE: - default: - return "NodeSocketInterfaceInt"; - } - case SOCK_BOOLEAN: - return "NodeSocketInterfaceBool"; - case SOCK_VECTOR: - switch (subtype) { - case PROP_TRANSLATION: - return "NodeSocketInterfaceVectorTranslation"; - case PROP_DIRECTION: - return "NodeSocketInterfaceVectorDirection"; - case PROP_VELOCITY: - return "NodeSocketInterfaceVectorVelocity"; - case PROP_ACCELERATION: - return "NodeSocketInterfaceVectorAcceleration"; - case PROP_EULER: - return "NodeSocketInterfaceVectorEuler"; - case PROP_XYZ: - return "NodeSocketInterfaceVectorXYZ"; - case PROP_NONE: - default: - return "NodeSocketInterfaceVector"; - } - case SOCK_RGBA: - return "NodeSocketInterfaceColor"; - case SOCK_STRING: - return "NodeSocketInterfaceString"; - case SOCK_SHADER: - return "NodeSocketInterfaceShader"; + case SOCK_FLOAT: + switch (subtype) { + case PROP_UNSIGNED: + return "NodeSocketInterfaceFloatUnsigned"; + case PROP_PERCENTAGE: + return "NodeSocketInterfaceFloatPercentage"; + case PROP_FACTOR: + return "NodeSocketInterfaceFloatFactor"; + case PROP_ANGLE: + return "NodeSocketInterfaceFloatAngle"; + case PROP_TIME: + return "NodeSocketInterfaceFloatTime"; + case PROP_NONE: + default: + return "NodeSocketInterfaceFloat"; + } + case SOCK_INT: + switch (subtype) { + case PROP_UNSIGNED: + return "NodeSocketInterfaceIntUnsigned"; + case PROP_PERCENTAGE: + return "NodeSocketInterfaceIntPercentage"; + case PROP_FACTOR: + return "NodeSocketInterfaceIntFactor"; + case PROP_NONE: + default: + return "NodeSocketInterfaceInt"; + } + case SOCK_BOOLEAN: + return "NodeSocketInterfaceBool"; + case SOCK_VECTOR: + switch (subtype) { + case PROP_TRANSLATION: + return "NodeSocketInterfaceVectorTranslation"; + case PROP_DIRECTION: + return "NodeSocketInterfaceVectorDirection"; + case PROP_VELOCITY: + return "NodeSocketInterfaceVectorVelocity"; + case PROP_ACCELERATION: + return "NodeSocketInterfaceVectorAcceleration"; + case PROP_EULER: + return "NodeSocketInterfaceVectorEuler"; + case PROP_XYZ: + return "NodeSocketInterfaceVectorXYZ"; + case PROP_NONE: + default: + return "NodeSocketInterfaceVector"; + } + case SOCK_RGBA: + return "NodeSocketInterfaceColor"; + case SOCK_STRING: + return "NodeSocketInterfaceString"; + case SOCK_SHADER: + return "NodeSocketInterfaceShader"; } return NULL; } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index f1183868e8b..8ac067c0316 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -121,9 +121,6 @@ #include "GPU_material.h" -/* Local function protos */ -float originmat[3][3]; /* after BKE_object_where_is_calc(), can be used in other functions (bad!) */ - void BKE_object_workob_clear(Object *workob) { memset(workob, 0, sizeof(Object)); @@ -696,6 +693,14 @@ void BKE_object_unlink(Object *ob) sbuts->pinid = NULL; } } + else if (sl->spacetype == SPACE_NODE) { + SpaceNode *snode = (SpaceNode *)sl; + + if (snode->from == (ID *)ob) { + snode->flag &= ~SNODE_PIN; + snode->from = NULL; + } + } } sa = sa->next; @@ -1592,13 +1597,15 @@ void BKE_object_mat3_to_rot(Object *ob, float mat[3][3], bool use_compat) normalize_qt_qt(dquat, ob->dquat); invert_qt(dquat); mul_qt_qtqt(ob->quat, dquat, ob->quat); + break; } - break; case ROT_MODE_AXISANGLE: + { mat3_to_axis_angle(ob->rotAxis, &ob->rotAngle, mat); sub_v3_v3(ob->rotAxis, ob->drotAxis); ob->rotAngle -= ob->drotAngle; break; + } default: /* euler */ { float quat[4]; @@ -1615,6 +1622,7 @@ void BKE_object_mat3_to_rot(Object *ob, float mat[3][3], bool use_compat) if (use_compat) mat3_to_compatible_eulO(ob->rot, ob->rot, ob->rotmode, tmat); else mat3_to_eulO(ob->rot, ob->rotmode, tmat); + break; } } } @@ -1739,6 +1747,18 @@ void BKE_object_to_mat4(Object *ob, float mat[4][4]) add_v3_v3v3(mat[3], ob->loc, ob->dloc); } +void BKE_object_matrix_local_get(struct Object *ob, float mat[4][4]) +{ + if (ob->parent) { + float invmat[4][4]; /* for inverse of parent's matrix */ + invert_m4_m4(invmat, ob->parent->obmat); + mul_m4_m4m4(mat, invmat, ob->obmat); + } + else { + copy_m4_m4(mat, ob->obmat); + } +} + /* extern */ int enable_cu_speed = 1; @@ -1991,7 +2011,11 @@ static void ob_parvert3(Object *ob, Object *par, float mat[4][4]) } } -static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[4][4], float slowmat[4][4], int simul) +/** + * \param r_originmat Optional matrix that stores the space the object is in (without its own matrix applied) + */ +static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[4][4], float slowmat[4][4], + float r_originmat[3][3], const bool simul) { float totmat[4][4]; float tmat[4][4]; @@ -2056,8 +2080,10 @@ static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[4 } else { - /* external usable originmat */ - copy_m3_m4(originmat, tmat); + if (r_originmat) { + /* usable originmat */ + copy_m3_m4(r_originmat, tmat); + } /* origin, for help line */ if ((ob->partype & PARTYPE) == PARSKEL) { @@ -2091,7 +2117,7 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[ /* note, scene is the active scene while actual_scene is the scene the object resides in */ void BKE_object_where_is_calc_time_ex(Scene *scene, Object *ob, float ctime, - RigidBodyWorld *rbw) + RigidBodyWorld *rbw, float r_originmat[3][3]) { if (ob == NULL) return; @@ -2103,7 +2129,7 @@ void BKE_object_where_is_calc_time_ex(Scene *scene, Object *ob, float ctime, float slowmat[4][4] = MAT4_UNITY; /* calculate parent matrix */ - solve_parenting(scene, ob, par, ob->obmat, slowmat, 0); + solve_parenting(scene, ob, par, ob->obmat, slowmat, r_originmat, false); /* "slow parent" is definitely not threadsafe, and may also give bad results jumping around * An old-fashioned hack which probably doesn't really cut it anymore @@ -2138,7 +2164,7 @@ void BKE_object_where_is_calc_time_ex(Scene *scene, Object *ob, float ctime, void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime) { - BKE_object_where_is_calc_time_ex(scene, ob, ctime, NULL); + BKE_object_where_is_calc_time_ex(scene, ob, ctime, NULL, NULL); } /* get object transformation matrix without recalculating dependencies and @@ -2152,7 +2178,7 @@ void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4]) if (ob->parent) { Object *par = ob->parent; - solve_parenting(scene, ob, par, obmat, slowmat, 1); + solve_parenting(scene, ob, par, obmat, slowmat, NULL, true); if (ob->partype & PARSLOW) where_is_object_parslow(ob, obmat, slowmat); @@ -2162,13 +2188,13 @@ void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4]) } } -void BKE_object_where_is_calc_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob) +void BKE_object_where_is_calc_ex(Scene *scene, RigidBodyWorld *rbw, Object *ob, float r_originmat[3][3]) { - BKE_object_where_is_calc_time_ex(scene, ob, BKE_scene_frame_get(scene), rbw); + BKE_object_where_is_calc_time_ex(scene, ob, BKE_scene_frame_get(scene), rbw, r_originmat); } void BKE_object_where_is_calc(Scene *scene, Object *ob) { - BKE_object_where_is_calc_time_ex(scene, ob, BKE_scene_frame_get(scene), NULL); + BKE_object_where_is_calc_time_ex(scene, ob, BKE_scene_frame_get(scene), NULL, NULL); } /* was written for the old game engine (until 2.04) */ @@ -2186,7 +2212,7 @@ void BKE_object_where_is_calc_simul(Scene *scene, Object *ob) if (ob->parent) { par = ob->parent; - solve_parenting(scene, ob, par, ob->obmat, slowmat, 1); + solve_parenting(scene, ob, par, ob->obmat, slowmat, NULL, true); if (ob->partype & PARSLOW) { fac1 = (float)(1.0 / (1.0 + fabs(ob->sf))); @@ -2342,8 +2368,9 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us /* Use the object bounding box so that modifier output * gets taken into account */ - if (ob->bb) + if (ob->bb) { bb = *(ob->bb); + } else { if (cu->bb == NULL) BKE_curve_texspace_calc(cu); @@ -2355,8 +2382,8 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us minmax_v3v3_v3(min_r, max_r, bb.vec[a]); } change = TRUE; + break; } - break; case OB_LATTICE: { Lattice *lt = ob->data; @@ -2372,9 +2399,10 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us } } change = TRUE; + break; } - break; case OB_ARMATURE: + { if (ob->pose) { bArmature *arm = ob->data; bPoseChannel *pchan; @@ -2393,6 +2421,7 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us } } break; + } case OB_MESH: { Mesh *me = BKE_mesh_from_object(ob); @@ -2406,8 +2435,8 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us } change = TRUE; } + break; } - break; case OB_MBALL: { float ob_min[3], ob_max[3]; @@ -2658,7 +2687,7 @@ void BKE_object_handle_update_ex(Scene *scene, Object *ob, copy_m4_m4(ob->obmat, ob->proxy_from->obmat); } else - BKE_object_where_is_calc_ex(scene, rbw, ob); + BKE_object_where_is_calc_ex(scene, rbw, ob, NULL); } if (ob->recalc & OB_RECALC_DATA) { @@ -2706,10 +2735,8 @@ void BKE_object_handle_update_ex(Scene *scene, Object *ob, makeDerivedMesh(scene, ob, NULL, data_mask, 0); } #endif - + break; } - break; - case OB_ARMATURE: if (ob->id.lib && ob->proxy_from) { if (BKE_pose_copy_result(ob->pose, ob->proxy_from->pose) == false) { diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index f97429d7e65..11d58c945fd 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -85,6 +85,7 @@ int seekPackedFile(PackedFile *pf, int offset, int whence) break; default: oldseek = -1; + break; } if (seek < 0) { seek = 0; @@ -448,7 +449,8 @@ char *unpackFile(ReportList *reports, const char *abs_name, const char *local_na temp = local_name; break; } - /* else fall through and create it */ + /* else create it */ + /* fall-through */ case PF_WRITE_LOCAL: if (writePackedFile(reports, local_name, pf, 1) == RET_OK) { temp = local_name; @@ -461,7 +463,8 @@ char *unpackFile(ReportList *reports, const char *abs_name, const char *local_na temp = abs_name; break; } - /* else fall through and create it */ + /* else create it */ + /* fall-through */ case PF_WRITE_ORIGINAL: if (writePackedFile(reports, abs_name, pf, 1) == RET_OK) { temp = abs_name; diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 0dbe4c56a09..b47a493581e 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -139,8 +139,7 @@ Paint *BKE_paint_get_active(Scene *sce) case OB_MODE_EDIT: if (ts->use_uv_sculpt) return &ts->uvsculpt->paint; - else - return &ts->imapaint.paint; + return &ts->imapaint.paint; } } @@ -187,8 +186,7 @@ Paint *BKE_paint_get_active_from_context(const bContext *C) case OB_MODE_EDIT: if (ts->use_uv_sculpt) return &ts->uvsculpt->paint; - else - return &ts->imapaint.paint; + return &ts->imapaint.paint; default: return &ts->imapaint.paint; } @@ -238,8 +236,7 @@ PaintMode BKE_paintmode_get_active_from_context(const bContext *C) case OB_MODE_EDIT: if (ts->use_uv_sculpt) return PAINT_SCULPT_UV; - else - return PAINT_TEXTURE_2D; + return PAINT_TEXTURE_2D; default: return PAINT_TEXTURE_2D; } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index f6901c7b81b..6bea4bec3ce 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3414,8 +3414,7 @@ static void psys_face_mat(Object *ob, DerivedMesh *dm, ParticleData *pa, float m OrigSpaceFace *osface; float (*orcodata)[3]; - int i = pa->num_dmcache == DMCACHE_NOTFOUND ? pa->num : pa->num_dmcache; - + int i = (ELEM(pa->num_dmcache, DMCACHE_ISCHILD, DMCACHE_NOTFOUND)) ? pa->num : pa->num_dmcache; if (i == -1 || i >= dm->getNumTessFaces(dm)) { unit_m4(mat); return; } mface = dm->getTessFaceData(dm, i, CD_MFACE); @@ -4511,7 +4510,7 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, num = DMCACHE_NOTFOUND; } - if (mtface && num != DMCACHE_NOTFOUND) { + if (mtface && !ELEM(num, DMCACHE_NOTFOUND, DMCACHE_ISCHILD)) { mface = psmd->dm->getTessFaceData(psmd->dm, num, CD_MFACE); mtface += num; psys_interpolate_uvs(mtface, mface->v4, pa->fuv, uv); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 9840852ad7e..16ea71204cc 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -1660,17 +1660,22 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P { Object *ob = sim->ob; ParticleSystem *psys = sim->psys; - ParticleSettings *part; + ParticleSettings *part = psys->part; ParticleTexture ptex; float fac, phasefac, nor[3] = {0,0,0},loc[3],vel[3] = {0.0,0.0,0.0},rot[4],q2[4]; float r_vel[3],r_ave[3],r_rot[4],vec[3],p_vel[3] = {0.0,0.0,0.0}; float x_vec[3] = {1.0,0.0,0.0}, utan[3] = {0.0,1.0,0.0}, vtan[3] = {0.0,0.0,1.0}, rot_vec[3] = {0.0,0.0,0.0}; float q_phase[4]; + + const bool use_boids = ((part->phystype == PART_PHYS_BOIDS) && + (pa->boid != NULL)); + const bool use_tangents = ((use_boids == false) && + ((part->tanfac != 0.0f) || (part->rotmode == PART_ROT_NOR_TAN))); + int p = pa - psys->particles; - part=psys->part; /* get birth location from object */ - if (part->tanfac != 0.f) + if (use_tangents) psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,utan,vtan,0,0); else psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,0,0,0,0); @@ -1688,7 +1693,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P normalize_v3(nor); /* -tangent */ - if (part->tanfac!=0.0f) { + if (use_tangents) { //float phase=vg_rot?2.0f*(psys_particle_value_from_verts(sim->psmd->dm,part->from,pa,vg_rot)-0.5f):0.0f; float phase=0.0f; mul_v3_fl(vtan,-cosf((float)M_PI*(part->tanphase+phase))); @@ -1737,7 +1742,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P mul_qt_qtqt(r_rot,r_rot,rot); } - if (part->phystype==PART_PHYS_BOIDS && pa->boid) { + if (use_boids) { float dvec[3], q[4], mat[3][3]; copy_v3_v3(state->co,loc); @@ -1823,35 +1828,112 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P unit_qt(state->rot); if (part->rotmode) { + bool use_global_space; + /* create vector into which rotation is aligned */ switch (part->rotmode) { case PART_ROT_NOR: + case PART_ROT_NOR_TAN: copy_v3_v3(rot_vec, nor); + use_global_space = false; break; case PART_ROT_VEL: copy_v3_v3(rot_vec, vel); + use_global_space = true; break; case PART_ROT_GLOB_X: case PART_ROT_GLOB_Y: case PART_ROT_GLOB_Z: rot_vec[part->rotmode - PART_ROT_GLOB_X] = 1.0f; + use_global_space = true; break; case PART_ROT_OB_X: case PART_ROT_OB_Y: case PART_ROT_OB_Z: copy_v3_v3(rot_vec, ob->obmat[part->rotmode - PART_ROT_OB_X]); + use_global_space = false; + break; + default: + use_global_space = true; break; } /* create rotation quat */ - negate_v3(rot_vec); - vec_to_quat( q2,rot_vec, OB_POSX, OB_POSZ); - /* randomize rotation quat */ - if (part->randrotfac!=0.0f) - interp_qt_qtqt(rot, q2, r_rot, part->randrotfac); - else - copy_qt_qt(rot,q2); + + if (use_global_space) { + negate_v3(rot_vec); + vec_to_quat(q2, rot_vec, OB_POSX, OB_POSZ); + + /* randomize rotation quat */ + if (part->randrotfac != 0.0f) { + interp_qt_qtqt(rot, q2, r_rot, part->randrotfac); + } + else { + copy_qt_qt(rot, q2); + } + } + else { + /* calculate rotation in local-space */ + float q_obmat[4]; + float q_imat[4]; + + mat4_to_quat(q_obmat, ob->obmat); + invert_qt_qt(q_imat, q_obmat); + + + if (part->rotmode != PART_ROT_NOR_TAN) { + float rot_vec_local[3]; + + /* rot_vec */ + negate_v3(rot_vec); + copy_v3_v3(rot_vec_local, rot_vec); + mul_qt_v3(q_imat, rot_vec_local); + normalize_v3(rot_vec_local); + + vec_to_quat(q2, rot_vec_local, OB_POSX, OB_POSZ); + } + else { + /* (part->rotmode == PART_ROT_NOR_TAN) */ + float tmat[3][3]; + + /* note: utan_local is not taken from 'utan', we calculate from rot_vec/vtan */ + /* note: it looks like rotation phase may be applied twice (once with vtan, again below) + * however this isn't the case - campbell */ + float *rot_vec_local = tmat[0]; + float *vtan_local = tmat[1]; + float *utan_local = tmat[2]; + + /* use tangents */ + BLI_assert(use_tangents == true); + + /* rot_vec */ + copy_v3_v3(rot_vec_local, rot_vec); + mul_qt_v3(q_imat, rot_vec_local); + + /* vtan_local */ + copy_v3_v3(vtan_local, vtan); /* flips, cant use */ + mul_qt_v3(q_imat, vtan_local); + + /* ensure orthogonal matrix (rot_vec aligned) */ + cross_v3_v3v3(utan_local, vtan_local, rot_vec_local); + cross_v3_v3v3(vtan_local, utan_local, rot_vec_local); + + /* note: no need to normalize */ + mat3_to_quat(q2, tmat); + } + + /* randomize rotation quat */ + if (part->randrotfac != 0.0f) { + mul_qt_qtqt(r_rot, r_rot, q_imat); + interp_qt_qtqt(rot, q2, r_rot, part->randrotfac); + } + else { + copy_qt_qt(rot, q2); + } + + mul_qt_qtqt(rot, q_obmat, rot); + } /* rotation phase */ phasefac = part->phasefac; @@ -4313,7 +4395,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) /* SPH_SOLVER_CLASSICAL */ /* Apply SPH forces using classical algorithm (due to Gingold * and Monaghan). Note that, unlike double-density relaxation, - * this algorthim is separated into distinct loops. */ + * this algorithm is separated into distinct loops. */ #pragma omp parallel for firstprivate (sphdata) private (pa) schedule(dynamic,5) LOOP_DYNAMIC_PARTICLES { diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 99e6e898685..a0cc37dcf3f 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -538,7 +538,7 @@ void BKE_pbvh_build_mesh(PBVH *bvh, MFace *faces, MVert *verts, int totface, int /* Do a full rebuild with on Grids data structure */ void BKE_pbvh_build_grids(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj, - int totgrid, CCGKey *key, void **gridfaces, DMFlagMat *flagmats, BLI_bitmap *grid_hidden) + int totgrid, CCGKey *key, void **gridfaces, DMFlagMat *flagmats, BLI_bitmap **grid_hidden) { BBC *prim_bbc = NULL; BB cb; @@ -1253,7 +1253,7 @@ void BKE_pbvh_bounding_box(const PBVH *bvh, float min[3], float max[3]) } } -BLI_bitmap *BKE_pbvh_grid_hidden(const PBVH *bvh) +BLI_bitmap **BKE_pbvh_grid_hidden(const PBVH *bvh) { BLI_assert(bvh->type == PBVH_GRIDS); return bvh->grid_hidden; @@ -1469,7 +1469,7 @@ static int pbvh_grids_node_raycast(PBVH *bvh, PBVHNode *node, for (i = 0; i < totgrid; ++i) { CCGElem *grid = bvh->grids[node->prim_indices[i]]; - BLI_bitmap gh; + BLI_bitmap *gh; if (!grid) continue; @@ -1664,7 +1664,7 @@ void BKE_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3], } void BKE_pbvh_grids_update(PBVH *bvh, CCGElem **grids, DMGridAdjacency *gridadj, void **gridfaces, - DMFlagMat *flagmats, BLI_bitmap *grid_hidden) + DMFlagMat *flagmats, BLI_bitmap **grid_hidden) { int a; diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index c6a5552dbf7..cd21f8ad968 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -294,7 +294,7 @@ static BMVert *pbvh_bmesh_vert_create(PBVH *bvh, int node_index, static BMFace *pbvh_bmesh_face_create(PBVH *bvh, int node_index, BMVert *v_tri[3], BMEdge *e_tri[3], - const BMFace *UNUSED(example)) + const BMFace *f_example) { BMFace *f; void *val = SET_INT_IN_POINTER(node_index); @@ -302,9 +302,10 @@ static BMFace *pbvh_bmesh_face_create(PBVH *bvh, int node_index, /* ensure we never add existing face */ BLI_assert(BM_face_exists(v_tri, 3, NULL) == false); - /* Note: passing NULL for the 'example' parameter, profiling shows - * a small performance bump */ f = BM_face_create(bvh->bm, v_tri, e_tri, 3, 0); + // BM_elem_attrs_copy(bvh->bm, bvh->bm, f_example, f); + f->mat_nr = f_example->mat_nr; + if (!BLI_ghash_haskey(bvh->bm_face_to_node, f)) { BLI_ghash_insert(bvh->nodes[node_index].bm_faces, f, NULL); diff --git a/source/blender/blenkernel/intern/pbvh_intern.h b/source/blender/blenkernel/intern/pbvh_intern.h index b3f7bf6e3d1..4154b8e4799 100644 --- a/source/blender/blenkernel/intern/pbvh_intern.h +++ b/source/blender/blenkernel/intern/pbvh_intern.h @@ -139,11 +139,11 @@ struct PBVH { void **gridfaces; const DMFlagMat *grid_flag_mats; int totgrid; - BLI_bitmap *grid_hidden; + BLI_bitmap **grid_hidden; /* Only used during BVH build and update, * don't need to remain valid after */ - BLI_bitmap vert_bitmap; + BLI_bitmap *vert_bitmap; #ifdef PERFCNTRS int perf_modified; diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 6f77d63d90f..41b9734315d 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -268,8 +268,9 @@ static int ptcache_particle_write(int index, void *psys_v, void **data, int cfr PTCACHE_DATA_FROM(data, BPHYS_DATA_SIZE, &pa->size); PTCACHE_DATA_FROM(data, BPHYS_DATA_TIMES, times); - if (boid) + if (boid) { PTCACHE_DATA_FROM(data, BPHYS_DATA_BOIDS, &boid->data); + } /* return flag 1+1=2 for newly born particles to copy exact birth location to previously cached frame */ return 1 + (pa->state.time >= pa->time && pa->prev_state.time <= pa->time); @@ -304,8 +305,9 @@ static void ptcache_particle_read(int index, void *psys_v, void **data, float cf else if (cfra > pa->dietime) pa->state.time = pa->dietime; - if (data[BPHYS_DATA_SIZE]) + if (data[BPHYS_DATA_SIZE]) { PTCACHE_DATA_TO(data, BPHYS_DATA_SIZE, 0, &pa->size); + } if (data[BPHYS_DATA_TIMES]) { float times[3]; @@ -926,7 +928,7 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v) /* version header */ ptcache_file_read(pf, version, 1, sizeof(char) * 4); if (strncmp(version, DPAINT_CACHE_VERSION, 4)) { - printf("Dynamic Paint: Invalid cache version: %s!\n", version); + printf("Dynamic Paint: Invalid cache version: '%c%c%c%c'!\n", UNPACK4(version)); return 0; } @@ -2800,7 +2802,7 @@ int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode) smokeModifier_reset_turbulence(pid->calldata); #endif else if (pid->type == PTCACHE_TYPE_DYNAMICPAINT) - dynamicPaint_clearSurface((DynamicPaintSurface*)pid->calldata); + dynamicPaint_clearSurface(scene, (DynamicPaintSurface*)pid->calldata); } if (clear) BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0); diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c index ec23a7db8a1..73f2a864e32 100644 --- a/source/blender/blenkernel/intern/property.c +++ b/source/blender/blenkernel/intern/property.c @@ -177,9 +177,9 @@ void BKE_bproperty_unique(bProperty *first, bProperty *prop, int force) i = 0; do { /* ensure we have enough chars for the new number in the name */ - BLI_snprintf(num, sizeof(num), "%d", i++); - BLI_strncpy(new_name, base_name, sizeof(prop->name) - strlen(num)); - strcat(new_name, num); + const size_t num_len = BLI_snprintf(num, sizeof(num), "%d", i++); + BLI_snprintf(new_name, sizeof(prop->name), + "%.*s%s", (int)(sizeof(prop->name) - num_len), base_name, num); } while (bproperty_get(first, prop, new_name)); BLI_strncpy(prop->name, new_name, sizeof(prop->name)); diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 9ddf0cd2d68..f3276992381 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -288,18 +288,18 @@ static rbCollisionShape *rigidbody_get_shape_trimesh_from_mesh(Object *ob) for (i = 0; (i < totface) && (mface) && (mvert); i++, mface++) { /* add first triangle - verts 1,2,3 */ { - MVert *va = (IN_RANGE(mface->v1, 0, totvert)) ? (mvert + mface->v1) : (mvert); - MVert *vb = (IN_RANGE(mface->v2, 0, totvert)) ? (mvert + mface->v2) : (mvert); - MVert *vc = (IN_RANGE(mface->v3, 0, totvert)) ? (mvert + mface->v3) : (mvert); + MVert *va = (mface->v1 < totvert) ? (mvert + mface->v1) : (mvert); + MVert *vb = (mface->v2 < totvert) ? (mvert + mface->v2) : (mvert); + MVert *vc = (mface->v3 < totvert) ? (mvert + mface->v3) : (mvert); RB_trimesh_add_triangle(mdata, va->co, vb->co, vc->co); } /* add second triangle if needed - verts 1,3,4 */ if (mface->v4) { - MVert *va = (IN_RANGE(mface->v1, 0, totvert)) ? (mvert + mface->v1) : (mvert); - MVert *vb = (IN_RANGE(mface->v3, 0, totvert)) ? (mvert + mface->v3) : (mvert); - MVert *vc = (IN_RANGE(mface->v4, 0, totvert)) ? (mvert + mface->v4) : (mvert); + MVert *va = (mface->v1 < totvert) ? (mvert + mface->v1) : (mvert); + MVert *vb = (mface->v3 < totvert) ? (mvert + mface->v3) : (mvert); + MVert *vc = (mface->v4 < totvert) ? (mvert + mface->v4) : (mvert); RB_trimesh_add_triangle(mdata, va->co, vb->co, vc->co); } @@ -602,7 +602,7 @@ void BKE_rigidbody_validate_sim_constraint(RigidBodyWorld *rbw, Object *ob, shor RB_constraint_set_damping_6dof_spring(rbc->physics_constraint, RB_LIMIT_LIN_Z, rbc->spring_damping_z); RB_constraint_set_equilibrium_6dof_spring(rbc->physics_constraint); - /* fall through */ + /* fall-through */ case RBC_TYPE_6DOF: if (rbc->type == RBC_TYPE_6DOF) /* a litte awkward but avoids duplicate code for limits */ rbc->physics_constraint = RB_constraint_new_6dof(loc, rot, rb1, rb2); @@ -914,12 +914,10 @@ void BKE_rigidbody_remove_object(Scene *scene, Object *ob) if (obt && obt->rigidbody_constraint) { rbc = obt->rigidbody_constraint; if (rbc->ob1 == ob) { - rbc->ob1 = NULL; - rbc->flag |= RBC_FLAG_NEEDS_VALIDATE; + BKE_rigidbody_remove_constraint(scene, obt); } if (rbc->ob2 == ob) { - rbc->ob2 = NULL; - rbc->flag |= RBC_FLAG_NEEDS_VALIDATE; + BKE_rigidbody_remove_constraint(scene, obt); } } } @@ -938,10 +936,9 @@ void BKE_rigidbody_remove_constraint(Scene *scene, Object *ob) RigidBodyWorld *rbw = scene->rigidbody_world; RigidBodyCon *rbc = ob->rigidbody_constraint; - if (rbw) { - /* remove from rigidbody world, free object won't do this */ - if (rbw && rbw->physics_world && rbc->physics_constraint) - RB_dworld_remove_constraint(rbw->physics_world, rbc->physics_constraint); + /* remove from rigidbody world, free object won't do this */ + if (rbw && rbw->physics_world && rbc->physics_constraint) { + RB_dworld_remove_constraint(rbw->physics_world, rbc->physics_constraint); } /* remove object's settings */ BKE_rigidbody_free_constraint(ob); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 26563afa65b..1874523dac9 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -684,12 +684,9 @@ void BKE_scene_set_background(Main *bmain, Scene *scene) } } - /* sort baselist */ - DAG_scene_relations_rebuild(bmain, scene); - - /* ensure dags are built for sets */ + /* sort baselist for scene and sets */ for (sce = scene; sce; sce = sce->set) - DAG_scene_relations_update(bmain, sce); + DAG_scene_relations_rebuild(bmain, sce); /* copy layers and flags from bases to objects */ for (base = scene->base.first; base; base = base->next) { @@ -746,17 +743,16 @@ void BKE_scene_unlink(Main *bmain, Scene *sce, Scene *newsce) /* used by metaballs * doesn't return the original duplicated object, only dupli's */ -int BKE_scene_base_iter_next(Scene **scene, int val, Base **base, Object **ob) +int BKE_scene_base_iter_next(SceneBaseIter *iter, Scene **scene, int val, Base **base, Object **ob) { - static ListBase *duplilist = NULL; - static DupliObject *dupob; - static int fase = F_START, in_next_object = 0; + static int in_next_object = 0; int run_again = 1; /* init */ if (val == 0) { - fase = F_START; - dupob = NULL; + iter->fase = F_START; + iter->dupob = NULL; + iter->duplilist = NULL; /* XXX particle systems with metas+dupligroups call this recursively */ /* see bug #18725 */ @@ -774,11 +770,11 @@ int BKE_scene_base_iter_next(Scene **scene, int val, Base **base, Object **ob) run_again = 0; /* the first base */ - if (fase == F_START) { + if (iter->fase == F_START) { *base = (*scene)->base.first; if (*base) { *ob = (*base)->object; - fase = F_SCENE; + iter->fase = F_SCENE; } else { /* exception: empty scene */ @@ -787,20 +783,20 @@ int BKE_scene_base_iter_next(Scene **scene, int val, Base **base, Object **ob) if ((*scene)->base.first) { *base = (*scene)->base.first; *ob = (*base)->object; - fase = F_SCENE; + iter->fase = F_SCENE; break; } } } } else { - if (*base && fase != F_DUPLI) { + if (*base && iter->fase != F_DUPLI) { *base = (*base)->next; if (*base) { *ob = (*base)->object; } else { - if (fase == F_SCENE) { + if (iter->fase == F_SCENE) { /* (*scene) is finished, now do the set */ while ((*scene)->set) { (*scene) = (*scene)->set; @@ -816,45 +812,45 @@ int BKE_scene_base_iter_next(Scene **scene, int val, Base **base, Object **ob) } if (*base == NULL) { - fase = F_START; + iter->fase = F_START; } else { - if (fase != F_DUPLI) { + if (iter->fase != F_DUPLI) { if ( (*base)->object->transflag & OB_DUPLI) { /* groups cannot be duplicated for mballs yet, * this enters eternal loop because of * makeDispListMBall getting called inside of group_duplilist */ if ((*base)->object->dup_group == NULL) { - duplilist = object_duplilist((*scene), (*base)->object, FALSE); + iter->duplilist = object_duplilist((*scene), (*base)->object, FALSE); - dupob = duplilist->first; + iter->dupob = iter->duplilist->first; - if (!dupob) - free_object_duplilist(duplilist); + if (!iter->dupob) + free_object_duplilist(iter->duplilist); } } } /* handle dupli's */ - if (dupob) { + if (iter->dupob) { - copy_m4_m4(dupob->ob->obmat, dupob->mat); + copy_m4_m4(iter->dupob->ob->obmat, iter->dupob->mat); (*base)->flag |= OB_FROMDUPLI; - *ob = dupob->ob; - fase = F_DUPLI; + *ob = iter->dupob->ob; + iter->fase = F_DUPLI; - dupob = dupob->next; + iter->dupob = iter->dupob->next; } - else if (fase == F_DUPLI) { - fase = F_SCENE; + else if (iter->fase == F_DUPLI) { + iter->fase = F_SCENE; (*base)->flag &= ~OB_FROMDUPLI; - for (dupob = duplilist->first; dupob; dupob = dupob->next) { - copy_m4_m4(dupob->ob->obmat, dupob->omat); + for (iter->dupob = iter->duplilist->first; iter->dupob; iter->dupob = iter->dupob->next) { + copy_m4_m4(iter->dupob->ob->obmat, iter->dupob->omat); } - free_object_duplilist(duplilist); - duplilist = NULL; + free_object_duplilist(iter->duplilist); + iter->duplilist = NULL; run_again = 1; } } @@ -870,7 +866,7 @@ int BKE_scene_base_iter_next(Scene **scene, int val, Base **base, Object **ob) /* reset recursion test */ in_next_object = 0; - return fase; + return iter->fase; } Object *BKE_scene_camera_find(Scene *sc) @@ -1483,6 +1479,16 @@ void BKE_scene_disable_color_management(Scene *scene) int BKE_scene_check_color_management_enabled(const Scene *scene) { + /* TODO(sergey): shouldn't be needed. but we're currently far to close to the release, + * so better be extra-safe than sorry. + * + * Will remove the check after the release. + */ + if (!scene) { + BLI_assert(!"Shouldn't happen!"); + return TRUE; + } + return strcmp(scene->display_settings.display_device, "None") != 0; } diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 68fac399c51..34b19e3f357 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -50,6 +50,7 @@ #include "BLI_listbase.h" #include "BLI_path_util.h" #include "BLI_string.h" +#include "BLI_string_utf8.h" #include "BLI_threads.h" #include "BLI_utildefines.h" @@ -64,6 +65,7 @@ #include "BKE_fcurve.h" #include "BKE_scene.h" #include "BKE_mask.h" +#include "BKE_library.h" #include "RNA_access.h" @@ -178,8 +180,10 @@ static void BKE_sequence_free_ex(Scene *scene, Sequence *seq, const int do_cache if (seq->strip) seq_free_strip(seq->strip); - if (seq->anim) + if (seq->anim) { IMB_free_anim(seq->anim); + seq->anim = NULL; + } if (seq->type & SEQ_TYPE_EFFECT) { struct SeqEffectHandle sh = BKE_sequence_get_effect(seq); @@ -262,6 +266,7 @@ static void seq_free_clipboard_recursive(Sequence *seq_parent) seq_free_clipboard_recursive(seq); } + BKE_sequence_clipboard_pointers_free(seq_parent); BKE_sequence_free_ex(NULL, seq_parent, FALSE); } @@ -276,6 +281,101 @@ void BKE_sequencer_free_clipboard(void) seqbase_clipboard.first = seqbase_clipboard.last = NULL; } +/* -------------------------------------------------------------------- */ +/* Manage pointers in the clipboard. + * note that these pointers should _never_ be access in the sequencer, + * they are only for storage while in the clipboard + * notice 'newid' is used for temp pointer storage here, validate on access. + */ +#define ID_PT (*id_pt) +static void seqclipboard_ptr_free(ID **id_pt) +{ + if (ID_PT) { + BLI_assert(ID_PT->newid != NULL); + MEM_freeN(ID_PT); + ID_PT = NULL; + } +} +static void seqclipboard_ptr_store(ID **id_pt) +{ + if (ID_PT) { + ID *id_prev = ID_PT; + ID_PT = MEM_dupallocN(ID_PT); + ID_PT->newid = id_prev; + } +} +static void seqclipboard_ptr_restore(Main *bmain, ID **id_pt) +{ + if (ID_PT) { + const ListBase *lb = which_libbase(bmain, GS(ID_PT->name)); + void *id_restore; + + BLI_assert(ID_PT->newid != NULL); + if (BLI_findindex(lb, (ID_PT)->newid) != -1) { + /* the pointer is still valid */ + id_restore = (ID_PT)->newid; + } + else { + /* the pointer of the same name still exists */ + id_restore = BLI_findstring(lb, (ID_PT)->name + 2, offsetof(ID, name) + 2); + } + + if (id_restore == NULL) { + /* check for a data with the same filename */ + switch (GS(ID_PT->name)) { + case ID_SO: + { + id_restore = BLI_findstring(lb, ((bSound *)ID_PT)->name, offsetof(bSound, name)); + if (id_restore == NULL) { + id_restore = sound_new_file(bmain, ((bSound *)ID_PT)->name); + (ID_PT)->newid = id_restore; /* reuse next time */ + } + break; + } + case ID_MC: + { + id_restore = BLI_findstring(lb, ((MovieClip *)ID_PT)->name, offsetof(MovieClip, name)); + if (id_restore == NULL) { + id_restore = BKE_movieclip_file_add(bmain, ((MovieClip *)ID_PT)->name); + (ID_PT)->newid = id_restore; /* reuse next time */ + } + break; + } + } + } + + ID_PT = id_restore; + } +} +#undef ID_PT + +void BKE_sequence_clipboard_pointers_free(Sequence *seq) +{ + seqclipboard_ptr_free((ID **)&seq->scene); + seqclipboard_ptr_free((ID **)&seq->scene_camera); + seqclipboard_ptr_free((ID **)&seq->clip); + seqclipboard_ptr_free((ID **)&seq->mask); + seqclipboard_ptr_free((ID **)&seq->sound); +} +void BKE_sequence_clipboard_pointers_store(Sequence *seq) +{ + seqclipboard_ptr_store((ID **)&seq->scene); + seqclipboard_ptr_store((ID **)&seq->scene_camera); + seqclipboard_ptr_store((ID **)&seq->clip); + seqclipboard_ptr_store((ID **)&seq->mask); + seqclipboard_ptr_store((ID **)&seq->sound); +} +void BKE_sequence_clipboard_pointers_restore(Sequence *seq, Main *bmain) +{ + seqclipboard_ptr_restore(bmain, (ID **)&seq->scene); + seqclipboard_ptr_restore(bmain, (ID **)&seq->scene_camera); + seqclipboard_ptr_restore(bmain, (ID **)&seq->clip); + seqclipboard_ptr_restore(bmain, (ID **)&seq->mask); + seqclipboard_ptr_restore(bmain, (ID **)&seq->sound); +} +/* end clipboard pointer mess */ + + Editing *BKE_sequencer_editing_ensure(Scene *scene) { if (scene->ed == NULL) { @@ -815,33 +915,6 @@ void BKE_sequencer_clear_scene_in_allseqs(Main *bmain, Scene *scene) BKE_sequencer_base_recursive_apply(&scene_iter->ed->seqbase, clear_scene_in_allseqs_cb, scene); } } - - /* also clear clipboard */ - BKE_sequencer_base_recursive_apply(&seqbase_clipboard, clear_scene_in_allseqs_cb, scene); -} - -static int clear_movieclip_in_clipboard_cb(Sequence *seq, void *arg_pt) -{ - if (seq->clip == (MovieClip *)arg_pt) - seq->clip = NULL; - return 1; -} - -void BKE_sequencer_clear_movieclip_in_clipboard(MovieClip *clip) -{ - BKE_sequencer_base_recursive_apply(&seqbase_clipboard, clear_movieclip_in_clipboard_cb, clip); -} - -static int clear_mask_in_clipboard_cb(Sequence *seq, void *arg_pt) -{ - if (seq->mask == (Mask *)arg_pt) - seq->mask = NULL; - return 1; -} - -void BKE_sequencer_clear_mask_in_clipboard(Mask *mask) -{ - BKE_sequencer_base_recursive_apply(&seqbase_clipboard, clear_mask_in_clipboard_cb, mask); } typedef struct SeqUniqueInfo { @@ -3111,8 +3184,18 @@ static void sequence_invalidate_cache(Scene *scene, Sequence *seq, int invalidat Editing *ed = scene->ed; /* invalidate cache for current sequence */ - if (invalidate_self) + if (invalidate_self) { + if (seq->anim) { + /* Animation structure holds some buffers inside, + * so for proper cache invalidation we need to + * re-open the animation. + */ + IMB_free_anim(seq->anim); + seq->anim = NULL; + } + BKE_sequencer_cache_cleanup_sequence(seq); + } /* if invalidation is invoked from sequence free routine, effectdata would be NULL here */ if (seq->effectdata && seq->type == SEQ_TYPE_SPEED) @@ -3938,7 +4021,8 @@ Mask *BKE_sequencer_mask_get(Scene *scene) static void seq_load_apply(Scene *scene, Sequence *seq, SeqLoadInfo *seq_load) { if (seq) { - BLI_strncpy(seq->name + 2, seq_load->name, sizeof(seq->name) - 2); + BLI_strncpy_utf8(seq->name + 2, seq_load->name, sizeof(seq->name) - 2); + BLI_utf8_invalid_strip(seq->name + 2, sizeof(seq->name) - 2); BKE_sequence_base_unique_name_recursive(&scene->ed->seqbase, seq); if (seq_load->flag & SEQ_LOAD_FRAME_ADVANCE) { @@ -4231,6 +4315,12 @@ static Sequence *seq_dupli(Scene *scene, Scene *scene_to, Sequence *seq, int dup if (seq->scene_sound) seqn->scene_sound = sound_scene_add_scene_sound_defaults(sce_audio, seqn); } + else if (seq->type == SEQ_TYPE_MOVIECLIP) { + /* avoid assert */ + } + else if (seq->type == SEQ_TYPE_MASK) { + /* avoid assert */ + } else if (seq->type == SEQ_TYPE_MOVIE) { seqn->strip->stripdata = MEM_dupallocN(seq->strip->stripdata); @@ -4242,7 +4332,7 @@ static Sequence *seq_dupli(Scene *scene, Scene *scene_to, Sequence *seq, int dup if (seq->scene_sound) seqn->scene_sound = sound_add_scene_sound_defaults(sce_audio, seqn); - seqn->sound->id.us++; + id_us_plus((ID *)seqn->sound); } else if (seq->type == SEQ_TYPE_IMAGE) { seqn->strip->stripdata = @@ -4264,7 +4354,8 @@ static Sequence *seq_dupli(Scene *scene, Scene *scene_to, Sequence *seq, int dup } else { - fprintf(stderr, "Aiiiiekkk! sequence type not handled in duplicate!\nExpect a crash now...\n"); + /* sequence type not handled in duplicate! Expect a crash now... */ + BLI_assert(0); } if (dupe_flag & SEQ_DUPE_UNIQUE_NAME) diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 05c3550d810..b2c0a45cbc4 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -1413,12 +1413,14 @@ static void emit_from_particles(Object *flow_ob, SmokeDomainSettings *sds, Smoke } } +/* TODO(sergey): de-duplicate with get_texture_value from modifier utils */ +/* NOTE: Skips color management, because result is only used for value now, not for color. */ static void get_texture_value(Tex *texture, float tex_co[3], TexResult *texres) { int result_type; /* no node textures for now */ - result_type = multitex_ext_safe(texture, tex_co, texres, NULL); + result_type = multitex_ext_safe(texture, tex_co, texres, NULL, false); /* if the texture gave an RGB value, we assume it didn't give a valid * intensity, since this is in the context of modifiers don't use perceptual color conversion. @@ -2100,7 +2102,7 @@ static void update_flowsfluids(Scene *scene, Object *ob, SmokeDomainSettings *sd /* sample subframes */ else { int scene_frame = scene->r.cfra; - float scene_subframe = scene->r.subframe; + // float scene_subframe = scene->r.subframe; // UNUSED int subframe; for (subframe = 0; subframe <= subframes; subframe++) { EmissionMap em_temp = {0}; diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 9b5e5070342..cc33727030a 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1505,7 +1505,8 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) static void ccgDM_foreachMappedVert( DerivedMesh *dm, void (*func)(void *userData, int index, const float co[3], const float no_f[3], const short no_s[3]), - void *userData) + void *userData, + DMForeachFlag flag) { CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm; CCGVertIterator *vi; @@ -1514,11 +1515,13 @@ static void ccgDM_foreachMappedVert( for (vi = ccgSubSurf_getVertIterator(ccgdm->ss); !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) { CCGVert *v = ccgVertIterator_getCurrent(vi); - CCGElem *vd = ccgSubSurf_getVertData(ccgdm->ss, v); - int index = ccgDM_getVertMapIndex(ccgdm->ss, v); + const int index = ccgDM_getVertMapIndex(ccgdm->ss, v); - if (index != -1) - func(userData, index, CCG_elem_co(&key, vd), CCG_elem_no(&key, vd), NULL); + if (index != -1) { + CCGElem *vd = ccgSubSurf_getVertData(ccgdm->ss, v); + const float *no = (flag & DM_FOREACH_USE_NORMAL) ? CCG_elem_no(&key, vd) : NULL; + func(userData, index, CCG_elem_co(&key, vd), no, NULL); + } } ccgVertIterator_free(vi); @@ -1539,12 +1542,13 @@ static void ccgDM_foreachMappedEdge( for (ei = ccgSubSurf_getEdgeIterator(ss); !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { CCGEdge *e = ccgEdgeIterator_getCurrent(ei); - CCGElem *edgeData = ccgSubSurf_getEdgeDataArray(ss, e); - int index = ccgDM_getEdgeMapIndex(ss, e); + const int index = ccgDM_getEdgeMapIndex(ss, e); if (index != -1) { - for (i = 0; i < edgeSize - 1; i++) + CCGElem *edgeData = ccgSubSurf_getEdgeDataArray(ss, e); + for (i = 0; i < edgeSize - 1; i++) { func(userData, index, CCG_elem_offset_co(&key, edgeData, i), CCG_elem_offset_co(&key, edgeData, i + 1)); + } } } @@ -1970,7 +1974,7 @@ static void ccgDM_drawFacesGLSL(DerivedMesh *dm, DMSetMaterial setMaterial) /* Only used by non-editmesh types */ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *userData, int, void *attribs), - int (*setFace)(void *userData, int index), void *userData) + bool (*setFace)(void *userData, int index), void *userData) { CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm; CCGSubSurf *ss = ccgdm->ss; @@ -2530,7 +2534,8 @@ static void ccgDM_drawMappedEdgesInterp(DerivedMesh *dm, static void ccgDM_foreachMappedFaceCenter( DerivedMesh *dm, void (*func)(void *userData, int index, const float co[3], const float no[3]), - void *userData) + void *userData, + DMForeachFlag flag) { CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm; CCGSubSurf *ss = ccgdm->ss; @@ -2541,13 +2546,13 @@ static void ccgDM_foreachMappedFaceCenter( for (fi = ccgSubSurf_getFaceIterator(ss); !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { CCGFace *f = ccgFaceIterator_getCurrent(fi); - int index = ccgDM_getFaceMapIndex(ss, f); + const int index = ccgDM_getFaceMapIndex(ss, f); if (index != -1) { /* Face center data normal isn't updated atm. */ CCGElem *vd = ccgSubSurf_getFaceGridData(ss, f, 0, 0, 0); - - func(userData, index, CCG_elem_co(&key, vd), CCG_elem_no(&key, vd)); + const float *no = (flag & DM_FOREACH_USE_NORMAL) ? CCG_elem_no(&key, vd) : NULL; + func(userData, index, CCG_elem_co(&key, vd), no); } } @@ -2925,7 +2930,7 @@ static void ccgdm_create_grids(DerivedMesh *dm) gridFaces = MEM_mallocN(sizeof(CCGFace *) * numGrids, "ccgdm.gridFaces"); gridFlagMats = MEM_mallocN(sizeof(DMFlagMat) * numGrids, "ccgdm.gridFlagMats"); - ccgdm->gridHidden = MEM_callocN(sizeof(BLI_bitmap) * numGrids, "ccgdm.gridHidden"); + ccgdm->gridHidden = MEM_callocN(sizeof(*ccgdm->gridHidden) * numGrids, "ccgdm.gridHidden"); for (gIndex = 0, index = 0; index < numFaces; index++) { CCGFace *f = ccgdm->faceMap[index].face; @@ -2997,7 +3002,7 @@ static DMFlagMat *ccgDM_getGridFlagMats(DerivedMesh *dm) return ccgdm->gridFlagMats; } -static BLI_bitmap *ccgDM_getGridHidden(DerivedMesh *dm) +static BLI_bitmap **ccgDM_getGridHidden(DerivedMesh *dm) { CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm; diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 296f25e303e..f0c01e25598 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -847,19 +847,6 @@ int txt_utf8_column_to_offset(const char *str, int column) return offset; } -/* returns the real number of characters in string */ -/* not the same as BLI_strlen_utf8, which returns length for wide characters */ -static int txt_utf8_len(const char *src) -{ - int len; - - for (len = 0; *src; len++) { - src += BLI_str_utf8_size(src); - } - - return len; -} - void txt_move_up(Text *text, short sel) { TextLine **linep; @@ -1509,6 +1496,7 @@ static int max_undo_test(Text *text, int x) return 1; } +#if 0 /* UNUSED */ static void dump_buffer(Text *text) { int i = 0; @@ -1620,6 +1608,7 @@ void txt_print_undo(Text *text) c_len = BLI_str_utf8_from_unicode(uc, c); c[c_len] = '\0'; puts(c); + break; } } } @@ -1672,6 +1661,7 @@ void txt_print_undo(Text *text) i++; } } +#endif static void txt_undo_store_uint16(char *undo_buf, int *undo_pos, unsigned short value) { @@ -1863,6 +1853,7 @@ static unsigned int txt_undo_read_unicode(const char *undo_buf, int *undo_pos, s /* should never happen */ BLI_assert(0); unicode = 0; + break; } return unicode; @@ -1938,6 +1929,7 @@ static unsigned int txt_redo_read_unicode(const char *undo_buf, int *undo_pos, s /* should never happen */ BLI_assert(0); unicode = 0; + break; } return unicode; @@ -2026,10 +2018,7 @@ void txt_do_undo(Text *text) buf[i] = 0; /* skip over the length that was stored again */ - text->undo_pos--; - text->undo_pos--; - text->undo_pos--; - text->undo_pos--; + text->undo_pos -= 4; /* Get the cursor positions */ txt_undo_read_cursors(text->undo_buf, &text->undo_pos, &curln, &curc, &selln, &selc); @@ -2059,14 +2048,11 @@ void txt_do_undo(Text *text) text->undo_pos--; } buf[i] = 0; - linep = txt_utf8_len(buf); + linep = BLI_strlen_utf8(buf); MEM_freeN(buf); /* skip over the length that was stored again */ - text->undo_pos--; - text->undo_pos--; - text->undo_pos--; - text->undo_pos--; + text->undo_pos -= 4; /* get and restore the cursors */ txt_undo_read_cursors(text->undo_buf, &text->undo_pos, &curln, &curc, &selln, &selc); @@ -2217,10 +2203,7 @@ void txt_do_redo(Text *text) text->undo_pos += linep; /* skip over the length that was stored again */ - text->undo_pos++; - text->undo_pos++; - text->undo_pos++; - text->undo_pos++; + text->undo_pos += 4; txt_delete_sel(text); @@ -2246,10 +2229,7 @@ void txt_do_redo(Text *text) MEM_freeN(buf); /* skip over the length that was stored again */ - text->undo_pos++; - text->undo_pos++; - text->undo_pos++; - text->undo_pos++; + text->undo_pos += 4; break; @@ -2379,7 +2359,7 @@ static void txt_delete_line(Text *text, TextLine *line) static void txt_combine_lines(Text *text, TextLine *linea, TextLine *lineb) { - char *tmp; + char *tmp, *s; if (!text) return; @@ -2388,8 +2368,10 @@ static void txt_combine_lines(Text *text, TextLine *linea, TextLine *lineb) tmp = MEM_mallocN(linea->len + lineb->len + 1, "textline_string"); - strcpy(tmp, linea->line); - strcat(tmp, lineb->line); + s = tmp; + s += BLI_strcpy_rlen(s, linea->line); + s += BLI_strcpy_rlen(s, lineb->line); + (void)s; make_new_line(linea, tmp); @@ -2642,10 +2624,6 @@ void txt_indent(Text *text) return; } - if (!text) return; - if (!text->curl) return; - if (!text->sell) return; - /* insert spaces rather than tabs */ if (text->flags & TXT_TABSTOSPACES) { add = tab_to_spaces; @@ -2705,9 +2683,9 @@ void txt_unindent(Text *text) /* hardcoded: TXT_TABSIZE = 4 spaces: */ int spaceslen = TXT_TABSIZE; - if (!text) return; - if (!text->curl) return; - if (!text->sell) return; + if (ELEM3(NULL, text, text->curl, text->sell)) { + return; + } /* insert spaces rather than tabs */ if (text->flags & TXT_TABSTOSPACES) { diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 1d0b0deae7e..e2b7358525a 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -906,42 +906,6 @@ void BKE_texture_make_local(Tex *tex) } } -/* ------------------------------------------------------------------------- */ -#if 0 /* UNUSED */ -void autotexname(Tex *tex) -{ - Main *bmain = G.main; - char texstr[20][15] = {"None", "Clouds", "Wood", "Marble", "Magic", "Blend", - "Stucci", "Noise", "Image", "EnvMap", "Musgrave", - "Voronoi", "DistNoise", "Point Density", "Voxel Data", "Ocean", "", "", ""}; - Image *ima; - char di[FILE_MAXDIR], fi[FILE_MAXFILE]; - - if (tex) { - if (tex->use_nodes) { - new_id(&bmain->tex, (ID *)tex, "Noddy"); - } - else if (tex->type == TEX_IMAGE) { - ima = tex->ima; - if (ima) { - BLI_split_file_part(ima->name, fi, sizeof(fi)); - strcpy(di, "I."); - strcat(di, fi); - new_id(&bmain->tex, (ID *)tex, di); - } - else { - new_id(&bmain->tex, (ID *)tex, texstr[tex->type]); - } - } - else { - new_id(&bmain->tex, (ID *)tex, texstr[tex->type]); - } - } -} -#endif - -/* ------------------------------------------------------------------------- */ - Tex *give_current_object_texture(Object *ob) { Material *ma, *node_ma; diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 8141fc8aaa1..12c2967afcf 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1534,7 +1534,7 @@ void BKE_tracking_camera_get_reconstructed_interpolate(MovieTracking *tracking, /*********************** Distortion/Undistortion *************************/ -static void cameraIntrinscisOptionsFromTracking(libmv_cameraIntrinsicsOptions *camera_intrinsics_options, +static void cameraIntrinscisOptionsFromTracking(libmv_CameraIntrinsicsOptions *camera_intrinsics_options, MovieTracking *tracking, int calibration_width, int calibration_height) { MovieTrackingCamera *camera = &tracking->camera; @@ -1559,7 +1559,7 @@ MovieDistortion *BKE_tracking_distortion_new(void) distortion = MEM_callocN(sizeof(MovieDistortion), "BKE_tracking_distortion_create"); - distortion->intrinsics = libmv_CameraIntrinsicsNewEmpty(); + distortion->intrinsics = libmv_cameraIntrinsicsNewEmpty(); return distortion; } @@ -1567,17 +1567,17 @@ MovieDistortion *BKE_tracking_distortion_new(void) void BKE_tracking_distortion_update(MovieDistortion *distortion, MovieTracking *tracking, int calibration_width, int calibration_height) { - libmv_cameraIntrinsicsOptions camera_intrinsics_options; + libmv_CameraIntrinsicsOptions camera_intrinsics_options; cameraIntrinscisOptionsFromTracking(&camera_intrinsics_options, tracking, calibration_width, calibration_height); - libmv_CameraIntrinsicsUpdate(&camera_intrinsics_options, distortion->intrinsics); + libmv_cameraIntrinsicsUpdate(&camera_intrinsics_options, distortion->intrinsics); } void BKE_tracking_distortion_set_threads(MovieDistortion *distortion, int threads) { - libmv_CameraIntrinsicsSetThreads(distortion->intrinsics, threads); + libmv_cameraIntrinsicsSetThreads(distortion->intrinsics, threads); } MovieDistortion *BKE_tracking_distortion_copy(MovieDistortion *distortion) @@ -1586,7 +1586,7 @@ MovieDistortion *BKE_tracking_distortion_copy(MovieDistortion *distortion) new_distortion = MEM_callocN(sizeof(MovieDistortion), "BKE_tracking_distortion_create"); - new_distortion->intrinsics = libmv_CameraIntrinsicsCopy(distortion->intrinsics); + new_distortion->intrinsics = libmv_cameraIntrinsicsCopy(distortion->intrinsics); return new_distortion; } @@ -1602,12 +1602,12 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking * if (ibuf->rect_float) { if (undistort) { - libmv_CameraIntrinsicsUndistortFloat(distortion->intrinsics, + libmv_cameraIntrinsicsUndistortFloat(distortion->intrinsics, ibuf->rect_float, resibuf->rect_float, ibuf->x, ibuf->y, overscan, ibuf->channels); } else { - libmv_CameraIntrinsicsDistortFloat(distortion->intrinsics, + libmv_cameraIntrinsicsDistortFloat(distortion->intrinsics, ibuf->rect_float, resibuf->rect_float, ibuf->x, ibuf->y, overscan, ibuf->channels); } @@ -1617,12 +1617,12 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking * } else { if (undistort) { - libmv_CameraIntrinsicsUndistortByte(distortion->intrinsics, + libmv_cameraIntrinsicsUndistortByte(distortion->intrinsics, (unsigned char *)ibuf->rect, (unsigned char *)resibuf->rect, ibuf->x, ibuf->y, overscan, ibuf->channels); } else { - libmv_CameraIntrinsicsDistortByte(distortion->intrinsics, + libmv_cameraIntrinsicsDistortByte(distortion->intrinsics, (unsigned char *)ibuf->rect, (unsigned char *)resibuf->rect, ibuf->x, ibuf->y, overscan, ibuf->channels); } @@ -1633,7 +1633,7 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking * void BKE_tracking_distortion_free(MovieDistortion *distortion) { - libmv_CameraIntrinsicsDestroy(distortion->intrinsics); + libmv_cameraIntrinsicsDestroy(distortion->intrinsics); MEM_freeN(distortion); } @@ -1642,7 +1642,7 @@ void BKE_tracking_distort_v2(MovieTracking *tracking, const float co[2], float r { MovieTrackingCamera *camera = &tracking->camera; - libmv_cameraIntrinsicsOptions camera_intrinsics_options; + libmv_CameraIntrinsicsOptions camera_intrinsics_options; double x, y; float aspy = 1.0f / tracking->camera.pixel_aspect; @@ -1652,7 +1652,7 @@ void BKE_tracking_distort_v2(MovieTracking *tracking, const float co[2], float r x = (co[0] - camera->principal[0]) / camera->focal; y = (co[1] - camera->principal[1] * aspy) / camera->focal; - libmv_ApplyCameraIntrinsics(&camera_intrinsics_options, x, y, &x, &y); + libmv_cameraIntrinsicsApply(&camera_intrinsics_options, x, y, &x, &y); /* result is in image coords already */ r_co[0] = x; @@ -1663,13 +1663,13 @@ void BKE_tracking_undistort_v2(MovieTracking *tracking, const float co[2], float { MovieTrackingCamera *camera = &tracking->camera; - libmv_cameraIntrinsicsOptions camera_intrinsics_options; + libmv_CameraIntrinsicsOptions camera_intrinsics_options; double x = co[0], y = co[1]; float aspy = 1.0f / tracking->camera.pixel_aspect; cameraIntrinscisOptionsFromTracking(&camera_intrinsics_options, tracking, 0, 0); - libmv_InvertCameraIntrinsics(&camera_intrinsics_options, x, y, &x, &y); + libmv_cameraIntrinsicsInvert(&camera_intrinsics_options, x, y, &x, &y); r_co[0] = (float)x * camera->focal + camera->principal[0]; r_co[1] = (float)y * camera->focal + camera->principal[1] * aspy; @@ -2529,7 +2529,7 @@ static bool track_context_update_reference(MovieTrackingContext *context, TrackC /* Fill in libmv tracker options structure with settings need to be used to perform track. */ static void tracking_configure_tracker(MovieTrackingTrack *track, float *mask, - struct libmv_trackRegionOptions *options) + libmv_TrackRegionOptions *options) { options->motion_model = track->motion_model; @@ -2654,8 +2654,8 @@ static bool configure_and_run_tracker(ImBuf *destination_ibuf, MovieTrackingTrac double src_pixel_x[5], src_pixel_y[5]; /* Settings for the tracker */ - struct libmv_trackRegionOptions options = {0}; - struct libmv_trackRegionResult result; + libmv_TrackRegionOptions options = {0}; + libmv_TrackRegionResult result; float *patch_new; @@ -2930,17 +2930,17 @@ static struct libmv_Tracks *libmv_tracks_new(ListBase *tracksbase, int width, in } /* Retrieve refined camera intrinsics from libmv to blender. */ -static void reconstruct_retrieve_libmv_intrinscis(MovieReconstructContext *context, MovieTracking *tracking) +static void reconstruct_retrieve_libmv_intrinsics(MovieReconstructContext *context, MovieTracking *tracking) { struct libmv_Reconstruction *libmv_reconstruction = context->reconstruction; - struct libmv_CameraIntrinsics *libmv_intrinsics = libmv_ReconstructionExtractIntrinsics(libmv_reconstruction); + struct libmv_CameraIntrinsics *libmv_intrinsics = libmv_reconstructionExtractIntrinsics(libmv_reconstruction); float aspy = 1.0f / tracking->camera.pixel_aspect; double focal_length, principal_x, principal_y, k1, k2, k3; int width, height; - libmv_CameraIntrinsicsExtract(libmv_intrinsics, &focal_length, &principal_x, &principal_y, + libmv_cameraIntrinsicsExtract(libmv_intrinsics, &focal_length, &principal_x, &principal_y, &k1, &k2, &k3, &width, &height); tracking->camera.focal = focal_length; @@ -2987,13 +2987,13 @@ static int reconstruct_retrieve_libmv_tracks(MovieReconstructContext *context, M while (track) { double pos[3]; - if (libmv_reporojectionPointForTrack(libmv_reconstruction, tracknr, pos)) { + if (libmv_reprojectionPointForTrack(libmv_reconstruction, tracknr, pos)) { track->bundle_pos[0] = pos[0]; track->bundle_pos[1] = pos[1]; track->bundle_pos[2] = pos[2]; track->flag |= TRACK_HAS_BUNDLE; - track->error = libmv_reporojectionErrorForTrack(libmv_reconstruction, tracknr); + track->error = libmv_reprojectionErrorForTrack(libmv_reconstruction, tracknr); } else { track->flag &= ~TRACK_HAS_BUNDLE; @@ -3017,10 +3017,10 @@ static int reconstruct_retrieve_libmv_tracks(MovieReconstructContext *context, M for (a = sfra; a <= efra; a++) { double matd[4][4]; - if (libmv_reporojectionCameraForImage(libmv_reconstruction, a, matd)) { + if (libmv_reprojectionCameraForImage(libmv_reconstruction, a, matd)) { int i, j; float mat[4][4]; - float error = libmv_reporojectionErrorForImage(libmv_reconstruction, a); + float error = libmv_reprojectionErrorForImage(libmv_reconstruction, a); for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) @@ -3081,8 +3081,8 @@ static int reconstruct_retrieve_libmv_tracks(MovieReconstructContext *context, M /* Retrieve all the libmv data from context to blender's side data blocks. */ static int reconstruct_retrieve_libmv(MovieReconstructContext *context, MovieTracking *tracking) { - /* take the intrinscis back from libmv */ - reconstruct_retrieve_libmv_intrinscis(context, tracking); + /* take the intrinsics back from libmv */ + reconstruct_retrieve_libmv_intrinsics(context, tracking); return reconstruct_retrieve_libmv_tracks(context, tracking); } @@ -3243,7 +3243,7 @@ MovieReconstructContext *BKE_tracking_reconstruction_context_new(MovieTracking * void BKE_tracking_reconstruction_context_free(MovieReconstructContext *context) { if (context->reconstruction) - libmv_destroyReconstruction(context->reconstruction); + libmv_reconstructionDestroy(context->reconstruction); libmv_tracksDestroy(context->tracks); @@ -3266,7 +3266,7 @@ static void reconstruct_update_solve_cb(void *customdata, double progress, const } /* FIll in camera intrinsics structure from reconstruction context. */ -static void camraIntrincicsOptionsFromContext(libmv_cameraIntrinsicsOptions *camera_intrinsics_options, +static void camraIntrincicsOptionsFromContext(libmv_CameraIntrinsicsOptions *camera_intrinsics_options, MovieReconstructContext *context) { camera_intrinsics_options->focal_length = context->focal_length; @@ -3283,7 +3283,7 @@ static void camraIntrincicsOptionsFromContext(libmv_cameraIntrinsicsOptions *cam } /* Fill in reconstruction options structure from reconstruction context. */ -static void reconstructionOptionsFromContext(libmv_reconstructionOptions *reconstruction_options, +static void reconstructionOptionsFromContext(libmv_ReconstructionOptions *reconstruction_options, MovieReconstructContext *context) { reconstruction_options->select_keyframes = context->select_keyframes; @@ -3313,8 +3313,8 @@ void BKE_tracking_reconstruction_solve(MovieReconstructContext *context, short * ReconstructProgressData progressdata; - libmv_cameraIntrinsicsOptions camera_intrinsics_options; - libmv_reconstructionOptions reconstruction_options; + libmv_CameraIntrinsicsOptions camera_intrinsics_options; + libmv_ReconstructionOptions reconstruction_options; progressdata.stop = stop; progressdata.do_update = do_update; @@ -3455,7 +3455,7 @@ static bool check_point_in_stroke(bGPDstroke *stroke, float x, float y) prev = i; } - return count % 2 ? true : false; + return (count % 2) ? true : false; } /* Check whether point is inside any stroke of grease pencil layer. */ @@ -3558,7 +3558,7 @@ void BKE_tracking_detect_fast(MovieTracking *tracking, ListBase *tracksbase, ImB framenr, ibuf->x, ibuf->y, layer, place_outside_layer ? true : false); - libmv_destroyFeatures(features); + libmv_featuresDestroy(features); } /*********************** 2D stabilization *************************/ diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index 097c9d076a4..a69df62f505 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -95,6 +95,11 @@ typedef struct bUnitDef { #define B_UNIT_DEF_SUPPRESS 1 /* Use for units that are not used enough to be translated into for common use */ #define B_UNIT_DEF_TENTH 2 /* Display a unit even if its value is 0.1, eg 0.1mm instead of 100um */ +/* workaround encoding issue with "µm", bug [#36090] */ +#define B_UNIT_CHAR_MICRO "\xb5" +#define UM B_UNIT_CHAR_MICRO"m" +#define US B_UNIT_CHAR_MICRO"s" + /* define a single unit */ typedef struct bUnitCollection { struct bUnitDef *units; @@ -116,7 +121,7 @@ static struct bUnitDef buMetricLenDef[] = { {"decimeter", "decimeters", "dm", NULL, "10 Centimeters", UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS}, {"centimeter", "centimeters", "cm", NULL, "Centimeters", UN_SC_CM, 0.0, B_UNIT_DEF_NONE}, {"millimeter", "millimeters", "mm", NULL, "Millimeters", UN_SC_MM, 0.0, B_UNIT_DEF_NONE | B_UNIT_DEF_TENTH}, - {"micrometer", "micrometers", "µm", "um", "Micrometers", UN_SC_UM, 0.0, B_UNIT_DEF_NONE}, // micron too? + {"micrometer", "micrometers", UM, "um", "Micrometers", UN_SC_UM, 0.0, B_UNIT_DEF_NONE}, // micron too? /* These get displayed because of float precision problems in the transform header, * could work around, but for now probably people wont use these */ @@ -149,7 +154,7 @@ static struct bUnitDef buMetricAreaDef[] = { {"square decimeter", "square decimetees", "dm²", "dm2", "Square Decimeters", UN_SC_DM * UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS}, {"square centimeter", "square centimeters", "cm²", "cm2", "Square Centimeters", UN_SC_CM * UN_SC_CM, 0.0, B_UNIT_DEF_NONE}, {"square millimeter", "square millimeters", "mm²", "mm2", "Square Millimeters", UN_SC_MM * UN_SC_MM, 0.0, B_UNIT_DEF_NONE | B_UNIT_DEF_TENTH}, - {"square micrometer", "square micrometers", "µm²", "um2", "Square Micrometers", UN_SC_UM * UN_SC_UM, 0.0, B_UNIT_DEF_NONE}, + {"square micrometer", "square micrometers", UM"²", "um2", "Square Micrometers", UN_SC_UM * UN_SC_UM, 0.0, B_UNIT_DEF_NONE}, {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} }; static struct bUnitCollection buMetricAreaCollection = {buMetricAreaDef, 3, 0, sizeof(buMetricAreaDef) / sizeof(bUnitDef)}; @@ -175,7 +180,7 @@ static struct bUnitDef buMetricVolDef[] = { {"cubic decimeter", "cubic decimeters", "dm³", "dm3", "Cubic Decimeters", UN_SC_DM * UN_SC_DM * UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS}, {"cubic centimeter", "cubic centimeters", "cm³", "cm3", "Cubic Centimeters", UN_SC_CM * UN_SC_CM * UN_SC_CM, 0.0, B_UNIT_DEF_NONE}, {"cubic millimeter", "cubic millimeters", "mm³", "mm3", "Cubic Millimeters", UN_SC_MM * UN_SC_MM * UN_SC_MM, 0.0, B_UNIT_DEF_NONE | B_UNIT_DEF_TENTH}, - {"cubic micrometer", "cubic micrometers", "µm³", "um3", "Cubic Micrometers", UN_SC_UM * UN_SC_UM * UN_SC_UM, 0.0, B_UNIT_DEF_NONE}, + {"cubic micrometer", "cubic micrometers", UM"³", "um3", "Cubic Micrometers", UN_SC_UM * UN_SC_UM * UN_SC_UM, 0.0, B_UNIT_DEF_NONE}, {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} }; static struct bUnitCollection buMetricVolCollection = {buMetricVolDef, 3, 0, sizeof(buMetricVolDef) / sizeof(bUnitDef)}; @@ -253,7 +258,7 @@ static struct bUnitDef buNaturalTimeDef[] = { {"minute", "minutes", "min", "m", "Minutes", 60.0, 0.0, B_UNIT_DEF_NONE}, {"second", "seconds", "sec", "s", "Seconds", 1.0, 0.0, B_UNIT_DEF_NONE}, /* base unit */ {"millisecond", "milliseconds", "ms", NULL, "Milliseconds", 0.001, 0.0, B_UNIT_DEF_NONE}, - {"microsecond", "microseconds", "µs", "us", "Microseconds", 0.000001, 0.0, B_UNIT_DEF_NONE}, + {"microsecond", "microseconds", US, "us", "Microseconds", 0.000001, 0.0, B_UNIT_DEF_NONE}, {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} }; static struct bUnitCollection buNaturalTimeCollection = {buNaturalTimeDef, 3, 0, sizeof(buNaturalTimeDef) / sizeof(bUnitDef)}; @@ -273,7 +278,7 @@ static struct bUnitDef buCameraLenDef[] = { {"decimeter", "decimeters", "dm", NULL, "10 Centimeters", UN_SC_HM, 0.0, B_UNIT_DEF_SUPPRESS}, {"centimeter", "centimeters", "cm", NULL, "Centimeters", UN_SC_DAM, 0.0, B_UNIT_DEF_SUPPRESS}, {"millimeter", "millimeters", "mm", NULL, "Millimeters", UN_SC_M, 0.0, B_UNIT_DEF_NONE}, - {"micrometer", "micrometers", "µm", "um", "Micrometers", UN_SC_MM, 0.0, B_UNIT_DEF_SUPPRESS}, // micron too? + {"micrometer", "micrometers", UM, "um", "Micrometers", UN_SC_MM, 0.0, B_UNIT_DEF_SUPPRESS}, // micron too? {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0} }; static struct bUnitCollection buCameraLenCollection = {buCameraLenDef, 3, 0, sizeof(buCameraLenDef) / sizeof(bUnitDef)}; diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index f08a51e602c..538c98cc899 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -877,6 +877,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report break; case FFMPEG_MP3: fmt->audio_codec = CODEC_ID_MP3; + /* fall-through */ case FFMPEG_WAV: fmt->video_codec = CODEC_ID_NONE; break; @@ -1072,23 +1073,23 @@ int BKE_ffmpeg_start(struct Scene *scene, RenderData *rd, int rectx, int recty, specs.channels = c->channels; switch (av_get_packed_sample_fmt(c->sample_fmt)) { - case AV_SAMPLE_FMT_U8: - specs.format = AUD_FORMAT_U8; - break; - case AV_SAMPLE_FMT_S16: - specs.format = AUD_FORMAT_S16; - break; - case AV_SAMPLE_FMT_S32: - specs.format = AUD_FORMAT_S32; - break; - case AV_SAMPLE_FMT_FLT: - specs.format = AUD_FORMAT_FLOAT32; - break; - case AV_SAMPLE_FMT_DBL: - specs.format = AUD_FORMAT_FLOAT64; - break; - default: - return -31415; + case AV_SAMPLE_FMT_U8: + specs.format = AUD_FORMAT_U8; + break; + case AV_SAMPLE_FMT_S16: + specs.format = AUD_FORMAT_S16; + break; + case AV_SAMPLE_FMT_S32: + specs.format = AUD_FORMAT_S32; + break; + case AV_SAMPLE_FMT_FLT: + specs.format = AUD_FORMAT_FLOAT32; + break; + case AV_SAMPLE_FMT_DBL: + specs.format = AUD_FORMAT_FLOAT64; + break; + default: + return -31415; } specs.rate = rd->ffcodecdata.audio_mixrate; diff --git a/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.h b/source/blender/blenlib/BLI_alloca.h index bb5c5e220a3..b93f5b7123e 100644 --- a/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.h +++ b/source/blender/blenlib/BLI_alloca.h @@ -15,27 +15,32 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * * ***** END GPL LICENSE BLOCK ***** */ -/** \file GPC_RawLogoArrays.h - * \ingroup player +#ifndef __BLI_ALLOCA_H__ + +/** \file BLI_alloca.h + * \ingroup bli + * + * Defines alloca and utility macro BLI_array_alloca */ -#ifndef __GPC_RAWLOGOARRAYS_H__ -#define __GPC_RAWLOGOARRAYS_H__ +/* BLI_array_alloca / alloca */ +#ifdef _MSC_VER +# define alloca _alloca +#endif + +#if defined(__MINGW32__) +# include <malloc.h> /* mingw needs for alloca() */ +#endif -void GetRawBlenderLogo(unsigned char **data, int *width, int *height); -void GetRawBlender3DLogo(unsigned char **data, int *width, int *height); -#if 0 -void GetRawNaNLogo(unsigned char **data, int *width, int *height); +#if defined(__GNUC__) || defined(__clang__) +#define BLI_array_alloca(arr, realsize) \ + (typeof(arr))alloca(sizeof(*arr) * (realsize)) +#else +#define BLI_array_alloca(arr, realsize) \ + alloca(sizeof(*arr) * (realsize)) #endif -#endif /* __GPC_RAWLOGOARRAYS_H__ */ +#endif /* __BLI_ALLOCA_H__ */ diff --git a/source/blender/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h index 3fb50afdeac..ef5cb8bde04 100644 --- a/source/blender/blenlib/BLI_array.h +++ b/source/blender/blenlib/BLI_array.h @@ -40,11 +40,11 @@ #define _bli_array_totalsize_dynamic(arr) ( \ ((arr) == NULL) ? \ 0 : \ - MEM_allocN_len(arr) / sizeof(*arr) \ + MEM_allocN_len(arr) / sizeof(*(arr)) \ ) #define _bli_array_totalsize_static(arr) \ - (sizeof(_##arr##_static) / sizeof(*arr)) + (sizeof(_##arr##_static) / sizeof(*(arr))) #define _bli_array_totalsize(arr) ( \ (size_t) \ @@ -66,8 +66,9 @@ void _bli_array_grow_func(void **arr_p, const void *arr_static, /* -------------------------------------------------------------------- */ /* public defines */ +/* use sizeof(*(arr)) to ensure the array exists and is an array */ #define BLI_array_declare(arr) \ - int _##arr##_count = 0; \ + int _##arr##_count = ((void)(sizeof(*(arr))), 0); \ void *_##arr##_static = NULL /* this will use stack space, up to maxstatic array elements, before @@ -95,7 +96,7 @@ void _bli_array_grow_func(void **arr_p, const void *arr_static, (LIKELY(_bli_array_totalsize(arr) >= _##arr##_count + num) ? \ (void)0 /* do nothing */ : \ _bli_array_grow_func((void **)&(arr), _##arr##_static, \ - sizeof(*arr), _##arr##_count, num, \ + sizeof(*(arr)), _##arr##_count, num, \ "BLI_array." #arr), \ (void)0) /* msvc2008 needs this */ \ ), \ @@ -148,8 +149,8 @@ void _bli_array_grow_func(void **arr_p, const void *arr_static, /* only to prevent unused warnings */ #define BLI_array_fake_user(arr) \ - (void)_##arr##_count, \ - (void)_##arr##_static + ((void)_##arr##_count, \ + (void)_##arr##_static) /* -------------------------------------------------------------------- */ @@ -161,7 +162,7 @@ void _bli_array_grow_func(void **arr_p, const void *arr_static, * but use when the max size is known ahead of time */ #define BLI_array_fixedstack_declare(arr, maxstatic, realsize, allocstr) \ char _##arr##_static[maxstatic * sizeof(*(arr))]; \ - const int _##arr##_is_static = ((void *)_##arr##_static) != ( \ + const bool _##arr##_is_static = ((void *)_##arr##_static) != ( \ arr = ((realsize) <= maxstatic) ? \ (void *)_##arr##_static : \ MEM_mallocN(sizeof(*(arr)) * (realsize), allocstr) \ @@ -172,31 +173,4 @@ void _bli_array_grow_func(void **arr_p, const void *arr_static, MEM_freeN(arr); \ } (void)0 - -/* alloca */ -#ifdef _MSC_VER -# define alloca _alloca -#endif - -#if defined(__MINGW32__) -# include <malloc.h> /* mingw needs for alloca() */ -#endif - -#if defined(__GNUC__) || defined(__clang__) -#define BLI_array_alloca(arr, realsize) \ - (typeof(arr))alloca(sizeof(*arr) * (realsize)) - -#define BLI_array_alloca_and_count(arr, realsize) \ - (typeof(arr))alloca(sizeof(*arr) * (realsize)); \ - const int _##arr##_count = (realsize) - -#else -#define BLI_array_alloca(arr, realsize) \ - alloca(sizeof(*arr) * (realsize)) - -#define BLI_array_alloca_and_count(arr, realsize) \ - alloca(sizeof(*arr) * (realsize)); \ - const int _##arr##_count = (realsize) -#endif - #endif /* __BLI_ARRAY_H__ */ diff --git a/source/blender/blenlib/BLI_bitmap.h b/source/blender/blenlib/BLI_bitmap.h index 02e5d6bd797..ca98d28cc40 100644 --- a/source/blender/blenlib/BLI_bitmap.h +++ b/source/blender/blenlib/BLI_bitmap.h @@ -26,7 +26,7 @@ #ifndef __BLI_BITMAP_H__ #define __BLI_BITMAP_H__ -typedef unsigned int *BLI_bitmap; +typedef unsigned int BLI_bitmap; /* warning: the bitmap does not keep track of its own size or check * for out-of-bounds access */ @@ -48,7 +48,7 @@ typedef unsigned int *BLI_bitmap; /* allocate memory for a bitmap with '_tot' bits; free * with MEM_freeN() */ #define BLI_BITMAP_NEW(_tot, _alloc_string) \ - ((BLI_bitmap)MEM_callocN(BLI_BITMAP_SIZE(_tot), \ + ((BLI_bitmap *)MEM_callocN(BLI_BITMAP_SIZE(_tot), \ _alloc_string)) /* get the value of a single bit at '_index' */ diff --git a/source/blender/blenlib/BLI_buffer.h b/source/blender/blenlib/BLI_buffer.h index fe835e7cadc..879ef869653 100644 --- a/source/blender/blenlib/BLI_buffer.h +++ b/source/blender/blenlib/BLI_buffer.h @@ -53,7 +53,7 @@ enum { #define BLI_buffer_declare_static(type_, name_, flag_, static_count_) \ char name_ ## user; /* warn for free only */ \ - type_ *name_ ## _static_[static_count_]; \ + type_ name_ ## _static_[static_count_]; \ BLI_Buffer name_ = { \ /* clear the static memory if this is a calloc'd array */ \ ((void)((flag_ & BLI_BUFFER_USE_CALLOC) ? \ diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index 930715b4bc6..3ad0e18c8d7 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -73,7 +73,7 @@ void *BLI_ghash_lookup(GHash *gh, const void *key); bool BLI_ghash_remove(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp); void BLI_ghash_clear(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp); void *BLI_ghash_pop(GHash *gh, void *key, GHashKeyFreeFP keyfreefp); -bool BLI_ghash_haskey(GHash *gh, const void *key); +bool BLI_ghash_haskey(GHash *gh, const void *key); int BLI_ghash_size(GHash *gh); /* *** */ diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h index 767f61b29dd..4c7ddf7ba66 100644 --- a/source/blender/blenlib/BLI_listbase.h +++ b/source/blender/blenlib/BLI_listbase.h @@ -72,7 +72,7 @@ void BLI_freelinkN(struct ListBase *listbase, void *vlink); void BLI_movelisttolist(struct ListBase *dst, struct ListBase *src); void BLI_duplicatelist(struct ListBase *dst, const struct ListBase *src); void BLI_reverselist(struct ListBase *lb); -void BLI_rotatelist(struct ListBase *lb, LinkData *vlink); +void BLI_rotatelist(struct ListBase *lb, void *vlink); /* create a generic list node containing link to provided data */ struct LinkData *BLI_genericNodeN(void *data); diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 96652c0e78d..f9671f57acd 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -75,7 +75,8 @@ void closest_to_line_segment_v2(float closest[2], const float p[2], const float float dist_to_plane_normalized_v3(const float p[3], const float plane_co[3], const float plane_no_unit[3]); float dist_to_plane_v3(const float p[3], const float plane_co[3], const float plane_no[3]); -float dist_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]); +float dist_squared_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]); +float dist_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]); float dist_to_line_v3(const float p[3], const float l1[3], const float l2[3]); float closest_to_line_v3(float r[3], const float p[3], const float l1[3], const float l2[3]); float closest_to_line_v2(float r[2], const float p[2], const float l1[2], const float l2[2]); diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h index 723122d7814..c305cc9a030 100644 --- a/source/blender/blenlib/BLI_math_matrix.h +++ b/source/blender/blenlib/BLI_math_matrix.h @@ -133,12 +133,12 @@ void normalize_m4_m4(float R[4][4], float A[4][4]); void orthogonalize_m3(float R[3][3], int axis); void orthogonalize_m4(float R[4][4], int axis); -int is_orthogonal_m3(float mat[3][3]); -int is_orthogonal_m4(float mat[4][4]); -int is_orthonormal_m3(float mat[3][3]); -int is_orthonormal_m4(float mat[4][4]); +bool is_orthogonal_m3(float mat[3][3]); +bool is_orthogonal_m4(float mat[4][4]); +bool is_orthonormal_m3(float mat[3][3]); +bool is_orthonormal_m4(float mat[4][4]); -int is_uniform_scaled_m3(float mat[3][3]); +bool is_uniform_scaled_m3(float mat[3][3]); void adjoint_m2_m2(float R[2][2], float A[2][2]); void adjoint_m3_m3(float R[3][3], float A[3][3]); @@ -175,7 +175,7 @@ void mat4_to_size(float r[3], float M[4][4]); void translate_m4(float mat[4][4], float tx, float ty, float tz); void rotate_m4(float mat[4][4], const char axis, const float angle); void rotate_m2(float mat[2][2], const float angle); - +void transform_pivot_set_m4(float mat[4][4], const float pivot[3]); void mat3_to_rot_size(float rot[3][3], float size[3], float mat3[3][3]); void mat4_to_loc_rot_size(float loc[3], float rot[3][3], float size[3], float wmat[4][4]); @@ -194,8 +194,11 @@ void loc_axisangle_size_to_mat4(float R[4][4], void blend_m3_m3m3(float R[3][3], float A[3][3], float B[3][3], const float t); void blend_m4_m4m4(float R[4][4], float A[4][4], float B[4][4], const float t); -int is_negative_m3(float mat[3][3]); -int is_negative_m4(float mat[4][4]); +bool is_negative_m3(float mat[3][3]); +bool is_negative_m4(float mat[4][4]); + +bool is_zero_m3(float mat[3][3]); +bool is_zero_m4(float mat[4][4]); /*********************************** Other ***********************************/ diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 0df4de1f829..38b377c640e 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -116,6 +116,9 @@ MINLINE void mul_v3_v3v3(float r[3], const float a[3], const float b[3]); MINLINE void mul_v4_fl(float r[4], float f); MINLINE void mul_v4_v4fl(float r[3], const float a[3], float f); MINLINE float mul_project_m4_v3_zfac(float mat[4][4], const float co[3]); +MINLINE float dot_m3_v3_row_x(float M[3][3], const float a[3]); +MINLINE float dot_m3_v3_row_y(float M[3][3], const float a[3]); +MINLINE float dot_m3_v3_row_z(float M[3][3], const float a[3]); MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f); MINLINE void madd_v3_v3v3(float r[3], const float a[3], const float b[3]); @@ -240,6 +243,7 @@ void rotate_normalized_v3_v3v3fl(float v[3], const float p[3], const float axis[ void print_v2(const char *str, const float a[2]); void print_v3(const char *str, const float a[3]); void print_v4(const char *str, const float a[4]); +void print_vn(const char *str, const float v[], const int n); MINLINE void normal_short_to_float_v3(float r[3], const short n[3]); MINLINE void normal_float_to_short_v3(short r[3], const float n[3]); diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index e0a34e35acc..cb812fe8595 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -89,7 +89,18 @@ void BLI_make_existing_file(const char *name); void BLI_split_dirfile(const char *string, char *dir, char *file, const size_t dirlen, const size_t filelen); void BLI_split_dir_part(const char *string, char *dir, const size_t dirlen); void BLI_split_file_part(const char *string, char *file, const size_t filelen); -void BLI_join_dirfile(char *string, const size_t maxlen, const char *dir, const char *file); +void BLI_path_append(char *__restrict dst, const size_t maxlen, + const char *__restrict file) +#ifdef __GNUC__ +__attribute__((nonnull)) +#endif +; +void BLI_join_dirfile(char *__restrict string, const size_t maxlen, + const char *__restrict dir, const char *__restrict file) +#ifdef __GNUC__ +__attribute__((nonnull)) +#endif +; const char *BLI_path_basename(const char *path); typedef enum bli_rebase_state { diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index c6f0bc49c9b..4816ac19fce 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -86,21 +86,21 @@ __attribute__((nonnull)) #endif ; -char *BLI_replacestr(char *__restrict str, const char *__restrict oldText, const char *__restrict newText) +char *BLI_replacestrN(const char *__restrict str, const char *__restrict substr_old, const char *__restrict substr_new) #ifdef __GNUC__ __attribute__((warn_unused_result)) __attribute__((nonnull)) #endif ; -size_t BLI_snprintf(char *__restrict buffer, size_t len, const char *__restrict format, ...) +size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format, ...) #ifdef __GNUC__ __attribute__ ((format(printf, 3, 4))) __attribute__((nonnull)) #endif ; -size_t BLI_vsnprintf(char *__restrict buffer, size_t count, const char *__restrict format, va_list arg) +size_t BLI_vsnprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format, va_list arg) #ifdef __GNUC__ __attribute__ ((format(printf, 3, 0))) #endif diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h index d20cbd2a91c..db32190494a 100644 --- a/source/blender/blenlib/BLI_string_utf8.h +++ b/source/blender/blenlib/BLI_string_utf8.h @@ -31,41 +31,57 @@ extern "C" { #endif -char *BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy); -char *BLI_strncat_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy); -int BLI_utf8_invalid_byte(const char *str, int length); -int BLI_utf8_invalid_strip(char *str, int length); +#ifdef __GNUC__ +# define ATTR_NONULL __attribute__((nonnull)) +# define ATTR_NONULL_FIRST __attribute__((nonnull(1))) +# define ATTR_UNUSED_RESULT __attribute__((warn_unused_result)) +#else +# define ATTR_NONULL +# define ATTR_NONULL_FIRST +# define ATTR_UNUSED_RESULT +#endif + +char *BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONULL; +char *BLI_strncat_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONULL; +int BLI_utf8_invalid_byte(const char *str, int length) ATTR_NONULL; +int BLI_utf8_invalid_strip(char *str, int length) ATTR_NONULL; -int BLI_str_utf8_size(const char *p); /* warning, can return -1 on bad chars */ -int BLI_str_utf8_size_safe(const char *p); +int BLI_str_utf8_size(const char *p) ATTR_NONULL; /* warning, can return -1 on bad chars */ +int BLI_str_utf8_size_safe(const char *p) ATTR_NONULL; /* copied from glib */ -unsigned int BLI_str_utf8_as_unicode(const char *p); -unsigned int BLI_str_utf8_as_unicode_and_size(const char *__restrict p, size_t *__restrict index); -unsigned int BLI_str_utf8_as_unicode_and_size_safe(const char *__restrict p, size_t *__restrict index); -unsigned int BLI_str_utf8_as_unicode_step(const char *__restrict p, size_t *__restrict index); +unsigned int BLI_str_utf8_as_unicode(const char *p) ATTR_NONULL; +unsigned int BLI_str_utf8_as_unicode_and_size(const char *__restrict p, size_t *__restrict index) ATTR_NONULL; +unsigned int BLI_str_utf8_as_unicode_and_size_safe(const char *__restrict p, size_t *__restrict index) ATTR_NONULL; +unsigned int BLI_str_utf8_as_unicode_step(const char *__restrict p, size_t *__restrict index) ATTR_NONULL; size_t BLI_str_utf8_from_unicode(unsigned int c, char *outbuf); -char *BLI_str_find_prev_char_utf8(const char *str, const char *p); -char *BLI_str_find_next_char_utf8(const char *p, const char *end); -char *BLI_str_prev_char_utf8(const char *p); +char *BLI_str_find_prev_char_utf8(const char *str, const char *p) ATTR_NONULL; +char *BLI_str_find_next_char_utf8(const char *p, const char *end) ATTR_NONULL_FIRST; +char *BLI_str_prev_char_utf8(const char *p) ATTR_NONULL; /* wchar_t functions, copied from blenders own font.c originally */ -size_t BLI_wstrlen_utf8(const wchar_t *src); -size_t BLI_strlen_utf8(const char *strc); -size_t BLI_strnlen_utf8(const char *start, const size_t maxlen); -size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst, const wchar_t *__restrict src, const size_t maxcpy); -size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst, const char *__restrict src, const size_t maxcpy); +size_t BLI_wstrlen_utf8(const wchar_t *src) ATTR_NONULL; +size_t BLI_strlen_utf8_ex(const char *strc, size_t *r_len_bytes) ATTR_NONULL; +size_t BLI_strlen_utf8(const char *strc) ATTR_NONULL; +size_t BLI_strnlen_utf8_ex(const char *strc, const size_t maxlen, size_t *r_len_bytes) ATTR_NONULL; +size_t BLI_strnlen_utf8(const char *strc, const size_t maxlen) ATTR_NONULL; +size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst, const wchar_t *__restrict src, const size_t maxcpy) ATTR_NONULL; +size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst, const char *__restrict src, const size_t maxcpy) ATTR_NONULL; /* count columns that character/string occupies, based on wcwidth.c */ int BLI_wcwidth(wchar_t ucs); -int BLI_wcswidth(const wchar_t *pwcs, size_t n); -int BLI_str_utf8_char_width(const char *p); /* warning, can return -1 on bad chars */ -int BLI_str_utf8_char_width_safe(const char *p); +int BLI_wcswidth(const wchar_t *pwcs, size_t n) ATTR_NONULL; +int BLI_str_utf8_char_width(const char *p) ATTR_NONULL; /* warning, can return -1 on bad chars */ +int BLI_str_utf8_char_width_safe(const char *p) ATTR_NONULL; #define BLI_UTF8_MAX 6 /* mem */ #define BLI_UTF8_WIDTH_MAX 2 /* columns */ #define BLI_UTF8_ERR ((unsigned int)-1) +#undef ATTR_NONULL +#undef ATTR_NONULL_FIRST +#undef ATTR_UNUSED_RESULT + #ifdef __cplusplus } #endif diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h index 331cac3ed76..154986936a2 100644 --- a/source/blender/blenlib/BLI_threads.h +++ b/source/blender/blenlib/BLI_threads.h @@ -131,6 +131,18 @@ void BLI_rw_mutex_free(ThreadRWMutex *mutex); void BLI_rw_mutex_lock(ThreadRWMutex *mutex, int mode); void BLI_rw_mutex_unlock(ThreadRWMutex *mutex); +/* Ticket Mutex Lock + * + * This is a 'fair' mutex in that it will grant the lock to the first thread + * that requests it. */ + +typedef struct TicketMutex TicketMutex; + +TicketMutex *BLI_ticket_mutex_alloc(void); +void BLI_ticket_mutex_free(TicketMutex *ticket); +void BLI_ticket_mutex_lock(TicketMutex *ticket); +void BLI_ticket_mutex_unlock(TicketMutex *ticket); + /* ThreadedWorker * * A simple tool for dispatching work to a limited number of threads diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 1d94ca9afbc..b6b69116e67 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -99,6 +99,7 @@ set(SRC intern/winstuff.c BLI_args.h + BLI_alloca.h BLI_array.h BLI_bitmap.h BLI_blenlib.h diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index d30d3f3d256..14dfbcffebe 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -34,6 +34,7 @@ #include <string.h> #include <stdlib.h> +#include <limits.h> #include "MEM_guardedalloc.h" @@ -178,7 +179,8 @@ void BLI_ghash_clear(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfree gh->nentries = 0; gh->nbuckets = hashsizes[gh->cursize]; - gh->buckets = MEM_recallocN(gh->buckets, gh->nbuckets * sizeof(*gh->buckets)); + MEM_freeN(gh->buckets); + gh->buckets = MEM_callocN(gh->nbuckets * sizeof(*gh->buckets), "buckets"); } /* same as above but return the value, @@ -255,22 +257,14 @@ void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreef GHashIterator *BLI_ghashIterator_new(GHash *gh) { GHashIterator *ghi = MEM_mallocN(sizeof(*ghi), "ghash iterator"); - ghi->gh = gh; - ghi->curEntry = NULL; - ghi->curBucket = (unsigned int)-1; - while (!ghi->curEntry) { - ghi->curBucket++; - if (ghi->curBucket == ghi->gh->nbuckets) - break; - ghi->curEntry = ghi->gh->buckets[ghi->curBucket]; - } + BLI_ghashIterator_init(ghi, gh); return ghi; } void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh) { ghi->gh = gh; ghi->curEntry = NULL; - ghi->curBucket = (unsigned int)-1; + ghi->curBucket = UINT_MAX; /* wraps to zero */ while (!ghi->curEntry) { ghi->curBucket++; if (ghi->curBucket == ghi->gh->nbuckets) diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index cd5c961d982..a4c72aa26b0 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -72,7 +72,7 @@ struct BVHTree { /* optimization, ensure we stay small */ BLI_STATIC_ASSERT((sizeof(void *) == 8 && sizeof(BVHTree) <= 48) || (sizeof(void *) == 4 && sizeof(BVHTree) <= 32), - "over sized"); + "over sized") typedef struct BVHOverlapData { BVHTree *tree1, *tree2; @@ -603,6 +603,7 @@ static void build_implicit_tree_helper(BVHTree *tree, BVHBuildHelper *data) data->branches_on_level[0] = 1; /* We could stop the loop first (but I am lazy to find out when) */ + /* note: this often causes integer overflow, may be worth avoiding? - campbell */ for (depth = 1; depth < 32; depth++) { data->branches_on_level[depth] = data->branches_on_level[depth - 1] * data->tree_type; data->leafs_per_child[depth] = data->leafs_per_child[depth - 1] / data->tree_type; diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index 87179a93e83..217a4b9d266 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -437,19 +437,22 @@ void *BLI_mempool_iterstep(BLI_mempool_iter *iter) void BLI_mempool_destroy(BLI_mempool *pool) { BLI_mempool_chunk *mpchunk = NULL; + BLI_mempool_chunk *mpchunk_next; if (pool->flag & BLI_MEMPOOL_SYSMALLOC) { - for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { + for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk_next) { + mpchunk_next = mpchunk->next; free(mpchunk->data); + free(mpchunk); } - BLI_freelist(&(pool->chunks)); free(pool); } else { - for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) { + for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk_next) { + mpchunk_next = mpchunk->next; MEM_freeN(mpchunk->data); + MEM_freeN(mpchunk); } - BLI_freelistN(&(pool->chunks)); MEM_freeN(pool); } } diff --git a/source/blender/blenlib/intern/DLRB_tree.c b/source/blender/blenlib/intern/DLRB_tree.c index cb47f07574d..31b4b7cd4a5 100644 --- a/source/blender/blenlib/intern/DLRB_tree.c +++ b/source/blender/blenlib/intern/DLRB_tree.c @@ -539,9 +539,8 @@ DLRBT_Node *BLI_dlrbTree_add(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb, parNode->left = node; node->parent = parNode; + break; } - break; - case 1: /* add new node as right child */ { node = new_cb(data); @@ -549,15 +548,14 @@ DLRBT_Node *BLI_dlrbTree_add(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb, parNode->right = node; node->parent = parNode; + break; } - break; - default: /* update the duplicate node as appropriate */ { if (update_cb) update_cb(parNode, data); + break; } - break; } } else { diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 26fe0f21cd5..4809ba59aaf 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -199,7 +199,7 @@ bool BLI_file_touch(const char *file) { FILE *f = BLI_fopen(file, "r+b"); if (f != NULL) { - char c = getc(f); + int c = getc(f); rewind(f); putc(c, f); } @@ -445,7 +445,7 @@ static void join_dirfile_alloc(char **dst, size_t *alloc_len, const char *dir, c size_t len = strlen(dir) + strlen(file) + 1; if (*dst == NULL) - *dst = MEM_callocN(len + 1, "join_dirfile_alloc path"); + *dst = MEM_mallocN(len + 1, "join_dirfile_alloc path"); else if (*alloc_len < len) *dst = MEM_reallocN(*dst, len + 1); @@ -911,18 +911,15 @@ void BLI_dir_create_recursive(const char *dirname) char static_buf[MAXPATHLEN]; #endif char *tmp; - int needs_free; if (BLI_exists(dirname)) return; #ifdef MAXPATHLEN size = MAXPATHLEN; tmp = static_buf; - needs_free = 0; #else size = strlen(dirname) + 1; - tmp = MEM_callocN(size, "BLI_dir_create_recursive tmp"); - needs_free = 1; + tmp = MEM_callocN(size, __func__); #endif BLI_strncpy(tmp, dirname, size); @@ -934,8 +931,9 @@ void BLI_dir_create_recursive(const char *dirname) BLI_dir_create_recursive(tmp); } - if (needs_free) - MEM_freeN(tmp); +#ifndef MAXPATHLEN + MEM_freeN(tmp); +#endif mkdir(dirname, 0777); } diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index f060a2771fe..ded4f31ae05 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -557,14 +557,14 @@ void BLI_reverselist(ListBase *lb) /** * \param vlink Link to make first. */ -void BLI_rotatelist(ListBase *lb, LinkData *vlink) +void BLI_rotatelist(ListBase *lb, void *vlink) { /* make circular */ ((LinkData *)lb->first)->prev = lb->last; ((LinkData *)lb->last)->next = lb->first; lb->first = vlink; - lb->last = vlink->prev; + lb->last = ((LinkData *)vlink)->prev; ((LinkData *)lb->first)->prev = NULL; ((LinkData *)lb->last)->next = NULL; diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index 3f802c492c2..8cfe4706937 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -150,6 +150,7 @@ void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr, in break; default: assert(!"invalid colorspace"); + break; } *ly = y; @@ -183,7 +184,8 @@ void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb, in b = y + 1.772f * cb - 226.816f; break; default: - assert(!"invalid colorspace"); + BLI_assert(0); + break; } *lr = r / 255.0f; *lg = g / 255.0f; diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index ddf1c598a1c..0e7ff521ce8 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -324,21 +324,26 @@ float dist_to_plane_v3(const float p[3], const float plane_co[3], const float pl return line_point_factor_v3(p, plane_co, plane_co_other); } -/* distance v1 to line-piece v2-v3 in 3D */ -float dist_to_line_segment_v3(const float v1[3], const float v2[3], const float v3[3]) +/* distance v1 to line-piece l1-l2 in 3D */ +float dist_squared_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]) { float closest[3]; - closest_to_line_segment_v3(closest, v1, v2, v3); + closest_to_line_segment_v3(closest, p, l1, l2); - return len_v3v3(closest, v1); + return len_squared_v3v3(closest, p); +} + +float dist_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]) +{ + return sqrtf(dist_squared_to_line_segment_v3(p, l1, l2)); } -float dist_to_line_v3(const float v1[3], const float v2[3], const float v3[3]) +float dist_to_line_v3(const float v1[3], const float l1[3], const float l2[3]) { float closest[3]; - closest_to_line_v3(closest, v1, v2, v3); + closest_to_line_v3(closest, v1, l1, l2); return len_v3v3(closest, v1); } @@ -489,6 +494,7 @@ int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[ float a1, a2, b1, b2, c1, c2, d; float u, v; const float eps = 0.000001f; + const float eps_sq = eps * eps; a1 = v2[0] - v1[0]; b1 = v4[0] - v3[0]; @@ -505,8 +511,8 @@ int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[ float a[2], b[2], c[2]; float u2; - if (len_v2v2(v1, v2) == 0.0f) { - if (len_v2v2(v3, v4) > eps) { + if (equals_v2v2(v1, v2)) { + if (len_squared_v2v2(v3, v4) > eps_sq) { /* use non-point segment as basis */ SWAP(const float *, v1, v3); SWAP(const float *, v2, v4); @@ -1452,7 +1458,7 @@ bool isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3 int isect_line_line_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3], float i1[3], float i2[3]) { float a[3], b[3], c[3], ab[3], cb[3], dir1[3], dir2[3]; - float d; + float d, div; sub_v3_v3v3(c, v3, v1); sub_v3_v3v3(a, v2, v1); @@ -1468,12 +1474,17 @@ int isect_line_line_v3(const float v1[3], const float v2[3], const float v3[3], cross_v3_v3v3(ab, a, b); d = dot_v3v3(c, ab); + div = dot_v3v3(ab, ab); + /* test zero length line */ + if (UNLIKELY(div == 0.0f)) { + return 0; + } /* test if the two lines are coplanar */ - if (d > -0.000001f && d < 0.000001f) { + else if (d > -0.000001f && d < 0.000001f) { cross_v3_v3v3(cb, c, b); - mul_v3_fl(a, dot_v3v3(cb, ab) / dot_v3v3(ab, ab)); + mul_v3_fl(a, dot_v3v3(cb, ab) / div); add_v3_v3v3(i1, v1, a); copy_v3_v3(i2, i1); @@ -1518,7 +1529,7 @@ bool isect_line_line_strict_v3(const float v1[3], const float v2[3], float vi[3], float *r_lambda) { float a[3], b[3], c[3], ab[3], cb[3], ca[3], dir1[3], dir2[3]; - float d; + float d, div; sub_v3_v3v3(c, v3, v1); sub_v3_v3v3(a, v2, v1); @@ -1534,15 +1545,20 @@ bool isect_line_line_strict_v3(const float v1[3], const float v2[3], cross_v3_v3v3(ab, a, b); d = dot_v3v3(c, ab); + div = dot_v3v3(ab, ab); + /* test zero length line */ + if (UNLIKELY(div == 0.0f)) { + return 0; + } /* test if the two lines are coplanar */ - if (d > -0.000001f && d < 0.000001f) { + else if (d > -0.000001f && d < 0.000001f) { float f1, f2; cross_v3_v3v3(cb, c, b); cross_v3_v3v3(ca, c, a); - f1 = dot_v3v3(cb, ab) / dot_v3v3(ab, ab); - f2 = dot_v3v3(ca, ab) / dot_v3v3(ab, ab); + f1 = dot_v3v3(cb, ab) / div; + f2 = dot_v3v3(ca, ab) / div; if (f1 >= 0 && f1 <= 1 && f2 >= 0 && f2 <= 1) @@ -2588,45 +2604,62 @@ static float mean_value_half_tan_v2(const float v1[2], const float v2[2], const void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[3]) { - /* TODO: t1 and t2 overlap each iter, we could call this only once per iter and reuse previous value */ - float totweight, t1, t2, len, *vmid, *vprev, *vnext; - int i, i_next, i_curr; + const float eps = 0.00001f; /* take care, low values cause [#36105] */ + const float eps_sq = eps * eps; + float *v_curr, *v_next; + float ht_prev, ht; /* half tangents */ + float totweight = 0.0f; + int i = 0; + bool vert_interp = false; bool edge_interp = false; - totweight = 0.0f; + v_curr = v[0]; + v_next = v[1]; - for (i = 0; i < n; i++) { - i_curr = i; - i_next = (i == n - 1) ? 0 : i + 1; + ht_prev = mean_value_half_tan_v3(co, v[n - 1], v_curr); - vmid = v[i]; - vprev = (i == 0) ? v[n - 1] : v[i - 1]; - vnext = v[i_next]; + while (i < n) { + const float len_sq = len_squared_v3v3(co, v_curr); /* Mark Mayer et al algorithm that is used here does not operate well if vertex is close * to borders of face. In that case, do simple linear interpolation between the two edge vertices */ - if (dist_to_line_segment_v3(co, vmid, vnext) < 10 * FLT_EPSILON) { + if (len_sq < eps_sq) { + vert_interp = true; + break; + } + else if (dist_squared_to_line_segment_v3(co, v_curr, v_next) < eps_sq) { edge_interp = true; break; } - t1 = mean_value_half_tan_v3(co, vprev, vmid); - t2 = mean_value_half_tan_v3(co, vmid, vnext); - - len = len_v3v3(co, vmid); - w[i] = (len != 0.0f) ? (t1 + t2) / len: 0.0f; + ht = mean_value_half_tan_v3(co, v_curr, v_next); + w[i] = (ht_prev + ht) / sqrtf(len_sq); totweight += w[i]; + + /* step */ + i++; + v_curr = v_next; + v_next = v[(i + 1) % n]; + + ht_prev = ht; } - if (edge_interp) { - float len_curr = len_v3v3(co, vmid); - float len_next = len_v3v3(co, vnext); + if (vert_interp) { + const int i_curr = i; + for (i = 0; i < n; i++) + w[i] = 0.0; + w[i_curr] = 1.0f; + } + else if (edge_interp) { + const int i_curr = i; + float len_curr = len_v3v3(co, v_curr); + float len_next = len_v3v3(co, v_next); float edge_len = len_curr + len_next; for (i = 0; i < n; i++) w[i] = 0.0; w[i_curr] = len_next / edge_len; - w[i_next] = len_curr / edge_len; + w[(i_curr + 1) % n] = len_curr / edge_len; } else { if (totweight != 0.0f) { @@ -2640,45 +2673,62 @@ void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[ void interp_weights_poly_v2(float *w, float v[][2], const int n, const float co[2]) { - /* TODO: t1 and t2 overlap each iter, we could call this only once per iter and reuse previous value */ - float totweight, t1, t2, len, *vmid, *vprev, *vnext; - int i, i_next, i_curr; + const float eps = 0.00001f; /* take care, low values cause [#36105] */ + const float eps_sq = eps * eps; + float *v_curr, *v_next; + float ht_prev, ht; /* half tangents */ + float totweight = 0.0f; + int i = 0; + bool vert_interp = false; bool edge_interp = false; - totweight = 0.0f; + v_curr = v[0]; + v_next = v[1]; - for (i = 0; i < n; i++) { - i_curr = i; - i_next = (i == n - 1) ? 0 : i + 1; + ht_prev = mean_value_half_tan_v2(co, v[n - 1], v_curr); - vmid = v[i]; - vprev = (i == 0) ? v[n - 1] : v[i - 1]; - vnext = v[i_next]; + while (i < n) { + const float len_sq = len_squared_v2v2(co, v_curr); /* Mark Mayer et al algorithm that is used here does not operate well if vertex is close * to borders of face. In that case, do simple linear interpolation between the two edge vertices */ - if (dist_to_line_segment_v2(co, vmid, vnext) < 10 * FLT_EPSILON) { + if (len_sq < eps_sq) { + vert_interp = true; + break; + } + else if (dist_squared_to_line_segment_v2(co, v_curr, v_next) < eps_sq) { edge_interp = true; break; } - t1 = mean_value_half_tan_v2(co, vprev, vmid); - t2 = mean_value_half_tan_v2(co, vmid, vnext); - - len = len_v2v2(co, vmid); - w[i] = (len != 0.0f) ? (t1 + t2) / len: 0.0f; + ht = mean_value_half_tan_v2(co, v_curr, v_next); + w[i] = (ht_prev + ht) / sqrtf(len_sq); totweight += w[i]; + + /* step */ + i++; + v_curr = v_next; + v_next = v[(i + 1) % n]; + + ht_prev = ht; } - if (edge_interp) { - float len_curr = len_v2v2(co, vmid); - float len_next = len_v2v2(co, vnext); + if (vert_interp) { + const int i_curr = i; + for (i = 0; i < n; i++) + w[i] = 0.0; + w[i_curr] = 1.0f; + } + else if (edge_interp) { + const int i_curr = i; + float len_curr = len_v2v2(co, v_curr); + float len_next = len_v2v2(co, v_next); float edge_len = len_curr + len_next; for (i = 0; i < n; i++) w[i] = 0.0; w[i_curr] = len_next / edge_len; - w[i_next] = len_curr / edge_len; + w[(i_curr + 1) % n] = len_curr / edge_len; } else { if (totweight != 0.0f) { diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 298abfa8c5e..99342c4d6dc 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -790,6 +790,7 @@ void orthogonalize_m3(float mat[3][3], int axis) normalize_v3(mat[2]); cross_v3_v3v3(mat[1], mat[2], mat[0]); } + break; case 1: if (dot_v3v3(mat[1], mat[0]) < 1) { cross_v3_v3v3(mat[2], mat[0], mat[1]); @@ -812,6 +813,7 @@ void orthogonalize_m3(float mat[3][3], int axis) normalize_v3(mat[0]); cross_v3_v3v3(mat[2], mat[0], mat[1]); } + break; case 2: if (dot_v3v3(mat[2], mat[0]) < 1) { cross_v3_v3v3(mat[1], mat[2], mat[0]); @@ -834,6 +836,10 @@ void orthogonalize_m3(float mat[3][3], int axis) normalize_v3(mat[0]); cross_v3_v3v3(mat[1], mat[2], mat[0]); } + break; + default: + BLI_assert(0); + break; } mul_v3_fl(mat[0], size[0]); mul_v3_fl(mat[1], size[1]); @@ -868,8 +874,8 @@ void orthogonalize_m4(float mat[4][4], int axis) normalize_v3(mat[2]); cross_v3_v3v3(mat[1], mat[2], mat[0]); } + break; case 1: - normalize_v3(mat[0]); if (dot_v3v3(mat[1], mat[0]) < 1) { cross_v3_v3v3(mat[2], mat[0], mat[1]); normalize_v3(mat[2]); @@ -891,6 +897,7 @@ void orthogonalize_m4(float mat[4][4], int axis) normalize_v3(mat[0]); cross_v3_v3v3(mat[2], mat[0], mat[1]); } + break; case 2: if (dot_v3v3(mat[2], mat[0]) < 1) { cross_v3_v3v3(mat[1], mat[2], mat[0]); @@ -913,13 +920,17 @@ void orthogonalize_m4(float mat[4][4], int axis) normalize_v3(mat[0]); cross_v3_v3v3(mat[1], mat[2], mat[0]); } + break; + default: + BLI_assert(0); + break; } mul_v3_fl(mat[0], size[0]); mul_v3_fl(mat[1], size[1]); mul_v3_fl(mat[2], size[2]); } -int is_orthogonal_m3(float m[3][3]) +bool is_orthogonal_m3(float m[3][3]) { int i, j; @@ -933,7 +944,7 @@ int is_orthogonal_m3(float m[3][3]) return 1; } -int is_orthogonal_m4(float m[4][4]) +bool is_orthogonal_m4(float m[4][4]) { int i, j; @@ -948,7 +959,7 @@ int is_orthogonal_m4(float m[4][4]) return 1; } -int is_orthonormal_m3(float m[3][3]) +bool is_orthonormal_m3(float m[3][3]) { if (is_orthogonal_m3(m)) { int i; @@ -963,7 +974,7 @@ int is_orthonormal_m3(float m[3][3]) return 0; } -int is_orthonormal_m4(float m[4][4]) +bool is_orthonormal_m4(float m[4][4]) { if (is_orthogonal_m4(m)) { int i; @@ -978,7 +989,7 @@ int is_orthonormal_m4(float m[4][4]) return 0; } -int is_uniform_scaled_m3(float m[3][3]) +bool is_uniform_scaled_m3(float m[3][3]) { const float eps = 1e-7; float t[3][3]; @@ -1207,16 +1218,19 @@ void mat4_to_size(float size[3], float mat[4][4]) float mat3_to_scale(float mat[3][3]) { /* unit length vector */ - float unit_vec[3] = {0.577350269189626f, 0.577350269189626f, 0.577350269189626f}; + float unit_vec[3]; + copy_v3_fl(unit_vec, 0.577350269189626f); mul_m3_v3(mat, unit_vec); return len_v3(unit_vec); } float mat4_to_scale(float mat[4][4]) { - float tmat[3][3]; - copy_m3_m4(tmat, mat); - return mat3_to_scale(tmat); + /* unit length vector */ + float unit_vec[3]; + copy_v3_fl(unit_vec, 0.577350269189626f); + mul_mat3_m4_v3(mat, unit_vec); + return len_v3(unit_vec); } void mat3_to_rot_size(float rot[3][3], float size[3], float mat3[3][3]) @@ -1360,6 +1374,28 @@ void rotate_m2(float mat[2][2], const float angle) mat[1][0] = -mat[0][1]; } +/** + * Scale or rotate around a pivot point, + * a convenience function to avoid having to do inline. + * + * Since its common to make a scale/rotation matrix that pivots around an arbitrary point. + * + * Typical use case is to make 3x3 matrix, copy to 4x4, then pass to this function. + */ +void transform_pivot_set_m4(float mat[4][4], const float pivot[3]) +{ + float tmat[4][4]; + + unit_m4(tmat); + + copy_v3_v3(tmat[3], pivot); + mul_m4_m4m4(mat, tmat, mat); + + /* invert the matrix */ + negate_v3(tmat[3]); + mul_m4_m4m4(mat, mat, tmat); +} + void blend_m3_m3m3(float out[3][3], float dst[3][3], float src[3][3], const float srcweight) { float srot[3][3], drot[3][3]; @@ -1405,20 +1441,34 @@ void blend_m4_m4m4(float out[4][4], float dst[4][4], float src[4][4], const floa loc_quat_size_to_mat4(out, floc, fquat, fsize); } -int is_negative_m3(float mat[3][3]) +bool is_negative_m3(float mat[3][3]) { float vec[3]; cross_v3_v3v3(vec, mat[0], mat[1]); return (dot_v3v3(vec, mat[2]) < 0.0f); } -int is_negative_m4(float mat[4][4]) +bool is_negative_m4(float mat[4][4]) { float vec[3]; cross_v3_v3v3(vec, mat[0], mat[1]); return (dot_v3v3(vec, mat[2]) < 0.0f); } +bool is_zero_m3(float mat[3][3]) +{ + return (is_zero_v3(mat[0]) && + is_zero_v3(mat[1]) && + is_zero_v3(mat[2])); +} +bool is_zero_m4(float mat[4][4]) +{ + return (is_zero_v4(mat[0]) && + is_zero_v4(mat[1]) && + is_zero_v4(mat[2]) && + is_zero_v4(mat[3])); +} + /* make a 4x4 matrix out of 3 transform components */ /* matrices are made in the order: scale * rot * loc */ /* TODO: need to have a version that allows for rotation order... */ diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 96664b776f0..9fd8c479d6e 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -857,7 +857,8 @@ void single_axis_angle_to_mat3(float mat[3][3], const char axis, const float ang mat[2][2] = 1.0f; break; default: - assert(0); + BLI_assert(0); + break; } } @@ -1816,7 +1817,7 @@ static int _axis_convert_lut[23][24] = { {0x408, 0x810, 0xA20, 0x228, 0x081, 0x891, 0x699, 0x2A9, 0x102, 0x50A, 0x71A, 0xB22, 0x4CB, 0x8D3, 0xAE3, 0x2EB, 0x144, 0x954, 0x75C, 0x36C, 0x045, 0x44D, 0x65D, 0xA65}, - }; +}; // _axis_convert_num = {'X': 0, 'Y': 1, 'Z': 2, '-X': 3, '-Y': 4, '-Z': 5} diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 78266c47170..ba0394dbc66 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -542,6 +542,16 @@ void print_v4(const char *str, const float v[4]) printf("%s: %.3f %.3f %.3f %.3f\n", str, v[0], v[1], v[2], v[3]); } +void print_vn(const char *str, const float v[], const int n) +{ + int i = 0; + printf("%s[%d]:", str, n); + while (i < n) { + printf(" %.3f", v[i++]); + } + printf("\n"); +} + void minmax_v3v3_v3(float min[3], float max[3], const float vec[3]) { if (min[0] > vec[0]) min[0] = vec[0]; diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index d77b1ecf017..8e5040d983b 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -418,6 +418,21 @@ MINLINE float mul_project_m4_v3_zfac(float mat[4][4], const float co[3]) (mat[2][3] * co[2]) + mat[3][3]; } +/** + * Has the effect of mul_m3_v3(), on a single axis. + */ +MINLINE float dot_m3_v3_row_x(float M[3][3], const float a[3]) +{ + return M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2]; +} +MINLINE float dot_m3_v3_row_y(float M[3][3], const float a[3]) +{ + return M[0][1] * a[0] + M[1][1] * a[1] + M[2][1] * a[2]; +} +MINLINE float dot_m3_v3_row_z(float M[3][3], const float a[3]) +{ + return M[0][2] * a[0] + M[1][2] * a[1] + M[2][2] * a[2]; +} MINLINE void madd_v2_v2fl(float r[2], const float a[2], float f) { diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index 6e52145c653..2f94e833e9d 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -1252,6 +1252,7 @@ void voronoi(float x, float y, float z, float *da, float *pa, float me, int dtyp case 0: default: distfunc = dist_Real; + break; } xi = (int)(floor(x)); @@ -1467,6 +1468,7 @@ float BLI_gNoise(float noisesize, float x, float y, float z, int hard, int noise x += 1; y += 1; z += 1; + break; } } @@ -1522,6 +1524,7 @@ float BLI_gTurbulence(float noisesize, float x, float y, float z, int oct, int h x += 1; y += 1; z += 1; + break; } if (noisesize != 0.0f) { @@ -1596,6 +1599,7 @@ float mg_fBm(float x, float y, float z, float H, float lacunarity, float octaves default: { noisefunc = orgBlenderNoiseS; + break; } } @@ -1667,6 +1671,7 @@ float mg_MultiFractal(float x, float y, float z, float H, float lacunarity, floa default: { noisefunc = orgBlenderNoiseS; + break; } } @@ -1734,6 +1739,7 @@ float mg_HeteroTerrain(float x, float y, float z, float H, float lacunarity, flo default: { noisefunc = orgBlenderNoiseS; + break; } } @@ -1808,6 +1814,7 @@ float mg_HybridMultiFractal(float x, float y, float z, float H, float lacunarity default: { noisefunc = orgBlenderNoiseS; + break; } } @@ -1884,6 +1891,7 @@ float mg_RidgedMultiFractal(float x, float y, float z, float H, float lacunarity default: { noisefunc = orgBlenderNoiseS; + break; } } @@ -1950,6 +1958,7 @@ float mg_VLNoise(float x, float y, float z, float distortion, int nbas1, int nba default: { noisefunc1 = orgBlenderNoiseS; + break; } } @@ -1985,6 +1994,7 @@ float mg_VLNoise(float x, float y, float z, float distortion, int nbas1, int nba default: { noisefunc2 = orgBlenderNoiseS; + break; } } diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 1e76a7f3164..2c06a812c8a 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -610,9 +610,8 @@ bool BLI_parent_dir(char *path) { static char parent_dir[] = {'.', '.', SEP, '\0'}; /* "../" or "..\\" */ char tmp[FILE_MAX + 4]; - BLI_strncpy(tmp, path, sizeof(tmp) - 4); - BLI_add_slash(tmp); - strcat(tmp, parent_dir); + + BLI_join_dirfile(tmp, sizeof(tmp), path, parent_dir); BLI_cleanup_dir(NULL, tmp); /* does all the work of normalizing the path for us */ if (!BLI_testextensie(tmp, parent_dir)) { @@ -696,8 +695,10 @@ bool BLI_path_frame(char *path, int frame, int digits) if (stringframe_chars(path, &ch_sta, &ch_end)) { /* warning, ch_end is the last # +1 */ char tmp[FILE_MAX]; - sprintf(tmp, "%.*s%.*d%s", ch_sta, path, ch_end - ch_sta, frame, path + ch_end); - strcpy(path, tmp); + BLI_snprintf(tmp, sizeof(tmp), + "%.*s%.*d%s", + ch_sta, path, ch_end - ch_sta, frame, path + ch_end); + BLI_strncpy(path, tmp, FILE_MAX); return true; } return false; @@ -1229,6 +1230,7 @@ const char *BLI_get_folder(int folder_id, const char *subfolder) default: BLI_assert(0); + break; } return path; @@ -1257,7 +1259,9 @@ const char *BLI_get_user_folder_notest(int folder_id, const char *subfolder) break; default: BLI_assert(0); + break; } + if ('\0' == path[0]) { return NULL; } @@ -1307,6 +1311,7 @@ const char *BLI_get_folder_version(const int id, const int ver, const bool do_ch path[0] = '\0'; /* in case do_check is false */ ok = false; BLI_assert(!"incorrect ID"); + break; } if (!ok && do_check) { @@ -1686,6 +1691,26 @@ void BLI_split_file_part(const char *string, char *file, const size_t filelen) } /** + * Append a filename to a dir, ensuring slash separates. + */ +void BLI_path_append(char *dst, const size_t maxlen, const char *file) +{ + size_t dirlen = BLI_strnlen(dst, maxlen); + + /* inline BLI_add_slash */ + if ((dirlen > 0) && (dst[dirlen - 1] != SEP)) { + dst[dirlen++] = SEP; + dst[dirlen] = '\0'; + } + + if (dirlen >= maxlen) { + return; /* fills the path */ + } + + BLI_strncpy(dst + dirlen, file, maxlen - dirlen); +} + +/** * Simple appending of filename to dir, does not check for valid path! * Puts result into *dst, which may be same area as *dir. */ @@ -1693,15 +1718,16 @@ void BLI_join_dirfile(char *dst, const size_t maxlen, const char *dir, const cha { size_t dirlen = BLI_strnlen(dir, maxlen); - if (dst != dir) { - if (dirlen == maxlen) { - memcpy(dst, dir, dirlen); - dst[dirlen - 1] = '\0'; - return; /* dir fills the path */ - } - else { - memcpy(dst, dir, dirlen + 1); - } + /* args can't match */ + BLI_assert(!ELEM(dst, dir, file)); + + if (dirlen == maxlen) { + memcpy(dst, dir, dirlen); + dst[dirlen - 1] = '\0'; + return; /* dir fills the path */ + } + else { + memcpy(dst, dir, dirlen + 1); } if (dirlen + 1 >= maxlen) { @@ -1718,10 +1744,6 @@ void BLI_join_dirfile(char *dst, const size_t maxlen, const char *dir, const cha return; /* fills the path */ } - if (file == NULL) { - return; - } - BLI_strncpy(dst + dirlen, file, maxlen - dirlen); } @@ -1837,7 +1859,7 @@ int BLI_rebase_path(char *abs, size_t abs_len, /* subdirectories relative to blend_dir */ BLI_join_dirfile(dest_path, sizeof(dest_path), dest_dir, rel_dir); /* same subdirectories relative to dest_dir */ - BLI_join_dirfile(dest_path, sizeof(dest_path), dest_path, base); + BLI_path_append(dest_path, sizeof(dest_path), base); /* keeping original item basename */ } @@ -2058,7 +2080,7 @@ static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name else { strncpy(filename, path, sizeof(filename)); } - BLI_join_dirfile(fullname, maxlen, fullname, name); + BLI_path_append(fullname, maxlen, name); if (add_win32_extension(filename)) { BLI_strncpy(fullname, filename, maxlen); break; diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 6b45c6f1cb3..34c6e632131 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -44,7 +44,7 @@ #if defined(__sun__) || defined(__sun) || defined(__NetBSD__) # include <sys/statvfs.h> /* Other modern unix os's should probably use this also */ -#elif !defined(__FreeBSD__) && !defined(linux) && (defined(__sparc) || defined(__sparc__)) +#elif !defined(__FreeBSD__) && !defined(__linux__) && (defined(__sparc) || defined(__sparc__)) # include <sys/statfs.h> #endif @@ -53,7 +53,7 @@ # include <sys/mount.h> #endif -#if defined(linux) || defined(__CYGWIN32__) || defined(__hpux) || defined(__GNU__) || defined(__GLIBC__) +#if defined(__linux__) || defined(__CYGWIN32__) || defined(__hpux) || defined(__GNU__) || defined(__GLIBC__) #include <sys/vfs.h> #endif @@ -194,13 +194,13 @@ double BLI_dir_free_space(const char *dir) strcpy(name, "/"); } -#if defined(__FreeBSD__) || defined(linux) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__GNU__) || defined(__GLIBC__) +#if defined(__FreeBSD__) || defined(__linux__) || defined(__OpenBSD__) || defined(__APPLE__) || defined(__GNU__) || defined(__GLIBC__) if (statfs(name, &disk)) return(-1); #endif #if defined(__sun__) || defined(__sun) || defined(__NetBSD__) if (statvfs(name, &disk)) return(-1); -#elif !defined(__FreeBSD__) && !defined(linux) && (defined(__sparc) || defined(__sparc__)) +#elif !defined(__FreeBSD__) && !defined(__linux__) && (defined(__sparc) || defined(__sparc__)) /* WARNING - This may not be supported by geeneric unix os's - Campbell */ if (statfs(name, &disk, sizeof(struct statfs), 0)) return(-1); #endif @@ -388,17 +388,14 @@ static void bli_adddirstrings(struct BuildDirCtx *dir_ctx) */ st_size = file->s.st_size; - /* FIXME: Either change decimal prefixes to binary ones - * <http://en.wikipedia.org/wiki/Binary_prefix>, or change - * divisor factors from 1024 to 1000. */ if (st_size > 1024 * 1024 * 1024) { - BLI_snprintf(file->size, sizeof(file->size), "%.2f GB", ((double)st_size) / (1024 * 1024 * 1024)); + BLI_snprintf(file->size, sizeof(file->size), "%.2f GiB", ((double)st_size) / (1024 * 1024 * 1024)); } else if (st_size > 1024 * 1024) { - BLI_snprintf(file->size, sizeof(file->size), "%.1f MB", ((double)st_size) / (1024 * 1024)); + BLI_snprintf(file->size, sizeof(file->size), "%.1f MiB", ((double)st_size) / (1024 * 1024)); } else if (st_size > 1024) { - BLI_snprintf(file->size, sizeof(file->size), "%d KB", (int)(st_size / 1024)); + BLI_snprintf(file->size, sizeof(file->size), "%d KiB", (int)(st_size / 1024)); } else { BLI_snprintf(file->size, sizeof(file->size), "%d B", (int)st_size); diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 03bed428c07..572b142d044 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -47,6 +47,8 @@ # pragma GCC diagnostic error "-Wsign-conversion" #endif +// #define DEBUG_STRSIZE + /** * Duplicates the first \a len bytes of cstring \a str * into a newly mallocN'd string and returns it. \a str @@ -85,15 +87,18 @@ char *BLI_strdup(const char *str) */ char *BLI_strdupcat(const char *__restrict str1, const char *__restrict str2) { - size_t len; - char *n; + /* include the NULL terminator of str2 only */ + const size_t str1_len = strlen(str1); + const size_t str2_len = strlen(str2) + 1; + char *str, *s; - len = strlen(str1) + strlen(str2); - n = MEM_mallocN(len + 1, "strdupcat"); - strcpy(n, str1); - strcat(n, str2); - - return n; + str = MEM_mallocN(str1_len + str2_len, "strdupcat"); + s = str; + + memcpy(s, str1, str1_len); s += str1_len; + memcpy(s, str2, str2_len); + + return str; } /** @@ -111,6 +116,10 @@ char *BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t size_t srclen = BLI_strnlen(src, maxncpy - 1); BLI_assert(maxncpy != 0); +#ifdef DEBUG_STRSIZE + memset(dst, 0xff, sizeof(*dst) * maxncpy); +#endif + memcpy(dst, src, srclen); dst[srclen] = '\0'; return dst; @@ -134,6 +143,10 @@ size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, const size_t srclen = BLI_strnlen(src, maxncpy - 1); BLI_assert(maxncpy != 0); +#ifdef DEBUG_STRSIZE + memset(dst, 0xff, sizeof(*dst) * maxncpy); +#endif + memcpy(dst, src, srclen); dst[srclen] = '\0'; return srclen; @@ -149,21 +162,21 @@ size_t BLI_strcpy_rlen(char *__restrict dst, const char *__restrict src) /** * Portable replacement for #vsnprintf */ -size_t BLI_vsnprintf(char *__restrict buffer, size_t count, const char *__restrict format, va_list arg) +size_t BLI_vsnprintf(char *__restrict buffer, size_t maxncpy, const char *__restrict format, va_list arg) { size_t n; BLI_assert(buffer != NULL); - BLI_assert(count > 0); + BLI_assert(maxncpy > 0); BLI_assert(format != NULL); - n = (size_t)vsnprintf(buffer, count, format, arg); + n = (size_t)vsnprintf(buffer, maxncpy, format, arg); - if (n != -1 && n < count) { + if (n != -1 && n < maxncpy) { buffer[n] = '\0'; } else { - buffer[count - 1] = '\0'; + buffer[maxncpy - 1] = '\0'; } return n; @@ -172,13 +185,17 @@ size_t BLI_vsnprintf(char *__restrict buffer, size_t count, const char *__restri /** * Portable replacement for #snprintf */ -size_t BLI_snprintf(char *__restrict buffer, size_t count, const char *__restrict format, ...) +size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format, ...) { size_t n; va_list arg; +#ifdef DEBUG_STRSIZE + memset(dst, 0xff, sizeof(*dst) * maxncpy); +#endif + va_start(arg, format); - n = BLI_vsnprintf(buffer, count, format, arg); + n = BLI_vsnprintf(dst, maxncpy, format, arg); va_end(arg); return n; @@ -226,6 +243,7 @@ size_t BLI_strescape(char *__restrict dst, const char *__restrict src, const siz goto escape_finish; case '\\': case '"': + /* fall-through */ /* less common but should also be support */ case '\t': @@ -239,9 +257,10 @@ size_t BLI_strescape(char *__restrict dst, const char *__restrict src, const siz /* not enough space to escape */ break; } - /* intentionally pass through */ + /* fall-through */ default: *dst = *src; + break; } dst++; src++; @@ -286,34 +305,30 @@ char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict } /** + * string with all instances of substr_old replaced with substr_new, * Returns a copy of the cstring \a str into a newly mallocN'd - * string with all instances of oldText replaced with newText, * and returns it. * * \note A rather wasteful string-replacement utility, though this shall do for now... * Feel free to replace this with an even safe + nicer alternative * - * \param str The string to replace occurrences of oldText in - * \param oldText The text in the string to find and replace - * \param newText The text in the string to find and replace + * \param str The string to replace occurrences of substr_old in + * \param substr_old The text in the string to find and replace + * \param substr_new The text in the string to find and replace * \retval Returns the duplicated string */ -char *BLI_replacestr(char *__restrict str, const char *__restrict oldText, const char *__restrict newText) +char *BLI_replacestrN(const char *__restrict str, const char *__restrict substr_old, const char *__restrict substr_new) { DynStr *ds = NULL; - size_t lenOld = strlen(oldText); - char *match; - - /* sanity checks */ - if ((str == NULL) || (str[0] == 0)) - return NULL; - else if ((oldText == NULL) || (newText == NULL) || (oldText[0] == 0)) - return BLI_strdup(str); - + size_t len_old = strlen(substr_old); + const char *match; + + BLI_assert(substr_old[0] != '\0'); + /* while we can still find a match for the old substring that we're searching for, * keep dicing and replacing */ - while ( (match = strstr(str, oldText)) ) { + while ((match = strstr(str, substr_old))) { /* the assembly buffer only gets created when we actually need to rebuild the string */ if (ds == NULL) ds = BLI_dynstr_new(); @@ -322,39 +337,35 @@ char *BLI_replacestr(char *__restrict str, const char *__restrict oldText, const * copy the text up to this position and advance the current position in the string */ if (str != match) { - /* replace the token at the 'match' position with \0 so that the copied string will be ok, - * add the segment of the string from str to match to the buffer, then restore the value at match + /* add the segment of the string from str to match to the buffer, then restore the value at match */ - match[0] = 0; - BLI_dynstr_append(ds, str); - match[0] = oldText[0]; + BLI_dynstr_nappend(ds, str, (match - str)); /* now our current position should be set on the start of the match */ str = match; } /* add the replacement text to the accumulation buffer */ - BLI_dynstr_append(ds, newText); + BLI_dynstr_append(ds, substr_new); /* advance the current position of the string up to the end of the replaced segment */ - str += lenOld; + str += len_old; } /* finish off and return a new string that has had all occurrences of */ if (ds) { - char *newStr; + char *str_new; /* add what's left of the string to the assembly buffer - * - we've been adjusting str to point at the end of the replaced segments + * - we've been adjusting str to point at the end of the replaced segments */ - if (str != NULL) - BLI_dynstr_append(ds, str); + BLI_dynstr_append(ds, str); /* convert to new c-string (MEM_malloc'd), and free the buffer */ - newStr = BLI_dynstr_get_cstring(ds); + str_new = BLI_dynstr_get_cstring(ds); BLI_dynstr_free(ds); - return newStr; + return str_new; } else { /* just create a new copy of the entire string - we avoid going through the assembly buffer diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index b8dca95ae33..225b3c5538f 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -45,6 +45,8 @@ # pragma GCC diagnostic error "-Wsign-conversion" #endif +// #define DEBUG_STRSIZE + /* from libswish3, originally called u8_isvalid(), * modified to return the index of the bad character (byte index not utf). * http://svn.swish-e.org/libswish3/trunk/src/libswish3/utf8.c r3044 - campbell */ @@ -195,6 +197,10 @@ char *BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t BLI_assert(maxncpy != 0); +#ifdef DEBUG_STRSIZE + memset(dst, 0xff, sizeof(*dst) * maxncpy); +#endif + /* note: currently we don't attempt to deal with invalid utf8 chars */ BLI_STR_UTF8_CPY(dst, src, maxncpy); @@ -208,6 +214,10 @@ char *BLI_strncat_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy--; } +#ifdef DEBUG_STRSIZE + memset(dst, 0xff, sizeof(*dst) * maxncpy); +#endif + BLI_STR_UTF8_CPY(dst, src, maxncpy); return dst; @@ -220,11 +230,16 @@ char *BLI_strncat_utf8(char *__restrict dst, const char *__restrict src, size_t size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst, const wchar_t *__restrict src, const size_t maxncpy) { + const size_t maxlen = maxncpy - 1; size_t len = 0; BLI_assert(maxncpy != 0); - while (*src && len < maxncpy) { /* XXX can still run over the buffer because utf8 size isn't known :| */ +#ifdef DEBUG_STRSIZE + memset(dst, 0xff, sizeof(*dst) * maxncpy); +#endif + + while (*src && len < maxlen) { /* XXX can still run over the buffer because utf8 size isn't known :| */ len += BLI_str_utf8_from_unicode((unsigned int)*src++, dst + len); } @@ -245,24 +260,16 @@ size_t BLI_wstrlen_utf8(const wchar_t *src) return len; } -/* this is very close to 'BLI_str_utf8_size' functionality, perhaps we should de-duplicate */ -/* size of UTF-8 character in bytes */ -static size_t strlen_utf8_char(const char *strc) +size_t BLI_strlen_utf8_ex(const char *strc, size_t *r_len_bytes) { - if ((*strc & 0xe0) == 0xc0) { - if ((strc[1] & 0x80) && (strc[1] & 0x40) == 0x00) - return 2; - } - else if ((*strc & 0xf0) == 0xe0) { - if ((strc[1] & strc[2] & 0x80) && ((strc[1] | strc[2]) & 0x40) == 0x00) - return 3; - } - else if ((*strc & 0xf8) == 0xf0) { - if ((strc[1] & strc[2] & strc[3] & 0x80) && ((strc[1] | strc[2] | strc[3]) & 0x40) == 0x00) - return 4; - } + size_t len; + const char *strc_orig = strc; - return 1; + for (len = 0; *strc; len++) + strc += BLI_str_utf8_size_safe(strc); + + *r_len_bytes = (size_t)(strc - strc_orig); + return len; } size_t BLI_strlen_utf8(const char *strc) @@ -270,8 +277,22 @@ size_t BLI_strlen_utf8(const char *strc) size_t len; for (len = 0; *strc; len++) - strc += strlen_utf8_char(strc); + strc += BLI_str_utf8_size_safe(strc); + + return len; +} + +size_t BLI_strnlen_utf8_ex(const char *strc, const size_t maxlen, size_t *r_len_bytes) +{ + size_t len; + const char *strc_orig = strc; + const char *strc_end = strc + maxlen; + + for (len = 0; *strc && strc < strc_end; len++) { + strc += BLI_str_utf8_size_safe(strc); + } + *r_len_bytes = (size_t)(strc - strc_orig); return len; } @@ -280,15 +301,13 @@ size_t BLI_strlen_utf8(const char *strc) * \param maxlen the string length (in bytes) * \return the unicode length (not in bytes!) */ -size_t BLI_strnlen_utf8(const char *start, const size_t maxlen) +size_t BLI_strnlen_utf8(const char *strc, const size_t maxlen) { - const char *strc = start; - const char *strc_end = start + maxlen; - size_t len; + const char *strc_end = strc + maxlen; for (len = 0; *strc && strc < strc_end; len++) { - strc += strlen_utf8_char(strc); + strc += BLI_str_utf8_size_safe(strc); } return len; @@ -296,13 +315,16 @@ size_t BLI_strnlen_utf8(const char *start, const size_t maxlen) size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w, const char *__restrict src_c, const size_t maxncpy) { + const size_t maxlen = maxncpy - 1; size_t len = 0; - if (dst_w == NULL || src_c == NULL) { - return 0; - } + BLI_assert(maxncpy != 0); - while (*src_c && len < maxncpy) { +#ifdef DEBUG_STRSIZE + memset(dst_w, 0xff, sizeof(*dst_w) * maxncpy); +#endif + + while (*src_c && len != maxlen) { size_t step = 0; unsigned int unicode = BLI_str_utf8_as_unicode_and_size(src_c, &step); if (unicode != BLI_UTF8_ERR) { @@ -316,6 +338,9 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w, const char *__rest dst_w++; len++; } + + *dst_w = 0; + return len; } diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index e0ea3bbf685..2b6fb52c49c 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -508,6 +508,52 @@ void BLI_rw_mutex_free(ThreadRWMutex *mutex) MEM_freeN(mutex); } +/* Ticket Mutex Lock */ + +struct TicketMutex { + pthread_cond_t cond; + pthread_mutex_t mutex; + unsigned int queue_head, queue_tail; +}; + +TicketMutex *BLI_ticket_mutex_alloc(void) +{ + TicketMutex *ticket = MEM_callocN(sizeof(TicketMutex), "TicketMutex"); + + pthread_cond_init(&ticket->cond, NULL); + pthread_mutex_init(&ticket->mutex, NULL); + + return ticket; +} + +void BLI_ticket_mutex_free(TicketMutex *ticket) +{ + pthread_mutex_destroy(&ticket->mutex); + pthread_cond_destroy(&ticket->cond); + MEM_freeN(ticket); +} + +void BLI_ticket_mutex_lock(TicketMutex *ticket) +{ + unsigned int queue_me; + + pthread_mutex_lock(&ticket->mutex); + queue_me = ticket->queue_tail++; + + while (queue_me != ticket->queue_head) + pthread_cond_wait(&ticket->cond, &ticket->mutex); + + pthread_mutex_unlock(&ticket->mutex); +} + +void BLI_ticket_mutex_unlock(TicketMutex *ticket) +{ + pthread_mutex_lock(&ticket->mutex); + ticket->queue_head++; + pthread_cond_broadcast(&ticket->cond); + pthread_mutex_unlock(&ticket->mutex); +} + /* ************************************************ */ typedef struct ThreadedWorker { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 5d30bf6ff73..1ed22a53251 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5708,8 +5708,9 @@ static void lib_link_screen(FileData *fd, Main *main) ntree = nodetree_from_id(snode->id); if (ntree) snode->nodetree = ntree; - else - snode->nodetree = newlibadr(fd, sc->id.lib, snode->nodetree); + else { + snode->nodetree = newlibadr_us(fd, sc->id.lib, snode->nodetree); + } for (path = snode->treepath.first; path; path = path->next) { if (path == snode->treepath.first) { @@ -5717,7 +5718,7 @@ static void lib_link_screen(FileData *fd, Main *main) path->nodetree = snode->nodetree; } else - path->nodetree = newlibadr(fd, sc->id.lib, path->nodetree); + path->nodetree = newlibadr_us(fd, sc->id.lib, path->nodetree); if (!path->nodetree) break; @@ -5802,21 +5803,23 @@ static void *restore_pointer_by_name(Main *mainp, ID *id, int user) return NULL; } +static void lib_link_seq_clipboard_pt_restore(ID *id, Main *newmain) +{ + if (id) { + /* clipboard must ensure this */ + BLI_assert(id->newid != NULL); + id->newid = restore_pointer_by_name(newmain, (ID *)id->newid, 1); + } +} static int lib_link_seq_clipboard_cb(Sequence *seq, void *arg_pt) { Main *newmain = (Main *)arg_pt; - - if (seq->sound) { - seq->sound = restore_pointer_by_name(newmain, (ID *)seq->sound, 0); - seq->sound->id.us++; - } - - if (seq->scene) - seq->scene = restore_pointer_by_name(newmain, (ID *)seq->scene, 1); - - if (seq->scene_camera) - seq->scene_camera = restore_pointer_by_name(newmain, (ID *)seq->scene_camera, 1); - + + lib_link_seq_clipboard_pt_restore((ID *)seq->scene, newmain); + lib_link_seq_clipboard_pt_restore((ID *)seq->scene_camera, newmain); + lib_link_seq_clipboard_pt_restore((ID *)seq->clip, newmain); + lib_link_seq_clipboard_pt_restore((ID *)seq->mask, newmain); + lib_link_seq_clipboard_pt_restore((ID *)seq->sound, newmain); return 1; } @@ -6046,7 +6049,7 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc path->nodetree = snode->nodetree; } else - path->nodetree= restore_pointer_by_name(newmain, (ID*)path->nodetree, 0); + path->nodetree= restore_pointer_by_name(newmain, (ID*)path->nodetree, 2); if (!path->nodetree) break; @@ -7688,31 +7691,38 @@ static const char *node_get_static_idname(int type, int treetype) static const char *node_socket_get_static_idname(bNodeSocket *sock) { switch (sock->type) { - case SOCK_FLOAT: { - bNodeSocketValueFloat *dval = sock->default_value; - return nodeStaticSocketType(SOCK_FLOAT, dval->subtype); - } - case SOCK_INT: { - bNodeSocketValueInt *dval = sock->default_value; - return nodeStaticSocketType(SOCK_INT, dval->subtype); - } - case SOCK_BOOLEAN: { - return nodeStaticSocketType(SOCK_BOOLEAN, PROP_NONE); - } - case SOCK_VECTOR: { - bNodeSocketValueVector *dval = sock->default_value; - return nodeStaticSocketType(SOCK_VECTOR, dval->subtype); - } - case SOCK_RGBA: { - return nodeStaticSocketType(SOCK_RGBA, PROP_NONE); - } - case SOCK_STRING: { - bNodeSocketValueString *dval = sock->default_value; - return nodeStaticSocketType(SOCK_STRING, dval->subtype); - } - case SOCK_SHADER: { - return nodeStaticSocketType(SOCK_SHADER, PROP_NONE); - } + case SOCK_FLOAT: + { + bNodeSocketValueFloat *dval = sock->default_value; + return nodeStaticSocketType(SOCK_FLOAT, dval->subtype); + } + case SOCK_INT: + { + bNodeSocketValueInt *dval = sock->default_value; + return nodeStaticSocketType(SOCK_INT, dval->subtype); + } + case SOCK_BOOLEAN: + { + return nodeStaticSocketType(SOCK_BOOLEAN, PROP_NONE); + } + case SOCK_VECTOR: + { + bNodeSocketValueVector *dval = sock->default_value; + return nodeStaticSocketType(SOCK_VECTOR, dval->subtype); + } + case SOCK_RGBA: + { + return nodeStaticSocketType(SOCK_RGBA, PROP_NONE); + } + case SOCK_STRING: + { + bNodeSocketValueString *dval = sock->default_value; + return nodeStaticSocketType(SOCK_STRING, dval->subtype); + } + case SOCK_SHADER: + { + return nodeStaticSocketType(SOCK_SHADER, PROP_NONE); + } } return ""; } @@ -9479,7 +9489,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main) } } - + if (!MAIN_VERSION_ATLEAST(main, 268, 1)) { + Brush *brush; + for (brush = main->brush.first; brush; brush = brush->id.next) { + brush->spacing = MAX2(1, brush->spacing); + } + } + { bScreen *sc; Object *ob; diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c index c6856d8b71d..82040020ce4 100644 --- a/source/blender/blenloader/intern/versioning_legacy.c +++ b/source/blender/blenloader/intern/versioning_legacy.c @@ -354,7 +354,7 @@ static void alphasort_version_246(FileData *fd, Library *lib, Mesh *me) ma = NULL; for (b = 0; ma && b < MAX_MTEX; b++) - if (ma->mtex && ma->mtex[b] && ma->mtex[b]->mapto & MAP_ALPHA) + if (ma->mtex[b] && ma->mtex[b]->mapto & MAP_ALPHA) texalpha = 1; } else { diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 9b6699f3f21..e170107713c 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1642,13 +1642,6 @@ static void write_mballs(WriteData *wd, ListBase *idbase) } } -static int amount_of_chars(char *str) -{ - // Since the data is saved as UTF-8 to the cu->str - // The cu->len is not same as the strlen(cu->str) - return strlen(str); -} - static void write_curves(WriteData *wd, ListBase *idbase) { Curve *cu; @@ -1666,8 +1659,12 @@ static void write_curves(WriteData *wd, ListBase *idbase) if (cu->adt) write_animdata(wd, cu->adt); if (cu->vfont) { - writedata(wd, DATA, amount_of_chars(cu->str)+1, cu->str); - writestruct(wd, DATA, "CharInfo", cu->len+1, cu->strinfo); + /* TODO, sort out 'cu->len', in editmode its character, object mode its bytes */ + size_t len_bytes; + size_t len_chars = BLI_strlen_utf8_ex(cu->str, &len_bytes); + + writedata(wd, DATA, len_bytes + 1, cu->str); + writestruct(wd, DATA, "CharInfo", len_chars + 1, cu->strinfo); writestruct(wd, DATA, "TextBox", cu->totbox, cu->tb); } else { diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt index e6b5fc15f52..228ebcb96c4 100644 --- a/source/blender/bmesh/CMakeLists.txt +++ b/source/blender/bmesh/CMakeLists.txt @@ -23,7 +23,7 @@ # # ***** END GPL LICENSE BLOCK ***** -set(INC +set(INC . ../blenfont ../blenkernel @@ -43,6 +43,7 @@ set(SRC operators/bmo_bevel.c operators/bmo_bridge.c operators/bmo_connect.c + operators/bmo_connect_nonplanar.c operators/bmo_connect_pair.c operators/bmo_create.c operators/bmo_dissolve.c @@ -50,12 +51,14 @@ set(SRC operators/bmo_edgenet.c operators/bmo_extrude.c operators/bmo_fill_edgeloop.c - operators/bmo_fill_grid.c + operators/bmo_fill_grid.c + operators/bmo_fill_holes.c operators/bmo_hull.c operators/bmo_inset.c operators/bmo_join_triangles.c operators/bmo_mesh_conv.c operators/bmo_mirror.c + operators/bmo_normals.c operators/bmo_poke.c operators/bmo_primitive.c operators/bmo_removedoubles.c @@ -114,7 +117,6 @@ set(SRC intern/bmesh_operator_api.h intern/bmesh_error.h - tools/BME_bevel.c tools/bmesh_bevel.c tools/bmesh_bevel.h tools/bmesh_decimate_collapse.c diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c index 15030f90c65..1f7ace1ba6d 100644 --- a/source/blender/bmesh/intern/bmesh_construct.c +++ b/source/blender/bmesh/intern/bmesh_construct.c @@ -33,7 +33,7 @@ #include "MEM_guardedalloc.h" -#include "BLI_array.h" +#include "BLI_alloca.h" #include "BLI_math.h" #include "BKE_customdata.h" @@ -200,6 +200,8 @@ BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, c ev1 = edges[0]->v1; ev2 = edges[0]->v2; + BLI_assert(ELEM(v1, ev1, ev2) && ELEM(v2, ev1, ev2)); + if (v1 == ev2) { /* Swapping here improves performance and consistency of face * structure in the special case that the edges are already in @@ -322,6 +324,7 @@ BMFace *BM_face_create_ngon_verts(BMesh *bm, BMVert **vert_arr, const int len, c BMEdge **edge_arr = BLI_array_alloca(edge_arr, len); unsigned int winding[2] = {0, 0}; int i, i_prev = len - 1; + BMVert *v_winding[2] = {vert_arr[i_prev], vert_arr[0]}; BLI_assert(len > 2); @@ -344,6 +347,7 @@ BMFace *BM_face_create_ngon_verts(BMesh *bm, BMVert **vert_arr, const int len, c /* we want to use the reverse winding to the existing order */ BM_edge_ordered_verts(edge_arr[i], &test_v2, &test_v1); winding[(vert_arr[i_prev] == test_v2)]++; + BLI_assert(vert_arr[i_prev] == test_v2 || vert_arr[i_prev] == test_v1); } } @@ -370,7 +374,11 @@ BMFace *BM_face_create_ngon_verts(BMesh *bm, BMVert **vert_arr, const int len, c /* --- */ /* create the face */ - return BM_face_create_ngon(bm, vert_arr[winding[0]], vert_arr[winding[1]], edge_arr, len, create_flag); + return BM_face_create_ngon( + bm, + v_winding[winding[0]], + v_winding[winding[1]], + edge_arr, len, create_flag); } @@ -803,47 +811,73 @@ static void bm_face_attrs_copy(BMesh *source_mesh, BMesh *target_mesh, } /* BMESH_TODO: Special handling for hide flags? */ +/* BMESH_TODO: swap src/dst args, everywhere else in bmesh does other way round */ /** * Copies attributes, e.g. customdata, header flags, etc, from one element * to another of the same type. */ -void BM_elem_attrs_copy(BMesh *source_mesh, BMesh *target_mesh, const void *source, void *target) +void BM_elem_attrs_copy_ex(BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v, + const char hflag_mask) { - const BMHeader *sheader = source; - BMHeader *theader = target; + const BMHeader *ele_src = ele_src_v; + BMHeader *ele_dst = ele_dst_v; - BLI_assert(sheader->htype == theader->htype); + BLI_assert(ele_src->htype == ele_dst->htype); - if (sheader->htype != theader->htype) { - BLI_assert(!"type mismatch"); - return; + if ((hflag_mask & BM_ELEM_SELECT) == 0) { + /* First we copy select */ + if (BM_elem_flag_test((BMElem *)ele_src, BM_ELEM_SELECT)) { + BM_elem_select_set(bm_dst, (BMElem *)ele_dst, true); + } } - /* First we copy select */ - if (BM_elem_flag_test((BMElem *)sheader, BM_ELEM_SELECT)) { - BM_elem_select_set(target_mesh, (BMElem *)target, true); - } - /* Now we copy flags */ - theader->hflag = sheader->hflag; - + if (hflag_mask == 0) { + ele_dst->hflag = ele_src->hflag; + } + else if (hflag_mask == 0xff) { + /* pass */ + } + else { + ele_dst->hflag = ((ele_dst->hflag & hflag_mask) | (ele_src->hflag & ~hflag_mask)); + } + /* Copy specific attributes */ - switch (theader->htype) { + switch (ele_dst->htype) { case BM_VERT: - bm_vert_attrs_copy(source_mesh, target_mesh, (const BMVert *)source, (BMVert *)target); + bm_vert_attrs_copy(bm_src, bm_dst, (const BMVert *)ele_src, (BMVert *)ele_dst); break; case BM_EDGE: - bm_edge_attrs_copy(source_mesh, target_mesh, (const BMEdge *)source, (BMEdge *)target); + bm_edge_attrs_copy(bm_src, bm_dst, (const BMEdge *)ele_src, (BMEdge *)ele_dst); break; case BM_LOOP: - bm_loop_attrs_copy(source_mesh, target_mesh, (const BMLoop *)source, (BMLoop *)target); + bm_loop_attrs_copy(bm_src, bm_dst, (const BMLoop *)ele_src, (BMLoop *)ele_dst); break; case BM_FACE: - bm_face_attrs_copy(source_mesh, target_mesh, (const BMFace *)source, (BMFace *)target); + bm_face_attrs_copy(bm_src, bm_dst, (const BMFace *)ele_src, (BMFace *)ele_dst); break; default: BLI_assert(0); + break; + } +} + +void BM_elem_attrs_copy(BMesh *bm_src, BMesh *bm_dst, const void *ele_src, void *ele_dst) +{ + /* BMESH_TODO, default 'use_flags' to false */ + BM_elem_attrs_copy_ex(bm_src, bm_dst, ele_src, ele_dst, BM_ELEM_SELECT); +} + +void BM_elem_select_copy(BMesh *UNUSED(bm_src), BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v) +{ + const BMHeader *ele_src = ele_src_v; + BMHeader *ele_dst = ele_dst_v; + + BLI_assert(ele_src->htype == ele_dst->htype); + + if ((ele_src->hflag & BM_ELEM_SELECT) != (ele_dst->hflag & BM_ELEM_SELECT)) { + BM_elem_select_set(bm_dst, (BMElem *)ele_dst, (ele_src->hflag & BM_ELEM_SELECT) != 0); } } @@ -878,7 +912,8 @@ static BMFace *bm_mesh_copy_new_face(BMesh *bm_new, BMesh *bm_old, /* use totface in case adding some faces fails */ BM_elem_index_set(f_new, (bm_new->totface - 1)); /* set_inline */ - BM_elem_attrs_copy(bm_old, bm_new, f, f_new); + BM_elem_attrs_copy_ex(bm_old, bm_new, f, f_new, 0xff); + f_new->head.hflag = f->head.hflag; /* low level! don't do this for normal api use */ j = 0; l_iter = l_first = BM_FACE_FIRST_LOOP(f_new); @@ -890,6 +925,24 @@ static BMFace *bm_mesh_copy_new_face(BMesh *bm_new, BMesh *bm_old, return f_new; } +void BM_mesh_copy_init_customdata(BMesh *bm_dst, BMesh *bm_src, const BMAllocTemplate *allocsize) +{ + if (allocsize == NULL) { + allocsize = &bm_mesh_allocsize_default; + } + + CustomData_copy(&bm_src->vdata, &bm_dst->vdata, CD_MASK_BMESH, CD_CALLOC, 0); + CustomData_copy(&bm_src->edata, &bm_dst->edata, CD_MASK_BMESH, CD_CALLOC, 0); + CustomData_copy(&bm_src->ldata, &bm_dst->ldata, CD_MASK_BMESH, CD_CALLOC, 0); + CustomData_copy(&bm_src->pdata, &bm_dst->pdata, CD_MASK_BMESH, CD_CALLOC, 0); + + CustomData_bmesh_init_pool(&bm_dst->vdata, allocsize->totvert, BM_VERT); + CustomData_bmesh_init_pool(&bm_dst->edata, allocsize->totedge, BM_EDGE); + CustomData_bmesh_init_pool(&bm_dst->ldata, allocsize->totloop, BM_LOOP); + CustomData_bmesh_init_pool(&bm_dst->pdata, allocsize->totface, BM_FACE); +} + + BMesh *BM_mesh_copy(BMesh *bm_old) { BMesh *bm_new; @@ -908,15 +961,7 @@ BMesh *BM_mesh_copy(BMesh *bm_old) /* allocate a bmesh */ bm_new = BM_mesh_create(&allocsize); - CustomData_copy(&bm_old->vdata, &bm_new->vdata, CD_MASK_BMESH, CD_CALLOC, 0); - CustomData_copy(&bm_old->edata, &bm_new->edata, CD_MASK_BMESH, CD_CALLOC, 0); - CustomData_copy(&bm_old->ldata, &bm_new->ldata, CD_MASK_BMESH, CD_CALLOC, 0); - CustomData_copy(&bm_old->pdata, &bm_new->pdata, CD_MASK_BMESH, CD_CALLOC, 0); - - CustomData_bmesh_init_pool(&bm_new->vdata, allocsize.totvert, BM_VERT); - CustomData_bmesh_init_pool(&bm_new->edata, allocsize.totedge, BM_EDGE); - CustomData_bmesh_init_pool(&bm_new->ldata, allocsize.totloop, BM_LOOP); - CustomData_bmesh_init_pool(&bm_new->pdata, allocsize.totface, BM_FACE); + BM_mesh_copy_init_customdata(bm_new, bm_old, &allocsize); vtable = MEM_mallocN(sizeof(BMVert *) * bm_old->totvert, "BM_mesh_copy vtable"); etable = MEM_mallocN(sizeof(BMEdge *) * bm_old->totedge, "BM_mesh_copy etable"); @@ -925,7 +970,8 @@ BMesh *BM_mesh_copy(BMesh *bm_old) BM_ITER_MESH_INDEX (v, &iter, bm_old, BM_VERTS_OF_MESH, i) { /* copy between meshes so cant use 'example' argument */ v_new = BM_vert_create(bm_new, v->co, NULL, BM_CREATE_SKIP_CD); - BM_elem_attrs_copy(bm_old, bm_new, v, v_new); + BM_elem_attrs_copy_ex(bm_old, bm_new, v, v_new, 0xff); + v_new->head.hflag = v->head.hflag; /* low level! don't do this for normal api use */ vtable[i] = v_new; BM_elem_index_set(v, i); /* set_inline */ BM_elem_index_set(v_new, i); /* set_inline */ @@ -942,7 +988,8 @@ BMesh *BM_mesh_copy(BMesh *bm_old) vtable[BM_elem_index_get(e->v2)], e, BM_CREATE_SKIP_CD); - BM_elem_attrs_copy(bm_old, bm_new, e, e_new); + BM_elem_attrs_copy_ex(bm_old, bm_new, e, e_new, 0xff); + e_new->head.hflag = e->head.hflag; /* low level! don't do this for normal api use */ etable[i] = e_new; BM_elem_index_set(e, i); /* set_inline */ BM_elem_index_set(e_new, i); /* set_inline */ @@ -965,6 +1012,12 @@ BMesh *BM_mesh_copy(BMesh *bm_old) bm_old->elem_index_dirty &= ~BM_FACE; bm_new->elem_index_dirty &= ~BM_FACE; + + /* low level! don't do this for normal api use */ + bm_new->totvertsel = bm_old->totvertsel; + bm_new->totedgesel = bm_old->totedgesel; + bm_new->totfacesel = bm_old->totfacesel; + /* safety check */ BLI_assert(i == bm_old->totface); diff --git a/source/blender/bmesh/intern/bmesh_construct.h b/source/blender/bmesh/intern/bmesh_construct.h index 949366309b9..9552ef6f5a4 100644 --- a/source/blender/bmesh/intern/bmesh_construct.h +++ b/source/blender/bmesh/intern/bmesh_construct.h @@ -27,6 +27,8 @@ * \ingroup bmesh */ +struct BMAllocTemplate; + BMFace *BM_face_create_quad_tri_v(BMesh *bm, BMVert **verts, int len, const BMFace *example, const bool no_double); @@ -48,8 +50,12 @@ void BMO_remove_tagged_verts(BMesh *bm, const short oflag); void BMO_remove_tagged_context(BMesh *bm, const short oflag, const int type); -void BM_elem_attrs_copy(BMesh *source_mesh, BMesh *target_mesh, const void *source, void *target); +void BM_elem_attrs_copy_ex(BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v, + const char hflag_mask); +void BM_elem_attrs_copy(BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v); +void BM_elem_select_copy(BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v); +void BM_mesh_copy_init_customdata(BMesh *bm_dst, BMesh *bm_src, const struct BMAllocTemplate *allocsize); BMesh *BM_mesh_copy(BMesh *bm_old); char BM_face_flag_from_mflag(const char mflag); diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index b7eeceae494..f9e711a0dc3 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -30,6 +30,7 @@ #include "BLI_math_vector.h" #include "BLI_listbase.h" #include "BLI_array.h" +#include "BLI_alloca.h" #include "BLI_smallhash.h" #include "BLF_translation.h" @@ -210,7 +211,7 @@ static BMLoop *bm_face_boundary_add(BMesh *bm, BMFace *f, BMVert *startv, BMEdge return l; } -BMFace *BM_face_copy(BMesh *bm, BMFace *f, +BMFace *BM_face_copy(BMesh *bm_dst, BMesh *bm_src, BMFace *f, const bool copy_verts, const bool copy_edges) { BMVert **verts = BLI_array_alloca(verts, f->len); @@ -221,11 +222,13 @@ BMFace *BM_face_copy(BMesh *bm, BMFace *f, BMFace *f_copy; int i; + BLI_assert((bm_dst == bm_src) || (copy_verts && copy_edges)); + l_iter = l_first = BM_FACE_FIRST_LOOP(f); i = 0; do { if (copy_verts) { - verts[i] = BM_vert_create(bm, l_iter->v->co, l_iter->v, 0); + verts[i] = BM_vert_create(bm_dst, l_iter->v->co, l_iter->v, 0); } else { verts[i] = l_iter->v; @@ -248,7 +251,7 @@ BMFace *BM_face_copy(BMesh *bm, BMFace *f, v1 = verts[(i + 1) % f->len]; } - edges[i] = BM_edge_create(bm, v1, v2, l_iter->e, 0); + edges[i] = BM_edge_create(bm_dst, v1, v2, l_iter->e, 0); } else { edges[i] = l_iter->e; @@ -256,14 +259,14 @@ BMFace *BM_face_copy(BMesh *bm, BMFace *f, i++; } while ((l_iter = l_iter->next) != l_first); - f_copy = BM_face_create(bm, verts, edges, f->len, BM_CREATE_SKIP_CD); + f_copy = BM_face_create(bm_dst, verts, edges, f->len, BM_CREATE_SKIP_CD); - BM_elem_attrs_copy(bm, bm, f, f_copy); + BM_elem_attrs_copy(bm_src, bm_dst, f, f_copy); l_iter = l_first = BM_FACE_FIRST_LOOP(f); l_copy = BM_FACE_FIRST_LOOP(f_copy); do { - BM_elem_attrs_copy(bm, bm, l_iter, l_copy); + BM_elem_attrs_copy(bm_src, bm_dst, l_iter, l_copy); l_copy = l_copy->next; } while ((l_iter = l_iter->next) != l_first); @@ -500,6 +503,7 @@ int bmesh_elem_check(void *element, const char htype) } default: BLI_assert(0); + break; } BMESH_ASSERT(err == 0); @@ -591,7 +595,7 @@ static void bm_kill_only_loop(BMesh *bm, BMLoop *l) */ void BM_face_edges_kill(BMesh *bm, BMFace *f) { - BMEdge **edges = BLI_array_alloca_and_count(edges, f->len); + BMEdge **edges = BLI_array_alloca(edges, f->len); BMLoop *l_iter; BMLoop *l_first; int i = 0; @@ -601,7 +605,7 @@ void BM_face_edges_kill(BMesh *bm, BMFace *f) edges[i++] = l_iter->e; } while ((l_iter = l_iter->next) != l_first); - for (i = 0; i < BLI_array_count(edges); i++) { + for (i = 0; i < f->len; i++) { BM_edge_kill(bm, edges[i]); } } @@ -612,7 +616,7 @@ void BM_face_edges_kill(BMesh *bm, BMFace *f) */ void BM_face_verts_kill(BMesh *bm, BMFace *f) { - BMVert **verts = BLI_array_alloca_and_count(verts, f->len); + BMVert **verts = BLI_array_alloca(verts, f->len); BMLoop *l_iter; BMLoop *l_first; int i = 0; @@ -622,7 +626,7 @@ void BM_face_verts_kill(BMesh *bm, BMFace *f) verts[i++] = l_iter->v; } while ((l_iter = l_iter->next) != l_first); - for (i = 0; i < BLI_array_count(verts); i++) { + for (i = 0; i < f->len; i++) { BM_vert_kill(bm, verts[i]); } } @@ -1365,16 +1369,20 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e) BMLoop *l_next; BMEdge *e_new; BMVert *v_new, *v_old; - int i, valence1 = 0, valence2 = 0; +#ifndef NDEBUG + int valence1, valence2; bool edok; + int i; +#endif BLI_assert(bmesh_vert_in_edge(e, tv) != false); v_old = bmesh_edge_other_vert_get(e, tv); +#ifndef NDEBUG valence1 = bmesh_disk_count(v_old); - valence2 = bmesh_disk_count(tv); +#endif v_new = BM_vert_create(bm, tv->co, tv, 0); e_new = BM_edge_create(bm, v_new, tv, e, 0); @@ -1397,6 +1405,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e) /* add e_new to tv's disk cycle */ bmesh_disk_edge_append(e_new, tv); +#ifndef NDEBUG /* verify disk cycles */ edok = bmesh_disk_validate(valence1, v_old->e, v_old); BMESH_ASSERT(edok != false); @@ -1404,6 +1413,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e) BMESH_ASSERT(edok != false); edok = bmesh_disk_validate(2, v_new->e, v_new); BMESH_ASSERT(edok != false); +#endif /* Split the radial cycle if present */ l_next = e->l; @@ -1467,6 +1477,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e) } +#ifndef NDEBUG /* verify length of radial cycle */ edok = bmesh_radial_validate(radlen, e->l); BMESH_ASSERT(edok != false); @@ -1505,6 +1516,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e) BM_CHECK_ELEMENT(l->e); BM_CHECK_ELEMENT(l->f); } +#endif } BM_CHECK_ELEMENT(e_new); @@ -1552,8 +1564,8 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, const bool check_e { BMEdge *e_old; BMVert *v_old, *tv; - BMLoop *l_kill, *l; - int len, radlen = 0, i, valence1, valence2; + BMLoop *l_kill; + int len, radlen = 0, i; bool edok, halt = false; if (bmesh_vert_in_edge(e_kill, v_kill) == 0) { @@ -1563,6 +1575,11 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, const bool check_e len = bmesh_disk_count(v_kill); if (len == 2) { +#ifndef NDEBUG + int valence1, valence2; + BMLoop *l; +#endif + e_old = bmesh_disk_edge_next(e_kill, v_kill); tv = bmesh_edge_other_vert_get(e_kill, v_kill); v_old = bmesh_edge_other_vert_get(e_old, v_kill); @@ -1574,9 +1591,11 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, const bool check_e else { BMEdge *e_splice; +#ifndef NDEBUG /* For verification later, count valence of v_old and tv */ valence1 = bmesh_disk_count(v_old); valence2 = bmesh_disk_count(tv); +#endif if (check_edge_double) { e_splice = BM_edge_exists(tv, v_old); @@ -1642,6 +1661,7 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, const bool check_e /* deallocate vertex */ bm_kill_only_vert(bm, v_kill); +#ifndef NDEBUG /* Validate disk cycle lengths of v_old, tv are unchanged */ edok = bmesh_disk_validate(valence1, v_old->e, v_old); BMESH_ASSERT(edok != false); @@ -1661,6 +1681,7 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, const bool check_e BM_CHECK_ELEMENT(l->e); BM_CHECK_ELEMENT(l->f); } +#endif if (check_edge_double) { if (e_splice) { diff --git a/source/blender/bmesh/intern/bmesh_core.h b/source/blender/bmesh/intern/bmesh_core.h index a1f378aaa5d..6e691a9a0b5 100644 --- a/source/blender/bmesh/intern/bmesh_core.h +++ b/source/blender/bmesh/intern/bmesh_core.h @@ -27,7 +27,7 @@ * \ingroup bmesh */ -BMFace *BM_face_copy(BMesh *bm, BMFace *f, +BMFace *BM_face_copy(BMesh *bm_dst, BMesh *bm_src, BMFace *f, const bool copy_verts, const bool copy_edges); typedef enum eBMCreateFlag { diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.c b/source/blender/bmesh/intern/bmesh_edgeloop.c index 8b5b95c5cae..a484bd2fa27 100644 --- a/source/blender/bmesh/intern/bmesh_edgeloop.c +++ b/source/blender/bmesh/intern/bmesh_edgeloop.c @@ -428,7 +428,7 @@ void BM_mesh_edgeloops_calc_order(BMesh *UNUSED(bm), ListBase *eloops, const boo float len_best = FLT_MAX; if (use_normals) - BLI_assert(fabsf(len_squared_v3(no) - 1.0f) < FLT_EPSILON); + BLI_ASSERT_UNIT_V3(no); for (el_store = eloops->first; el_store; el_store = el_store->next) { float len; diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index 454eb201b78..70d1d4c81df 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -36,7 +36,7 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" -#include "BLI_array.h" +#include "BLI_alloca.h" #include "BLI_math.h" #include "BKE_customdata.h" @@ -205,6 +205,7 @@ void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source, const b int i; /* convert the 3d coords into 2d for projection */ + BLI_assert(BM_face_is_normal_valid(source)); axis_dominant_v3_to_m3(axis_mat, source->no); i = 0; @@ -429,32 +430,32 @@ static void bm_loop_flip_disp(float source_axis_x[3], float source_axis_y[3], disp[1] = (mat[0][0] * b[1] - b[0] * mat[1][0]) / d; } -static void bm_loop_interp_mdisps(BMesh *bm, BMLoop *target, BMFace *source) +static void bm_loop_interp_mdisps(BMesh *bm, BMLoop *l_dst, BMFace *f_src) { - MDisps *mdisps; + const int cd_loop_mdisp_offset = CustomData_get_offset(&bm->ldata, CD_MDISPS); + MDisps *md_dst; float d, v1[3], v2[3], v3[3], v4[3] = {0.0f, 0.0f, 0.0f}, e1[3], e2[3]; int ix, res; float axis_x[3], axis_y[3]; - - /* ignore 2-edged faces */ - if (UNLIKELY(target->f->len < 3)) + + if (cd_loop_mdisp_offset == -1) return; - if (!CustomData_has_layer(&bm->ldata, CD_MDISPS)) + /* ignore 2-edged faces */ + if (UNLIKELY(l_dst->f->len < 3)) return; + + md_dst = BM_ELEM_CD_GET_VOID_P(l_dst, cd_loop_mdisp_offset); + compute_mdisp_quad(l_dst, v1, v2, v3, v4, e1, e2); - mdisps = CustomData_bmesh_get(&bm->ldata, target->head.data, CD_MDISPS); - compute_mdisp_quad(target, v1, v2, v3, v4, e1, e2); - - /* if no disps data allocate a new grid, the size of the first grid in source. */ - if (!mdisps->totdisp) { - MDisps *md2 = CustomData_bmesh_get(&bm->ldata, BM_FACE_FIRST_LOOP(source)->head.data, CD_MDISPS); + /* if no disps data allocate a new grid, the size of the first grid in f_src. */ + if (!md_dst->totdisp) { + MDisps *md_src = BM_ELEM_CD_GET_VOID_P(BM_FACE_FIRST_LOOP(f_src), cd_loop_mdisp_offset); - mdisps->totdisp = md2->totdisp; - mdisps->level = md2->level; - if (mdisps->totdisp) { - mdisps->disps = MEM_callocN(sizeof(float) * 3 * mdisps->totdisp, - "mdisp->disps in bmesh_loop_intern_mdisps"); + md_dst->totdisp = md_src->totdisp; + md_dst->level = md_src->level; + if (md_dst->totdisp) { + md_dst->disps = MEM_callocN(sizeof(float) * 3 * md_dst->totdisp, __func__); } else { return; @@ -463,7 +464,7 @@ static void bm_loop_interp_mdisps(BMesh *bm, BMLoop *target, BMFace *source) mdisp_axis_from_quad(v1, v2, v3, v4, axis_x, axis_y); - res = (int)sqrt(mdisps->totdisp); + res = (int)sqrt(md_dst->totdisp); d = 1.0f / (float)(res - 1); #pragma omp parallel for if (res > 3) for (ix = 0; ix < res; ix++) { @@ -487,18 +488,17 @@ static void bm_loop_interp_mdisps(BMesh *bm, BMLoop *target, BMFace *source) mul_v3_fl(co, x); add_v3_v3(co, co1); - l_iter = l_first = BM_FACE_FIRST_LOOP(source); + l_iter = l_first = BM_FACE_FIRST_LOOP(f_src); do { float x2, y2; - MDisps *md1, *md2; + MDisps *md_src; float src_axis_x[3], src_axis_y[3]; - md1 = CustomData_bmesh_get(&bm->ldata, target->head.data, CD_MDISPS); - md2 = CustomData_bmesh_get(&bm->ldata, l_iter->head.data, CD_MDISPS); + md_src = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_mdisp_offset); - if (mdisp_in_mdispquad(target, l_iter, co, &x2, &y2, res, src_axis_x, src_axis_y)) { - old_mdisps_bilinear(md1->disps[iy * res + ix], md2->disps, res, (float)x2, (float)y2); - bm_loop_flip_disp(src_axis_x, src_axis_y, axis_x, axis_y, md1->disps[iy * res + ix]); + if (mdisp_in_mdispquad(l_dst, l_iter, co, &x2, &y2, res, src_axis_x, src_axis_y)) { + old_mdisps_bilinear(md_dst->disps[iy * res + ix], md_src->disps, res, (float)x2, (float)y2); + bm_loop_flip_disp(src_axis_x, src_axis_y, axis_x, axis_y, md_dst->disps[iy * res + ix]); break; } @@ -513,16 +513,17 @@ static void bm_loop_interp_mdisps(BMesh *bm, BMLoop *target, BMFace *source) */ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f) { + const int cd_loop_mdisp_offset = CustomData_get_offset(&bm->ldata, CD_MDISPS); BMLoop *l; BMIter liter; - if (!CustomData_has_layer(&bm->ldata, CD_MDISPS)) + if (cd_loop_mdisp_offset == -1) return; BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { - MDisps *mdp = CustomData_bmesh_get(&bm->ldata, l->prev->head.data, CD_MDISPS); - MDisps *mdl = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MDISPS); - MDisps *mdn = CustomData_bmesh_get(&bm->ldata, l->next->head.data, CD_MDISPS); + MDisps *mdp = BM_ELEM_CD_GET_VOID_P(l->prev, cd_loop_mdisp_offset); + MDisps *mdl = BM_ELEM_CD_GET_VOID_P(l, cd_loop_mdisp_offset); + MDisps *mdn = BM_ELEM_CD_GET_VOID_P(l->next, cd_loop_mdisp_offset); float co1[3]; int sides; int y; @@ -551,7 +552,7 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f) } BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { - MDisps *mdl1 = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MDISPS); + MDisps *mdl1 = BM_ELEM_CD_GET_VOID_P(l, cd_loop_mdisp_offset); MDisps *mdl2; float co1[3], co2[3], co[3]; int sides; @@ -575,9 +576,9 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f) continue; if (l->radial_next->v == l->v) - mdl2 = CustomData_bmesh_get(&bm->ldata, l->radial_next->head.data, CD_MDISPS); + mdl2 = BM_ELEM_CD_GET_VOID_P(l->radial_next, cd_loop_mdisp_offset); else - mdl2 = CustomData_bmesh_get(&bm->ldata, l->radial_next->next->head.data, CD_MDISPS); + mdl2 = BM_ELEM_CD_GET_VOID_P(l->radial_next->next, cd_loop_mdisp_offset); sides = (int)sqrt(mdl1->totdisp); for (y = 0; y < sides; y++) { @@ -638,10 +639,9 @@ void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source, int i; /* convert the 3d coords into 2d for projection */ + BLI_assert(BM_face_is_normal_valid(source)); axis_dominant_v3_to_m3(axis_mat, source->no); - BM_elem_attrs_copy(bm, bm, source, target->f); - i = 0; l_iter = l_first = BM_FACE_FIRST_LOOP(source); do { @@ -663,9 +663,7 @@ void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source, } if (do_multires) { - if (CustomData_has_layer(&bm->ldata, CD_MDISPS)) { - bm_loop_interp_mdisps(bm, target, source); - } + bm_loop_interp_mdisps(bm, target, source); } } @@ -682,6 +680,7 @@ void BM_vert_interp_from_face(BMesh *bm, BMVert *v, BMFace *source) int i; /* convert the 3d coords into 2d for projection */ + BLI_assert(BM_face_is_normal_valid(source)); axis_dominant_v3_to_m3(axis_mat, source->no); i = 0; diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index dc7c13b3fe0..61a326bbf97 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -721,17 +721,23 @@ void BM_editselection_plane(BMEditSelection *ese, float r_plane[3]) else if (ese->htype == BM_EDGE) { BMEdge *eed = (BMEdge *)ese->ele; - /* the plane is simple, it runs along the edge - * however selecting different edges can swap the direction of the y axis. - * this makes it less likely for the y axis of the manipulator - * (running along the edge).. to flip less often. - * at least its more predictable */ - if (eed->v2->co[1] > eed->v1->co[1]) { /* check which to do first */ - sub_v3_v3v3(r_plane, eed->v2->co, eed->v1->co); + if (BM_edge_is_boundary(eed)) { + sub_v3_v3v3(r_plane, eed->l->v->co, eed->l->next->v->co); } else { - sub_v3_v3v3(r_plane, eed->v1->co, eed->v2->co); + /* the plane is simple, it runs along the edge + * however selecting different edges can swap the direction of the y axis. + * this makes it less likely for the y axis of the manipulator + * (running along the edge).. to flip less often. + * at least its more predictable */ + if (eed->v2->co[1] > eed->v1->co[1]) { /* check which to do first */ + sub_v3_v3v3(r_plane, eed->v2->co, eed->v1->co); + } + else { + sub_v3_v3v3(r_plane, eed->v1->co, eed->v2->co); + } } + normalize_v3(r_plane); } else if (ese->htype == BM_FACE) { diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index 4027d4b2c19..64368390444 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -240,7 +240,7 @@ void BM_mesh_clear(BMesh *bm) bm_mempool_init(bm, &bm_mesh_allocsize_default); bm->stackdepth = 1; - bm->totflags = 1; + bm->totflags = 0; CustomData_reset(&bm->vdata); CustomData_reset(&bm->edata); diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c index 7c4af8eaa3b..81d4aad0fdf 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_conv.c +++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c @@ -84,7 +84,7 @@ #include "MEM_guardedalloc.h" #include "BLI_listbase.h" -#include "BLI_array.h" +#include "BLI_alloca.h" #include "BLI_math_vector.h" #include "BKE_mesh.h" @@ -583,9 +583,8 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, bool do_tessface) MEdge *med, *medge; BMVert *v, *eve; BMEdge *e; - BMLoop *l; BMFace *f; - BMIter iter, liter; + BMIter iter; int i, j, ototvert; const int cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT); @@ -699,22 +698,26 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, bool do_tessface) i = 0; j = 0; BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { + BMLoop *l_iter, *l_first; mpoly->loopstart = j; mpoly->totloop = f->len; mpoly->mat_nr = f->mat_nr; mpoly->flag = BM_face_flag_to_mflag(f); - l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f); - for ( ; l; l = BM_iter_step(&liter), j++, mloop++) { - mloop->e = BM_elem_index_get(l->e); - mloop->v = BM_elem_index_get(l->v); + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + mloop->e = BM_elem_index_get(l_iter->e); + mloop->v = BM_elem_index_get(l_iter->v); - /* copy over customdat */ - CustomData_from_bmesh_block(&bm->ldata, &me->ldata, l->head.data, j); - BM_CHECK_ELEMENT(l); - BM_CHECK_ELEMENT(l->e); - BM_CHECK_ELEMENT(l->v); - } + /* copy over customdata */ + CustomData_from_bmesh_block(&bm->ldata, &me->ldata, l_iter->head.data, j); + + j++; + mloop++; + BM_CHECK_ELEMENT(l_iter); + BM_CHECK_ELEMENT(l_iter->e); + BM_CHECK_ELEMENT(l_iter->v); + } while ((l_iter = l_iter->next) != l_first); if (f == bm->act_face) me->act_face = i; diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index c75843f029a..418fc16ea55 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -345,7 +345,7 @@ BMFace *BM_face_split(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, BMLoop **r_l /* do we have a multires layer? */ if (has_mdisp) { - f_tmp = BM_face_copy(bm, f, false, false); + f_tmp = BM_face_copy(bm, bm, f, false, false); } #ifdef USE_BMESH_HOLES @@ -414,7 +414,7 @@ BMFace *BM_face_split_n(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, float cos[ BLI_assert(v1 != v2); - f_tmp = BM_face_copy(bm, f, true, true); + f_tmp = BM_face_copy(bm, bm, f, true, true); if (!r_l) r_l = &l_dummy; @@ -490,26 +490,22 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, float BMEdge *e2; BMVert *tv2; - BMIter iter; - BMLoop *l_iter = NULL, *kvloop = NULL, *tvloop = NULL; - - void *src[2]; - float w[2]; - /* Only intended to be called for 2-valence vertices */ BLI_assert(bmesh_disk_count(v_kill) <= 2); - /* first modify the face loop data */ - w[0] = 1.0f - fac; - w[1] = fac; + /* first modify the face loop data */ if (e_kill->l) { + BMLoop *l_iter; + const float w[2] = {1.0f - fac, fac}; + l_iter = e_kill->l; do { if (l_iter->v == tv && l_iter->next->v == v_kill) { - tvloop = l_iter; - kvloop = l_iter->next; + void *src[2]; + BMLoop *tvloop = l_iter; + BMLoop *kvloop = l_iter->next; src[0] = kvloop->head.data; src[1] = tvloop->head.data; @@ -525,11 +521,12 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, float tv2 = BM_edge_other_vert(e2, v_kill); if (join_faces) { + BMIter fiter; BMFace **faces = NULL; BMFace *f; - BLI_array_staticdeclare(faces, 8); + BLI_array_staticdeclare(faces, BM_DEFAULT_ITER_STACK_SIZE); - BM_ITER_ELEM (f, &iter, v_kill, BM_FACES_OF_VERT) { + BM_ITER_ELEM (f, &fiter, v_kill, BM_FACES_OF_VERT) { BLI_array_append(faces, f); } @@ -543,6 +540,8 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, float } } + BLI_assert(BLI_array_count(faces) < 8); + BLI_array_free(faces); } else { @@ -553,8 +552,8 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, float /* e_new = BM_edge_exists(tv, tv2); */ /* same as return above */ if (e_new && kill_degenerate_faces) { - BLI_array_declare(bad_faces); BMFace **bad_faces = NULL; + BLI_array_staticdeclare(bad_faces, BM_DEFAULT_ITER_STACK_SIZE); BMIter fiter; BMFace *f; @@ -662,7 +661,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float perce /* flag existing faces so we can differentiate oldfaces from new faces */ for (i = 0; i < BLI_array_count(oldfaces); i++) { BM_ELEM_API_FLAG_ENABLE(oldfaces[i], _FLAG_OVERLAP); - oldfaces[i] = BM_face_copy(bm, oldfaces[i], true, true); + oldfaces[i] = BM_face_copy(bm, bm, oldfaces[i], true, true); BM_ELEM_API_FLAG_DISABLE(oldfaces[i], _FLAG_OVERLAP); } } @@ -1073,7 +1072,7 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const bool ccw, const short check_f f_hflag_prev_1 = l1->f->head.hflag; f_hflag_prev_2 = l2->f->head.hflag; - /* don't delete the edge, manually remove the egde after so we can copy its attributes */ + /* don't delete the edge, manually remove the edge after so we can copy its attributes */ f = BM_faces_join_pair(bm, l1->f, l2->f, NULL, true); if (f == NULL) { diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index 7e4d5e06100..4f8a851c780 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -150,7 +150,6 @@ static BMOpDefine bmo_recalc_face_normals_def = { "recalc_face_normals", /* slots_in */ {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, - {"use_face_tag", BMO_OP_SLOT_BOOL}, /* Tag faces that have been flipped */ {{'\0'}}, }, {{{'\0'}}}, /* no output */ @@ -519,6 +518,7 @@ static BMOpDefine bmo_bridge_loops_def = { {"use_cyclic", BMO_OP_SLOT_BOOL}, {"use_merge", BMO_OP_SLOT_BOOL}, {"merge_factor", BMO_OP_SLOT_FLT}, + {"twist_offset", BMO_OP_SLOT_INT}, {{'\0'}}, }, /* slots_out */ @@ -553,6 +553,29 @@ static BMOpDefine bmo_grid_fill_def = { BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH, }; + +/* + * Fill Holes. + * + * Fill boundary edges with faces, copying surrounding customdata. + */ +static BMOpDefine bmo_holes_fill_def = { + "holes_fill", + /* slots_in */ + {{"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ + {"sides", BMO_OP_SLOT_INT}, /* number of face sides to fill */ + {{'\0'}}, + }, + /* slots_out */ + /* maps new faces to the group numbers they came from */ + {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* new faces */ + {{'\0'}}, + }, + bmo_holes_fill_exec, + BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH, +}; + + /* * Edge Loop Fill. * @@ -640,6 +663,7 @@ static BMOpDefine bmo_rotate_def = { {{"cent", BMO_OP_SLOT_VEC}, /* center of rotation */ {"matrix", BMO_OP_SLOT_MAT}, /* matrix defining rotation */ {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ + {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */ {{'\0'}}, }, {{{'\0'}}}, /* no output */ @@ -656,6 +680,7 @@ static BMOpDefine bmo_translate_def = { "translate", /* slots_in */ {{"vec", BMO_OP_SLOT_VEC}, /* translation offset */ + {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */ {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ {{'\0'}}, }, @@ -673,6 +698,7 @@ static BMOpDefine bmo_scale_def = { "scale", /* slots_in */ {{"vec", BMO_OP_SLOT_VEC}, /* scale factor */ + {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */ {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ {{'\0'}}, }, @@ -692,6 +718,7 @@ static BMOpDefine bmo_transform_def = { "transform", /* slots_in */ {{"matrix", BMO_OP_SLOT_MAT}, /* transform matrix */ + {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */ {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* input vertices */ {{'\0'}}, }, @@ -841,6 +868,27 @@ static BMOpDefine bmo_connect_verts_def = { }; /* + * Connect Verts Across non Planer Faces. + * + * Split faces by connecting edges along non planer **faces**. + */ +static BMOpDefine bmo_connect_verts_nonplanar_def = { + "connect_verts_nonplanar", + /* slots_in */ + {{"angle_limit", BMO_OP_SLOT_FLT}, /* total rotation angle (radians) */ + {"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + /* slots_out */ + {{"edges.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, + {"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}, + }, + bmo_connect_verts_nonplanar_exec, + BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH, +}; + +/* * Connect Verts. * * Split faces by adding edges that connect **verts**. @@ -948,7 +996,9 @@ static BMOpDefine bmo_dissolve_limit_def = { {"delimit", BMO_OP_SLOT_INT}, {{'\0'}}, }, - {{{'\0'}}}, /* no output */ + /* slots_out */ + {{"region.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, + {{'\0'}}}, bmo_dissolve_limit_exec, BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH, }; @@ -1045,7 +1095,7 @@ static BMOpDefine bmo_subdivide_edgering_def = { {{'\0'}}, }, {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */ - {{'\0'}}}, /* no output */ + {{'\0'}}}, bmo_subdivide_edgering_exec, BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH, }; @@ -1134,6 +1184,7 @@ static BMOpDefine bmo_spin_def = { {"axis", BMO_OP_SLOT_VEC}, /* rotation axis */ {"dvec", BMO_OP_SLOT_VEC}, /* translation delta per step */ {"angle", BMO_OP_SLOT_FLT}, /* total rotation angle (radians) */ + {"space", BMO_OP_SLOT_MAT}, /* matrix to define the space (typically object matrix) */ {"steps", BMO_OP_SLOT_INT}, /* number of steps */ {"use_duplicate", BMO_OP_SLOT_BOOL}, /* duplicate or extrude? */ {{'\0'}}, @@ -1225,7 +1276,6 @@ static BMOpDefine bmo_rotate_uvs_def = { {"use_ccw", BMO_OP_SLOT_BOOL}, /* rotate counter-clockwise if true, otherwise clockwise */ {{'\0'}}, }, - /* slots_out */ {{{'\0'}}}, /* no output */ bmo_rotate_uvs_exec, BMO_OPTYPE_FLAG_NOP, @@ -1705,6 +1755,7 @@ const BMOpDefine *bmo_opdefines[] = { &bmo_collapse_def, &bmo_collapse_uvs_def, &bmo_connect_verts_def, + &bmo_connect_verts_nonplanar_def, &bmo_connect_vert_pair_def, &bmo_contextual_create_def, #ifdef WITH_BULLET @@ -1724,6 +1775,7 @@ const BMOpDefine *bmo_opdefines[] = { &bmo_dissolve_limit_def, &bmo_dissolve_verts_def, &bmo_duplicate_def, + &bmo_holes_fill_def, &bmo_edgeloop_fill_def, &bmo_edgenet_fill_def, &bmo_edgenet_prepare_def, diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index 3ffdbe167d7..269501e1f02 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -34,7 +34,6 @@ #include "BLI_memarena.h" #include "BLI_mempool.h" #include "BLI_listbase.h" -#include "BLI_array.h" #include "BLF_translation.h" @@ -411,7 +410,7 @@ void BMO_slot_mat_set(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], cons slot->data.p = BLI_memarena_alloc(op->arena, sizeof(float) * 4 * 4); if (size == 4) { - memcpy(slot->data.p, mat, sizeof(float) * 4 * 4); + copy_m4_m4(slot->data.p, (float (*)[4])mat); } else if (size == 3) { copy_m4_m3(slot->data.p, (float (*)[3])mat); @@ -561,8 +560,6 @@ static int bmo_mesh_flag_count(BMesh *bm, const char htype, const short oflag, BMElemF *ele_f; int i; - BLI_assert((unsigned int)test_for_enabled <= 1); - for (i = 0; i < 3; i++) { if (htype & flag_types[i]) { BM_ITER_MESH (ele_f, &iter, bm, iter_types[i]) { @@ -937,7 +934,6 @@ static void bmo_slot_buffer_from_flag(BMesh *bm, BMOperator *op, int totelement, i = 0; BLI_assert(op->slots_in == slot_args || op->slots_out == slot_args); - BLI_assert((unsigned int)test_for_enabled <= 1); if (test_for_enabled) totelement = BMO_mesh_enabled_flag_count(bm, htype, oflag); @@ -1248,7 +1244,7 @@ static void bmo_flag_layer_free(BMesh *bm) /* now go through and memcpy all the flag */ BM_ITER_MESH_INDEX (ele, &iter, bm, BM_VERTS_OF_MESH, i) { void *oldflags = ele->oflags; - ele->oflags = BLI_mempool_calloc(newpool); + ele->oflags = BLI_mempool_alloc(newpool); memcpy(ele->oflags, oldflags, new_totflags_size); BM_elem_index_set(ele, i); /* set_inline */ BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele); @@ -1264,7 +1260,7 @@ static void bmo_flag_layer_free(BMesh *bm) BM_ITER_MESH_INDEX (ele, &iter, bm, BM_EDGES_OF_MESH, i) { void *oldflags = ele->oflags; - ele->oflags = BLI_mempool_calloc(newpool); + ele->oflags = BLI_mempool_alloc(newpool); memcpy(ele->oflags, oldflags, new_totflags_size); BM_elem_index_set(ele, i); /* set_inline */ BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele); @@ -1280,7 +1276,7 @@ static void bmo_flag_layer_free(BMesh *bm) BM_ITER_MESH_INDEX (ele, &iter, bm, BM_FACES_OF_MESH, i) { void *oldflags = ele->oflags; - ele->oflags = BLI_mempool_calloc(newpool); + ele->oflags = BLI_mempool_alloc(newpool); memcpy(ele->oflags, oldflags, new_totflags_size); BM_elem_index_set(ele, i); /* set_inline */ BM_ELEM_API_FLAG_CLEAR((BMElemF *)ele); diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h index 4c6129cf43f..56d63694d88 100644 --- a/source/blender/bmesh/intern/bmesh_operators.h +++ b/source/blender/bmesh/intern/bmesh_operators.h @@ -49,9 +49,9 @@ enum { }; enum { + SUBDIV_SELECT_NONE, SUBDIV_SELECT_ORIG, SUBDIV_SELECT_INNER, - SUBDIV_SELECT_INNER_SEL, SUBDIV_SELECT_LOOPCUT }; diff --git a/source/blender/bmesh/intern/bmesh_operators_private.h b/source/blender/bmesh/intern/bmesh_operators_private.h index e6a4760060c..33c10411c0f 100644 --- a/source/blender/bmesh/intern/bmesh_operators_private.h +++ b/source/blender/bmesh/intern/bmesh_operators_private.h @@ -40,6 +40,7 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op); void bmo_collapse_exec(BMesh *bm, BMOperator *op); void bmo_collapse_uvs_exec(BMesh *bm, BMOperator *op); void bmo_connect_verts_exec(BMesh *bm, BMOperator *op); +void bmo_connect_verts_nonplanar_exec(BMesh *bm, BMOperator *op); void bmo_connect_vert_pair_exec(BMesh *bm, BMOperator *op); void bmo_contextual_create_exec(BMesh *bm, BMOperator *op); void bmo_convex_hull_exec(BMesh *bm, BMOperator *op); @@ -58,6 +59,7 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op); void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op); void bmo_duplicate_exec(BMesh *bm, BMOperator *op); void bmo_edgeloop_fill_exec(BMesh *bm, BMOperator *op); +void bmo_holes_fill_exec(BMesh *bm, BMOperator *op); void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op); void bmo_edgenet_prepare_exec(BMesh *bm, BMOperator *op); void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op); diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 88186df89fb..eea5ec59674 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -32,8 +32,8 @@ #include "MEM_guardedalloc.h" +#include "BLI_alloca.h" #include "BLI_math.h" -#include "BLI_array.h" #include "BLI_scanfill.h" #include "BLI_listbase.h" @@ -125,7 +125,7 @@ static void bm_face_calc_poly_normal(BMFace *f, float n[3]) * Same as #calc_poly_normal and #bm_face_calc_poly_normal * but takes an array of vertex locations. */ -static void bm_face_calc_poly_normal_vertex_cos(BMFace *f, float n[3], +static void bm_face_calc_poly_normal_vertex_cos(BMFace *f, float r_no[3], float const (*vertexCos)[3]) { BMLoop *l_first = BM_FACE_FIRST_LOOP(f); @@ -133,23 +133,41 @@ static void bm_face_calc_poly_normal_vertex_cos(BMFace *f, float n[3], float const *v_prev = vertexCos[BM_elem_index_get(l_first->prev->v)]; float const *v_curr = vertexCos[BM_elem_index_get(l_first->v)]; - zero_v3(n); + zero_v3(r_no); /* Newell's Method */ do { - add_newell_cross_v3_v3v3(n, v_prev, v_curr); + add_newell_cross_v3_v3v3(r_no, v_prev, v_curr); l_iter = l_iter->next; v_prev = v_curr; v_curr = vertexCos[BM_elem_index_get(l_iter->v)]; } while (l_iter != l_first); - if (UNLIKELY(normalize_v3(n) == 0.0f)) { - n[2] = 1.0f; /* other axis set to 0.0 */ + if (UNLIKELY(normalize_v3(r_no) == 0.0f)) { + r_no[2] = 1.0f; /* other axis set to 0.0 */ } } /** + * \brief COMPUTE POLY CENTER (BMFace) + */ +static void bm_face_calc_poly_center_mean_vertex_cos(BMFace *f, float r_cent[3], + float const (*vertexCos)[3]) +{ + BMLoop *l_first = BM_FACE_FIRST_LOOP(f); + BMLoop *l_iter = l_first; + + zero_v3(r_cent); + + /* Newell's Method */ + do { + add_v3_v3(r_cent, vertexCos[BM_elem_index_get(l_iter->v)]); + } while ((l_iter = l_iter->next) != l_first); + mul_v3_fl(r_cent, 1.0f / f->len); +} + +/** * For tools that insist on using triangles, ideally we would cache this data. * * \param r_loops Store face loop pointers, (f->len) @@ -370,8 +388,7 @@ void BM_face_calc_center_bounds(BMFace *f, float r_cent[3]) */ void BM_face_calc_center_mean(BMFace *f, float r_cent[3]) { - BMLoop *l_iter; - BMLoop *l_first; + BMLoop *l_iter, *l_first; zero_v3(r_cent); @@ -379,9 +396,7 @@ void BM_face_calc_center_mean(BMFace *f, float r_cent[3]) do { add_v3_v3(r_cent, l_iter->v->co); } while ((l_iter = l_iter->next) != l_first); - - if (f->len) - mul_v3_fl(r_cent, 1.0f / (float) f->len); + mul_v3_fl(r_cent, 1.0f / (float) f->len); } /** @@ -601,9 +616,9 @@ void BM_face_normal_update(BMFace *f) BM_face_calc_normal(f, f->no); } -/* exact same as 'bmesh_face_normal_update' but accepts vertex coords */ -void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3], - float const (*vertexCos)[3]) +/* exact same as 'BM_face_calc_normal' but accepts vertex coords */ +void BM_face_calc_normal_vcos(BMesh *bm, BMFace *f, float r_no[3], + float const (*vertexCos)[3]) { BMLoop *l; @@ -620,7 +635,7 @@ void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3], const float *co3 = vertexCos[BM_elem_index_get((l = l->next)->v)]; const float *co4 = vertexCos[BM_elem_index_get((l->next)->v)]; - normal_quad_v3(no, co1, co2, co3, co4); + normal_quad_v3(r_no, co1, co2, co3, co4); break; } case 3: @@ -629,22 +644,33 @@ void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3], const float *co2 = vertexCos[BM_elem_index_get((l = l->next)->v)]; const float *co3 = vertexCos[BM_elem_index_get((l->next)->v)]; - normal_tri_v3(no, co1, co2, co3); + normal_tri_v3(r_no, co1, co2, co3); break; } case 0: { - zero_v3(no); + zero_v3(r_no); break; } default: { - bm_face_calc_poly_normal_vertex_cos(f, no, vertexCos); + bm_face_calc_poly_normal_vertex_cos(f, r_no, vertexCos); break; } } } +/* exact same as 'BM_face_calc_normal' but accepts vertex coords */ +void BM_face_calc_center_mean_vcos(BMesh *bm, BMFace *f, float r_cent[3], + float const (*vertexCos)[3]) +{ + /* must have valid index data */ + BLI_assert((bm->elem_index_dirty & BM_VERT) == 0); + (void)bm; + + bm_face_calc_poly_center_mean_vertex_cos(f, r_cent, vertexCos); +} + /** * \brief Face Flip Normal * @@ -980,6 +1006,8 @@ void BM_face_triangulate(BMesh *bm, BMFace *f, float *abscoss = BLI_array_alloca(abscoss, f_len_orig); float mat[3][3]; + BLI_assert(BM_face_is_normal_valid(f)); + axis_dominant_v3_to_m3(mat, f->no); /* copy vertex coordinates to vertspace area */ @@ -1035,7 +1063,7 @@ void BM_face_legal_splits(BMFace *f, BMLoop *(*loops)[2], int len) { const int len2 = len * 2; BMLoop *l; - float v1[2], v2[2], v3[2] /*, v4[3 */, no[3], mid[2], *p1, *p2, *p3, *p4; + float v1[2], v2[2], v3[2], mid[2], *p1, *p2, *p3, *p4; float out[2] = {-FLT_MAX, -FLT_MAX}; float axis_mat[3][3]; float (*projverts)[2] = BLI_array_alloca(projverts, f->len); @@ -1043,10 +1071,9 @@ void BM_face_legal_splits(BMFace *f, BMLoop *(*loops)[2], int len) float fac1 = 1.0000001f, fac2 = 0.9f; //9999f; //0.999f; int i, j, a = 0, clen; - /* TODO, the face normal may already be correct */ - BM_face_calc_normal(f, no); + BLI_assert(BM_face_is_normal_valid(f)); - axis_dominant_v3_to_m3(axis_mat, no); + axis_dominant_v3_to_m3(axis_mat, f->no); for (i = 0, l = BM_FACE_FIRST_LOOP(f); i < f->len; i++, l = l->next) { BM_elem_index_set(l, i); /* set_loop */ diff --git a/source/blender/bmesh/intern/bmesh_polygon.h b/source/blender/bmesh/intern/bmesh_polygon.h index 2f6b54b91d3..91fe94f8e48 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.h +++ b/source/blender/bmesh/intern/bmesh_polygon.h @@ -34,16 +34,18 @@ int BM_face_calc_tessellation(BMFace *f, BMLoop **r_loops, int (*r_index)[3]) #endif ; void BM_face_calc_normal(BMFace *f, float r_no[3]); +void BM_face_calc_normal_vcos(BMesh *bm, BMFace *f, float r_no[3], + float const (*vertexCos)[3]); float BM_face_calc_area(BMFace *f); float BM_face_calc_perimeter(BMFace *f); void BM_face_calc_plane(BMFace *f, float r_plane[3]); void BM_face_calc_center_bounds(BMFace *f, float center[3]); void BM_face_calc_center_mean(BMFace *f, float center[3]); +void BM_face_calc_center_mean_vcos(BMesh *bm, BMFace *f, float r_cent[3], + float const (*vertexCos)[3]); void BM_face_calc_center_mean_weighted(BMFace *f, float center[3]); void BM_face_normal_update(BMFace *f); -void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3], - float const (*vertexCos)[3]); void BM_edge_normals_update(BMEdge *e); diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index be186e0441b..0e2984c53cc 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -33,8 +33,8 @@ #include "MEM_guardedalloc.h" -#include "BLI_array.h" #include "BLI_math.h" +#include "BLI_alloca.h" #include "bmesh.h" #include "intern/bmesh_private.h" @@ -338,16 +338,16 @@ bool BM_verts_in_face(BMFace *f, BMVert **varr, int len) */ bool BM_edge_in_face(BMFace *f, BMEdge *e) { - BMLoop *l_iter; - BMLoop *l_first; - - l_iter = l_first = BM_FACE_FIRST_LOOP(f); + if (e->l) { + BMLoop *l_iter, *l_first; - do { - if (l_iter->e == e) { - return true; - } - } while ((l_iter = l_iter->next) != l_first); + l_iter = l_first = e->l; + do { + if (l_iter->f == f) { + return true; + } + } while ((l_iter = l_iter->radial_next) != l_first); + } return false; } @@ -1719,6 +1719,18 @@ bool BM_face_is_any_edge_flag_test(BMFace *f, const char hflag) return false; } +/** + * Use within assert's to check normals are valid. + */ +bool BM_face_is_normal_valid(BMFace *f) +{ + const float eps = 0.0001f; + float no[3]; + + BM_face_calc_normal(f, no); + return len_squared_v3v3(no, f->no) < (eps * eps); +} + static void bm_mesh_calc_volume_face(BMFace *f, float *r_vol) { int tottri = f->len - 2; @@ -1758,6 +1770,293 @@ float BM_mesh_calc_volume(BMesh *bm, bool is_signed) return vol; } +/* note, almost duplicate of BM_mesh_calc_edge_groups, keep in sync */ +/** + * Calculate isolated groups of faces with optional filtering. + * + * \param bm the BMesh. + * \param r_groups_array Array of ints to fill in, length of bm->totface + * (or when hflag_test is set, the number of flagged faces). + * \param r_group_index index, length pairs into \a r_groups_array, size of return value + * int pairs: (array_start, array_length). + * \param filter_fn Filter the edges or verts we step over (depends on \a htype_step) + * as to which types we deal with. + * \param user_data Optional user data for \a filter_fn, can be NULL. + * \param hflag_test Optional flag to test faces, + * use to exclude faces from the calculation, 0 for all faces. + * \param htype_step BM_VERT to walk over face-verts, BM_EDGE to walk over faces edges + * (having both set is supported too). + * \return The number of groups found. + */ +int BM_mesh_calc_face_groups(BMesh *bm, int *r_groups_array, int (**r_group_index)[2], + BMElemFilterFunc filter_fn, void *user_data, + const char hflag_test, const char htype_step) +{ +#ifdef DEBUG + int group_index_len = 1; +#else + int group_index_len = 32; +#endif + + int (*group_index)[2] = MEM_mallocN(sizeof(*group_index) * group_index_len, __func__); + + int *group_array = r_groups_array; + STACK_DECLARE(group_array); + + int group_curr = 0; + + unsigned int tot_faces = 0; + unsigned int tot_touch = 0; + + BMFace **stack; + STACK_DECLARE(stack); + + BMIter iter; + BMFace *f; + int i; + + STACK_INIT(group_array); + + BLI_assert(((htype_step & ~(BM_VERT | BM_EDGE)) == 0) && (htype_step != 0)); + + /* init the array */ + BM_ITER_MESH_INDEX (f, &iter, bm, BM_FACES_OF_MESH, i) { + if ((hflag_test == 0) || BM_elem_flag_test(f, hflag_test)) { + tot_faces++; + BM_elem_flag_disable(f, BM_ELEM_TAG); + } + else { + /* never walk over tagged */ + BM_elem_flag_enable(f, BM_ELEM_TAG); + } + + BM_elem_index_set(f, i); /* set_inline */ + } + bm->elem_index_dirty &= ~BM_FACE; + + /* detect groups */ + stack = MEM_mallocN(sizeof(*stack) * tot_faces, __func__); + + while (tot_touch != tot_faces) { + int *group_item; + bool ok = false; + + BLI_assert(tot_touch < tot_faces); + + STACK_INIT(stack); + + BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { + if (BM_elem_flag_test(f, BM_ELEM_TAG) == false) { + BM_elem_flag_enable(f, BM_ELEM_TAG); + STACK_PUSH(stack, f); + ok = true; + break; + } + } + + BLI_assert(ok == true); + + /* manage arrays */ + if (group_index_len == group_curr) { + group_index_len *= 2; + group_index = MEM_reallocN(group_index, sizeof(*group_index) * group_index_len); + } + + group_item = group_index[group_curr]; + group_item[0] = STACK_SIZE(group_array); + group_item[1] = 0; + + while ((f = STACK_POP(stack))) { + BMLoop *l_iter, *l_first; + + /* add face */ + STACK_PUSH(group_array, BM_elem_index_get(f)); + tot_touch++; + group_item[1]++; + /* done */ + + if (htype_step & BM_EDGE) { + /* search for other faces */ + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + BMLoop *l_radial_iter = l_iter->radial_next; + if ((l_radial_iter != l_iter) && + ((filter_fn == NULL) || filter_fn((BMElem *)l_iter->e, user_data))) + { + do { + BMFace *f_other = l_radial_iter->f; + if (BM_elem_flag_test(f_other, BM_ELEM_TAG) == false) { + BM_elem_flag_enable(f_other, BM_ELEM_TAG); + STACK_PUSH(stack, f_other); + } + } while ((l_radial_iter = l_radial_iter->radial_next) != l_iter); + } + } while ((l_iter = l_iter->next) != l_first); + } + + if (htype_step & BM_VERT) { + BMIter liter; + /* search for other faces */ + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + if ((filter_fn == NULL) || filter_fn((BMElem *)l_iter->v, user_data)) { + BMLoop *l_other; + BM_ITER_ELEM (l_other, &liter, l_iter, BM_LOOPS_OF_LOOP) { + BMFace *f_other = l_other->f; + if (BM_elem_flag_test(f_other, BM_ELEM_TAG) == false) { + BM_elem_flag_enable(f_other, BM_ELEM_TAG); + STACK_PUSH(stack, f_other); + } + } + } + } while ((l_iter = l_iter->next) != l_first); + } + } + + group_curr++; + } + + MEM_freeN(stack); + + /* reduce alloc to required size */ + group_index = MEM_reallocN(group_index, sizeof(*group_index) * group_curr); + *r_group_index = group_index; + + return group_curr; +} + +/* note, almost duplicate of BM_mesh_calc_face_groups, keep in sync */ +/** + * Calculate isolated groups of edges with optional filtering. + * + * \param bm the BMesh. + * \param r_groups_array Array of ints to fill in, length of bm->totedge + * (or when hflag_test is set, the number of flagged edges). + * \param r_group_index index, length pairs into \a r_groups_array, size of return value + * int pairs: (array_start, array_length). + * \param filter_fn Filter the edges or verts we step over (depends on \a htype_step) + * as to which types we deal with. + * \param user_data Optional user data for \a filter_fn, can be NULL. + * \param hflag_test Optional flag to test edges, + * use to exclude edges from the calculation, 0 for all edges. + * \return The number of groups found. + * + * \note Unlike #BM_mesh_calc_face_groups there is no 'htype_step' argument, + * since we always walk over verts. + */ +int BM_mesh_calc_edge_groups(BMesh *bm, int *r_groups_array, int (**r_group_index)[2], + BMElemFilterFunc filter_fn, void *user_data, + const char hflag_test) +{ +#ifdef DEBUG + int group_index_len = 1; +#else + int group_index_len = 32; +#endif + + int (*group_index)[2] = MEM_mallocN(sizeof(*group_index) * group_index_len, __func__); + + int *group_array = r_groups_array; + STACK_DECLARE(group_array); + + int group_curr = 0; + + unsigned int tot_edges = 0; + unsigned int tot_touch = 0; + + BMEdge **stack; + STACK_DECLARE(stack); + + BMIter iter; + BMEdge *e; + int i; + + STACK_INIT(group_array); + + /* init the array */ + BM_ITER_MESH_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, i) { + if ((hflag_test == 0) || BM_elem_flag_test(e, hflag_test)) { + tot_edges++; + BM_elem_flag_disable(e, BM_ELEM_TAG); + } + else { + /* never walk over tagged */ + BM_elem_flag_enable(e, BM_ELEM_TAG); + } + + BM_elem_index_set(e, i); /* set_inline */ + } + bm->elem_index_dirty &= ~BM_FACE; + + /* detect groups */ + stack = MEM_mallocN(sizeof(*stack) * tot_edges, __func__); + + while (tot_touch != tot_edges) { + int *group_item; + bool ok = false; + + BLI_assert(tot_touch < tot_edges); + + STACK_INIT(stack); + + BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { + if (BM_elem_flag_test(e, BM_ELEM_TAG) == false) { + BM_elem_flag_enable(e, BM_ELEM_TAG); + STACK_PUSH(stack, e); + ok = true; + break; + } + } + + BLI_assert(ok == true); + + /* manage arrays */ + if (group_index_len == group_curr) { + group_index_len *= 2; + group_index = MEM_reallocN(group_index, sizeof(*group_index) * group_index_len); + } + + group_item = group_index[group_curr]; + group_item[0] = STACK_SIZE(group_array); + group_item[1] = 0; + + while ((e = STACK_POP(stack))) { + BMIter viter; + BMIter eiter; + BMVert *v; + + /* add edge */ + STACK_PUSH(group_array, BM_elem_index_get(e)); + tot_touch++; + group_item[1]++; + /* done */ + + /* search for other edges */ + BM_ITER_ELEM (v, &viter, e, BM_VERTS_OF_EDGE) { + if ((filter_fn == NULL) || filter_fn((BMElem *)v, user_data)) { + BMEdge *e_other; + BM_ITER_ELEM (e_other, &eiter, v, BM_EDGES_OF_VERT) { + if (BM_elem_flag_test(e_other, BM_ELEM_TAG) == false) { + BM_elem_flag_enable(e_other, BM_ELEM_TAG); + STACK_PUSH(stack, e_other); + } + } + } + } + } + + group_curr++; + } + + MEM_freeN(stack); + + /* reduce alloc to required size */ + group_index = MEM_reallocN(group_index, sizeof(*group_index) * group_curr); + *r_group_index = group_index; + + return group_curr; +} + float bmesh_subd_falloff_calc(const int falloff, float val) { switch (falloff) { @@ -1777,6 +2076,7 @@ float bmesh_subd_falloff_calc(const int falloff, float val) break; default: BLI_assert(0); + break; } return val; diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_queries.h index 7d599a9c8af..151d1de9b5b 100644 --- a/source/blender/bmesh/intern/bmesh_queries.h +++ b/source/blender/bmesh/intern/bmesh_queries.h @@ -27,6 +27,8 @@ * \ingroup bmesh */ +typedef bool (*BMElemFilterFunc)(BMElem *, void *user_data); + bool BM_vert_in_face(BMFace *f, BMVert *v); int BM_verts_in_face_count(BMFace *f, BMVert **varr, int len); bool BM_verts_in_face(BMFace *f, BMVert **varr, int len); @@ -114,8 +116,17 @@ bool BM_edge_is_any_vert_flag_test(BMEdge *e, const char hflag); bool BM_face_is_any_vert_flag_test(BMFace *f, const char hflag); bool BM_face_is_any_edge_flag_test(BMFace *f, const char hflag); +bool BM_face_is_normal_valid(BMFace *f); + float BM_mesh_calc_volume(BMesh *bm, bool is_signed); +int BM_mesh_calc_face_groups(BMesh *bm, int *r_groups_array, int (**r_group_index)[2], + BMElemFilterFunc filter_fn, void *user_data, + const char hflag_test, const char htype_step); +int BM_mesh_calc_edge_groups(BMesh *bm, int *r_groups_array, int (**r_group_index)[2], + BMElemFilterFunc filter_fn, void *user_data, + const char hflag_test); + /* not really any good place to put this */ float bmesh_subd_falloff_calc(const int falloff, float val); diff --git a/source/blender/bmesh/operators/bmo_beautify.c b/source/blender/bmesh/operators/bmo_beautify.c index 2c0bc7f95d9..22b686db64e 100644 --- a/source/blender/bmesh/operators/bmo_beautify.c +++ b/source/blender/bmesh/operators/bmo_beautify.c @@ -276,7 +276,7 @@ static void bm_edge_update_beauty_cost_single(BMEdge *e, Heap *eheap, HeapNode * } } -/* we have rotated an edge, tag other egdes and clear this one */ +/* we have rotated an edge, tag other edges and clear this one */ static void bm_edge_update_beauty_cost(BMEdge *e, Heap *eheap, HeapNode **eheap_table, GHash **edge_state_arr, const int flag) { @@ -415,9 +415,9 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op) /* edge is manifold and can be rotated */ if (BM_edge_rotate_check(e) && - /* faces are tagged */ - BMO_elem_flag_test(bm, e->l->f, FACE_MARK) && - BMO_elem_flag_test(bm, e->l->radial_next->f, FACE_MARK)) + /* faces are tagged */ + BMO_elem_flag_test(bm, e->l->f, FACE_MARK) && + BMO_elem_flag_test(bm, e->l->radial_next->f, FACE_MARK)) { BM_elem_index_set(e, edge_array_len); /* set_dirty */ BM_elem_flag_enable(e, BM_ELEM_TAG); diff --git a/source/blender/bmesh/operators/bmo_bridge.c b/source/blender/bmesh/operators/bmo_bridge.c index 045997fb6be..f63e742d8ba 100644 --- a/source/blender/bmesh/operators/bmo_bridge.c +++ b/source/blender/bmesh/operators/bmo_bridge.c @@ -142,13 +142,15 @@ static bool bm_edge_test_cb(BMEdge *e, void *bm_v) static void bridge_loop_pair(BMesh *bm, struct BMEdgeLoopStore *el_store_a, struct BMEdgeLoopStore *el_store_b, - const bool use_merge, const float merge_factor) + const bool use_merge, const float merge_factor, const int twist_offset) { + const float eps = 0.00001f; LinkData *el_a_first, *el_b_first; const bool is_closed = BM_edgeloop_is_closed(el_store_a) && BM_edgeloop_is_closed(el_store_b); int el_store_a_len, el_store_b_len; bool el_store_b_free = false; float el_dir[3]; + float dot_a, dot_b; const bool use_edgeout = true; el_store_a_len = BM_edgeloop_length_get((struct BMEdgeLoopStore *)el_store_a); @@ -160,7 +162,7 @@ static void bridge_loop_pair(BMesh *bm, } if (use_merge) { - BLI_assert((el_store_a_len == el_store_a_len)); + BLI_assert((el_store_a_len == el_store_b_len)); } if (el_store_a_len != el_store_b_len) { @@ -189,7 +191,10 @@ static void bridge_loop_pair(BMesh *bm, ((BMVert *)(((LinkData *)lb_b->first)->data))->co, ((BMVert *)(((LinkData *)lb_b->last)->data))->co); - /* this isnt totally reliable but works well in most cases */ + /* make the directions point out from the normals, 'no' is used as a temp var */ + cross_v3_v3v3(no, dir_a, el_dir); cross_v3_v3v3(dir_a, no, el_dir); + cross_v3_v3v3(no, dir_b, el_dir); cross_v3_v3v3(dir_b, no, el_dir); + if (dot_v3v3(dir_a, dir_b) < 0.0f) { BM_edgeloop_flip(bm, el_store_b); } @@ -199,9 +204,22 @@ static void bridge_loop_pair(BMesh *bm, BM_edgeloop_calc_normal_aligned(bm, el_store_b, no); } - if ((dot_v3v3(BM_edgeloop_normal_get(el_store_a), el_dir) < 0.0f) != - (dot_v3v3(BM_edgeloop_normal_get(el_store_b), el_dir) < 0.0f)) + dot_a = dot_v3v3(BM_edgeloop_normal_get(el_store_a), el_dir); + dot_b = dot_v3v3(BM_edgeloop_normal_get(el_store_b), el_dir); + + if (UNLIKELY((len_squared_v3(el_dir) < eps) || + ((fabsf(dot_a) < eps) && (fabsf(dot_b) < eps)))) { + /* in this case there is no depth between the two loops, + * eg: 2x 2d circles, one scaled smaller, + * in this case 'el_dir' cant be used, just ensure we have matching flipping. */ + if (dot_v3v3(BM_edgeloop_normal_get(el_store_a), + BM_edgeloop_normal_get(el_store_b)) < 0.0f) + { + BM_edgeloop_flip(bm, el_store_b); + } + } + else if ((dot_a < 0.0f) != (dot_b < 0.0f)) { BM_edgeloop_flip(bm, el_store_b); } @@ -250,6 +268,15 @@ static void bridge_loop_pair(BMesh *bm, if (is_closed) { bm_bridge_best_rotation(el_store_a, el_store_b); + + /* add twist */ + if (twist_offset != 0) { + const int len_b = BM_edgeloop_length_get(el_store_b); + ListBase *lb_b = BM_edgeloop_verts_get(el_store_b); + const int offset = twist_offset % len_b; + LinkData *el_b = BLI_rfindlink(lb_b, (offset < 0) ? (offset + len_b) : offset); + BLI_rotatelist(lb_b, el_b); + } } /* Assign after flipping is finalized */ @@ -458,6 +485,7 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op) const bool use_merge = BMO_slot_bool_get(op->slots_in, "use_merge"); const float merge_factor = BMO_slot_float_get(op->slots_in, "merge_factor"); const bool use_cyclic = BMO_slot_bool_get(op->slots_in, "use_cyclic") && (use_merge == false); + const int twist_offset = BMO_slot_int_get(op->slots_in, "twist_offset"); int count; bool change = false; @@ -517,7 +545,7 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op) bridge_loop_pair(bm, (struct BMEdgeLoopStore *)el_store, (struct BMEdgeLoopStore *)el_store_next, - use_merge, merge_factor); + use_merge, merge_factor, twist_offset); if (use_pairs) { el_store = el_store->next; } diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c index 50588ad70a9..c718cac4bd6 100644 --- a/source/blender/bmesh/operators/bmo_connect.c +++ b/source/blender/bmesh/operators/bmo_connect.c @@ -29,8 +29,8 @@ #include "MEM_guardedalloc.h" #include "BLI_math.h" -#include "BLI_array.h" #include "BLI_utildefines.h" +#include "BLI_alloca.h" #include "bmesh.h" diff --git a/source/blender/bmesh/operators/bmo_connect_nonplanar.c b/source/blender/bmesh/operators/bmo_connect_nonplanar.c new file mode 100644 index 00000000000..6d30b327a6c --- /dev/null +++ b/source/blender/bmesh/operators/bmo_connect_nonplanar.c @@ -0,0 +1,229 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Campbell Barton + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/bmesh/operators/bmo_connect_nonplanar.c + * \ingroup bmesh + * + * Connect verts non-planer faces iteratively (splits faces). + */ + +#include "MEM_guardedalloc.h" + +#include "BLI_math.h" +#include "BLI_utildefines.h" +#include "BLI_alloca.h" + +#include "bmesh.h" + +#include "intern/bmesh_operators_private.h" /* own include */ + +#define EDGE_OUT (1 << 0) +#define FACE_OUT (1 << 1) + +/** + * Calculates the face subset normal. + */ +static bool bm_face_subset_calc_normal(BMLoop *l_first, BMLoop *l_last, float r_no[3]) +{ + float const *v_prev, *v_curr; + + /* Newell's Method */ + BMLoop *l_iter = l_first; + BMLoop *l_term = l_last->next; + + zero_v3(r_no); + + v_prev = l_last->v->co; + do { + v_curr = l_iter->v->co; + add_newell_cross_v3_v3v3(r_no, v_prev, v_curr); + v_prev = v_curr; + } while ((l_iter = l_iter->next) != l_term); + + return (normalize_v3(r_no) != 0.0f); +} + +/** + * Calculates how non-planar the face subset is. + */ +static float bm_face_subset_calc_planar(BMLoop *l_first, BMLoop *l_last, const float no[3]) +{ + float axis_mat[3][3]; + float z_prev, z_curr; + float delta_z = 0.0f; + + /* Newell's Method */ + BMLoop *l_iter = l_first; + BMLoop *l_term = l_last->next; + + axis_dominant_v3_to_m3(axis_mat, no); + + z_prev = dot_m3_v3_row_z(axis_mat, l_last->v->co); + do { + z_curr = dot_m3_v3_row_z(axis_mat, l_iter->v->co); + delta_z += fabsf(z_curr - z_prev); + z_prev = z_curr; + } while ((l_iter = l_iter->next) != l_term); + + return delta_z; +} + +static bool bm_face_split_find(BMFace *f, BMVert *v_pair[2], float *r_angle) +{ + BMLoop *l_iter, *l_first; + BMLoop **l_arr = BLI_array_alloca(l_arr, f->len); + const unsigned int f_len = f->len; + unsigned int i_a, i_b; + bool found = false; + + /* angle finding */ + float err_best = FLT_MAX; + float angle_best = FLT_MAX; + + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + i_a = 0; + do { + l_arr[i_a++] = l_iter; + } while ((l_iter = l_iter->next) != l_first); + + /* now for the big search, O(N^2), however faces normally aren't so large */ + for (i_a = 0; i_a < f_len; i_a++) { + BMLoop *l_a = l_arr[i_a]; + for (i_b = i_a + 2; i_b < f_len; i_b++) { + BMLoop *l_b = l_arr[i_b]; + /* check these are not touching + * (we could be smarter here) */ + if ((l_a->next != l_b) && + (l_a->prev != l_b)) + { + /* first calculate normals */ + float no_a[3], no_b[3]; + + if (bm_face_subset_calc_normal(l_a, l_b, no_a) && + bm_face_subset_calc_normal(l_b, l_a, no_b)) + { + const float err_a = bm_face_subset_calc_planar(l_a, l_b, no_a); + const float err_b = bm_face_subset_calc_planar(l_b, l_a, no_b); + const float err_test = err_a + err_b; + + if (err_test < err_best) { + /* check we're legal (we could batch this) */ + BMLoop *l_split[2] = {l_a, l_b}; + BM_face_legal_splits(f, &l_split, 1); + if (l_split[0]) { + err_best = err_test; + v_pair[0] = l_a->v; + v_pair[1] = l_b->v; + + angle_best = angle_normalized_v3v3(no_a, no_b); + found = true; + } + } + } + } + } + } + + *r_angle = angle_best; + + return found; + + +} + +static bool bm_face_split_by_angle(BMesh *bm, BMFace *f, BMFace *r_f_pair[2], const float angle_limit) +{ + BMVert *v_pair[2]; + float angle; + + if (bm_face_split_find(f, v_pair, &angle) && (angle > angle_limit)) { + BMFace *f_new; + BMLoop *l_new; + f_new = BM_face_split(bm, f, v_pair[0], v_pair[1], &l_new, NULL, false); + if (f_new) { + r_f_pair[0] = f; + r_f_pair[1] = f_new; + + BMO_elem_flag_enable(bm, f, FACE_OUT); + BMO_elem_flag_enable(bm, f_new, FACE_OUT); + BMO_elem_flag_enable(bm, l_new->e, EDGE_OUT); + return true; + } + } + + return false; + +} + +void bmo_connect_verts_nonplanar_exec(BMesh *bm, BMOperator *op) +{ + BMOIter siter; + BMFace *f; + int totface = 0, totloop = 0; + int tottris; + BMFace **fstack; + STACK_DECLARE(fstack); + + const float angle_limit = BMO_slot_float_get(op->slots_in, "angle_limit"); + + + BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) { + if (f->len > 3) { + totface += 1; + totloop += f->len; + } + } + + if (totface == 0) { + return; + } + + /* over alloc, if we split every face */ + tottris = poly_to_tri_count(totface, totloop); + fstack = MEM_mallocN(sizeof(BMFace *) * tottris, __func__); + + STACK_INIT(fstack); + + BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) { + if (f->len > 3) { + STACK_PUSH(fstack, f); + } + } + + while ((f = STACK_POP(fstack))) { + BMFace *f_pair[2]; + if (bm_face_split_by_angle(bm, f, f_pair, angle_limit)) { + int j; + for (j = 0; j < 2; j++) { + BM_face_normal_update(f_pair[j]); + if (f_pair[j]->len > 3) { + STACK_PUSH(fstack, f_pair[j]); + } + } + } + } + + MEM_freeN(fstack); + + BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "edges.out", BM_EDGE, EDGE_OUT); + BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, FACE_OUT); +} diff --git a/source/blender/bmesh/operators/bmo_connect_pair.c b/source/blender/bmesh/operators/bmo_connect_pair.c index a56cdeec629..0bc29c56256 100644 --- a/source/blender/bmesh/operators/bmo_connect_pair.c +++ b/source/blender/bmesh/operators/bmo_connect_pair.c @@ -84,17 +84,11 @@ typedef struct PathLinkState { float co_prev[3]; } PathLinkState; -/* only the x axis */ -static float mul_v1_m3v3(float M[3][3], const float a[3]) -{ - return M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2]; -} - static int state_isect_co_pair(const PathContext *pc, const float co_a[3], const float co_b[3]) { - const float diff_a = mul_v1_m3v3((float (*)[3])pc->matrix, co_a) - pc->axis_sep; - const float diff_b = mul_v1_m3v3((float (*)[3])pc->matrix, co_b) - pc->axis_sep; + const float diff_a = dot_m3_v3_row_x((float (*)[3])pc->matrix, co_a) - pc->axis_sep; + const float diff_b = dot_m3_v3_row_x((float (*)[3])pc->matrix, co_b) - pc->axis_sep; const int test_a = (fabsf(diff_a) < CONNECT_EPS) ? 0 : (diff_a < 0.0f) ? -1 : 1; const int test_b = (fabsf(diff_b) < CONNECT_EPS) ? 0 : (diff_b < 0.0f) ? -1 : 1; @@ -110,7 +104,7 @@ static int state_isect_co_pair(const PathContext *pc, static int state_isect_co_exact(const PathContext *pc, const float co[3]) { - const float diff = mul_v1_m3v3((float (*)[3])pc->matrix, co) - pc->axis_sep; + const float diff = dot_m3_v3_row_x((float (*)[3])pc->matrix, co) - pc->axis_sep; return (fabsf(diff) <= CONNECT_EPS); } @@ -119,8 +113,8 @@ static float state_calc_co_pair_fac(const PathContext *pc, { float diff_a, diff_b, diff_tot; - diff_a = fabsf(mul_v1_m3v3((float (*)[3])pc->matrix, co_a) - pc->axis_sep); - diff_b = fabsf(mul_v1_m3v3((float (*)[3])pc->matrix, co_b) - pc->axis_sep); + diff_a = fabsf(dot_m3_v3_row_x((float (*)[3])pc->matrix, co_a) - pc->axis_sep); + diff_b = fabsf(dot_m3_v3_row_x((float (*)[3])pc->matrix, co_b) - pc->axis_sep); diff_tot = (diff_a + diff_b); return (diff_tot > FLT_EPSILON) ? (diff_a / diff_tot) : 0.5f; } @@ -381,7 +375,7 @@ void bmo_connect_vert_pair_exec(BMesh *bm, BMOperator *op) pc.v_b = ((BMVert **)op_verts_slot->data.p)[1]; /* fail! */ - if (!(pc.v_a && pc.v_a)) { + if (!(pc.v_a && pc.v_b)) { return; } @@ -443,7 +437,7 @@ void bmo_connect_vert_pair_exec(BMesh *bm, BMOperator *op) normalize_v3_v3(pc.matrix[2], basis_nor); invert_m3(pc.matrix); - pc.axis_sep = mul_v1_m3v3(pc.matrix, pc.v_a->co); + pc.axis_sep = dot_m3_v3_row_x(pc.matrix, pc.v_a->co); } /* add first vertex */ diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index ad858c514d2..e43c04f7d08 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -217,7 +217,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) /* Continue with ad-hoc fill methods since operators fail, * edge, vcloud... may add more */ - if (0) { /* nice feature but perhaps it should be a different tool? */ + if (0) { /* nice feature but perhaps it should be a different tool? */ /* tricky feature for making a line/edge from selection history... * diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index e4f2423ca17..d633182de42 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -103,10 +103,10 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op) { BMOIter oiter; BMFace *f; - BLI_array_declare(faces); - BLI_array_declare(regions); BMFace ***regions = NULL; BMFace **faces = NULL; + BLI_array_declare(regions); + BLI_array_declare(faces); BMFace *act_face = bm->act_face; BMWalker regwalker; int i; @@ -430,5 +430,8 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op) BM_mesh_decimate_dissolve_ex(bm, angle_limit, do_dissolve_boundaries, delimit, (BMVert **)BMO_SLOT_AS_BUFFER(vinput), vinput->len, - (BMEdge **)BMO_SLOT_AS_BUFFER(einput), einput->len); + (BMEdge **)BMO_SLOT_AS_BUFFER(einput), einput->len, + FACE_NEW); + + BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "region.out", BM_FACE, FACE_NEW); } diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c index e41fbd69616..f9ff308b706 100644 --- a/source/blender/bmesh/operators/bmo_dupe.c +++ b/source/blender/bmesh/operators/bmo_dupe.c @@ -28,8 +28,8 @@ #include "MEM_guardedalloc.h" -#include "BLI_array.h" #include "BLI_math.h" +#include "BLI_alloca.h" #include "bmesh.h" @@ -130,9 +130,11 @@ static BMFace *copy_face(BMOperator *op, BMOpSlot *slot_facemap_out, BMesh *source_mesh, BMFace *source_face, BMesh *target_mesh, - BMVert **vtar, BMEdge **edar, GHash *vhash, GHash *ehash) + GHash *vhash, GHash *ehash) { /* BMVert *target_vert1, *target_vert2; */ /* UNUSED */ + BMVert **vtar = BLI_array_alloca(vtar, source_face->len); + BMEdge **edar = BLI_array_alloca(edar, source_face->len); BMLoop *source_loop, *target_loop; BMFace *target_face = NULL; BMIter iter, iter2; @@ -148,10 +150,7 @@ static BMFace *copy_face(BMOperator *op, #endif /* lookup edge */ - for (i = 0, source_loop = BM_iter_new(&iter, source_mesh, BM_LOOPS_OF_FACE, source_face); - source_loop; - source_loop = BM_iter_step(&iter), i++) - { + BM_ITER_ELEM_INDEX (source_loop, &iter, source_face, BM_LOOPS_OF_FACE, i) { vtar[i] = BLI_ghash_lookup(vhash, source_loop->v); edar[i] = BLI_ghash_lookup(ehash, source_loop->e); } @@ -190,11 +189,6 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *bm_src, BMesh *bm_dst) BMVert *v = NULL, *v2; BMEdge *e = NULL; BMFace *f = NULL; - - BLI_array_declare(vtar); - BLI_array_declare(edar); - BMVert **vtar = NULL; - BMEdge **edar = NULL; BMIter viter, eiter, fiter; GHash *vhash, *ehash; @@ -280,14 +274,7 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *bm_src, BMesh *bm_dst) } } - /* ensure arrays are the right size */ - BLI_array_empty(vtar); - BLI_array_empty(edar); - - BLI_array_grow_items(vtar, f->len); - BLI_array_grow_items(edar, f->len); - - copy_face(op, slot_face_map_out, bm_src, f, bm_dst, vtar, edar, vhash, ehash); + copy_face(op, slot_face_map_out, bm_src, f, bm_dst, vhash, ehash); BMO_elem_flag_enable(bm_src, f, DUPE_DONE); } } @@ -295,9 +282,6 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *bm_src, BMesh *bm_dst) /* free pointer hashes */ BLI_ghash_free(vhash, NULL, NULL); BLI_ghash_free(ehash, NULL, NULL); - - BLI_array_free(vtar); /* free vert pointer array */ - BLI_array_free(edar); /* free edge pointer array */ } /** @@ -505,8 +489,8 @@ void bmo_spin_exec(BMesh *bm, BMOperator *op) BMO_op_initf(bm, &dupop, op->flag, "duplicate geom=%S", op, "geom_last.out"); BMO_op_exec(bm, &dupop); BMO_op_callf(bm, op->flag, - "rotate cent=%v matrix=%m3 verts=%S", - cent, rmat, &dupop, "geom.out"); + "rotate cent=%v matrix=%m3 space=%s verts=%S", + cent, rmat, op, "space", &dupop, "geom.out"); BMO_slot_copy(&dupop, slots_out, "geom.out", op, slots_out, "geom_last.out"); BMO_op_finish(bm, &dupop); @@ -516,8 +500,8 @@ void bmo_spin_exec(BMesh *bm, BMOperator *op) op, "geom_last.out"); BMO_op_exec(bm, &extop); BMO_op_callf(bm, op->flag, - "rotate cent=%v matrix=%m3 verts=%S", - cent, rmat, &extop, "geom.out"); + "rotate cent=%v matrix=%m3 space=%s verts=%S", + cent, rmat, op, "space", &extop, "geom.out"); BMO_slot_copy(&extop, slots_out, "geom.out", op, slots_out, "geom_last.out"); BMO_op_finish(bm, &extop); @@ -526,8 +510,8 @@ void bmo_spin_exec(BMesh *bm, BMOperator *op) if (usedvec) { mul_m3_v3(rmat, dvec); BMO_op_callf(bm, op->flag, - "translate vec=%v verts=%S", - dvec, op, "geom_last.out"); + "translate vec=%v space=%s verts=%S", + dvec, op, "space", op, "geom_last.out"); } } } diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index 32c8ee50e05..070cc187045 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -31,7 +31,6 @@ #include "DNA_meshdata_types.h" #include "BLI_math.h" -#include "BLI_array.h" #include "BLI_buffer.h" #include "BKE_customdata.h" @@ -54,84 +53,42 @@ enum { void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op) { - BMVert **verts = NULL; - BLI_array_declare(verts); - BMEdge **edges = NULL; - BLI_array_declare(edges); - BMOIter siter; - BMIter liter, liter2; - BMFace *f, *f2, *f3; - BMLoop *l, *l2, *l3, *l4, *l_tmp; - BMEdge *e, *laste; - BMVert *v, *lastv, *firstv; - int i; + BMFace *f_org; - BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) { - BLI_array_empty(verts); - BLI_array_empty(edges); - BLI_array_grow_items(verts, f->len); - BLI_array_grow_items(edges, f->len); - - i = 0; - firstv = lastv = NULL; - BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { - v = BM_vert_create(bm, l->v->co, l->v, 0); - /* skip on the first iteration */ - if (lastv) { - e = BM_edge_create(bm, lastv, v, l->e, 0); - edges[i] = e; - verts[i] = lastv; - i++; - } + BMO_ITER (f_org, &siter, op->slots_in, "faces", BM_FACE) { + BMFace *f_new; + BMLoop *l_org, *l_org_first; + BMLoop *l_new; - lastv = v; - laste = l->e; - if (!firstv) firstv = v; - } + BMO_elem_flag_enable(bm, f_org, EXT_DEL); - /* this fits in the array because we skip one in the loop above */ - e = BM_edge_create(bm, v, firstv, laste, 0); - edges[i] = e; - verts[i] = lastv; - i++; + f_new = BM_face_copy(bm, bm, f_org, true, true); + BMO_elem_flag_enable(bm, f_new, EXT_KEEP); - BMO_elem_flag_enable(bm, f, EXT_DEL); + l_org = l_org_first = BM_FACE_FIRST_LOOP(f_org); + l_new = BM_FACE_FIRST_LOOP(f_new); - f2 = BM_face_create(bm, verts, edges, f->len, 0); - if (UNLIKELY(f2 == NULL)) { - BMO_error_raise(bm, op, BMERR_MESH_ERROR, "Extrude failed: could not create face"); - BLI_array_free(edges); - return; - } - - BMO_elem_flag_enable(bm, f2, EXT_KEEP); - BM_elem_attrs_copy(bm, bm, f, f2); - - l2 = BM_iter_new(&liter2, bm, BM_LOOPS_OF_FACE, f2); - BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { - BM_elem_attrs_copy(bm, bm, l, l2); - - l3 = l->next; - l4 = l2->next; + do { + BMFace *f_side; + BMLoop *l_side_iter; - f3 = BM_face_create_quad_tri(bm, l3->v, l4->v, l2->v, l->v, f, false); - /* XXX, no error check here, why? - Campbell */ + BM_elem_attrs_copy(bm, bm, l_org, l_new); - l_tmp = BM_FACE_FIRST_LOOP(f3); + f_side = BM_face_create_quad_tri(bm, + l_org->next->v, l_new->next->v, l_new->v, l_org->v, + f_org, false); - BM_elem_attrs_copy(bm, bm, l->next, l_tmp); l_tmp = l_tmp->next; - BM_elem_attrs_copy(bm, bm, l->next, l_tmp); l_tmp = l_tmp->next; - BM_elem_attrs_copy(bm, bm, l, l_tmp); l_tmp = l_tmp->next; - BM_elem_attrs_copy(bm, bm, l, l_tmp); + l_side_iter = BM_FACE_FIRST_LOOP(f_side); - l2 = BM_iter_step(&liter2); - } + BM_elem_attrs_copy(bm, bm, l_org->next, l_side_iter); l_side_iter = l_side_iter->next; + BM_elem_attrs_copy(bm, bm, l_org->next, l_side_iter); l_side_iter = l_side_iter->next; + BM_elem_attrs_copy(bm, bm, l_org, l_side_iter); l_side_iter = l_side_iter->next; + BM_elem_attrs_copy(bm, bm, l_org, l_side_iter); + } while (((l_new = l_new->next), + (l_org = l_org->next)) != l_org_first); } - BLI_array_free(verts); - BLI_array_free(edges); - BMO_op_callf(bm, op->flag, "delete geom=%ff context=%i", EXT_DEL, DEL_ONLYFACES); diff --git a/source/blender/bmesh/operators/bmo_fill_edgeloop.c b/source/blender/bmesh/operators/bmo_fill_edgeloop.c index f80eafd4135..bd0466ff499 100644 --- a/source/blender/bmesh/operators/bmo_fill_edgeloop.c +++ b/source/blender/bmesh/operators/bmo_fill_edgeloop.c @@ -62,22 +62,19 @@ void bmo_edgeloop_fill_exec(BMesh *bm, BMOperator *op) BMO_elem_flag_enable(bm, e, EDGE_MARK); BM_ITER_ELEM (v, &viter, e, BM_VERTS_OF_EDGE) { if (BMO_elem_flag_test(bm, v, VERT_USED) == false) { - BMO_elem_flag_enable(bm, v, VERT_USED); - verts[i++] = v; if (i == tote) { - break; + goto cleanup; } + + BMO_elem_flag_enable(bm, v, VERT_USED); + verts[i++] = v; } } - if (i > tote) { - break; - } } /* we have a different number of verts to edges */ if (i != tote) { - MEM_freeN(verts); - return; + goto cleanup; } /* loop over connected flagged edges and fill in faces, this is made slightly more @@ -156,5 +153,6 @@ void bmo_edgeloop_fill_exec(BMesh *bm, BMOperator *op) BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, ELE_OUT); } +cleanup: MEM_freeN(verts); } diff --git a/source/blender/bmesh/operators/bmo_fill_holes.c b/source/blender/bmesh/operators/bmo_fill_holes.c new file mode 100644 index 00000000000..40a682e790d --- /dev/null +++ b/source/blender/bmesh/operators/bmo_fill_holes.c @@ -0,0 +1,137 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Campbell Barton. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/bmesh/operators/bmo_fill_holes.c + * \ingroup bmesh + * + * Fill boundary edge loop(s) with faces. + */ + +#include "MEM_guardedalloc.h" + +#include "BLI_listbase.h" +#include "BLI_alloca.h" +#include "BLI_math.h" + +#include "bmesh.h" + +#include "intern/bmesh_operators_private.h" /* own include */ + +#define EDGE_MARK 2 +#define ELE_OUT 4 + +/** + * Clone of BM_face_find_longest_loop that ensures the loop has an adjacent face + */ +static BMLoop *bm_face_find_longest_loop_manifold(BMFace *f) +{ + BMLoop *longest_loop = NULL; + float longest_len = 0.0f; + BMLoop *l_iter, *l_first; + + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + + do { + if (BM_edge_is_wire(l_iter->e) == false) { + const float len = len_squared_v3v3(l_iter->v->co, l_iter->next->v->co); + if (len >= longest_len) { + longest_loop = l_iter; + longest_len = len; + } + } + } while ((l_iter = l_iter->next) != l_first); + + return longest_loop; +} + +static BMFace *bm_face_from_eloop(BMesh *bm, struct BMEdgeLoopStore *el_store) +{ + LinkData *node = BM_edgeloop_verts_get(el_store)->first; + const int len = BM_edgeloop_length_get(el_store); + BMVert **f_verts = BLI_array_alloca(f_verts, len); + BMFace *f; + BMLoop *l; + unsigned int i = 0; + + do { + f_verts[i++] = node->data; + } while ((node = node->next)); + + f = BM_face_create_ngon_verts(bm, f_verts, len, 0, true, false); + BM_face_copy_shared(bm, f); + + l = bm_face_find_longest_loop_manifold(f); + if (l) { + BMFace *f_other = l->radial_next->f; + BLI_assert(l->radial_next != l); + BM_elem_attrs_copy(bm, bm, f_other, f); + } + + return f; +} + +static bool bm_edge_test_cb(BMEdge *e, void *bm_v) +{ + return BMO_elem_flag_test((BMesh *)bm_v, e, EDGE_MARK); +} + +void bmo_holes_fill_exec(BMesh *bm, BMOperator *op) +{ + ListBase eloops = {NULL, NULL}; + LinkData *el_store; + + BMEdge *e; + int count; + + BMOIter siter; + + const int sides = BMO_slot_int_get(op->slots_in, "sides"); + + /* clear tags */ + + BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, false); + + /* tag edges that may be apart of loops */ + BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) { + BMO_elem_flag_set(bm, e, EDGE_MARK, BM_edge_is_boundary(e)); + } + + count = BM_mesh_edgeloops_find(bm, &eloops, bm_edge_test_cb, (void *)bm); + + for (el_store = eloops.first; el_store; el_store = el_store->next) { + if (BM_edgeloop_is_closed((struct BMEdgeLoopStore *)el_store)) { + const int len = BM_edgeloop_length_get((struct BMEdgeLoopStore *)el_store); + if ((sides == 0) || (len <= sides)) { + BMFace *f; + + f = bm_face_from_eloop(bm, (struct BMEdgeLoopStore *)el_store); + BMO_elem_flag_enable(bm, f, ELE_OUT); + } + } + } + + (void)count; + + BM_mesh_edgeloops_free(&eloops); + + BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, ELE_OUT); +} diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c index 97444a50438..60fdf075d18 100644 --- a/source/blender/bmesh/operators/bmo_inset.c +++ b/source/blender/bmesh/operators/bmo_inset.c @@ -277,6 +277,8 @@ static void bm_interp_face_store(InterpFace *iface, BMesh *bm, BMFace *f, MemAre void *axis_mat = iface->axis_mat; int i; + BLI_assert(BM_face_is_normal_valid(f)); + axis_dominant_v3_to_m3(axis_mat, f->no); iface->f = f; diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c index 39f7b0953b1..5ee03b8a541 100644 --- a/source/blender/bmesh/operators/bmo_join_triangles.c +++ b/source/blender/bmesh/operators/bmo_join_triangles.c @@ -34,7 +34,6 @@ #include "DNA_meshdata_types.h" #include "BLI_math.h" -#include "BLI_array.h" #include "BKE_customdata.h" @@ -42,6 +41,8 @@ #include "intern/bmesh_operators_private.h" /* own include */ +#define FACE_OUT (1 << 0) + /* assumes edges are validated before reaching this poin */ static float measure_facepair(const float v1[3], const float v2[3], const float v3[3], const float v4[3], float limit) @@ -195,10 +196,9 @@ static int fplcmp(const void *v1, const void *v2) { const JoinEdge *e1 = (JoinEdge *)v1, *e2 = (JoinEdge *)v2; - if (e1->weight > e2->weight) return 1; + if (e1->weight > e2->weight) return 1; else if (e1->weight < e2->weight) return -1; - - return 0; + else return 0; } void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) @@ -210,148 +210,138 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) const bool do_mat = BMO_slot_bool_get(op->slots_in, "cmp_materials"); const float limit = BMO_slot_float_get(op->slots_in, "limit"); - BMIter iter, liter; + BMIter iter; BMOIter siter; BMFace *f; - BMLoop *l; BMEdge *e; - BLI_array_declare(jedges); JoinEdge *jedges = NULL; - int i, totedge; + unsigned i, totedge; + unsigned int totedge_tag = 0; /* flag all edges of all input face */ BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) { BMO_elem_flag_enable(bm, f, FACE_INPUT); - BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { - BMO_elem_flag_enable(bm, l->e, EDGE_MARK); - } } - /* unflag edges that are invalid; e.g. aren't surrounded by triangle */ + /* flag edges surrounded by 2 flagged triangles */ BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { - BMFace *f1, *f2; - if (!BMO_elem_flag_test(bm, e, EDGE_MARK)) - continue; - - if (!BM_edge_face_pair(e, &f1, &f2)) { - BMO_elem_flag_disable(bm, e, EDGE_MARK); - continue; - } - - if (f1->len != 3 || f2->len != 3) { - BMO_elem_flag_disable(bm, e, EDGE_MARK); - continue; + BMFace *f_a, *f_b; + if (BM_edge_face_pair(e, &f_a, &f_b) && + (f_a->len == 3 && f_b->len == 3) && + (BMO_elem_flag_test(bm, f_a, FACE_INPUT) && BMO_elem_flag_test(bm, f_b, FACE_INPUT))) + { + BMO_elem_flag_enable(bm, e, EDGE_MARK); + totedge_tag++; } + } - if (!BMO_elem_flag_test(bm, f1, FACE_INPUT) || !BMO_elem_flag_test(bm, f2, FACE_INPUT)) { - BMO_elem_flag_disable(bm, e, EDGE_MARK); - continue; - } + if (totedge_tag == 0) { + return; } - + + /* over alloc, some of the edges will be delimited */ + jedges = MEM_mallocN(sizeof(*jedges) * totedge_tag, __func__); + i = 0; BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { BMVert *v1, *v2, *v3, *v4; - BMFace *f1, *f2; + BMFace *f_a, *f_b; float measure; if (!BMO_elem_flag_test(bm, e, EDGE_MARK)) continue; - f1 = e->l->f; - f2 = e->l->radial_next->f; - - v1 = e->l->v; - v2 = e->l->prev->v; - v3 = e->l->next->v; - v4 = e->l->radial_next->prev->v; + f_a = e->l->f; + f_b = e->l->radial_next->f; if (do_sharp && !BM_elem_flag_test(e, BM_ELEM_SMOOTH)) continue; - if (do_mat && f1->mat_nr != f2->mat_nr) + if (do_mat && f_a->mat_nr != f_b->mat_nr) continue; if ((do_uv || do_tf || do_vcol) && (bm_edge_faces_cmp(bm, e, do_uv, do_tf, do_vcol) == false)) continue; + v1 = e->l->v; + v2 = e->l->prev->v; + v3 = e->l->next->v; + v4 = e->l->radial_next->prev->v; + measure = measure_facepair(v1->co, v2->co, v3->co, v4->co, limit); if (measure < limit) { - BLI_array_grow_one(jedges); - jedges[i].e = e; jedges[i].weight = measure; - i++; } } - if (!jedges) - return; + totedge = i; + qsort(jedges, totedge, sizeof(JoinEdge), fplcmp); - qsort(jedges, BLI_array_count(jedges), sizeof(JoinEdge), fplcmp); - - totedge = BLI_array_count(jedges); for (i = 0; i < totedge; i++) { - BMFace *f1, *f2; + BMFace *f_a, *f_b; e = jedges[i].e; - f1 = e->l->f; - f2 = e->l->radial_next->f; - - if (BMO_elem_flag_test(bm, f1, FACE_MARK) || BMO_elem_flag_test(bm, f2, FACE_MARK)) - continue; + f_a = e->l->f; + f_b = e->l->radial_next->f; - BMO_elem_flag_enable(bm, f1, FACE_MARK); - BMO_elem_flag_enable(bm, f2, FACE_MARK); - BMO_elem_flag_enable(bm, e, EDGE_CHOSEN); + /* check if another edge already claimed this face */ + if ((BMO_elem_flag_test(bm, f_a, FACE_MARK) == false) || + (BMO_elem_flag_test(bm, f_b, FACE_MARK) == false)) + { + BMO_elem_flag_enable(bm, f_a, FACE_MARK); + BMO_elem_flag_enable(bm, f_b, FACE_MARK); + BMO_elem_flag_enable(bm, e, EDGE_CHOSEN); + } } + MEM_freeN(jedges); + + /* join best weighted */ BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { - BMFace *f1, *f2; + BMFace *f_new; + BMFace *f_a, *f_b; if (!BMO_elem_flag_test(bm, e, EDGE_CHOSEN)) continue; - - BM_edge_face_pair(e, &f1, &f2); /* checked above */ - BM_faces_join_pair(bm, f1, f2, e, true); + BM_edge_face_pair(e, &f_a, &f_b); /* checked above */ + f_new = BM_faces_join_pair(bm, f_a, f_b, e, true); + if (f_new) { + BMO_elem_flag_enable(bm, f_new, FACE_OUT); + } } + /* join 2-tri islands */ BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if (BMO_elem_flag_test(bm, e, EDGE_MARK)) { - BMFace *f1, *f2; + BMLoop *l_a, *l_b; + BMFace *f_a, *f_b; /* ok, this edge wasn't merged, check if it's - * in a 2-tri-pair island, and if so merg */ + * in a 2-tri-pair island, and if so merge */ + l_a = e->l; + l_b = e->l->radial_next; - f1 = e->l->f; - f2 = e->l->radial_next->f; + f_a = l_a->f; + f_b = l_b->f; - if (f1->len != 3 || f2->len != 3) - continue; - - for (i = 0; i < 2; i++) { - BM_ITER_ELEM (l, &liter, i ? f2 : f1, BM_LOOPS_OF_FACE) { - if (l->e != e && BMO_elem_flag_test(bm, l->e, EDGE_MARK)) { - break; - } - } - - /* if l isn't NULL, we broke out of the loop */ - if (l) { - break; + /* check the other 2 edges in both tris are untagged */ + if ((f_a->len == 3 && f_b->len == 3) && + (BMO_elem_flag_test(bm, l_a->next->e, EDGE_MARK) == false) && + (BMO_elem_flag_test(bm, l_a->prev->e, EDGE_MARK) == false) && + (BMO_elem_flag_test(bm, l_b->next->e, EDGE_MARK) == false) && + (BMO_elem_flag_test(bm, l_b->prev->e, EDGE_MARK) == false)) + { + BMFace *f_new; + f_new = BM_faces_join_pair(bm, f_a, f_b, e, true); + if (f_new) { + BMO_elem_flag_enable(bm, f_new, FACE_OUT); } } - - /* if i isn't 2, we broke out of that loop */ - if (i != 2) { - continue; - } - - BM_faces_join_pair(bm, f1, f2, e, true); } } - BLI_array_free(jedges); + BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, FACE_OUT); } diff --git a/source/blender/bmesh/operators/bmo_normals.c b/source/blender/bmesh/operators/bmo_normals.c new file mode 100644 index 00000000000..025b8557331 --- /dev/null +++ b/source/blender/bmesh/operators/bmo_normals.c @@ -0,0 +1,188 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Joseph Eagar, Campbell Barton + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/bmesh/operators/bmo_normals.c + * \ingroup bmesh + * + * normal recalculation. + */ + +#include "MEM_guardedalloc.h" + +#include "BLI_math.h" + +#include "bmesh.h" + +#include "intern/bmesh_operators_private.h" /* own include */ + +/********* righthand faces implementation ****** */ + +#define FACE_FLAG (1 << 0) +#define FACE_FLIP (1 << 1) +#define FACE_TEMP (1 << 2) + +static bool bmo_recalc_normal_edge_filter_cb(BMElem *ele, void *UNUSED(user_data)) +{ + return BM_edge_is_manifold((BMEdge *)ele); +} + +/** + * Given an array of faces, recalcualte their normals. + * this functions assumes all faces in the array are connected by edges. + * + * \param bm + * \param faces Array of connected faces. + * \param faces_len Length of \a faces + * \param oflag Flag to check before doing the actual face flipping. + */ +static void bmo_recalc_face_normals_array(BMesh *bm, BMFace **faces, const int faces_len, const short oflag) +{ + float cent[3], tvec[3]; + float (*faces_center)[3] = MEM_mallocN(sizeof(*faces_center) * faces_len, __func__); + const float cent_fac = 1.0f / (float)faces_len; + int i, f_start_index; + const short oflag_flip = oflag | FACE_FLIP; + + float f_len_best; + BMFace *f; + + BMFace **fstack = MEM_mallocN(sizeof(*fstack) * faces_len, __func__); + STACK_DECLARE(fstack); + + zero_v3(cent); + + /* first calculate the center */ + for (i = 0; i < faces_len; i++) { + float *f_cent = faces_center[i]; + BM_face_calc_center_mean_weighted(faces[i], f_cent); + madd_v3_v3fl(cent, f_cent, cent_fac); + + BLI_assert(BMO_elem_flag_test(bm, faces[i], FACE_TEMP) == 0); + } + + f_len_best = -FLT_MAX; + + for (i = 0; i < faces_len; i++) { + float f_len_test; + + if ((f_len_test = len_squared_v3v3(faces_center[i], cent)) > f_len_best) { + f_len_best = f_len_test; + f_start_index = i; + } + } + + /* make sure the starting face has the correct winding */ + sub_v3_v3v3(tvec, faces_center[f_start_index], cent); + if (dot_v3v3(tvec, faces[f_start_index]->no) < 0.0f) { + BMO_elem_flag_enable(bm, faces[f_start_index], FACE_FLIP); + } + + MEM_freeN(faces_center); + + /* now that we've found our starting face, make all connected faces + * have the same winding. this is done recursively, using a manual + * stack (if we use simple function recursion, we'd end up overloading + * the stack on large meshes). */ + STACK_INIT(fstack); + + STACK_PUSH(fstack, faces[f_start_index]); + BMO_elem_flag_enable(bm, faces[f_start_index], FACE_TEMP); + + while ((f = STACK_POP(fstack))) { + const bool flip_state = BMO_elem_flag_test_bool(bm, f, FACE_FLIP); + BMLoop *l_iter, *l_first; + + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + BMLoop *l_other = l_iter->radial_next; + + if ((l_other != l_iter) && bmo_recalc_normal_edge_filter_cb((BMElem *)l_iter->e, NULL)) { + if (!BMO_elem_flag_test(bm, l_other->f, FACE_TEMP)) { + BMO_elem_flag_enable(bm, l_other->f, FACE_TEMP); + BMO_elem_flag_set(bm, l_other->f, FACE_FLIP, (l_other->v == l_iter->v) != flip_state); + STACK_PUSH(fstack, l_other->f); + } + } + } while ((l_iter = l_iter->next) != l_first); + } + + MEM_freeN(fstack); + + /* apply flipping to oflag'd faces */ + for (i = 0; i < faces_len; i++) { + if (BMO_elem_flag_test(bm, faces[i], oflag_flip) == oflag_flip) { + BM_face_normal_flip(bm, faces[i]); + } + BMO_elem_flag_disable(bm, faces[i], FACE_TEMP); + } +} + +/* + * put normal to the outside, and set the first direction flags in edges + * + * then check the object, and set directions / direction-flags: but only for edges with 1 or 2 faces + * this is in fact the 'select connected' + * + * in case all faces were not done: start over with 'find the ultimate ...' */ + +void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op) +{ + int *groups_array = MEM_mallocN(sizeof(*groups_array) * bm->totface, __func__); + int faces_len; + BMFace **faces_arr = BM_iter_as_arrayN(bm, BM_FACES_OF_MESH, NULL, &faces_len, NULL, 0); + BMFace **faces_grp = MEM_mallocN(sizeof(*faces_grp) * bm->totface, __func__); + + int (*group_index)[2]; + const int group_tot = BM_mesh_calc_face_groups(bm, groups_array, &group_index, + bmo_recalc_normal_edge_filter_cb, NULL, + 0, BM_EDGE); + int i; + + + BMO_slot_buffer_flag_enable(bm, op->slots_in, "faces", BM_FACE, FACE_FLAG); + + for (i = 0; i < group_tot; i++) { + const int fg_sta = group_index[i][0]; + const int fg_len = group_index[i][1]; + int j; + bool is_calc = false; + + for (j = 0; j < fg_len; j++) { + faces_grp[j] = faces_arr[groups_array[fg_sta + j]]; + + if (is_calc == false) { + is_calc = BMO_elem_flag_test_bool(bm, faces_grp[j], FACE_FLAG); + } + } + + if (is_calc) { + bmo_recalc_face_normals_array(bm, faces_grp, fg_len, FACE_FLAG); + } + } + + + if (faces_arr) MEM_freeN(faces_arr); + MEM_freeN(faces_grp); + + MEM_freeN(groups_array); + MEM_freeN(group_index); +} diff --git a/source/blender/bmesh/operators/bmo_similar.c b/source/blender/bmesh/operators/bmo_similar.c index b02f9cdfaa6..2d6ceb23f37 100644 --- a/source/blender/bmesh/operators/bmo_similar.c +++ b/source/blender/bmesh/operators/bmo_similar.c @@ -262,6 +262,7 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op) #endif default: BLI_assert(0); + break; } } } @@ -495,6 +496,7 @@ void bmo_similar_edges_exec(BMesh *bm, BMOperator *op) #endif default: BLI_assert(0); + break; } } } @@ -627,6 +629,7 @@ void bmo_similar_verts_exec(BMesh *bm, BMOperator *op) break; default: BLI_assert(0); + break; } } } diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index 6b55d5ea877..d0b23c3cdfb 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -1203,24 +1203,22 @@ void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag, BMO_op_exec(bm, &op); - if (seltype == SUBDIV_SELECT_INNER) { - BMOIter iter; - BMElem *ele; - - for (ele = BMO_iter_new(&iter, op.slots_out, "geom_inner.out", BM_EDGE | BM_VERT); ele; ele = BMO_iter_step(&iter)) { - BM_elem_select_set(bm, ele, true); - } - } - else if (seltype == SUBDIV_SELECT_LOOPCUT) { - BMOIter iter; - BMElem *ele; - - /* deselect input */ - BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false); - - for (ele = BMO_iter_new(&iter, op.slots_out, "geom_inner.out", BM_EDGE); ele; ele = BMO_iter_step(&iter)) { - BM_edge_select_set(bm, (BMEdge *)ele, true); - } + switch (seltype) { + case SUBDIV_SELECT_NONE: + break; + case SUBDIV_SELECT_ORIG: + /* set the newly created data to be selected */ + BMO_slot_buffer_hflag_enable(bm, op.slots_out, "geom_inner.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, true); + BM_mesh_select_flush(bm); + break; + case SUBDIV_SELECT_INNER: + BMO_slot_buffer_hflag_enable(bm, op.slots_out, "geom_inner.out", BM_EDGE | BM_VERT, BM_ELEM_SELECT, true); + break; + case SUBDIV_SELECT_LOOPCUT: + /* deselect input */ + BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false); + BMO_slot_buffer_hflag_enable(bm, op.slots_out, "geom_inner.out", BM_EDGE, BM_ELEM_SELECT, true); + break; } BMO_op_finish(bm, &op); diff --git a/source/blender/bmesh/operators/bmo_subdivide_edgering.c b/source/blender/bmesh/operators/bmo_subdivide_edgering.c index d9555c409f6..9cc418d61ed 100644 --- a/source/blender/bmesh/operators/bmo_subdivide_edgering.c +++ b/source/blender/bmesh/operators/bmo_subdivide_edgering.c @@ -40,7 +40,7 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" -#include "BLI_array.h" +#include "BLI_alloca.h" #include "BLI_math.h" #include "BLI_listbase.h" @@ -893,7 +893,7 @@ static void bm_edgering_pair_order(BMesh *bm, /* before going much further, get ourselves in order * - align loops (not strictly necessary but handy) * - ensure winding is set for both loops */ - if (BM_edgeloop_is_closed(el_store_a) && BM_edgeloop_is_closed(el_store_a)) { + if (BM_edgeloop_is_closed(el_store_a) && BM_edgeloop_is_closed(el_store_b)) { BMIter eiter; BMEdge *e; BMVert *v_other; @@ -1167,6 +1167,7 @@ void bmo_subdivide_edgering_exec(BMesh *bm, BMOperator *op) bm_edgering_pair_ringsubd(bm, lpair, el_store_a, el_store_b, interp_mode, cuts, smooth, falloff_cache); bm_edgering_pair_store_free(lpair, interp_mode); + change = true; } else { BMO_error_raise(bm, op, BMERR_INVALID_SELECTION, @@ -1217,6 +1218,7 @@ void bmo_subdivide_edgering_exec(BMesh *bm, BMOperator *op) bm_edgering_pair_ringsubd(bm, lpair, el_store_a, el_store_b, interp_mode, cuts, smooth, falloff_cache); bm_edgering_pair_store_free(lpair, interp_mode); + change = true; } BLI_assert(bm_verts_tag_count(bm) == 0); @@ -1229,6 +1231,6 @@ cleanup: /* flag output */ if (change) { - BMO_slot_buffer_flag_enable(bm, op->slots_out, "faces.out", BM_FACE, FACE_OUT); + BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, FACE_OUT); } } diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c index 5e61b8ea7ea..8b8cab9d881 100644 --- a/source/blender/bmesh/operators/bmo_utils.c +++ b/source/blender/bmesh/operators/bmo_utils.c @@ -32,8 +32,8 @@ #include "DNA_meshdata_types.h" #include "BLI_math.h" -#include "BLI_array.h" #include "BLI_heap.h" +#include "BLI_alloca.h" #include "BKE_customdata.h" @@ -55,9 +55,15 @@ void bmo_transform_exec(BMesh *UNUSED(bm), BMOperator *op) { BMOIter iter; BMVert *v; - float mat[4][4]; + float mat[4][4], mat_space[4][4], imat_space[4][4]; BMO_slot_mat4_get(op->slots_in, "matrix", mat); + BMO_slot_mat4_get(op->slots_in, "space", mat_space); + + if (!is_zero_m4(mat_space)) { + invert_m4_m4(imat_space, mat_space); + mul_serie_m4(mat, imat_space, mat, mat_space, NULL, NULL, NULL, NULL, NULL); + } BMO_ITER (v, &iter, op->slots_in, "verts", BM_VERT) { mul_m4_v3(mat, v->co); @@ -73,7 +79,7 @@ void bmo_translate_exec(BMesh *bm, BMOperator *op) unit_m4(mat); copy_v3_v3(mat[3], vec); - BMO_op_callf(bm, op->flag, "transform matrix=%m4 verts=%s", mat, op, "verts"); + BMO_op_callf(bm, op->flag, "transform matrix=%m4 space=%s verts=%s", mat, op, "space", op, "verts"); } void bmo_scale_exec(BMesh *bm, BMOperator *op) @@ -87,25 +93,19 @@ void bmo_scale_exec(BMesh *bm, BMOperator *op) mat[1][1] = vec[1]; mat[2][2] = vec[2]; - BMO_op_callf(bm, op->flag, "transform matrix=%m3 verts=%s", mat, op, "verts"); + BMO_op_callf(bm, op->flag, "transform matrix=%m3 space=%s verts=%s", mat, op, "space", op, "verts"); } void bmo_rotate_exec(BMesh *bm, BMOperator *op) { - float vec[3]; - - BMO_slot_vec_get(op->slots_in, "cent", vec); - - /* there has to be a proper matrix way to do this, but - * this is how editmesh did it and I'm too tired to think - * through the math right now. */ - mul_v3_fl(vec, -1.0f); - BMO_op_callf(bm, op->flag, "translate verts=%s vec=%v", op, "verts", vec); + float center[3]; + float mat[4][4]; - BMO_op_callf(bm, op->flag, "transform matrix=%s verts=%s", op, "matrix", op, "verts"); + BMO_slot_vec_get(op->slots_in, "cent", center); + BMO_slot_mat4_get(op->slots_in, "matrix", mat); + transform_pivot_set_m4(mat, center); - mul_v3_fl(vec, -1.0f); - BMO_op_callf(bm, op->flag, "translate verts=%s vec=%v", op, "verts", vec); + BMO_op_callf(bm, op->flag, "transform matrix=%m4 space=%s verts=%s", mat, op, "space", op, "verts"); } void bmo_reverse_faces_exec(BMesh *bm, BMOperator *op) @@ -278,131 +278,6 @@ void bmo_region_extend_exec(BMesh *bm, BMOperator *op) BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_ALL_NOLOOP, SEL_FLAG); } -/********* righthand faces implementation ****** */ - -#define FACE_VIS 1 -#define FACE_FLAG 2 -// #define FACE_MARK 4 /* UNUSED */ -#define FACE_FLIP 8 - -/* NOTE: these are the original recalc_face_normals comment in editmesh_mods.c, - * copied here for reference. */ - -/* based at a select-connected to witness loose objects */ - -/* count per edge the amount of faces - * find the ultimate left, front, upper face (not manhattan dist!!) - * also evaluate both triangle cases in quad, since these can be non-flat - * - * put normal to the outside, and set the first direction flags in edges - * - * then check the object, and set directions / direction-flags: but only for edges with 1 or 2 faces - * this is in fact the 'select connected' - * - * in case (selected) faces were not done: start over with 'find the ultimate ...' */ - -/* NOTE: this function uses recursion, which is a little unusual for a bmop - * function, but acceptable I think. */ - -/* NOTE: BM_ELEM_TAG is used on faces to tell if they are flipped. */ - -void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op) -{ - BMIter liter, liter2; - BMOIter siter; - BMFace *f, *startf; - BMFace **fstack; - STACK_DECLARE(fstack); - BMLoop *l, *l2; - float maxx, maxx_test, cent[3]; - const bool use_flip = BMO_slot_bool_get(op->slots_in, "use_face_tag"); - - startf = NULL; - maxx = -1.0e10; - - BMO_slot_buffer_flag_enable(bm, op->slots_in, "faces", BM_FACE, FACE_FLAG); - - /* find a starting face */ - BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) { - - /* clear dirty flag */ - BM_elem_flag_disable(f, BM_ELEM_TAG); - - if (BMO_elem_flag_test(bm, f, FACE_VIS)) - continue; - - if (!startf) startf = f; - - BM_face_calc_center_bounds(f, cent); - - if ((maxx_test = dot_v3v3(cent, cent)) > maxx) { - maxx = maxx_test; - startf = f; - } - } - - if (!startf) return; - - BM_face_calc_center_bounds(startf, cent); - - /* make sure the starting face has the correct winding */ - if (dot_v3v3(cent, startf->no) < 0.0f) { - BM_face_normal_flip(bm, startf); - BMO_elem_flag_toggle(bm, startf, FACE_FLIP); - - if (use_flip) - BM_elem_flag_toggle(startf, BM_ELEM_TAG); - } - - /* now that we've found our starting face, make all connected faces - * have the same winding. this is done recursively, using a manual - * stack (if we use simple function recursion, we'd end up overloading - * the stack on large meshes). */ - fstack = MEM_mallocN(sizeof(*fstack) * BMO_slot_buffer_count(op->slots_in, "faces"), __func__); - STACK_INIT(fstack); - STACK_PUSH(fstack, startf); - BMO_elem_flag_enable(bm, startf, FACE_VIS); - - while ((f = STACK_POP(fstack))) { - BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { - BM_ITER_ELEM (l2, &liter2, l, BM_LOOPS_OF_LOOP) { - if (!BMO_elem_flag_test(bm, l2->f, FACE_FLAG) || l2 == l) - continue; - - if (!BMO_elem_flag_test(bm, l2->f, FACE_VIS)) { - BMO_elem_flag_enable(bm, l2->f, FACE_VIS); - - if (l2->v == l->v) { - BM_face_normal_flip(bm, l2->f); - - BMO_elem_flag_toggle(bm, l2->f, FACE_FLIP); - if (use_flip) - BM_elem_flag_toggle(l2->f, BM_ELEM_TAG); - } - else if (BM_elem_flag_test(l2->f, BM_ELEM_TAG) || BM_elem_flag_test(l->f, BM_ELEM_TAG)) { - if (use_flip) { - BM_elem_flag_disable(l->f, BM_ELEM_TAG); - BM_elem_flag_disable(l2->f, BM_ELEM_TAG); - } - } - - STACK_PUSH(fstack, l2->f); - } - } - } - } - - MEM_freeN(fstack); - - /* check if we have faces yet to do. if so, recurse */ - BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) { - if (!BMO_elem_flag_test(bm, f, FACE_VIS)) { - bmo_recalc_face_normals_exec(bm, op); - break; - } - } -} - void bmo_smooth_vert_exec(BMesh *UNUSED(bm), BMOperator *op) { BMOIter siter; diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c deleted file mode 100644 index ba553e2f763..00000000000 --- a/source/blender/bmesh/tools/BME_bevel.c +++ /dev/null @@ -1,1160 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2004 Blender Foundation. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): Geoffrey Bantle and Levi Schooley. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include <math.h> - -#include "MEM_guardedalloc.h" - -#include "DNA_listBase.h" -#include "DNA_meshdata_types.h" -#include "DNA_mesh_types.h" - -#include "BLI_math.h" -#include "BLI_blenlib.h" -#include "BLI_ghash.h" -#include "BLI_memarena.h" - -#include "BKE_editmesh.h" -#include "BKE_bmesh.h" - -#include "bmesh.h" -#include "intern/bmesh_private.h" - -/* BMESH_TODO - * - * Date: 2011-11-24 06:25 - * Sender: Andrew Wiggin - * Status update: I have code changes to actually make basic bevel modifier work. The things that still need to be done: - * - clean up the changes - * - get bevel by weight and bevel by angles working for vertex only bevel. - * - the code uses adaptations of a couple of bmesh APIs, - * that work a little differently. for example, a join faces that doesn't just create a new face and then delete the - * original two faces and all associated loops, it extends one of the original faces to cover all the original loops - * (except for the loop on the join edge which is of course deleted). the bevel code currently requires this because it - * expects to be able to continue walking loop lists and doesn't like for loops to be deleted out from under it - * while working... - * but bmesh APIs don't do it this way because it makes it trickier to manage the interp during these operations, - * so I need to decide what to do in these cases. - */ - -/* BMESH_TODO - resolve this */ -#define BMESH_263_VERT_BEVEL_WORKAROUND - -/* ------- Bevel code starts here -------- */ - -static BME_TransData_Head *BME_init_transdata(int bufsize) -{ - BME_TransData_Head *td; - - td = MEM_callocN(sizeof(BME_TransData_Head), "BM transdata header"); - td->gh = BLI_ghash_ptr_new("BME_init_transdata gh"); - td->ma = BLI_memarena_new(bufsize, "BME_TransData arena"); - BLI_memarena_use_calloc(td->ma); - - return td; -} - -void BME_free_transdata(BME_TransData_Head *td) -{ - BLI_ghash_free(td->gh, NULL, NULL); - BLI_memarena_free(td->ma); - MEM_freeN(td); -} - -static BME_TransData *BME_assign_transdata(BME_TransData_Head *td, BMesh *bm, BMVert *v, - float *co, float *org, float *vec, float *loc, - float factor, float weight, float maxfactor, float *max) -{ - BME_TransData *vtd; - int is_new = false; - - if (v == NULL) { - return NULL; - } - - if ((vtd = BLI_ghash_lookup(td->gh, v)) == NULL && bm != NULL) { - vtd = BLI_memarena_alloc(td->ma, sizeof(*vtd)); - BLI_ghash_insert(td->gh, v, vtd); - td->len++; - is_new = true; - } - - vtd->bm = bm; - vtd->v = v; - - if (co != NULL) { - copy_v3_v3(vtd->co, co); - } - - if (org == NULL && is_new) { - copy_v3_v3(vtd->org, v->co); /* default */ - } - else if (org != NULL) { - copy_v3_v3(vtd->org, org); - } - - if (vec != NULL) { - copy_v3_v3(vtd->vec, vec); - normalize_v3(vtd->vec); - } - - vtd->loc = loc; - - vtd->factor = factor; - vtd->weight = weight; - vtd->maxfactor = maxfactor; - vtd->max = max; - - return vtd; -} - -BME_TransData *BME_get_transdata(BME_TransData_Head *td, BMVert *v) -{ - BME_TransData *vtd; - vtd = BLI_ghash_lookup(td->gh, v); - return vtd; -} - -/* a hack (?) to use the transdata memarena to allocate floats for use with the max limits */ -static float *BME_new_transdata_float(BME_TransData_Head *td) -{ - return BLI_memarena_alloc(td->ma, sizeof(float)); -} - -/* ported from before bmesh merge into trunk (was called) - * problem with this is it creates 2 vert faces */ -static void BME_Bevel_Dissolve_Disk(BMesh *bm, BMVert *v) -{ - BMFace *f; - BMEdge *e; - bool done; - - if (v->e) { - done = false; - while (!done) { - done = true; - e = v->e; /*loop the edge looking for a edge to dissolve*/ - do { - f = NULL; - if (BM_edge_is_manifold(e)) { - f = bmesh_jfke(bm, e->l->f, e->l->radial_next->f, e); - } - if (f) { - done = false; - break; - } - e = bmesh_disk_edge_next(e, v); - } while (e != v->e); - } - BM_vert_collapse_edge(bm, v->e, v, true); - // bmesh_jekv(bm, v->e, v, false); - } -} - -static int BME_bevel_is_split_vert(BMesh *bm, BMLoop *l) -{ - /* look for verts that have already been added to the edge when - * beveling other polys; this can be determined by testing the - * vert and the edges around it for originality - */ - if (!BMO_elem_flag_test(bm, l->v, BME_BEVEL_ORIG) && - BMO_elem_flag_test(bm, l->e, BME_BEVEL_ORIG) && - BMO_elem_flag_test(bm, l->prev->e, BME_BEVEL_ORIG)) - { - return 1; - } - return 0; -} - -/* get a vector, vec, that points from v1->co to wherever makes sense to - * the bevel operation as a whole based on the relationship between v1 and v2 - * (won't necessarily be a vec from v1->co to v2->co, though it probably will be); - * the return value is -1 for failure, 0 if we used vert co's, and 1 if we used transform origins */ -static int BME_bevel_get_vec(float vec[3], BMVert *v1, BMVert *v2, BME_TransData_Head *td) -{ - BME_TransData *vtd1, *vtd2; - - vtd1 = BME_get_transdata(td, v1); - vtd2 = BME_get_transdata(td, v2); - if (!vtd1 || !vtd2) { - //printf("BME_bevel_get_vec() got called without proper BME_TransData\n"); - return -1; - } - - /* compare the transform origins to see if we can use the vert co's; - * if they belong to different origins, then we will use the origins to determine - * the vector */ - if (compare_v3v3(vtd1->org, vtd2->org, 0.000001f)) { - sub_v3_v3v3(vec, v2->co, v1->co); - if (len_v3(vec) < 0.000001f) { - zero_v3(vec); - } - return 0; - } - else { - sub_v3_v3v3(vec, vtd2->org, vtd1->org); - if (len_v3(vec) < 0.000001f) { - zero_v3(vec); - } - return 1; - } -} - -/* "Projects" a vector perpendicular to vec2 against vec1, such that - * the projected vec1 + vec2 has a min distance of 1 from the "edge" defined by vec2. - * note: the direction, is_forward, is used in conjunction with up_vec to determine - * whether this is a convex or concave corner. If it is a concave corner, it will - * be projected "backwards." If vec1 is before vec2, is_forward should be 0 (we are projecting backwards). - * vec1 is the vector to project onto (expected to be normalized) - * vec2 is the direction of projection (pointing away from vec1) - * up_vec is used for orientation (expected to be normalized) - * returns the length of the projected vector that lies along vec1 */ -static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, - int is_forward, BME_TransData_Head *UNUSED(td)) -{ - float factor, vec3[3], tmp[3], c1, c2; - - cross_v3_v3v3(tmp, vec1, vec2); - normalize_v3(tmp); - factor = dot_v3v3(up_vec, tmp); - if ((factor > 0 && is_forward) || (factor < 0 && !is_forward)) { - cross_v3_v3v3(vec3, vec2, tmp); /* hmm, maybe up_vec should be used instead of tmp */ - } - else { - cross_v3_v3v3(vec3, tmp, vec2); /* hmm, maybe up_vec should be used instead of tmp */ - } - normalize_v3(vec3); - c1 = dot_v3v3(vec3, vec1); - c2 = dot_v3v3(vec1, vec1); - if (fabsf(c1) < 0.000001f || fabsf(c2) < 0.000001f) { - factor = 0.0f; - } - else { - factor = c2 / c1; - } - - return factor; -} - -/* BME_bevel_split_edge() is the main math work-house; its responsibilities are: - * using the vert and the loop passed, get or make the split vert, set its coordinates - * and transform properties, and set the max limits. - * Finally, return the split vert. */ -static BMVert *BME_bevel_split_edge(BMesh *bm, BMVert *v, BMVert *v1, BMLoop *l, - float *up_vec, float value, BME_TransData_Head *td) -{ - BME_TransData *vtd, *vtd1, *vtd2; - BMVert *sv, *v2, *v3, *ov; - BMLoop *lv1, *lv2; - BMEdge *ne, *e1, *e2; - float maxfactor, scale, len, dis, vec1[3], vec2[3], t_up_vec[3]; - int is_edge, forward, is_split_vert; - - /* ov, vtd2, and is_split_vert are set but UNUSED */ - (void)ov, (void)vtd2, (void)is_split_vert; - - if (l == NULL) { - /* what you call operator overloading in C :) - * I wanted to use the same function for both wire edges and poly loops - * so... here we walk around edges to find the needed verts */ - forward = 1; - is_split_vert = 0; - if (v->e == NULL) { - //printf("We can't split a loose vert's edge!\n"); - return NULL; - } - e1 = v->e; /* we just use the first two edges */ - e2 = bmesh_disk_edge_next(v->e, v); - if (e1 == e2) { - //printf("You need at least two edges to use BME_bevel_split_edge()\n"); - return NULL; - } - v2 = BM_edge_other_vert(e1, v); - v3 = BM_edge_other_vert(e2, v); - if (v1 != v2 && v1 != v3) { - //printf("Error: more than 2 edges in v's disk cycle, or v1 does not share an edge with v\n"); - return NULL; - } - if (v1 == v2) { - v2 = v3; - } - else { - e1 = e2; - } - ov = BM_edge_other_vert(e1, v); - sv = BM_edge_split(bm, e1, v, &ne, 0.0f); - //BME_data_interp_from_verts(bm, v, ov, sv, 0.25); /* this is technically wrong.. */ - //BME_data_interp_from_faceverts(bm, v, ov, sv, 0.25); - //BME_data_interp_from_faceverts(bm, ov, v, sv, 0.25); - BME_assign_transdata(td, bm, sv, sv->co, sv->co, NULL, sv->co, 0, -1, -1, NULL); /* quick default */ - BMO_elem_flag_enable(bm, sv, BME_BEVEL_BEVEL); - BMO_elem_flag_enable(bm, ne, BME_BEVEL_ORIG); /* mark edge as original, even though it isn't */ - BME_bevel_get_vec(vec1, v1, v, td); - BME_bevel_get_vec(vec2, v2, v, td); - cross_v3_v3v3(t_up_vec, vec1, vec2); - normalize_v3(t_up_vec); - up_vec = t_up_vec; - } - else { - /* establish loop direction */ - if (l->v == v) { - forward = 1; - lv1 = l->next; - lv2 = l->prev; - v1 = l->next->v; - v2 = l->prev->v; - } - else if (l->next->v == v) { - forward = 0; - lv1 = l; - lv2 = l->next->next; - v1 = l->v; - v2 = l->next->next->v; - } - else { - //printf("ERROR: BME_bevel_split_edge() - v must be adjacent to l\n"); - return NULL; - } - - if (BME_bevel_is_split_vert(bm, lv1)) { - is_split_vert = 1; - sv = v1; - v1 = forward ? l->next->next->v : l->prev->v; - } - else { - is_split_vert = 0; - ov = BM_edge_other_vert(l->e, v); - sv = BM_edge_split(bm, l->e, v, &ne, 0.0f); - //BME_data_interp_from_verts(bm, v, ov, sv, 0.25); /* this is technically wrong.. */ - //BME_data_interp_from_faceverts(bm, v, ov, sv, 0.25); - //BME_data_interp_from_faceverts(bm, ov, v, sv, 0.25); - BME_assign_transdata(td, bm, sv, sv->co, sv->co, NULL, sv->co, 0, -1, -1, NULL); /* quick default */ - BMO_elem_flag_enable(bm, sv, BME_BEVEL_BEVEL); - BMO_elem_flag_enable(bm, ne, BME_BEVEL_ORIG); /* mark edge as original, even though it isn't */ - } - - if (BME_bevel_is_split_vert(bm, lv2)) { - v2 = forward ? lv2->prev->v : lv2->next->v; - } - } - - is_edge = BME_bevel_get_vec(vec1, v, v1, td); /* get the vector we will be projecting onto */ - BME_bevel_get_vec(vec2, v, v2, td); /* get the vector we will be projecting parallel to */ - len = normalize_v3(vec1); - - vtd = BME_get_transdata(td, sv); - vtd1 = BME_get_transdata(td, v); - vtd2 = BME_get_transdata(td, v1); - - if (vtd1->loc == NULL) { - /* this is a vert with data only for calculating initial weights */ - if (vtd1->weight < 0.0f) { - vtd1->weight = 0.0f; - } - scale = vtd1->weight / vtd1->factor; - if (!vtd1->max) { - vtd1->max = BME_new_transdata_float(td); - *vtd1->max = -1; - } - } - else { - scale = vtd1->weight; - } - vtd->max = vtd1->max; - - if (is_edge && vtd1->loc != NULL) { - maxfactor = vtd1->maxfactor; - } - else { - maxfactor = scale * BME_bevel_project_vec(vec1, vec2, up_vec, forward, td); - if (vtd->maxfactor > 0 && vtd->maxfactor < maxfactor) { - maxfactor = vtd->maxfactor; - } - } - - dis = BMO_elem_flag_test(bm, v1, BME_BEVEL_ORIG) ? len / 3 : len / 2; - if (is_edge || dis > maxfactor * value) { - dis = maxfactor * value; - } - madd_v3_v3v3fl(sv->co, v->co, vec1, dis); - sub_v3_v3v3(vec1, sv->co, vtd1->org); - dis = normalize_v3(vec1); - BME_assign_transdata(td, bm, sv, vtd1->org, vtd1->org, vec1, sv->co, dis, scale, maxfactor, vtd->max); - - return sv; -} - -#if 0 /* UNUSED */ -static float BME_bevel_set_max(BMVert *v1, BMVert *v2, float value, BME_TransData_Head *td) -{ - BME_TransData *vtd1, *vtd2; - float max, fac1, fac2, vec1[3], vec2[3], vec3[3]; - - BME_bevel_get_vec(vec1, v1, v2, td); - vtd1 = BME_get_transdata(td, v1); - vtd2 = BME_get_transdata(td, v2); - - if (vtd1->loc == NULL) { - fac1 = 0; - } - else { - copy_v3_v3(vec2, vtd1->vec); - mul_v3_fl(vec2, vtd1->factor); - if (dot_v3v3(vec1, vec1)) { - project_v3_v3v3(vec2, vec2, vec1); - fac1 = len_v3(vec2) / value; - } - else { - fac1 = 0; - } - } - - if (vtd2->loc == NULL) { - fac2 = 0; - } - else { - copy_v3_v3(vec3, vtd2->vec); - mul_v3_fl(vec3, vtd2->factor); - if (dot_v3v3(vec1, vec1)) { - project_v3_v3v3(vec2, vec3, vec1); - fac2 = len_v3(vec2) / value; - } - else { - fac2 = 0; - } - } - - if (fac1 || fac2) { - max = len_v3(vec1) / (fac1 + fac2); - if (vtd1->max && (*vtd1->max < 0 || max < *vtd1->max)) { - *vtd1->max = max; - } - if (vtd2->max && (*vtd2->max < 0 || max < *vtd2->max)) { - *vtd2->max = max; - } - } - else { - max = -1; - } - - return max; -} -#endif - -#if 0 /* UNUSED */ -static BMVert *BME_bevel_wire(BMesh *bm, BMVert *v, float value, int res, int UNUSED(options), BME_TransData_Head *td) -{ - BMVert *ov1, *ov2, *v1, *v2; - - ov1 = BM_edge_other_vert(v->e, v); - ov2 = BM_edge_other_vert(bmesh_disk_edge_next(v->e, v), v); - - /* split the edges */ - v1 = BME_bevel_split_edge(bm, v, ov1, NULL, NULL, value, td); - BMO_elem_flag_enable(bm, v1, BME_BEVEL_NONMAN); - v2 = BME_bevel_split_edge(bm, v, ov2, NULL, NULL, value, td); - BMO_elem_flag_enable(bm, v2, BME_BEVEL_NONMAN); - - if (value > 0.5) { - BME_bevel_set_max(v1, ov1, value, td); - BME_bevel_set_max(v2, ov2, value, td); - } - - /* remove the original vert */ - if (res) { - /* bmesh_jekv; */ - - //void BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac, int calcnorm) { - //hrm, why is there a fac here? it just removes a vert - BM_vert_collapse_edge(bm, v->e, v); - } - - return v1; -} -#endif - -static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(options), - float *up_vec, BME_TransData_Head *td) -{ - BMVert *v1, *v2, *kv; - BMLoop *kl = NULL, *nl; - BMEdge *e, *ke, *se; - BMFace *f, *jf; - - f = l->f; - e = l->e; - - /* sanity check */ - if (!BMO_elem_flag_test(bm, l->e, BME_BEVEL_BEVEL) && - (BMO_elem_flag_test(bm, l->v, BME_BEVEL_BEVEL) || BMO_elem_flag_test(bm, l->next->v, BME_BEVEL_BEVEL))) - { - return l; - } - - /* checks and operations for prev edge */ - /* first, check to see if this edge was inset previously */ - if (!BMO_elem_flag_test(bm, l->prev->e, BME_BEVEL_ORIG) && - !BMO_elem_flag_test(bm, l->v, BME_BEVEL_NONMAN)) - { - kl = l->prev->radial_next; - kl = (kl->v == l->v) ? kl->prev : kl->next; - kv = l->v; - } - else { - kv = NULL; - } - /* get/make the first vert to be used in SFME */ - if (BMO_elem_flag_test(bm, l->v, BME_BEVEL_NONMAN)) { - v1 = l->v; - } - else { /* we'll need to split the previous edge */ - v1 = BME_bevel_split_edge(bm, l->v, NULL, l->prev, up_vec, value, td); - } - /* if we need to clean up geometry... */ - if (kv) { - se = l->next->e; - jf = NULL; - if (kl->v == kv) { - BM_face_split(bm, kl->f, kl->prev->v, kl->next->v, &nl, kl->prev->e, true); - ke = kl->e; - /* BMESH-TODO: jfke doesn't handle customdata */ - jf = bmesh_jfke(bm, kl->prev->radial_next->f, kl->f, kl->prev->e); - BM_vert_collapse_edge(bm, ke, kv, false); - } - else { - BM_face_split(bm, kl->f, kl->next->next->v, kl->v, &nl, kl->next->e, true); - ke = kl->e; - /* BMESH-TODO: jfke doesn't handle customdata */ - jf = bmesh_jfke(bm, kl->next->radial_next->f, kl->f, kl->next->e); - BM_vert_collapse_edge(bm, ke, kv, false); - } - /* find saved loop pointer */ - l = se->l; - while (l->f != jf) { - l = l->radial_next; - BLI_assert(l != se->l); - } - l = l->prev; - } - - /* checks and operations for the next edge */ - /* first, check to see if this edge was inset previously */ - if (!BMO_elem_flag_test(bm, l->next->e, BME_BEVEL_ORIG) && - !BMO_elem_flag_test(bm, l->next->v, BME_BEVEL_NONMAN)) - { - kl = l->next->radial_next; - kl = (kl->v == l->next->v) ? kl->prev : kl->next; - kv = l->next->v; - } - else { - kv = NULL; - } - /* get/make the second vert to be used in SFME */ - if (BMO_elem_flag_test(bm, l->next->v, BME_BEVEL_NONMAN)) { - v2 = l->next->v; - } - else { /* we'll need to split the next edge */ - v2 = BME_bevel_split_edge(bm, l->next->v, NULL, l->next, up_vec, value, td); - } - /* if we need to clean up geometry... */ - if (kv) { - se = l->e; - jf = NULL; - if (kl->v == kv) { - BM_face_split(bm, kl->f, kl->prev->v, kl->next->v, &nl, kl->prev->e, true); - ke = kl->e; - /* BMESH-TODO: jfke doesn't handle customdata */ - jf = bmesh_jfke(bm, kl->prev->radial_next->f, kl->f, kl->prev->e); - BM_vert_collapse_edge(bm, ke, kv, false); - } - else { - BM_face_split(bm, kl->f, kl->next->next->v, kl->v, &nl, kl->next->e, true); - ke = kl->e; - /* BMESH-TODO: jfke doesn't handle customdata */ - jf = bmesh_jfke(bm, kl->next->radial_next->f, kl->f, kl->next->e); - BM_vert_collapse_edge(bm, ke, kv, false); - } - /* find saved loop pointer */ - l = se->l; - while (l->f != jf) { - l = l->radial_next; - BLI_assert(l != se->l); - } - } - - if (!BMO_elem_flag_test(bm, v1, BME_BEVEL_NONMAN) || !BMO_elem_flag_test(bm, v2, BME_BEVEL_NONMAN)) { - BM_face_split(bm, f, v2, v1, &l, e, true); - BMO_elem_flag_enable(bm, l->e, BME_BEVEL_BEVEL); - l = l->radial_next; - } - - if (l->f != f) { - //printf("Whoops! You got something out of order in BME_bevel_edge()!\n"); - } - - return l; -} - -static BMLoop *BME_bevel_vert(BMesh *bm, BMLoop *l, float value, int UNUSED(options), - float up_vec[3], BME_TransData_Head *td) -{ - BMVert *v1, *v2; - /* BMFace *f; */ /* UNUSED */ - - /* get/make the first vert to be used in SFME */ - /* may need to split the previous edge */ - v1 = BME_bevel_split_edge(bm, l->v, NULL, l->prev, up_vec, value, td); - - /* get/make the second vert to be used in SFME */ - /* may need to split this edge (so move l) */ - l = l->prev; - v2 = BME_bevel_split_edge(bm, l->next->v, NULL, l->next, up_vec, value, td); - l = l->next->next; - - /* "cut off" this corner */ - /* f = */ BM_face_split(bm, l->f, v2, v1, NULL, l->e, true); - - return l; -} - -/* - * BME_bevel_poly - * - * Polygon inset tool: - * - * Insets a polygon/face based on the flagss of its vertices - * and edges. Used by the bevel tool only, for now. - * The parameter "value" is the distance to inset (should be negative). - * The parameter "options" is not currently used. - * - * Returns - - * A BMFace pointer to the resulting inner face. - */ -static BMFace *BME_bevel_poly(BMesh *bm, BMFace *f, float value, int options, BME_TransData_Head *td) -{ - BMLoop *l /*, *o */; - BME_TransData *vtd1, *vtd2; - float up_vec[3], vec1[3], vec2[3], vec3[3], fac1, fac2, max = -1; - int len, i; - BMIter iter; - - zero_v3(up_vec); - - /* find a good normal for this face (there's better ways, I'm sure) */ - BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) { -#ifdef BMESH_263_VERT_BEVEL_WORKAROUND - add_newell_cross_v3_v3v3(up_vec, l->prev->v->co, l->v->co); -#else - BME_bevel_get_vec(vec1, l->v, l->next->v, td); - BME_bevel_get_vec(vec2, l->prev->v, l->v, td); - cross_v3_v3v3(vec3, vec2, vec1); - add_v3_v3(up_vec, vec3); - -#endif - } - normalize_v3(up_vec); - - /* Can't use a BM_LOOPS_OF_FACE iterator here, because the loops are being modified - * and so the end condition will never hi */ - for (l = BM_FACE_FIRST_LOOP(f)->prev, i = 0, len = f->len; i < len; i++, l = l->next) { - if (BMO_elem_flag_test(bm, l->e, BME_BEVEL_BEVEL) && BMO_elem_flag_test(bm, l->e, BME_BEVEL_ORIG)) { - max = 1.0f; - l = BME_bevel_edge(bm, l, value, options, up_vec, td); - } - else if (BMO_elem_flag_test(bm, l->v, BME_BEVEL_BEVEL) && - BMO_elem_flag_test(bm, l->v, BME_BEVEL_ORIG) && - !BMO_elem_flag_test(bm, l->prev->e, BME_BEVEL_BEVEL)) - { - /* avoid making double vertices [#33438] */ - BME_TransData *vtd; - vtd = BME_get_transdata(td, l->v); - if (vtd->weight == 0.0f) { - BMO_elem_flag_disable(bm, l->v, BME_BEVEL_BEVEL); - } - else { - max = 1.0f; - l = BME_bevel_vert(bm, l, value, options, up_vec, td); - } - } - } - - f = l->f; - - /* max pass */ - if (value > 0.5f && max > 0.0f) { - max = -1; - BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) { - if (BMO_elem_flag_test(bm, l->e, BME_BEVEL_BEVEL) || BMO_elem_flag_test(bm, l->e, BME_BEVEL_ORIG)) { - BME_bevel_get_vec(vec1, l->v, l->next->v, td); - vtd1 = BME_get_transdata(td, l->v); - vtd2 = BME_get_transdata(td, l->next->v); - if (vtd1->loc == NULL) { - fac1 = 0; - } - else { - copy_v3_v3(vec2, vtd1->vec); - mul_v3_fl(vec2, vtd1->factor); - if (dot_v3v3(vec1, vec1)) { - project_v3_v3v3(vec2, vec2, vec1); - fac1 = len_v3(vec2) / value; - } - else { - fac1 = 0; - } - } - if (vtd2->loc == NULL) { - fac2 = 0; - } - else { - copy_v3_v3(vec3, vtd2->vec); - mul_v3_fl(vec3, vtd2->factor); - if (dot_v3v3(vec1, vec1)) { - project_v3_v3v3(vec2, vec3, vec1); - fac2 = len_v3(vec2) / value; - } - else { - fac2 = 0; - } - } - if (fac1 || fac2) { - max = len_v3(vec1) / (fac1 + fac2); - if (vtd1->max && (*vtd1->max < 0 || max < *vtd1->max)) { - *vtd1->max = max; - } - if (vtd2->max && (*vtd2->max < 0 || max < *vtd2->max)) { - *vtd2->max = max; - } - } - } - } - } - - /* return l->f; */ - return NULL; -} - -static float BME_bevel_get_angle(BMEdge *e, BMVert *v) -{ - BMVert *v1, *v2; - BMLoop *l1, *l2; - float vec1[3], vec2[3], vec3[3], vec4[3]; - - l1 = e->l; - l2 = e->l->radial_next; - if (l1->v == v) { - v1 = l1->prev->v; - v2 = l1->next->v; - } - else { - v1 = l1->next->next->v; - v2 = l1->v; - } - sub_v3_v3v3(vec1, v1->co, v->co); - sub_v3_v3v3(vec2, v2->co, v->co); - cross_v3_v3v3(vec3, vec1, vec2); - - l1 = l2; - if (l1->v == v) { - v1 = l1->prev->v; - v2 = l1->next->v; - } - else { - v1 = l1->next->next->v; - v2 = l1->v; - } - sub_v3_v3v3(vec1, v1->co, v->co); - sub_v3_v3v3(vec2, v2->co, v->co); - cross_v3_v3v3(vec4, vec2, vec1); - - normalize_v3(vec3); - normalize_v3(vec4); - - return dot_v3v3(vec3, vec4); -} - -static float BME_bevel_get_angle_vert(BMVert *v) -{ - BMIter iter; - BMLoop *l; - float n[3]; - float n_tmp[3]; - float angle_diff = 0.0f; - float tot_angle = 0.0f; - - - BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) { - const float angle = BM_loop_calc_face_angle(l); - tot_angle += angle; - BM_loop_calc_face_normal(l, n_tmp); - madd_v3_v3fl(n, n_tmp, angle); - } - normalize_v3(n); - - BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) { - /* could cache from before */ - BM_loop_calc_face_normal(l, n_tmp); - angle_diff += angle_normalized_v3v3(n, n_tmp) * BM_loop_calc_face_angle(l); - } - - /* return cosf(angle_diff + 0.001f); */ /* compare with dot product */ - return (angle_diff / tot_angle) * (float)(M_PI / 2.0); -} - -static void BME_bevel_add_vweight(BME_TransData_Head *td, BMesh *bm, BMVert *v, float weight, float factor, int options) -{ - BME_TransData *vtd; - - if (BMO_elem_flag_test(bm, v, BME_BEVEL_NONMAN)) { - return; - } - - BMO_elem_flag_enable(bm, v, BME_BEVEL_BEVEL); - if ((vtd = BME_get_transdata(td, v))) { - if (options & BME_BEVEL_EMIN) { - vtd->factor = 1.0; - if (vtd->weight < 0 || weight < vtd->weight) { - vtd->weight = weight; - } - } - else if (options & BME_BEVEL_EMAX) { - vtd->factor = 1.0; - if (weight > vtd->weight) { - vtd->weight = weight; - } - } - else if (vtd->weight < 0.0f) { - vtd->factor = factor; - vtd->weight = weight; - } - else { - vtd->factor += factor; /* increment number of edges with weights (will be averaged) */ - vtd->weight += weight; /* accumulate all the weights */ - } - } - else { - /* we'll use vtd->loc == NULL to mark that this vert is not moving */ - vtd = BME_assign_transdata(td, bm, v, v->co, NULL, NULL, NULL, factor, weight, -1, NULL); - } -} - -static void bevel_init_verts(BMesh *bm, int options, float angle, BME_TransData_Head *td) -{ - BMVert *v; - BMIter iter; - float weight; - /* const float threshold = (options & BME_BEVEL_ANGLE) ? cosf(angle + 0.001) : 0.0f; */ /* UNUSED */ - - BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { - weight = 0.0f; - if (!BMO_elem_flag_test(bm, v, BME_BEVEL_NONMAN)) { - /* modifiers should not use selection */ - if (options & BME_BEVEL_SELECT) { - if (BM_elem_flag_test(v, BM_ELEM_SELECT)) { - weight = 1.0f; - } - } - /* bevel weight NYI */ - else if (options & BME_BEVEL_WEIGHT) { - weight = BM_elem_float_data_get(&bm->vdata, v, CD_BWEIGHT); - } - else if (options & BME_BEVEL_ANGLE) { - /* dont set weight_v1/weight_v2 here, add direct */ - if (BME_bevel_get_angle_vert(v) > angle) { - weight = 1.0f; - } - } - else { - weight = 1.0f; - } - - if (weight > 0.0f) { - BMO_elem_flag_enable(bm, v, BME_BEVEL_BEVEL); - BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 1.0, weight, -1, NULL); - } - } - } -} - -static void bevel_init_edges(BMesh *bm, int options, float angle, BME_TransData_Head *td) -{ - BMEdge *e; - int count; - float weight; - BMIter iter; - const float threshold = (options & BME_BEVEL_ANGLE) ? cosf(angle + 0.001f) : 0.0f; - - BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { - weight = 0.0f; - if (!BMO_elem_flag_test(bm, e, BME_BEVEL_NONMAN)) { - if (options & BME_BEVEL_SELECT) { - if (BM_elem_flag_test(e, BM_ELEM_SELECT)) { - weight = 1.0f; - } - } - else if (options & BME_BEVEL_WEIGHT) { - weight = BM_elem_float_data_get(&bm->edata, e, CD_BWEIGHT); - } - else if (options & BME_BEVEL_ANGLE) { - /* dont set weight_v1/weight_v2 here, add direct */ - if (!BMO_elem_flag_test(bm, e->v1, BME_BEVEL_NONMAN) && BME_bevel_get_angle(e, e->v1) < threshold) { - BMO_elem_flag_enable(bm, e, BME_BEVEL_BEVEL); - BME_bevel_add_vweight(td, bm, e->v1, 1.0, 1.0, options); - } - else { - BME_bevel_add_vweight(td, bm, e->v1, 0.0, 1.0, options); - } - if (!BMO_elem_flag_test(bm, e->v2, BME_BEVEL_NONMAN) && BME_bevel_get_angle(e, e->v2) < threshold) { - BMO_elem_flag_enable(bm, e, BME_BEVEL_BEVEL); - BME_bevel_add_vweight(td, bm, e->v2, 1.0, 1.0, options); - } - else { - BME_bevel_add_vweight(td, bm, e->v2, 0.0, 1.0, options); - } - } - else { - weight = 1.0f; - } - - if (weight > 0.0f) { - BMO_elem_flag_enable(bm, e, BME_BEVEL_BEVEL); - BME_bevel_add_vweight(td, bm, e->v1, weight, 1.0, options); - BME_bevel_add_vweight(td, bm, e->v2, weight, 1.0, options); - } - } - } - - /* clean up edges with 2 faces that share more than one edg */ - BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { - if (BMO_elem_flag_test(bm, e, BME_BEVEL_BEVEL)) { - count = BM_face_share_edge_count(e->l->f, e->l->radial_next->f); - if (count > 1) BMO_elem_flag_disable(bm, e, BME_BEVEL_BEVEL); - } - } -} - -static BMesh *BME_bevel_initialize(BMesh *bm, int options, - int UNUSED(defgrp_index), float angle, BME_TransData_Head *td) -{ - BMVert *v /*, *v2 */; - BMEdge *e /*, *curedg */; - BMFace *f; - BMIter iter; - int /* wire, */ len; - - /* tag non-manifold geometry */ - BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { - BMO_elem_flag_enable(bm, v, BME_BEVEL_ORIG); - if (v->e) { - BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 0, -1, -1, NULL); - if (!BM_vert_is_manifold(v)) { - BMO_elem_flag_enable(bm, v, BME_BEVEL_NONMAN); - } - - /* test wire ver */ - len = BM_vert_edge_count(v); - if (len == 2 && BM_vert_is_wire(v)) - BMO_elem_flag_disable(bm, v, BME_BEVEL_NONMAN); - } - else { - BMO_elem_flag_enable(bm, v, BME_BEVEL_NONMAN); - } - } - - BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { - BMO_elem_flag_enable(bm, e, BME_BEVEL_ORIG); - if (!(BM_edge_is_boundary(e) || BM_edge_is_manifold(e))) { - BMO_elem_flag_enable(bm, e->v1, BME_BEVEL_NONMAN); - BMO_elem_flag_enable(bm, e->v2, BME_BEVEL_NONMAN); - BMO_elem_flag_enable(bm, e, BME_BEVEL_NONMAN); - } - if (BMO_elem_flag_test(bm, e->v1, BME_BEVEL_NONMAN) || BMO_elem_flag_test(bm, e->v2, BME_BEVEL_NONMAN)) { - BMO_elem_flag_enable(bm, e, BME_BEVEL_NONMAN); - } - } - - BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { - BMO_elem_flag_enable(bm, f, BME_BEVEL_ORIG); - } - - if (options & BME_BEVEL_VERT) { - bevel_init_verts(bm, options, angle, td); - } - else { - bevel_init_edges(bm, options, angle, td); - } - - return bm; - -} - -#if 0 - -static BMesh *BME_bevel_reinitialize(BMesh *bm) -{ - BMVert *v; - BMEdge *e; - BMFace *f; - BMIter iter; - - BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { - BMO_elem_flag_enable(bm, v, BME_BEVEL_ORIG); - } - BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { - BMO_elem_flag_enable(bm, e, BME_BEVEL_ORIG); - } - BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { - BMO_elem_flag_enable(bm, f, BME_BEVEL_ORIG); - } - return bm; - -} - -#endif - -/** - * BME_bevel_mesh - * - * Mesh beveling tool: - * - * Bevels an entire mesh. It currently uses the flags of - * its vertices and edges to track topological changes. - * The parameter "value" is the distance to inset (should be negative). - * The parameter "options" is not currently used. - * - * \return A BMesh pointer to the BM passed as a parameter. - */ - -static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int options, - int UNUSED(defgrp_index), BME_TransData_Head *td) -{ - BMVert *v; - BMEdge *e, *curedge; - BMLoop *l, *l2; - BMFace *f; - BMIter iter; - - /* unsigned int i, len; */ - - /* bevel poly */ - BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { - if (BMO_elem_flag_test(bm, f, BME_BEVEL_ORIG)) { - BME_bevel_poly(bm, f, value, options, td); - } - } - - /* get rid of beveled edge */ - BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { - if (BMO_elem_flag_test(bm, e, BME_BEVEL_BEVEL) && BMO_elem_flag_test(bm, e, BME_BEVEL_ORIG)) { - BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e, true); - } - } - - /* link up corners and cli */ - BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { - if (BMO_elem_flag_test(bm, v, BME_BEVEL_ORIG) && BMO_elem_flag_test(bm, v, BME_BEVEL_BEVEL)) { - curedge = v->e; - do { - l = curedge->l; - l2 = l->radial_next; - if (l->v != v) l = l->next; - if (l2->v != v) l2 = l2->next; - if (l->f->len > 3) - BM_face_split(bm, l->f, l->next->v, l->prev->v, &l, l->e, true); /* clip this corner off */ - if (l2->f->len > 3) - BM_face_split(bm, l2->f, l2->next->v, l2->prev->v, &l, l2->e, true); /* clip this corner off */ - curedge = bmesh_disk_edge_next(curedge, v); - } while (curedge != v->e); - BME_Bevel_Dissolve_Disk(bm, v); - } - } - -#ifdef DEBUG - /* Debug print, remov */ - BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { - if (f->len == 2) { - printf("%s: warning, 2 edge face\n", __func__); - } - } -#endif - - return bm; -} - -BMesh *BME_bevel(BMesh *bm, float value, int res, int options, int defgrp_index, float angle, - BME_TransData_Head **rtd) -{ - BMVert *v; - BMIter iter; - - BME_TransData_Head *td; - BME_TransData *vtd; - int i; - double fac = 1.0, d; - - td = BME_init_transdata(BLI_MEMARENA_STD_BUFSIZE); - /* recursion math courtesy of Martin Poirier (theeth) */ - for (i = 0; i < res - 1; i++) { - if (i == 0) fac += 1.0 / 3.0; - else fac += 1.0 / (3.0 * i * 2.0); - } - d = 1.0 / fac; - - BM_mesh_elem_toolflags_ensure(bm); - - for (i = 0; i < res || (res == 0 && i == 0); i++) { - BMO_push(bm, NULL); - BME_bevel_initialize(bm, options, defgrp_index, angle, td); - //if (i != 0) BME_bevel_reinitialize(bm); - bmesh_edit_begin(bm, 0); - BME_bevel_mesh(bm, (float)d, res, options, defgrp_index, td); - bmesh_edit_end(bm, 0); - d /= (i == 0) ? 3.0 : 2.0; - BMO_pop(bm); - } - - /* interactive preview? */ - if (rtd) { - *rtd = td; - return bm; - } - - /* otherwise apply transforms */ - BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { - if ((vtd = BME_get_transdata(td, v))) { - if (vtd->max && (*vtd->max > 0 && value > *vtd->max)) { - d = *vtd->max; - } - else { - d = value; - } - madd_v3_v3v3fl(v->co, vtd->org, vtd->vec, vtd->factor * (float)d); - } - } - - BME_free_transdata(td); - return bm; -} diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index d7073ef61be..02f0251bff2 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -34,6 +34,7 @@ #include "DNA_meshdata_types.h" #include "BLI_array.h" +#include "BLI_alloca.h" #include "BLI_math.h" #include "BLI_memarena.h" @@ -1941,26 +1942,35 @@ static void bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v) int i, found_shared_face, ccw_test_sum; int nsel = 0; int ntot = 0; + int fcnt; /* Gather input selected edges. * Only bevel selected edges that have exactly two incident faces. + * Want edges to be ordered so that they share faces. + * There may be one or more chains of shared faces broken by + * gaps where there are no faces. + * TODO: make following work when more than one gap. */ - if (bp->vertex_only) - first_bme = v->e; - else - first_bme = NULL; + first_bme = NULL; BM_ITER_ELEM (bme, &iter, v, BM_EDGES_OF_VERT) { + fcnt = BM_edge_face_count(bme); if (BM_elem_flag_test(bme, BM_ELEM_TAG) && !bp->vertex_only) { - BLI_assert(BM_edge_is_manifold(bme)); + BLI_assert(fcnt == 2); nsel++; if (!first_bme) first_bme = bme; } + if (fcnt == 1) { + /* good to start face chain from this edge */ + first_bme = bme; + } ntot++; BM_BEVEL_EDGE_TAG_DISABLE(bme); } + if (!first_bme) + first_bme = v->e; if ((nsel == 0 && !bp->vertex_only) || (ntot < 3 && bp->vertex_only)) { /* signal this vert isn't being beveled */ @@ -2223,6 +2233,7 @@ static void bevel_build_edge_polygons(BMesh *bm, BevelParams *bp, BMEdge *bme) BMVert *bmv1, *bmv2, *bmv3, *bmv4, *bmv1i, *bmv2i, *bmv3i, *bmv4i; VMesh *vm1, *vm2; EdgeHalf *e1, *e2; + BMEdge *bme1, *bme2; BMFace *f1, *f2, *f; int k, nseg, i1, i2, odd, mid; @@ -2294,6 +2305,13 @@ static void bevel_build_edge_polygons(BMesh *bm, BevelParams *bp, BMEdge *bme) bev_merge_end_uvs(bm, bv1, e1); if (!e2->is_seam && bv2->vmesh->mesh_kind == M_NONE) bev_merge_end_uvs(bm, bv2, e2); + + /* Copy edge data to first and last edge */ + bme1 = BM_edge_exists(bmv1, bmv2); + bme2 = BM_edge_exists(bmv3, bmv4); + BLI_assert(bme1 && bme2); + BM_elem_attrs_copy(bm, bm, bme, bme1); + BM_elem_attrs_copy(bm, bm, bme, bme2); } /* diff --git a/source/blender/bmesh/tools/bmesh_decimate.h b/source/blender/bmesh/tools/bmesh_decimate.h index c77cb18c518..a1b26990587 100644 --- a/source/blender/bmesh/tools/bmesh_decimate.h +++ b/source/blender/bmesh/tools/bmesh_decimate.h @@ -35,7 +35,8 @@ void BM_mesh_decimate_unsubdivide(BMesh *bm, const int iterations); void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries, const BMO_Delimit delimit, BMVert **vinput_arr, const int vinput_len, - BMEdge **einput_arr, const int einput_len); + BMEdge **einput_arr, const int einput_len, + const short oflag_out); void BM_mesh_decimate_dissolve(BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries, const BMO_Delimit delimit); diff --git a/source/blender/bmesh/tools/bmesh_decimate_dissolve.c b/source/blender/bmesh/tools/bmesh_decimate_dissolve.c index 9d4e01d19cd..9f97d8f4287 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_dissolve.c +++ b/source/blender/bmesh/tools/bmesh_decimate_dissolve.c @@ -72,7 +72,8 @@ static int dissolve_elem_cmp(const void *a1, const void *a2) void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const bool do_dissolve_boundaries, const BMO_Delimit delimit, BMVert **vinput_arr, const int vinput_len, - BMEdge **einput_arr, const int einput_len) + BMEdge **einput_arr, const int einput_len, + const short oflag_out) { const float angle_max = (float)M_PI / 2.0f; DissolveElemWeight *weight_elems = MEM_mallocN(max_ii(einput_len, vinput_len) * @@ -155,6 +156,9 @@ void BM_mesh_decimate_dissolve_ex(BMesh *bm, const float angle_limit, const bool /* there may be some errors, we don't mind, just move on */ if (f_new) { BM_face_normal_update(f_new); + if (oflag_out) { + BMO_elem_flag_enable(bm, f_new, oflag_out); + } } else { BMO_error_clear(bm); @@ -269,7 +273,8 @@ void BM_mesh_decimate_dissolve(BMesh *bm, const float angle_limit, const bool do BM_mesh_decimate_dissolve_ex(bm, angle_limit, do_dissolve_boundaries, delimit, vinput_arr, vinput_len, - einput_arr, einput_len); + einput_arr, einput_len, + 0); MEM_freeN(vinput_arr); MEM_freeN(einput_arr); diff --git a/source/blender/bmesh/tools/bmesh_triangulate.c b/source/blender/bmesh/tools/bmesh_triangulate.c index 79f6c76afc7..2eacf62d68a 100644 --- a/source/blender/bmesh/tools/bmesh_triangulate.c +++ b/source/blender/bmesh/tools/bmesh_triangulate.c @@ -30,7 +30,7 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" -#include "BLI_array.h" +#include "BLI_alloca.h" #include "bmesh.h" diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 643b2cdc2b0..445199dbdef 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -1687,6 +1687,18 @@ void AnimationImporter::evaluate_transform_at_frame(float mat[4][4], COLLADAFW:: } } +static void report_class_type_unsupported(const char *path, + const COLLADAFW::AnimationList::AnimationClass animclass, + const COLLADAFW::Transformation::TransformationType type) +{ + if (animclass == COLLADAFW::AnimationList::UNKNOWN_CLASS) { + fprintf(stderr, "%s: UNKNOWN animation class\n", path); + } + else { + fprintf(stderr, "%s: animation class %d is not supported yet for transformation type %d\n", path, animclass, type); + } +} + // return true to indicate that mat contains a sane value bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float mat[4][4], float fra, const char *node_id) { @@ -1741,11 +1753,6 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float break; } - if (animclass == COLLADAFW::AnimationList::UNKNOWN_CLASS) { - fprintf(stderr, "%s: UNKNOWN animation class\n", path); - //continue; - } - if (type == COLLADAFW::Transformation::ROTATE) { if (curves.size() != 1) { fprintf(stderr, "expected 1 curve, got %d\n", (int)curves.size()); @@ -1754,7 +1761,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float // TODO support other animclasses if (animclass != COLLADAFW::AnimationList::ANGLE) { - fprintf(stderr, "%s: animation class %d is not supported yet\n", path, animclass); + report_class_type_unsupported(path, animclass, type); return false; } @@ -1793,7 +1800,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float vec[2] = evaluate_fcurve(curves[2], fra); break; default: - fprintf(stderr, "%s: animation class %d is not supported yet\n", path, animclass); + report_class_type_unsupported(path, animclass, type); break; } } diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 8791d94f44a..5d47ce155c8 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -50,7 +50,11 @@ static const char *bc_get_joint_name(T *node) } ArmatureImporter::ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, Scene *sce) : - TransformReader(conv), scene(sce), empty(NULL), mesh_importer(mesh) { + unit_converter(conv), + TransformReader(conv), + scene(sce), + empty(NULL), + mesh_importer(mesh) { } ArmatureImporter::~ArmatureImporter() @@ -82,17 +86,15 @@ JointData *ArmatureImporter::get_joint_data(COLLADAFW::Node *node); void ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::Node *node, EditBone *parent, int totchild, float parent_mat[4][4], bArmature *arm) { + float mat[4][4]; + float joint_inv_bind_mat[4][4]; + //Checking if bone is already made. std::vector<COLLADAFW::Node *>::iterator it; it = std::find(finished_joints.begin(), finished_joints.end(), node); if (it != finished_joints.end()) return; - float joint_inv_bind_mat[4][4]; - // JointData* jd = get_joint_data(node); - - float mat[4][4]; - float obmat[4][4]; // TODO rename from Node "name" attrs later EditBone *bone = ED_armature_edit_bone_add(arm, (char *)bc_get_joint_name(node)); @@ -101,9 +103,18 @@ void ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::Node *node, EditBo if (skin && skin->get_joint_inv_bind_matrix(joint_inv_bind_mat, node)) { // get original world-space matrix invert_m4_m4(mat, joint_inv_bind_mat); + + // And make local to armature + Object *ob_arm = skin->BKE_armature_from_object(); + if (ob_arm) { + float invmat[4][4]; + invert_m4_m4(invmat, ob_arm->obmat); + mul_m4_m4m4(mat, invmat, mat); + } } // create a bone even if there's no joint data for it (i.e. it has no influence) else { + float obmat[4][4]; // bone-space get_node_mat(obmat, node, NULL, NULL); @@ -133,24 +144,28 @@ void ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::Node *node, EditBo add_v3_v3v3(bone->tail, bone->head, vec); // set parent tail - if (parent && totchild == 1) { - copy_v3_v3(parent->tail, bone->head); - - // not setting BONE_CONNECTED because this would lock child bone location with respect to parent - bone->flag |= BONE_CONNECTED; + if (parent) { // XXX increase this to prevent "very" small bones? const float epsilon = 0.000001f; // derive leaf bone length - float length = len_v3v3(parent->head, parent->tail); + float length = len_v3v3(parent->head, bone->head); if ((length < leaf_bone_length || totbone == 0) && length > epsilon) { leaf_bone_length = length; } - // treat zero-sized bone like a leaf bone - if (length <= epsilon) { - add_leaf_bone(parent_mat, parent, node); + if (totchild == 1) { + copy_v3_v3(parent->tail, bone->head); + + // not setting BONE_CONNECTED because this would lock child bone location with respect to parent + bone->flag |= BONE_CONNECTED; + + + // treat zero-sized bone like a leaf bone + if (length <= epsilon) { + add_leaf_bone(parent_mat, parent, node); + } } } @@ -166,7 +181,7 @@ void ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::Node *node, EditBo } bone->length = len_v3v3(bone->head, bone->tail); - + joint_by_uid[node->getUniqueId()] = node; finished_joints.push_back(node); } @@ -200,16 +215,21 @@ void ArmatureImporter::add_leaf_bone(float mat[4][4], EditBone *bone, COLLADAFW void ArmatureImporter::fix_leaf_bones( ) { + // Collada only knows Joints, Here we guess a reasonable + // leaf bone length + float leaf_length = (leaf_bone_length == FLT_MAX) ? 1.0:leaf_bone_length; + // just setting tail for leaf bones here std::vector<LeafBone>::iterator it; for (it = leaf_bones.begin(); it != leaf_bones.end(); it++) { + LeafBone& leaf = *it; // pointing up float vec[3] = {0.0f, 0.0f, 0.1f}; sub_v3_v3v3(vec, leaf.bone->tail , leaf.bone->head); - mul_v3_fl(vec, leaf_bone_length); + mul_v3_fl(vec, leaf_length); add_v3_v3v3(leaf.bone->tail, leaf.bone->head , vec); } @@ -517,16 +537,11 @@ void ArmatureImporter::set_pose(Object *ob_arm, COLLADAFW::Node *root_node, con // root - if this joint is the top joint in hierarchy, if a joint // is a child of a node (not joint), root should be true since // this is where we build armature bones from -void ArmatureImporter::add_joint(COLLADAFW::Node *node, bool root, Object *parent, Scene *sce) +void ArmatureImporter::add_root_joint(COLLADAFW::Node *node, Object *parent) { - joint_by_uid[node->getUniqueId()] = node; - if (root) { - root_joints.push_back(node); - - if (parent) { - - joint_parent_map[node->getUniqueId()] = parent; - } + root_joints.push_back(node); + if (parent) { + joint_parent_map[node->getUniqueId()] = parent; } } diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h index bfbf7433d97..beeac85cc4d 100644 --- a/source/blender/collada/ArmatureImporter.h +++ b/source/blender/collada/ArmatureImporter.h @@ -140,11 +140,7 @@ public: ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, Scene *sce); ~ArmatureImporter(); - void add_joint(COLLADAFW::Node *node, bool root, Object *parent, Scene *sce); - -#if 0 - void add_root_joint(COLLADAFW::Node *node); -#endif + void add_root_joint(COLLADAFW::Node *node, Object *parent); // here we add bones to armatures, having armatures previously created in write_controller void make_armatures(bContext *C); diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp index 4c6f71ff1a6..d04ed8d6fa1 100644 --- a/source/blender/collada/ControllerExporter.cpp +++ b/source/blender/collada/ControllerExporter.cpp @@ -123,7 +123,7 @@ void ControllerExporter::operator()(Object *ob) if (ob_arm) { export_skin_controller(ob, ob_arm); } - if (key) { + if (key && this->export_settings->include_shapekeys) { export_morph_controller(ob, key); } } diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 0abf413788f..c6337e27218 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -185,6 +185,9 @@ void DocumentImporter::finish() Main *bmain = CTX_data_main(mContext); // TODO: create a new scene except the selected <visual_scene> - use current blender scene for it Scene *sce = CTX_data_scene(mContext); + unit_converter.calculate_scale(*sce); + + std::vector<Object *> *objects_to_scale = new std::vector<Object *>(); /** TODO Break up and put into 2-pass parsing of DAE */ std::vector<const COLLADAFW::VisualScene *>::iterator it; @@ -221,13 +224,8 @@ void DocumentImporter::finish() // Write nodes to scene const COLLADAFW::NodePointerArray& roots = (*it)->getRootNodes(); for (unsigned int i = 0; i < roots.getCount(); i++) { - std::vector<Object *> *objects_done; - objects_done = write_node(roots[i], NULL, sce, NULL, false); - - if (!this->import_settings->import_units) { - // Match incoming scene with current unit settings - bc_match_scale(objects_done, *sce, unit_converter); - } + std::vector<Object *> *objects_done = write_node(roots[i], NULL, sce, NULL, false); + objects_to_scale->insert(objects_to_scale->end(), objects_done->begin(), objects_done->end()); } // update scene @@ -278,6 +276,8 @@ void DocumentImporter::finish() DAG_relations_tag_update(bmain); } + + bc_match_scale(objects_to_scale, unit_converter, !this->import_settings->import_units); } @@ -311,11 +311,6 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW #endif unsigned int i; - - //for (i = 0; i < 4; i++) - // ob = - anim_importer.translate_Animations(node, root_map, object_map, FW_object_map); - if (node->getType() == COLLADAFW::Node::JOINT && par == NULL) { // For Skeletons without root node we have to simulate the // root node here and recursively enter the same function @@ -323,6 +318,7 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW translate_anim_recursive(node, node, parob); } else { + anim_importer.translate_Animations(node, root_map, object_map, FW_object_map); COLLADAFW::NodePointerArray &children = node->getChildNodes(); for (i = 0; i < children.getCount(); i++) { translate_anim_recursive(children[i], node, NULL); @@ -465,6 +461,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA std::string name = node->getName(); std::vector<Object *> *objects_done = new std::vector<Object *>(); + std::vector<Object *> *root_objects = new std::vector<Object *>(); fprintf(stderr, "Writing node id='%s', name='%s'\n", @@ -477,15 +474,18 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA // Here we add the armature "on the fly": par = bc_add_object(sce, OB_ARMATURE, std::string("Armature").c_str()); objects_done->push_back(par); + root_objects->push_back(par); object_map.insert(std::pair<COLLADAFW::UniqueId, Object *>(node->getUniqueId(), par)); node_map[node->getUniqueId()] = node; } - armature_importer.add_joint(node, parent_node == NULL || parent_node->getType() != COLLADAFW::Node::JOINT, par, sce); + if (parent_node == NULL || parent_node->getType() != COLLADAFW::Node::JOINT) { + armature_importer.add_root_joint(node, par); + } if (parent_node == NULL) { // for skeletons without root node all has been done above. // Skeletons with root node are handled further down. - return objects_done; + return root_objects; } } else { @@ -514,6 +514,9 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA } else { objects_done->push_back(ob); + if (parent_node == NULL) { + root_objects->push_back(ob); + } } ++geom_done; } @@ -524,19 +527,29 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA std::string name = node->getName(); fprintf(stderr, "<node id=\"%s\", name=\"%s\" >...contains a reference to an unknown instance_camera.\n", id.c_str(), name.c_str()); } - else + else { objects_done->push_back(ob); + if (parent_node == NULL) { + root_objects->push_back(ob); + } + } ++camera_done; } while (lamp_done < lamp.getCount()) { ob = create_lamp_object(lamp[lamp_done], sce); objects_done->push_back(ob); + if (parent_node == NULL) { + root_objects->push_back(ob); + } ++lamp_done; } while (controller_done < controller.getCount()) { COLLADAFW::InstanceGeometry *geom = (COLLADAFW::InstanceGeometry *)controller[controller_done]; ob = mesh_importer.create_mesh_object(node, geom, true, uid_material_map, material_texture_mapping_map); objects_done->push_back(ob); + if (parent_node == NULL) { + root_objects->push_back(ob); + } ++controller_done; } // XXX instance_node is not supported yet @@ -552,9 +565,12 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA Object *source_ob = (Object *)it2->second; COLLADAFW::Node *source_node = node_map[node_id]; ob = create_instance_node(source_ob, source_node, node, sce, is_library_node); + objects_done->push_back(ob); + if (parent_node == NULL) { + root_objects->push_back(ob); + } } } - if (ob != NULL) objects_done->push_back(ob); ++inst_done; read_transform = false; @@ -571,12 +587,14 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA ob = bc_add_object(sce, OB_EMPTY, NULL); } objects_done->push_back(ob); - + if (parent_node == NULL) { + root_objects->push_back(ob); + } } // XXX: if there're multiple instances, only one is stored - if (!ob) return objects_done; + if (!ob) return root_objects; for (std::vector<Object *>::iterator it = objects_done->begin(); it != objects_done->end(); ++it) { ob = *it; @@ -601,11 +619,16 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA anim_importer.read_node_transform(node, ob); // overwrites location set earlier if (!is_joint) { - // if par was given make this object child of the previous - if (par && ob) - bc_set_parent(ob, par, mContext); + if (par && ob) { + ob->parent = par; + ob->partype = PAROBJECT; + ob->parsubstr[0] = 0; + + //bc_set_parent(ob, par, mContext, false); + } } } + // if node has child nodes write them COLLADAFW::NodePointerArray &child_nodes = node->getChildNodes(); @@ -620,11 +643,11 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA write_node(child_nodes[i], node, sce, ob, is_library_node); } - return objects_done; + return root_objects; } /** When this method is called, the writer must write the entire visual scene. - * \return The writer should return true, if writing succeeded, false otherwise.*/ + * Return The writer should return true, if writing succeeded, false otherwise. */ bool DocumentImporter::writeVisualScene(const COLLADAFW::VisualScene *visualScene) { if (mImportStage != General) diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index b4b37f7d0bd..1e0f0244072 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -315,7 +315,8 @@ bool MeshImporter::primitive_has_faces(COLLADAFW::MeshPrimitive *mp) { case COLLADAFW::MeshPrimitive::TRIANGLES: case COLLADAFW::MeshPrimitive::TRIANGLE_FANS: case COLLADAFW::MeshPrimitive::POLYLIST: - case COLLADAFW::MeshPrimitive::POLYGONS: { + case COLLADAFW::MeshPrimitive::POLYGONS: + { has_faces = true; break; } @@ -347,8 +348,8 @@ void MeshImporter::allocate_poly_data(COLLADAFW::Mesh *collada_mesh, Mesh *me) case COLLADAFW::MeshPrimitive::TRIANGLES: case COLLADAFW::MeshPrimitive::TRIANGLE_FANS: case COLLADAFW::MeshPrimitive::POLYLIST: - case COLLADAFW::MeshPrimitive::POLYGONS: { - + case COLLADAFW::MeshPrimitive::POLYGONS: + { COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons *)mp; size_t prim_poly_count = mpvc->getFaceCount(); @@ -361,7 +362,8 @@ void MeshImporter::allocate_poly_data(COLLADAFW::Mesh *collada_mesh, Mesh *me) total_loop_count += prim_loop_count; break; } - default: break; + default: + break; } } @@ -400,16 +402,19 @@ unsigned int MeshImporter::get_vertex_count(COLLADAFW::Polygons *mp, int index) int result; switch (type) { case COLLADAFW::MeshPrimitive::TRIANGLES: - case COLLADAFW::MeshPrimitive::TRIANGLE_FANS: { + case COLLADAFW::MeshPrimitive::TRIANGLE_FANS: + { result = 3; break; } case COLLADAFW::MeshPrimitive::POLYLIST: - case COLLADAFW::MeshPrimitive::POLYGONS: { + case COLLADAFW::MeshPrimitive::POLYGONS: + { result = mp->getGroupedVerticesVertexCountArray()[index]; break; } - default: { + default: + { result = -1; break; } @@ -427,12 +432,14 @@ unsigned int MeshImporter::get_loose_edge_count(COLLADAFW::Mesh *mesh) { COLLADAFW::MeshPrimitive *mp = prim_arr[i]; int type = mp->getPrimitiveType(); switch (type) { - case COLLADAFW::MeshPrimitive::LINES: { + case COLLADAFW::MeshPrimitive::LINES: + { size_t prim_totface = mp->getFaceCount(); loose_edge_count += prim_totface; break; } - default: break; + default: + break; } } return loose_edge_count; diff --git a/source/blender/collada/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp index c2770dc3dc5..7ae1750d2ca 100644 --- a/source/blender/collada/SkinInfo.cpp +++ b/source/blender/collada/SkinInfo.cpp @@ -226,8 +226,6 @@ void SkinInfo::link_armature(bContext *C, Object *ob, std::map<COLLADAFW::Unique ArmatureModifierData *amd = (ArmatureModifierData *)md; amd->object = ob_arm; - copy_m4_m4(ob->obmat, bind_shape_matrix); - BKE_object_apply_mat4(ob, ob->obmat, 0, 0); #if 1 bc_set_parent(ob, ob_arm, C); #else @@ -243,6 +241,8 @@ void SkinInfo::link_armature(bContext *C, Object *ob, std::map<COLLADAFW::Unique DAG_relations_tag_update(bmain); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); #endif + copy_m4_m4(ob->obmat, bind_shape_matrix); + BKE_object_apply_mat4(ob, ob->obmat, 0, 0); amd->deformflag = ARM_DEF_VGROUP; diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp index 43faa15b4bb..f8f31304d28 100644 --- a/source/blender/collada/TransformReader.cpp +++ b/source/blender/collada/TransformReader.cpp @@ -48,7 +48,9 @@ void TransformReader::get_node_mat(float mat[4][4], COLLADAFW::Node *node, std:: switch (type) { case COLLADAFW::Transformation::MATRIX: - // XXX why does this return and discard all following transformations? + // When matrix AND Trans/Rot/Scale are defined for a node, + // then this is considered as redundant information. + // So if we find a Matrix we use that and return. dae_matrix_to_mat4(tm, mat); return; case COLLADAFW::Transformation::TRANSLATE: diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp index d4db42da35b..c3665a33ca4 100644 --- a/source/blender/collada/TransformWriter.cpp +++ b/source/blender/collada/TransformWriter.cpp @@ -97,40 +97,31 @@ void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob, B add_transform(node, loc, rot, scale); #endif - UnitConverter converter; - - /* Using parentinv should allow use of existing curves */ - if (ob->parent) { - // If parentinv is identity don't add it. - bool add_parinv = false; - for (int i = 0; i < 16; ++i) { - float f = (i % 4 == i / 4) ? 1.0f : 0.0f; - add_parinv |= (ob->parentinv[i % 4][i / 4] != f); - } - - if (add_parinv) { - double dmat[4][4]; - converter.mat4_to_dae_double(dmat, ob->parentinv); - node.addMatrix("parentinverse", dmat); - } - } + UnitConverter converter; + double d_obmat[4][4]; + float f_obmat[4][4]; - double d_obmat[4][4]; - converter.mat4_to_dae_double(d_obmat, ob->obmat); + /* Export the local Matrix (relative to the object parent) */ + BKE_object_matrix_local_get(ob, f_obmat); + converter.mat4_to_dae_double(d_obmat, f_obmat); switch (transformation_type) { - case BC_TRANSFORMATION_TYPE_MATRIX : { + case BC_TRANSFORMATION_TYPE_MATRIX: + { node.addMatrix("transform",d_obmat); break; } - case BC_TRANSFORMATION_TYPE_TRANSROTLOC: { - add_transform(node, ob->loc, ob->rot, ob->size); - break; - } - case BC_TRANSFORMATION_TYPE_BOTH : { + case BC_TRANSFORMATION_TYPE_BOTH: + { node.addMatrix("transform",d_obmat); - add_transform(node, ob->loc, ob->rot, ob->size); + /* fall-through */ + } + case BC_TRANSFORMATION_TYPE_TRANSROTLOC: + { + float loc[3], rot[3], scale[3]; + TransformBase::decompose(f_obmat, loc, rot, NULL, scale); + add_transform(node, loc, rot, scale); break; } } diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp index 069419f938b..567ee22b3d6 100644 --- a/source/blender/collada/collada_internal.cpp +++ b/source/blender/collada/collada_internal.cpp @@ -27,7 +27,7 @@ /* COLLADABU_ASSERT, may be able to remove later */ #include "COLLADABUPlatform.h" -#include "collada_internal.h" +#include "collada_utils.h" #include "BLI_linklist.h" @@ -40,7 +40,7 @@ UnitConverter::UnitConverter() : unit(), up_axis(COLLADAFW::FileInfo::Z_UP) rotate_m4(y_up_mat4, 'X', 0.5 * M_PI); unit_m4(z_up_mat4); - + unit_m4(scale_mat4); } void UnitConverter::read_asset(const COLLADAFW::FileInfo *asset) @@ -124,6 +124,48 @@ float(&UnitConverter::get_rotation())[4][4] } } + +float(&UnitConverter::get_scale())[4][4] +{ + return scale_mat4; +} + +void UnitConverter::calculate_scale(Scene &sce) +{ + PointerRNA scene_ptr, unit_settings; + PropertyRNA *system_ptr, *scale_ptr; + RNA_id_pointer_create(&sce.id, &scene_ptr); + + unit_settings = RNA_pointer_get(&scene_ptr, "unit_settings"); + system_ptr = RNA_struct_find_property(&unit_settings, "system"); + scale_ptr = RNA_struct_find_property(&unit_settings, "scale_length"); + + int type = RNA_property_enum_get(&unit_settings, system_ptr); + + float bl_scale; + + switch (type) { + case USER_UNIT_NONE: + bl_scale = 1.0; // map 1 Blender unit to 1 Meter + break; + + case USER_UNIT_METRIC: + bl_scale = RNA_property_float_get(&unit_settings, scale_ptr); + break; + + default : + bl_scale = RNA_property_float_get(&unit_settings, scale_ptr); + // it looks like the conversion to Imperial is done implicitly. + // So nothing to do here. + break; + } + + float rescale[3]; + rescale[0] = rescale[1] = rescale[2] = getLinearMeter() / bl_scale; + + size_to_mat4(scale_mat4, rescale); +} + void TransformBase::decompose(float mat[4][4], float *loc, float eul[3], float quat[4], float *size) { mat4_to_size(size, mat); diff --git a/source/blender/collada/collada_internal.h b/source/blender/collada/collada_internal.h index 2e855764f4b..4aa637a6876 100644 --- a/source/blender/collada/collada_internal.h +++ b/source/blender/collada/collada_internal.h @@ -50,7 +50,8 @@ private: float x_up_mat4[4][4]; float y_up_mat4[4][4]; float z_up_mat4[4][4]; - + float scale_mat4[4][4]; + public: enum UnitSystem { @@ -79,7 +80,8 @@ public: void mat4_to_dae_double(double out[4][4], float in[4][4]); float(&get_rotation())[4][4]; - + float(&get_scale())[4][4]; + void calculate_scale(Scene &sce); }; diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index 41f48a757c0..3e17472e9c2 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -145,11 +145,13 @@ Mesh *bc_get_mesh_copy(Scene *scene, Object *ob, BC_export_mesh_type export_mesh DerivedMesh *dm = NULL; if (apply_modifiers) { switch (export_mesh_type) { - case BC_MESH_TYPE_VIEW: { + case BC_MESH_TYPE_VIEW: + { dm = mesh_create_derived_view(scene, ob, mask); break; } - case BC_MESH_TYPE_RENDER: { + case BC_MESH_TYPE_RENDER: + { dm = mesh_create_derived_render(scene, ob, mask); break; } @@ -322,65 +324,30 @@ std::string bc_replace_string(std::string data, const std::string& pattern, * Calculate a rescale factor such that the imported scene's scale * is preserved. I.e. 1 meter in the import will also be * 1 meter in the current scene. - * XXX : I am not sure if it is correct to map 1 Blender Unit - * to 1 Meter for unit type NONE. But it looks reasonable to me. */ -void bc_match_scale(std::vector<Object *> *objects_done, - Scene &sce, - UnitConverter &bc_unit) -{ - Object *ob = NULL; - - PointerRNA scene_ptr, unit_settings; - PropertyRNA *system_ptr, *scale_ptr; - RNA_id_pointer_create(&sce.id, &scene_ptr); - - unit_settings = RNA_pointer_get(&scene_ptr, "unit_settings"); - system_ptr = RNA_struct_find_property(&unit_settings, "system"); - scale_ptr = RNA_struct_find_property(&unit_settings, "scale_length"); - - int type = RNA_property_enum_get(&unit_settings, system_ptr); - float bl_scale; - - switch (type) { - case USER_UNIT_NONE: - bl_scale = 1.0; // map 1 Blender unit to 1 Meter - break; - - case USER_UNIT_METRIC: - bl_scale = RNA_property_float_get(&unit_settings, scale_ptr); - break; - - default : - bl_scale = RNA_property_float_get(&unit_settings, scale_ptr); - // it looks like the conversion to Imperial is done implicitly. - // So nothing to do here. - break; +void bc_match_scale(Object *ob, UnitConverter &bc_unit, bool scale_to_scene) +{ + if (scale_to_scene) { + mul_m4_m4m4(ob->obmat, bc_unit.get_scale(), ob->obmat); } - - float scale_conv = bc_unit.getLinearMeter() / bl_scale; - - float rescale[3]; - rescale[0] = rescale[1] = rescale[2] = scale_conv; - - float size_mat4[4][4]; - - float axis_mat4[4][4]; - unit_m4(axis_mat4); - - size_to_mat4(size_mat4, rescale); + mul_m4_m4m4(ob->obmat, bc_unit.get_rotation(), ob->obmat); + BKE_object_apply_mat4(ob, ob->obmat, 0, 0); +} +void bc_match_scale(std::vector<Object *> *objects_done, + UnitConverter &bc_unit, + bool scale_to_scene) +{ for (std::vector<Object *>::iterator it = objects_done->begin(); it != objects_done->end(); ++it) { - ob = *it; - mul_m4_m4m4(ob->obmat, size_mat4, ob->obmat); - mul_m4_m4m4(ob->obmat, bc_unit.get_rotation(), ob->obmat); - BKE_object_apply_mat4(ob, ob->obmat, 0, 0); + Object *ob = *it; + if (ob -> parent == NULL) { + bc_match_scale(*it, bc_unit, scale_to_scene); + } } - } void bc_triangulate_mesh(Mesh *me) diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h index f8e6f09e498..4bc2f55cf33 100644 --- a/source/blender/collada/collada_utils.h +++ b/source/blender/collada/collada_utils.h @@ -83,7 +83,8 @@ extern int bc_get_active_UVLayer(Object *ob); extern std::string bc_replace_string(std::string data, const std::string& pattern, const std::string& replacement); extern std::string bc_url_encode(std::string data); -extern void bc_match_scale(std::vector<Object *> *objects_done, Scene &sce, UnitConverter &unit_converter); +extern void bc_match_scale(Object *ob, UnitConverter &bc_unit, bool scale_to_scene); +extern void bc_match_scale(std::vector<Object *> *objects_done, UnitConverter &unit_converter, bool scale_to_scene); extern void bc_triangulate_mesh(Mesh *me); diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp index e82bf2e21c8..51eaffaa31c 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp @@ -288,8 +288,8 @@ void ExecutionGroup::execute(ExecutionSystem *graph) delete hotspots[0]; MEM_freeN(chunkOrders); + break; } - break; case COM_TO_RULE_OF_THIRDS: { ChunkOrderHotspot *hotspots[9]; @@ -336,8 +336,8 @@ void ExecutionGroup::execute(ExecutionSystem *graph) delete hotspots[7]; delete hotspots[8]; MEM_freeN(chunkOrders); + break; } - break; case COM_TO_TOP_DOWN: default: break; diff --git a/source/blender/compositor/intern/COM_SocketReader.h b/source/blender/compositor/intern/COM_SocketReader.h index 88b018ef8ba..b7aae8b92f0 100644 --- a/source/blender/compositor/intern/COM_SocketReader.h +++ b/source/blender/compositor/intern/COM_SocketReader.h @@ -91,13 +91,13 @@ protected: virtual void executePixel(float output[4], float x, float y, float dx, float dy, PixelSampler sampler) {} public: - inline void read(float *result, float x, float y, PixelSampler sampler) { + inline void read(float result[4], float x, float y, PixelSampler sampler) { executePixel(result, x, y, sampler); } - inline void read(float *result, int x, int y, void *chunkData) { + inline void read(float result[4], int x, int y, void *chunkData) { executePixel(result, x, y, chunkData); } - inline void read(float *result, float x, float y, float dx, float dy, PixelSampler sampler) { + inline void read(float result[4], float x, float y, float dx, float dy, PixelSampler sampler) { executePixel(result, x, y, dx, dy, sampler); } diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp index 402fa28e210..1bac06fc4ab 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.cpp +++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp @@ -81,6 +81,7 @@ int g_highlightIndex; void **g_highlightedNodes; void **g_highlightedNodesRead; +#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE #define HIGHLIGHT(wp) \ { \ ExecutionGroup *group = wp->getExecutionGroup(); \ @@ -103,6 +104,7 @@ void **g_highlightedNodesRead; } \ } \ } +#endif /* COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE */ void COM_startReadHighlights() { @@ -304,7 +306,8 @@ void WorkScheduler::initialize(bool use_opencl) g_context = NULL; g_program = NULL; - OCL_init(); /* this will check and skip if already initialized */ + if (!OCL_init()) /* this will check for errors and skip if already initialized */ + return; if (clCreateContextFromType) { cl_uint numberOfPlatforms = 0; diff --git a/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp b/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp index 4c4b77ba6cc..d2598e661a9 100644 --- a/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp @@ -47,7 +47,7 @@ void ChromaMatteNode::convertToOperations(ExecutionSystem *graph, CompositorCont operation->setSettings((NodeChroma *)editorsnode->storage); inputSocketImage->relinkConnections(operationRGBToYCC_Image->getInputSocket(0), 0, graph); - inputSocketKey->relinkConnections(operationRGBToYCC_Key->getInputSocket(0), 0, graph); + inputSocketKey->relinkConnections(operationRGBToYCC_Key->getInputSocket(0), 1, graph); addLink(graph, operationRGBToYCC_Image->getOutputSocket(), operation->getInputSocket(0)); addLink(graph, operationRGBToYCC_Key->getOutputSocket(), operation->getInputSocket(1)); diff --git a/source/blender/compositor/nodes/COM_GroupNode.cpp b/source/blender/compositor/nodes/COM_GroupNode.cpp index 85554d7a7aa..7c0499dc04e 100644 --- a/source/blender/compositor/nodes/COM_GroupNode.cpp +++ b/source/blender/compositor/nodes/COM_GroupNode.cpp @@ -183,14 +183,16 @@ void GroupNode::addDefaultOutputOperation(ExecutionSystem &system, OutputSocket NodeOperation *operation = NULL; switch (iosock->typeinfo->type) { - case SOCK_FLOAT: { + case SOCK_FLOAT: + { float value = RNA_float_get(&ptr, "default_value"); SetValueOperation *value_op = new SetValueOperation(); value_op->setValue(value); operation = value_op; break; } - case SOCK_VECTOR: { + case SOCK_VECTOR: + { float vector[3]; RNA_float_get_array(&ptr, "default_value", vector); SetVectorOperation *vector_op = new SetVectorOperation(); @@ -198,7 +200,8 @@ void GroupNode::addDefaultOutputOperation(ExecutionSystem &system, OutputSocket operation = vector_op; break; } - case SOCK_RGBA: { + case SOCK_RGBA: + { float color[4]; RNA_float_get_array(&ptr, "default_value", color); SetColorOperation *color_op = new SetColorOperation(); diff --git a/source/blender/compositor/nodes/COM_TextureNode.cpp b/source/blender/compositor/nodes/COM_TextureNode.cpp index 5b386a504e4..6f2baa63b0e 100644 --- a/source/blender/compositor/nodes/COM_TextureNode.cpp +++ b/source/blender/compositor/nodes/COM_TextureNode.cpp @@ -34,11 +34,14 @@ void TextureNode::convertToOperations(ExecutionSystem *system, CompositorContext bNode *editorNode = this->getbNode(); Tex *texture = (Tex *)editorNode->id; TextureOperation *operation = new TextureOperation(); + const ColorManagedDisplaySettings *displaySettings = context->getDisplaySettings(); + bool sceneColorManage = strcmp(displaySettings->display_device, "None") != 0; this->getOutputSocket(1)->relinkConnections(operation->getOutputSocket()); this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, system); this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, system); operation->setTexture(texture); operation->setRenderData(context->getRenderData()); + operation->setSceneColorManage(sceneColorManage); system->addOperation(operation); addPreviewOperation(system, context, operation->getOutputSocket()); @@ -49,6 +52,7 @@ void TextureNode::convertToOperations(ExecutionSystem *system, CompositorContext addLink(system, operation->getInputSocket(1)->getConnection()->getFromSocket(), alphaOperation->getInputSocket(1)); alphaOperation->setTexture(texture); alphaOperation->setRenderData(context->getRenderData()); + alphaOperation->setSceneColorManage(sceneColorManage); system->addOperation(alphaOperation); } } diff --git a/source/blender/compositor/nodes/COM_ZCombineNode.cpp b/source/blender/compositor/nodes/COM_ZCombineNode.cpp index 95f06e350b1..b48d974e893 100644 --- a/source/blender/compositor/nodes/COM_ZCombineNode.cpp +++ b/source/blender/compositor/nodes/COM_ZCombineNode.cpp @@ -34,7 +34,7 @@ void ZCombineNode::convertToOperations(ExecutionSystem *system, CompositorContext *context) { - if (context->getRenderData()->scemode & R_FULL_SAMPLE) { + if ((context->getRenderData()->scemode & R_FULL_SAMPLE) || this->getbNode()->custom2) { if (this->getOutputSocket(0)->isConnected()) { ZCombineOperation *operation = NULL; if (this->getbNode()->custom1) { diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp index 39a0014ac41..cc91210a385 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp @@ -121,10 +121,12 @@ float *BlurBaseOperation::make_dist_fac_inverse(int rad, int falloff) val = val * val; break; case PROP_LIN: + /* fall-through */ #ifndef NDEBUG - /* uninitialized! */ case -1: + /* uninitialized! */ BLI_assert(0); + break; #endif default: /* nothing */ diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp index e8268adff7a..0c67da2d552 100644 --- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp +++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp @@ -53,33 +53,34 @@ void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect) pixels++; switch (this->m_setting) { - case 1: + case 1: /* rgb combined */ { float value = rgb_to_bw(&buffer[offset]); sum += (value - mean) * (value - mean); break; } - case 2: + case 2: /* red */ { float value = buffer[offset]; sum += value; sum += (value - mean) * (value - mean); break; } - case 3: + case 3: /* green */ { float value = buffer[offset + 1]; sum += value; sum += (value - mean) * (value - mean); break; } - case 4: + case 4: /* blue */ { float value = buffer[offset + 2]; sum += value; sum += (value - mean) * (value - mean); + break; } - case 5: + case 5: /* luminance */ { float yuv[3]; rgb_to_yuv(buffer[offset], buffer[offset + 1], buffer[offset + 2], &yuv[0], &yuv[1], &yuv[2]); diff --git a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp index 9cff5e8eaa6..3b5aa8cd755 100644 --- a/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertColorToBWOperation.cpp @@ -37,7 +37,7 @@ void ConvertColorToBWOperation::initExecution() void ConvertColorToBWOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) { float inputColor[4]; - this->m_inputOperation->read(&inputColor[0], x, y, sampler); + this->m_inputOperation->read(inputColor, x, y, sampler); output[0] = rgb_to_bw(inputColor); } diff --git a/source/blender/compositor/operations/COM_ConvertColorToValueProg.cpp b/source/blender/compositor/operations/COM_ConvertColorToValueProg.cpp index 3a65519864a..44e751d1cae 100644 --- a/source/blender/compositor/operations/COM_ConvertColorToValueProg.cpp +++ b/source/blender/compositor/operations/COM_ConvertColorToValueProg.cpp @@ -37,7 +37,7 @@ void ConvertColorToValueProg::initExecution() void ConvertColorToValueProg::executePixel(float output[4], float x, float y, PixelSampler sampler) { float inputColor[4]; - this->m_inputOperation->read(&inputColor[0], x, y, sampler); + this->m_inputOperation->read(inputColor, x, y, sampler); output[0] = (inputColor[0] + inputColor[1] + inputColor[2]) / 3.0f; } diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp index 39665b10f48..5006720f091 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp @@ -1284,7 +1284,7 @@ void DoubleEdgeMaskOperation::executePixel(float output[4], int x, int y, void * { float *buffer = (float *)data; int index = (y * this->getWidth() + x); - copy_v4_v4(output, buffer + index); + output[0] = buffer[index]; } void DoubleEdgeMaskOperation::deinitExecution() diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.h b/source/blender/compositor/operations/COM_KeyingScreenOperation.h index 8b1128a4da3..fa22ba668b9 100644 --- a/source/blender/compositor/operations/COM_KeyingScreenOperation.h +++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.h @@ -32,6 +32,7 @@ #include "DNA_movieclip_types.h" #include "BLI_listbase.h" +#include "BLI_string.h" extern "C" { #include "BLI_voronoi.h" @@ -76,7 +77,7 @@ public: void deinitializeTileData(rcti *rect, void *data); void setMovieClip(MovieClip *clip) {this->m_movieClip = clip;} - void setTrackingObject(const char *object) {strncpy(this->m_trackingObject, object, sizeof(this->m_trackingObject));} + void setTrackingObject(const char *object) { BLI_strncpy(this->m_trackingObject, object, sizeof(this->m_trackingObject)); } void setFramenumber(int framenumber) {this->m_framenumber = framenumber;} void executePixel(float output[4], int x, int y, void *data); diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp index 3749bcf42d8..fa0c480eb70 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp @@ -77,8 +77,8 @@ void MathAddOperation::executePixel(float output[4], float x, float y, PixelSamp float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = inputValue1[0] + inputValue2[0]; @@ -90,8 +90,8 @@ void MathSubtractOperation::executePixel(float output[4], float x, float y, Pixe float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = inputValue1[0] - inputValue2[0]; @@ -103,8 +103,8 @@ void MathMultiplyOperation::executePixel(float output[4], float x, float y, Pixe float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = inputValue1[0] * inputValue2[0]; @@ -116,8 +116,8 @@ void MathDivideOperation::executePixel(float output[4], float x, float y, PixelS float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); if (inputValue2[0] == 0) /* We don't want to divide by zero. */ output[0] = 0.0; @@ -132,8 +132,8 @@ void MathSineOperation::executePixel(float output[4], float x, float y, PixelSam float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = sin(inputValue1[0]); @@ -145,8 +145,8 @@ void MathCosineOperation::executePixel(float output[4], float x, float y, PixelS float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = cos(inputValue1[0]); @@ -158,8 +158,8 @@ void MathTangentOperation::executePixel(float output[4], float x, float y, Pixel float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = tan(inputValue1[0]); @@ -171,8 +171,8 @@ void MathArcSineOperation::executePixel(float output[4], float x, float y, Pixel float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); if (inputValue1[0] <= 1 && inputValue1[0] >= -1) output[0] = asin(inputValue1[0]); @@ -187,8 +187,8 @@ void MathArcCosineOperation::executePixel(float output[4], float x, float y, Pix float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); if (inputValue1[0] <= 1 && inputValue1[0] >= -1) output[0] = acos(inputValue1[0]); @@ -203,8 +203,8 @@ void MathArcTangentOperation::executePixel(float output[4], float x, float y, Pi float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = atan(inputValue1[0]); @@ -216,8 +216,8 @@ void MathPowerOperation::executePixel(float output[4], float x, float y, PixelSa float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); if (inputValue1[0] >= 0) { output[0] = pow(inputValue1[0], inputValue2[0]); @@ -241,8 +241,8 @@ void MathLogarithmOperation::executePixel(float output[4], float x, float y, Pix float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); if (inputValue1[0] > 0 && inputValue2[0] > 0) output[0] = log(inputValue1[0]) / log(inputValue2[0]); @@ -257,8 +257,8 @@ void MathMinimumOperation::executePixel(float output[4], float x, float y, Pixel float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = min(inputValue1[0], inputValue2[0]); @@ -270,8 +270,8 @@ void MathMaximumOperation::executePixel(float output[4], float x, float y, Pixel float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = max(inputValue1[0], inputValue2[0]); @@ -283,8 +283,8 @@ void MathRoundOperation::executePixel(float output[4], float x, float y, PixelSa float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = round(inputValue1[0]); @@ -296,8 +296,8 @@ void MathLessThanOperation::executePixel(float output[4], float x, float y, Pixe float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = inputValue1[0] < inputValue2[0] ? 1.0f : 0.0f; @@ -309,8 +309,8 @@ void MathGreaterThanOperation::executePixel(float output[4], float x, float y, P float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); output[0] = inputValue1[0] > inputValue2[0] ? 1.0f : 0.0f; @@ -322,8 +322,8 @@ void MathModuloOperation::executePixel(float output[4], float x, float y, PixelS float inputValue1[4]; float inputValue2[4]; - this->m_inputValue1Operation->read(&inputValue1[0], x, y, sampler); - this->m_inputValue2Operation->read(&inputValue2[0], x, y, sampler); + this->m_inputValue1Operation->read(inputValue1, x, y, sampler); + this->m_inputValue2Operation->read(inputValue2, x, y, sampler); if (inputValue2[0] == 0) output[0] = 0.0; diff --git a/source/blender/compositor/operations/COM_MixAddOperation.cpp b/source/blender/compositor/operations/COM_MixAddOperation.cpp index be737f22280..4e0876439c0 100644 --- a/source/blender/compositor/operations/COM_MixAddOperation.cpp +++ b/source/blender/compositor/operations/COM_MixAddOperation.cpp @@ -37,7 +37,6 @@ void MixAddOperation::executePixel(float output[4], float x, float y, PixelSampl this->m_inputColor1Operation->read(inputColor1, x, y, sampler); this->m_inputColor2Operation->read(inputColor2, x, y, sampler); - float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; diff --git a/source/blender/compositor/operations/COM_MixBurnOperation.cpp b/source/blender/compositor/operations/COM_MixBurnOperation.cpp index 5cfe38766bc..d4422c6cc6a 100644 --- a/source/blender/compositor/operations/COM_MixBurnOperation.cpp +++ b/source/blender/compositor/operations/COM_MixBurnOperation.cpp @@ -31,13 +31,14 @@ void MixBurnOperation::executePixel(float output[4], float x, float y, PixelSamp { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; float tmp; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixColorOperation.cpp b/source/blender/compositor/operations/COM_MixColorOperation.cpp index 56aca27eaef..6919a636aeb 100644 --- a/source/blender/compositor/operations/COM_MixColorOperation.cpp +++ b/source/blender/compositor/operations/COM_MixColorOperation.cpp @@ -35,12 +35,13 @@ void MixColorOperation::executePixel(float output[4], float x, float y, PixelSam { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixDarkenOperation.cpp b/source/blender/compositor/operations/COM_MixDarkenOperation.cpp index 5b79f4c95ac..d56d9fdf122 100644 --- a/source/blender/compositor/operations/COM_MixDarkenOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDarkenOperation.cpp @@ -31,12 +31,13 @@ void MixDarkenOperation::executePixel(float output[4], float x, float y, PixelSa { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp b/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp index d2c1e5e428f..13494401c60 100644 --- a/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDifferenceOperation.cpp @@ -32,12 +32,13 @@ void MixDifferenceOperation::executePixel(float output[4], float x, float y, Pix { float inputColor1[4]; float inputColor2[4]; - float value; - - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + float inputValue[4]; + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixDivideOperation.cpp b/source/blender/compositor/operations/COM_MixDivideOperation.cpp index fdb1618b6e6..3e0eb66565c 100644 --- a/source/blender/compositor/operations/COM_MixDivideOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDivideOperation.cpp @@ -31,12 +31,13 @@ void MixDivideOperation::executePixel(float output[4], float x, float y, PixelSa { float inputColor1[4]; float inputColor2[4]; - float value; - - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + float inputValue[4]; + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixDodgeOperation.cpp b/source/blender/compositor/operations/COM_MixDodgeOperation.cpp index 87f60df8e1b..acb39f665ff 100644 --- a/source/blender/compositor/operations/COM_MixDodgeOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDodgeOperation.cpp @@ -31,13 +31,14 @@ void MixDodgeOperation::executePixel(float output[4], float x, float y, PixelSam { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; float tmp; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixHueOperation.cpp b/source/blender/compositor/operations/COM_MixHueOperation.cpp index 12cd16bb73b..64c88592b93 100644 --- a/source/blender/compositor/operations/COM_MixHueOperation.cpp +++ b/source/blender/compositor/operations/COM_MixHueOperation.cpp @@ -35,12 +35,13 @@ void MixHueOperation::executePixel(float output[4], float x, float y, PixelSampl { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixLightenOperation.cpp b/source/blender/compositor/operations/COM_MixLightenOperation.cpp index 9eb45a783f8..a468fb39442 100644 --- a/source/blender/compositor/operations/COM_MixLightenOperation.cpp +++ b/source/blender/compositor/operations/COM_MixLightenOperation.cpp @@ -31,12 +31,13 @@ void MixLightenOperation::executePixel(float output[4], float x, float y, PixelS { float inputColor1[4]; float inputColor2[4]; - float value; - - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + float inputValue[4]; + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp b/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp index ee7dcc9fe28..e1b5e040f0f 100644 --- a/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp +++ b/source/blender/compositor/operations/COM_MixLinearLightOperation.cpp @@ -31,12 +31,13 @@ void MixLinearLightOperation::executePixel(float output[4], float x, float y, Pi { float inputColor1[4]; float inputColor2[4]; - float value; - - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); - + float inputValue[4]; + + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixOverlayOperation.cpp b/source/blender/compositor/operations/COM_MixOverlayOperation.cpp index 09a9d3cbc4f..d5e1c6d1167 100644 --- a/source/blender/compositor/operations/COM_MixOverlayOperation.cpp +++ b/source/blender/compositor/operations/COM_MixOverlayOperation.cpp @@ -31,12 +31,13 @@ void MixOverlayOperation::executePixel(float output[4], float x, float y, PixelS { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixSaturationOperation.cpp b/source/blender/compositor/operations/COM_MixSaturationOperation.cpp index 3ab19748458..ca45a1c703a 100644 --- a/source/blender/compositor/operations/COM_MixSaturationOperation.cpp +++ b/source/blender/compositor/operations/COM_MixSaturationOperation.cpp @@ -35,12 +35,13 @@ void MixSaturationOperation::executePixel(float output[4], float x, float y, Pix { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixScreenOperation.cpp b/source/blender/compositor/operations/COM_MixScreenOperation.cpp index 671ffd3303c..511768a49ad 100644 --- a/source/blender/compositor/operations/COM_MixScreenOperation.cpp +++ b/source/blender/compositor/operations/COM_MixScreenOperation.cpp @@ -31,13 +31,13 @@ void MixScreenOperation::executePixel(float output[4], float x, float y, PixelSa { float inputColor1[4]; float inputColor2[4]; - float valuev[4]; + float inputValue[4]; - this->m_inputValueOperation->read(valuev, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); - float value = valuev[0]; + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp b/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp index 604881ae47f..71d83ce54ea 100644 --- a/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp +++ b/source/blender/compositor/operations/COM_MixSoftLightOperation.cpp @@ -31,12 +31,13 @@ void MixSoftLightOperation::executePixel(float output[4], float x, float y, Pixe { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixSubtractOperation.cpp b/source/blender/compositor/operations/COM_MixSubtractOperation.cpp index a446dfe4e54..e6efe0f62f3 100644 --- a/source/blender/compositor/operations/COM_MixSubtractOperation.cpp +++ b/source/blender/compositor/operations/COM_MixSubtractOperation.cpp @@ -31,12 +31,13 @@ void MixSubtractOperation::executePixel(float output[4], float x, float y, Pixel { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixValueOperation.cpp b/source/blender/compositor/operations/COM_MixValueOperation.cpp index caefdf024cc..553041e39bf 100644 --- a/source/blender/compositor/operations/COM_MixValueOperation.cpp +++ b/source/blender/compositor/operations/COM_MixValueOperation.cpp @@ -35,12 +35,13 @@ void MixValueOperation::executePixel(float output[4], float x, float y, PixelSam { float inputColor1[4]; float inputColor2[4]; - float value; + float inputValue[4]; - this->m_inputValueOperation->read(&value, x, y, sampler); - this->m_inputColor1Operation->read(&inputColor1[0], x, y, sampler); - this->m_inputColor2Operation->read(&inputColor2[0], x, y, sampler); + this->m_inputValueOperation->read(inputValue, x, y, sampler); + this->m_inputColor1Operation->read(inputColor1, x, y, sampler); + this->m_inputColor2Operation->read(inputColor2, x, y, sampler); + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_TextureOperation.cpp b/source/blender/compositor/operations/COM_TextureOperation.cpp index 08f6f8ada4a..bbb7c8b5289 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.cpp +++ b/source/blender/compositor/operations/COM_TextureOperation.cpp @@ -33,6 +33,8 @@ TextureBaseOperation::TextureBaseOperation() : SingleThreadedNodeOperation() this->m_inputSize = NULL; this->m_inputOffset = NULL; this->m_rd = NULL; + this->m_pool = NULL; + this->m_sceneColorManage = false; } TextureOperation::TextureOperation() : TextureBaseOperation() { @@ -101,7 +103,7 @@ void TextureBaseOperation::executePixel(float output[4], float x, float y, Pixel vec[1] = textureSize[1] * (v + textureOffset[1]); vec[2] = textureSize[2] * textureOffset[2]; - retval = multitex_ext(this->m_texture, vec, NULL, NULL, 0, &texres, m_pool); + retval = multitex_ext(this->m_texture, vec, NULL, NULL, 0, &texres, m_pool, m_sceneColorManage); if (texres.talpha) output[3] = texres.ta; diff --git a/source/blender/compositor/operations/COM_TextureOperation.h b/source/blender/compositor/operations/COM_TextureOperation.h index fc9369099a6..b776f6f2493 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.h +++ b/source/blender/compositor/operations/COM_TextureOperation.h @@ -46,6 +46,7 @@ private: SocketReader *m_inputSize; SocketReader *m_inputOffset; struct ImagePool *m_pool; + bool m_sceneColorManage; protected: @@ -67,6 +68,7 @@ public: void initExecution(); void deinitExecution(); void setRenderData(const RenderData *rd) { this->m_rd = rd; } + void setSceneColorManage(bool sceneColorManage) { this->m_sceneColorManage = sceneColorManage; } }; class TextureOperation : public TextureBaseOperation { diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.h b/source/blender/compositor/operations/COM_TrackPositionOperation.h index 3f05b907ea0..b5499ab76b7 100644 --- a/source/blender/compositor/operations/COM_TrackPositionOperation.h +++ b/source/blender/compositor/operations/COM_TrackPositionOperation.h @@ -33,6 +33,7 @@ #include "DNA_tracking_types.h" #include "BLI_listbase.h" +#include "BLI_string.h" /** * Class with implementation of green screen gradient rasterization @@ -60,8 +61,8 @@ public: TrackPositionOperation(); void setMovieClip(MovieClip *clip) {this->m_movieClip = clip;} - void setTrackingObject(char *object) {strncpy(this->m_trackingObjectName, object, sizeof(this->m_trackingObjectName));} - void setTrackName(char *track) {strncpy(this->m_trackName, track, sizeof(this->m_trackName));} + void setTrackingObject(char *object) { BLI_strncpy(this->m_trackingObjectName, object, sizeof(this->m_trackingObjectName)); } + void setTrackName(char *track) { BLI_strncpy(this->m_trackName, track, sizeof(this->m_trackName)); } void setFramenumber(int framenumber) {this->m_framenumber = framenumber;} void setAxis(int value) {this->m_axis = value;} void setPosition(int value) {this->m_position = value;} diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index a441dce5656..845ad72d7aa 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -574,8 +574,7 @@ static void *acf_scene_setting_ptr(bAnimListElem *ale, int setting, short *type) case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (scene->adt) return GET_ACF_FLAG_PTR(scene->adt->flag, type); - else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -719,9 +718,8 @@ static void *acf_object_setting_ptr(bAnimListElem *ale, int setting, short *type case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (ob->adt) return GET_ACF_FLAG_PTR(ob->adt->flag, type); - else - return NULL; - + return NULL; + default: /* unsupported */ return NULL; } @@ -1053,9 +1051,8 @@ static void *acf_fillactd_setting_ptr(bAnimListElem *ale, int setting, short *ty if (adt) { return GET_ACF_FLAG_PTR(adt->flag, type); } - else - return NULL; - + return NULL; + case ACHANNEL_SETTING_EXPAND: /* expanded */ return GET_ACF_FLAG_PTR(act->flag, type); @@ -1213,9 +1210,8 @@ static void *acf_dsmat_setting_ptr(bAnimListElem *ale, int setting, short *type) case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (ma->adt) return GET_ACF_FLAG_PTR(ma->adt->flag, type); - else - return NULL; - + return NULL; + default: /* unsupported */ return NULL; } @@ -1290,8 +1286,7 @@ static void *acf_dslam_setting_ptr(bAnimListElem *ale, int setting, short *type) case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (la->adt) return GET_ACF_FLAG_PTR(la->adt->flag, type); - else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -1374,8 +1369,7 @@ static void *acf_dstex_setting_ptr(bAnimListElem *ale, int setting, short *type) case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (tex->adt) return GET_ACF_FLAG_PTR(tex->adt->flag, type); - else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -1451,8 +1445,7 @@ static void *acf_dscam_setting_ptr(bAnimListElem *ale, int setting, short *type) case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (ca->adt) return GET_ACF_FLAG_PTR(ca->adt->flag, type); - else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -1538,8 +1531,7 @@ static void *acf_dscur_setting_ptr(bAnimListElem *ale, int setting, short *type) case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (cu->adt) return GET_ACF_FLAG_PTR(cu->adt->flag, type); - else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -1615,8 +1607,7 @@ static void *acf_dsskey_setting_ptr(bAnimListElem *ale, int setting, short *type case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (key->adt) return GET_ACF_FLAG_PTR(key->adt->flag, type); - else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -1692,8 +1683,7 @@ static void *acf_dswor_setting_ptr(bAnimListElem *ale, int setting, short *type) case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (wo->adt) return GET_ACF_FLAG_PTR(wo->adt->flag, type); - else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -1769,8 +1759,7 @@ static void *acf_dspart_setting_ptr(bAnimListElem *ale, int setting, short *type case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (part->adt) return GET_ACF_FLAG_PTR(part->adt->flag, type); - else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -1846,8 +1835,7 @@ static void *acf_dsmball_setting_ptr(bAnimListElem *ale, int setting, short *typ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (mb->adt) return GET_ACF_FLAG_PTR(mb->adt->flag, type); - else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -1923,8 +1911,7 @@ static void *acf_dsarm_setting_ptr(bAnimListElem *ale, int setting, short *type) case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (arm->adt) return GET_ACF_FLAG_PTR(arm->adt->flag, type); - else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -2011,8 +1998,7 @@ static void *acf_dsntree_setting_ptr(bAnimListElem *ale, int setting, short *typ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (ntree->adt) return GET_ACF_FLAG_PTR(ntree->adt->flag, type); - else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -2088,8 +2074,7 @@ static void *acf_dslinestyle_setting_ptr(bAnimListElem *ale, int setting, short case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (linestyle->adt) return GET_ACF_FLAG_PTR(linestyle->adt->flag, type); - else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -2165,8 +2150,7 @@ static void *acf_dsmesh_setting_ptr(bAnimListElem *ale, int setting, short *type case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (me->adt) return GET_ACF_FLAG_PTR(me->adt->flag, type); - else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -2242,8 +2226,7 @@ static void *acf_dslat_setting_ptr(bAnimListElem *ale, int setting, short *type) case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (lt->adt) return GET_ACF_FLAG_PTR(lt->adt->flag, type); - else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -2319,8 +2302,7 @@ static void *acf_dsspk_setting_ptr(bAnimListElem *ale, int setting, short *type) case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */ if (spk->adt) return GET_ACF_FLAG_PTR(spk->adt->flag, type); - else - return NULL; + return NULL; default: /* unsupported */ return NULL; @@ -2921,9 +2903,8 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting return ((*val) & flag) == 0; else return ((*val) & flag) != 0; + break; } - break; - case sizeof(short): /* short pointer for setting */ { short *val = (short *)ptr; @@ -2932,9 +2913,8 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting return ((*val) & flag) == 0; else return ((*val) & flag) != 0; + break; } - break; - case sizeof(char): /* char pointer for setting */ { char *val = (char *)ptr; @@ -2943,8 +2923,8 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting return ((*val) & flag) == 0; else return ((*val) & flag) != 0; + break; } - break; } } } @@ -2994,22 +2974,20 @@ void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting, { int *val = (int *)ptr; ACF_SETTING_SET(*val, flag, mode); + break; } - break; - case sizeof(short): /* short pointer for setting */ { short *val = (short *)ptr; ACF_SETTING_SET(*val, flag, mode); + break; } - break; - case sizeof(char): /* char pointer for setting */ { char *val = (char *)ptr; ACF_SETTING_SET(*val, flag, mode); + break; } - break; } } } @@ -3156,14 +3134,14 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float { SpaceAction *saction = (SpaceAction *)ac->sl; draw_sliders = (saction->flag & SACTION_SLIDERS); + break; } - break; case SPACE_IPO: { SpaceIpo *sipo = (SpaceIpo *)ac->sl; draw_sliders = (sipo->flag & SIPO_SLIDERS); + break; } - break; } } @@ -3443,6 +3421,7 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChann case ACHANNEL_SETTING_EXPAND: /* expanding - cannot flush, otherwise all would open/close at once */ default: uiButSetFunc(but, achannel_setting_widget_cb, NULL, NULL); + break; } } } @@ -3546,14 +3525,14 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale { SpaceAction *saction = (SpaceAction *)ac->sl; draw_sliders = (saction->flag & SACTION_SLIDERS); + break; } - break; case SPACE_IPO: { SpaceIpo *sipo = (SpaceIpo *)ac->sl; draw_sliders = (sipo->flag & SIPO_SLIDERS); + break; } - break; } } diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 481430f37e4..e04c51b33d8 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -94,23 +94,22 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int f bActionGroup *agrp = (bActionGroup *)ale->data; ACHANNEL_SET_FLAG(agrp, ACHANNEL_SETFLAG_CLEAR, AGRP_ACTIVE); + break; } - break; case ANIMTYPE_FCURVE: { FCurve *fcu = (FCurve *)ale->data; ACHANNEL_SET_FLAG(fcu, ACHANNEL_SETFLAG_CLEAR, FCURVE_ACTIVE); + break; } - break; case ANIMTYPE_NLATRACK: { NlaTrack *nlt = (NlaTrack *)ale->data; ACHANNEL_SET_FLAG(nlt, ACHANNEL_SETFLAG_CLEAR, NLATRACK_ACTIVE); + break; } - break; - case ANIMTYPE_FILLACTD: /* Action Expander */ case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */ case ANIMTYPE_DSLAM: @@ -131,8 +130,8 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int f if (ale->adt) { ACHANNEL_SET_FLAG(ale->adt, ACHANNEL_SETFLAG_CLEAR, ADT_UI_ACTIVE); } + break; } - break; } } @@ -143,21 +142,20 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int f { bActionGroup *agrp = (bActionGroup *)channel_data; agrp->flag |= AGRP_ACTIVE; + break; } - break; case ANIMTYPE_FCURVE: { FCurve *fcu = (FCurve *)channel_data; fcu->flag |= FCURVE_ACTIVE; + break; } - break; case ANIMTYPE_NLATRACK: { NlaTrack *nlt = (NlaTrack *)channel_data; nlt->flag |= NLATRACK_ACTIVE; + break; } - break; - case ANIMTYPE_FILLACTD: /* Action Expander */ case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */ case ANIMTYPE_DSLAM: @@ -177,8 +175,8 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int f if (ale && ale->adt) { ale->adt->flag |= ADT_UI_ACTIVE; } + break; } - break; } } @@ -256,9 +254,8 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, s { if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED)) sel = ACHANNEL_SETFLAG_CLEAR; + break; } - break; - case ANIMTYPE_GPLAYER: if (ale->flag & GP_LAYER_SELECT) sel = ACHANNEL_SETFLAG_CLEAR; @@ -283,55 +280,54 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, s if (scene->adt) { ACHANNEL_SET_FLAG(scene, sel, ADT_UI_SELECTED); } + break; } - break; case ANIMTYPE_OBJECT: + { #if 0 /* for now, do not take object selection into account, since it gets too annoying */ - { - Base *base = (Base *)ale->data; - Object *ob = base->object; - - ACHANNEL_SET_FLAG(base, sel, SELECT); - ACHANNEL_SET_FLAG(ob, sel, SELECT); - - if (ob->adt) { - ACHANNEL_SET_FLAG(ob, sel, ADT_UI_SELECTED); - } + Base *base = (Base *)ale->data; + Object *ob = base->object; + + ACHANNEL_SET_FLAG(base, sel, SELECT); + ACHANNEL_SET_FLAG(ob, sel, SELECT); + + if (ob->adt) { + ACHANNEL_SET_FLAG(ob, sel, ADT_UI_SELECTED); } #endif break; + } case ANIMTYPE_GROUP: { bActionGroup *agrp = (bActionGroup *)ale->data; ACHANNEL_SET_FLAG(agrp, sel, AGRP_SELECTED); agrp->flag &= ~AGRP_ACTIVE; + break; } - break; case ANIMTYPE_FCURVE: { FCurve *fcu = (FCurve *)ale->data; ACHANNEL_SET_FLAG(fcu, sel, FCURVE_SELECTED); fcu->flag &= ~FCURVE_ACTIVE; + break; } - break; case ANIMTYPE_SHAPEKEY: { KeyBlock *kb = (KeyBlock *)ale->data; ACHANNEL_SET_FLAG(kb, sel, KEYBLOCK_SEL); + break; } - break; case ANIMTYPE_NLATRACK: { NlaTrack *nlt = (NlaTrack *)ale->data; ACHANNEL_SET_FLAG(nlt, sel, NLATRACK_SELECTED); nlt->flag &= ~NLATRACK_ACTIVE; + break; } - break; - case ANIMTYPE_FILLACTD: /* Action Expander */ case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */ case ANIMTYPE_DSLAM: @@ -354,24 +350,22 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, short datatype, s ACHANNEL_SET_FLAG(ale->adt, sel, ADT_UI_SELECTED); ale->adt->flag &= ~ADT_UI_ACTIVE; } + break; } - break; - case ANIMTYPE_GPLAYER: { bGPDlayer *gpl = (bGPDlayer *)ale->data; ACHANNEL_SET_FLAG(gpl, sel, GP_LAYER_SELECT); + break; } - break; - case ANIMTYPE_MASKLAYER: { MaskLayer *masklay = (MaskLayer *)ale->data; ACHANNEL_SET_FLAG(masklay, sel, MASK_LAYERFLAG_SELECT); + break; } - break; } } @@ -801,23 +795,22 @@ static void rearrange_animchannel_add_to_islands(ListBase *islands, ListBase *sr is_sel = SEL_AGRP(agrp); is_untouchable = (agrp->flag & AGRP_TEMP) != 0; + break; } - break; case ANIMTYPE_FCURVE: { FCurve *fcu = (FCurve *)channel; is_sel = SEL_FCU(fcu); + break; } - break; case ANIMTYPE_NLATRACK: { NlaTrack *nlt = (NlaTrack *)channel; is_sel = SEL_NLT(nlt); + break; } - break; - default: printf("rearrange_animchannel_add_to_islands(): don't know how to handle channels of type %d\n", type); return; @@ -1435,9 +1428,8 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op)) /* try to free F-Curve */ ANIM_fcurve_delete_from_animdata(&ac, adt, fcu); + break; } - break; - case ANIMTYPE_GPLAYER: { /* Grease Pencil layer */ @@ -1447,9 +1439,8 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op)) /* try to delete the layer's data and the layer itself */ free_gpencil_frames(gpl); BLI_freelinkN(&gpd->layers, gpl); + break; } - break; - case ANIMTYPE_MASKLAYER: { /* Mask layer */ @@ -1458,8 +1449,8 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op)) /* try to delete the layer's data and the layer itself */ BKE_mask_layer_remove(mask, masklay); + break; } - break; } } @@ -2131,8 +2122,8 @@ static void borderselect_anim_channels(bAnimContext *ac, rcti *rect, short selec /* always clear active flag after doing this */ agrp->flag &= ~AGRP_ACTIVE; + break; } - break; case ANIMTYPE_NLATRACK: { NlaTrack *nlt = (NlaTrack *)ale->data; @@ -2141,8 +2132,8 @@ static void borderselect_anim_channels(bAnimContext *ac, rcti *rect, short selec * currently adds complications when doing other stuff */ ACHANNEL_SET_FLAG(nlt, selectmode, NLATRACK_SELECTED); + break; } - break; } } @@ -2367,8 +2358,8 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in } notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); + break; } - break; case ANIMTYPE_OBJECT: { bDopeSheet *ads = (bDopeSheet *)ac->data; @@ -2406,9 +2397,8 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in adt->flag |= ADT_UI_ACTIVE; notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); + break; } - break; - case ANIMTYPE_FILLACTD: /* Action Expander */ case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */ case ANIMTYPE_DSLAM: @@ -2445,9 +2435,8 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in } notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); + break; } - break; - case ANIMTYPE_GROUP: { bActionGroup *agrp = (bActionGroup *)ale->data; @@ -2482,8 +2471,8 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, NULL, ANIMTYPE_GROUP); notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); + break; } - break; case ANIMTYPE_FCURVE: { FCurve *fcu = (FCurve *)ale->data; @@ -2504,8 +2493,8 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in ANIM_set_active_channel(ac, ac->data, ac->datatype, filter, fcu, ANIMTYPE_FCURVE); notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); + break; } - break; case ANIMTYPE_SHAPEKEY: { KeyBlock *kb = (KeyBlock *)ale->data; @@ -2522,8 +2511,8 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in } notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); + break; } - break; case ANIMTYPE_GPDATABLOCK: { bGPdata *gpd = (bGPdata *)ale->data; @@ -2534,8 +2523,8 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in gpd->flag ^= GP_DATA_EXPAND; notifierFlags |= (ND_ANIMCHAN | NA_EDITED); + break; } - break; case ANIMTYPE_GPLAYER: { bGPDlayer *gpl = (bGPDlayer *)ale->data; @@ -2552,8 +2541,8 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in } notifierFlags |= (ND_ANIMCHAN | NA_EDITED); + break; } - break; case ANIMTYPE_MASKDATABLOCK: { Mask *mask = (Mask *)ale->data; @@ -2564,8 +2553,8 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in mask->flag ^= MASK_ANIMF_EXPAND; notifierFlags |= (ND_ANIMCHAN | NA_EDITED); + break; } - break; case ANIMTYPE_MASKLAYER: { MaskLayer *masklay = (MaskLayer *)ale->data; @@ -2582,11 +2571,12 @@ static int mouse_anim_channels(bAnimContext *ac, float UNUSED(x), int channel_in } notifierFlags |= (ND_ANIMCHAN | NA_EDITED); + break; } - break; default: if (G.debug & G_DEBUG) printf("Error: Invalid channel type in mouse_anim_channels()\n"); + break; } /* free channels */ diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 2e580a57a01..9e8800fd91e 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -126,17 +126,15 @@ void ANIM_timecode_string_from_frame(char *str, Scene *scene, int power, short t if (hours) sprintf(str, "%s%02d:%02d:%02d", neg, hours, minutes, seconds); else sprintf(str, "%s%02d:%02d", neg, minutes, seconds); } + break; } - break; - case USER_TIMECODE_SMPTE_MSF: { /* reduced SMPTE format that always shows minutes, seconds, frames. Hours only shown as needed. */ if (hours) sprintf(str, "%s%02d:%02d:%02d:%02d", neg, hours, minutes, seconds, frames); else sprintf(str, "%s%02d:%02d:%02d", neg, minutes, seconds, frames); + break; } - break; - case USER_TIMECODE_MILLISECONDS: { /* reduced SMPTE. Instead of frames, milliseconds are shown */ @@ -145,25 +143,23 @@ void ANIM_timecode_string_from_frame(char *str, Scene *scene, int power, short t if (hours) sprintf(str, "%s%02d:%02d:%0*.*f", neg, hours, minutes, s_pad, ms_dp, cfra); else sprintf(str, "%s%02d:%0*.*f", neg, minutes, s_pad, ms_dp, cfra); + break; } - break; - case USER_TIMECODE_SECONDS_ONLY: { /* only show the original seconds display */ /* round to whole numbers if power is >= 1 (i.e. scale is coarse) */ if (power <= 0) sprintf(str, "%.*f", 1 - power, raw_seconds); else sprintf(str, "%d", (int)floor(raw_seconds + GLA_PIXEL_OFS)); + break; } - break; - case USER_TIMECODE_SMPTE_FULL: default: { /* full SMPTE format */ sprintf(str, "%s%02d:%02d:%02d:%02d", neg, hours, minutes, seconds, frames); + break; } - break; } } else { diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 41aeb92e182..91003674524 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -301,22 +301,20 @@ short ANIM_animdata_context_getdata(bAnimContext *ac) { SpaceAction *saction = (SpaceAction *)sl; ok = actedit_get_context(ac, saction); + break; } - break; - case SPACE_IPO: { SpaceIpo *sipo = (SpaceIpo *)sl; ok = graphedit_get_context(ac, sipo); + break; } - break; - case SPACE_NLA: { SpaceNla *snla = (SpaceNla *)sl; ok = nlaedit_get_context(ac, snla); + break; } - break; } } @@ -543,9 +541,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne */ ale->key_data = NULL; ale->datatype = ALE_ALL; + break; } - break; - case ANIMTYPE_SCENE: { Scene *sce = (Scene *)data; @@ -556,8 +553,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->datatype = ALE_SCE; ale->adt = BKE_animdata_from_id(data); + break; } - break; case ANIMTYPE_OBJECT: { Base *base = (Base *)data; @@ -569,8 +566,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->datatype = ALE_OB; ale->adt = BKE_animdata_from_id(&ob->id); + break; } - break; case ANIMTYPE_FILLACTD: { bAction *act = (bAction *)data; @@ -579,8 +576,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->key_data = act; ale->datatype = ALE_ACT; + break; } - break; case ANIMTYPE_FILLDRIVERS: { AnimData *adt = (AnimData *)data; @@ -590,9 +587,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne // XXX... drivers don't show summary for now ale->key_data = NULL; ale->datatype = ALE_NONE; + break; } - break; - case ANIMTYPE_DSMAT: { Material *ma = (Material *)data; @@ -604,8 +600,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->datatype = ALE_ACT; ale->adt = BKE_animdata_from_id(data); + break; } - break; case ANIMTYPE_DSLAM: { Lamp *la = (Lamp *)data; @@ -617,8 +613,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->datatype = ALE_ACT; ale->adt = BKE_animdata_from_id(data); + break; } - break; case ANIMTYPE_DSCAM: { Camera *ca = (Camera *)data; @@ -630,8 +626,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->datatype = ALE_ACT; ale->adt = BKE_animdata_from_id(data); + break; } - break; case ANIMTYPE_DSCUR: { Curve *cu = (Curve *)data; @@ -643,8 +639,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->datatype = ALE_ACT; ale->adt = BKE_animdata_from_id(data); + break; } - break; case ANIMTYPE_DSARM: { bArmature *arm = (bArmature *)data; @@ -656,8 +652,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->datatype = ALE_ACT; ale->adt = BKE_animdata_from_id(data); + break; } - break; case ANIMTYPE_DSMESH: { Mesh *me = (Mesh *)data; @@ -669,8 +665,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->datatype = ALE_ACT; ale->adt = BKE_animdata_from_id(data); + break; } - break; case ANIMTYPE_DSLAT: { Lattice *lt = (Lattice *)data; @@ -682,8 +678,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->datatype = ALE_ACT; ale->adt = BKE_animdata_from_id(data); + break; } - break; case ANIMTYPE_DSSPK: { Speaker *spk = (Speaker *)data; @@ -695,8 +691,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->datatype = ALE_ACT; ale->adt = BKE_animdata_from_id(data); + break; } - break; case ANIMTYPE_DSSKEY: { Key *key = (Key *)data; @@ -708,8 +704,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->datatype = ALE_ACT; ale->adt = BKE_animdata_from_id(data); + break; } - break; case ANIMTYPE_DSWOR: { World *wo = (World *)data; @@ -721,8 +717,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->datatype = ALE_ACT; ale->adt = BKE_animdata_from_id(data); + break; } - break; case ANIMTYPE_DSNTREE: { bNodeTree *ntree = (bNodeTree *)data; @@ -734,8 +730,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->datatype = ALE_ACT; ale->adt = BKE_animdata_from_id(data); + break; } - break; case ANIMTYPE_DSLINESTYLE: { FreestyleLineStyle *linestyle = (FreestyleLineStyle *)data; @@ -747,8 +743,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->datatype = ALE_ACT; ale->adt = BKE_animdata_from_id(data); + break; } - break; case ANIMTYPE_DSPART: { ParticleSettings *part = (ParticleSettings *)ale->data; @@ -760,8 +756,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->datatype = ALE_ACT; ale->adt = BKE_animdata_from_id(data); + break; } - break; case ANIMTYPE_DSTEX: { Tex *tex = (Tex *)data; @@ -773,9 +769,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->datatype = ALE_ACT; ale->adt = BKE_animdata_from_id(data); + break; } - break; - case ANIMTYPE_GROUP: { bActionGroup *agrp = (bActionGroup *)data; @@ -784,8 +779,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->key_data = NULL; ale->datatype = ALE_GROUP; + break; } - break; case ANIMTYPE_FCURVE: { FCurve *fcu = (FCurve *)data; @@ -794,9 +789,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->key_data = fcu; ale->datatype = ALE_FCURVE; + break; } - break; - case ANIMTYPE_SHAPEKEY: { KeyBlock *kb = (KeyBlock *)data; @@ -824,9 +818,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne } ale->datatype = (ale->key_data) ? ALE_FCURVE : ALE_NONE; } + break; } - break; - case ANIMTYPE_GPLAYER: { bGPDlayer *gpl = (bGPDlayer *)data; @@ -835,9 +828,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->key_data = NULL; ale->datatype = ALE_GPFRAME; + break; } - break; - case ANIMTYPE_MASKLAYER: { MaskLayer *masklay = (MaskLayer *)data; @@ -846,9 +838,8 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->key_data = NULL; ale->datatype = ALE_MASKLAY; + break; } - break; - case ANIMTYPE_NLATRACK: { NlaTrack *nlt = (NlaTrack *)data; @@ -857,15 +848,15 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne ale->key_data = &nlt->strips; ale->datatype = ALE_NLASTRIP; + break; } - break; case ANIMTYPE_NLAACTION: { /* nothing to include for now... nothing editable from NLA-perspective here */ ale->key_data = NULL; ale->datatype = ALE_NONE; + break; } - break; } } @@ -1654,20 +1645,20 @@ static size_t animdata_filter_ds_textures(bAnimContext *ac, ListBase *anim_data, { Material *ma = (Material *)owner_id; mtex = (MTex **)(&ma->mtex); + break; } - break; case ID_LA: { Lamp *la = (Lamp *)owner_id; mtex = (MTex **)(&la->mtex); + break; } - break; case ID_WO: { World *wo = (World *)owner_id; mtex = (MTex **)(&wo->mtex); + break; } - break; default: { /* invalid/unsupported option */ @@ -1812,8 +1803,8 @@ static void animfilter_modifier_idpoin_cb(void *afm_ptr, Object *ob, ID **idpoin if (!(afm->ads->filterflag & ADS_FILTER_NOTEX)) { afm->items += animdata_filter_ds_texture(afm->ac, &afm->tmp_data, afm->ads, tex, owner_id, afm->filter_mode); } + break; } - break; /* TODO: images? */ } @@ -1920,8 +1911,8 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b type = ANIMTYPE_DSCAM; expanded = FILTER_CAM_OBJD(ca); + break; } - break; case OB_LAMP: /* ---------- Lamp ----------- */ { Lamp *la = (Lamp *)ob->data; @@ -1931,8 +1922,8 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b type = ANIMTYPE_DSLAM; expanded = FILTER_LAM_OBJD(la); + break; } - break; case OB_CURVE: /* ------- Curve ---------- */ case OB_SURF: /* ------- Nurbs Surface ---------- */ case OB_FONT: /* ------- Text Curve ---------- */ @@ -1944,8 +1935,8 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b type = ANIMTYPE_DSCUR; expanded = FILTER_CUR_OBJD(cu); + break; } - break; case OB_MBALL: /* ------- MetaBall ---------- */ { MetaBall *mb = (MetaBall *)ob->data; @@ -1955,8 +1946,8 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b type = ANIMTYPE_DSMBALL; expanded = FILTER_MBALL_OBJD(mb); + break; } - break; case OB_ARMATURE: /* ------- Armature ---------- */ { bArmature *arm = (bArmature *)ob->data; @@ -1966,8 +1957,8 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b type = ANIMTYPE_DSARM; expanded = FILTER_ARM_OBJD(arm); + break; } - break; case OB_MESH: /* ------- Mesh ---------- */ { Mesh *me = (Mesh *)ob->data; @@ -1977,8 +1968,8 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b type = ANIMTYPE_DSMESH; expanded = FILTER_MESH_OBJD(me); + break; } - break; case OB_LATTICE: /* ---- Lattice ---- */ { Lattice *lt = (Lattice *)ob->data; @@ -1988,16 +1979,16 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b type = ANIMTYPE_DSLAT; expanded = FILTER_LATTICE_OBJD(lt); + break; } - break; case OB_SPEAKER: /* ---------- Speaker ----------- */ { Speaker *spk = (Speaker *)ob->data; type = ANIMTYPE_DSSPK; expanded = FILTER_SPK_OBJD(spk); + break; } - break; } /* add object data animation channels */ @@ -2020,8 +2011,8 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b /* textures */ if (!(ads->filterflag & ADS_FILTER_NOTEX)) tmp_items += animdata_filter_ds_textures(ac, &tmp_data, ads, &la->id, filter_mode); + break; } - break; } } END_ANIMFILTER_SUBCHANNELS; @@ -2603,58 +2594,52 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mo /* the check for the DopeSheet summary is included here since the summary works here too */ if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) items += animfilter_action(ac, anim_data, ads, data, filter_mode, (ID *)obact); + break; } - break; - case ANIMCONT_SHAPEKEY: /* 'ShapeKey Editor' */ { /* the check for the DopeSheet summary is included here since the summary works here too */ if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) items = animdata_filter_shapekey(ac, anim_data, data, filter_mode); + break; } - break; - case ANIMCONT_GPENCIL: { if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) items = animdata_filter_gpencil(anim_data, data, filter_mode); + break; } - break; - case ANIMCONT_MASK: { if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) items = animdata_filter_mask(anim_data, data, filter_mode); + break; } - break; - case ANIMCONT_DOPESHEET: /* 'DopeSheet Editor' */ { /* the DopeSheet editor is the primary place where the DopeSheet summaries are useful */ if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items)) items += animdata_filter_dopesheet(ac, anim_data, data, filter_mode); + break; } - break; - case ANIMCONT_FCURVES: /* Graph Editor -> F-Curves/Animation Editing */ case ANIMCONT_DRIVERS: /* Graph Editor -> Drivers Editing */ case ANIMCONT_NLA: /* NLA Editor */ { /* all of these editors use the basic DopeSheet data for filtering options, but don't have all the same features */ items = animdata_filter_dopesheet(ac, anim_data, data, filter_mode); + break; } - break; - case ANIMCONT_CHANNEL: /* animation channel */ { bDopeSheet *ads = ac->ads; /* based on the channel type, filter relevant data for this */ items = animdata_filter_animchan(ac, anim_data, ads, data, filter_mode); + break; } - break; } - + /* remove any 'weedy' entries */ items = animdata_filter_remove_invalid(anim_data); diff --git a/source/blender/editors/animation/anim_intern.h b/source/blender/editors/animation/anim_intern.h index 54c7f7ea30f..c571da1ba74 100644 --- a/source/blender/editors/animation/anim_intern.h +++ b/source/blender/editors/animation/anim_intern.h @@ -54,14 +54,14 @@ void ANIM_OT_keyframe_insert_menu(struct wmOperatorType *ot); void ANIM_OT_keyframe_delete_v3d(struct wmOperatorType *ot); void ANIM_OT_keyframe_clear_v3d(struct wmOperatorType *ot); -/* Keyframe managment operators for UI buttons (RMB menu). */ +/* Keyframe management operators for UI buttons (RMB menu). */ void ANIM_OT_keyframe_insert_button(struct wmOperatorType *ot); void ANIM_OT_keyframe_delete_button(struct wmOperatorType *ot); void ANIM_OT_keyframe_clear_button(struct wmOperatorType *ot); /* .......... */ -/* KeyingSet managment operators for UI buttons (RMB menu) */ +/* KeyingSet management operators for UI buttons (RMB menu) */ void ANIM_OT_keyingset_button_add(struct wmOperatorType *ot); void ANIM_OT_keyingset_button_remove(struct wmOperatorType *ot); diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index f3edb61f487..3c8576be312 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -401,7 +401,7 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag) glDisable(GL_BLEND); /* and the marker name too, shifted slightly to the top-right */ - if (marker->name && marker->name[0]) { + if (marker->name[0]) { float x, y; /* minimal y coordinate which wouldn't be occluded by scroll */ @@ -553,7 +553,7 @@ static int ed_markers_opwrap_invoke(bContext *C, wmOperator *op, const wmEvent * /* ************************** add markers *************************** */ /* add TimeMarker at curent frame */ -static int ed_marker_add(bContext *C, wmOperator *UNUSED(op)) +static int ed_marker_add_exec(bContext *C, wmOperator *UNUSED(op)) { ListBase *markers = ED_context_get_markers(C); TimeMarker *marker; @@ -593,7 +593,7 @@ static void MARKER_OT_add(wmOperatorType *ot) ot->idname = "MARKER_OT_add"; /* api callbacks */ - ot->exec = ed_marker_add; + ot->exec = ed_marker_add_exec; ot->invoke = ed_markers_opwrap_invoke; ot->poll = ED_operator_animview_active; @@ -763,7 +763,6 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, const wmEvent *even MarkerMove *mm = op->customdata; View2D *v2d = UI_view2d_fromcontext(C); TimeMarker *marker, *selmarker = NULL; - float dx, fac; char str[256]; switch (event->type) { @@ -791,6 +790,9 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, const wmEvent *even } break; case MOUSEMOVE: + { + float dx, fac; + if (hasNumInput(&mm->num)) break; @@ -863,6 +865,8 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, const wmEvent *even ED_area_headerprint(CTX_wm_area(C), str); } + break; + } } if (event->val == KM_PRESS) { diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 8c49bee3058..df93da8b7c1 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -449,8 +449,8 @@ static char *get_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *pro /* free old one */ MEM_freeN(basepath); } + break; } - break; } /* fix RNA pointer, as we've now changed the ID root by changing the paths */ diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index adea3bcdc31..5ceca478b47 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -242,8 +242,8 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s else uiDefBut(block, LABEL, 1, ") ", 0, 0, 2 * UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); } + break; } - break; } } diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index d9d2180e184..4e6cc53f962 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -601,30 +601,27 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel, { if (sel) glColor4f(0.33f, 0.75f, 0.93f, alpha); else glColor4f(0.70f, 0.86f, 0.91f, alpha); + break; } - break; - case BEZT_KEYTYPE_EXTREME: /* redish frames for now */ { if (sel) glColor4f(0.95f, 0.5f, 0.5f, alpha); else glColor4f(0.91f, 0.70f, 0.80f, alpha); + break; } - break; - case BEZT_KEYTYPE_JITTER: /* greenish frames for now? */ { if (sel) glColor4f(0.38f, 0.75f, 0.26f, alpha); else glColor4f(0.58f, 0.90f, 0.46f, alpha); + break; } - break; - case BEZT_KEYTYPE_KEYFRAME: /* traditional yellowish frames for now */ default: { if (sel) UI_ThemeColorShadeAlpha(TH_STRIP_SELECT, 50, -255 * (1.0f - alpha)); else glColor4f(0.91f, 0.91f, 0.91f, alpha); + break; } - break; } glCallList(displist2); diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index 2cb2f6683ef..cfa5f9f032c 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -628,9 +628,8 @@ static tAnimCopybufItem *pastebuf_match_path_property(FCurve *fcu, const short f PropertyRNA *prop; RNA_id_pointer_create(aci->id, &id_ptr); - RNA_path_resolve(&id_ptr, aci->rna_path, &rptr, &prop); - if (prop) { + if (RNA_path_resolve_property(&id_ptr, aci->rna_path, &rptr, &prop)) { const char *identifier = RNA_property_identifier(prop); int len_id = strlen(identifier); int len_path = strlen(fcu->rna_path); diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 1638e4ce629..63acc5a943c 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1962,10 +1962,11 @@ short id_frame_has_keyframe(ID *id, float frame, short filter) return object_frame_has_keyframe((Object *)id, frame, filter); break; - case ID_SCE: /* scene */ +#if 0 // XXX TODO... for now, just use 'normal' behavior - // break; - + case ID_SCE: /* scene */ + break; +#endif default: /* 'normal type' */ { AnimData *adt = BKE_animdata_from_id(id); @@ -1973,8 +1974,8 @@ short id_frame_has_keyframe(ID *id, float frame, short filter) /* only check keyframes in active action */ if (adt) return action_frame_has_keyframe(adt->action, frame, filter); + break; } - break; } diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 07825f59c2f..ebe8dccc356 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -1004,8 +1004,8 @@ int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSe // XXX: only object transforms? DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); + break; } - break; } /* send notifiers for updates (this doesn't require context to work!) */ diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c index 13c1f2d5b2b..d480d41f5d6 100644 --- a/source/blender/editors/armature/armature_add.c +++ b/source/blender/editors/armature/armature_add.c @@ -84,39 +84,25 @@ EditBone *ED_armature_edit_bone_add(bArmature *arm, const char *name) return bone; } -/* v3d and rv3d are allowed to be NULL */ -void add_primitive_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d) +void add_primitive_bone(Object *obedit_arm, bool view_aligned) { - Object *obedit = scene->obedit; // XXX get from context - bArmature *arm = obedit->data; - float obmat[3][3], curs[3], viewmat[3][3], totmat[3][3], imat[3][3]; - EditBone *bone; - - /* Get inverse point for head and orientation for tail */ - invert_m4_m4(obedit->imat, obedit->obmat); - mul_v3_m4v3(curs, obedit->imat, give_cursor(scene, v3d)); + bArmature *arm = obedit_arm->data; + EditBone *bone; - if (rv3d && (U.flag & USER_ADD_VIEWALIGNED)) - copy_m3_m4(obmat, rv3d->viewmat); - else unit_m3(obmat); - - copy_m3_m4(viewmat, obedit->obmat); - mul_m3_m3m3(totmat, obmat, viewmat); - invert_m3_m3(imat, totmat); - - ED_armature_deselect_all(obedit, 0); + ED_armature_deselect_all(obedit_arm, 0); /* Create a bone */ bone = ED_armature_edit_bone_add(arm, "Bone"); arm->act_edbone = bone; - copy_v3_v3(bone->head, curs); - - if (rv3d && (U.flag & USER_ADD_VIEWALIGNED)) - add_v3_v3v3(bone->tail, bone->head, imat[1]); // bone with unit length 1 + zero_v3(bone->head); + zero_v3(bone->tail); + + if (view_aligned) + bone->tail[1] = 1.0f; else - add_v3_v3v3(bone->tail, bone->head, imat[2]); // bone with unit length 1, pointing up Z + bone->tail[2] = 1.0f; } diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c index 12602c10955..90c1a439a19 100644 --- a/source/blender/editors/armature/armature_edit.c +++ b/source/blender/editors/armature/armature_edit.c @@ -78,11 +78,10 @@ void ED_armature_apply_transform(Object *ob, float mat[4][4]) /* Do the rotations */ for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { - float delta[3], tmat[3][3]; + float tmat[3][3]; /* find the current bone's roll matrix */ - sub_v3_v3v3(delta, ebone->tail, ebone->head); - vec_roll_to_mat3(delta, ebone->roll, tmat); + ED_armature_ebone_to_mat3(ebone, tmat); /* transform the roll matrix */ mul_m3_m3m3(tmat, mat3, tmat); @@ -282,15 +281,14 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op) mul_m3_v3(imat, vec); } else if (type == CALC_ROLL_ACTIVE) { - float mat[3][3], nor[3]; + float mat[3][3]; ebone = (EditBone *)arm->act_edbone; if (ebone == NULL) { BKE_report(op->reports, RPT_ERROR, "No active bone set"); return OPERATOR_CANCELLED; } - sub_v3_v3v3(nor, ebone->tail, ebone->head); - vec_roll_to_mat3(nor, ebone->roll, mat); + ED_armature_ebone_to_mat3(ebone, mat); copy_v3_v3(vec, mat[2]); } else { /* Axis */ diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index bfebc68ea46..e58d8fd2380 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -63,6 +63,8 @@ void ARMATURE_OT_parent_clear(struct wmOperatorType *ot); void ARMATURE_OT_select_all(struct wmOperatorType *ot); void ARMATURE_OT_select_inverse(struct wmOperatorType *ot); +void ARMATURE_OT_select_more(struct wmOperatorType *ot); +void ARMATURE_OT_select_less(struct wmOperatorType *ot); void ARMATURE_OT_select_hierarchy(struct wmOperatorType *ot); void ARMATURE_OT_select_linked(struct wmOperatorType *ot); void ARMATURE_OT_select_similar(struct wmOperatorType *ot); diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index 568178802bd..0090522d1e1 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -59,6 +59,8 @@ void ED_operatortypes_armature(void) WM_operatortype_append(ARMATURE_OT_select_all); WM_operatortype_append(ARMATURE_OT_select_inverse); + WM_operatortype_append(ARMATURE_OT_select_more); + WM_operatortype_append(ARMATURE_OT_select_less); WM_operatortype_append(ARMATURE_OT_select_hierarchy); WM_operatortype_append(ARMATURE_OT_select_linked); WM_operatortype_append(ARMATURE_OT_select_similar); @@ -258,6 +260,9 @@ void ED_keymap_armature(wmKeyConfig *keyconf) RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD); RNA_boolean_set(kmi->ptr, "extend", TRUE); + WM_keymap_add_item(keymap, "ARMATURE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "ARMATURE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "ARMATURE_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "ARMATURE_OT_select_linked", LKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index d5dbe80538f..79d75c9fcda 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -170,7 +170,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann } /* join armature exec is exported for use in object->join objects operator... */ -int join_armature_exec(bContext *C, wmOperator *UNUSED(op)) +int join_armature_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -180,6 +180,7 @@ int join_armature_exec(bContext *C, wmOperator *UNUSED(op)) bPoseChannel *pchan, *pchann; EditBone *curbone; float mat[4][4], oimat[4][4]; + bool ok = false; /* Ensure we're not in editmode and that the active object is an armature*/ if (!ob || ob->type != OB_ARMATURE) @@ -187,6 +188,21 @@ int join_armature_exec(bContext *C, wmOperator *UNUSED(op)) if (!arm || arm->edbo) return OPERATOR_CANCELLED; + CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases) + { + if (base->object == ob) { + ok = true; + break; + } + } + CTX_DATA_END; + + /* that way the active object is always selected */ + if (ok == false) { + BKE_report(op->reports, RPT_WARNING, "Active object is not a selected armature"); + return OPERATOR_CANCELLED; + } + /* Get editbones of active armature to add editbones to */ ED_armature_to_edit(ob); @@ -226,21 +242,18 @@ int join_armature_exec(bContext *C, wmOperator *UNUSED(op)) float difmat[4][4]; float imat[4][4]; float temp[3][3]; - float delta[3]; /* Get the premat */ - sub_v3_v3v3(delta, curbone->tail, curbone->head); - vec_roll_to_mat3(delta, curbone->roll, temp); + ED_armature_ebone_to_mat3(curbone, temp); - unit_m4(premat); /* Mat4MulMat34 only sets 3x3 part */ + unit_m4(premat); /* mul_m4_m3m4 only sets 3x3 part */ mul_m4_m3m4(premat, temp, mat); mul_m4_v3(mat, curbone->head); mul_m4_v3(mat, curbone->tail); /* Get the postmat */ - sub_v3_v3v3(delta, curbone->tail, curbone->head); - vec_roll_to_mat3(delta, curbone->roll, temp); + ED_armature_ebone_to_mat3(curbone, temp); copy_m4_m3(postmat, temp); /* Find the roll */ diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c index bbdc0df41a7..f2b3ce206f1 100644 --- a/source/blender/editors/armature/armature_select.c +++ b/source/blender/editors/armature/armature_select.c @@ -244,7 +244,7 @@ void ARMATURE_OT_select_linked(wmOperatorType *ot) ot->description = "Select bones related to selected ones by parent/child relationships"; /* api callbacks */ - ot->exec = NULL; + /* leave 'exec' unset */ ot->invoke = armature_select_linked_invoke; ot->poll = armature_select_linked_poll; @@ -434,7 +434,7 @@ void ED_armature_deselect_all_visible(Object *obedit) for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { /* first and foremost, bone must be visible and selected */ - if (EBONE_SELECTABLE(arm, ebone)) { + if (EBONE_VISIBLE(arm, ebone)) { ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); } } @@ -597,38 +597,48 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op) int action = RNA_enum_get(op->ptr, "action"); if (action == SEL_TOGGLE) { - action = SEL_SELECT; /* Determine if there are any selected bones * And therefore whether we are selecting or deselecting */ - if (CTX_DATA_COUNT(C, selected_bones) > 0) - action = SEL_DESELECT; + action = SEL_SELECT; + CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones) + { + if (ebone->flag & (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL)) { + action = SEL_DESELECT; + break; + } + } + CTX_DATA_END; } /* Set the flags */ CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones) { /* ignore bone if selection can't change */ - if ((ebone->flag & BONE_UNSELECTABLE) == 0) { - switch (action) { - case SEL_SELECT: + switch (action) { + case SEL_SELECT: + if ((ebone->flag & BONE_UNSELECTABLE) == 0) { ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); - if (ebone->parent) + if (ebone->parent) { ebone->parent->flag |= (BONE_TIPSEL); - break; - case SEL_DESELECT: - ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); - break; - case SEL_INVERT: - if (ebone->flag & BONE_SELECTED) { - ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); } - else { + } + break; + case SEL_DESELECT: + ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); + break; + case SEL_INVERT: + if (ebone->flag & BONE_SELECTED) { + ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); + } + else { + if ((ebone->flag & BONE_UNSELECTABLE) == 0) { ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); - if (ebone->parent) + if (ebone->parent) { ebone->parent->flag |= (BONE_TIPSEL); + } } - break; - } + } + break; } } CTX_DATA_END; @@ -655,6 +665,145 @@ void ARMATURE_OT_select_all(wmOperatorType *ot) WM_operator_properties_select_all(ot); } +/**************** Select more/less **************/ + +#define EBONE_PREV_FLAG_GET(ebone) ((void)0, (GET_INT_FROM_POINTER(ebone->temp))) +#define EBONE_PREV_FLAG_SET(ebone, val) (ebone->temp = SET_INT_IN_POINTER(val)) + +static void armature_select_more(bArmature *arm, EditBone *ebone) +{ + if ((EBONE_PREV_FLAG_GET(ebone) & (BONE_ROOTSEL | BONE_TIPSEL)) != 0) { + if (EBONE_SELECTABLE(arm, ebone)) { + ED_armature_ebone_select_set(ebone, true); + } + } + + if (ebone->parent && (ebone->flag & BONE_CONNECTED)) { + /* to parent */ + if ((EBONE_PREV_FLAG_GET(ebone) & BONE_ROOTSEL) != 0) { + if (EBONE_SELECTABLE(arm, ebone->parent)) { + ED_armature_ebone_selectflag_enable(ebone->parent, (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL)); + } + } + + /* from parent (difference from select less) */ + if ((EBONE_PREV_FLAG_GET(ebone->parent) & BONE_TIPSEL) != 0) { + if (EBONE_SELECTABLE(arm, ebone)) { + ED_armature_ebone_selectflag_enable(ebone, (BONE_SELECTED | BONE_ROOTSEL)); + } + } + } +} + +static void armature_select_less(bArmature *UNUSED(arm), EditBone *ebone) +{ + if ((EBONE_PREV_FLAG_GET(ebone) & (BONE_ROOTSEL | BONE_TIPSEL)) != (BONE_ROOTSEL | BONE_TIPSEL)) { + ED_armature_ebone_select_set(ebone, false); + } + + if (ebone->parent && (ebone->flag & BONE_CONNECTED)) { + /* to parent */ + if ((EBONE_PREV_FLAG_GET(ebone) & BONE_SELECTED) == 0) { + ED_armature_ebone_selectflag_disable(ebone->parent, (BONE_SELECTED | BONE_TIPSEL)); + } + + /* from parent (difference from select more) */ + if ((EBONE_PREV_FLAG_GET(ebone->parent) & BONE_SELECTED) == 0) { + ED_armature_ebone_selectflag_disable(ebone, (BONE_SELECTED | BONE_ROOTSEL)); + } + } +} + +static void armature_select_more_less(Object* ob, bool more) +{ + bArmature* arm = (bArmature *)ob->data; + EditBone* ebone; + + /* XXX, eventually we shouldn't need this - campbell */ + ED_armature_sync_selection(arm->edbo); + + /* count bones & store selection state */ + for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { + EBONE_PREV_FLAG_SET(ebone, ED_armature_ebone_selectflag_get(ebone)); + } + + /* do selection */ + for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { + if (EBONE_VISIBLE(arm, ebone)) { + if (more) { + armature_select_more(arm, ebone); + } + else { + armature_select_less(arm, ebone); + } + } + } + + for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { + if (EBONE_VISIBLE(arm, ebone)) { + if (more == false) { + if (ebone->flag & BONE_SELECTED) { + ED_armature_ebone_select_set(ebone, true); + } + } + } + ebone->temp = NULL; + } + + ED_armature_sync_selection(arm->edbo); +} + +#undef EBONE_PREV_FLAG_GET +#undef EBONE_PREV_FLAG_SET + +static int armature_de_select_more_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Object *obedit = CTX_data_edit_object(C); + armature_select_more_less(obedit, true); + WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit); + + return OPERATOR_FINISHED; +} + +void ARMATURE_OT_select_more(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Select More"; + ot->idname = "ARMATURE_OT_select_more"; + ot->description = "Select those bones connected to the initial selection"; + + /* api callbacks */ + ot->exec = armature_de_select_more_exec; + ot->poll = ED_operator_editarmature; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + +static int armature_de_select_less_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Object *obedit = CTX_data_edit_object(C); + armature_select_more_less(obedit, false); + WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit); + + return OPERATOR_FINISHED; +} + +void ARMATURE_OT_select_less(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Select Less"; + ot->idname = "ARMATURE_OT_select_less"; + ot->description = "Deselect those bones at the boundary of each selection region"; + + /* api callbacks */ + ot->exec = armature_de_select_less_exec; + ot->poll = ED_operator_editarmature; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + enum { SIMEDBONE_LENGTH = 1, SIMEDBONE_DIRECTION, @@ -672,16 +821,6 @@ static EnumPropertyItem prop_similar_types[] = { {0, NULL, 0, NULL, NULL} }; -/* could be used in more places */ -static void ED_armature_edit_bone_select(EditBone *ebone) -{ - BLI_assert((ebone->flag & BONE_UNSELECTABLE) == 0); - ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); - - if ((ebone->flag & BONE_CONNECTED) && (ebone->parent != NULL)) { - ebone->parent->flag |= BONE_TIPSEL; - } -} static void select_similar_length(bArmature *arm, EditBone *ebone_act, const float thresh) { @@ -696,7 +835,7 @@ static void select_similar_length(bArmature *arm, EditBone *ebone_act, const flo if ((ebone->length >= len_min) && (ebone->length <= len_max)) { - ED_armature_edit_bone_select(ebone); + ED_armature_ebone_select_set(ebone, true); } } } @@ -714,7 +853,7 @@ static void select_similar_direction(bArmature *arm, EditBone *ebone_act, const sub_v3_v3v3(dir, ebone->head, ebone->tail); if (angle_v3v3(dir_act, dir) / (float)M_PI < thresh) { - ED_armature_edit_bone_select(ebone); + ED_armature_ebone_select_set(ebone, true); } } } @@ -727,7 +866,7 @@ static void select_similar_layer(bArmature *arm, EditBone *ebone_act) for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { if (EBONE_SELECTABLE(arm, ebone)) { if (ebone->layer & ebone_act->layer) { - ED_armature_edit_bone_select(ebone); + ED_armature_ebone_select_set(ebone, true); } } } @@ -750,8 +889,8 @@ static void select_similar_prefix(bArmature *arm, EditBone *ebone_act) if (EBONE_SELECTABLE(arm, ebone)) { char prefix_other[MAX_VGROUP_NAME]; BKE_deform_split_prefix(ebone->name, prefix_other, body_tmp); - if (!strcmp(prefix_act, prefix_other)) { - ED_armature_edit_bone_select(ebone); + if (STREQ(prefix_act, prefix_other)) { + ED_armature_ebone_select_set(ebone, true); } } } @@ -774,8 +913,8 @@ static void select_similar_suffix(bArmature *arm, EditBone *ebone_act) if (EBONE_SELECTABLE(arm, ebone)) { char suffix_other[MAX_VGROUP_NAME]; BKE_deform_split_suffix(ebone->name, body_tmp, suffix_other); - if (!strcmp(suffix_act, suffix_other)) { - ED_armature_edit_bone_select(ebone); + if (STREQ(suffix_act, suffix_other)) { + ED_armature_ebone_select_set(ebone, true); } } } diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c index 0a9cff3dc90..22bd22c8561 100644 --- a/source/blender/editors/armature/armature_skinning.c +++ b/source/blender/editors/armature/armature_skinning.c @@ -362,7 +362,7 @@ static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH); if (dm->foreachMappedVert) { - dm->foreachMappedVert(dm, add_vgroups__mapFunc, (void *)verts); + dm->foreachMappedVert(dm, add_vgroups__mapFunc, (void *)verts, DM_FOREACH_NOP); vertsfilled = 1; } diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c index 4120be08b46..4991ef63cf5 100644 --- a/source/blender/editors/armature/armature_utils.c +++ b/source/blender/editors/armature/armature_utils.c @@ -156,6 +156,25 @@ bool ED_armature_ebone_is_child_recursive(EditBone *ebone_parent, EditBone *ebon return false; } +void ED_armature_ebone_to_mat3(EditBone *ebone, float mat[3][3]) +{ + float delta[3]; + + /* Find the current bone matrix */ + sub_v3_v3v3(delta, ebone->tail, ebone->head); + vec_roll_to_mat3(delta, ebone->roll, mat); +} + +void ED_armature_ebone_to_mat4(EditBone *ebone, float mat[4][4]) +{ + float m3[3][3]; + + ED_armature_ebone_to_mat3(ebone, m3); + + copy_m4_m3(mat, m3); + copy_v3_v3(mat[3], ebone->head); +} + /* *************************************************************** */ /* Mirroring */ @@ -337,18 +356,9 @@ EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone } else { /* if the bone is not selected, but connected to its parent - * copy the parents tip selection state */ + * always use the parents tip selection state */ if (eBone->parent && (eBone->flag & BONE_CONNECTED)) { - /* selecting with the mouse gives this behavior */ - if (eBone->parent->flag & BONE_TIPSEL) { - eBone->flag |= BONE_ROOTSEL; - } - else { - eBone->flag &= ~BONE_ROOTSEL; - } - - /* probably not selected but just in case */ - eBone->flag &= ~BONE_TIPSEL; + eBone->flag &= ~BONE_ROOTSEL; } } @@ -398,7 +408,6 @@ static void fix_bonelist_roll(ListBase *bonelist, ListBase *editbonelist) float postmat[3][3]; float difmat[3][3]; float imat[3][3]; - float delta[3]; for (curBone = bonelist->first; curBone; curBone = curBone->next) { /* sets local matrix and arm_mat (restpos) */ @@ -411,8 +420,7 @@ static void fix_bonelist_roll(ListBase *bonelist, ListBase *editbonelist) if (ebone) { /* Get the ebone premat */ - sub_v3_v3v3(delta, ebone->tail, ebone->head); - vec_roll_to_mat3(delta, ebone->roll, premat); + ED_armature_ebone_to_mat3(ebone, premat); /* Get the bone postmat */ copy_m3_m4(postmat, curBone->arm_mat); @@ -512,11 +520,9 @@ void ED_armature_from_edit(Object *obedit) { float M_parentRest[3][3]; float iM_parentRest[3][3]; - float delta[3]; /* Get the parent's matrix (rotation only) */ - sub_v3_v3v3(delta, eBone->parent->tail, eBone->parent->head); - vec_roll_to_mat3(delta, eBone->parent->roll, M_parentRest); + ED_armature_ebone_to_mat3(eBone->parent, M_parentRest); /* Invert the parent matrix */ invert_m3_m3(iM_parentRest, M_parentRest); @@ -588,6 +594,60 @@ void ED_armature_to_edit(Object *ob) /* *************************************************************** */ /* Undo for Armature EditMode*/ +/* free's bones and their properties */ + +static void ED_armature_ebone_listbase_free(ListBase *lb) +{ + EditBone *ebone, *ebone_next; + + for (ebone = lb->first; ebone; ebone = ebone_next) { + ebone_next = ebone->next; + + if (ebone->prop) { + IDP_FreeProperty(ebone->prop); + MEM_freeN(ebone->prop); + } + + MEM_freeN(ebone); + } + + lb->first = NULL; + lb->last = NULL; +} + +static void ED_armature_ebone_listbase_copy(ListBase *lb_dst, ListBase *lb_src) +{ + EditBone *ebone_src; + EditBone *ebone_dst; + + BLI_assert(lb_dst->first == NULL); + + for (ebone_src = lb_src->first; ebone_src; ebone_src = ebone_src->next) { + ebone_dst = MEM_dupallocN(ebone_src); + if (ebone_dst->prop) { + ebone_dst->prop = IDP_CopyProperty(ebone_dst->prop); + } + ebone_src->temp = ebone_dst; + BLI_addtail(lb_dst, ebone_dst); + } + + /* set pointers */ + for (ebone_dst = lb_dst->first; ebone_dst; ebone_dst = ebone_dst->next) { + if (ebone_dst->parent) { + ebone_dst->parent = ebone_dst->parent->temp; + } + } +} + +static void ED_armature_ebone_listbase_temp_clear(ListBase *lb) +{ + EditBone *ebone; + /* be sure they don't hang ever */ + for (ebone = lb->first; ebone; ebone = ebone->next) { + ebone->temp = NULL; + } +} + typedef struct UndoArmature { EditBone *act_edbone; ListBase lb; @@ -597,60 +657,40 @@ static void undoBones_to_editBones(void *uarmv, void *armv, void *UNUSED(data)) { UndoArmature *uarm = uarmv; bArmature *arm = armv; - EditBone *ebo, *newebo; + EditBone *ebone; - BLI_freelistN(arm->edbo); - - /* copy */ - for (ebo = uarm->lb.first; ebo; ebo = ebo->next) { - newebo = MEM_dupallocN(ebo); - ebo->temp = newebo; - BLI_addtail(arm->edbo, newebo); - } + ED_armature_ebone_listbase_free(arm->edbo); + ED_armature_ebone_listbase_copy(arm->edbo, &uarm->lb); /* active bone */ if (uarm->act_edbone) { - ebo = uarm->act_edbone; - arm->act_edbone = ebo->temp; + ebone = uarm->act_edbone; + arm->act_edbone = ebone->temp; } - else + else { arm->act_edbone = NULL; - - /* set pointers */ - for (newebo = arm->edbo->first; newebo; newebo = newebo->next) { - if (newebo->parent) newebo->parent = newebo->parent->temp; - } - /* be sure they don't hang ever */ - for (newebo = arm->edbo->first; newebo; newebo = newebo->next) { - newebo->temp = NULL; } + + ED_armature_ebone_listbase_temp_clear(arm->edbo); } static void *editBones_to_undoBones(void *armv, void *UNUSED(obdata)) { bArmature *arm = armv; UndoArmature *uarm; - EditBone *ebo, *newebo; + EditBone *ebone; uarm = MEM_callocN(sizeof(UndoArmature), "listbase undo"); - /* copy */ - for (ebo = arm->edbo->first; ebo; ebo = ebo->next) { - newebo = MEM_dupallocN(ebo); - ebo->temp = newebo; - BLI_addtail(&uarm->lb, newebo); - } + ED_armature_ebone_listbase_copy(&uarm->lb, arm->edbo); /* active bone */ if (arm->act_edbone) { - ebo = arm->act_edbone; - uarm->act_edbone = ebo->temp; + ebone = arm->act_edbone; + uarm->act_edbone = ebone->temp; } - /* set pointers */ - for (newebo = uarm->lb.first; newebo; newebo = newebo->next) { - if (newebo->parent) newebo->parent = newebo->parent->temp; - } + ED_armature_ebone_listbase_temp_clear(&uarm->lb); return uarm; } @@ -659,7 +699,8 @@ static void free_undoBones(void *uarmv) { UndoArmature *uarm = uarmv; - BLI_freelistN(&uarm->lb); + ED_armature_ebone_listbase_free(&uarm->lb); + MEM_freeN(uarm); } @@ -678,3 +719,62 @@ void undo_push_armature(bContext *C, const char *name) // XXX solve getdata() undo_editmode_push(C, name, get_armature_edit, free_undoBones, undoBones_to_editBones, editBones_to_undoBones, NULL); } + +/* *************************************************************** */ +/* Low level selection functions which hide connected-parent + * flag behavior which gets tricky to handle in selection operators. + * (no flushing in ED_armature_ebone_select.*, that should be explicit) */ + +int ED_armature_ebone_selectflag_get(const EditBone *ebone) +{ + if (ebone->parent && (ebone->flag & BONE_CONNECTED)) { + return ((ebone->flag & (BONE_SELECTED | BONE_TIPSEL)) | + ((ebone->parent->flag & BONE_TIPSEL) ? BONE_ROOTSEL : 0)); + } + else { + return (ebone->flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL)); + } +} + +void ED_armature_ebone_selectflag_set(EditBone *ebone, int flag) +{ + flag = flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL); + + if (ebone->parent && (ebone->flag & BONE_CONNECTED)) { + ebone->flag &= ~(BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL); + ebone->parent->flag &= ~BONE_TIPSEL; + + ebone->flag |= flag; + ebone->parent->flag |= (flag & BONE_ROOTSEL) ? BONE_TIPSEL : 0; + } + else { + ebone->flag &= ~(BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL); + ebone->flag |= flag; + } +} + +void ED_armature_ebone_selectflag_enable(EditBone *ebone, int flag) +{ + BLI_assert((flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL)) != 0); + ED_armature_ebone_selectflag_set(ebone, ebone->flag | flag); +} + +void ED_armature_ebone_selectflag_disable(EditBone *ebone, int flag) +{ + BLI_assert((flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL)) != 0); + ED_armature_ebone_selectflag_set(ebone, ebone->flag & ~flag); +} + +/* could be used in more places */ +void ED_armature_ebone_select_set(EditBone *ebone, bool select) +{ + int flag; + if (select) { + BLI_assert((ebone->flag & BONE_UNSELECTABLE) == 0); + flag = (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); + } + else { + flag = 0; + } + ED_armature_ebone_selectflag_set(ebone, flag); +} diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index c599e978e58..9449b5a49bf 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -271,7 +271,7 @@ void POSE_OT_select_linked(wmOperatorType *ot) ot->description = "Select bones related to selected ones by parent/child relationships"; /* api callbacks */ - ot->exec = NULL; + /* leave 'exec' unset */ ot->invoke = pose_select_connected_invoke; ot->poll = pose_select_linked_poll; diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c index 0ff0e0d498c..ec1662c7fa6 100644 --- a/source/blender/editors/armature/pose_slide.c +++ b/source/blender/editors/armature/pose_slide.c @@ -238,9 +238,8 @@ static void pose_slide_apply_val(tPoseSlideOp *pso, FCurve *fcu, float *val) while (iters-- > 0) { (*val) = (-((sVal * w2) + (eVal * w1)) + ((*val) * 6.0f) ) / 5.0f; } + break; } - break; - case POSESLIDE_RELAX: /* make the current pose more like its surrounding ones */ { /* perform a weighted average here, favoring the middle pose @@ -252,16 +251,15 @@ static void pose_slide_apply_val(tPoseSlideOp *pso, FCurve *fcu, float *val) while (iters-- > 0) { (*val) = ( ((sVal * w2) + (eVal * w1)) + ((*val) * 5.0f) ) / 6.0f; } + break; } - break; - case POSESLIDE_BREAKDOWN: /* make the current pose slide around between the endpoints */ { /* perform simple linear interpolation - coefficient for start must come from pso->percentage... */ /* TODO: make this use some kind of spline interpolation instead? */ (*val) = ((sVal * w2) + (eVal * w1)); + break; } - break; } } @@ -327,8 +325,8 @@ static void pose_slide_apply_props(tPoseSlideOp *pso, tPChanFCurveLink *pfl) float tval = RNA_property_float_get(&ptr, prop); pose_slide_apply_val(pso, fcu, &tval); RNA_property_float_set(&ptr, prop, tval); + break; } - break; case PROP_BOOLEAN: case PROP_ENUM: case PROP_INT: @@ -336,8 +334,8 @@ static void pose_slide_apply_props(tPoseSlideOp *pso, tPChanFCurveLink *pfl) float tval = (float)RNA_property_int_get(&ptr, prop); pose_slide_apply_val(pso, fcu, &tval); RNA_property_int_set(&ptr, prop, (int)tval); + break; } - break; default: /* cannot handle */ //printf("Cannot Pose Slide non-numerical property\n"); @@ -672,9 +670,8 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event) /* apply... */ pose_slide_apply(C, pso); + break; } - break; - default: /* unhandled event (maybe it was some view manip? */ /* allow to pass through */ return OPERATOR_RUNNING_MODAL | OPERATOR_PASS_THROUGH; diff --git a/source/blender/editors/armature/pose_utils.c b/source/blender/editors/armature/pose_utils.c index a5e51ccf32a..014a64170db 100644 --- a/source/blender/editors/armature/pose_utils.c +++ b/source/blender/editors/armature/pose_utils.c @@ -239,7 +239,7 @@ void poseAnim_mapping_autoKeyframe(bContext *C, Scene *scene, Object *ob, ListBa * - only do this if keyframes should have been added * - do not calculate unless there are paths already to update... */ - if (C && (ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) { + if (ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS) { //ED_pose_clear_paths(C, ob); // XXX for now, don't need to clear ED_pose_recalculate_paths(scene, ob); } diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h index 0521297d049..d197697e60b 100644 --- a/source/blender/editors/curve/curve_intern.h +++ b/source/blender/editors/curve/curve_intern.h @@ -88,7 +88,9 @@ void CURVE_OT_shade_flat(struct wmOperatorType *ot); void CURVE_OT_tilt_clear(struct wmOperatorType *ot); void CURVE_OT_smooth(struct wmOperatorType *ot); +void CURVE_OT_smooth_weight(struct wmOperatorType *ot); void CURVE_OT_smooth_radius(struct wmOperatorType *ot); +void CURVE_OT_smooth_tilt(struct wmOperatorType *ot); void CURVE_OT_primitive_bezier_curve_add(struct wmOperatorType *ot); void CURVE_OT_primitive_bezier_circle_add(struct wmOperatorType *ot); diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index 5b525a089b3..2452a5d1a4b 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -112,7 +112,9 @@ void ED_operatortypes_curve(void) WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_torus_add); WM_operatortype_append(CURVE_OT_smooth); + WM_operatortype_append(CURVE_OT_smooth_weight); WM_operatortype_append(CURVE_OT_smooth_radius); + WM_operatortype_append(CURVE_OT_smooth_tilt); WM_operatortype_append(CURVE_OT_de_select_first); WM_operatortype_append(CURVE_OT_de_select_last); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 3327d4a07e9..660f8098a38 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -2260,29 +2260,33 @@ void CURVE_OT_smooth(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -/**************** smooth curve radius operator *************/ +/* -------------------------------------------------------------------- */ +/* Smooth radius/weight/tilt + * + * TODO: make smoothing distance based + * TODO: support cyclic curves + */ -/* TODO, make smoothing distance based */ -static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op)) +static void curve_smooth_value(ListBase *editnurb, + const int bezt_offsetof, const int bp_offset) { - Object *obedit = CTX_data_edit_object(C); - ListBase *editnurb = object_editcurve_get(obedit); Nurb *nu; BezTriple *bezt; BPoint *bp; int a; - + /* use for smoothing */ int last_sel; int start_sel, end_sel; /* selection indices, inclusive */ float start_rad, end_rad, fac, range; - + for (nu = editnurb->first; nu; nu = nu->next) { if (nu->bezt) { - +#define BEZT_VALUE(bezt) (*((float *)((char *)bezt + bezt_offsetof))) + for (last_sel = 0; last_sel < nu->pntsu; last_sel++) { /* loop over selection segments of a curve, smooth each */ - + /* Start BezTriple code, this is duplicated below for points, make sure these functions stay in sync */ start_sel = -1; for (bezt = &nu->bezt[last_sel], a = last_sel; a < nu->pntsu; a++, bezt++) { @@ -2299,57 +2303,60 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op)) } end_sel = a; } - + if (start_sel == -1) { last_sel = nu->pntsu; /* next... */ } else { last_sel = end_sel; /* before we modify it */ - + /* now blend between start and end sel */ - start_rad = end_rad = -1.0; - + start_rad = end_rad = FLT_MAX; + if (start_sel == end_sel) { /* simple, only 1 point selected */ - if (start_sel > 0) start_rad = nu->bezt[start_sel - 1].radius; - if (end_sel != -1 && end_sel < nu->pntsu) end_rad = nu->bezt[start_sel + 1].radius; - - if (start_rad >= 0.0f && end_rad >= 0.0f) nu->bezt[start_sel].radius = (start_rad + end_rad) / 2.0f; - else if (start_rad >= 0.0f) nu->bezt[start_sel].radius = start_rad; - else if (end_rad >= 0.0f) nu->bezt[start_sel].radius = end_rad; + if (start_sel > 0) start_rad = BEZT_VALUE(&nu->bezt[start_sel - 1]); + if (end_sel != -1 && end_sel < nu->pntsu) end_rad = BEZT_VALUE(&nu->bezt[start_sel + 1]); + + if (start_rad != FLT_MAX && end_rad >= FLT_MAX) BEZT_VALUE(&nu->bezt[start_sel]) = (start_rad + end_rad) / 2.0f; + else if (start_rad != FLT_MAX) BEZT_VALUE(&nu->bezt[start_sel]) = start_rad; + else if (end_rad != FLT_MAX) BEZT_VALUE(&nu->bezt[start_sel]) = end_rad; } else { /* if endpoints selected, then use them */ if (start_sel == 0) { - start_rad = nu->bezt[start_sel].radius; + start_rad = BEZT_VALUE(&nu->bezt[start_sel]); start_sel++; /* we don't want to edit the selected endpoint */ } else { - start_rad = nu->bezt[start_sel - 1].radius; + start_rad = BEZT_VALUE(&nu->bezt[start_sel - 1]); } if (end_sel == nu->pntsu - 1) { - end_rad = nu->bezt[end_sel].radius; + end_rad = BEZT_VALUE(&nu->bezt[end_sel]); end_sel--; /* we don't want to edit the selected endpoint */ } else { - end_rad = nu->bezt[end_sel + 1].radius; + end_rad = BEZT_VALUE(&nu->bezt[end_sel + 1]); } - + /* Now Blend between the points */ range = (float)(end_sel - start_sel) + 2.0f; for (bezt = &nu->bezt[start_sel], a = start_sel; a <= end_sel; a++, bezt++) { fac = (float)(1 + a - start_sel) / range; - bezt->radius = start_rad * (1.0f - fac) + end_rad * fac; + BEZT_VALUE(bezt) = start_rad * (1.0f - fac) + end_rad * fac; } } } } +#undef BEZT_VALUE } else if (nu->bp) { +#define BP_VALUE(bp) (*((float *)((char *)bp + bp_offset))) + /* Same as above, keep these the same! */ for (last_sel = 0; last_sel < nu->pntsu; last_sel++) { /* loop over selection segments of a curve, smooth each */ - + /* Start BezTriple code, this is duplicated below for points, make sure these functions stay in sync */ start_sel = -1; for (bp = &nu->bp[last_sel], a = last_sel; a < nu->pntsu; a++, bp++) { @@ -2366,53 +2373,90 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op)) } end_sel = a; } - + if (start_sel == -1) { last_sel = nu->pntsu; /* next... */ } else { last_sel = end_sel; /* before we modify it */ - + /* now blend between start and end sel */ - start_rad = end_rad = -1.0; - + start_rad = end_rad = FLT_MAX; + if (start_sel == end_sel) { /* simple, only 1 point selected */ - if (start_sel > 0) start_rad = nu->bp[start_sel - 1].radius; - if (end_sel != -1 && end_sel < nu->pntsu) end_rad = nu->bp[start_sel + 1].radius; - - if (start_rad >= 0.0f && end_rad >= 0.0f) nu->bp[start_sel].radius = (start_rad + end_rad) / 2; - else if (start_rad >= 0.0f) nu->bp[start_sel].radius = start_rad; - else if (end_rad >= 0.0f) nu->bp[start_sel].radius = end_rad; + if (start_sel > 0) start_rad = BP_VALUE(&nu->bp[start_sel - 1]); + if (end_sel != -1 && end_sel < nu->pntsu) end_rad = BP_VALUE(&nu->bp[start_sel + 1]); + + if (start_rad != FLT_MAX && end_rad != FLT_MAX) BP_VALUE(&nu->bp[start_sel]) = (start_rad + end_rad) / 2; + else if (start_rad != FLT_MAX) BP_VALUE(&nu->bp[start_sel]) = start_rad; + else if (end_rad != FLT_MAX) BP_VALUE(&nu->bp[start_sel]) = end_rad; } else { /* if endpoints selected, then use them */ if (start_sel == 0) { - start_rad = nu->bp[start_sel].radius; + start_rad = BP_VALUE(&nu->bp[start_sel]); start_sel++; /* we don't want to edit the selected endpoint */ } else { - start_rad = nu->bp[start_sel - 1].radius; + start_rad = BP_VALUE(&nu->bp[start_sel - 1]); } if (end_sel == nu->pntsu - 1) { - end_rad = nu->bp[end_sel].radius; + end_rad = BP_VALUE(&nu->bp[end_sel]); end_sel--; /* we don't want to edit the selected endpoint */ } else { - end_rad = nu->bp[end_sel + 1].radius; + end_rad = BP_VALUE(&nu->bp[end_sel + 1]); } - + /* Now Blend between the points */ range = (float)(end_sel - start_sel) + 2.0f; for (bp = &nu->bp[start_sel], a = start_sel; a <= end_sel; a++, bp++) { fac = (float)(1 + a - start_sel) / range; - bp->radius = start_rad * (1.0f - fac) + end_rad * fac; + BP_VALUE(bp) = start_rad * (1.0f - fac) + end_rad * fac; } } } } +#undef BP_VALUE } } +} + +static int curve_smooth_weight_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Object *obedit = CTX_data_edit_object(C); + ListBase *editnurb = object_editcurve_get(obedit); + + curve_smooth_value(editnurb, offsetof(BezTriple, weight), offsetof(BPoint, weight)); + + WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); + DAG_id_tag_update(obedit->data, 0); + + return OPERATOR_FINISHED; +} + +void CURVE_OT_smooth_weight(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Smooth Curve Weight"; + ot->description = "Interpolate weight of selected points"; + ot->idname = "CURVE_OT_smooth_weight"; + + /* api clastbacks */ + ot->exec = curve_smooth_weight_exec; + ot->poll = ED_operator_editsurfcurve; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + +static int curve_smooth_radius_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Object *obedit = CTX_data_edit_object(C); + ListBase *editnurb = object_editcurve_get(obedit); + + curve_smooth_value(editnurb, offsetof(BezTriple, radius), offsetof(BPoint, radius)); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); DAG_id_tag_update(obedit->data, 0); @@ -2424,17 +2468,45 @@ void CURVE_OT_smooth_radius(wmOperatorType *ot) { /* identifiers */ ot->name = "Smooth Curve Radius"; - ot->description = "Flatten radii of selected points"; + ot->description = "Interpolate radii of selected points"; ot->idname = "CURVE_OT_smooth_radius"; /* api clastbacks */ - ot->exec = smooth_radius_exec; + ot->exec = curve_smooth_radius_exec; ot->poll = ED_operator_editsurfcurve; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } +static int curve_smooth_tilt_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Object *obedit = CTX_data_edit_object(C); + ListBase *editnurb = object_editcurve_get(obedit); + + curve_smooth_value(editnurb, offsetof(BezTriple, alfa), offsetof(BPoint, alfa)); + + WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); + DAG_id_tag_update(obedit->data, 0); + + return OPERATOR_FINISHED; +} + +void CURVE_OT_smooth_tilt(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Smooth Curve Tilt"; + ot->description = "Interpolate tilt of selected points"; + ot->idname = "CURVE_OT_smooth_tilt"; + + /* api clastbacks */ + ot->exec = curve_smooth_tilt_exec; + ot->poll = ED_operator_editsurfcurve; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + /***************** selection utility *************************/ /* next == 1 -> select next */ @@ -2842,7 +2914,7 @@ static void subdividenurb(Object *obedit, int number_cuts) Curve *cu = obedit->data; EditNurb *editnurb = cu->editnurb; Nurb *nu; - BezTriple *prevbezt, *bezt, *beztnew, *beztn; + BezTriple *bezt, *beztnew, *beztn; BPoint *bp, *prevbp, *bpnew, *bpn; float vec[15]; int a, b, sel, amount, *usel, *vsel, i; @@ -2853,25 +2925,25 @@ static void subdividenurb(Object *obedit, int number_cuts) for (nu = editnurb->nurbs.first; nu; nu = nu->next) { amount = 0; if (nu->type == CU_BEZIER) { + BezTriple *nextbezt; + /* * Insert a point into a 2D Bezier curve. * Endpoints are preserved. Otherwise, all selected and inserted points are * newly created. Old points are discarded. */ /* count */ - if (nu->flagu & CU_NURB_CYCLIC) { - a = nu->pntsu; - bezt = nu->bezt; - prevbezt = bezt + (a - 1); - } - else { - a = nu->pntsu - 1; - prevbezt = nu->bezt; - bezt = prevbezt + 1; - } + a = nu->pntsu; + bezt = nu->bezt; while (a--) { - if (BEZSELECTED_HIDDENHANDLES(cu, prevbezt) && BEZSELECTED_HIDDENHANDLES(cu, bezt) ) amount += number_cuts; - prevbezt = bezt; + nextbezt = BKE_nurb_bezt_get_next(nu, bezt); + if (nextbezt == NULL) { + break; + } + + if (BEZSELECTED_HIDDENHANDLES(cu, bezt) && BEZSELECTED_HIDDENHANDLES(cu, nextbezt)) { + amount += number_cuts; + } bezt++; } @@ -2879,35 +2951,32 @@ static void subdividenurb(Object *obedit, int number_cuts) /* insert */ beztnew = (BezTriple *)MEM_mallocN((amount + nu->pntsu) * sizeof(BezTriple), "subdivNurb"); beztn = beztnew; - if (nu->flagu & CU_NURB_CYCLIC) { - a = nu->pntsu; - bezt = nu->bezt; - prevbezt = bezt + (a - 1); - } - else { - a = nu->pntsu - 1; - prevbezt = nu->bezt; - bezt = prevbezt + 1; - } + a = nu->pntsu; + bezt = nu->bezt; while (a--) { - memcpy(beztn, prevbezt, sizeof(BezTriple)); - keyIndex_updateBezt(editnurb, prevbezt, beztn, 1); + memcpy(beztn, bezt, sizeof(BezTriple)); + keyIndex_updateBezt(editnurb, bezt, beztn, 1); beztn++; - if (BEZSELECTED_HIDDENHANDLES(cu, prevbezt) && BEZSELECTED_HIDDENHANDLES(cu, bezt)) { + nextbezt = BKE_nurb_bezt_get_next(nu, bezt); + if (nextbezt == NULL) { + break; + } + + if (BEZSELECTED_HIDDENHANDLES(cu, bezt) && BEZSELECTED_HIDDENHANDLES(cu, nextbezt)) { float prevvec[3][3]; - memcpy(prevvec, prevbezt->vec, sizeof(float) * 9); + memcpy(prevvec, bezt->vec, sizeof(float) * 9); for (i = 0; i < number_cuts; i++) { factor = 1.0f / (number_cuts + 1 - i); - memcpy(beztn, bezt, sizeof(BezTriple)); + memcpy(beztn, nextbezt, sizeof(BezTriple)); /* midpoint subdividing */ interp_v3_v3v3(vec, prevvec[1], prevvec[2], factor); - interp_v3_v3v3(vec + 3, prevvec[2], bezt->vec[0], factor); - interp_v3_v3v3(vec + 6, bezt->vec[0], bezt->vec[1], factor); + interp_v3_v3v3(vec + 3, prevvec[2], nextbezt->vec[0], factor); + interp_v3_v3v3(vec + 6, nextbezt->vec[0], nextbezt->vec[1], factor); interp_v3_v3v3(vec + 9, vec, vec + 3, factor); interp_v3_v3v3(vec + 12, vec + 3, vec + 6, factor); @@ -2920,24 +2989,18 @@ static void subdividenurb(Object *obedit, int number_cuts) copy_v3_v3(beztn->vec[2], vec + 12); /* handle of next bezt */ if (a == 0 && i == number_cuts - 1 && (nu->flagu & CU_NURB_CYCLIC)) { copy_v3_v3(beztnew->vec[0], vec + 6); } - else { copy_v3_v3(bezt->vec[0], vec + 6); } + else { copy_v3_v3(nextbezt->vec[0], vec + 6); } - beztn->radius = (prevbezt->radius + bezt->radius) / 2; - beztn->weight = (prevbezt->weight + bezt->weight) / 2; + beztn->radius = (bezt->radius + nextbezt->radius) / 2; + beztn->weight = (bezt->weight + nextbezt->weight) / 2; memcpy(prevvec, beztn->vec, sizeof(float) * 9); beztn++; } } - prevbezt = bezt; bezt++; } - /* last point */ - if ((nu->flagu & CU_NURB_CYCLIC) == 0) { - memcpy(beztn, prevbezt, sizeof(BezTriple)); - keyIndex_updateBezt(editnurb, prevbezt, beztn, 1); - } MEM_freeN(nu->bezt); nu->bezt = beztnew; @@ -2947,6 +3010,8 @@ static void subdividenurb(Object *obedit, int number_cuts) } } /* End of 'if (nu->type == CU_BEZIER)' */ else if (nu->pntsv == 1) { + BPoint *nextbp; + /* * All flat lines (ie. co-planar), except flat Nurbs. Flat NURB curves * are handled together with the regular NURB plane division, as it @@ -2954,19 +3019,17 @@ static void subdividenurb(Object *obedit, int number_cuts) * stable... nzc 30-5-'00 */ /* count */ - if (nu->flagu & CU_NURB_CYCLIC) { - a = nu->pntsu; - bp = nu->bp; - prevbp = bp + (a - 1); - } - else { - a = nu->pntsu - 1; - prevbp = nu->bp; - bp = prevbp + 1; - } + a = nu->pntsu; + bp = nu->bp; while (a--) { - if ( (bp->f1 & SELECT) && (prevbp->f1 & SELECT) ) amount += number_cuts; - prevbp = bp; + nextbp = BKE_nurb_bpoint_get_next(nu, bp); + if (nextbp == NULL) { + break; + } + + if ((bp->f1 & SELECT) && (nextbp->f1 & SELECT)) { + amount += number_cuts; + } bp++; } @@ -2975,39 +3038,33 @@ static void subdividenurb(Object *obedit, int number_cuts) bpnew = (BPoint *)MEM_mallocN((amount + nu->pntsu) * sizeof(BPoint), "subdivNurb2"); bpn = bpnew; - if (nu->flagu & CU_NURB_CYCLIC) { - a = nu->pntsu; - bp = nu->bp; - prevbp = bp + (a - 1); - } - else { - a = nu->pntsu - 1; - prevbp = nu->bp; - bp = prevbp + 1; - } + a = nu->pntsu; + bp = nu->bp; + while (a--) { - memcpy(bpn, prevbp, sizeof(BPoint)); - keyIndex_updateBP(editnurb, prevbp, bpn, 1); + /* Copy "old" point. */ + memcpy(bpn, bp, sizeof(BPoint)); + keyIndex_updateBP(editnurb, bp, bpn, 1); bpn++; - if ((bp->f1 & SELECT) && (prevbp->f1 & SELECT)) { + nextbp = BKE_nurb_bpoint_get_next(nu, bp); + if (nextbp == NULL) { + break; + } + + if ((bp->f1 & SELECT) && (nextbp->f1 & SELECT)) { // printf("*** subdivideNurb: insert 'linear' point\n"); for (i = 0; i < number_cuts; i++) { factor = (float)(i + 1) / (number_cuts + 1); - memcpy(bpn, bp, sizeof(BPoint)); - interp_v4_v4v4(bpn->vec, prevbp->vec, bp->vec, factor); + memcpy(bpn, nextbp, sizeof(BPoint)); + interp_v4_v4v4(bpn->vec, bp->vec, nextbp->vec, factor); bpn++; } } - prevbp = bp; bp++; } - if ((nu->flagu & CU_NURB_CYCLIC) == 0) { /* last point */ - memcpy(bpn, prevbp, sizeof(BPoint)); - keyIndex_updateBP(editnurb, prevbp, bpn, 1); - } MEM_freeN(nu->bp); nu->bp = bpnew; @@ -5151,7 +5208,7 @@ static int select_more_exec(bContext *C, wmOperator *UNUSED(op)) /* may not be optimal always (example: end of NURBS sphere) */ if (obedit->type == OB_SURF) { for (nu = editnurb->first; nu; nu = nu->next) { - BLI_bitmap selbpoints; + BLI_bitmap *selbpoints; a = nu->pntsu * nu->pntsv; bp = nu->bp; selbpoints = BLI_BITMAP_NEW(a, "selectlist"); @@ -5237,7 +5294,7 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op)) if (obedit->type == OB_SURF) { for (nu = editnurb->first; nu; nu = nu->next) { - BLI_bitmap selbpoints; + BLI_bitmap *selbpoints; a = nu->pntsu * nu->pntsv; bp = nu->bp; selbpoints = BLI_BITMAP_NEW(a, "selectlist"); @@ -6077,7 +6134,7 @@ void CURVE_OT_shade_flat(wmOperatorType *ot) /************** join operator, to be used externally? ****************/ /* TODO: shape keys - as with meshes */ -int join_curve_exec(bContext *C, wmOperator *UNUSED(op)) +int join_curve_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -6089,6 +6146,22 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op)) ListBase tempbase; float imat[4][4], cmat[4][4]; int a; + bool ok = false; + + CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases) + { + if (base->object == ob) { + ok = true; + break; + } + } + CTX_DATA_END; + + /* that way the active object is always selected */ + if (ok == false) { + BKE_report(op->reports, RPT_WARNING, "Active object is not a selected curve"); + return OPERATOR_CANCELLED; + } tempbase.first = tempbase.last = NULL; diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 5b2cc49d106..b9759e16f20 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -380,7 +380,7 @@ static int paste_file(bContext *C, ReportList *reports, const char *filename) if (cu->len + filelen < MAXTEXT) { int tmplen; - wchar_t *mem = MEM_callocN((sizeof(wchar_t) * filelen) + (4 * sizeof(wchar_t)), "temporary"); + wchar_t *mem = MEM_mallocN((sizeof(wchar_t) * filelen) + (4 * sizeof(wchar_t)), "temporary"); tmplen = BLI_strncpy_wchar_from_utf8(mem, strp, filelen + 1); wcscat(ef->textbuf, mem); MEM_freeN(mem); @@ -446,7 +446,9 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, float Object *obedit; Base *base; struct TextLine *tmp; - int nchars = 0, a; + int nchars = 0, nbytes = 0; + char *s; + int a; float rot[3] = {0.f, 0.f, 0.f}; obedit = BKE_object_add(bmain, scene, OB_FONT); @@ -463,26 +465,38 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, float cu->vfont = BKE_vfont_builtin_get(); cu->vfont->id.us++; - for (tmp = firstline, a = 0; cu->len < MAXTEXT && a < totline; tmp = tmp->next, a++) - nchars += strlen(tmp->line) + 1; + for (tmp = firstline, a = 0; nbytes < MAXTEXT && a < totline; tmp = tmp->next, a++) { + size_t nchars_line, nbytes_line; + nchars_line = BLI_strlen_utf8_ex(tmp->line, &nbytes_line); + nchars += nchars_line + 1; + nbytes += nbytes_line + 1; + } if (cu->str) MEM_freeN(cu->str); if (cu->strinfo) MEM_freeN(cu->strinfo); - cu->str = MEM_callocN(nchars + 4, "str"); + cu->str = MEM_mallocN(nbytes + 4, "str"); cu->strinfo = MEM_callocN((nchars + 4) * sizeof(CharInfo), "strinfo"); - cu->str[0] = '\0'; cu->len = 0; cu->pos = 0; - + + s = cu->str; + *s = '\0'; + for (tmp = firstline, a = 0; cu->len < MAXTEXT && a < totline; tmp = tmp->next, a++) { - strcat(cu->str, tmp->line); - cu->len += strlen(tmp->line); + size_t nbytes_line; + + nbytes_line = BLI_strcpy_rlen(s, tmp->line); + + s += nbytes_line; + cu->len += nbytes_line; if (tmp->next) { - strcat(cu->str, "\n"); - cu->len++; + nbytes_line = BLI_strcpy_rlen(s, "\n"); + + s += nbytes_line; + cu->len += nbytes_line; } cu->pos = cu->len; @@ -1273,7 +1287,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, const wmEvent *event) accentcode = 0; } else if (event->utf8_buf[0]) { - BLI_strncpy_wchar_from_utf8(inserted_text, event->utf8_buf, 1); + BLI_strncpy_wchar_from_utf8(inserted_text, event->utf8_buf, 2); ascii = inserted_text[0]; insert_into_textbuf(obedit, ascii); accentcode = 0; diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 50c348a015f..bb0a753d9c6 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -706,8 +706,8 @@ void draw_gpencil_2dimage(const bContext *C) wmOrtho2(ar->v2d.cur.xmin, ar->v2d.cur.xmax, ar->v2d.cur.ymin, ar->v2d.cur.ymax); dflag |= GP_DRAWDATA_ONLYV2D | GP_DRAWDATA_IEDITHACK; + break; } - break; case SPACE_SEQ: /* sequence */ { /* just draw using standard scaling (settings here are currently ignored anyways) */ @@ -720,8 +720,8 @@ void draw_gpencil_2dimage(const bContext *C) * and everything moved to standard View2d */ dflag |= GP_DRAWDATA_ONLYV2D; + break; } - break; default: /* for spacetype not yet handled */ offsx = 0; offsy = 0; diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 2d24b34e60b..99157b074fd 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -112,9 +112,8 @@ bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr) if (ptr) RNA_id_pointer_create(&ob->id, ptr); return &ob->gpd; } + break; } - break; - case SPACE_NODE: /* Nodes Editor */ { SpaceNode *snode = (SpaceNode *)CTX_wm_space_data(C); @@ -125,13 +124,10 @@ bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr) if (ptr) RNA_id_pointer_create(&snode->nodetree->id, ptr); return &snode->nodetree->gpd; } - else { - /* even when there is no node-tree, don't allow this to flow to scene */ - return NULL; - } + + /* even when there is no node-tree, don't allow this to flow to scene */ + return NULL; } - break; - case SPACE_SEQ: /* Sequencer */ { SpaceSeq *sseq = (SpaceSeq *)CTX_wm_space_data(C); @@ -141,8 +137,6 @@ bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr) if (ptr) RNA_pointer_create(screen_id, &RNA_SpaceSequenceEditor, sseq, ptr); return &sseq->gpd; } - break; - case SPACE_IMAGE: /* Image/UV Editor */ { SpaceImage *sima = (SpaceImage *)CTX_wm_space_data(C); @@ -152,8 +146,6 @@ bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr) if (ptr) RNA_pointer_create(screen_id, &RNA_SpaceImageEditor, sima, ptr); return &sima->gpd; } - break; - case SPACE_CLIP: /* Nodes Editor */ { SpaceClip *sc = (SpaceClip *)CTX_wm_space_data(C); @@ -178,9 +170,8 @@ bGPdata **gpencil_data_get_pointers(const bContext *C, PointerRNA *ptr) return &clip->gpd; } } + break; } - break; - default: /* unsupported space */ return NULL; } diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index dc5e12df766..4c5727f16ed 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1084,9 +1084,8 @@ static int gp_session_initdata(bContext *C, tGPsdata *p) printf("Error: 3D-View active region doesn't have any region data, so cannot be drawable\n"); return 0; } + break; } - break; - case SPACE_NODE: { /* SpaceNode *snode = curarea->spacedata.first; */ @@ -1095,8 +1094,8 @@ static int gp_session_initdata(bContext *C, tGPsdata *p) p->sa = curarea; p->ar = ar; p->v2d = &ar->v2d; + break; } - break; case SPACE_SEQ: { SpaceSeq *sseq = curarea->spacedata.first; @@ -1113,8 +1112,8 @@ static int gp_session_initdata(bContext *C, tGPsdata *p) printf("Error: In active view (sequencer), active mode doesn't support Grease Pencil\n"); return 0; } + break; } - break; case SPACE_IMAGE: { /* SpaceImage *sima = curarea->spacedata.first; */ @@ -1123,8 +1122,8 @@ static int gp_session_initdata(bContext *C, tGPsdata *p) p->sa = curarea; p->ar = ar; p->v2d = &ar->v2d; + break; } - break; case SPACE_CLIP: { SpaceClip *sc = curarea->spacedata.first; @@ -1151,9 +1150,8 @@ static int gp_session_initdata(bContext *C, tGPsdata *p) p->imat[3][0] -= marker->pos[0]; p->imat[3][1] -= marker->pos[1]; } + break; } - break; - /* unsupported views */ default: { @@ -1162,7 +1160,6 @@ static int gp_session_initdata(bContext *C, tGPsdata *p) printf("Error: Active view not appropriate for Grease Pencil drawing\n"); return 0; } - break; } /* get gp-data */ @@ -1295,21 +1292,18 @@ static void gp_paint_initstroke(tGPsdata *p, short paintmode) case SPACE_VIEW3D: { p->gpd->sbuffer_sflag |= GP_STROKE_3DSPACE; + break; } - break; - case SPACE_NODE: { p->gpd->sbuffer_sflag |= GP_STROKE_2DSPACE; + break; } - break; - case SPACE_SEQ: { p->gpd->sbuffer_sflag |= GP_STROKE_2DSPACE; + break; } - break; - case SPACE_IMAGE: { SpaceImage *sima = (SpaceImage *)p->sa->spacedata.first; @@ -1324,16 +1318,16 @@ static void gp_paint_initstroke(tGPsdata *p, short paintmode) p->gpd->sbuffer_sflag &= ~GP_STROKE_2DSPACE; p->gpd->flag &= ~GP_DATA_VIEWALIGN; } - else + else { p->gpd->sbuffer_sflag |= GP_STROKE_2DSPACE; + } + break; } - break; - case SPACE_CLIP: { p->gpd->sbuffer_sflag |= GP_STROKE_2DSPACE; + break; } - break; } } } diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h index dfb02fa9c1b..352a74cf172 100644 --- a/source/blender/editors/include/BIF_glutil.h +++ b/source/blender/editors/include/BIF_glutil.h @@ -55,7 +55,6 @@ void fdrawXORcirc(float xofs, float yofs, float rad); void fdrawcheckerboard(float x1, float y1, float x2, float y2); /* OpenGL stipple defines */ -/* OpenGL stipple defines */ extern const unsigned char stipple_halftone[128]; extern const unsigned char stipple_quarttone[128]; extern const unsigned char stipple_diag_stripes_pos[128]; diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index 3367dcb9c4c..fab179da7bc 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -132,11 +132,15 @@ EditBone *ED_armature_bone_get_mirrored(struct ListBase *edbo, EditBone *ebo); / void ED_armature_sync_selection(struct ListBase *edbo); void ED_armature_validate_active(struct bArmature *arm); -void add_primitive_bone(struct Scene *scene, struct View3D *v3d, struct RegionView3D *rv3d); +void add_primitive_bone(struct Object *obedit_arm, bool view_aligned); struct EditBone *ED_armature_edit_bone_add(struct bArmature *arm, const char *name); void ED_armature_edit_bone_remove(struct bArmature *arm, EditBone *exBone); + bool ED_armature_ebone_is_child_recursive(EditBone *ebone_parent, EditBone *ebone_child); +void ED_armature_ebone_to_mat3(EditBone *ebone, float mat[3][3]); +void ED_armature_ebone_to_mat4(EditBone *ebone, float mat[4][4]); + void transform_armature_mirror_update(struct Object *obedit); void ED_armature_origin_set(struct Scene *scene, struct Object *ob, float cursor[3], int centermode, int around); @@ -153,6 +157,13 @@ void ED_armature_bone_rename(struct bArmature *arm, const char *oldnamep, const void undo_push_armature(struct bContext *C, const char *name); +/* low level selection functions which handle */ +int ED_armature_ebone_selectflag_get(const EditBone *ebone); +void ED_armature_ebone_selectflag_set(EditBone *ebone, int flag); +void ED_armature_ebone_select_set(EditBone *ebone, bool select); +void ED_armature_ebone_selectflag_enable(EditBone *ebone, int flag); +void ED_armature_ebone_selectflag_disable(EditBone *ebone, int flag); + /* poseobject.c */ void ED_armature_exit_posemode(struct bContext *C, struct Base *base); void ED_armature_enter_posemode(struct bContext *C, struct Base *base); diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 807d94b56b0..f24f9098fcd 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -92,9 +92,10 @@ void EDBM_mesh_normals_update(struct BMEditMesh *em); void EDBM_mesh_clear(struct BMEditMesh *em); void EDBM_selectmode_to_scene(struct bContext *C); -void EDBM_mesh_make(struct ToolSettings *ts, struct Scene *scene, struct Object *ob); +void EDBM_mesh_make(struct ToolSettings *ts, struct Object *ob); void EDBM_mesh_free(struct BMEditMesh *em); void EDBM_mesh_load(struct Object *ob); +struct DerivedMesh *EDBM_mesh_deform_dm_get(struct BMEditMesh *em); void EDBM_index_arrays_ensure(struct BMEditMesh *em, const char htype); void EDBM_index_arrays_init(struct BMEditMesh *em, const char htype); @@ -233,6 +234,7 @@ void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store); #define WEIGHT_ADD 2 #define WEIGHT_SUBTRACT 3 +bool ED_vgroup_sync_from_pose(struct Object *ob); struct bDeformGroup *ED_vgroup_add(struct Object *ob); struct bDeformGroup *ED_vgroup_add_name(struct Object *ob, const char *name); void ED_vgroup_delete(struct Object *ob, struct bDeformGroup *defgroup); diff --git a/source/blender/editors/include/ED_render.h b/source/blender/editors/include/ED_render.h index c1ddd9a6294..bdfbbbb9c74 100644 --- a/source/blender/editors/include/ED_render.h +++ b/source/blender/editors/include/ED_render.h @@ -52,6 +52,8 @@ void ED_render_engine_changed(struct Main *bmain); void ED_render_engine_area_exit(struct ScrArea *sa); void ED_render_scene_update(struct Main *bmain, struct Scene *scene, int updated); +void ED_viewport_render_kill_jobs(const struct bContext *C, bool free_database); + /* render_preview.c */ /* stores rendered preview - is also used for icons */ diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index b997d0ef6a0..2daab072435 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -236,6 +236,8 @@ typedef enum { BUT_NORMAL = (31 << 9), BUT_CURVE = (32 << 9), ICONTOGN = (34 << 9), + LISTBOX = (35 << 9), + LISTROW = (36 << 9), TOGBUT = (37 << 9), OPTION = (38 << 9), OPTIONN = (39 << 9), @@ -244,8 +246,6 @@ typedef enum { SEARCH_MENU = (41 << 9), BUT_EXTRA = (42 << 9), HSVCIRCLE = (43 << 9), - LISTBOX = (44 << 9), - LISTROW = (45 << 9), HOTKEYEVT = (46 << 9), BUT_IMAGE = (47 << 9), HISTOGRAM = (48 << 9), @@ -327,7 +327,11 @@ typedef void (*uiMenuHandleFunc)(struct bContext *C, void *arg, int event); typedef struct uiPopupMenu uiPopupMenu; -struct uiPopupMenu *uiPupMenuBegin(struct bContext *C, const char *title, int icon); +struct uiPopupMenu *uiPupMenuBegin(struct bContext *C, const char *title, int icon) +#ifdef __GNUC__ +__attribute__((nonnull)) +#endif +; void uiPupMenuEnd(struct bContext *C, struct uiPopupMenu *head); struct uiLayout *uiPupMenuLayout(uiPopupMenu *head); @@ -534,7 +538,8 @@ enum { BUT_GET_TIP, BUT_GET_RNA_TIP, BUT_GET_RNAENUM_TIP, - BUT_GET_OP_KEYMAP + BUT_GET_OP_KEYMAP, + BUT_GET_PROP_KEYMAP }; typedef struct uiStringInfo { diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 19eb978a01e..21a63183c1a 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -559,19 +559,19 @@ static void ui_draw_links(uiBlock *block) /* ************** BLOCK ENDING FUNCTION ************* */ /* NOTE: if but->poin is allocated memory for every defbut, things fail... */ -static bool ui_but_equals_old(uiBut *but, uiBut *oldbut) +static bool ui_but_equals_old(const uiBut *but, const uiBut *oldbut) { /* various properties are being compared here, hopefully sufficient * to catch all cases, but it is simple to add more checks later */ if (but->retval != oldbut->retval) return false; if (but->rnapoin.data != oldbut->rnapoin.data) return false; - if (but->rnaprop != oldbut->rnaprop) - if (but->rnaindex != oldbut->rnaindex) return false; + if (but->rnaprop != oldbut->rnaprop && but->rnaindex != oldbut->rnaindex) return false; if (but->func != oldbut->func) return false; if (but->funcN != oldbut->funcN) return false; if (oldbut->func_arg1 != oldbut && but->func_arg1 != oldbut->func_arg1) return false; if (oldbut->func_arg2 != oldbut && but->func_arg2 != oldbut->func_arg2) return false; - if (!but->funcN && ((but->poin != oldbut->poin && (uiBut *)oldbut->poin != oldbut) || but->pointype != oldbut->pointype)) return false; + if (!but->funcN && ((but->poin != oldbut->poin && (uiBut *)oldbut->poin != oldbut) || + (but->pointype != oldbut->pointype))) return false; if (but->optype != oldbut->optype) return false; return true; @@ -620,7 +620,7 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut return found; for (oldbut = oldblock->buttons.first; oldbut; oldbut = oldbut->next) { - if (ui_but_equals_old(oldbut, but)) { + if (ui_but_equals_old(but, oldbut)) { if (oldbut->active) { #if 0 // but->flag = oldbut->flag; @@ -901,6 +901,114 @@ static bool ui_but_event_operator_string(const bContext *C, uiBut *but, char *bu return found; } +static bool ui_but_event_property_operator_string(const bContext *C, uiBut *but, char *buf, const size_t buf_len) +{ + /* context toggle operator names to check... */ + const char *ctx_toggle_opnames[] = { + "WM_OT_context_toggle", + "WM_OT_context_toggle_enum", + "WM_OT_context_cycle_int", + "WM_OT_context_cycle_enum", + "WM_OT_context_cycle_array", + "WM_OT_context_menu_enum", + NULL + }; + const size_t num_ops = sizeof(ctx_toggle_opnames) / sizeof(const char *); + + bool found = false; + + /* this version is only for finding hotkeys for properties (which get set via context using operators) */ + if (but->rnaprop) { + /* to avoid massive slowdowns on property panels, for now, we only check the + * hotkeys for Editor / Scene settings... + * + * TODO: userpref settings? + */ + // TODO: value (for enum stuff)? + char *data_path = NULL; + + if (but->rnapoin.id.data) { + ID *id = but->rnapoin.id.data; + + if (GS(id->name) == ID_SCR) { + /* screen/editor property + * NOTE: in most cases, there is actually no info for backwards tracing + * how to get back to ID from the editor data we may be dealing with + */ + if (RNA_struct_is_a(but->rnapoin.type, &RNA_Space)) { + /* data should be directly on here... */ + data_path = BLI_sprintfN("space_data.%s", RNA_property_identifier(but->rnaprop)); + } + else { + /* special exceptions for common nested data in editors... */ + if (RNA_struct_is_a(but->rnapoin.type, &RNA_DopeSheet)) { + /* dopesheet filtering options... */ + data_path = BLI_sprintfN("space_data.dopesheet.%s", RNA_property_identifier(but->rnaprop)); + } + } + } + else if (GS(id->name) == ID_SCE) { + if (RNA_struct_is_a(but->rnapoin.type, &RNA_ToolSettings)) { + /* toolsettings property + * NOTE: toolsettings is usually accessed directly (i.e. not through scene) + */ + data_path = RNA_path_from_ID_to_property(&but->rnapoin, but->rnaprop); + } + else { + /* scene property */ + char *path = RNA_path_from_ID_to_property(&but->rnapoin, but->rnaprop); + + if (path) { + data_path = BLI_sprintfN("scene.%s", path); + MEM_freeN(path); + } + /*else { + printf("ERROR in %s(): Couldn't get path for scene property - %s\n", + __func__, RNA_property_identifier(but->rnaprop)); + }*/ + } + } + else { + //puts("other id"); + } + + //printf("prop shortcut: '%s' (%s)\n", RNA_property_identifier(but->rnaprop), data_path); + } + + /* we have a datapath! */ + if (data_path) { + size_t i; + + /* create a property to host the "datapath" property we're sending to the operators */ + IDProperty *prop_path; + IDProperty *prop_path_value; + + IDPropertyTemplate val = {0}; + prop_path = IDP_New(IDP_GROUP, &val, __func__); + prop_path_value = IDP_NewString(data_path, "data_path", strlen(data_path) + 1); /* len + 1, or else will be truncated */ + IDP_AddToGroup(prop_path, prop_path_value); + + /* check each until one works... */ + for (i = 0; (i < num_ops) && (ctx_toggle_opnames[i]); i++) { + //printf("\t%s\n", ctx_toggle_opnames[i]); + if (WM_key_event_operator_string(C, ctx_toggle_opnames[i], WM_OP_INVOKE_REGION_WIN, prop_path, false, + buf, buf_len)) + { + found = true; + break; + } + } + + /* cleanup */ + IDP_FreeProperty(prop_path); + MEM_freeN(prop_path); + MEM_freeN(data_path); + } + } + + return found; +} + static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block) { uiBut *but; @@ -915,6 +1023,9 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block) if (ui_but_event_operator_string(C, but, buf, sizeof(buf))) { ui_but_add_shortcut(but, buf, FALSE); } + else if (ui_but_event_property_operator_string(C, but, buf, sizeof(buf))) { + ui_but_add_shortcut(but, buf, FALSE); + } } } @@ -2056,6 +2167,15 @@ static void ui_set_but_soft_range(uiBut *but) but->softmin = softmin; but->softmax = softmax; } + else if (but->poin && (but->pointype & UI_BUT_POIN_TYPES)) { + float value = ui_get_but_val(but); + CLAMP(value, but->hardmin, but->hardmax); + but->softmin = min_ff(but->softmin, value); + but->softmax = max_ff(but->softmax, value); + } + else { + BLI_assert(0); + } } /* ******************* Free ********************/ @@ -2257,8 +2377,12 @@ void ui_check_but(uiBut *but) ui_check_but_select(but, &value); /* only update soft range while not editing */ - if (but->rnaprop && !(but->editval || but->editstr || but->editvec)) { - ui_set_but_soft_range(but); + if (!(but->editval || but->editstr || but->editvec)) { + if ((but->rnaprop != NULL) || + (but->poin && (but->pointype & UI_BUT_POIN_TYPES))) + { + ui_set_but_soft_range(but); + } } /* test for min and max, icon sliders, etc */ @@ -2302,35 +2426,37 @@ void ui_check_but(uiBut *but) case NUM: case NUMSLI: - UI_GET_BUT_VALUE_INIT(but, value); + if (!but->editstr) { + UI_GET_BUT_VALUE_INIT(but, value); - if (ui_is_but_float(but)) { - if (value == (double) FLT_MAX) { - BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str); - } - else if (value == (double) -FLT_MAX) { - BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s-inf", but->str); - } - /* support length type buttons */ - else if (ui_is_but_unit(but)) { - char new_str[sizeof(but->drawstr)]; - ui_get_but_string_unit(but, new_str, sizeof(new_str), value, TRUE, -1); - BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%s", but->str, new_str); + if (ui_is_but_float(but)) { + if (value == (double) FLT_MAX) { + BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str); + } + else if (value == (double) -FLT_MAX) { + BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s-inf", but->str); + } + /* support length type buttons */ + else if (ui_is_but_unit(but)) { + char new_str[sizeof(but->drawstr)]; + ui_get_but_string_unit(but, new_str, sizeof(new_str), value, TRUE, -1); + BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%s", but->str, new_str); + } + else { + const int prec = ui_but_float_precision(but, value); + BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%.*f", but->str, prec, value); + } } else { - const int prec = ui_but_float_precision(but, value); - BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%.*f", but->str, prec, value); + BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%d", but->str, (int)value); + } + + if (but->rnaprop) { + PropertySubType pstype = RNA_property_subtype(but->rnaprop); + + if (pstype == PROP_PERCENTAGE) + strcat(but->drawstr, "%"); } - } - else { - BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%d", but->str, (int)value); - } - - if (but->rnaprop) { - PropertySubType pstype = RNA_property_subtype(but->rnaprop); - - if (pstype == PROP_PERCENTAGE) - strcat(but->drawstr, "%"); } break; @@ -2353,29 +2479,30 @@ void ui_check_but(uiBut *but) if (!but->editstr) { char str[UI_MAX_DRAW_STR]; - ui_get_but_string(but, str, UI_MAX_DRAW_STR - strlen(but->str)); - + ui_get_but_string(but, str, UI_MAX_DRAW_STR); BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%s", but->str, str); } break; case KEYEVT: - BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); + { + const char *str; if (but->flag & UI_SELECT) { - strcat(but->drawstr, "Press a key"); + str = "Press a key"; } else { UI_GET_BUT_VALUE_INIT(but, value); - strcat(but->drawstr, WM_key_event_string((short)value)); + str = WM_key_event_string((short)value); } + BLI_snprintf(but->drawstr, UI_MAX_DRAW_STR, "%s%s", but->str, str); break; - + } case HOTKEYEVT: if (but->flag & UI_SELECT) { - but->drawstr[0] = '\0'; if (but->modifier_key) { char *str = but->drawstr; + but->drawstr[0] = '\0'; if (but->modifier_key & KM_SHIFT) str += BLI_strcpy_rlen(str, "Shift "); @@ -2388,8 +2515,9 @@ void ui_check_but(uiBut *but) (void)str; /* UNUSED */ } - else - strcat(but->drawstr, "Press a key "); + else { + BLI_strncpy(but->drawstr, "Press a key", UI_MAX_DRAW_STR); + } } else BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); @@ -2401,6 +2529,7 @@ void ui_check_but(uiBut *but) break; default: BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR); + break; } @@ -2646,13 +2775,10 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, uiBut *but; int slen; - BLI_assert(width >= 0); - BLI_assert(height >= 0); + BLI_assert(width >= 0 && height >= 0); /* we could do some more error checks here */ if ((type & BUTTYPE) == LABEL) { - if ((poin != NULL || min != 0.0f || max != 0.0f || (a1 == 0.0f && a2 != 0.0f) || (a1 != 0.0f && a1 != 1.0f))) - printf("blah\n"); BLI_assert((poin != NULL || min != 0.0f || max != 0.0f || (a1 == 0.0f && a2 != 0.0f) || (a1 != 0.0f && a1 != 1.0f)) == FALSE); } @@ -2740,7 +2866,7 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, } /* keep track of UI_interface.h */ - if (ELEM9(but->type, BLOCK, BUT, LABEL, PULLDOWN, ROUNDBOX, LISTBOX, BUTM, SCROLL, SEPR /* , FTPREVIEW */)) {} + if (ELEM8(but->type, BLOCK, BUT, LABEL, PULLDOWN, ROUNDBOX, BUTM, SCROLL, SEPR)) {} else if (but->type >= SEARCH_MENU) {} else but->flag |= UI_BUT_UNDO; @@ -3838,7 +3964,8 @@ void uiButSetFocusOnEnter(wmWindow *win, uiBut *but) { wmEvent event; - event = *(win->eventstate); + wm_event_init_from_window(win, &event); + event.type = EVT_BUT_OPEN; event.val = KM_PRESS; event.customdata = but; @@ -4011,9 +4138,17 @@ void uiButGetStrInfo(bContext *C, uiBut *but, ...) } } } + else if (type == BUT_GET_PROP_KEYMAP) { + /* for properties that are bound to one of the context cycle, etc. keys... */ + char buf[128]; + if (ui_but_event_property_operator_string(C, but, buf, sizeof(buf))) { + tmp = BLI_strdup(buf); + } + } si->strinfo = tmp; } + va_end(args); if (free_items && items) MEM_freeN(items); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 4c1ad2e41c4..b3df719d95a 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -875,6 +875,10 @@ static bool ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data, uiDragToggleHandle *drag_info = MEM_callocN(sizeof(*drag_info), __func__); ARegion *ar_prev; + /* call here because regular mouse-up event wont run, + * typically 'button_activate_exit()' handles this */ + ui_apply_autokey(C, but); + drag_info->is_set = ui_is_but_push(but); drag_info->but_cent_start[0] = BLI_rctf_cent_x(&but->rect); drag_info->but_cent_start[1] = BLI_rctf_cent_y(&but->rect); @@ -1297,9 +1301,14 @@ static void ui_but_drop(bContext *C, const wmEvent *event, uiBut *but, uiHandleB if (ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) { ID *id = (ID *)wmd->poin; - if (but->poin == NULL && but->rnapoin.data == NULL) {} button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); BLI_strncpy(data->str, id->name + 2, data->maxlen); + + if (ELEM(but->type, SEARCH_MENU, SEARCH_MENU_UNLINK)) { + but->changed = true; + ui_searchbox_update(C, data->searchbox, but, true); + } + button_activate_state(C, but, BUTTON_STATE_EXIT); } } @@ -1420,6 +1429,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, if (ELEM(but->type, SEARCH_MENU, SEARCH_MENU_UNLINK)) { /* else uiSearchboxData.active member is not updated [#26856] */ + but->changed = true; ui_searchbox_update(C, data->searchbox, but, true); } button_activate_state(C, but, BUTTON_STATE_EXIT); @@ -1852,7 +1862,6 @@ enum { static bool ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, const int mode) { - char buf[UI_MAX_DRAW_STR] = {0}; char *str, *p, *pbuf; int x; bool changed = false; @@ -1868,6 +1877,7 @@ static bool ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, const in p = pbuf = WM_clipboard_text_get(0); if (p && p[0]) { + char buf[UI_MAX_DRAW_STR] = {0}; unsigned int y; buf_len = 0; while (*p && *p != '\r' && *p != '\n' && buf_len < UI_MAX_DRAW_STR - 1) { @@ -1904,14 +1914,12 @@ static bool ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, const in /* cut & copy */ else if (ELEM(mode, UI_TEXTEDIT_COPY, UI_TEXTEDIT_CUT)) { /* copy the contents to the copypaste buffer */ - for (x = but->selsta; x <= but->selend; x++) { - if (x == but->selend) - buf[x] = '\0'; - else - buf[(x - but->selsta)] = str[x]; - } + int sellen = but->selend - but->selsta; + char *buf = MEM_mallocN(sizeof(char) * (sellen + 1), "ui_textedit_copypaste"); + BLI_strncpy(buf, str + but->selsta, sellen + 1); WM_clipboard_text_set(buf, 0); + MEM_freeN(buf); /* for cut only, delete the selection afterwards */ if (mode == UI_TEXTEDIT_CUT) { @@ -2175,7 +2183,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle ui_searchbox_event(C, data->searchbox, but, event); break; } - /* pass on purposedly */ + /* fall-through */ case ENDKEY: ui_textedit_move(but, data, STRCUR_DIR_NEXT, event->shift, STRCUR_JUMP_ALL); @@ -2190,7 +2198,7 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle ui_searchbox_event(C, data->searchbox, but, event); break; } - /* pass on purposedly */ + /* fall-through */ case HOMEKEY: ui_textedit_move(but, data, STRCUR_DIR_PREV, event->shift, STRCUR_JUMP_ALL); @@ -2597,7 +2605,7 @@ static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, c static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event) { if (data->state == BUTTON_STATE_HIGHLIGHT) { - if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN) && event->val == KM_PRESS) { + if (ELEM4(event->type, LEFTMOUSE, EVT_BUT_OPEN, PADENTER, RETKEY) && event->val == KM_PRESS) { if (but->dt == UI_EMBOSSN && !event->ctrl) { /* pass */ } @@ -2622,7 +2630,7 @@ static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButton static int ui_do_but_SEARCH_UNLINK(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, const wmEvent *event) { /* unlink icon is on right */ - if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN) && event->val == KM_PRESS) { + if (ELEM4(event->type, LEFTMOUSE, EVT_BUT_OPEN, PADENTER, RETKEY) && event->val == KM_PRESS) { ARegion *ar = data->region; rcti rect; int x = event->x, y = event->y; @@ -3713,7 +3721,8 @@ static bool ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, break; default: - assert(!"invalid hsv type"); + BLI_assert(0); + break; } hsv_to_rgb_v(hsv, rgb); @@ -3783,8 +3792,10 @@ static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOF hsv[2] += ndof->rx * sensitivity; CLAMP(hsv[2], but->softmin, but->softmax); + break; default: assert(!"invalid hsv type"); + break; } hsv_to_rgb_v(hsv, rgb); @@ -4933,7 +4944,6 @@ static bool ui_but_menu(bContext *C, uiBut *but) uiPopupMenu *pup; uiLayout *layout; bool is_array, is_array_component; - const char *name; uiStringInfo label = {BUT_GET_LABEL, NULL}; /* if ((but->rnapoin.data && but->rnaprop) == 0 && but->optype == NULL)*/ @@ -4946,12 +4956,11 @@ static bool ui_but_menu(bContext *C, uiBut *but) button_timers_tooltip_remove(C, but); + /* highly unlikely getting the label ever fails */ uiButGetStrInfo(C, but, &label, NULL); - name = label.strinfo; - pup = uiPupMenuBegin(C, name, ICON_NONE); + pup = uiPupMenuBegin(C, label.strinfo ? label.strinfo : "", ICON_NONE); layout = uiPupMenuLayout(pup); - if (label.strinfo) MEM_freeN(label.strinfo); @@ -6184,7 +6193,7 @@ void ui_button_activate_do(bContext *C, ARegion *ar, uiBut *but) button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER); - event = *(win->eventstate); /* XXX huh huh? make api call */ + wm_event_init_from_window(win, &event); event.type = EVT_BUT_OPEN; event.val = KM_PRESS; event.customdata = but; @@ -6291,11 +6300,11 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) case MIDDLEMOUSE: case MOUSEPAN: button_timers_tooltip_remove(C, but); - - /* pass on purposedly */ + /* fall-through */ default: /* handle button type specific events */ retval = ui_do_button(C, block, but, event); + break; } } else if (data->state == BUTTON_STATE_WAIT_RELEASE) { @@ -6345,6 +6354,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but) if (event->customdata == data->flashtimer) { button_activate_state(C, but, BUTTON_STATE_EXIT); } + break; } } @@ -6415,7 +6425,6 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar) { uiBut *but = ui_list_find_mouse_over(ar, event->x, event->y); int retval = WM_UI_HANDLER_CONTINUE; - int value, min, max; int type = event->type, val = event->val; if (but) { @@ -6438,8 +6447,11 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar) if (ELEM(type, UPARROWKEY, DOWNARROWKEY) || ((ELEM(type, WHEELUPMOUSE, WHEELDOWNMOUSE) && event->alt))) { + const int value_orig = RNA_property_int_get(&but->rnapoin, but->rnaprop); + int value, min, max; + /* activate up/down the list */ - value = RNA_property_int_get(&but->rnapoin, but->rnaprop); + value = value_orig; if (ELEM(type, UPARROWKEY, WHEELUPMOUSE)) value--; @@ -6456,9 +6468,13 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar) RNA_property_int_range(&but->rnapoin, but->rnaprop, &min, &max); value = CLAMPIS(value, min, max); - RNA_property_int_set(&but->rnapoin, but->rnaprop, value); - RNA_property_update(C, &but->rnapoin, but->rnaprop); - ED_region_tag_redraw(ar); + if (value != value_orig) { + RNA_property_int_set(&but->rnapoin, but->rnaprop, value); + RNA_property_update(C, &but->rnapoin, but->rnaprop); + + ui_apply_undo(but); + ED_region_tag_redraw(ar); + } retval = WM_UI_HANDLER_BREAK; } @@ -6563,6 +6579,8 @@ static void ui_handle_button_return_submenu(bContext *C, const wmEvent *event, u static void ui_mouse_motion_towards_init_ex(uiPopupBlockHandle *menu, const int xy[2], const bool force) { + BLI_assert(((uiBlock *)menu->region->uiblocks.first)->flag & UI_BLOCK_MOVEMOUSE_QUIT); + if (!menu->dotowards || force) { menu->dotowards = true; menu->towards_xy[0] = xy[0]; @@ -6595,6 +6613,25 @@ static bool ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *me const float margin = MENU_TOWARDS_MARGIN; rctf rect_px; + BLI_assert(block->flag & UI_BLOCK_MOVEMOUSE_QUIT); + + + /* annoying fix for [#36269], this is a bit odd but in fact works quite well + * don't mouse-out of a menu if another menu has been created after it. + * if this causes problems we could remove it and check on a different fix - campbell */ + if (menu->region->next) { + /* am I the last menu (test) */ + ARegion *ar = menu->region->next; + do { + uiBlock *block = ar->uiblocks.first; + if (block && ui_block_is_menu(block)) { + return true; + } + } while ((ar = ar->next)); + } + /* annoying fix end! */ + + if (!menu->dotowards) { return false; } @@ -6819,10 +6856,12 @@ static int ui_handle_menu_event(bContext *C, const wmEvent *event, uiPopupBlockH but = ui_but_find_activated(ar); if (but && button_modal_state(but->active->state)) { - /* if a button is activated modal, always reset the start mouse - * position of the towards mechanism to avoid loosing focus, - * and don't handle events */ - ui_mouse_motion_towards_reinit(menu, &event->x); + if (block->flag & UI_BLOCK_MOVEMOUSE_QUIT) { + /* if a button is activated modal, always reset the start mouse + * position of the towards mechanism to avoid loosing focus, + * and don't handle events */ + ui_mouse_motion_towards_reinit(menu, &event->x); + } } else if (event->type == TIMER) { if (event->customdata == menu->scrolltimer) @@ -6831,7 +6870,9 @@ static int ui_handle_menu_event(bContext *C, const wmEvent *event, uiPopupBlockH else { /* for ui_mouse_motion_towards_block */ if (event->type == MOUSEMOVE) { - ui_mouse_motion_towards_init(menu, &event->x); + if (block->flag & UI_BLOCK_MOVEMOUSE_QUIT) { + ui_mouse_motion_towards_init(menu, &event->x); + } /* add menu scroll timer, if needed */ if (ui_menu_scroll_test(block, my)) @@ -7136,11 +7177,12 @@ static int ui_handle_menu_event(bContext *C, const wmEvent *event, uiPopupBlockH menu->menuretval = UI_RETURN_CANCEL | UI_RETURN_POPUP_OK; } else { - ui_mouse_motion_towards_check(block, menu, &event->x, is_parent_inside == false); /* check mouse moving outside of the menu */ if (inside == 0 && (block->flag & UI_BLOCK_MOVEMOUSE_QUIT)) { uiSafetyRct *saferct; + + ui_mouse_motion_towards_check(block, menu, &event->x, is_parent_inside == false); /* check for all parent rects, enables arrowkeys to be used */ for (saferct = block->saferct.first; saferct; saferct = saferct->next) { @@ -7229,9 +7271,11 @@ static int ui_handle_menu_return_submenu(bContext *C, const wmEvent *event, uiPo submenu->menuretval = 0; } - /* for cases where close does not cascade, allow the user to - * move the mouse back towards the menu without closing */ - ui_mouse_motion_towards_reinit(menu, &event->x); + if (block->flag & UI_BLOCK_MOVEMOUSE_QUIT) { + /* for cases where close does not cascade, allow the user to + * move the mouse back towards the menu without closing */ + ui_mouse_motion_towards_reinit(menu, &event->x); + } if (menu->menuretval) return WM_UI_HANDLER_CONTINUE; @@ -7286,12 +7330,16 @@ static int ui_handle_menus_recursive(bContext *C, const wmEvent *event, uiPopupB } if (do_but_search) { + uiBlock *block = menu->region->uiblocks.first; + retval = ui_handle_menu_button(C, event, menu); - /* when there is a active search button and we close it, - * we need to reinit the mouse coords [#35346] */ - if (ui_but_find_activated(menu->region) != but) { - do_towards_reinit = true; + if (block->flag & UI_BLOCK_MOVEMOUSE_QUIT) { + /* when there is a active search button and we close it, + * we need to reinit the mouse coords [#35346] */ + if (ui_but_find_activated(menu->region) != but) { + do_towards_reinit = true; + } } } else { diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 82352cee05e..d2a8c47b347 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -427,6 +427,8 @@ struct uiKeyNavLock { struct uiPopupBlockHandle { /* internal */ struct ARegion *region; + + /* use only for 'UI_BLOCK_MOVEMOUSE_QUIT' popups */ float towards_xy[2]; double towardstime; bool dotowards; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 2a6a9600582..2e80af1b3ad 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -2429,6 +2429,11 @@ uiLayout *uiLayoutListBox(uiLayout *layout, uiList *ui_list, PointerRNA *ptr, Pr but->rnapoin = *actptr; but->rnaprop = actprop; + /* only for the undo string */ + if (but->flag & UI_BUT_UNDO) { + but->tip = RNA_property_description(actprop); + } + return (uiLayout *)box; } @@ -3077,12 +3082,14 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, /* no undo for buttons for operator redo panels */ uiButClearFlag(but, UI_BUT_UNDO); +#if 0 /* broken, causes freedback loop, see [#36109] */ /* if button is operator's default property, and a text-field, enable focus for it * - this is used for allowing operators with popups to rename stuff with fewer clicks */ if ((but->rnaprop == op->type->prop) && (but->type == TEX)) { uiButSetFocusOnEnter(CTX_wm_window(C), but); } +#endif } } } diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 9f7d1435195..5910909142c 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -148,7 +148,7 @@ static void eyedropper_color_sample_fl(bContext *C, Eyedropper *UNUSED(eye), int if (BLI_rcti_isect_pt(&sa->totrct, mx, my)) { if (sa->spacetype == SPACE_IMAGE) { ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); - if (BLI_rcti_isect_pt(&ar->winrct, mx, my)) { + if (ar && BLI_rcti_isect_pt(&ar->winrct, mx, my)) { SpaceImage *sima = sa->spacedata.first; int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin}; @@ -160,7 +160,7 @@ static void eyedropper_color_sample_fl(bContext *C, Eyedropper *UNUSED(eye), int } else if (sa->spacetype == SPACE_NODE) { ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); - if (BLI_rcti_isect_pt(&ar->winrct, mx, my)) { + if (ar && BLI_rcti_isect_pt(&ar->winrct, mx, my)) { SpaceNode *snode = sa->spacedata.first; int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin}; @@ -172,7 +172,7 @@ static void eyedropper_color_sample_fl(bContext *C, Eyedropper *UNUSED(eye), int } else if (sa->spacetype == SPACE_CLIP) { ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); - if (BLI_rcti_isect_pt(&ar->winrct, mx, my)) { + if (ar && BLI_rcti_isect_pt(&ar->winrct, mx, my)) { SpaceClip *sc = sa->spacedata.first; int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin}; @@ -917,7 +917,7 @@ static void edittranslation_find_po_file(const char *root, const char *uilng, ch /* First, full lang code. */ BLI_snprintf(tstr, sizeof(tstr), "%s.po", uilng); BLI_join_dirfile(path, maxlen, root, uilng); - BLI_join_dirfile(path, maxlen, path, tstr); + BLI_path_append(path, maxlen, tstr); if (BLI_is_file(path)) return; @@ -941,7 +941,7 @@ static void edittranslation_find_po_file(const char *root, const char *uilng, ch BLI_join_dirfile(path, maxlen, root, tstr); strcat(tstr, ".po"); - BLI_join_dirfile(path, maxlen, path, tstr); + BLI_path_append(path, maxlen, tstr); if (BLI_is_file(path)) return; } diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index b13de64d0c7..3fe11ad3a6b 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -255,7 +255,7 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int pa->sizey = 0; } - BLI_strncpy(pa->drawname, drawname, UI_MAX_NAME_STR); + BLI_strncpy(pa->drawname, drawname, sizeof(pa->drawname)); /* if a new panel is added, we insert it right after the panel * that was last added. this way new panels are inserted in the diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index fbe23b1a1ed..95f47be0b70 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -439,6 +439,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) uiStringInfo enum_label = {BUT_GET_RNAENUM_LABEL, NULL}; uiStringInfo enum_tip = {BUT_GET_RNAENUM_TIP, NULL}; uiStringInfo op_keymap = {BUT_GET_OP_KEYMAP, NULL}; + uiStringInfo prop_keymap = {BUT_GET_PROP_KEYMAP, NULL}; uiStringInfo rna_struct = {BUT_GET_RNASTRUCT_IDENTIFIER, NULL}; uiStringInfo rna_prop = {BUT_GET_RNAPROP_IDENTIFIER, NULL}; @@ -448,7 +449,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* create tooltip data */ data = MEM_callocN(sizeof(uiTooltipData), "uiTooltipData"); - uiButGetStrInfo(C, but, &but_tip, &enum_label, &enum_tip, &op_keymap, &rna_struct, &rna_prop, NULL); + uiButGetStrInfo(C, but, &but_tip, &enum_label, &enum_tip, &op_keymap, &prop_keymap, &rna_struct, &rna_prop, NULL); /* special case, enum rna buttons only have enum item description, * use general enum description too before the specific one */ @@ -480,6 +481,13 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) data->color_id[data->totline] = UI_TIP_LC_NORMAL; data->totline++; } + + /* Property context-toggle shortcut */ + if (prop_keymap.strinfo) { + BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Shortcut: %s"), prop_keymap.strinfo); + data->color_id[data->totline] = UI_TIP_LC_NORMAL; + data->totline++; + } if (ELEM3(but->type, TEX, SEARCH_MENU, SEARCH_MENU_UNLINK)) { /* full string */ @@ -516,7 +524,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if (but->rnapoin.id.data) { ID *id = but->rnapoin.id.data; - if (id->lib && id->lib->name) { + if (id->lib) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Library: %s"), id->lib->name); data->color_id[data->totline] = UI_TIP_LC_NORMAL; data->totline++; @@ -582,7 +590,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* never fails */ id_path = RNA_path_full_ID_py(id); - if (ptr->id.data && ptr->data && prop) { + if (ptr->data && prop) { data_path = RNA_path_from_ID_to_property(ptr, prop); } @@ -614,6 +622,8 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) MEM_freeN(enum_tip.strinfo); if (op_keymap.strinfo) MEM_freeN(op_keymap.strinfo); + if (prop_keymap.strinfo) + MEM_freeN(prop_keymap.strinfo); if (rna_struct.strinfo) MEM_freeN(rna_struct.strinfo); if (rna_prop.strinfo) @@ -2106,7 +2116,7 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper static char tip[50]; static char hexcol[128]; float rgb_gamma[3]; - float min, max, step, precision; + float softmin, softmax, hardmin, hardmax, step, precision; float *hsv = ui_block_hsv_get(block); int yco; @@ -2132,7 +2142,8 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper /* sneaky way to check for alpha */ rgba[3] = FLT_MAX; - RNA_property_float_ui_range(ptr, prop, &min, &max, &step, &precision); + RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision); + RNA_property_float_range(ptr, prop, &hardmin, &hardmax); RNA_property_float_get_array(ptr, prop, rgba); switch (U.color_picker_type) { @@ -2186,7 +2197,8 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv); bt = uiDefButF(block, NUMSLI, 0, IFACE_("S "), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, hsv + 1, 0.0, 1.0, 10, 3, TIP_("Saturation")); uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv); - bt = uiDefButF(block, NUMSLI, 0, IFACE_("V "), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, hsv + 2, 0.0, max, 10, 3, TIP_("Value")); + bt = uiDefButF(block, NUMSLI, 0, IFACE_("V "), 0, yco -= UI_UNIT_Y, butwidth, UI_UNIT_Y, hsv + 2, 0.0, softmax, 10, 3, TIP_("Value")); + bt->hardmax = hardmax; /* not common but rgb may be over 1.0 */ uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv); uiBlockEndAlign(block); @@ -2256,10 +2268,8 @@ uiBlock *ui_block_func_COLOR(bContext *C, uiPopupBlockHandle *handle, void *arg_ block = uiBeginBlock(C, handle->region, __func__, UI_EMBOSS); - if (but->rnaprop) { - if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) { - block->color_profile = FALSE; - } + if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) { + block->color_profile = false; } if (but->block) { @@ -2516,7 +2526,7 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon) uiStyle *style = UI_GetStyleDraw(); uiPopupMenu *pup = MEM_callocN(sizeof(uiPopupMenu), "popup menu"); uiBut *but; - + pup->block = uiBeginBlock(C, NULL, __func__, UI_EMBOSSP); pup->block->flag |= UI_BLOCK_POPUP_MEMORY; pup->block->puphash = ui_popup_menu_hash(title); @@ -2530,7 +2540,7 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon) pup->block->handle = MEM_callocN(sizeof(uiPopupBlockHandle), "uiPopupBlockHandle"); /* create title button */ - if (title && title[0]) { + if (title[0]) { char titlestr[256]; if (icon) { diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 57392c60f80..f45bd1c3463 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2646,7 +2646,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co sub = uiLayoutRow(overlap, FALSE); but = uiDefButR_prop(subblock, LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, - active_dataptr, activeprop, 0, 0, i, 0, 0, ""); + active_dataptr, activeprop, 0, 0, i, 0, 0, NULL); uiButSetFlag(but, UI_BUT_NO_TOOLTIP); sub = uiLayoutRow(overlap, FALSE); @@ -2660,6 +2660,8 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co if (i == activei) { ui_layout_list_set_labels_active(sub); } + + uiBlockClearFlag(subblock, UI_BLOCK_LIST_ITEM); } i++; } @@ -2734,7 +2736,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co sub = uiLayoutRow(overlap, FALSE); but = uiDefButR_prop(subblock, LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, - active_dataptr, activeprop, 0, 0, i, 0, 0, ""); + active_dataptr, activeprop, 0, 0, i, 0, 0, NULL); uiButSetFlag(but, UI_BUT_NO_TOOLTIP); sub = uiLayoutRow(overlap, FALSE); @@ -2747,6 +2749,8 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co ui_layout_list_set_labels_active(sub); } + uiBlockClearFlag(subblock, UI_BLOCK_LIST_ITEM); + i++; } RNA_PROP_END; @@ -3018,16 +3022,16 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title, /* recurse for nested properties */ if (RNA_property_type(prop) == PROP_POINTER) { PointerRNA propptr = RNA_property_pointer_get(ptr, prop); - const char *name = RNA_property_ui_name(prop); if (propptr.data && RNA_struct_is_a(propptr.type, &RNA_OperatorProperties)) { + const char *name = RNA_property_ui_name(prop); template_keymap_item_properties(layout, name, &propptr); continue; } } /* add property */ - uiItemR(flow, ptr, RNA_property_identifier(prop), 0, NULL, ICON_NONE); + uiItemFullR(flow, ptr, prop, -1, 0, 0, NULL, ICON_NONE); } RNA_STRUCT_END; } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 9b736eb1bf4..594d3e40dcd 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -96,8 +96,7 @@ typedef struct uiWidgetBase { float inner_v[WIDGET_SIZE_MAX][2]; float inner_uv[WIDGET_SIZE_MAX][2]; - short inner, outline, emboss; /* set on/off */ - short shadedir; + bool inner, outline, emboss, shadedir; uiWidgetTrias tria1; uiWidgetTrias tria2; @@ -209,9 +208,9 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y /* for each AA step */ for (j = 0; j < WIDGET_AA_JITTER; j++) { - glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f); + glTranslatef(jit[j][0], jit[j][1], 0.0f); glDrawArrays(GL_TRIANGLES, 0, 3); - glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f); + glTranslatef(-jit[j][0], -jit[j][1], 0.0f); } glDisableClientState(GL_VERTEX_ARRAY); @@ -232,9 +231,9 @@ void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float m glColor4fv(color); for (j = 0; j < WIDGET_AA_JITTER; j++) { - glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f); + glTranslatef(jit[j][0], jit[j][1], 0.0f); uiDrawBox(mode, minx, miny, maxx, maxy, rad); - glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f); + glTranslatef(-jit[j][0], -jit[j][1], 0.0f); } glDisable(GL_BLEND); @@ -778,7 +777,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) glEnableClientState(GL_VERTEX_ARRAY); for (j = 0; j < WIDGET_AA_JITTER; j++) { - glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f); + glTranslatef(jit[j][0], jit[j][1], 0.0f); /* outline */ glColor4ubv(tcol); @@ -794,7 +793,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) glDrawArrays(GL_QUAD_STRIP, 0, wtb->halfwayvert * 2); } - glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f); + glTranslatef(-jit[j][0], -jit[j][1], 0.0f); } glDisableClientState(GL_VERTEX_ARRAY); @@ -808,7 +807,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) (unsigned char)((float)wcol->item[3] / WIDGET_AA_JITTER)}; /* for each AA step */ for (j = 0; j < WIDGET_AA_JITTER; j++) { - glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f); + glTranslatef(jit[j][0], jit[j][1], 0.0f); if (wtb->tria1.tot) { glColor4ubv(tcol); @@ -819,7 +818,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol) widget_trias_draw(&wtb->tria2); } - glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f); + glTranslatef(-jit[j][0], -jit[j][1], 0.0f); } } @@ -2061,6 +2060,7 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons copy_v3_v3(col1[0], col1[2]); copy_v3_v3(col1[1], col1[2]); copy_v3_v3(col1[3], col1[2]); + break; } /* old below */ @@ -2365,7 +2365,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, const rcti *rect, const rcti *slid uiWidgetBase wtb; int horizontal; float rad; - short outline = 0; + bool outline = false; widget_init(&wtb); @@ -2409,8 +2409,9 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, const rcti *rect, const rcti *slid wtb.emboss = 0; /* only emboss once */ /* exception for progress bar */ - if (state & UI_SCROLL_NO_OUTLINE) - SWAP(short, outline, wtb.outline); + if (state & UI_SCROLL_NO_OUTLINE) { + SWAP(bool, outline, wtb.outline); + } round_box_edges(&wtb, UI_CNR_ALL, slider, rad); @@ -2431,8 +2432,9 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, const rcti *rect, const rcti *slid } widgetbase_draw(&wtb, wcol); - if (state & UI_SCROLL_NO_OUTLINE) - SWAP(short, outline, wtb.outline); + if (state & UI_SCROLL_NO_OUTLINE) { + SWAP(bool, outline, wtb.outline); + } } } @@ -2968,7 +2970,7 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type) case UI_WTYPE_LISTLABEL: wt.wcol_theme = &btheme->tui.wcol_list_item; - /* No break, we use usual label code too. */ + /* fall-through */ /* we use usual label code too. */ case UI_WTYPE_LABEL: wt.draw = NULL; break; @@ -3197,9 +3199,9 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct case SEPR: ui_draw_separator(rect, &tui->wcol_menu_item); break; - default: wt = widget_type(UI_WTYPE_MENU_ITEM); + break; } } else if (but->dt == UI_EMBOSSN) { @@ -3384,6 +3386,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct default: wt = widget_type(UI_WTYPE_REGULAR); + break; } } diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index becffb64ae6..dc780d6a4f1 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1353,7 +1353,8 @@ void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3] UI_GetColorPtrBlendShade3ubv(src_col, col, dst_col, 0.5f, -10); break; default: - BLI_assert(!"invalid axis arg"); + BLI_assert(0); + break; } } @@ -2094,8 +2095,7 @@ void init_userdef_do_versions(void) if (U.ndof_sensitivity == 0.0f) { U.ndof_sensitivity = 1.0f; - U.ndof_flag = NDOF_LOCK_HORIZON | - NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM | NDOF_SHOULD_ROTATE; + U.ndof_flag = (NDOF_LOCK_HORIZON | NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM | NDOF_SHOULD_ROTATE); } if (U.ndof_orbit_sensitivity == 0.0f) { diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index fe5b129e938..f656d22fc64 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -209,9 +209,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) } /* scrollers - should we have these by default? */ /* XXX for now, we don't override this, or set it either! */ + break; } - break; - /* 'list/channel view' - zoom, aspect ratio, and alignment restrictions are set here */ case V2D_COMMONVIEW_LIST: { @@ -225,9 +224,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) tot_changed = do_init; /* scroller settings are currently not set here... that is left for regions... */ + break; } - break; - /* 'stack view' - practically the same as list/channel view, except is located in the pos y half instead. * zoom, aspect ratio, and alignment restrictions are set here */ case V2D_COMMONVIEW_STACK: @@ -242,9 +240,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) tot_changed = do_init; /* scroller settings are currently not set here... that is left for regions... */ + break; } - break; - /* 'header' regions - zoom, aspect ratio, alignment, and panning restrictions are set here */ case V2D_COMMONVIEW_HEADER: { @@ -272,10 +269,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) /* absolutely no scrollers allowed */ v2d->scroll = 0; - + break; } - break; - /* panels view, with horizontal/vertical align */ case V2D_COMMONVIEW_PANELS_UI: { @@ -308,9 +303,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) v2d->cur.ymax = 0.0f; v2d->cur.ymin = (-winy) * panelzoom; } + break; } - break; - /* other view types are completely defined using their own settings already */ default: /* we don't do anything here, as settings should be fine, but just make sure that rect */ @@ -1739,9 +1733,8 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v fac2 = fac2 - time; scroll_printstr(scene, fac, h, time + (float)FPS * fac2 / 100.0f, grid->powerx, V2D_UNIT_SECONDSSEQ, 'h'); + break; } - break; - case V2D_UNIT_DEGREES: /* Graph Editor for rotation Drivers */ /* HACK: although we're drawing horizontal, we make this draw as 'vertical', just to get degree signs */ scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v'); diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index e12817262f8..929b7ae2a5d 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -247,8 +247,8 @@ static int view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event) vpd->lasty = event->y; view_pan_apply(op); + break; } - break; /* XXX - Mode switching isn't implemented. See comments in 36818. * switch to zoom */ #if 0 @@ -1288,7 +1288,7 @@ void UI_view2d_smooth_view(bContext *C, ARegion *ar, fac = smooth_view_rect_to_fac(&v2d->cur, cur); } - if (C && U.smooth_viewtx && fac > FLT_EPSILON) { + if (U.smooth_viewtx && fac > FLT_EPSILON) { int changed = FALSE; if (BLI_rctf_compare(&sms.new_cur, &v2d->cur, FLT_EPSILON) == FALSE) @@ -1674,9 +1674,8 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e vsm->lasty = event->y; scroller_activate_apply(C, op); + break; } - break; - case LEFTMOUSE: case MIDDLEMOUSE: if (event->val == KM_RELEASE) { diff --git a/source/blender/editors/mask/mask_add.c b/source/blender/editors/mask/mask_add.c index 33a6aa2d43d..9c270144a0a 100644 --- a/source/blender/editors/mask/mask_add.c +++ b/source/blender/editors/mask/mask_add.c @@ -387,6 +387,7 @@ static int add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2] /* TODO - we could pass the spline! */ BKE_mask_layer_shape_changed_add(masklay, BKE_mask_layer_shape_spline_to_index(masklay, spline) + point_index + 1, TRUE, TRUE); + masklay->act_spline = spline; masklay->act_point = new_point; WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask); diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c index cd2995be439..9ae5b436fb3 100644 --- a/source/blender/editors/mask/mask_edit.c +++ b/source/blender/editors/mask/mask_edit.c @@ -390,6 +390,8 @@ void ED_operatortypes_mask(void) WM_operatortype_append(MASK_OT_select_circle); WM_operatortype_append(MASK_OT_select_linked_pick); WM_operatortype_append(MASK_OT_select_linked); + WM_operatortype_append(MASK_OT_select_more); + WM_operatortype_append(MASK_OT_select_less); /* hide/reveal */ WM_operatortype_append(MASK_OT_hide_view_clear); @@ -466,6 +468,9 @@ void ED_keymap_mask(wmKeyConfig *keyconf) kmi = WM_keymap_add_item(keymap, "MASK_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL | KM_SHIFT | KM_ALT, 0); RNA_boolean_set(kmi->ptr, "deselect", TRUE); + WM_keymap_add_item(keymap, "MASK_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "MASK_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0); + /* hide/reveal */ WM_keymap_add_item(keymap, "MASK_OT_hide_view_clear", HKEY, KM_PRESS, KM_ALT, 0); kmi = WM_keymap_add_item(keymap, "MASK_OT_hide_view_set", HKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/mask/mask_intern.h b/source/blender/editors/mask/mask_intern.h index fcfcfb237e9..bd148c48980 100644 --- a/source/blender/editors/mask/mask_intern.h +++ b/source/blender/editors/mask/mask_intern.h @@ -88,6 +88,8 @@ void MASK_OT_select_lasso(struct wmOperatorType *ot); void MASK_OT_select_circle(struct wmOperatorType *ot); void MASK_OT_select_linked_pick(struct wmOperatorType *ot); void MASK_OT_select_linked(struct wmOperatorType *ot); +void MASK_OT_select_more(struct wmOperatorType *ot); +void MASK_OT_select_less(struct wmOperatorType *ot); int ED_mask_spline_select_check(struct MaskSpline *spline); int ED_mask_layer_select_check(struct MaskLayer *masklay); diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index 134806cf5bd..5c2aacf0713 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -655,8 +655,7 @@ static int slide_point_modal(bContext *C, wmOperator *op, const wmEvent *event) if (ELEM(event->type, LEFTSHIFTKEY, RIGHTSHIFTKEY)) data->accurate = (event->val == KM_PRESS); - /* no break! update CV position */ - + /* fall-through */ /* update CV position */ case MOUSEMOVE: { ScrArea *sa = CTX_wm_area(C); diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c index 997f170c9f9..c524aeb06ee 100644 --- a/source/blender/editors/mask/mask_select.c +++ b/source/blender/editors/mask/mask_select.c @@ -470,7 +470,7 @@ void MASK_OT_select_border(wmOperatorType *ot) { /* identifiers */ ot->name = "Border Select"; - ot->description = "Select markers using border selection"; + ot->description = "Select curve points using border selection"; ot->idname = "MASK_OT_select_border"; /* api callbacks */ @@ -521,7 +521,7 @@ static int do_lasso_select_mask(bContext *C, const int mcords[][2], short moves, float screen_co[2]; - /* marker in screen coords */ + /* point in screen coords */ ED_mask_point_pos__reverse(sa, ar, point_deform->bezt.vec[1][0], point_deform->bezt.vec[1][1], &screen_co[0], &screen_co[1]); @@ -569,7 +569,7 @@ void MASK_OT_select_lasso(wmOperatorType *ot) { /* identifiers */ ot->name = "Lasso Select"; - ot->description = "Select markers using lasso selection"; + ot->description = "Select curve points using lasso selection"; ot->idname = "MASK_OT_select_lasso"; /* api callbacks */ @@ -670,7 +670,7 @@ void MASK_OT_select_circle(wmOperatorType *ot) { /* identifiers */ ot->name = "Circle Select"; - ot->description = "Select markers using circle selection"; + ot->description = "Select curve points using circle selection"; ot->idname = "MASK_OT_select_circle"; /* api callbacks */ @@ -784,7 +784,7 @@ void MASK_OT_select_linked(wmOperatorType *ot) /* identifiers */ ot->name = "Select Linked All"; ot->idname = "MASK_OT_select_linked"; - ot->description = "Select all vertices linked to the active mesh"; + ot->description = "Select all curve points linked to already selected ones"; /* api callbacks */ ot->exec = mask_select_linked_exec; @@ -793,3 +793,115 @@ void MASK_OT_select_linked(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } + +/**************** Select more/less **************/ + +static int mask_select_more_less(bContext *C, bool more) +{ + Mask *mask = CTX_data_edit_mask(C); + MaskLayer *masklay; + + for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) { + MaskSpline *spline; + + if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) { + continue; + } + + for (spline = masklay->splines.first; spline; spline = spline->next) { + int i; + bool start_sel, end_sel, prev_sel, cur_sel, cyclic = spline->flag & MASK_SPLINE_CYCLIC; + + /* reselect point if any handle is selected to make the result more predictable */ + for (i = 0; i < spline->tot_point; i++) { + BKE_mask_point_select_set(spline->points + i, MASKPOINT_ISSEL_ANY(spline->points + i)); + } + + /* select more/less does not affect empty/single point splines */ + if (spline->tot_point < 2) { + continue; + } + + if (cyclic) { + start_sel = !!MASKPOINT_ISSEL_KNOT(spline->points); + end_sel = !!MASKPOINT_ISSEL_KNOT(&spline->points[spline->tot_point - 1]); + } + + for (i = 0; i < spline->tot_point; i++) { + if (i == 0 && !cyclic) { + continue; + } + + prev_sel = (i > 0) ? !!MASKPOINT_ISSEL_KNOT(&spline->points[i - 1]) : end_sel; + cur_sel = !!MASKPOINT_ISSEL_KNOT(&spline->points[i]); + + if (cur_sel != more) { + if (prev_sel == more) { + BKE_mask_point_select_set(&spline->points[i], more); + } + i++; + } + } + + for (i = spline->tot_point - 1; i >= 0; i--) { + if (i == spline->tot_point - 1 && !cyclic) { + continue; + } + + prev_sel = (i < spline->tot_point - 1) ? !!MASKPOINT_ISSEL_KNOT(&spline->points[i + 1]) : start_sel; + cur_sel = !!MASKPOINT_ISSEL_KNOT(&spline->points[i]); + + if (cur_sel != more) { + if (prev_sel == more) { + BKE_mask_point_select_set(&spline->points[i], more); + } + i--; + } + } + } + } + + WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask); + + return OPERATOR_FINISHED; +} + +static int mask_select_more_exec(bContext *C, wmOperator *UNUSED(op)) +{ + return mask_select_more_less(C, true); +} + +void MASK_OT_select_more(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Select More"; + ot->idname = "MASK_OT_select_more"; + ot->description = "Select more spline points connected to initial selection"; + + /* api callbacks */ + ot->exec = mask_select_more_exec; + ot->poll = ED_maskedit_mask_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + +static int mask_select_less_exec(bContext *C, wmOperator *UNUSED(op)) +{ + return mask_select_more_less(C, false); +} + +void MASK_OT_select_less(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Select Less"; + ot->idname = "MASK_OT_select_less"; + ot->description = "Deselect spline points at the boundary of each selection region"; + + /* api callbacks */ + ot->exec = mask_select_less_exec; + ot->poll = ED_maskedit_mask_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index b2c7846ab6c..db5635d6ea3 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -95,9 +95,11 @@ void paintface_flush_flags(Object *ob) /* loop over tessfaces */ for (i = 0; i < totface; i++) { - /* Copy flags onto the original tessface from its original poly */ - mp_orig = me->mpoly + index_array[i]; - faces[i].flag = mp_orig->flag; + if (index_array[i] != ORIGINDEX_NONE) { + /* Copy flags onto the original tessface from its original poly */ + mp_orig = me->mpoly + index_array[i]; + faces[i].flag = mp_orig->flag; + } } } @@ -107,9 +109,11 @@ void paintface_flush_flags(Object *ob) /* loop over final derived polys */ for (i = 0; i < totpoly; i++) { - /* Copy flags onto the final derived poly from the original mesh poly */ - mp_orig = me->mpoly + index_array[i]; - polys[i].flag = mp_orig->flag; + if (index_array[i] != ORIGINDEX_NONE) { + /* Copy flags onto the final derived poly from the original mesh poly */ + mp_orig = me->mpoly + index_array[i]; + polys[i].flag = mp_orig->flag; + } } } @@ -120,9 +124,11 @@ void paintface_flush_flags(Object *ob) /* loop over tessfaces */ for (i = 0; i < totface; i++) { - /* Copy flags onto the final tessface from its final poly */ - mp_orig = polys + index_array[i]; - faces[i].flag = mp_orig->flag; + if (index_array[i] != ORIGINDEX_NONE) { + /* Copy flags onto the final tessface from its final poly */ + mp_orig = polys + index_array[i]; + faces[i].flag = mp_orig->flag; + } } } } @@ -192,8 +198,8 @@ static void select_linked_tfaces_with_seams(Mesh *me, const unsigned int index, bool do_it = true; bool mark = false; - BLI_bitmap edge_tag = BLI_BITMAP_NEW(me->totedge, __func__); - BLI_bitmap poly_tag = BLI_BITMAP_NEW(me->totpoly, __func__); + BLI_bitmap *edge_tag = BLI_BITMAP_NEW(me->totedge, __func__); + BLI_bitmap *poly_tag = BLI_BITMAP_NEW(me->totpoly, __func__); if (index != (unsigned int)-1) { /* only put face under cursor in array */ diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index e544592365d..f372053db55 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -118,9 +118,10 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op) obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Plane"), &dia, mat, &was_editmode, loc, rot, layer); em = BKE_editmesh_from_object(obedit); - if (!EDBM_op_call_and_selectf(em, op, "verts.out", - "create_grid x_segments=%i y_segments=%i size=%f matrix=%m4", - 1, 1, RNA_float_get(op->ptr, "radius"), mat)) + if (!EDBM_op_call_and_selectf( + em, op, "verts.out", false, + "create_grid x_segments=%i y_segments=%i size=%f matrix=%m4", + 1, 1, RNA_float_get(op->ptr, "radius"), mat)) { return OPERATOR_CANCELLED; } @@ -162,8 +163,10 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op) obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Cube"), &dia, mat, &was_editmode, loc, rot, layer); em = BKE_editmesh_from_object(obedit); - if (!EDBM_op_call_and_selectf(em, op, "verts.out", "create_cube matrix=%m4 size=%f", - mat, RNA_float_get(op->ptr, "radius") * 2.0f)) + if (!EDBM_op_call_and_selectf( + em, op, "verts.out", false, + "create_cube matrix=%m4 size=%f", + mat, RNA_float_get(op->ptr, "radius") * 2.0f)) { return OPERATOR_CANCELLED; } @@ -216,10 +219,11 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op) obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Circle"), &dia, mat, &was_editmode, loc, rot, layer); em = BKE_editmesh_from_object(obedit); - if (!EDBM_op_call_and_selectf(em, op, "verts.out", - "create_circle segments=%i diameter=%f cap_ends=%b cap_tris=%b matrix=%m4", - RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius"), - cap_end, cap_tri, mat)) + if (!EDBM_op_call_and_selectf( + em, op, "verts.out", false, + "create_circle segments=%i diameter=%f cap_ends=%b cap_tris=%b matrix=%m4", + RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius"), + cap_end, cap_tri, mat)) { return OPERATOR_CANCELLED; } @@ -269,7 +273,7 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op) em = BKE_editmesh_from_object(obedit); if (!EDBM_op_call_and_selectf( - em, op, "verts.out", + em, op, "verts.out", false, "create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%b cap_tris=%b depth=%f matrix=%m4", RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius"), @@ -329,7 +333,7 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op) em = BKE_editmesh_from_object(obedit); if (!EDBM_op_call_and_selectf( - em, op, "verts.out", + em, op, "verts.out", false, "create_cone segments=%i diameter1=%f diameter2=%f cap_ends=%b cap_tris=%b depth=%f matrix=%m4", RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius1"), RNA_float_get(op->ptr, "radius2"), cap_end, cap_tri, RNA_float_get(op->ptr, "depth"), mat)) @@ -385,11 +389,12 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op) obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Grid"), &dia, mat, &was_editmode, loc, rot, layer); em = BKE_editmesh_from_object(obedit); - if (!EDBM_op_call_and_selectf(em, op, "verts.out", - "create_grid x_segments=%i y_segments=%i size=%f matrix=%m4", - RNA_int_get(op->ptr, "x_subdivisions"), - RNA_int_get(op->ptr, "y_subdivisions"), - RNA_float_get(op->ptr, "radius"), mat)) + if (!EDBM_op_call_and_selectf( + em, op, "verts.out", false, + "create_grid x_segments=%i y_segments=%i size=%f matrix=%m4", + RNA_int_get(op->ptr, "x_subdivisions"), + RNA_int_get(op->ptr, "y_subdivisions"), + RNA_float_get(op->ptr, "radius"), mat)) { return OPERATOR_CANCELLED; } @@ -444,7 +449,10 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op) em = BKE_editmesh_from_object(obedit); - if (!EDBM_op_call_and_selectf(em, op, "verts.out", "create_monkey matrix=%m4", mat)) { + if (!EDBM_op_call_and_selectf( + em, op, "verts.out", false, + "create_monkey matrix=%m4", mat)) + { return OPERATOR_CANCELLED; } @@ -485,10 +493,11 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op) obedit = make_prim_init(C, CTX_DATA_(BLF_I18NCONTEXT_ID_MESH, "Sphere"), &dia, mat, &was_editmode, loc, rot, layer); em = BKE_editmesh_from_object(obedit); - if (!EDBM_op_call_and_selectf(em, op, "verts.out", - "create_uvsphere u_segments=%i v_segments=%i diameter=%f matrix=%m4", - RNA_int_get(op->ptr, "segments"), RNA_int_get(op->ptr, "ring_count"), - RNA_float_get(op->ptr, "size"), mat)) + if (!EDBM_op_call_and_selectf( + em, op, "verts.out", false, + "create_uvsphere u_segments=%i v_segments=%i diameter=%f matrix=%m4", + RNA_int_get(op->ptr, "segments"), RNA_int_get(op->ptr, "ring_count"), + RNA_float_get(op->ptr, "size"), mat)) { return OPERATOR_CANCELLED; } @@ -538,7 +547,7 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op) em = BKE_editmesh_from_object(obedit); if (!EDBM_op_call_and_selectf( - em, op, "verts.out", + em, op, "verts.out", false, "create_icosphere subdivisions=%i diameter=%f matrix=%m4", RNA_int_get(op->ptr, "subdivisions"), RNA_float_get(op->ptr, "size"), mat)) diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c index 65c528dbe03..b38f09b1dec 100644 --- a/source/blender/editors/mesh/editmesh_extrude.c +++ b/source/blender/editors/mesh/editmesh_extrude.c @@ -713,7 +713,7 @@ static int edbm_spin_exec(bContext *C, wmOperator *op) BMEditMesh *em = BKE_editmesh_from_object(obedit); BMesh *bm = em->bm; BMOperator spinop; - float cent[3], axis[3], imat[3][3]; + float cent[3], axis[3]; float d[3] = {0.0f, 0.0f, 0.0f}; int steps, dupli; float angle; @@ -726,15 +726,10 @@ static int edbm_spin_exec(bContext *C, wmOperator *op) angle = -angle; dupli = RNA_boolean_get(op->ptr, "dupli"); - /* undo object transformation */ - copy_m3_m4(imat, obedit->imat); - sub_v3_v3(cent, obedit->obmat[3]); - mul_m3_v3(imat, cent); - mul_m3_v3(imat, axis); - + /* keep the values in worldspace since we're passing the obmat */ if (!EDBM_op_init(em, &spinop, op, - "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f use_duplicate=%b", - BM_ELEM_SELECT, cent, axis, d, steps, angle, dupli)) + "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f space=%m4 use_duplicate=%b", + BM_ELEM_SELECT, cent, axis, d, steps, angle, obedit->obmat, dupli)) { return OPERATOR_CANCELLED; } @@ -800,8 +795,7 @@ static int edbm_screw_exec(bContext *C, wmOperator *op) BMVert *eve, *v1, *v2; BMIter iter, eiter; BMOperator spinop; - float dvec[3], nor[3], cent[3], axis[3]; - float imat[3][3]; + float dvec[3], nor[3], cent[3], axis[3], v1_co_global[3], v2_co_global[3]; int steps, turns; int valence; @@ -811,13 +805,6 @@ static int edbm_screw_exec(bContext *C, wmOperator *op) RNA_float_get_array(op->ptr, "center", cent); RNA_float_get_array(op->ptr, "axis", axis); - /* undo object transformation */ - copy_m3_m4(imat, obedit->imat); - sub_v3_v3(cent, obedit->obmat[3]); - mul_m3_v3(imat, cent); - mul_m3_v3(imat, axis); - - /* find two vertices with valence count == 1, more or less is wrong */ v1 = NULL; v2 = NULL; @@ -850,15 +837,17 @@ static int edbm_screw_exec(bContext *C, wmOperator *op) } /* calculate dvec */ - sub_v3_v3v3(dvec, v1->co, v2->co); + mul_v3_m4v3(v1_co_global, obedit->obmat, v1->co); + mul_v3_m4v3(v2_co_global, obedit->obmat, v2->co); + sub_v3_v3v3(dvec, v1_co_global, v2_co_global); mul_v3_fl(dvec, 1.0f / steps); - if (dot_v3v3(nor, dvec) > 0.000f) + if (dot_v3v3(nor, dvec) > 0.0f) negate_v3(dvec); if (!EDBM_op_init(em, &spinop, op, - "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f use_duplicate=%b", - BM_ELEM_SELECT, cent, axis, dvec, turns * steps, DEG2RADF(360.0f * turns), false)) + "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f space=%m4 use_duplicate=%b", + BM_ELEM_SELECT, cent, axis, dvec, turns * steps, DEG2RADF(360.0f * turns), obedit->obmat, false)) { return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 50db460e5bc..d61f6712a8f 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -38,6 +38,7 @@ #include "BLI_listbase.h" #include "BLI_string.h" #include "BLI_array.h" +#include "BLI_alloca.h" #include "BLI_linklist.h" #include "BLI_math.h" #include "BLI_smallhash.h" @@ -2623,15 +2624,15 @@ static bool knife_edge_in_face(KnifeTool_OpData *UNUSED(kcd), KnifeEdge *kfe, BM /* Split face f with KnifeEdges on chain. f remains as one side, the face formed is put in *newface. * The new face will be on the left side of the chain as viewed from the normal-out side of f. */ -static void knife_make_chain_cut(KnifeTool_OpData *kcd, BMFace *f, ListBase *chain, BMFace **newface) +static void knife_make_chain_cut(KnifeTool_OpData *kcd, BMFace *f, ListBase *chain, BMFace **r_f_new) { BMesh *bm = kcd->em->bm; KnifeEdge *kfe, *kfelast; BMVert *v1, *v2; - BMFace *fnew; + BMFace *f_new; Ref *ref; KnifeVert *kfv, *kfvprev; - BMLoop *lnew, *l_iter; + BMLoop *l_new, *l_iter; int i; int nco = BLI_countlist(chain) - 1; float (*cos)[3] = BLI_array_alloca(cos, nco); @@ -2652,23 +2653,21 @@ static void knife_make_chain_cut(KnifeTool_OpData *kcd, BMFace *f, ListBase *cha kfvprev = kfv; } BLI_assert(i == nco); - lnew = NULL; + l_new = NULL; if (nco == 0) { /* Want to prevent creating two-sided polygons */ if (BM_edge_exists(v1, v2)) { - *newface = NULL; + f_new = NULL; } else { - *newface = BM_face_split(bm, f, v1, v2, &lnew, NULL, true); + f_new = BM_face_split(bm, f, v1, v2, &l_new, NULL, true); } } else { - fnew = BM_face_split_n(bm, f, v1, v2, cos, nco, &lnew, NULL); - *newface = fnew; - - if (fnew) { + f_new = BM_face_split_n(bm, f, v1, v2, cos, nco, &l_new, NULL); + if (f_new) { /* Now go through lnew chain matching up chain kv's and assign real v's to them */ - for (l_iter = lnew->next, i = 0; i < nco; l_iter = l_iter->next, i++) { + for (l_iter = l_new->next, i = 0; i < nco; l_iter = l_iter->next, i++) { BLI_assert(equals_v3v3(cos[i], l_iter->v->co)); if (kcd->select_result) { BM_edge_select_set(bm, l_iter->e, true); @@ -2680,10 +2679,15 @@ static void knife_make_chain_cut(KnifeTool_OpData *kcd, BMFace *f, ListBase *cha /* the select chain above doesnt account for the first loop */ if (kcd->select_result) { - if (lnew) { - BM_edge_select_set(bm, lnew->e, true); + if (l_new) { + BM_edge_select_set(bm, l_new->e, true); } } + else { + BM_elem_select_copy(bm, bm, f, f_new); + } + + *r_f_new = f_new; } static void knife_make_face_cuts(KnifeTool_OpData *kcd, BMFace *f, ListBase *kfedges) @@ -2887,6 +2891,7 @@ static void knifetool_finish_ex(KnifeTool_OpData *kcd) knife_make_cuts(kcd); #endif + EDBM_selectmode_flush(kcd->em); EDBM_mesh_normals_update(kcd->em); EDBM_update_generic(kcd->em, true, true); } diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 2829aed4999..3c1b210d171 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -42,6 +42,7 @@ #include "BKE_modifier.h" #include "BKE_report.h" #include "BKE_editmesh.h" +#include "BKE_DerivedMesh.h" #include "BIF_gl.h" @@ -61,6 +62,7 @@ #include "mesh_intern.h" /* own include */ #define SUBD_SMOOTH_MAX 4.0f +#define SUBD_CUTS_MAX 500 /* ringsel operator */ @@ -155,9 +157,30 @@ static void edgering_find_order(BMEdge *lasteed, BMEdge *eed, } } +static void edgering_vcos_get(DerivedMesh *dm, BMVert *v[2][2], float r_cos[2][2][3]) +{ + if (dm) { + int j, k; + for (j = 0; j < 2; j++) { + for (k = 0; k < 2; k++) { + dm->getVertCo(dm, BM_elem_index_get(v[j][k]), r_cos[j][k]); + } + } + } + else { + int j, k; + for (j = 0; j < 2; j++) { + for (k = 0; k < 2; k++) { + copy_v3_v3(r_cos[j][k], v[j][k]->co); + } + } + } +} + static void edgering_sel(RingSelOpData *lcd, int previewlines, bool select) { BMEditMesh *em = lcd->em; + DerivedMesh *dm = EDBM_mesh_deform_dm_get(em); BMEdge *eed_start = lcd->eed; BMEdge *eed, *eed_last; BMVert *v[2][2], *v_last; @@ -195,6 +218,10 @@ static void edgering_sel(RingSelOpData *lcd, int previewlines, bool select) return; } + if (dm) { + EDBM_index_arrays_ensure(lcd->em, BM_VERT); + } + BMW_init(&walker, em->bm, BMW_EDGERING, BMW_MASK_NOP, BMW_MASK_NOP, BMW_MASK_NOP, BMW_FLAG_TEST_HIDDEN, @@ -222,19 +249,26 @@ static void edgering_sel(RingSelOpData *lcd, int previewlines, bool select) for (i = 1; i <= previewlines; i++) { const float fac = (i / ((float)previewlines + 1)); - interp_v3_v3v3(edges[tot][0], v[0][0]->co, v[0][1]->co, fac); - interp_v3_v3v3(edges[tot][1], v[1][0]->co, v[1][1]->co, fac); + float v_cos[2][2][3]; + + edgering_vcos_get(dm, v, v_cos); + + interp_v3_v3v3(edges[tot][0], v_cos[0][0], v_cos[0][1], fac); + interp_v3_v3v3(edges[tot][1], v_cos[1][0], v_cos[1][1], fac); tot++; } } eed_last = eed; } + if ((eed_last != eed_start) && #ifdef BMW_EDGERING_NGON - if (lasteed != startedge && BM_edge_share_face_check(lasteed, startedge)) { + BM_edge_share_face_check(eed_last, eed_start) #else - if (eed_last != eed_start && BM_edge_share_quad_check(eed_last, eed_start)) { + BM_edge_share_quad_check(eed_last, eed_start) #endif + ) + { v[1][0] = v[0][0]; v[1][1] = v[0][1]; @@ -244,13 +278,16 @@ static void edgering_sel(RingSelOpData *lcd, int previewlines, bool select) for (i = 1; i <= previewlines; i++) { const float fac = (i / ((float)previewlines + 1)); + float v_cos[2][2][3]; if (!v[0][0] || !v[0][1] || !v[1][0] || !v[1][1]) { continue; } - interp_v3_v3v3(edges[tot][0], v[0][0]->co, v[0][1]->co, fac); - interp_v3_v3v3(edges[tot][1], v[1][0]->co, v[1][1]->co, fac); + edgering_vcos_get(dm, v, v_cos); + + interp_v3_v3v3(edges[tot][0], v_cos[0][0], v_cos[0][1], fac); + interp_v3_v3v3(edges[tot][1], v_cos[1][0], v_cos[1][1], fac); tot++; } } @@ -545,6 +582,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) break; if (event->alt == 0) { cuts++; + cuts = CLAMPIS(cuts, 0, SUBD_CUTS_MAX); RNA_int_set(op->ptr, "number_cuts", cuts); ringsel_find_edge(lcd, cuts); show_cuts = true; @@ -598,7 +636,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) /* allow zero so you can backspace and type in a value * otherwise 1 as minimum would make more sense */ - cuts = CLAMPIS(value, 0, 130); + cuts = CLAMPIS(value, 0, SUBD_CUTS_MAX); RNA_int_set(op->ptr, "number_cuts", cuts); ringsel_find_edge(lcd, cuts); diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index e9694b8a8f3..a1f1f6bd83f 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -460,7 +460,7 @@ BMVert *EDBM_vert_find_nearest(ViewContext *vc, float *r_dist, const bool sel, c 0, NULL, NULL); } - eve = BM_vert_at_index(vc->em->bm, index - 1); + eve = index ? BM_vert_at_index(vc->em->bm, index - 1) : NULL; if (eve && distance < *r_dist) { *r_dist = distance; @@ -552,7 +552,7 @@ BMEdge *EDBM_edge_find_nearest(ViewContext *vc, float *r_dist) view3d_validate_backbuf(vc); index = view3d_sample_backbuf_rect(vc, vc->mval, 50, bm_solidoffs, bm_wireoffs, &distance, 0, NULL, NULL); - eed = BM_edge_at_index(vc->em->bm, index - 1); + eed = index ? BM_edge_at_index(vc->em->bm, index - 1) : NULL; if (eed && distance < *r_dist) { *r_dist = distance; @@ -625,7 +625,7 @@ BMFace *EDBM_face_find_nearest(ViewContext *vc, float *r_dist) view3d_validate_backbuf(vc); index = view3d_sample_backbuf(vc, vc->mval[0], vc->mval[1]); - efa = BM_face_at_index(vc->em->bm, index - 1); + efa = index ? BM_face_at_index(vc->em->bm, index - 1) : NULL; if (efa) { struct { float mval_fl[2]; float dist; BMFace *toFace; } data; @@ -927,10 +927,11 @@ static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *UNUS } else if (em->selectmode & SCE_SELECT_FACE) { #ifdef WITH_FREESTYLE - for (a = SIMFACE_MATERIAL; a <= SIMFACE_FREESTYLE; a++) { + const int a_end = SIMFACE_FREESTYLE; #else - for (a = SIMFACE_MATERIAL; a <= SIMFACE_COPLANAR; a++) { + const int a_end = SIMFACE_COPLANAR; #endif + for (a = SIMFACE_MATERIAL; a <= a_end; a++) { RNA_enum_items_add_value(&item, &totitem, prop_similar_types, a); } } @@ -1589,8 +1590,7 @@ void EDBM_selectmode_set(BMEditMesh *em) } if (em->bm->totfacesel) { - efa = BM_iter_new(&iter, em->bm, BM_FACES_OF_MESH, NULL); - for (; efa; efa = BM_iter_step(&iter)) { + BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) { BM_face_select_set(em->bm, efa, true); } @@ -1705,6 +1705,7 @@ bool EDBM_selectmode_toggle(bContext *C, const short selectmode_new, break; default: BLI_assert(0); + break; } switch (selectmode_new) { @@ -2425,9 +2426,6 @@ static void walker_deselect_nth(BMEditMesh *em, int nth, int offset, BMHeader *h static void deselect_nth_active(BMEditMesh *em, BMVert **r_eve, BMEdge **r_eed, BMFace **r_efa) { - BMVert *v; - BMEdge *e; - BMFace *f; BMIter iter; BMElem *ele; @@ -2438,7 +2436,7 @@ static void deselect_nth_active(BMEditMesh *em, BMVert **r_eve, BMEdge **r_eed, EDBM_selectmode_flush(em); ele = BM_mesh_active_elem_get(em->bm); - if (ele) { + if (ele && BM_elem_flag_test(ele, BM_ELEM_SELECT)) { switch (ele->head.htype) { case BM_VERT: *r_eve = (BMVert *)ele; @@ -2453,6 +2451,7 @@ static void deselect_nth_active(BMEditMesh *em, BMVert **r_eve, BMEdge **r_eed, } if (em->selectmode & SCE_SELECT_VERTEX) { + BMVert *v; BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(v, BM_ELEM_SELECT)) { *r_eve = v; @@ -2461,6 +2460,7 @@ static void deselect_nth_active(BMEditMesh *em, BMVert **r_eve, BMEdge **r_eed, } } else if (em->selectmode & SCE_SELECT_EDGE) { + BMEdge *e; BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) { if (BM_elem_flag_test(e, BM_ELEM_SELECT)) { *r_eed = e; @@ -2469,8 +2469,8 @@ static void deselect_nth_active(BMEditMesh *em, BMVert **r_eve, BMEdge **r_eed, } } else if (em->selectmode & SCE_SELECT_FACE) { - f = BM_mesh_active_face_get(em->bm, true, false); - if (f) { + BMFace *f = BM_mesh_active_face_get(em->bm, true, false); + if (f && BM_elem_flag_test(f, BM_ELEM_SELECT)) { *r_efa = f; return; } @@ -2617,7 +2617,7 @@ static int edbm_select_linked_flat_faces_exec(bContext *C, wmOperator *op) BMLoop *l, *l2; const float angle_limit = RNA_float_get(op->ptr, "sharpness"); - BM_mesh_elem_hflag_disable_all(bm, BM_VERT, BM_ELEM_TAG, false); + BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, false); BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { @@ -3074,10 +3074,10 @@ void MESH_OT_region_to_loop(wmOperatorType *ot) static int loop_find_region(BMLoop *l, int flag, SmallHash *fhash, BMFace ***region_out) { - BLI_array_declare(region); - BLI_array_declare(stack); BMFace **region = NULL; BMFace **stack = NULL; + BLI_array_declare(region); + BLI_array_declare(stack); BMFace *f; BLI_array_append(stack, l->f); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 2fa6812d131..868db4fa746 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -635,7 +635,7 @@ void MESH_OT_edge_face_add(wmOperatorType *ot) /* ************************* SEAMS AND EDGES **************** */ -static int edbm_mark_seam(bContext *C, wmOperator *op) +static int edbm_mark_seam_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); @@ -681,7 +681,7 @@ void MESH_OT_mark_seam(wmOperatorType *ot) ot->description = "(Un)mark selected edges as a seam"; /* api callbacks */ - ot->exec = edbm_mark_seam; + ot->exec = edbm_mark_seam_exec; ot->poll = ED_operator_editmesh; /* flags */ @@ -690,7 +690,7 @@ void MESH_OT_mark_seam(wmOperatorType *ot) RNA_def_boolean(ot->srna, "clear", 0, "Clear", ""); } -static int edbm_mark_sharp(bContext *C, wmOperator *op) +static int edbm_mark_sharp_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); Mesh *me = ((Mesh *)obedit->data); @@ -735,7 +735,7 @@ void MESH_OT_mark_sharp(wmOperatorType *ot) ot->description = "(Un)mark selected edges as sharp"; /* api callbacks */ - ot->exec = edbm_mark_sharp; + ot->exec = edbm_mark_sharp_exec; ot->poll = ED_operator_editmesh; /* flags */ @@ -745,7 +745,7 @@ void MESH_OT_mark_sharp(wmOperatorType *ot) } -static int edbm_vert_connect(bContext *C, wmOperator *op) +static int edbm_vert_connect_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); @@ -795,13 +795,58 @@ void MESH_OT_vert_connect(wmOperatorType *ot) ot->description = "Connect 2 vertices of a face by an edge, splitting the face in two"; /* api callbacks */ - ot->exec = edbm_vert_connect; + ot->exec = edbm_vert_connect_exec; ot->poll = ED_operator_editmesh; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } + +static int edbm_vert_connect_nonplaner_exec(bContext *C, wmOperator *op) +{ + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BKE_editmesh_from_object(obedit); + + const float angle_limit = RNA_float_get(op->ptr, "angle_limit"); + + if (!EDBM_op_call_and_selectf( + em, op, + "faces.out", true, + "connect_verts_nonplanar faces=%hf angle_limit=%f", + BM_ELEM_SELECT, angle_limit)) + { + return OPERATOR_CANCELLED; + } + + + EDBM_update_generic(em, true, true); + return OPERATOR_FINISHED; +} + +void MESH_OT_vert_connect_nonplanar(wmOperatorType *ot) +{ + PropertyRNA *prop; + + /* identifiers */ + ot->name = "Split Non-Planar Faces"; + ot->idname = "MESH_OT_vert_connect_nonplanar"; + ot->description = "Split non-planar faces that exceed the angle threshold"; + + /* api callbacks */ + ot->exec = edbm_vert_connect_nonplaner_exec; + ot->poll = ED_operator_editmesh; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* props */ + prop = RNA_def_float_rotation(ot->srna, "angle_limit", 0, NULL, 0.0f, DEG2RADF(180.0f), + "Max Angle", "Angle limit", 0.0f, DEG2RADF(180.0f)); + RNA_def_property_float_default(prop, DEG2RADF(5.0f)); +} + + static int edbm_edge_split_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); @@ -1066,7 +1111,7 @@ static int edbm_normals_make_consistent_exec(bContext *C, wmOperator *op) /* doflip has to do with bmesh_rationalize_normals, it's an internal * thing */ - if (!EDBM_op_callf(em, op, "recalc_face_normals faces=%hf use_face_tag=%b", BM_ELEM_SELECT, true)) + if (!EDBM_op_callf(em, op, "recalc_face_normals faces=%hf", BM_ELEM_SELECT)) return OPERATOR_CANCELLED; if (RNA_boolean_get(op->ptr, "inside")) @@ -1622,6 +1667,7 @@ static int edbm_merge_exec(bContext *C, wmOperator *op) break; default: BLI_assert(0); + break; } if (!ok) { @@ -2276,7 +2322,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op) /* store percentage of edge cut for KNIFE_EXACT here.*/ slot_edge_percents = BMO_slot_get(bmop.slots_in, "edge_percents"); - for (be = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL); be; be = BM_iter_step(&iter)) { + BM_ITER_MESH (be, &iter, bm, BM_EDGES_OF_MESH) { bool is_cut = false; if (BM_elem_flag_test(be, BM_ELEM_SELECT)) { const float *sco_a = screen_vert_coords[BM_elem_index_get(be->v1)]; @@ -2751,15 +2797,56 @@ void MESH_OT_fill_grid(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } +static int edbm_fill_holes_exec(bContext *C, wmOperator *op) +{ + Object *obedit = CTX_data_edit_object(C); + BMEditMesh *em = BKE_editmesh_from_object(obedit); + const int sides = RNA_int_get(op->ptr, "sides"); + + if (!EDBM_op_call_and_selectf( + em, op, + "faces.out", true, + "holes_fill edges=%he sides=%i", + BM_ELEM_SELECT, sides)) + { + return OPERATOR_CANCELLED; + } + + EDBM_update_generic(em, true, true); + + return OPERATOR_FINISHED; + +} + +void MESH_OT_fill_holes(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Fill Holes"; + ot->idname = "MESH_OT_fill_holes"; + ot->description = "Fill in holes (boundary edge loops)"; + + /* api callbacks */ + ot->exec = edbm_fill_holes_exec; + ot->poll = ED_operator_editmesh; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + RNA_def_int(ot->srna, "sides", 4, 0, INT_MAX, "Sides", "Number of sides (zero disables)", 0, 100); +} static int edbm_beautify_fill_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); - if (!EDBM_op_callf(em, op, "beautify_fill faces=%hf edges=ae", BM_ELEM_SELECT)) + if (!EDBM_op_call_and_selectf( + em, op, "geom.out", true, + "beautify_fill faces=%hf edges=ae", + BM_ELEM_SELECT)) + { return OPERATOR_CANCELLED; + } EDBM_update_generic(em, true, true); @@ -2854,11 +2941,14 @@ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op) EDBM_op_init(em, &bmop, op, "triangulate faces=%hf use_beauty=%b", BM_ELEM_SELECT, use_beauty); BMO_op_exec(em->bm, &bmop); + BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true); + /* now call beauty fill */ if (use_beauty) { - EDBM_op_callf(em, op, - "beautify_fill faces=%S edges=%S", - &bmop, "faces.out", &bmop, "edges.out"); + EDBM_op_call_and_selectf( + em, op, "geom.out", true, + "beautify_fill faces=%S edges=%S", + &bmop, "faces.out", &bmop, "edges.out"); } if (!EDBM_op_finish(em, &bmop, op, true)) { @@ -2900,9 +2990,11 @@ static int edbm_tris_convert_to_quads_exec(bContext *C, wmOperator *op) dovcols = RNA_boolean_get(op->ptr, "vcols"); domaterials = RNA_boolean_get(op->ptr, "materials"); - if (!EDBM_op_callf(em, op, - "join_triangles faces=%hf limit=%f cmp_sharp=%b cmp_uvs=%b cmp_vcols=%b cmp_materials=%b", - BM_ELEM_SELECT, limit, dosharp, douvs, dovcols, domaterials)) + if (!EDBM_op_call_and_selectf( + em, op, + "faces.out", true, + "join_triangles faces=%hf limit=%f cmp_sharp=%b cmp_uvs=%b cmp_vcols=%b cmp_materials=%b", + BM_ELEM_SELECT, limit, dosharp, douvs, dovcols, domaterials)) { return OPERATOR_CANCELLED; } @@ -3093,12 +3185,10 @@ static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op) dissolve_flag = BM_ELEM_SELECT; } - if (!EDBM_op_callf(em, op, - "dissolve_limit edges=%he verts=%hv angle_limit=%f use_dissolve_boundaries=%b delimit=%i", - dissolve_flag, dissolve_flag, angle_limit, use_dissolve_boundaries, delimit)) - { - return OPERATOR_CANCELLED; - } + EDBM_op_call_and_selectf( + em, op, "region.out", true, + "dissolve_limit edges=%he verts=%hv angle_limit=%f use_dissolve_boundaries=%b delimit=%i", + dissolve_flag, dissolve_flag, angle_limit, use_dissolve_boundaries, delimit); EDBM_update_generic(em, true, true); @@ -3935,6 +4025,7 @@ static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op) const bool use_cyclic = (type == 1); const bool use_merge = RNA_boolean_get(op->ptr, "use_merge"); const float merge_factor = RNA_float_get(op->ptr, "merge_factor"); + const int twist_offset = RNA_int_get(op->ptr, "twist_offset"); const bool use_faces = (em->bm->totfacesel != 0); char edge_hflag; @@ -3962,8 +4053,8 @@ static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op) } EDBM_op_init(em, &bmop, op, - "bridge_loops edges=%he use_pairs=%b use_cyclic=%b use_merge=%b merge_factor=%f", - edge_hflag, use_pairs, use_cyclic, use_merge, merge_factor); + "bridge_loops edges=%he use_pairs=%b use_cyclic=%b use_merge=%b merge_factor=%f twist_offset=%i", + edge_hflag, use_pairs, use_cyclic, use_merge, merge_factor, twist_offset); BMO_op_exec(em->bm, &bmop); @@ -3990,14 +4081,23 @@ static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op) mesh_operator_edgering_props_get(op, &op_props); if (op_props.cuts) { + BMOperator bmop_subd; /* we only need face normals updated */ EDBM_mesh_normals_update(em); - BMO_op_callf(em->bm, BMO_FLAG_DEFAULTS, - "subdivide_edgering edges=%S interp_mode=%i cuts=%i smooth=%f " - "profile_shape=%i profile_shape_factor=%f", - &bmop, "edges.out", op_props.interp_mode, op_props.cuts, op_props.smooth, - op_props.profile_shape, op_props.profile_shape_factor); + BMO_op_initf( + em->bm, &bmop_subd, op->flag, + "subdivide_edgering edges=%S interp_mode=%i cuts=%i smooth=%f " + "profile_shape=%i profile_shape_factor=%f", + &bmop, "edges.out", op_props.interp_mode, op_props.cuts, op_props.smooth, + op_props.profile_shape, op_props.profile_shape_factor + ); + BMO_op_exec(em->bm, &bmop_subd); + + BMO_slot_buffer_hflag_enable(em->bm, bmop_subd.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true); + + BMO_op_finish(em->bm, &bmop_subd); + } } } @@ -4007,8 +4107,9 @@ static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op) } if (!EDBM_op_finish(em, &bmop, op, true)) { - return OPERATOR_CANCELLED; - + /* grr, need to return finished so the user can select different options */ + //return OPERATOR_CANCELLED; + return OPERATOR_FINISHED; } else { EDBM_update_generic(em, true, true); @@ -4042,6 +4143,7 @@ void MESH_OT_bridge_edge_loops(wmOperatorType *ot) RNA_def_boolean(ot->srna, "use_merge", false, "Merge", "Merge rather than creating faces"); RNA_def_float(ot->srna, "merge_factor", 0.5f, 0.0f, 1.0f, "Merge Factor", "", 0.0f, 1.0f); + RNA_def_int(ot->srna, "twist_offset", 0, -1000, 1000, "Twist", "Twist offset for closed loops", -1000, 1000); mesh_operator_edgering_props(ot, 0); } @@ -4380,7 +4482,7 @@ void MESH_OT_symmetry_snap(struct wmOperatorType *ot) #ifdef WITH_FREESTYLE -static int edbm_mark_freestyle_edge(bContext *C, wmOperator *op) +static int edbm_mark_freestyle_edge_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); Mesh *me = (Mesh *)obedit->data; @@ -4433,7 +4535,7 @@ void MESH_OT_mark_freestyle_edge(wmOperatorType *ot) ot->idname = "MESH_OT_mark_freestyle_edge"; /* api callbacks */ - ot->exec = edbm_mark_freestyle_edge; + ot->exec = edbm_mark_freestyle_edge_exec; ot->poll = ED_operator_editmesh; /* flags */ diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index effbe3a619d..44cc89cb23c 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -35,7 +35,7 @@ #include "DNA_object_types.h" #include "BLI_math.h" -#include "BLI_array.h" +#include "BLI_alloca.h" #include "BKE_DerivedMesh.h" #include "BKE_context.h" @@ -171,6 +171,13 @@ void EDBM_stats_update(BMEditMesh *em) } } +DerivedMesh *EDBM_mesh_deform_dm_get(BMEditMesh *em) +{ + return ((em->derivedFinal != NULL) && + (em->derivedFinal->type == DM_TYPE_EDITBMESH) && + (em->derivedFinal->deformedOnly != false)) ? em->derivedFinal : NULL; +} + bool EDBM_op_init(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const char *fmt, ...) { BMesh *bm = em->bm; @@ -263,7 +270,9 @@ bool EDBM_op_callf(BMEditMesh *em, wmOperator *op, const char *fmt, ...) return EDBM_op_finish(em, &bmop, op, true); } -bool EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, const char *select_slot_out, const char *fmt, ...) +bool EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, + const char *select_slot_out, const bool select_extend, + const char *fmt, ...) { BMOpSlot *slot_select_out; BMesh *bm = em->bm; @@ -287,8 +296,11 @@ bool EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, const char *select slot_select_out = BMO_slot_get(bmop.slots_out, select_slot_out); hflag = slot_select_out->slot_subtype.elem & BM_ALL_NOLOOP; + BLI_assert(hflag != 0); - BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false); + if (select_extend == false) { + BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false); + } BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, select_slot_out, hflag, BM_ELEM_SELECT, true); @@ -334,7 +346,7 @@ void EDBM_selectmode_to_scene(bContext *C) WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, scene); } -void EDBM_mesh_make(ToolSettings *ts, Scene *UNUSED(scene), Object *ob) +void EDBM_mesh_make(ToolSettings *ts, Object *ob) { Mesh *me = ob->data; BMesh *bm; @@ -361,8 +373,10 @@ void EDBM_mesh_make(ToolSettings *ts, Scene *UNUSED(scene), Object *ob) me->edit_btmesh->selectmode = me->edit_btmesh->bm->selectmode = ts->selectmode; me->edit_btmesh->mat_nr = (ob->actcol > 0) ? ob->actcol - 1 : 0; - me->edit_btmesh->ob = ob; + + /* we need to flush selection because the mode may have changed from when last in editmode */ + EDBM_selectmode_flush(me->edit_btmesh); } void EDBM_mesh_load(Object *ob) diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 21fe51c03ef..e8cbf0926d4 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -37,8 +37,8 @@ #include "DNA_view3d_types.h" #include "BLI_utildefines.h" +#include "BLI_alloca.h" #include "BLI_path_util.h" -#include "BLI_array.h" #include "BLI_math.h" #include "BKE_context.h" @@ -116,6 +116,7 @@ static CustomData *mesh_customdata_get_type(Mesh *me, const char htype, int *r_t BLI_assert(0); tot = 0; data = NULL; + break; } *r_tot = tot; @@ -125,98 +126,22 @@ static CustomData *mesh_customdata_get_type(Mesh *me, const char htype, int *r_t #define GET_CD_DATA(me, data) (me->edit_btmesh ? &me->edit_btmesh->bm->data : &me->data) static void delete_customdata_layer(Mesh *me, CustomDataLayer *layer) { + const int type = layer->type; CustomData *data; - void *actlayerdata, *rndlayerdata, *clonelayerdata, *stencillayerdata, *layerdata = layer->data; - int type = layer->type; - int index; - int i, actindex, rndindex, cloneindex, stencilindex, tot; + int layer_index, tot, n; - if (layer->type == CD_MLOOPCOL || layer->type == CD_MLOOPUV) { - data = mesh_customdata_get_type(me, BM_LOOP, &tot); - } - else { - data = mesh_customdata_get_type(me, BM_FACE, &tot); - } - - index = CustomData_get_layer_index(data, type); - - /* ok, deleting a non-active layer needs to preserve the active layer indices. - * to do this, we store a pointer to the .data member of both layer and the active layer, - * (to detect if we're deleting the active layer or not), then use the active - * layer data pointer to find where the active layer has ended up. - * - * this is necessary because the deletion functions only support deleting the active - * layer. */ - actlayerdata = data->layers[CustomData_get_active_layer_index(data, type)].data; - rndlayerdata = data->layers[CustomData_get_render_layer_index(data, type)].data; - clonelayerdata = data->layers[CustomData_get_clone_layer_index(data, type)].data; - stencillayerdata = data->layers[CustomData_get_stencil_layer_index(data, type)].data; - CustomData_set_layer_active(data, type, layer - &data->layers[index]); + data = mesh_customdata_get_type(me, (ELEM(type, CD_MLOOPUV, CD_MLOOPCOL)) ? BM_LOOP : BM_FACE, &tot); + layer_index = CustomData_get_layer_index(data, type); + n = (layer - &data->layers[layer_index]); + BLI_assert(n >= 0 && (n + layer_index) < data->totlayer); if (me->edit_btmesh) { - BM_data_layer_free(me->edit_btmesh->bm, data, type); + BM_data_layer_free_n(me->edit_btmesh->bm, data, type, n); } else { - CustomData_free_layer_active(data, type, tot); + CustomData_free_layer(data, type, tot, layer_index + n); BKE_mesh_update_customdata_pointers(me, true); } - - /* reconstruct active layer */ - if (actlayerdata != layerdata) { - /* find index */ - actindex = CustomData_get_layer_index(data, type); - for (i = actindex; i < data->totlayer; i++) { - if (data->layers[i].data == actlayerdata) { - actindex = i - actindex; - break; - } - } - - /* set index */ - CustomData_set_layer_active(data, type, actindex); - } - - if (rndlayerdata != layerdata) { - /* find index */ - rndindex = CustomData_get_layer_index(data, type); - for (i = rndindex; i < data->totlayer; i++) { - if (data->layers[i].data == rndlayerdata) { - rndindex = i - rndindex; - break; - } - } - - /* set index */ - CustomData_set_layer_render(data, type, rndindex); - } - - if (clonelayerdata != layerdata) { - /* find index */ - cloneindex = CustomData_get_layer_index(data, type); - for (i = cloneindex; i < data->totlayer; i++) { - if (data->layers[i].data == clonelayerdata) { - cloneindex = i - cloneindex; - break; - } - } - - /* set index */ - CustomData_set_layer_clone(data, type, cloneindex); - } - - if (stencillayerdata != layerdata) { - /* find index */ - stencilindex = CustomData_get_layer_index(data, type); - for (i = stencilindex; i < data->totlayer; i++) { - if (data->layers[i].data == stencillayerdata) { - stencilindex = i - stencilindex; - break; - } - } - - /* set index */ - CustomData_set_layer_stencil(data, type, stencilindex); - } } static void mesh_uv_reset_array(float **fuv, const int len) @@ -642,7 +567,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, const wmEvent *e obedit = base->object; me = obedit->data; if (me->edit_btmesh == NULL) { - EDBM_mesh_make(scene->toolsettings, scene, obedit); + EDBM_mesh_make(scene->toolsettings, obedit); exitmode = 1; } if (me->edit_btmesh == NULL) diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 69f471670ed..b2d6e872206 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -59,7 +59,8 @@ struct LinkNode; /* Calls a bmesh op, reporting errors to the user, etc */ bool EDBM_op_callf(struct BMEditMesh *em, struct wmOperator *op, const char *fmt, ...); bool EDBM_op_call_and_selectf(struct BMEditMesh *em, struct wmOperator *op, - const char *selectslot, const char *fmt, ...); + const char *select_slot, const bool select_replace, + const char *fmt, ...); /* Same as above, but doesn't report errors.*/ bool EDBM_op_call_silentf(struct BMEditMesh *em, const char *fmt, ...); @@ -165,6 +166,7 @@ void MESH_OT_normals_make_consistent(struct wmOperatorType *ot); void MESH_OT_vertices_smooth(struct wmOperatorType *ot); void MESH_OT_vertices_smooth_laplacian(struct wmOperatorType *ot); void MESH_OT_vert_connect(struct wmOperatorType *ot); +void MESH_OT_vert_connect_nonplanar(struct wmOperatorType *ot); void MESH_OT_edge_split(struct wmOperatorType *ot); void MESH_OT_bridge_edge_loops(struct wmOperatorType *ot); void MESH_OT_wireframe(struct wmOperatorType *ot); @@ -195,6 +197,7 @@ void MESH_OT_knife_cut(struct wmOperatorType *ot); void MESH_OT_separate(struct wmOperatorType *ot); void MESH_OT_fill(struct wmOperatorType *ot); void MESH_OT_fill_grid(struct wmOperatorType *ot); +void MESH_OT_fill_holes(struct wmOperatorType *ot); void MESH_OT_beautify_fill(struct wmOperatorType *ot); void MESH_OT_quads_convert_to_tris(struct wmOperatorType *ot); void MESH_OT_tris_convert_to_quads(struct wmOperatorType *ot); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 4f2924293ea..90dc803ea50 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -102,6 +102,7 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_fill); WM_operatortype_append(MESH_OT_fill_grid); + WM_operatortype_append(MESH_OT_fill_holes); WM_operatortype_append(MESH_OT_beautify_fill); WM_operatortype_append(MESH_OT_quads_convert_to_tris); WM_operatortype_append(MESH_OT_tris_convert_to_quads); @@ -155,6 +156,7 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_solidify); WM_operatortype_append(MESH_OT_select_nth); WM_operatortype_append(MESH_OT_vert_connect); + WM_operatortype_append(MESH_OT_vert_connect_nonplanar); WM_operatortype_append(MESH_OT_knife_tool); WM_operatortype_append(MESH_OT_knife_project); diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 51b5e30bc3f..059f8de7108 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -88,9 +88,10 @@ int join_mesh_exec(bContext *C, wmOperator *op) Key *key, *nkey = NULL; KeyBlock *kb, *okb, *kbn; float imat[4][4], cmat[4][4], *fp1, *fp2; - int a, b, totcol, totmat = 0, totedge = 0, totvert = 0, ok = 0; + int a, b, totcol, totmat = 0, totedge = 0, totvert = 0; int totloop = 0, totpoly = 0, vertofs, *matmap = NULL; int i, j, index, haskey = 0, edgeofs, loopofs, polyofs; + bool ok = false; bDeformGroup *dg, *odg; MDeformVert *dvert; CustomData vdata, edata, fdata, ldata, pdata; @@ -119,7 +120,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) totmat += base->object->totcol; if (base->object == ob) - ok = 1; + ok = true; /* check for shapekeys */ if (me->key) @@ -129,7 +130,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* that way the active object is always selected */ - if (ok == 0) { + if (ok == false) { BKE_report(op->reports, RPT_WARNING, "Active object is not a selected mesh"); return OPERATOR_CANCELLED; } @@ -569,7 +570,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) ED_object_editmode_exit(C, EM_FREEDATA | EM_WAITCURSOR | EM_DO_UNDO); #else /* toggle editmode using lower level functions so this can be called from python */ - EDBM_mesh_make(scene->toolsettings, scene, ob); + EDBM_mesh_make(scene->toolsettings, ob); EDBM_mesh_load(ob); EDBM_mesh_free(me->edit_btmesh); MEM_freeN(me->edit_btmesh); @@ -1199,7 +1200,7 @@ bool ED_mesh_pick_face(bContext *C, Object *ob, const int mval[2], unsigned int *index = view3d_sample_backbuf(&vc, mval[0], mval[1]); } - if ((*index) <= 0 || (*index) > (unsigned int)me->totpoly) + if ((*index) == 0 || (*index) > (unsigned int)me->totpoly) return false; (*index)--; @@ -1320,7 +1321,7 @@ bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int *index = view3d_sample_backbuf(&vc, mval[0], mval[1]); } - if ((*index) <= 0 || (*index) > (unsigned int)me->totvert) + if ((*index) == 0 || (*index) > (unsigned int)me->totvert) return false; (*index)--; @@ -1350,7 +1351,7 @@ bool ED_mesh_pick_vert(bContext *C, Object *ob, const int mval[2], unsigned int data.len_best = FLT_MAX; data.v_idx_best = -1; - dm->foreachMappedVert(dm, ed_mesh_pick_vert__mapFunc, &data); + dm->foreachMappedVert(dm, ed_mesh_pick_vert__mapFunc, &data, DM_FOREACH_NOP); dm->release(dm); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index d6f48b4d350..ce61b4fce50 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -226,7 +226,7 @@ float ED_object_new_primitive_matrix(bContext *C, Object *obedit, return dia; } - return 1.0f; + // return 1.0f; } /********************* Add Object Operator ********************/ @@ -265,6 +265,7 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float loc[3], fl bool *enter_editmode, unsigned int *layer, bool *is_view_aligned) { View3D *v3d = CTX_wm_view3d(C); + unsigned int _layer; /* Switch to Edit mode? */ if (RNA_struct_find_property(op->ptr, "enter_editmode")) { /* optional */ @@ -283,7 +284,6 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float loc[3], fl /* Get layers! */ { int a, layer_values[20]; - unsigned int _layer; if (!layer) layer = &_layer; @@ -342,7 +342,7 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float loc[3], fl else if (RNA_struct_property_is_set(op->ptr, "view_align")) *is_view_aligned = RNA_boolean_get(op->ptr, "view_align"); else { - *is_view_aligned = U.flag & USER_ADD_VIEWALIGNED; + *is_view_aligned = (U.flag & USER_ADD_VIEWALIGNED) != 0; RNA_boolean_set(op->ptr, "view_align", *is_view_aligned); } @@ -657,12 +657,12 @@ void OBJECT_OT_text_add(wmOperatorType *ot) static int object_armature_add_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); - View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); bool newob = false; bool enter_editmode; unsigned int layer; float loc[3], rot[3]; + bool view_aligned = rv3d && (U.flag & USER_ADD_VIEWALIGNED); if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL)) return OPERATOR_CANCELLED; @@ -681,8 +681,7 @@ static int object_armature_add_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - /* v3d and rv3d are allowed to be NULL */ - add_primitive_bone(CTX_data_scene(C), v3d, rv3d); + add_primitive_bone(obedit, view_aligned); /* userdef */ if (newob && !enter_editmode) @@ -1432,7 +1431,7 @@ static int convert_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - Base *basen = NULL, *basact = NULL, *basedel = NULL; + Base *basen = NULL, *basact = NULL; Object *ob, *ob1, *newob, *obact = CTX_data_active_object(C); DerivedMesh *dm; Curve *cu; @@ -1688,14 +1687,6 @@ static int convert_exec(bContext *C, wmOperator *op) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); ((ID *)ob->data)->flag &= ~LIB_DOIT; /* flag not to convert this datablock again */ } - - /* delete original if needed */ - if (basedel) { - if (!keep_original) - ED_base_object_free_and_unlink(bmain, scene, basedel); - - basedel = NULL; - } } CTX_DATA_END; diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 3f1ceb7327c..8b674cf1e50 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -107,13 +107,14 @@ typedef struct { int threads; } MultiresBakeJob; -static int multiresbake_check(bContext *C, wmOperator *op) +static bool multiresbake_check(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); Object *ob; Mesh *me; MultiresModifierData *mmd; - int ok = 1, a; + bool ok = true; + int a; CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { @@ -122,7 +123,7 @@ static int multiresbake_check(bContext *C, wmOperator *op) if (ob->type != OB_MESH) { BKE_report(op->reports, RPT_ERROR, "Baking of multires data only works with an active mesh object"); - ok = 0; + ok = false; break; } @@ -137,12 +138,12 @@ static int multiresbake_check(bContext *C, wmOperator *op) for (md = (ModifierData *)mmd->modifier.next; md && ok; md = md->next) { if (modifier_isEnabled(scene, md, eModifierMode_Realtime)) { - ok = 0; + ok = false; } } } else { - ok = 0; + ok = false; } if (!ok) { @@ -153,14 +154,14 @@ static int multiresbake_check(bContext *C, wmOperator *op) if (mmd->lvl == 0) { BKE_report(op->reports, RPT_ERROR, "Multires data baking is not supported for preview subdivision level 0"); - + ok = false; break; } if (!me->mtpoly) { BKE_report(op->reports, RPT_ERROR, "Mesh should be unwrapped before multires data baking"); - ok = 0; + ok = false; } else { a = me->totpoly; @@ -170,7 +171,7 @@ static int multiresbake_check(bContext *C, wmOperator *op) if (!ima) { BKE_report(op->reports, RPT_ERROR, "You should have active texture to use multires baker"); - ok = 0; + ok = false; } else { ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL); @@ -178,14 +179,14 @@ static int multiresbake_check(bContext *C, wmOperator *op) if (!ibuf) { BKE_report(op->reports, RPT_ERROR, "Baking should happen to image with image buffer"); - ok = 0; + ok = false; } else { if (ibuf->rect == NULL && ibuf->rect_float == NULL) - ok = 0; + ok = false; if (ibuf->rect_float && !(ibuf->channels == 0 || ibuf->channels == 4)) - ok = 0; + ok = false; if (!ok) BKE_report(op->reports, RPT_ERROR, "Baking to unsupported image type"); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 0a69306928a..aed1d9a1a6c 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -478,7 +478,7 @@ void ED_object_editmode_enter(bContext *C, int flag) ok = 1; scene->obedit = ob; /* context sees this */ - EDBM_mesh_make(CTX_data_tool_settings(C), scene, ob); + EDBM_mesh_make(scene->toolsettings, ob); em = BKE_editmesh_from_object(ob); if (LIKELY(em)) { @@ -1501,36 +1501,38 @@ static const char *object_mode_op_string(int mode) /* checks the mode to be set is compatible with the object * should be made into a generic function */ -static int object_mode_set_compat(bContext *UNUSED(C), wmOperator *op, Object *ob) +static bool object_mode_set_compat(bContext *UNUSED(C), wmOperator *op, Object *ob) { ObjectMode mode = RNA_enum_get(op->ptr, "mode"); if (ob) { if (mode == OB_MODE_OBJECT) - return 1; + return true; switch (ob->type) { case OB_MESH: if (mode & (OB_MODE_EDIT | OB_MODE_SCULPT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT | OB_MODE_PARTICLE_EDIT)) - return 1; - return 0; + return true; + break; case OB_CURVE: case OB_SURF: case OB_FONT: case OB_MBALL: if (mode & (OB_MODE_EDIT)) - return 1; - return 0; + return true; + break; case OB_LATTICE: if (mode & (OB_MODE_EDIT | OB_MODE_WEIGHT_PAINT)) - return 1; + return true; + break; case OB_ARMATURE: if (mode & (OB_MODE_EDIT | OB_MODE_POSE)) - return 1; + return true; + break; } } - return 0; + return false; } static int object_mode_set_exec(bContext *C, wmOperator *op) @@ -1608,7 +1610,7 @@ void ED_object_toggle_modes(bContext *C, int mode) /************************ Game Properties ***********************/ -static int game_property_new(bContext *C, wmOperator *op) +static int game_property_new_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); bProperty *prop; @@ -1638,7 +1640,7 @@ void OBJECT_OT_game_property_new(wmOperatorType *ot) ot->idname = "OBJECT_OT_game_property_new"; /* api callbacks */ - ot->exec = game_property_new; + ot->exec = game_property_new_exec; ot->poll = ED_operator_object_active_editable; /* flags */ @@ -1648,7 +1650,7 @@ void OBJECT_OT_game_property_new(wmOperatorType *ot) RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the game property to add"); } -static int game_property_remove(bContext *C, wmOperator *op) +static int game_property_remove_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); bProperty *prop; @@ -1679,7 +1681,7 @@ void OBJECT_OT_game_property_remove(wmOperatorType *ot) ot->idname = "OBJECT_OT_game_property_remove"; /* api callbacks */ - ot->exec = game_property_remove; + ot->exec = game_property_remove_exec; ot->poll = ED_operator_object_active_editable; /* flags */ diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 1f0163bc391..c8baa0d84dc 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -310,7 +310,7 @@ static bool object_hook_index_array(Scene *scene, Object *obedit, int *tot, int BMEditMesh *em; EDBM_mesh_load(obedit); - EDBM_mesh_make(scene->toolsettings, scene, obedit); + EDBM_mesh_make(scene->toolsettings, obedit); em = me->edit_btmesh; @@ -318,12 +318,10 @@ static bool object_hook_index_array(Scene *scene, Object *obedit, int *tot, int BKE_editmesh_tessface_calc(em); /* check selected vertices first */ - if (return_editmesh_indexar(em, tot, indexar, cent_r)) { - return true; - } - else { + if (return_editmesh_indexar(em, tot, indexar, cent_r) == 0) { return return_editmesh_vgroup(obedit, em, name, cent_r); } + return true; } case OB_CURVE: case OB_SURF: diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 58cca9dca02..4ff3bc9ac06 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -138,7 +138,10 @@ void OBJECT_OT_hook_recenter(struct wmOperatorType *ot); /* object_lattice.c */ void LATTICE_OT_select_all(struct wmOperatorType *ot); +void LATTICE_OT_select_more(struct wmOperatorType *ot); +void LATTICE_OT_select_less(struct wmOperatorType *ot); void LATTICE_OT_select_ungrouped(struct wmOperatorType *ot); +void LATTICE_OT_select_random(struct wmOperatorType *ot); void LATTICE_OT_make_regular(struct wmOperatorType *ot); void LATTICE_OT_flip(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index 0e220357d30..a79b0607421 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -37,6 +37,8 @@ #include "BLI_listbase.h" #include "BLI_math.h" #include "BLI_utildefines.h" +#include "BLI_rand.h" +#include "BLI_bitmap.h" #include "DNA_curve_types.h" #include "DNA_key_types.h" @@ -54,6 +56,7 @@ #include "BKE_lattice.h" #include "BKE_deform.h" #include "BKE_report.h" +#include "BKE_utildefines.h" #include "ED_lattice.h" #include "ED_object.h" @@ -170,6 +173,163 @@ void load_editLatt(Object *obedit) } } +/************************** Select Random Operator **********************/ + +static int lattice_select_random_exec(bContext *C, wmOperator *op) +{ + Object *obedit = CTX_data_edit_object(C); + Lattice *lt = ((Lattice *)obedit->data)->editlatt->latt; + const float randfac = RNA_float_get(op->ptr, "percent") / 100.0f; + int tot; + BPoint *bp; + + if (!RNA_boolean_get(op->ptr, "extend")) { + ED_setflagsLatt(obedit, !SELECT); + } + else { + lt->actbp = LT_ACTBP_NONE; + } + + tot = lt->pntsu * lt->pntsv * lt->pntsw; + bp = lt->def; + while (tot--) { + if (!bp->hide) { + if (BLI_frand() < randfac) { + bp->f1 |= SELECT; + } + } + bp++; + } + + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); + + return OPERATOR_FINISHED; +} + +void LATTICE_OT_select_random(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Select Random"; + ot->description = "Randomly select UVW control points"; + ot->idname = "LATTICE_OT_select_random"; + + /* api callbacks */ + ot->exec = lattice_select_random_exec; + ot->poll = ED_operator_editlattice; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* props */ + RNA_def_float_percentage(ot->srna, "percent", 50.f, 0.0f, 100.0f, + "Percent", "Percentage of elements to select randomly", 0.f, 100.0f); + RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection"); +} + +/************************** Select More/Less Operator *************************/ + +static bool lattice_test_bitmap_uvw(Lattice *lt, BLI_bitmap *selpoints, int u, int v, int w, const bool selected) +{ + if ((u < 0 || u >= lt->pntsu) || + (v < 0 || v >= lt->pntsv) || + (w < 0 || w >= lt->pntsw)) + { + return false; + } + else { + int i = BKE_lattice_index_from_uvw(lt, u, v, w); + if (lt->def[i].hide == 0) { + return (BLI_BITMAP_GET(selpoints, i) != 0) == selected; + } + return false; + } +} + +static int lattice_select_more_less(bContext *C, const bool select) +{ + Object *obedit = CTX_data_edit_object(C); + Lattice *lt = ((Lattice *)obedit->data)->editlatt->latt; + BPoint *bp; + const int tot = lt->pntsu * lt->pntsv * lt->pntsw; + int i, w, u, v; + BLI_bitmap *selpoints; + + lt->actbp = LT_ACTBP_NONE; + + bp = lt->def; + selpoints = BLI_BITMAP_NEW(tot, __func__); + for (i = 0; i < tot; i++, bp++) { + if (bp->f1 & SELECT) { + BLI_BITMAP_SET(selpoints, i); + } + } + + bp = lt->def; + for (w = 0; w < lt->pntsw; w++) { + for (v = 0; v < lt->pntsv; v++) { + for (u = 0; u < lt->pntsu; u++) { + if ((bp->hide == 0) && (((bp->f1 & SELECT) == 0) == select)) { + if (lattice_test_bitmap_uvw(lt, selpoints, u + 1, v, w, select) || + lattice_test_bitmap_uvw(lt, selpoints, u - 1, v, w, select) || + lattice_test_bitmap_uvw(lt, selpoints, u, v + 1, w, select) || + lattice_test_bitmap_uvw(lt, selpoints, u, v - 1, w, select) || + lattice_test_bitmap_uvw(lt, selpoints, u, v, w + 1, select) || + lattice_test_bitmap_uvw(lt, selpoints, u, v, w - 1, select)) + { + BKE_BIT_TEST_SET(bp->f1, select, SELECT); + } + } + bp++; + } + } + } + + MEM_freeN(selpoints); + + WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); + return OPERATOR_FINISHED; +} + +static int lattice_select_more_exec(bContext *C, wmOperator *UNUSED(op)) +{ + return lattice_select_more_less(C, true); +} + +static int lattice_select_less_exec(bContext *C, wmOperator *UNUSED(op)) +{ + return lattice_select_more_less(C, false); +} + +void LATTICE_OT_select_more(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Select More"; + ot->description = "Select vertex directly linked to already selected ones"; + ot->idname = "LATTICE_OT_select_more"; + + /* api callbacks */ + ot->exec = lattice_select_more_exec; + ot->poll = ED_operator_editlattice; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + +void LATTICE_OT_select_less(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Select Less"; + ot->description = "Deselect vertices at the boundary of each selection region"; + ot->idname = "LATTICE_OT_select_less"; + + /* api callbacks */ + ot->exec = lattice_select_less_exec; + ot->poll = ED_operator_editlattice; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + /************************** Select All Operator *************************/ void ED_setflagsLatt(Object *obedit, int flag) @@ -510,8 +670,8 @@ static int lattice_flip_exec(bContext *C, wmOperator *op) } } } + break; } - break; case LATTICE_FLIP_V: { int u, v, w; @@ -531,8 +691,8 @@ static int lattice_flip_exec(bContext *C, wmOperator *op) } } } + break; } - break; case LATTICE_FLIP_W: { int u, v, w; @@ -551,9 +711,8 @@ static int lattice_flip_exec(bContext *C, wmOperator *op) } } } + break; } - break; - default: /* shouldn't happen, but just in case */ break; } diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index b1f1f73f493..b9c97c32fc9 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -1671,7 +1671,7 @@ void OBJECT_OT_skin_radii_equalize(wmOperatorType *ot) static void skin_armature_bone_create(Object *skin_ob, MVert *mvert, MEdge *medge, bArmature *arm, - BLI_bitmap edges_visited, + BLI_bitmap *edges_visited, const MeshElemMap *emap, EditBone *parent_bone, int parent_v) @@ -1720,7 +1720,7 @@ static void skin_armature_bone_create(Object *skin_ob, static Object *modifier_skin_armature_create(Main *bmain, Scene *scene, Object *skin_ob) { - BLI_bitmap edges_visited; + BLI_bitmap *edges_visited; DerivedMesh *deform_dm; MVert *mvert; Mesh *me = skin_ob->data; diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 35bfba8b78a..333e5ff3006 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -217,7 +217,10 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_shape_key_move); WM_operatortype_append(LATTICE_OT_select_all); + WM_operatortype_append(LATTICE_OT_select_more); + WM_operatortype_append(LATTICE_OT_select_less); WM_operatortype_append(LATTICE_OT_select_ungrouped); + WM_operatortype_append(LATTICE_OT_select_random); WM_operatortype_append(LATTICE_OT_make_regular); WM_operatortype_append(LATTICE_OT_flip); @@ -427,6 +430,8 @@ void ED_keymap_object(wmKeyConfig *keyconf) RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE); kmi = WM_keymap_add_item(keymap, "LATTICE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0); RNA_enum_set(kmi->ptr, "action", SEL_INVERT); + WM_keymap_add_item(keymap, "LATTICE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "LATTICE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "OBJECT_OT_vertex_parent_set", PKEY, KM_PRESS, KM_CTRL, 0); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 75c1f956f1b..52f51cfcf48 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -136,7 +136,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) BMEditMesh *em; EDBM_mesh_load(obedit); - EDBM_mesh_make(scene->toolsettings, scene, obedit); + EDBM_mesh_make(scene->toolsettings, obedit); em = me->edit_btmesh; @@ -494,23 +494,21 @@ void ED_object_parent_clear(Object *ob, int type) /* clear parenting relationship completely */ ob->parent = NULL; + break; } - break; - case CLEAR_PARENT_KEEP_TRANSFORM: { /* remove parent, and apply the parented transform result as object's local transforms */ ob->parent = NULL; BKE_object_apply_mat4(ob, ob->obmat, TRUE, FALSE); + break; } - break; - case CLEAR_PARENT_INVERSE: { /* object stays parented, but the parent inverse (i.e. offset from parent to retain binding state) is cleared */ unit_m4(ob->parentinv); + break; } - break; } DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); @@ -2051,7 +2049,7 @@ static int make_local_exec(bContext *C, wmOperator *op) if (adt) BKE_animdata_make_local(adt); /* tag indirect data direct */ - matarar = (Material ***)give_matarar(ob); + matarar = give_matarar(ob); if (matarar) { for (a = 0; a < ob->totcol; a++) { ma = (*matarar)[a]; diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 424333810a8..366aa72f2b8 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -682,12 +682,17 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); + Object *obact = CTX_data_active_object(C); Object *obedit = CTX_data_edit_object(C); Object *tob; float cursor[3], cent[3], cent_neg[3], centn[3]; int centermode = RNA_enum_get(op->ptr, "type"); int around = RNA_enum_get(op->ptr, "center"); /* initialized from v3d->around */ + ListBase ctx_data_list; + CollectionPointerLink *ctx_ob; + CollectionPointerLink *ctx_ob_act = NULL; + /* keep track of what is changed */ int tot_change = 0, tot_lib_error = 0, tot_multiuser_arm_error = 0; @@ -746,12 +751,25 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) } } + CTX_data_selected_editable_objects(C, &ctx_data_list); + /* reset flags */ - CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) + for (ctx_ob = ctx_data_list.first; + ctx_ob; + ctx_ob = ctx_ob->next) { + Object *ob = ctx_ob->ptr.data; ob->flag &= ~OB_DONE; + + /* move active first */ + if (ob == obact) { + ctx_ob_act = ctx_ob; + } + } + + if (ctx_ob_act) { + BLI_rotatelist(&ctx_data_list, (LinkData *)ctx_ob_act); } - CTX_DATA_END; for (tob = bmain->object.first; tob; tob = tob->id.next) { if (tob->data) @@ -760,8 +778,12 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) ((ID *)tob->dup_group)->flag &= ~LIB_DOIT; } - CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) + for (ctx_ob = ctx_data_list.first; + ctx_ob; + ctx_ob = ctx_ob->next) { + Object *ob = ctx_ob->ptr.data; + if ((ob->flag & OB_DONE) == 0) { int do_inverse_offset = FALSE; ob->flag |= OB_DONE; @@ -992,7 +1014,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) } } } - CTX_DATA_END; + BLI_freelistN(&ctx_data_list); for (tob = bmain->object.first; tob; tob = tob->id.next) if (tob->data && (((ID *)tob->data)->flag & LIB_DOIT)) diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index da46001bde9..9b3f1a4f3ac 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -109,6 +109,22 @@ static Lattice *vgroup_edit_lattice(Object *ob) return (lt->editlatt) ? lt->editlatt->latt : lt; } +bool ED_vgroup_sync_from_pose(Object *ob) +{ + Object *armobj = BKE_object_pose_armature_get(ob); + if (armobj && (armobj->mode & OB_MODE_POSE)) { + struct bArmature *arm = armobj->data; + if (arm->act_bone) { + int def_num = defgroup_name_index(ob, arm->act_bone->name); + if (def_num != -1) { + ob->actdef = def_num + 1; + return true; + } + } + } + return false; +} + bool ED_vgroup_object_is_edit_mode(Object *ob) { if (ob->type == OB_MESH) @@ -125,13 +141,8 @@ bDeformGroup *ED_vgroup_add_name(Object *ob, const char *name) if (!ob || !OB_TYPE_SUPPORT_VGROUP(ob->type)) return NULL; - - defgroup = MEM_callocN(sizeof(bDeformGroup), "add deformGroup"); - BLI_strncpy(defgroup->name, name, sizeof(defgroup->name)); - - BLI_addtail(&ob->defbase, defgroup); - defgroup_unique_name(defgroup, ob); + defgroup = BKE_defgroup_new(ob, name); ob->actdef = BLI_countlist(&ob->defbase); @@ -279,9 +290,7 @@ static bool ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_t return true; } - else { - return false; - } + return false; } case ID_LT: { @@ -309,9 +318,7 @@ static bool ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_t return true; } - else { - return false; - } + return false; } } } @@ -754,15 +761,14 @@ static bool ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGro unsigned int f_index; float weight, tmp_weight[4], tmp_co[3], normal[3], tmp_mat[4][4], dist_v1, dist_v2, dist_v3, dist_v4; const int use_vert_sel = vertex_group_use_vert_sel(ob_dst); + bool is_dg_dst_new = false; /* Ensure vertex group on target.*/ - if (!defgroup_find_name(ob_dst, dg_src->name)) { - ED_vgroup_add_name(ob_dst, dg_src->name); + if ((dg_dst = defgroup_find_name(ob_dst, dg_src->name)) == NULL) { + dg_dst = BKE_defgroup_new(ob_dst, dg_src->name); + is_dg_dst_new = true; } - /* Get destination deformgroup.*/ - dg_dst = defgroup_find_name(ob_dst, dg_src->name); - /* Get meshes.*/ dmesh_src = mesh_get_derived_deform(scene, ob_src, CD_MASK_BAREMESH); me_dst = ob_dst->data; @@ -812,7 +818,10 @@ static bool ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGro if (ob_dst == ob_src || dv_tot_dst == 0 || dv_tot_dst != dv_tot_src || dv_array_src == NULL || dv_array_dst == NULL) { - ED_vgroup_delete(ob_dst, defgroup_find_name(ob_dst, dg_dst->name)); + if (is_dg_dst_new) { + ED_vgroup_delete(ob_dst, dg_dst); + } + if (dv_array_src) MEM_freeN(dv_array_src); if (dv_array_dst) MEM_freeN(dv_array_dst); dmesh_src->release(dmesh_src); @@ -909,18 +918,16 @@ static bool ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGro project_v3_plane(tmp_co, normal, mv_src[mf->v1].co); /* Interpolate weights over face.*/ - f_index = mf->v4 ? 3 : 2; - if (f_index == 3) { - interp_weights_face_v3(tmp_weight, mv_src[mf->v1].co, mv_src[mf->v2].co, - mv_src[mf->v3].co, mv_src[mf->v4].co, tmp_co); - } - else { - interp_weights_face_v3(tmp_weight, mv_src[mf->v1].co, mv_src[mf->v2].co, - mv_src[mf->v3].co, NULL, tmp_co); - } + interp_weights_face_v3(tmp_weight, + mv_src[mf->v1].co, + mv_src[mf->v2].co, + mv_src[mf->v3].co, + mf->v4 ? mv_src[mf->v4].co : NULL, + tmp_co); /* Get weights from face.*/ - weight = 0; + f_index = mf->v4 ? 3 : 2; + weight = 0.0f; do { v_index = (&mf->v1)[f_index]; weight += tmp_weight[f_index] * defvert_find_weight(dv_array_src[v_index], index_src); @@ -928,7 +935,7 @@ static bool ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGro /* Copy weight that are not NULL including weight value 0. In relevant cases, existing weights are * overwritten prior to this. See the "Clear weights." step above.*/ - if (weight > 0) { + if (weight > 0.0f) { dw_dst = defvert_verify_index(*dv_dst, index_dst); vgroup_transfer_weight(&dw_dst->weight, weight, replace_mode); } @@ -1087,6 +1094,7 @@ static void ED_vgroup_nr_vert_add(Object *ob, /* we checked if the vertex was added before so no need to test again, simply add */ defvert_add_index_notest(dv, def_nr, weight); + break; } } } @@ -2917,6 +2925,17 @@ static int vertex_group_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; + + return (ob && !ob->id.lib && + data && !data->lib && + OB_TYPE_SUPPORT_VGROUP(ob->type) && + ob->defbase.first); +} + +static int vertex_group_supported_poll(bContext *C) +{ + Object *ob = ED_object_context(C); + ID *data = (ob) ? ob->data : NULL; return (ob && !ob->id.lib && OB_TYPE_SUPPORT_VGROUP(ob->type) && data && !data->lib); } @@ -2924,9 +2943,21 @@ static int vertex_group_mesh_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; + + return (ob && !ob->id.lib && + data && !data->lib && + ob->type == OB_MESH && + ob->defbase.first); +} + +static int vertex_group_mesh_supported_poll(bContext *C) +{ + Object *ob = ED_object_context(C); + ID *data = (ob) ? ob->data : NULL; return (ob && !ob->id.lib && ob->type == OB_MESH && data && !data->lib); } + static int UNUSED_FUNCTION(vertex_group_poll_edit) (bContext *C) { Object *ob = ED_object_context(C); @@ -2966,7 +2997,7 @@ static int vertex_group_vert_select_unlocked_poll(bContext *C) return 0; } - if (ob->actdef != -1) { + if (ob->actdef != 0) { bDeformGroup *dg = BLI_findlink(&ob->defbase, ob->actdef - 1); if (dg) { return !(dg->flag & DG_LOCK_WEIGHT); @@ -3011,7 +3042,7 @@ void OBJECT_OT_vertex_group_add(wmOperatorType *ot) ot->description = "Add a new vertex group to the active object"; /* api callbacks */ - ot->poll = vertex_group_poll; + ot->poll = vertex_group_supported_poll; ot->exec = vertex_group_add_exec; /* flags */ @@ -3039,7 +3070,7 @@ void OBJECT_OT_vertex_group_remove(wmOperatorType *ot) /* identifiers */ ot->name = "Remove Vertex Group"; ot->idname = "OBJECT_OT_vertex_group_remove"; - ot->description = "Delete the active vertex group"; + ot->description = "Delete the active or all vertex groups from the active object"; /* api callbacks */ ot->poll = vertex_group_poll; @@ -3423,7 +3454,8 @@ void OBJECT_OT_vertex_group_lock(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - RNA_def_enum(ot->srna, "action", vgroup_lock_actions, VGROUP_TOGGLE, "Action", "Lock action to execute on vertex groups"); + RNA_def_enum(ot->srna, "action", vgroup_lock_actions, VGROUP_TOGGLE, "Action", + "Lock action to execute on vertex groups"); } static int vertex_group_invert_exec(bContext *C, wmOperator *op) @@ -3559,7 +3591,7 @@ void OBJECT_OT_vertex_group_clean(wmOperatorType *ot) /* identifiers */ ot->name = "Clean Vertex Group"; ot->idname = "OBJECT_OT_vertex_group_clean"; - ot->description = "Remove Vertex Group assignments which aren't required"; + ot->description = "Remove vertex group assignments which are not required"; /* api callbacks */ ot->poll = vertex_group_poll; @@ -3696,7 +3728,7 @@ void OBJECT_OT_vertex_group_copy_to_linked(wmOperatorType *ot) /* identifiers */ ot->name = "Copy Vertex Groups to Linked"; ot->idname = "OBJECT_OT_vertex_group_copy_to_linked"; - ot->description = "Copy Vertex Groups to all users of the same Geometry data"; + ot->description = "Copy vertex groups to all users of the same geometry data"; /* api callbacks */ ot->poll = vertex_group_poll; @@ -3723,7 +3755,7 @@ static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op) if ((change == 0 && fail == 0) || fail) { BKE_reportf(op->reports, RPT_ERROR, - "Copy VGroups to Selected warning, %d done, %d failed (object data must have matching indices)", + "Copy vertex groups to selected: %d done, %d failed (object data must have matching indices)", change, fail); } @@ -3735,7 +3767,7 @@ void OBJECT_OT_vertex_group_copy_to_selected(wmOperatorType *ot) /* identifiers */ ot->name = "Copy Vertex Group to Selected"; ot->idname = "OBJECT_OT_vertex_group_copy_to_selected"; - ot->description = "Copy Vertex Groups to other selected objects with matching indices"; + ot->description = "Copy vertex groups to other selected objects with matching indices"; /* api callbacks */ ot->poll = vertex_group_poll; @@ -3749,6 +3781,10 @@ static int vertex_group_transfer_weight_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); Object *ob_act = CTX_data_active_object(C); + + bDeformGroup *dg_act = BLI_findlink(&ob_act->defbase, (ob_act->actdef - 1)); + char dg_act_name[MAX_VGROUP_NAME]; /* may be freed so copy */ + int fail = 0; bool change = false; @@ -3756,6 +3792,17 @@ static int vertex_group_transfer_weight_exec(bContext *C, wmOperator *op) WT_Method method = RNA_enum_get(op->ptr, "method"); WT_ReplaceMode replace_mode = RNA_enum_get(op->ptr, "replace_mode"); + if (vertex_group_mode == WT_REPLACE_ACTIVE_VERTEX_GROUP) { + if (!dg_act) { + BKE_report(op->reports, RPT_WARNING, "Failed, active object has no active groups"); + return OPERATOR_FINISHED; /* to get the chance to make changes in the redo panel*/ + } + } + + if (dg_act) { + BLI_strncpy(dg_act_name, dg_act->name, sizeof(dg_act_name)); + } + /* Macro to loop through selected objects and perform operation depending on function, option and method.*/ CTX_DATA_BEGIN (C, Object *, ob_src, selected_editable_objects) { @@ -3767,8 +3814,11 @@ static int vertex_group_transfer_weight_exec(bContext *C, wmOperator *op) continue; } else if (ob_src->type != OB_MESH) { - BKE_reportf(op->reports, RPT_WARNING, - "Skipping object '%s' only copying from meshes is supported", ob_src->id.name + 2); + /* armatures can be in pose mode so ignore them */ + if (ob_src->type != OB_ARMATURE) { + BKE_reportf(op->reports, RPT_WARNING, + "Skipping object '%s' only copying from meshes is supported", ob_src->id.name + 2); + } continue; } @@ -3777,7 +3827,14 @@ static int vertex_group_transfer_weight_exec(bContext *C, wmOperator *op) case WT_REPLACE_ACTIVE_VERTEX_GROUP: { bDeformGroup *dg_src; - dg_src = BLI_findlink(&ob_src->defbase, ob_src->actdef - 1); + dg_src = defgroup_find_name(ob_src, dg_act_name); + + if (dg_src == NULL) { + BKE_reportf(op->reports, RPT_WARNING, + "Skipping object '%s' no group '%s' found", ob_src->id.name + 2, dg_act_name); + continue; + } + if (ed_vgroup_transfer_weight(ob_act, ob_src, dg_src, scene, method, replace_mode, op)) { change = true; } @@ -3808,15 +3865,30 @@ static int vertex_group_transfer_weight_exec(bContext *C, wmOperator *op) CTX_DATA_END; if (change) { + + /* possible the active vertex group changed because of adding/removing */ + /* note!, dg_act may be realloc'd, only check its not NULL */ + if (dg_act) { + ED_vgroup_select_by_name(ob_act, dg_act_name); + } + else { + ED_vgroup_sync_from_pose(ob_act); + } + /* Event notifiers for correct display of data.*/ + + DAG_id_tag_update(&ob_act->id, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob_act); /* for buttons */ WM_event_add_notifier(C, NC_GEOM | ND_VERTEX_GROUP, ob_act); - return OPERATOR_FINISHED; } else { - BKE_report(op->reports, RPT_WARNING, "Failed, no other selected objects with vertex groups found."); - return OPERATOR_CANCELLED; + if (op->reports->list.first == NULL) { + BKE_report(op->reports, RPT_WARNING, "Failed, no other selected objects with vertex groups found"); + } + + return OPERATOR_FINISHED; /* to get the chance to make changes in the redo panel */ } } @@ -3829,7 +3901,7 @@ void OBJECT_OT_vertex_group_transfer_weight(wmOperatorType *ot) ot->description = "Transfer weight paint to active from selected mesh"; /* API callbacks.*/ - ot->poll = vertex_group_mesh_poll; + ot->poll = vertex_group_mesh_supported_poll; ot->exec = vertex_group_transfer_weight_exec; /* Flags.*/ @@ -3837,7 +3909,7 @@ void OBJECT_OT_vertex_group_transfer_weight(wmOperatorType *ot) /* Properties.*/ /* TODO, use vgroup_operator_subset_select_props for group_select_mode */ - ot->prop = RNA_def_enum(ot->srna, "group_select_mode", WT_vertex_group_mode_item, WT_REPLACE_ACTIVE_VERTEX_GROUP, "Group", ""); + ot->prop = RNA_def_enum(ot->srna, "group_select_mode", WT_vertex_group_mode_item, WT_REPLACE_ALL_VERTEX_GROUPS, "Group", ""); ot->prop = RNA_def_enum(ot->srna, "method", WT_method_item, WT_BY_NEAREST_FACE, "Method", ""); ot->prop = RNA_def_enum(ot->srna, "replace_mode", WT_replace_mode_item, WT_REPLACE_ALL_WEIGHTS, "Replace", ""); } @@ -4033,7 +4105,7 @@ void OBJECT_OT_vertex_group_sort(wmOperatorType *ot) { ot->name = "Sort Vertex Groups"; ot->idname = "OBJECT_OT_vertex_group_sort"; - ot->description = "Sorts vertex groups alphabetically"; + ot->description = "Sort vertex groups alphabetically"; /* api callbacks */ ot->poll = vertex_group_poll; @@ -4177,12 +4249,12 @@ static bool check_vertex_group_accessible(wmOperator *op, Object *ob, int def_nr bDeformGroup *dg = BLI_findlink(&ob->defbase, def_nr); if (!dg) { - BKE_report(op->reports, RPT_ERROR, "Invalid Weight Group Index"); + BKE_report(op->reports, RPT_ERROR, "Invalid vertex group index"); return false; } if (dg->flag & DG_LOCK_WEIGHT) { - BKE_report(op->reports, RPT_ERROR, "Weight Group is locked"); + BKE_report(op->reports, RPT_ERROR, "Vertex group is locked"); return false; } @@ -4210,9 +4282,9 @@ void OBJECT_OT_vertex_weight_paste(wmOperatorType *ot) { PropertyRNA *prop; - ot->name = "Paste weight to Selected"; + ot->name = "Paste Weight to Selected"; ot->idname = "OBJECT_OT_vertex_weight_paste"; - ot->description = "Copy this group's weight to other selected verts (disabled if vertex Group is locked)"; + ot->description = "Copy this group's weight to other selected verts (disabled if vertex group is locked)"; /* api callbacks */ ot->poll = vertex_group_vert_select_mesh_poll; @@ -4222,7 +4294,7 @@ void OBJECT_OT_vertex_weight_paste(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; prop = RNA_def_int(ot->srna, "weight_group", -1, -1, INT_MAX, "Weight Index", - "Index of source weight in active Weight Group", -1, INT_MAX); + "Index of source weight in active vertex group", -1, INT_MAX); RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); } @@ -4249,7 +4321,7 @@ void OBJECT_OT_vertex_weight_delete(wmOperatorType *ot) ot->name = "Delete Weight"; ot->idname = "OBJECT_OT_vertex_weight_delete"; - ot->description = "Delete this weight from the vertex (disabled if vertex Group is locked)"; + ot->description = "Delete this weight from the vertex (disabled if vertex group is locked)"; /* api callbacks */ ot->poll = vertex_group_vert_select_mesh_poll; @@ -4259,7 +4331,7 @@ void OBJECT_OT_vertex_weight_delete(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; prop = RNA_def_int(ot->srna, "weight_group", -1, -1, INT_MAX, "Weight Index", - "Index of source weight in active Weight Group", -1, INT_MAX); + "Index of source weight in active vertex group", -1, INT_MAX); RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); } @@ -4283,7 +4355,7 @@ void OBJECT_OT_vertex_weight_set_active(wmOperatorType *ot) ot->name = "Set Active Group"; ot->idname = "OBJECT_OT_vertex_weight_set_active"; - ot->description = "Set as active Vertex Group"; + ot->description = "Set as active vertex group"; /* api callbacks */ ot->poll = vertex_group_vert_select_mesh_poll; @@ -4293,7 +4365,7 @@ void OBJECT_OT_vertex_weight_set_active(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; prop = RNA_def_int(ot->srna, "weight_group", -1, -1, INT_MAX, "Weight Index", - "Index of source weight in active Weight Group", -1, INT_MAX); + "Index of source weight in active vertex group", -1, INT_MAX); RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); } @@ -4316,7 +4388,7 @@ void OBJECT_OT_vertex_weight_normalize_active_vertex(wmOperatorType *ot) ot->name = "Normalize Active"; ot->idname = "OBJECT_OT_vertex_weight_normalize_active_vertex"; - ot->description = "Normalize Active Vert Weights"; + ot->description = "Normalize active vertex's weights"; /* api callbacks */ ot->poll = vertex_group_vert_select_mesh_poll; @@ -4345,7 +4417,7 @@ void OBJECT_OT_vertex_weight_copy(wmOperatorType *ot) ot->name = "Copy Active"; ot->idname = "OBJECT_OT_vertex_weight_copy"; - ot->description = "Copy weights from Active to selected"; + ot->description = "Copy weights from active to selected"; /* api callbacks */ ot->poll = vertex_group_vert_select_mesh_poll; diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c index 9634acd701a..5cb74e1ca09 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.c +++ b/source/blender/editors/physics/dynamicpaint_ops.c @@ -294,7 +294,7 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf ED_update_for_newframe(CTX_data_main(C), scene, 1); /* Init surface */ - if (!dynamicPaint_createUVSurface(surface)) return 0; + if (!dynamicPaint_createUVSurface(scene, surface)) return 0; /* Loop through selected frames */ for (frame = surface->start_frame; frame <= surface->end_frame; frame++) { diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index f84521fabbf..d6bb394ff79 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -1722,13 +1722,17 @@ int PE_lasso_select(bContext *C, const int mcords[][2], const short moves, bool BLI_lasso_is_point_inside(mcords, moves, screen_co[0], screen_co[1], IS_CLIPPED) && key_test_depth(&data, co, screen_co)) { - if (select && !(key->flag & PEK_SELECT)) { - key->flag |= PEK_SELECT; - point->flag |= PEP_EDIT_RECALC; + if (select) { + if (!(key->flag & PEK_SELECT)) { + key->flag |= PEK_SELECT; + point->flag |= PEP_EDIT_RECALC; + } } - else if (key->flag & PEK_SELECT) { - key->flag &= ~PEK_SELECT; - point->flag |= PEP_EDIT_RECALC; + else { + if (key->flag & PEK_SELECT) { + key->flag &= ~PEK_SELECT; + point->flag |= PEP_EDIT_RECALC; + } } } } @@ -1742,13 +1746,17 @@ int PE_lasso_select(bContext *C, const int mcords[][2], const short moves, bool BLI_lasso_is_point_inside(mcords, moves, screen_co[0], screen_co[1], IS_CLIPPED) && key_test_depth(&data, co, screen_co)) { - if (select && !(key->flag & PEK_SELECT)) { - key->flag |= PEK_SELECT; - point->flag |= PEP_EDIT_RECALC; + if (select) { + if (!(key->flag & PEK_SELECT)) { + key->flag |= PEK_SELECT; + point->flag |= PEP_EDIT_RECALC; + } } - else if (key->flag & PEK_SELECT) { - key->flag &= ~PEK_SELECT; - point->flag |= PEP_EDIT_RECALC; + else { + if (key->flag & PEK_SELECT) { + key->flag &= ~PEK_SELECT; + point->flag |= PEP_EDIT_RECALC; + } } } } @@ -2963,14 +2971,20 @@ static void brush_puff(PEData *data, int point_index) KEY_K; float mat[4][4], imat[4][4]; - float lastco[3], rootco[3] = {0.0f, 0.0f, 0.0f}, co[3], nor[3], kco[3], dco[3], ofs[3] = {0.0f, 0.0f, 0.0f}, fac=0.0f, length=0.0f; - int puff_volume = 0; - int change= 0; + float onor_prev[3]; /* previous normal (particle-space) */ + float ofs_prev[3]; /* accumulate offset for puff_volume (particle-space) */ + float co_root[3], no_root[3]; /* root location and normal (global-space) */ + float co_prev[3], co[3]; /* track key coords as we loop (global-space) */ + float fac = 0.0f, length_accum = 0.0f; + bool puff_volume = false; + bool change = false; + + zero_v3(ofs_prev); { ParticleEditSettings *pset= PE_settings(data->scene); ParticleBrushData *brush= &pset->brush[pset->brushtype]; - puff_volume = brush->flag & PE_BRUSH_DATA_PUFF_VOLUME; + puff_volume = (brush->flag & PE_BRUSH_DATA_PUFF_VOLUME) != 0; } if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) { @@ -2983,6 +2997,8 @@ static void brush_puff(PEData *data, int point_index) } LOOP_KEYS { + float kco[3]; + if (k==0) { /* find root coordinate and normal on emitter */ copy_v3_v3(co, key->co); @@ -2992,12 +3008,16 @@ static void brush_puff(PEData *data, int point_index) point_index= BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL, NULL); if (point_index == -1) return; - copy_v3_v3(rootco, co); - copy_v3_v3(nor, &edit->emitter_cosnos[point_index*6+3]); - mul_mat3_m4_v3(data->ob->obmat, nor); /* normal into worldspace */ + copy_v3_v3(co_root, co); + copy_v3_v3(no_root, &edit->emitter_cosnos[point_index * 6 + 3]); + mul_mat3_m4_v3(data->ob->obmat, no_root); /* normal into global-space */ + normalize_v3(no_root); - normalize_v3(nor); - length= 0.0f; + if (puff_volume) { + copy_v3_v3(onor_prev, no_root); + mul_mat3_m4_v3(imat, onor_prev); /* global-space into particle space */ + normalize_v3(onor_prev); + } fac= (float)pow((double)(1.0f - data->dist / data->rad), (double)data->pufffac); fac *= 0.025f; @@ -3007,16 +3027,23 @@ static void brush_puff(PEData *data, int point_index) else { /* compute position as if hair was standing up straight. * */ - copy_v3_v3(lastco, co); + float length; + copy_v3_v3(co_prev, co); copy_v3_v3(co, key->co); mul_m4_v3(mat, co); - length += len_v3v3(lastco, co); + length = len_v3v3(co_prev, co); + length_accum += length; + if ((data->select==0 || (key->flag & PEK_SELECT)) && !(key->flag & PEK_HIDE)) { - madd_v3_v3v3fl(kco, rootco, nor, length); + float dco[3]; /* delta temp var */ + + madd_v3_v3v3fl(kco, co_root, no_root, length_accum); /* blend between the current and straight position */ sub_v3_v3v3(dco, kco, co); madd_v3_v3fl(co, dco, fac); + /* keep the same distance from the root or we get glitches [#35406] */ + dist_ensure_v3_v3fl(co, co_root, length_accum); /* re-use dco to compare before and after translation and add to the offset */ copy_v3_v3(dco, key->co); @@ -3026,11 +3053,9 @@ static void brush_puff(PEData *data, int point_index) if (puff_volume) { /* accumulate the total distance moved to apply to unselected * keys that come after */ - ofs[0] += key->co[0] - dco[0]; - ofs[1] += key->co[1] - dco[1]; - ofs[2] += key->co[2] - dco[2]; + sub_v3_v3v3(ofs_prev, key->co, dco); } - change = 1; + change = true; } else { @@ -3040,7 +3065,7 @@ static void brush_puff(PEData *data, int point_index) add_v3_v3(key->co, ofs); #else /* translate (not rotate) the rest of the hair if its not selected */ - if (ofs[0] || ofs[1] || ofs[2]) { + { #if 0 /* kindof works but looks worse then whats below */ /* Move the unselected point on a vector based on the @@ -3070,11 +3095,18 @@ static void brush_puff(PEData *data, int point_index) mul_mat3_m4_v3(data->ob->obmat, onor); /* normal into worldspace */ mul_mat3_m4_v3(imat, onor); /* worldspace into particle space */ normalize_v3(onor); + } + else { + copy_v3_v3(onor, onor_prev); + } + if (!is_zero_v3(ofs_prev)) { + mul_v3_fl(onor, len_v3(ofs_prev)); - mul_v3_fl(onor, len_v3(ofs)); add_v3_v3(key->co, onor); } + + copy_v3_v3(onor_prev, onor); #endif } #endif diff --git a/source/blender/editors/render/render_intern.h b/source/blender/editors/render/render_intern.h index edd61bfc5c3..eb09606e57e 100644 --- a/source/blender/editors/render/render_intern.h +++ b/source/blender/editors/render/render_intern.h @@ -83,7 +83,7 @@ void TEXTURE_OT_envmap_clear_all(struct wmOperatorType *ot); /* render_internal.c */ void RENDER_OT_render(struct wmOperatorType *ot); -void render_view3d(struct RenderEngine *engine, const struct bContext *C); +void render_view3d_update(struct RenderEngine *engine, const struct bContext *C); void render_view3d_draw(struct RenderEngine *engine, const struct bContext *C); /* render_opengl.c uses this */ diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 09138a5523a..bc4ca82392f 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -266,6 +266,7 @@ typedef struct RenderJob { SceneRenderLayer *srl; struct Object *camera_override; int lay; + bool v3d_override; short anim, write_still; Image *image; ImageUser iuser; @@ -283,7 +284,7 @@ static void render_freejob(void *rjv) } /* str is IMA_MAX_RENDER_TEXT in size */ -static void make_renderinfo_string(RenderStats *rs, Scene *scene, char *str) +static void make_renderinfo_string(RenderStats *rs, Scene *scene, bool v3d_override, char *str) { char info_time_str[32]; // used to be extern to header_info.c uintptr_t mem_in_use, mmap_in_use, peak_memory; @@ -300,7 +301,9 @@ static void make_renderinfo_string(RenderStats *rs, Scene *scene, char *str) /* local view */ if (rs->localview) - spos += sprintf(spos, "%s | ", IFACE_("Local View")); + spos += sprintf(spos, "%s | ", IFACE_("3D Local View")); + else if (v3d_override) + spos += sprintf(spos, "%s | ", IFACE_("3D View")); /* frame number */ spos += sprintf(spos, IFACE_("Frame:%d "), (scene->r.cfra)); @@ -376,7 +379,7 @@ static void image_renderinfo_cb(void *rjv, RenderStats *rs) if (rr->text == NULL) rr->text = MEM_callocN(IMA_MAX_RENDER_TEXT, "rendertext"); - make_renderinfo_string(rs, rj->scene, rr->text); + make_renderinfo_string(rs, rj->scene, rj->v3d_override, rr->text); } RE_ReleaseResult(rj->re); @@ -643,7 +646,12 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even rj->reports = op->reports; if (v3d) { - rj->lay = v3d->lay; + if (rj->lay != v3d->lay) { + rj->lay = v3d->lay; + rj->v3d_override = true; + } + else if (camera_override && camera_override != scene->camera) + rj->v3d_override = true; if (v3d->localvd) rj->lay |= v3d->localvd->lay; @@ -728,11 +736,13 @@ void RENDER_OT_render(wmOperatorType *ot) #define PR_UPDATE_VIEW 1 #define PR_UPDATE_RENDERSIZE 2 #define PR_UPDATE_MATERIAL 4 +#define PR_UPDATE_DATABASE 8 typedef struct RenderPreview { /* from wmJob */ void *owner; short *stop, *do_update; + wmJob *job; Scene *scene; ScrArea *sa; @@ -743,8 +753,6 @@ typedef struct RenderPreview { RenderEngine *engine; float viewmat[4][4]; - - int keep_data; } RenderPreview; static int render_view3d_disprect(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, rcti *disprect) @@ -823,10 +831,11 @@ static void render_view3d_renderinfo_cb(void *rjp, RenderStats *rs) RenderPreview *rp = rjp; /* during render, rv3d->engine can get freed */ - if (rp->rv3d->render_engine == NULL) + if (rp->rv3d->render_engine == NULL) { *rp->stop = 1; - else if (rp->engine->text) { - make_renderinfo_string(rs, rp->scene, rp->engine->text); + } + else { + make_renderinfo_string(rs, rp->scene, false, rp->engine->text); /* make jobs timer to send notifier */ *(rp->do_update) = TRUE; @@ -845,7 +854,13 @@ static void render_view3d_startjob(void *customdata, short *stop, short *do_upda float clipsta, clipend, pixsize; bool orth, restore = 0; char name[32]; - + int update_flag; + + update_flag = rp->engine->job_update_flag; + rp->engine->job_update_flag = 0; + + //printf("ma %d res %d view %d db %d\n", update_flag & PR_UPDATE_MATERIAL, update_flag & PR_UPDATE_RENDERSIZE, update_flag & PR_UPDATE_VIEW, update_flag & PR_UPDATE_DATABASE); + G.is_break = FALSE; if (false == render_view3d_get_rects(rp->ar, rp->v3d, rp->rv3d, &viewplane, rp->engine, &clipsta, &clipend, &pixsize, &orth)) @@ -860,13 +875,6 @@ static void render_view3d_startjob(void *customdata, short *stop, short *do_upda sprintf(name, "View3dPreview %p", (void *)rp->ar); re = rp->engine->re = RE_GetRender(name); - if (rp->engine->re == NULL) { - - re = rp->engine->re = RE_NewRender(name); - - rp->keep_data = 0; - } - /* set this always, rp is different for each job */ RE_test_break_cb(re, rp, render_view3d_break); RE_display_draw_cb(re, rp, render_view3d_draw_update); @@ -874,7 +882,7 @@ static void render_view3d_startjob(void *customdata, short *stop, short *do_upda rstats = RE_GetStats(re); - if (rp->keep_data == 0 || rstats->convertdone == 0 || (rp->keep_data & PR_UPDATE_RENDERSIZE)) { + if ((update_flag & (PR_UPDATE_RENDERSIZE | PR_UPDATE_DATABASE)) || rstats->convertdone == 0) { /* no osa, blur, seq, layers, etc for preview render */ rdata = rp->scene->r; rdata.mode &= ~(R_OSA | R_MBLUR | R_BORDER | R_PANORAMA); @@ -900,11 +908,7 @@ static void render_view3d_startjob(void *customdata, short *stop, short *do_upda RE_SetPixelSize(re, pixsize); - /* database free can crash on a empty Render... */ - if (rp->keep_data == 0 && rstats->convertdone) - RE_Database_Free(re); - - if (rstats->convertdone == 0) { + if ((update_flag & PR_UPDATE_DATABASE) || rstats->convertdone == 0) { unsigned int lay = rp->scene->lay; /* allow localview render for objects with lights in normal layers */ @@ -913,8 +917,20 @@ static void render_view3d_startjob(void *customdata, short *stop, short *do_upda else lay = rp->v3d->lay; RE_SetView(re, rp->viewmat); - + + /* copying blender data while main thread is locked, to avoid crashes */ + WM_job_main_thread_lock_acquire(rp->job); + RE_Database_Free(re); RE_Database_FromScene(re, rp->bmain, rp->scene, lay, 0); // 0= dont use camera view + WM_job_main_thread_lock_release(rp->job); + + /* do preprocessing like building raytree, shadows, volumes, SSS */ + RE_Database_Preprocess(re); + + /* conversion not completed, need to do it again */ + if (!rstats->convertdone) + rp->engine->job_update_flag |= PR_UPDATE_DATABASE; + // printf("dbase update\n"); } else { @@ -932,8 +948,6 @@ static void render_view3d_startjob(void *customdata, short *stop, short *do_upda /* always rotate back */ if (restore) RE_DataBase_IncrementalView(re, rp->viewmat, 1); - - rp->engine->flag &= ~RE_ENGINE_DO_UPDATE; } } @@ -944,21 +958,99 @@ static void render_view3d_free(void *customdata) MEM_freeN(rp); } -static void render_view3d_do(RenderEngine *engine, const bContext *C, int keep_data) +static bool render_view3d_flag_changed(RenderEngine *engine, const bContext *C) +{ + RegionView3D *rv3d = CTX_wm_region_view3d(C); + View3D *v3d = CTX_wm_view3d(C); + ARegion *ar = CTX_wm_region(C); + Scene *scene = CTX_data_scene(C); + Render *re; + rctf viewplane; + rcti disprect; + float clipsta, clipend; + bool orth; + int job_update_flag = 0; + char name[32]; + + /* ensure render engine exists */ + re = engine->re; + + if (!re) { + sprintf(name, "View3dPreview %p", (void *)ar); + re = engine->re = RE_GetRender(name); + if (!re) + re = engine->re = RE_NewRender(name); + + engine->update_flag |= RE_ENGINE_UPDATE_DATABASE; + } + + /* check update_flag */ + if (engine->update_flag & RE_ENGINE_UPDATE_MA) + job_update_flag |= PR_UPDATE_MATERIAL; + + if (engine->update_flag & RE_ENGINE_UPDATE_OTHER) + job_update_flag |= PR_UPDATE_MATERIAL; + + if (engine->update_flag & RE_ENGINE_UPDATE_DATABASE) { + job_update_flag |= PR_UPDATE_DATABASE; + + /* load editmesh */ + if (scene->obedit) + ED_object_editmode_load(scene->obedit); + } + + engine->update_flag = 0; + + /* check if viewport changed */ + if (engine->last_winx != ar->winx || engine->last_winy != ar->winy) { + engine->last_winx = ar->winx; + engine->last_winy = ar->winy; + job_update_flag |= PR_UPDATE_RENDERSIZE; + } + + if (compare_m4m4(engine->last_viewmat, rv3d->viewmat, 0.00001f) == 0) { + copy_m4_m4(engine->last_viewmat, rv3d->viewmat); + job_update_flag |= PR_UPDATE_VIEW; + } + + render_view3d_get_rects(ar, v3d, rv3d, &viewplane, engine, &clipsta, &clipend, NULL, &orth); + + if (BLI_rctf_compare(&viewplane, &engine->last_viewplane, 0.00001f) == 0) { + engine->last_viewplane = viewplane; + job_update_flag |= PR_UPDATE_VIEW; + } + + render_view3d_disprect(scene, ar, v3d, rv3d, &disprect); + if (BLI_rcti_compare(&disprect, &engine->last_disprect) == 0) { + engine->last_disprect = disprect; + job_update_flag |= PR_UPDATE_RENDERSIZE; + } + + /* any changes? go ahead and rerender */ + if (job_update_flag) { + engine->job_update_flag |= job_update_flag; + return true; + } + + return false; +} + +static void render_view3d_do(RenderEngine *engine, const bContext *C) { wmJob *wm_job; RenderPreview *rp; Scene *scene = CTX_data_scene(C); - if (CTX_wm_window(C) == NULL) { - engine->flag |= RE_ENGINE_DO_UPDATE; + if (CTX_wm_window(C) == NULL) + return; + if (!render_view3d_flag_changed(engine, C)) return; - } wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), CTX_wm_region(C), "Render Preview", WM_JOB_EXCL_RENDER, WM_JOB_TYPE_RENDER_PREVIEW); rp = MEM_callocN(sizeof(RenderPreview), "render preview"); - + rp->job = wm_job; + /* customdata for preview thread */ rp->scene = scene; rp->engine = engine; @@ -967,12 +1059,10 @@ static void render_view3d_do(RenderEngine *engine, const bContext *C, int keep_d rp->v3d = rp->sa->spacedata.first; rp->rv3d = CTX_wm_region_view3d(C); rp->bmain = CTX_data_main(C); - rp->keep_data = keep_data; copy_m4_m4(rp->viewmat, rp->rv3d->viewmat); - /* dont alloc in threads */ - if (engine->text == NULL) - engine->text = MEM_callocN(IMA_MAX_RENDER_TEXT, "rendertext"); + /* clear info text */ + engine->text[0] = '\0'; /* setup job */ WM_jobs_customdata_set(wm_job, rp, render_view3d_free); @@ -982,80 +1072,33 @@ static void render_view3d_do(RenderEngine *engine, const bContext *C, int keep_d WM_jobs_start(CTX_wm_manager(C), wm_job); engine->flag &= ~RE_ENGINE_DO_UPDATE; - } /* callback for render engine , on changes */ -void render_view3d(RenderEngine *engine, const bContext *C) +void render_view3d_update(RenderEngine *engine, const bContext *C) { - render_view3d_do(engine, C, 0); -} - -static int render_view3d_changed(RenderEngine *engine, const bContext *C) -{ - ARegion *ar = CTX_wm_region(C); - Render *re; - int update = 0; - char name[32]; - - sprintf(name, "View3dPreview %p", (void *)ar); - re = RE_GetRender(name); - - if (re) { - RegionView3D *rv3d = CTX_wm_region_view3d(C); - View3D *v3d = CTX_wm_view3d(C); - Scene *scene = CTX_data_scene(C); - rctf viewplane, viewplane1; - rcti disprect, disprect1; - float mat[4][4]; - float clipsta, clipend; - bool orth; - - if (engine->update_flag & RE_ENGINE_UPDATE_MA) - update |= PR_UPDATE_MATERIAL; - - if (engine->update_flag & RE_ENGINE_UPDATE_OTHER) - update |= PR_UPDATE_MATERIAL; - - engine->update_flag = 0; - - if (engine->resolution_x != ar->winx || engine->resolution_y != ar->winy) - update |= PR_UPDATE_RENDERSIZE; + /* this shouldn't be needed and causes too many database rebuilds, but we + * aren't actually tracking updates for all relevent datablocks so this is + * a catch-all for updates */ + engine->update_flag |= RE_ENGINE_UPDATE_DATABASE; - RE_GetView(re, mat); - if (compare_m4m4(mat, rv3d->viewmat, 0.00001f) == 0) { - update |= PR_UPDATE_VIEW; - } - - render_view3d_get_rects(ar, v3d, rv3d, &viewplane, engine, &clipsta, &clipend, NULL, &orth); - RE_GetViewPlane(re, &viewplane1, &disprect1); - - if (BLI_rctf_compare(&viewplane, &viewplane1, 0.00001f) == 0) - update |= PR_UPDATE_VIEW; - - render_view3d_disprect(scene, ar, v3d, rv3d, &disprect); - if (BLI_rcti_compare(&disprect, &disprect1) == 0) - update |= PR_UPDATE_RENDERSIZE; - - if (update) - engine->flag |= RE_ENGINE_DO_UPDATE; - //if (update) - // printf("changed ma %d res %d view %d\n", update & PR_UPDATE_MATERIAL, update & PR_UPDATE_RENDERSIZE, update & PR_UPDATE_VIEW); - } - - return update; + render_view3d_do(engine, C); } void render_view3d_draw(RenderEngine *engine, const bContext *C) { Render *re = engine->re; RenderResult rres; - int keep_data = render_view3d_changed(engine, C); + char name[32]; - if (engine->flag & RE_ENGINE_DO_UPDATE) - render_view3d_do(engine, C, keep_data); - - if (re == NULL) return; + render_view3d_do(engine, C); + + if (re == NULL) { + sprintf(name, "View3dPreview %p", (void *)CTX_wm_region(C)); + re = RE_GetRender(name); + + if (re == NULL) return; + } RE_AcquireResultImage(re, &rres); @@ -1105,3 +1148,58 @@ void render_view3d_draw(RenderEngine *engine, const bContext *C) RE_ReleaseResultImage(re); } + +void ED_viewport_render_kill_jobs(const bContext *C, bool free_database) +{ + wmWindowManager *wm = CTX_wm_manager(C); + Main *bmain = CTX_data_main(C); + bScreen *sc; + ScrArea *sa; + ARegion *ar; + + if (!wm) + return; + + /* kill all actively running jobs */ + WM_jobs_kill(wm, NULL, render_view3d_startjob); + + /* loop over 3D view render engines */ + for (sc = bmain->screen.first; sc; sc = sc->id.next) { + for (sa = sc->areabase.first; sa; sa = sa->next) { + if (sa->spacetype != SPACE_VIEW3D) + continue; + + for (ar = sa->regionbase.first; ar; ar = ar->next) { + RegionView3D *rv3d; + + if (ar->regiontype != RGN_TYPE_WINDOW) + continue; + + rv3d = ar->regiondata; + + if (rv3d->render_engine) { + /* free render database now before we change data, because + * RE_Database_Free will also loop over blender data */ + if (free_database) { + char name[32]; + Render *re; + + sprintf(name, "View3dPreview %p", (void *)ar); + re = RE_GetRender(name); + + if (re) + RE_Database_Free(re); + + /* tag render engine to update entire database */ + rv3d->render_engine->update_flag |= RE_ENGINE_UPDATE_DATABASE; + } + else { + /* quick shader update */ + rv3d->render_engine->update_flag |= RE_ENGINE_UPDATE_MA; + } + } + } + } + } +} + diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 13379425258..b4532e0571c 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -107,6 +107,10 @@ typedef struct OGLRender { bMovieHandle *mh; int cfrao, nfra; + /* wm vars for timer and progress cursor */ + wmWindowManager *wm; + wmWindow *win; + wmTimer *timer; /* use to check if running modal or not (invoke'd or exec'd)*/ } OGLRender; @@ -327,6 +331,9 @@ static void screen_opengl_render_apply(OGLRender *oglrender) static int screen_opengl_render_init(bContext *C, wmOperator *op) { /* new render clears all callbacks */ + wmWindowManager *wm = CTX_wm_manager(C); + wmWindow *win = CTX_wm_window(C); + Scene *scene = CTX_data_scene(C); ScrArea *prevsa = CTX_wm_area(C); ARegion *prevar = CTX_wm_region(C); @@ -353,7 +360,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) } /* only one render job at a time */ - if (WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_RENDER)) + if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) return 0; if (!is_view_context && scene->camera == NULL) { @@ -367,7 +374,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) } /* stop all running jobs, except screen one. currently previews frustrate Render */ - WM_jobs_kill_all_except(CTX_wm_manager(C), CTX_wm_screen(C)); + WM_jobs_kill_all_except(wm, CTX_wm_screen(C)); /* create offscreen buffer */ sizex = (scene->r.size * scene->r.xsch) / 100; @@ -381,9 +388,6 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) return 0; } - /* handle UI stuff */ - WM_cursor_wait(1); - /* allocate opengl render */ oglrender = MEM_callocN(sizeof(OGLRender), "OGLRender"); op->customdata = oglrender; @@ -441,6 +445,10 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) rr->rectf = MEM_callocN(sizeof(float) * 4 * sizex * sizey, "screen_opengl_render_init rect"); RE_ReleaseResult(oglrender->re); + /* wm vars */ + oglrender->wm = wm; + oglrender->win = win; + return 1; } @@ -458,10 +466,11 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) scene->r.cfra = oglrender->cfrao; BKE_scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender)); - WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), oglrender->timer); + WM_event_remove_timer(oglrender->wm, oglrender->win, oglrender->timer); } - WM_cursor_wait(0); + WM_cursor_restore(oglrender->win); + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, oglrender->scene); U.obcenter_dia = oglrender->obcenter_dia_back; @@ -549,6 +558,8 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) } } + WM_cursor_time(oglrender->win, scene->r.cfra); + BKE_scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender)); if (view_context) { @@ -713,8 +724,11 @@ static int screen_opengl_render_invoke(bContext *C, wmOperator *op, const wmEven oglrender = op->customdata; render_view_open(C, event->x, event->y); + /* view may be changed above (R_OUTPUT_WINDOW) */ + oglrender->win = CTX_wm_window(C); + WM_event_add_modal_handler(C, op); - oglrender->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f); + oglrender->timer = WM_event_add_timer(oglrender->wm, oglrender->win, TIMER, 0.01f); return OPERATOR_RUNNING_MODAL; } diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 76fa79029fd..4bd8a7d426a 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -964,7 +964,7 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat br->icon_imbuf = get_brush_icon(br); - memset(sp->pr_rect, 0x888888, sp->sizex * sp->sizey * sizeof(unsigned int)); + memset(sp->pr_rect, 0x88, sp->sizex * sp->sizey * sizeof(unsigned int)); if (!(br->icon_imbuf) || !(br->icon_imbuf->rect)) return; @@ -1180,5 +1180,7 @@ void ED_preview_kill_jobs(const struct bContext *C) wmWindowManager *wm = CTX_wm_manager(C); if (wm) WM_jobs_kill(wm, NULL, common_preview_startjob); + + ED_viewport_render_kill_jobs(C, false); } diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 7a274396e86..58c244228ed 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -110,6 +110,7 @@ static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op)) object_add_material_slot(ob); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, ob); + WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_PREVIEW, ob); return OPERATOR_FINISHED; } @@ -146,6 +147,7 @@ static int material_slot_remove_exec(bContext *C, wmOperator *op) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, ob); + WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_PREVIEW, ob); return OPERATOR_FINISHED; } @@ -1064,21 +1066,21 @@ static int freestyle_modifier_remove_exec(bContext *C, wmOperator *op) } switch (freestyle_get_modifier_type(&ptr)) { - case LS_MODIFIER_TYPE_COLOR: - BKE_remove_linestyle_color_modifier(lineset->linestyle, modifier); - break; - case LS_MODIFIER_TYPE_ALPHA: - BKE_remove_linestyle_alpha_modifier(lineset->linestyle, modifier); - break; - case LS_MODIFIER_TYPE_THICKNESS: - BKE_remove_linestyle_thickness_modifier(lineset->linestyle, modifier); - break; - case LS_MODIFIER_TYPE_GEOMETRY: - BKE_remove_linestyle_geometry_modifier(lineset->linestyle, modifier); - break; - default: - BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier"); - return OPERATOR_CANCELLED; + case LS_MODIFIER_TYPE_COLOR: + BKE_remove_linestyle_color_modifier(lineset->linestyle, modifier); + break; + case LS_MODIFIER_TYPE_ALPHA: + BKE_remove_linestyle_alpha_modifier(lineset->linestyle, modifier); + break; + case LS_MODIFIER_TYPE_THICKNESS: + BKE_remove_linestyle_thickness_modifier(lineset->linestyle, modifier); + break; + case LS_MODIFIER_TYPE_GEOMETRY: + BKE_remove_linestyle_geometry_modifier(lineset->linestyle, modifier); + break; + default: + BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier"); + return OPERATOR_CANCELLED; } WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); @@ -1114,21 +1116,21 @@ static int freestyle_modifier_copy_exec(bContext *C, wmOperator *op) } switch (freestyle_get_modifier_type(&ptr)) { - case LS_MODIFIER_TYPE_COLOR: - BKE_copy_linestyle_color_modifier(lineset->linestyle, modifier); - break; - case LS_MODIFIER_TYPE_ALPHA: - BKE_copy_linestyle_alpha_modifier(lineset->linestyle, modifier); - break; - case LS_MODIFIER_TYPE_THICKNESS: - BKE_copy_linestyle_thickness_modifier(lineset->linestyle, modifier); - break; - case LS_MODIFIER_TYPE_GEOMETRY: - BKE_copy_linestyle_geometry_modifier(lineset->linestyle, modifier); - break; - default: - BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier"); - return OPERATOR_CANCELLED; + case LS_MODIFIER_TYPE_COLOR: + BKE_copy_linestyle_color_modifier(lineset->linestyle, modifier); + break; + case LS_MODIFIER_TYPE_ALPHA: + BKE_copy_linestyle_alpha_modifier(lineset->linestyle, modifier); + break; + case LS_MODIFIER_TYPE_THICKNESS: + BKE_copy_linestyle_thickness_modifier(lineset->linestyle, modifier); + break; + case LS_MODIFIER_TYPE_GEOMETRY: + BKE_copy_linestyle_geometry_modifier(lineset->linestyle, modifier); + break; + default: + BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier"); + return OPERATOR_CANCELLED; } WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); @@ -1165,21 +1167,21 @@ static int freestyle_modifier_move_exec(bContext *C, wmOperator *op) } switch (freestyle_get_modifier_type(&ptr)) { - case LS_MODIFIER_TYPE_COLOR: - BKE_move_linestyle_color_modifier(lineset->linestyle, modifier, dir); - break; - case LS_MODIFIER_TYPE_ALPHA: - BKE_move_linestyle_alpha_modifier(lineset->linestyle, modifier, dir); - break; - case LS_MODIFIER_TYPE_THICKNESS: - BKE_move_linestyle_thickness_modifier(lineset->linestyle, modifier, dir); - break; - case LS_MODIFIER_TYPE_GEOMETRY: - BKE_move_linestyle_geometry_modifier(lineset->linestyle, modifier, dir); - break; - default: - BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier"); - return OPERATOR_CANCELLED; + case LS_MODIFIER_TYPE_COLOR: + BKE_move_linestyle_color_modifier(lineset->linestyle, modifier, dir); + break; + case LS_MODIFIER_TYPE_ALPHA: + BKE_move_linestyle_alpha_modifier(lineset->linestyle, modifier, dir); + break; + case LS_MODIFIER_TYPE_THICKNESS: + BKE_move_linestyle_thickness_modifier(lineset->linestyle, modifier, dir); + break; + case LS_MODIFIER_TYPE_GEOMETRY: + BKE_move_linestyle_geometry_modifier(lineset->linestyle, modifier, dir); + break; + default: + BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier"); + return OPERATOR_CANCELLED; } WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); @@ -1212,7 +1214,7 @@ void SCENE_OT_freestyle_modifier_move(wmOperatorType *ot) #endif /* WITH_FREESTYLE */ -static int texture_slot_move(bContext *C, wmOperator *op) +static int texture_slot_move_exec(bContext *C, wmOperator *op) { ID *id = CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data; @@ -1290,7 +1292,7 @@ void TEXTURE_OT_slot_move(wmOperatorType *ot) ot->description = "Move texture slots up and down"; /* api callbacks */ - ot->exec = texture_slot_move; + ot->exec = texture_slot_move_exec; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index 436aef943e4..5f74bf6576a 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -539,7 +539,7 @@ void ED_render_internal_init(void) { RenderEngineType *ret = RE_engines_find("BLENDER_RENDER"); - ret->view_update = render_view3d; + ret->view_update = render_view3d_update; ret->view_draw = render_view3d_draw; } diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 4ddacc3254e..1f1da35f823 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -420,7 +420,7 @@ void ED_region_do_draw(bContext *C, ARegion *ar) /* note; this sets state, so we can use wmOrtho and friends */ wmSubWindowScissorSet(win, ar->swinid, &ar->drawrct); - UI_SetTheme(sa ? sa->spacetype : 0, ar->type ? ar->type->regionid : 0); + UI_SetTheme(sa ? sa->spacetype : 0, at->regionid); /* optional header info instead? */ if (ar->headerstr) { @@ -908,11 +908,19 @@ static void region_overlap_fix(ScrArea *sa, ARegion *ar) /* overlapping regions only in the following restricted cases */ static int region_is_overlap(wmWindow *win, ScrArea *sa, ARegion *ar) { - if (U.uiflag2 & USER_REGION_OVERLAP) - if (WM_is_draw_triple(win)) - if (ELEM4(sa->spacetype, SPACE_VIEW3D, SPACE_IMAGE, SPACE_SEQ, SPACE_CLIP)) + if (U.uiflag2 & USER_REGION_OVERLAP) { + if (WM_is_draw_triple(win)) { + if (ELEM(sa->spacetype, SPACE_VIEW3D, SPACE_SEQ)) { if (ELEM3(ar->regiontype, RGN_TYPE_TOOLS, RGN_TYPE_UI, RGN_TYPE_TOOL_PROPS)) return 1; + } + else if (ELEM(sa->spacetype, SPACE_IMAGE, SPACE_CLIP)) { + if (ELEM4(ar->regiontype, RGN_TYPE_TOOLS, RGN_TYPE_UI, RGN_TYPE_TOOL_PROPS, RGN_TYPE_PREVIEW)) + return 1; + } + } + } + return 0; } diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index c70841ffe82..3066b733fc5 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -649,7 +649,8 @@ static void actionzone_apply(bContext *C, wmOperator *op, int type) sad->modifier = RNA_int_get(op->ptr, "modifier"); - event = *(win->eventstate); /* XXX huh huh? make api call */ + wm_event_init_from_window(win, &event); + if (type == AZONE_AREA) event.type = EVT_ACTIONZONE_AREA; else @@ -1154,7 +1155,7 @@ static int area_move_modal(bContext *C, wmOperator *op, const wmEvent *event) /* execute the events */ switch (event->type) { case MOUSEMOVE: - + { x = RNA_int_get(op->ptr, "x"); y = RNA_int_get(op->ptr, "y"); @@ -1164,9 +1165,9 @@ static int area_move_modal(bContext *C, wmOperator *op, const wmEvent *event) area_move_apply(C, op); break; - + } case EVT_MODAL_MAP: - + { switch (event->val) { case KM_MODAL_APPLY: area_move_exit(C, op); @@ -1182,6 +1183,8 @@ static int area_move_modal(bContext *C, wmOperator *op, const wmEvent *event) md->step = 0; break; } + break; + } } return OPERATOR_RUNNING_MODAL; @@ -2463,8 +2466,8 @@ static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event) WM_event_add_notifier(C, NC_WINDOW, NULL); } } + break; } - break; case LEFTMOUSE: if (event->val == KM_RELEASE) { ED_area_tag_redraw(jd->sa1); @@ -2562,7 +2565,7 @@ static void SCREEN_OT_area_options(wmOperatorType *ot) /* ******************************* */ -static int spacedata_cleanup(bContext *C, wmOperator *op) +static int spacedata_cleanup_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); bScreen *screen; @@ -2594,7 +2597,7 @@ static void SCREEN_OT_spacedata_cleanup(wmOperatorType *ot) ot->idname = "SCREEN_OT_spacedata_cleanup"; /* api callbacks */ - ot->exec = spacedata_cleanup; + ot->exec = spacedata_cleanup_exec; ot->poll = WM_operator_winactive; } @@ -3182,7 +3185,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), const wmEv sound_seek_scene(bmain, scene); /* since we follow drawflags, we can't send notifier but tag regions ourselves */ - ED_update_for_newframe(CTX_data_main(C), scene, 1); + ED_update_for_newframe(bmain, scene, 1); for (window = wm->windows.first; window; window = window->next) { for (sa = window->screen->areabase.first; sa; sa = sa->next) { @@ -3367,7 +3370,7 @@ static void SCREEN_OT_animation_cancel(wmOperatorType *ot) * poll() has to be filled in by user for context */ #if 0 -static int border_select_do(bContext *C, wmOperator *op) +static int border_select_exec(bContext *C, wmOperator *op) { int event_type = RNA_int_get(op->ptr, "event_type"); @@ -3388,7 +3391,7 @@ static void SCREEN_OT_border_select(wmOperatorType *ot) ot->idname = "SCREEN_OT_border_select"; /* api callbacks */ - ot->exec = border_select_do; + ot->exec = border_select_exec; ot->invoke = WM_border_select_invoke; ot->modal = WM_border_select_modal; ot->cancel = WM_border_select_cancel; diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index 3db0bd61f03..db6380e920f 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -154,7 +154,7 @@ static void partialvis_update_grids(Object *ob, { CCGElem **grids; CCGKey key; - BLI_bitmap *grid_hidden; + BLI_bitmap **grid_hidden; int any_visible = 0; int *grid_indices, totgrid, any_changed, i; @@ -171,7 +171,7 @@ static void partialvis_update_grids(Object *ob, for (i = 0; i < totgrid; i++) { int any_hidden = 0; int g = grid_indices[i], x, y; - BLI_bitmap gh = grid_hidden[g]; + BLI_bitmap *gh = grid_hidden[g]; if (!gh) { switch (action) { diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 553a5cbe9ac..db55dc271f1 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -245,7 +245,8 @@ typedef struct ProjPaintState { float normal_angle_inner; float normal_angle_range; /* difference between normal_angle and normal_angle_inner, for easy access */ - short is_ortho; + bool do_face_sel; /* quick access to (me->editflag & ME_EDIT_PAINT_FACE_SEL) */ + bool is_ortho; bool do_masking; /* use masking during painting. Some operations such as airbrush may disable */ bool is_texbrush; /* only to avoid running */ bool is_maskbrush; /* mask brush is applied before masking */ @@ -2809,22 +2810,32 @@ static void project_paint_begin(ProjPaintState *ps) Image *tpage_last = NULL, *tpage; /* Face vars */ + MPoly *mpoly_orig; MFace *mf; MTFace *tf; int a, i; /* generic looping vars */ int image_index = -1, face_index; + + /* double lookup */ + const int *index_mf_to_mpoly = NULL; + const int *index_mp_to_orig = NULL; + MVert *mv; MemArena *arena; /* at the moment this is just ps->arena_mt[0], but use this to show were not multithreading */ const int diameter = 2 * BKE_brush_size_get(ps->scene, ps->brush); + bool reset_threads = false; + /* ---- end defines ---- */ if (ps->source == PROJ_SRC_VIEW) ED_view3d_clipping_local(ps->rv3d, ps->ob->obmat); /* faster clipping lookups */ + ps->do_face_sel = ((((Mesh *)ps->ob->data)->editflag & ME_EDIT_PAINT_FACE_SEL) != 0); + /* paint onto the derived mesh */ /* Workaround for subsurf selection, try the display mesh first */ @@ -2833,12 +2844,17 @@ static void project_paint_begin(ProjPaintState *ps) ps->dm = mesh_create_derived_render(ps->scene, ps->ob, ps->scene->customdata_mask | CD_MASK_MTFACE); ps->dm_release = TRUE; } - else if (ps->ob->derivedFinal && CustomData_has_layer(&ps->ob->derivedFinal->faceData, CD_MTFACE)) { + else if (ps->ob->derivedFinal && + CustomData_has_layer(&ps->ob->derivedFinal->faceData, CD_MTFACE) && + (ps->do_face_sel == false || CustomData_has_layer(&ps->ob->derivedFinal->polyData, CD_ORIGINDEX))) + { ps->dm = ps->ob->derivedFinal; ps->dm_release = FALSE; } else { - ps->dm = mesh_get_derived_final(ps->scene, ps->ob, ps->scene->customdata_mask | CD_MASK_MTFACE); + ps->dm = mesh_get_derived_final( + ps->scene, ps->ob, + ps->scene->customdata_mask | CD_MASK_MTFACE | (ps->do_face_sel ? CD_ORIGINDEX : 0)); ps->dm_release = TRUE; } @@ -2858,6 +2874,20 @@ static void project_paint_begin(ProjPaintState *ps) ps->dm_totvert = ps->dm->getNumVerts(ps->dm); ps->dm_totface = ps->dm->getNumTessFaces(ps->dm); + if (ps->do_face_sel) { + index_mf_to_mpoly = ps->dm->getTessFaceDataArray(ps->dm, CD_ORIGINDEX); + index_mp_to_orig = ps->dm->getPolyDataArray(ps->dm, CD_ORIGINDEX); + if (index_mf_to_mpoly == NULL) { + index_mp_to_orig = NULL; + } + else { + mpoly_orig = ((Mesh *)ps->ob->data)->mpoly; + } + } + else { + mpoly_orig = NULL; + } + /* use clone mtface? */ @@ -3064,6 +3094,10 @@ static void project_paint_begin(ProjPaintState *ps) /* printf("\tscreenspace bucket division x:%d y:%d\n", ps->buckets_x, ps->buckets_y); */ + if (ps->buckets_x > PROJ_BUCKET_RECT_MAX || ps->buckets_y > PROJ_BUCKET_RECT_MAX) { + reset_threads = true; + } + /* really high values could cause problems since it has to allocate a few * (ps->buckets_x*ps->buckets_y) sized arrays */ CLAMP(ps->buckets_x, PROJ_BUCKET_RECT_MIN, PROJ_BUCKET_RECT_MAX); @@ -3089,6 +3123,11 @@ static void project_paint_begin(ProjPaintState *ps) ps->thread_tot = BKE_scene_num_threads(ps->scene); + /* workaround for #35057, disable threading if diameter is less than is possible for + * optimum bucket number generation */ + if (reset_threads) + ps->thread_tot = 1; + for (a = 0; a < ps->thread_tot; a++) { ps->arena_mt[a] = BLI_memarena_new(1 << 16, "project paint arena"); } @@ -3118,8 +3157,8 @@ static void project_paint_begin(ProjPaintState *ps) } } - for (face_index = 0, tf = ps->dm_mtface, mf = ps->dm_mface; face_index < ps->dm_totface; mf++, tf++, face_index++) { + bool is_face_sel; #ifndef PROJ_DEBUG_NOSEAMBLEED /* add face user if we have bleed enabled, set the UV seam flags later */ @@ -3134,10 +3173,23 @@ static void project_paint_begin(ProjPaintState *ps) } #endif - tpage = project_paint_face_image(ps, ps->dm_mtface, face_index); - - if (tpage && ((((Mesh *)ps->ob->data)->editflag & ME_EDIT_PAINT_FACE_SEL) == 0 || mf->flag & ME_FACE_SEL)) { + if (ps->do_face_sel) { + int orig_index; + if (index_mp_to_orig && ((orig_index = DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, + face_index))) != ORIGINDEX_NONE) + { + MPoly *mp = &mpoly_orig[orig_index]; + is_face_sel = ((mp->flag & ME_FACE_SEL) != 0); + } + else { + is_face_sel = ((mf->flag & ME_FACE_SEL) != 0); + } + } + else { + is_face_sel = true; + } + if (is_face_sel && (tpage = project_paint_face_image(ps, ps->dm_mtface, face_index))) { float *v1coSS, *v2coSS, *v3coSS, *v4coSS = NULL; v1coSS = ps->screenCoords[mf->v1]; diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 6de6734f975..bdf542526ee 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -695,6 +695,7 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve WM_event_add_notifier(C, NC_WINDOW, NULL); return OPERATOR_CANCELLED; } + break; case XKEY: if (event->val == KM_PRESS) { @@ -846,7 +847,7 @@ static void BRUSH_OT_stencil_fit_image_aspect(wmOperatorType *ot) } -static int stencil_reset_transform(bContext *C, wmOperator *op) +static int stencil_reset_transform_exec(bContext *C, wmOperator *op) { Paint *paint = BKE_paint_get_active_from_context(C); Brush *br = BKE_paint_brush(paint); @@ -888,7 +889,7 @@ static void BRUSH_OT_stencil_reset_transform(wmOperatorType *ot) ot->idname = "BRUSH_OT_stencil_reset_transform"; /* api callbacks */ - ot->exec = stencil_reset_transform; + ot->exec = stencil_reset_transform_exec; ot->poll = stencil_control_poll; /* flags */ diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index d82606f52f0..576bbecb561 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -540,8 +540,9 @@ bool paint_supports_dynamic_size(Brush *br, PaintMode mode) case PAINT_SCULPT: if (sculpt_is_grab_tool(br)) return false; + break; default: - ; + break; } return true; } @@ -559,8 +560,9 @@ bool paint_supports_smooth_stroke(Brush *br, PaintMode mode) case PAINT_SCULPT: if (sculpt_is_grab_tool(br)) return false; + break; default: - ; + break; } return true; } @@ -575,9 +577,10 @@ bool paint_supports_dynamic_tex_coords(Brush *br, PaintMode mode) case PAINT_SCULPT: if (sculpt_is_grab_tool(br)) return false; + break; default: - ; - } + break; + } return true; } diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 8db9215a376..3ecde56b5d0 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -333,7 +333,7 @@ int imapaint_pick_face(ViewContext *vc, const int mval[2], unsigned int *index, /* sample only on the exact position */ *index = view3d_sample_backbuf(vc, mval[0], mval[1]); - if ((*index) <= 0 || (*index) > (unsigned int)totface) { + if ((*index) == 0 || (*index) > (unsigned int)totface) { return 0; } diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 173a76a54e8..3ac3564ed45 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -380,11 +380,9 @@ static int wpaint_mirror_vgroup_ensure(Object *ob, const int vgroup_active) flip_side_name(name, defgroup->name, FALSE); mirrdef = defgroup_name_index(ob, name); if (mirrdef == -1) { - int olddef = ob->actdef; /* tsk, ED_vgroup_add sets the active defgroup */ - if (ED_vgroup_add_name(ob, name)) { + if (BKE_defgroup_new(ob, name)) { mirrdef = BLI_countlist(&ob->defbase) - 1; } - ob->actdef = olddef; } /* curdef should never be NULL unless this is @@ -2027,7 +2025,7 @@ static void do_weight_paint_vertex( /* *************** set wpaint operator ****************** */ -static int set_wpaint(bContext *C, wmOperator *UNUSED(op)) /* toggle */ +static int wpaint_mode_toggle_exec(bContext *C, wmOperator *UNUSED(op)) /* toggle */ { Object *ob = CTX_data_active_object(C); Scene *scene = CTX_data_scene(C); @@ -2049,8 +2047,6 @@ static int set_wpaint(bContext *C, wmOperator *UNUSED(op)) /* toggle */ DAG_id_tag_update(&me->id, 0); if (ob->mode & OB_MODE_WEIGHT_PAINT) { - Object *par; - if (wp == NULL) wp = scene->toolsettings->wpaint = new_vpaint(1); @@ -2059,14 +2055,7 @@ static int set_wpaint(bContext *C, wmOperator *UNUSED(op)) /* toggle */ mesh_octree_table(ob, NULL, NULL, 's'); - /* verify if active weight group is also active bone */ - par = modifiers_isDeformedByArmature(ob); - if (par && (par->mode & OB_MODE_POSE)) { - bArmature *arm = par->data; - - if (arm->act_bone) - ED_vgroup_select_by_name(ob, arm->act_bone->name); - } + ED_vgroup_sync_from_pose(ob); } else { mesh_octree_table(NULL, NULL, NULL, 'e'); @@ -2107,7 +2096,7 @@ void PAINT_OT_weight_paint_toggle(wmOperatorType *ot) ot->description = "Toggle weight paint mode in 3D view"; /* api callbacks */ - ot->exec = set_wpaint; + ot->exec = wpaint_mode_toggle_exec; ot->poll = paint_poll_test; /* flags */ @@ -2653,7 +2642,7 @@ void PAINT_OT_weight_set(wmOperatorType *ot) /* ************ set / clear vertex paint mode ********** */ -static int set_vpaint(bContext *C, wmOperator *op) /* toggle */ +static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op) /* toggle */ { Object *ob = CTX_data_active_object(C); Scene *scene = CTX_data_scene(C); @@ -2684,7 +2673,7 @@ static int set_vpaint(bContext *C, wmOperator *op) /* toggle */ ob->mode |= OB_MODE_VERTEX_PAINT; /* Turn off weight painting */ if (ob->mode & OB_MODE_WEIGHT_PAINT) - set_wpaint(C, op); + wpaint_mode_toggle_exec(C, op); if (vp == NULL) vp = scene->toolsettings->vpaint = new_vpaint(0); @@ -2711,7 +2700,7 @@ void PAINT_OT_vertex_paint_toggle(wmOperatorType *ot) ot->description = "Toggle the vertex paint mode in 3D view"; /* api callbacks */ - ot->exec = set_vpaint; + ot->exec = vpaint_mode_toggle_exec; ot->poll = paint_poll_test; /* flags */ @@ -3424,7 +3413,7 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op) ED_view3d_init_mats_rv3d(ob, ar->regiondata); - dm->foreachMappedVert(dm, gradientVert__mapFunc, &data); + dm->foreachMappedVert(dm, gradientVert__mapFunc, &data, DM_FOREACH_NOP); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); diff --git a/source/blender/editors/sculpt_paint/paint_vertex_proj.c b/source/blender/editors/sculpt_paint/paint_vertex_proj.c index 2d5de80efeb..4c06cb8ea0d 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_proj.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_proj.c @@ -107,7 +107,7 @@ static void vpaint_proj_dm_map_cosnos_init(Scene *scene, Object *ob, if (dm->foreachMappedVert) { memset(vp_handle->vcosnos, 0, sizeof(DMCoNo) * me->totvert); - dm->foreachMappedVert(dm, vpaint_proj_dm_map_cosnos_init__map_cb, vp_handle); + dm->foreachMappedVert(dm, vpaint_proj_dm_map_cosnos_init__map_cb, vp_handle, DM_FOREACH_USE_NORMAL); } else { DMCoNo *v_co_no = vp_handle->vcosnos; @@ -183,7 +183,7 @@ static void vpaint_proj_dm_map_cosnos_update(struct VertProjHandle *vp_handle, if (LIKELY(dm->foreachMappedVert)) { fill_vn_fl(vp_handle->dists, me->totvert, FLT_MAX); - dm->foreachMappedVert(dm, vpaint_proj_dm_map_cosnos_update__map_cb, &vp_update); + dm->foreachMappedVert(dm, vpaint_proj_dm_map_cosnos_update__map_cb, &vp_update, DM_FOREACH_USE_NORMAL); } dm->release(dm); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 8e2a29964ee..4b7c2995ea7 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1177,6 +1177,7 @@ static void calc_sculpt_normal(Sculpt *sd, Object *ob, case SCULPT_DISP_DIR_AREA: calc_area_normal(sd, ob, an, nodes, totnode); + break; default: break; @@ -1528,7 +1529,7 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no float *tmpgrid_mask, *tmprow_mask; int v1, v2, v3, v4; int thread_num; - BLI_bitmap *grid_hidden; + BLI_bitmap **grid_hidden; int *grid_indices, totgrid, gridsize, i, x, y; sculpt_brush_test_init(ss, &test); @@ -1553,7 +1554,7 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no for (i = 0; i < totgrid; ++i) { int gi = grid_indices[i]; - BLI_bitmap gh = grid_hidden[gi]; + BLI_bitmap *gh = grid_hidden[gi]; data = griddata[gi]; adj = &gridadj[gi]; @@ -2457,6 +2458,7 @@ static void calc_sculpt_plane(Sculpt *sd, Object *ob, PBVHNode **nodes, int totn case SCULPT_DISP_DIR_AREA: calc_area_normal_and_flatten_center(sd, ob, nodes, totnode, an, fc); + break; default: break; @@ -3534,7 +3536,14 @@ int sculpt_mode_poll(bContext *C) int sculpt_mode_poll_view3d(bContext *C) { - return (sculpt_mode_poll(C) && CTX_wm_region_view3d(C)); + return (sculpt_mode_poll(C) && + CTX_wm_region_view3d(C)); +} + +int sculpt_poll_view3d(bContext *C) +{ + return (sculpt_poll(C) && + CTX_wm_region_view3d(C)); } int sculpt_poll(bContext *C) @@ -4514,7 +4523,7 @@ static void SCULPT_OT_brush_stroke(wmOperatorType *ot) /**** Reset the copy of the mesh that is being sculpted on (currently just for the layer brush) ****/ -static int sculpt_set_persistent_base(bContext *C, wmOperator *UNUSED(op)) +static int sculpt_set_persistent_base_exec(bContext *C, wmOperator *UNUSED(op)) { SculptSession *ss = CTX_data_active_object(C)->sculpt; @@ -4535,7 +4544,7 @@ static void SCULPT_OT_set_persistent_base(wmOperatorType *ot) ot->description = "Reset the copy of the mesh that is being sculpted on"; /* api callbacks */ - ot->exec = sculpt_set_persistent_base; + ot->exec = sculpt_set_persistent_base_exec; ot->poll = sculpt_mode_poll; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -4579,14 +4588,21 @@ void sculpt_dynamic_topology_enable(bContext *C) Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; Mesh *me = ob->data; + const BMAllocTemplate allocsize = {me->totvert, + me->totedge, + me->totloop, + me->totpoly}; sculpt_pbvh_clear(ob); ss->bm_smooth_shading = (scene->toolsettings->sculpt->flags & SCULPT_DYNTOPO_SMOOTH_SHADING); + /* Dynamic topology doesn't ensure selection state is valid, so remove [#36280] */ + BKE_mesh_mselect_clear(me); + /* Create triangles-only BMesh */ - ss->bm = BM_mesh_create(&bm_mesh_allocsize_default); + ss->bm = BM_mesh_create(&allocsize); BM_mesh_bm_from_me(ss->bm, me, true, true, ob->shapenr); sculpt_dynamic_topology_triangulate(ss->bm); @@ -4645,13 +4661,18 @@ void sculpt_dynamic_topology_disable(bContext *C, sculptsession_bm_to_me(ob, TRUE); } - BM_mesh_free(ss->bm); - /* Clear data */ me->flag &= ~ME_SCULPT_DYNAMIC_TOPOLOGY; - ss->bm = NULL; - BM_log_free(ss->bm_log); - ss->bm_log = NULL; + + /* typically valid but with global-undo they can be NULL, [#36234] */ + if (ss->bm) { + BM_mesh_free(ss->bm); + ss->bm = NULL; + } + if (ss->bm_log) { + BM_log_free(ss->bm_log); + ss->bm_log = NULL; + } /* Refresh */ sculpt_update_after_dynamic_topology_toggle(C); @@ -4879,7 +4900,7 @@ int ED_sculpt_mask_layers_ensure(Object *ob, MultiresModifierData *mmd) return ret; } -static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op)) +static int sculpt_mode_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); ToolSettings *ts = CTX_data_tool_settings(C); @@ -4951,7 +4972,7 @@ static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op)) BKE_paint_init(&ts->sculpt->paint, PAINT_CURSOR_SCULPT); - paint_cursor_start(C, sculpt_mode_poll_view3d); + paint_cursor_start(C, sculpt_poll_view3d); } WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene); @@ -4967,7 +4988,7 @@ static void SCULPT_OT_sculptmode_toggle(wmOperatorType *ot) ot->description = "Toggle sculpt mode in 3D view"; /* api callbacks */ - ot->exec = sculpt_toggle_mode; + ot->exec = sculpt_mode_toggle_exec; ot->poll = ED_operator_object_active_editable_mesh; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index 1060999e13f..d904ec3bc96 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -56,7 +56,9 @@ struct MultiresModifierData *sculpt_multires_active(struct Scene *scene, struct int sculpt_mode_poll(struct bContext *C); int sculpt_mode_poll_view3d(struct bContext *C); +/* checks for a brush, not just sculpt mode */ int sculpt_poll(struct bContext *C); +int sculpt_poll_view3d(struct bContext *C); void sculpt_update_mesh_elements(struct Scene *scene, struct Sculpt *sd, struct Object *ob, int need_pmap, int need_mask); @@ -98,14 +100,14 @@ typedef struct SculptUndoNode { /* non-multires */ int maxvert; /* to verify if totvert it still the same */ int *index; /* to restore into right location */ - BLI_bitmap vert_hidden; + BLI_bitmap *vert_hidden; /* multires */ int maxgrid; /* same for grid */ int gridsize; /* same for grid */ int totgrid; /* to restore into right location */ int *grids; /* to restore into right location */ - BLI_bitmap *grid_hidden; + BLI_bitmap **grid_hidden; /* bmesh */ struct BMLogEntry *bm_entry; diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 2cc09ea2aa9..8861777f326 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -210,10 +210,10 @@ static int sculpt_undo_restore_hidden(bContext *C, DerivedMesh *dm, } } else if (unode->maxgrid && dm->getGridData) { - BLI_bitmap *grid_hidden = dm->getGridHidden(dm); + BLI_bitmap **grid_hidden = dm->getGridHidden(dm); for (i = 0; i < unode->totgrid; i++) { - SWAP(BLI_bitmap, + SWAP(BLI_bitmap *, unode->grid_hidden[i], grid_hidden[unode->grids[i]]); @@ -531,7 +531,7 @@ static void sculpt_undo_alloc_and_store_hidden(PBVH *pbvh, SculptUndoNode *unode) { PBVHNode *node = unode->node; - BLI_bitmap *grid_hidden; + BLI_bitmap **grid_hidden; int i, *grid_indices, totgrid; grid_hidden = BKE_pbvh_grid_hidden(pbvh); @@ -539,7 +539,7 @@ static void sculpt_undo_alloc_and_store_hidden(PBVH *pbvh, BKE_pbvh_node_get_grids(pbvh, node, &grid_indices, &totgrid, NULL, NULL, NULL, NULL); - unode->grid_hidden = MEM_mapallocN(sizeof(BLI_bitmap) * totgrid, + unode->grid_hidden = MEM_mapallocN(sizeof(*unode->grid_hidden) * totgrid, "unode->grid_hidden"); for (i = 0; i < totgrid; i++) { diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 4b1954c8889..b5f6fa9a23e 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -226,39 +226,35 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar) { /* reddish color from NLA */ UI_ThemeColor4(TH_ANIM_ACTIVE); + break; } - break; - case ANIMTYPE_SCENE: case ANIMTYPE_OBJECT: { if (sel) glColor4ub(col1b[0], col1b[1], col1b[2], 0x45); else glColor4ub(col1b[0], col1b[1], col1b[2], 0x22); + break; } - break; - case ANIMTYPE_FILLACTD: case ANIMTYPE_DSSKEY: case ANIMTYPE_DSWOR: { if (sel) glColor4ub(col2b[0], col2b[1], col2b[2], 0x45); else glColor4ub(col2b[0], col2b[1], col2b[2], 0x22); + break; } - break; - case ANIMTYPE_GROUP: { if (sel) glColor4ub(col1a[0], col1a[1], col1a[2], 0x22); else glColor4ub(col2a[0], col2a[1], col2a[2], 0x22); + break; } - break; - default: { if (sel) glColor4ub(col1[0], col1[1], col1[2], 0x22); else glColor4ub(col2[0], col2[1], col2[2], 0x22); + break; } - break; } /* draw region twice: firstly backdrop, then the current range */ diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index 803e7b71c77..7c9d867aad6 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -231,11 +231,12 @@ void ACTION_OT_markers_make_local(wmOperatorType *ot) /* *************************** Calculate Range ************************** */ /* Get the min/max keyframes*/ -static void get_keyframe_extents(bAnimContext *ac, float *min, float *max, const short onlySel) +static bool get_keyframe_extents(bAnimContext *ac, float *min, float *max, const short onlySel) { ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; + bool found = false; /* get data to filter, from Action or Dopesheet */ /* XXX: what is sel doing here?! @@ -261,6 +262,7 @@ static void get_keyframe_extents(bAnimContext *ac, float *min, float *max, const const float framenum = (float)gpf->framenum; *min = min_ff(*min, framenum); *max = max_ff(*max, framenum); + found = true; } } else if (ale->datatype == ALE_MASKLAY) { @@ -275,6 +277,7 @@ static void get_keyframe_extents(bAnimContext *ac, float *min, float *max, const const float framenum = (float)masklay_shape->frame; *min = min_ff(*min, framenum); *max = max_ff(*max, framenum); + found = true; } } else { @@ -282,16 +285,18 @@ static void get_keyframe_extents(bAnimContext *ac, float *min, float *max, const float tmin, tmax; /* get range and apply necessary scaling before processing */ - calc_fcurve_range(fcu, &tmin, &tmax, onlySel, TRUE); + if (calc_fcurve_range(fcu, &tmin, &tmax, onlySel, TRUE)) { - if (adt) { - tmin = BKE_nla_tweakedit_remap(adt, tmin, NLATIME_CONVERT_MAP); - tmax = BKE_nla_tweakedit_remap(adt, tmax, NLATIME_CONVERT_MAP); - } + if (adt) { + tmin = BKE_nla_tweakedit_remap(adt, tmin, NLATIME_CONVERT_MAP); + tmax = BKE_nla_tweakedit_remap(adt, tmax, NLATIME_CONVERT_MAP); + } - /* try to set cur using these values, if they're more extreme than previously set values */ - *min = min_ff(*min, tmin); - *max = max_ff(*max, tmax); + /* try to set cur using these values, if they're more extreme than previously set values */ + *min = min_ff(*min, tmin); + *max = max_ff(*max, tmax); + found = true; + } } } @@ -309,6 +314,8 @@ static void get_keyframe_extents(bAnimContext *ac, float *min, float *max, const *max = 100; } } + + return found; } /* ****************** Automatic Preview-Range Operator ****************** */ @@ -357,11 +364,12 @@ void ACTION_OT_previewrange_set(wmOperatorType *ot) /* ****************** View-All Operator ****************** */ -static int actkeys_viewall(bContext *C, const short onlySel) +static int actkeys_viewall(bContext *C, const bool only_sel, const bool only_xaxis) { bAnimContext ac; View2D *v2d; float extra; + bool found; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) @@ -369,15 +377,20 @@ static int actkeys_viewall(bContext *C, const short onlySel) v2d = &ac.ar->v2d; /* set the horizontal range, with an extra offset so that the extreme keys will be in view */ - get_keyframe_extents(&ac, &v2d->cur.xmin, &v2d->cur.xmax, onlySel); + found = get_keyframe_extents(&ac, &v2d->cur.xmin, &v2d->cur.xmax, only_sel); + + if (only_sel && (found == false)) + return OPERATOR_CANCELLED; extra = 0.1f * BLI_rctf_size_x(&v2d->cur); v2d->cur.xmin -= extra; v2d->cur.xmax += extra; /* set vertical range */ - v2d->cur.ymax = 0.0f; - v2d->cur.ymin = (float)-BLI_rcti_size_y(&v2d->mask); + if (only_xaxis == false) { + v2d->cur.ymax = 0.0f; + v2d->cur.ymin = (float)-BLI_rcti_size_y(&v2d->mask); + } /* do View2D syncing */ UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY); @@ -393,13 +406,13 @@ static int actkeys_viewall(bContext *C, const short onlySel) static int actkeys_viewall_exec(bContext *C, wmOperator *UNUSED(op)) { /* whole range */ - return actkeys_viewall(C, FALSE); + return actkeys_viewall(C, false, false); } static int actkeys_viewsel_exec(bContext *C, wmOperator *UNUSED(op)) { /* only selected */ - return actkeys_viewall(C, TRUE); + return actkeys_viewall(C, true, true); } void ACTION_OT_view_all(wmOperatorType *ot) diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index eb755e162a3..9d124cf08ee 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -1079,26 +1079,26 @@ static void mouse_action_keys(bAnimContext *ac, const int mval[2], short select_ { Scene *scene = (Scene *)ale->key_data; scene_to_keylist(ads, scene, &anim_keys, NULL); + break; } - break; case ALE_OB: { Object *ob = (Object *)ale->key_data; ob_to_keylist(ads, ob, &anim_keys, NULL); + break; } - break; case ALE_ACT: { bAction *act = (bAction *)ale->key_data; action_to_keylist(adt, act, &anim_keys, NULL); + break; } - break; case ALE_FCURVE: { FCurve *fcu = (FCurve *)ale->key_data; fcurve_to_keylist(adt, fcu, &anim_keys, NULL); + break; } - break; } } else if (ale->type == ANIMTYPE_SUMMARY) { diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 7b0ff5a656f..a89a02b7e01 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -304,6 +304,7 @@ static void action_channel_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa default: if (wmn->data == ND_KEYS) ED_region_tag_redraw(ar); + break; } } @@ -351,6 +352,7 @@ static void action_main_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), default: if (wmn->data == ND_KEYS) ED_region_tag_redraw(ar); + break; } } diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index b01f653837c..d32be692558 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -266,6 +266,7 @@ static void buttons_area_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier * break; case ND_POSE: buttons_area_redraw(sa, BCONTEXT_DATA); + break; case ND_BONE_ACTIVE: case ND_BONE_SELECT: buttons_area_redraw(sa, BCONTEXT_BONE); @@ -292,6 +293,7 @@ static void buttons_area_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier * buttons_area_redraw(sa, BCONTEXT_OBJECT); buttons_area_redraw(sa, BCONTEXT_DATA); buttons_area_redraw(sa, BCONTEXT_PHYSICS); + break; case ND_SHADING: case ND_SHADING_DRAW: case ND_SHADING_LINKS: diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 7a6da5d8896..de19df9abe2 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -50,6 +50,7 @@ #include "BLI_math.h" #include "BLI_rect.h" #include "BLI_threads.h" +#include "BLI_string.h" #include "BLF_translation.h" @@ -250,13 +251,13 @@ static int open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event) clip = ED_space_clip_get_clip(sc); if (clip) { - strncpy(path, clip->name, sizeof(path)); + BLI_strncpy(path, clip->name, sizeof(path)); BLI_path_abs(path, G.main->name); BLI_parent_dir(path); } else { - strncpy(path, U.textudir, sizeof(path)); + BLI_strncpy(path, U.textudir, sizeof(path)); } if (RNA_struct_property_is_set(op->ptr, "files")) diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 36cf9fc44c6..562a8584560 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -348,7 +348,7 @@ static void clip_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) switch (wmn->data) { case ND_FRAME: clip_scopes_tag_refresh(sa); - /* no break! */ + /* fall-through */ case ND_FRAME_RANGE: ED_area_tag_redraw(sa); @@ -368,7 +368,7 @@ static void clip_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) case NA_EDITED: case NA_EVALUATED: clip_stabilization_tag_refresh(sa); - /* no break! */ + /* fall-through */ case NA_SELECTED: clip_scopes_tag_refresh(sa); @@ -1019,7 +1019,7 @@ static void clip_refresh(const bContext *C, ScrArea *sa) if (ar_channels && !(ar_channels->flag & RGN_FLAG_HIDDEN)) { ar_channels->flag |= RGN_FLAG_HIDDEN; ar_channels->v2d.flag &= ~V2D_IS_INITIALISED; - WM_event_remove_handlers((bContext *)C, &ar_tools->handlers); + WM_event_remove_handlers((bContext *)C, &ar_channels->handlers); view_changed = TRUE; } if (ar_channels && ar_channels->alignment != RGN_ALIGN_NONE) { @@ -1353,8 +1353,8 @@ static void clip_header_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), // if (sc->mode == SC_MODE_MASKEDIT) { ED_region_tag_redraw(ar); + break; } - break; } break; } diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 49b16a68dfc..f3d070452a5 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -420,7 +420,6 @@ static int mouse_on_slide_zone(SpaceClip *sc, MovieTrackingMarker *marker, float padding, int width, int height) { const float size = 12.0f; - int inside = 0; float min[2], max[2]; float dx, dy; @@ -445,8 +444,6 @@ static int mouse_on_slide_zone(SpaceClip *sc, MovieTrackingMarker *marker, return IN_RANGE_INCL(co[0], slide_zone[0] - dx, slide_zone[0] + dx) && IN_RANGE_INCL(co[1], slide_zone[1] - dy, slide_zone[1] + dy); - - return inside; } static int mouse_on_corner(SpaceClip *sc, MovieTrackingMarker *marker, @@ -791,8 +788,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, const wmEvent *event) if (ELEM(event->type, LEFTSHIFTKEY, RIGHTSHIFTKEY)) data->accurate = event->val == KM_PRESS; - /* no break! update area size */ - + /* fall-through */ case MOUSEMOVE: mdelta[0] = event->mval[0] - data->mval[0]; mdelta[1] = event->mval[1] - data->mval[1]; @@ -1230,9 +1226,9 @@ static void track_markers_freejob(void *tmv) BKE_tracking_context_sync(tmj->context); BKE_tracking_context_free(tmj->context); - MEM_freeN(tmj); - WM_main_add_notifier(NC_SCENE | ND_FRAME, tmj->scene); + + MEM_freeN(tmj); } static int track_markers_exec(bContext *C, wmOperator *op) @@ -1715,7 +1711,9 @@ static int clear_track_path_exec(bContext *C, wmOperator *op) if (clear_active) { track = BKE_tracking_track_get_active(tracking); - BKE_tracking_track_path_clear(track, framenr, action); + if (track) { + BKE_tracking_track_path_clear(track, framenr, action); + } } else { track = tracksbase->first; @@ -3480,6 +3478,8 @@ static int clean_tracks_exec(bContext *C, wmOperator *op) track = next; } + BKE_tracking_dopesheet_tag_update(tracking); + WM_event_add_notifier(C, NC_MOVIECLIP | ND_SELECT, clip); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index f1e707f8802..8f25ac38963 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -463,10 +463,7 @@ void folderlist_pushdir(ListBase *folderlist, const char *dir) /* create next folder element */ folder = (FolderList *)MEM_mallocN(sizeof(FolderList), "FolderList"); - folder->foldername = (char *)MEM_mallocN(sizeof(char) * (strlen(dir) + 1), "foldername"); - folder->foldername[0] = '\0'; - - BLI_strncpy(folder->foldername, dir, FILE_MAXDIR); + folder->foldername = BLI_strdup(dir); /* add it to the end of the list */ BLI_addtail(folderlist, folder); @@ -538,6 +535,7 @@ FileList *filelist_new(short type) default: p->readf = filelist_read_dir; p->filterf = is_filtered_file; + break; } return p; @@ -847,7 +845,7 @@ static void filelist_setfiletypes(struct FileList *filelist) } file->flags = file_extension_type(file->relname); - if (filelist->filter_glob && + if (filelist->filter_glob[0] && BLI_testextensie_glob(file->relname, filelist->filter_glob)) { file->flags = OPERATORFILE; @@ -996,6 +994,7 @@ void filelist_sort(struct FileList *filelist, short sort) break; case FILE_SORT_EXTENSION: qsort(filelist->filelist, filelist->numfiles, sizeof(struct direntry), compare_extension); + break; } filelist_filter(filelist); diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 8f9893e3bce..93a68be164a 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -74,20 +74,6 @@ /* -------------- */ -static void do_graph_region_buttons(bContext *UNUSED(C), void *UNUSED(arg), int event) -{ - //Scene *scene = CTX_data_scene(C); - - switch (event) { - - } - - /* default for now */ - //WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob); -} - -/* -------------- */ - static int graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve **fcu) { bAnimContext ac; @@ -162,15 +148,16 @@ static void graph_panel_properties(const bContext *C, Panel *pa) PointerRNA fcu_ptr; uiLayout *layout = pa->layout; uiLayout *col, *row, *sub; - uiBlock *block; + // uiBlock *block; // UNUSED char name[256]; int icon = 0; if (!graph_panel_context(C, &ale, &fcu)) return; - block = uiLayoutGetBlock(layout); - uiBlockSetHandleFunc(block, do_graph_region_buttons, NULL); + // UNUSED + // block = uiLayoutGetBlock(layout); + // uiBlockSetHandleFunc(block, do_graph_region_buttons, NULL); /* F-Curve pointer */ RNA_pointer_create(ale->id, &RNA_FCurve, fcu, &fcu_ptr); @@ -281,7 +268,7 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa) return; block = uiLayoutGetBlock(layout); - uiBlockSetHandleFunc(block, do_graph_region_buttons, NULL); + /* uiBlockSetHandleFunc(block, do_graph_region_buttons, NULL); */ /* only show this info if there are keyframes to edit */ if (get_active_fcurve_keyframe_edit(fcu, &bezt, &prevbezt)) { @@ -383,8 +370,8 @@ static void do_graph_region_driver_buttons(bContext *C, void *UNUSED(arg), int e { /* rebuild depsgraph for the new deps */ DAG_relations_tag_update(bmain); + break; } - break; } /* default for now */ @@ -841,7 +828,7 @@ void graph_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } -static int graph_properties(bContext *C, wmOperator *UNUSED(op)) +static int graph_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = graph_has_buttons_region(sa); @@ -858,7 +845,7 @@ void GRAPH_OT_properties(wmOperatorType *ot) ot->idname = "GRAPH_OT_properties"; ot->description = "Toggle display properties panel"; - ot->exec = graph_properties; + ot->exec = graph_properties_toggle_exec; ot->poll = ED_operator_graphedit_active; /* flags */ diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 765c61b5bed..ccb98dfd13d 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -436,6 +436,7 @@ static void graph_region_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), AReg default: if (wmn->data == ND_KEYS) ED_region_tag_redraw(ar); + break; } } @@ -518,15 +519,13 @@ static void graph_refresh(const bContext *C, ScrArea *sa) switch (sipo->mode) { case SIPO_MODE_ANIMATION: /* all animation */ { - + break; } - break; case SIPO_MODE_DRIVERS: /* drivers only */ { - + break; } - break; } /* region updates? */ @@ -563,11 +562,12 @@ static void graph_refresh(const bContext *C, ScrArea *sa) /* set color of curve here */ switch (fcu->color_mode) { case FCURVE_COLOR_CUSTOM: + { /* User has defined a custom color for this curve already (we assume it's not going to cause clashes with text colors), * which should be left alone... Nothing needs to be done here. */ break; - + } case FCURVE_COLOR_AUTO_RGB: { /* F-Curve's array index is automatically mapped to RGB values. This works best of 3-value vectors. @@ -590,9 +590,8 @@ static void graph_refresh(const bContext *C, ScrArea *sa) col[0] = 0.3f; col[1] = 0.8f; col[2] = 1.0f; break; } + break; } - break; - case FCURVE_COLOR_AUTO_RAINBOW: default: { @@ -600,8 +599,8 @@ static void graph_refresh(const bContext *C, ScrArea *sa) * of current item index + total items to determine some RGB color */ getcolor_fcurve_rainbow(i, items, fcu->color); + break; } - break; } } diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 4b1975bc058..144d2c14e9f 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -886,7 +886,7 @@ void image_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } -static int image_properties(bContext *C, wmOperator *UNUSED(op)) +static int image_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = image_has_buttons_region(sa); @@ -903,14 +903,14 @@ void IMAGE_OT_properties(wmOperatorType *ot) ot->idname = "IMAGE_OT_properties"; ot->description = "Toggle display properties panel"; - ot->exec = image_properties; + ot->exec = image_properties_toggle_exec; ot->poll = ED_operator_image_active; /* flags */ ot->flag = 0; } -static int image_scopes(bContext *C, wmOperator *UNUSED(op)) +static int image_scopes_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = image_has_scope_region(sa); @@ -927,7 +927,7 @@ void IMAGE_OT_scopes(wmOperatorType *ot) ot->idname = "IMAGE_OT_scopes"; ot->description = "Toggle display scopes panel"; - ot->exec = image_scopes; + ot->exec = image_scopes_toggle_exec; ot->poll = ED_operator_image_active; /* flags */ diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 20bbfbbf343..2da3f3adb67 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1204,7 +1204,8 @@ static char imtype_best_depth(ImBuf *ibuf, const char imtype) } } -static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, Scene *scene, const short guess_path) +static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, Scene *scene, + const bool guess_path, const bool save_as_render) { void *lock; ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock); @@ -1253,13 +1254,20 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, /* check for empty path */ if (guess_path && simopts->filepath[0] == 0) { - if ((G.ima[0] == '/') && (G.ima[1] == '/') && (G.ima[2] == '\0')) { - BLI_strncpy(simopts->filepath, "//untitled", FILE_MAX); + const bool is_prev_save = !STREQ(G.ima, "//"); + if (save_as_render) { + if (is_prev_save) { + BLI_strncpy(simopts->filepath, G.ima, sizeof(simopts->filepath)); + } + else { + BLI_strncpy(simopts->filepath, "//untitled", sizeof(simopts->filepath)); + BLI_path_abs(simopts->filepath, G.main->name); + } } else { - BLI_strncpy(simopts->filepath, G.ima, FILE_MAX); + BLI_snprintf(simopts->filepath, sizeof(simopts->filepath), "//%s", ima->id.name + 2); + BLI_path_abs(simopts->filepath, is_prev_save ? G.ima : G.main->name); } - BLI_path_abs(simopts->filepath, G.main->name); } /* color management */ @@ -1430,7 +1438,7 @@ static int image_save_as_exec(bContext *C, wmOperator *op) /* just in case to initialize values, * these should be set on invoke or by the caller. */ - save_image_options_init(&simopts, sima, CTX_data_scene(C), 0); + save_image_options_init(&simopts, sima, CTX_data_scene(C), false, false); save_image_options_from_op(&simopts, op); @@ -1453,13 +1461,14 @@ static int image_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS Image *ima = ED_space_image(sima); Scene *scene = CTX_data_scene(C); SaveImageOptions simopts; + const bool save_as_render = ((ima->source == IMA_SRC_VIEWER) || (ima->flag & IMA_VIEW_AS_RENDER)); if (RNA_struct_property_is_set(op->ptr, "filepath")) return image_save_as_exec(C, op); save_image_options_defaults(&simopts); - if (save_image_options_init(&simopts, sima, scene, TRUE) == 0) + if (save_image_options_init(&simopts, sima, scene, true, save_as_render) == 0) return OPERATOR_CANCELLED; save_image_options_to_op(&simopts, op); @@ -1468,10 +1477,7 @@ static int image_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS RNA_boolean_set(op->ptr, "copy", TRUE); } - if (ima->source == IMA_SRC_VIEWER || (ima->flag & IMA_VIEW_AS_RENDER)) - RNA_boolean_set(op->ptr, "save_as_render", TRUE); - else - RNA_boolean_set(op->ptr, "save_as_render", FALSE); + RNA_boolean_set(op->ptr, "save_as_render", save_as_render); op->customdata = MEM_mallocN(sizeof(simopts.im_format), __func__); memcpy(op->customdata, &simopts.im_format, sizeof(simopts.im_format)); @@ -1570,7 +1576,7 @@ static int image_save_exec(bContext *C, wmOperator *op) SaveImageOptions simopts; save_image_options_defaults(&simopts); - if (save_image_options_init(&simopts, sima, scene, FALSE) == 0) + if (save_image_options_init(&simopts, sima, scene, false, false) == 0) return OPERATOR_CANCELLED; save_image_options_from_op(&simopts, op); @@ -1892,6 +1898,8 @@ static int image_invert_exec(bContext *C, wmOperator *op) void IMAGE_OT_invert(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name = "Invert Channels"; ot->idname = "IMAGE_OT_invert"; @@ -1902,10 +1910,14 @@ void IMAGE_OT_invert(wmOperatorType *ot) ot->poll = image_invert_poll; /* properties */ - RNA_def_boolean(ot->srna, "invert_r", 0, "Red", "Invert Red Channel"); - RNA_def_boolean(ot->srna, "invert_g", 0, "Green", "Invert Green Channel"); - RNA_def_boolean(ot->srna, "invert_b", 0, "Blue", "Invert Blue Channel"); - RNA_def_boolean(ot->srna, "invert_a", 0, "Alpha", "Invert Alpha Channel"); + prop = RNA_def_boolean(ot->srna, "invert_r", 0, "Red", "Invert Red Channel"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + prop = RNA_def_boolean(ot->srna, "invert_g", 0, "Green", "Invert Green Channel"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + prop = RNA_def_boolean(ot->srna, "invert_b", 0, "Blue", "Invert Blue Channel"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); + prop = RNA_def_boolean(ot->srna, "invert_a", 0, "Alpha", "Invert Alpha Channel"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 2b106e13836..c0ef59e9e25 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -492,6 +492,7 @@ static void image_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) break; } case NC_GEOM: + { switch (wmn->data) { case ND_DATA: case ND_SELECT: @@ -500,6 +501,8 @@ static void image_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) ED_area_tag_redraw(sa); break; } + break; + } case NC_OBJECT: { Object *ob = (Object *)wmn->reference; @@ -512,6 +515,7 @@ static void image_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) } break; } + break; } } } @@ -872,7 +876,7 @@ static void image_header_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ED_region_tag_redraw(ar); break; } - + break; } } diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index 10b935502ba..07f4b64d187 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -271,6 +271,7 @@ static void info_header_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARegi case NC_ID: if (wmn->action == NA_RENAME) ED_region_tag_redraw(ar); + break; } } diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c index a55da0e3b2c..2c521532484 100644 --- a/source/blender/editors/space_logic/logic_buttons.c +++ b/source/blender/editors/space_logic/logic_buttons.c @@ -50,7 +50,7 @@ #include "interface_intern.h" #include "logic_intern.h" -static int logic_properties(bContext *C, wmOperator *UNUSED(op)) +static int logic_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = logic_has_buttons_region(sa); @@ -67,7 +67,7 @@ void LOGIC_OT_properties(wmOperatorType *ot) ot->description = "Toggle display properties panel"; ot->idname = "LOGIC_OT_properties"; - ot->exec = logic_properties; + ot->exec = logic_properties_toggle_exec; ot->poll = ED_operator_logic_active; /* flags */ diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index 9206f3f024a..d3bef346705 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -125,9 +125,8 @@ static int nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA } found = 1; + break; } - break; - case ANIMTYPE_SCENE: /* Top-Level Widgets doubling up as datablocks */ case ANIMTYPE_OBJECT: case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */ @@ -167,8 +166,8 @@ static int nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA */ found = -1; } + break; } - break; } if (found > 0) @@ -553,7 +552,7 @@ void nla_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } -static int nla_properties(bContext *C, wmOperator *UNUSED(op)) +static int nla_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = nla_has_buttons_region(sa); @@ -570,7 +569,7 @@ void NLA_OT_properties(wmOperatorType *ot) ot->idname = "NLA_OT_properties"; ot->description = "Toggle display properties panel"; - ot->exec = nla_properties; + ot->exec = nla_properties_toggle_exec; ot->poll = ED_operator_nla_active; /* flags */ diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index bf914a05620..c0e559a34cf 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -119,8 +119,8 @@ static int mouse_nla_channels(bAnimContext *ac, float x, int channel_index, shor } notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); + break; } - break; case ANIMTYPE_OBJECT: { bDopeSheet *ads = (bDopeSheet *)ac->data; @@ -161,9 +161,8 @@ static int mouse_nla_channels(bAnimContext *ac, float x, int channel_index, shor /* notifiers - channel was selected */ notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); } + break; } - break; - case ANIMTYPE_FILLACTD: /* Action Expander */ case ANIMTYPE_DSMAT: /* Datablock AnimData Expanders */ case ANIMTYPE_DSLAM: @@ -200,9 +199,8 @@ static int mouse_nla_channels(bAnimContext *ac, float x, int channel_index, shor } notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); + break; } - break; - case ANIMTYPE_NLATRACK: { NlaTrack *nlt = (NlaTrack *)ale->data; @@ -260,8 +258,8 @@ static int mouse_nla_channels(bAnimContext *ac, float x, int channel_index, shor /* notifier flags - channel was selected */ notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); } + break; } - break; case ANIMTYPE_NLAACTION: { AnimData *adt = BKE_animdata_from_id(ale->id); @@ -316,12 +314,12 @@ static int mouse_nla_channels(bAnimContext *ac, float x, int channel_index, shor notifierFlags |= (ND_ANIMCHAN | NA_SELECTED); } } + break; } - break; - default: if (G.debug & G_DEBUG) printf("Error: Invalid channel type in mouse_nla_channels()\n"); + break; } /* free channels */ diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 5f3e1ef88e3..b4c52a5b1ca 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -307,8 +307,8 @@ static void nla_draw_strip(SpaceNla *snla, AnimData *adt, NlaTrack *nlt, NlaStri glVertex2f(strip->start, yminc); glEnd(); } - /* no break needed... */ - + /* fall-through */ + /* this only draws after the strip */ case NLASTRIP_EXTEND_HOLD_FORWARD: /* only need to try and draw if the next strip doesn't occur immediately after */ @@ -563,9 +563,8 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar) nla_draw_strip_frames_text(nlt, strip, v2d, yminc, ymaxc); } } + break; } - break; - case ANIMTYPE_NLAACTION: { AnimData *adt = ale->adt; @@ -603,8 +602,8 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar) fdrawline(v2d->cur.xmin, ymaxc - NLACHANNEL_SKIP, v2d->cur.xmax, ymaxc - NLACHANNEL_SKIP); glDisable(GL_BLEND); + break; } - break; } } @@ -684,8 +683,8 @@ static void draw_nla_channel_list_gl(bAnimContext *ac, ListBase *anim_data, View /* draw manually still */ do_draw = TRUE; + break; } - break; case ANIMTYPE_NLAACTION: /* NLA Action-Line */ { bAction *act = (bAction *)ale->data; @@ -698,9 +697,8 @@ static void draw_nla_channel_list_gl(bAnimContext *ac, ListBase *anim_data, View /* draw manually still */ do_draw = TRUE; + break; } - break; - default: /* handled by standard channel-drawing API */ // draw backdrops only... ANIM_channel_draw(ac, ale, yminc, ymaxc); @@ -725,17 +723,15 @@ static void draw_nla_channel_list_gl(bAnimContext *ac, ListBase *anim_data, View /* same as for textures */ offset = 0.7f * U.widget_unit; indent = 1; + break; } - break; - case NTREE_TEXTURE: { /* even more */ offset = U.widget_unit; indent = 1; + break; } - break; - default: /* normal will do */ offset = 0.7f * U.widget_unit; diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index e54c1e8323a..4d4f27cf1ad 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -427,6 +427,7 @@ static void nla_main_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ARe default: if (wmn->data == ND_KEYS) ED_region_tag_redraw(ar); + break; } } @@ -457,10 +458,10 @@ static void nla_channel_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), if (wmn->action == NA_RENAME) ED_region_tag_redraw(ar); break; - default: if (wmn->data == ND_KEYS) ED_region_tag_redraw(ar); + break; } } diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 82104d2c837..cf3c0454e6b 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -790,6 +790,12 @@ static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA node_buts_image_user(layout, C, &iuserptr, &imaptr, &iuserptr); } +static void node_shader_buts_tex_image_details(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + PointerRNA iuserptr = RNA_pointer_get(ptr, "image_user"); + uiTemplateImage(layout, C, ptr, "image", &iuserptr, 0); +} + static void node_shader_buts_tex_environment(uiLayout *layout, bContext *C, PointerRNA *ptr) { PointerRNA imaptr = RNA_pointer_get(ptr, "image"); @@ -993,6 +999,7 @@ static void node_shader_set_butfunc(bNodeType *ntype) break; case SH_NODE_TEX_IMAGE: ntype->uifunc = node_shader_buts_tex_image; + ntype->uifuncbut = node_shader_buts_tex_image_details; break; case SH_NODE_TEX_ENVIRONMENT: ntype->uifunc = node_shader_buts_tex_environment; @@ -1062,19 +1069,10 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA * static void node_composit_buts_image_details(uiLayout *layout, bContext *C, PointerRNA *ptr) { bNode *node = ptr->data; - PointerRNA imaptr; - - node_composit_buts_image(layout, C, ptr); - - uiItemR(layout, ptr, "use_straight_alpha_output", 0, NULL, 0); + PointerRNA iuserptr; - if (!node->id) - return; - - imaptr = RNA_pointer_get(ptr, "image"); - - uiTemplateColorspaceSettings(layout, &imaptr, "colorspace_settings"); - uiItemR(layout, &imaptr, "alpha_mode", 0, NULL, 0); + RNA_pointer_create((ID *)ptr->id.data, &RNA_ImageUser, node->storage, &iuserptr); + uiTemplateImage(layout, C, ptr, "image", &iuserptr, 0); } static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, PointerRNA *ptr) @@ -1389,6 +1387,7 @@ static void node_composit_buts_zcombine(uiLayout *layout, bContext *UNUSED(C), P col = uiLayoutColumn(layout, TRUE); uiItemR(col, ptr, "use_alpha", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "use_antialias_z", 0, NULL, ICON_NONE); } @@ -2548,6 +2547,15 @@ static void node_texture_buts_image(uiLayout *layout, bContext *C, PointerRNA *p uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL); } +static void node_texture_buts_image_details(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + bNode *node = ptr->data; + PointerRNA iuserptr; + + RNA_pointer_create((ID *)ptr->id.data, &RNA_ImageUser, node->storage, &iuserptr); + uiTemplateImage(layout, C, ptr, "image", &iuserptr, 0); +} + static void node_texture_buts_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "filepath", 0, "", ICON_NONE); @@ -2592,6 +2600,7 @@ static void node_texture_set_butfunc(bNodeType *ntype) case TEX_NODE_IMAGE: ntype->uifunc = node_texture_buts_image; + ntype->uifuncbut = node_texture_buts_image_details; break; case TEX_NODE_OUTPUT: @@ -2777,7 +2786,8 @@ static void std_node_socket_draw(bContext *C, uiLayout *layout, PointerRNA *ptr, case SOCK_VECTOR: uiTemplateComponentMenu(layout, ptr, "default_value", text); break; - case SOCK_RGBA: { + case SOCK_RGBA: + { uiLayout *row = uiLayoutRow(layout, false); uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT); /* draw the socket name right of the actual button */ @@ -2785,14 +2795,14 @@ static void std_node_socket_draw(bContext *C, uiLayout *layout, PointerRNA *ptr, uiItemL(row, text, 0); break; } - case SOCK_STRING: { + case SOCK_STRING: + { uiLayout *row = uiLayoutRow(layout, true); /* draw the socket name right of the actual button */ uiItemR(row, ptr, "default_value", 0, "", 0); uiItemL(row, text, 0); break; } - default: node_socket_button_label(C, layout, ptr, node_ptr, text); break; @@ -2806,7 +2816,8 @@ static void std_node_socket_interface_draw(bContext *UNUSED(C), uiLayout *layout /*int subtype = sock->typeinfo->subtype;*/ switch (type) { - case SOCK_FLOAT: { + case SOCK_FLOAT: + { uiLayout *row; uiItemR(layout, ptr, "default_value", 0, NULL, 0); row = uiLayoutRow(layout, true); @@ -2814,7 +2825,8 @@ static void std_node_socket_interface_draw(bContext *UNUSED(C), uiLayout *layout uiItemR(row, ptr, "max_value", 0, "Max", 0); break; } - case SOCK_INT: { + case SOCK_INT: + { uiLayout *row; uiItemR(layout, ptr, "default_value", 0, NULL, 0); row = uiLayoutRow(layout, true); @@ -2822,11 +2834,13 @@ static void std_node_socket_interface_draw(bContext *UNUSED(C), uiLayout *layout uiItemR(row, ptr, "max_value", 0, "Max", 0); break; } - case SOCK_BOOLEAN: { + case SOCK_BOOLEAN: + { uiItemR(layout, ptr, "default_value", 0, NULL, 0); break; } - case SOCK_VECTOR: { + case SOCK_VECTOR: + { uiLayout *row; uiItemR(layout, ptr, "default_value", UI_ITEM_R_EXPAND, NULL, 0); row = uiLayoutRow(layout, true); @@ -2834,11 +2848,13 @@ static void std_node_socket_interface_draw(bContext *UNUSED(C), uiLayout *layout uiItemR(row, ptr, "max_value", 0, "Max", 0); break; } - case SOCK_RGBA: { + case SOCK_RGBA: + { uiItemR(layout, ptr, "default_value", 0, NULL, 0); break; } - case SOCK_STRING: { + case SOCK_STRING: + { uiItemR(layout, ptr, "default_value", 0, NULL, 0); break; } diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c index d5224a37358..4c40b6c412b 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.c @@ -339,8 +339,6 @@ static int node_add_file_exec(bContext *C, wmOperator *op) } } - node_deselect_all(snode); - switch (snode->nodetree->type) { case NTREE_SHADER: type = SH_NODE_TEX_IMAGE; @@ -410,6 +408,69 @@ void NODE_OT_add_file(wmOperatorType *ot) RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME - 2, "Name", "Datablock name to assign"); } +/* ****************** Add Mask Node Operator ******************* */ + +static int node_add_mask_poll(bContext *C) +{ + SpaceNode *snode = CTX_wm_space_node(C); + + return ED_operator_node_editable(C) && snode->nodetree->type == NTREE_COMPOSIT; +} + +static int node_add_mask_invoke(bContext *C, wmOperator *op, const wmEvent *event) +{ + ARegion *ar = CTX_wm_region(C); + SpaceNode *snode = CTX_wm_space_node(C); + bNode *node; + ID *mask = NULL; + + /* check input variables */ + char name[MAX_ID_NAME - 2]; + RNA_string_get(op->ptr, "name", name); + mask = BKE_libblock_find_name(ID_MSK, name); + if (!mask) { + BKE_reportf(op->reports, RPT_ERROR, "Mask '%s' not found", name); + return OPERATOR_CANCELLED; + } + + ED_preview_kill_jobs(C); + + /* convert mouse coordinates to v2d space */ + UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], + &snode->cursor[0], &snode->cursor[1]); + node = node_add_node(C, NULL, CMP_NODE_MASK, snode->cursor[0], snode->cursor[1]); + + if (!node) { + BKE_report(op->reports, RPT_WARNING, "Could not add a mask node"); + return OPERATOR_CANCELLED; + } + + node->id = mask; + id_us_plus(mask); + + snode_notify(C, snode); + snode_dag_update(C, snode); + + return OPERATOR_FINISHED; +} + +void NODE_OT_add_mask(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Add Mask Node"; + ot->description = "Add a mask node to the current node editor"; + ot->idname = "NODE_OT_add_mask"; + + /* callbacks */ + ot->invoke = node_add_mask_invoke; + ot->poll = node_add_mask_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + RNA_def_string(ot->srna, "name", "Mask", MAX_ID_NAME - 2, "Name", "Datablock name to assign"); +} + /********************** New node tree operator *********************/ static int new_node_tree_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c index 7068973b2bf..f95e895bef2 100644 --- a/source/blender/editors/space_node/node_buttons.c +++ b/source/blender/editors/space_node/node_buttons.c @@ -206,7 +206,7 @@ void node_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } -static int node_properties(bContext *C, wmOperator *UNUSED(op)) +static int node_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = node_has_buttons_region(sa); @@ -230,7 +230,7 @@ void NODE_OT_properties(wmOperatorType *ot) ot->description = "Toggles the properties panel display"; ot->idname = "NODE_OT_properties"; - ot->exec = node_properties; + ot->exec = node_properties_toggle_exec; ot->poll = node_properties_poll; /* flags */ diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 7da06bcf3a6..dce04bb8c42 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -91,18 +91,18 @@ static bNodeTree *node_tree_from_ID(ID *id) short idtype = GS(id->name); switch (idtype) { - case ID_NT: - return (bNodeTree *)id; - case ID_MA: - return ((Material *)id)->nodetree; - case ID_LA: - return ((Lamp *)id)->nodetree; - case ID_WO: - return ((World *)id)->nodetree; - case ID_SCE: - return ((Scene *)id)->nodetree; - case ID_TE: - return ((Tex *)id)->nodetree; + case ID_NT: + return (bNodeTree *)id; + case ID_MA: + return ((Material *)id)->nodetree; + case ID_LA: + return ((Lamp *)id)->nodetree; + case ID_WO: + return ((World *)id)->nodetree; + case ID_SCE: + return ((Scene *)id)->nodetree; + case ID_TE: + return ((Tex *)id)->nodetree; } } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index e10cba43d71..9b48774588d 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -577,9 +577,10 @@ void snode_set_context(const bContext *C) if (!treetype || (treetype->poll && !treetype->poll(C, treetype))) { - /* invalid tree type, disable */ - snode->tree_idname[0] = '\0'; - ED_node_tree_start(snode, NULL, NULL, NULL); + /* invalid tree type, skip + * NB: not resetting the node path here, invalid bNodeTreeType + * may still be registered at a later point. + */ return; } @@ -2261,24 +2262,26 @@ static int ntree_socket_move_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; switch (direction) { - case 1: { /* up */ - bNodeSocket *before = iosock->prev; - BLI_remlink(lb, iosock); - if (before) - BLI_insertlinkbefore(lb, before, iosock); - else - BLI_addhead(lb, iosock); - break; - } - case 2: { /* down */ - bNodeSocket *after = iosock->next; - BLI_remlink(lb, iosock); - if (after) - BLI_insertlinkafter(lb, after, iosock); - else - BLI_addtail(lb, iosock); - break; - } + case 1: + { /* up */ + bNodeSocket *before = iosock->prev; + BLI_remlink(lb, iosock); + if (before) + BLI_insertlinkbefore(lb, before, iosock); + else + BLI_addhead(lb, iosock); + break; + } + case 2: + { /* down */ + bNodeSocket *after = iosock->next; + BLI_remlink(lb, iosock); + if (after) + BLI_insertlinkafter(lb, after, iosock); + else + BLI_addtail(lb, iosock); + break; + } } ntreeUpdateTree(CTX_data_main(C), ntree); diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index a9a17b182a4..1a2e90e5522 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -143,6 +143,7 @@ void draw_nodespace_back_pix(const struct bContext *C, struct ARegion *ar, struc bNode *node_add_node(const struct bContext *C, const char *idname, int type, float locx, float locy); void NODE_OT_add_reroute(struct wmOperatorType *ot); void NODE_OT_add_file(struct wmOperatorType *ot); +void NODE_OT_add_mask(struct wmOperatorType *ot); void NODE_OT_new_node_tree(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c index 2476a9b8b99..566bb1600cc 100644 --- a/source/blender/editors/space_node/node_ops.c +++ b/source/blender/editors/space_node/node_ops.c @@ -101,6 +101,7 @@ void node_operatortypes(void) WM_operatortype_append(NODE_OT_backimage_sample); WM_operatortype_append(NODE_OT_add_file); + WM_operatortype_append(NODE_OT_add_mask); WM_operatortype_append(NODE_OT_new_node_tree); diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index beea4dc3183..244b222811e 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -356,7 +356,7 @@ static int node_link_viewer(const bContext *C, bNode *tonode) } -static int node_active_link_viewer(bContext *C, wmOperator *UNUSED(op)) +static int node_active_link_viewer_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); bNode *node; @@ -385,7 +385,7 @@ void NODE_OT_link_viewer(wmOperatorType *ot) ot->idname = "NODE_OT_link_viewer"; /* api callbacks */ - ot->exec = node_active_link_viewer; + ot->exec = node_active_link_viewer_exec; ot->poll = composite_node_editable; /* flags */ diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index ea745c47690..e17699309ef 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -429,6 +429,7 @@ void NODE_OT_select(wmOperatorType *ot) /* api callbacks */ ot->invoke = node_select_invoke; + ot->exec = node_select_exec; ot->poll = ED_operator_node_active; /* flags */ @@ -925,7 +926,7 @@ static uiBlock *node_find_menu(bContext *C, ARegion *ar, void *arg_op) uiEndBlock(C, block); // uiButActiveOnly(C, ar, block, but); XXX using this here makes Blender hang - investigate - event = *(win->eventstate); /* XXX huh huh? make api call */ + wm_event_init_from_window(win, &event); event.type = EVT_BUT_OPEN; event.val = KM_PRESS; event.customdata = but; diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c index b74d1bf2ef8..83c11e69d84 100644 --- a/source/blender/editors/space_node/node_templates.c +++ b/source/blender/editors/space_node/node_templates.c @@ -675,23 +675,23 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree, /* input not linked, show value */ if (!(input->flag & SOCK_HIDE_VALUE)) { switch (input->type) { - case SOCK_FLOAT: - case SOCK_INT: - case SOCK_BOOLEAN: - case SOCK_RGBA: - case SOCK_STRING: - row = uiLayoutRow(split, TRUE); - uiItemR(row, &inputptr, "default_value", 0, "", ICON_NONE); - break; - case SOCK_VECTOR: - row = uiLayoutRow(split, FALSE); - col = uiLayoutColumn(row, FALSE); - uiItemR(col, &inputptr, "default_value", 0, "", ICON_NONE); - break; - - default: - row = uiLayoutRow(split, FALSE); - break; + case SOCK_FLOAT: + case SOCK_INT: + case SOCK_BOOLEAN: + case SOCK_RGBA: + case SOCK_STRING: + row = uiLayoutRow(split, TRUE); + uiItemR(row, &inputptr, "default_value", 0, "", ICON_NONE); + break; + case SOCK_VECTOR: + row = uiLayoutRow(split, FALSE); + col = uiLayoutColumn(row, FALSE); + uiItemR(col, &inputptr, "default_value", 0, "", ICON_NONE); + break; + + default: + row = uiLayoutRow(split, FALSE); + break; } } else diff --git a/source/blender/editors/space_node/node_toolbar.c b/source/blender/editors/space_node/node_toolbar.c index 86da4009b17..dd5bad3f8ad 100644 --- a/source/blender/editors/space_node/node_toolbar.c +++ b/source/blender/editors/space_node/node_toolbar.c @@ -60,7 +60,7 @@ void node_toolbar_register(ARegionType *UNUSED(art)) /* ********** operator to open/close toolshelf region */ -static int node_toolbar(bContext *C, wmOperator *UNUSED(op)) +static int node_toolbar_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = node_has_tools_region(sa); @@ -84,7 +84,7 @@ void NODE_OT_toolbar(wmOperatorType *ot) ot->description = "Toggles tool shelf display"; ot->idname = "NODE_OT_toolbar"; - ot->exec = node_toolbar; + ot->exec = node_toolbar_toggle_exec; ot->poll = node_toolbar_poll; /* flags */ diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c index eed8a10a1db..9e6e1e628f6 100644 --- a/source/blender/editors/space_node/node_view.c +++ b/source/blender/editors/space_node/node_view.c @@ -295,7 +295,7 @@ void NODE_OT_backimage_move(wmOperatorType *ot) ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_POINTER; } -static int backimage_zoom(bContext *C, wmOperator *op) +static int backimage_zoom_exec(bContext *C, wmOperator *op) { SpaceNode *snode = CTX_wm_space_node(C); ARegion *ar = CTX_wm_region(C); @@ -317,7 +317,7 @@ void NODE_OT_backimage_zoom(wmOperatorType *ot) ot->description = "Zoom in/out the background image"; /* api callbacks */ - ot->exec = backimage_zoom; + ot->exec = backimage_zoom_exec; ot->poll = composite_node_active; /* flags */ diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 07fa6997e99..922912fa540 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -41,6 +41,7 @@ #include "BLI_math.h" #include "BKE_context.h" +#include "BKE_library.h" #include "BKE_screen.h" #include "BKE_node.h" @@ -83,6 +84,8 @@ void ED_node_tree_start(SpaceNode *snode, bNodeTree *ntree, ID *id, ID *from) BLI_strncpy(path->node_name, id->name + 2, sizeof(path->node_name)); BLI_addtail(&snode->treepath, path); + + id_us_ensure_real(&ntree->id); } /* update current tree */ @@ -116,6 +119,8 @@ void ED_node_tree_push(SpaceNode *snode, bNodeTree *ntree, bNode *gnode) BLI_addtail(&snode->treepath, path); + id_us_ensure_real(&ntree->id); + /* update current tree */ snode->edittree = ntree; @@ -387,7 +392,8 @@ static void node_area_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn switch (wmn->category) { case NC_SCENE: switch (wmn->data) { - case ND_NODES: { + case ND_NODES: + { ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW); bNodeTreePath *path = snode->treepath.last; /* shift view to node tree center */ @@ -629,7 +635,7 @@ static void node_main_area_draw(const bContext *C, ARegion *ar) /* ************* dropboxes ************* */ -static int node_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) +static int node_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) { ID *id = (ID *)drag->poin; @@ -643,6 +649,23 @@ static int node_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUS return 0; } +static int node_mask_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) +{ + if (drag->type == WM_DRAG_ID) { + ID *id = (ID *)drag->poin; + if (GS(id->name) == ID_MSK) + return 1; + } + return 0; +} + +static void node_id_drop_copy(wmDrag *drag, wmDropBox *drop) +{ + ID *id = (ID *)drag->poin; + + RNA_string_set(drop->ptr, "name", id->name + 2); +} + static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop) { ID *id = (ID *)drag->poin; @@ -660,7 +683,8 @@ static void node_dropboxes(void) { ListBase *lb = WM_dropboxmap_find("Node Editor", SPACE_NODE, RGN_TYPE_WINDOW); - WM_dropbox_add(lb, "NODE_OT_add_file", node_drop_poll, node_id_path_drop_copy); + WM_dropbox_add(lb, "NODE_OT_add_file", node_ima_drop_poll, node_id_path_drop_copy); + WM_dropbox_add(lb, "NODE_OT_add_mask", node_mask_drop_poll, node_id_drop_copy); } diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 3b769761dfb..b308bd09026 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -263,7 +263,7 @@ static void restrictbutton_bone_visibility_cb(bContext *C, void *poin, void *poi { bArmature *arm = (bArmature *)poin; Bone *bone = (Bone *)poin2; - if (bone && (bone->flag & BONE_HIDDEN_P)) + if (bone->flag & BONE_HIDDEN_P) bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); if (CTX_wm_window(C)->eventstate->ctrl) { @@ -277,7 +277,7 @@ static void restrictbutton_bone_select_cb(bContext *C, void *poin, void *poin2) { bArmature *arm = (bArmature *)poin; Bone *bone = (Bone *)poin2; - if (bone && (bone->flag & BONE_UNSELECTABLE)) + if (bone->flag & BONE_UNSELECTABLE) bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); if (CTX_wm_window(C)->eventstate->ctrl) { @@ -464,8 +464,8 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) ED_armature_bone_rename(obedit->data, oldname, newname); WM_event_add_notifier(C, NC_OBJECT | ND_POSE, OBACT); } + break; } - break; case TSE_BONE: { @@ -482,8 +482,8 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) BLI_strncpy(bone->name, oldname, sizeof(bone->name)); ED_armature_bone_rename(ob->data, oldname, newname); WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); + break; } - break; case TSE_POSE_CHANNEL: { bPoseChannel *pchan = te->directdata; @@ -499,8 +499,8 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) BLI_strncpy(pchan->name, oldname, sizeof(pchan->name)); ED_armature_bone_rename(ob->data, oldname, newname); WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); + break; } - break; case TSE_POSEGRP: { Object *ob = (Object *)tselem->id; // id = object @@ -509,8 +509,8 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname) BLI_uniquename(&ob->pose->agroups, grp, CTX_DATA_(BLF_I18NCONTEXT_ID_ACTION, "Group"), '.', offsetof(bActionGroup, name), sizeof(grp->name)); WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob); + break; } - break; case TSE_R_LAYER: break; } @@ -539,21 +539,21 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar uiBlockSetEmboss(block, UI_EMBOSSN); bt = uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_VIEW_OFF, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)te->ys, UI_UNIT_X, UI_UNIT_Y, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, &ptr, "hide", -1, 0, 0, -1, -1, TIP_("Restrict viewport visibility (Ctrl - Recursive)")); uiButSetFunc(bt, restrictbutton_view_cb, scene, ob); uiButSetFlag(bt, UI_BUT_DRAG_LOCK); bt = uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_SELECT_OFF, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), (int)te->ys, UI_UNIT_X, UI_UNIT_Y, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, &ptr, "hide_select", -1, 0, 0, -1, -1, TIP_("Restrict viewport selection (Ctrl - Recursive)")); uiButSetFunc(bt, restrictbutton_sel_cb, scene, ob); uiButSetFlag(bt, UI_BUT_DRAG_LOCK); bt = uiDefIconButR(block, ICONTOG, 0, ICON_RESTRICT_RENDER_OFF, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), (int)te->ys, UI_UNIT_X, UI_UNIT_Y, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y, &ptr, "hide_render", -1, 0, 0, -1, -1, TIP_("Restrict rendering (Ctrl - Recursive)")); uiButSetFunc(bt, restrictbutton_rend_cb, scene, ob); @@ -570,21 +570,21 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar restrict_bool = group_restrict_flag(gr, OB_RESTRICT_VIEW); bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)te->ys, UI_UNIT_X, UI_UNIT_Y, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Restrict/Allow visibility in the 3D View")); uiButSetFunc(bt, restrictbutton_gr_restrict_view, scene, gr); uiButSetFlag(bt, UI_BUT_DRAG_LOCK); restrict_bool = group_restrict_flag(gr, OB_RESTRICT_SELECT); bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_SELECT_ON : ICON_RESTRICT_SELECT_OFF, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), (int)te->ys, UI_UNIT_X, UI_UNIT_Y, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Restrict/Allow selection in the 3D View")); uiButSetFunc(bt, restrictbutton_gr_restrict_select, scene, gr); uiButSetFlag(bt, UI_BUT_DRAG_LOCK); restrict_bool = group_restrict_flag(gr, OB_RESTRICT_RENDER); bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_RENDER_ON : ICON_RESTRICT_RENDER_OFF, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), (int)te->ys, UI_UNIT_X, UI_UNIT_Y, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Restrict/Allow renderability")); uiButSetFunc(bt, restrictbutton_gr_restrict_render, scene, gr); uiButSetFlag(bt, UI_BUT_DRAG_LOCK); @@ -596,7 +596,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar uiBlockSetEmboss(block, UI_EMBOSSN); bt = uiDefIconButBitI(block, ICONTOGN, SCE_LAY_DISABLE, 0, ICON_CHECKBOX_HLT - 1, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)te->ys, UI_UNIT_X, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, te->directdata, 0, 0, 0, 0, TIP_("Render this RenderLayer")); uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); uiButSetFlag(bt, UI_BUT_DRAG_LOCK); @@ -611,7 +611,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar bt = uiDefIconButBitI(block, ICONTOG, passflag, 0, ICON_CHECKBOX_HLT - 1, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)te->ys, UI_UNIT_X, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, layflag, 0, 0, 0, 0, TIP_("Render this Pass")); uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); uiButSetFlag(bt, UI_BUT_DRAG_LOCK); @@ -621,7 +621,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar SCE_PASS_INDIRECT, SCE_PASS_EMIT, SCE_PASS_ENVIRONMENT)) { bt = uiDefIconButBitI(block, TOG, passflag, 0, (*layflag & passflag) ? ICON_DOT : ICON_BLANK1, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), (int)te->ys, UI_UNIT_X, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, layflag, 0, 0, 0, 0, TIP_("Exclude this Pass from Combined")); uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); uiButSetFlag(bt, UI_BUT_DRAG_LOCK); @@ -635,14 +635,14 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar uiBlockSetEmboss(block, UI_EMBOSSN); bt = uiDefIconButBitI(block, ICONTOGN, eModifierMode_Realtime, 0, ICON_RESTRICT_VIEW_OFF, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)te->ys, UI_UNIT_X, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, &(md->mode), 0, 0, 0, 0, TIP_("Restrict/Allow visibility in the 3D View")); uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob); uiButSetFlag(bt, UI_BUT_DRAG_LOCK); bt = uiDefIconButBitI(block, ICONTOGN, eModifierMode_Render, 0, ICON_RESTRICT_RENDER_OFF, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), (int)te->ys, UI_UNIT_X, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y, &(md->mode), 0, 0, 0, 0, TIP_("Restrict/Allow renderability")); uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob); uiButSetFlag(bt, UI_BUT_DRAG_LOCK); @@ -656,14 +656,14 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar uiBlockSetEmboss(block, UI_EMBOSSN); bt = uiDefIconButBitI(block, ICONTOG, BONE_HIDDEN_P, 0, ICON_RESTRICT_VIEW_OFF, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)te->ys, UI_UNIT_X, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, &(bone->flag), 0, 0, 0, 0, TIP_("Restrict/Allow visibility in the 3D View")); uiButSetFunc(bt, restrictbutton_bone_visibility_cb, ob->data, bone); uiButSetFlag(bt, UI_BUT_DRAG_LOCK); bt = uiDefIconButBitI(block, ICONTOG, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), (int)te->ys, UI_UNIT_X, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, &(bone->flag), 0, 0, 0, 0, TIP_("Restrict/Allow selection in the 3D View")); uiButSetFunc(bt, restrictbutton_bone_select_cb, ob->data, bone); @@ -676,14 +676,14 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar uiBlockSetEmboss(block, UI_EMBOSSN); bt = uiDefIconButBitI(block, ICONTOG, BONE_HIDDEN_A, 0, ICON_RESTRICT_VIEW_OFF, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)te->ys, UI_UNIT_X, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, &(ebone->flag), 0, 0, 0, 0, TIP_("Restrict/Allow visibility in the 3D View")); uiButSetFunc(bt, restrictbutton_ebone_visibility_cb, NULL, ebone); uiButSetFlag(bt, UI_BUT_DRAG_LOCK); bt = uiDefIconButBitI(block, ICONTOG, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF, - (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), (int)te->ys, UI_UNIT_X, + (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, &(ebone->flag), 0, 0, 0, 0, TIP_("Restrict/Allow selection in the 3D View")); uiButSetFunc(bt, restrictbutton_ebone_select_cb, NULL, ebone); @@ -735,7 +735,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa prop = te->directdata; if (!(RNA_property_type(prop) == PROP_POINTER && (TSELEM_OPEN(tselem, soops)))) { - uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, (int)te->ys, OL_RNA_COL_SIZEX, + uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX, UI_UNIT_Y - 1); } } @@ -743,7 +743,7 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa ptr = &te->rnaptr; prop = te->directdata; - uiDefAutoButR(block, ptr, prop, te->index, "", ICON_NONE, sizex, (int)te->ys, OL_RNA_COL_SIZEX, + uiDefAutoButR(block, ptr, prop, te->index, "", ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX, UI_UNIT_Y - 1); } } @@ -811,7 +811,7 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi) uiBlockSetDirection(block, UI_DOWN); uiEndBlock(C, block); - event = *(win->eventstate); /* XXX huh huh? make api call */ + wm_event_init_from_window(win, &event); event.type = EVT_BUT_OPEN; event.val = KM_PRESS; event.customdata = but; @@ -929,6 +929,7 @@ static void keymap_type_cb(bContext *C, void *kmi_v, void *UNUSED(arg_v)) case OL_KM_SPECIALS: kmi->type = AKEY; kmi->val = KM_PRESS; + break; } ED_region_tag_redraw(CTX_wm_region(C)); } @@ -959,7 +960,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo /* pass */ } else { - uiDefBlockBut(block, operator_search_menu, kmi, "", xstart, (int)te->ys + 1, butw1, UI_UNIT_Y - 1, + uiDefBlockBut(block, operator_search_menu, kmi, "", xstart, te->ys + 1, butw1, UI_UNIT_Y - 1, TIP_("Assign new Operator")); } xstart += butw1 + 10; @@ -968,7 +969,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo kmi->maptype = keymap_menu_type(kmi->type); str = keymap_type_menu(); - but = uiDefButS(block, MENU, 0, str, xstart, (int)te->ys + 1, butw2, UI_UNIT_Y - 1, &kmi->maptype, + but = uiDefButS(block, MENU, 0, str, xstart, te->ys + 1, butw2, UI_UNIT_Y - 1, &kmi->maptype, 0, 0, 0, 0, TIP_("Event type")); uiButSetFunc(but, keymap_type_cb, kmi, NULL); xstart += butw2 + 5; @@ -976,48 +977,48 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo /* edit actual event */ switch (kmi->maptype) { case OL_KM_KEYBOARD: - uiDefKeyevtButS(block, 0, "", xstart, (int)te->ys + 1, butw2, UI_UNIT_Y - 1, &kmi->type, + uiDefKeyevtButS(block, 0, "", xstart, te->ys + 1, butw2, UI_UNIT_Y - 1, &kmi->type, TIP_("Key code")); xstart += butw2 + 5; break; case OL_KM_MOUSE: str = keymap_mouse_menu(); - uiDefButS(block, MENU, 0, str, xstart, (int)te->ys + 1, butw2, UI_UNIT_Y - 1, &kmi->type, + uiDefButS(block, MENU, 0, str, xstart, te->ys + 1, butw2, UI_UNIT_Y - 1, &kmi->type, 0, 0, 0, 0, TIP_("Mouse button")); xstart += butw2 + 5; break; case OL_KM_TWEAK: str = keymap_tweak_menu(); - uiDefButS(block, MENU, 0, str, xstart, (int)te->ys + 1, butw2, UI_UNIT_Y - 1, &kmi->type, + uiDefButS(block, MENU, 0, str, xstart, te->ys + 1, butw2, UI_UNIT_Y - 1, &kmi->type, 0, 0, 0, 0, TIP_("Tweak gesture")); xstart += butw2 + 5; str = keymap_tweak_dir_menu(); - uiDefButS(block, MENU, 0, str, xstart, (int)te->ys + 1, butw2, UI_UNIT_Y - 1, &kmi->val, + uiDefButS(block, MENU, 0, str, xstart, te->ys + 1, butw2, UI_UNIT_Y - 1, &kmi->val, 0, 0, 0, 0, TIP_("Tweak gesture direction")); xstart += butw2 + 5; break; } /* modifiers */ - uiDefButS(block, OPTION, 0, IFACE_("Shift"), xstart, (int)te->ys + 1, butw3 + 5, UI_UNIT_Y - 1, + uiDefButS(block, OPTION, 0, IFACE_("Shift"), xstart, te->ys + 1, butw3 + 5, UI_UNIT_Y - 1, &kmi->shift, 0, 0, 0, 0, TIP_("Modifier")); xstart += butw3 + 5; - uiDefButS(block, OPTION, 0, IFACE_("Ctrl"), xstart, (int)te->ys + 1, butw3, UI_UNIT_Y - 1, &kmi->ctrl, + uiDefButS(block, OPTION, 0, IFACE_("Ctrl"), xstart, te->ys + 1, butw3, UI_UNIT_Y - 1, &kmi->ctrl, 0, 0, 0, 0, TIP_("Modifier")); xstart += butw3; - uiDefButS(block, OPTION, 0, IFACE_("Alt"), xstart, (int)te->ys + 1, butw3, UI_UNIT_Y - 1, &kmi->alt, + uiDefButS(block, OPTION, 0, IFACE_("Alt"), xstart, te->ys + 1, butw3, UI_UNIT_Y - 1, &kmi->alt, 0, 0, 0, 0, TIP_("Modifier")); xstart += butw3; - uiDefButS(block, OPTION, 0, IFACE_("OS"), xstart, (int)te->ys + 1, butw3, UI_UNIT_Y - 1, &kmi->oskey, + uiDefButS(block, OPTION, 0, IFACE_("OS"), xstart, te->ys + 1, butw3, UI_UNIT_Y - 1, &kmi->oskey, 0, 0, 0, 0, TIP_("Modifier")); xstart += butw3 + 5; - uiDefKeyevtButS(block, 0, "", xstart, (int)te->ys + 1, butw3, UI_UNIT_Y - 1, &kmi->keymodifier, + uiDefKeyevtButS(block, 0, "", xstart, te->ys + 1, butw3, UI_UNIT_Y - 1, &kmi->keymodifier, TIP_("Key Modifier code")); xstart += butw3 + 5; /* rna property */ if (kmi->ptr && kmi->ptr->data) { - uiDefBut(block, LABEL, 0, IFACE_("(RNA property)"), xstart, (int)te->ys + 1, butw2, UI_UNIT_Y - 1, + uiDefBut(block, LABEL, 0, IFACE_("(RNA property)"), xstart, te->ys + 1, butw2, UI_UNIT_Y - 1, NULL, 0, 0, 0, 0, ""); xstart += butw2; } @@ -1063,7 +1064,7 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa spx = te->xs + 1.8f * UI_UNIT_X; if (spx + dx + 0.5f * UI_UNIT_X > ar->v2d.cur.xmax) dx = ar->v2d.cur.xmax - spx - 0.5f * UI_UNIT_X; - bt = uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, (int)te->ys, dx + UI_UNIT_X, UI_UNIT_Y - 1, (void *)te->name, + bt = uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, te->ys, dx + UI_UNIT_X, UI_UNIT_Y - 1, (void *)te->name, 1.0, (float)len, 0, 0, ""); uiButSetRenameFunc(bt, namebutton_cb, tselem); @@ -1252,8 +1253,6 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto } break; } - case TSE_SCRIPT_BASE: - UI_icon_draw(x, y, ICON_TEXT); break; case TSE_POSE_BASE: UI_icon_draw(x, y, ICON_ARMATURE_DATA); break; case TSE_POSE_CHANNEL: @@ -1441,8 +1440,8 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa } tselem_draw_icon(block, xmax, (float)*offsx, (float)ys, tselem, te, 0.5f); - te->xs = (float)*offsx; - te->ys = (float)ys; + te->xs = *offsx; + te->ys = ys; te->xend = (short)*offsx + UI_UNIT_X; te->flag |= TE_ICONROW; // for click @@ -1457,13 +1456,13 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa } /* closed tree element */ -static void outliner_set_coord_tree_element(SpaceOops *soops, TreeElement *te, int startx, int *starty) +static void outliner_set_coord_tree_element(SpaceOops *soops, TreeElement *te, int startx, int starty) { TreeElement *ten; /* store coord and continue, we need coordinates for elements outside view too */ - te->xs = (float)startx; - te->ys = (float)(*starty); + te->xs = startx; + te->ys = starty; for (ten = te->subtree.first; ten; ten = ten->next) { outliner_set_coord_tree_element(soops, ten, startx + UI_UNIT_X, starty); @@ -1657,8 +1656,8 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene } } /* store coord and continue, we need coordinates for elements outside view too */ - te->xs = (float)startx; - te->ys = (float)*starty; + te->xs = startx; + te->ys = *starty; te->xend = startx + offsx; if (TSELEM_OPEN(tselem, soops)) { @@ -1669,7 +1668,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene } else { for (ten = te->subtree.first; ten; ten = ten->next) - outliner_set_coord_tree_element(soops, te, startx, starty); + outliner_set_coord_tree_element(soops, ten, startx, *starty); *starty -= UI_UNIT_Y; } diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 0a1d3a63f2c..cef5fe53407 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -219,7 +219,7 @@ static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, /* do nothing */; } else if (ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, - TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS)) + TSE_DRIVER_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS)) { BKE_report(reports, RPT_WARNING, "Cannot edit builtin name"); } @@ -618,7 +618,7 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op)) te = outliner_find_id(so, &so->tree, (ID *)OBACT); if (te) { /* make te->ys center of view */ - ytop = (int)(te->ys + BLI_rcti_size_y(&v2d->mask) / 2); + ytop = te->ys + BLI_rcti_size_y(&v2d->mask) / 2; if (ytop > 0) ytop = 0; v2d->cur.ymax = (float)ytop; @@ -1181,14 +1181,14 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportL { /* add a new driver with the information obtained (only if valid) */ ANIM_add_driver(reports, id, path, array_index, dflags, DRIVER_TYPE_PYTHON); + break; } - break; case DRIVERS_EDITMODE_REMOVE: { /* remove driver matching the information obtained (only if valid) */ ANIM_remove_driver(reports, id, path, array_index, dflags); + break; } - break; } } diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 3ab412f0ddc..2310ca9b4b5 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -48,7 +48,7 @@ struct Object; typedef struct TreeElement { struct TreeElement *next, *prev, *parent; ListBase subtree; - float xs, ys; // do selection + int xs, ys; // do selection int store_index; // offset in tree store short flag; // flag for non-saved stuff short index; // index for data arrays @@ -77,7 +77,7 @@ typedef struct TreeElement { #define TSE_MODIFIER_BASE 9 #define TSE_MODIFIER 10 #define TSE_LINKED_OB 11 -#define TSE_SCRIPT_BASE 12 +// #define TSE_SCRIPT_BASE 12 // UNUSED #define TSE_POSE_BASE 13 #define TSE_POSE_CHANNEL 14 #define TSE_ANIM_DATA 15 diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 3f06db22f59..9720d981e85 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -704,7 +704,7 @@ static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeS // XXX select_single_seq(seq, 1); p = ed->seqbasep->first; while (p) { - if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + if ((!p->strip) || (!p->strip->stripdata) || (p->strip->stripdata->name[0] == '\0')) { p = p->next; continue; } diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 9b9e7bef42c..fb56c5c6dfe 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -854,17 +854,15 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_WARNING, "Not yet implemented"); break; } + break; } - break; - case OUTLINER_IDOP_LOCAL: { /* make local */ outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb); ED_undo_push(C, "Localized Data"); + break; } - break; - case OUTLINER_IDOP_SINGLE: { /* make single user */ @@ -887,9 +885,8 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_WARNING, "Not yet implemented"); break; } + break; } - break; - case OUTLINER_IDOP_FAKE_ADD: { /* set fake user */ @@ -897,9 +894,8 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL); ED_undo_push(C, "Add Fake User"); + break; } - break; - case OUTLINER_IDOP_FAKE_CLEAR: { /* clear fake user */ @@ -907,8 +903,8 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL); ED_undo_push(C, "Clear Fake User"); + break; } - break; case OUTLINER_IDOP_RENAME: { /* rename */ @@ -916,9 +912,8 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL); ED_undo_push(C, "Rename"); + break; } - break; - case OUTLINER_IDOP_SELECT_LINKED: outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_select_linked_cb); ED_undo_push(C, "Select"); diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index b5c74eea30e..17734f00997 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -616,18 +616,18 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor case ID_LI: { te->name = ((Library *)id)->name; + break; } - break; case ID_SCE: { outliner_add_scene_contents(soops, &te->subtree, (Scene *)id, te); + break; } - break; case ID_OB: { outliner_add_object_contents(soops, te, tselem, (Object *)id); + break; } - break; case ID_ME: { Mesh *me = (Mesh *)id; @@ -641,8 +641,8 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor outliner_add_element(soops, &te->subtree, me->mat[a], te, 0, a); /* could do tfaces with image links, but the images are not grouped nicely. * would require going over all tfaces, sort images in use. etc... */ + break; } - break; case ID_CU: { Curve *cu = (Curve *)id; @@ -653,8 +653,8 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor for (a = 0; a < cu->totcol; a++) outliner_add_element(soops, &te->subtree, cu->mat[a], te, 0, a); + break; } - break; case ID_MB: { MetaBall *mb = (MetaBall *)id; @@ -665,8 +665,8 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor for (a = 0; a < mb->totcol; a++) outliner_add_element(soops, &te->subtree, mb->mat[a], te, 0, a); + break; } - break; case ID_MA: { Material *ma = (Material *)id; @@ -678,8 +678,8 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor for (a = 0; a < MAX_MTEX; a++) { if (ma->mtex[a]) outliner_add_element(soops, &te->subtree, ma->mtex[a]->tex, te, 0, a); } + break; } - break; case ID_TE: { Tex *tex = (Tex *)id; @@ -688,16 +688,16 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor outliner_add_element(soops, &te->subtree, tex, te, TSE_ANIM_DATA, 0); outliner_add_element(soops, &te->subtree, tex->ima, te, 0, 0); + break; } - break; case ID_CA: { Camera *ca = (Camera *)id; if (outliner_animdata_test(ca->adt)) outliner_add_element(soops, &te->subtree, ca, te, TSE_ANIM_DATA, 0); + break; } - break; case ID_LA: { Lamp *la = (Lamp *)id; @@ -709,16 +709,16 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor for (a = 0; a < MAX_MTEX; a++) { if (la->mtex[a]) outliner_add_element(soops, &te->subtree, la->mtex[a]->tex, te, 0, a); } + break; } - break; case ID_SPK: { Speaker *spk = (Speaker *)id; if (outliner_animdata_test(spk->adt)) outliner_add_element(soops, &te->subtree, spk, te, TSE_ANIM_DATA, 0); + break; } - break; case ID_WO: { World *wrld = (World *)id; @@ -730,22 +730,22 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor for (a = 0; a < MAX_MTEX; a++) { if (wrld->mtex[a]) outliner_add_element(soops, &te->subtree, wrld->mtex[a]->tex, te, 0, a); } + break; } - break; case ID_KE: { Key *key = (Key *)id; if (outliner_animdata_test(key->adt)) outliner_add_element(soops, &te->subtree, key, te, TSE_ANIM_DATA, 0); + break; } - break; case ID_AC: { // XXX do we want to be exposing the F-Curves here? //bAction *act = (bAction *)id; + break; } - break; case ID_AR: { bArmature *arm = (bArmature *)id; @@ -791,8 +791,8 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor } } } + break; } - break; } } @@ -804,7 +804,6 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i TreeElement *te; TreeStoreElem *tselem; ID *id = idv; - int a = 0; if (ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) { id = ((PointerRNA *)idv)->id.data; @@ -957,7 +956,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i else if (type == TSE_SEQ_STRIP) { Strip *strip = (Strip *)idv; - if (strip->dir) + if (strip->dir[0] != '\0') te->name = strip->dir; else te->name = IFACE_("Strip None"); @@ -1084,7 +1083,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i te->name = km->idname; if (TSELEM_OPEN(tselem, soops)) { - a = 0; + int a = 0; for (kmi = km->items.first; kmi; kmi = kmi->next, a++) { const char *key = WM_key_event_string(kmi->type); @@ -1131,7 +1130,7 @@ static int need_add_seq_dup(Sequence *seq) { Sequence *p; - if ((!seq->strip) || (!seq->strip->stripdata) || (!seq->strip->stripdata->name)) + if ((!seq->strip) || (!seq->strip->stripdata)) return(1); /* @@ -1140,7 +1139,7 @@ static int need_add_seq_dup(Sequence *seq) */ p = seq->prev; while (p) { - if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + if ((!p->strip) || (!p->strip->stripdata)) { p = p->prev; continue; } @@ -1152,7 +1151,7 @@ static int need_add_seq_dup(Sequence *seq) p = seq->next; while (p) { - if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + if ((!p->strip) || (!p->strip->stripdata)) { p = p->next; continue; } @@ -1171,7 +1170,7 @@ static void outliner_add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *t p = seq; while (p) { - if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) { + if ((!p->strip) || (!p->strip->stripdata) || (p->strip->stripdata->name[0] == '\0')) { p = p->next; continue; } diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 65199ee9c3d..93dfc347b1f 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -118,7 +118,7 @@ static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op, Scene *scene = CTX_data_scene(C); Sequence *last_seq = BKE_sequencer_active_get(scene); if (last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) { - char path[sizeof(last_seq->strip->dir)]; + char path[FILE_MAX]; BLI_strncpy(path, last_seq->strip->dir, sizeof(path)); BLI_path_abs(path, G.main->name); RNA_string_set(op->ptr, identifier, path); @@ -761,7 +761,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) BKE_sequencer_sort(scene); /* last active name */ - strncpy(ed->act_imagedir, strip->dir, FILE_MAXDIR - 1); + BLI_strncpy(ed->act_imagedir, strip->dir, sizeof(ed->act_imagedir)); if (RNA_boolean_get(op->ptr, "overlap") == FALSE) { if (BKE_sequence_test_overlap(ed->seqbasep, seq)) diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c index 197cc64dea4..36589984c78 100644 --- a/source/blender/editors/space_sequencer/sequencer_buttons.c +++ b/source/blender/editors/space_sequencer/sequencer_buttons.c @@ -76,7 +76,7 @@ void sequencer_buttons_register(ARegionType *art) /* **************** operator to open/close properties view ************* */ -static int sequencer_properties(bContext *C, wmOperator *UNUSED(op)) +static int sequencer_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = sequencer_has_buttons_region(sa); @@ -93,7 +93,7 @@ void SEQUENCER_OT_properties(wmOperatorType *ot) ot->idname = "SEQUENCER_OT_properties"; ot->description = "Open sequencer properties panel"; - ot->exec = sequencer_properties; + ot->exec = sequencer_properties_toggle_exec; ot->poll = ED_operator_sequencer_active; /* flags */ diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index af4b4055156..68fd09f5fb7 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -162,12 +162,7 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[ break; case SEQ_TYPE_COLOR: - if (colvars->col) { - rgb_float_to_uchar(col, colvars->col); - } - else { - col[0] = col[1] = col[2] = 128; - } + rgb_float_to_uchar(col, colvars->col); break; case SEQ_TYPE_SOUND_RAM: @@ -178,6 +173,7 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[ default: col[0] = 10; col[1] = 255; col[2] = 40; + break; } } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 135fddfd348..955a9c78c56 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -551,12 +551,14 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen } if (seq1 == NULL) seq1 = seq2; if (seq3 == NULL) seq3 = seq2; + /* fall-through */ case 2: if (seq1 == NULL || seq2 == NULL) { *error_str = N_("2 selected sequence strips are needed"); return 0; } if (seq3 == NULL) seq3 = seq2; + break; } if (seq1 == NULL && seq2 == NULL && seq3 == NULL) { @@ -866,7 +868,7 @@ static int cut_seq_list(Scene *scene, ListBase *slist, int cutframe, return (seq_first_new != NULL); } -static bool insert_gap(Scene *scene, int gap, int cfra) +static bool sequence_offset_after_frame(Scene *scene, const int delta, const int cfra) { Sequence *seq; Editing *ed = BKE_sequencer_editing_get(scene, FALSE); @@ -876,15 +878,13 @@ static bool insert_gap(Scene *scene, int gap, int cfra) if (ed == NULL) return 0; - SEQP_BEGIN (ed, seq) - { + for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->startdisp >= cfra) { - seq->start += gap; + BKE_sequence_translate(scene, seq, delta); BKE_sequence_calc(scene, seq); done = true; } } - SEQ_END return done; } @@ -1017,7 +1017,7 @@ static int sequencer_gap_remove_exec(bContext *C, wmOperator *op) else if (BKE_sequencer_evaluate_frame(scene, cfra) == 0) { done = true; while (BKE_sequencer_evaluate_frame(scene, cfra) == 0) { - done = insert_gap(scene, -1, cfra); + done = sequence_offset_after_frame(scene, -1, cfra); if (done == false) break; } if (done == false || do_all == false) break; @@ -1054,7 +1054,7 @@ static int sequencer_gap_insert_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); int frames = RNA_int_get(op->ptr, "frames"); - insert_gap(scene, frames, CFRA); + sequence_offset_after_frame(scene, frames, CFRA); WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); @@ -2721,7 +2721,6 @@ static void seq_copy_del_sound(Scene *scene, Sequence *seq) } } -/* TODO, validate scenes */ static int sequencer_copy_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -2766,6 +2765,11 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op) for (seq = seqbase_clipboard.first; seq; seq = seq->next) { seq_copy_del_sound(scene, seq); } + + /* duplicate pointers */ + for (seq = seqbase_clipboard.first; seq; seq = seq->next) { + BKE_sequence_clipboard_pointers_store(seq); + } } return OPERATOR_FINISHED; @@ -2790,11 +2794,12 @@ void SEQUENCER_OT_copy(wmOperatorType *ot) static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, TRUE); /* create if needed */ ListBase nseqbase = {NULL, NULL}; int ofs; - Sequence *iseq; + Sequence *iseq, *iseq_first; ED_sequencer_deselect_all(scene); ofs = scene->r.cfra - seqbase_clipboard_frame; @@ -2805,19 +2810,33 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) if (ofs) { for (iseq = nseqbase.first; iseq; iseq = iseq->next) { BKE_sequence_translate(scene, iseq, ofs); - BKE_sequence_sound_init(scene, iseq); } } - iseq = nseqbase.first; + for (iseq = nseqbase.first; iseq; iseq = iseq->next) { + BKE_sequence_clipboard_pointers_restore(iseq, bmain); + } + + for (iseq = nseqbase.first; iseq; iseq = iseq->next) { + BKE_sequence_sound_init(scene, iseq); + } + + iseq_first = nseqbase.first; BLI_movelisttolist(ed->seqbasep, &nseqbase); /* make sure the pasted strips have unique names between them */ - for (; iseq; iseq = iseq->next) { + for (iseq = iseq_first; iseq; iseq = iseq->next) { BKE_sequencer_recursive_apply(iseq, apply_unique_name_cb, scene); } + /* ensure pasted strips don't overlap */ + for (iseq = iseq_first; iseq; iseq = iseq->next) { + if (BKE_sequence_test_overlap(ed->seqbasep, iseq)) { + BKE_sequence_base_shuffle(ed->seqbasep, iseq, scene); + } + } + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index e7fa4c05b9d..b04d2b16e8d 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -149,7 +149,7 @@ static void text_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) } ED_area_tag_redraw(sa); - /* no break -- fall down to tag redraw */ + /* fall-through */ /* fall down to tag redraw */ case NA_ADDED: case NA_REMOVED: ED_area_tag_redraw(sa); diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c index 26e0be264a4..ba61399f6d5 100644 --- a/source/blender/editors/space_text/text_autocomplete.c +++ b/source/blender/editors/space_text/text_autocomplete.c @@ -433,6 +433,7 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e break; case PAGEDOWNKEY: scroll = SUGG_LIST_SIZE - 1; + /* fall-through */ case WHEELDOWNMOUSE: case DOWNARROWKEY: if (event->val == KM_PRESS) { @@ -460,6 +461,7 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e break; case PAGEUPKEY: scroll = SUGG_LIST_SIZE - 1; + /* fall-through */ case WHEELUPMOUSE: case UPARROWKEY: if (event->val == KM_PRESS) { diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 8258d717889..f7116c01a72 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -201,9 +201,10 @@ static void time_draw_cache(SpaceTime *stime, Object *ob, Scene *scene) col[3] = 0.1; break; default: - BLI_assert(0); col[0] = 1.0; col[1] = 0.0; col[2] = 1.0; col[3] = 0.1; + BLI_assert(0); + break; } glColor4fv(col); @@ -403,6 +404,7 @@ static void time_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) /* mainly for updating cache display */ switch (wmn->category) { case NC_OBJECT: + { switch (wmn->data) { case ND_BONE_ACTIVE: case ND_POINTCACHE: @@ -414,7 +416,9 @@ static void time_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) break; } break; + } case NC_SCENE: + { switch (wmn->data) { case ND_OB_ACTIVE: case ND_FRAME: @@ -432,21 +436,29 @@ static void time_listener(bScreen *UNUSED(sc), ScrArea *sa, wmNotifier *wmn) break; } } + break; } - break; } + break; + } case NC_SPACE: + { switch (wmn->data) { case ND_SPACE_CHANGED: ED_area_tag_refresh(sa); break; } + break; + } case NC_WM: + { switch (wmn->data) { case ND_FILEREAD: ED_area_tag_refresh(sa); break; } + break; + } } } @@ -568,11 +580,13 @@ static void time_header_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), /* context changes */ switch (wmn->category) { case NC_SCREEN: + { if (wmn->data == ND_ANIMPLAY) ED_region_tag_redraw(ar); break; - + } case NC_SCENE: + { switch (wmn->data) { case ND_OB_SELECT: case ND_FRAME: @@ -582,11 +596,14 @@ static void time_header_area_listener(bScreen *UNUSED(sc), ScrArea *UNUSED(sa), ED_region_tag_redraw(ar); break; } - + break; + } case NC_SPACE: + { if (wmn->data == ND_SPACE_TIME) ED_region_tag_redraw(ar); break; + } } } diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index f3528ef61b6..68f656bbf57 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -186,8 +186,6 @@ static bool set_pchan_glColor(short colCode, int boneflag, short constflag) return true; } - break; - case PCHAN_COLOR_SOLID: { if (bcolor) { @@ -198,8 +196,6 @@ static bool set_pchan_glColor(short colCode, int boneflag, short constflag) return true; } - break; - case PCHAN_COLOR_CONSTS: { if ((bcolor == NULL) || (bcolor->flag & TH_WIRECOLOR_CONSTCOLS)) { @@ -210,11 +206,8 @@ static bool set_pchan_glColor(short colCode, int boneflag, short constflag) return true; } - else - return 0; + return false; } - break; - case PCHAN_COLOR_SPHEREBONE_BASE: { if (bcolor) { @@ -240,7 +233,6 @@ static bool set_pchan_glColor(short colCode, int boneflag, short constflag) return true; } - break; case PCHAN_COLOR_SPHEREBONE_END: { if (bcolor) { @@ -266,9 +258,8 @@ static bool set_pchan_glColor(short colCode, int boneflag, short constflag) else if (boneflag & BONE_SELECTED) UI_ThemeColorShade(TH_BONE_POSE, -30); else UI_ThemeColorShade(TH_BONE_SOLID, -30); } + break; } - break; - case PCHAN_COLOR_LINEBONE: { /* inner part in background color or constraint */ @@ -290,7 +281,6 @@ static bool set_pchan_glColor(short colCode, int boneflag, short constflag) return true; } - break; } return false; @@ -1426,8 +1416,8 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp) glEnd(); setlinestyle(0); + break; } - break; case CONSTRAINT_TYPE_SPLINEIK: { bSplineIKConstraint *data = (bSplineIKConstraint *)con->data; @@ -1451,8 +1441,8 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp) glEnd(); setlinestyle(0); + break; } - break; } } } @@ -2070,20 +2060,10 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, } /* in editmode, we don't store the bone matrix... */ -static void get_matrix_editbone(EditBone *eBone, float bmat[4][4]) +static void get_matrix_editbone(EditBone *ebone, float bmat[4][4]) { - float delta[3]; - float mat[3][3]; - - /* Compose the parent transforms (i.e. their translations) */ - sub_v3_v3v3(delta, eBone->tail, eBone->head); - - eBone->length = (float)sqrt(delta[0] * delta[0] + delta[1] * delta[1] + delta[2] * delta[2]); - - vec_roll_to_mat3(delta, eBone->roll, mat); - copy_m4_m3(bmat, mat); - - add_v3_v3(bmat[3], eBone->head); + ebone->length = len_v3v3(ebone->tail, ebone->head); + ED_armature_ebone_to_mat4(ebone, bmat); } static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt) diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 7525b799067..16423c60cac 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -77,7 +77,7 @@ /* user data structures for derived mesh callbacks */ typedef struct drawMeshFaceSelect_userData { Mesh *me; - BLI_bitmap edge_flags; /* pairs of edge options (visible, select) */ + BLI_bitmap *edge_flags; /* pairs of edge options (visible, select) */ } drawMeshFaceSelect_userData; typedef struct drawEMTFMapped_userData { @@ -100,9 +100,9 @@ typedef struct drawTFace_userData { BLI_INLINE int edge_vis_index(const int index) { return index * 2; } BLI_INLINE int edge_sel_index(const int index) { return index * 2 + 1; } -static BLI_bitmap get_tface_mesh_marked_edge_info(Mesh *me) +static BLI_bitmap *get_tface_mesh_marked_edge_info(Mesh *me) { - BLI_bitmap bitmap_edge_flags = BLI_BITMAP_NEW(me->totedge * 2, __func__); + BLI_bitmap *bitmap_edge_flags = BLI_BITMAP_NEW(me->totedge * 2, __func__); MPoly *mp; MLoop *ml; int i, j; @@ -566,7 +566,12 @@ static DMDrawOption draw_em_tf_mapped__set_draw(void *userData, int index) { drawEMTFMapped_userData *data = userData; BMEditMesh *em = data->em; - BMFace *efa = EDBM_face_at_index(em, index); + BMFace *efa; + + if (UNLIKELY(index >= em->bm->totface)) + return DM_DRAW_OPTION_NORMAL; + + efa = EDBM_face_at_index(em, index); if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) { return DM_DRAW_OPTION_SKIP; @@ -907,7 +912,7 @@ static void tex_mat_set_texture_cb(void *userData, int mat_nr, void *attribs) } } -static int tex_mat_set_face_mesh_cb(void *userData, int index) +static bool tex_mat_set_face_mesh_cb(void *userData, int index) { /* faceselect mode face hiding */ TexMatCallback *data = (TexMatCallback *)userData; @@ -917,12 +922,18 @@ static int tex_mat_set_face_mesh_cb(void *userData, int index) return !(mp->flag & ME_HIDE); } -static int tex_mat_set_face_editmesh_cb(void *userData, int index) +static bool tex_mat_set_face_editmesh_cb(void *userData, int index) { /* editmode face hiding */ TexMatCallback *data = (TexMatCallback *)userData; Mesh *me = (Mesh *)data->me; - BMFace *efa = EDBM_face_at_index(me->edit_btmesh, index); + BMEditMesh *em = me->edit_btmesh; + BMFace *efa; + + if (UNLIKELY(index >= em->bm->totface)) + return DM_DRAW_OPTION_NORMAL; + + efa = EDBM_face_at_index(em, index); return !BM_elem_flag_test(efa, BM_ELEM_HIDDEN); } @@ -949,7 +960,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, { Mesh *me = ob->data; TexMatCallback data = {scene, ob, me, dm}; - int (*set_face_cb)(void *, int); + bool (*set_face_cb)(void *, int); int glsl, picking = (G.f & G_PICKSEL); /* face hiding callback depending on mode */ diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 9ab6336ab0e..6383440893d 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2002,7 +2002,7 @@ static void drawSelectedVertices(DerivedMesh *dm, Mesh *me) data.col[2] = act_col; glBegin(GL_POINTS); - dm->foreachMappedVert(dm, drawSelectedVertices__mapFunc, &data); + dm->foreachMappedVert(dm, drawSelectedVertices__mapFunc, &data, DM_FOREACH_NOP); glEnd(); } @@ -2068,7 +2068,7 @@ static void draw_dm_face_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv calcDrawDMNormalScale(ob, &data); glBegin(GL_LINES); - dm->foreachMappedFaceCenter(dm, draw_dm_face_normals__mapFunc, &data); + dm->foreachMappedFaceCenter(dm, draw_dm_face_normals__mapFunc, &data, DM_FOREACH_USE_NORMAL); glEnd(); } @@ -2088,7 +2088,7 @@ static void draw_dm_face_centers(BMEditMesh *em, DerivedMesh *dm, char sel) void *ptrs[2] = {em, &sel}; bglBegin(GL_POINTS); - dm->foreachMappedFaceCenter(dm, draw_dm_face_centers__mapFunc, ptrs); + dm->foreachMappedFaceCenter(dm, draw_dm_face_centers__mapFunc, ptrs, DM_FOREACH_NOP); bglEnd(); } @@ -2133,7 +2133,7 @@ static void draw_dm_vert_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv calcDrawDMNormalScale(ob, &data); glBegin(GL_LINES); - dm->foreachMappedVert(dm, draw_dm_vert_normals__mapFunc, &data); + dm->foreachMappedVert(dm, draw_dm_vert_normals__mapFunc, &data, DM_FOREACH_USE_NORMAL); glEnd(); } @@ -2204,7 +2204,7 @@ static void draw_dm_verts(BMEditMesh *em, DerivedMesh *dm, const char sel, BMVer invert_m4(data.imat); bglBegin(GL_POINTS); - dm->foreachMappedVert(dm, draw_dm_verts__mapFunc, &data); + dm->foreachMappedVert(dm, draw_dm_verts__mapFunc, &data, DM_FOREACH_NOP); bglEnd(); } @@ -2534,7 +2534,7 @@ static void draw_dm_bweights(BMEditMesh *em, Scene *scene, DerivedMesh *dm) if (data.cd_layer_offset != -1) { glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) + 2); bglBegin(GL_POINTS); - dm->foreachMappedVert(dm, draw_dm_bweights__mapFunc, &data); + dm->foreachMappedVert(dm, draw_dm_bweights__mapFunc, &data, DM_FOREACH_NOP); bglEnd(); } } @@ -2699,7 +2699,8 @@ static void draw_em_measure_stats(ARegion *ar, View3D *v3d, Object *ob, BMEditMe const bool do_global = (v3d->flag & V3D_GLOBAL_STATS) != 0; const bool do_moving = (G.moving & G_TRANSFORM_EDIT) != 0; float clip_planes[4][4]; - + /* allow for displaying shape keys and deform mods */ + DerivedMesh *dm = EDBM_mesh_deform_dm_get(em); BMIter iter; int i; @@ -2725,23 +2726,33 @@ static void draw_em_measure_stats(ARegion *ar, View3D *v3d, Object *ob, BMEditMe UI_GetThemeColor3ubv(TH_DRAWEXTRA_EDGELEN, col); - eed = BM_iter_new(&iter, em->bm, BM_EDGES_OF_MESH, NULL); - for (; eed; eed = BM_iter_step(&iter)) { + if (dm) { + BM_mesh_elem_index_ensure(em->bm, BM_VERT); + } + + BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) { /* draw selected edges, or edges next to selected verts while draging */ if (BM_elem_flag_test(eed, BM_ELEM_SELECT) || (do_moving && (BM_elem_flag_test(eed->v1, BM_ELEM_SELECT) || BM_elem_flag_test(eed->v2, BM_ELEM_SELECT)))) { + float v1_clip[3], v2_clip[3]; - copy_v3_v3(v1, eed->v1->co); - copy_v3_v3(v2, eed->v2->co); + if (dm) { + dm->getVertCo(dm, BM_elem_index_get(eed->v1), v1); + dm->getVertCo(dm, BM_elem_index_get(eed->v2), v2); + } + else { + copy_v3_v3(v1, eed->v1->co); + copy_v3_v3(v2, eed->v2->co); + } - if (clip_segment_v3_plane_n(v1, v2, clip_planes, 4)) { + copy_v3_v3(v1_clip, v1); + copy_v3_v3(v2_clip, v2); - mid_v3_v3v3(vmid, v1, v2); + if (clip_segment_v3_plane_n(v1_clip, v2_clip, clip_planes, 4)) { - copy_v3_v3(v1, eed->v1->co); - copy_v3_v3(v2, eed->v2->co); + mid_v3_v3v3(vmid, v1_clip, v2_clip); if (do_global) { mul_mat3_m4_v3(ob->obmat, v1); @@ -2768,10 +2779,13 @@ static void draw_em_measure_stats(ARegion *ar, View3D *v3d, Object *ob, BMEditMe UI_GetThemeColor3ubv(TH_DRAWEXTRA_EDGEANG, col); + if (dm) { + BM_mesh_elem_index_ensure(em->bm, BM_VERT | BM_FACE); + } + // invert_m4_m4(ob->imat, ob->obmat); // this is already called - eed = BM_iter_new(&iter, em->bm, BM_EDGES_OF_MESH, NULL); - for (; eed; eed = BM_iter_step(&iter)) { + BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) { BMLoop *l_a, *l_b; if (BM_edge_loop_pair(eed, &l_a, &l_b)) { /* draw selected edges, or edges next to selected verts while draging */ @@ -2786,30 +2800,44 @@ static void draw_em_measure_stats(ARegion *ar, View3D *v3d, Object *ob, BMEditMe BM_elem_flag_test(l_b->prev->v, BM_ELEM_SELECT) ))) { - copy_v3_v3(v1, eed->v1->co); - copy_v3_v3(v2, eed->v2->co); - - if (clip_segment_v3_plane_n(v1, v2, clip_planes, 4)) { - float angle; - - mid_v3_v3v3(vmid, v1, v2); + float v1_clip[3], v2_clip[3]; + if (dm) { + dm->getVertCo(dm, BM_elem_index_get(eed->v1), v1); + dm->getVertCo(dm, BM_elem_index_get(eed->v2), v2); + } + else { copy_v3_v3(v1, eed->v1->co); copy_v3_v3(v2, eed->v2->co); + } - if (do_global) { - float no_a[3]; - float no_b[3]; + copy_v3_v3(v1_clip, v1); + copy_v3_v3(v2_clip, v2); + + if (clip_segment_v3_plane_n(v1_clip, v2_clip, clip_planes, 4)) { + float no_a[3], no_b[3]; + float angle; + + mid_v3_v3v3(vmid, v1_clip, v2_clip); + + if (dm) { + dm->getPolyNo(dm, BM_elem_index_get(l_a->f), no_a); + dm->getPolyNo(dm, BM_elem_index_get(l_b->f), no_b); + } + else { copy_v3_v3(no_a, l_a->f->no); copy_v3_v3(no_b, l_b->f->no); + } + + if (do_global) { mul_mat3_m4_v3(ob->imat, no_a); mul_mat3_m4_v3(ob->imat, no_b); - angle = angle_v3v3(no_a, no_b); - } - else { - angle = angle_normalized_v3v3(l_a->f->no, l_b->f->no); + normalize_v3(no_a); + normalize_v3(no_b); } + angle = angle_normalized_v3v3(no_a, no_b); + BLI_snprintf(numstr, sizeof(numstr), "%.3f", is_rad ? angle : RAD2DEGF(angle)); view3d_cached_text_draw_add(vmid, numstr, 0, txt_flag, col); @@ -2844,6 +2872,10 @@ static void draw_em_measure_stats(ARegion *ar, View3D *v3d, Object *ob, BMEditMe UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col); + if (dm) { + BM_mesh_elem_index_ensure(em->bm, BM_VERT); + } + f = NULL; area = 0.0; zero_v3(vmid); @@ -2858,9 +2890,18 @@ static void draw_em_measure_stats(ARegion *ar, View3D *v3d, Object *ob, BMEditMe } f = l[0]->f; - copy_v3_v3(v1, l[0]->v->co); - copy_v3_v3(v2, l[1]->v->co); - copy_v3_v3(v3, l[2]->v->co); + + if (dm) { + dm->getVertCo(dm, BM_elem_index_get(l[0]->v), v1); + dm->getVertCo(dm, BM_elem_index_get(l[1]->v), v2); + dm->getVertCo(dm, BM_elem_index_get(l[2]->v), v3); + } + else { + copy_v3_v3(v1, l[0]->v->co); + copy_v3_v3(v2, l[1]->v->co); + copy_v3_v3(v3, l[2]->v->co); + } + add_v3_v3(vmid, v1); add_v3_v3(vmid, v2); add_v3_v3(vmid, v3); @@ -2885,6 +2926,9 @@ static void draw_em_measure_stats(ARegion *ar, View3D *v3d, Object *ob, BMEditMe UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col); + if (dm) { + BM_mesh_elem_index_ensure(em->bm, BM_VERT); + } BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { const int is_face_sel = BM_elem_flag_test(efa, BM_ELEM_SELECT); @@ -2897,35 +2941,50 @@ static void draw_em_measure_stats(ARegion *ar, View3D *v3d, Object *ob, BMEditMe BM_ITER_ELEM (loop, &liter, efa, BM_LOOPS_OF_FACE) { if (is_face_sel || (do_moving && BM_elem_flag_test(loop->v, BM_ELEM_SELECT))) { float angle; + float v2_local[3]; /* lazy init center calc */ if (is_first) { - BM_face_calc_center_bounds(efa, vmid); - /* Avoid triple matrix multiply every vertex for 'global' */ - if (do_global) { - copy_v3_v3(v1, loop->prev->v->co); - copy_v3_v3(v2, loop->v->co); - mul_mat3_m4_v3(ob->obmat, v1); - mul_mat3_m4_v3(ob->obmat, v2); + if (dm) { + BMLoop *l_iter, *l_first; + float tvec[3]; + zero_v3(vmid); + l_iter = l_first = BM_FACE_FIRST_LOOP(efa); + do { + dm->getVertCo(dm, BM_elem_index_get(l_iter->v), tvec); + add_v3_v3(vmid, tvec); + } while ((l_iter = l_iter->next) != l_first); + mul_v3_fl(vmid, 1.0f / (float)efa->len); + } + else { + BM_face_calc_center_bounds(efa, vmid); } is_first = false; } - if (do_global) { + if (dm) { + dm->getVertCo(dm, BM_elem_index_get(loop->prev->v), v1); + dm->getVertCo(dm, BM_elem_index_get(loop->v), v2); + dm->getVertCo(dm, BM_elem_index_get(loop->next->v), v3); + } + else { + copy_v3_v3(v1, loop->prev->v->co); + copy_v3_v3(v2, loop->v->co); copy_v3_v3(v3, loop->next->v->co); + } - mul_mat3_m4_v3(ob->obmat, v3); + copy_v3_v3(v2_local, v2); - angle = angle_v3v3v3(v1, v2, v3); - copy_v3_v3(v1, v2); - copy_v3_v3(v2, v3); - } - else { - angle = angle_v3v3v3(loop->prev->v->co, loop->v->co, loop->next->v->co); + if (do_global) { + mul_mat3_m4_v3(ob->obmat, v1); + mul_mat3_m4_v3(ob->obmat, v2); + mul_mat3_m4_v3(ob->obmat, v3); } + angle = angle_v3v3v3(v1, v2, v3); + BLI_snprintf(numstr, sizeof(numstr), "%.3f", is_rad ? angle : RAD2DEGF(angle)); - interp_v3_v3v3(fvec, vmid, loop->v->co, 0.8f); + interp_v3_v3v3(fvec, vmid, v2_local, 0.8f); view3d_cached_text_draw_add(fvec, numstr, 0, txt_flag, col); } } @@ -2990,24 +3049,38 @@ static void draw_em_indices(BMEditMesh *em) static DMDrawOption draw_em_fancy__setFaceOpts(void *userData, int index) { - BMFace *efa = EDBM_face_at_index(userData, index); + BMEditMesh *em = userData; + BMFace *efa; + if (UNLIKELY(index >= em->bm->totface)) + return DM_DRAW_OPTION_NORMAL; + + efa = EDBM_face_at_index(em, index); if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) { GPU_enable_material(efa->mat_nr + 1, NULL); return DM_DRAW_OPTION_NORMAL; } - else + else { return DM_DRAW_OPTION_SKIP; + } } static DMDrawOption draw_em_fancy__setGLSLFaceOpts(void *userData, int index) { - BMFace *efa = EDBM_face_at_index(userData, index); + BMEditMesh *em = userData; + BMFace *efa; - if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) - return DM_DRAW_OPTION_SKIP; - else + if (UNLIKELY(index >= em->bm->totface)) + return DM_DRAW_OPTION_NORMAL; + + efa = EDBM_face_at_index(em, index); + + if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) { return DM_DRAW_OPTION_NORMAL; + } + else { + return DM_DRAW_OPTION_SKIP; + } } static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d, @@ -3019,8 +3092,9 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d, BMFace *efa_act = BM_mesh_active_face_get(em->bm, false, true); /* annoying but active faces is stored differently */ BMEdge *eed_act = NULL; BMVert *eve_act = NULL; + bool use_occlude_wire = (v3d->flag2 & V3D_OCCLUDE_WIRE) && (dt > OB_WIRE); - if (cageDM) BLI_assert(!(cageDM->dirty & DM_DIRTY_NORMALS)); + // if (cageDM) BLI_assert(!(cageDM->dirty & DM_DIRTY_NORMALS)); if (finalDM) BLI_assert(!(finalDM->dirty & DM_DIRTY_NORMALS)); if (em->bm->selected.last) { @@ -3057,7 +3131,14 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d, } } else if (dt > OB_WIRE) { - if (check_object_draw_texture(scene, v3d, dt)) { + if (use_occlude_wire) { + /* use the cageDM since it always overlaps the editmesh faces */ + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + cageDM->drawMappedFaces(cageDM, draw_em_fancy__setFaceOpts, + GPU_enable_material, NULL, me->edit_btmesh, 0); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + } + else if (check_object_draw_texture(scene, v3d, dt)) { if (draw_glsl_material(scene, ob, v3d, dt)) { glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW); @@ -3098,8 +3179,8 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d, finalDM->drawEdges(finalDM, 1, 0); } } - - if (me->drawflag & ME_DRAWFACES) { /* transp faces */ + + if ((me->drawflag & ME_DRAWFACES) && (use_occlude_wire == false)) { /* transp faces */ unsigned char col1[4], col2[4], col3[4]; #ifdef WITH_FREESTYLE unsigned char col4[4]; @@ -3238,6 +3319,11 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d, bglPolygonOffset(rv3d->dist, 0.0); GPU_disable_material(); } +#if 0 /* currently not needed */ + else if (use_occlude_wire) { + bglPolygonOffset(rv3d->dist, 0.0); + } +#endif } /* Mesh drawing routines */ @@ -3273,7 +3359,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D Object *ob = base->object; Mesh *me = ob->data; Material *ma = give_current_material(ob, 1); - const short hasHaloMat = (ma && (ma->material_type == MA_TYPE_HALO)); + const short hasHaloMat = (ma && (ma->material_type == MA_TYPE_HALO) && !BKE_scene_use_new_shading_nodes(scene)); eWireDrawMode draw_wire = OBDRAW_WIRE_OFF; int /* totvert,*/ totedge, totface; DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask); @@ -3766,8 +3852,8 @@ static void drawDispListsolid(ListBase *lb, Object *ob, const short dflag, glEnd(); glEnable(GL_LIGHTING); - break; } + break; case DL_SURF: if (dl->index) { @@ -4345,7 +4431,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv copy_m4_m4(imat, rv3d->viewinv); normalize_v3(imat[0]); normalize_v3(imat[1]); - /* no break! */ + /* fall-through */ case PART_DRAW_CROSS: case PART_DRAW_AXIS: /* lets calculate the scale: */ @@ -4519,6 +4605,8 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv break; default: intensity = 1.0f; /* should never happen */ + BLI_assert(0); + break; } CLAMP(intensity, 0.f, 1.f); weight_to_rgb(ma_col, intensity); @@ -6780,8 +6868,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short (rv3d->persp == RV3D_CAMOB && v3d->camera == ob)) /* special exception for active camera */ { drawcamera(scene, v3d, rv3d, base, dflag, ob_wire_col); - break; } + break; case OB_SPEAKER: if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) drawspeaker(scene, v3d, rv3d, ob, dflag); @@ -6820,6 +6908,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { drawaxes(1.0, OB_ARROWS); } + break; } if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { @@ -7270,7 +7359,7 @@ static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset) data.offset = (void *)(intptr_t) offset; glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); bglBegin(GL_POINTS); - dm->foreachMappedVert(dm, bbs_obmode_mesh_verts__mapFunc, &data); + dm->foreachMappedVert(dm, bbs_obmode_mesh_verts__mapFunc, &data, DM_FOREACH_NOP); bglEnd(); glPointSize(1.0); } @@ -7293,7 +7382,7 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset) glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE)); bglBegin(GL_POINTS); - dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, ptrs); + dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, ptrs, DM_FOREACH_NOP); bglEnd(); glPointSize(1.0); } @@ -7359,7 +7448,7 @@ static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d, glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE)); bglBegin(GL_POINTS); - dm->foreachMappedFaceCenter(dm, bbs_mesh_solid__drawCenter, ptrs); + dm->foreachMappedFaceCenter(dm, bbs_mesh_solid__drawCenter, ptrs, DM_FOREACH_NOP); bglEnd(); } diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 92bf8214336..dfbc973ee85 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -1141,17 +1141,17 @@ const char *view3d_context_dir[] = { static int view3d_context(const bContext *C, const char *member, bContextDataResult *result) { - View3D *v3d = CTX_wm_view3d(C); - Scene *scene = CTX_data_scene(C); - Base *base; /* fallback to the scene layer, allows duplicate and other object operators to run outside the 3d view */ - unsigned int lay = v3d ? v3d->lay : scene->lay; if (CTX_data_dir(member)) { CTX_data_dir_set(result, view3d_context_dir); } else if (CTX_data_equals(member, "selected_objects") || CTX_data_equals(member, "selected_bases")) { - int selected_objects = CTX_data_equals(member, "selected_objects"); + View3D *v3d = CTX_wm_view3d(C); + Scene *scene = CTX_data_scene(C); + const unsigned int lay = v3d ? v3d->lay : scene->lay; + Base *base; + const bool selected_objects = CTX_data_equals(member, "selected_objects"); for (base = scene->base.first; base; base = base->next) { if ((base->flag & SELECT) && (base->lay & lay)) { @@ -1167,7 +1167,11 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes return 1; } else if (CTX_data_equals(member, "selected_editable_objects") || CTX_data_equals(member, "selected_editable_bases")) { - int selected_editable_objects = CTX_data_equals(member, "selected_editable_objects"); + View3D *v3d = CTX_wm_view3d(C); + Scene *scene = CTX_data_scene(C); + const unsigned int lay = v3d ? v3d->lay : scene->lay; + Base *base; + const bool selected_editable_objects = CTX_data_equals(member, "selected_editable_objects"); for (base = scene->base.first; base; base = base->next) { if ((base->flag & SELECT) && (base->lay & lay)) { @@ -1185,7 +1189,11 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes return 1; } else if (CTX_data_equals(member, "visible_objects") || CTX_data_equals(member, "visible_bases")) { - int visible_objects = CTX_data_equals(member, "visible_objects"); + View3D *v3d = CTX_wm_view3d(C); + Scene *scene = CTX_data_scene(C); + const unsigned int lay = v3d ? v3d->lay : scene->lay; + Base *base; + const bool visible_objects = CTX_data_equals(member, "visible_objects"); for (base = scene->base.first; base; base = base->next) { if (base->lay & lay) { @@ -1201,7 +1209,11 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes return 1; } else if (CTX_data_equals(member, "selectable_objects") || CTX_data_equals(member, "selectable_bases")) { - int selectable_objects = CTX_data_equals(member, "selectable_objects"); + View3D *v3d = CTX_wm_view3d(C); + Scene *scene = CTX_data_scene(C); + const unsigned int lay = v3d ? v3d->lay : scene->lay; + Base *base; + const bool selectable_objects = CTX_data_equals(member, "selectable_objects"); for (base = scene->base.first; base; base = base->next) { if (base->lay & lay) { @@ -1217,6 +1229,9 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes return 1; } else if (CTX_data_equals(member, "active_base")) { + View3D *v3d = CTX_wm_view3d(C); + Scene *scene = CTX_data_scene(C); + const unsigned int lay = v3d ? v3d->lay : scene->lay; if (scene->basact && (scene->basact->lay & lay)) { Object *ob = scene->basact->object; /* if hidden but in edit mode, we still display, can happen with animation */ @@ -1227,6 +1242,9 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes return 1; } else if (CTX_data_equals(member, "active_object")) { + View3D *v3d = CTX_wm_view3d(C); + Scene *scene = CTX_data_scene(C); + const unsigned int lay = v3d ? v3d->lay : scene->lay; if (scene->basact && (scene->basact->lay & lay)) { Object *ob = scene->basact->object; if ((ob->restrictflag & OB_RESTRICT_VIEW) == 0 || (ob->mode & OB_MODE_EDIT)) diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 4a823290f99..75e7605df6b 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -95,8 +95,6 @@ typedef struct { float ob_dims[3]; short link_scale; float ve_median[NBR_TRANSFORM_PROPERTIES]; - int curdef; - float *defweightp; } TransformProperties; /* Helper function to compute a median changed value, @@ -154,17 +152,14 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float #define L_WEIGHT 4 uiBlock *block = (layout) ? uiLayoutAbsoluteBlock(layout) : NULL; - MDeformVert *dvert = NULL; TransformProperties *tfp; float median[NBR_TRANSFORM_PROPERTIES], ve_median[NBR_TRANSFORM_PROPERTIES]; int tot, totedgedata, totcurvedata, totlattdata, totskinradius, totcurvebweight; bool has_meshdata = false; - char defstr[320]; PointerRNA data_ptr; fill_vn_fl(median, NBR_TRANSFORM_PROPERTIES, 0.0f); tot = totedgedata = totcurvedata = totlattdata = totskinradius = totcurvebweight = 0; - defstr[0] = '\0'; /* make sure we got storage */ if (v3d->properties_storage == NULL) @@ -175,7 +170,7 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float Mesh *me = ob->data; BMEditMesh *em = me->edit_btmesh; BMesh *bm = em->bm; - BMVert *eve, *evedef = NULL; + BMVert *eve; BMEdge *eed; BMIter iter; @@ -187,7 +182,6 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float if (bm->totvertsel) { BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) { - evedef = eve; tot++; add_v3_v3(&median[LOC_X], eve->co); @@ -226,33 +220,6 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float totedgedata = bm->totedgesel; } - /* check for defgroups */ - if (evedef) - dvert = CustomData_bmesh_get(&bm->vdata, evedef->head.data, CD_MDEFORMVERT); - if (tot == 1 && dvert && dvert->totweight) { - bDeformGroup *dg; - int i, max = 1, init = 1; - char str[320]; - - for (i = 0; i < dvert->totweight; i++) { - dg = BLI_findlink(&ob->defbase, dvert->dw[i].def_nr); - if (dg) { - max += BLI_snprintf(str, sizeof(str), "%s %%x%d|", dg->name, dvert->dw[i].def_nr); - if (max < sizeof(str)) strcat(defstr, str); - } - - if (tfp->curdef == dvert->dw[i].def_nr) { - init = 0; - tfp->defweightp = &dvert->dw[i].weight; - } - } - - if (init) { /* needs new initialized */ - tfp->curdef = dvert->dw[0].def_nr; - tfp->defweightp = &dvert->dw[0].weight; - } - } - has_meshdata = (totedgedata || totskinradius); } else if (ob->type == OB_CURVE || ob->type == OB_SURF) { @@ -915,7 +882,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) ot = WM_operatortype_find("OBJECT_OT_vertex_weight_normalize_active_vertex", 1); but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, "Normalize", 0, yco, UI_UNIT_X * 5, UI_UNIT_Y, - TIP_("Normalize weights of active vertex (if affected groups are unlocked")); + TIP_("Normalize weights of active vertex (if affected groups are unlocked)")); if (lock_count) { uiButSetFlag(but, UI_BUT_DISABLED); } @@ -923,7 +890,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) ot = WM_operatortype_find("OBJECT_OT_vertex_weight_copy", 1); but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, "Copy", UI_UNIT_X * 5, yco, UI_UNIT_X * 5, UI_UNIT_Y, - TIP_("Copy active vertex to other selected verts (if affected groups are unlocked)")); + TIP_("Copy active vertex to other selected vertices (if affected groups are unlocked)")); if (lock_count) { uiButSetFlag(but, UI_BUT_DISABLED); } @@ -1204,7 +1171,7 @@ void view3d_buttons_register(ARegionType *art) BLI_addtail(&art->paneltypes, pt); } -static int view3d_properties(bContext *C, wmOperator *UNUSED(op)) +static int view3d_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = view3d_has_buttons_region(sa); @@ -1221,7 +1188,7 @@ void VIEW3D_OT_properties(wmOperatorType *ot) ot->description = "Toggles the properties panel display"; ot->idname = "VIEW3D_OT_properties"; - ot->exec = view3d_properties; + ot->exec = view3d_properties_toggle_exec; ot->poll = ED_operator_view3d_active; /* flags */ diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 0a2358aa137..61532e75ee9 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -3033,7 +3033,7 @@ static void view3d_main_area_draw_engine_info(View3D *v3d, RegionView3D *rv3d, A { float fill_color[4] = {0.0f, 0.0f, 0.0f, 0.25f}; - if (!rv3d->render_engine || !rv3d->render_engine->text) + if (!rv3d->render_engine || !rv3d->render_engine->text[0]) return; if (render_border) { diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index e4aa44d7d78..7b8c197f3e6 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1009,6 +1009,14 @@ static int view3d_camera_user_poll(bContext *C) return 0; } +static int view3d_lock_poll(bContext *C) +{ + View3D *v3d = CTX_wm_view3d(C); + RegionView3D *rv3d = CTX_wm_region_view3d(C); + + return ED_view3d_offset_lock_check(v3d, rv3d); +} + static int viewrotate_cancel(bContext *C, wmOperator *op) { viewops_data_free(C, op); @@ -1537,7 +1545,11 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf) static void viewmove_apply(ViewOpsData *vod, int x, int y) { - if ((vod->rv3d->persp == RV3D_CAMOB) && !ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) { + if (ED_view3d_offset_lock_check(vod->v3d, vod->rv3d)) { + vod->rv3d->ofs_lock[0] -= ((vod->oldx - x) * 2.0f) / (float)vod->ar->winx; + vod->rv3d->ofs_lock[1] -= ((vod->oldy - y) * 2.0f) / (float)vod->ar->winy; + } + else if ((vod->rv3d->persp == RV3D_CAMOB) && !ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) { const float zoomfac = BKE_screen_view3d_zoom_to_fac((float)vod->rv3d->camzoom) * 2.0f; vod->rv3d->camdx += (vod->oldx - x) / (vod->ar->winx * zoomfac); vod->rv3d->camdy += (vod->oldy - y) / (vod->ar->winy * zoomfac); @@ -1614,8 +1626,6 @@ static int viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *event) { ViewOpsData *vod; - VIEW3D_OP_OFS_LOCK_TEST(C, op); - /* makes op->customdata */ viewops_data_create(C, op, event); vod = op->customdata; @@ -2141,7 +2151,7 @@ static int viewdolly_modal(bContext *C, wmOperator *op, const wmEvent *event) static int viewdolly_exec(bContext *C, wmOperator *op) { - /* View3D *v3d; */ + View3D *v3d; RegionView3D *rv3d; ScrArea *sa; ARegion *ar; @@ -2163,7 +2173,7 @@ static int viewdolly_exec(bContext *C, wmOperator *op) normalize_v3(mousevec); } - /* v3d = sa->spacedata.first; */ /* UNUSED */ + v3d = sa->spacedata.first; rv3d = ar->regiondata; /* overwrite the mouse vector with the view direction (zoom into the center) */ @@ -2172,16 +2182,19 @@ static int viewdolly_exec(bContext *C, wmOperator *op) } if (delta < 0) { - view_dolly_mouseloc(ar, rv3d->ofs, mousevec, 1.2f); + view_dolly_mouseloc(ar, rv3d->ofs, mousevec, 0.2f); } else { - view_dolly_mouseloc(ar, rv3d->ofs, mousevec, 0.83333f); + view_dolly_mouseloc(ar, rv3d->ofs, mousevec, 1.8f); } if (rv3d->viewlock & RV3D_BOXVIEW) view3d_boxview_sync(sa, ar); ED_view3d_depth_tag_update(rv3d); + + ED_view3d_camera_lock_sync(v3d, rv3d); + ED_region_tag_redraw(ar); viewops_data_free(C, op); @@ -2792,6 +2805,32 @@ void VIEW3D_OT_view_center_camera(wmOperatorType *ot) ot->flag = 0; } +static int view3d_center_lock_exec(bContext *C, wmOperator *UNUSED(op)) /* was view3d_home() in 2.4x */ +{ + RegionView3D *rv3d = CTX_wm_region_view3d(C); + + zero_v2(rv3d->ofs_lock); + + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); + + return OPERATOR_FINISHED; +} + +void VIEW3D_OT_view_center_lock(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "View Lock Center"; + ot->description = "Center the view lock offset"; + ot->idname = "VIEW3D_OT_view_center_lock"; + + /* api callbacks */ + ot->exec = view3d_center_lock_exec; + ot->poll = view3d_lock_poll; + + /* flags */ + ot->flag = 0; +} + /* ********************* Set render border operator ****************** */ static int render_border_exec(bContext *C, wmOperator *op) @@ -3202,16 +3241,11 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar, align_active = false; } else { - const float z_flip_quat[4] = {0.0f, 0.0f, 0.0f, 1.0f}; float obact_quat[4]; float twmat[3][3]; - /* flip the input, the end result being that an object - * with no rotation behaves as if 'align_active' is off */ - mul_qt_qtqt(new_quat, new_quat, z_flip_quat); - /* same as transform manipulator when normal is set */ - ED_getTransformOrientationMatrix(C, twmat, false); + ED_getTransformOrientationMatrix(C, twmat, true); mat3_to_quat(obact_quat, twmat); invert_qt(obact_quat); @@ -4166,28 +4200,27 @@ float ED_view3d_offset_distance(float mat[4][4], const float ofs[3], const float */ void ED_view3d_from_m4(float mat[4][4], float ofs[3], float quat[4], float *dist) { + float nmat[3][3]; + + /* dist depends on offset */ + BLI_assert(dist == NULL || ofs != NULL); + + copy_m3_m4(nmat, mat); + normalize_m3(nmat); + /* Offset */ if (ofs) negate_v3_v3(ofs, mat[3]); /* Quat */ if (quat) { - float imat[4][4]; - normalize_m4_m4(imat, mat); - invert_m4(imat); - mat4_to_quat(quat, imat); + float imat[3][3]; + invert_m3_m3(imat, nmat); + mat3_to_quat(quat, imat); } - if (dist) { - float nmat[3][3]; - float vec[3]; - - vec[0] = 0.0f; - vec[1] = 0.0f; - vec[2] = -(*dist); - - copy_m3_m4(nmat, mat); - normalize_m3(nmat); + if (ofs && dist) { + float vec[3] = {0.0f, 0.0f, -(*dist)}; mul_m3_v3(nmat, vec); sub_v3_v3(ofs, vec); diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 659c9a6c2e6..a1a13130b27 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -518,7 +518,7 @@ static void flyEvent(FlyInfo *fly, const wmEvent *event) #ifdef NDOF_FLY_DEBUG puts("start keeping track of 3D mouse position"); #endif - /* fall through... */ + /* fall-through */ case P_IN_PROGRESS: /* update 3D mouse position */ #ifdef NDOF_FLY_DEBUG diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 44c85799896..085af4e5c18 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -89,6 +89,7 @@ void VIEW3D_OT_view_lock_to_active(struct wmOperatorType *ot); void VIEW3D_OT_view_center_cursor(struct wmOperatorType *ot); void VIEW3D_OT_view_center_pick(struct wmOperatorType *ot); void VIEW3D_OT_view_center_camera(struct wmOperatorType *ot); +void VIEW3D_OT_view_center_lock(struct wmOperatorType *ot); void VIEW3D_OT_view_pan(struct wmOperatorType *ot); void VIEW3D_OT_view_persportho(struct wmOperatorType *ot); void VIEW3D_OT_background_image_add(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c index 0490d8763d8..d13ab15d837 100644 --- a/source/blender/editors/space_view3d/view3d_iterators.c +++ b/source/blender/editors/space_view3d/view3d_iterators.c @@ -124,7 +124,7 @@ void meshobject_foreachScreenVert( ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */ } - dm->foreachMappedVert(dm, meshobject_foreachScreenVert__mapFunc, &data); + dm->foreachMappedVert(dm, meshobject_foreachScreenVert__mapFunc, &data, DM_FOREACH_NOP); dm->release(dm); } @@ -166,7 +166,7 @@ void mesh_foreachScreenVert( } EDBM_index_arrays_ensure(vc->em, BM_VERT); - dm->foreachMappedVert(dm, mesh_foreachScreenVert__mapFunc, &data); + dm->foreachMappedVert(dm, mesh_foreachScreenVert__mapFunc, &data, DM_FOREACH_NOP); dm->release(dm); } @@ -262,7 +262,7 @@ void mesh_foreachScreenFace( data.clip_flag = clip_flag; EDBM_index_arrays_ensure(vc->em, BM_FACE); - dm->foreachMappedFaceCenter(dm, mesh_foreachScreenFace__mapFunc, &data); + dm->foreachMappedFaceCenter(dm, mesh_foreachScreenFace__mapFunc, &data, DM_FOREACH_NOP); dm->release(dm); } diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index c46ae36a3a5..6780b71c906 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -148,6 +148,7 @@ void view3d_operatortypes(void) WM_operatortype_append(VIEW3D_OT_view_center_cursor); WM_operatortype_append(VIEW3D_OT_view_center_pick); WM_operatortype_append(VIEW3D_OT_view_center_camera); + WM_operatortype_append(VIEW3D_OT_view_center_lock); WM_operatortype_append(VIEW3D_OT_select); WM_operatortype_append(VIEW3D_OT_select_border); WM_operatortype_append(VIEW3D_OT_clip_border); @@ -232,7 +233,6 @@ void view3d_keymap(wmKeyConfig *keyconf) /*numpad +/-*/ RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", PADPLUSKEY, KM_PRESS, 0, 0)->ptr, "delta", 1); RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", PADMINUS, KM_PRESS, 0, 0)->ptr, "delta", -1); - /*ctrl +/-*/ RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", EQUALKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", 1); RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", MINUSKEY, KM_PRESS, KM_CTRL, 0)->ptr, "delta", -1); @@ -241,9 +241,18 @@ void view3d_keymap(wmKeyConfig *keyconf) RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", WHEELINMOUSE, KM_PRESS, 0, 0)->ptr, "delta", 1); RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_zoom", WHEELOUTMOUSE, KM_PRESS, 0, 0)->ptr, "delta", -1); + /* ... and for dolly */ + /*numpad +/-*/ + RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_dolly", PADPLUSKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "delta", 1); + RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_dolly", PADMINUS, KM_PRESS, KM_SHIFT, 0)->ptr, "delta", -1); + /*ctrl +/-*/ + RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_dolly", EQUALKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "delta", 1); + RNA_int_set(WM_keymap_add_item(keymap, "VIEW3D_OT_dolly", MINUSKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "delta", -1); + WM_keymap_add_item(keymap, "VIEW3D_OT_zoom_camera_1_to_1", PADENTER, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_camera", HOMEKEY, KM_PRESS, 0, 0); /* only with camera view */ + WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_lock", HOMEKEY, KM_PRESS, 0, 0); /* only with lock view */ WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_cursor", HOMEKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "VIEW3D_OT_view_center_pick", FKEY, KM_PRESS, KM_ALT, 0); diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index 576badf601e..b2f2d5849a4 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -967,6 +967,7 @@ static int view3d_ruler_modal(bContext *C, wmOperator *op, const wmEvent *event) WM_clipboard_text_set((void *) numstr, false); } } + break; } case RIGHTCTRLKEY: case LEFTCTRLKEY: diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index c119fe24210..16282b0d49c 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -609,7 +609,7 @@ static void do_lasso_select_armature__doSelectBone(void *userData, struct EditBo LassoSelectUserData *data = userData; bArmature *arm = data->vc->obedit->data; - if (EBONE_SELECTABLE(arm, ebone)) { + if (data->select ? EBONE_SELECTABLE(arm, ebone) : EBONE_VISIBLE(arm, ebone)) { bool is_point_done = false; int points_proj_tot = 0; @@ -856,6 +856,7 @@ static void view3d_lasso_select(bContext *C, ViewContext *vc, break; default: assert(!"lasso select on incorrect object type"); + break; } WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc->obedit->data); @@ -1907,7 +1908,7 @@ static int do_armature_box_select(ViewContext *vc, rcti *rect, bool select, bool int index = buffer[(4 * a) + 3]; if (index != -1) { ebone = BLI_findlink(arm->edbo, index & ~(BONESEL_ANY)); - if ((ebone->flag & BONE_UNSELECTABLE) == 0) { + if ((select == false) || ((ebone->flag & BONE_UNSELECTABLE) == 0)) { if (index & BONESEL_TIP) { ebone->flag |= BONE_DONE; if (select) ebone->flag |= BONE_TIPSEL; @@ -1937,7 +1938,7 @@ static int do_armature_box_select(ViewContext *vc, rcti *rect, bool select, bool if (index != -1) { ebone = BLI_findlink(arm->edbo, index & ~(BONESEL_ANY)); if (index & BONESEL_BONE) { - if ((ebone->flag & BONE_UNSELECTABLE) == 0) { + if ((select == false) || ((ebone->flag & BONE_UNSELECTABLE) == 0)) { if (!(ebone->flag & BONE_DONE)) { if (select) ebone->flag |= (BONE_ROOTSEL | BONE_TIPSEL | BONE_SELECTED); @@ -1974,7 +1975,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b if (bone_only) { CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones) { - if ((pchan->bone->flag & BONE_UNSELECTABLE) == 0) { + if ((select == false) || ((pchan->bone->flag & BONE_UNSELECTABLE) == 0)) { pchan->bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); } } @@ -2110,6 +2111,7 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op) break; default: assert(!"border select on incorrect object type"); + break; } } else { /* no editmode, unified for bones and objects */ @@ -2622,7 +2624,7 @@ static void do_circle_select_armature__doSelectBone(void *userData, struct EditB CircleSelectUserData *data = userData; bArmature *arm = data->vc->obedit->data; - if (EBONE_SELECTABLE(arm, ebone)) { + if (data->select ? EBONE_SELECTABLE(arm, ebone) : EBONE_VISIBLE(arm, ebone)) { bool is_point_done = false; int points_proj_tot = 0; diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 1678487d8bf..0f2f07a1053 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -64,7 +64,8 @@ #include "WM_api.h" #include "WM_types.h" - +#include "RNA_access.h" +#include "RNA_define.h" #include "ED_armature.h" #include "ED_mesh.h" @@ -74,13 +75,13 @@ #include "view3d_intern.h" -extern float originmat[3][3]; /* XXX object.c */ - /* ************************************************** */ /* ********************* old transform stuff ******** */ /* *********** will get replaced with new transform * */ /* ************************************************** */ +static bool snap_curs_to_sel_ex(bContext *C, float cursor[3]); + typedef struct TransVert { float *loc; float oldloc[3], maploc[3]; @@ -342,7 +343,7 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod if (transvmain && em->derivedCage) { EDBM_index_arrays_ensure(em, BM_VERT); - em->derivedCage->foreachMappedVert(em->derivedCage, set_mapped_co, userdata); + em->derivedCage->foreachMappedVert(em->derivedCage, set_mapped_co, userdata, DM_FOREACH_NOP); } } else if (obedit->type == OB_ARMATURE) { @@ -531,7 +532,7 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod /* *********************** operators ******************** */ -static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) +static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit = CTX_data_edit_object(C); Scene *scene = CTX_data_scene(C); @@ -628,7 +629,8 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) vec[2] = -ob->obmat[3][2] + gridf * floorf(0.5f + ob->obmat[3][2] / gridf); if (ob->parent) { - BKE_object_where_is_calc(scene, ob); + float originmat[3][3]; + BKE_object_where_is_calc_ex(scene, NULL, ob, originmat); invert_m3_m3(imat, originmat); mul_m3_v3(imat, vec); @@ -658,11 +660,11 @@ void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot) { /* identifiers */ ot->name = "Snap Selection to Grid"; - ot->description = "Snap selected item(s) to nearest grid node"; + ot->description = "Snap selected item(s) to nearest grid division"; ot->idname = "VIEW3D_OT_snap_selected_to_grid"; /* api callbacks */ - ot->exec = snap_sel_to_grid; + ot->exec = snap_sel_to_grid_exec; ot->poll = ED_operator_region_view3d_active; /* flags */ @@ -671,18 +673,30 @@ void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot) /* *************************************************** */ -static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) +static int snap_sel_to_curs_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); TransVert *tv; - float *curs, imat[3][3], bmat[3][3], vec[3]; + float imat[3][3], bmat[3][3]; + const float *cursor_global; + float center_global[3]; + float offset_global[3]; int a; - curs = give_cursor(scene, v3d); + const bool use_offset = RNA_boolean_get(op->ptr, "use_offset"); + + cursor_global = give_cursor(scene, v3d); + + if (use_offset) { + snap_curs_to_sel_ex(C, center_global); + sub_v3_v3v3(offset_global, cursor_global, center_global); + } if (obedit) { + float cursor_local[3]; + tottrans = 0; if (ELEM6(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)) @@ -692,11 +706,25 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) copy_m3_m4(bmat, obedit->obmat); invert_m3_m3(imat, bmat); - tv = transvmain; - for (a = 0; a < tottrans; a++, tv++) { - sub_v3_v3v3(vec, curs, obedit->obmat[3]); - mul_m3_v3(imat, vec); - copy_v3_v3(tv->loc, vec); + /* get the cursor in object space */ + sub_v3_v3v3(cursor_local, cursor_global, obedit->obmat[3]); + mul_m3_v3(imat, cursor_local); + + if (use_offset) { + float offset_local[3]; + + mul_v3_m3v3(offset_local, imat, offset_global); + + tv = transvmain; + for (a = 0; a < tottrans; a++, tv++) { + add_v3_v3(tv->loc, offset_local); + } + } + else { + tv = transvmain; + for (a = 0; a < tottrans; a++, tv++) { + copy_v3_v3(tv->loc, cursor_local); + } } special_transvert_update(obedit); @@ -712,25 +740,36 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) if (ob->mode & OB_MODE_POSE) { bPoseChannel *pchan; bArmature *arm = ob->data; + float cursor_local[3]; invert_m4_m4(ob->imat, ob->obmat); - copy_v3_v3(vec, curs); - mul_m4_v3(ob->imat, vec); - + mul_v3_m4v3(cursor_local, ob->imat, cursor_global); + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { if (pchan->bone->flag & BONE_SELECTED) { - if (pchan->bone->layer & arm->layer) { + if (PBONE_VISIBLE(arm, pchan->bone)) { if ((pchan->bone->flag & BONE_CONNECTED) == 0) { /* Get position in pchan (pose) space. */ - BKE_armature_loc_pose_to_bone(pchan, vec, vec); + float cursor_pose[3]; + + if (use_offset) { + mul_v3_m4v3(cursor_pose, ob->obmat, pchan->pose_mat[3]); + add_v3_v3(cursor_pose, offset_global); + + mul_m4_v3(ob->imat, cursor_pose); + BKE_armature_loc_pose_to_bone(pchan, cursor_pose, cursor_pose); + } + else { + BKE_armature_loc_pose_to_bone(pchan, cursor_local, cursor_pose); + } /* copy new position */ if ((pchan->protectflag & OB_LOCK_LOCX) == 0) - pchan->loc[0] = vec[0]; + pchan->loc[0] = cursor_pose[0]; if ((pchan->protectflag & OB_LOCK_LOCY) == 0) - pchan->loc[1] = vec[1]; + pchan->loc[1] = cursor_pose[1]; if ((pchan->protectflag & OB_LOCK_LOCZ) == 0) - pchan->loc[2] = vec[2]; + pchan->loc[2] = cursor_pose[2]; /* auto-keyframing */ ED_autokeyframe_pchan(C, scene, ob, pchan, ks); @@ -746,22 +785,30 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } else { - vec[0] = -ob->obmat[3][0] + curs[0]; - vec[1] = -ob->obmat[3][1] + curs[1]; - vec[2] = -ob->obmat[3][2] + curs[2]; + float cursor_parent[3]; /* parent-relative */ + + if (use_offset) { + add_v3_v3v3(cursor_parent, ob->obmat[3], offset_global); + } + else { + copy_v3_v3(cursor_parent, cursor_global); + } + + sub_v3_v3(cursor_parent, ob->obmat[3]); if (ob->parent) { - BKE_object_where_is_calc(scene, ob); + float originmat[3][3]; + BKE_object_where_is_calc_ex(scene, NULL, ob, originmat); invert_m3_m3(imat, originmat); - mul_m3_v3(imat, vec); + mul_m3_v3(imat, cursor_parent); } if ((ob->protectflag & OB_LOCK_LOCX) == 0) - ob->loc[0] += vec[0]; + ob->loc[0] += cursor_parent[0]; if ((ob->protectflag & OB_LOCK_LOCY) == 0) - ob->loc[1] += vec[1]; + ob->loc[1] += cursor_parent[1]; if ((ob->protectflag & OB_LOCK_LOCZ) == 0) - ob->loc[2] += vec[2]; + ob->loc[2] += cursor_parent[2]; /* auto-keyframing */ ED_autokeyframe_object(C, scene, ob, ks); @@ -785,16 +832,19 @@ void VIEW3D_OT_snap_selected_to_cursor(wmOperatorType *ot) ot->idname = "VIEW3D_OT_snap_selected_to_cursor"; /* api callbacks */ - ot->exec = snap_sel_to_curs; + ot->exec = snap_sel_to_curs_exec; ot->poll = ED_operator_view3d_active; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + /* rna */ + RNA_def_boolean(ot->srna, "use_offset", 1, "Offset", ""); } /* *************************************************** */ -static int snap_curs_to_grid(bContext *C, wmOperator *UNUSED(op)) +static int snap_curs_to_grid_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); RegionView3D *rv3d = CTX_wm_region_data(C); @@ -817,11 +867,11 @@ void VIEW3D_OT_snap_cursor_to_grid(wmOperatorType *ot) { /* identifiers */ ot->name = "Snap Cursor to Grid"; - ot->description = "Snap cursor to nearest grid node"; + ot->description = "Snap cursor to nearest grid division"; ot->idname = "VIEW3D_OT_snap_cursor_to_grid"; /* api callbacks */ - ot->exec = snap_curs_to_grid; + ot->exec = snap_curs_to_grid_exec; ot->poll = ED_operator_region_view3d_active; /* flags */ @@ -882,28 +932,29 @@ static void bundle_midpoint(Scene *scene, Object *ob, float vec[3]) } } -static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op)) +static bool snap_curs_to_sel_ex(bContext *C, float cursor[3]) { Object *obedit = CTX_data_edit_object(C); Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); TransVert *tv; - float *curs, bmat[3][3], vec[3], min[3], max[3], centroid[3]; + float bmat[3][3], vec[3], min[3], max[3], centroid[3]; int count, a; - curs = give_cursor(scene, v3d); - count = 0; INIT_MINMAX(min, max); zero_v3(centroid); if (obedit) { tottrans = 0; - + if (ELEM6(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)) make_trans_verts(obedit, bmat[0], bmat[1], TM_ALL_JOINTS | TM_SKIP_HANDLES); - if (tottrans == 0) return OPERATOR_CANCELLED; - + + if (tottrans == 0) { + return false; + } + copy_m3_m4(bmat, obedit->obmat); tv = transvmain; @@ -917,10 +968,10 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op)) if (v3d->around == V3D_CENTROID) { mul_v3_fl(centroid, 1.0f / (float)tottrans); - copy_v3_v3(curs, centroid); + copy_v3_v3(cursor, centroid); } else { - mid_v3_v3v3(curs, min, max); + mid_v3_v3v3(cursor, min, max); } MEM_freeN(transvmain); transvmain = NULL; @@ -962,19 +1013,38 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op)) } CTX_DATA_END; } - if (count) { - if (v3d->around == V3D_CENTROID) { - mul_v3_fl(centroid, 1.0f / (float)count); - copy_v3_v3(curs, centroid); - } - else { - mid_v3_v3v3(curs, min, max); - } + + if (count == 0) { + return false; + } + + if (v3d->around == V3D_CENTROID) { + mul_v3_fl(centroid, 1.0f / (float)count); + copy_v3_v3(cursor, centroid); + } + else { + mid_v3_v3v3(cursor, min, max); } } - WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d); - - return OPERATOR_FINISHED; + return true; +} + +static int snap_curs_to_sel_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Scene *scene = CTX_data_scene(C); + View3D *v3d = CTX_wm_view3d(C); + float *curs; + + curs = give_cursor(scene, v3d); + + if (snap_curs_to_sel_ex(C, curs)) { + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d); + + return OPERATOR_FINISHED; + } + else { + return OPERATOR_CANCELLED; + } } void VIEW3D_OT_snap_cursor_to_selected(wmOperatorType *ot) @@ -985,7 +1055,7 @@ void VIEW3D_OT_snap_cursor_to_selected(wmOperatorType *ot) ot->idname = "VIEW3D_OT_snap_cursor_to_selected"; /* api callbacks */ - ot->exec = snap_curs_to_sel; + ot->exec = snap_curs_to_sel_exec; ot->poll = ED_operator_view3d_active; /* flags */ @@ -994,7 +1064,7 @@ void VIEW3D_OT_snap_cursor_to_selected(wmOperatorType *ot) /* ********************************************** */ -static int snap_curs_to_active(bContext *C, wmOperator *UNUSED(op)) +static int snap_curs_to_active_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit = CTX_data_edit_object(C); Object *obact = CTX_data_active_object(C); @@ -1043,7 +1113,7 @@ void VIEW3D_OT_snap_cursor_to_active(wmOperatorType *ot) ot->idname = "VIEW3D_OT_snap_cursor_to_active"; /* api callbacks */ - ot->exec = snap_curs_to_active; + ot->exec = snap_curs_to_active_exec; ot->poll = ED_operator_view3d_active; /* flags */ @@ -1052,7 +1122,7 @@ void VIEW3D_OT_snap_cursor_to_active(wmOperatorType *ot) /* **************************************************** */ /*New Code - Snap Cursor to Center -*/ -static int snap_curs_to_center(bContext *C, wmOperator *UNUSED(op)) +static int snap_curs_to_center_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); @@ -1074,7 +1144,7 @@ void VIEW3D_OT_snap_cursor_to_center(wmOperatorType *ot) ot->idname = "VIEW3D_OT_snap_cursor_to_center"; /* api callbacks */ - ot->exec = snap_curs_to_center; + ot->exec = snap_curs_to_center_exec; ot->poll = ED_operator_view3d_active; /* flags */ diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index ebb9a7b8c81..bdb203ab003 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -195,7 +195,7 @@ static uiBlock *tool_search_menu(bContext *C, ARegion *ar, void *arg_listbase) uiBlockSetDirection(block, UI_DOWN); uiEndBlock(C, block); - event = *(win->eventstate); /* XXX huh huh? make api call */ + wm_event_init_from_window(win, &event); event.type = EVT_BUT_OPEN; event.val = KM_PRESS; event.customdata = but; @@ -258,7 +258,7 @@ void view3d_tool_props_register(ARegionType *art) /* ********** operator to open/close toolshelf region */ -static int view3d_toolshelf(bContext *C, wmOperator *UNUSED(op)) +static int view3d_toolshelf_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = view3d_has_tools_region(sa); @@ -275,7 +275,7 @@ void VIEW3D_OT_toolshelf(wmOperatorType *ot) ot->description = "Toggles tool shelf display"; ot->idname = "VIEW3D_OT_toolshelf"; - ot->exec = view3d_toolshelf; + ot->exec = view3d_toolshelf_toggle_exec; ot->poll = ED_operator_view3d_active; /* flags */ diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index a3421295464..4a14aa79e41 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -202,7 +202,7 @@ void view3d_smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera } /* skip smooth viewing for render engine draw */ - if (C && U.smooth_viewtx && v3d->drawtype != OB_RENDER) { + if (U.smooth_viewtx && v3d->drawtype != OB_RENDER) { bool changed = false; /* zero means no difference */ if (oldcamera != camera) @@ -753,7 +753,7 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect) glGetFloatv(GL_PROJECTION_MATRIX, (float *)rv3d->winmat); } -static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short smooth) +static void obmat_to_viewmat(RegionView3D *rv3d, Object *ob) { float bmat[4][4]; float tmat[3][3]; @@ -766,36 +766,7 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short /* view quat calculation, needed for add object */ copy_m3_m4(tmat, rv3d->viewmat); - if (smooth) { - float new_quat[4]; - if (rv3d->persp == RV3D_CAMOB && v3d->camera) { - /* were from a camera view */ - - float orig_ofs[3]; - float orig_dist = rv3d->dist; - float orig_lens = v3d->lens; - copy_v3_v3(orig_ofs, rv3d->ofs); - - /* Switch from camera view */ - mat3_to_quat(new_quat, tmat); - - rv3d->persp = RV3D_PERSP; - rv3d->dist = 0.0; - - ED_view3d_from_object(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens); - view3d_smooth_view(NULL, NULL, NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); /* XXX */ - - rv3d->persp = RV3D_CAMOB; /* just to be polite, not needed */ - - } - else { - mat3_to_quat(new_quat, tmat); - view3d_smooth_view(NULL, NULL, NULL, NULL, NULL, NULL, new_quat, NULL, NULL); /* XXX */ - } - } - else { - mat3_to_quat(rv3d->viewquat, tmat); - } + mat3_to_quat(rv3d->viewquat, tmat); } #define QUATSET(a, b, c, d, e) { a[0] = b; a[1] = c; a[2] = d; a[3] = e; } (void)0 @@ -839,7 +810,7 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d) if (rv3d->persp == RV3D_CAMOB) { /* obs/camera */ if (v3d->camera) { BKE_object_where_is_calc(scene, v3d->camera); - obmat_to_viewmat(v3d, rv3d, v3d->camera, 0); + obmat_to_viewmat(rv3d, v3d->camera); } else { quat_to_mat4(rv3d->viewmat, rv3d->viewquat); @@ -847,6 +818,9 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d) } } else { + bool use_lock_ofs = false; + + /* should be moved to better initialize later on XXX */ if (rv3d->viewlock) ED_view3d_lock(rv3d); @@ -866,15 +840,34 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d) } } translate_m4(rv3d->viewmat, -vec[0], -vec[1], -vec[2]); + use_lock_ofs = true; } else if (v3d->ob_centre_cursor) { float vec[3]; copy_v3_v3(vec, give_cursor(scene, v3d)); translate_m4(rv3d->viewmat, -vec[0], -vec[1], -vec[2]); + use_lock_ofs = true; } else { translate_m4(rv3d->viewmat, rv3d->ofs[0], rv3d->ofs[1], rv3d->ofs[2]); } + + /* lock offset */ + if (use_lock_ofs) { + float persmat[4][4], persinv[4][4]; + float vec[3]; + + /* we could calculate the real persmat/persinv here + * but it would be unreliable so better to later */ + mul_m4_m4m4(persmat, rv3d->winmat, rv3d->viewmat); + invert_m4_m4(persinv, persmat); + + mul_v2_v2fl(vec, rv3d->ofs_lock, rv3d->is_persp ? rv3d->dist : 1.0f); + vec[2] = 0.0f; + mul_mat3_m4_v3(persinv, vec); + translate_m4(rv3d->viewmat, vec[0], vec[1], vec[2]); + } + /* end lock offset */ } } @@ -1540,40 +1533,6 @@ void VIEW3D_OT_game_start(wmOperatorType *ot) /* ************************************** */ -static void UNUSED_FUNCTION(view3d_align_axis_to_vector)(View3D *v3d, RegionView3D *rv3d, int axisidx, float vec[3]) -{ - float alignaxis[3] = {0.0, 0.0, 0.0}; - float norm[3], axis[3], angle, new_quat[4]; - - if (axisidx > 0) alignaxis[axisidx - 1] = 1.0; - else alignaxis[-axisidx - 1] = -1.0; - - normalize_v3_v3(norm, vec); - - angle = (float)acos(dot_v3v3(alignaxis, norm)); - cross_v3_v3v3(axis, alignaxis, norm); - axis_angle_to_quat(new_quat, axis, -angle); - - rv3d->view = RV3D_VIEW_USER; - - if (rv3d->persp == RV3D_CAMOB && v3d->camera) { - /* switch out of camera view */ - float orig_ofs[3]; - float orig_dist = rv3d->dist; - float orig_lens = v3d->lens; - - copy_v3_v3(orig_ofs, rv3d->ofs); - rv3d->persp = RV3D_PERSP; - rv3d->dist = 0.0; - ED_view3d_from_object(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens); - view3d_smooth_view(NULL, NULL, NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); /* XXX */ - } - else { - if (rv3d->persp == RV3D_CAMOB) rv3d->persp = RV3D_PERSP; /* switch out of camera mode */ - view3d_smooth_view(NULL, NULL, NULL, NULL, NULL, NULL, new_quat, NULL, NULL); /* XXX */ - } -} - float ED_view3d_pixel_size(RegionView3D *rv3d, const float co[3]) { return mul_project_m4_v3_zfac(rv3d->persmat, co) * rv3d->pixsize * U.pixelsize; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 5ad5636bb21..6c854ef6795 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -59,10 +59,8 @@ #include "BLI_string.h" #include "BLI_ghash.h" #include "BLI_linklist.h" -#include "BLI_smallhash.h" #include "BKE_nla.h" -#include "BKE_bmesh.h" #include "BKE_editmesh_bvh.h" #include "BKE_context.h" #include "BKE_constraint.h" @@ -112,9 +110,7 @@ static bool transdata_check_local_center(TransInfo *t) { return ((t->around == V3D_LOCAL) && ( (t->flag & (T_OBJECT | T_POSE)) || - (t->obedit && t->obedit->type == OB_MESH && (t->settings->selectmode & (SCE_SELECT_EDGE | SCE_SELECT_FACE))) || - (t->obedit && t->obedit->type == OB_MBALL) || - (t->obedit && t->obedit->type == OB_ARMATURE) || + (t->obedit && ELEM4(t->obedit->type, OB_MESH, OB_CURVE, OB_MBALL, OB_ARMATURE)) || (t->spacetype == SPACE_IPO)) ); } @@ -1433,6 +1429,7 @@ static void drawArrow(ArrowDirection d, short offset, short length, short size) offset = -offset; length = -length; size = -size; + /* fall-through */ case RIGHT: glBegin(GL_LINES); glVertex2s(offset, 0); @@ -1443,10 +1440,12 @@ static void drawArrow(ArrowDirection d, short offset, short length, short size) glVertex2s(offset + length - size, size); glEnd(); break; + case DOWN: offset = -offset; length = -length; size = -size; + /* fall-through */ case UP: glBegin(GL_LINES); glVertex2s(0, offset); @@ -1465,6 +1464,7 @@ static void drawArrowHead(ArrowDirection d, short size) switch (d) { case LEFT: size = -size; + /* fall-through */ case RIGHT: glBegin(GL_LINES); glVertex2s(0, 0); @@ -1473,8 +1473,10 @@ static void drawArrowHead(ArrowDirection d, short size) glVertex2s(-size, size); glEnd(); break; + case DOWN: size = -size; + /* fall-through */ case UP: glBegin(GL_LINES); glVertex2s(0, 0); @@ -1676,9 +1678,9 @@ static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar) */ UI_ThemeColorShade(TH_TEXT_HI, -50); #ifdef WITH_INTERNATIONAL - BLF_draw_default(xco, ar->winy - 17, 0.0f, printable, sizeof(printable)); + BLF_draw_default(xco, ar->winy - 17, 0.0f, printable, BLF_DRAW_STR_DUMMY_MAX); #else - BLF_draw_default_ascii(xco, ar->winy - 17, 0.0f, printable, sizeof(printable)); + BLF_draw_default_ascii(xco, ar->winy - 17, 0.0f, printable, BLF_DRAW_STR_DUMMY_MAX); #endif /* autokey recording icon... */ @@ -1748,6 +1750,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) break; default: proportional = PROP_EDIT_OFF; + break; } // If modal, save settings back in scene if not set as operator argument @@ -2003,8 +2006,8 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *even initBoneEnvelope(t); else initBoneSize(t); + break; } - break; case TFM_BONE_ENVELOPE: initBoneEnvelope(t); break; @@ -2935,6 +2938,7 @@ static void headerResize(TransInfo *t, float vec[3], char *str) case 2: ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, IFACE_("Scale: %s : %s : %s%s %s"), &tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext); + break; } } else { @@ -3901,6 +3905,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, "D: %s D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2], distvec, t->con.text, t->proptext, autoik); + break; } } else { @@ -4995,8 +5000,7 @@ static bool createEdgeSlideVerts(TransInfo *t) TransDataEdgeSlideVert *sv_array; int sv_tot; BMBVHTree *btree; - /* BMVert -> sv_array index */ - SmallHash table; + int *sv_table; /* BMVert -> sv_array index */ EdgeSlideData *sld = MEM_callocN(sizeof(*sld), "sld"); View3D *v3d = NULL; RegionView3D *rv3d = NULL; @@ -5014,6 +5018,17 @@ static bool createEdgeSlideVerts(TransInfo *t) rv3d = t->ar ? t->ar->regiondata : NULL; } + if ((t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) && + /* don't do this at all for non-basis shape keys, too easy to + * accidentally break uv maps or vertex colors then */ + (bm->shapenr <= 1)) + { + sld->use_origfaces = true; + } + else { + sld->use_origfaces = false; + } + sld->is_proportional = true; sld->curr_sv_index = 0; sld->flipped_vtx = FALSE; @@ -5025,11 +5040,7 @@ static bool createEdgeSlideVerts(TransInfo *t) else { ED_view3d_ob_project_mat_get(rv3d, t->obedit, projectMat); } - - BLI_smallhash_init(&sld->vhash); - BLI_smallhash_init(&sld->origfaces); - BLI_smallhash_init(&table); - + /*ensure valid selection*/ BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(v, BM_ELEM_SELECT)) { @@ -5063,20 +5074,26 @@ static bool createEdgeSlideVerts(TransInfo *t) } } + sv_table = MEM_mallocN(sizeof(*sv_table) * bm->totvert, __func__); + j = 0; - BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { + BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) { if (BM_elem_flag_test(v, BM_ELEM_SELECT)) { BM_elem_flag_enable(v, BM_ELEM_TAG); - BLI_smallhash_insert(&table, (uintptr_t)v, SET_INT_IN_POINTER(j)); + sv_table[i] = j; j += 1; } else { BM_elem_flag_disable(v, BM_ELEM_TAG); + sv_table[i] = -1; } + BM_elem_index_set(v, i); /* set_inline */ } + bm->elem_index_dirty &= ~BM_VERT; if (!j) { MEM_freeN(sld); + MEM_freeN(sv_table); return false; } @@ -5173,9 +5190,9 @@ static bool createEdgeSlideVerts(TransInfo *t) BMEdge *e_prev; /* XXX, 'sv' will initialize multiple times, this is suspicious. see [#34024] */ - BLI_assert(BLI_smallhash_haskey(&table, (uintptr_t)v) != false); BLI_assert(v != NULL); - sv = sv_array + GET_INT_FROM_POINTER(BLI_smallhash_lookup(&table, (uintptr_t)v)); + BLI_assert(sv_table[BM_elem_index_get(v)] != -1); + sv = &sv_array[sv_table[BM_elem_index_get(v)]]; sv->v = v; copy_v3_v3(sv->v_co_orig, v->co); sv->loop_nr = loop_nr; @@ -5199,9 +5216,9 @@ static bool createEdgeSlideVerts(TransInfo *t) e = get_other_edge(v, e); if (!e) { - BLI_assert(BLI_smallhash_haskey(&table, (uintptr_t)v) != false); BLI_assert(v != NULL); - sv = sv_array + GET_INT_FROM_POINTER(BLI_smallhash_lookup(&table, (uintptr_t)v)); + BLI_assert(sv_table[BM_elem_index_get(v)] != -1); + sv = &sv_array[sv_table[BM_elem_index_get(v)]]; sv->v = v; copy_v3_v3(sv->v_co_orig, v->co); sv->loop_nr = loop_nr; @@ -5268,7 +5285,6 @@ static bool createEdgeSlideVerts(TransInfo *t) loop_nr++; } - /* use for visibility checks */ use_btree_disp = (v3d && t->obedit->dt > OB_WIRE && v3d->drawtype > OB_WIRE); @@ -5316,8 +5332,8 @@ static bool createEdgeSlideVerts(TransInfo *t) continue; } - BLI_assert(BLI_smallhash_haskey(&table, (uintptr_t)v) != false); - j = GET_INT_FROM_POINTER(BLI_smallhash_lookup(&table, (uintptr_t)v)); + BLI_assert(sv_table[BM_elem_index_get(v)] != -1); + j = sv_table[BM_elem_index_get(v)]; if (sv_array[j].v_b) { ED_view3d_project_float_v3_m4(ar, sv_array[j].v_b->co, sco_b, projectMat); @@ -5364,33 +5380,29 @@ static bool createEdgeSlideVerts(TransInfo *t) bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES); + if (sld->use_origfaces) { + sld->origfaces = BLI_ghash_ptr_new(__func__); + sld->bm_origfaces = BM_mesh_create(&bm_mesh_allocsize_default); + /* we need to have matching customdata */ + BM_mesh_copy_init_customdata(sld->bm_origfaces, bm, NULL); + } + /*create copies of faces for customdata projection*/ sv_array = sld->sv; for (i = 0; i < sld->totsv; i++, sv_array++) { - BMIter fiter, liter; + BMIter fiter; BMFace *f; - BMLoop *l; - BM_ITER_ELEM (f, &fiter, sv_array->v, BM_FACES_OF_VERT) { - - if (!BLI_smallhash_haskey(&sld->origfaces, (uintptr_t)f)) { - BMFace *copyf = BM_face_copy(bm, f, true, true); - - BM_face_select_set(bm, copyf, false); - BM_elem_flag_enable(copyf, BM_ELEM_HIDDEN); - BM_ITER_ELEM (l, &liter, copyf, BM_LOOPS_OF_FACE) { - BM_vert_select_set(bm, l->v, false); - BM_elem_flag_enable(l->v, BM_ELEM_HIDDEN); - BM_edge_select_set(bm, l->e, false); - BM_elem_flag_enable(l->e, BM_ELEM_HIDDEN); - } - BLI_smallhash_insert(&sld->origfaces, (uintptr_t)f, copyf); + if (sld->use_origfaces) { + BM_ITER_ELEM (f, &fiter, sv_array->v, BM_FACES_OF_VERT) { + if (!BLI_ghash_haskey(sld->origfaces, f)) { + BMFace *f_copy = BM_face_copy(sld->bm_origfaces, bm, f, true, true); + BLI_ghash_insert(sld->origfaces, f, f_copy); + } } } - BLI_smallhash_insert(&sld->vhash, (uintptr_t)sv_array->v, sv_array); - /* switch a/b if loop direction is different from global direction */ l_nr = sv_array->loop_nr; if (dot_v3v3(loop_dir[l_nr], mval_dir) < 0.0f) { @@ -5402,9 +5414,8 @@ static bool createEdgeSlideVerts(TransInfo *t) if (rv3d) calcNonProportionalEdgeSlide(t, sld, mval); - sld->origfaces_init = true; sld->em = em; - + /*zero out start*/ zero_v2(mval_start); @@ -5422,16 +5433,13 @@ static bool createEdgeSlideVerts(TransInfo *t) t->customData = sld; - BLI_smallhash_release(&table); + MEM_freeN(sv_table); if (btree) { BKE_bmbvh_free(btree); } MEM_freeN(loop_dir); MEM_freeN(loop_maxdist); - /* arrays are dirty from copying faces: EDBM_index_arrays_free */ - EDBM_update_generic(em, false, true); - return true; } @@ -5442,17 +5450,10 @@ void projectEdgeSlideData(TransInfo *t, bool is_final) BMEditMesh *em = sld->em; int i; - if (!em) - return; - - if (!(t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT)) + if (sld->use_origfaces == false) { return; + } - /* don't do this at all for non-basis shape keys, too easy to - * accidentally break uv maps or vertex colors then */ - if (em->bm->shapenr > 1) - return; - for (i = 0, sv = sld->sv; i < sld->totsv; sv++, i++) { BMIter fiter; BMLoop *l; @@ -5460,15 +5461,8 @@ void projectEdgeSlideData(TransInfo *t, bool is_final) BM_ITER_ELEM (l, &fiter, sv->v, BM_LOOPS_OF_VERT) { BMFace *f_copy; /* the copy of 'f' */ BMFace *f_copy_flip; /* the copy of 'f' or detect if we need to flip to the shorter side. */ - bool is_sel, is_hide; - /* the face attributes of the copied face will get - * copied over, so its necessary to save the selection - * and hidden state*/ - is_sel = BM_elem_flag_test(l->f, BM_ELEM_SELECT) != 0; - is_hide = BM_elem_flag_test(l->f, BM_ELEM_HIDDEN) != 0; - - f_copy = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)l->f); + f_copy = BLI_ghash_lookup(sld->origfaces, l->f); /* project onto copied projection face */ f_copy_flip = f_copy; @@ -5482,12 +5476,12 @@ void projectEdgeSlideData(TransInfo *t, bool is_final) if (sld->perc < 0.0f) { if (BM_vert_in_face(l_ed_sel->radial_next->f, sv->v_b)) { - f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)l_ed_sel->radial_next->f); + f_copy_flip = BLI_ghash_lookup(sld->origfaces, l_ed_sel->radial_next->f); } } else if (sld->perc > 0.0f) { if (BM_vert_in_face(l_ed_sel->radial_next->f, sv->v_a)) { - f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)l_ed_sel->radial_next->f); + f_copy_flip = BLI_ghash_lookup(sld->origfaces, l_ed_sel->radial_next->f); } } @@ -5573,7 +5567,7 @@ void projectEdgeSlideData(TransInfo *t, bool is_final) l_adj = l; } - f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)l_adj->f); + f_copy_flip = BLI_ghash_lookup(sld->origfaces, l_adj->f); } } } @@ -5590,36 +5584,23 @@ void projectEdgeSlideData(TransInfo *t, bool is_final) } /* make sure face-attributes are correct (e.g. MTexPoly) */ - BM_elem_attrs_copy(em->bm, em->bm, f_copy, l->f); - - /* restore selection and hidden flags */ - BM_face_select_set(em->bm, l->f, is_sel); - if (!is_hide) { - /* this check is a workaround for bug, see note - [#30735], - * without this edge can be hidden and selected */ - BM_elem_hide_set(em->bm, l->f, is_hide); - } + BM_elem_attrs_copy(sld->bm_origfaces, em->bm, f_copy, l->f); } } } void freeEdgeSlideTempFaces(EdgeSlideData *sld) { - if (sld->origfaces_init) { - SmallHashIter hiter; - BMFace *copyf; - - copyf = BLI_smallhash_iternew(&sld->origfaces, &hiter, NULL); - for (; copyf; copyf = BLI_smallhash_iternext(&hiter, NULL)) { - BM_face_verts_kill(sld->em->bm, copyf); + if (sld->use_origfaces) { + if (sld->bm_origfaces) { + BM_mesh_free(sld->bm_origfaces); + sld->bm_origfaces = NULL; } - BLI_smallhash_release(&sld->origfaces); - - sld->origfaces_init = false; - - /* arrays are dirty from removing faces: EDBM_index_arrays_free */ - EDBM_update_generic(sld->em, FALSE, TRUE); + if (sld->origfaces) { + BLI_ghash_free(sld->origfaces, NULL, NULL); + sld->origfaces = NULL; + } } } @@ -5628,30 +5609,12 @@ void freeEdgeSlideVerts(TransInfo *t) { EdgeSlideData *sld = t->customData; -#if 0 /*BMESH_TODO*/ - if (me->drawflag & ME_DRAWEXTRA_EDGELEN) { - TransDataEdgeSlideVert *sv; - LinkNode *look = sld->vertlist; - GHash *vertgh = sld->vhash; - while (look) { - sv = BLI_ghash_lookup(vertgh, (EditVert *)look->link); - if (sv != NULL) { - sv->v_a->f &= !SELECT; - sv->v_b->f &= !SELECT; - } - look = look->next; - } - } -#endif - if (!sld) return; freeEdgeSlideTempFaces(sld); bmesh_edit_end(sld->em->bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES); - - BLI_smallhash_release(&sld->vhash); MEM_freeN(sld->sv); MEM_freeN(sld); @@ -5733,6 +5696,7 @@ int handleEventEdgeSlide(struct TransInfo *t, const struct wmEvent *event) break; } } + break; } default: break; @@ -6265,6 +6229,7 @@ int handleEventVertSlide(struct TransInfo *t, const struct wmEvent *event) calcVertSlideMouseActiveEdges(t, event->mval); } calcVertSlideCustomPoints(t); + break; } default: break; @@ -7390,7 +7355,7 @@ bool checkUseAxisMatrix(TransInfo *t) { /* currenly only checks for editmode */ if (t->flag & T_EDIT) { - if ((t->around == V3D_LOCAL) && (ELEM3(t->obedit->type, OB_MESH, OB_MBALL, OB_ARMATURE))) { + if ((t->around == V3D_LOCAL) && (ELEM4(t->obedit->type, OB_MESH, OB_CURVE, OB_MBALL, OB_ARMATURE))) { /* not all editmode supports axis-matrix */ return true; } diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index d160e1562b0..4a1c4203a43 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -201,14 +201,14 @@ typedef struct EdgeSlideData { TransDataEdgeSlideVert *sv; int totsv; - struct SmallHash vhash; - struct SmallHash origfaces; + struct GHash *origfaces; int mval_start[2], mval_end[2]; struct BMEditMesh *em; /* flag that is set when origfaces is initialized */ - bool origfaces_init; + bool use_origfaces; + struct BMesh *bm_origfaces; float perc; @@ -725,7 +725,7 @@ void initTransformOrientation(struct bContext *C, TransInfo *t); /* Those two fill in mat and return non-zero on success */ bool createSpaceNormal(float mat[3][3], const float normal[3]); -bool createSpaceNormalTangent(float mat[3][3], float normal[3], float tangent[3]); +bool createSpaceNormalTangent(float mat[3][3], const float normal[3], const float tangent[3]); struct TransformOrientation *addMatrixSpace(struct bContext *C, float mat[3][3], char name[], int overwrite); void applyTransformOrientation(const struct bContext *C, float mat[3][3], char *name); diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 27b25a50eff..fd8fba91fc9 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -621,8 +621,8 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte float mtx[3][3] = MAT3_UNITY; BLI_snprintf(text, sizeof(text), ftext, IFACE_("global")); setConstraint(t, mtx, mode, text); + break; } - break; case V3D_MANIP_LOCAL: BLI_snprintf(text, sizeof(text), ftext, IFACE_("local")); setLocalConstraint(t, mode, text); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index a089f0d4159..b154acc7456 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -59,14 +59,12 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_array.h" #include "BLI_utildefines.h" #include "BLI_smallhash.h" #include "BKE_DerivedMesh.h" #include "BKE_action.h" #include "BKE_armature.h" -#include "BKE_bmesh.h" #include "BKE_constraint.h" #include "BKE_context.h" #include "BKE_curve.h" @@ -124,6 +122,11 @@ #include "BLI_sys_types.h" // for intptr_t support +/* when transforming islands */ +struct TransIslandData { + float co[3]; + float axismtx[3][3]; +}; /* local function prototype - for Object/Bone Constraints */ static bool constraints_list_needinv(TransInfo *t, ListBase *list); @@ -1043,7 +1046,7 @@ static void createTransArmatureVerts(TransInfo *t) bArmature *arm = t->obedit->data; ListBase *edbo = arm->edbo; TransData *td; - float mtx[3][3], smtx[3][3], delta[3], bonemat[3][3]; + float mtx[3][3], smtx[3][3], bonemat[3][3]; /* special hack for envelope drawmode and scaling: * to allow scaling the size of the envelope around single points, @@ -1135,8 +1138,7 @@ static void createTransArmatureVerts(TransInfo *t) td->flag = TD_SELECTED; /* use local bone matrix */ - sub_v3_v3v3(delta, ebo->tail, ebo->head); - vec_roll_to_mat3(delta, ebo->roll, bonemat); + ED_armature_ebone_to_mat3(ebo, bonemat); mul_m3_m3m3(td->mtx, mtx, bonemat); invert_m3_m3(td->smtx, td->mtx); @@ -1176,8 +1178,7 @@ static void createTransArmatureVerts(TransInfo *t) copy_m3_m3(td->smtx, smtx); copy_m3_m3(td->mtx, mtx); - sub_v3_v3v3(delta, ebo->tail, ebo->head); - vec_roll_to_mat3(delta, ebo->roll, td->axismtx); + ED_armature_ebone_to_mat3(ebo, td->axismtx); if ((ebo->flag & BONE_ROOTSEL) == 0) { td->extra = ebo; @@ -1200,8 +1201,7 @@ static void createTransArmatureVerts(TransInfo *t) copy_m3_m3(td->smtx, smtx); copy_m3_m3(td->mtx, mtx); - sub_v3_v3v3(delta, ebo->tail, ebo->head); - vec_roll_to_mat3(delta, ebo->roll, td->axismtx); + ED_armature_ebone_to_mat3(ebo, td->axismtx); td->extra = ebo; /* to fix roll */ @@ -1413,6 +1413,23 @@ static void createTransCurveVerts(TransInfo *t) for (a = 0, bezt = nu->bezt; a < nu->pntsu; a++, bezt++) { if (bezt->hide == 0) { TransDataCurveHandleFlags *hdata = NULL; + float axismtx[3][3]; + + if (t->around == V3D_LOCAL) { + float normal[3], plane[3]; + + BKE_nurb_bezt_calc_normal(nu, bezt, normal); + BKE_nurb_bezt_calc_plane(nu, bezt, plane); + + if (createSpaceNormalTangent(axismtx, normal, plane)) { + /* pass */ + } + else { + normalize_v3(normal); + axis_dominant_v3_to_m3(axismtx, normal); + invert_m3(axismtx); + } + } if (propmode || ((bezt->f2 & SELECT) && hide_handles) || @@ -1436,6 +1453,9 @@ static void createTransCurveVerts(TransInfo *t) copy_m3_m3(td->smtx, smtx); copy_m3_m3(td->mtx, mtx); + if (t->around == V3D_LOCAL) { + copy_m3_m3(td->axismtx, axismtx); + } td++; count++; @@ -1465,6 +1485,9 @@ static void createTransCurveVerts(TransInfo *t) copy_m3_m3(td->smtx, smtx); copy_m3_m3(td->mtx, mtx); + if (t->around == V3D_LOCAL) { + copy_m3_m3(td->axismtx, axismtx); + } if ((bezt->f1 & SELECT) == 0 && (bezt->f3 & SELECT) == 0) /* If the middle is selected but the sides arnt, this is needed */ @@ -1500,6 +1523,9 @@ static void createTransCurveVerts(TransInfo *t) copy_m3_m3(td->smtx, smtx); copy_m3_m3(td->mtx, mtx); + if (t->around == V3D_LOCAL) { + copy_m3_m3(td->axismtx, axismtx); + } td++; count++; @@ -1914,75 +1940,147 @@ static void editmesh_set_connectivity_distance(BMesh *bm, float mtx[3][3], float MEM_freeN(dists_prev); } -static BMElem *bm_vert_single_select_face(BMVert *eve) +static struct TransIslandData *editmesh_islands_info_calc(BMEditMesh *em, int *r_island_tot, int **r_island_vert_map) { - BMElem *ele; - BMIter iter; + BMesh *bm = em->bm; + struct TransIslandData *trans_islands; + char htype; + char itype; + int i; + + /* group vars */ + int *groups_array; + int (*group_index)[2]; + int group_tot; + void **ele_array; + + int *vert_map; + + if (em->selectmode & (SCE_SELECT_VERTEX | SCE_SELECT_EDGE)) { + groups_array = MEM_mallocN(sizeof(*groups_array) * bm->totedgesel, __func__); + group_tot = BM_mesh_calc_edge_groups(bm, groups_array, &group_index, + NULL, NULL, + BM_ELEM_SELECT); + + htype = BM_EDGE; + itype = BM_VERTS_OF_EDGE; - BM_ITER_ELEM (ele, &iter, eve, BM_FACES_OF_VERT) { - if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) { - return ele; - } } - return NULL; -} -static BMElem *bm_vert_single_select_edge(BMVert *eve) -{ - BMElem *ele; - BMIter iter; + else { /* (bm->selectmode & SCE_SELECT_FACE) */ + groups_array = MEM_mallocN(sizeof(*groups_array) * bm->totfacesel, __func__); + group_tot = BM_mesh_calc_face_groups(bm, groups_array, &group_index, + NULL, NULL, + BM_ELEM_SELECT, BM_VERT); + + htype = BM_FACE; + itype = BM_VERTS_OF_FACE; + } + + + trans_islands = MEM_mallocN(sizeof(*trans_islands) * group_tot, __func__); + + vert_map = MEM_mallocN(sizeof(*vert_map) * bm->totvert, __func__); + /* we shouldn't need this, but with incorrect selection flushing + * its possible we have a selected vertex thats not in a face, for now best not crash in that case. */ + fill_vn_i(vert_map, bm->totvert, -1); - BM_ITER_ELEM (ele, &iter, eve, BM_EDGES_OF_VERT) { - if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) { - return ele; + EDBM_index_arrays_ensure(em, htype); + ele_array = (htype == BM_FACE) ? (void **)em->face_index : (void **)em->edge_index; + + BM_mesh_elem_index_ensure(bm, BM_VERT); + + /* may be an edge OR a face array */ + for (i = 0; i < group_tot; i++) { + BMEditSelection ese = {0}; + + const int fg_sta = group_index[i][0]; + const int fg_len = group_index[i][1]; + float co[3], no[3], tangent[3]; + int j; + + zero_v3(co); + zero_v3(no); + zero_v3(tangent); + + ese.htype = htype; + + /* loop on each face in this group: + * - assign r_vert_map + * - calculate (co, no) + */ + for (j = 0; j < fg_len; j++) { + float tmp_co[3], tmp_no[3], tmp_tangent[3]; + + ese.ele = ele_array[groups_array[fg_sta + j]]; + + BM_editselection_center(&ese, tmp_co); + BM_editselection_normal(&ese, tmp_no); + BM_editselection_plane(&ese, tmp_tangent); + + add_v3_v3(co, tmp_co); + add_v3_v3(no, tmp_no); + add_v3_v3(tangent, tmp_tangent); + + { + /* setup vertex map */ + BMIter iter; + BMVert *v; + + /* connected edge-verts */ + BM_ITER_ELEM (v, &iter, ese.ele, itype) { + vert_map[BM_elem_index_get(v)] = i; + } + } + } + + mul_v3_v3fl(trans_islands[i].co, co, 1.0f / (float)fg_len); + + if (createSpaceNormalTangent(trans_islands[i].axismtx, no, tangent)) { + /* pass */ + } + else { + normalize_v3(no); + axis_dominant_v3_to_m3(trans_islands[i].axismtx, no); + invert_m3(trans_islands[i].axismtx); } } - return NULL; + + MEM_freeN(groups_array); + MEM_freeN(group_index); + + *r_island_tot = group_tot; + *r_island_vert_map = vert_map; + + return trans_islands; } /* way to overwrite what data is edited with transform */ static void VertsToTransData(TransInfo *t, TransData *td, TransDataExtension *tx, - BMEditMesh *em, BMVert *eve, float *bweight) + BMEditMesh *em, BMVert *eve, float *bweight, + struct TransIslandData *v_island) { + BLI_assert(BM_elem_flag_test(eve, BM_ELEM_HIDDEN) == 0); + td->flag = 0; //if (key) // td->loc = key->co; //else td->loc = eve->co; copy_v3_v3(td->iloc, td->loc); - copy_v3_v3(td->center, td->loc); - - if (t->around == V3D_LOCAL) { - BMElem *ele; - bool is_axismat_set = false; - - if (em->selectmode & (SCE_SELECT_FACE | SCE_SELECT_EDGE) && - (ele = ((em->selectmode & SCE_SELECT_FACE) ? - bm_vert_single_select_face(eve) : - bm_vert_single_select_edge(eve)))) - { - float normal[3], tangent[3]; - - BMEditSelection ese; - ese.next = ese.prev = NULL; - ese.ele = ele; - ese.htype = ele->head.htype; - BM_editselection_center(&ese, td->center); - BM_editselection_normal(&ese, normal); - BM_editselection_plane(&ese, tangent); - - if (createSpaceNormalTangent(td->axismtx, normal, tangent)) { - is_axismat_set = true; - } - } + if (v_island) { + copy_v3_v3(td->center, v_island->co); + copy_m3_m3(td->axismtx, v_island->axismtx); + } + else if (t->around == V3D_LOCAL) { + copy_v3_v3(td->center, td->loc); - /* for verts or fallback when createSpaceNormalTangent fails */ - if (is_axismat_set == false) { - axis_dominant_v3_to_m3(td->axismtx, eve->no); - invert_m3(td->axismtx); - } + axis_dominant_v3_to_m3(td->axismtx, eve->no); + invert_m3(td->axismtx); } else { + copy_v3_v3(td->center, td->loc); + /* Setting normals */ copy_v3_v3(td->axismtx[2], eve->no); td->axismtx[0][0] = @@ -2019,7 +2117,6 @@ static void VertsToTransData(TransInfo *t, TransData *td, TransDataExtension *tx static void createTransEditVerts(TransInfo *t) { - ToolSettings *ts = t->scene->toolsettings; TransData *tob = NULL; TransDataExtension *tx = NULL; BMEditMesh *em = BKE_editmesh_from_object(t->obedit); @@ -2031,85 +2128,42 @@ static void createTransEditVerts(TransInfo *t) float *mappedcos = NULL, *quats = NULL; float mtx[3][3], smtx[3][3], (*defmats)[3][3] = NULL, (*defcos)[3] = NULL; float *dists = NULL; - int count = 0, countsel = 0, a, totleft; + int a; int propmode = (t->flag & T_PROP_EDIT) ? (t->flag & T_PROP_EDIT_ALL) : 0; int mirror = 0; - char *selstate = NULL; - short selectmode = ts->selectmode; int cd_vert_bweight_offset = -1; bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0; + struct TransIslandData *island_info = NULL; + int island_info_tot; + int *island_vert_map = NULL; + if (t->flag & T_MIRROR) { EDBM_verts_mirror_cache_begin(em, 0, false, (t->flag & T_PROP_EDIT) == 0, use_topology); mirror = 1; } - /* edge slide forces edge select */ - if (t->mode == TFM_EDGE_SLIDE) { - selectmode = SCE_SELECT_EDGE; - } - - /* BMESH_TODO, writing into the index values is BAD!, means we cant - * use the values for vertex mirror - campbell */ - - // transform now requires awareness for select mode, so we tag the f1 flags in verts - if (selectmode & SCE_SELECT_VERTEX) { - BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) { - BM_elem_flag_set(eve, BM_ELEM_TAG, BM_elem_flag_test(eve, BM_ELEM_SELECT)); + /* quick check if we can transform */ + /* note: in prop mode we need at least 1 selected */ + if (em->selectmode & SCE_SELECT_VERTEX) { + if (bm->totvertsel == 0) { + goto cleanup; } } - else if (selectmode & SCE_SELECT_EDGE) { - BMEdge *eed; - - eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); - for (; eve; eve = BM_iter_step(&iter)) BM_elem_flag_disable(eve, BM_ELEM_TAG); - - eed = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL); - for (; eed; eed = BM_iter_step(&iter)) { - if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) { - BM_elem_flag_enable(eed->v1, BM_ELEM_TAG); - BM_elem_flag_enable(eed->v2, BM_ELEM_TAG); - } + else if (em->selectmode & SCE_SELECT_EDGE) { + if (bm->totvertsel == 0 || bm->totedgesel == 0) { + goto cleanup; } } - else { - BMFace *efa; - eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); - for (; eve; eve = BM_iter_step(&iter)) BM_elem_flag_disable(eve, BM_ELEM_TAG); - - efa = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL); - for (; efa; efa = BM_iter_step(&iter)) { - if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) { - BMIter liter; - BMLoop *l; - - l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, efa); - for (; l; l = BM_iter_step(&liter)) { - BM_elem_flag_enable(l->v, BM_ELEM_TAG); - } - } + else if (em->selectmode & SCE_SELECT_FACE) { + if (bm->totvertsel == 0 || bm->totfacesel == 0) { + goto cleanup; } } - - /* now we can count. we store selection state in selstate, since - * get_crazy_mapped_editverts messes up the index state of the - * verts*/ - selstate = MEM_callocN(sizeof(*selstate) * bm->totvert, __func__); - eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); - for (a = 0; eve; eve = BM_iter_step(&iter), a++) { - if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { - if (BM_elem_flag_test(eve, BM_ELEM_TAG)) { - selstate[a] = 1; - countsel++; - } - if (propmode) count++; - } + else { + BLI_assert(0); } - /* note: in prop mode we need at least 1 selected */ - if (countsel == 0) { - goto cleanup; - } /* check active */ eve_act = BM_mesh_active_vert_get(bm); @@ -2120,6 +2174,13 @@ static void createTransEditVerts(TransInfo *t) } if (propmode) { + unsigned int count = 0; + BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) { + if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { + count++; + } + } + t->total = count; /* allocating scratch arrays */ @@ -2127,7 +2188,7 @@ static void createTransEditVerts(TransInfo *t) dists = MEM_mallocN(em->bm->totvert * sizeof(float), "scratch nears"); } else { - t->total = countsel; + t->total = bm->totvertsel; } tob = t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(Mesh EditMode)"); @@ -2149,9 +2210,17 @@ static void createTransEditVerts(TransInfo *t) editmesh_set_connectivity_distance(em->bm, mtx, dists); } + if (t->around == V3D_LOCAL) { + island_info = editmesh_islands_info_calc(em, &island_info_tot, &island_vert_map); + } + + /* BMESH_TODO, crazy-space writing into the index values is BAD!, means we cant + * use the values for vertex mirror - campbell */ + /* detect CrazySpace [tm] */ if (modifiers_getCageIndex(t->scene, t->obedit, NULL, 1) >= 0) { if (modifiers_isCorrectableDeformed(t->obedit)) { + int totleft; /* check if we can use deform matrices for modifier from the * start up to stack, they are more accurate than quats */ totleft = editbmesh_get_first_deform_matrices(t->scene, t->obedit, em, &defmats, &defcos); @@ -2174,9 +2243,8 @@ static void createTransEditVerts(TransInfo *t) /* find out which half we do */ if (mirror) { - eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); - for (a = 0; eve; eve = BM_iter_step(&iter), a++) { - if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN) && selstate[a] && eve->co[0] != 0.0f) { + BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) { + if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && eve->co[0] != 0.0f) { if (eve->co[0] < 0.0f) { t->mirror = -1; mirror = -1; @@ -2188,15 +2256,18 @@ static void createTransEditVerts(TransInfo *t) BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, a) { if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { - if (propmode || selstate[a]) { + if (propmode || BM_elem_flag_test(eve, BM_ELEM_SELECT)) { + struct TransIslandData *v_island = (island_info && island_vert_map[a] != -1) ? + &island_info[island_vert_map[a]] : NULL; float *bweight = (cd_vert_bweight_offset != -1) ? BM_ELEM_CD_GET_VOID_P(eve, cd_vert_bweight_offset) : NULL; - - VertsToTransData(t, tob, tx, em, eve, bweight); + + VertsToTransData(t, tob, tx, em, eve, bweight, v_island); if (tx) tx++; /* selected */ - if (selstate[a]) tob->flag |= TD_SELECTED; + if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) + tob->flag |= TD_SELECTED; /* active */ if (eve == eve_act) tob->flag |= TD_ACTIVE; @@ -2250,6 +2321,11 @@ static void createTransEditVerts(TransInfo *t) } } + if (island_info) { + MEM_freeN(island_info); + MEM_freeN(island_vert_map); + } + if (mirror != 0) { tob = t->data; for (a = 0; a < t->total; a++, tob++) { @@ -2267,12 +2343,9 @@ cleanup: MEM_freeN(defmats); if (dists) MEM_freeN(dists); - - MEM_freeN(selstate); if (t->flag & T_MIRROR) { EDBM_verts_mirror_cache_end(em); - mirror = 1; } } diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 666612880e5..cb0a0530036 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1667,7 +1667,7 @@ void calculateCenter(TransInfo *t) projectIntView(t, t->center, t->center2d); } } - + break; } } @@ -1803,6 +1803,7 @@ void calculatePropRatio(TransInfo *t) break; default: td->factor = 1; + break; } } } @@ -1830,6 +1831,7 @@ void calculatePropRatio(TransInfo *t) break; default: t->proptext[0] = '\0'; + break; } } else { diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 5059e3bcc40..6fecf0d6642 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -602,7 +602,7 @@ int calc_manipulator_stats(const bContext *C) break; } /* if not gimbal, fall through to normal */ - /* pass through */ + /* fall-through */ } case V3D_MANIP_NORMAL: { @@ -613,7 +613,7 @@ int calc_manipulator_stats(const bContext *C) break; } /* no break we define 'normal' as 'local' in Object mode */ - /* pass through */ + /* fall-through */ } case V3D_MANIP_LOCAL: { @@ -840,7 +840,8 @@ static void manipulator_setcolor(View3D *v3d, char axis, int colcode, unsigned c UI_GetThemeColor3ubv(TH_AXIS_Z, col); break; default: - BLI_assert(!"invalid axis arg"); + BLI_assert(0); + break; } } @@ -1641,6 +1642,11 @@ void BIF_draw_manipulator(const bContext *C) mul_mat3_m4_fl(rv3d->twmat, ED_view3d_pixel_size(rv3d, rv3d->twmat[3]) * U.tw_size * 5.0f); } + /* when looking through a selected camera, the manipulator can be at the + * exact same position as the view, skip so we don't break selection */ + if (fabsf(mat4_to_scale(rv3d->twmat)) < 1e-7f) + return; + test_manipulator_axis(C); drawflags = rv3d->twdrawflag; /* set in calc_manipulator_stats */ @@ -1677,7 +1683,12 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl rctf rect; GLuint buffer[64]; // max 4 items per select, so large enuf short hits; - extern void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect); // XXX check a bit later on this... (ton) + extern void setwinmatrixview3d(ARegion *, View3D *, rctf *); // XXX check a bit later on this... (ton) + + /* when looking through a selected camera, the manipulator can be at the + * exact same position as the view, skip so we don't break selection */ + if (fabsf(mat4_to_scale(rv3d->twmat)) < 1e-7f) + return 0; G.f |= G_PICKSEL; diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 70e01ef3718..55d80d63234 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -115,7 +115,7 @@ static TransformOrientation *createViewSpace(bContext *C, ReportList *UNUSED(rep View3D *v3d = CTX_wm_view3d(C); if (rv3d->persp == RV3D_CAMOB && v3d->camera) { /* If an object is used as camera, then this space is the same as object space! */ - strncpy(name, v3d->camera->id.name + 2, MAX_NAME); + BLI_strncpy(name, v3d->camera->id.name + 2, MAX_NAME); } else { strcpy(name, "Custom View"); @@ -141,7 +141,7 @@ static TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(r /* use object name if no name is given */ if (name[0] == 0) { - strncpy(name, ob->id.name + 2, MAX_ID_NAME - 2); + BLI_strncpy(name, ob->id.name + 2, MAX_ID_NAME - 2); } return addMatrixSpace(C, mat, name, overwrite); @@ -166,6 +166,26 @@ static TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, c return addMatrixSpace(C, mat, name, overwrite); } +static TransformOrientation *createCurveSpace(bContext *C, ReportList *reports, char *name, int overwrite) +{ + float mat[3][3]; + float normal[3], plane[3]; + + getTransformOrientation(C, normal, plane, 0); + + if (createSpaceNormalTangent(mat, normal, plane) == 0) { + BKE_reports_prepend(reports, "Cannot use zero-length curve"); + return NULL; + } + + if (name[0] == 0) { + strcpy(name, "Curve"); + } + + return addMatrixSpace(C, mat, name, overwrite); +} + + static TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *name, int overwrite) { float mat[3][3]; @@ -236,26 +256,34 @@ bool createSpaceNormal(float mat[3][3], const float normal[3]) return true; } -bool createSpaceNormalTangent(float mat[3][3], float normal[3], float tangent[3]) +/** + * \note To recreate an orientation from the matrix: + * - (plane == mat[1]) + * - (normal == mat[2]) + */ +bool createSpaceNormalTangent(float mat[3][3], const float normal[3], const float tangent[3]) { - copy_v3_v3(mat[2], normal); - if (normalize_v3(mat[2]) == 0.0f) { + if (normalize_v3_v3(mat[2], normal) == 0.0f) { return false; /* error return */ } - + + /* negate so we can use values from the matrix as input */ + negate_v3_v3(mat[1], tangent); /* preempt zero length tangent from causing trouble */ - if (tangent[0] == 0 && tangent[1] == 0 && tangent[2] == 0) { - tangent[2] = 1; + if (is_zero_v3(mat[1])) { + mat[1][2] = 1.0f; } - cross_v3_v3v3(mat[0], mat[2], tangent); + cross_v3_v3v3(mat[0], mat[2], mat[1]); if (normalize_v3(mat[0]) == 0.0f) { return false; /* error return */ } cross_v3_v3v3(mat[1], mat[2], mat[0]); + normalize_v3(mat[1]); - normalize_m3(mat); + /* final matrix must be normalized, do inline */ + // normalize_m3(mat); return true; } @@ -276,6 +304,8 @@ void BIF_createTransformOrientation(bContext *C, ReportList *reports, char *name ts = createMeshSpace(C, reports, name, overwrite); else if (obedit->type == OB_ARMATURE) ts = createBoneSpace(C, reports, name, overwrite); + else if (obedit->type == OB_CURVE) + ts = createCurveSpace(C, reports, name, overwrite); } else if (ob && (ob->mode & OB_MODE_POSE)) { ts = createBoneSpace(C, reports, name, overwrite); @@ -306,7 +336,7 @@ TransformOrientation *addMatrixSpace(bContext *C, float mat[3][3], char name[], if (ts == NULL) { ts = MEM_callocN(sizeof(TransformOrientation), "UserTransSpace from matrix"); BLI_addtail(transform_spaces, ts); - strncpy(ts->name, name, sizeof(ts->name)); + BLI_strncpy(ts->name, name, sizeof(ts->name)); } /* copy matrix into transform space */ @@ -466,14 +496,14 @@ void initTransformOrientation(bContext *C, TransInfo *t) strcpy(t->spacename, IFACE_("gimbal")); break; } - /* no gimbal fallthrough to normal */ + /* fall-through */ /* no gimbal fallthrough to normal */ case V3D_MANIP_NORMAL: if (obedit || (ob && ob->mode & OB_MODE_POSE)) { strcpy(t->spacename, IFACE_("normal")); ED_getTransformOrientationMatrix(C, t->spacemtx, (v3d->around == V3D_ACTIVE)); break; } - /* no break we define 'normal' as 'local' in Object mode */ + /* fall-through */ /* we define 'normal' as 'local' in Object mode */ case V3D_MANIP_LOCAL: strcpy(t->spacename, IFACE_("local")); @@ -667,6 +697,10 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], result = ORIENTATION_VERT; } } + + /* not needed but this matches 2.68 and older behavior */ + negate_v3(plane); + } /* end editmesh */ else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) { Curve *cu = obedit->data; @@ -675,34 +709,67 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], int a; ListBase *nurbs = BKE_curve_editNurbs_get(cu); - for (nu = nurbs->first; nu; nu = nu->next) { - /* only bezier has a normal */ - if (nu->type == CU_BEZIER) { - bezt = nu->bezt; - a = nu->pntsu; - while (a--) { - /* exception */ - if ((bezt->f1 & SELECT) + (bezt->f2 & SELECT) + (bezt->f3 & SELECT) > SELECT) { - sub_v3_v3v3(normal, bezt->vec[0], bezt->vec[2]); + if (activeOnly && cu->lastsel) { + for (nu = nurbs->first; nu; nu = nu->next) { + if (nu->type == CU_BEZIER) { + if (ARRAY_HAS_ITEM((BezTriple *)cu->lastsel, nu->bezt, nu->pntsu)) { + bezt = cu->lastsel; + BKE_nurb_bezt_calc_normal(nu, bezt, normal); + BKE_nurb_bezt_calc_plane(nu, bezt, plane); + break; } - else { - if (bezt->f1) { - sub_v3_v3v3(normal, bezt->vec[0], bezt->vec[1]); - } - if (bezt->f2) { - sub_v3_v3v3(normal, bezt->vec[0], bezt->vec[2]); - } - if (bezt->f3) { - sub_v3_v3v3(normal, bezt->vec[1], bezt->vec[2]); + } + else { + if (ARRAY_HAS_ITEM((BPoint *)cu->lastsel, nu->bp, nu->pntsu)) { + /* do nothing */ + break; + } + } + } + } + else { + for (nu = nurbs->first; nu; nu = nu->next) { + /* only bezier has a normal */ + if (nu->type == CU_BEZIER) { + bezt = nu->bezt; + a = nu->pntsu; + while (a--) { + /* exception */ + if ((bezt->f1 | bezt->f2 | bezt->f3) & SELECT) { + float tvec[3]; + if ((bezt->f1 & SELECT) + (bezt->f2 & SELECT) + (bezt->f3 & SELECT) > SELECT) { + BKE_nurb_bezt_calc_normal(nu, bezt, tvec); + add_v3_v3(normal, tvec); + } + else { + if (bezt->f1 & SELECT) { + sub_v3_v3v3(tvec, bezt->vec[0], bezt->vec[1]); + normalize_v3(tvec); + add_v3_v3(normal, tvec); + } + if (bezt->f2 & SELECT) { + sub_v3_v3v3(tvec, bezt->vec[0], bezt->vec[2]); + normalize_v3(tvec); + add_v3_v3(normal, tvec); + } + if (bezt->f3 & SELECT) { + sub_v3_v3v3(tvec, bezt->vec[1], bezt->vec[2]); + normalize_v3(tvec); + add_v3_v3(normal, tvec); + } + } + + BKE_nurb_bezt_calc_plane(nu, bezt, tvec); + add_v3_v3(plane, tvec); } + bezt++; } - bezt++; } } } if (!is_zero_v3(normal)) { - result = ORIENTATION_NORMAL; + result = ORIENTATION_FACE; } } else if (obedit->type == OB_MBALL) { @@ -716,7 +783,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], copy_v3_v3(normal, qmat[2]); - negate_v3_v3(plane, qmat[1]); + copy_v3_v3(plane, qmat[1]); result = ORIENTATION_FACE; } @@ -724,45 +791,33 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], else if (obedit->type == OB_ARMATURE) { bArmature *arm = obedit->data; EditBone *ebone; - int ok = FALSE; - - /* grr. but better then duplicate code */ -#define EBONE_CALC_NORMAL_PLANE { \ - float tmat[3][3]; \ - float vec[3]; \ - sub_v3_v3v3(vec, ebone->tail, ebone->head); \ - normalize_v3(vec); \ - add_v3_v3(normal, vec); \ - \ - vec_roll_to_mat3(vec, ebone->roll, tmat); \ - add_v3_v3(plane, tmat[2]); \ - } (void)0 - + bool ok = false; + float tmat[3][3]; if (activeOnly && (ebone = arm->act_edbone)) { - EBONE_CALC_NORMAL_PLANE; - ok = TRUE; + ED_armature_ebone_to_mat3(ebone, tmat); + add_v3_v3(normal, tmat[2]); + add_v3_v3(plane, tmat[1]); + ok = true; } else { for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { if (arm->layer & ebone->layer) { if (ebone->flag & BONE_SELECTED) { - EBONE_CALC_NORMAL_PLANE; - ok = TRUE; + ED_armature_ebone_to_mat3(ebone, tmat); + add_v3_v3(normal, tmat[2]); + add_v3_v3(plane, tmat[1]); + ok = true; } } } } if (ok) { - normalize_v3(normal); - normalize_v3(plane); - if (!is_zero_v3(plane)) { result = ORIENTATION_EDGE; } } -#undef EBONE_CALC_NORMAL_PLANE } /* Vectors from edges don't need the special transpose inverse multiplication */ @@ -804,8 +859,6 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], /* use for both active & all */ if (ok) { - negate_v3(plane); - /* we need the transpose of the inverse for a normal... */ copy_m3_m4(imat, ob->obmat); @@ -823,11 +876,14 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], else { /* we need the one selected object, if its not active */ ob = OBACT; - if (ob && !(ob->flag & SELECT)) ob = NULL; - - for (base = scene->base.first; base; base = base->next) { - if (TESTBASELIB(v3d, base)) { - if (ob == NULL) { + if (ob && (ob->flag & SELECT)) { + /* pass */ + } + else { + /* first selected */ + ob = NULL; + for (base = scene->base.first; base; base = base->next) { + if (TESTBASELIB(v3d, base)) { ob = base->object; break; } diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt index ea5e806647f..e72385b311d 100644 --- a/source/blender/editors/util/CMakeLists.txt +++ b/source/blender/editors/util/CMakeLists.txt @@ -47,6 +47,7 @@ set(SRC ../include/BIF_glutil.h ../include/ED_anim_api.h ../include/ED_armature.h + ../include/ED_buttons.h ../include/ED_clip.h ../include/ED_curve.h ../include/ED_datafiles.h diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c index ea3687ad715..bed8aaaddf2 100644 --- a/source/blender/editors/util/crazyspace.c +++ b/source/blender/editors/util/crazyspace.c @@ -40,6 +40,7 @@ #include "BLI_utildefines.h" #include "BLI_math.h" +#include "BLI_bitmap.h" #include "BKE_DerivedMesh.h" #include "BKE_modifier.h" @@ -51,7 +52,7 @@ typedef struct { float *vertexcos; - short *flags; + BLI_bitmap *vertex_visit; } MappedUserData; #define TAN_MAKE_VEC(a, b, c) a[0] = b[0] + 0.2f * (b[0] - c[0]); a[1] = b[1] + 0.2f * (b[1] - c[1]); a[2] = b[2] + 0.2f * (b[2] - c[2]) @@ -79,11 +80,11 @@ static void make_vertexcos__mapFunc(void *userData, int index, const float co[3] float *vec = mappedData->vertexcos; vec += 3 * index; - if (!mappedData->flags[index]) { + if (BLI_BITMAP_GET(mappedData->vertex_visit, index) == 0) { /* we need coord from prototype vertex, not it clones or images, * suppose they stored in the beginning of vertex array stored in DM */ copy_v3_v3(vec, co); - mappedData->flags[index] = 1; + BLI_BITMAP_SET(mappedData->vertex_visit, index); } } @@ -109,7 +110,7 @@ float *crazyspace_get_mapped_editverts(Scene *scene, Object *obedit) DerivedMesh *dm; float *vertexcos; int nverts = me->edit_btmesh->bm->totvert; - short *flags; + BLI_bitmap *vertex_visit; MappedUserData userData; /* disable subsurf temporal, get mapped cos, and enable it */ @@ -122,18 +123,18 @@ float *crazyspace_get_mapped_editverts(Scene *scene, Object *obedit) dm = editbmesh_get_derived_cage(scene, obedit, me->edit_btmesh, CD_MASK_BAREMESH); vertexcos = MEM_callocN(3 * sizeof(float) * nverts, "vertexcos map"); - flags = MEM_callocN(sizeof(short) * nverts, "vertexcos flags"); + vertex_visit = BLI_BITMAP_NEW(nverts, "vertexcos flags"); userData.vertexcos = vertexcos; - userData.flags = flags; - dm->foreachMappedVert(dm, make_vertexcos__mapFunc, &userData); + userData.vertex_visit = vertex_visit; + dm->foreachMappedVert(dm, make_vertexcos__mapFunc, &userData, DM_FOREACH_NOP); dm->release(dm); /* set back the flag, no new cage needs to be built, transform does it */ modifiers_disable_subsurf_temporary(obedit); - MEM_freeN(flags); + MEM_freeN(vertex_visit); return vertexcos; } @@ -278,7 +279,7 @@ int editbmesh_get_first_deform_matrices(Scene *scene, Object *ob, BMEditMesh *em if (!defmats) { dm = getEditDerivedBMesh(em, ob, NULL); deformedVerts = editbmesh_get_vertex_cos(em, &numVerts); - defmats = MEM_callocN(sizeof(*defmats) * numVerts, "defmats"); + defmats = MEM_mallocN(sizeof(*defmats) * numVerts, "defmats"); for (a = 0; a < numVerts; a++) unit_m3(defmats[a]); diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c index bfe3b80eff4..3e5f879aa3c 100644 --- a/source/blender/editors/util/numinput.c +++ b/source/blender/editors/util/numinput.c @@ -109,6 +109,7 @@ void outputNumInput(NumInput *n, char *str) break; default: BLI_snprintf(&str[j * ln], ln, "%s%.4e%c", inv, n->val[i], cur); + break; } } } @@ -201,8 +202,7 @@ char handleNumInput(NumInput *n, const wmEvent *event) n->inv[idx] = 0; } break; - case PERIODKEY: - case PADPERIOD: + case PERIODKEY: case PADPERIOD: if (n->flag & NUM_NO_FRACTION) return 0; @@ -213,11 +213,13 @@ char handleNumInput(NumInput *n, const wmEvent *event) break; case -1: n->ctrl[idx] = -10; + break; } break; case PADMINUS: if (event->alt) break; + /* fall-through */ case MINUSKEY: if (n->flag & NUM_NO_NEGATIVE) return 0; @@ -229,8 +231,7 @@ char handleNumInput(NumInput *n, const wmEvent *event) else n->ctrl[idx] = -1; break; - case PADSLASHKEY: - case SLASHKEY: + case PADSLASHKEY: case SLASHKEY: if (n->flag & NUM_NO_FRACTION) return 0; @@ -245,35 +246,34 @@ char handleNumInput(NumInput *n, const wmEvent *event) idx = 0; n->idx = idx; break; - case PAD9: - case NINEKEY: + case PAD9: case NINEKEY: Val += 1.0f; - case PAD8: - case EIGHTKEY: + /* fall-through */ + case PAD8: case EIGHTKEY: Val += 1.0f; - case PAD7: - case SEVENKEY: + /* fall-through */ + case PAD7: case SEVENKEY: Val += 1.0f; - case PAD6: - case SIXKEY: + /* fall-through */ + case PAD6: case SIXKEY: Val += 1.0f; - case PAD5: - case FIVEKEY: + /* fall-through */ + case PAD5: case FIVEKEY: Val += 1.0f; - case PAD4: - case FOURKEY: + /* fall-through */ + case PAD4: case FOURKEY: Val += 1.0f; - case PAD3: - case THREEKEY: + /* fall-through */ + case PAD3: case THREEKEY: Val += 1.0f; - case PAD2: - case TWOKEY: + /* fall-through */ + case PAD2: case TWOKEY: Val += 1.0f; - case PAD1: - case ONEKEY: + /* fall-through */ + case PAD1: case ONEKEY: Val += 1.0f; - case PAD0: - case ZEROKEY: + /* fall-through */ + case PAD0: case ZEROKEY: if (!n->ctrl[idx]) n->ctrl[idx] = 1; diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index 7f2e5b4b81c..e285fd8bea4 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -59,6 +59,7 @@ #include "ED_mball.h" #include "ED_mesh.h" #include "ED_object.h" +#include "ED_render.h" #include "ED_screen.h" #include "ED_sculpt.h" #include "ED_util.h" @@ -140,9 +141,12 @@ static int ed_undo_step(bContext *C, int step, const char *undoname) SpaceImage *sima = (SpaceImage *)sa->spacedata.first; if ((obact && (obact->mode & OB_MODE_TEXTURE_PAINT)) || (sima->mode == SI_MODE_PAINT)) { - if (!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname) && undoname) - if (U.uiflag & USER_GLOBALUNDO) + if (!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname) && undoname) { + if (U.uiflag & USER_GLOBALUNDO) { + ED_viewport_render_kill_jobs(C, true); BKE_undo_name(C, undoname); + } + } WM_event_add_notifier(C, NC_WINDOW, NULL); return OPERATOR_FINISHED; @@ -192,6 +196,8 @@ static int ed_undo_step(bContext *C, int step, const char *undoname) /* for example, texface stores image pointers */ undo_editmode_clear(); + ED_viewport_render_kill_jobs(C, true); + if (undoname) BKE_undo_name(C, undoname); else @@ -363,6 +369,8 @@ int ED_undo_operator_repeat(bContext *C, struct wmOperator *op) { int retval; + ED_viewport_render_kill_jobs(C, true); + if (G.debug & G_DEBUG) printf("redo_cb: operator redo %s\n", op->type->name); ED_undo_pop_op(C, op); @@ -529,6 +537,7 @@ static int undo_history_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_GEOM | ND_DATA, NULL); } else { + ED_viewport_render_kill_jobs(C, true); BKE_undo_number(C, item); WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, CTX_data_scene(C)); } diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 438f6bbdb9c..a873702b5b8 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -49,7 +49,6 @@ #include "BKE_mesh.h" #include "BKE_editmesh.h" -#include "BLI_array.h" #include "BLI_buffer.h" #include "BIF_gl.h" @@ -66,6 +65,10 @@ #include "uvedit_intern.h" +/* use editmesh tessface */ +#define USE_EDBM_LOOPTRIS + + void draw_image_cursor(SpaceImage *sima, ARegion *ar) { float zoom[2], x_fac, y_fac; @@ -257,6 +260,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe weight_to_rgb(col, areadiff); glColor3fv(col); + /* TODO: USE_EDBM_LOOPTRIS */ glBegin(GL_POLYGON); BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); @@ -321,6 +325,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe ang[i] = angle_normalized_v3v3(av[i], av[(i + 1) % efa_len]); } + /* TODO: USE_EDBM_LOOPTRIS */ glBegin(GL_POLYGON); BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); @@ -421,6 +426,23 @@ static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, Object *ob) } } +#ifdef USE_EDBM_LOOPTRIS +static void draw_uvs_looptri(BMEditMesh *em, unsigned int *r_loop_index, const int cd_loop_uv_offset) +{ + unsigned int i = *r_loop_index; + BMFace *f = em->looptris[i][0]->f; + do { + unsigned int j; + for (j = 0; j < 3; j++) { + MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(em->looptris[i][j], cd_loop_uv_offset); + glVertex2fv(luv->uv); + } + i++; + } while (i != em->tottri && (f == em->looptris[i][0]->f)); + *r_loop_index = i - 1; +} +#endif + /* draws uv's in the image space */ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) { @@ -428,7 +450,10 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) Mesh *me = obedit->data; BMEditMesh *em = me->edit_btmesh; BMesh *bm = em->bm; - BMFace *efa, *efa_act, *activef; + BMFace *efa, *efa_act; +#ifndef USE_EDBM_LOOPTRIS + BMFace *activef; +#endif BMLoop *l; BMIter iter, liter; MTexPoly *tf, *activetf = NULL; @@ -443,7 +468,9 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) const int cd_poly_tex_offset = CustomData_get_offset(&bm->pdata, CD_MTEXPOLY); activetf = EDBM_mtexpoly_active_get(em, &efa_act, FALSE, FALSE); /* will be set to NULL if hidden */ +#ifndef USE_EDBM_LOOPTRIS activef = BM_mesh_active_face_get(bm, FALSE, FALSE); +#endif ts = scene->toolsettings; drawfaces = draw_uvs_face_check(scene); @@ -490,9 +517,42 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); +#ifdef USE_EDBM_LOOPTRIS + { + unsigned int i; + for (i = 0; i < em->tottri; i++) { + efa = em->looptris[i][0]->f; + tf = BM_ELEM_CD_GET_VOID_P(efa, cd_poly_tex_offset); + if (uvedit_face_visible_test(scene, ima, efa, tf)) { + const bool is_select = uvedit_face_select_test(scene, efa, cd_loop_uv_offset); + BM_elem_flag_enable(efa, BM_ELEM_TAG); + + if (tf == activetf) { + /* only once */ + glEnable(GL_POLYGON_STIPPLE); + glPolygonStipple(stipple_quarttone); + UI_ThemeColor4(TH_EDITMESH_ACTIVE); + } + else { + glColor4ubv((GLubyte *)(is_select ? col2 : col1)); + } + + glBegin(GL_TRIANGLES); + draw_uvs_looptri(em, &i, cd_loop_uv_offset); + glEnd(); + + if (tf == activetf) { + glDisable(GL_POLYGON_STIPPLE); + } + } + else { + BM_elem_flag_disable(efa, BM_ELEM_TAG); + } + } + } +#else BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { tf = BM_ELEM_CD_GET_VOID_P(efa, cd_poly_tex_offset); - if (uvedit_face_visible_test(scene, ima, efa, tf)) { BM_elem_flag_enable(efa, BM_ELEM_TAG); if (tf == activetf) continue; /* important the temp boolean is set above */ @@ -515,6 +575,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) BM_elem_flag_disable(efa, BM_ELEM_TAG); } } +#endif glDisable(GL_BLEND); } else { @@ -536,7 +597,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) } /* 3. draw active face stippled */ - +#ifndef USE_EDBM_LOOPTRIS if (activef) { tf = BM_ELEM_CD_GET_VOID_P(activef, cd_poly_tex_offset); if (uvedit_face_visible_test(scene, ima, activef, tf)) { @@ -558,6 +619,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit) glDisable(GL_BLEND); } } +#endif /* 4. draw edges */ diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 1ed00c3aa20..0b514e3f6fd 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -46,11 +46,12 @@ #include "DNA_space_types.h" #include "DNA_scene_types.h" +#include "BLI_utildefines.h" +#include "BLI_alloca.h" #include "BLI_math.h" #include "BLI_lasso.h" #include "BLI_blenlib.h" #include "BLI_array.h" -#include "BLI_utildefines.h" #include "BKE_context.h" #include "BKE_customdata.h" @@ -3226,7 +3227,7 @@ static void UV_OT_snap_cursor(wmOperatorType *ot) /* ******************** snap selection operator **************** */ -static bool uv_snap_uvs_to_cursor(Scene *scene, Image *ima, Object *obedit, SpaceImage *sima) +static bool uv_snap_uvs_to_cursor(Scene *scene, Image *ima, Object *obedit, const float cursor[2]) { BMEditMesh *em = BKE_editmesh_from_object(obedit); BMFace *efa; @@ -3247,7 +3248,37 @@ static bool uv_snap_uvs_to_cursor(Scene *scene, Image *ima, Object *obedit, Spac BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - copy_v2_v2(luv->uv, sima->cursor); + copy_v2_v2 (luv->uv, cursor); + change = true; + } + } + } + + return change; +} + +static bool uv_snap_uvs_offset(Scene *scene, Image *ima, Object *obedit, const float offset[2]) +{ + BMEditMesh *em = BKE_editmesh_from_object(obedit); + BMFace *efa; + BMLoop *l; + BMIter iter, liter; + MTexPoly *tface; + MLoopUV *luv; + bool change = false; + + const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); + const int cd_poly_tex_offset = CustomData_get_offset(&em->bm->pdata, CD_MTEXPOLY); + + BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { + tface = BM_ELEM_CD_GET_VOID_P(efa, cd_poly_tex_offset); + if (!uvedit_face_visible_test(scene, ima, efa, tface)) + continue; + + BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { + if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset)) { + luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); + add_v2_v2(luv->uv, offset); change = true; } } @@ -3365,9 +3396,19 @@ static int uv_snap_selection_exec(bContext *C, wmOperator *op) change = uv_snap_uvs_to_pixels(sima, scene, obedit); break; case 1: - change = uv_snap_uvs_to_cursor(scene, ima, obedit, sima); + change = uv_snap_uvs_to_cursor(scene, ima, obedit, sima->cursor); break; case 2: + { + float center[2]; + if (uvedit_center(scene, ima, obedit, center, sima->around)) { + float offset[2]; + sub_v2_v2v2(offset, sima->cursor, center); + change = uv_snap_uvs_offset(scene, ima, obedit, offset); + } + break; + } + case 3: change = uv_snap_uvs_to_adjacent_unselected(scene, ima, obedit); break; } @@ -3387,7 +3428,8 @@ static void UV_OT_snap_selected(wmOperatorType *ot) static EnumPropertyItem target_items[] = { {0, "PIXELS", 0, "Pixels", ""}, {1, "CURSOR", 0, "Cursor", ""}, - {2, "ADJACENT_UNSELECTED", 0, "Adjacent Unselected", ""}, + {2, "CURSOR_OFFSET", 0, "Cursor (Offset)", ""}, + {3, "ADJACENT_UNSELECTED", 0, "Adjacent Unselected", ""}, {0, NULL, 0, NULL, NULL}}; /* identifiers */ diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 6f92c1873d6..7851eebe269 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -26,15 +26,13 @@ #include "MEM_guardedalloc.h" -#include "BLI_array.h" +#include "BLI_utildefines.h" +#include "BLI_alloca.h" #include "BLI_memarena.h" #include "BLI_math.h" #include "BLI_rand.h" #include "BLI_heap.h" #include "BLI_boxpack2d.h" -#include "BLI_utildefines.h" - - #include "ONL_opennl.h" @@ -3682,8 +3680,8 @@ static SmoothNode *p_node_new(MemArena *arena, SmoothTriangle **tri, int ntri, f if (ntri <= 10 || depth >= 15) return node; - t1 = MEM_mallocN(sizeof(SmoothTriangle) * ntri, "PNodeTri1"); - t2 = MEM_mallocN(sizeof(SmoothTriangle) * ntri, "PNodeTri1"); + t1 = MEM_mallocN(sizeof(*t1) * ntri, "PNodeTri1"); + t2 = MEM_mallocN(sizeof(*t2) * ntri, "PNodeTri1"); axis = (bmax[0] - bmin[0] > bmax[1] - bmin[1]) ? 0 : 1; split = 0.5f * (bmin[axis] + bmax[axis]); diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index a100757980c..af6689e3f6d 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -44,6 +44,7 @@ #include "DNA_modifier_types.h" #include "BLI_utildefines.h" +#include "BLI_alloca.h" #include "BLI_math.h" #include "BLI_edgehash.h" #include "BLI_uvproject.h" @@ -65,7 +66,6 @@ #include "BLI_math.h" #include "BLI_edgehash.h" #include "BLI_scanfill.h" -#include "BLI_array.h" #include "BLI_uvproject.h" #include "PIL_time.h" diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp index 2f98a042e27..cd8ce14567e 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp @@ -22,10 +22,10 @@ * \ingroup freestyle */ -#include <assert.h> - #include "BlenderFileLoader.h" +#include "BLI_utildefines.h" + #include "BKE_global.h" namespace Freestyle { @@ -60,8 +60,23 @@ NodeGroup *BlenderFileLoader::Load() _viewplane_right = _re->viewplane.xmax; _viewplane_bottom = _re->viewplane.ymin; _viewplane_top = _re->viewplane.ymax; - _z_near = -_re->clipsta; - _z_far = -_re->clipend; + + if ((_re->r.scemode & R_VIEWPORT_PREVIEW) && (_re->r.mode & R_ORTHO)) { + // Adjust clipping start/end and set up a Z offset when the viewport preview + // is used with the orthographic view. In this case, _re->clipsta is negative, + // while Freestyle assumes that imported mesh data are in the camera coordinate + // system with the view point located at origin [bug #36009]. + BLI_assert(_re->clipsta < 0.f); + _z_near = -0.001f; + _z_offset = _re->clipsta + _z_near; + _z_far = -_re->clipend + _z_offset; + } + else { + _z_near = -_re->clipsta; + _z_far = -_re->clipend; + _z_offset = 0.f; + } + #if 0 if (G.debug & G_DEBUG_FREESTYLE) { cout << "Frustum: l " << _viewplane_left << " r " << _viewplane_right @@ -225,7 +240,7 @@ void BlenderFileLoader::clipTriangle(int numTris, float triCoords[][3], float v1 } } } - assert(k == 2 + numTris); + BLI_assert(k == 2 + numTris); } void BlenderFileLoader::addTriangle(struct LoaderState *ls, float v1[3], float v2[3], float v3[3], @@ -293,6 +308,9 @@ void BlenderFileLoader::addTriangle(struct LoaderState *ls, float v1[3], float v // zero otherwise. int BlenderFileLoader::testDegenerateTriangle(float v1[3], float v2[3], float v3[3]) { + const float eps = 1.0e-6; + const float eps_sq = eps * eps; + #if 0 float area = area_tri_v3(v1, v2, v3); bool verbose = (area < 1.0e-6); @@ -306,9 +324,9 @@ int BlenderFileLoader::testDegenerateTriangle(float v1[3], float v2[3], float v3 #endif return 1; } - if (dist_to_line_segment_v3(v1, v2, v3) < 1.0e-6 || - dist_to_line_segment_v3(v2, v1, v3) < 1.0e-6 || - dist_to_line_segment_v3(v3, v1, v2) < 1.0e-6) + if (dist_squared_to_line_segment_v3(v1, v2, v3) < eps_sq || + dist_squared_to_line_segment_v3(v2, v1, v3) < eps_sq || + dist_squared_to_line_segment_v3(v3, v1, v2) < eps_sq) { #if 0 if (verbose && G.debug & G_DEBUG_FREESTYLE) { @@ -378,6 +396,11 @@ void BlenderFileLoader::insertShapeNode(ObjectInstanceRen *obi, int id) if (vlr->v4) mul_m4_v3(obi->mat, v4); } + v1[2] += _z_offset; + v2[2] += _z_offset; + v3[2] += _z_offset; + if (vlr->v4) + v4[2] += _z_offset; #if 0 print_v3("v1", v1); print_v3("v2", v2); @@ -472,6 +495,11 @@ void BlenderFileLoader::insertShapeNode(ObjectInstanceRen *obi, int id) if (vlr->v4) mul_m4_v3(obi->mat, v4); } + v1[2] += _z_offset; + v2[2] += _z_offset; + v3[2] += _z_offset; + if (vlr->v4) + v4[2] += _z_offset; if (_smooth && (vlr->flag & R_SMOOTH)) { copy_v3_v3(n1, vlr->v1->n); copy_v3_v3(n2, vlr->v2->n); diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h index 494dd375be0..c505eab40f1 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h @@ -122,6 +122,7 @@ protected: float _viewplane_bottom; float _viewplane_top; float _z_near, _z_far; + float _z_offset; RenderMonitor *_pRenderMonitor; diff --git a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp index e44dfdf0bae..dd678ee6fbd 100644 --- a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp +++ b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp @@ -79,6 +79,26 @@ ContextFunctions_get_canvas_height(PyObject *self) return PyLong_FromLong(ContextFunctions::GetCanvasHeightCF()); } +static char ContextFunctions_get_border___doc__[] = +".. method:: get_border()\n" +"\n" +" Returns the border.\n" +"\n" +" :return: A tuple of 4 numbers (xmin, ymin, xmax, ymax).\n" +" :rtype: tuple\n"; + +static PyObject * +ContextFunctions_get_border(PyObject *self) +{ + BBox<Vec2i> border(ContextFunctions::GetBorderCF()); + PyObject *v = PyTuple_New(4); + PyTuple_SET_ITEM(v, 0, PyLong_FromLong(border.getMin().x())); + PyTuple_SET_ITEM(v, 1, PyLong_FromLong(border.getMin().y())); + PyTuple_SET_ITEM(v, 2, PyLong_FromLong(border.getMax().x())); + PyTuple_SET_ITEM(v, 3, PyLong_FromLong(border.getMax().y())); + return v; +} + static char ContextFunctions_load_map___doc__[] = ".. function:: load_map(file_name, map_name, num_levels=4, sigma=1.0)\n" "\n" @@ -232,6 +252,8 @@ static PyMethodDef module_functions[] = { ContextFunctions_get_canvas_width___doc__}, {"get_canvas_height", (PyCFunction)ContextFunctions_get_canvas_height, METH_NOARGS, ContextFunctions_get_canvas_height___doc__}, + {"get_border", (PyCFunction)ContextFunctions_get_border, METH_NOARGS, + ContextFunctions_get_border___doc__}, {"load_map", (PyCFunction)ContextFunctions_load_map, METH_VARARGS | METH_KEYWORDS, ContextFunctions_load_map___doc__}, {"read_map_pixel", (PyCFunction)ContextFunctions_read_map_pixel, METH_VARARGS | METH_KEYWORDS, diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp index 883dba4a31c..3e4e7e3aef3 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp @@ -266,7 +266,7 @@ static PyObject *Stroke_stroke_vertices_begin(BPy_Stroke *self, PyObject *args, } PyDoc_STRVAR(Stroke_stroke_vertices_end_doc, -".. method:: strokeVerticesEnd()\n" +".. method:: stroke_vertices_end()\n" "\n" " Returns a StrokeVertexIterator pointing after the last StrokeVertex\n" " of the Stroke.\n" diff --git a/source/blender/freestyle/intern/stroke/Canvas.h b/source/blender/freestyle/intern/stroke/Canvas.h index 07aa171534a..038b4b3af0f 100644 --- a/source/blender/freestyle/intern/stroke/Canvas.h +++ b/source/blender/freestyle/intern/stroke/Canvas.h @@ -195,6 +195,7 @@ public: virtual int width() const = 0; virtual int height() const = 0; + virtual BBox<Vec2i> border() const = 0; virtual BBox<Vec3r> scene3DBBox() const = 0; inline const StrokeRenderer *renderer() const diff --git a/source/blender/freestyle/intern/stroke/ContextFunctions.cpp b/source/blender/freestyle/intern/stroke/ContextFunctions.cpp index 42d27a0e5c3..052a6804815 100644 --- a/source/blender/freestyle/intern/stroke/ContextFunctions.cpp +++ b/source/blender/freestyle/intern/stroke/ContextFunctions.cpp @@ -51,6 +51,11 @@ unsigned GetCanvasHeightCF() return Canvas::getInstance()->height(); } +BBox<Vec2i> GetBorderCF() +{ + return Canvas::getInstance()->border(); +} + void LoadMapCF(const char *iFileName, const char *iMapName, unsigned iNbLevels, float iSigma) { return Canvas::getInstance()->loadMap(iFileName, iMapName, iNbLevels, iSigma); diff --git a/source/blender/freestyle/intern/stroke/ContextFunctions.h b/source/blender/freestyle/intern/stroke/ContextFunctions.h index 5c0b88fd412..28ce918e919 100644 --- a/source/blender/freestyle/intern/stroke/ContextFunctions.h +++ b/source/blender/freestyle/intern/stroke/ContextFunctions.h @@ -54,10 +54,15 @@ LIB_STROKE_EXPORT unsigned GetCanvasWidthCF(); // GetCanvasHeight -/*! Returns the canvas width */ +/*! Returns the canvas height */ LIB_STROKE_EXPORT unsigned GetCanvasHeightCF(); +// GetBorder +/*! Returns the border */ +LIB_STROKE_EXPORT +BBox<Vec2i> GetBorderCF(); + // Load map /*! Loads an image map for further reading */ LIB_STROKE_EXPORT diff --git a/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp index ed9932c3eef..8bc7c0952a8 100644 --- a/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp +++ b/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp @@ -79,10 +79,10 @@ void ArbitraryGridDensityProvider::initialize(const real proscenium[4]) // Make sure the grid exceeds the proscenium by a small amount float safetyZone = 0.1f; if (_cellsX * _cellSize < prosceniumWidth * (1.0 + safetyZone)) { - _cellsX = prosceniumWidth * (1.0 + safetyZone) / _cellSize; + _cellsX = ceil(prosceniumWidth * (1.0 + safetyZone) / _cellSize); } if (_cellsY * _cellSize < prosceniumHeight * (1.0 + safetyZone)) { - _cellsY = prosceniumHeight * (1.0 + safetyZone) / _cellSize; + _cellsY = ceil(prosceniumHeight * (1.0 + safetyZone) / _cellSize); } if (G.debug & G_DEBUG_FREESTYLE) { cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl; diff --git a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp index 61ad78a8567..952b9752a3e 100644 --- a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp +++ b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp @@ -100,10 +100,10 @@ void AverageAreaGridDensityProvider::initialize(const real proscenium[4], real s // Make sure the grid exceeds the proscenium by a small amount float safetyZone = 0.1f; if (_cellsX * _cellSize < prosceniumWidth * (1.0 + safetyZone)) { - _cellsX = prosceniumWidth * (1.0 + safetyZone) / _cellSize; + _cellsX = ceil(prosceniumWidth * (1.0 + safetyZone) / _cellSize); } if (_cellsY * _cellSize < prosceniumHeight * (1.0 + safetyZone)) { - _cellsY = prosceniumHeight * (1.0 + safetyZone) / _cellSize; + _cellsY = ceil(prosceniumHeight * (1.0 + safetyZone) / _cellSize); } if (G.debug & G_DEBUG_FREESTYLE) { cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl; diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.cpp b/source/blender/freestyle/intern/view_map/BoxGrid.cpp index 2e702813fb8..f770bf6843f 100644 --- a/source/blender/freestyle/intern/view_map/BoxGrid.cpp +++ b/source/blender/freestyle/intern/view_map/BoxGrid.cpp @@ -129,6 +129,10 @@ void BoxGrid::assignCells (OccluderSource& source, GridDensityProvider& density, _cellsY = density.cellsY(); _cellOrigin[0] = density.cellOrigin(0); _cellOrigin[1] = density.cellOrigin(1); + if (G.debug & G_DEBUG_FREESTYLE) { + cout << "Using " << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl; + cout << "Cell origin: " << _cellOrigin[0] << ", " << _cellOrigin[1] << endl; + } // Now allocate the cell table and fill it with default (empty) cells _cells.resize(_cellsX * _cellsY); diff --git a/source/blender/freestyle/intern/view_map/GridDensityProvider.h b/source/blender/freestyle/intern/view_map/GridDensityProvider.h index d096fb3aacd..fe14efbe20f 100644 --- a/source/blender/freestyle/intern/view_map/GridDensityProvider.h +++ b/source/blender/freestyle/intern/view_map/GridDensityProvider.h @@ -100,24 +100,29 @@ public: static void calculateQuickProscenium(const GridHelpers::Transform& transform, const BBox<Vec3r>& bbox, real proscenium[4]) { - real z; - // We want to use the z-coordinate closest to the camera to determine the proscenium face - if (::fabs(bbox.getMin()[2]) < ::fabs(bbox.getMax()[2])) { - z = bbox.getMin()[2]; - } - else { - z = bbox.getMax()[2]; - } - // Now calculate the proscenium according to the min and max values of the x and y coordinates - Vec3r minPoint = transform(Vec3r(bbox.getMin()[0], bbox.getMin()[1], z)); - Vec3r maxPoint = transform(Vec3r(bbox.getMax()[0], bbox.getMax()[1], z)); - proscenium[0] = std::min(minPoint[0], maxPoint[0]); - proscenium[1] = std::max(minPoint[0], maxPoint[0]); - proscenium[2] = std::min(minPoint[1], maxPoint[1]); - proscenium[3] = std::max(minPoint[1], maxPoint[1]); + // Transform the coordinates of the 8 corners of the 3D bounding box + real xm = bbox.getMin()[0], xM = bbox.getMax()[0]; + real ym = bbox.getMin()[1], yM = bbox.getMax()[1]; + real zm = bbox.getMin()[2], zM = bbox.getMax()[2]; + Vec3r p1 = transform(Vec3r(xm, ym, zm)); + Vec3r p2 = transform(Vec3r(xm, ym, zM)); + Vec3r p3 = transform(Vec3r(xm, yM, zm)); + Vec3r p4 = transform(Vec3r(xm, yM, zM)); + Vec3r p5 = transform(Vec3r(xM, ym, zm)); + Vec3r p6 = transform(Vec3r(xM, ym, zM)); + Vec3r p7 = transform(Vec3r(xM, yM, zm)); + Vec3r p8 = transform(Vec3r(xM, yM, zM)); + // Determine the proscenium face according to the min and max values of the transformed x and y coordinates + proscenium[0] = std::min(std::min(std::min(p1.x(), p2.x()), std::min(p3.x(), p4.x())), + std::min(std::min(p5.x(), p6.x()), std::min(p7.x(), p8.x()))); + proscenium[1] = std::max(std::max(std::max(p1.x(), p2.x()), std::max(p3.x(), p4.x())), + std::max(std::max(p5.x(), p6.x()), std::max(p7.x(), p8.x()))); + proscenium[2] = std::min(std::min(std::min(p1.y(), p2.y()), std::min(p3.y(), p4.y())), + std::min(std::min(p5.y(), p6.y()), std::min(p7.y(), p8.y()))); + proscenium[3] = std::max(std::max(std::max(p1.y(), p2.y()), std::max(p3.y(), p4.y())), + std::max(std::max(p5.y(), p6.y()), std::max(p7.y(), p8.y()))); if (G.debug & G_DEBUG_FREESTYLE) { - cout << "Bounding box: " << minPoint << " to " << maxPoint << endl; - cout << "Proscenium : " << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2] << ", " << + cout << "Proscenium: " << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2] << ", " << proscenium[3] << endl; } } diff --git a/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp index 40a3c9f298d..e3bb9b87ecc 100644 --- a/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp +++ b/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp @@ -78,10 +78,10 @@ void Pow23GridDensityProvider::initialize(const real proscenium[4]) // Make sure the grid exceeds the proscenium by a small amount float safetyZone = 0.1; if (_cellsX * _cellSize < prosceniumWidth * (1.0 + safetyZone)) { - _cellsX = prosceniumWidth * (1.0 + safetyZone) / _cellSize; + _cellsX = ceil(prosceniumWidth * (1.0 + safetyZone) / _cellSize); } if (_cellsY * _cellSize < prosceniumHeight * (1.0 + safetyZone)) { - _cellsY = prosceniumHeight * (1.0 + safetyZone) / _cellSize; + _cellsY = ceil(prosceniumHeight * (1.0 + safetyZone) / _cellSize); } if (G.debug & G_DEBUG_FREESTYLE) { cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl; diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp index 1621bd85000..60ad7daea0a 100644 --- a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp +++ b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp @@ -127,6 +127,10 @@ void SphericalGrid::assignCells(OccluderSource& source, GridDensityProvider& den _cellsY = density.cellsY(); _cellOrigin[0] = density.cellOrigin(0); _cellOrigin[1] = density.cellOrigin(1); + if (G.debug & G_DEBUG_FREESTYLE) { + cout << "Using " << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl; + cout << "Cell origin: " << _cellOrigin[0] << ", " << _cellOrigin[1] << endl; + } // Now allocate the cell table and fill it with default (empty) cells _cells.resize(_cellsX * _cellsY); diff --git a/source/blender/freestyle/intern/view_map/ViewMap.cpp b/source/blender/freestyle/intern/view_map/ViewMap.cpp index 102581bf70f..246c4caef82 100644 --- a/source/blender/freestyle/intern/view_map/ViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMap.cpp @@ -216,6 +216,11 @@ ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge*>& newVi // update new View Vertex: vva->AddOutgoingViewEdge(newVEdge); vva->AddIncomingViewEdge(ioEdge); + + NonTVertex *vvb = dynamic_cast<NonTVertex*>(newVEdge->B()); + if (vvb) + vvb->Replace(ioEdge, newVEdge); + // update ViewShape //vshape->AddEdge(newVEdge); // update SShape diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp index 20b0f6576bb..81b0f5f8934 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp @@ -1364,6 +1364,9 @@ void ViewMapBuilder::ComputeDetailedVisibility(ViewMap *ioViewMap, WingedEdge& w void ViewMapBuilder::ComputeEdgesVisibility(ViewMap *ioViewMap, WingedEdge& we, const BBox<Vec3r>& bbox, unsigned int sceneNumFaces, visibility_algo iAlgo, real epsilon) { +#if 0 + iAlgo = ray_casting; // for testing algorithms equivalence +#endif switch (iAlgo) { case ray_casting: if (_global.debug & G_DEBUG_FREESTYLE) { diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 4d52afbde93..11cf64b0995 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -1266,7 +1266,7 @@ struct GPU_Buffers { CCGKey gridkey; CCGElem **grids; const DMFlagMat *grid_flag_mats; - const BLI_bitmap *grid_hidden; + BLI_bitmap * const *grid_hidden; int *grid_indices; int totgrid; int has_hidden; @@ -1686,7 +1686,7 @@ void GPU_update_grid_buffers(GPU_Buffers *buffers, CCGElem **grids, } /* Returns the number of visible quads in the nodes' grids. */ -static int gpu_count_grid_quads(BLI_bitmap *grid_hidden, +static int gpu_count_grid_quads(BLI_bitmap **grid_hidden, int *grid_indices, int totgrid, int gridsize) { @@ -1697,7 +1697,7 @@ static int gpu_count_grid_quads(BLI_bitmap *grid_hidden, * visibility */ for (i = 0, totquad = 0; i < totgrid; i++) { - const BLI_bitmap gh = grid_hidden[grid_indices[i]]; + const BLI_bitmap *gh = grid_hidden[grid_indices[i]]; if (gh) { /* grid hidden are present, have to check each element */ @@ -1732,7 +1732,7 @@ static int gpu_count_grid_quads(BLI_bitmap *grid_hidden, GL_WRITE_ONLY_ARB); \ if (quad_data) { \ for (i = 0; i < totgrid; ++i) { \ - BLI_bitmap gh = NULL; \ + BLI_bitmap *gh = NULL; \ if (grid_hidden) \ gh = grid_hidden[(grid_indices)[i]]; \ \ @@ -1770,7 +1770,7 @@ static GLuint gpu_get_grid_buffer(int gridsize, GLenum *index_type, unsigned *to static unsigned prev_totquad; /* used in the FILL_QUAD_BUFFER macro */ - const BLI_bitmap *grid_hidden = NULL; + BLI_bitmap * const *grid_hidden = NULL; int *grid_indices = NULL; int totgrid = 1; @@ -1815,7 +1815,7 @@ static GLuint gpu_get_grid_buffer(int gridsize, GLenum *index_type, unsigned *to } GPU_Buffers *GPU_build_grid_buffers(int *grid_indices, int totgrid, - BLI_bitmap *grid_hidden, int gridsize) + BLI_bitmap **grid_hidden, int gridsize) { GPU_Buffers *buffers; int totquad; @@ -2200,7 +2200,7 @@ static void gpu_draw_buffers_legacy_grids(GPU_Buffers *buffers) for (i = 0; i < buffers->totgrid; ++i) { int g = buffers->grid_indices[i]; CCGElem *grid = buffers->grids[g]; - BLI_bitmap gh = buffers->grid_hidden[g]; + BLI_bitmap *gh = buffers->grid_hidden[g]; /* TODO: could use strips with hiding as well */ diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index ffd3bba5493..ea7b169a882 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -989,6 +989,8 @@ void GPU_framebuffer_blur(GPUFrameBuffer *fb, GPUTexture *tex, GPUFrameBuffer *b glMatrixMode(GL_PROJECTION); glLoadIdentity(); + glDisable(GL_DEPTH_TEST); + GPU_texture_bind(tex, 0); /* Drawing quad */ diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 044b699a042..0ca929da65d 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -742,12 +742,16 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la } if (lamp->mode & LA_ONLYSHADOW) { + GPUNodeLink *rgb; GPU_link(mat, "shade_only_shadow", i, shadfac, GPU_dynamic_uniform(&lamp->dynenergy, GPU_DYNAMIC_LAMP_DYNENERGY, lamp->ob), &shadfac); + + GPU_link(mat, "shade_mul", shi->rgb, GPU_uniform(lamp->shadow_color), &rgb); + GPU_link(mat, "mtex_rgb_invert", rgb, &rgb); if (!(lamp->mode & LA_NO_DIFF)) { - GPU_link(mat, "mix_mult", shadfac, shr->diff, - GPU_uniform(lamp->shadow_color), &shr->diff); + GPU_link(mat, "shade_only_shadow_diffuse", shadfac, rgb, + shr->diff, &shr->diff); } if (!(lamp->mode & LA_NO_SPEC)) diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 64e80d4383c..63790cf7d25 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -429,10 +429,9 @@ static ImBuf *avi_fetchibuf(struct anim *anim, int position) } } } - else { -#else - if (1) { + else #endif + { ibuf = IMB_allocImBuf(anim->x, anim->y, 24, IB_rect); tmp = AVI_read_frame(anim->avi, AVI_FORMAT_RGB32, position, diff --git a/source/blender/imbuf/intern/cineon/logImageCore.c b/source/blender/imbuf/intern/cineon/logImageCore.c index c10f201fb55..1500f4282e5 100644 --- a/source/blender/imbuf/intern/cineon/logImageCore.c +++ b/source/blender/imbuf/intern/cineon/logImageCore.c @@ -918,25 +918,35 @@ static int getYUVtoRGBMatrix(float *matrix, LogImageElement logElement) } } -static void getLinToLogLut(float *lut, LogImageFile *logImage, LogImageElement logElement) +static float *getLinToLogLut(LogImageFile *logImage, LogImageElement logElement) { + float *lut; float gain, negativeFilmGamma, offset, step; + unsigned int lutsize = (unsigned int)(logElement.maxValue + 1); unsigned int i; + + lut = MEM_mallocN(sizeof(float) * lutsize, "getLinToLogLut"); negativeFilmGamma = 0.6; step = logElement.refHighQuantity / logElement.maxValue; gain = logElement.maxValue / (1.0f - powf(10, (logImage->referenceBlack - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f)); offset = gain - logElement.maxValue; - for (i = 0; i < (int)(logElement.maxValue + 1); i++) + for (i = 0; i < lutsize; i++) lut[i] = (logImage->referenceWhite + log10f(powf((i + offset) / gain, 1.7f / logImage->gamma)) / (step / negativeFilmGamma)) / logElement.maxValue; + + return lut; } -static void getLogToLinLut(float *lut, LogImageFile *logImage, LogImageElement logElement) +static float *getLogToLinLut(LogImageFile *logImage, LogImageElement logElement) { + float *lut; float breakPoint, gain, kneeGain, kneeOffset, negativeFilmGamma, offset, step, softClip; /* float filmGamma; unused */ + unsigned int lutsize = (unsigned int)(logElement.maxValue + 1); unsigned int i; + + lut = MEM_mallocN(sizeof(float) * lutsize, "getLogToLinLut"); /* Building the Log -> Lin LUT */ step = logElement.refHighQuantity / logElement.maxValue; @@ -952,7 +962,7 @@ static void getLogToLinLut(float *lut, LogImageFile *logImage, LogImageElement l kneeOffset = powf(10, (breakPoint - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f) * gain - offset; kneeGain = (logElement.maxValue - kneeOffset) / powf(5 * softClip, softClip / 100); - for (i = 0; i < (int)(logElement.maxValue + 1); i++) { + for (i = 0; i < lutsize; i++) { if (i < logImage->referenceBlack) lut[i] = 0.0f; else if (i > breakPoint) @@ -960,61 +970,76 @@ static void getLogToLinLut(float *lut, LogImageFile *logImage, LogImageElement l else lut[i] = (powf(10, ((float)i - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f) * gain - offset) / logElement.maxValue; } + + return lut; } -static void getLinToSrgbLut(float *lut, LogImageElement logElement) +static float *getLinToSrgbLut(LogImageElement logElement) { + float col, *lut; + unsigned int lutsize = (unsigned int)(logElement.maxValue + 1); unsigned int i; - float col; - for (i = 0; i < (int)(logElement.maxValue + 1); i++) { + lut = MEM_mallocN(sizeof(float) * lutsize, "getLogToLinLut"); + + for (i = 0; i < lutsize; i++) { col = (float)i / logElement.maxValue; if (col < 0.0031308f) lut[i] = (col < 0.0f) ? 0.0f : col * 12.92f; else lut[i] = 1.055f * powf(col, 1.0f / 2.4f) - 0.055f; } + + return lut; } -static void getSrgbToLinLut(float *lut, LogImageElement logElement) +static float *getSrgbToLinLut(LogImageElement logElement) { + float col, *lut; + unsigned int lutsize = (unsigned int)(logElement.maxValue + 1); unsigned int i; - float col; - for (i = 0; i < (int)(logElement.maxValue + 1); i++) { + lut = MEM_mallocN(sizeof(float) * lutsize, "getLogToLinLut"); + + for (i = 0; i < lutsize; i++) { col = (float)i / logElement.maxValue; if (col < 0.04045f) lut[i] = (col < 0.0f) ? 0.0f : col * (1.0f / 12.92f); else lut[i] = powf((col + 0.055f) * (1.0f / 1.055f), 2.4f); } + + return lut; } static int convertRGBA_RGB(float *src, float *dst, LogImageFile *logImage, LogImageElement logElement, int elementIsSource) { unsigned int i; - float lut[65536]; float *src_ptr = src; float *dst_ptr = dst; switch (logElement.transfer) { case transfer_UserDefined: case transfer_Linear: - case transfer_Logarithmic: + case transfer_Logarithmic: { for (i = 0; i < logImage->width * logImage->height; i++) { *(dst_ptr++) = *(src_ptr++); *(dst_ptr++) = *(src_ptr++); *(dst_ptr++) = *(src_ptr++); src_ptr++; } + return 0; + } + + case transfer_PrintingDensity: { + float *lut; - case transfer_PrintingDensity: if (elementIsSource == 1) - getLogToLinLut((float *)&lut, logImage, logElement); + lut = getLogToLinLut(logImage, logElement); else - getLinToLogLut((float *)&lut, logImage, logElement); + lut = getLinToLogLut(logImage, logElement); for (i = 0; i < logImage->width * logImage->height; i++) { *(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)]; @@ -1022,7 +1047,11 @@ static int convertRGBA_RGB(float *src, float *dst, LogImageFile *logImage, *(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)]; src_ptr++; } + + MEM_freeN(lut); + return 0; + } default: return 1; @@ -1033,27 +1062,30 @@ static int convertRGB_RGBA(float *src, float *dst, LogImageFile *logImage, LogImageElement logElement, int elementIsSource) { unsigned int i; - float lut[65536]; float *src_ptr = src; float *dst_ptr = dst; switch (logElement.transfer) { case transfer_UserDefined: case transfer_Linear: - case transfer_Logarithmic: + case transfer_Logarithmic: { for (i = 0; i < logImage->width * logImage->height; i++) { *(dst_ptr++) = *(src_ptr++); *(dst_ptr++) = *(src_ptr++); *(dst_ptr++) = *(src_ptr++); *(dst_ptr++) = 1.0f; } + return 0; + } + + case transfer_PrintingDensity: { + float *lut; - case transfer_PrintingDensity: if (elementIsSource == 1) - getLogToLinLut((float *)&lut, logImage, logElement); + lut = getLogToLinLut(logImage, logElement); else - getLinToLogLut((float *)&lut, logImage, logElement); + lut = getLinToLogLut(logImage, logElement); for (i = 0; i < logImage->width * logImage->height; i++) { *(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)]; @@ -1061,7 +1093,11 @@ static int convertRGB_RGBA(float *src, float *dst, LogImageFile *logImage, *(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)]; *(dst_ptr++) = 1.0f; } + + MEM_freeN(lut); + return 0; + } default: return 1; @@ -1072,22 +1108,24 @@ static int convertRGBA_RGBA(float *src, float *dst, LogImageFile *logImage, LogImageElement logElement, int elementIsSource) { unsigned int i; - float lut[65536]; float *src_ptr = src; float *dst_ptr = dst; switch (logElement.transfer) { case transfer_UserDefined: case transfer_Linear: - case transfer_Logarithmic: + case transfer_Logarithmic: { memcpy(dst, src, 4 * logImage->width * logImage->height * sizeof(float)); return 0; + } + + case transfer_PrintingDensity: { + float *lut; - case transfer_PrintingDensity: if (elementIsSource == 1) - getLogToLinLut((float *)&lut, logImage, logElement); + lut = getLogToLinLut(logImage, logElement); else - getLinToLogLut((float *)&lut, logImage, logElement); + lut = getLinToLogLut(logImage, logElement); for (i = 0; i < logImage->width * logImage->height; i++) { *(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)]; @@ -1095,7 +1133,11 @@ static int convertRGBA_RGBA(float *src, float *dst, LogImageFile *logImage, *(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)]; *(dst_ptr++) = *(src_ptr++); } + + MEM_freeN(lut); + return 0; + } default: return 1; @@ -1106,14 +1148,13 @@ static int convertABGR_RGBA(float *src, float *dst, LogImageFile *logImage, LogImageElement logElement, int elementIsSource) { unsigned int i; - float lut[65536]; float *src_ptr = src; float *dst_ptr = dst; switch (logElement.transfer) { case transfer_UserDefined: case transfer_Linear: - case transfer_Logarithmic: + case transfer_Logarithmic: { for (i = 0; i < logImage->width * logImage->height; i++) { src_ptr += 4; *(dst_ptr++) = *(src_ptr--); @@ -1123,12 +1164,15 @@ static int convertABGR_RGBA(float *src, float *dst, LogImageFile *logImage, src_ptr += 4; } return 0; + } + + case transfer_PrintingDensity: { + float *lut; - case transfer_PrintingDensity: if (elementIsSource == 1) - getLogToLinLut((float *)&lut, logImage, logElement); + lut = getLogToLinLut(logImage, logElement); else - getLinToLogLut((float *)&lut, logImage, logElement); + lut = getLinToLogLut(logImage, logElement); for (i = 0; i < logImage->width * logImage->height; i++) { src_ptr += 4; @@ -1138,7 +1182,11 @@ static int convertABGR_RGBA(float *src, float *dst, LogImageFile *logImage, *(dst_ptr++) = *(src_ptr--); src_ptr += 4; } + + MEM_freeN(lut); + return 0; + } default: return 1; @@ -1309,7 +1357,6 @@ static int convertLogElementToRGBA(float *src, float *dst, LogImageFile *logImag unsigned int i; float *src_ptr; float *dst_ptr; - float lut[65536]; /* Convert data in src to linear RGBA in dst */ switch (logElement.descriptor) { @@ -1357,7 +1404,7 @@ static int convertLogElementToRGBA(float *src, float *dst, LogImageFile *logImag return 1; else if (dstIsLinearRGB) { /* convert data from sRGB to Linear RGB via lut */ - getSrgbToLinLut((float *)&lut, logElement); + float *lut = getSrgbToLinLut(logElement); src_ptr = dst; // no error here dst_ptr = dst; for (i = 0; i < logImage->width * logImage->height; i++) { @@ -1366,6 +1413,7 @@ static int convertLogElementToRGBA(float *src, float *dst, LogImageFile *logImag *(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)]; dst_ptr++; src_ptr++; } + MEM_freeN(lut); } return 0; } @@ -1378,7 +1426,7 @@ static int convertRGBAToLogElement(float *src, float *dst, LogImageFile *logImag float *srgbSrc; float *srgbSrc_ptr; float *src_ptr = src; - float lut[65536]; + float *lut; if (srcIsLinearRGB != 0) { /* we need to convert src to sRGB */ @@ -1390,13 +1438,14 @@ static int convertRGBAToLogElement(float *src, float *dst, LogImageFile *logImag srgbSrc_ptr = srgbSrc; /* convert data from Linear RGB to sRGB via lut */ - getLinToSrgbLut((float *)&lut, logElement); + lut = getLinToSrgbLut(logElement); for (i = 0; i < logImage->width * logImage->height; i++) { *(srgbSrc_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)]; *(srgbSrc_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)]; *(srgbSrc_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)]; srgbSrc_ptr++; src_ptr++; } + MEM_freeN(lut); } else srgbSrc = src; @@ -1421,6 +1470,7 @@ static int convertRGBAToLogElement(float *src, float *dst, LogImageFile *logImag case descriptor_YA: /* this descriptor is for internal use only */ default: rvalue = 1; + break; } if (srcIsLinearRGB != 0) { diff --git a/source/blender/imbuf/intern/cineon/logmemfile.c b/source/blender/imbuf/intern/cineon/logmemfile.c index 3914f6dc633..e52660faf66 100644 --- a/source/blender/imbuf/intern/cineon/logmemfile.c +++ b/source/blender/imbuf/intern/cineon/logmemfile.c @@ -50,7 +50,7 @@ int logimage_fseek(LogImageFile *logFile, intptr_t offset, int origin) } else if (origin == SEEK_CUR) { uintptr_t pos = (uintptr_t)logFile->memCursor - (uintptr_t)logFile->memBuffer; - if (pos + offset > logFile->memBufferSize || pos < 0) + if (pos + offset > logFile->memBufferSize) return 1; logFile->memCursor += offset; diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 235c6a0f37e..238e68b141c 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -1094,6 +1094,7 @@ const char *IMB_colormanagement_role_colorspace_name_get(int role) default: printf("Unknown role was passed to %s\n", __func__); BLI_assert(0); + break; } return NULL; @@ -2448,11 +2449,7 @@ void IMB_colormanagement_colorspace_items_add(EnumPropertyItem **items, int *tot item.name = colorspace->name; item.identifier = colorspace->name; item.icon = 0; - - if (colorspace->description) - item.description = colorspace->description; - else - item.description = ""; + item.description = colorspace->description; RNA_enum_item_add(items, totitem, &item); } diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index c66f2d62db2..7acfe8a9dd1 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -366,8 +366,8 @@ static void get_index_dir(struct anim *anim, char *index_dir, size_t index_dir_l if (!anim->index_dir[0]) { char fname[FILE_MAXFILE]; BLI_split_dirfile(anim->name, index_dir, fname, index_dir_len, sizeof(fname)); - BLI_join_dirfile(index_dir, index_dir_len, index_dir, "BL_proxy"); - BLI_join_dirfile(index_dir, index_dir_len, index_dir, fname); + BLI_path_append(index_dir, index_dir_len, "BL_proxy"); + BLI_path_append(index_dir, index_dir_len, fname); } else { BLI_strncpy(index_dir, anim->index_dir, index_dir_len); diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index 9bb625a64b0..38caf224c42 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -61,7 +61,7 @@ /* the types are from the jpeg lib */ static void jpeg_error(j_common_ptr cinfo) #ifdef __GNUC__ -__attribute__((noreturn)); +__attribute__((noreturn)) #endif ; static void init_source(j_decompress_ptr cinfo); @@ -366,6 +366,7 @@ static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo, int fla rect[0] = r; rect += 4; } + break; } } @@ -549,7 +550,8 @@ next_stamp_info: break; /* default was missing... intentional ? */ default: - ; /* do nothing */ + /* do nothing */ + break; } jpeg_write_scanlines(cinfo, row_pointer, 1); @@ -594,7 +596,8 @@ static int init_jpeg(FILE *outfile, struct jpeg_compress_struct *cinfo, struct I break; /* default was missing... intentional ? */ default: - ; /* do nothing */ + /* do nothing */ + break; } jpeg_set_defaults(cinfo); diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 6db7cfc8efd..922c865a0d5 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -97,7 +97,8 @@ class Mem_IStream : public Imf::IStream public: Mem_IStream (unsigned char *exrbuf, size_t exrsize) : - IStream("dummy"), _exrpos(0), _exrsize(exrsize) { + IStream("dummy"), _exrpos(0), _exrsize(exrsize) + { _exrbuf = exrbuf; } diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index e07eef1868e..b620dbd9b10 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -567,6 +567,7 @@ ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags, char colorspace[I default: printf("PNG format not supported\n"); longjmp(png_jmpbuf(png_ptr), 1); + break; } ibuf = IMB_allocImBuf(width, height, 8 * bytesperpixel, 0); diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 59b78109aaf..18268043a04 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -67,35 +67,40 @@ # include <unistd.h> #endif -#define URI_MAX FILE_MAX * 3 + 8 +#define URI_MAX (FILE_MAX * 3 + 8) static int get_thumb_dir(char *dir, ThumbSize size) { + char *s = dir; + const char *subdir; #ifdef WIN32 wchar_t dir_16[MAX_PATH]; /* yes, applications shouldn't store data there, but so does GIMP :)*/ SHGetSpecialFolderPathW(0, dir_16, CSIDL_PROFILE, 0); conv_utf_16_to_8(dir_16, dir, FILE_MAX); - - + s += strlen(dir); #else const char *home = getenv("HOME"); if (!home) return 0; - BLI_strncpy(dir, home, FILE_MAX); + s += BLI_strncpy_rlen(s, home, FILE_MAX); #endif switch (size) { case THB_NORMAL: - strcat(dir, "/.thumbnails/normal/"); + subdir = "/.thumbnails/normal/"; break; case THB_LARGE: - strcat(dir, "/.thumbnails/large/"); + subdir = "/.thumbnails/large/"; break; case THB_FAIL: - strcat(dir, "/.thumbnails/fail/blender/"); + subdir = "/.thumbnails/fail/blender/"; break; default: return 0; /* unknown size */ } + + s += BLI_strncpy_rlen(s, subdir, FILE_MAX - (s - dir)); + (void)s; + return 1; } @@ -195,20 +200,20 @@ static int uri_from_filename(const char *path, char *uri) strcat(orig_uri, vol); dirstart += 2; } -#else - BLI_strncpy(orig_uri, "file://", FILE_MAX); -#endif strcat(orig_uri, dirstart); BLI_char_switch(orig_uri, '\\', '/'); +#else + BLI_snprintf(orig_uri, URI_MAX, "file://%s", dirstart); +#endif #ifdef WITH_ICONV { - char uri_utf8[FILE_MAX * 3 + 8]; - escape_uri_string(orig_uri, uri_utf8, FILE_MAX * 3 + 8, UNSAFE_PATH); + char uri_utf8[URI_MAX]; + escape_uri_string(orig_uri, uri_utf8, URI_MAX, UNSAFE_PATH); BLI_string_to_utf8(uri_utf8, uri, NULL); } #else - escape_uri_string(orig_uri, uri, FILE_MAX * 3 + 8, UNSAFE_PATH); + escape_uri_string(orig_uri, uri, URI_MAX, UNSAFE_PATH); #endif return 1; } @@ -396,7 +401,7 @@ ImBuf *IMB_thumb_create(const char *path, ThumbSize size, ThumbSource source, Im ImBuf *IMB_thumb_read(const char *path, ThumbSize size) { char thumb[FILE_MAX]; - char uri[FILE_MAX * 3 + 8]; + char uri[URI_MAX]; ImBuf *img = NULL; if (!uri_from_filename(path, uri)) { @@ -413,7 +418,7 @@ ImBuf *IMB_thumb_read(const char *path, ThumbSize size) void IMB_thumb_delete(const char *path, ThumbSize size) { char thumb[FILE_MAX]; - char uri[FILE_MAX * 3 + 8]; + char uri[URI_MAX]; if (!uri_from_filename(path, uri)) { return; @@ -433,7 +438,7 @@ void IMB_thumb_delete(const char *path, ThumbSize size) ImBuf *IMB_thumb_manage(const char *path, ThumbSize size, ThumbSource source) { char thumb[FILE_MAX]; - char uri[FILE_MAX * 3 + 8]; + char uri[URI_MAX]; struct stat st; ImBuf *img = NULL; diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 2630aebef3b..eaba04c9310 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -532,6 +532,7 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags, char colorspace[ int level; short spp; int ib_depth; + int found; /* check whether or not we have a TIFF file */ if (size < IMB_TIFF_NCB) { @@ -575,10 +576,11 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags, char colorspace[ if (spp == 4) { unsigned short extra, *extraSampleTypes; - TIFFGetField(image, TIFFTAG_EXTRASAMPLES, &extra, &extraSampleTypes); + found = TIFFGetField(image, TIFFTAG_EXTRASAMPLES, &extra, &extraSampleTypes); - if (extraSampleTypes[0] == EXTRASAMPLE_ASSOCALPHA) + if (found && (extraSampleTypes[0] == EXTRASAMPLE_ASSOCALPHA)) { ibuf->flags |= IB_alphamode_premul; + } } } diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index 234d80bf782..a4b0e61d544 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -158,9 +158,13 @@ const char *imb_ext_audio[] = { static int IMB_ispic_name(const char *name) { + /* increased from 32 to 64 because of the bitmaps header size */ +#define HEADER_SIZE 64 + + unsigned char buf[HEADER_SIZE]; ImFileType *type; struct stat st; - int fp, buf[10]; + int fp; if (UTIL_DEBUG) printf("IMB_ispic_name: loading %s\n", name); @@ -172,7 +176,8 @@ static int IMB_ispic_name(const char *name) if ((fp = BLI_open(name, O_BINARY | O_RDONLY, 0)) < 0) return FALSE; - if (read(fp, buf, 32) != 32) { + memset(buf, 0, sizeof(buf)); + if (read(fp, buf, HEADER_SIZE) <= 0) { close(fp); return FALSE; } @@ -180,14 +185,18 @@ static int IMB_ispic_name(const char *name) close(fp); /* XXX move this exception */ - if ((BIG_LONG(buf[0]) & 0xfffffff0) == 0xffd8ffe0) + if ((BIG_LONG(((int *)buf)[0]) & 0xfffffff0) == 0xffd8ffe0) return JPG; - for (type = IMB_FILE_TYPES; type->is_a; type++) - if (type->is_a((uchar *)buf)) + for (type = IMB_FILE_TYPES; type->is_a; type++) { + if (type->is_a(buf)) { return type->filetype; + } + } return FALSE; + +#undef HEADER_SIZE } int IMB_ispic(const char *filename) @@ -244,11 +253,11 @@ static void ffmpeg_log_callback(void *ptr, int level, const char *format, va_lis { if (ELEM(level, AV_LOG_FATAL, AV_LOG_ERROR)) { size_t n; - va_list arg2; - - va_copy(arg2, arg); + va_list args_cpy; - n = BLI_vsnprintf(ffmpeg_last_error, sizeof(ffmpeg_last_error), format, arg2); + va_copy(args_cpy, arg); + n = BLI_vsnprintf(ffmpeg_last_error, sizeof(ffmpeg_last_error), format, args_cpy); + va_end(args_cpy); /* strip trailing \n */ ffmpeg_last_error[n - 1] = '\0'; diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index deb9902c35d..7ff8667f90e 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -75,6 +75,7 @@ typedef struct BevList { struct BevList *next, *prev; int nr, dupe_nr; int poly, hole; + int charidx; } BevList; /* These two Lines with # tell makesdna this struct can be excluded. */ @@ -215,6 +216,10 @@ typedef struct Curve { void *lastsel; /* font part */ + /* WARNING: cu->len is... + * - strlen(cu->str) object-mode (bytes). + * - BLI_strlen_utf8(cu->str) in edit-mode. + * This should be cleaned up and some point, see 'write_curves' - campbell */ short len, lines, pos, spacemode; float spacing, linedist, shear, fsize, wordspace, ulpos, ulheight; float xof, yof; diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 4fa8ed2b34a..65e5c4e347a 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -281,16 +281,23 @@ typedef struct BevelModifierData { short val_flags; /* flags used to interpret the bevel value */ short lim_flags; /* flags to tell the tool how to limit the bevel */ short e_flags; /* flags to direct how edge weights are applied to verts */ - float bevel_angle; /* if the BME_BEVEL_ANGLE is set, this will be how "sharp" an edge must be before it gets beveled */ - char defgrp_name[64]; /* if the BME_BEVEL_VWEIGHT option is set, this will be the name of the vert group, MAX_VGROUP_NAME */ + float bevel_angle; /* if the MOD_BEVEL_ANGLE is set, this will be how "sharp" an edge must be before it gets beveled */ + char defgrp_name[64]; /* if the MOD_BEVEL_VWEIGHT option is set, this will be the name of the vert group, MAX_VGROUP_NAME */ } BevelModifierData; -typedef struct BMeshModifierData { - ModifierData modifier; - - float pad; - int type; -} BMeshModifierData; +#define MOD_BEVEL_VERT (1 << 1) +// #define MOD_BEVEL_RADIUS (1 << 2) +#define MOD_BEVEL_ANGLE (1 << 3) +#define MOD_BEVEL_WEIGHT (1 << 4) +#define MOD_BEVEL_VGROUP (1 << 5) +#define MOD_BEVEL_EMIN (1 << 7) +#define MOD_BEVEL_EMAX (1 << 8) +// #define MOD_BEVEL_RUNNING (1 << 9) +// #define MOD_BEVEL_RES (1 << 10) +// #define MOD_BEVEL_EVEN (1 << 11) /* this is a new setting not related to old (trunk bmesh bevel code) but adding +// * here because they are mixed - campbell */ +// #define MOD_BEVEL_DIST (1 << 12) /* same as above */ +#define MOD_BEVEL_OVERLAP_OK (1 << 13) /* Smoke modifier flags */ @@ -713,8 +720,7 @@ typedef struct SimpleDeformModifierData { char mode; /* deform function */ char axis; /* lock axis (for taper and strech) */ - char originOpts; /* originOptions */ - char pad; + char pad[2]; } SimpleDeformModifierData; @@ -726,12 +732,6 @@ typedef struct SimpleDeformModifierData { #define MOD_SIMPLEDEFORM_LOCK_AXIS_X (1<<0) #define MOD_SIMPLEDEFORM_LOCK_AXIS_Y (1<<1) -/* indicates whether simple deform should use the local - * coordinates or global coordinates of origin */ -/* XXX, this should have never been an option, all other modifiers work relatively - * (so moving both objects makes no change!) - Campbell */ -#define MOD_SIMPLEDEFORM_ORIGIN_LOCAL (1<<0) - #define MOD_UVPROJECT_MAX 10 typedef struct ShapeKeyModifierData { diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 780cc371865..9ff4392242e 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -878,14 +878,11 @@ typedef struct NodeShaderNormalMap { /* vector transform */ #define SHD_VECT_TRANSFORM_TYPE_VECTOR 0 #define SHD_VECT_TRANSFORM_TYPE_POINT 1 +#define SHD_VECT_TRANSFORM_TYPE_NORMAL 2 -#define SHD_VECT_TRANSFORM_FROM_WORLD 0 -#define SHD_VECT_TRANSFORM_FROM_OBJECT 1 -#define SHD_VECT_TRANSFORM_FROM_CAMERA 2 - -#define SHD_VECT_TRANSFORM_TO_WORLD 0 -#define SHD_VECT_TRANSFORM_TO_OBJECT 1 -#define SHD_VECT_TRANSFORM_TO_CAMERA 2 +#define SHD_VECT_TRANSFORM_SPACE_WORLD 0 +#define SHD_VECT_TRANSFORM_SPACE_OBJECT 1 +#define SHD_VECT_TRANSFORM_SPACE_CAMERA 2 /* toon modes */ #define SHD_TOON_DIFFUSE 0 diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index 84442201df8..29fcaf3bf73 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -473,6 +473,7 @@ typedef struct ParticleSystem { #define PART_ROT_OB_X 6 #define PART_ROT_OB_Y 7 #define PART_ROT_OB_Z 8 +#define PART_ROT_NOR_TAN 9 /* part->avemode */ #define PART_AVE_VELOCITY 1 diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 5e877ed697b..dd194ed389f 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -652,7 +652,8 @@ typedef struct GameData { short mode, matmode; short occlusionRes; /* resolution of occlusion Z buffer in pixel */ short physicsEngine; - short exitkey, pad; + short exitkey; + short vsync; /* Controls vsync: off, on, or adaptive (if supported) */ short ticrate, maxlogicstep, physubstep, maxphystep; short obstacleSimulation; short raster_storage; @@ -688,6 +689,11 @@ typedef struct GameData { #define RAS_STORE_VA 2 #define RAS_STORE_VBO 3 +/* vsync */ +#define VSYNC_OFF 0 +#define VSYNC_ON 1 +#define VSYNC_ADAPTIVE 2 + /* GameData.flag */ #define GAME_RESTRICT_ANIM_UPDATES (1 << 0) #define GAME_ENABLE_ALL_FRAMES (1 << 1) diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 499598d2df5..5436b9debfa 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -131,6 +131,7 @@ typedef struct RegionView3D { char viewlock; char viewlock_quad; /* options for quadview (store while out of quad view) */ char pad[3]; + float ofs_lock[2]; /* normalized offset for locked view: (-1, -1) bottom left, (1, 1) upper right */ short twdrawflag; short rflag; @@ -278,6 +279,8 @@ typedef struct View3D { #define V3D_RENDER_BORDER 2048 #define V3D_SOLID_MATCAP 4096 /* user flag */ #define V3D_SHOW_SOLID_MATCAP 8192 /* runtime flag */ +#define V3D_OCCLUDE_WIRE 16384 + /* View3D->around */ #define V3D_CENTER 0 diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 29c977bfe64..2665da1b435 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -965,7 +965,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file) types = MEM_callocN(sizeof(char *) * maxnr, "types"); typelens_native = MEM_callocN(sizeof(short) * maxnr, "typelens_native"); typelens_64 = MEM_callocN(sizeof(short) * maxnr, "typelens_64"); - structs = MEM_callocN(sizeof(short) * maxnr, "structs"); + structs = MEM_callocN(sizeof(short *) * maxnr, "structs"); /* insertion of all known types */ /* watch it: uint is not allowed! use in structs an unsigned int */ diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 11a4dcfab8a..af14e959c11 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -26,6 +26,11 @@ # Generated code has some unused vars we can ignore. remove_strict_flags() +if(CMAKE_COMPILER_IS_GNUCC) + # add here so we fail early. + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=implicit-function-declaration") +endif() + # message(STATUS "Configuring makesrna") # files rna_access.c rna_define.c makesrna.c intentionally excluded. diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 9686d7fab51..f382caaccba 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -177,8 +177,8 @@ static int replace_if_different(char *tmpfile, const char *dep_files[]) if (len_new != len_org) { - fclose(fp_new); - fclose(fp_org); + fclose(fp_new); fp_new = NULL; + fclose(fp_org); fp_org = NULL; REN_IF_DIFF; } @@ -191,8 +191,8 @@ static int replace_if_different(char *tmpfile, const char *dep_files[]) if (fread(arr_org, sizeof(char), len_org, fp_org) != len_org) fprintf(stderr, "%s:%d, error reading file %s for comparison.\n", __FILE__, __LINE__, orgfile); - fclose(fp_new); - fclose(fp_org); + fclose(fp_new); fp_new = NULL; + fclose(fp_org); fp_org = NULL; cmp = memcmp(arr_new, arr_org, len_new); @@ -319,15 +319,15 @@ static void rna_print_c_string(FILE *f, const char *str) static void rna_print_data_get(FILE *f, PropertyDefRNA *dp) { if (dp->dnastructfromname && dp->dnastructfromprop) - fprintf(f, " %s *data= (%s*)(((%s*)ptr->data)->%s);\n", dp->dnastructname, dp->dnastructname, + fprintf(f, " %s *data = (%s *)(((%s *)ptr->data)->%s);\n", dp->dnastructname, dp->dnastructname, dp->dnastructfromname, dp->dnastructfromprop); else - fprintf(f, " %s *data= (%s*)(ptr->data);\n", dp->dnastructname, dp->dnastructname); + fprintf(f, " %s *data = (%s *)(ptr->data);\n", dp->dnastructname, dp->dnastructname); } static void rna_print_id_get(FILE *f, PropertyDefRNA *UNUSED(dp)) { - fprintf(f, " ID *id= ptr->id.data;\n"); + fprintf(f, " ID *id = ptr->id.data;\n"); } static void rna_construct_function_name(char *buffer, int size, const char *structname, const char *propname, const char *type) @@ -647,13 +647,13 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr char *lenfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get_length"); fprintf(f, " int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n"); - fprintf(f, " int len= %s(ptr, arraylen);\n\n", lenfunc); - fprintf(f, " for (i=0; i < len; i++) {\n"); + fprintf(f, " int len = %s(ptr, arraylen);\n\n", lenfunc); + fprintf(f, " for (i = 0; i < len; i++) {\n"); MEM_freeN(lenfunc); } else { fprintf(f, " int i;\n\n"); - fprintf(f, " for (i=0; i < %u; i++) {\n", prop->totarraylength); + fprintf(f, " for (i = 0; i < %u; i++) {\n", prop->totarraylength); } if (dp->dnaarraylength == 1) { @@ -674,11 +674,11 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr fprintf(f, ") != 0);\n"); } else if (rna_color_quantize(prop, dp)) { - fprintf(f, " values[i] = (%s)(data->%s[i]*(1.0f / 255.0f));\n", + fprintf(f, " values[i] = (%s)(data->%s[i] * (1.0f / 255.0f));\n", rna_type_type(prop), dp->dnaname); } else if (dp->dnatype) { - fprintf(f, " values[i] = (%s)%s(((%s*)data->%s)[i]);\n", + fprintf(f, " values[i] = (%s)%s(((%s *)data->%s)[i]);\n", rna_type_type(prop), (dp->booleannegative) ? "!" : "", dp->dnatype, dp->dnaname); } else { @@ -897,15 +897,15 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr char *lenfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "set_length"); fprintf(f, " int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n"); - fprintf(f, " int len= %s(ptr, arraylen);\n\n", lenfunc); + fprintf(f, " int len = %s(ptr, arraylen);\n\n", lenfunc); rna_clamp_value_range(f, prop); - fprintf(f, " for (i=0; i < len; i++) {\n"); + fprintf(f, " for (i = 0; i < len; i++) {\n"); MEM_freeN(lenfunc); } else { fprintf(f, " int i;\n\n"); rna_clamp_value_range(f, prop); - fprintf(f, " for (i=0; i < %u; i++) {\n", prop->totarraylength); + fprintf(f, " for (i = 0; i < %u; i++) {\n", prop->totarraylength); } if (dp->dnaarraylength == 1) { @@ -934,7 +934,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr } else { if (dp->dnatype) - fprintf(f, " ((%s*)data->%s)[i] = %s", dp->dnatype, dp->dnaname, + fprintf(f, " ((%s *)data->%s)[i] = %s", dp->dnatype, dp->dnaname, (dp->booleannegative) ? "!" : ""); else fprintf(f, " (data->%s)[i] = %s", dp->dnaname, (dp->booleannegative) ? "!" : ""); @@ -1072,8 +1072,8 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA * rna_print_data_get(f, dp); fprintf(f, "\n memset(iter, 0, sizeof(*iter));\n"); - fprintf(f, " iter->parent= *ptr;\n"); - fprintf(f, " iter->prop= (PropertyRNA *)&rna_%s_%s;\n", srna->identifier, prop->identifier); + fprintf(f, " iter->parent = *ptr;\n"); + fprintf(f, " iter->prop = (PropertyRNA *)&rna_%s_%s;\n", srna->identifier, prop->identifier); if (dp->dnalengthname || dp->dnalengthfixed) { if (manualfunc) { @@ -1100,7 +1100,7 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA * getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get"); fprintf(f, "\n if (iter->valid)\n"); - fprintf(f, " iter->ptr= %s(iter);\n", getfunc); + fprintf(f, " iter->ptr = %s(iter);\n", getfunc); fprintf(f, "}\n\n"); @@ -1139,14 +1139,14 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property return func; } - fprintf(f, " int found= 0;\n"); + fprintf(f, " int found = 0;\n"); fprintf(f, " CollectionPropertyIterator iter;\n\n"); fprintf(f, " %s_%s_begin(&iter, ptr);\n\n", srna->identifier, rna_safe_id(prop->identifier)); fprintf(f, " if (iter.valid) {\n"); if (strcmp(nextfunc, "rna_iterator_array_next") == 0) { - fprintf(f, " ArrayIterator *internal= iter.internal;\n"); + fprintf(f, " ArrayIterator *internal = iter.internal;\n"); fprintf(f, " if (index < 0 || index >= internal->length) {\n"); fprintf(f, "#ifdef __GNUC__\n"); fprintf(f, " printf(\"Array iterator out of range: %%s (index %%d)\\n\", __func__, index);\n"); @@ -1158,25 +1158,25 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property fprintf(f, " while (index-- > 0 && iter.valid) {\n"); fprintf(f, " rna_iterator_array_next(&iter);\n"); fprintf(f, " }\n"); - fprintf(f, " found= (index == -1 && iter.valid);\n"); + fprintf(f, " found = (index == -1 && iter.valid);\n"); fprintf(f, " }\n"); fprintf(f, " else {\n"); - fprintf(f, " internal->ptr += internal->itemsize*index;\n"); - fprintf(f, " found= 1;\n"); + fprintf(f, " internal->ptr += internal->itemsize * index;\n"); + fprintf(f, " found = 1;\n"); fprintf(f, " }\n"); } else if (strcmp(nextfunc, "rna_iterator_listbase_next") == 0) { - fprintf(f, " ListBaseIterator *internal= iter.internal;\n"); + fprintf(f, " ListBaseIterator *internal = iter.internal;\n"); fprintf(f, " if (internal->skip) {\n"); fprintf(f, " while (index-- > 0 && iter.valid) {\n"); fprintf(f, " rna_iterator_listbase_next(&iter);\n"); fprintf(f, " }\n"); - fprintf(f, " found= (index == -1 && iter.valid);\n"); + fprintf(f, " found = (index == -1 && iter.valid);\n"); fprintf(f, " }\n"); fprintf(f, " else {\n"); fprintf(f, " while (index-- > 0 && internal->link)\n"); - fprintf(f, " internal->link= internal->link->next;\n"); - fprintf(f, " found= (index == -1 && internal->link);\n"); + fprintf(f, " internal->link = internal->link->next;\n"); + fprintf(f, " found = (index == -1 && internal->link);\n"); fprintf(f, " }\n"); } @@ -1256,7 +1256,7 @@ static char *rna_def_property_lookup_string_func(FILE *f, StructRNA *srna, Prope fprintf(f, " extern int %s_%s_length(PointerRNA *);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier)); fprintf(f, " extern void %s_%s_get(PointerRNA *, char *);\n\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier)); - fprintf(f, " int found= 0;\n"); + fprintf(f, " bool found = false;\n"); fprintf(f, " CollectionPropertyIterator iter;\n"); fprintf(f, " char namebuf[%d];\n", namebuflen); fprintf(f, " char *name;\n\n"); @@ -1264,26 +1264,29 @@ static char *rna_def_property_lookup_string_func(FILE *f, StructRNA *srna, Prope fprintf(f, " %s_%s_begin(&iter, ptr);\n\n", srna->identifier, rna_safe_id(prop->identifier)); fprintf(f, " while (iter.valid) {\n"); - fprintf(f, " int namelen = %s_%s_length(&iter.ptr);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier)); - fprintf(f, " if (namelen < %d) {\n", namebuflen); - fprintf(f, " %s_%s_get(&iter.ptr, namebuf);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier)); - fprintf(f, " if (strcmp(namebuf, key) == 0) {\n"); - fprintf(f, " found = 1;\n"); - fprintf(f, " *r_ptr = iter.ptr;\n"); - fprintf(f, " break;\n"); + fprintf(f, " if (iter.ptr.data) {\n"); + fprintf(f, " int namelen = %s_%s_length(&iter.ptr);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier)); + fprintf(f, " if (namelen < %d) {\n", namebuflen); + fprintf(f, " %s_%s_get(&iter.ptr, namebuf);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier)); + fprintf(f, " if (strcmp(namebuf, key) == 0) {\n"); + fprintf(f, " found = true;\n"); + fprintf(f, " *r_ptr = iter.ptr;\n"); + fprintf(f, " break;\n"); + fprintf(f, " }\n"); fprintf(f, " }\n"); - fprintf(f, " }\n"); - fprintf(f, " else {\n"); - fprintf(f, " name = MEM_mallocN(namelen+1, \"name string\");\n"); - fprintf(f, " %s_%s_get(&iter.ptr, name);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier)); - fprintf(f, " if (strcmp(name, key) == 0) {\n"); - fprintf(f, " MEM_freeN(name);\n\n"); - fprintf(f, " found = 1;\n"); - fprintf(f, " *r_ptr = iter.ptr;\n"); - fprintf(f, " break;\n"); + fprintf(f, " else {\n"); + fprintf(f, " name = MEM_mallocN(namelen+1, \"name string\");\n"); + fprintf(f, " %s_%s_get(&iter.ptr, name);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier)); + fprintf(f, " if (strcmp(name, key) == 0) {\n"); + fprintf(f, " MEM_freeN(name);\n\n"); + fprintf(f, " found = true;\n"); + fprintf(f, " *r_ptr = iter.ptr;\n"); + fprintf(f, " break;\n"); + fprintf(f, " }\n"); + fprintf(f, " else {\n"); + fprintf(f, " MEM_freeN(name);\n"); + fprintf(f, " }\n"); fprintf(f, " }\n"); - fprintf(f, " else\n"); - fprintf(f, " MEM_freeN(name);\n"); fprintf(f, " }\n"); fprintf(f, " %s_%s_next(&iter);\n", srna->identifier, rna_safe_id(prop->identifier)); fprintf(f, " }\n"); @@ -1315,7 +1318,7 @@ static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *p getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get"); fprintf(f, "\n if (iter->valid)\n"); - fprintf(f, " iter->ptr= %s(iter);\n", getfunc); + fprintf(f, " iter->ptr = %s(iter);\n", getfunc); fprintf(f, "}\n\n"); @@ -2199,7 +2202,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA else if ((type == PROP_POINTER) && (flag & PROP_RNAPTR) && !(flag & PROP_THICK_WRAP)) ptrstr = "*"; /* PROP_THICK_WRAP strings are pre-allocated on the ParameterList stack, - * but type name for string props is already char*, so leave empty */ + * but type name for string props is already (char *), so leave empty */ else if (type == PROP_STRING && (flag & PROP_THICK_WRAP)) ptrstr = ""; else @@ -2222,19 +2225,19 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA /* assign self */ if (func->flag & FUNC_USE_SELF_ID) { - fprintf(f, "\t_selfid= (struct ID*)_ptr->id.data;\n"); + fprintf(f, "\t_selfid = (struct ID *)_ptr->id.data;\n"); } if ((func->flag & FUNC_NO_SELF) == 0) { - if (dsrna->dnaname) fprintf(f, "\t_self= (struct %s *)_ptr->data;\n", dsrna->dnaname); - else fprintf(f, "\t_self= (struct %s *)_ptr->data;\n", srna->identifier); + if (dsrna->dnaname) fprintf(f, "\t_self = (struct %s *)_ptr->data;\n", dsrna->dnaname); + else fprintf(f, "\t_self = (struct %s *)_ptr->data;\n", srna->identifier); } else if (func->flag & FUNC_USE_SELF_TYPE) { - fprintf(f, "\t_type= _ptr->type;\n"); + fprintf(f, "\t_type = _ptr->type;\n"); } if (has_data) { - fprintf(f, "\t_data= (char *)_parms->data;\n"); + fprintf(f, "\t_data = (char *)_parms->data;\n"); } dparm = dfunc->cont.properties.first; @@ -2245,7 +2248,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA cptr = ((type == PROP_POINTER) && !(flag & PROP_RNAPTR)); if (dparm->prop == func->c_ret) - fprintf(f, "\t_retdata= _data;\n"); + fprintf(f, "\t_retdata = _data;\n"); else { const char *data_str; if (cptr || (flag & PROP_DYNAMIC)) { @@ -2272,7 +2275,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA /* this must be kept in sync with RNA_parameter_length_get_data, * we could just call the function directly, but this is faster */ if (flag & PROP_DYNAMIC) { - fprintf(f, "\t%s_len= %s((int *)_data);\n", dparm->prop->identifier, pout ? "" : "*"); + fprintf(f, "\t%s_len = %s((int *)_data);\n", dparm->prop->identifier, pout ? "" : "*"); data_str = "(&(((char *)_data)[sizeof(void *)]))"; } else { @@ -2283,7 +2286,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA if (!pout) fprintf(f, "%s", valstr); - fprintf(f, "((%s%s%s)%s);\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), + fprintf(f, "((%s%s %s)%s);\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, data_str); } @@ -2353,7 +2356,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA dparm = rna_find_parameter_def(func->c_ret); ptrstr = (((dparm->prop->type == PROP_POINTER) && !(dparm->prop->flag & PROP_RNAPTR)) || (dparm->prop->arraydimension)) ? "*" : ""; - fprintf(f, "\t*((%s%s%s*)_retdata) = %s;\n", rna_type_struct(dparm->prop), + fprintf(f, "\t*((%s%s %s*)_retdata) = %s;\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, func->c_ret->identifier); } } @@ -2912,9 +2915,9 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr fprintf(f, ", %d, ", prop->flag); rna_print_c_string(f, prop->name); fprintf(f, ",\n\t"); rna_print_c_string(f, prop->description); fprintf(f, ",\n\t"); - fprintf(f, "%d,\n", prop->icon); - rna_print_c_string(f, prop->translation_context); fprintf(f, ",\n\t"); - fprintf(f, "\t%s, %s|%s, %s, %u, {%u, %u, %u}, %u,\n", + fprintf(f, "%d, ", prop->icon); + rna_print_c_string(f, prop->translation_context); fprintf(f, ",\n"); + fprintf(f, "\t%s, %s | %s, %s, %u, {%u, %u, %u}, %u,\n", RNA_property_typename(prop->type), rna_property_subtypename(prop->subtype), rna_property_subtype_unit(prop->subtype), @@ -3152,14 +3155,14 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE else fprintf(f, "NULL}},\n"); fprintf(f, "\t"); rna_print_c_string(f, srna->identifier); - fprintf(f, "\t, NULL,NULL\n"); /* PyType - Cant initialize here */ + fprintf(f, ", NULL, NULL"); /* PyType - Cant initialize here */ fprintf(f, ", %d, ", srna->flag); rna_print_c_string(f, srna->name); - fprintf(f, ", "); + fprintf(f, ",\n\t"); rna_print_c_string(f, srna->description); - fprintf(f, ", "); + fprintf(f, ",\n\t"); rna_print_c_string(f, srna->translation_context); - fprintf(f, ",\n\t%d,\n", srna->icon); + fprintf(f, ", %d,\n", srna->icon); prop = srna->nameproperty; if (prop) { @@ -3389,7 +3392,7 @@ static void rna_generate_header(BlenderRNA *UNUSED(brna), FILE *f) fprintf(f, " CollectionPropertyIterator rna_macro_iter; \\\n"); fprintf(f, " for (property##_begin(&rna_macro_iter, sptr); rna_macro_iter.valid; " "property##_next(&rna_macro_iter)) { \\\n"); - fprintf(f, " itemptr= rna_macro_iter.ptr;\n\n"); + fprintf(f, " itemptr = rna_macro_iter.ptr;\n\n"); fprintf(f, "#define FOREACH_END(property) \\\n"); fprintf(f, " } \\\n"); @@ -3492,7 +3495,7 @@ static const char *cpp_classes = "" "\n" "#define STRING_PROPERTY(sname, identifier) \\\n" " inline std::string sname::identifier(void) { \\\n" -" int len= sname##_##identifier##_length(&ptr); \\\n" +" int len = sname##_##identifier##_length(&ptr); \\\n" " std::string str; str.resize(len); \\\n" " sname##_##identifier##_get(&ptr, &str[0]); return str; } \\\n" " inline void sname::identifier(const std::string& value) { \\\n" @@ -3601,7 +3604,7 @@ static const char *cpp_classes = "" "\n" " Array() {}\n" " Array(const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T) * Tsize); }\n" -" const Array<T, Tsize>& operator=(const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T) * Tsize); " +" const Array<T, Tsize>& operator = (const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T) * Tsize); " "return *this; }\n" "\n" " operator T*() { return data; }\n" @@ -3616,7 +3619,7 @@ static const char *cpp_classes = "" " DynamicArray() : data(NULL), length(0) {}\n" " DynamicArray(int new_length) : data(NULL), length(new_length) { data = (float *)malloc(sizeof(T) * new_length); }\n" " DynamicArray(const DynamicArray<T>& other) { copy_from(other); }\n" -" const DynamicArray<T>& operator=(const DynamicArray<T>& other) { copy_from(other); return *this; }\n" +" const DynamicArray<T>& operator = (const DynamicArray<T>& other) { copy_from(other); return *this; }\n" "\n" " ~DynamicArray() { if (data) free(data); }\n" "\n" @@ -3641,7 +3644,7 @@ static const char *cpp_classes = "" "template<typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend>\n" "class CollectionIterator {\n" "public:\n" -" CollectionIterator() : t(iter.ptr), init(false) { iter.valid= false; }\n" +" CollectionIterator() : t(iter.ptr), init(false) { iter.valid = false; }\n" " ~CollectionIterator(void) { if (init) Tend(&iter); };\n" "\n" " operator bool(void)\n" @@ -3650,7 +3653,7 @@ static const char *cpp_classes = "" "\n" " T& operator*(void) { return t; }\n" " T* operator->(void) { return &t; }\n" -" bool operator==(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) " +" bool operator == (const CollectionIterator<T, Tbegin, Tnext, Tend>& other) " "{ return iter.valid == other.iter.valid; }\n" " bool operator!=(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) " "{ return iter.valid != other.iter.valid; }\n" @@ -3659,7 +3662,7 @@ static const char *cpp_classes = "" " { if (init) Tend(&iter); Tbegin(&iter, (PointerRNA *)&ptr.ptr); t = T(iter.ptr); init = true; }\n" "\n" "private:\n" -" const CollectionIterator<T, Tbegin, Tnext, Tend>& operator=" +" const CollectionIterator<T, Tbegin, Tnext, Tend>& operator = " "(const CollectionIterator<T, Tbegin, Tnext, Tend>& copy) {}\n" "" " CollectionPropertyIterator iter;\n" diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index f67561954be..7e2d8e8eb62 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -6385,6 +6385,16 @@ bool RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop, bool i return equals; } + case PROP_POINTER: + { + if (!STREQ(RNA_property_identifier(prop), "rna_type")) { + PointerRNA propptr_a = RNA_property_pointer_get(a, prop); + PointerRNA propptr_b = RNA_property_pointer_get(b, prop); + return RNA_struct_equals(&propptr_a, &propptr_b, is_strict); + } + break; + } + default: break; } diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index b222dd9148b..a832a8cdf96 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -398,16 +398,7 @@ static void rna_EditBone_parent_set(PointerRNA *ptr, PointerRNA value) static void rna_EditBone_matrix_get(PointerRNA *ptr, float *values) { EditBone *ebone = (EditBone *)(ptr->data); - - float delta[3], tmat[3][3], mat[4][4]; - - /* Find the current bone matrix */ - sub_v3_v3v3(delta, ebone->tail, ebone->head); - vec_roll_to_mat3(delta, ebone->roll, tmat); - copy_m4_m3(mat, tmat); - copy_v3_v3(mat[3], ebone->head); - - memcpy(values, mat, 16 * sizeof(float)); + ED_armature_ebone_to_mat4(ebone, (float(*)[4])values); } static void rna_Armature_editbone_transform_update(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -472,6 +463,12 @@ static void rna_Armature_bones_next(CollectionPropertyIterator *iter) iter->valid = (internal->link != NULL); } +static int rna_Armature_is_editmode_get(PointerRNA *ptr) +{ + bArmature *arm = (bArmature *)ptr->id.data; + return (arm->edbo != NULL); +} + #else static int rna_matrix_dimsize_4x4[] = {4, 4}; @@ -1071,6 +1068,12 @@ static void rna_def_armature(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); /* XXX deprecated ....... old animviz for armatures only */ + + + prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_Armature_is_editmode_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode"); } void RNA_def_armature(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 46420b38224..ebd06475c79 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -252,9 +252,8 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr) RNA_pointer_create(id, &RNA_ColorRamp, ma->ramp_spec, &ramp_ptr); COLRAMP_GETPATH; } + break; } - break; - case ID_NT: { bNodeTree *ntree = (bNodeTree *)id; @@ -266,9 +265,8 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr) COLRAMP_GETPATH; } } + break; } - break; - case ID_LS: { ListBase listbase; @@ -290,6 +288,7 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr) if (RNA_path_resolve(&ramp_ptr, "color_ramp", &ramp_ptr, &prop)) { COLRAMP_GETPATH; } + break; } } } @@ -312,8 +311,8 @@ static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA * DAG_id_tag_update(&ma->id, 0); WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, ma); + break; } - break; case ID_NT: { bNodeTree *ntree = (bNodeTree *)id; @@ -324,16 +323,16 @@ static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA * ED_node_tag_update_nodetree(bmain, ntree); } } + break; } - break; case ID_TE: { Tex *tex = ptr->id.data; DAG_id_tag_update(&tex->id, 0); WM_main_add_notifier(NC_TEXTURE, tex); + break; } - break; case ID_LS: { FreestyleLineStyle *linestyle = ptr->id.data; diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index c9734545245..21bf2ec6719 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -683,6 +683,18 @@ static void rna_Curve_splines_begin(CollectionPropertyIterator *iter, PointerRNA rna_iterator_listbase_begin(iter, BKE_curve_nurbs_get(cu), NULL); } +static int rna_Curve_is_editmode_get(PointerRNA *ptr) +{ + Curve *cu = (Curve *)ptr->id.data; + const short type = BKE_curve_type_get(cu); + if (type == OB_FONT) { + return (cu->editfont != NULL); + } + else { + return (cu->editnurb != NULL); + } +} + #else static void rna_def_bpoint(BlenderRNA *brna) @@ -1485,6 +1497,11 @@ static void rna_def_curve(BlenderRNA *brna) RNA_def_property_range(prop, 0, 1.0); RNA_def_property_ui_text(prop, "End Bevel Factor", "Factor that defines to where beveling of spline happens (0=to the very beginning, 1=to the very end)"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); + + prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_Curve_is_editmode_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode"); } static void rna_def_curve_nurb(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 900ae5122ef..fb16dd0c5a1 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -107,7 +107,7 @@ static void rna_DynamicPaintSurfaces_updateFrames(Main *bmain, Scene *scene, Poi static void rna_DynamicPaintSurface_reset(Main *bmain, Scene *scene, PointerRNA *ptr) { - dynamicPaint_resetSurface((DynamicPaintSurface *)ptr->data); + dynamicPaint_resetSurface(scene, (DynamicPaintSurface *)ptr->data); rna_DynamicPaint_redoModifier(bmain, scene, ptr); } @@ -116,7 +116,7 @@ static void rna_DynamicPaintSurface_initialcolortype(Main *bmain, Scene *scene, DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data; surface->init_layername[0] = '\0'; - dynamicPaint_clearSurface(surface); + dynamicPaint_clearSurface(scene, surface); rna_DynamicPaint_redoModifier(bmain, scene, ptr); } @@ -143,7 +143,7 @@ static void rna_DynamicPaintSurface_uniqueName(Main *bmain, Scene *scene, Pointe static void rna_DynamicPaintSurface_changeType(Main *bmain, Scene *scene, PointerRNA *ptr) { dynamicPaintSurface_updateType((DynamicPaintSurface *)ptr->data); - dynamicPaint_resetSurface((DynamicPaintSurface *)ptr->data); + dynamicPaint_resetSurface(scene, (DynamicPaintSurface *)ptr->data); rna_DynamicPaintSurface_reset(bmain, scene, ptr); } diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 9181ab13aa7..210e0fef28f 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -158,10 +158,12 @@ static char *rna_ImageUser_path(PointerRNA *ptr) /* ImageUser *iuser = ptr->data; */ switch (GS(((ID *)ptr->id.data)->name)) { - case ID_TE: { + case ID_TE: + { return BLI_strdup("image_user"); } - case ID_NT: { + case ID_NT: + { return rna_Node_ImageUser_path(ptr); } } diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index e7b12206871..3bb00716302 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -234,6 +234,11 @@ static char *rna_LatticePoint_path(PointerRNA *ptr) return BLI_strdup(""); } +static int rna_Lattice_is_editmode_get(PointerRNA *ptr) +{ + Lattice *lt = (Lattice *)ptr->id.data; + return (lt->editlatt != NULL); +} #else @@ -350,6 +355,11 @@ static void rna_def_lattice(BlenderRNA *brna) "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL); RNA_def_property_ui_text(prop, "Points", "Points of the lattice"); + prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_Lattice_is_editmode_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode"); + /* pointers */ rna_def_animdata_common(srna); } diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 4c652770e3f..fd931262904 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -335,6 +335,8 @@ Mesh *rna_Main_meshes_new_from_object( return NULL; } + BKE_mesh_texspace_copy_from_object(tmpmesh, ob); + BKE_libblock_free_us(&bmain->object, tmpobj); break; } @@ -362,6 +364,8 @@ Mesh *rna_Main_meshes_new_from_object( else BKE_mesh_from_metaball(&ob->disp, tmpmesh); + BKE_mesh_texspace_copy_from_object(tmpmesh, ob); + break; } diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 85a669adcc0..35d8a0fb433 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -37,7 +37,6 @@ #include "DNA_meshdata_types.h" #include "DNA_object_types.h" -#include "BLI_array.h" #include "BLI_math_base.h" #include "BLI_math_rotation.h" #include "BLI_utildefines.h" @@ -972,7 +971,7 @@ static int rna_Mesh_polygon_string_layers_length(PointerRNA *ptr) } /* Skin vertices */ -DEFINE_CUSTOMDATA_LAYER_COLLECTION(skin_vertice, vdata, CD_MVERT_SKIN); +DEFINE_CUSTOMDATA_LAYER_COLLECTION(skin_vertice, vdata, CD_MVERT_SKIN) static char *rna_MeshSkinVertexLayer_path(PointerRNA *ptr) { @@ -1556,6 +1555,13 @@ static PointerRNA rna_Mesh_tessface_uv_texture_new(struct Mesh *me, ReportList * return ptr; } + +static int rna_Mesh_is_editmode_get(PointerRNA *ptr) +{ + Mesh *me = rna_mesh(ptr); + return (me->edit_btmesh != NULL); +} + /* only to quiet warnings */ static void UNUSED_FUNCTION(rna_mesh_unused)(void) { @@ -2367,14 +2373,14 @@ void rna_def_texmat_common(StructRNA *srna, const char *texspace_editable) RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location"); RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_loc_get", NULL, NULL); RNA_def_property_editable_func(prop, texspace_editable); - RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); + RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "size"); RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size"); RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_size_get", NULL, NULL); RNA_def_property_editable_func(prop, texspace_editable); - RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); + RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); /* not supported yet */ #if 0 @@ -2382,7 +2388,7 @@ void rna_def_texmat_common(StructRNA *srna, const char *texspace_editable) RNA_def_property_float(prop, NULL, "rot"); RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation"); RNA_def_property_editable_func(prop, texspace_editable); - RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); + RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); #endif /* materials */ @@ -3211,6 +3217,11 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Selected Face Total", "Selected face count in editmode"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_Mesh_is_editmode_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode"); + /* pointers */ rna_def_animdata_common(srna); rna_def_texmat_common(srna, "rna_Mesh_texspace_editable"); diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c index f38151fd721..898825820ac 100644 --- a/source/blender/makesrna/intern/rna_meta.c +++ b/source/blender/makesrna/intern/rna_meta.c @@ -158,6 +158,12 @@ static void rna_MetaBall_elements_clear(MetaBall *mb) } } +static int rna_Meta_is_editmode_get(PointerRNA *ptr) +{ + MetaBall *mb = ptr->id.data; + return (mb->editelems != NULL); +} + #else static void rna_def_metaelement(BlenderRNA *brna) @@ -350,6 +356,11 @@ static void rna_def_metaball(BlenderRNA *brna) RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */ RNA_def_property_collection_funcs(prop, 0, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int"); + prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_Meta_is_editmode_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode"); + /* anim */ rna_def_animdata_common(srna); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index ed85312948d..cd6067fb7e8 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -43,7 +43,6 @@ #include "BLF_translation.h" #include "BKE_animsys.h" -#include "BKE_bmesh.h" /* For BevelModifierData */ #include "BKE_dynamicpaint.h" #include "BKE_multires.h" #include "BKE_smoke.h" /* For smokeModifier_free & smokeModifier_createType */ @@ -2300,10 +2299,10 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) static EnumPropertyItem prop_limit_method_items[] = { {0, "NONE", 0, "None", "Bevel the entire mesh by a constant amount"}, - {BME_BEVEL_ANGLE, "ANGLE", 0, "Angle", "Only bevel edges with sharp enough angles between faces"}, - {BME_BEVEL_WEIGHT, "WEIGHT", 0, "Weight", + {MOD_BEVEL_ANGLE, "ANGLE", 0, "Angle", "Only bevel edges with sharp enough angles between faces"}, + {MOD_BEVEL_WEIGHT, "WEIGHT", 0, "Weight", "Use bevel weights to determine how much bevel is applied in edge mode"}, - {BME_BEVEL_VGROUP, "VGROUP", 0, "Vertex Group", + {MOD_BEVEL_VGROUP, "VGROUP", 0, "Vertex Group", "Use vertex group weights to determine how much bevel is applied in vertex mode"}, {0, NULL, 0, NULL, NULL} }; @@ -2311,8 +2310,8 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) /* TO BE DEPRECATED */ static EnumPropertyItem prop_edge_weight_method_items[] = { {0, "AVERAGE", 0, "Average", ""}, - {BME_BEVEL_EMIN, "SHARPEST", 0, "Sharpest", ""}, - {BME_BEVEL_EMAX, "LARGEST", 0, "Largest", ""}, + {MOD_BEVEL_EMIN, "SHARPEST", 0, "Sharpest", ""}, + {MOD_BEVEL_EMAX, "LARGEST", 0, "Largest", ""}, {0, NULL, 0, NULL, NULL} }; @@ -2335,7 +2334,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "use_only_vertices", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_VERT); + RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_BEVEL_VERT); RNA_def_property_ui_text(prop, "Only Vertices", "Bevel verts/corners, not edges"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); @@ -2352,22 +2351,14 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Edge Weight Method", "What edge weight to use for weighting a vertex"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); -#if 1 /* expose as radians */ prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_funcs(prop, "rna_BevelModifier_angle_limit_get", "rna_BevelModifier_angle_limit_set", NULL); RNA_def_property_range(prop, 0, DEG2RAD(180)); RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 100, 2); -#else - prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "bevel_angle"); - RNA_def_property_range(prop, 0, 180); - RNA_def_property_ui_range(prop, 0, 180, 100, 2); -#endif RNA_def_property_ui_text(prop, "Angle", "Angle above which to bevel edges"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); -#ifdef USE_BM_BEVEL_OP_AS_MOD prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "defgrp_name"); RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name"); @@ -2375,11 +2366,9 @@ static void rna_def_modifier_bevel(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop = RNA_def_property(srna, "use_clamp_overlap", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", BME_BEVEL_OVERLAP_OK); + RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", MOD_BEVEL_OVERLAP_OK); RNA_def_property_ui_text(prop, "Clamp Overlap", "Clamp the width to avoid overlap"); RNA_def_property_update(prop, 0, "rna_Modifier_update"); -#endif - } static void rna_def_modifier_shrinkwrap(BlenderRNA *brna) @@ -2592,11 +2581,6 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update"); - prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "originOpts", MOD_SIMPLEDEFORM_ORIGIN_LOCAL); - RNA_def_property_ui_text(prop, "Relative", "Set the origin of deform space to be relative to the object"); - RNA_def_property_update(prop, 0, "rna_Modifier_update"); - prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE); RNA_def_property_range(prop, -FLT_MAX, FLT_MAX); RNA_def_property_ui_range(prop, -10, 10, 1, 3); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index df53e62692c..535c279c02f 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -3514,20 +3514,14 @@ static void def_sh_vect_transform(StructRNA *srna) static EnumPropertyItem prop_vect_type_items[] = { {SHD_VECT_TRANSFORM_TYPE_VECTOR, "VECTOR", 0, "Vector", ""}, {SHD_VECT_TRANSFORM_TYPE_POINT, "POINT", 0, "Point", ""}, + {SHD_VECT_TRANSFORM_TYPE_NORMAL, "NORMAL", 0, "Normal", ""}, {0, NULL, 0, NULL, NULL} }; - static EnumPropertyItem prop_vect_from_items[] = { - {SHD_VECT_TRANSFORM_FROM_WORLD, "WORLD", 0, "World", ""}, - {SHD_VECT_TRANSFORM_FROM_OBJECT, "OBJECT", 0, "Object", ""}, - {SHD_VECT_TRANSFORM_FROM_CAMERA, "CAMERA", 0, "Camera", ""}, - {0, NULL, 0, NULL, NULL} - }; - - static EnumPropertyItem prop_vect_to_items[] = { - {SHD_VECT_TRANSFORM_TO_WORLD, "WORLD", 0, "World", ""}, - {SHD_VECT_TRANSFORM_TO_OBJECT, "OBJECT", 0, "Object", ""}, - {SHD_VECT_TRANSFORM_TO_CAMERA, "CAMERA", 0, "Camera", ""}, + static EnumPropertyItem prop_vect_space_items[] = { + {SHD_VECT_TRANSFORM_SPACE_WORLD, "WORLD", 0, "World", ""}, + {SHD_VECT_TRANSFORM_SPACE_OBJECT, "OBJECT", 0, "Object", ""}, + {SHD_VECT_TRANSFORM_SPACE_CAMERA, "CAMERA", 0, "Camera", ""}, {0, NULL, 0, NULL, NULL} }; @@ -3541,12 +3535,12 @@ static void def_sh_vect_transform(StructRNA *srna) RNA_def_property_update(prop, 0, "rna_Node_update"); prop = RNA_def_property(srna, "convert_from", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_vect_from_items); + RNA_def_property_enum_items(prop, prop_vect_space_items); RNA_def_property_ui_text(prop, "Convert From", "Space to convert from"); RNA_def_property_update(prop, 0, "rna_Node_update"); prop = RNA_def_property(srna, "convert_to", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_items(prop, prop_vect_to_items); + RNA_def_property_enum_items(prop, prop_vect_space_items); RNA_def_property_ui_text(prop, "Convert To", "Space to convert to"); RNA_def_property_update(prop, 0, "rna_Node_update"); } @@ -4074,7 +4068,7 @@ static void def_cmp_render_layers(StructRNA *srna) RNA_def_property_pointer_sdna(prop, NULL, "id"); RNA_def_property_pointer_funcs(prop, NULL, "rna_Node_scene_set", NULL, NULL); RNA_def_property_struct_type(prop, "Scene"); - RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK); + RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Scene", ""); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); @@ -5190,6 +5184,11 @@ static void def_cmp_zcombine(StructRNA *srna) RNA_def_property_boolean_sdna(prop, NULL, "custom1", 0); RNA_def_property_ui_text(prop, "Use Alpha", "Take Alpha channel into account when doing the Z operation"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "use_antialias_z", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", 0); + RNA_def_property_ui_text(prop, "Anti-Alias Z", "Anti-alias the z-buffer to try to avoid artifacts, mostly useful for Blender renders"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } static void def_cmp_ycc(StructRNA *srna) diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 3a5869c8300..e71d1d22c4b 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -44,7 +44,7 @@ #include "BKE_paint.h" #include "BKE_editmesh.h" #include "BKE_group.h" /* needed for BKE_group_object_exists() */ - +#include "BKE_object.h" /* Needed for BKE_object_matrix_local_get() */ #include "RNA_access.h" #include "RNA_define.h" #include "RNA_enum_types.h" @@ -216,15 +216,7 @@ static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA static void rna_Object_matrix_local_get(PointerRNA *ptr, float values[16]) { Object *ob = ptr->id.data; - - if (ob->parent) { - float invmat[4][4]; /* for inverse of parent's matrix */ - invert_m4_m4(invmat, ob->parent->obmat); - mul_m4_m4m4((float(*)[4])values, invmat, ob->obmat); - } - else { - copy_m4_m4((float(*)[4])values, ob->obmat); - } + BKE_object_matrix_local_get(ob, (float(*)[4])values); } static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16]) @@ -274,7 +266,7 @@ static void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA switch (ob->type) { case OB_MESH: EDBM_mesh_load(ob); - EDBM_mesh_make(scene->toolsettings, scene, ob); + EDBM_mesh_make(scene->toolsettings, ob); EDBM_mesh_normals_update(((Mesh *)ob->data)->edit_btmesh); BKE_editmesh_tessface_calc(((Mesh *)ob->data)->edit_btmesh); break; @@ -460,17 +452,20 @@ static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), Point if (ob->parent) { Object *par = ob->parent; - if (par->type == OB_CURVE) + if (par->type == OB_CURVE) { RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARCURVE); - else if (par->type == OB_LATTICE) + } + else if (par->type == OB_LATTICE) { /* special hack: prevents this overriding others */ RNA_enum_items_add_value(&item, &totitem, &parent_type_items[4], PARSKEL); + } else if (par->type == OB_ARMATURE) { /* special hack: prevents this being overrided */ RNA_enum_items_add_value(&item, &totitem, &parent_type_items[3], PARSKEL); RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARBONE); } - else if (par->type == OB_MESH) { + + if (ELEM4(par->type, OB_MESH, OB_CURVE, OB_SURF, OB_LATTICE)) { RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARVERT1); RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARVERT3); } @@ -988,8 +983,8 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value) case OB_BODY_TYPE_CHARACTER: ob->gameflag |= OB_COLLISION | OB_GHOST | OB_CHARACTER; ob->gameflag &= ~(OB_SENSOR | OB_OCCLUDER | OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_ACTOR | - OB_ANISOTROPIC_FRICTION | OB_DO_FH | OB_ROT_FH | OB_COLLISION_RESPONSE | OB_NAVMESH); - break; + OB_ANISOTROPIC_FRICTION | OB_DO_FH | OB_ROT_FH | OB_COLLISION_RESPONSE | OB_NAVMESH); + break; case OB_BODY_TYPE_STATIC: ob->gameflag |= OB_COLLISION; ob->gameflag &= ~(OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_OCCLUDER | OB_CHARACTER | OB_SENSOR | OB_NAVMESH); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index f120a0cab4a..b966a7d7f2c 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -1887,6 +1887,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) static EnumPropertyItem rot_mode_items[] = { {0, "NONE", 0, "None", ""}, {PART_ROT_NOR, "NOR", 0, "Normal", ""}, + {PART_ROT_NOR_TAN, "NOR_TAN", 0, "Normal-Tangent", ""}, {PART_ROT_VEL, "VEL", 0, "Velocity / Hair", ""}, {PART_ROT_GLOB_X, "GLOB_X", 0, "Global X", ""}, {PART_ROT_GLOB_Y, "GLOB_Y", 0, "Global Y", ""}, diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 90c0282545c..64b4e019c27 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -456,6 +456,10 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_EXCLUDE_LAYERS); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + prop = RNA_def_property(srna, "bl_use_save_buffers", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SAVE_BUFFERS); + RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + RNA_define_verify_sdna(1); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index d46b1a28439..a0e1e29ab55 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -525,6 +525,13 @@ static void rna_Scene_frame_current_set(PointerRNA *ptr, int value) data->r.cfra = value; } +static float rna_Scene_frame_current_final_get(PointerRNA *ptr) +{ + Scene *scene = (Scene *)ptr->data; + + return BKE_scene_frame_get_from_ctime(scene, (float)scene->r.cfra); +} + static void rna_Scene_start_frame_set(PointerRNA *ptr, int value) { Scene *data = (Scene *)ptr->data; @@ -1772,6 +1779,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "use_mesh_automerge", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "automerge", 0); RNA_def_property_ui_text(prop, "AutoMerge Editing", "Automatically merge vertices moved to the same location"); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ prop = RNA_def_property(srna, "use_snap", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP); @@ -3118,6 +3126,13 @@ static void rna_def_scene_game_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; + static EnumPropertyItem vsync_items[] = { + {VSYNC_OFF, "OFF", 0, "Off", "Disables vsync"}, + {VSYNC_ON, "ON", 0, "On", "Enables vsync"}, + {VSYNC_ADAPTIVE, "ADAPTIVE", 0, "Adaptive", "Enables adaptive vsync (if supported)"}, + {0, NULL, 0, NULL, NULL} + }; + static EnumPropertyItem storage_items[] = { {RAS_STORE_AUTO, "AUTO", 0, "Auto Select", "Chooses the best supported mode"}, {RAS_STORE_IMMEDIATE, "IMMEDIATE", 0, "Immediate Mode", "Slowest performance, requires OpenGL (any version)"}, @@ -3144,6 +3159,11 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_range(prop, 4, 10000); RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the screen"); RNA_def_property_update(prop, NC_SCENE, NULL); + + prop = RNA_def_property(srna, "vsync", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "vsync"); + RNA_def_property_enum_items(prop, vsync_items); + RNA_def_property_ui_text(prop, "Vsync", "Change vsync settings"); prop = RNA_def_property(srna, "samples", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "aasamples"); @@ -5148,6 +5168,13 @@ void RNA_def_scene(BlenderRNA *brna) "Number of frames to skip forward while rendering/playing back each frame"); RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL); + prop = RNA_def_property(srna, "frame_current_final", PROP_FLOAT, PROP_TIME); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); + RNA_def_property_range(prop, MINAFRAME, MAXFRAME); + RNA_def_property_float_funcs(prop, "rna_Scene_frame_current_final_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Current Frame Final", + "Current frame with subframe and time remapping applied"); + /* Preview Range (frame-range for UI playback) */ prop = RNA_def_property(srna, "use_preview_range", PROP_BOOLEAN, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 38ada7bf74f..f7a0d865274 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1249,6 +1249,12 @@ void rna_SpaceNodeEditor_path_pop(SpaceNode *snode, bContext *C) ED_node_tree_update(C); } +static void rna_SpaceNodeEditor_show_backdrop_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) +{ + WM_main_add_notifier(NC_NODE | NA_EDITED, NULL); + WM_main_add_notifier(NC_SCENE | ND_NODES, NULL); +} + static void rna_SpaceClipEditor_clip_set(PointerRNA *ptr, PointerRNA value) { SpaceClip *sc = (SpaceClip *)(ptr->data); @@ -1915,6 +1921,11 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Backface Culling", "Use back face culling to hide the back side of faces"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + prop = RNA_def_property(srna, "show_occlude_wire", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_OCCLUDE_WIRE); + RNA_def_property_ui_text(prop, "Hidden Wire", "Use hidden wireframe display"); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); + prop = RNA_def_property(srna, "lock_camera", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_LOCK_CAMERA); RNA_def_property_ui_text(prop, "Lock Camera to View", "Enable view navigation within the camera view"); @@ -3369,7 +3380,7 @@ static void rna_def_space_node(BlenderRNA *brna) prop = RNA_def_property(srna, "show_backdrop", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_BACKDRAW); RNA_def_property_ui_text(prop, "Backdrop", "Use active Viewer Node output as backdrop for compositing nodes"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, "rna_SpaceNodeEditor_show_backdrop_update"); prop = RNA_def_property(srna, "show_grease_pencil", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_SHOW_GPENCIL); diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c index 10ac5a9548a..132faacbaac 100644 --- a/source/blender/makesrna/intern/rna_texture_api.c +++ b/source/blender/makesrna/intern/rna_texture_api.c @@ -72,7 +72,9 @@ static void clear_envmap(struct EnvMap *env, bContext *C) static void texture_evaluate(struct Tex *tex, float value[3], float color_r[4]) { TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL}; - multitex_ext(tex, value, NULL, NULL, 1, &texres, NULL); + + /* TODO(sergey): always use color management now. */ + multitex_ext(tex, value, NULL, NULL, 1, &texres, NULL, true); color_r[0] = texres.tr; color_r[1] = texres.tg; diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 24eab621f5e..0d1c684e6a1 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -770,10 +770,8 @@ static PointerRNA rna_WindowManager_active_keyconfig_get(PointerRNA *ptr) wmWindowManager *wm = ptr->data; wmKeyConfig *kc; - for (kc = wm->keyconfigs.first; kc; kc = kc->next) - if (strcmp(kc->idname, U.keyconfigstr) == 0) - break; - + kc = BLI_findstring(&wm->keyconfigs, U.keyconfigstr, offsetof(wmKeyConfig, idname)); + if (!kc) kc = wm->defaultconf; diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 5805bcefdb4..c822378e76e 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -333,17 +333,23 @@ void RNA_api_wm(StructRNA *srna) /* Progress bar interface */ func = RNA_def_function(srna, "progress_begin", "rna_progress_begin"); + RNA_def_function_ui_description(func, "Start Progress bar"); + parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_NONE); + RNA_def_property_ui_text(parm, "min", "any value in range [0,9999]"); RNA_def_property_flag(parm, PROP_REQUIRED); + parm = RNA_def_property(func, "max", PROP_FLOAT, PROP_NONE); RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_ui_text(parm, "max", "any value in range [min+1,9998]"); func = RNA_def_function(srna, "progress_update", "rna_progress_update"); parm = RNA_def_property(func, "value", PROP_FLOAT, PROP_NONE); RNA_def_property_flag(parm, PROP_REQUIRED); - RNA_def_property_ui_text(parm, "value", "any value between min and max as set in progress_init()"); + RNA_def_property_ui_text(parm, "value", "any value between min and max as set in progress_begin()"); func = RNA_def_function(srna, "progress_end", "rna_progress_end"); + RNA_def_function_ui_description(func, "Terminate Progress bar"); /* invoke functions, for use with python */ func = RNA_def_function(srna, "invoke_props_popup", "rna_Operator_props_popup"); diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 3713cb817f5..b48f434abe9 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -42,7 +42,6 @@ #include "BKE_deform.h" #include "BKE_modifier.h" #include "BKE_mesh.h" -#include "BKE_bmesh.h" /* only for defines */ #include "MOD_util.h" @@ -91,8 +90,6 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) return dataMask; } -#ifdef USE_BM_BEVEL_OP_AS_MOD - /* * This calls the new bevel code (added since 2.64) */ @@ -110,13 +107,13 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob, MDeformVert *dvert = NULL; BevelModifierData *bmd = (BevelModifierData *) md; const float threshold = cosf((bmd->bevel_angle + 0.00001f) * (float)M_PI / 180.0f); - const bool vertex_only = (bmd->flags & BME_BEVEL_VERT) != 0; - const bool do_clamp = !(bmd->flags & BME_BEVEL_OVERLAP_OK); + const bool vertex_only = (bmd->flags & MOD_BEVEL_VERT) != 0; + const bool do_clamp = !(bmd->flags & MOD_BEVEL_OVERLAP_OK); bm = DM_to_bmesh(dm, true); if (vertex_only) { - if ((bmd->lim_flags & BME_BEVEL_VGROUP) && bmd->defgrp_name[0]) { + if ((bmd->lim_flags & MOD_BEVEL_VGROUP) && bmd->defgrp_name[0]) { modifier_get_vgroup(ob, dm, bmd->defgrp_name, &dvert, &vgroup); } BM_ITER_MESH(v, &iter, bm, BM_VERTS_OF_MESH) { @@ -131,7 +128,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob, BM_elem_flag_enable(v, BM_ELEM_TAG); } } - else if (bmd->lim_flags & BME_BEVEL_ANGLE) { + else if (bmd->lim_flags & MOD_BEVEL_ANGLE) { BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { /* check for 1 edge having 2 face users */ BMLoop *l_a, *l_b; @@ -148,7 +145,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob, /* crummy, is there a way just to operator on all? - campbell */ BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { if (BM_edge_is_manifold(e)) { - if (bmd->lim_flags & BME_BEVEL_WEIGHT) { + if (bmd->lim_flags & MOD_BEVEL_WEIGHT) { weight = BM_elem_float_data_get(&bm->edata, e, CD_BWEIGHT); if (weight == 0.0f) continue; @@ -161,7 +158,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob, } BM_mesh_bevel(bm, bmd->value, bmd->res, - vertex_only, bmd->lim_flags & BME_BEVEL_WEIGHT, do_clamp, + vertex_only, bmd->lim_flags & MOD_BEVEL_WEIGHT, do_clamp, dvert, vgroup); result = CDDM_from_bmesh(bm, TRUE); @@ -176,46 +173,6 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob, return result; } - -#else /* from trunk, see note above */ - -static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), - DerivedMesh *derivedData, - ModifierApplyFlag UNUSED(flag)) -{ - DerivedMesh *result; - BMesh *bm; - - /*bDeformGroup *def;*/ - int /*i,*/ options, defgrp_index = -1; - BevelModifierData *bmd = (BevelModifierData *) md; - - options = bmd->flags | bmd->val_flags | bmd->lim_flags | bmd->e_flags; - -#if 0 - if ((options & BME_BEVEL_VWEIGHT) && bmd->defgrp_name[0]) { - defgrp_index = defgroup_name_index(ob, bmd->defgrp_name); - if (defgrp_index == -1) { - options &= ~BME_BEVEL_VWEIGHT; - } - } -#endif - - bm = DM_to_bmesh(derivedData); - BME_bevel(bm, bmd->value, bmd->res, options, defgrp_index, DEG2RADF(bmd->bevel_angle), NULL); - result = CDDM_from_bmesh(bm, TRUE); - BM_mesh_free(bm); - - /* until we allow for dirty normal flag, always calc, - * note: calculating on the CDDM is faster then the BMesh equivalent */ - result->dirty |= DM_DIRTY_NORMALS; - - return result; -} - -#endif - - ModifierTypeInfo modifierType_Bevel = { /* name */ "Bevel", /* structName */ "BevelModifierData", diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index 05d00ca5375..05b51c2cf4b 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -453,7 +453,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *dm = NULL; CastModifierData *cmd = (CastModifierData *)md; - dm = get_dm(ob, NULL, derivedData, NULL, 0); + dm = get_dm(ob, NULL, derivedData, NULL, false, false); if (cmd->type == MOD_CAST_TYPE_CUBOID) { cuboid_do(cmd, ob, dm, vertexCos, numVerts); @@ -470,7 +470,7 @@ static void deformVertsEM( ModifierData *md, Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { - DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, 0); + DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false); CastModifierData *cmd = (CastModifierData *)md; if (cmd->type == MOD_CAST_TYPE_CUBOID) { diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 33e0456d492..81f139e48ce 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -72,7 +72,6 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, { DerivedMesh *dm; ClothModifierData *clmd = (ClothModifierData *) md; - DerivedMesh *result = NULL; /* check for alloc failing */ if (!clmd->sim_parms || !clmd->coll_parms) { @@ -82,7 +81,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, return; } - dm = get_dm(ob, NULL, derivedData, NULL, 0); + dm = get_dm(ob, NULL, derivedData, NULL, false, false); if (dm == derivedData) dm = CDDM_copy(dm); @@ -92,11 +91,6 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, clothModifier_do(clmd, md->scene, ob, dm, vertexCos); - if (result) { - result->getVertCos(result, vertexCos); - result->release(result); - } - dm->release(dm); } diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index ffd202736a9..25254c7a30e 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -219,7 +219,7 @@ static void displaceModifier_do( if (dmd->texture) { texres.nor = NULL; - get_texture_value(dmd->texture, tex_co[i], &texres); + get_texture_value(dmd->modifier.scene, dmd->texture, tex_co[i], &texres, false); delta = texres.tin - dmd->midlevel; } else { @@ -265,7 +265,7 @@ static void deformVerts(ModifierData *md, Object *ob, int numVerts, ModifierApplyFlag UNUSED(flag)) { - DerivedMesh *dm = get_cddm(ob, NULL, derivedData, vertexCos); + DerivedMesh *dm = get_cddm(ob, NULL, derivedData, vertexCos, dependsOnNormals(md)); displaceModifier_do((DisplaceModifierData *)md, ob, dm, vertexCos, numVerts); @@ -278,7 +278,7 @@ static void deformVertsEM( ModifierData *md, Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { - DerivedMesh *dm = get_cddm(ob, editData, derivedData, vertexCos); + DerivedMesh *dm = get_cddm(ob, editData, derivedData, vertexCos, dependsOnNormals(md)); displaceModifier_do((DisplaceModifierData *)md, ob, dm, vertexCos, numVerts); diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index b4193a0a369..4e8af650cb2 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -252,7 +252,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, DerivedMesh *dm = derivedData; /* We need a valid dm for meshes when a vgroup is set... */ if (!dm && ob->type == OB_MESH && hmd->name[0] != '\0') - dm = get_dm(ob, NULL, dm, NULL, 0); + dm = get_dm(ob, NULL, dm, NULL, false, false); deformVerts_do(hmd, ob, dm, vertexCos, numVerts); @@ -267,7 +267,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editD DerivedMesh *dm = derivedData; /* We need a valid dm for meshes when a vgroup is set... */ if (!dm && ob->type == OB_MESH && hmd->name[0] != '\0') - dm = get_dm(ob, editData, dm, NULL, 0); + dm = get_dm(ob, editData, dm, NULL, false, false); deformVerts_do(hmd, ob, dm, vertexCos, numVerts); diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c index cf9ab8d5ec2..1abe1e97a23 100644 --- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c +++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c @@ -669,7 +669,7 @@ static void laplaciansmoothModifier_do( static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) { - DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, 0); + DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false); laplaciansmoothModifier_do((LaplacianSmoothModifierData *)md, ob, dm, vertexCos, numVerts); @@ -682,7 +682,7 @@ static void deformVertsEM( ModifierData *md, Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { - DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, 0); + DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false); laplaciansmoothModifier_do((LaplacianSmoothModifierData *)md, ob, dm, vertexCos, numVerts); diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index b6f8dede42f..8386f0ff9af 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -212,7 +212,7 @@ static void meshdeformModifier_do( /* if we don't have one computed, use derivedmesh from data * without any modifiers */ if (!cagedm) { - cagedm = get_dm(mmd->object, NULL, NULL, NULL, 0); + cagedm = get_dm(mmd->object, NULL, NULL, NULL, false, false); if (cagedm) cagedm->needsFree = 1; } @@ -343,7 +343,7 @@ static void deformVerts(ModifierData *md, Object *ob, int numVerts, ModifierApplyFlag UNUSED(flag)) { - DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, 0); + DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false); modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */ @@ -359,7 +359,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, float (*vertexCos)[3], int numVerts) { - DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, 0); + DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false); meshdeformModifier_do(md, ob, dm, vertexCos, numVerts); diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index d50e69217f6..1b9fcd9f34e 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -37,7 +37,6 @@ #include "DNA_object_types.h" #include "BLI_math.h" -#include "BLI_array.h" #include "BKE_cdderivedmesh.h" #include "BKE_mesh.h" diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index 7c9a88622ed..5fdd17b5167 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -426,6 +426,11 @@ static DerivedMesh *doOcean(ModifierData *md, Object *ob, const float size_co_inv = 1.0f / (omd->size * omd->spatial_size); + /* can happen in when size is small, avoid bad array lookups later and quit now */ + if (!finite(size_co_inv)) { + return derivedData; + } + /* update modifier */ if (omd->refresh & MOD_OCEAN_REFRESH_ADD) omd->ocean = BKE_add_ocean(); @@ -531,7 +536,7 @@ static DerivedMesh *doOcean(ModifierData *md, Object *ob, } } - #undef OCEAN_CO +#undef OCEAN_CO return dm; } @@ -552,8 +557,6 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, { DerivedMesh *result; - CDDM_calc_normals(derivedData); - result = doOcean(md, ob, derivedData, 0); if (result != derivedData) diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index cd2ef5957cd..327ae577108 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -142,7 +142,7 @@ static void deformVerts(ModifierData *md, Object *ob, return; if (dm == NULL) { - dm = get_dm(ob, NULL, NULL, vertexCos, 1); + dm = get_dm(ob, NULL, NULL, vertexCos, false, true); if (!dm) return; diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 5faa1ecdaac..0dd2f2770a4 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -636,7 +636,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, * * Use the edge order to make the subtraction, flip the normal the right way * edge should be there but check just in case... */ - if (vc->e && vc->e[0]->v1 == i) { + if (vc->e[0]->v1 == i) { sub_v3_v3(tmp_vec1, tmp_vec2); } else { @@ -646,7 +646,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, else { /* only 1 edge connected - same as above except * don't need to average edge direction */ - if (vc->e && vc->e[0]->v2 == i) { + if (vc->e[0]->v2 == i) { sub_v3_v3v3(tmp_vec1, mvert_new[i].co, mvert_new[vc->v[0]].co); } else { diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c index 697ccdc49a4..fef4c7ccedb 100644 --- a/source/blender/modifiers/intern/MOD_shapekey.c +++ b/source/blender/modifiers/intern/MOD_shapekey.c @@ -55,17 +55,12 @@ static void deformVerts(ModifierData *md, Object *ob, ModifierApplyFlag UNUSED(flag)) { Key *key = BKE_key_from_object(ob); - float (*deformedVerts)[3]; if (key && key->block.first) { int deformedVerts_tot; - deformedVerts = (float(*)[3])BKE_key_evaluate_object(md->scene, ob, &deformedVerts_tot); - if (deformedVerts) { - if (numVerts == deformedVerts_tot) { - memcpy(vertexCos, deformedVerts, sizeof(float) * 3 * numVerts); - } - MEM_freeN(deformedVerts); - } + BKE_key_evaluate_object_ex(md->scene, ob, &deformedVerts_tot, + (float *)vertexCos, sizeof(*vertexCos) * numVerts); + } } diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index 9addcdc6ee1..e06c4f22553 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -48,6 +48,8 @@ #include "MOD_util.h" +static bool dependsOnNormals(ModifierData *md); + static void initData(ModifierData *md) { @@ -120,8 +122,9 @@ static void deformVerts(ModifierData *md, Object *ob, CustomDataMask dataMask = requiredDataMask(ob, md); /* ensure we get a CDDM with applied vertex coords */ - if (dataMask) - dm = get_cddm(ob, NULL, dm, vertexCos); + if (dataMask) { + dm = get_cddm(ob, NULL, dm, vertexCos, dependsOnNormals(md)); + } shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ob, dm, vertexCos, numVerts); @@ -136,8 +139,9 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editD CustomDataMask dataMask = requiredDataMask(ob, md); /* ensure we get a CDDM with applied vertex coords */ - if (dataMask) - dm = get_cddm(ob, editData, dm, vertexCos); + if (dataMask) { + dm = get_cddm(ob, editData, dm, vertexCos, dependsOnNormals(md)); + } shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ob, dm, vertexCos, numVerts); diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index 5267c0d9ccb..d260312fe3d 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -166,14 +166,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object /* Calculate matrixs do convert between coordinate spaces */ if (smd->origin) { transf = &tmp_transf; - - if (smd->originOpts & MOD_SIMPLEDEFORM_ORIGIN_LOCAL) { - space_transform_from_matrixs(transf, ob->obmat, smd->origin->obmat); - } - else { - copy_m4_m4(transf->local2target, smd->origin->obmat); - invert_m4_m4(transf->target2local, transf->local2target); - } + space_transform_from_matrixs(transf, ob->obmat, smd->origin->obmat); } /* Setup vars, @@ -252,7 +245,6 @@ static void initData(ModifierData *md) SimpleDeformModifierData *smd = (SimpleDeformModifierData *) md; smd->mode = MOD_SIMPLEDEFORM_MODE_TWIST; - smd->originOpts = MOD_SIMPLEDEFORM_ORIGIN_LOCAL; smd->axis = 0; smd->origin = NULL; @@ -269,9 +261,8 @@ static void copyData(ModifierData *md, ModifierData *target) tsmd->mode = smd->mode; tsmd->axis = smd->axis; tsmd->origin = smd->origin; - tsmd->originOpts = smd->originOpts; tsmd->factor = smd->factor; - memcpy(tsmd->limit, smd->limit, sizeof(tsmd->limit)); + copy_v2_v2(tsmd->limit, smd->limit); BLI_strncpy(tsmd->vgroup_name, smd->vgroup_name, sizeof(tsmd->vgroup_name)); } @@ -317,7 +308,7 @@ static void deformVerts(ModifierData *md, Object *ob, /* we implement requiredDataMask but thats not really useful since * mesh_calc_modifiers pass a NULL derivedData */ if (dataMask) - dm = get_dm(ob, NULL, dm, NULL, 0); + dm = get_dm(ob, NULL, dm, NULL, false, false); SimpleDeformModifier_do((SimpleDeformModifierData *)md, ob, dm, vertexCos, numVerts); @@ -337,7 +328,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, /* we implement requiredDataMask but thats not really useful since * mesh_calc_modifiers pass a NULL derivedData */ if (dataMask) - dm = get_dm(ob, editData, dm, NULL, 0); + dm = get_dm(ob, editData, dm, NULL, false, false); SimpleDeformModifier_do((SimpleDeformModifierData *)md, ob, dm, vertexCos, numVerts); diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c index 6c2bd25f0a5..91dcf721e4b 100644 --- a/source/blender/modifiers/intern/MOD_skin.c +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -237,7 +237,7 @@ static int build_hull(SkinOutput *so, Frame **frames, int totframe) /* Deselect all faces so that only new hull output faces are * selected after the operator is run */ - BM_mesh_elem_hflag_disable_all(bm, BM_ALL, BM_ELEM_SELECT, 0); + BM_mesh_elem_hflag_disable_all(bm, BM_ALL_NOLOOP, BM_ELEM_SELECT, false); BMO_op_initf(bm, &op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE), "convex_hull input=%hv", BM_ELEM_TAG); @@ -288,7 +288,7 @@ static int build_hull(SkinOutput *so, Frame **frames, int totframe) /* Remove triangles that would fill the original frames -- skip if * frame is partially detached */ - BM_mesh_elem_hflag_disable_all(bm, BM_ALL, BM_ELEM_TAG, FALSE); + BM_mesh_elem_hflag_disable_all(bm, BM_ALL_NOLOOP, BM_ELEM_TAG, false); for (i = 0; i < totframe; i++) { Frame *frame = frames[i]; if (!frame->detached) { @@ -690,7 +690,7 @@ static void build_emats_stack(BLI_Stack *stack, int *visited_e, EMat *emat, /* Add neighbors to stack */ for (i = 0; i < emap[v].count; i++) { /* Add neighbors to stack */ - memcpy(stack_elem.mat, emat[e].mat, sizeof(float) * 3 * 3); + copy_m3_m3(stack_elem.mat, emat[e].mat); stack_elem.e = emap[v].indices[i]; stack_elem.parent_v = v; BLI_stack_push(stack, &stack_elem); diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index 0da122b0d0f..96d7d5956c5 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -221,7 +221,7 @@ static void smoothModifier_do( static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag)) { - DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, 0); + DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false); smoothModifier_do((SmoothModifierData *)md, ob, dm, vertexCos, numVerts); @@ -234,7 +234,7 @@ static void deformVertsEM( ModifierData *md, Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts) { - DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, 0); + DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false); smoothModifier_do((SmoothModifierData *)md, ob, dm, vertexCos, numVerts); diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 8f124bf0181..2696a3e156b 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -242,7 +242,7 @@ static DerivedMesh *applyModifier( unsigned int *new_edge_arr = NULL; STACK_DECLARE(new_edge_arr); - unsigned int *old_vert_arr = MEM_callocN(sizeof(old_vert_arr) * (size_t)numVerts, "old_vert_arr in solidify"); + unsigned int *old_vert_arr = MEM_callocN(sizeof(*old_vert_arr) * (size_t)numVerts, "old_vert_arr in solidify"); unsigned int *edge_users = NULL; char *edge_order = NULL; diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c index 78ac029d726..1c462f12f9f 100644 --- a/source/blender/modifiers/intern/MOD_surface.c +++ b/source/blender/modifiers/intern/MOD_surface.c @@ -98,7 +98,7 @@ static void deformVerts(ModifierData *md, Object *ob, /* if possible use/create DerivedMesh */ if (derivedData) surmd->dm = CDDM_copy(derivedData); - else surmd->dm = get_dm(ob, NULL, NULL, NULL, 0); + else surmd->dm = get_dm(ob, NULL, NULL, NULL, false, false); if (!ob->pd) { printf("SurfaceModifier deformVerts: Should not happen!\n"); diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index c3748ce0265..230931a1a33 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -50,6 +50,7 @@ #include "BKE_lattice.h" #include "BKE_mesh.h" #include "BKE_displist.h" +#include "BKE_scene.h" #include "BKE_modifier.h" @@ -69,12 +70,17 @@ void modifier_init_texture(Scene *scene, Tex *tex) BKE_image_user_frame_calc(&tex->iuser, scene->r.cfra, 0); } -void get_texture_value(Tex *texture, float *tex_co, TexResult *texres) +void get_texture_value(Scene *scene, Tex *texture, float *tex_co, TexResult *texres, bool use_color_management) { int result_type; + bool do_color_manage = false; + + if (use_color_management) { + do_color_manage = BKE_scene_check_color_management_enabled(scene); + } /* no node textures for now */ - result_type = multitex_ext_safe(texture, tex_co, texres, NULL); + result_type = multitex_ext_safe(texture, tex_co, texres, NULL, do_color_manage); /* if the texture gave an RGB value, we assume it didn't give a valid * intensity, since this is in the context of modifiers don't use perceptual color conversion. @@ -173,30 +179,33 @@ void modifier_vgroup_cache(ModifierData *md, float (*vertexCos)[3]) } /* returns a cdderivedmesh if dm == NULL or is another type of derivedmesh */ -DerivedMesh *get_cddm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*vertexCos)[3]) +DerivedMesh *get_cddm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*vertexCos)[3], bool use_normals) { - if (dm && dm->type == DM_TYPE_CDDM) - return dm; + if (dm) { + if (dm->type != DM_TYPE_CDDM) { + dm = CDDM_copy(dm); + CDDM_apply_vert_coords(dm, vertexCos); + } - if (!dm) { - dm = get_dm(ob, em, dm, vertexCos, 0); + if (use_normals) { + DM_ensure_normals(dm); + } } else { - dm = CDDM_copy(dm); - CDDM_apply_vert_coords(dm, vertexCos); - dm->dirty |= DM_DIRTY_NORMALS; + dm = get_dm(ob, em, dm, vertexCos, use_normals, false); } return dm; } /* returns a derived mesh if dm == NULL, for deforming modifiers that need it */ -DerivedMesh *get_dm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*vertexCos)[3], int orco) +DerivedMesh *get_dm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, + float (*vertexCos)[3], bool use_normals, bool use_orco) { - if (dm) - return dm; - - if (ob->type == OB_MESH) { + if (dm) { + /* pass */ + } + else if (ob->type == OB_MESH) { if (em) dm = CDDM_from_editbmesh(em, FALSE, FALSE); else dm = CDDM_from_mesh((struct Mesh *)(ob->data), ob); @@ -205,13 +214,20 @@ DerivedMesh *get_dm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (* dm->dirty |= DM_DIRTY_NORMALS; } - if (orco) + if (use_orco) { DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, BKE_mesh_orco_verts_get(ob)); + } } else if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) { dm = CDDM_from_curve(ob); } + if (use_normals) { + if (LIKELY(dm)) { + DM_ensure_normals(dm); + } + } + return dm; } diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h index 6f05c9a957a..25632eb5b80 100644 --- a/source/blender/modifiers/intern/MOD_util.h +++ b/source/blender/modifiers/intern/MOD_util.h @@ -41,14 +41,14 @@ struct Tex; struct TexResult; void modifier_init_texture(struct Scene *scene, struct Tex *texture); -void get_texture_value(struct Tex *texture, float *tex_co, struct TexResult *texres); +void get_texture_value(struct Scene *scene, struct Tex *texture, float *tex_co, struct TexResult *texres, bool do_color_manage); void get_texture_coords(struct MappingInfoModifierData *dmd, struct Object *ob, struct DerivedMesh *dm, float (*co)[3], float (*texco)[3], int numVerts); void modifier_vgroup_cache(struct ModifierData *md, float (*vertexCos)[3]); struct DerivedMesh *get_cddm(struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm, - float (*vertexCos)[3]); + float (*vertexCos)[3], bool use_normals); struct DerivedMesh *get_dm(struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm, - float (*vertexCos)[3], int orco); + float (*vertexCos)[3], bool use_normals, bool use_orco); void modifier_get_vgroup(struct Object *ob, struct DerivedMesh *dm, const char *name, struct MDeformVert **dvert, int *defgrp_index); diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c index cba1880491c..3429acdcea4 100644 --- a/source/blender/modifiers/intern/MOD_warp.c +++ b/source/blender/modifiers/intern/MOD_warp.c @@ -282,7 +282,7 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob, if (tex_co) { TexResult texres; texres.nor = NULL; - get_texture_value(wmd->texture, tex_co[i], &texres); + get_texture_value(wmd->modifier.scene, wmd->texture, tex_co[i], &texres, false); fac *= texres.tin; } @@ -327,7 +327,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, int use_dm = warp_needs_dm((WarpModifierData *)md); if (use_dm) { - dm = get_cddm(ob, NULL, derivedData, vertexCos); + dm = get_cddm(ob, NULL, derivedData, vertexCos, false); } warpModifier_do((WarpModifierData *)md, ob, dm, vertexCos, numVerts); diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 8c6c483472e..43dc1ba4eb9 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -306,7 +306,7 @@ static void waveModifier_do(WaveModifierData *md, if (wmd->texture) { TexResult texres; texres.nor = NULL; - get_texture_value(wmd->texture, tex_co[i], &texres); + get_texture_value(wmd->modifier.scene, wmd->texture, tex_co[i], &texres, false); amplit *= texres.tin; } @@ -346,9 +346,9 @@ static void deformVerts(ModifierData *md, Object *ob, WaveModifierData *wmd = (WaveModifierData *)md; if (wmd->flag & MOD_WAVE_NORM) - dm = get_cddm(ob, NULL, dm, vertexCos); + dm = get_cddm(ob, NULL, dm, vertexCos, false); else if (wmd->texture || wmd->defgrp_name[0]) - dm = get_dm(ob, NULL, dm, NULL, 0); + dm = get_dm(ob, NULL, dm, NULL, false, false); waveModifier_do(wmd, md->scene, ob, dm, vertexCos, numVerts); @@ -364,9 +364,9 @@ static void deformVertsEM( WaveModifierData *wmd = (WaveModifierData *)md; if (wmd->flag & MOD_WAVE_NORM) - dm = get_cddm(ob, editData, dm, vertexCos); + dm = get_cddm(ob, editData, dm, vertexCos, false); else if (wmd->texture || wmd->defgrp_name[0]) - dm = get_dm(ob, editData, dm, NULL, 0); + dm = get_dm(ob, editData, dm, NULL, false, false); waveModifier_do(wmd, md->scene, ob, dm, vertexCos, numVerts); diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index a5e63a7832f..8ad9e26f788 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -158,9 +158,12 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne int idx = indices ? indices[i] : i; TexResult texres; float hsv[3]; /* For HSV color space. */ + bool do_color_manage; + + do_color_manage = tex_use_channel != MOD_WVG_MASK_TEX_USE_INT; texres.nor = NULL; - get_texture_value(texture, tex_co[idx], &texres); + get_texture_value(scene, texture, tex_co[idx], &texres, do_color_manage); /* Get the good channel value... */ switch (tex_use_channel) { case MOD_WVG_MASK_TEX_USE_INT: diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h index 05c1330ee85..0b526fcde0e 100644 --- a/source/blender/nodes/NOD_static_types.h +++ b/source/blender/nodes/NOD_static_types.h @@ -69,7 +69,7 @@ DefNode( ShaderNode, SH_NODE_OUTPUT_MATERIAL, 0, "OU DefNode( ShaderNode, SH_NODE_OUTPUT_LAMP, 0, "OUTPUT_LAMP", OutputLamp, "Lamp Output", "" ) DefNode( ShaderNode, SH_NODE_OUTPUT_WORLD, 0, "OUTPUT_WORLD", OutputWorld, "World Output", "" ) DefNode( ShaderNode, SH_NODE_FRESNEL, 0, "FRESNEL", Fresnel, "Fresnel", "" ) -DefNode( ShaderNode, SH_NODE_LAYER_WEIGHT, 0, "LAYER_WEIGHT", LayerWeight, "LayerWeight", "" ) +DefNode( ShaderNode, SH_NODE_LAYER_WEIGHT, 0, "LAYER_WEIGHT", LayerWeight, "Layer Weight", "" ) DefNode( ShaderNode, SH_NODE_MIX_SHADER, 0, "MIX_SHADER", MixShader, "Mix Shader", "" ) DefNode( ShaderNode, SH_NODE_ADD_SHADER, 0, "ADD_SHADER", AddShader, "Add Shader", "" ) DefNode( ShaderNode, SH_NODE_ATTRIBUTE, def_sh_attribute, "ATTRIBUTE", Attribute, "Attribute", "" ) diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index 41f1f81e048..0d68b999eb2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -373,7 +373,8 @@ void node_cmp_rlayers_force_hidden_passes(bNode *node) bNodeSocket *sock; /* must always have valid scene pointer */ - BLI_assert(scene != NULL); + if (!scene) + return; srl = BLI_findlink(&scene->r.layers, node->custom1); if (!srl) diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 36b27094cc4..a8133460628 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -267,6 +267,7 @@ static void node_reroute_inherit_type_recursive(bNodeTree *ntree, bNode *node) bNodeSocket *output = node->outputs.first; bNodeLink *link; int type = SOCK_FLOAT; + const char *type_idname = nodeStaticSocketType(type, PROP_NONE); /* XXX it would be a little bit more efficient to restrict actual updates * to rerout nodes connected to an updated node, but there's no reliable flag @@ -292,21 +293,37 @@ static void node_reroute_inherit_type_recursive(bNodeTree *ntree, bNode *node) } /* determine socket type from unambiguous input/output connection if possible */ - if (input->limit == 1 && input->link) + if (input->limit == 1 && input->link) { type = input->link->fromsock->type; - else if (output->limit == 1 && output->link) + type_idname = nodeStaticSocketType(type, PROP_NONE); + } + else if (output->limit == 1 && output->link) { type = output->link->tosock->type; + type_idname = nodeStaticSocketType(type, PROP_NONE); + } - /* arbitrary, could also test output->type, both are the same */ if (input->type != type) { - PointerRNA input_ptr, output_ptr; - /* same type for input/output */ - RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, input, &input_ptr); - RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, output, &output_ptr); - - RNA_enum_set(&input_ptr, "type", type); - RNA_enum_set(&output_ptr, "type", type); + bNodeSocket *ninput = nodeAddSocket(ntree, node, SOCK_IN, type_idname, "input", "Input"); + for (link = ntree->links.first; link; link = link->next) { + if (link->tosock == input) { + link->tosock = ninput; + ninput->link = link; + } + } + nodeRemoveSocket(ntree, node, input); } + + if (output->type != type) { + bNodeSocket *noutput = nodeAddSocket(ntree, node, SOCK_OUT, type_idname, "output", "Output"); + for (link = ntree->links.first; link; link = link->next) { + if (link->fromsock == output) { + link->fromsock = noutput; + } + } + nodeRemoveSocket(ntree, node, output); + } + + nodeUpdateInternalLinks(ntree, node); } /* Global update function for Reroute node types. diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c index d18dddd4ff4..2b6318679e0 100644 --- a/source/blender/nodes/intern/node_exec.c +++ b/source/blender/nodes/intern/node_exec.c @@ -98,6 +98,10 @@ static void node_init_output_index(bNodeSocket *sock, int *index, ListBase *inte for (link = internal_links->first; link; link = link->next) { if (link->tosock == sock) { sock->stack_index = link->fromsock->stack_index; + /* set the link pointer to indicate that this socket + * should not overwrite the stack value! + */ + sock->link = link; break; } } diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c index 0fd6d871dc1..92d403685d0 100644 --- a/source/blender/nodes/intern/node_socket.c +++ b/source/blender/nodes/intern/node_socket.c @@ -60,26 +60,30 @@ struct bNodeSocket *node_add_socket_from_template(struct bNodeTree *ntree, struc /* initialize default_value */ switch (stemp->type) { - case SOCK_FLOAT: { + case SOCK_FLOAT: + { bNodeSocketValueFloat *dval = sock->default_value; dval->value = stemp->val1; dval->min = stemp->min; dval->max = stemp->max; break; } - case SOCK_INT: { + case SOCK_INT: + { bNodeSocketValueInt *dval = sock->default_value; dval->value = (int)stemp->val1; dval->min = (int)stemp->min; dval->max = (int)stemp->max; break; } - case SOCK_BOOLEAN: { + case SOCK_BOOLEAN: + { bNodeSocketValueBoolean *dval = sock->default_value; dval->value = (int)stemp->val1; break; } - case SOCK_VECTOR: { + case SOCK_VECTOR: + { bNodeSocketValueVector *dval = sock->default_value; dval->value[0] = stemp->val1; dval->value[1] = stemp->val2; @@ -88,7 +92,8 @@ struct bNodeSocket *node_add_socket_from_template(struct bNodeTree *ntree, struc dval->max = stemp->max; break; } - case SOCK_RGBA: { + case SOCK_RGBA: + { bNodeSocketValueRGBA *dval = sock->default_value; dval->value[0] = stemp->val1; dval->value[1] = stemp->val2; @@ -202,7 +207,8 @@ void node_socket_init_default_value(bNodeSocket *sock) return; /* already initialized */ switch (type) { - case SOCK_FLOAT: { + case SOCK_FLOAT: + { bNodeSocketValueFloat *dval = MEM_callocN(sizeof(bNodeSocketValueFloat), "node socket value float"); dval->subtype = subtype; dval->value = 0.0f; @@ -212,7 +218,8 @@ void node_socket_init_default_value(bNodeSocket *sock) sock->default_value = dval; break; } - case SOCK_INT: { + case SOCK_INT: + { bNodeSocketValueInt *dval = MEM_callocN(sizeof(bNodeSocketValueInt), "node socket value int"); dval->subtype = subtype; dval->value = 0; @@ -222,14 +229,16 @@ void node_socket_init_default_value(bNodeSocket *sock) sock->default_value = dval; break; } - case SOCK_BOOLEAN: { + case SOCK_BOOLEAN: + { bNodeSocketValueBoolean *dval = MEM_callocN(sizeof(bNodeSocketValueBoolean), "node socket value bool"); dval->value = false; sock->default_value = dval; break; } - case SOCK_VECTOR: { + case SOCK_VECTOR: + { static float default_value[] = { 0.0f, 0.0f, 0.0f }; bNodeSocketValueVector *dval = MEM_callocN(sizeof(bNodeSocketValueVector), "node socket value vector"); dval->subtype = subtype; @@ -240,7 +249,8 @@ void node_socket_init_default_value(bNodeSocket *sock) sock->default_value = dval; break; } - case SOCK_RGBA: { + case SOCK_RGBA: + { static float default_value[] = { 0.0f, 0.0f, 0.0f, 1.0f }; bNodeSocketValueRGBA *dval = MEM_callocN(sizeof(bNodeSocketValueRGBA), "node socket value color"); copy_v4_v4(dval->value, default_value); @@ -248,7 +258,8 @@ void node_socket_init_default_value(bNodeSocket *sock) sock->default_value = dval; break; } - case SOCK_STRING: { + case SOCK_STRING: + { bNodeSocketValueString *dval = MEM_callocN(sizeof(bNodeSocketValueString), "node socket value string"); dval->subtype = subtype; dval->value[0] = '\0'; @@ -271,37 +282,43 @@ void node_socket_copy_default_value(bNodeSocket *to, bNodeSocket *from) node_socket_init_default_value(to); switch (from->typeinfo->type) { - case SOCK_FLOAT: { + case SOCK_FLOAT: + { bNodeSocketValueFloat *toval = to->default_value; bNodeSocketValueFloat *fromval = from->default_value; *toval = *fromval; break; } - case SOCK_INT: { + case SOCK_INT: + { bNodeSocketValueInt *toval = to->default_value; bNodeSocketValueInt *fromval = from->default_value; *toval = *fromval; break; } - case SOCK_BOOLEAN: { + case SOCK_BOOLEAN: + { bNodeSocketValueBoolean *toval = to->default_value; bNodeSocketValueBoolean *fromval = from->default_value; *toval = *fromval; break; } - case SOCK_VECTOR: { + case SOCK_VECTOR: + { bNodeSocketValueVector *toval = to->default_value; bNodeSocketValueVector *fromval = from->default_value; *toval = *fromval; break; } - case SOCK_RGBA: { + case SOCK_RGBA: + { bNodeSocketValueRGBA *toval = to->default_value; bNodeSocketValueRGBA *fromval = from->default_value; *toval = *fromval; break; } - case SOCK_STRING: { + case SOCK_STRING: + { bNodeSocketValueString *toval = to->default_value; bNodeSocketValueString *fromval = from->default_value; *toval = *fromval; @@ -334,21 +351,24 @@ static void standard_node_socket_interface_verify_socket(bNodeTree *UNUSED(ntree node_socket_init_default_value(sock); switch (stemp->typeinfo->type) { - case SOCK_FLOAT: { + case SOCK_FLOAT: + { bNodeSocketValueFloat *toval = sock->default_value; bNodeSocketValueFloat *fromval = stemp->default_value; toval->min = fromval->min; toval->max = fromval->max; break; } - case SOCK_INT: { + case SOCK_INT: + { bNodeSocketValueInt *toval = sock->default_value; bNodeSocketValueInt *fromval = stemp->default_value; toval->min = fromval->min; toval->max = fromval->max; break; } - case SOCK_VECTOR: { + case SOCK_VECTOR: + { bNodeSocketValueVector *toval = sock->default_value; bNodeSocketValueVector *fromval = stemp->default_value; toval->min = fromval->min; diff --git a/source/blender/nodes/shader/nodes/node_shader_light_path.c b/source/blender/nodes/shader/nodes/node_shader_light_path.c index 63713eb1e02..9d769b284b1 100644 --- a/source/blender/nodes/shader/nodes/node_shader_light_path.c +++ b/source/blender/nodes/shader/nodes/node_shader_light_path.c @@ -38,6 +38,7 @@ static bNodeSocketTemplate sh_node_light_path_out[] = { { SOCK_FLOAT, 0, N_("Is Reflection Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, N_("Is Transmission Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_FLOAT, 0, N_("Ray Length"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_FLOAT, 0, N_("Ray Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, { -1, 0, "" } }; diff --git a/source/blender/nodes/shader/nodes/node_shader_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c index b1a27f194cc..49a7de47fc3 100644 --- a/source/blender/nodes/shader/nodes/node_shader_math.c +++ b/source/blender/nodes/shader/nodes/node_shader_math.c @@ -64,32 +64,32 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode out[0]->vec[0] = 0.0; else out[0]->vec[0] = in[0]->vec[0] / in[1]->vec[0]; + break; } - break; case 4: /* Sine */ { if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ out[0]->vec[0] = sin(in[0]->vec[0]); else out[0]->vec[0] = sin(in[1]->vec[0]); + break; } - break; case 5: /* Cosine */ { if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ out[0]->vec[0] = cos(in[0]->vec[0]); else out[0]->vec[0] = cos(in[1]->vec[0]); + break; } - break; case 6: /* Tangent */ { if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ out[0]->vec[0] = tan(in[0]->vec[0]); else out[0]->vec[0] = tan(in[1]->vec[0]); + break; } - break; case 7: /* Arc-Sine */ { if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */ @@ -106,8 +106,8 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode else out[0]->vec[0] = 0.0; } + break; } - break; case 8: /* Arc-Cosine */ { if (in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */ @@ -124,16 +124,16 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode else out[0]->vec[0] = 0.0; } + break; } - break; case 9: /* Arc-Tangent */ { if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ out[0]->vec[0] = atan(in[0]->vec[0]); else out[0]->vec[0] = atan(in[1]->vec[0]); + break; } - break; case 10: /* Power */ { /* Only raise negative numbers by full integers */ @@ -152,8 +152,8 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode } } + break; } - break; case 11: /* Logarithm */ { /* Don't want any imaginary numbers... */ @@ -161,56 +161,56 @@ static void node_shader_exec_math(void *UNUSED(data), int UNUSED(thread), bNode out[0]->vec[0] = log(in[0]->vec[0]) / log(in[1]->vec[0]); else out[0]->vec[0] = 0.0; + break; } - break; case 12: /* Minimum */ { if (in[0]->vec[0] < in[1]->vec[0]) out[0]->vec[0] = in[0]->vec[0]; else out[0]->vec[0] = in[1]->vec[0]; + break; } - break; case 13: /* Maximum */ { if (in[0]->vec[0] > in[1]->vec[0]) out[0]->vec[0] = in[0]->vec[0]; else out[0]->vec[0] = in[1]->vec[0]; + break; } - break; case 14: /* Round */ { if (in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */ out[0]->vec[0] = (in[0]->vec[0] < 0) ? (int)(in[0]->vec[0] - 0.5f) : (int)(in[0]->vec[0] + 0.5f); else out[0]->vec[0] = (in[1]->vec[0] < 0) ? (int)(in[1]->vec[0] - 0.5f) : (int)(in[1]->vec[0] + 0.5f); + break; } - break; case 15: /* Less Than */ { if (in[0]->vec[0] < in[1]->vec[0]) out[0]->vec[0] = 1.0f; else out[0]->vec[0] = 0.0f; + break; } - break; case 16: /* Greater Than */ { if (in[0]->vec[0] > in[1]->vec[0]) out[0]->vec[0] = 1.0f; else out[0]->vec[0] = 0.0f; + break; } - break; case 17: /* Modulo */ { if (in[1]->vec[0] == 0.0f) out[0]->vec[0] = 0.0f; else out[0]->vec[0] = fmod(in[0]->vec[0], in[1]->vec[0]); + break; } - break; } } @@ -232,6 +232,7 @@ static int gpu_shader_math(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED( case 13: case 15: case 16: + case 17: GPU_stack_link(mat, names[node->custom1], in, out); break; case 4: diff --git a/source/blender/nodes/shader/nodes/node_shader_particle_info.c b/source/blender/nodes/shader/nodes/node_shader_particle_info.c index dc98b7d5f63..05f7301776f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_particle_info.c +++ b/source/blender/nodes/shader/nodes/node_shader_particle_info.c @@ -39,7 +39,7 @@ static bNodeSocketTemplate outputs[] = { { SOCK_VECTOR, 0, "Velocity" }, { SOCK_VECTOR, 0, "Angular Velocity" }, { -1, 0, "" } - }; +}; /* node type definition */ void register_node_type_sh_particle_info(void) diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c index 859636ed4e5..5e863da9635 100644 --- a/source/blender/nodes/texture/node_texture_tree.c +++ b/source/blender/nodes/texture/node_texture_tree.c @@ -283,10 +283,12 @@ void ntreeTexEndExecTree_internal(bNodeTreeExec *exec) void ntreeTexEndExecTree(bNodeTreeExec *exec) { if (exec) { + /* exec may get freed, so assign ntree */ + bNodeTree *ntree = exec->nodetree; ntreeTexEndExecTree_internal(exec); /* XXX clear nodetree backpointer to exec data, same problem as noted in ntreeBeginExecTree */ - exec->nodetree->execdata = NULL; + ntree->execdata = NULL; } } diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c index 0688eb81ff2..8d69d79d847 100644 --- a/source/blender/nodes/texture/nodes/node_texture_math.c +++ b/source/blender/nodes/texture/nodes/node_texture_math.c @@ -184,9 +184,8 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor } default: { - fprintf(stderr, - "%s:%d: unhandeld value in switch statement: %d\n", - __FILE__, __LINE__, node->custom1); + BLI_assert(0); + break; } } } diff --git a/source/blender/nodes/texture/nodes/node_texture_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c index 235cb560a99..37e527f611a 100644 --- a/source/blender/nodes/texture/nodes/node_texture_output.c +++ b/source/blender/nodes/texture/nodes/node_texture_output.c @@ -80,12 +80,13 @@ static void exec(void *data, int UNUSED(thread), bNode *node, bNodeExecData *exe static void unique_name(bNode *node) { TexNodeOutput *tno = (TexNodeOutput *)node->storage; - char *new_name = NULL; + char new_name[sizeof(tno->name)]; int new_len = 0; int suffix; bNode *i; char *name = tno->name; + new_name[0] = '\0'; i = node; while (i->prev) i = i->prev; for (; i; i = i->next) { @@ -96,7 +97,7 @@ static void unique_name(bNode *node) continue; } - if (!new_name) { + if (new_name[0] == '\0') { int len = strlen(name); if (len >= 4 && sscanf(name + len - 4, ".%03d", &suffix) == 1) { new_len = len; @@ -107,17 +108,15 @@ static void unique_name(bNode *node) if (new_len > (sizeof(tno->name) - 1)) new_len = (sizeof(tno->name) - 1); } - - new_name = MEM_mallocN(new_len + 1, "new_name"); - strcpy(new_name, name); + + BLI_strncpy(new_name, name, sizeof(tno->name)); name = new_name; } sprintf(new_name + new_len - 4, ".%03d", ++suffix); } - if (new_name) { - strcpy(tno->name, new_name); - MEM_freeN(new_name); + if (new_name[0] != '\0') { + BLI_strncpy(tno->name, new_name, sizeof(tno->name)); } } diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c index 7ac4dd5d0b7..6c7fc686cc0 100644 --- a/source/blender/python/bmesh/bmesh_py_ops_call.c +++ b/source/blender/python/bmesh/bmesh_py_ops_call.c @@ -507,6 +507,7 @@ static int bpy_slot_from_py(BMesh *bm, BMOperator *bmop, BMOpSlot *slot, PyObjec return -1; } } + /* fall-through */ } default: /* TODO --- many others */ diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index 0db8b07d5f5..0e2fbe8a526 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -1616,7 +1616,7 @@ static PyObject *bpy_bmface_copy(BPy_BMFace *self, PyObject *args, PyObject *kw) return NULL; } - f_cpy = BM_face_copy(bm, self->f, do_verts, do_edges); + f_cpy = BM_face_copy(bm, bm, self->f, do_verts, do_edges); if (f_cpy) { return BPy_BMFace_CreatePyObject(bm, f_cpy); diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c index 64435792ae2..b8572baa7f9 100644 --- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c @@ -499,7 +499,7 @@ static PySequenceMethods bpy_bmdeformvert_as_sequence = { (objobjproc)bpy_bmdeformvert_contains, /* sq_contains */ (binaryfunc) NULL, /* sq_inplace_concat */ (ssizeargfunc) NULL, /* sq_inplace_repeat */ - }; +}; static PyMappingMethods bpy_bmdeformvert_as_mapping = { (lenfunc)bpy_bmdeformvert_len, diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index 85bb8125a3a..fc4b78b5c05 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -1531,7 +1531,7 @@ void IDP_spit(IDProperty *prop) ret_str = PyObject_Repr(ret_dict); Py_DECREF(ret_dict); - printf("IDProperty: %s\n", _PyUnicode_AsString(ret_str)); + printf("IDProperty(%p): %s\n", prop, _PyUnicode_AsString(ret_str)); Py_DECREF(ret_str); diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 76e64ebba6e..9f7c589630a 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -189,7 +189,7 @@ static GHash *id_weakref_pool_get(ID *id) } /* called from pyrna_struct_CreatePyObject() and pyrna_prop_CreatePyObject() */ -void id_weakref_pool_add(ID *id, BPy_DummyPointerRNA *pyrna) +static void id_weakref_pool_add(ID *id, BPy_DummyPointerRNA *pyrna) { PyObject *weakref; PyObject *weakref_capsule; @@ -704,6 +704,7 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop) ret = col_cb; /* return the color instead */ } } + break; default: break; } @@ -776,7 +777,8 @@ static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op) switch (op) { case Py_NE: - ok = !ok; /* pass through */ + ok = !ok; + /* fall-through */ case Py_EQ: res = ok ? Py_False : Py_True; break; @@ -805,7 +807,8 @@ static PyObject *pyrna_prop_richcmp(PyObject *a, PyObject *b, int op) switch (op) { case Py_NE: - ok = !ok; /* pass through */ + ok = !ok; + /* fall-through */ case Py_EQ: res = ok ? Py_False : Py_True; break; @@ -2380,6 +2383,7 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po PyErr_SetString(PyExc_TypeError, "not an array type"); Py_DECREF(tuple); tuple = NULL; + break; } } return tuple; @@ -2719,6 +2723,7 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, default: PyErr_SetString(PyExc_TypeError, "not an array type"); ret = -1; + break; } Py_DECREF(value); @@ -3588,6 +3593,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname) "bpy_struct: Context type invalid %d, can't get \"%.200s\" from context", newtype, name); ret = NULL; + break; } } else if (done == -1) { /* found but not set */ @@ -4863,13 +4869,13 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat ret = Matrix_CreatePyObject(data, 3, 3, Py_NEW, NULL); break; } - /* pass through */ + /* fall-through */ #endif default: ret = PyTuple_New(len); for (a = 0; a < len; a++) PyTuple_SET_ITEM(ret, a, PyFloat_FromDouble(((float *)data)[a])); - + break; } break; default: @@ -7001,21 +7007,23 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, StructRNA *srna, v /* Sneaky workaround to use the class name as the bl_idname */ #define BPY_REPLACEMENT_STRING(rna_attr, py_attr) \ - (STREQ(identifier, rna_attr)) { \ - item = PyObject_GetAttr(py_class, py_attr); \ - if (item && item != Py_None) { \ - if (pyrna_py_to_prop(dummyptr, prop, NULL, \ - item, "validating class:") != 0) \ - { \ - Py_DECREF(item); \ - return -1; \ - } \ - } \ - Py_XDECREF(item); \ - } /* intentionally allow else here */ - - if BPY_REPLACEMENT_STRING("bl_idname", bpy_intern_str___name__) - else if BPY_REPLACEMENT_STRING("bl_description", bpy_intern_str___doc__) + else if (STREQ(identifier, rna_attr)) { \ + if ((item = PyObject_GetAttr(py_class, py_attr))) { \ + if (item != Py_None) { \ + if (pyrna_py_to_prop(dummyptr, prop, NULL, \ + item, "validating class:") != 0) \ + { \ + Py_DECREF(item); \ + return -1; \ + } \ + } \ + Py_DECREF(item); \ + } \ + } /* intentionally allow else here */ + + if (false) {} /* needed for macro */ + BPY_REPLACEMENT_STRING("bl_idname", bpy_intern_str___name__) + BPY_REPLACEMENT_STRING("bl_description", bpy_intern_str___doc__) #undef BPY_REPLACEMENT_STRING diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c index ee5f6109ab8..bb40a21eed9 100644 --- a/source/blender/python/intern/bpy_rna_array.c +++ b/source/blender/python/intern/bpy_rna_array.c @@ -66,7 +66,7 @@ typedef void (*RNA_SetIndexFunc)(PointerRNA *, PropertyRNA *, int index, void *) /* arr[3] = x, self->arraydim is 0, lvalue_dim is 1 */ /* Ensures that a python sequence has expected number of items/sub-items and items are of desired type. */ -static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[], +static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[], const bool is_dynamic, ItemTypeCheckFunc check_item_type, const char *item_type_str, const char *error_prefix) { Py_ssize_t i; @@ -110,7 +110,9 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[] error_prefix, dim + 1, dimsize[dim + 1], item_seq_size); ok = 0; } - else if (validate_array_type(item, dim + 1, totdim, dimsize, check_item_type, item_type_str, error_prefix) == -1) { + else if (validate_array_type(item, dim + 1, totdim, dimsize, is_dynamic, + check_item_type, item_type_str, error_prefix) == -1) + { ok = 0; } @@ -129,7 +131,7 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[] error_prefix, dim + 1, Py_TYPE(seq)->tp_name); return -1; } - else if (seq_size != dimsize[dim]) { + else if ((seq_size != dimsize[dim]) && (is_dynamic == false)) { PyErr_Format(PyExc_ValueError, "%s sequences of dimension %d should contain %d items, not %d", error_prefix, dim, dimsize[dim], seq_size); return -1; @@ -315,8 +317,12 @@ static int validate_array(PyObject *rvalue, PointerRNA *ptr, PropertyRNA *prop, { - if (validate_array_type(rvalue, lvalue_dim, totdim, dimsize, check_item_type, item_type_str, error_prefix) == -1) + const int prop_flag = RNA_property_flag(prop); + if (validate_array_type(rvalue, lvalue_dim, totdim, dimsize, (prop_flag & PROP_DYNAMIC) != 0, + check_item_type, item_type_str, error_prefix) == -1) + { return -1; + } return validate_array_length(rvalue, ptr, prop, lvalue_dim, totitem, error_prefix); } @@ -574,6 +580,7 @@ int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data, default: PyErr_SetString(PyExc_TypeError, "not an array type"); ret = -1; + break; } return ret; @@ -599,6 +606,7 @@ int pyrna_py_to_array_index(PointerRNA *ptr, PropertyRNA *prop, int arraydim, in default: PyErr_SetString(PyExc_TypeError, "not an array type"); ret = -1; + break; } return ret; @@ -621,6 +629,7 @@ PyObject *pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index) default: PyErr_SetString(PyExc_TypeError, "not an array type"); item = NULL; + break; } return item; diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index ae5b381cf59..9c3edec108a 100644 --- a/source/blender/python/mathutils/mathutils_Color.c +++ b/source/blender/python/mathutils/mathutils_Color.c @@ -170,7 +170,8 @@ static PyObject *Color_richcmpr(PyObject *a, PyObject *b, int op) switch (op) { case Py_NE: - ok = !ok; /* pass through */ + ok = !ok; + /* fall-through */ case Py_EQ: res = ok ? Py_False : Py_True; break; diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index 517fd9045e5..6bb3031f0a3 100644 --- a/source/blender/python/mathutils/mathutils_Euler.c +++ b/source/blender/python/mathutils/mathutils_Euler.c @@ -64,7 +64,7 @@ static PyObject *Euler_new(PyTypeObject *type, PyObject *args, PyObject *kwds) case 2: if ((order = euler_order_from_string(order_str, "mathutils.Euler()")) == -1) return NULL; - /* intentionally pass through */ + /* fall-through */ case 1: if (mathutils_array_parse(eul, EULER_SIZE, EULER_SIZE, seq, "mathutils.Euler()") == -1) return NULL; @@ -356,7 +356,8 @@ static PyObject *Euler_richcmpr(PyObject *a, PyObject *b, int op) switch (op) { case Py_NE: - ok = !ok; /* pass through */ + ok = !ok; + /* fall-through */ case Py_EQ: res = ok ? Py_False : Py_True; break; diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 26793139227..d471cd05a2b 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -371,6 +371,7 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) } } } + break; } } @@ -1752,7 +1753,8 @@ static PyObject *Matrix_richcmpr(PyObject *a, PyObject *b, int op) switch (op) { case Py_NE: - ok = !ok; /* pass through */ + ok = !ok; + /* fall-through */ case Py_EQ: res = ok ? Py_False : Py_True; break; diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index a3f6b3f7c79..b0b818faaa0 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -529,7 +529,8 @@ static PyObject *Quaternion_richcmpr(PyObject *a, PyObject *b, int op) switch (op) { case Py_NE: - ok = !ok; /* pass through */ + ok = !ok; + /* fall-through */ case Py_EQ: res = ok ? Py_False : Py_True; break; diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index ab83a11e797..8509c46b395 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -720,8 +720,8 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje return NULL; } else { - short use_a = TRUE; - short use_b = TRUE; + bool use_a = true; + bool use_b = true; float lambda; PyObject *ret = PyTuple_New(2); @@ -729,15 +729,16 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje switch (isect_line_sphere_v3(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) { case 1: if (!(!clip || (((lambda = line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE; - use_b = FALSE; + use_b = false; break; case 2: if (!(!clip || (((lambda = line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE; if (!(!clip || (((lambda = line_point_factor_v3(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b = FALSE; break; default: - use_a = FALSE; - use_b = FALSE; + use_a = false; + use_b = false; + break; } if (use_a) { PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(isect_a, 3, Py_NEW, NULL)); } @@ -811,6 +812,7 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO default: use_a = false; use_b = false; + break; } if (use_a) { PyTuple_SET_ITEM(ret, 0, Vector_CreatePyObject(isect_a, 2, Py_NEW, NULL)); } diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c index ce4f3063082..52ef21e4f39 100644 --- a/source/blender/quicktime/apple/quicktime_export.c +++ b/source/blender/quicktime/apple/quicktime_export.c @@ -768,7 +768,7 @@ int get_qtcodec_settings(RenderData *rd, ReportList *reports) return err; } -static int request_qtcodec_settings(bContext *C, wmOperator *op) +static int request_qtcodec_settings_exec(bContext *C, wmOperator *op) { OSErr err = noErr; Scene *scene = CTX_data_scene(C); @@ -893,11 +893,11 @@ static int ED_operator_setqtcodec(bContext *C) #if defined(__APPLE__) && defined(GHOST_COCOA) /* Need to set up a Cocoa NSAutoReleasePool to avoid memory leak * And it must be done in an objC file, so use a GHOST_SystemCocoa.mm function for that */ -extern int cocoa_request_qtcodec_settings(bContext *C, wmOperator *op); +extern int cocoa_request_qtcodec_settings_exec(bContext *C, wmOperator *op); int fromcocoa_request_qtcodec_settings(bContext *C, wmOperator *op) { - return request_qtcodec_settings(C, op); + return request_qtcodec_settings_exec(C, op); } #endif @@ -911,9 +911,9 @@ void SCENE_OT_render_data_set_quicktime_codec(wmOperatorType *ot) /* api callbacks */ #if defined(__APPLE__) && defined(GHOST_COCOA) - ot->exec = cocoa_request_qtcodec_settings; + ot->exec = cocoa_request_qtcodec_settings_exec; #else - ot->exec = request_qtcodec_settings; + ot->exec = request_qtcodec_settings_exec; #endif ot->poll = ED_operator_setqtcodec; diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h index b6c3668512b..7bec3eb234d 100644 --- a/source/blender/render/extern/include/RE_engine.h +++ b/source/blender/render/extern/include/RE_engine.h @@ -57,6 +57,7 @@ struct Scene; #define RE_USE_POSTPROCESS 8 #define RE_USE_SHADING_NODES 16 #define RE_USE_EXCLUDE_LAYERS 32 +#define RE_USE_SAVE_BUFFERS 64 /* RenderEngine.flag */ #define RE_ENGINE_ANIMATION 1 @@ -70,6 +71,7 @@ struct Scene; /* RenderEngine.update_flag, used by internal now */ #define RE_ENGINE_UPDATE_MA 1 #define RE_ENGINE_UPDATE_OTHER 2 +#define RE_ENGINE_UPDATE_DATABASE 4 extern ListBase R_engines; @@ -97,7 +99,7 @@ typedef struct RenderEngine { RenderEngineType *type; void *py_instance; - int flag, update_flag; + int flag; struct Object *camera_override; int tile_x; @@ -105,11 +107,20 @@ typedef struct RenderEngine { struct Render *re; ListBase fullresult; - char *text; + char text[512]; /* IMA_MAX_RENDER_TEXT */ int resolution_x, resolution_y; struct ReportList *reports; + + /* for blender internal only */ + int update_flag; + int job_update_flag; + + rctf last_viewplane; + rcti last_disprect; + float last_viewmat[4][4]; + int last_winx, last_winy; } RenderEngine; RenderEngine *RE_engine_create(RenderEngineType *type); diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index da53bc5a819..e154fd42119 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -207,6 +207,7 @@ void RE_GetViewPlane(struct Render *re, rctf *viewplane, rcti *disprect); /* make or free the dbase */ void RE_Database_FromScene(struct Render *re, struct Main *bmain, struct Scene *scene, unsigned int lay, int use_camera_view); +void RE_Database_Preprocess(struct Render *re); void RE_Database_Free(struct Render *re); /* project dbase again, when viewplane/perspective changed */ diff --git a/source/blender/render/extern/include/RE_shader_ext.h b/source/blender/render/extern/include/RE_shader_ext.h index d686de21517..19ddfb7a13d 100644 --- a/source/blender/render/extern/include/RE_shader_ext.h +++ b/source/blender/render/extern/include/RE_shader_ext.h @@ -196,12 +196,13 @@ struct ImBuf; struct ImagePool; /* this one uses nodes */ -int multitex_ext(struct Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, struct TexResult *texres, struct ImagePool *pool); +int multitex_ext(struct Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, struct TexResult *texres, struct ImagePool *pool, bool scene_color_manage); /* nodes disabled */ -int multitex_ext_safe(struct Tex *tex, float texvec[3], struct TexResult *texres, struct ImagePool *pool); +int multitex_ext_safe(struct Tex *tex, float texvec[3], struct TexResult *texres, struct ImagePool *pool, bool scene_color_manage); /* only for internal node usage */ int multitex_nodes(struct Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, struct TexResult *texres, - const short thread, short which_output, struct ShadeInput *shi, struct MTex *mtex, struct ImagePool *pool); + const short thread, short which_output, struct ShadeInput *shi, struct MTex *mtex, + struct ImagePool *pool); /* shaded view and bake */ struct Render; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 29555756f9f..3087086764b 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -803,7 +803,7 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[4][4], int totvert= obr->totvert; /* we now test all vertices, when faces have a normal too much different: they get a new vertex */ for (a=0, asv=asverts; a<totvert; a++, asv++) { - if (asv && asv->totface>1) { + if (asv->totface > 1) { ver= RE_findOrAddVert(obr, a); asf= asv->faces.first; @@ -3478,9 +3478,14 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset) ma= give_render_material(re, ob, a1+1); /* test for 100% transparent */ - ok= 1; - if (ma->alpha==0.0f && ma->spectra==0.0f && ma->spectra==0.0f && ma->filter==0.0f && (ma->mode & MA_TRANSP) && (ma->mode & (MA_RAYTRANSP | MA_RAYMIRROR))==0 ) { - ok= 0; + ok = 1; + if ((ma->alpha == 0.0f) && + (ma->spectra == 0.0f) && + (ma->filter == 0.0f) && + (ma->mode & MA_TRANSP) && + (ma->mode & (MA_RAYTRANSP | MA_RAYMIRROR)) == 0) + { + ok = 0; /* texture on transparency? */ for (a=0; a<MAX_MTEX; a++) { if (ma->mtex[a] && ma->mtex[a]->tex) { @@ -4149,10 +4154,15 @@ static void set_renderlayer_lightgroups(Render *re, Scene *sce) void init_render_world(Render *re) { + void *wrld_prev[2] = { + re->wrld.aotables, + re->wrld.aosphere, + }; + int a; if (re->scene && re->scene->world) { - re->wrld= *(re->scene->world); + re->wrld = *(re->scene->world); copy_v3_v3(re->grvec, re->viewmat[2]); normalize_v3(re->grvec); @@ -4181,6 +4191,10 @@ void init_render_world(Render *re) re->wrld.linfac= 1.0f + powf((2.0f*re->wrld.exp + 0.5f), -10); re->wrld.logfac= logf((re->wrld.linfac-1.0f)/re->wrld.linfac) / re->wrld.range; + + /* restore runtime vars, needed for viewport rendering [#36005] */ + re->wrld.aotables = wrld_prev[0]; + re->wrld.aosphere = wrld_prev[1]; } @@ -4854,7 +4868,11 @@ static void init_render_object(Render *re, Object *ob, Object *par, DupliObject void RE_Database_Free(Render *re) { LampRen *lar; - + + /* will crash if we try to free empty database */ + if (!re->i.convertdone) + return; + /* statistics for debugging render memory usage */ if ((G.debug & G_DEBUG) && (G.is_rendering)) { if ((re->r.scemode & (R_BUTS_PREVIEW|R_VIEWPORT_PREVIEW))==0) { @@ -4894,13 +4912,13 @@ void RE_Database_Free(Render *re) if (re->wrld.aosphere) { MEM_freeN(re->wrld.aosphere); re->wrld.aosphere= NULL; - if (re->scene) + if (re->scene && re->scene->world) re->scene->world->aosphere= NULL; } if (re->wrld.aotables) { MEM_freeN(re->wrld.aotables); re->wrld.aotables= NULL; - if (re->scene) + if (re->scene && re->scene->world) re->scene->world->aotables= NULL; } if (re->r.mode & R_RAYTRACE) @@ -5247,6 +5265,9 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l re->main= bmain; re->scene= scene; re->lay= lay; + + if (re->r.scemode & R_VIEWPORT_PREVIEW) + re->scene_color_manage = BKE_scene_check_color_management_enabled(scene); /* scene needs to be set to get camera */ camera= RE_GetCamera(re); @@ -5309,14 +5330,10 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l database_init_objects(re, lay, 0, 0, 0, 0); if (!re->test_break(re->tbh)) { - int tothalo; - set_material_lightgroups(re); for (sce= re->scene; sce; sce= sce->set) set_renderlayer_lightgroups(re, sce); - slurph_opt= 1; - /* for now some clumsy copying still */ re->i.totvert= re->totvert; re->i.totface= re->totvlak; @@ -5324,7 +5341,16 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l re->i.tothalo= re->tothalo; re->i.totlamp= re->totlamp; re->stats_draw(re->sdh, &re->i); - + } + + slurph_opt= 1; +} + +void RE_Database_Preprocess(Render *re) +{ + if (!re->test_break(re->tbh)) { + int tothalo; + /* don't sort stars */ tothalo= re->tothalo; if (!re->test_break(re->tbh)) { @@ -5380,13 +5406,12 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l if (!re->test_break(re->tbh)) if (re->r.mode & R_RAYTRACE) volume_precache(re); - } + re->i.convertdone = TRUE; + if (re->test_break(re->tbh)) RE_Database_Free(re); - else - re->i.convertdone = TRUE; re->i.infostr = NULL; re->stats_draw(re->sdh, &re->i); @@ -5836,6 +5861,7 @@ void RE_Database_FromScene_Vectors(Render *re, Main *bmain, Scene *sce, unsigned /* free dbase and make the future one */ strandsurface= re->strandsurface; memset(&re->strandsurface, 0, sizeof(ListBase)); + re->i.convertdone = TRUE; RE_Database_Free(re); re->strandsurface= strandsurface; @@ -5851,11 +5877,14 @@ void RE_Database_FromScene_Vectors(Render *re, Main *bmain, Scene *sce, unsigned /* free dbase and make the real one */ strandsurface= re->strandsurface; memset(&re->strandsurface, 0, sizeof(ListBase)); + re->i.convertdone = TRUE; RE_Database_Free(re); re->strandsurface= strandsurface; - if (!re->test_break(re->tbh)) + if (!re->test_break(re->tbh)) { RE_Database_FromScene(re, bmain, sce, lay, 1); + RE_Database_Preprocess(re); + } if (!re->test_break(re->tbh)) { int vectorlay= get_vector_renderlayers(re->scene); @@ -6057,4 +6086,6 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay, if (re->wrld.ao_gather_method == WO_AOGATHER_APPROX) if (re->r.mode & R_SHADOW) make_occ_tree(re); + + re->i.convertdone = true; } diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 3111c4c079e..3cd9020fb89 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -722,6 +722,10 @@ int envmaptex(Tex *tex, const float texvec[3], float dxt[3], float dyt[3], int o envmap_split_ima(env, ibuf_ima); else env->ok = 0; + + if (env->type == ENV_PLANE) + tex->extend = TEX_EXTEND; + BKE_image_pool_release_ibuf(env->ima, ibuf_ima, pool); } } diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c index 551f3686370..ea22423985b 100644 --- a/source/blender/render/intern/source/external_engine.c +++ b/source/blender/render/intern/source/external_engine.c @@ -158,9 +158,6 @@ void RE_engine_free(RenderEngine *engine) BLI_end_threaded_malloc(); } - if (engine->text) - MEM_freeN(engine->text); - MEM_freeN(engine); } @@ -253,8 +250,14 @@ void RE_engine_end_result(RenderEngine *engine, RenderResult *result, int cancel /* for exr tile render, detect tiles that are done */ RenderPart *pa = get_part_from_result(re, result); - if (pa) + if (pa) { pa->status = PART_STATUS_READY; + } + else if (re->result->do_exr_tile) { + /* if written result does not match any tile and we are using save + * buffers, we are going to get openexr save errors */ + fprintf(stderr, "RenderEngine.end_result: dimensions do not match any OpenEXR tile.\n"); + } if (re->result->do_exr_tile) render_result_exr_file_merge(re->result, result); @@ -301,17 +304,14 @@ void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char } /* set engine text */ - if (engine->text) { - MEM_freeN(engine->text); - engine->text = NULL; - } + engine->text[0] = '\0'; if (stats && stats[0] && info && info[0]) - engine->text = BLI_sprintfN("%s | %s", stats, info); + BLI_snprintf(engine->text, sizeof(engine->text), "%s | %s", stats, info); else if (info && info[0]) - engine->text = BLI_strdup(info); + BLI_strncpy(engine->text, info, sizeof(engine->text)); else if (stats && stats[0]) - engine->text = BLI_strdup(stats); + BLI_strncpy(engine->text, stats, sizeof(engine->text)); } void RE_engine_update_progress(RenderEngine *engine, float progress) @@ -438,12 +438,13 @@ int RE_engine_render(Render *re, int do_all) /* create render result */ BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE); if (re->result == NULL || !(re->r.scemode & R_BUTS_PREVIEW)) { - int savebuffers; + int savebuffers = RR_USE_MEM; if (re->result) render_result_free(re->result); - savebuffers = (re->r.scemode & R_EXR_TILE_FILE) ? RR_USE_EXR : RR_USE_MEM; + if ((type->flag & RE_USE_SAVE_BUFFERS) && (re->r.scemode & R_EXR_TILE_FILE)) + savebuffers = RR_USE_EXR; re->result = render_result_new(re, &re->disprect, 0, savebuffers, RR_ALL_LAYERS); } BLI_rw_mutex_unlock(&re->resultmutex); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index f7d347e8a5a..848e94c8d4b 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1142,10 +1142,13 @@ static void do_render_3d(Render *re) re->draw_lock(re->dlh, 1); /* make render verts/faces/halos/lamps */ - if (render_scene_needs_vector(re)) + if (render_scene_needs_vector(re)) { RE_Database_FromScene_Vectors(re, re->main, re->scene, re->lay); - else + } + else { RE_Database_FromScene(re, re->main, re->scene, re->lay, 1); + RE_Database_Preprocess(re); + } /* clear UI drawing locks */ if (re->draw_lock) @@ -1676,6 +1679,9 @@ static void add_freestyle(Render *re, int render) } FRS_finish_stroke_rendering(re); + + /* restore the global R value (invalidated by nested execution of the internal renderer) */ + R = *re; } /* merges the results of Freestyle stroke rendering into a given render result */ diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index a444588d627..ad923a4172c 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -409,7 +409,7 @@ static int marble(Tex *tex, const float texvec[3], TexResult *texres) static int magic(Tex *tex, const float texvec[3], TexResult *texres) { - float x, y, z, turb=1.0; + float x, y, z, turb; int n; n= tex->noisedepth; @@ -1212,9 +1212,9 @@ static int multitex(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int o return retval; } -/* this is called from the shader and texture nodes */ -int multitex_nodes(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, - const short thread, short which_output, ShadeInput *shi, MTex *mtex, struct ImagePool *pool) +static int multitex_nodes_intern(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, + const short thread, short which_output, ShadeInput *shi, MTex *mtex, struct ImagePool *pool, + bool scene_color_manage) { if (tex==NULL) { memset(texres, 0, sizeof(TexResult)); @@ -1236,7 +1236,7 @@ int multitex_nodes(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int os ImBuf *ibuf = BKE_image_pool_acquire_ibuf(tex->ima, &tex->iuser, pool); /* don't linearize float buffers, assumed to be linear */ - if (ibuf && !(ibuf->rect_float) && R.scene_color_manage) + if (ibuf && !(ibuf->rect_float) && scene_color_manage) IMB_colormanagement_colorspace_to_scene_linear_v3(&texres->tr, ibuf->rect_colorspace); BKE_image_pool_release_ibuf(tex->ima, ibuf, pool); @@ -1269,7 +1269,7 @@ int multitex_nodes(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int os ImBuf *ibuf = BKE_image_pool_acquire_ibuf(tex->ima, &tex->iuser, pool); /* don't linearize float buffers, assumed to be linear */ - if (ibuf && !(ibuf->rect_float) && R.scene_color_manage) + if (ibuf && !(ibuf->rect_float) && scene_color_manage) IMB_colormanagement_colorspace_to_scene_linear_v3(&texres->tr, ibuf->rect_colorspace); BKE_image_pool_release_ibuf(tex->ima, ibuf, pool); @@ -1283,6 +1283,16 @@ int multitex_nodes(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int os } } +/* this is called from the shader and texture nodes + * Use it from render pipeline only! + */ +int multitex_nodes(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, + const short thread, short which_output, ShadeInput *shi, MTex *mtex, struct ImagePool *pool) +{ + return multitex_nodes_intern(tex, texvec, dxt, dyt, osatex, texres, + thread, which_output, shi, mtex, pool, R.scene_color_manage); +} + /* this is called for surface shading */ static int multitex_mtex(ShadeInput *shi, MTex *mtex, float texvec[3], float dxt[3], float dyt[3], TexResult *texres, struct ImagePool *pool) { @@ -1300,19 +1310,25 @@ static int multitex_mtex(ShadeInput *shi, MTex *mtex, float texvec[3], float dxt } /* Warning, if the texres's values are not declared zero, check the return value to be sure - * the color values are set before using the r/g/b values, otherwise you may use uninitialized values - Campbell */ -int multitex_ext(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, struct ImagePool *pool) + * the color values are set before using the r/g/b values, otherwise you may use uninitialized values - Campbell + * + * Use it for stuff which is out of render pipeline. + */ +int multitex_ext(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, struct ImagePool *pool, bool scene_color_manage) { - return multitex_nodes(tex, texvec, dxt, dyt, osatex, texres, 0, 0, NULL, NULL, pool); + return multitex_nodes_intern(tex, texvec, dxt, dyt, osatex, texres, 0, 0, NULL, NULL, pool, scene_color_manage); } -/* extern-tex doesn't support nodes (ntreeBeginExec() can't be called when rendering is going on) */ -int multitex_ext_safe(Tex *tex, float texvec[3], TexResult *texres, struct ImagePool *pool) +/* extern-tex doesn't support nodes (ntreeBeginExec() can't be called when rendering is going on)\ + * + * Use it for stuff which is out of render pipeline. + */ +int multitex_ext_safe(Tex *tex, float texvec[3], TexResult *texres, struct ImagePool *pool, bool scene_color_manage) { int use_nodes= tex->use_nodes, retval; tex->use_nodes = FALSE; - retval= multitex_nodes(tex, texvec, NULL, NULL, 0, texres, 0, 0, NULL, NULL, pool); + retval= multitex_nodes_intern(tex, texvec, NULL, NULL, 0, texres, 0, 0, NULL, NULL, pool, scene_color_manage); tex->use_nodes= use_nodes; return retval; diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index f7cd382dc91..76fb88c8d25 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -187,6 +187,8 @@ __attribute__ ((format(printf, 3, 4))) ; void wm_event_add(struct wmWindow *win, const struct wmEvent *event_to_add); +void wm_event_init_from_window(struct wmWindow *win, struct wmEvent *event); + /* at maximum, every timestep seconds it triggers event_type events */ struct wmTimer *WM_event_add_timer(struct wmWindowManager *wm, struct wmWindow *win, int event_type, double timestep); @@ -252,7 +254,7 @@ void WM_operator_properties_border(struct wmOperatorType *ot); void WM_operator_properties_border_to_rcti(struct wmOperator *op, struct rcti *rect); void WM_operator_properties_gesture_border(struct wmOperatorType *ot, bool extend); void WM_operator_properties_mouse_select(struct wmOperatorType *ot); -void WM_operator_properties_gesture_straightline(struct wmOperatorType *ot, bool cursor); +void WM_operator_properties_gesture_straightline(struct wmOperatorType *ot, int cursor); void WM_operator_properties_select_all(struct wmOperatorType *ot); void WM_operator_properties_select_action(struct wmOperatorType *ot, int default_action); @@ -404,6 +406,9 @@ void WM_jobs_kill_type(struct wmWindowManager *wm, int job_type); int WM_jobs_has_running(struct wmWindowManager *wm); +void WM_job_main_thread_lock_acquire(struct wmJob *job); +void WM_job_main_thread_lock_release(struct wmJob *job); + /* clipboard */ char *WM_clipboard_text_get(int selection); void WM_clipboard_text_set(char *buf, int selection); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index dc2f19eded7..b4f193bdbe6 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -132,6 +132,14 @@ void wm_event_free_all(wmWindow *win) } } +void wm_event_init_from_window(wmWindow *win, wmEvent *event) +{ + /* make sure we don't copy any owned pointers */ + BLI_assert(win->eventstate->tablet_data == NULL); + + *event = *(win->eventstate); +} + /* ********************* notifiers, listeners *************** */ static int wm_test_duplicate_notifier(wmWindowManager *wm, unsigned int type, void *reference) @@ -274,7 +282,7 @@ void wm_event_do_notifiers(bContext *C) } if (note->window == win || - (note->window == NULL && (note->reference == NULL || note->reference == CTX_data_scene(C)))) + (note->window == NULL && (note->reference == NULL || note->reference == win->screen->scene))) { if (note->category == NC_SCENE) { if (note->data == ND_FRAME) @@ -282,7 +290,7 @@ void wm_event_do_notifiers(bContext *C) } } if (ELEM5(note->category, NC_SCENE, NC_OBJECT, NC_GEOM, NC_SCENE, NC_WM)) { - ED_info_stats_clear(CTX_data_scene(C)); + ED_info_stats_clear(win->screen->scene); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO, NULL); } } @@ -445,7 +453,9 @@ static void wm_handler_ui_cancel(bContext *C) nexthandler = handler->next; if (handler->ui_handle) { - wmEvent event = *(win->eventstate); + wmEvent event; + + wm_event_init_from_window(win, &event); event.type = EVT_BUT_CANCEL; handler->ui_handle(C, &event, handler->ui_userdata); } @@ -972,7 +982,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, WM_operator_last_properties_init(op); } - if ((G.debug & G_DEBUG_HANDLERS) && event && event->type != MOUSEMOVE) { + if ((G.debug & G_DEBUG_HANDLERS) && ((event == NULL) || (event->type != MOUSEMOVE))) { printf("%s: handle evt %d win %d op %s\n", __func__, event ? event->type : 0, CTX_wm_screen(C)->subwinactive, ot->idname); } @@ -1116,6 +1126,7 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA break; default: event = NULL; + break; } switch (context) { @@ -1362,40 +1373,17 @@ int WM_userdef_event_map(int kmitype) { switch (kmitype) { case SELECTMOUSE: - if (U.flag & USER_LMOUSESELECT) - return LEFTMOUSE; - else - return RIGHTMOUSE; - + return (U.flag & USER_LMOUSESELECT) ? LEFTMOUSE : RIGHTMOUSE; case ACTIONMOUSE: - if (U.flag & USER_LMOUSESELECT) - return RIGHTMOUSE; - else - return LEFTMOUSE; - - case WHEELOUTMOUSE: - if (U.uiflag & USER_WHEELZOOMDIR) - return WHEELUPMOUSE; - else - return WHEELDOWNMOUSE; - - case WHEELINMOUSE: - if (U.uiflag & USER_WHEELZOOMDIR) - return WHEELDOWNMOUSE; - else - return WHEELUPMOUSE; - + return (U.flag & USER_LMOUSESELECT) ? RIGHTMOUSE : LEFTMOUSE; case EVT_TWEAK_A: - if (U.flag & USER_LMOUSESELECT) - return EVT_TWEAK_R; - else - return EVT_TWEAK_L; - + return (U.flag & USER_LMOUSESELECT) ? EVT_TWEAK_R : EVT_TWEAK_L; case EVT_TWEAK_S: - if (U.flag & USER_LMOUSESELECT) - return EVT_TWEAK_L; - else - return EVT_TWEAK_R; + return (U.flag & USER_LMOUSESELECT) ? EVT_TWEAK_L : EVT_TWEAK_R; + case WHEELOUTMOUSE: + return (U.uiflag & USER_WHEELZOOMDIR) ? WHEELUPMOUSE : WHEELDOWNMOUSE; + case WHEELINMOUSE: + return (U.uiflag & USER_WHEELZOOMDIR) ? WHEELDOWNMOUSE : WHEELUPMOUSE; } return kmitype; @@ -1638,8 +1626,8 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa ED_fileselect_set_params(sfile); action = WM_HANDLER_BREAK; + break; } - break; case EVT_FILESELECT_EXEC: case EVT_FILESELECT_CANCEL: @@ -1734,8 +1722,8 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa wm_event_free_handler(handler); action = WM_HANDLER_BREAK; + break; } - break; } return action; diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c index 03af5e9e8a6..c6e067dc2f9 100644 --- a/source/blender/windowmanager/intern/wm_jobs.c +++ b/source/blender/windowmanager/intern/wm_jobs.c @@ -128,8 +128,43 @@ struct wmJob { ListBase threads; double start_time; + + /* ticket mutex for main thread locking while some job accesses + * data that the main thread might modify at the same time */ + TicketMutex *main_thread_mutex; + bool main_thread_mutex_ending; }; +/* Main thread locking */ + +void WM_job_main_thread_lock_acquire(wmJob *wm_job) +{ + BLI_ticket_mutex_lock(wm_job->main_thread_mutex); + + /* if BLI_end_threads is being called to stop the job before it's finished, + * we no longer need to lock to get access to the main thread as it's + * waiting and can't respond */ + if (wm_job->main_thread_mutex_ending) + BLI_ticket_mutex_unlock(wm_job->main_thread_mutex); +} + +void WM_job_main_thread_lock_release(wmJob *wm_job) +{ + if (!wm_job->main_thread_mutex_ending) + BLI_ticket_mutex_unlock(wm_job->main_thread_mutex); +} + +static void wm_job_main_thread_yield(wmJob *wm_job, bool ending) +{ + if (ending) + wm_job->main_thread_mutex_ending = true; + + /* unlock and lock the ticket mutex. because it's a fair mutex any job that + * is waiting to acquire the lock will get it first, before we can lock */ + BLI_ticket_mutex_unlock(wm_job->main_thread_mutex); + BLI_ticket_mutex_lock(wm_job->main_thread_mutex); +} + /* finds: * if type, compare for it, otherwise any matching job */ @@ -162,13 +197,16 @@ wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char * if (wm_job == NULL) { wm_job = MEM_callocN(sizeof(wmJob), "new job"); - + BLI_addtail(&wm->jobs, wm_job); wm_job->win = win; wm_job->owner = owner; wm_job->flag = flag; wm_job->job_type = job_type; BLI_strncpy(wm_job->name, name, sizeof(wm_job->name)); + + wm_job->main_thread_mutex = BLI_ticket_mutex_alloc(); + BLI_ticket_mutex_lock(wm_job->main_thread_mutex); } /* else: a running job, be careful */ @@ -369,12 +407,21 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job) } } +static void wm_job_free(wmWindowManager *wm, wmJob *wm_job) +{ + BLI_remlink(&wm->jobs, wm_job); + BLI_ticket_mutex_unlock(wm_job->main_thread_mutex); + BLI_ticket_mutex_free(wm_job->main_thread_mutex); + MEM_freeN(wm_job); +} + /* stop job, end thread, free data completely */ static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *wm_job) { if (wm_job->running) { /* signal job to end */ wm_job->stop = TRUE; + wm_job_main_thread_yield(wm_job, true); BLI_end_threads(&wm_job->threads); if (wm_job->endjob) @@ -389,9 +436,7 @@ static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *wm_job) wm_job->run_free(wm_job->run_customdata); /* remove wm_job */ - BLI_remlink(&wm->jobs, wm_job); - MEM_freeN(wm_job); - + wm_job_free(wm, wm_job); } /* wait until every job ended */ @@ -483,7 +528,6 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt) float total_progress = 0.f; float jobs_progress = 0; - for (wm_job = wm->jobs.first; wm_job; wm_job = wm_jobnext) { wm_jobnext = wm_job->next; @@ -491,6 +535,9 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt) /* running threads */ if (wm_job->threads.first) { + + /* let threads get temporary lock over main thread if needed */ + wm_job_main_thread_yield(wm_job, false); /* always call note and update when ready */ if (wm_job->do_update || wm_job->ready) { @@ -522,7 +569,9 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt) } wm_job->running = FALSE; + wm_job_main_thread_yield(wm_job, true); BLI_end_threads(&wm_job->threads); + wm_job->main_thread_mutex_ending = false; if (wm_job->endnote) WM_event_add_notifier(C, wm_job->endnote, NULL); @@ -539,8 +588,7 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt) wm_job->wt = NULL; /* remove wm_job */ - BLI_remlink(&wm->jobs, wm_job); - MEM_freeN(wm_job); + wm_job_free(wm, wm_job); } } else if (wm_job->flag & WM_JOB_PROGRESS) { diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 13230f48a15..ff805579b44 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -795,6 +795,7 @@ const char *WM_key_event_string(short type) int WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, const int len) { char buf[128]; + char *p = buf; buf[0] = 0; @@ -803,28 +804,28 @@ int WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, const int len) kmi->alt == KM_ANY && kmi->oskey == KM_ANY) { - strcat(buf, "Any "); + p += BLI_strcpy_rlen(p, "Any "); } else { if (kmi->shift) - strcat(buf, "Shift "); + p += BLI_strcpy_rlen(p, "Shift "); if (kmi->ctrl) - strcat(buf, "Ctrl "); + p += BLI_strcpy_rlen(p, "Ctrl "); if (kmi->alt) - strcat(buf, "Alt "); + p += BLI_strcpy_rlen(p, "Alt "); if (kmi->oskey) - strcat(buf, "Cmd "); + p += BLI_strcpy_rlen(p, "Cmd "); } if (kmi->keymodifier) { - strcat(buf, WM_key_event_string(kmi->keymodifier)); - strcat(buf, " "); + p += BLI_strcpy_rlen(p, WM_key_event_string(kmi->keymodifier)); + p += BLI_strcpy_rlen(p, " "); } - strcat(buf, WM_key_event_string(kmi->type)); + p += BLI_strcpy_rlen(p, WM_key_event_string(kmi->type)); return BLI_strncpy_rlen(str, buf, len); } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 9e0cb6a1d38..f1a9f6dc007 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -307,14 +307,9 @@ static int wm_macro_modal(bContext *C, wmOperator *op, const wmEvent *event) /* if new operator is modal and also added its own handler */ if (retval & OPERATOR_RUNNING_MODAL && op->opm != opm) { wmWindow *win = CTX_wm_window(C); - wmEventHandler *handler = NULL; - - for (handler = win->modalhandlers.first; handler; handler = handler->next) { - /* first handler in list is the new one */ - if (handler->op == op) - break; - } + wmEventHandler *handler; + handler = BLI_findptr(&win->modalhandlers, op, offsetof(wmEventHandler, op)); if (handler) { BLI_remlink(&win->modalhandlers, handler); wm_event_free_handler(handler); @@ -495,7 +490,7 @@ void WM_operator_py_idname(char *to, const char *from) BLI_ascii_strtolower(to, ofs); to[ofs] = '.'; - BLI_strncpy(to + (ofs + 1), sep + 4, OP_MAX_TYPENAME); + BLI_strncpy(to + (ofs + 1), sep + 4, OP_MAX_TYPENAME - (ofs + 1)); } else { /* should not happen but support just in case */ @@ -514,9 +509,8 @@ void WM_operator_bl_idname(char *to, const char *from) memcpy(to, from, sizeof(char) * ofs); BLI_ascii_strtoupper(to, ofs); - - BLI_strncpy(to + ofs, "_OT_", OP_MAX_TYPENAME); - BLI_strncpy(to + (ofs + 4), sep + 1, OP_MAX_TYPENAME); + strcpy(to + ofs, "_OT_"); + strcpy(to + (ofs + 4), sep + 1); } else { /* should not happen but support just in case */ @@ -984,7 +978,7 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg_op) uiPopupBoundsBlock(block, 6, 0, -UI_UNIT_Y); /* move it downwards, mouse over button */ uiEndBlock(C, block); - event = *(win->eventstate); /* XXX huh huh? make api call */ + wm_event_init_from_window(win, &event); event.type = EVT_BUT_OPEN; event.val = KM_PRESS; event.customdata = but; @@ -1175,7 +1169,7 @@ void WM_operator_properties_mouse_select(wmOperatorType *ot) RNA_def_boolean(ot->srna, "toggle", 0, "Toggle Selection", "Toggle the selection"); } -void WM_operator_properties_gesture_straightline(wmOperatorType *ot, bool cursor) +void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor) { RNA_def_int(ot->srna, "xstart", 0, INT_MIN, INT_MAX, "X Start", "", INT_MIN, INT_MAX); RNA_def_int(ot->srna, "xend", 0, INT_MIN, INT_MAX, "X End", "", INT_MIN, INT_MAX); @@ -1757,7 +1751,7 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_ uiPopupBoundsBlock(block, 6, 0, -UI_UNIT_Y); /* move it downwards, mouse over button */ uiEndBlock(C, block); - event = *(win->eventstate); /* XXX huh huh? make api call */ + wm_event_init_from_window(win, &event); event.type = EVT_BUT_OPEN; event.val = KM_PRESS; event.customdata = but; @@ -1880,6 +1874,7 @@ static void WM_OT_userpref_autoexec_path_add(wmOperatorType *ot) { ot->name = "Add Autoexec Path"; ot->idname = "WM_OT_userpref_autoexec_path_add"; + ot->description = "Add path to exclude from autoexecution"; ot->exec = wm_userpref_autoexec_add_exec; ot->poll = WM_operator_winactive; @@ -1901,6 +1896,7 @@ static void WM_OT_userpref_autoexec_path_remove(wmOperatorType *ot) { ot->name = "Remove Autoexec Path"; ot->idname = "WM_OT_userpref_autoexec_path_remove"; + ot->description = "Remove path to exclude from autoexecution"; ot->exec = wm_userpref_autoexec_remove_exec; ot->poll = WM_operator_winactive; @@ -2618,7 +2614,7 @@ static void WM_OT_window_fullscreen_toggle(wmOperatorType *ot) ot->poll = WM_operator_winactive; } -static int wm_exit_blender_op(bContext *C, wmOperator *op) +static int wm_exit_blender_exec(bContext *C, wmOperator *op) { WM_operator_free(op); @@ -2634,7 +2630,7 @@ static void WM_OT_quit_blender(wmOperatorType *ot) ot->description = "Quit Blender"; ot->invoke = WM_operator_confirm; - ot->exec = wm_exit_blender_op; + ot->exec = wm_exit_blender_exec; ot->poll = WM_operator_winactive; } @@ -2642,7 +2638,7 @@ static void WM_OT_quit_blender(wmOperatorType *ot) #if defined(WIN32) -static int wm_console_toggle_op(bContext *UNUSED(C), wmOperator *UNUSED(op)) +static int wm_console_toggle_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) { GHOST_toggleConsole(2); return OPERATOR_FINISHED; @@ -2655,7 +2651,7 @@ static void WM_OT_console_toggle(wmOperatorType *ot) ot->idname = "WM_OT_console_toggle"; ot->description = N_("Toggle System Console"); - ot->exec = wm_console_toggle_op; + ot->exec = wm_console_toggle_exec; ot->poll = WM_operator_winactive; } @@ -2992,7 +2988,7 @@ static void tweak_gesture_modal(bContext *C, const wmEvent *event) if ((val = wm_gesture_evaluate(gesture))) { wmEvent tevent; - tevent = *(window->eventstate); + wm_event_init_from_window(window, &tevent); if (gesture->event_type == LEFTMOUSE) tevent.type = EVT_TWEAK_L; else if (gesture->event_type == RIGHTMOUSE) diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c index b9350ca8799..e8ab1fef8b7 100644 --- a/source/blender/windowmanager/intern/wm_playanim.c +++ b/source/blender/windowmanager/intern/wm_playanim.c @@ -940,6 +940,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv) } } else if (!IMB_ispic(filepath)) { + printf("%s: '%s' not an image file\n", __func__, filepath); exit(1); } @@ -949,7 +950,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv) } if (ibuf == NULL) { - printf("couldn't open %s\n", filepath); + printf("%s: '%s' couldn't open\n", __func__, filepath); exit(1); } @@ -1190,7 +1191,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv) GHOST_DisposeWindow(g_WS.ghost_system, g_WS.ghost_window); /* early exit, IMB and BKE should be exited only in end */ - if (ps.dropped_file) { + if (ps.dropped_file[0]) { BLI_strncpy(filepath, ps.dropped_file, sizeof(filepath)); return filepath; } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index e0595e3c8ab..062107f834e 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -808,7 +808,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr * currently it seems to be common practice to generate new event for, but probably * we'll need utility function for this? (sergey) */ - event = *(win->eventstate); + wm_event_init_from_window(win, &event); event.type = MOUSEMOVE; event.prevx = event.x; event.prevy = event.y; @@ -957,7 +957,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr win->eventstate->x = wx; win->eventstate->y = wy; - event = *(win->eventstate); /* copy last state, like mouse coords */ + wm_event_init_from_window(win, &event); /* copy last state, like mouse coords */ /* activate region */ event.type = MOUSEMOVE; @@ -1065,7 +1065,8 @@ static int wm_window_timer(const bContext *C) else if (wt->event_type == TIMERAUTOSAVE) wm_autosave_timer(C, wm, wt); else if (win) { - wmEvent event = *(win->eventstate); + wmEvent event; + wm_event_init_from_window(win, &event); event.type = wt->event_type; event.val = 0; @@ -1323,6 +1324,16 @@ void wm_window_swap_buffers(wmWindow *win) #endif } +void wm_window_set_swap_interval (wmWindow *win, int interval) +{ + GHOST_SetSwapInterval(win->ghostwin, interval); +} + +int wm_window_get_swap_interval (wmWindow *win) +{ + return GHOST_GetSwapInterval(win->ghostwin); +} + /* ******************* exported api ***************** */ diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h index 6dcef9db407..df3096eed07 100644 --- a/source/blender/windowmanager/wm_event_types.h +++ b/source/blender/windowmanager/wm_event_types.h @@ -135,7 +135,7 @@ enum { NDOF_BUTTON_C, // the end NDOF_LAST - }; +}; /* SYSTEM : 0x01xx */ diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h index 22fa2423f61..d7e938fec7c 100644 --- a/source/blender/windowmanager/wm_window.h +++ b/source/blender/windowmanager/wm_window.h @@ -58,6 +58,8 @@ void wm_window_lower (wmWindow *win); void wm_window_set_size (wmWindow *win, int width, int height); void wm_window_get_position (wmWindow *win, int *posx_r, int *posy_r); void wm_window_swap_buffers (wmWindow *win); +void wm_window_set_swap_interval (wmWindow *win, int interval); +int wm_window_get_swap_interval (wmWindow *win); void wm_get_cursor_position (wmWindow *win, int *x, int *y); diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 547ced6098f..21502492c05 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -140,7 +140,7 @@ struct wmWindowManager; /*new render funcs */ void EDBM_selectmode_set(struct BMEditMesh *em) {STUB_ASSERT(0);} void EDBM_mesh_load(struct Object *ob) {STUB_ASSERT(0);} -void EDBM_mesh_make(struct ToolSettings *ts, struct Scene *scene, struct Object *ob) {STUB_ASSERT(0);} +void EDBM_mesh_make(struct ToolSettings *ts, struct Object *ob) {STUB_ASSERT(0);} void EDBM_mesh_normals_update(struct BMEditMesh *em) {STUB_ASSERT(0);} void *g_system; @@ -226,6 +226,7 @@ struct wmTimer *WM_event_add_timer(struct wmWindowManager *wm, struct wmWindow * void WM_event_remove_timer(struct wmWindowManager *wm, struct wmWindow *win, struct wmTimer *timer) {STUB_ASSERT(0);} void ED_armature_edit_bone_remove(struct bArmature *arm, struct EditBone *exBone) {STUB_ASSERT(0);} void object_test_constraints(struct Object *owner) {STUB_ASSERT(0);} +void ED_armature_ebone_to_mat4(struct EditBone *ebone, float mat[4][4]) {STUB_ASSERT(0);} void ED_object_parent(struct Object *ob, struct Object *par, int type, const char *substr) {STUB_ASSERT(0);} void ED_object_constraint_set_active(struct Object *ob, struct bConstraint *con) {STUB_ASSERT(0);} void ED_node_composit_default(struct bContext *C, struct Scene *scene) {STUB_ASSERT(0);} diff --git a/source/creator/creator.c b/source/creator/creator.c index 84d23530800..a710c07f34b 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -499,7 +499,7 @@ static void blender_crash_handler_backtrace(FILE *fp) #undef SIZE } -#elif defined(_MSV_VER) +#elif defined(_MSC_VER) static void blender_crash_handler_backtrace(FILE *fp) { @@ -1584,10 +1584,6 @@ int main(int argc, const char **argv) /* this is properly initialized with user defs, but this is default */ /* call after loading the startup.blend so we can read U.tempdir */ BLI_init_temporary_dir(U.tempdir); - -#ifdef WITH_SDL - BLI_setenv("SDL_VIDEODRIVER", "dummy"); -#endif } else { #ifndef WITH_PYTHON_MODULE diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index dbb7cbc1816..5703527eae0 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -284,6 +284,14 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL); else canvas->SetMouseState(RAS_ICanvas::MOUSE_INVISIBLE); + + // Setup vsync + int previous_vsync = canvas->GetSwapInterval(); + if (startscene->gm.vsync == VSYNC_ADAPTIVE) + canvas->SetSwapInterval(-1); + else + canvas->SetSwapInterval(startscene->gm.vsync); // VSYNC_OFF == 0, VSYNC_ON == 1, so this works + RAS_IRenderTools* rendertools = new KX_BlenderRenderTools(); RAS_IRasterizer* rasterizer = NULL; //Don't use displaylists with VBOs @@ -384,9 +392,8 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c if (!bfd) { // just add "//" in front of it - char temppath[242]; - strcpy(temppath, "//"); - strcat(temppath, basedpath); + char temppath[FILE_MAX] = "//"; + BLI_strncpy(temppath + 2, basedpath, FILE_MAX - 2); BLI_path_abs(temppath, pathname); bfd = load_game_data(temppath); @@ -664,6 +671,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c } if (canvas) { + canvas->SetSwapInterval(previous_vsync); // Set the swap interval back delete canvas; canvas = NULL; } diff --git a/source/gameengine/BlenderRoutines/CMakeLists.txt b/source/gameengine/BlenderRoutines/CMakeLists.txt index 32efc5bde21..67739706e3c 100644 --- a/source/gameengine/BlenderRoutines/CMakeLists.txt +++ b/source/gameengine/BlenderRoutines/CMakeLists.txt @@ -25,11 +25,11 @@ set(INC ../../blender/windowmanager ../../../intern/container ../../../intern/guardedalloc - ../../../intern/moto/include ../../../intern/string ) set(INC_SYS + ../../../intern/moto/include ${PTHREADS_INCLUDE_DIRS} ${GLEW_INCLUDE_PATH} ${BOOST_INCLUDE_DIR} diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp index 3bd1c02f12e..3089b3fd44d 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp @@ -66,6 +66,16 @@ void KX_BlenderCanvas::SwapBuffers() BL_SwapBuffers(m_win); } +void KX_BlenderCanvas::SetSwapInterval(int interval) +{ + BL_SetSwapInterval(m_win, interval); +} + +int KX_BlenderCanvas::GetSwapInterval() +{ + return BL_GetSwapInterval(m_win); +} + void KX_BlenderCanvas::ResizeWindow(int width, int height) { // Not implemented for the embedded player diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h index c201d866efe..c5318b882fa 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h +++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h @@ -80,6 +80,16 @@ public: void SwapBuffers( ); + + void + SetSwapInterval( + int interval + ); + + int + GetSwapInterval( + ); + void ResizeWindow( int width, diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp index 61598995040..6ed4866579c 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp @@ -98,6 +98,16 @@ void BL_MakeDrawable(wmWindowManager *wm, wmWindow *win) wm_window_make_drawable(wm, win); } +void BL_SetSwapInterval(struct wmWindow *win, int interval) +{ + wm_window_set_swap_interval(win, interval); +} + +int BL_GetSwapInterval(struct wmWindow *win) +{ + return wm_window_get_swap_interval(win); +} + static void DisableForText() { glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); /* needed for texture fonts otherwise they render as wireframe */ diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.h b/source/gameengine/BlenderRoutines/KX_BlenderGL.h index 54e76ff6489..8032d9a594a 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderGL.h +++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.h @@ -43,6 +43,8 @@ struct wmWindowManager; // special swapbuffers, that takes care of which area (viewport) needs to be swapped void BL_SwapBuffers(struct wmWindow *win); +void BL_SetSwapInterval(struct wmWindow *win, int interval); +int BL_GetSwapInterval(struct wmWindow *win); void BL_MakeDrawable(struct wmWindowManager *wm, struct wmWindow *win); diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp index db9445b728d..a6b71e0bc43 100644 --- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp +++ b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp @@ -37,6 +37,7 @@ #include "RAS_LightObject.h" #include "RAS_ICanvas.h" #include "RAS_GLExtensionManager.h" +#include "RAS_MeshObject.h" #include "KX_GameObject.h" #include "KX_PolygonMaterial.h" @@ -157,6 +158,11 @@ void KX_BlenderRenderTools::SetClientObject(RAS_IRasterizer *rasty, void* obj) bool KX_BlenderRenderTools::RayHit(KX_ClientObjectInfo *client, KX_RayCast *result, void * const data) { double* const oglmatrix = (double* const) data; + + RAS_Polygon* poly = result->m_hitMesh->GetPolygon(result->m_hitPolygon); + if (!poly->IsVisible()) + return false; + MT_Point3 resultpoint(result->m_hitPoint); MT_Vector3 resultnormal(result->m_hitNormal); MT_Vector3 left(oglmatrix[0],oglmatrix[1],oglmatrix[2]); @@ -219,7 +225,7 @@ void KX_BlenderRenderTools::applyTransform(RAS_IRasterizer* rasty,double* oglmat } MT_Vector3 left = dir.normalized(); - dir = (left.cross(up)).normalized(); + dir = (up.cross(left)).normalized(); // we have calculated the row vectors, now we keep // local scaling into account: diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index ad16c96dc70..99613f8bd99 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -890,8 +890,8 @@ static bool ConvertMaterial( static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace *tface, MCol *mcol, MTF_localLayer *layers, int lightlayer, unsigned int *rgb, MT_Point2 uvs[4][RAS_TexVert::MAX_UNIT], const char *tfaceName, KX_Scene* scene, KX_BlenderSceneConverter *converter) { - RAS_IPolyMaterial* polymat = converter->FindCachedPolyMaterial(ma); - BL_Material* bl_mat = converter->FindCachedBlenderMaterial(ma); + RAS_IPolyMaterial* polymat = converter->FindCachedPolyMaterial(scene, ma); + BL_Material* bl_mat = converter->FindCachedBlenderMaterial(scene, ma); KX_BlenderMaterial* kx_blmat = NULL; KX_PolygonMaterial* kx_polymat = NULL; @@ -907,7 +907,7 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace converter->GetGLSLMaterials()); if (ma && (ma->mode & MA_FACETEXTURE) == 0) - converter->CacheBlenderMaterial(ma, bl_mat); + converter->CacheBlenderMaterial(scene, ma, bl_mat); } const bool use_vcol = GetMaterialUseVColor(ma, bl_mat->glslmat); @@ -923,7 +923,7 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace kx_blmat->Initialize(scene, bl_mat, (ma?&ma->game:NULL), lightlayer); polymat = static_cast<RAS_IPolyMaterial*>(kx_blmat); if (ma && (ma->mode & MA_FACETEXTURE) == 0) - converter->CachePolyMaterial(ma, polymat); + converter->CachePolyMaterial(scene, ma, polymat); } } else { @@ -1052,7 +1052,7 @@ static RAS_MaterialBucket *material_from_mesh(Material *ma, MFace *mface, MTFace polymat->m_shininess = 35.0; } - converter->CachePolyMaterial(ma, polymat); + converter->CachePolyMaterial(scene, ma, polymat); } } @@ -2085,8 +2085,9 @@ static KX_GameObject *gameobject_from_blenderobject( case OB_FONT: { + bool do_color_management = !(blenderscene->gm.flag & GAME_GLSL_NO_COLOR_MANAGEMENT); /* font objects have no bounding box */ - gameobj = new KX_FontObject(kxscene,KX_Scene::m_callbacks, rendertools, ob); + gameobj = new KX_FontObject(kxscene,KX_Scene::m_callbacks, rendertools, ob, do_color_management); /* add to the list only the visible fonts */ if ((ob->lay & kxscene->GetBlenderScene()->lay) != 0) diff --git a/source/gameengine/Converter/CMakeLists.txt b/source/gameengine/Converter/CMakeLists.txt index f18646c1de0..084a85c8a1f 100644 --- a/source/gameengine/Converter/CMakeLists.txt +++ b/source/gameengine/Converter/CMakeLists.txt @@ -51,11 +51,11 @@ set(INC ../../blender/windowmanager ../../../intern/container ../../../intern/guardedalloc - ../../../intern/moto/include ../../../intern/string ) set(INC_SYS + ../../../intern/moto/include ../../../extern/recastnavigation/Detour/Include ../../../extern/Eigen3 ${PTHREADS_INCLUDE_DIRS} diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index 5df431db4b3..7a53144657d 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -174,7 +174,7 @@ KX_BlenderSceneConverter::~KX_BlenderSceneConverter() vector<pair<KX_Scene*,RAS_IPolyMaterial*> >::iterator itp = m_polymaterials.begin(); while (itp != m_polymaterials.end()) { - m_polymat_cache.erase((*itp).second->GetBlenderMaterial()); + //m_polymat_cache.erase((*itp).second->GetBlenderMaterial()); delete (*itp).second; itp++; } @@ -183,7 +183,7 @@ KX_BlenderSceneConverter::~KX_BlenderSceneConverter() // delete after RAS_IPolyMaterial vector<pair<KX_Scene*,BL_Material *> >::iterator itmat = m_materials.begin(); while (itmat != m_materials.end()) { - m_mat_cache.erase((*itmat).second->material); + //m_mat_cache.erase((*itmat).second->material); delete (*itmat).second; itmat++; } @@ -439,7 +439,7 @@ void KX_BlenderSceneConverter::RemoveScene(KX_Scene *scene) size = m_polymaterials.size(); for (i=0, polymit=m_polymaterials.begin(); i<size; ) { if ((*polymit).first == scene) { - m_polymat_cache.erase((*polymit).second->GetBlenderMaterial()); + m_polymat_cache[scene].erase((*polymit).second->GetBlenderMaterial()); delete (*polymit).second; *polymit = m_polymaterials.back(); m_polymaterials.pop_back(); @@ -450,11 +450,13 @@ void KX_BlenderSceneConverter::RemoveScene(KX_Scene *scene) } } + m_polymat_cache.erase(scene); + vector<pair<KX_Scene*,BL_Material*> >::iterator matit; size = m_materials.size(); for (i=0, matit=m_materials.begin(); i<size; ) { if ((*matit).first == scene) { - m_mat_cache.erase((*matit).second->material); + m_mat_cache[scene].erase((*matit).second->material); delete (*matit).second; *matit = m_materials.back(); m_materials.pop_back(); @@ -465,6 +467,8 @@ void KX_BlenderSceneConverter::RemoveScene(KX_Scene *scene) } } + m_mat_cache.erase(scene); + vector<pair<KX_Scene*,RAS_MeshObject*> >::iterator meshit; size = m_meshobjects.size(); for (i=0, meshit=m_meshobjects.begin(); i<size; ) { @@ -603,26 +607,26 @@ void KX_BlenderSceneConverter::RegisterPolyMaterial(RAS_IPolyMaterial *polymat) m_polymaterials.push_back(pair<KX_Scene*,RAS_IPolyMaterial*>(m_currentScene,polymat)); } -void KX_BlenderSceneConverter::CachePolyMaterial(struct Material *mat, RAS_IPolyMaterial *polymat) +void KX_BlenderSceneConverter::CachePolyMaterial(KX_Scene *scene, Material *mat, RAS_IPolyMaterial *polymat) { if (m_use_mat_cache && mat) - m_polymat_cache[mat] = polymat; + m_polymat_cache[scene][mat] = polymat; } -RAS_IPolyMaterial *KX_BlenderSceneConverter::FindCachedPolyMaterial(struct Material *mat) +RAS_IPolyMaterial *KX_BlenderSceneConverter::FindCachedPolyMaterial(KX_Scene *scene, struct Material *mat) { - return (m_use_mat_cache) ? m_polymat_cache[mat] : NULL; + return (m_use_mat_cache) ? m_polymat_cache[scene][mat] : NULL; } -void KX_BlenderSceneConverter::CacheBlenderMaterial(struct Material *mat, BL_Material *blmat) +void KX_BlenderSceneConverter::CacheBlenderMaterial(KX_Scene *scene, struct Material *mat, BL_Material *blmat) { if (m_use_mat_cache && mat) - m_mat_cache[mat] = blmat; + m_mat_cache[scene][mat] = blmat; } -BL_Material *KX_BlenderSceneConverter::FindCachedBlenderMaterial(struct Material *mat) +BL_Material *KX_BlenderSceneConverter::FindCachedBlenderMaterial(KX_Scene *scene, struct Material *mat) { - return (m_use_mat_cache) ? m_mat_cache[mat] : NULL; + return (m_use_mat_cache) ? m_mat_cache[scene][mat] : NULL; } void KX_BlenderSceneConverter::RegisterInterpolatorList( @@ -1262,6 +1266,8 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) KX_Scene* scene = scenes->at(scene_idx); if (IS_TAGGED(scene->GetBlenderScene())) { m_ketsjiEngine->RemoveScene(scene->GetName()); + m_mat_cache.erase(scene); + m_polymat_cache.erase(scene); scene_idx--; numScenes--; } @@ -1456,7 +1462,6 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) } if (IS_TAGGED(bmat)) { - m_polymat_cache.erase((*polymit).second->GetBlenderMaterial()); delete (*polymit).second; *polymit = m_polymaterials.back(); m_polymaterials.pop_back(); @@ -1474,7 +1479,6 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) for (i=0, matit=m_materials.begin(); i<size; ) { BL_Material *mat= (*matit).second; if (IS_TAGGED(mat->material)) { - m_mat_cache.erase((*matit).second->material); delete (*matit).second; *matit = m_materials.back(); m_materials.pop_back(); diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.h b/source/gameengine/Converter/KX_BlenderSceneConverter.h index 06dac1707c5..7ed75ad7614 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.h +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.h @@ -53,6 +53,10 @@ class BL_Material; struct Main; struct Scene; struct ThreadInfo; +struct Material; + +typedef map<KX_Scene*, map<Material*, BL_Material*> > MaterialCache; +typedef map<KX_Scene*, map<Material*, RAS_IPolyMaterial*> > PolyMaterialCache; class KX_BlenderSceneConverter : public KX_ISceneConverter { @@ -66,8 +70,8 @@ class KX_BlenderSceneConverter : public KX_ISceneConverter ThreadInfo *m_threadinfo; // Cached material conversions - map<struct Material*, BL_Material*> m_mat_cache; - map<struct Material*, RAS_IPolyMaterial*> m_polymat_cache; + MaterialCache m_mat_cache; + PolyMaterialCache m_polymat_cache; // Saved KX_LibLoadStatus objects map<char *, class KX_LibLoadStatus*> m_status_map; @@ -126,12 +130,12 @@ public: RAS_MeshObject *FindGameMesh(struct Mesh *for_blendermesh/*, unsigned int onlayer*/); void RegisterPolyMaterial(RAS_IPolyMaterial *polymat); - void CachePolyMaterial(struct Material *mat, RAS_IPolyMaterial *polymat); - RAS_IPolyMaterial *FindCachedPolyMaterial(struct Material *mat); + void CachePolyMaterial(KX_Scene *scene, Material *mat, RAS_IPolyMaterial *polymat); + RAS_IPolyMaterial *FindCachedPolyMaterial(KX_Scene *scene, Material *mat); void RegisterBlenderMaterial(BL_Material *mat); - void CacheBlenderMaterial(struct Material *mat, BL_Material *blmat); - BL_Material *FindCachedBlenderMaterial(struct Material *mat); + void CacheBlenderMaterial(KX_Scene *scene, Material *mat, BL_Material *blmat); + BL_Material *FindCachedBlenderMaterial(KX_Scene *scene, Material *mat); void RegisterInterpolatorList(BL_InterpolatorList *actList, struct bAction *for_act); BL_InterpolatorList *FindInterpolatorList(struct bAction *for_act); diff --git a/source/gameengine/Converter/KX_ConvertProperties.cpp b/source/gameengine/Converter/KX_ConvertProperties.cpp index 7222c673322..3b4ba6886cb 100644 --- a/source/gameengine/Converter/KX_ConvertProperties.cpp +++ b/source/gameengine/Converter/KX_ConvertProperties.cpp @@ -131,7 +131,7 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan if (propval) { - if (show_debug_info) + if (show_debug_info && isInActiveLayer) { scene->AddDebugProperty(gameobj,STR_String(prop->name)); } @@ -159,7 +159,7 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan prop = prop->next; } // check if state needs to be debugged - if (object->scaflag & OB_DEBUGSTATE) + if (object->scaflag & OB_DEBUGSTATE && isInActiveLayer) { // reserve name for object state scene->AddDebugProperty(gameobj,STR_String("__state__")); diff --git a/source/gameengine/Expressions/CMakeLists.txt b/source/gameengine/Expressions/CMakeLists.txt index 0c7d79b4cda..6907f314503 100644 --- a/source/gameengine/Expressions/CMakeLists.txt +++ b/source/gameengine/Expressions/CMakeLists.txt @@ -28,12 +28,11 @@ set(INC ../SceneGraph ../../blender/blenlib ../../../intern/guardedalloc - ../../../intern/moto/include ../../../intern/string ) set(INC_SYS - + ../../../intern/moto/include ) set(SRC diff --git a/source/gameengine/Expressions/FloatValue.cpp b/source/gameengine/Expressions/FloatValue.cpp index b7d7f528155..0f468e328ed 100644 --- a/source/gameengine/Expressions/FloatValue.cpp +++ b/source/gameengine/Expressions/FloatValue.cpp @@ -97,7 +97,7 @@ ret: a new object containing the result of applying operator op to this return new CFloatValue (-m_float); break; case VALUE_NOT_OPERATOR: - return new CErrorValue (op2str(op) + "only allowed on booleans"); + return new CBoolValue (m_float == 0.f); break; case VALUE_AND_OPERATOR: case VALUE_OR_OPERATOR: @@ -160,6 +160,9 @@ ret: a new object containing the result of applying operator op to val and case VALUE_LEQ_OPERATOR: ret = new CBoolValue(((CIntValue *) val)->GetInt() <= m_float); break; + case VALUE_NOT_OPERATOR: + ret = new CBoolValue(m_float == 0); + break; default: ret = new CErrorValue("illegal operator. please send a bug report."); break; @@ -212,7 +215,9 @@ ret: a new object containing the result of applying operator op to val and case VALUE_POS_OPERATOR: ret = new CFloatValue (m_float); break; - + case VALUE_NOT_OPERATOR: + ret = new CBoolValue(m_float == 0); + break; default: ret = new CErrorValue("illegal operator. please send a bug report."); break; diff --git a/source/gameengine/Expressions/IntValue.cpp b/source/gameengine/Expressions/IntValue.cpp index 2cacea98467..fa4c9ad8ac9 100644 --- a/source/gameengine/Expressions/IntValue.cpp +++ b/source/gameengine/Expressions/IntValue.cpp @@ -96,7 +96,7 @@ object and val return new CIntValue (-m_int); break; case VALUE_NOT_OPERATOR: - return new CErrorValue (op2str(op) + "only allowed on booleans"); + return new CBoolValue (m_int == 0); break; case VALUE_AND_OPERATOR: case VALUE_OR_OPERATOR: @@ -170,7 +170,11 @@ CValue* CIntValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *v case VALUE_POS_OPERATOR: ret = new CIntValue (m_int); break; + case VALUE_NOT_OPERATOR: + ret = new CBoolValue(m_int == 0); + break; default: + printf("Found op: %d\n", op); ret = new CErrorValue("illegal operator. please send a bug report."); break; } @@ -215,6 +219,9 @@ CValue* CIntValue::CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *v case VALUE_LEQ_OPERATOR: ret = new CBoolValue(((CFloatValue *) val)->GetFloat() <= m_int); break; + case VALUE_NOT_OPERATOR: + ret = new CBoolValue(m_int == 0); + break; default: ret = new CErrorValue("illegal operator. please send a bug report."); break; diff --git a/source/gameengine/Expressions/KX_HashedPtr.cpp b/source/gameengine/Expressions/KX_HashedPtr.cpp index 555ef7f9500..bd42892cc8d 100644 --- a/source/gameengine/Expressions/KX_HashedPtr.cpp +++ b/source/gameengine/Expressions/KX_HashedPtr.cpp @@ -36,6 +36,8 @@ unsigned int KX_Hash(void *inDWord) { #if defined(_WIN64) && !defined(FREE_WINDOWS64) unsigned __int64 key = (unsigned __int64)inDWord; +#elif defined(FREE_WINDOWS64) + unsigned long long key = (unsigned long long)inDWord; #else unsigned long key = (unsigned long)inDWord; #endif diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt index ad357bd015b..05071f59707 100644 --- a/source/gameengine/GameLogic/CMakeLists.txt +++ b/source/gameengine/GameLogic/CMakeLists.txt @@ -30,13 +30,12 @@ set(INC ../SceneGraph ../../blender/blenlib ../../../intern/container - ../../../intern/moto/include ../../../intern/string ../../../intern/ghost ) set(INC_SYS - + ../../../intern/moto/include ) set(SRC diff --git a/source/gameengine/GameLogic/SCA_IScene.cpp b/source/gameengine/GameLogic/SCA_IScene.cpp index c2ea8b4a8bc..60b4d19e155 100644 --- a/source/gameengine/GameLogic/SCA_IScene.cpp +++ b/source/gameengine/GameLogic/SCA_IScene.cpp @@ -74,9 +74,28 @@ std::vector<SCA_DebugProp*>& SCA_IScene::GetDebugProperties() void SCA_IScene::AddDebugProperty(class CValue* debugprop, const STR_String &name) { - SCA_DebugProp* dprop = new SCA_DebugProp(); - dprop->m_obj = debugprop; - debugprop->AddRef(); - dprop->m_name = name; - m_debugList.push_back(dprop); + if (m_debugList.size() < DEBUG_MAX_DISPLAY) { + SCA_DebugProp* dprop = new SCA_DebugProp(); + dprop->m_obj = debugprop; + debugprop->AddRef(); + dprop->m_name = name; + m_debugList.push_back(dprop); + } } + + +void SCA_IScene::RemoveObjectDebugProperties(class CValue* gameobj) +{ + vector<SCA_DebugProp*>::iterator it = m_debugList.begin(); + while(it != m_debugList.end()) { + CValue* debugobj = (*it)->m_obj; + + if (debugobj == gameobj) { + delete (*it); + m_debugList.erase(it); + continue; + } + ++it; + } +} + diff --git a/source/gameengine/GameLogic/SCA_IScene.h b/source/gameengine/GameLogic/SCA_IScene.h index 997266976ad..e2e1edd4354 100644 --- a/source/gameengine/GameLogic/SCA_IScene.h +++ b/source/gameengine/GameLogic/SCA_IScene.h @@ -41,6 +41,8 @@ #include "MEM_guardedalloc.h" #endif +#define DEBUG_MAX_DISPLAY 100 + struct SCA_DebugProp { class CValue* m_obj; @@ -65,9 +67,11 @@ public: virtual void ReplaceMesh(class CValue* gameobj, void* meshobj, bool use_gfx, bool use_phys)=0; std::vector<SCA_DebugProp*>& GetDebugProperties(); + void RemoveAllDebugProperties(); void AddDebugProperty(class CValue* debugprop, const STR_String &name); - void RemoveAllDebugProperties(); + void RemoveObjectDebugProperties(class CValue* gameobj); + virtual void Update2DFilter(std::vector<STR_String>& propNames, void* gameObj, RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode, int pass, STR_String& text) {} diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp index c7e31f75306..3cae3bcf160 100644 --- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp +++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp @@ -367,7 +367,7 @@ PyObject *SCA_JoystickSensor::pyattr_get_axis_single(void *self_v, const KX_PYAT SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex); if (self->m_joymode != KX_JOYSENSORMODE_AXIS_SINGLE) { - PyErr_SetString(PyExc_TypeError, "val = sensor.axisSingle: Joystick Sensor, not 'Single Axis' type"); + PyErr_SetString(PyExc_AttributeError, "val = sensor.axisSingle: Joystick Sensor, not 'Single Axis' type"); return NULL; } diff --git a/source/gameengine/GamePlayer/CMakeLists.txt b/source/gameengine/GamePlayer/CMakeLists.txt index e1a26668d11..e77609985dc 100644 --- a/source/gameengine/GamePlayer/CMakeLists.txt +++ b/source/gameengine/GamePlayer/CMakeLists.txt @@ -25,7 +25,3 @@ add_subdirectory(common) add_subdirectory(ghost) - -if(WITH_WEBPLUGIN) - add_subdirectory(xembed) -endif() diff --git a/source/gameengine/GamePlayer/common/CMakeLists.txt b/source/gameengine/GamePlayer/common/CMakeLists.txt index 8884ff82363..4f2531cec2a 100644 --- a/source/gameengine/GamePlayer/common/CMakeLists.txt +++ b/source/gameengine/GamePlayer/common/CMakeLists.txt @@ -48,38 +48,27 @@ set(INC ../../../../intern/container ../../../../intern/ghost ../../../../intern/guardedalloc - ../../../../intern/moto/include ../../../../intern/string ) set(INC_SYS + ../../../../intern/moto/include ${GLEW_INCLUDE_PATH} ${PYTHON_INCLUDE_DIRS} ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS} ) -set(SRC +set(SRC GPC_Canvas.cpp - GPC_Engine.cpp GPC_KeyboardDevice.cpp GPC_MouseDevice.cpp - GPC_RawImage.cpp - GPC_RawLoadDotBlendArray.cpp - GPC_RawLogoArrays.cpp GPC_RenderTools.cpp - GPC_System.cpp - bmfont.cpp GPC_Canvas.h - GPC_Engine.h GPC_KeyboardDevice.h GPC_MouseDevice.h - GPC_RawImage.h - GPC_RawLoadDotBlendArray.h - GPC_RawLogoArrays.h GPC_RenderTools.h - GPC_System.h ) add_definitions(-DGLEW_STATIC) diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp b/source/gameengine/GamePlayer/common/GPC_Canvas.cpp index dd914cd6e7d..be7cf6629f0 100644 --- a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp +++ b/source/gameengine/GamePlayer/common/GPC_Canvas.cpp @@ -56,16 +56,13 @@ extern "C" { #include "IMB_imbuf_types.h" } -GPC_Canvas::TBannerId GPC_Canvas::s_bannerId = 0; - GPC_Canvas::GPC_Canvas( int width, int height ) : m_width(width), - m_height(height), - m_bannersEnabled(false) + m_height(height) { // initialize area so that it's available for game logic on frame 1 (ImageViewport) m_displayarea.m_x1 = 0; @@ -79,28 +76,9 @@ GPC_Canvas::GPC_Canvas( GPC_Canvas::~GPC_Canvas() { - DisposeAllBanners(); } -// void GPC_Canvas::InitPostRenderingContext(void) -// { -// glViewport(0, 0, m_width, m_height); -// glMatrixMode(GL_PROJECTION); -// glLoadIdentity(); - -// glOrtho(-2.0, 2.0, -2.0, 2.0, -20.0, 20.0); - -// glMatrixMode(GL_MODELVIEW); -// glLoadIdentity(); - -// glEnable(GL_DEPTH_TEST); - -// glDepthFunc(GL_LESS); - -// glShadeModel(GL_SMOOTH); -// } - void GPC_Canvas::Resize(int width, int height) { m_width = width; @@ -113,12 +91,6 @@ void GPC_Canvas::Resize(int width, int height) m_displayarea.m_y2 = height; } -void GPC_Canvas::EndFrame() -{ - if (m_bannersEnabled) - DrawAllBanners(); -} - void GPC_Canvas::ClearColor(float r, float g, float b, float a) { @@ -185,256 +157,6 @@ void GPC_Canvas::ClearBuffer( ::glClear(ogltype); } - -GPC_Canvas::TBannerId GPC_Canvas::AddBanner( - unsigned int bannerWidth, unsigned int bannerHeight, - unsigned int imageWidth, unsigned int imageHeight, - unsigned char* imageData, - TBannerAlignment alignment, bool enabled) -{ - TBannerData banner; - - banner.alignment = alignment; - banner.enabled = enabled; - banner.displayWidth = bannerWidth; - banner.displayHeight = bannerHeight; - banner.imageWidth = imageWidth; - banner.imageHeight = imageHeight; - unsigned int bannerDataSize = imageWidth*imageHeight*4; - banner.imageData = new unsigned char [bannerDataSize]; - ::memcpy(banner.imageData, imageData, bannerDataSize); - banner.textureName = 0; - - m_banners.insert(TBannerMap::value_type(++s_bannerId, banner)); - return s_bannerId; -} - - -void GPC_Canvas::DisposeBanner(TBannerId id) -{ - TBannerMap::iterator it = m_banners.find(id); - if (it != m_banners.end()) { - DisposeBanner(it->second); - m_banners.erase(it); - } -} - -void GPC_Canvas::DisposeAllBanners() -{ - TBannerMap::iterator it = m_banners.begin(); - while (it != m_banners.end()) { - DisposeBanner(it->second); - it++; - } -} - -void GPC_Canvas::SetBannerEnabled(TBannerId id, bool enabled) -{ - TBannerMap::iterator it = m_banners.find(id); - if (it != m_banners.end()) { - it->second.enabled = enabled; - } -} - - -void GPC_Canvas::SetBannerDisplayEnabled(bool enabled) -{ - m_bannersEnabled = enabled; -} - - -void GPC_Canvas::DisposeBanner(TBannerData& banner) -{ - if (banner.imageData) { - delete [] banner.imageData; - banner.imageData = 0; - } - if (banner.textureName) { - ::glDeleteTextures(1, (GLuint*)&banner.textureName); - } -} - -void GPC_Canvas::DrawAllBanners(void) -{ - if (!m_bannersEnabled || (m_banners.size() < 1)) - return; - - // Save the old rendering parameters. - - CanvasRenderState render_state; - PushRenderState(render_state); - - // Set up everything for banner display. - - // Set up OpenGL matrices - SetOrthoProjection(); - // Activate OpenGL settings needed for display of the texture - ::glDisable(GL_LIGHTING); - ::glDisable(GL_DEPTH_TEST); - ::glDisable(GL_FOG); - ::glEnable(GL_TEXTURE_2D); - ::glEnable(GL_BLEND); - ::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - TBannerMap::iterator it = m_banners.begin(); - while (it != m_banners.end()) { - if (it->second.enabled) { - DrawBanner(it->second); - } - it++; - } - - PopRenderState(render_state); -} - - -void GPC_Canvas::DrawBanner(TBannerData& banner) -{ - if (!banner.enabled) - return; - - // Set up coordinates - int coords[4][2]; - if (banner.alignment == alignTopLeft) { - // Upper left - coords[0][0] = 0; - coords[0][1] = ((int)m_height)-banner.displayHeight; - coords[1][0] = banner.displayWidth; - coords[1][1] = ((int)m_height)-banner.displayHeight; - coords[2][0] = banner.displayWidth; - coords[2][1] = ((int)m_height); - coords[3][0] = 0; - coords[3][1] = ((int)m_height); - } - else { - // Lower right - coords[0][0] = (int)m_width - banner.displayWidth; - coords[0][1] = 0; - coords[1][0] = m_width; - coords[1][1] = 0; - coords[2][0] = m_width; - coords[2][1] = banner.displayHeight; - coords[3][0] = (int)m_width - banner.displayWidth; - coords[3][1] = banner.displayHeight; - } - // Set up uvs - int uvs[4][2] = { - { 0, 1}, - { 1, 1}, - { 1, 0}, - { 0, 0} - }; - - if (!banner.textureName) { - ::glGenTextures(1, (GLuint*)&banner.textureName); - ::glBindTexture(GL_TEXTURE_2D, banner.textureName); - ::glTexImage2D( - GL_TEXTURE_2D, // target - 0, // level - 4, // components - banner.imageWidth, // width - banner.displayHeight, // height - 0, // border - GL_RGBA, // format - GL_UNSIGNED_BYTE, // type - banner.imageData); // image data - ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - } - else { - ::glBindTexture(GL_TEXTURE_2D, banner.textureName); - } - - // Draw the rectangle with the texture on it - ::glBegin(GL_QUADS); - ::glColor4f(1.f, 1.f, 1.f, 1.f); - ::glTexCoord2iv((GLint*)uvs[0]); - ::glVertex2iv((GLint*)coords[0]); - ::glTexCoord2iv((GLint*)uvs[1]); - ::glVertex2iv((GLint*)coords[1]); - ::glTexCoord2iv((GLint*)uvs[2]); - ::glVertex2iv((GLint*)coords[2]); - ::glTexCoord2iv((GLint*)uvs[3]); - ::glVertex2iv((GLint*)coords[3]); - ::glEnd(); -} - - void -GPC_Canvas:: -PushRenderState( - CanvasRenderState & render_state -) { -#if 0 - - ::glMatrixMode(GL_PROJECTION); - ::glPushMatrix(); - ::glMatrixMode(GL_MODELVIEW); - ::glPushMatrix(); - ::glMatrixMode(GL_TEXTURE); - ::glPushMatrix(); - // Save old OpenGL settings - ::glGetIntegerv(GL_LIGHTING, (GLint*)&(render_state.oldLighting)); - ::glGetIntegerv(GL_DEPTH_TEST, (GLint*)&(render_state.oldDepthTest)); - ::glGetIntegerv(GL_FOG, (GLint*)&(render_state.oldFog)); - ::glGetIntegerv(GL_TEXTURE_2D, (GLint*)&(render_state.oldTexture2D)); - ::glGetIntegerv(GL_BLEND, (GLint*)&(render_state.oldBlend)); - ::glGetIntegerv(GL_BLEND_SRC, (GLint*)&(render_state.oldBlendSrc)); - ::glGetIntegerv(GL_BLEND_DST, (GLint*)&(render_state.oldBlendDst)); - ::glGetFloatv(GL_CURRENT_COLOR, render_state.oldColor); - ::glGetIntegerv(GL_DEPTH_WRITEMASK,(GLint*)&(render_state.oldWriteMask)); -#else - - glPushAttrib(GL_ALL_ATTRIB_BITS); - -#endif -} - - void -GPC_Canvas:: -PopRenderState( - const CanvasRenderState & render_state -) { -#if 0 - // Restore OpenGL settings - render_state.oldLighting ? ::glEnable(GL_LIGHTING) : glDisable(GL_LIGHTING); - render_state.oldDepthTest ? ::glEnable(GL_DEPTH_TEST) : glDisable(GL_DEPTH_TEST); - render_state.oldFog ? ::glEnable(GL_FOG) : ::glDisable(GL_FOG); - render_state.oldTexture2D ? ::glEnable(GL_TEXTURE_2D) : glDisable(GL_TEXTURE_2D); - render_state.oldBlend ? glEnable(GL_BLEND) : ::glDisable(GL_BLEND); - ::glBlendFunc((GLenum)render_state.oldBlendSrc, (GLenum)render_state.oldBlendDst); - render_state.oldWriteMask ? ::glEnable(GL_DEPTH_WRITEMASK) : glDisable(GL_DEPTH_WRITEMASK); - - ::glColor4fv(render_state.oldColor); - // Restore OpenGL matrices - ::glMatrixMode(GL_TEXTURE); - ::glPopMatrix(); - ::glMatrixMode(GL_PROJECTION); - ::glPopMatrix(); - ::glMatrixMode(GL_MODELVIEW); - ::glPopMatrix(); - -#else - - glPopAttrib(); -#endif -} - - void -GPC_Canvas:: -SetOrthoProjection( -) { - // Set up OpenGL matrices - ::glViewport(0, 0, m_width, m_height); - ::glScissor(0, 0, m_width, m_height); - ::glMatrixMode(GL_PROJECTION); - ::glLoadIdentity(); - ::glOrtho(0, m_width, 0, m_height, -1, 1); - ::glMatrixMode(GL_MODELVIEW); - ::glLoadIdentity(); - ::glMatrixMode(GL_TEXTURE); - ::glLoadIdentity(); -} - void GPC_Canvas:: MakeScreenShot( diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.h b/source/gameengine/GamePlayer/common/GPC_Canvas.h index 07f96166ec2..bd50066a212 100644 --- a/source/gameengine/GamePlayer/common/GPC_Canvas.h +++ b/source/gameengine/GamePlayer/common/GPC_Canvas.h @@ -47,40 +47,7 @@ class GPC_Canvas : public RAS_ICanvas { -public: - /** - * Used to position banners in the canvas. - */ - typedef enum { - alignTopLeft, - alignBottomRight - } TBannerAlignment; - - typedef int TBannerId; - protected: - /** - * Used to store info for banners drawn on top of the canvas. - */ - typedef struct { - /** Where the banner will be displayed. */ - TBannerAlignment alignment; - /** Banner display enabled. */ - bool enabled; - /** Banner display width. */ - unsigned int displayWidth; - /** Banner display height. */ - unsigned int displayHeight; - /** Banner image width. */ - unsigned int imageWidth; - /** Banner image height. */ - unsigned int imageHeight; - /** Banner image data. */ - unsigned char* imageData; - /** Banner OpenGL texture name. */ - unsigned int textureName; - } TBannerData; - typedef std::map<TBannerId, TBannerData> TBannerMap; /** Width of the context. */ int m_width; @@ -92,11 +59,6 @@ protected: int m_viewport[4]; - /** Storage for the banners to display. */ - TBannerMap m_banners; - /** State of banner display. */ - bool m_bannersEnabled; - public: GPC_Canvas(int width, int height); @@ -152,7 +114,7 @@ public: */ void EndFrame( - ); + ) {}; void SetViewPort(int x1, int y1, int x2, int y2); void UpdateViewPort(int x1, int y1, int x2, int y2); @@ -178,100 +140,6 @@ public: virtual void MakeScreenShot(const char* filename); void ClearBuffer(int type); - - /** - * \section Services provided by this class. - */ - - /** - * Enables display of a banner. - * The image data is copied inside. - * \param bannerWidth Display width of the banner. - * \param bannerHeight Display height of the banner. - * \param imageWidth Width of the banner image in pixels. - * \param imageHeight Height of the banner image in pixels. - * \param imageData Pointer to the pixels of the image to display. - * \param alignment Where the banner will be positioned on the canvas. - * \param enabled Whether the banner will be displayed initially. - * \return A banner id. - */ - TBannerId AddBanner( - unsigned int bannerWidth, unsigned int bannerHeight, - unsigned int imageWidth, unsigned int imageHeight, - unsigned char* imageData, TBannerAlignment alignment = alignTopLeft, - bool enabled = true); - - /** - * Disposes a banner. - * \param id Banner to be disposed. - */ - void DisposeBanner(TBannerId id); - - /** - * Disposes all the banners. - */ - void DisposeAllBanners(); - - /** - * Enables or disables display of a banner. - * \param id Banner id of the banner to be enabled/disabled. - * \param enabled New state of the banner. - */ - void SetBannerEnabled(TBannerId id, bool enabled = true); - - /** - * Enables or disables display of all banners. - * \param enabled New state of the banners. - */ - void SetBannerDisplayEnabled(bool enabled = true); - -protected: - /** - * Disposes a banner. - * \param it Banner to be disposed. - */ - void DisposeBanner(TBannerData& banner); - - /** - * Draws all the banners enabled. - */ - void DrawAllBanners(void); - - /** - * Draws a banner. - */ - void DrawBanner(TBannerData& banner); - - struct CanvasRenderState { - int oldLighting; - int oldDepthTest; - int oldFog; - int oldTexture2D; - int oldBlend; - int oldBlendSrc; - int oldBlendDst; - float oldColor[4]; - int oldWriteMask; - }; - - void - PushRenderState( - CanvasRenderState & render_state - ); - void - PopRenderState( - const CanvasRenderState & render_state - ); - - /** - * Set up an orthogonal viewing,model and texture matrix - * for banners and progress bars. - */ - void - SetOrthoProjection( - ); - - static TBannerId s_bannerId; }; #endif /* __GPC_CANVAS_H__ */ diff --git a/source/gameengine/GamePlayer/common/GPC_Engine.cpp b/source/gameengine/GamePlayer/common/GPC_Engine.cpp deleted file mode 100644 index 1a90fb8aca8..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_Engine.cpp +++ /dev/null @@ -1,338 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file gameengine/GamePlayer/common/GPC_Engine.cpp - * \ingroup player - */ - - -#ifdef WIN32 - #pragma warning (disable:4786) // suppress stl-MSVC debug info warning -#endif // WIN32 - -#include <iostream> - -#include "BKE_blender.h" // initglobals() -#include "BKE_global.h" // Global G -#include "BKE_report.h" -#include "DNA_scene_types.h" -#include "DNA_camera_types.h" // Camera -#include "DNA_object_types.h" // Object - -#include "BLO_readfile.h" -#include "BLI_blenlib.h" - -// include files needed by "KX_BlenderSceneConverter.h" - -#include "CTR_Map.h" -#include "SCA_IActuator.h" -#include "RAS_MeshObject.h" - -#include "KX_BlenderSceneConverter.h" -#include "KX_KetsjiEngine.h" -#include "NG_LoopBackNetworkDeviceInterface.h" - -#include "RAS_IRenderTools.h" - -#include "GPC_Engine.h" -#include "GPC_KeyboardDevice.h" -#include "GPC_MouseDevice.h" -#include "GPC_RawImage.h" -#include "GPC_RawLoadDotBlendArray.h" - - - -GPC_Engine::GPC_Engine(char *customLoadingAnimationURL, - int foregroundColor, int backgroundColor, int frameRate) : - m_initialized(false), m_running(false), m_loading(false), - m_customLoadingAnimation(false), m_previousProgress(0.0), - m_system(NULL), m_keyboarddev(NULL), - m_mousedev(NULL), m_canvas(NULL), m_rendertools(NULL), - m_portal(NULL), m_sceneconverter(NULL), m_networkdev(NULL), - m_curarea(NULL), m_customLoadingAnimationURL(NULL), - m_foregroundColor(foregroundColor), m_backgroundColor(backgroundColor), - m_frameRate(frameRate), - m_BlenderLogo(0), m_Blender3DLogo(0)/*, m_NaNLogo(0)*/ -{ - if (customLoadingAnimationURL[0] != '\0') - { - m_customLoadingAnimationURL = new char[sizeof(customLoadingAnimationURL)]; -// not yet, need to be implemented first... m_customLoadingAnimation = true; - } - - // load the Blender logo into memory - m_BlenderLogo = new GPC_RawImage(); - // blender3d size is 115 x 32 so make resulting texture 128 x 128 - if (!m_BlenderLogo->Load("BlenderLogo", 128, 128, GPC_RawImage::alignTopLeft, 8, 8)) - m_BlenderLogo = 0; - - // load the Blender3D logo into memory - m_Blender3DLogo = new GPC_RawImage(); - // blender3d size is 136 x 11 so make resulting texture 256 x 256 - if (!m_Blender3DLogo->Load("Blender3DLogo", 256, 256, GPC_RawImage::alignBottomRight, 8, 8)) - m_Blender3DLogo = 0; - -#if 0 - // obsolete logo - // load the NaN logo into memory - m_NaNLogo = new GPC_RawImage(); - // blender3d size is 32 x 31 so make resulting texture 64 x 64 - if (!m_NaNLogo->Load("NaNLogo", 64, 64, GPC_RawImage::alignBottomRight, 8, 8)) - m_NaNLogo = 0; -#endif -} - - -GPC_Engine::~GPC_Engine() -{ - // deleting everything in reverse order of creation -#if 0 -// hmm deleted in Stop() delete m_portal; -// hmm deleted in Stop() delete m_sceneconverter; - delete m_system; - delete m_networkdev; - delete m_rendertools; - delete m_canvas; - delete m_mousedev; - delete m_keyboarddev; -// not yet used so be careful and not delete them -// delete m_WaveCache; -// delete m_curarea; // for future use, not used yet -#endif - delete m_BlenderLogo; - delete m_Blender3DLogo; -#if 0 - delete m_NaNLogo; -#endif -} - - -bool GPC_Engine::Start(const char *filename) -{ - ReportList reports; - BlendFileData *bfd; - - BKE_reports_init(&reports, RPT_STORE); - bfd= BLO_read_from_file(filename, &reports); - BKE_reports_clear(&reports); - - if (!bfd) { - // XXX, deal with error here - cout << "Unable to load: " << filename << endl; - return false; - } - - StartKetsji(); - - if (bfd->type == BLENFILETYPE_PUB) - m_canvas->SetBannerDisplayEnabled(false); - - return true; -} - - -bool GPC_Engine::Start(const void *blenderDataBuffer, - unsigned int blenderDataBufferSize) -{ - ReportList reports; - BlendFileData *bfd; - - BKE_reports_init(&reports, RPT_STORE); - bfd = BLO_read_from_memory(blenderDataBuffer, blenderDataBufferSize, &reports); - BKE_reports_clear(&reports); - - if (!bfd) { - // XXX, deal with error here - cout << "Unable to load. " << endl; - return false; - } - - StartKetsji(); - - if (bfd->type == BLENFILETYPE_PUB) - m_canvas->SetBannerDisplayEnabled(false); - - return true; -} - - -bool GPC_Engine::StartKetsji(void) -{ - STR_String startSceneName = ""; // XXX scene->id.name + 2; -/* - KX_KetsjiEngine* ketsjieng = new KX_KetsjiEngine(m_system); - m_portal = new KetsjiPortal(ketsjieng); - m_portal->setSecurity(psl_Highest); - - KX_ISceneConverter *sceneconverter = new KX_BlenderSceneConverter(&G, ketsjieng); - - m_portal->Enter( - startSceneName, - sceneconverter, - m_canvas, - m_rendertools, - m_keyboarddev, - m_mousedev, - m_networkdev, - m_system); - - m_system->SetMainLoop(m_portal->m_ketsjieng); - - m_running = true; - */ - return true; -} - - -void GPC_Engine::StartLoadingAnimation() -{ - if (m_customLoadingAnimation) - { - } - else - { - unsigned char *blenderDataBuffer; - int blenderDataBufferSize; - GetRawLoadingAnimation(&blenderDataBuffer, &blenderDataBufferSize); - if (!Start(blenderDataBuffer, blenderDataBufferSize)) - cout << "something went wrong when starting the engine" << endl; - delete blenderDataBuffer; // created with 'new' in GetRawLoadingAnimation() - } -} - - -// will be platform dependent -float GPC_Engine::DetermineProgress(void) -{ -#if 0 - float progress; - if ((m_blenderData.m_ulProgress > 0) && - (m_blenderData.m_ulProgressMax != m_blenderData.m_ulProgress)) { - progress = (float)m_blenderData.m_ulProgress; - progress /= (float)m_blenderData.m_ulProgressMax; - } - else { - progress = 0.f; - } - progress *= 100.f; - return (unsigned int) progress; -#endif - return m_previousProgress + 0.01; // temporary TODO -} - - -void GPC_Engine::UpdateLoadingAnimation(void) -{ - //int delta; - - float progress = DetermineProgress(); - - if (progress > m_previousProgress) - { -// delta = progress - m_previousProgress; - m_previousProgress = progress; - if (m_previousProgress > 1.0) - m_previousProgress = 1.0; // limit to 1.0 (has to change !) -// m_engine->m_previousProgress = 0.0; - } - - STR_String to = ""; - STR_String from = ""; - STR_String subject = "progress"; - STR_String body; - body.Format("%f", progress); // a number between 0.0 and 1.0 - - if (m_networkdev) - { - // Store a progress message in the network device. - NG_NetworkMessage* msg = new NG_NetworkMessage(to, from, subject, body); - m_networkdev->SendNetworkMessage(msg); - msg->Release(); - } -} - - -void GPC_Engine::Stop() -{ - // only delete things that are created in StartKetsji() -/* if (m_portal) - { - m_portal->Leave(); - delete m_portal; // also gets rid of KX_KetsjiEngine (says Maarten) - m_portal = 0; - } -*/ if (m_sceneconverter) - { - delete m_sceneconverter; - m_sceneconverter = 0; - } -#if 0 - if (m_frameTimerID) - { - ::KillTimer(0, m_frameTimerID); - m_frameTimerID = 0; - } - m_engineRunning = false; -#endif - - m_running = false; -} - - -void GPC_Engine::Exit() -{ - if (m_running) - Stop(); - - if (m_system) { - delete m_system; - m_system = 0; - } - if (m_keyboarddev) { - delete m_keyboarddev; - m_keyboarddev = 0; - } - if (m_mousedev) { - delete m_mousedev; - m_mousedev = 0; - } - if (m_canvas) { - delete m_canvas; - m_canvas = 0; - } - if (m_rendertools) { - delete m_rendertools; - m_rendertools = 0; - } - if (m_networkdev) { - delete m_networkdev; - m_networkdev = 0; - } - - m_initialized = false; -} - diff --git a/source/gameengine/GamePlayer/common/GPC_Engine.h b/source/gameengine/GamePlayer/common/GPC_Engine.h deleted file mode 100644 index 3a4fd9c81d6..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_Engine.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file GPC_Engine.h - * \ingroup player - */ - -#ifndef __GPC_ENGINE_H__ -#define __GPC_ENGINE_H__ - -#include "GPC_Canvas.h" -#include "GPC_System.h" - -class GPC_KeyboardDevice; -class GPC_MouseDevice; - -class RAS_IRenderTools; -class KetsjiPortal; -class KX_ISceneConverter; -class NG_LoopBackNetworkDeviceInterface; -class GPC_RawImage; - - -class GPC_Engine -{ -//protected: -public: - /** Engine construction state. */ - bool m_initialized; - /** Engine state. */ - bool m_running; - /** loading state, ie a file is requested and is being loaded. Different - * from initialized and/or running */ - bool m_loading; - - bool m_customLoadingAnimation; - - /** Last file download progress measurement. */ - float m_previousProgress; - - /** The game engine's system abstraction. */ - GPC_System* m_system; - /** The game engine's keyboard abstraction. */ - GPC_KeyboardDevice* m_keyboarddev; - /** The game engine's mouse abstraction. */ - GPC_MouseDevice* m_mousedev; - /** The game engine's canvas abstraction. */ - GPC_Canvas* m_canvas; - /** The game engine's platform dependent render tools. */ - RAS_IRenderTools* m_rendertools; - /** The portal used to start the engine. */ - KetsjiPortal* m_portal; - /** Converts Blender data files. */ - KX_ISceneConverter* m_sceneconverter; - /** Network interface. */ - NG_LoopBackNetworkDeviceInterface* m_networkdev; - - struct ScrArea *m_curarea; // for future use, not used yet - - char *m_customLoadingAnimationURL; - int m_foregroundColor; - int m_backgroundColor; - int m_frameRate; - - GPC_RawImage *m_BlenderLogo; - GPC_Canvas::TBannerId m_BlenderLogoId; - GPC_RawImage *m_Blender3DLogo; - GPC_Canvas::TBannerId m_Blender3DLogoId; -#if 0 - GPC_RawImage *m_NaNLogo; - GPC_Canvas::TBannerId m_NaNLogoId; -#endif - -public: - GPC_Engine(char *customLoadingAnimation, - int foregroundColor, int backgroundColor, int frameRate); - virtual ~GPC_Engine(); - // Initialize() functions are not put here since they have - // different prototypes for Unix and Windows - void StartLoadingAnimation(); - bool Start(const char *filename); // file-on-disk starter - bool Start(const void *blenderDataBuffer, - unsigned int blenderDataBufferSize); // file-in-memory starter - - void Stop(); - virtual void Exit(); - - bool Initialized(void) {return m_initialized;} - bool Loading(void) {return m_loading;} - bool Running(void) const {return m_running;} - - virtual float DetermineProgress(void); // will be platform dependent - void UpdateLoadingAnimation(void); - -private: - bool StartKetsji(void); - -}; - -#endif /* __GPC_ENGINE_H__ */ diff --git a/source/gameengine/GamePlayer/common/GPC_RawImage.cpp b/source/gameengine/GamePlayer/common/GPC_RawImage.cpp deleted file mode 100644 index 0e2585b0baa..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_RawImage.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file gameengine/GamePlayer/common/GPC_RawImage.cpp - * \ingroup player - */ - -#include <iostream> -#include <string.h> - -#include "GPC_RawImage.h" -#include "GPC_RawLogoArrays.h" - - -GPC_RawImage::GPC_RawImage() - : m_data(0), m_dataSize(0), m_width(0), m_height(0) -{ -} - - -bool GPC_RawImage::Load( - const char *srcName, - int destWidth, int destHeight, - TImageAlignment alignment, int offsetX, int offsetY) -{ - int srcWidth, srcHeight; - bool success = true; - if (strcmp(srcName, "BlenderLogo") == 0) - GetRawBlenderLogo(&m_data, &srcWidth, &srcHeight); - else - if (strcmp(srcName, "Blender3DLogo") == 0) - GetRawBlender3DLogo(&m_data, &srcWidth, &srcHeight); -#if 0 - else - if (strcmp(srcName, "NaNLogo") == 0) - GetRawNaNLogo(&m_data, &srcWidth, &srcHeight); -#endif - else // unknown image - success = false; - - if (success) - { - unsigned char *tempData = m_data; - - int numBytes = destWidth * destHeight * 4; - m_data = new unsigned char[numBytes]; // re-use m_data ('unsigned char' was 'char') - if (m_data) - { - ::memset(m_data, 0x00000000, numBytes); - m_width = destWidth; - m_height = destHeight; - - int srcBytesWidth = srcWidth * 4; - int dstBytesWidth = m_width * 4; - int numRows = (srcHeight + offsetY) < m_height ? srcHeight : m_height - offsetY; - numBytes = (srcWidth + offsetX) < m_width ? srcBytesWidth : (m_width - offsetX) * 4; - - if ((offsetX < m_width) && (offsetY < m_height)) - { - unsigned char* src = (unsigned char*)tempData; - unsigned char* dst = (unsigned char*)m_data; - if (alignment == alignTopLeft) - { - // Put original in upper left corner - - // Add vertical offset - dst += offsetY * dstBytesWidth; - // Add horizontal offset - dst += offsetX * 4; - for (int row = 0; row < numRows; row++) - { - ::memcpy(dst, src, numBytes); - src += srcBytesWidth; - dst += dstBytesWidth; - } - } - else - { - // Put original in lower right corner - - // Add vertical offset - dst += (m_height - (srcHeight + offsetY)) * dstBytesWidth; - // Add horizontal offset - if (m_width > (srcWidth + offsetX)) { - dst += (m_width - (srcWidth + offsetX)) * 4; - } - else { - src += (srcWidth + offsetX - m_width) * 4; - } - for (int row = 0; row < numRows; row++) { - ::memcpy(dst, src, numBytes); - src += srcBytesWidth; - dst += dstBytesWidth; - } - } - } -// doesn't compile under Linux delete [] tempData; - delete tempData; - } - else { - // Allocation failed, restore old data - m_data = tempData; - success = false; - } - } - - return success; -} - diff --git a/source/gameengine/GamePlayer/common/GPC_RawImage.h b/source/gameengine/GamePlayer/common/GPC_RawImage.h deleted file mode 100644 index afff59484b9..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_RawImage.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file GPC_RawImage.h - * \ingroup player - */ - -#ifndef __GPC_RAWIMAGE_H__ -#define __GPC_RAWIMAGE_H__ - -/** - * This memory resource reads images from the application resources. - * Images are expected to be stored as raw RGBA bytes. - * You can generate these images by exporting images with an alpha - * channel from Photoshop in RAW format with interleaved channels. - */ - -class GPC_RawImage -{ -public: - GPC_RawImage(); - - typedef enum { - alignTopLeft, - alignBottomRight - } TImageAlignment; - - /** - * Loads the image form the resource into memory. - * Converts size of the image and places it with given alignment. - * \param hInstApp The application's instance (location of the resources). - * \param lpName Name of the resource. - * \param lpType Type of the resource. - * \param srcWidth The width of the resource image. - * \param srcHeight The height of the resource image. - * \param width The width of the image created. - * \param height The height of the image created. - * \param alignment How the resource image is located in the image created. - * \param offsetX Amount of horizontal offset applied to the resource image. - * \param offsetY Amount of vertical offset applied to the resource image. - */ - virtual bool Load(const char *srcName, - int destWidth, int destHeight, - TImageAlignment alignment = alignTopLeft, - int offsetX = 0, int offsetY = 0); - - /** - * Returns the width of the image. - * \return The width of the image. - */ - virtual int Width() const - { - return m_width; - } - - /** - * Returns the height of the image. - * \return The height of the image. - */ - virtual int Height() const - { - return m_height; - } - - /** - * Returns a pointer to the data loaded from the resource. - * \return A pointer to the data loaded from the resource. - */ - virtual unsigned char *Data() const - { - return m_data; - } - - /** - * Returns the size of the data loaded from the resource. - * \return The size of the loaded from the resource. - */ - virtual int DataSize() const - { - return m_dataSize; - } - -protected: - /** - * Disposes the data stored at the m_data member. - */ -// virtual void disposeData(void); - -protected: - unsigned char *m_data; - int m_dataSize; - int m_width; - int m_height; -}; - -#endif /* __GPC_RAWIMAGE_H__ */ diff --git a/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp b/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp deleted file mode 100644 index c4022d69153..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp +++ /dev/null @@ -1,9311 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp - * \ingroup player - */ - - -// This file is automatically generated. Do not edit by hand! - -#include "GPC_RawLoadDotBlendArray.h" - -void GetRawLoadingAnimation(unsigned char **data, int *dataSize) -{ - // create an array that will automatically be deleted when) - // we're outta this scope - static unsigned char load_blend[] = { - 66, 76, 69, 78, 68, 70, - 73, 10, 0, 2, 21, 0, 0, 2, 22, 0, 0, 0, 0, 0, 0, - 2, 30, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 65, 25, 242, 2, 0, 2, 29, 253, 0, 0, 0, 4, 160, 249, 227, - 5, 65, 25, 242, 2, 0, 2, 29, 237, 0, 0, 0, 10, 39, 161, - 89, 128, 65, 248, 18, 0, 0, 2, 28, 205, 179, 76, 248, 13, 9, - 10, 156, 188, 58, 101, 43, 138, 63, 142, 132, 111, 231, 106, 44, 72, - 171, 116, 148, 204, 204, 104, 121, 88, 224, 36, 141, 195, 251, 160, 141, - 162, 12, 177, 93, 203, 236, 68, 235, 2, 137, 27, 34, 49, 52, 25, - 83, 60, 100, 208, 12, 234, 185, 206, 97, 0, 109, 170, 238, 253, 66, - 0, 68, 0, 0, 236, 253, 127, 0, 246, 18, 0, 82, 0, 0, 0, - 42, 247, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, - 0, 0, 0, 0, 0, 36, 0, 2, 0, 0, 236, 253, 127, 0, 224, - 253, 127, 0, 224, 253, 127, 72, 249, 18, 0, 219, 128, 251, 119, 104, - 78, 249, 119, 255, 255, 255, 255, 0, 0, 0, 64, 111, 122, 152, 187, - 158, 149, 34, 236, 158, 103, 110, 35, 246, 67, 137, 177, 29, 56, 22, - 101, 64, 134, 124, 38, 155, 203, 128, 162, 3, 184, 27, 114, 80, 94, - 145, 136, 82, 121, 92, 7, 241, 119, 134, 12, 246, 193, 229, 95, 180, - 47, 135, 212, 231, 14, 59, 120, 218, 79, 151, 205, 221, 116, 27, 122, - 92, 0, 68, 0, 111, 0, 99, 0, 117, 0, 109, 0, 101, 0, 110, - 0, 116, 0, 115, 0, 82, 145, 252, 119, 255, 255, 255, 255, 60, 247, - 18, 0, 0, 0, 0, 0, 92, 247, 18, 0, 0, 16, 0, 0, 4, - 0, 0, 0, 0, 0, 242, 2, 0, 0, 242, 2, 32, 110, 172, 7, - 3, 239, 0, 0, 0, 0, 162, 7, 0, 0, 0, 64, 149, 244, 255, - 174, 70, 126, 180, 169, 78, 97, 78, 32, 67, 111, 110, 116, 101, 110, - 116, 32, 84, 101, 97, 109, 0, 247, 18, 0, 0, 16, 0, 0, 4, - 0, 0, 0, 0, 0, 242, 2, 0, 0, 242, 2, 80, 33, 90, 7, - 2, 32, 0, 0, 0, 0, 72, 7, 82, 145, 252, 119, 255, 255, 255, - 255, 168, 247, 18, 0, 0, 0, 0, 0, 200, 247, 18, 0, 0, 16, - 0, 0, 4, 0, 0, 0, 0, 0, 242, 2, 0, 0, 242, 2, 64, - 33, 88, 7, 2, 67, 0, 0, 0, 0, 72, 7, 216, 69, 0, 2, - 99, 111, 110, 116, 101, 110, 116, 99, 114, 101, 97, 116, 105, 111, 110, - 64, 98, 108, 101, 110, 100, 101, 114, 46, 110, 108, 0, 2, 81, 67, - 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 216, 69, 0, 0, 0, - 0, 72, 7, 116, 249, 18, 0, 127, 164, 252, 119, 0, 0, 242, 2, - 103, 154, 252, 119, 0, 0, 0, 0, 128, 26, 2, 0, 112, 112, 247, - 2, 12, 155, 252, 119, 255, 255, 255, 255, 40, 248, 18, 0, 0, 0, - 0, 0, 124, 249, 18, 0, 0, 16, 0, 0, 0, 236, 179, 7, 120, - 1, 242, 2, 48, 62, 8, 0, 184, 250, 18, 0, 0, 0, 72, 7, - 0, 112, 166, 7, 0, 0, 242, 2, 80, 0, 242, 2, 80, 0, 242, - 2, 0, 0, 226, 7, 0, 16, 162, 7, 0, 240, 5, 0, 248, 3, - 242, 2, 248, 3, 242, 2, 10, 0, 0, 0, 1, 0, 0, 0, 248, - 3, 242, 2, 120, 1, 242, 2, 112, 236, 179, 7, 120, 1, 242, 2, - 120, 1, 242, 2, 104, 236, 179, 7, 0, 16, 0, 0, 4, 0, 0, - 0, 0, 0, 242, 2, 0, 0, 242, 2, 64, 0, 162, 7, 3, 239, - 0, 0, 0, 0, 162, 7, 112, 236, 179, 7, 96, 157, 12, 3, 112, - 236, 179, 7, 120, 1, 242, 2, 104, 236, 179, 7, 18, 0, 0, 0, - 168, 248, 18, 0, 166, 166, 252, 119, 0, 0, 72, 7, 0, 48, 84, - 7, 64, 27, 84, 7, 0, 0, 242, 2, 236, 248, 18, 0, 176, 160, - 252, 119, 0, 0, 72, 7, 0, 32, 84, 7, 0, 16, 0, 0, 0, - 0, 242, 2, 64, 27, 84, 7, 1, 0, 0, 0, 136, 4, 0, 0, - 0, 27, 84, 7, 144, 1, 161, 7, 0, 0, 0, 0, 0, 0, 0, - 0, 145, 0, 0, 0, 145, 0, 0, 0, 152, 0, 0, 0, 0, 0, - 72, 7, 144, 249, 18, 0, 9, 151, 252, 119, 0, 32, 84, 7, 0, - 16, 0, 0, 143, 157, 252, 119, 86, 250, 18, 0, 72, 27, 84, 7, - 32, 0, 226, 7, 8, 0, 0, 0, 193, 0, 0, 0, 25, 0, 0, - 0, 0, 0, 242, 2, 135, 2, 0, 0, 112, 236, 179, 7, 64, 33, - 88, 7, 19, 0, 0, 0, 0, 249, 18, 0, 0, 67, 0, 0, 72, - 27, 84, 7, 0, 0, 0, 0, 0, 0, 0, 0, 200, 59, 90, 7, - 0, 0, 0, 0, 63, 0, 0, 0, 72, 33, 88, 7, 128, 26, 2, - 0, 112, 112, 247, 2, 0, 0, 0, 0, 16, 0, 0, 0, 224, 249, - 18, 0, 255, 255, 223, 255, 32, 0, 0, 0, 252, 24, 242, 2, 144, - 0, 0, 0, 8, 0, 0, 0, 77, 26, 2, 0, 1, 120, 64, 0, - 80, 6, 242, 2, 109, 26, 228, 7, 210, 119, 64, 0, 16, 0, 0, - 0, 191, 119, 64, 0, 65, 97, 108, 46, 0, 2, 26, 101, 0, 0, - 0, 6, 77, 194, 164, 27, 66, 114, 105, 0, 0, 2, 26, 77, 0, - 7, 126, 76, 0, 0, 0, 1, 121, 216, 88, 60, 9, 46, 197, 144, - 120, 249, 120, 38, 9, 47, 236, 125, 7, 120, 19, 71, 211, 240, 158, - 108, 176, 1, 3, 162, 155, 46, 211, 171, 113, 161, 186, 232, 132, 49, - 29, 131, 232, 132, 18, 100, 192, 96, 83, 140, 177, 77, 77, 192, 162, - 147, 64, 192, 9, 189, 37, 14, 16, 8, 9, 197, 96, 211, 193, 18, - 37, 116, 136, 147, 80, 2, 164, 152, 150, 0, 129, 196, 132, 22, 170, - 254, 153, 211, 173, 180, 42, 167, 147, 49, 223, 251, 230, 251, 126, 204, - 115, 104, 110, 119, 102, 118, 118, 119, 118, 102, 118, 111, 116, 106, 25, - 61, 210, 159, 120, 77, 9, 35, 132, 40, 178, 238, 111, 237, 30, 209, - 169, 117, 231, 200, 214, 221, 6, 142, 11, 10, 10, 234, 6, 160, 10, - 42, 110, 60, 43, 73, 240, 143, 131, 43, 24, 174, 182, 112, 141, 138, - 142, 139, 39, 78, 254, 186, 119, 35, 100, 8, 124, 166, 206, 138, 247, - 106, 43, 210, 56, 226, 36, 13, 78, 140, 137, 113, 160, 167, 184, 26, - 160, 205, 158, 22, 239, 165, 135, 43, 125, 85, 188, 87, 218, 202, 120, - 47, 213, 23, 112, 191, 35, 222, 139, 16, 147, 39, 92, 30, 164, 0, - 241, 84, 136, 20, 28, 241, 38, 145, 45, 123, 180, 44, 45, 210, 182, - 19, 121, 229, 206, 68, 124, 219, 63, 138, 135, 117, 20, 47, 13, 96, - 164, 19, 81, 60, 89, 188, 52, 6, 79, 11, 176, 133, 103, 1, 91, - 60, 45, 131, 71, 0, 78, 179, 226, 217, 180, 75, 24, 188, 244, 25, - 241, 94, 90, 171, 140, 28, 139, 135, 117, 20, 79, 7, 48, 177, 242, - 179, 193, 211, 49, 120, 74, 128, 145, 206, 204, 238, 150, 7, 139, 167, - 100, 240, 140, 211, 227, 189, 116, 20, 175, 128, 45, 30, 214, 81, 188, - 4, 128, 149, 34, 158, 81, 97, 219, 110, 2, 131, 167, 2, 24, 233, - 204, 120, 182, 252, 84, 12, 30, 206, 105, 130, 5, 175, 143, 13, 30, - 214, 181, 99, 116, 64, 53, 157, 202, 103, 197, 243, 133, 79, 212, 137, - 246, 34, 94, 192, 52, 51, 78, 154, 56, 47, 28, 51, 199, 190, 98, - 61, 197, 205, 153, 106, 214, 39, 173, 56, 215, 246, 184, 88, 79, 113, - 83, 1, 22, 120, 75, 224, 166, 50, 184, 26, 128, 145, 150, 206, 165, - 61, 174, 134, 193, 205, 213, 199, 123, 165, 138, 184, 132, 209, 77, 138, - 139, 245, 20, 55, 13, 96, 164, 197, 121, 114, 214, 183, 52, 6, 87, - 11, 48, 210, 226, 92, 165, 57, 193, 213, 50, 184, 217, 159, 1, 142, - 136, 107, 209, 1, 6, 23, 235, 41, 174, 30, 96, 164, 21, 230, 214, - 137, 188, 122, 6, 55, 0, 96, 164, 69, 220, 116, 39, 124, 3, 24, - 220, 156, 79, 97, 46, 62, 51, 235, 130, 51, 25, 176, 222, 50, 23, - 0, 7, 136, 184, 74, 39, 184, 169, 12, 174, 6, 96, 164, 77, 96, - 244, 209, 102, 46, 24, 220, 220, 213, 48, 23, 159, 138, 237, 59, 25, - 51, 172, 183, 204, 5, 192, 72, 171, 146, 224, 155, 198, 224, 106, 1, - 70, 90, 196, 77, 112, 130, 171, 101, 112, 9, 192, 72, 139, 186, 143, - 125, 179, 151, 129, 48, 184, 104, 7, 181, 34, 110, 186, 19, 92, 172, - 111, 207, 218, 91, 17, 87, 101, 39, 195, 79, 40, 47, 216, 211, 14, - 212, 22, 44, 55, 215, 11, 246, 111, 166, 85, 143, 177, 44, 231, 202, - 99, 133, 112, 253, 104, 190, 200, 155, 248, 19, 237, 225, 75, 230, 254, - 182, 221, 189, 96, 189, 4, 67, 92, 128, 40, 136, 167, 39, 87, 224, - 54, 241, 128, 127, 21, 61, 204, 190, 5, 255, 18, 230, 69, 146, 180, - 211, 17, 36, 189, 113, 71, 98, 92, 25, 41, 92, 217, 43, 160, 207, - 112, 41, 253, 158, 40, 148, 31, 63, 81, 96, 127, 211, 80, 167, 161, - 76, 99, 231, 139, 60, 89, 153, 114, 62, 139, 52, 3, 67, 90, 225, - 255, 133, 78, 173, 141, 28, 58, 180, 230, 65, 122, 159, 183, 63, 61, - 208, 212, 137, 32, 228, 56, 240, 188, 138, 244, 252, 213, 73, 153, 60, - 182, 206, 9, 158, 170, 56, 20, 121, 19, 205, 153, 120, 47, 147, 201, - 158, 118, 9, 71, 231, 8, 231, 133, 206, 145, 102, 169, 217, 7, 82, - 91, 128, 107, 156, 174, 133, 156, 243, 48, 55, 231, 223, 208, 220, 48, - 115, 240, 135, 7, 51, 72, 226, 189, 201, 131, 153, 35, 79, 243, 85, - 80, 144, 209, 203, 139, 43, 128, 189, 243, 224, 54, 42, 172, 115, 36, - 216, 102, 152, 163, 236, 79, 204, 195, 155, 0, 115, 164, 93, 6, 250, - 5, 87, 118, 201, 103, 10, 188, 176, 191, 26, 232, 36, 150, 69, 216, - 205, 81, 1, 6, 46, 139, 113, 67, 203, 94, 173, 85, 61, 90, 118, - 107, 219, 210, 86, 220, 193, 33, 253, 35, 71, 15, 30, 59, 42, 38, - 62, 57, 73, 21, 29, 63, 68, 213, 61, 38, 57, 57, 46, 126, 88, - 82, 255, 68, 184, 139, 30, 57, 178, 127, 100, 76, 210, 136, 228, 209, - 9, 253, 7, 38, 140, 29, 52, 50, 46, 41, 54, 38, 177, 97, 66, - 98, 204, 200, 209, 209, 67, 98, 18, 251, 147, 255, 109, 127, 133, 48, - 88, 131, 43, 150, 176, 211, 110, 213, 38, 170, 67, 168, 55, 22, 29, - 74, 5, 219, 181, 220, 188, 198, 81, 143, 88, 27, 153, 243, 61, 232, - 16, 92, 185, 103, 30, 43, 30, 194, 181, 58, 180, 132, 198, 190, 205, - 242, 166, 162, 14, 101, 43, 90, 234, 13, 160, 239, 6, 122, 223, 142, - 139, 202, 162, 240, 1, 16, 205, 3, 26, 190, 233, 97, 123, 95, 142, - 179, 222, 251, 138, 245, 94, 176, 30, 64, 123, 184, 44, 197, 89, 5, - 106, 209, 82, 70, 135, 210, 39, 152, 215, 121, 218, 216, 86, 196, 8, - 48, 94, 250, 197, 96, 167, 182, 64, 63, 114, 31, 40, 240, 194, 254, - 206, 3, 94, 88, 30, 78, 237, 240, 34, 115, 223, 204, 205, 233, 121, - 39, 235, 212, 85, 153, 30, 175, 139, 133, 159, 25, 205, 101, 121, 166, - 23, 254, 128, 94, 131, 101, 175, 59, 158, 15, 170, 61, 212, 32, 143, - 157, 159, 93, 85, 219, 227, 54, 56, 242, 155, 67, 153, 177, 74, 165, - 67, 158, 23, 63, 51, 210, 251, 195, 241, 190, 17, 185, 117, 210, 52, - 246, 114, 125, 81, 106, 155, 70, 33, 174, 47, 142, 185, 170, 192, 60, - 16, 226, 19, 129, 248, 103, 78, 159, 134, 161, 124, 214, 170, 125, 211, - 118, 124, 159, 210, 133, 52, 179, 222, 25, 8, 124, 141, 141, 115, 158, - 24, 194, 219, 69, 157, 228, 209, 126, 13, 228, 134, 113, 120, 61, 48, - 157, 86, 60, 55, 157, 19, 148, 177, 52, 211, 142, 106, 177, 121, 14, - 112, 126, 106, 136, 247, 97, 18, 123, 2, 176, 20, 116, 60, 248, 246, - 138, 213, 150, 88, 51, 77, 156, 75, 106, 191, 181, 31, 67, 236, 0, - 124, 164, 236, 247, 212, 217, 51, 91, 133, 188, 120, 63, 114, 205, 179, - 174, 135, 59, 191, 188, 252, 198, 237, 183, 66, 88, 103, 10, 187, 21, - 103, 107, 191, 179, 21, 102, 57, 223, 161, 190, 27, 116, 21, 251, 80, - 24, 109, 88, 235, 78, 173, 91, 245, 80, 181, 143, 106, 217, 182, 181, - 61, 117, 57, 17, 255, 20, 215, 29, 56, 212, 113, 42, 157, 55, 252, - 171, 66, 62, 81, 212, 130, 207, 108, 248, 204, 129, 207, 199, 240, 57, - 11, 40, 94, 1, 77, 49, 143, 79, 20, 175, 160, 172, 152, 71, 37, - 82, 139, 236, 80, 108, 82, 148, 129, 242, 101, 138, 115, 92, 25, 146, - 24, 61, 104, 80, 92, 114, 191, 192, 1, 254, 201, 195, 162, 255, 11, - 118, 171, 149, 172, 157, 142, 154, 168, 178, 96, 56, 55, 214, 137, 49, - 73, 49, 209, 137, 131, 99, 95, 199, 106, 255, 255, 222, 127, 171, 167, - 48, 107, 174, 73, 252, 115, 151, 46, 231, 241, 99, 133, 242, 122, 7, - 66, 125, 54, 234, 53, 235, 179, 81, 231, 89, 159, 221, 144, 250, 236, - 54, 237, 59, 181, 38, 221, 222, 177, 153, 139, 16, 9, 103, 156, 135, - 177, 32, 20, 242, 31, 52, 50, 38, 126, 72, 255, 30, 49, 19, 146, - 251, 147, 193, 201, 253, 253, 253, 243, 237, 212, 19, 7, 37, 155, 121, - 55, 28, 26, 23, 31, 61, 210, 220, 66, 62, 248, 121, 139, 159, 211, - 37, 34, 28, 139, 207, 78, 181, 250, 108, 60, 243, 64, 31, 142, 126, - 26, 227, 120, 26, 251, 11, 182, 254, 212, 99, 5, 94, 169, 39, 204, - 215, 244, 65, 213, 29, 252, 193, 149, 203, 39, 194, 237, 203, 70, 151, - 244, 216, 199, 250, 56, 243, 165, 231, 15, 139, 14, 1, 125, 116, 79, - 240, 201, 236, 61, 250, 108, 122, 239, 43, 214, 23, 34, 133, 65, 198, - 130, 5, 213, 10, 181, 2, 99, 243, 170, 30, 142, 113, 95, 234, 229, - 246, 2, 172, 252, 50, 146, 228, 108, 134, 125, 220, 122, 216, 115, 173, - 123, 162, 192, 11, 251, 187, 10, 117, 10, 202, 35, 169, 109, 223, 108, - 238, 91, 65, 7, 123, 76, 63, 171, 100, 17, 253, 120, 176, 197, 15, - 15, 16, 141, 51, 255, 235, 248, 167, 86, 216, 126, 186, 250, 11, 200, - 137, 197, 246, 45, 126, 25, 73, 110, 153, 238, 155, 80, 58, 148, 183, - 143, 40, 99, 107, 122, 46, 179, 9, 246, 155, 112, 95, 136, 234, 255, - 72, 115, 28, 94, 195, 66, 13, 222, 20, 46, 244, 165, 56, 211, 37, - 224, 234, 6, 87, 15, 113, 230, 75, 136, 88, 219, 57, 199, 51, 170, - 253, 34, 127, 158, 238, 65, 191, 2, 31, 2, 109, 217, 118, 163, 116, - 4, 240, 62, 112, 230, 244, 60, 158, 222, 3, 166, 145, 250, 82, 37, - 213, 101, 206, 220, 214, 100, 177, 29, 37, 177, 222, 151, 16, 235, 11, - 95, 172, 30, 134, 23, 209, 13, 111, 67, 200, 164, 72, 54, 214, 116, - 246, 167, 187, 19, 239, 229, 107, 185, 235, 18, 225, 112, 208, 198, 200, - 70, 227, 51, 236, 3, 141, 207, 2, 54, 66, 252, 182, 201, 188, 143, - 29, 245, 21, 207, 115, 85, 234, 31, 152, 244, 110, 93, 161, 31, 21, - 51, 235, 242, 95, 230, 244, 9, 111, 22, 192, 11, 177, 144, 222, 231, - 189, 125, 199, 134, 167, 240, 75, 126, 255, 64, 208, 231, 175, 30, 53, - 81, 199, 214, 62, 23, 94, 179, 227, 68, 53, 234, 238, 72, 160, 71, - 154, 239, 139, 188, 39, 232, 246, 163, 202, 245, 15, 108, 6, 250, 163, - 64, 131, 247, 200, 183, 41, 240, 90, 38, 210, 31, 27, 176, 40, 235, - 210, 225, 209, 225, 115, 47, 61, 56, 128, 244, 31, 172, 127, 24, 126, - 233, 238, 172, 125, 101, 70, 111, 222, 139, 245, 143, 87, 255, 24, 126, - 134, 251, 58, 244, 234, 209, 195, 33, 120, 255, 113, 11, 213, 222, 160, - 152, 19, 225, 57, 77, 139, 238, 193, 251, 171, 17, 183, 194, 180, 237, - 106, 135, 125, 219, 198, 180, 7, 233, 115, 107, 47, 209, 68, 62, 152, - 161, 169, 179, 249, 8, 78, 27, 25, 224, 121, 41, 107, 199, 172, 66, - 252, 139, 199, 126, 194, 78, 37, 98, 232, 23, 135, 75, 239, 216, 219, - 170, 222, 166, 130, 135, 216, 246, 231, 137, 237, 247, 122, 233, 207, 63, - 233, 85, 221, 208, 177, 233, 196, 172, 115, 15, 167, 103, 125, 49, 255, - 184, 134, 106, 16, 27, 159, 153, 255, 204, 241, 153, 48, 87, 16, 159, - 1, 47, 245, 149, 195, 163, 15, 64, 95, 108, 214, 58, 198, 103, 126, - 220, 82, 14, 47, 155, 89, 113, 50, 151, 212, 158, 227, 156, 80, 123, - 142, 107, 21, 231, 139, 181, 231, 133, 109, 236, 185, 157, 189, 12, 249, - 119, 111, 174, 44, 246, 60, 32, 40, 223, 182, 156, 181, 231, 174, 246, - 96, 24, 7, 226, 56, 190, 195, 204, 31, 142, 49, 142, 99, 183, 214, - 218, 78, 45, 91, 181, 118, 26, 8, 122, 137, 248, 213, 185, 193, 240, - 81, 149, 169, 41, 98, 23, 7, 190, 226, 204, 113, 224, 43, 206, 28, - 7, 190, 226, 254, 230, 204, 113, 96, 83, 197, 43, 14, 227, 192, 166, - 10, 140, 3, 253, 132, 248, 239, 21, 241, 84, 188, 32, 52, 14, 12, - 246, 31, 158, 48, 204, 226, 66, 251, 39, 131, 243, 28, 155, 24, 211, - 31, 43, 243, 24, 168, 228, 121, 46, 36, 116, 133, 138, 64, 250, 19, - 27, 246, 46, 113, 95, 59, 14, 252, 87, 247, 223, 230, 239, 77, 247, - 63, 191, 113, 96, 238, 163, 199, 138, 156, 180, 54, 150, 152, 5, 227, - 148, 14, 236, 243, 155, 84, 235, 249, 39, 158, 83, 101, 139, 231, 244, - 169, 71, 33, 86, 193, 235, 176, 249, 122, 83, 49, 75, 63, 15, 243, - 57, 2, 123, 63, 154, 185, 79, 16, 235, 139, 128, 55, 134, 29, 28, - 68, 44, 227, 132, 243, 196, 43, 156, 227, 121, 162, 242, 120, 123, 146, - 134, 48, 92, 1, 235, 32, 254, 74, 131, 190, 116, 125, 166, 80, 142, - 249, 71, 65, 253, 50, 150, 83, 191, 156, 176, 214, 220, 55, 91, 191, - 60, 223, 206, 47, 207, 119, 234, 151, 199, 137, 126, 248, 165, 157, 95, - 126, 41, 250, 101, 172, 151, 243, 203, 218, 162, 175, 20, 246, 118, 31, - 253, 242, 159, 146, 126, 121, 190, 173, 95, 22, 251, 48, 155, 238, 85, - 63, 135, 56, 13, 250, 231, 35, 198, 46, 230, 179, 3, 218, 46, 126, - 98, 63, 166, 69, 152, 239, 239, 70, 248, 43, 172, 177, 213, 56, 113, - 114, 26, 42, 172, 253, 161, 247, 180, 63, 214, 63, 228, 53, 41, 210, - 124, 206, 160, 106, 89, 88, 12, 185, 18, 166, 91, 207, 50, 105, 220, - 128, 50, 209, 184, 1, 231, 3, 229, 125, 27, 55, 252, 123, 226, 6, - 156, 19, 118, 31, 136, 243, 245, 54, 110, 120, 189, 184, 161, 59, 236, - 114, 230, 128, 173, 210, 237, 143, 247, 10, 165, 207, 225, 118, 216, 62, - 199, 238, 222, 42, 208, 41, 111, 58, 254, 186, 109, 241, 94, 250, 94, - 214, 117, 164, 4, 94, 154, 61, 86, 30, 67, 253, 2, 3, 99, 253, - 182, 165, 195, 231, 1, 206, 215, 25, 159, 96, 210, 22, 44, 227, 16, - 219, 115, 77, 187, 253, 150, 94, 145, 195, 133, 1, 206, 71, 68, 195, - 105, 56, 78, 60, 31, 3, 55, 146, 178, 124, 249, 30, 126, 197, 242, - 229, 203, 79, 159, 190, 235, 100, 143, 102, 110, 112, 32, 88, 135, 2, - 226, 136, 148, 23, 85, 207, 254, 172, 181, 81, 163, 127, 247, 57, 124, - 163, 70, 137, 160, 16, 49, 137, 141, 254, 181, 242, 145, 234, 228, 237, - 223, 27, 251, 67, 123, 87, 73, 92, 79, 45, 232, 243, 211, 125, 226, - 186, 82, 90, 215, 159, 222, 167, 187, 66, 119, 57, 222, 139, 226, 35, - 14, 197, 79, 0, 24, 233, 17, 95, 97, 193, 223, 173, 208, 252, 108, - 197, 79, 96, 240, 85, 0, 11, 109, 0, 190, 135, 5, 127, 191, 34, - 221, 104, 197, 87, 49, 248, 217, 123, 193, 63, 138, 248, 158, 22, 252, - 158, 16, 111, 89, 241, 17, 135, 226, 235, 1, 70, 122, 142, 57, 141, - 42, 170, 240, 228, 52, 247, 172, 248, 122, 6, 63, 0, 96, 164, 71, - 67, 70, 207, 105, 52, 10, 13, 135, 231, 1, 20, 63, 128, 193, 207, - 1, 187, 131, 244, 40, 15, 53, 64, 248, 204, 32, 224, 132, 21, 31, - 113, 40, 126, 42, 192, 1, 34, 62, 181, 149, 222, 138, 126, 156, 178, - 123, 172, 5, 63, 149, 193, 71, 187, 134, 244, 28, 19, 19, 233, 125, - 98, 56, 180, 129, 20, 95, 195, 224, 19, 145, 30, 249, 23, 102, 248, - 231, 148, 136, 245, 162, 182, 23, 237, 109, 40, 107, 79, 247, 91, 109, - 103, 247, 86, 66, 230, 147, 127, 64, 64, 160, 243, 220, 165, 51, 182, - 182, 55, 0, 120, 105, 50, 65, 198, 76, 199, 92, 36, 142, 188, 181, - 189, 111, 109, 239, 219, 191, 188, 216, 94, 92, 79, 22, 219, 146, 105, - 125, 198, 75, 215, 82, 57, 197, 66, 69, 234, 119, 140, 109, 201, 100, - 108, 11, 192, 72, 207, 49, 49, 178, 222, 103, 132, 2, 215, 172, 197, - 182, 48, 248, 116, 221, 34, 236, 97, 225, 223, 90, 65, 90, 91, 109, - 145, 38, 211, 206, 182, 136, 248, 212, 246, 126, 194, 45, 84, 232, 47, - 198, 123, 117, 129, 0, 121, 147, 194, 28, 155, 53, 165, 252, 207, 216, - 218, 132, 46, 17, 173, 162, 71, 197, 36, 70, 75, 217, 137, 34, 121, - 28, 51, 180, 177, 194, 30, 113, 241, 35, 135, 211, 111, 109, 110, 172, - 151, 187, 124, 30, 6, 220, 210, 196, 237, 95, 123, 240, 224, 225, 230, - 54, 153, 23, 35, 63, 159, 158, 217, 39, 246, 87, 99, 189, 161, 107, - 53, 10, 176, 29, 96, 126, 28, 158, 149, 167, 248, 46, 225, 39, 118, - 186, 159, 113, 118, 255, 11, 181, 252, 51, 116, 235, 253, 207, 77, 2, - 249, 199, 134, 230, 252, 244, 51, 235, 49, 229, 148, 108, 136, 92, 144, - 245, 219, 136, 15, 212, 117, 158, 142, 16, 112, 60, 58, 213, 227, 111, - 247, 169, 110, 232, 48, 243, 168, 192, 87, 245, 67, 64, 75, 242, 229, - 188, 131, 135, 4, 25, 245, 188, 98, 89, 18, 191, 54, 121, 181, 58, - 113, 231, 178, 12, 172, 7, 56, 11, 203, 174, 133, 148, 204, 20, 198, - 122, 102, 209, 224, 133, 173, 190, 13, 166, 109, 30, 139, 45, 100, 220, - 190, 232, 156, 166, 193, 208, 181, 70, 231, 207, 246, 243, 246, 103, 181, - 237, 5, 184, 46, 17, 70, 111, 171, 158, 14, 97, 250, 170, 231, 11, - 214, 29, 194, 139, 207, 219, 133, 126, 152, 239, 237, 207, 19, 254, 211, - 127, 212, 23, 88, 199, 129, 234, 47, 234, 44, 213, 95, 212, 47, 212, - 103, 123, 253, 181, 119, 142, 175, 171, 191, 174, 254, 140, 105, 238, 235, - 47, 253, 51, 231, 99, 184, 223, 103, 182, 82, 154, 70, 234, 62, 127, - 57, 35, 175, 75, 47, 93, 246, 154, 250, 27, 105, 214, 95, 47, 9, - 253, 45, 124, 177, 122, 56, 171, 191, 230, 243, 28, 187, 252, 58, 251, - 231, 200, 233, 96, 87, 225, 50, 158, 54, 95, 90, 241, 202, 151, 190, - 106, 92, 207, 37, 218, 235, 78, 98, 219, 49, 78, 98, 47, 142, 249, - 63, 41, 38, 62, 105, 116, 162, 235, 22, 211, 210, 109, 229, 69, 254, - 158, 76, 185, 176, 55, 56, 109, 246, 43, 90, 17, 142, 117, 26, 243, - 217, 158, 210, 12, 30, 29, 159, 44, 215, 91, 157, 68, 219, 58, 166, - 109, 173, 216, 118, 152, 8, 143, 115, 210, 118, 17, 40, 193, 53, 25, - 61, 216, 117, 147, 202, 211, 214, 60, 30, 165, 120, 63, 74, 228, 231, - 105, 23, 35, 83, 59, 129, 182, 129, 218, 9, 220, 123, 176, 190, 174, - 75, 196, 96, 193, 78, 116, 27, 157, 76, 98, 163, 135, 140, 30, 79, - 70, 70, 199, 199, 88, 229, 227, 94, 83, 11, 178, 251, 59, 230, 65, - 42, 35, 221, 183, 19, 172, 63, 99, 203, 251, 4, 55, 108, 172, 251, - 252, 165, 225, 210, 55, 51, 121, 41, 59, 129, 190, 4, 124, 74, 198, - 235, 218, 9, 244, 71, 248, 217, 169, 78, 204, 6, 44, 51, 251, 38, - 161, 60, 3, 224, 12, 138, 103, 43, 163, 158, 143, 243, 91, 19, 28, - 235, 183, 38, 195, 202, 83, 207, 31, 111, 182, 37, 56, 78, 40, 35, - 36, 113, 122, 51, 161, 110, 56, 224, 225, 125, 244, 231, 47, 249, 31, - 191, 153, 105, 88, 221, 230, 187, 204, 55, 97, 39, 44, 135, 217, 145, - 156, 194, 153, 159, 107, 158, 185, 228, 132, 75, 59, 225, 196, 209, 25, - 143, 131, 93, 128, 75, 35, 94, 250, 99, 230, 43, 251, 168, 249, 250, - 159, 182, 19, 26, 81, 134, 190, 118, 186, 152, 28, 55, 42, 70, 24, - 211, 209, 9, 78, 185, 23, 176, 201, 88, 37, 228, 238, 113, 235, 186, - 65, 219, 131, 125, 121, 19, 182, 135, 28, 119, 190, 254, 105, 185, 16, - 215, 30, 179, 218, 30, 132, 223, 148, 237, 209, 28, 115, 222, 54, 45, - 23, 206, 32, 142, 90, 109, 15, 194, 227, 156, 246, 153, 19, 202, 228, - 108, 79, 194, 81, 235, 24, 6, 136, 247, 9, 22, 126, 5, 225, 243, - 132, 101, 94, 228, 254, 168, 109, 66, 123, 68, 109, 19, 158, 163, 208, - 56, 217, 140, 211, 41, 122, 84, 130, 195, 246, 222, 34, 127, 225, 215, - 212, 188, 4, 226, 104, 155, 178, 179, 221, 183, 77, 213, 71, 8, 71, - 236, 228, 138, 218, 43, 194, 133, 126, 107, 172, 151, 237, 223, 229, 226, - 237, 249, 188, 218, 166, 135, 158, 77, 4, 62, 15, 60, 155, 24, 109, - 219, 48, 255, 61, 16, 235, 41, 158, 173, 140, 249, 143, 97, 128, 191, - 90, 108, 135, 217, 59, 232, 45, 240, 223, 158, 77, 178, 216, 250, 232, - 105, 207, 240, 57, 142, 126, 228, 96, 254, 160, 192, 83, 201, 198, 48, - 172, 198, 187, 105, 155, 254, 211, 49, 183, 198, 189, 24, 28, 117, 214, - 178, 135, 252, 57, 222, 11, 245, 217, 65, 127, 131, 254, 93, 250, 11, - 253, 104, 138, 250, 241, 58, 250, 251, 208, 115, 199, 6, 212, 223, 203, - 197, 79, 240, 121, 209, 223, 25, 237, 99, 26, 163, 110, 90, 245, 87, - 111, 4, 95, 217, 152, 35, 250, 47, 241, 110, 26, 212, 163, 14, 83, - 253, 181, 149, 49, 255, 250, 11, 252, 97, 22, 244, 89, 230, 79, 179, - 158, 66, 251, 65, 84, 95, 5, 253, 109, 50, 106, 29, 171, 191, 170, - 191, 191, 108, 252, 127, 93, 127, 81, 103, 169, 254, 226, 57, 57, 234, - 179, 131, 254, 6, 255, 235, 236, 47, 62, 131, 109, 246, 58, 250, 91, - 109, 153, 234, 75, 179, 254, 182, 215, 228, 209, 254, 26, 103, 180, 191, - 217, 152, 234, 111, 156, 95, 181, 29, 168, 195, 189, 43, 95, 255, 146, - 218, 229, 105, 80, 207, 216, 95, 70, 198, 55, 98, 127, 179, 98, 253, - 170, 101, 60, 16, 237, 44, 200, 34, 232, 243, 116, 225, 147, 234, 239, - 61, 59, 253, 173, 211, 228, 255, 186, 254, 162, 206, 82, 253, 197, 179, - 61, 212, 103, 7, 253, 109, 252, 111, 179, 191, 154, 93, 168, 31, 175, - 163, 191, 165, 238, 124, 42, 232, 239, 245, 83, 75, 242, 164, 191, 69, - 166, 164, 239, 64, 29, 102, 236, 175, 166, 248, 242, 167, 59, 106, 30, - 208, 109, 20, 198, 2, 234, 177, 206, 106, 127, 89, 25, 243, 175, 191, - 208, 62, 238, 125, 212, 230, 79, 97, 189, 100, 21, 91, 254, 212, 162, - 207, 168, 191, 153, 125, 163, 215, 179, 250, 187, 69, 149, 186, 227, 255, - 186, 254, 162, 206, 90, 246, 230, 223, 197, 123, 161, 62, 91, 113, 180, - 184, 25, 119, 8, 32, 94, 119, 111, 142, 252, 241, 51, 189, 175, 163, - 254, 170, 90, 185, 175, 191, 251, 163, 106, 26, 157, 237, 205, 67, 151, - 253, 206, 31, 26, 30, 166, 153, 251, 233, 217, 64, 115, 110, 203, 155, - 59, 195, 91, 253, 209, 23, 161, 108, 205, 18, 239, 241, 181, 214, 246, - 226, 248, 221, 27, 75, 218, 12, 14, 150, 9, 243, 173, 226, 248, 195, - 32, 75, 212, 142, 206, 25, 206, 228, 168, 51, 233, 97, 45, 44, 11, - 168, 249, 113, 144, 179, 54, 71, 125, 62, 189, 49, 244, 81, 83, 207, - 114, 6, 157, 63, 122, 235, 25, 158, 243, 189, 249, 235, 156, 225, 105, - 192, 87, 227, 69, 46, 154, 47, 227, 121, 243, 149, 125, 206, 124, 253, - 39, 246, 230, 216, 190, 253, 222, 60, 33, 113, 244, 176, 196, 152, 164, - 36, 210, 173, 75, 219, 110, 173, 187, 119, 183, 223, 164, 43, 236, 78, - 212, 71, 26, 109, 247, 230, 216, 23, 251, 189, 121, 97, 225, 59, 14, - 156, 219, 123, 115, 205, 5, 24, 139, 11, 206, 247, 199, 180, 92, 56, - 23, 60, 111, 222, 31, 71, 138, 52, 67, 152, 118, 45, 253, 200, 199, - 115, 50, 173, 216, 134, 179, 61, 191, 135, 216, 31, 15, 55, 247, 252, - 26, 224, 163, 63, 239, 188, 79, 180, 92, 216, 243, 159, 51, 247, 201, - 83, 164, 25, 70, 207, 33, 71, 62, 86, 88, 206, 2, 206, 229, 243, - 44, 224, 156, 221, 89, 192, 57, 219, 179, 128, 188, 140, 159, 229, 44, - 224, 59, 102, 47, 117, 15, 250, 122, 209, 153, 45, 12, 126, 35, 182, - 208, 229, 179, 186, 150, 238, 219, 66, 214, 230, 73, 157, 95, 162, 77, - 162, 87, 222, 158, 251, 56, 191, 119, 198, 199, 85, 153, 173, 140, 255, - 162, 231, 113, 130, 45, 116, 244, 229, 249, 121, 158, 241, 95, 221, 75, - 221, 99, 246, 82, 119, 226, 189, 168, 191, 181, 209, 223, 160, 55, 171, - 191, 105, 203, 28, 159, 39, 235, 195, 229, 245, 87, 43, 202, 198, 230, - 31, 190, 206, 89, 150, 251, 190, 220, 158, 159, 251, 101, 182, 50, 254, - 139, 158, 199, 17, 231, 250, 75, 99, 81, 169, 231, 201, 158, 132, 227, - 200, 127, 237, 207, 185, 47, 247, 100, 116, 130, 179, 223, 99, 221, 177, - 234, 53, 230, 102, 161, 158, 91, 245, 58, 105, 68, 204, 200, 152, 228, - 209, 241, 206, 99, 212, 242, 175, 251, 252, 104, 145, 173, 94, 167, 105, - 99, 189, 84, 49, 238, 191, 91, 3, 159, 19, 105, 27, 249, 105, 204, - 207, 137, 24, 191, 101, 83, 238, 252, 249, 17, 158, 109, 37, 78, 111, - 22, 156, 215, 51, 174, 56, 225, 185, 142, 158, 55, 63, 231, 17, 238, - 51, 146, 129, 15, 251, 60, 8, 203, 226, 196, 231, 63, 125, 156, 202, - 98, 253, 91, 244, 109, 187, 218, 66, 140, 89, 104, 209, 54, 103, 109, - 142, 9, 110, 152, 9, 244, 70, 160, 55, 188, 145, 231, 71, 222, 249, - 124, 126, 228, 132, 101, 78, 54, 196, 5, 112, 229, 220, 6, 157, 185, - 21, 239, 149, 246, 27, 92, 55, 224, 186, 14, 215, 63, 255, 153, 24, - 21, 101, 160, 49, 42, 202, 130, 117, 227, 163, 71, 142, 16, 158, 85, - 36, 71, 39, 38, 11, 128, 109, 144, 106, 126, 126, 116, 220, 178, 63, - 247, 249, 206, 26, 239, 104, 68, 62, 108, 220, 139, 109, 196, 13, 129, - 133, 224, 200, 202, 41, 79, 164, 91, 149, 109, 27, 247, 226, 24, 209, - 184, 87, 119, 219, 126, 108, 204, 45, 13, 141, 75, 76, 74, 30, 154, - 24, 13, 173, 72, 70, 192, 1, 217, 206, 99, 68, 90, 46, 124, 135, - 245, 55, 115, 140, 216, 73, 108, 203, 18, 111, 223, 50, 207, 149, 167, - 101, 54, 205, 237, 226, 120, 13, 141, 139, 199, 175, 6, 136, 78, 218, - 182, 117, 61, 208, 169, 110, 59, 111, 151, 150, 11, 246, 227, 166, 185, - 221, 88, 145, 102, 160, 88, 78, 23, 182, 227, 188, 216, 245, 141, 96, - 180, 217, 180, 185, 148, 86, 52, 49, 35, 184, 140, 201, 59, 137, 253, - 100, 247, 24, 58, 177, 207, 236, 243, 63, 156, 79, 75, 159, 157, 140, - 182, 234, 119, 216, 99, 252, 46, 177, 199, 248, 157, 25, 235, 27, 214, - 62, 35, 141, 125, 159, 45, 122, 35, 21, 143, 202, 172, 132, 38, 1, - 238, 237, 67, 112, 206, 99, 153, 121, 176, 213, 45, 15, 203, 157, 91, - 121, 15, 191, 57, 246, 219, 135, 41, 23, 250, 13, 107, 60, 247, 42, - 236, 69, 175, 89, 159, 127, 98, 187, 84, 6, 213, 77, 179, 61, 176, - 202, 160, 176, 145, 33, 72, 46, 246, 185, 233, 40, 131, 55, 83, 46, - 60, 83, 52, 1, 124, 213, 218, 190, 138, 105, 31, 231, 37, 231, 166, - 115, 27, 132, 237, 7, 190, 230, 126, 15, 249, 178, 251, 61, 149, 216, - 134, 121, 191, 231, 109, 25, 233, 228, 241, 113, 201, 131, 99, 3, 73, - 108, 220, 224, 88, 212, 1, 123, 126, 74, 224, 163, 189, 225, 216, 71, - 21, 250, 234, 27, 204, 154, 122, 9, 122, 248, 10, 238, 225, 83, 245, - 34, 222, 75, 243, 60, 222, 75, 247, 12, 246, 79, 79, 205, 54, 150, - 234, 36, 242, 163, 123, 193, 156, 62, 214, 189, 32, 206, 19, 221, 11, - 226, 92, 177, 90, 33, 124, 183, 107, 244, 184, 152, 161, 163, 19, 199, - 71, 39, 14, 33, 206, 182, 133, 154, 235, 182, 123, 65, 188, 79, 96, - 250, 95, 134, 212, 204, 211, 24, 134, 137, 114, 80, 153, 80, 135, 210, - 196, 54, 138, 139, 23, 218, 9, 146, 28, 147, 0, 251, 212, 184, 209, - 241, 32, 150, 221, 100, 233, 174, 89, 101, 10, 19, 239, 135, 83, 31, - 32, 126, 175, 45, 47, 114, 217, 203, 135, 50, 89, 246, 207, 162, 142, - 211, 157, 47, 94, 184, 158, 5, 25, 99, 146, 98, 146, 5, 192, 172, - 86, 84, 169, 19, 174, 218, 218, 126, 188, 143, 183, 219, 7, 200, 217, - 194, 134, 1, 254, 104, 8, 253, 131, 131, 228, 229, 37, 140, 188, 184, - 38, 114, 175, 218, 142, 103, 82, 92, 50, 113, 181, 229, 79, 205, 177, - 29, 79, 188, 183, 140, 167, 206, 60, 158, 193, 194, 219, 72, 95, 111, - 60, 81, 38, 42, 159, 160, 203, 87, 29, 199, 19, 101, 180, 172, 79, - 187, 9, 15, 48, 217, 142, 39, 222, 219, 143, 167, 197, 206, 198, 153, - 71, 211, 126, 68, 97, 60, 155, 187, 43, 47, 202, 56, 142, 89, 127, - 233, 38, 58, 158, 156, 48, 158, 160, 151, 193, 46, 247, 95, 175, 108, - 199, 19, 239, 233, 120, 166, 142, 123, 172, 240, 16, 96, 249, 112, 55, - 72, 66, 62, 148, 201, 162, 159, 212, 62, 216, 202, 231, 250, 124, 231, - 165, 173, 124, 120, 79, 229, 11, 8, 115, 95, 190, 210, 82, 250, 200, - 200, 135, 54, 43, 231, 165, 131, 124, 46, 205, 111, 234, 11, 59, 125, - 124, 97, 149, 47, 61, 144, 202, 231, 245, 218, 242, 161, 76, 84, 62, - 180, 167, 196, 81, 62, 151, 238, 41, 253, 185, 173, 124, 120, 79, 229, - 83, 109, 116, 127, 252, 138, 75, 200, 135, 50, 81, 249, 208, 214, 171, - 94, 56, 200, 215, 216, 229, 254, 234, 153, 173, 124, 120, 79, 229, 211, - 125, 234, 190, 124, 133, 37, 228, 67, 153, 168, 124, 232, 135, 52, 207, - 29, 228, 107, 226, 138, 111, 238, 83, 91, 249, 240, 158, 202, 151, 179, - 208, 253, 249, 149, 146, 15, 101, 162, 242, 161, 143, 212, 61, 115, 144, - 175, 169, 43, 190, 74, 59, 249, 148, 140, 124, 233, 183, 168, 124, 133, - 100, 229, 43, 47, 33, 31, 202, 196, 158, 207, 234, 159, 58, 200, 215, - 204, 229, 25, 230, 63, 182, 242, 225, 61, 149, 47, 247, 35, 247, 231, - 183, 138, 19, 249, 210, 112, 126, 159, 196, 123, 77, 167, 246, 234, 177, - 109, 140, 130, 47, 132, 75, 154, 173, 52, 12, 104, 84, 215, 80, 253, - 131, 249, 65, 182, 123, 51, 199, 253, 179, 231, 129, 78, 1, 243, 74, - 198, 212, 194, 187, 196, 71, 211, 131, 241, 187, 11, 21, 227, 183, 172, - 199, 251, 23, 203, 18, 214, 255, 176, 96, 81, 45, 74, 151, 8, 124, - 251, 1, 223, 122, 34, 223, 132, 152, 145, 227, 226, 146, 228, 109, 118, - 154, 40, 39, 149, 217, 248, 8, 230, 252, 137, 85, 110, 47, 79, 233, - 115, 146, 225, 175, 82, 248, 249, 179, 84, 33, 126, 29, 190, 10, 169, - 164, 250, 53, 116, 199, 211, 20, 126, 77, 205, 129, 97, 245, 14, 212, - 21, 190, 171, 238, 229, 59, 112, 127, 14, 148, 77, 189, 176, 70, 248, - 174, 249, 254, 115, 245, 66, 239, 4, 127, 186, 119, 191, 201, 252, 221, - 245, 65, 89, 115, 50, 218, 77, 43, 210, 184, 66, 185, 194, 130, 204, - 67, 99, 70, 141, 77, 244, 135, 189, 69, 178, 188, 204, 40, 39, 149, - 57, 247, 97, 188, 23, 59, 214, 174, 100, 254, 12, 218, 206, 44, 22, - 186, 111, 194, 217, 81, 33, 171, 74, 157, 223, 59, 23, 238, 79, 143, - 234, 185, 111, 198, 194, 187, 194, 247, 227, 223, 221, 223, 35, 116, 49, - 244, 43, 182, 246, 62, 161, 15, 95, 23, 248, 43, 164, 247, 227, 189, - 161, 63, 188, 50, 203, 92, 235, 66, 98, 198, 199, 77, 67, 50, 195, - 238, 238, 17, 100, 78, 142, 27, 20, 23, 237, 166, 204, 40, 39, 149, - 89, 5, 48, 246, 193, 29, 153, 191, 130, 182, 115, 175, 105, 67, 74, - 239, 138, 10, 137, 243, 57, 27, 186, 239, 89, 10, 191, 80, 217, 57, - 172, 100, 204, 105, 65, 230, 210, 5, 59, 239, 199, 178, 221, 13, 190, - 23, 198, 121, 112, 193, 111, 67, 248, 37, 223, 238, 61, 47, 142, 243, - 246, 6, 199, 130, 134, 110, 73, 207, 56, 197, 63, 51, 203, 28, 157, - 152, 52, 54, 201, 181, 208, 84, 102, 21, 35, 179, 246, 1, 196, 71, - 15, 221, 147, 249, 224, 243, 20, 126, 99, 196, 201, 61, 186, 97, 123, - 247, 234, 238, 53, 223, 239, 253, 87, 10, 175, 184, 181, 123, 127, 212, - 227, 16, 225, 121, 229, 202, 187, 187, 195, 218, 66, 89, 239, 243, 45, - 133, 62, 248, 126, 223, 98, 95, 197, 175, 187, 133, 236, 22, 101, 62, - 186, 46, 36, 176, 207, 39, 202, 192, 67, 185, 251, 133, 179, 249, 81, - 49, 201, 209, 114, 114, 91, 222, 197, 248, 192, 42, 179, 254, 111, 240, - 1, 110, 202, 236, 108, 13, 22, 43, 181, 122, 187, 49, 178, 189, 16, - 16, 7, 63, 235, 45, 172, 65, 221, 237, 87, 194, 26, 60, 247, 243, - 246, 218, 247, 31, 159, 89, 79, 233, 74, 54, 59, 158, 113, 186, 192, - 209, 237, 154, 155, 61, 132, 117, 57, 114, 236, 168, 65, 209, 137, 238, - 173, 65, 148, 147, 202, 156, 126, 31, 246, 55, 15, 94, 95, 230, 247, - 54, 181, 202, 24, 55, 38, 184, 54, 222, 253, 82, 96, 181, 48, 126, - 217, 33, 53, 4, 153, 149, 15, 252, 191, 120, 117, 226, 75, 139, 204, - 115, 171, 182, 200, 168, 115, 236, 122, 70, 234, 137, 80, 65, 230, 228, - 216, 209, 137, 209, 19, 220, 147, 25, 229, 164, 50, 231, 228, 194, 190, - 234, 239, 215, 151, 185, 235, 160, 105, 25, 161, 187, 102, 9, 50, 159, - 173, 91, 93, 144, 153, 12, 60, 33, 188, 166, 108, 237, 198, 102, 27, - 114, 219, 101, 91, 108, 93, 181, 58, 75, 130, 118, 39, 148, 201, 56, - 253, 219, 118, 33, 15, 61, 58, 121, 100, 180, 220, 195, 52, 42, 51, - 202, 105, 209, 231, 170, 177, 94, 216, 7, 70, 102, 165, 187, 50, 163, - 30, 244, 251, 114, 94, 80, 179, 47, 139, 9, 227, 250, 237, 170, 221, - 194, 243, 244, 250, 57, 105, 27, 240, 254, 201, 241, 254, 27, 2, 254, - 46, 93, 147, 210, 205, 78, 90, 147, 241, 211, 59, 5, 27, 71, 206, - 230, 4, 153, 7, 39, 70, 199, 199, 141, 29, 229, 150, 204, 40, 167, - 69, 159, 171, 196, 122, 97, 31, 94, 119, 156, 79, 70, 85, 220, 238, - 125, 171, 136, 16, 163, 29, 110, 84, 172, 49, 150, 149, 93, 244, 129, - 112, 223, 33, 180, 238, 182, 57, 202, 140, 109, 156, 72, 119, 196, 187, - 110, 70, 192, 215, 21, 131, 125, 118, 157, 222, 142, 120, 49, 209, 114, - 214, 153, 209, 231, 42, 86, 153, 211, 43, 199, 122, 97, 31, 220, 145, - 249, 200, 31, 41, 60, 247, 217, 151, 33, 190, 201, 203, 246, 30, 83, - 158, 218, 223, 126, 107, 10, 255, 147, 71, 199, 3, 79, 90, 148, 22, - 236, 198, 242, 151, 29, 194, 213, 80, 54, 255, 157, 6, 194, 125, 245, - 37, 149, 246, 133, 158, 172, 177, 111, 181, 104, 55, 86, 53, 90, 16, - 124, 225, 114, 151, 224, 117, 69, 218, 10, 231, 203, 177, 99, 71, 197, - 36, 202, 24, 59, 139, 62, 87, 182, 202, 156, 83, 41, 214, 11, 251, - 224, 142, 204, 107, 110, 167, 240, 87, 27, 165, 238, 171, 176, 238, 242, - 222, 125, 250, 239, 195, 202, 111, 76, 225, 183, 79, 238, 22, 254, 145, - 161, 163, 32, 227, 157, 119, 187, 29, 184, 187, 62, 133, 63, 247, 97, - 9, 225, 29, 42, 153, 131, 226, 246, 29, 219, 87, 44, 172, 252, 75, - 179, 204, 119, 213, 33, 25, 218, 235, 189, 130, 55, 221, 231, 5, 29, - 26, 59, 50, 94, 206, 165, 88, 245, 185, 146, 85, 102, 37, 192, 216, - 7, 119, 100, 238, 15, 62, 37, 56, 76, 21, 114, 48, 236, 241, 222, - 223, 110, 253, 18, 58, 1, 252, 244, 142, 159, 223, 13, 27, 115, 116, - 156, 32, 115, 231, 251, 239, 238, 191, 14, 101, 185, 57, 171, 4, 159, - 178, 98, 235, 216, 125, 199, 23, 173, 221, 59, 89, 28, 103, 245, 189, - 78, 25, 151, 135, 254, 180, 93, 105, 200, 10, 16, 244, 57, 58, 49, - 193, 93, 159, 162, 100, 100, 214, 84, 4, 125, 174, 228, 158, 204, 187, - 115, 83, 248, 132, 65, 53, 246, 104, 31, 166, 135, 4, 206, 75, 223, - 127, 237, 80, 10, 95, 126, 90, 192, 129, 49, 19, 2, 4, 95, 221, - 124, 106, 64, 120, 213, 195, 16, 111, 92, 58, 36, 188, 203, 166, 64, - 191, 192, 208, 19, 23, 102, 182, 56, 36, 202, 124, 175, 76, 227, 237, - 11, 78, 126, 26, 212, 237, 214, 150, 237, 212, 167, 200, 201, 77, 101, - 70, 57, 169, 204, 9, 21, 98, 189, 148, 110, 202, 236, 204, 110, 164, - 156, 43, 24, 252, 119, 61, 95, 97, 205, 253, 120, 83, 41, 204, 249, - 239, 138, 115, 219, 241, 190, 232, 158, 141, 219, 127, 234, 153, 20, 72, - 215, 224, 170, 155, 126, 65, 233, 23, 210, 50, 14, 55, 127, 25, 68, - 215, 96, 98, 220, 176, 88, 119, 116, 3, 229, 164, 50, 167, 149, 143, - 245, 194, 62, 184, 35, 243, 47, 176, 6, 189, 27, 71, 182, 240, 235, - 144, 30, 82, 217, 120, 114, 255, 68, 88, 111, 107, 182, 118, 56, 176, - 255, 162, 121, 156, 215, 165, 119, 8, 207, 128, 178, 230, 161, 159, 183, - 16, 124, 76, 90, 163, 208, 0, 159, 223, 247, 208, 113, 78, 232, 241, - 65, 112, 246, 186, 61, 193, 95, 126, 29, 97, 179, 6, 93, 201, 77, - 101, 70, 57, 169, 204, 217, 190, 177, 94, 216, 7, 119, 100, 174, 126, - 39, 133, 95, 31, 172, 15, 125, 191, 251, 223, 33, 247, 87, 100, 135, - 205, 255, 42, 133, 239, 180, 76, 27, 126, 199, 63, 70, 144, 249, 193, - 68, 237, 129, 87, 95, 166, 240, 95, 100, 112, 194, 54, 59, 35, 42, - 37, 244, 227, 208, 151, 251, 62, 16, 215, 160, 255, 239, 253, 130, 139, - 254, 84, 47, 35, 123, 246, 141, 0, 203, 26, 148, 25, 104, 203, 187, - 251, 125, 173, 50, 19, 128, 177, 15, 238, 200, 220, 9, 214, 160, 41, - 116, 102, 200, 210, 220, 59, 45, 166, 14, 185, 29, 218, 3, 214, 219, - 161, 161, 113, 97, 27, 106, 14, 19, 98, 162, 164, 129, 113, 251, 155, - 65, 153, 97, 125, 1, 97, 77, 94, 220, 19, 31, 82, 61, 219, 115, - 223, 5, 113, 156, 107, 141, 168, 17, 172, 25, 210, 44, 40, 186, 207, - 198, 64, 102, 13, 186, 148, 154, 202, 76, 24, 153, 3, 202, 197, 122, - 97, 31, 220, 145, 217, 15, 214, 224, 59, 41, 197, 246, 20, 235, 181, - 109, 239, 136, 187, 25, 251, 103, 27, 193, 246, 229, 4, 31, 232, 182, - 53, 80, 144, 113, 221, 213, 224, 240, 163, 80, 54, 106, 237, 187, 194, - 26, 188, 246, 91, 192, 190, 39, 159, 110, 110, 97, 20, 101, 38, 3, - 74, 52, 234, 240, 105, 169, 224, 62, 41, 5, 236, 215, 160, 164, 220, - 84, 102, 148, 147, 202, 172, 43, 11, 242, 186, 41, 115, 79, 24, 231, - 163, 97, 109, 247, 62, 136, 222, 191, 215, 123, 217, 245, 208, 56, 24, - 211, 201, 159, 13, 14, 27, 180, 53, 84, 144, 217, 56, 111, 240, 254, - 149, 80, 118, 253, 210, 9, 97, 220, 179, 74, 132, 239, 155, 178, 250, - 72, 200, 70, 81, 230, 73, 55, 87, 103, 172, 59, 154, 153, 209, 179, - 72, 197, 12, 235, 62, 197, 181, 114, 88, 246, 131, 101, 173, 50, 167, - 150, 137, 245, 194, 62, 184, 35, 243, 18, 104, 59, 84, 23, 25, 90, - 239, 97, 220, 222, 150, 29, 127, 222, 59, 11, 238, 87, 174, 25, 176, - 111, 226, 186, 91, 130, 61, 206, 205, 237, 31, 154, 4, 253, 242, 159, - 120, 68, 232, 67, 177, 54, 127, 236, 157, 212, 230, 200, 190, 221, 226, - 62, 101, 217, 184, 155, 129, 154, 161, 177, 193, 79, 251, 173, 204, 176, - 238, 83, 220, 147, 25, 229, 180, 236, 7, 75, 199, 122, 9, 99, 237, - 134, 204, 95, 66, 219, 53, 198, 118, 221, 91, 191, 85, 231, 189, 159, - 175, 58, 27, 186, 19, 246, 36, 103, 211, 58, 135, 61, 249, 235, 180, - 32, 51, 191, 164, 243, 254, 29, 80, 86, 242, 240, 247, 194, 56, 151, - 88, 244, 237, 222, 128, 218, 217, 33, 84, 159, 183, 127, 118, 109, 91, - 197, 140, 45, 219, 195, 127, 217, 18, 204, 236, 83, 220, 210, 103, 148, - 115, 58, 115, 46, 128, 125, 112, 71, 230, 72, 216, 167, 44, 79, 56, - 18, 82, 179, 171, 49, 164, 224, 95, 45, 247, 247, 189, 151, 194, 55, - 189, 118, 112, 255, 119, 105, 17, 130, 221, 216, 248, 240, 96, 88, 111, - 40, 43, 94, 43, 66, 24, 231, 238, 207, 194, 67, 181, 25, 109, 246, - 141, 16, 101, 126, 209, 162, 80, 224, 195, 234, 47, 183, 246, 186, 186, - 97, 187, 221, 62, 197, 165, 62, 123, 139, 207, 238, 103, 80, 125, 134, - 61, 55, 246, 129, 230, 22, 96, 62, 1, 205, 45, 192, 247, 202, 96, - 174, 1, 155, 91, 16, 23, 31, 68, 236, 147, 96, 173, 57, 51, 121, - 203, 4, 162, 188, 85, 11, 173, 185, 5, 248, 44, 32, 245, 93, 176, - 191, 141, 29, 115, 102, 2, 210, 31, 43, 132, 11, 234, 115, 123, 130, - 108, 90, 215, 121, 53, 125, 220, 204, 45, 192, 45, 86, 94, 115, 11, - 134, 139, 185, 5, 135, 123, 19, 75, 110, 193, 88, 23, 185, 5, 11, - 180, 154, 140, 97, 191, 52, 48, 60, 122, 220, 66, 67, 191, 155, 26, - 103, 247, 221, 212, 109, 245, 155, 137, 223, 87, 21, 254, 50, 40, 158, - 16, 203, 13, 237, 100, 44, 94, 231, 79, 254, 163, 228, 176, 198, 255, - 137, 239, 166, 202, 231, 124, 57, 230, 204, 232, 85, 16, 187, 194, 165, - 43, 33, 94, 74, 243, 21, 48, 208, 124, 185, 47, 92, 1, 161, 253, - 186, 220, 28, 245, 79, 143, 102, 171, 221, 205, 45, 16, 190, 231, 45, - 234, 4, 103, 151, 115, 128, 114, 73, 230, 197, 74, 228, 7, 176, 121, - 177, 72, 183, 73, 21, 107, 243, 76, 3, 251, 40, 151, 23, 59, 42, - 105, 152, 152, 26, 235, 60, 61, 32, 7, 198, 71, 163, 138, 117, 254, - 189, 81, 149, 181, 47, 56, 142, 52, 47, 22, 105, 254, 39, 242, 98, - 177, 141, 55, 145, 23, 155, 6, 115, 157, 51, 208, 121, 159, 104, 185, - 224, 255, 7, 198, 90, 158, 133, 34, 141, 179, 188, 88, 196, 113, 149, - 23, 27, 151, 48, 58, 122, 112, 242, 216, 232, 100, 24, 91, 103, 143, - 80, 178, 223, 141, 181, 121, 22, 138, 247, 175, 155, 23, 75, 237, 39, - 218, 167, 25, 118, 50, 97, 93, 3, 148, 23, 234, 154, 208, 56, 114, - 128, 185, 109, 107, 236, 156, 56, 122, 172, 19, 77, 203, 169, 111, 238, - 111, 3, 145, 134, 210, 39, 0, 140, 252, 108, 246, 191, 206, 88, 248, - 91, 233, 19, 24, 122, 37, 192, 200, 143, 238, 249, 157, 183, 14, 122, - 86, 194, 74, 175, 100, 232, 211, 251, 195, 88, 193, 189, 249, 156, 67, - 138, 26, 244, 166, 148, 149, 30, 105, 40, 189, 22, 96, 228, 39, 158, - 237, 72, 50, 208, 151, 177, 210, 107, 25, 250, 220, 126, 176, 175, 132, - 123, 241, 60, 75, 146, 62, 173, 156, 149, 30, 105, 40, 125, 42, 192, - 200, 79, 60, 147, 150, 238, 192, 96, 43, 125, 42, 67, 31, 0, 48, - 242, 179, 217, 203, 35, 151, 247, 109, 201, 141, 117, 173, 244, 1, 12, - 125, 118, 223, 88, 175, 84, 134, 94, 74, 7, 52, 126, 204, 252, 247, - 101, 230, 31, 96, 228, 103, 221, 151, 59, 239, 66, 90, 109, 102, 254, - 25, 122, 37, 192, 200, 143, 221, 83, 56, 229, 80, 140, 153, 127, 134, - 62, 253, 29, 24, 59, 184, 103, 247, 170, 206, 232, 245, 53, 153, 249, - 127, 135, 153, 127, 128, 149, 86, 122, 201, 37, 144, 83, 132, 153, 127, - 134, 62, 183, 15, 204, 63, 220, 219, 239, 151, 237, 89, 232, 170, 51, - 243, 223, 135, 153, 127, 128, 181, 182, 244, 78, 101, 48, 22, 98, 230, - 159, 161, 15, 0, 24, 249, 49, 207, 7, 156, 14, 95, 142, 142, 153, - 127, 134, 62, 187, 55, 204, 191, 133, 94, 218, 2, 164, 121, 49, 243, - 223, 155, 153, 127, 128, 145, 31, 115, 214, 239, 92, 1, 170, 48, 243, - 207, 208, 43, 1, 70, 126, 108, 12, 238, 116, 254, 10, 48, 243, 207, - 208, 167, 247, 130, 249, 71, 122, 230, 252, 219, 25, 125, 78, 69, 102, - 254, 123, 49, 243, 15, 176, 210, 74, 47, 169, 129, 58, 15, 102, 254, - 25, 122, 140, 241, 144, 159, 195, 25, 188, 253, 252, 149, 103, 230, 191, - 167, 149, 158, 136, 252, 28, 98, 99, 123, 17, 166, 60, 86, 208, 248, - 23, 99, 94, 26, 255, 226, 187, 204, 48, 30, 182, 139, 127, 37, 223, - 111, 248, 186, 241, 175, 205, 115, 126, 136, 127, 85, 221, 98, 189, 140, - 69, 156, 196, 191, 127, 67, 236, 11, 151, 177, 43, 200, 213, 22, 230, - 182, 219, 219, 248, 247, 223, 20, 255, 234, 96, 62, 116, 221, 98, 189, - 242, 45, 155, 16, 105, 189, 94, 252, 75, 117, 194, 62, 254, 69, 185, - 242, 27, 255, 206, 235, 102, 141, 165, 112, 192, 80, 79, 165, 226, 32, - 212, 81, 186, 14, 141, 93, 242, 30, 7, 33, 13, 165, 215, 1, 140, - 252, 242, 18, 7, 233, 24, 122, 130, 244, 93, 242, 22, 7, 17, 134, - 62, 173, 51, 204, 107, 151, 188, 197, 65, 72, 67, 233, 53, 0, 35, - 191, 188, 196, 65, 26, 134, 62, 39, 42, 214, 11, 249, 229, 37, 14, - 66, 26, 74, 175, 7, 24, 249, 229, 37, 14, 210, 51, 244, 42, 128, - 145, 95, 94, 226, 32, 21, 67, 111, 236, 4, 251, 194, 168, 188, 197, - 65, 72, 99, 153, 127, 128, 145, 95, 94, 226, 32, 29, 67, 79, 0, - 70, 126, 121, 137, 131, 8, 67, 159, 214, 17, 230, 191, 83, 222, 226, - 32, 164, 177, 204, 63, 192, 164, 83, 222, 226, 32, 13, 67, 159, 211, - 1, 230, 191, 99, 222, 226, 32, 164, 177, 204, 63, 192, 154, 142, 121, - 139, 131, 244, 12, 189, 10, 96, 228, 151, 151, 56, 72, 197, 208, 27, - 219, 195, 252, 119, 200, 91, 28, 132, 52, 150, 249, 7, 24, 249, 229, - 37, 14, 210, 49, 244, 4, 96, 228, 151, 151, 56, 136, 48, 244, 105, - 237, 96, 254, 219, 231, 45, 14, 66, 26, 203, 252, 3, 76, 218, 231, - 45, 14, 210, 48, 244, 232, 235, 145, 95, 94, 226, 32, 164, 97, 227, - 32, 77, 187, 188, 197, 65, 24, 251, 52, 101, 232, 49, 46, 178, 198, - 65, 248, 107, 114, 142, 195, 159, 223, 239, 193, 59, 251, 83, 181, 200, - 219, 59, 234, 126, 241, 244, 62, 232, 234, 123, 240, 111, 250, 93, 150, - 246, 223, 243, 148, 251, 30, 60, 202, 18, 212, 182, 136, 230, 175, 166, - 211, 223, 208, 247, 224, 243, 247, 247, 127, 237, 187, 159, 81, 173, 9, - 193, 135, 221, 248, 110, 195, 32, 106, 191, 236, 222, 165, 16, 213, 154, - 126, 119, 185, 185, 211, 177, 208, 61, 122, 252, 198, 95, 49, 203, 17, - 87, 207, 106, 217, 252, 62, 79, 27, 92, 218, 31, 236, 3, 237, 15, - 126, 31, 154, 125, 119, 163, 165, 63, 129, 1, 78, 219, 204, 126, 232, - 186, 63, 250, 174, 102, 94, 170, 8, 176, 51, 17, 174, 215, 155, 39, - 177, 126, 15, 97, 95, 84, 77, 152, 13, 77, 227, 74, 61, 95, 6, - 31, 0, 56, 62, 120, 142, 218, 177, 63, 156, 67, 124, 40, 124, 39, - 3, 218, 105, 36, 242, 219, 31, 245, 133, 38, 1, 104, 145, 143, 240, - 172, 58, 69, 97, 194, 178, 216, 224, 57, 89, 108, 25, 124, 236, 24, - 234, 80, 166, 111, 156, 108, 71, 75, 191, 251, 130, 253, 170, 103, 25, - 7, 15, 136, 102, 57, 8, 251, 77, 130, 12, 237, 196, 254, 54, 176, - 153, 27, 103, 239, 168, 53, 207, 145, 233, 229, 203, 151, 166, 165, 75, - 151, 10, 215, 139, 23, 47, 164, 102, 149, 206, 23, 206, 17, 157, 47, - 252, 254, 47, 171, 131, 214, 249, 146, 120, 79, 190, 204, 124, 25, 121, - 51, 175, 4, 53, 248, 37, 141, 235, 249, 242, 102, 230, 76, 228, 46, - 228, 33, 55, 153, 222, 80, 115, 232, 204, 57, 181, 156, 254, 89, 158, - 39, 106, 204, 243, 133, 252, 112, 174, 19, 132, 185, 22, 115, 11, 82, - 136, 9, 203, 112, 190, 236, 202, 140, 67, 237, 202, 246, 66, 89, 178, - 29, 109, 240, 244, 134, 198, 227, 130, 44, 214, 50, 144, 207, 184, 231, - 204, 185, 44, 187, 50, 205, 126, 39, 101, 135, 236, 104, 233, 89, 47, - 142, 83, 61, 139, 141, 226, 72, 65, 130, 63, 109, 208, 83, 200, 179, - 45, 0, 119, 8, 43, 64, 47, 60, 225, 14, 97, 220, 117, 121, 17, - 79, 1, 22, 190, 215, 195, 153, 199, 184, 129, 141, 157, 115, 161, 35, - 41, 41, 41, 236, 229, 218, 27, 230, 157, 15, 247, 47, 231, 67, 117, - 31, 245, 221, 98, 123, 193, 127, 179, 239, 111, 176, 232, 190, 196, 247, - 238, 211, 31, 72, 235, 190, 6, 248, 42, 67, 204, 188, 210, 51, 75, - 122, 212, 33, 81, 46, 117, 191, 43, 49, 255, 96, 169, 147, 254, 182, - 52, 95, 246, 186, 79, 159, 117, 152, 203, 45, 207, 97, 194, 173, 123, - 234, 180, 2, 230, 103, 22, 61, 10, 226, 175, 80, 71, 9, 107, 162, - 171, 184, 44, 217, 239, 204, 163, 30, 154, 203, 136, 179, 50, 98, 87, - 70, 28, 241, 244, 70, 137, 50, 59, 90, 163, 51, 126, 248, 142, 166, - 198, 78, 240, 236, 101, 57, 200, 57, 148, 9, 120, 45, 29, 249, 25, - 53, 142, 101, 44, 158, 130, 182, 235, 76, 230, 150, 142, 109, 24, 157, - 180, 235, 48, 126, 196, 121, 153, 209, 201, 152, 26, 157, 180, 235, 116, - 62, 90, 58, 226, 57, 200, 162, 177, 47, 227, 204, 188, 236, 199, 165, - 165, 253, 24, 112, 102, 58, 39, 120, 206, 218, 112, 24, 43, 137, 50, - 135, 254, 74, 148, 57, 140, 115, 99, 39, 178, 56, 105, 67, 160, 117, - 210, 174, 109, 25, 252, 241, 142, 122, 37, 240, 215, 56, 41, 35, 142, - 101, 122, 39, 99, 224, 172, 93, 7, 221, 213, 176, 186, 207, 200, 119, - 208, 201, 56, 27, 157, 204, 165, 209, 137, 124, 7, 109, 117, 215, 232, - 132, 159, 94, 162, 93, 7, 126, 18, 101, 14, 242, 101, 74, 224, 57, - 41, 115, 218, 95, 103, 253, 112, 82, 166, 119, 50, 6, 196, 73, 153, - 62, 195, 201, 250, 176, 111, 215, 104, 50, 165, 24, 157, 172, 203, 12, - 39, 54, 204, 232, 100, 237, 27, 157, 216, 23, 39, 101, 246, 50, 147, - 131, 78, 218, 61, 248, 202, 100, 50, 56, 177, 37, 70, 39, 246, 202, - 89, 187, 7, 157, 216, 48, 59, 61, 208, 59, 195, 35, 206, 203, 28, - 100, 118, 38, 139, 51, 126, 78, 250, 171, 119, 160, 69, 63, 131, 65, - 9, 250, 188, 122, 150, 133, 82, 90, 136, 208, 148, 226, 243, 134, 2, - 16, 193, 208, 223, 198, 196, 39, 244, 74, 209, 135, 41, 136, 249, 21, - 125, 158, 16, 177, 21, 20, 226, 27, 164, 84, 194, 157, 57, 217, 220, - 155, 20, 130, 88, 7, 99, 160, 106, 112, 21, 133, 59, 111, 1, 46, - 76, 124, 72, 17, 82, 28, 224, 96, 248, 191, 8, 212, 40, 133, 242, - 98, 80, 83, 156, 148, 5, 184, 4, 252, 143, 245, 165, 197, 35, 244, - 18, 164, 36, 41, 37, 192, 126, 164, 12, 64, 37, 5, 28, 252, 30, - 95, 41, 1, 31, 191, 215, 91, 12, 160, 82, 66, 121, 5, 226, 11, - 126, 182, 156, 0, 151, 3, 168, 50, 169, 36, 224, 148, 135, 154, 114, - 164, 34, 192, 203, 225, 255, 114, 80, 90, 7, 224, 57, 128, 81, 21, - 90, 175, 44, 224, 248, 18, 21, 220, 85, 17, 104, 171, 66, 59, 37, - 4, 217, 33, 198, 128, 150, 75, 66, 137, 82, 40, 41, 1, 253, 175, - 46, 148, 87, 7, 136, 39, 53, 5, 184, 50, 212, 84, 39, 53, 4, - 184, 6, 64, 53, 73, 61, 1, 174, 69, 234, 146, 48, 82, 91, 104, - 171, 14, 180, 90, 23, 74, 16, 174, 11, 88, 245, 160, 6, 113, 42, - 1, 117, 13, 40, 65, 184, 62, 9, 36, 65, 196, 95, 128, 253, 1, - 106, 64, 2, 0, 142, 36, 33, 80, 227, 79, 26, 10, 180, 13, 1, - 10, 32, 141, 0, 62, 13, 24, 193, 164, 49, 96, 33, 78, 32, 105, - 6, 119, 65, 2, 109, 48, 105, 66, 58, 66, 13, 150, 55, 35, 157, - 224, 46, 88, 40, 175, 73, 112, 139, 219, 84, 128, 155, 2, 212, 9, - 106, 17, 174, 7, 53, 77, 73, 115, 1, 110, 14, 80, 51, 224, 134, - 112, 11, 18, 10, 45, 135, 8, 237, 214, 6, 121, 67, 161, 4, 225, - 80, 192, 10, 132, 26, 196, 9, 3, 234, 230, 80, 162, 20, 206, 244, - 11, 128, 129, 8, 23, 224, 112, 128, 212, 164, 139, 0, 243, 80, 19, - 14, 237, 41, 5, 61, 11, 135, 210, 78, 2, 220, 146, 68, 144, 86, - 128, 165, 20, 178, 114, 10, 194, 93, 75, 1, 142, 32, 173, 65, 242, - 86, 130, 110, 96, 92, 221, 26, 74, 16, 110, 5, 165, 109, 73, 27, - 1, 110, 3, 80, 123, 210, 14, 224, 161, 192, 161, 21, 220, 107, 5, - 90, 45, 64, 237, 72, 7, 161, 239, 77, 72, 20, 233, 12, 35, 129, - 112, 39, 104, 53, 10, 74, 16, 39, 10, 176, 58, 64, 13, 150, 119, - 1, 106, 45, 148, 40, 197, 152, 12, 38, 91, 136, 255, 26, 176, 206, - 195, 85, 252, 58, 97, 194, 4, 83, 100, 100, 164, 240, 121, 246, 236, - 89, 172, 249, 39, 133, 216, 127, 233, 66, 158, 79, 76, 76, 140, 41, - 36, 36, 196, 212, 186, 117, 107, 211, 196, 137, 19, 205, 124, 184, 188, - 243, 65, 122, 228, 131, 252, 242, 195, 231, 201, 147, 39, 216, 31, 225, - 83, 252, 141, 226, 215, 234, 23, 142, 75, 131, 6, 13, 76, 205, 154, - 53, 51, 45, 88, 176, 224, 181, 249, 168, 84, 42, 147, 183, 183, 183, - 169, 116, 233, 210, 216, 191, 215, 238, 23, 210, 163, 13, 196, 171, 66, - 133, 10, 175, 205, 167, 84, 169, 82, 22, 62, 208, 191, 215, 238, 23, - 229, 33, 94, 111, 132, 15, 140, 211, 107, 247, 235, 77, 241, 161, 227, - 131, 159, 176, 62, 164, 251, 101, 75, 103, 207, 87, 208, 31, 208, 27, - 65, 127, 222, 196, 56, 227, 252, 187, 156, 119, 25, 121, 80, 15, 113, - 125, 33, 159, 55, 49, 206, 56, 62, 111, 162, 95, 226, 120, 231, 139, - 15, 174, 47, 113, 157, 189, 17, 253, 177, 200, 227, 241, 223, 235, 151, - 56, 190, 212, 78, 191, 17, 253, 201, 207, 248, 136, 250, 71, 237, 116, - 190, 198, 89, 161, 80, 228, 123, 93, 208, 245, 37, 218, 251, 124, 249, - 47, 240, 55, 166, 201, 147, 39, 231, 203, 239, 208, 245, 37, 250, 195, - 215, 230, 35, 250, 99, 161, 95, 249, 241, 59, 162, 125, 23, 198, 25, - 198, 59, 223, 235, 75, 244, 63, 249, 210, 31, 26, 39, 228, 215, 127, - 209, 184, 37, 63, 250, 67, 249, 188, 41, 251, 99, 99, 55, 184, 255, - 46, 159, 55, 225, 151, 169, 253, 201, 47, 159, 55, 229, 119, 168, 253, - 201, 239, 248, 188, 41, 191, 44, 198, 151, 111, 204, 254, 228, 215, 174, - 138, 241, 247, 27, 179, 63, 111, 194, 239, 160, 254, 188, 137, 245, 133, - 243, 254, 166, 236, 79, 126, 227, 4, 113, 63, 144, 111, 251, 35, 218, - 247, 55, 182, 255, 18, 215, 217, 107, 247, 75, 244, 127, 111, 108, 255, - 37, 174, 179, 124, 239, 191, 100, 227, 112, 55, 214, 5, 213, 159, 55, - 181, 255, 202, 175, 254, 96, 252, 147, 223, 253, 23, 187, 143, 123, 83, - 251, 175, 252, 172, 47, 186, 207, 125, 83, 251, 175, 252, 246, 75, 180, - 239, 52, 222, 204, 151, 254, 80, 255, 149, 159, 184, 69, 244, 127, 111, - 196, 127, 209, 184, 197, 133, 254, 88, 114, 36, 90, 88, 159, 59, 226, - 247, 7, 217, 247, 110, 71, 181, 142, 138, 73, 138, 149, 206, 203, 200, - 249, 197, 245, 51, 119, 93, 19, 51, 175, 101, 71, 58, 121, 213, 209, - 118, 116, 249, 220, 177, 59, 92, 29, 173, 188, 51, 105, 249, 181, 19, - 69, 53, 213, 43, 239, 116, 235, 153, 251, 251, 248, 124, 17, 218, 105, - 36, 242, 67, 90, 205, 212, 245, 251, 216, 243, 225, 156, 19, 47, 121, - 219, 50, 133, 80, 182, 106, 193, 193, 3, 44, 94, 141, 225, 94, 26, - 103, 101, 187, 38, 36, 218, 60, 75, 159, 100, 80, 104, 126, 109, 52, - 221, 166, 236, 200, 194, 231, 252, 143, 237, 102, 219, 148, 133, 237, 185, - 202, 55, 175, 218, 202, 166, 44, 107, 211, 69, 158, 52, 158, 185, 151, - 45, 91, 181, 224, 42, 31, 52, 83, 99, 243, 108, 254, 167, 107, 79, - 249, 139, 237, 102, 219, 148, 45, 123, 228, 169, 57, 154, 243, 190, 77, - 217, 241, 28, 31, 77, 226, 143, 237, 212, 108, 223, 176, 236, 157, 191, - 150, 218, 224, 53, 232, 234, 169, 41, 122, 118, 171, 77, 89, 114, 205, - 103, 188, 121, 156, 173, 180, 127, 7, 254, 200, 247, 11, 155, 106, 131, - 215, 255, 131, 147, 40, 179, 205, 152, 78, 123, 112, 17, 250, 102, 59, - 6, 169, 7, 159, 34, 63, 155, 178, 206, 241, 5, 52, 41, 239, 108, - 205, 98, 219, 192, 57, 58, 244, 116, 153, 13, 94, 205, 225, 94, 198, - 46, 241, 219, 108, 218, 189, 126, 162, 168, 93, 153, 130, 150, 217, 208, - 174, 59, 252, 155, 193, 182, 76, 33, 148, 141, 92, 55, 221, 161, 13, - 251, 178, 242, 171, 126, 53, 216, 63, 131, 171, 150, 253, 189, 161, 92, - 151, 41, 54, 120, 43, 34, 210, 13, 246, 125, 251, 227, 229, 60, 67, - 192, 31, 147, 237, 240, 244, 14, 252, 230, 214, 254, 200, 16, 229, 167, - 87, 219, 62, 199, 16, 248, 217, 148, 93, 94, 252, 189, 97, 251, 47, - 41, 54, 101, 187, 38, 124, 239, 192, 111, 234, 250, 227, 134, 160, 239, - 91, 58, 240, 179, 215, 151, 254, 97, 75, 29, 240, 94, 196, 124, 228, - 192, 15, 241, 186, 196, 183, 204, 178, 231, 103, 175, 207, 216, 174, 214, - 14, 175, 207, 154, 178, 134, 170, 211, 51, 108, 117, 119, 113, 29, 187, - 50, 5, 140, 105, 178, 193, 126, 222, 254, 57, 213, 215, 97, 222, 194, - 70, 70, 26, 110, 167, 151, 176, 193, 155, 241, 224, 126, 150, 125, 153, - 247, 138, 67, 89, 246, 180, 233, 31, 207, 207, 178, 111, 3, 172, 157, - 33, 226, 94, 7, 27, 249, 206, 69, 123, 24, 82, 147, 251, 216, 172, - 243, 119, 63, 8, 113, 40, 211, 251, 116, 118, 224, 167, 153, 253, 81, - 184, 125, 89, 218, 184, 205, 234, 176, 61, 99, 109, 202, 98, 15, 252, - 170, 182, 31, 231, 221, 19, 182, 171, 87, 68, 36, 216, 200, 162, 79, - 156, 27, 110, 175, 247, 98, 187, 54, 101, 26, 191, 236, 3, 35, 214, - 77, 183, 157, 243, 142, 61, 194, 237, 203, 180, 126, 115, 212, 197, 42, - 182, 176, 41, 203, 105, 244, 181, 131, 44, 217, 147, 22, 168, 67, 70, - 214, 176, 29, 171, 138, 113, 225, 246, 235, 3, 219, 181, 47, 83, 86, - 172, 203, 219, 203, 231, 187, 170, 56, 111, 191, 86, 197, 50, 103, 180, - 54, 243, 118, 164, 205, 94, 71, 126, 93, 182, 56, 242, 131, 50, 207, - 21, 17, 182, 54, 118, 228, 16, 7, 218, 78, 126, 90, 7, 90, 177, - 204, 134, 246, 75, 101, 172, 131, 44, 88, 118, 114, 18, 111, 59, 31, - 239, 108, 117, 160, 21, 101, 206, 178, 127, 14, 57, 195, 195, 236, 3, - 235, 137, 190, 205, 151, 148, 37, 229, 8, 17, 158, 237, 248, 146, 138, - 112, 71, 132, 103, 62, 190, 164, 2, 220, 81, 24, 159, 234, 17, 225, - 89, 98, 117, 82, 11, 74, 136, 240, 60, 167, 22, 241, 19, 225, 106, - 194, 147, 184, 90, 34, 92, 27, 202, 107, 137, 56, 181, 133, 167, 122, - 230, 242, 74, 128, 83, 93, 44, 175, 68, 106, 8, 111, 9, 198, 242, - 58, 128, 83, 91, 44, 199, 39, 116, 149, 44, 112, 125, 82, 67, 196, - 169, 11, 56, 117, 196, 242, 186, 164, 42, 220, 153, 203, 235, 1, 92, - 215, 130, 95, 15, 40, 104, 57, 62, 113, 52, 195, 85, 224, 174, 178, - 136, 227, 79, 26, 144, 134, 98, 127, 253, 133, 39, 122, 230, 56, 164, - 49, 244, 173, 129, 136, 239, 79, 154, 146, 198, 34, 220, 68, 120, 238, - 71, 105, 3, 72, 83, 17, 63, 0, 106, 154, 138, 56, 1, 36, 144, - 52, 17, 224, 18, 0, 5, 139, 48, 62, 87, 108, 36, 188, 99, 92, - 41, 60, 45, 12, 38, 129, 2, 220, 147, 52, 35, 106, 18, 46, 242, - 84, 147, 48, 17, 174, 6, 48, 79, 194, 68, 62, 60, 9, 21, 225, - 106, 128, 143, 120, 102, 88, 3, 229, 188, 72, 171, 33, 33, 36, 84, - 44, 111, 9, 176, 70, 44, 143, 0, 184, 165, 5, 110, 65, 66, 68, - 156, 86, 0, 71, 136, 229, 173, 72, 115, 210, 194, 194, 31, 159, 246, - 81, 184, 57, 220, 153, 101, 104, 75, 90, 147, 54, 226, 88, 181, 37, - 237, 224, 206, 220, 151, 206, 164, 19, 137, 18, 203, 59, 19, 45, 233, - 36, 246, 87, 11, 26, 213, 73, 228, 211, 145, 180, 39, 29, 68, 156, - 142, 164, 27, 220, 153, 203, 59, 147, 46, 68, 43, 242, 233, 10, 53, - 90, 81, 158, 174, 128, 211, 81, 108, 87, 73, 138, 9, 239, 226, 68, - 90, 124, 166, 93, 76, 164, 85, 146, 194, 112, 103, 110, 171, 176, 240, - 76, 219, 140, 95, 132, 248, 136, 48, 62, 123, 45, 36, 188, 155, 84, - 41, 60, 65, 46, 36, 224, 34, 255, 18, 194, 147, 114, 90, 238, 37, - 228, 63, 34, 92, 18, 224, 18, 34, 142, 66, 140, 245, 148, 164, 160, - 144, 67, 168, 16, 96, 79, 82, 134, 152, 191, 201, 165, 20, 158, 212, - 151, 17, 225, 72, 160, 45, 40, 188, 41, 21, 249, 20, 128, 114, 79, - 177, 188, 20, 148, 151, 20, 225, 130, 80, 94, 192, 82, 94, 70, 248, - 166, 186, 82, 120, 166, 94, 90, 224, 139, 50, 227, 186, 244, 45, 99, - 142, 73, 27, 136, 235, 210, 241, 185, 136, 109, 153, 201, 238, 143, 198, - 230, 210, 57, 138, 121, 227, 195, 189, 229, 243, 150, 207, 91, 62, 111, - 249, 188, 229, 243, 150, 207, 91, 62, 111, 249, 188, 229, 243, 150, 207, - 91, 62, 111, 249, 188, 229, 243, 150, 207, 91, 62, 111, 249, 188, 229, - 243, 191, 132, 143, 212, 111, 245, 254, 111, 231, 243, 118, 222, 255, 127, - 228, 67, 115, 4, 48, 47, 128, 230, 8, 224, 59, 214, 48, 103, 64, - 151, 104, 126, 182, 31, 213, 26, 223, 239, 70, 95, 111, 220, 204, 33, - 71, 64, 229, 226, 187, 201, 1, 192, 183, 78, 128, 143, 240, 138, 84, - 227, 192, 142, 94, 198, 7, 237, 189, 234, 144, 158, 146, 121, 2, 103, - 224, 10, 225, 204, 188, 151, 181, 141, 48, 36, 92, 95, 139, 121, 1, - 153, 138, 196, 233, 154, 187, 15, 234, 105, 140, 123, 207, 56, 228, 8, - 40, 152, 94, 89, 126, 67, 182, 177, 245, 187, 201, 57, 30, 226, 251, - 84, 149, 32, 3, 180, 223, 72, 108, 167, 195, 198, 233, 134, 221, 101, - 234, 24, 106, 142, 86, 242, 234, 39, 222, 207, 151, 167, 16, 211, 207, - 156, 191, 161, 107, 169, 97, 134, 209, 85, 7, 240, 225, 5, 54, 94, - 214, 78, 34, 166, 105, 191, 63, 10, 63, 60, 38, 214, 80, 3, 240, - 30, 112, 3, 158, 223, 76, 81, 152, 254, 60, 119, 196, 208, 254, 244, - 117, 67, 187, 216, 123, 234, 121, 109, 21, 75, 86, 62, 35, 166, 91, - 23, 46, 27, 102, 241, 223, 26, 10, 247, 111, 200, 39, 60, 46, 253, - 119, 206, 20, 98, 154, 161, 254, 219, 176, 40, 108, 167, 128, 55, 251, - 73, 175, 103, 75, 128, 246, 94, 124, 5, 227, 173, 141, 255, 24, 102, - 76, 250, 65, 93, 61, 55, 253, 21, 129, 118, 75, 173, 43, 101, 252, - 114, 122, 33, 227, 135, 35, 235, 242, 145, 59, 159, 13, 91, 82, 132, - 152, 234, 61, 44, 102, 60, 221, 95, 105, 68, 188, 201, 161, 91, 230, - 47, 121, 69, 76, 85, 207, 55, 53, 206, 158, 90, 194, 168, 91, 90, - 153, 247, 206, 217, 60, 190, 153, 74, 97, 106, 24, 94, 213, 24, 31, - 84, 194, 120, 123, 108, 16, 223, 161, 114, 244, 7, 87, 47, 17, 83, - 185, 254, 213, 141, 199, 122, 61, 51, 196, 71, 29, 81, 255, 241, 115, - 183, 247, 198, 189, 32, 166, 217, 217, 26, 129, 54, 197, 84, 67, 125, - 238, 215, 244, 73, 231, 255, 84, 88, 218, 189, 153, 89, 87, 29, 220, - 186, 248, 226, 185, 62, 214, 126, 140, 250, 106, 166, 250, 158, 199, 55, - 164, 164, 158, 152, 126, 129, 113, 209, 194, 184, 244, 215, 44, 83, 207, - 47, 84, 236, 214, 231, 211, 136, 165, 221, 230, 11, 23, 133, 143, 185, - 243, 193, 248, 117, 23, 21, 166, 1, 91, 226, 13, 207, 135, 151, 50, - 206, 219, 145, 193, 55, 189, 186, 117, 124, 55, 63, 133, 73, 85, 239, - 70, 86, 169, 65, 127, 24, 106, 173, 89, 192, 95, 120, 53, 75, 249, - 199, 20, 133, 233, 157, 6, 93, 213, 149, 55, 191, 52, 248, 70, 207, - 230, 163, 148, 127, 78, 233, 175, 32, 166, 202, 123, 86, 242, 61, 111, - 221, 53, 204, 239, 59, 154, 31, 86, 170, 208, 227, 170, 48, 126, 126, - 223, 127, 206, 127, 80, 253, 39, 3, 231, 49, 134, 15, 46, 193, 229, - 126, 63, 153, 152, 38, 141, 249, 73, 29, 215, 53, 35, 107, 157, 223, - 42, 190, 65, 241, 90, 127, 158, 159, 172, 48, 205, 76, 175, 148, 85, - 201, 191, 180, 177, 94, 253, 61, 124, 56, 41, 54, 239, 228, 9, 133, - 233, 175, 42, 105, 106, 44, 219, 123, 55, 133, 47, 224, 179, 87, 191, - 255, 41, 49, 69, 102, 252, 200, 79, 25, 95, 214, 184, 179, 121, 123, - 126, 72, 248, 226, 212, 95, 238, 43, 76, 21, 14, 63, 231, 3, 215, - 43, 132, 178, 145, 222, 15, 114, 207, 129, 124, 91, 23, 255, 196, 79, - 168, 30, 97, 184, 117, 62, 133, 255, 165, 200, 236, 63, 195, 65, 150, - 176, 167, 243, 213, 63, 21, 169, 199, 123, 167, 110, 231, 15, 150, 56, - 153, 123, 17, 218, 93, 61, 244, 10, 255, 207, 186, 245, 89, 229, 160, - 31, 83, 189, 130, 254, 250, 10, 240, 252, 85, 31, 242, 77, 46, 174, - 225, 251, 244, 220, 196, 15, 171, 181, 162, 224, 31, 19, 137, 233, 82, - 216, 51, 126, 205, 79, 83, 248, 169, 189, 151, 241, 171, 154, 15, 233, - 61, 186, 131, 194, 20, 30, 179, 90, 125, 243, 153, 143, 81, 55, 99, - 61, 223, 250, 217, 168, 247, 134, 249, 17, 211, 177, 31, 15, 243, 117, - 39, 251, 24, 145, 159, 230, 214, 236, 232, 37, 233, 196, 148, 116, 225, - 59, 254, 220, 225, 39, 134, 87, 218, 15, 248, 93, 53, 54, 223, 49, - 76, 32, 166, 86, 157, 55, 240, 43, 119, 55, 50, 68, 116, 201, 228, - 163, 203, 85, 186, 249, 23, 232, 233, 211, 144, 84, 222, 72, 78, 134, - 125, 165, 63, 193, 231, 60, 27, 124, 181, 193, 251, 196, 116, 254, 199, - 157, 252, 198, 35, 65, 134, 47, 238, 204, 228, 239, 87, 223, 92, 239, - 219, 121, 196, 212, 125, 210, 167, 252, 238, 161, 235, 213, 158, 119, 143, - 242, 47, 94, 252, 94, 240, 40, 62, 215, 175, 252, 55, 223, 174, 228, - 169, 3, 89, 176, 190, 30, 20, 41, 255, 240, 42, 140, 193, 142, 163, - 87, 120, 255, 250, 233, 134, 6, 7, 134, 243, 247, 254, 220, 118, 101, - 238, 68, 51, 237, 94, 160, 93, 191, 184, 35, 191, 224, 236, 136, 178, - 229, 230, 153, 219, 189, 10, 237, 246, 25, 217, 134, 175, 127, 243, 7, - 238, 231, 105, 102, 249, 86, 128, 124, 103, 230, 132, 242, 59, 95, 164, - 120, 181, 214, 91, 251, 177, 119, 84, 5, 126, 87, 161, 93, 5, 63, - 210, 91, 251, 59, 103, 163, 47, 223, 254, 69, 165, 30, 177, 58, 24, - 103, 113, 92, 254, 172, 25, 197, 207, 243, 153, 59, 173, 96, 89, 98, - 154, 35, 206, 111, 242, 199, 60, 95, 170, 112, 165, 121, 67, 154, 40, - 76, 23, 135, 204, 16, 116, 237, 72, 217, 113, 188, 239, 149, 51, 19, - 180, 127, 40, 76, 81, 220, 71, 198, 73, 171, 187, 25, 134, 213, 237, - 208, 120, 208, 201, 99, 115, 241, 81, 109, 159, 3, 223, 26, 230, 15, - 255, 152, 111, 182, 45, 84, 29, 243, 234, 94, 85, 229, 12, 98, 186, - 204, 253, 144, 53, 126, 110, 45, 205, 182, 244, 202, 124, 173, 87, 183, - 91, 205, 90, 72, 76, 189, 7, 220, 205, 122, 39, 129, 215, 212, 78, - 155, 192, 239, 250, 235, 218, 128, 185, 95, 41, 76, 29, 58, 22, 54, - 46, 184, 81, 86, 19, 152, 51, 144, 79, 184, 249, 115, 212, 131, 213, - 196, 116, 113, 97, 35, 227, 205, 140, 177, 252, 135, 165, 14, 170, 253, - 188, 13, 229, 43, 131, 78, 86, 107, 81, 193, 184, 239, 230, 112, 94, - 147, 229, 167, 110, 121, 34, 240, 102, 242, 2, 98, 90, 49, 166, 149, - 113, 218, 218, 52, 126, 147, 166, 126, 227, 162, 30, 253, 174, 205, 154, - 78, 76, 235, 199, 61, 51, 140, 223, 245, 55, 255, 217, 129, 106, 234, - 34, 79, 155, 54, 59, 48, 79, 97, 218, 149, 18, 105, 248, 231, 85, - 3, 141, 102, 67, 5, 222, 244, 244, 188, 246, 239, 85, 196, 244, 235, - 165, 9, 70, 227, 190, 247, 249, 210, 215, 10, 241, 223, 158, 253, 89, - 91, 183, 151, 194, 52, 240, 183, 84, 227, 167, 75, 170, 102, 197, 53, - 201, 80, 87, 221, 245, 135, 103, 197, 56, 98, 250, 99, 238, 44, 99, - 175, 182, 93, 13, 151, 126, 251, 73, 221, 240, 116, 120, 243, 53, 67, - 21, 166, 232, 238, 195, 141, 187, 103, 86, 51, 212, 10, 216, 170, 158, - 123, 157, 203, 104, 50, 136, 152, 174, 169, 206, 25, 98, 215, 220, 53, - 240, 71, 9, 63, 227, 105, 207, 45, 189, 160, 172, 224, 163, 43, 89, - 39, 238, 237, 53, 84, 250, 214, 139, 191, 204, 169, 183, 182, 27, 76, - 76, 95, 20, 219, 160, 238, 188, 112, 131, 161, 67, 216, 123, 252, 189, - 95, 14, 236, 234, 57, 132, 152, 122, 53, 40, 173, 217, 186, 231, 47, - 67, 129, 152, 72, 62, 160, 82, 139, 207, 174, 118, 6, 29, 63, 219, - 65, 115, 209, 235, 99, 195, 247, 191, 38, 243, 103, 251, 94, 57, 215, - 188, 139, 194, 164, 245, 111, 165, 249, 167, 243, 44, 245, 63, 239, 69, - 242, 127, 13, 234, 18, 124, 95, 77, 76, 241, 254, 158, 198, 65, 39, - 215, 170, 251, 93, 94, 174, 142, 244, 218, 217, 38, 97, 56, 49, 141, - 187, 178, 216, 208, 185, 73, 81, 62, 173, 104, 49, 254, 175, 156, 175, - 155, 252, 51, 26, 198, 111, 203, 111, 89, 131, 122, 127, 198, 171, 166, - 151, 226, 199, 95, 240, 141, 24, 29, 67, 76, 103, 134, 22, 208, 156, - 57, 52, 149, 111, 177, 216, 135, 175, 173, 25, 217, 219, 212, 138, 152, - 116, 223, 133, 240, 37, 55, 110, 230, 91, 13, 232, 205, 235, 185, 101, - 81, 199, 1, 47, 179, 96, 117, 227, 209, 131, 151, 213, 159, 156, 248, - 71, 61, 191, 225, 229, 218, 199, 18, 136, 233, 235, 29, 61, 141, 83, - 127, 190, 175, 222, 186, 172, 58, 191, 225, 69, 159, 234, 79, 97, 125, - 24, 150, 119, 52, 250, 110, 218, 125, 96, 85, 223, 65, 252, 242, 23, - 237, 31, 47, 2, 91, 124, 247, 115, 63, 227, 205, 150, 17, 134, 67, - 195, 159, 168, 67, 174, 15, 248, 173, 24, 224, 45, 57, 86, 210, 56, - 38, 100, 16, 159, 102, 122, 21, 124, 179, 243, 201, 33, 132, 40, 76, - 133, 115, 139, 241, 219, 58, 84, 54, 28, 120, 178, 156, 127, 244, 98, - 225, 171, 7, 64, 27, 116, 244, 104, 214, 77, 159, 62, 134, 196, 164, - 0, 222, 227, 228, 38, 226, 147, 76, 76, 169, 93, 27, 241, 165, 135, - 29, 82, 151, 58, 59, 147, 127, 247, 229, 156, 82, 19, 192, 30, 36, - 214, 249, 52, 235, 121, 250, 65, 53, 246, 173, 242, 181, 237, 222, 181, - 97, 93, 214, 105, 241, 53, 191, 224, 231, 139, 134, 18, 47, 218, 243, - 199, 239, 87, 202, 232, 9, 253, 184, 54, 56, 198, 48, 216, 56, 67, - 240, 71, 37, 189, 35, 142, 222, 31, 67, 76, 105, 223, 4, 25, 98, - 75, 149, 53, 220, 30, 58, 67, 125, 84, 83, 46, 247, 208, 39, 196, - 244, 153, 88, 86, 199, 103, 24, 191, 161, 228, 222, 194, 13, 160, 141, - 89, 97, 51, 14, 236, 228, 19, 179, 208, 71, 29, 242, 212, 151, 138, - 131, 245, 187, 88, 57, 208, 48, 161, 77, 143, 3, 177, 153, 69, 248, - 197, 47, 61, 42, 150, 5, 61, 173, 85, 225, 67, 67, 165, 86, 213, - 12, 131, 170, 39, 241, 127, 148, 53, 229, 122, 65, 217, 203, 27, 95, - 25, 50, 79, 206, 54, 140, 159, 90, 146, 255, 161, 232, 185, 203, 219, - 97, 157, 55, 241, 87, 26, 191, 155, 58, 255, 192, 200, 9, 185, 234, - 65, 164, 155, 223, 226, 247, 136, 169, 118, 165, 127, 12, 7, 251, 111, - 53, 204, 45, 26, 198, 183, 63, 231, 113, 112, 242, 80, 98, 242, 233, - 252, 139, 193, 247, 66, 57, 195, 170, 228, 100, 62, 226, 207, 31, 61, - 50, 160, 221, 171, 233, 91, 13, 13, 11, 21, 86, 183, 225, 130, 248, - 211, 207, 118, 6, 158, 31, 75, 76, 47, 238, 4, 26, 7, 175, 52, - 24, 180, 101, 62, 82, 119, 202, 30, 191, 143, 68, 19, 211, 189, 43, - 77, 140, 223, 116, 59, 103, 80, 15, 215, 102, 100, 28, 152, 241, 9, - 142, 115, 135, 139, 75, 248, 230, 93, 11, 24, 111, 220, 110, 180, 195, - 227, 215, 158, 51, 176, 236, 179, 211, 227, 140, 125, 219, 181, 49, 116, - 44, 52, 59, 120, 224, 141, 130, 248, 179, 18, 166, 247, 215, 95, 52, - 244, 217, 227, 109, 108, 190, 97, 94, 102, 199, 71, 201, 122, 44, 235, - 152, 194, 25, 126, 30, 114, 215, 48, 117, 220, 141, 204, 150, 117, 244, - 179, 144, 182, 114, 218, 2, 245, 156, 178, 71, 12, 31, 23, 44, 190, - 163, 210, 237, 146, 211, 132, 212, 141, 19, 149, 52, 97, 137, 5, 141, - 31, 94, 237, 177, 163, 127, 80, 143, 15, 17, 175, 74, 183, 94, 154, - 98, 191, 45, 54, 180, 237, 213, 110, 199, 165, 241, 37, 126, 64, 188, - 117, 105, 81, 154, 207, 78, 125, 169, 206, 92, 89, 126, 71, 145, 164, - 138, 205, 17, 239, 69, 143, 103, 134, 109, 193, 74, 254, 213, 185, 144, - 224, 114, 37, 46, 77, 65, 188, 247, 154, 109, 52, 180, 57, 18, 205, - 175, 107, 250, 85, 208, 149, 29, 61, 49, 155, 210, 212, 195, 207, 71, - 179, 123, 209, 90, 126, 96, 173, 207, 50, 181, 161, 35, 199, 32, 173, - 178, 85, 51, 254, 230, 153, 43, 252, 135, 127, 108, 205, 200, 245, 50, - 164, 96, 217, 148, 39, 181, 13, 47, 134, 27, 249, 79, 7, 13, 11, - 78, 59, 252, 19, 190, 118, 206, 244, 104, 239, 74, 99, 90, 137, 213, - 89, 239, 206, 141, 107, 60, 79, 223, 234, 33, 226, 233, 47, 77, 53, - 246, 110, 48, 154, 31, 82, 184, 119, 227, 46, 155, 46, 234, 176, 236, - 185, 117, 76, 179, 132, 49, 253, 12, 116, 8, 198, 190, 177, 121, 236, - 13, 56, 246, 245, 63, 36, 166, 162, 48, 71, 101, 97, 142, 86, 39, - 39, 27, 112, 142, 162, 166, 42, 44, 115, 249, 81, 209, 48, 3, 206, - 229, 244, 229, 230, 57, 63, 14, 115, 30, 55, 33, 55, 11, 231, 124, - 4, 216, 201, 87, 160, 27, 25, 160, 27, 147, 166, 150, 52, 160, 110, - 116, 158, 5, 122, 0, 58, 84, 1, 116, 40, 166, 122, 146, 1, 117, - 232, 41, 216, 251, 37, 160, 107, 9, 160, 107, 195, 51, 139, 24, 80, - 215, 238, 64, 153, 30, 116, 50, 29, 116, 178, 206, 104, 165, 1, 117, - 114, 41, 180, 187, 6, 116, 119, 40, 232, 110, 3, 159, 97, 6, 212, - 221, 115, 83, 173, 58, 158, 59, 116, 70, 22, 234, 184, 122, 20, 49, - 221, 128, 181, 48, 8, 214, 66, 93, 160, 197, 181, 80, 124, 62, 196, - 67, 176, 102, 82, 97, 205, 84, 126, 209, 222, 128, 107, 230, 235, 21, - 196, 148, 12, 107, 235, 21, 172, 173, 106, 211, 75, 25, 42, 193, 218, - 186, 4, 54, 118, 30, 172, 193, 242, 176, 6, 203, 156, 157, 105, 192, - 53, 56, 7, 218, 104, 12, 107, 245, 26, 172, 213, 241, 73, 1, 6, - 92, 171, 15, 231, 18, 147, 39, 172, 233, 205, 176, 166, 15, 62, 89, - 110, 192, 53, 93, 84, 111, 182, 7, 215, 193, 30, 100, 13, 127, 146, - 133, 246, 224, 239, 153, 196, 100, 4, 187, 225, 13, 118, 99, 89, 223, - 65, 6, 180, 27, 35, 1, 111, 19, 216, 151, 25, 96, 95, 54, 46, - 171, 110, 64, 251, 226, 53, 211, 108, 135, 142, 131, 29, 154, 123, 226, - 159, 44, 180, 67, 45, 192, 7, 244, 7, 123, 85, 10, 236, 85, 235, - 1, 189, 13, 104, 175, 154, 131, 204, 103, 193, 174, 157, 5, 187, 166, - 89, 236, 99, 64, 187, 198, 237, 39, 166, 26, 96, 255, 6, 155, 237, - 159, 1, 237, 223, 199, 128, 55, 30, 236, 164, 214, 108, 39, 13, 104, - 39, 189, 83, 205, 246, 116, 8, 216, 211, 222, 151, 151, 103, 161, 61, - 77, 93, 76, 4, 187, 251, 28, 236, 174, 231, 251, 145, 6, 180, 187, - 197, 15, 154, 237, 243, 5, 176, 207, 215, 126, 77, 54, 160, 125, 62, - 158, 174, 176, 216, 241, 82, 49, 145, 6, 180, 227, 85, 183, 17, 211, - 106, 176, 247, 157, 192, 222, 119, 15, 123, 207, 128, 246, 254, 235, 149, - 196, 84, 24, 252, 194, 41, 240, 11, 213, 190, 245, 50, 160, 95, 216, - 189, 202, 236, 63, 226, 192, 127, 180, 60, 74, 12, 232, 63, 190, 2, - 63, 72, 253, 76, 213, 128, 173, 89, 232, 103, 78, 173, 54, 251, 163, - 30, 224, 143, 178, 127, 251, 41, 11, 253, 209, 187, 203, 205, 126, 43, - 13, 252, 86, 191, 38, 25, 89, 232, 183, 110, 46, 33, 166, 28, 240, - 111, 7, 193, 191, 249, 92, 43, 100, 64, 255, 118, 113, 163, 194, 180, - 7, 252, 224, 83, 240, 131, 33, 27, 42, 24, 208, 15, 22, 27, 108, - 245, 151, 51, 15, 84, 203, 66, 127, 217, 42, 73, 97, 241, 181, 254, - 89, 126, 89, 232, 107, 231, 37, 152, 125, 242, 111, 224, 147, 83, 74, - 29, 204, 66, 159, 124, 29, 244, 175, 163, 232, 187, 235, 229, 128, 110, - 130, 239, 46, 10, 62, 175, 63, 248, 248, 190, 224, 227, 171, 165, 77, - 48, 160, 143, 31, 219, 83, 97, 250, 9, 98, 129, 9, 16, 11, 108, - 78, 175, 108, 192, 88, 96, 210, 72, 107, 204, 80, 119, 91, 104, 22, - 198, 12, 185, 96, 255, 126, 132, 120, 227, 25, 196, 27, 167, 202, 142, - 51, 96, 188, 145, 94, 26, 214, 165, 24, 151, 76, 254, 152, 55, 96, - 92, 178, 234, 164, 194, 212, 28, 226, 151, 27, 16, 191, 252, 83, 51, - 202, 128, 241, 203, 179, 219, 196, 116, 92, 140, 115, 22, 111, 244, 53, - 96, 156, 179, 12, 214, 106, 178, 24, 15, 29, 27, 85, 193, 128, 241, - 80, 18, 230, 148, 65, 220, 180, 12, 226, 166, 11, 115, 66, 13, 24, - 55, 237, 195, 188, 73, 136, 175, 84, 220, 201, 176, 129, 35, 219, 24, - 48, 190, 170, 14, 54, 187, 27, 196, 97, 89, 16, 135, 109, 90, 220, - 209, 128, 113, 216, 237, 36, 98, 218, 14, 241, 90, 3, 136, 215, 154, - 31, 24, 110, 192, 120, 109, 44, 172, 213, 30, 16, 215, 213, 129, 184, - 238, 208, 222, 51, 6, 140, 235, 170, 194, 26, 68, 90, 35, 208, 122, - 221, 61, 106, 192, 248, 47, 4, 226, 176, 239, 33, 78, 92, 15, 113, - 226, 87, 119, 102, 26, 48, 78, 12, 4, 126, 143, 161, 93, 13, 180, - 187, 89, 127, 194, 128, 241, 228, 57, 88, 91, 17, 162, 124, 109, 186, - 100, 26, 48, 238, 44, 1, 122, 159, 8, 253, 248, 30, 250, 81, 160, - 235, 7, 6, 140, 79, 91, 206, 38, 166, 163, 208, 223, 58, 208, 223, - 42, 209, 179, 13, 24, 199, 14, 239, 66, 44, 227, 18, 51, 99, 189, - 1, 227, 221, 229, 191, 192, 152, 66, 92, 252, 5, 196, 197, 51, 122, - 47, 51, 96, 92, 252, 241, 14, 133, 169, 1, 196, 207, 205, 32, 126, - 238, 219, 115, 147, 1, 227, 231, 50, 208, 143, 21, 16, 103, 63, 132, - 56, 187, 18, 240, 195, 56, 187, 23, 172, 233, 230, 16, 143, 231, 64, - 60, 94, 40, 117, 187, 1, 227, 241, 186, 211, 20, 166, 45, 16, 183, - 143, 131, 184, 253, 239, 243, 41, 6, 140, 219, 15, 3, 94, 37, 49, - 190, 63, 210, 188, 189, 1, 227, 251, 6, 48, 6, 116, 31, 128, 101, - 184, 15, 168, 86, 76, 97, 186, 5, 251, 133, 138, 48, 151, 223, 220, - 77, 49, 224, 126, 33, 178, 32, 248, 115, 152, 95, 44, 107, 84, 127, - 143, 1, 247, 21, 77, 155, 42, 76, 9, 176, 255, 208, 193, 254, 99, - 131, 223, 42, 3, 238, 63, 234, 67, 187, 85, 96, 159, 50, 11, 246, - 41, 69, 61, 198, 24, 112, 159, 226, 15, 250, 87, 1, 246, 51, 221, - 96, 63, 179, 162, 239, 104, 3, 238, 103, 174, 130, 44, 90, 216, 247, - 84, 128, 125, 79, 101, 232, 7, 238, 123, 214, 189, 132, 181, 15, 251, - 163, 146, 176, 63, 170, 183, 102, 129, 1, 247, 71, 101, 64, 62, 29, - 236, 163, 80, 215, 82, 119, 100, 24, 112, 31, 181, 229, 23, 235, 62, - 175, 251, 194, 69, 7, 112, 191, 213, 191, 142, 194, 178, 47, 139, 209, - 44, 203, 194, 125, 217, 192, 201, 214, 253, 91, 242, 87, 51, 179, 112, - 255, 246, 39, 179, 191, 124, 144, 89, 55, 11, 247, 121, 99, 31, 88, - 247, 131, 179, 77, 53, 178, 112, 63, 88, 191, 132, 66, 216, 55, 30, - 135, 125, 99, 82, 212, 145, 44, 220, 55, 126, 232, 97, 221, 231, 221, - 29, 27, 100, 192, 253, 101, 213, 90, 196, 164, 18, 247, 161, 131, 150, - 86, 54, 224, 62, 244, 196, 175, 10, 203, 126, 117, 222, 164, 31, 178, - 112, 191, 58, 156, 179, 182, 59, 127, 100, 93, 3, 238, 107, 135, 63, - 36, 150, 253, 239, 135, 128, 39, 236, 127, 167, 90, 247, 201, 157, 99, - 239, 101, 225, 62, 121, 56, 216, 216, 219, 98, 63, 138, 245, 111, 104, - 192, 253, 180, 10, 240, 112, 223, 221, 14, 246, 221, 93, 1, 15, 247, - 221, 49, 5, 192, 207, 192, 254, 252, 16, 236, 207, 235, 131, 175, 192, - 253, 121, 69, 189, 121, 92, 58, 195, 184, 36, 87, 29, 96, 192, 125, - 124, 58, 232, 105, 71, 216, 239, 239, 132, 253, 62, 250, 35, 220, 239, - 15, 211, 155, 115, 56, 87, 21, 194, 119, 150, 245, 244, 242, 23, 207, - 5, 114, 131, 99, 189, 44, 239, 93, 99, 224, 4, 6, 14, 96, 224, - 220, 32, 6, 159, 129, 19, 24, 56, 128, 129, 115, 3, 25, 124, 6, - 78, 96, 224, 0, 6, 206, 13, 96, 240, 25, 56, 129, 129, 3, 24, - 56, 167, 145, 21, 78, 99, 96, 29, 3, 171, 24, 56, 199, 159, 193, - 103, 96, 29, 3, 171, 24, 56, 167, 33, 131, 207, 192, 58, 6, 86, - 49, 112, 78, 3, 6, 159, 129, 117, 12, 172, 98, 224, 156, 250, 12, - 62, 3, 235, 24, 88, 197, 192, 57, 245, 24, 124, 6, 214, 49, 176, - 138, 129, 115, 234, 50, 248, 12, 172, 99, 96, 21, 3, 231, 212, 97, - 240, 25, 88, 199, 192, 42, 6, 206, 169, 205, 224, 51, 176, 142, 129, - 85, 12, 156, 83, 139, 193, 103, 96, 29, 3, 171, 24, 56, 167, 38, - 131, 207, 192, 58, 6, 86, 49, 112, 78, 13, 6, 159, 129, 117, 12, - 172, 4, 152, 30, 226, 25, 171, 91, 225, 4, 6, 14, 168, 206, 232, - 100, 53, 70, 39, 25, 88, 87, 205, 138, 175, 100, 224, 108, 63, 43, - 78, 42, 3, 231, 164, 48, 178, 49, 176, 142, 129, 85, 12, 156, 61, - 197, 202, 51, 117, 138, 181, 92, 195, 148, 231, 78, 182, 194, 233, 147, - 25, 158, 76, 185, 146, 129, 179, 223, 103, 100, 99, 96, 45, 3, 43, - 25, 56, 251, 61, 6, 159, 129, 181, 12, 172, 100, 96, 227, 36, 102, - 60, 25, 88, 197, 192, 217, 19, 173, 176, 158, 129, 3, 24, 56, 119, - 2, 51, 86, 19, 172, 229, 90, 6, 38, 12, 108, 28, 111, 197, 215, - 51, 176, 134, 129, 115, 199, 89, 241, 211, 24, 88, 203, 192, 202, 113, - 76, 223, 199, 50, 125, 103, 96, 45, 3, 147, 177, 204, 248, 39, 91, - 97, 29, 3, 43, 25, 56, 59, 137, 225, 201, 192, 90, 6, 86, 50, - 112, 118, 34, 131, 207, 192, 90, 6, 86, 50, 176, 113, 12, 51, 254, - 12, 28, 48, 134, 209, 195, 4, 70, 175, 24, 88, 195, 192, 57, 163, - 153, 241, 103, 96, 29, 3, 171, 24, 56, 39, 158, 193, 103, 96, 109, - 60, 51, 95, 12, 108, 28, 197, 204, 23, 3, 107, 24, 56, 119, 36, - 51, 95, 12, 172, 101, 96, 229, 72, 102, 172, 70, 48, 99, 197, 192, - 90, 6, 86, 50, 112, 246, 112, 6, 159, 129, 181, 12, 172, 100, 224, - 236, 56, 6, 159, 129, 181, 12, 172, 100, 224, 236, 88, 6, 159, 129, - 181, 12, 172, 100, 224, 236, 97, 12, 62, 3, 107, 25, 88, 201, 192, - 217, 67, 25, 124, 6, 214, 50, 176, 146, 129, 179, 99, 24, 124, 6, - 214, 50, 176, 146, 129, 179, 135, 48, 248, 12, 172, 101, 96, 37, 3, - 103, 15, 102, 240, 25, 88, 203, 192, 74, 6, 206, 30, 196, 224, 51, - 176, 150, 129, 149, 12, 156, 29, 205, 224, 51, 176, 150, 129, 149, 12, - 156, 173, 99, 116, 76, 199, 232, 57, 83, 158, 83, 156, 209, 91, 6, - 214, 49, 176, 138, 129, 115, 138, 49, 248, 12, 172, 99, 96, 101, 49, - 70, 207, 139, 50, 235, 145, 129, 3, 138, 50, 122, 238, 195, 248, 23, - 6, 166, 239, 176, 198, 24, 173, 161, 248, 124, 167, 144, 248, 220, 139, - 254, 206, 133, 143, 24, 183, 185, 170, 79, 144, 169, 15, 144, 169, 199, - 152, 207, 101, 251, 50, 245, 9, 76, 125, 17, 177, 158, 254, 78, 134, - 143, 24, 47, 186, 170, 199, 24, 210, 85, 125, 58, 83, 95, 84, 172, - 167, 191, 131, 225, 35, 198, 154, 174, 234, 3, 100, 234, 49, 38, 117, - 85, 159, 30, 224, 90, 190, 132, 0, 153, 241, 151, 169, 199, 24, 215, - 85, 251, 105, 76, 125, 25, 177, 158, 254, 14, 132, 143, 24, 11, 187, - 170, 87, 49, 245, 165, 196, 122, 250, 59, 22, 62, 98, 204, 236, 170, - 62, 141, 169, 47, 65, 159, 203, 86, 97, 218, 151, 169, 87, 249, 187, - 150, 15, 99, 112, 151, 237, 203, 212, 235, 26, 202, 180, 47, 83, 143, - 49, 189, 171, 250, 52, 153, 122, 29, 83, 95, 156, 202, 167, 99, 218, - 151, 169, 199, 61, 130, 203, 254, 203, 212, 235, 234, 203, 244, 95, 166, - 30, 247, 28, 46, 251, 95, 207, 181, 252, 58, 153, 122, 149, 76, 61, - 238, 97, 92, 213, 167, 201, 212, 235, 234, 202, 244, 95, 166, 30, 247, - 68, 46, 251, 95, 71, 102, 252, 101, 234, 85, 117, 100, 244, 191, 182, - 235, 250, 52, 166, 94, 33, 214, 211, 223, 177, 242, 17, 247, 98, 180, - 158, 163, 242, 251, 51, 237, 203, 212, 227, 158, 205, 85, 125, 154, 76, - 189, 174, 150, 107, 249, 84, 50, 245, 184, 7, 116, 85, 159, 86, 83, - 166, 125, 153, 122, 149, 12, 127, 220, 83, 186, 108, 95, 166, 94, 231, - 162, 222, 87, 220, 143, 54, 20, 235, 60, 169, 255, 40, 243, 88, 33, - 254, 214, 46, 79, 127, 83, 204, 87, 220, 175, 58, 195, 45, 32, 226, - 210, 223, 255, 242, 21, 247, 179, 20, 183, 32, 237, 247, 96, 138, 171, - 183, 224, 250, 136, 251, 93, 42, 35, 139, 107, 241, 129, 213, 92, 215, - 167, 51, 245, 246, 252, 125, 197, 189, 50, 149, 197, 131, 250, 48, 232, - 151, 248, 155, 10, 60, 253, 221, 51, 95, 113, 47, 237, 206, 120, 248, - 136, 123, 109, 218, 46, 139, 75, 235, 83, 253, 164, 229, 242, 17, 247, - 228, 174, 234, 211, 82, 100, 230, 86, 166, 94, 149, 226, 122, 238, 113, - 143, 239, 108, 92, 196, 56, 209, 134, 87, 234, 20, 215, 188, 52, 83, - 220, 155, 111, 95, 241, 220, 192, 29, 61, 242, 17, 207, 21, 92, 206, - 237, 100, 247, 117, 82, 57, 217, 149, 140, 182, 237, 226, 89, 5, 109, - 215, 139, 218, 189, 186, 204, 120, 200, 212, 107, 101, 234, 149, 50, 245, - 120, 246, 225, 178, 125, 153, 122, 173, 76, 189, 146, 169, 103, 231, 222, - 178, 214, 39, 217, 143, 43, 145, 180, 11, 9, 147, 220, 183, 33, 170, - 60, 224, 226, 89, 141, 59, 250, 233, 43, 158, 229, 184, 139, 27, 48, - 209, 125, 61, 192, 179, 32, 87, 122, 159, 54, 193, 253, 254, 104, 39, - 184, 175, 171, 100, 130, 251, 246, 19, 207, 159, 92, 217, 71, 189, 76, - 189, 102, 188, 235, 53, 134, 103, 87, 238, 218, 207, 180, 113, 121, 24, - 15, 6, 151, 109, 87, 164, 83, 179, 182, 84, 57, 206, 181, 173, 196, - 243, 50, 151, 182, 120, 172, 107, 91, 169, 29, 235, 122, 158, 201, 88, - 247, 245, 11, 207, 226, 220, 29, 3, 93, 30, 112, 149, 201, 238, 173, - 73, 31, 241, 172, 79, 106, 125, 251, 136, 231, 127, 180, 222, 155, 246, - 215, 143, 25, 15, 153, 122, 165, 76, 61, 158, 29, 186, 170, 79, 149, - 169, 215, 202, 212, 43, 93, 212, 251, 138, 103, 145, 238, 172, 113, 95, - 241, 172, 210, 93, 127, 20, 48, 198, 245, 90, 193, 243, 77, 119, 215, - 120, 106, 130, 251, 62, 83, 147, 224, 190, 175, 198, 243, 83, 151, 49, - 163, 76, 189, 78, 166, 94, 53, 90, 38, 174, 137, 151, 137, 107, 226, - 165, 215, 170, 175, 120, 110, 235, 238, 154, 32, 241, 238, 217, 38, 31, - 241, 220, 215, 149, 92, 250, 81, 50, 118, 210, 69, 189, 175, 120, 102, - 236, 238, 124, 166, 141, 116, 95, 79, 180, 35, 221, 143, 73, 149, 35, - 93, 207, 29, 158, 83, 187, 170, 79, 149, 169, 215, 202, 212, 43, 153, - 122, 154, 39, 79, 127, 87, 217, 71, 60, 247, 118, 85, 159, 58, 92, - 166, 125, 153, 122, 165, 12, 127, 60, 71, 119, 217, 190, 76, 189, 86, - 166, 94, 201, 212, 151, 165, 58, 48, 133, 105, 63, 214, 117, 125, 42, - 83, 95, 154, 234, 179, 7, 211, 190, 76, 189, 146, 169, 47, 73, 117, - 165, 0, 211, 254, 48, 215, 245, 169, 50, 245, 90, 166, 94, 73, 245, - 218, 139, 105, 95, 166, 30, 159, 27, 184, 170, 79, 149, 169, 215, 202, - 212, 43, 135, 202, 244, 63, 70, 166, 255, 50, 245, 218, 24, 153, 241, - 151, 169, 199, 231, 26, 46, 251, 47, 83, 175, 29, 226, 90, 62, 165, - 76, 61, 62, 39, 113, 217, 127, 153, 122, 237, 96, 153, 254, 203, 212, - 227, 115, 23, 151, 250, 63, 72, 166, 125, 153, 122, 229, 32, 153, 246, - 163, 93, 215, 167, 70, 187, 150, 79, 43, 83, 175, 100, 234, 139, 209, - 125, 87, 33, 166, 125, 157, 181, 190, 48, 165, 47, 198, 236, 99, 116, - 86, 91, 207, 214, 251, 80, 91, 83, 132, 241, 71, 12, 47, 103, 245, - 248, 124, 201, 149, 44, 105, 50, 245, 58, 153, 122, 149, 76, 61, 62, - 175, 114, 37, 95, 154, 76, 189, 206, 69, 189, 175, 248, 172, 203, 157, - 177, 242, 21, 159, 133, 185, 139, 155, 80, 212, 253, 57, 8, 40, 42, - 61, 159, 62, 226, 243, 53, 87, 245, 233, 46, 234, 119, 195, 160, 226, - 119, 186, 234, 89, 190, 171, 229, 41, 252, 138, 172, 146, 252, 202, 97, - 4, 99, 254, 29, 174, 231, 156, 167, 240, 203, 72, 248, 219, 162, 89, - 28, 254, 154, 40, 190, 37, 172, 6, 217, 196, 121, 1, 71, 140, 141, - 253, 72, 48, 87, 72, 120, 243, 24, 174, 153, 222, 0, 23, 17, 198, - 83, 69, 198, 113, 69, 128, 74, 208, 91, 146, 200, 121, 11, 111, 45, - 195, 223, 86, 106, 6, 112, 97, 241, 183, 170, 18, 184, 194, 164, 16, - 224, 40, 137, 63, 201, 5, 254, 222, 194, 155, 205, 148, 164, 63, 135, - 191, 93, 138, 111, 60, 43, 65, 126, 226, 10, 0, 84, 20, 164, 168, - 76, 118, 112, 120, 18, 94, 12, 100, 42, 79, 238, 3, 255, 194, 194, - 249, 67, 73, 50, 4, 96, 47, 33, 46, 82, 145, 30, 28, 254, 174, - 87, 17, 225, 76, 59, 25, 224, 34, 66, 121, 77, 18, 192, 149, 18, - 222, 187, 87, 26, 254, 109, 229, 240, 253, 125, 126, 112, 223, 128, 188, - 199, 149, 22, 222, 217, 87, 6, 248, 108, 225, 240, 173, 126, 213, 224, - 222, 151, 60, 224, 240, 109, 127, 213, 133, 119, 172, 157, 231, 202, 8, - 239, 243, 195, 223, 252, 186, 203, 85, 20, 222, 200, 135, 191, 195, 53, - 158, 43, 43, 252, 242, 22, 254, 206, 215, 11, 14, 223, 223, 87, 75, - 248, 13, 175, 95, 184, 202, 194, 187, 255, 106, 0, 230, 90, 174, 10, - 64, 181, 133, 223, 240, 122, 197, 213, 36, 117, 0, 174, 5, 178, 61, - 224, 202, 9, 191, 250, 133, 227, 208, 147, 195, 95, 12, 43, 41, 244, - 101, 60, 135, 191, 58, 22, 32, 142, 97, 9, 225, 215, 182, 202, 65, - 43, 127, 115, 37, 197, 119, 231, 149, 34, 99, 128, 182, 17, 17, 206, - 60, 96, 108, 125, 1, 246, 23, 224, 166, 128, 163, 18, 206, 226, 85, - 192, 179, 36, 208, 169, 4, 158, 9, 0, 227, 155, 247, 8, 148, 140, - 225, 240, 55, 205, 252, 133, 49, 233, 198, 225, 59, 215, 240, 55, 189, - 170, 144, 94, 192, 7, 127, 229, 171, 60, 200, 115, 3, 198, 161, 33, - 140, 77, 5, 248, 247, 152, 195, 183, 178, 225, 27, 2, 43, 2, 126, - 25, 24, 131, 250, 112, 87, 10, 100, 171, 0, 159, 245, 161, 180, 60, - 201, 132, 49, 169, 47, 188, 81, 176, 60, 249, 13, 198, 164, 146, 240, - 214, 193, 82, 32, 115, 37, 224, 92, 23, 238, 74, 145, 37, 28, 190, - 139, 176, 46, 180, 90, 5, 230, 40, 152, 132, 136, 239, 16, 28, 207, - 5, 9, 111, 216, 107, 33, 232, 94, 19, 248, 108, 46, 200, 63, 22, - 224, 230, 194, 251, 4, 91, 129, 108, 65, 226, 187, 5, 75, 193, 92, - 7, 9, 191, 17, 102, 150, 63, 158, 132, 139, 239, 4, 28, 15, 112, - 160, 240, 222, 64, 13, 73, 2, 56, 148, 140, 22, 96, 44, 15, 19, - 222, 9, 168, 129, 177, 10, 21, 126, 105, 204, 60, 230, 248, 59, 98, - 136, 83, 13, 198, 39, 8, 228, 9, 22, 248, 196, 0, 76, 223, 15, - 24, 196, 53, 5, 74, 243, 59, 248, 198, 1, 220, 65, 104, 183, 52, - 41, 5, 112, 71, 241, 93, 126, 221, 56, 124, 43, 97, 71, 17, 14, - 35, 157, 68, 56, 24, 96, 181, 248, 238, 191, 193, 28, 190, 209, 80, - 45, 242, 236, 96, 121, 39, 224, 16, 78, 77, 162, 44, 56, 67, 8, - 132, 244, 66, 223, 199, 3, 172, 17, 222, 105, 168, 130, 190, 224, 219, - 22, 155, 8, 115, 215, 148, 195, 55, 41, 6, 9, 176, 134, 11, 1, - 57, 155, 8, 56, 201, 0, 55, 17, 198, 83, 5, 125, 137, 35, 157, - 5, 57, 107, 0, 159, 102, 0, 55, 23, 198, 42, 136, 171, 10, 154, - 135, 111, 53, 68, 61, 172, 13, 122, 24, 33, 252, 198, 217, 5, 40, - 143, 36, 194, 111, 70, 195, 56, 215, 33, 221, 197, 247, 33, 6, 115, - 248, 75, 123, 189, 73, 47, 128, 167, 192, 122, 44, 78, 122, 194, 93, - 121, 192, 239, 5, 159, 125, 200, 59, 130, 77, 232, 1, 245, 239, 144, - 190, 0, 31, 16, 172, 72, 47, 210, 3, 52, 189, 15, 192, 61, 0, - 191, 56, 104, 194, 26, 174, 53, 72, 211, 65, 208, 195, 158, 0, 199, - 137, 99, 24, 13, 112, 7, 210, 79, 104, 171, 52, 140, 73, 39, 17, - 14, 226, 240, 77, 138, 253, 196, 241, 124, 135, 12, 32, 253, 5, 254, - 205, 184, 54, 228, 93, 104, 23, 203, 203, 1, 237, 187, 226, 123, 24, - 99, 160, 188, 15, 233, 38, 192, 17, 0, 119, 35, 109, 5, 24, 127, - 148, 62, 138, 12, 20, 224, 182, 0, 247, 23, 222, 207, 168, 129, 126, - 13, 134, 145, 29, 40, 244, 183, 49, 192, 3, 137, 78, 128, 135, 114, - 131, 0, 86, 11, 112, 51, 128, 117, 34, 206, 24, 46, 10, 104, 7, - 8, 124, 146, 1, 30, 96, 145, 243, 93, 128, 204, 229, 99, 1, 110, - 45, 150, 107, 184, 190, 132, 23, 223, 59, 89, 19, 224, 254, 226, 187, - 41, 85, 92, 31, 144, 121, 128, 48, 110, 58, 78, 11, 50, 247, 196, - 92, 8, 104, 75, 11, 50, 155, 251, 213, 18, 240, 181, 66, 57, 234, - 103, 95, 224, 162, 21, 251, 165, 6, 105, 204, 239, 151, 84, 114, 93, - 97, 182, 218, 139, 58, 223, 21, 86, 84, 59, 97, 108, 91, 113, 248, - 118, 207, 118, 162, 62, 84, 1, 168, 174, 176, 94, 148, 92, 93, 210, - 149, 116, 17, 236, 225, 80, 174, 37, 204, 111, 23, 145, 182, 46, 64, - 221, 133, 242, 198, 48, 239, 117, 5, 184, 36, 233, 202, 5, 138, 239, - 226, 172, 1, 115, 52, 8, 224, 64, 129, 103, 36, 232, 149, 249, 221, - 151, 42, 82, 3, 224, 54, 100, 184, 0, 183, 225, 240, 183, 240, 70, - 137, 246, 167, 13, 64, 230, 242, 106, 220, 40, 225, 55, 242, 204, 118, - 108, 20, 64, 35, 69, 24, 127, 55, 111, 132, 5, 30, 33, 150, 39, - 114, 145, 36, 86, 44, 31, 15, 240, 8, 177, 47, 1, 220, 48, 40, - 143, 20, 230, 46, 16, 224, 72, 225, 93, 156, 26, 88, 59, 195, 0, - 138, 16, 231, 113, 24, 64, 67, 133, 242, 161, 92, 4, 244, 36, 90, - 228, 31, 1, 208, 80, 145, 127, 52, 148, 183, 20, 199, 39, 26, 160, - 24, 81, 231, 99, 0, 214, 8, 112, 45, 128, 129, 179, 0, 15, 129, - 177, 162, 239, 229, 28, 7, 176, 86, 156, 83, 45, 215, 69, 120, 51, - 167, 89, 31, 186, 0, 164, 21, 203, 187, 65, 185, 121, 94, 26, 115, - 248, 118, 207, 182, 226, 188, 159, 34, 39, 201, 9, 114, 28, 96, 3, - 119, 154, 156, 2, 232, 24, 192, 47, 185, 227, 228, 27, 114, 84, 128, - 47, 114, 39, 200, 17, 184, 59, 14, 99, 222, 157, 251, 6, 224, 67, - 130, 111, 29, 202, 29, 38, 7, 5, 184, 52, 248, 214, 195, 196, 40, - 252, 216, 38, 218, 132, 131, 0, 239, 23, 125, 235, 17, 98, 16, 224, - 72, 50, 12, 224, 253, 2, 62, 218, 180, 67, 0, 27, 201, 97, 193, - 183, 158, 32, 89, 128, 117, 4, 240, 215, 114, 39, 201, 1, 184, 59, - 1, 243, 158, 193, 29, 3, 9, 12, 112, 87, 142, 92, 6, 217, 142, - 1, 116, 0, 116, 230, 31, 224, 255, 141, 216, 110, 32, 192, 71, 225, - 14, 219, 237, 202, 25, 64, 130, 253, 130, 206, 140, 1, 248, 168, 32, - 79, 117, 208, 231, 61, 100, 55, 249, 154, 108, 2, 252, 129, 92, 38, - 124, 126, 77, 50, 192, 203, 221, 227, 118, 147, 93, 228, 43, 184, 243, - 5, 249, 51, 224, 243, 43, 178, 29, 116, 236, 5, 183, 29, 160, 141, - 100, 27, 200, 179, 151, 219, 69, 118, 2, 252, 21, 192, 73, 220, 54, - 128, 190, 36, 91, 1, 254, 147, 219, 73, 210, 1, 222, 8, 240, 3, - 46, 157, 108, 33, 235, 225, 78, 73, 118, 113, 91, 225, 115, 61, 217, - 0, 50, 247, 231, 182, 144, 205, 228, 11, 184, 83, 146, 39, 220, 6, - 248, 252, 130, 172, 3, 217, 94, 112, 59, 64, 134, 76, 97, 28, 122, - 114, 251, 200, 94, 178, 67, 232, 203, 120, 128, 87, 145, 189, 226, 24, - 238, 131, 210, 213, 112, 95, 151, 60, 228, 246, 194, 231, 106, 225, 57, - 116, 50, 208, 102, 10, 48, 234, 76, 38, 249, 84, 132, 7, 3, 206, - 30, 224, 106, 246, 173, 123, 1, 50, 243, 76, 0, 120, 53, 96, 161, - 77, 78, 6, 248, 83, 192, 194, 49, 233, 6, 99, 242, 41, 249, 12, - 198, 165, 10, 89, 15, 124, 50, 0, 254, 20, 230, 55, 17, 198, 97, - 59, 73, 131, 59, 244, 173, 187, 225, 51, 13, 198, 168, 34, 89, 7, - 227, 144, 70, 62, 135, 177, 64, 31, 186, 29, 198, 230, 115, 184, 47, - 69, 190, 135, 49, 217, 74, 214, 192, 29, 250, 220, 157, 240, 185, 6, - 198, 165, 60, 200, 156, 14, 208, 90, 24, 151, 242, 224, 91, 183, 194, - 120, 172, 133, 251, 42, 96, 111, 87, 144, 229, 100, 145, 184, 198, 87, - 146, 197, 96, 255, 151, 128, 156, 6, 110, 25, 64, 139, 133, 49, 25, - 11, 240, 82, 193, 47, 128, 61, 0, 156, 165, 100, 153, 208, 247, 64, - 128, 151, 192, 157, 89, 254, 120, 242, 9, 249, 216, 226, 91, 63, 22, - 236, 0, 250, 208, 120, 240, 154, 11, 5, 120, 28, 192, 11, 1, 203, - 92, 190, 16, 56, 46, 21, 199, 103, 33, 224, 52, 23, 99, 188, 149, - 100, 133, 40, 79, 19, 128, 23, 9, 50, 40, 201, 32, 110, 41, 153, - 46, 240, 193, 121, 95, 10, 237, 206, 16, 236, 79, 27, 128, 103, 144, - 233, 162, 253, 95, 8, 208, 39, 34, 252, 9, 192, 211, 4, 120, 40, - 192, 211, 72, 170, 0, 55, 5, 56, 85, 148, 115, 16, 55, 3, 202, - 205, 180, 129, 92, 42, 192, 83, 69, 156, 33, 224, 89, 23, 136, 54, - 97, 8, 64, 243, 69, 120, 5, 244, 124, 185, 48, 119, 131, 1, 94, - 41, 140, 67, 57, 176, 153, 139, 0, 90, 44, 218, 255, 69, 128, 177, - 204, 226, 91, 151, 128, 71, 197, 49, 76, 226, 150, 64, 15, 59, 139, - 250, 191, 153, 124, 72, 230, 130, 246, 161, 30, 126, 1, 208, 60, 208, - 67, 37, 217, 9, 229, 179, 160, 6, 105, 187, 115, 235, 160, 244, 125, - 81, 254, 83, 100, 34, 153, 0, 118, 65, 73, 126, 135, 245, 56, 129, - 76, 18, 214, 221, 78, 110, 34, 25, 71, 198, 195, 61, 218, 132, 247, - 200, 88, 184, 155, 8, 240, 21, 88, 155, 239, 1, 116, 10, 44, 252, - 231, 0, 31, 0, 252, 247, 32, 18, 235, 193, 125, 0, 99, 181, 68, - 208, 195, 158, 0, 47, 1, 239, 138, 99, 216, 24, 224, 100, 97, 60, - 209, 167, 204, 0, 120, 154, 56, 62, 211, 0, 158, 42, 142, 231, 56, - 224, 159, 68, 18, 1, 62, 203, 205, 129, 86, 199, 136, 190, 242, 3, - 50, 71, 132, 155, 64, 249, 100, 168, 65, 184, 36, 192, 179, 225, 14, - 225, 238, 220, 2, 146, 32, 242, 41, 7, 240, 84, 224, 99, 182, 189, - 131, 161, 220, 60, 206, 209, 0, 235, 72, 130, 0, 7, 129, 31, 73, - 21, 225, 97, 0, 39, 136, 62, 55, 129, 155, 10, 237, 39, 9, 124, - 198, 0, 156, 12, 119, 102, 57, 199, 0, 148, 44, 250, 214, 49, 0, - 125, 32, 250, 190, 177, 48, 115, 11, 68, 223, 58, 22, 160, 36, 209, - 198, 142, 135, 145, 74, 4, 169, 209, 183, 166, 192, 232, 140, 23, 246, - 26, 195, 0, 30, 47, 202, 92, 26, 240, 39, 145, 20, 209, 38, 140, - 5, 104, 190, 216, 175, 84, 144, 63, 65, 244, 221, 83, 200, 76, 152, - 49, 179, 206, 79, 1, 104, 173, 48, 182, 101, 193, 206, 204, 2, 75, - 99, 214, 135, 45, 80, 58, 75, 88, 47, 26, 110, 45, 209, 147, 41, - 130, 61, 12, 230, 62, 2, 248, 125, 145, 118, 45, 64, 122, 161, 60, - 26, 230, 253, 125, 145, 79, 15, 240, 173, 31, 11, 122, 91, 13, 230, - 104, 16, 172, 168, 84, 129, 167, 18, 244, 106, 142, 208, 71, 216, 161, - 0, 60, 28, 238, 16, 198, 49, 31, 5, 163, 110, 182, 63, 115, 160, - 220, 236, 103, 85, 224, 79, 103, 138, 229, 73, 0, 143, 132, 59, 179, - 189, 154, 9, 126, 115, 150, 88, 62, 19, 202, 71, 136, 227, 252, 33, - 64, 177, 98, 92, 253, 33, 96, 152, 203, 117, 224, 55, 63, 20, 202, - 53, 2, 60, 87, 208, 85, 179, 159, 157, 71, 230, 138, 243, 56, 12, - 60, 232, 60, 161, 60, 136, 155, 7, 254, 244, 125, 145, 255, 60, 40, - 143, 22, 249, 71, 147, 143, 196, 242, 49, 0, 199, 192, 29, 194, 221, - 192, 159, 206, 23, 225, 234, 0, 15, 17, 215, 93, 0, 140, 85, 138, - 48, 62, 184, 246, 63, 130, 210, 20, 209, 135, 234, 97, 182, 166, 136, - 250, 160, 135, 210, 201, 98, 249, 100, 232, 161, 185, 60, 26, 224, 217, - 66, 127, 113, 222, 113, 47, 171, 237, 99, 126, 47, 73, 3, 113, 47, - 219, 35, 219, 135, 191, 83, 234, 138, 250, 246, 170, 130, 188, 166, 250, - 56, 245, 47, 125, 139, 243, 7, 114, 38, 170, 219, 205, 244, 227, 171, - 103, 123, 58, 188, 87, 165, 111, 141, 196, 109, 154, 119, 97, 126, 188, - 197, 28, 214, 28, 243, 123, 71, 188, 19, 158, 170, 189, 62, 251, 65, - 189, 111, 252, 63, 234, 85, 234, 36, 11, 63, 202, 223, 158, 207, 181, - 99, 135, 131, 51, 134, 58, 242, 161, 116, 148, 207, 31, 190, 207, 213, - 23, 103, 122, 168, 87, 87, 40, 200, 215, 126, 252, 56, 220, 158, 79, - 142, 49, 49, 252, 187, 254, 142, 124, 104, 63, 40, 63, 74, 127, 209, - 163, 8, 95, 246, 234, 125, 7, 62, 195, 66, 199, 108, 217, 209, 217, - 145, 15, 165, 235, 244, 179, 39, 223, 163, 194, 14, 11, 189, 212, 123, - 103, 198, 183, 121, 190, 190, 80, 168, 35, 31, 21, 255, 68, 189, 169, - 100, 11, 11, 159, 39, 253, 30, 170, 15, 180, 189, 46, 201, 103, 243, - 157, 42, 189, 219, 246, 147, 230, 67, 233, 11, 55, 253, 75, 221, 125, - 237, 213, 48, 41, 62, 157, 210, 59, 235, 250, 86, 116, 228, 67, 233, - 169, 60, 114, 124, 118, 252, 101, 232, 221, 113, 157, 35, 31, 58, 30, - 148, 15, 29, 47, 41, 62, 77, 187, 133, 111, 91, 244, 141, 60, 31, - 250, 41, 197, 103, 94, 193, 96, 92, 18, 14, 124, 40, 29, 29, 39, - 218, 47, 90, 110, 207, 39, 154, 43, 172, 63, 99, 146, 214, 31, 42, - 23, 237, 23, 213, 39, 123, 62, 107, 35, 158, 236, 248, 106, 171, 35, - 31, 186, 142, 236, 245, 81, 106, 93, 24, 234, 248, 29, 209, 47, 113, - 228, 99, 191, 174, 168, 60, 116, 125, 216, 243, 121, 118, 106, 109, 100, - 191, 207, 165, 215, 169, 253, 186, 167, 252, 237, 249, 212, 186, 248, 77, - 248, 186, 165, 242, 250, 35, 55, 239, 134, 203, 71, 186, 53, 233, 43, - 205, 199, 190, 63, 82, 124, 106, 221, 156, 218, 119, 72, 47, 249, 117, - 42, 183, 190, 98, 31, 174, 236, 51, 108, 157, 52, 31, 74, 47, 39, - 207, 114, 175, 172, 193, 129, 233, 142, 124, 218, 107, 34, 248, 150, 229, - 127, 84, 55, 105, 216, 145, 95, 218, 224, 123, 245, 228, 175, 135, 243, - 225, 245, 139, 242, 23, 39, 246, 225, 167, 124, 228, 227, 192, 199, 207, - 39, 174, 227, 38, 39, 246, 240, 210, 135, 157, 249, 162, 241, 103, 212, - 61, 43, 36, 241, 155, 15, 22, 229, 41, 31, 202, 215, 65, 15, 189, - 163, 63, 82, 55, 119, 178, 190, 196, 118, 41, 253, 254, 103, 49, 124, - 220, 253, 178, 252, 173, 167, 61, 249, 42, 145, 37, 28, 228, 121, 126, - 233, 3, 239, 27, 19, 29, 249, 80, 57, 198, 70, 143, 225, 91, 175, - 168, 108, 225, 67, 249, 218, 243, 25, 210, 97, 230, 169, 63, 223, 113, - 228, 67, 233, 127, 184, 210, 134, 55, 190, 104, 202, 155, 72, 8, 31, - 183, 174, 129, 133, 159, 61, 159, 193, 189, 87, 152, 222, 27, 224, 200, - 135, 202, 111, 161, 19, 249, 92, 248, 179, 60, 191, 58, 171, 162, 3, - 159, 49, 223, 222, 202, 78, 27, 233, 200, 135, 202, 177, 174, 91, 8, - 159, 54, 163, 37, 63, 250, 165, 138, 255, 126, 65, 11, 11, 63, 123, - 62, 123, 123, 174, 121, 126, 203, 137, 31, 180, 180, 43, 210, 81, 62, - 59, 203, 253, 173, 62, 118, 59, 192, 129, 79, 210, 249, 211, 57, 139, - 147, 29, 249, 80, 124, 74, 127, 169, 109, 69, 94, 169, 142, 228, 203, - 254, 252, 143, 186, 236, 242, 222, 14, 124, 170, 63, 24, 86, 182, 231, - 100, 71, 62, 180, 63, 170, 209, 225, 124, 207, 236, 70, 22, 62, 150, - 254, 217, 253, 121, 61, 106, 216, 238, 119, 39, 246, 135, 182, 75, 233, - 199, 76, 109, 206, 119, 154, 208, 9, 214, 68, 57, 184, 146, 29, 248, - 188, 91, 254, 120, 205, 21, 227, 85, 142, 254, 75, 148, 227, 78, 147, - 62, 124, 239, 123, 181, 44, 124, 40, 95, 123, 62, 131, 78, 240, 39, - 223, 119, 178, 46, 154, 79, 142, 224, 55, 246, 220, 174, 166, 235, 131, - 174, 7, 169, 117, 218, 174, 238, 209, 249, 5, 234, 59, 242, 89, 80, - 220, 159, 223, 119, 108, 166, 154, 242, 27, 214, 176, 33, 191, 179, 250, - 30, 73, 62, 205, 158, 255, 211, 186, 240, 8, 105, 62, 148, 126, 74, - 219, 250, 124, 177, 98, 41, 146, 124, 38, 110, 57, 167, 59, 94, 82, - 154, 15, 165, 167, 114, 209, 79, 123, 62, 141, 94, 249, 232, 235, 58, - 241, 131, 84, 14, 74, 39, 39, 79, 244, 239, 217, 173, 186, 44, 145, - 30, 103, 251, 241, 150, 126, 239, 158, 183, 83, 191, 76, 233, 40, 31, - 185, 249, 138, 244, 187, 181, 104, 192, 33, 233, 126, 81, 122, 106, 103, - 165, 248, 4, 85, 174, 62, 232, 112, 39, 249, 241, 145, 147, 167, 105, - 209, 242, 81, 109, 98, 228, 229, 161, 252, 164, 248, 248, 63, 141, 236, - 52, 97, 185, 52, 31, 123, 191, 33, 197, 231, 167, 162, 197, 6, 55, - 116, 225, 119, 236, 237, 189, 148, 191, 248, 231, 110, 118, 143, 178, 107, - 164, 231, 203, 222, 127, 81, 251, 111, 207, 231, 232, 131, 239, 23, 213, - 219, 39, 237, 47, 236, 253, 14, 181, 255, 246, 124, 206, 135, 146, 75, - 223, 47, 150, 246, 95, 246, 246, 94, 202, 239, 108, 223, 165, 87, 205, - 91, 41, 237, 47, 236, 237, 180, 148, 223, 249, 35, 115, 194, 159, 191, - 46, 151, 246, 95, 246, 126, 199, 226, 207, 236, 254, 166, 183, 62, 90, - 249, 155, 101, 210, 126, 199, 222, 95, 80, 187, 237, 160, 207, 173, 22, - 148, 46, 182, 88, 218, 239, 216, 251, 13, 41, 255, 245, 106, 111, 47, - 18, 190, 72, 218, 239, 216, 219, 123, 41, 127, 145, 120, 166, 119, 163, - 161, 139, 164, 253, 142, 189, 255, 162, 246, 223, 158, 79, 133, 71, 135, - 234, 100, 79, 112, 228, 3, 35, 13, 250, 159, 3, 235, 32, 22, 62, - 113, 61, 12, 128, 207, 162, 146, 239, 123, 29, 91, 177, 65, 175, 9, - 95, 40, 157, 240, 73, 1, 124, 21, 208, 143, 129, 79, 13, 196, 133, - 189, 145, 30, 118, 106, 209, 240, 217, 206, 97, 93, 108, 40, 126, 237, - 159, 160, 169, 97, 78, 248, 180, 2, 252, 37, 106, 74, 103, 229, 227, - 92, 158, 33, 63, 44, 127, 183, 245, 78, 79, 7, 62, 29, 123, 84, - 10, 127, 244, 176, 52, 95, 120, 196, 199, 225, 159, 172, 56, 160, 206, - 76, 46, 164, 62, 84, 247, 160, 228, 122, 47, 243, 121, 96, 161, 30, - 61, 29, 199, 167, 199, 186, 225, 234, 114, 227, 11, 240, 148, 159, 28, - 159, 31, 42, 154, 78, 165, 142, 145, 230, 67, 233, 107, 77, 13, 84, - 95, 11, 146, 182, 63, 87, 43, 182, 93, 20, 196, 59, 155, 47, 21, - 62, 14, 9, 251, 182, 88, 184, 250, 206, 229, 146, 225, 159, 254, 241, - 121, 120, 210, 59, 211, 37, 227, 240, 135, 155, 126, 184, 118, 173, 191, - 52, 31, 216, 209, 169, 89, 126, 82, 124, 148, 235, 79, 108, 45, 82, - 223, 91, 146, 207, 71, 239, 235, 195, 72, 95, 250, 219, 147, 177, 146, - 253, 42, 189, 84, 23, 217, 177, 66, 9, 73, 62, 180, 63, 86, 126, - 206, 249, 76, 79, 171, 81, 119, 89, 7, 199, 126, 81, 58, 58, 206, - 116, 254, 165, 248, 124, 233, 83, 37, 238, 215, 182, 210, 124, 172, 244, - 174, 251, 165, 188, 244, 219, 68, 252, 21, 51, 233, 117, 65, 215, 23, - 93, 111, 206, 249, 124, 91, 228, 85, 133, 137, 211, 43, 185, 224, 67, - 215, 5, 229, 231, 156, 79, 195, 154, 35, 124, 26, 205, 114, 228, 67, - 199, 133, 246, 175, 97, 31, 15, 245, 233, 47, 102, 74, 251, 193, 18, - 239, 212, 27, 53, 158, 72, 242, 169, 188, 178, 159, 186, 243, 177, 109, - 178, 250, 156, 214, 122, 122, 67, 117, 180, 52, 31, 42, 7, 229, 39, - 197, 167, 125, 249, 23, 126, 198, 9, 210, 243, 69, 245, 71, 174, 95, - 253, 111, 92, 125, 118, 241, 125, 71, 62, 148, 126, 151, 190, 135, 122, - 111, 110, 140, 236, 248, 132, 127, 215, 185, 70, 210, 24, 105, 62, 67, - 186, 232, 212, 77, 179, 238, 88, 248, 73, 241, 41, 126, 229, 253, 125, - 159, 196, 72, 243, 161, 235, 147, 242, 147, 148, 167, 232, 173, 50, 209, - 78, 246, 41, 116, 92, 105, 127, 228, 228, 185, 227, 251, 176, 89, 191, - 4, 71, 62, 180, 253, 122, 95, 111, 83, 207, 106, 63, 74, 150, 79, - 205, 63, 190, 76, 111, 50, 200, 145, 143, 241, 159, 250, 252, 174, 226, - 59, 212, 3, 162, 138, 241, 37, 247, 13, 81, 95, 56, 95, 134, 159, - 113, 63, 82, 218, 174, 86, 48, 126, 98, 10, 147, 230, 19, 21, 89, - 157, 31, 223, 234, 140, 133, 159, 20, 159, 11, 85, 230, 45, 15, 110, - 227, 200, 103, 211, 80, 141, 122, 254, 174, 40, 254, 231, 207, 138, 169, - 23, 118, 234, 101, 177, 247, 82, 124, 244, 229, 91, 108, 14, 122, 87, - 154, 15, 165, 167, 118, 95, 138, 79, 71, 223, 97, 39, 215, 140, 113, - 102, 159, 233, 250, 166, 235, 157, 250, 69, 231, 124, 22, 93, 234, 20, - 221, 105, 167, 210, 5, 31, 74, 239, 218, 191, 119, 184, 60, 126, 84, - 202, 9, 95, 7, 62, 19, 115, 167, 171, 79, 148, 188, 162, 14, 191, - 223, 82, 221, 165, 231, 69, 217, 245, 94, 190, 251, 146, 222, 113, 245, - 28, 251, 69, 233, 40, 31, 57, 251, 188, 185, 89, 193, 196, 143, 148, - 206, 198, 199, 188, 47, 166, 251, 219, 153, 199, 199, 241, 5, 55, 244, - 230, 23, 116, 236, 196, 191, 8, 25, 239, 192, 231, 80, 171, 10, 21, - 171, 196, 57, 198, 9, 148, 158, 238, 151, 55, 44, 25, 203, 215, 185, - 85, 223, 194, 207, 158, 79, 118, 129, 17, 39, 149, 201, 210, 242, 208, - 246, 9, 241, 131, 75, 39, 57, 206, 234, 142, 119, 98, 202, 148, 116, - 148, 135, 202, 241, 227, 216, 222, 124, 183, 168, 210, 22, 121, 36, 245, - 240, 89, 209, 243, 35, 156, 216, 67, 122, 254, 72, 207, 71, 135, 204, - 47, 196, 7, 53, 84, 242, 147, 7, 120, 240, 233, 67, 111, 59, 196, - 99, 167, 130, 126, 44, 208, 101, 172, 244, 249, 42, 229, 71, 233, 41, - 63, 135, 115, 63, 255, 95, 61, 127, 156, 227, 200, 199, 158, 110, 242, - 180, 95, 213, 59, 127, 121, 166, 126, 248, 213, 35, 117, 178, 49, 219, - 65, 158, 23, 133, 195, 218, 247, 143, 117, 228, 179, 242, 69, 97, 126, - 203, 221, 99, 22, 57, 40, 125, 197, 80, 194, 47, 85, 108, 118, 224, - 115, 172, 232, 176, 175, 11, 12, 148, 63, 167, 165, 252, 40, 127, 123, - 62, 158, 145, 233, 109, 51, 182, 72, 243, 177, 151, 75, 234, 252, 121, - 107, 196, 193, 150, 77, 122, 59, 242, 41, 189, 110, 158, 186, 142, 223, - 113, 203, 186, 146, 243, 131, 15, 130, 87, 52, 29, 49, 76, 154, 15, - 93, 175, 114, 235, 180, 87, 212, 66, 62, 179, 139, 52, 31, 42, 199, - 149, 247, 151, 169, 183, 109, 218, 40, 201, 231, 89, 224, 79, 229, 255, - 76, 148, 246, 59, 212, 79, 200, 241, 89, 20, 20, 82, 97, 177, 19, - 62, 148, 158, 250, 29, 57, 62, 79, 131, 119, 222, 75, 73, 114, 228, - 67, 245, 165, 231, 195, 108, 117, 243, 71, 155, 212, 31, 55, 123, 160, - 94, 90, 101, 172, 164, 254, 92, 170, 88, 213, 216, 195, 201, 121, 84, - 161, 225, 155, 213, 29, 234, 122, 242, 252, 150, 189, 234, 106, 253, 127, - 87, 83, 125, 150, 146, 231, 96, 189, 97, 165, 10, 143, 151, 30, 103, - 202, 135, 242, 149, 226, 19, 242, 131, 127, 139, 1, 113, 210, 242, 80, - 57, 166, 86, 188, 161, 254, 102, 173, 175, 36, 159, 98, 47, 202, 191, - 184, 148, 34, 205, 135, 210, 167, 84, 248, 90, 189, 108, 118, 61, 73, - 62, 251, 94, 76, 48, 221, 117, 194, 135, 250, 97, 58, 95, 179, 207, - 156, 85, 15, 169, 95, 64, 58, 254, 201, 57, 114, 107, 247, 68, 105, - 62, 116, 158, 40, 63, 41, 62, 115, 210, 190, 206, 60, 95, 219, 201, - 254, 93, 140, 47, 40, 63, 57, 121, 58, 254, 240, 124, 217, 59, 225, - 210, 124, 40, 253, 131, 15, 207, 169, 55, 123, 254, 44, 25, 143, 109, - 184, 112, 113, 101, 201, 72, 71, 62, 163, 38, 246, 83, 251, 165, 175, - 13, 167, 124, 228, 226, 58, 239, 61, 151, 183, 245, 104, 39, 205, 135, - 202, 33, 215, 175, 197, 187, 110, 110, 50, 105, 28, 249, 208, 113, 165, - 227, 76, 215, 135, 20, 159, 202, 7, 185, 251, 163, 227, 165, 249, 80, - 122, 185, 117, 186, 124, 95, 229, 202, 117, 157, 216, 121, 186, 30, 40, - 189, 156, 60, 65, 23, 123, 134, 244, 26, 46, 205, 135, 174, 51, 57, - 121, 12, 23, 70, 104, 150, 56, 57, 15, 167, 246, 129, 234, 15, 141, - 55, 165, 248, 156, 34, 19, 31, 38, 166, 72, 243, 161, 227, 44, 23, - 175, 22, 244, 39, 215, 207, 57, 177, 99, 116, 157, 211, 254, 209, 241, - 145, 242, 167, 215, 125, 111, 55, 42, 224, 36, 110, 73, 158, 83, 146, - 247, 60, 250, 167, 197, 126, 81, 255, 37, 37, 207, 250, 197, 217, 71, - 251, 213, 147, 230, 67, 237, 134, 156, 61, 28, 246, 151, 209, 71, 61, - 69, 122, 124, 44, 114, 201, 200, 51, 56, 199, 103, 224, 218, 46, 210, - 124, 232, 60, 81, 126, 82, 124, 174, 63, 217, 152, 115, 246, 61, 233, - 253, 14, 93, 87, 114, 246, 103, 209, 189, 207, 175, 15, 119, 194, 103, - 121, 102, 17, 254, 244, 132, 38, 150, 184, 240, 137, 255, 53, 245, 198, - 181, 93, 36, 237, 170, 70, 245, 91, 185, 105, 19, 165, 249, 208, 243, - 190, 30, 63, 87, 230, 91, 248, 197, 75, 242, 233, 19, 244, 193, 31, - 151, 147, 164, 159, 55, 209, 184, 85, 46, 94, 213, 212, 249, 99, 194, - 130, 34, 222, 46, 248, 152, 233, 169, 92, 82, 124, 146, 15, 196, 250, - 23, 94, 237, 228, 60, 92, 164, 163, 253, 251, 113, 74, 13, 190, 212, - 39, 210, 254, 107, 76, 147, 57, 69, 50, 156, 244, 107, 82, 183, 32, - 254, 135, 49, 196, 18, 63, 203, 241, 249, 218, 235, 250, 133, 220, 9, - 210, 242, 80, 122, 202, 79, 138, 207, 35, 245, 55, 10, 221, 104, 34, - 25, 207, 91, 248, 201, 240, 201, 254, 113, 235, 203, 211, 19, 157, 237, - 47, 204, 231, 116, 84, 31, 229, 206, 235, 188, 106, 221, 158, 181, 249, - 47, 79, 73, 127, 97, 245, 55, 102, 190, 146, 231, 108, 133, 239, 207, - 46, 88, 95, 41, 185, 31, 164, 118, 85, 46, 110, 25, 244, 195, 186, - 33, 225, 45, 137, 36, 31, 43, 253, 60, 144, 199, 91, 146, 207, 111, - 223, 110, 26, 88, 188, 141, 82, 50, 110, 177, 198, 43, 51, 128, 79, - 35, 73, 62, 247, 182, 213, 237, 210, 151, 151, 142, 127, 172, 244, 174, - 229, 185, 184, 99, 98, 151, 153, 173, 156, 237, 187, 205, 244, 84, 30, - 185, 245, 222, 243, 86, 244, 232, 33, 33, 68, 146, 143, 149, 254, 16, - 220, 15, 146, 228, 243, 211, 189, 238, 201, 53, 131, 156, 228, 129, 88, - 232, 233, 58, 47, 3, 215, 68, 73, 62, 235, 107, 235, 135, 159, 15, - 113, 197, 135, 210, 187, 150, 231, 23, 191, 207, 199, 84, 11, 112, 242, - 28, 214, 178, 79, 238, 202, 19, 253, 44, 89, 121, 170, 247, 188, 218, - 175, 126, 5, 87, 124, 40, 189, 107, 59, 182, 58, 156, 211, 189, 104, - 225, 100, 156, 245, 83, 1, 127, 152, 69, 30, 43, 95, 231, 124, 38, - 189, 31, 89, 100, 92, 69, 105, 62, 148, 158, 158, 35, 72, 241, 81, - 77, 62, 93, 244, 101, 89, 105, 62, 148, 94, 238, 28, 96, 140, 86, - 251, 169, 103, 41, 105, 62, 148, 190, 152, 49, 133, 255, 176, 167, 116, - 60, 223, 161, 247, 210, 175, 7, 213, 113, 228, 67, 233, 169, 253, 138, - 237, 253, 46, 191, 194, 197, 185, 86, 213, 187, 59, 83, 31, 133, 74, - 243, 161, 244, 114, 242, 68, 189, 106, 53, 179, 78, 13, 71, 62, 148, - 158, 202, 67, 237, 190, 228, 121, 230, 181, 202, 11, 87, 134, 73, 243, - 161, 244, 207, 63, 104, 198, 103, 166, 253, 45, 233, 223, 151, 101, 37, - 44, 14, 115, 50, 239, 148, 142, 242, 145, 139, 15, 219, 121, 15, 158, - 254, 155, 11, 62, 148, 158, 158, 111, 74, 230, 21, 212, 169, 183, 114, - 67, 43, 23, 126, 80, 244, 95, 114, 241, 207, 142, 163, 202, 191, 234, - 141, 145, 230, 67, 233, 229, 250, 197, 31, 62, 248, 251, 139, 81, 142, - 124, 168, 28, 212, 191, 203, 237, 79, 163, 79, 126, 235, 59, 125, 140, - 52, 31, 74, 47, 215, 175, 109, 198, 46, 197, 218, 59, 217, 167, 80, - 122, 42, 143, 156, 125, 158, 114, 178, 74, 133, 214, 99, 164, 249, 80, - 122, 185, 253, 242, 224, 27, 147, 159, 255, 250, 190, 252, 121, 157, 125, - 62, 163, 179, 60, 97, 227, 27, 200, 63, 196, 60, 225, 168, 229, 210, - 121, 194, 246, 121, 131, 82, 124, 48, 79, 184, 209, 218, 252, 231, 121, - 98, 158, 112, 199, 109, 210, 121, 131, 246, 121, 172, 174, 242, 132, 159, - 28, 145, 207, 239, 149, 227, 131, 121, 194, 123, 214, 73, 243, 161, 249, - 175, 114, 249, 144, 152, 39, 188, 254, 134, 116, 126, 166, 125, 30, 173, - 171, 60, 225, 29, 253, 164, 243, 123, 237, 243, 52, 93, 229, 9, 143, - 12, 249, 159, 207, 19, 182, 207, 127, 166, 227, 230, 44, 79, 56, 152, - 228, 63, 207, 28, 243, 132, 123, 105, 229, 207, 177, 237, 243, 241, 157, - 230, 9, 199, 73, 231, 9, 219, 231, 205, 75, 233, 51, 230, 9, 127, - 241, 6, 242, 249, 49, 79, 216, 217, 121, 184, 125, 126, 175, 220, 124, - 97, 158, 240, 169, 47, 164, 249, 216, 247, 203, 85, 158, 240, 170, 141, - 242, 249, 189, 114, 242, 96, 158, 240, 242, 126, 210, 124, 168, 60, 114, - 235, 11, 243, 132, 191, 237, 146, 255, 124, 45, 204, 19, 238, 177, 60, - 255, 249, 90, 152, 39, 124, 232, 88, 254, 243, 172, 48, 79, 184, 210, - 172, 252, 231, 125, 97, 158, 112, 201, 245, 249, 207, 179, 194, 60, 225, - 153, 107, 242, 159, 247, 133, 121, 194, 186, 133, 249, 207, 215, 194, 60, - 97, 223, 207, 243, 159, 175, 133, 121, 194, 35, 230, 230, 63, 95, 11, - 243, 132, 191, 158, 150, 255, 124, 45, 204, 19, 46, 31, 39, 127, 110, - 35, 151, 223, 139, 121, 194, 67, 231, 120, 75, 230, 9, 219, 231, 27, - 211, 243, 10, 103, 121, 194, 51, 150, 75, 231, 175, 210, 117, 33, 151, - 191, 138, 121, 194, 207, 207, 201, 231, 247, 202, 229, 121, 98, 158, 240, - 227, 69, 242, 249, 189, 114, 249, 198, 152, 39, 220, 252, 158, 124, 222, - 178, 125, 158, 175, 179, 60, 225, 139, 38, 233, 188, 83, 251, 124, 99, - 87, 121, 194, 219, 226, 228, 243, 177, 229, 248, 200, 229, 9, 187, 155, - 79, 219, 218, 239, 214, 162, 181, 225, 249, 207, 167, 197, 60, 225, 240, - 140, 252, 231, 247, 98, 158, 240, 222, 21, 249, 207, 55, 198, 60, 225, - 57, 67, 243, 159, 255, 140, 121, 194, 63, 116, 201, 255, 247, 83, 48, - 79, 248, 206, 128, 252, 127, 63, 5, 243, 132, 47, 68, 230, 255, 123, - 37, 152, 39, 236, 63, 60, 255, 223, 115, 193, 60, 225, 228, 33, 249, - 255, 94, 9, 230, 9, 251, 13, 205, 255, 247, 92, 48, 79, 56, 116, - 88, 254, 191, 159, 130, 121, 194, 127, 15, 207, 255, 247, 83, 48, 79, - 248, 240, 136, 252, 127, 63, 5, 243, 132, 87, 140, 200, 255, 247, 83, - 48, 79, 56, 96, 182, 171, 60, 97, 154, 63, 228, 58, 255, 16, 243, - 132, 231, 244, 245, 118, 35, 143, 145, 230, 247, 154, 243, 134, 157, 229, - 9, 159, 157, 226, 42, 79, 216, 54, 207, 216, 85, 158, 240, 190, 246, - 210, 121, 194, 238, 230, 139, 98, 158, 240, 166, 175, 228, 243, 123, 229, - 242, 199, 48, 79, 56, 97, 190, 52, 31, 154, 183, 33, 151, 111, 140, - 121, 194, 103, 141, 68, 54, 159, 86, 238, 121, 1, 230, 9, 87, 89, - 43, 159, 111, 44, 247, 188, 0, 243, 132, 31, 157, 83, 186, 200, 55, - 54, 231, 209, 202, 229, 247, 98, 158, 240, 142, 155, 133, 100, 243, 141, - 229, 242, 159, 49, 79, 56, 118, 135, 124, 126, 175, 220, 56, 99, 158, - 176, 223, 110, 105, 62, 180, 95, 114, 250, 131, 121, 194, 251, 77, 69, - 92, 172, 11, 251, 124, 124, 233, 60, 225, 217, 239, 87, 114, 35, 223, - 216, 245, 186, 192, 60, 225, 239, 38, 86, 146, 205, 203, 149, 155, 47, - 204, 19, 94, 56, 71, 58, 191, 215, 221, 188, 38, 204, 19, 62, 244, - 169, 124, 190, 177, 92, 94, 46, 230, 9, 107, 102, 75, 207, 23, 165, - 151, 211, 31, 204, 19, 174, 59, 93, 58, 47, 215, 221, 124, 90, 204, - 19, 254, 104, 190, 124, 190, 177, 92, 30, 8, 230, 9, 199, 175, 144, - 207, 55, 150, 91, 239, 152, 39, 252, 217, 52, 249, 124, 45, 185, 113, - 198, 60, 225, 47, 22, 72, 63, 55, 183, 207, 219, 114, 149, 39, 124, - 106, 181, 116, 126, 175, 125, 254, 142, 171, 60, 97, 238, 176, 124, 190, - 177, 220, 57, 54, 230, 9, 159, 217, 35, 159, 223, 75, 243, 133, 93, - 229, 9, 159, 253, 92, 154, 143, 253, 247, 75, 92, 229, 9, 191, 59, - 159, 184, 145, 223, 235, 122, 189, 99, 158, 112, 102, 123, 111, 23, 124, - 168, 127, 119, 157, 111, 140, 121, 194, 83, 155, 74, 231, 9, 219, 231, - 249, 186, 202, 19, 94, 122, 94, 58, 79, 152, 218, 83, 57, 62, 152, - 39, 156, 244, 151, 124, 94, 46, 125, 158, 70, 247, 187, 206, 242, 132, - 175, 45, 145, 206, 19, 182, 127, 30, 39, 181, 95, 198, 60, 225, 220, - 185, 210, 242, 208, 231, 148, 114, 207, 25, 49, 79, 248, 143, 123, 210, - 121, 194, 246, 207, 229, 92, 229, 9, 47, 158, 45, 253, 220, 193, 62, - 63, 87, 234, 253, 36, 167, 130, 46, 21, 216, 246, 161, 244, 249, 170, - 125, 158, 177, 212, 121, 38, 230, 9, 215, 25, 47, 157, 39, 76, 243, - 152, 104, 30, 145, 84, 190, 49, 230, 9, 59, 123, 127, 2, 205, 199, - 165, 121, 64, 22, 126, 18, 249, 207, 152, 39, 252, 60, 45, 255, 249, - 189, 152, 39, 28, 213, 53, 255, 249, 198, 152, 39, 124, 234, 75, 249, - 188, 92, 185, 252, 94, 204, 19, 94, 188, 76, 62, 223, 152, 174, 91, - 87, 121, 194, 157, 210, 165, 249, 208, 188, 58, 57, 255, 142, 121, 194, - 37, 63, 146, 246, 59, 148, 143, 156, 63, 93, 24, 20, 82, 97, 196, - 71, 210, 121, 194, 148, 143, 156, 223, 193, 60, 97, 253, 60, 233, 60, - 97, 251, 124, 61, 154, 103, 231, 44, 79, 120, 211, 34, 249, 188, 92, - 154, 175, 231, 42, 79, 248, 241, 28, 233, 113, 182, 207, 59, 118, 149, - 39, 188, 118, 137, 124, 126, 175, 92, 158, 30, 230, 9, 215, 214, 19, - 217, 124, 27, 185, 231, 185, 152, 39, 92, 90, 47, 157, 223, 235, 110, - 126, 29, 230, 9, 183, 155, 37, 159, 111, 76, 231, 203, 85, 158, 112, - 253, 31, 229, 243, 123, 229, 226, 13, 204, 19, 222, 112, 72, 154, 143, - 187, 121, 185, 152, 39, 252, 231, 62, 34, 155, 175, 37, 199, 7, 243, - 132, 55, 237, 146, 207, 55, 150, 203, 91, 198, 60, 97, 206, 32, 159, - 223, 43, 55, 206, 152, 39, 252, 241, 199, 210, 124, 220, 205, 239, 197, - 60, 225, 139, 75, 165, 243, 123, 221, 205, 55, 198, 60, 225, 175, 22, - 203, 231, 27, 211, 245, 230, 42, 79, 120, 248, 114, 249, 188, 83, 57, - 253, 193, 60, 225, 249, 122, 249, 124, 99, 185, 113, 198, 60, 225, 6, - 243, 164, 243, 132, 237, 191, 247, 64, 251, 235, 44, 79, 248, 249, 92, - 23, 121, 194, 162, 223, 146, 179, 27, 152, 39, 252, 197, 121, 249, 124, - 99, 57, 187, 129, 121, 194, 135, 166, 74, 143, 15, 149, 71, 46, 15, - 4, 243, 132, 7, 164, 203, 231, 27, 203, 237, 11, 48, 79, 56, 104, - 134, 252, 247, 34, 229, 214, 41, 230, 9, 47, 153, 33, 157, 223, 235, - 152, 175, 39, 157, 39, 60, 101, 150, 52, 31, 154, 31, 44, 151, 151, - 139, 121, 194, 181, 230, 17, 217, 252, 94, 107, 252, 42, 157, 39, 60, - 230, 161, 82, 246, 253, 54, 114, 253, 194, 60, 225, 199, 131, 228, 243, - 114, 173, 121, 213, 210, 121, 194, 81, 243, 228, 243, 163, 228, 226, 103, - 204, 19, 86, 206, 118, 33, 143, 155, 249, 198, 152, 39, 156, 150, 74, - 100, 191, 247, 39, 55, 95, 152, 39, 220, 120, 150, 116, 158, 176, 187, - 223, 23, 198, 60, 225, 238, 74, 233, 60, 97, 251, 188, 99, 87, 121, - 194, 207, 206, 121, 203, 230, 247, 202, 217, 85, 204, 19, 62, 156, 37, - 157, 39, 76, 243, 113, 229, 242, 141, 49, 79, 248, 254, 30, 111, 217, - 252, 94, 185, 124, 45, 204, 19, 94, 111, 116, 149, 39, 76, 243, 131, - 93, 231, 27, 99, 158, 240, 123, 251, 189, 101, 243, 123, 229, 228, 193, - 60, 225, 85, 223, 72, 231, 9, 211, 124, 92, 185, 124, 54, 204, 19, - 190, 114, 198, 157, 252, 94, 215, 235, 20, 243, 132, 235, 127, 227, 138, - 15, 205, 15, 118, 157, 223, 139, 121, 194, 191, 124, 235, 78, 126, 47, - 205, 23, 150, 206, 19, 62, 127, 211, 21, 31, 247, 242, 159, 49, 79, - 216, 243, 168, 124, 126, 175, 156, 60, 152, 39, 252, 225, 13, 249, 252, - 94, 185, 115, 0, 204, 19, 246, 184, 45, 159, 223, 43, 151, 111, 140, - 121, 194, 47, 238, 74, 243, 161, 249, 184, 114, 249, 198, 152, 39, 252, - 233, 69, 249, 252, 94, 57, 187, 138, 121, 194, 69, 142, 72, 243, 161, - 242, 200, 229, 27, 99, 158, 240, 143, 87, 228, 243, 123, 229, 228, 193, - 60, 225, 152, 195, 210, 124, 236, 243, 124, 93, 229, 9, 31, 185, 33, - 159, 223, 43, 199, 7, 243, 132, 43, 184, 224, 99, 255, 254, 3, 87, - 121, 194, 239, 236, 151, 207, 239, 149, 243, 95, 152, 39, 124, 97, 190, - 52, 31, 119, 191, 111, 133, 121, 194, 158, 159, 200, 231, 247, 202, 249, - 119, 204, 19, 158, 60, 95, 154, 143, 253, 247, 210, 92, 229, 9, 239, - 250, 88, 62, 191, 87, 78, 30, 204, 19, 222, 55, 95, 154, 143, 187, - 223, 7, 193, 60, 97, 63, 39, 207, 29, 162, 90, 19, 225, 157, 247, - 198, 34, 177, 94, 65, 204, 239, 179, 37, 52, 166, 126, 0, 113, 146, - 70, 196, 197, 251, 7, 4, 4, 18, 155, 63, 78, 68, 79, 253, 251, - 177, 130, 72, 252, 233, 129, 111, 174, 151, 153, 87, 78, 193, 88, 47, - 125, 225, 88, 175, 236, 66, 86, 222, 246, 127, 133, 197, 223, 35, 68, - 198, 186, 159, 35, 249, 182, 169, 179, 96, 215, 168, 111, 92, 173, 214, - 49, 77, 235, 122, 119, 249, 243, 243, 167, 104, 88, 252, 42, 196, 147, - 40, 152, 95, 149, 195, 119, 38, 123, 138, 237, 138, 50, 146, 28, 143, - 88, 47, 44, 63, 142, 229, 208, 126, 35, 177, 157, 246, 245, 251, 26, - 215, 60, 173, 204, 39, 152, 106, 240, 243, 110, 156, 125, 165, 152, 172, - 48, 117, 128, 178, 117, 80, 54, 220, 84, 195, 128, 101, 175, 166, 41, - 76, 103, 43, 198, 26, 159, 7, 119, 228, 245, 141, 202, 91, 240, 176, - 236, 5, 148, 77, 106, 84, 222, 130, 215, 237, 204, 24, 227, 233, 123, - 215, 212, 254, 223, 22, 183, 148, 105, 161, 236, 36, 148, 53, 254, 182, - 184, 133, 246, 196, 193, 95, 255, 31, 123, 95, 1, 87, 213, 182, 173, - 191, 232, 110, 65, 58, 164, 148, 6, 233, 70, 148, 84, 80, 164, 67, - 233, 238, 6, 165, 149, 80, 26, 165, 20, 65, 5, 233, 110, 16, 73, - 105, 164, 59, 5, 105, 9, 165, 164, 255, 123, 123, 166, 247, 112, 125, - 231, 220, 115, 239, 123, 239, 190, 247, 126, 255, 115, 182, 191, 15, 215, - 94, 107, 206, 49, 190, 49, 230, 152, 177, 214, 158, 115, 46, 201, 171, - 122, 66, 117, 125, 223, 109, 57, 245, 129, 32, 196, 83, 215, 71, 121, - 117, 50, 176, 115, 67, 103, 206, 57, 195, 206, 73, 195, 206, 13, 132, - 123, 215, 253, 56, 247, 1, 150, 247, 10, 236, 92, 239, 153, 115, 112, - 219, 220, 225, 239, 200, 130, 249, 149, 3, 216, 22, 9, 59, 254, 225, - 149, 155, 103, 142, 241, 207, 28, 247, 160, 255, 122, 28, 121, 230, 248, - 230, 153, 227, 127, 245, 243, 183, 247, 129, 97, 252, 193, 251, 8, 255, - 224, 58, 254, 31, 92, 135, 115, 255, 135, 239, 99, 252, 131, 235, 55, - 255, 193, 117, 6, 248, 251, 167, 96, 49, 203, 242, 183, 119, 99, 34, - 126, 127, 239, 37, 124, 239, 115, 248, 155, 164, 16, 192, 49, 42, 132, - 1, 161, 67, 104, 16, 45, 116, 250, 221, 238, 17, 16, 227, 108, 127, - 203, 183, 9, 27, 223, 62, 130, 181, 89, 241, 176, 255, 3, 197, 167, - 198, 138, 197, 60, 23, 213, 126, 183, 13, 11, 131, 197, 199, 225, 125, - 244, 31, 239, 168, 253, 117, 206, 242, 223, 242, 253, 34, 231, 87, 185, - 191, 47, 7, 37, 224, 63, 202, 249, 241, 222, 197, 255, 120, 12, 228, - 192, 142, 206, 2, 130, 190, 193, 226, 11, 9, 241, 111, 114, 16, 64, - 155, 33, 5, 179, 31, 230, 132, 20, 20, 115, 52, 186, 51, 117, 236, - 108, 28, 220, 144, 178, 181, 115, 178, 55, 49, 130, 12, 156, 77, 28, - 45, 12, 172, 207, 180, 25, 103, 142, 124, 37, 126, 197, 223, 181, 26, - 191, 115, 30, 250, 157, 116, 127, 255, 57, 253, 155, 255, 127, 121, 247, - 215, 175, 121, 127, 149, 251, 115, 124, 211, 162, 252, 126, 155, 244, 159, - 173, 7, 55, 129, 92, 50, 96, 45, 194, 217, 183, 95, 34, 194, 234, - 216, 143, 55, 145, 254, 174, 221, 190, 18, 191, 141, 95, 108, 249, 81, - 14, 112, 223, 211, 157, 241, 109, 202, 25, 91, 110, 72, 57, 26, 24, - 26, 90, 56, 67, 223, 75, 227, 215, 54, 28, 241, 255, 104, 57, 232, - 35, 253, 123, 202, 1, 46, 247, 223, 85, 14, 170, 176, 62, 52, 3, - 200, 162, 254, 187, 24, 255, 245, 163, 122, 77, 213, 196, 253, 55, 206, - 255, 90, 14, 190, 176, 250, 156, 34, 249, 123, 186, 126, 125, 215, 247, - 127, 228, 9, 183, 231, 87, 63, 35, 254, 75, 254, 145, 191, 1, 139, - 81, 132, 95, 234, 54, 41, 224, 254, 247, 237, 5, 60, 141, 147, 185, - 129, 177, 157, 27, 135, 179, 153, 193, 79, 253, 255, 247, 15, 39, 167, - 179, 137, 187, 179, 139, 163, 137, 19, 231, 153, 132, 240, 80, 251, 126, - 82, 247, 183, 115, 255, 207, 126, 244, 215, 143, 255, 105, 199, 32, 252, - 221, 49, 194, 223, 149, 211, 12, 244, 203, 88, 226, 28, 56, 38, 1, - 233, 217, 36, 255, 94, 198, 77, 58, 165, 239, 233, 224, 231, 225, 199, - 191, 202, 253, 149, 134, 36, 236, 31, 45, 58, 124, 114, 237, 191, 25, - 8, 255, 69, 64, 255, 199, 129, 240, 191, 140, 255, 43, 54, 35, 254, - 15, 227, 127, 195, 23, 255, 200, 94, 164, 223, 0, 242, 127, 19, 126, - 75, 246, 63, 242, 199, 255, 132, 221, 191, 101, 39, 202, 25, 160, 254, - 55, 227, 172, 236, 223, 242, 203, 191, 195, 15, 255, 200, 110, 228, 223, - 176, 21, 13, 0, 29, 0, 227, 55, 128, 249, 7, 248, 173, 60, 63, - 228, 253, 144, 255, 179, 79, 144, 255, 13, 126, 248, 61, 219, 145, 207, - 216, 140, 246, 147, 157, 112, 254, 88, 48, 96, 3, 224, 156, 1, 238, - 191, 136, 179, 121, 127, 200, 195, 250, 201, 71, 232, 103, 252, 113, 214, - 15, 255, 85, 31, 252, 108, 251, 217, 50, 63, 107, 247, 89, 123, 127, - 216, 136, 7, 159, 24, 11, 3, 1, 12, 132, 0, 68, 0, 231, 254, - 73, 252, 72, 255, 35, 63, 1, 144, 137, 119, 198, 55, 103, 253, 113, - 214, 15, 63, 199, 194, 127, 198, 7, 63, 219, 126, 182, 204, 127, 148, - 55, 22, 224, 241, 195, 94, 66, 192, 157, 24, 6, 18, 24, 206, 195, - 64, 10, 159, 20, 7, 159, 136, 15, 64, 241, 79, 226, 71, 122, 50, - 32, 227, 60, 144, 73, 12, 116, 16, 158, 241, 7, 14, 224, 242, 35, - 30, 126, 43, 22, 254, 21, 251, 255, 200, 118, 76, 224, 123, 60, 80, - 46, 68, 128, 27, 41, 224, 76, 9, 3, 53, 252, 97, 48, 252, 65, - 55, 124, 17, 38, 12, 23, 224, 15, 243, 1, 24, 254, 0, 63, 210, - 93, 0, 121, 105, 129, 44, 106, 32, 155, 28, 232, 34, 1, 186, 9, - 0, 23, 236, 51, 177, 240, 95, 241, 193, 207, 245, 253, 172, 237, 63, - 202, 28, 255, 140, 221, 100, 128, 23, 13, 224, 12, 183, 129, 9, 134, - 139, 48, 176, 192, 192, 10, 3, 27, 124, 114, 54, 0, 199, 31, 224, - 71, 58, 54, 144, 151, 5, 200, 98, 2, 178, 47, 0, 93, 148, 64, - 247, 15, 63, 224, 159, 137, 133, 179, 62, 248, 185, 61, 248, 87, 203, - 254, 172, 237, 184, 192, 223, 231, 64, 25, 252, 176, 27, 94, 94, 204, - 128, 43, 156, 59, 23, 124, 114, 6, 12, 188, 240, 69, 94, 240, 5, - 126, 48, 8, 194, 32, 4, 159, 204, 244, 7, 16, 2, 105, 5, 64, - 94, 94, 32, 139, 11, 200, 102, 1, 186, 232, 207, 248, 129, 20, 112, - 34, 0, 28, 207, 250, 224, 95, 137, 129, 223, 179, 29, 19, 248, 150, - 0, 212, 65, 184, 223, 169, 64, 89, 48, 129, 114, 226, 4, 92, 225, - 220, 69, 224, 147, 61, 225, 63, 160, 195, 112, 5, 134, 171, 240, 197, - 119, 48, 200, 192, 32, 11, 32, 247, 19, 126, 156, 151, 1, 105, 175, - 130, 188, 146, 64, 150, 8, 144, 205, 11, 116, 177, 2, 221, 23, 0, - 23, 50, 192, 141, 0, 112, 197, 252, 7, 62, 248, 103, 202, 30, 5, - 180, 169, 24, 160, 110, 225, 3, 31, 147, 129, 186, 8, 247, 255, 37, - 16, 179, 188, 160, 220, 224, 60, 165, 129, 29, 138, 48, 40, 193, 112, - 19, 6, 21, 24, 84, 225, 63, 120, 194, 39, 31, 254, 1, 212, 64, - 90, 21, 144, 87, 9, 200, 146, 5, 178, 197, 129, 46, 94, 160, 251, - 18, 224, 66, 13, 184, 157, 3, 92, 177, 1, 119, 180, 159, 234, 193, - 239, 197, 192, 63, 138, 123, 60, 80, 199, 72, 129, 175, 127, 216, 206, - 5, 226, 84, 12, 112, 147, 135, 65, 25, 240, 215, 132, 47, 56, 128, - 225, 46, 252, 135, 13, 248, 143, 0, 240, 133, 75, 48, 152, 192, 96, - 250, 59, 48, 1, 105, 140, 64, 158, 187, 64, 134, 38, 144, 169, 12, - 116, 72, 3, 157, 2, 128, 195, 15, 31, 80, 1, 142, 68, 128, 51, - 214, 191, 16, 3, 191, 85, 246, 103, 227, 158, 4, 212, 181, 11, 103, - 108, 135, 199, 163, 4, 40, 27, 37, 80, 118, 58, 128, 59, 220, 30, - 75, 24, 108, 96, 176, 135, 47, 106, 131, 79, 4, 129, 47, 38, 131, - 193, 245, 119, 224, 2, 210, 56, 130, 60, 54, 64, 134, 41, 144, 169, - 3, 116, 40, 1, 157, 18, 128, 195, 15, 31, 92, 0, 28, 73, 126, - 170, 7, 191, 21, 3, 127, 20, 251, 63, 151, 61, 25, 104, 111, 152, - 64, 220, 9, 0, 253, 240, 186, 123, 11, 6, 45, 192, 209, 28, 6, - 91, 96, 135, 7, 12, 94, 240, 9, 219, 48, 248, 195, 240, 0, 134, - 135, 48, 4, 194, 16, 244, 19, 2, 193, 181, 7, 32, 173, 47, 200, - 235, 1, 100, 217, 2, 217, 6, 64, 215, 45, 160, 91, 2, 112, 225, - 0, 220, 104, 0, 215, 159, 99, 224, 31, 213, 129, 179, 246, 255, 136, - 253, 179, 245, 254, 71, 217, 211, 131, 118, 135, 23, 196, 159, 44, 224, - 161, 13, 226, 214, 26, 112, 189, 15, 108, 128, 219, 21, 10, 67, 4, - 12, 209, 240, 137, 82, 240, 201, 136, 48, 196, 194, 16, 247, 19, 98, - 193, 181, 39, 32, 109, 4, 200, 27, 4, 100, 221, 7, 178, 173, 129, - 46, 109, 160, 91, 22, 112, 225, 5, 220, 232, 207, 196, 192, 217, 118, - 224, 71, 29, 248, 61, 251, 127, 174, 251, 24, 32, 126, 8, 65, 157, - 162, 1, 253, 14, 39, 104, 127, 164, 65, 28, 106, 1, 62, 240, 242, - 113, 7, 229, 22, 12, 248, 195, 237, 73, 132, 225, 5, 12, 47, 225, - 27, 73, 192, 144, 6, 159, 104, 1, 144, 14, 240, 227, 123, 26, 72, - 243, 18, 228, 73, 4, 50, 34, 128, 76, 95, 160, 195, 22, 232, 212, - 2, 28, 164, 1, 39, 78, 192, 145, 6, 112, 38, 4, 54, 96, 252, - 65, 27, 240, 123, 117, 31, 23, 180, 167, 228, 160, 110, 177, 0, 63, - 139, 131, 118, 72, 13, 196, 163, 53, 224, 229, 15, 202, 12, 94, 134, - 207, 97, 120, 5, 95, 108, 7, 67, 14, 124, 18, 60, 252, 135, 89, - 24, 138, 97, 40, 129, 255, 248, 252, 19, 74, 192, 181, 66, 144, 54, - 7, 228, 125, 5, 100, 61, 1, 178, 253, 129, 46, 107, 160, 91, 13, - 112, 17, 7, 220, 88, 0, 87, 114, 192, 29, 247, 159, 104, 3, 126, - 203, 254, 31, 117, 159, 24, 196, 19, 3, 24, 127, 8, 2, 127, 43, - 131, 246, 200, 28, 196, 165, 47, 224, 7, 143, 227, 100, 80, 174, 121, - 192, 174, 74, 24, 222, 194, 39, 154, 194, 80, 7, 95, 152, 2, 208, - 8, 240, 227, 123, 29, 72, 243, 22, 228, 41, 1, 50, 210, 129, 204, - 88, 160, 195, 23, 232, 52, 7, 28, 148, 1, 39, 65, 192, 145, 1, - 112, 38, 62, 211, 6, 252, 43, 246, 163, 255, 84, 247, 169, 65, 219, - 194, 5, 198, 33, 178, 160, 63, 50, 0, 177, 120, 31, 196, 231, 19, - 192, 51, 19, 190, 88, 28, 216, 0, 183, 167, 9, 134, 86, 24, 218, - 97, 232, 132, 161, 11, 134, 15, 240, 133, 143, 0, 31, 192, 185, 78, - 144, 166, 21, 228, 169, 5, 50, 138, 128, 204, 100, 160, 35, 24, 232, - 180, 5, 28, 84, 1, 39, 17, 192, 145, 9, 112, 62, 219, 6, 160, - 255, 147, 246, 163, 158, 177, 159, 0, 220, 123, 209, 128, 49, 56, 15, - 136, 51, 69, 208, 39, 155, 130, 114, 240, 7, 117, 244, 57, 40, 43, - 56, 223, 106, 80, 182, 109, 192, 190, 62, 248, 66, 124, 248, 228, 49, - 24, 70, 224, 139, 12, 126, 194, 8, 184, 54, 8, 210, 126, 0, 121, - 27, 129, 172, 34, 32, 251, 57, 208, 229, 15, 116, 155, 2, 46, 138, - 128, 27, 15, 224, 74, 3, 184, 19, 156, 177, 31, 245, 15, 236, 255, - 189, 182, 143, 246, 76, 221, 151, 4, 109, 142, 46, 232, 155, 61, 64, - 27, 253, 20, 212, 213, 60, 80, 102, 112, 222, 29, 48, 244, 194, 23, - 224, 193, 48, 6, 195, 36, 12, 211, 240, 133, 206, 240, 205, 202, 126, - 194, 71, 112, 109, 18, 164, 29, 2, 121, 59, 128, 172, 74, 32, 251, - 21, 208, 21, 4, 116, 91, 2, 46, 74, 128, 219, 143, 54, 128, 246, - 31, 180, 129, 103, 237, 71, 248, 3, 251, 201, 192, 125, 40, 43, 184, - 31, 185, 2, 198, 165, 119, 193, 248, 196, 11, 212, 201, 68, 208, 94, - 149, 128, 184, 109, 3, 252, 71, 128, 77, 112, 251, 62, 193, 39, 51, - 194, 176, 4, 195, 242, 79, 88, 2, 215, 62, 129, 180, 147, 32, 111, - 47, 144, 85, 11, 100, 103, 0, 93, 161, 64, 183, 13, 224, 114, 19, - 112, 227, 7, 92, 233, 0, 247, 127, 100, 63, 194, 31, 216, 79, 116, - 166, 237, 103, 3, 227, 140, 171, 96, 108, 110, 0, 198, 104, 190, 32, - 30, 95, 128, 54, 187, 18, 212, 221, 15, 160, 12, 225, 118, 204, 193, - 176, 8, 159, 144, 5, 195, 103, 24, 214, 97, 216, 248, 9, 235, 224, - 218, 10, 72, 59, 7, 242, 14, 1, 89, 77, 64, 118, 14, 208, 21, - 1, 116, 219, 3, 46, 42, 128, 155, 0, 224, 250, 163, 15, 32, 250, - 79, 218, 143, 123, 198, 126, 250, 51, 109, 255, 53, 208, 222, 24, 129, - 113, 170, 63, 24, 175, 188, 4, 253, 214, 91, 208, 126, 245, 129, 56, - 254, 8, 236, 89, 5, 54, 126, 129, 225, 43, 124, 49, 215, 79, 248, - 10, 174, 173, 131, 180, 139, 32, 239, 24, 144, 213, 10, 100, 231, 3, - 93, 209, 64, 183, 35, 224, 162, 10, 184, 253, 232, 3, 232, 207, 216, - 143, 251, 159, 180, 255, 28, 120, 30, 245, 195, 126, 33, 112, 127, 170, - 6, 198, 31, 206, 96, 188, 250, 4, 140, 91, 10, 65, 156, 182, 131, - 118, 108, 18, 196, 243, 10, 176, 11, 110, 227, 54, 124, 226, 52, 12, - 187, 48, 236, 1, 236, 130, 115, 219, 32, 205, 58, 200, 243, 9, 200, - 24, 4, 50, 107, 129, 142, 215, 64, 231, 3, 192, 193, 24, 112, 146, - 1, 28, 127, 216, 79, 113, 102, 12, 240, 175, 216, 143, 249, 147, 253, - 12, 96, 124, 45, 12, 250, 25, 117, 112, 175, 230, 2, 198, 236, 79, - 193, 216, 173, 24, 244, 225, 157, 160, 45, 159, 6, 117, 250, 51, 40, - 219, 109, 96, 235, 55, 248, 98, 181, 159, 240, 13, 92, 219, 6, 105, - 63, 131, 188, 211, 64, 86, 39, 144, 93, 12, 116, 61, 5, 186, 93, - 0, 23, 117, 192, 77, 24, 112, 101, 248, 201, 126, 204, 255, 102, 251, - 77, 193, 61, 91, 32, 24, 151, 188, 1, 237, 83, 3, 232, 203, 71, - 64, 252, 46, 157, 41, 251, 157, 51, 182, 31, 192, 55, 68, 3, 56, - 56, 227, 131, 157, 51, 49, 176, 4, 100, 140, 0, 153, 13, 64, 199, - 27, 160, 51, 16, 112, 48, 253, 31, 180, 95, 238, 39, 251, 131, 192, - 253, 203, 27, 48, 142, 109, 0, 237, 213, 40, 232, 215, 150, 65, 251, - 182, 5, 202, 247, 172, 237, 71, 0, 103, 125, 176, 11, 210, 110, 128, - 188, 179, 64, 214, 7, 32, 187, 20, 232, 138, 3, 186, 207, 218, 47, - 247, 191, 104, 127, 58, 224, 214, 8, 198, 116, 191, 101, 255, 30, 176, - 241, 172, 237, 103, 125, 176, 15, 210, 252, 150, 253, 221, 64, 118, 41, - 208, 245, 151, 253, 255, 183, 236, 255, 179, 196, 255, 159, 189, 253, 251, - 51, 244, 127, 127, 246, 241, 207, 95, 227, 223, 191, 238, 127, 254, 44, - 247, 191, 127, 246, 231, 31, 127, 61, 255, 250, 235, 249, 231, 95, 207, - 191, 255, 250, 253, 227, 207, 254, 251, 215, 159, 253, 247, 207, 63, 243, - 239, 223, 127, 246, 249, 15, 127, 205, 127, 249, 107, 254, 211, 159, 125, - 254, 219, 95, 243, 31, 255, 154, 255, 250, 215, 252, 231, 191, 230, 191, - 255, 181, 254, 225, 175, 245, 47, 127, 173, 127, 250, 107, 253, 219, 95, - 235, 31, 255, 90, 255, 250, 215, 250, 231, 255, 207, 215, 191, 255, 109, - 135, 8, 21, 181, 107, 234, 242, 183, 229, 149, 149, 216, 53, 101, 228, - 175, 95, 227, 248, 117, 111, 134, 153, 95, 247, 102, 56, 187, 15, 203, - 47, 123, 51, 252, 178, 191, 199, 101, 14, 75, 123, 179, 223, 216, 195, - 192, 81, 88, 247, 174, 189, 139, 161, 181, 133, 147, 185, 137, 35, 187, - 189, 163, 137, 181, 157, 129, 177, 137, 163, 46, 216, 177, 65, 247, 183, - 115, 255, 207, 126, 184, 16, 190, 253, 151, 246, 102, 248, 113, 110, 115, - 243, 215, 189, 25, 224, 199, 63, 246, 102, 24, 188, 241, 247, 50, 82, - 114, 127, 217, 155, 97, 228, 198, 47, 199, 63, 100, 156, 142, 156, 206, - 64, 248, 10, 50, 242, 50, 16, 2, 34, 2, 36, 7, 251, 7, 157, - 174, 17, 190, 185, 105, 110, 231, 108, 231, 100, 110, 103, 79, 123, 153, - 131, 11, 18, 188, 34, 127, 3, 105, 237, 151, 205, 148, 224, 41, 190, - 211, 0, 255, 195, 175, 33, 227, 124, 191, 6, 223, 238, 196, 253, 123, - 218, 173, 239, 223, 209, 127, 104, 255, 158, 6, 243, 7, 113, 248, 55, - 102, 124, 176, 245, 213, 15, 67, 16, 191, 231, 219, 249, 126, 44, 7, - 113, 154, 154, 194, 174, 88, 195, 254, 162, 130, 92, 191, 156, 121, 153, - 144, 248, 183, 51, 191, 108, 221, 165, 13, 251, 251, 227, 12, 223, 247, - 191, 236, 191, 158, 249, 46, 243, 219, 47, 155, 123, 65, 240, 200, 251, - 141, 15, 210, 210, 247, 125, 91, 254, 219, 175, 125, 183, 249, 199, 134, - 39, 72, 223, 191, 253, 82, 226, 164, 191, 87, 206, 223, 211, 160, 3, - 47, 127, 247, 20, 162, 228, 47, 0, 215, 206, 253, 205, 203, 132, 223, - 191, 99, 127, 79, 250, 9, 20, 165, 253, 47, 64, 184, 9, 65, 49, - 240, 243, 173, 48, 77, 8, 191, 89, 190, 235, 16, 174, 148, 177, 157, - 161, 9, 100, 12, 127, 191, 29, 194, 233, 56, 244, 0, 194, 70, 71, - 71, 199, 64, 199, 198, 192, 192, 38, 192, 194, 196, 34, 32, 198, 195, - 198, 198, 35, 38, 37, 34, 34, 38, 34, 34, 37, 192, 254, 254, 1, - 255, 253, 246, 7, 1, 7, 11, 11, 7, 23, 7, 31, 23, 23, 255, - 28, 46, 46, 238, 57, 248, 31, 220, 115, 191, 100, 33, 248, 103, 4, - 156, 214, 65, 4, 232, 48, 3, 236, 145, 16, 46, 64, 136, 4, 8, - 72, 4, 8, 167, 147, 48, 99, 209, 78, 155, 16, 36, 96, 44, 81, - 16, 190, 127, 128, 175, 144, 96, 230, 32, 163, 160, 162, 161, 99, 96, - 98, 33, 252, 124, 17, 1, 66, 68, 250, 113, 17, 31, 66, 64, 70, - 64, 66, 68, 70, 68, 65, 67, 69, 71, 65, 194, 190, 12, 187, 72, - 128, 132, 76, 71, 200, 141, 34, 117, 203, 128, 232, 130, 131, 31, 15, - 234, 185, 168, 151, 133, 87, 232, 25, 136, 85, 234, 13, 47, 243, 58, - 250, 247, 74, 163, 49, 70, 223, 222, 252, 248, 197, 200, 137, 143, 228, - 85, 81, 0, 211, 213, 24, 85, 227, 107, 13, 175, 157, 249, 207, 247, - 169, 205, 154, 124, 45, 126, 208, 216, 239, 50, 183, 37, 195, 252, 36, - 245, 97, 201, 211, 166, 129, 79, 219, 105, 165, 239, 7, 231, 119, 212, - 77, 93, 3, 99, 223, 148, 53, 15, 45, 236, 10, 200, 106, 152, 185, - 5, 197, 165, 151, 183, 12, 47, 238, 17, 64, 136, 136, 48, 182, 200, - 223, 57, 161, 161, 162, 240, 125, 167, 64, 199, 77, 136, 12, 99, 224, - 112, 129, 8, 133, 199, 47, 234, 28, 156, 65, 189, 74, 239, 230, 101, - 6, 195, 143, 142, 254, 209, 210, 183, 137, 141, 156, 120, 191, 48, 162, - 194, 9, 160, 49, 241, 53, 244, 193, 72, 188, 62, 111, 124, 77, 141, - 223, 217, 100, 246, 111, 20, 126, 159, 1, 243, 175, 20, 78, 199, 32, - 108, 164, 239, 58, 9, 32, 9, 168, 100, 237, 101, 106, 28, 6, 30, - 249, 234, 132, 237, 30, 47, 222, 167, 204, 119, 67, 26, 183, 177, 74, - 142, 134, 49, 14, 152, 180, 123, 118, 215, 220, 202, 147, 87, 236, 110, - 149, 32, 42, 62, 214, 70, 62, 124, 131, 91, 219, 190, 123, 232, 90, - 57, 181, 203, 166, 84, 58, 80, 230, 39, 63, 132, 86, 46, 207, 248, - 70, 172, 234, 176, 252, 158, 202, 237, 26, 181, 48, 78, 179, 117, 63, - 17, 55, 251, 229, 205, 201, 245, 177, 201, 252, 177, 144, 219, 150, 70, - 146, 180, 94, 180, 139, 21, 136, 66, 132, 226, 49, 53, 47, 198, 249, - 15, 125, 118, 204, 46, 133, 12, 234, 177, 27, 69, 84, 166, 223, 232, - 74, 66, 248, 216, 145, 186, 156, 128, 93, 154, 231, 58, 59, 139, 246, - 192, 31, 125, 12, 109, 135, 255, 152, 230, 88, 99, 57, 77, 96, 233, - 101, 106, 153, 73, 103, 142, 237, 148, 60, 141, 226, 50, 234, 97, 205, - 187, 161, 92, 81, 87, 212, 230, 17, 174, 30, 99, 251, 251, 135, 238, - 180, 70, 1, 219, 111, 164, 168, 251, 204, 154, 14, 239, 190, 246, 137, - 57, 169, 237, 90, 26, 188, 101, 124, 30, 215, 135, 147, 195, 80, 225, - 54, 43, 142, 62, 101, 27, 151, 81, 83, 67, 20, 59, 244, 98, 70, - 142, 168, 59, 250, 201, 61, 185, 125, 220, 155, 83, 195, 49, 107, 9, - 168, 202, 54, 216, 202, 125, 199, 27, 43, 169, 105, 143, 183, 119, 227, - 113, 241, 233, 55, 110, 10, 84, 248, 127, 92, 64, 118, 35, 72, 223, - 245, 106, 119, 30, 66, 15, 138, 120, 73, 173, 187, 181, 118, 185, 252, - 225, 121, 245, 186, 161, 53, 238, 151, 104, 241, 18, 251, 52, 31, 228, - 21, 4, 86, 153, 140, 154, 245, 79, 33, 230, 39, 167, 144, 37, 142, - 133, 133, 112, 56, 70, 112, 12, 243, 180, 196, 53, 244, 161, 6, 42, - 19, 253, 117, 15, 14, 119, 102, 127, 153, 110, 187, 253, 96, 229, 34, - 4, 134, 53, 130, 42, 249, 254, 218, 16, 121, 121, 235, 182, 204, 46, - 60, 100, 235, 40, 238, 47, 227, 184, 189, 102, 38, 165, 41, 144, 59, - 178, 136, 125, 184, 143, 187, 143, 217, 177, 183, 63, 251, 13, 196, 87, - 7, 143, 117, 153, 52, 133, 98, 50, 167, 211, 123, 167, 143, 34, 142, - 252, 3, 165, 35, 10, 99, 82, 144, 43, 132, 141, 151, 215, 198, 203, - 247, 188, 99, 183, 85, 97, 189, 101, 79, 177, 215, 67, 255, 197, 98, - 123, 232, 60, 73, 149, 228, 209, 204, 41, 228, 32, 82, 219, 103, 183, - 163, 179, 226, 211, 204, 66, 69, 65, 92, 246, 201, 216, 69, 183, 44, - 72, 128, 146, 170, 186, 102, 236, 75, 245, 158, 106, 213, 235, 145, 177, - 61, 30, 82, 175, 222, 116, 180, 164, 220, 221, 53, 23, 159, 1, 169, - 21, 134, 57, 103, 107, 165, 216, 254, 194, 81, 250, 129, 50, 4, 252, - 233, 180, 109, 159, 165, 212, 44, 19, 42, 129, 124, 149, 67, 7, 86, - 98, 157, 91, 123, 114, 1, 18, 53, 107, 234, 158, 84, 110, 132, 82, - 162, 130, 136, 188, 65, 164, 7, 194, 201, 105, 213, 199, 62, 125, 170, - 75, 236, 182, 244, 137, 155, 200, 98, 69, 104, 59, 46, 78, 186, 85, - 226, 81, 146, 54, 187, 149, 185, 236, 6, 238, 180, 34, 122, 232, 243, - 121, 167, 144, 236, 41, 244, 154, 16, 181, 79, 138, 92, 120, 36, 62, - 86, 67, 211, 105, 98, 49, 238, 186, 45, 20, 238, 21, 122, 192, 126, - 192, 190, 123, 111, 48, 101, 45, 12, 74, 26, 195, 224, 64, 58, 73, - 158, 10, 238, 227, 191, 238, 209, 73, 19, 71, 163, 56, 150, 61, 241, - 181, 87, 226, 249, 44, 122, 4, 193, 41, 164, 58, 237, 58, 16, 25, - 119, 15, 171, 204, 222, 3, 169, 117, 89, 34, 105, 191, 213, 206, 9, - 169, 172, 130, 170, 137, 232, 56, 118, 217, 76, 162, 186, 250, 208, 210, - 89, 117, 152, 123, 44, 26, 215, 175, 166, 78, 196, 167, 18, 235, 82, - 253, 203, 151, 235, 177, 168, 9, 145, 130, 71, 117, 87, 20, 20, 86, - 73, 251, 60, 208, 182, 94, 55, 42, 31, 36, 181, 42, 241, 227, 223, - 93, 243, 224, 234, 251, 152, 238, 254, 201, 238, 120, 254, 250, 132, 158, - 211, 39, 255, 41, 52, 218, 138, 15, 171, 252, 197, 203, 247, 180, 55, - 62, 251, 140, 63, 186, 176, 27, 64, 94, 133, 193, 70, 27, 57, 140, - 136, 219, 181, 238, 84, 43, 226, 58, 189, 115, 76, 126, 219, 176, 175, - 69, 163, 220, 181, 79, 151, 177, 25, 239, 235, 30, 94, 151, 35, 1, - 237, 24, 169, 88, 81, 157, 246, 71, 232, 186, 207, 179, 109, 177, 83, - 168, 227, 152, 249, 136, 5, 165, 146, 130, 5, 71, 36, 109, 221, 137, - 124, 193, 95, 239, 109, 28, 137, 180, 87, 178, 178, 235, 241, 114, 238, - 189, 220, 114, 39, 170, 150, 18, 91, 124, 233, 230, 112, 11, 135, 221, - 147, 167, 131, 39, 86, 62, 157, 242, 215, 117, 247, 30, 151, 157, 135, - 12, 113, 238, 201, 108, 184, 245, 21, 126, 144, 80, 62, 72, 126, 125, - 10, 101, 43, 205, 46, 150, 214, 81, 173, 249, 106, 95, 149, 233, 167, - 121, 237, 179, 83, 59, 124, 130, 79, 172, 185, 56, 209, 60, 178, 136, - 184, 200, 95, 251, 74, 91, 172, 65, 177, 86, 188, 251, 246, 128, 119, - 75, 33, 113, 25, 218, 144, 149, 147, 107, 77, 24, 215, 210, 199, 186, - 67, 189, 242, 173, 119, 113, 199, 188, 240, 224, 232, 21, 217, 76, 72, - 72, 86, 227, 180, 160, 75, 181, 139, 105, 181, 152, 62, 78, 78, 45, - 60, 104, 190, 213, 185, 58, 204, 69, 80, 84, 52, 214, 92, 147, 40, - 64, 60, 48, 43, 96, 81, 182, 139, 35, 237, 149, 40, 133, 202, 119, - 210, 55, 83, 200, 227, 211, 30, 55, 106, 148, 218, 225, 71, 159, 32, - 62, 48, 154, 116, 126, 142, 58, 101, 221, 80, 210, 122, 168, 79, 250, - 46, 68, 67, 131, 184, 49, 165, 199, 143, 218, 35, 25, 144, 137, 139, - 20, 142, 86, 69, 35, 33, 181, 126, 224, 179, 186, 242, 245, 88, 168, - 171, 112, 35, 51, 53, 230, 117, 34, 179, 116, 235, 226, 178, 237, 158, - 144, 139, 222, 69, 10, 243, 204, 197, 201, 210, 112, 139, 113, 242, 250, - 233, 42, 113, 239, 141, 21, 159, 248, 215, 69, 233, 213, 197, 186, 113, - 54, 236, 123, 114, 144, 185, 49, 65, 149, 143, 219, 210, 155, 194, 92, - 225, 36, 109, 190, 11, 188, 180, 73, 249, 195, 7, 185, 42, 153, 47, - 67, 113, 160, 32, 126, 125, 171, 99, 195, 41, 159, 232, 87, 125, 179, - 13, 75, 227, 111, 151, 152, 76, 197, 67, 104, 100, 167, 183, 137, 98, - 47, 91, 213, 217, 54, 190, 196, 151, 15, 119, 121, 49, 221, 46, 213, - 89, 100, 205, 64, 133, 206, 190, 187, 114, 61, 98, 37, 249, 85, 202, - 42, 100, 84, 86, 33, 133, 28, 196, 75, 99, 97, 30, 103, 251, 0, - 177, 97, 175, 162, 141, 182, 59, 163, 121, 215, 185, 35, 185, 241, 121, - 215, 212, 238, 41, 52, 172, 162, 98, 89, 67, 225, 182, 238, 206, 16, - 162, 239, 75, 155, 108, 165, 87, 129, 51, 88, 211, 170, 97, 216, 51, - 187, 138, 206, 39, 98, 142, 236, 79, 110, 144, 178, 102, 103, 122, 232, - 118, 140, 247, 45, 91, 162, 62, 107, 119, 125, 202, 184, 49, 60, 21, - 7, 15, 165, 218, 90, 124, 195, 233, 197, 70, 175, 79, 126, 38, 207, - 225, 234, 212, 161, 64, 205, 251, 158, 143, 235, 241, 20, 58, 20, 74, - 11, 199, 204, 62, 249, 223, 24, 82, 73, 52, 76, 226, 231, 243, 236, - 93, 103, 123, 113, 201, 5, 21, 75, 246, 248, 198, 189, 62, 164, 155, - 238, 122, 71, 108, 39, 111, 90, 90, 187, 168, 108, 14, 109, 16, 199, - 32, 244, 232, 173, 125, 217, 77, 250, 112, 112, 103, 241, 20, 90, 25, - 152, 29, 46, 124, 229, 98, 85, 123, 245, 27, 67, 19, 205, 61, 202, - 13, 215, 233, 111, 234, 94, 152, 181, 155, 4, 101, 229, 158, 126, 129, - 164, 51, 179, 140, 69, 8, 104, 203, 181, 86, 62, 30, 176, 16, 59, - 133, 122, 45, 46, 153, 173, 187, 164, 174, 30, 208, 178, 187, 163, 109, - 37, 111, 24, 115, 55, 142, 86, 159, 228, 111, 13, 232, 242, 96, 117, - 176, 237, 161, 34, 101, 235, 228, 205, 50, 126, 168, 57, 12, 28, 90, - 247, 73, 63, 86, 86, 24, 216, 16, 241, 162, 88, 137, 30, 191, 138, - 129, 22, 98, 99, 227, 242, 44, 185, 122, 191, 236, 224, 222, 216, 198, - 196, 118, 191, 141, 121, 94, 121, 28, 213, 26, 77, 26, 253, 68, 11, - 62, 37, 219, 30, 47, 119, 233, 161, 222, 209, 198, 1, 191, 119, 204, - 49, 139, 130, 207, 105, 223, 84, 221, 155, 238, 162, 105, 28, 219, 77, - 74, 163, 200, 141, 15, 115, 251, 119, 97, 45, 204, 170, 85, 231, 193, - 99, 37, 60, 221, 119, 175, 183, 239, 184, 241, 126, 161, 93, 169, 81, - 76, 21, 47, 24, 86, 149, 134, 5, 189, 46, 213, 20, 243, 41, 196, - 173, 203, 60, 252, 33, 202, 198, 67, 194, 214, 220, 181, 13, 123, 226, - 158, 197, 231, 136, 207, 180, 215, 242, 66, 94, 91, 188, 203, 228, 27, - 77, 216, 64, 246, 14, 229, 238, 23, 43, 61, 80, 44, 93, 42, 137, - 253, 216, 41, 91, 133, 228, 71, 77, 131, 242, 225, 88, 166, 249, 213, - 243, 243, 107, 140, 249, 165, 201, 215, 35, 186, 184, 69, 124, 86, 72, - 78, 216, 79, 18, 138, 242, 149, 237, 82, 181, 77, 189, 159, 224, 84, - 29, 211, 76, 157, 180, 28, 107, 35, 16, 242, 235, 73, 59, 145, 15, - 21, 44, 25, 249, 17, 161, 45, 123, 91, 18, 39, 92, 119, 114, 33, - 156, 114, 67, 186, 96, 54, 121, 10, 41, 30, 251, 120, 63, 94, 247, - 86, 12, 54, 46, 109, 112, 173, 168, 163, 77, 216, 93, 90, 155, 150, - 34, 171, 24, 18, 126, 133, 187, 96, 238, 108, 59, 20, 239, 182, 126, - 204, 185, 115, 10, 213, 61, 58, 239, 122, 103, 104, 221, 126, 2, 194, - 231, 157, 164, 244, 118, 219, 113, 165, 195, 178, 46, 234, 182, 170, 183, - 182, 25, 19, 53, 232, 234, 61, 212, 92, 56, 176, 53, 59, 162, 134, - 57, 253, 20, 26, 10, 138, 210, 209, 36, 239, 69, 105, 198, 186, 203, - 67, 201, 164, 187, 86, 93, 46, 112, 80, 155, 124, 32, 113, 67, 196, - 104, 144, 3, 23, 135, 155, 205, 159, 191, 202, 108, 252, 228, 252, 150, - 207, 179, 209, 195, 228, 221, 175, 42, 236, 229, 218, 253, 37, 159, 7, - 172, 45, 6, 168, 100, 114, 92, 135, 42, 223, 250, 8, 28, 72, 28, - 211, 209, 57, 61, 95, 40, 26, 18, 241, 56, 144, 122, 173, 1, 9, - 120, 113, 190, 90, 93, 118, 235, 59, 62, 168, 149, 221, 95, 185, 94, - 84, 30, 214, 229, 63, 195, 116, 213, 38, 160, 48, 125, 124, 91, 123, - 237, 101, 172, 214, 126, 8, 215, 160, 113, 220, 219, 176, 7, 197, 110, - 134, 67, 17, 139, 15, 146, 222, 37, 167, 159, 66, 183, 78, 33, 242, - 232, 216, 199, 218, 125, 55, 244, 35, 186, 227, 120, 45, 56, 112, 220, - 106, 15, 166, 186, 55, 147, 95, 159, 232, 16, 33, 178, 32, 12, 137, - 13, 225, 165, 213, 204, 242, 29, 136, 220, 45, 204, 27, 95, 94, 223, - 61, 156, 254, 108, 118, 92, 53, 91, 21, 63, 44, 98, 206, 30, 156, - 175, 55, 102, 121, 220, 121, 180, 104, 99, 127, 10, 213, 231, 202, 239, - 150, 190, 233, 26, 119, 195, 31, 162, 16, 144, 114, 246, 121, 48, 89, - 189, 92, 108, 183, 116, 124, 146, 165, 96, 100, 229, 106, 173, 239, 221, - 120, 187, 156, 183, 147, 171, 90, 198, 70, 226, 53, 251, 218, 254, 41, - 180, 51, 208, 197, 65, 162, 165, 123, 222, 119, 161, 166, 183, 90, 210, - 135, 87, 194, 174, 247, 68, 57, 243, 132, 232, 100, 156, 145, 221, 105, - 252, 182, 110, 95, 189, 89, 5, 137, 124, 156, 69, 57, 172, 83, 252, - 124, 10, 181, 106, 104, 177, 31, 83, 133, 79, 172, 145, 143, 26, 233, - 164, 146, 6, 201, 82, 212, 200, 141, 151, 31, 91, 195, 194, 171, 127, - 100, 201, 205, 182, 170, 89, 180, 74, 115, 115, 223, 126, 156, 252, 158, - 68, 209, 198, 246, 179, 154, 21, 31, 45, 110, 150, 174, 204, 157, 210, - 24, 147, 176, 49, 82, 231, 61, 188, 151, 184, 110, 229, 91, 79, 243, - 18, 252, 110, 176, 151, 211, 150, 230, 246, 148, 15, 92, 166, 149, 119, - 74, 52, 21, 15, 159, 215, 16, 201, 222, 30, 214, 94, 201, 114, 191, - 87, 111, 142, 199, 197, 16, 124, 180, 113, 228, 47, 239, 80, 69, 214, - 217, 96, 149, 229, 98, 99, 101, 137, 140, 49, 64, 253, 177, 118, 159, - 170, 67, 246, 220, 99, 30, 118, 225, 195, 15, 11, 232, 95, 15, 112, - 143, 167, 15, 166, 143, 200, 107, 237, 228, 77, 182, 53, 108, 40, 52, - 59, 172, 46, 212, 185, 160, 154, 140, 157, 66, 3, 62, 183, 110, 165, - 187, 144, 81, 232, 210, 27, 196, 227, 155, 45, 219, 156, 104, 148, 47, - 165, 166, 219, 145, 132, 56, 56, 165, 70, 234, 98, 156, 66, 153, 159, - 169, 182, 245, 214, 213, 239, 76, 166, 148, 33, 32, 135, 223, 219, 61, - 154, 126, 189, 221, 215, 124, 143, 66, 53, 12, 57, 201, 103, 99, 140, - 101, 148, 51, 218, 53, 73, 116, 59, 210, 104, 98, 216, 199, 130, 129, - 151, 135, 157, 196, 206, 2, 95, 191, 244, 1, 141, 197, 16, 127, 181, - 244, 209, 226, 193, 33, 97, 122, 191, 129, 123, 16, 95, 105, 96, 97, - 98, 163, 175, 57, 146, 146, 120, 236, 41, 116, 96, 142, 199, 48, 116, - 200, 22, 7, 41, 173, 165, 198, 135, 141, 151, 196, 9, 189, 123, 238, - 99, 64, 144, 75, 215, 197, 23, 72, 174, 147, 55, 211, 99, 76, 85, - 77, 222, 61, 105, 59, 116, 10, 5, 192, 186, 212, 187, 199, 54, 140, - 97, 36, 182, 105, 105, 213, 87, 239, 213, 164, 188, 64, 82, 108, 116, - 222, 114, 157, 156, 150, 62, 133, 68, 187, 201, 186, 207, 227, 57, 80, - 40, 29, 60, 31, 138, 90, 195, 73, 58, 89, 40, 222, 190, 171, 120, - 112, 18, 7, 11, 25, 34, 189, 216, 106, 74, 146, 183, 158, 79, 149, - 242, 130, 108, 81, 222, 45, 248, 208, 193, 170, 250, 100, 232, 41, 84, - 54, 40, 149, 112, 35, 97, 33, 210, 181, 50, 232, 70, 42, 62, 147, - 128, 167, 247, 198, 188, 196, 190, 207, 166, 207, 50, 97, 146, 130, 21, - 103, 230, 76, 144, 198, 114, 20, 158, 175, 238, 48, 162, 143, 252, 6, - 238, 100, 77, 190, 145, 171, 247, 41, 180, 229, 170, 25, 227, 166, 101, - 128, 29, 116, 40, 233, 164, 148, 234, 199, 236, 140, 122, 76, 99, 163, - 60, 173, 147, 99, 118, 32, 177, 104, 181, 163, 229, 91, 118, 195, 108, - 192, 230, 129, 63, 185, 36, 82, 33, 77, 170, 196, 243, 197, 147, 160, - 163, 11, 133, 106, 34, 119, 87, 130, 20, 223, 8, 188, 208, 92, 62, - 128, 245, 152, 50, 45, 158, 161, 242, 242, 150, 57, 93, 6, 185, 113, - 92, 138, 206, 17, 246, 8, 85, 27, 28, 147, 213, 163, 39, 181, 31, - 164, 47, 190, 183, 181, 231, 50, 116, 255, 244, 237, 20, 202, 63, 65, - 219, 238, 253, 208, 34, 250, 168, 213, 234, 206, 50, 210, 77, 201, 192, - 56, 174, 117, 187, 245, 195, 155, 28, 78, 202, 101, 116, 101, 74, 207, - 195, 196, 195, 55, 14, 23, 79, 178, 229, 241, 78, 7, 134, 15, 54, - 146, 188, 169, 81, 42, 70, 166, 229, 159, 158, 47, 227, 141, 183, 74, - 110, 249, 234, 154, 207, 146, 158, 113, 160, 39, 139, 185, 254, 124, 245, - 171, 157, 147, 206, 110, 226, 87, 136, 110, 175, 162, 178, 108, 88, 154, - 149, 243, 24, 181, 133, 187, 212, 246, 152, 99, 103, 53, 89, 43, 115, - 231, 242, 177, 202, 113, 138, 80, 46, 178, 171, 223, 164, 193, 246, 187, - 176, 62, 171, 110, 129, 185, 94, 61, 38, 170, 119, 187, 33, 246, 71, - 195, 85, 33, 19, 99, 94, 225, 71, 77, 209, 151, 134, 151, 188, 164, - 230, 206, 127, 222, 21, 236, 64, 70, 250, 16, 224, 214, 119, 146, 149, - 153, 248, 245, 115, 121, 252, 94, 16, 190, 182, 179, 149, 223, 152, 0, - 222, 74, 37, 121, 206, 219, 235, 194, 228, 99, 202, 149, 169, 165, 169, - 123, 139, 135, 56, 147, 88, 226, 157, 126, 198, 99, 138, 51, 113, 82, - 228, 82, 200, 101, 184, 126, 167, 80, 219, 41, 84, 78, 120, 187, 58, - 34, 185, 44, 29, 33, 19, 165, 190, 186, 28, 137, 38, 41, 199, 231, - 69, 80, 84, 116, 139, 252, 118, 27, 114, 96, 84, 193, 186, 8, 172, - 200, 229, 203, 247, 124, 118, 46, 180, 189, 218, 100, 141, 119, 162, 28, - 138, 97, 63, 184, 34, 233, 68, 51, 238, 86, 123, 10, 169, 179, 230, - 216, 39, 117, 35, 221, 46, 107, 24, 141, 202, 91, 40, 204, 67, 218, - 47, 47, 62, 98, 222, 21, 83, 222, 182, 80, 196, 31, 122, 172, 169, - 73, 121, 151, 211, 201, 77, 232, 147, 47, 239, 88, 99, 233, 244, 200, - 41, 244, 64, 166, 133, 118, 244, 166, 7, 95, 101, 24, 110, 65, 36, - 210, 227, 80, 193, 160, 242, 173, 68, 88, 8, 70, 40, 247, 221, 114, - 200, 236, 30, 115, 113, 74, 148, 118, 147, 90, 16, 179, 235, 60, 133, - 66, 143, 166, 183, 93, 152, 45, 240, 42, 103, 135, 130, 212, 59, 16, - 76, 2, 38, 228, 35, 94, 157, 66, 202, 99, 29, 20, 135, 225, 167, - 208, 96, 230, 13, 221, 225, 245, 55, 245, 154, 40, 41, 124, 41, 132, - 51, 107, 74, 161, 139, 91, 122, 135, 135, 167, 208, 11, 221, 225, 27, - 217, 151, 38, 21, 157, 169, 124, 35, 240, 61, 204, 135, 151, 125, 250, - 245, 140, 148, 199, 196, 174, 44, 245, 145, 233, 39, 77, 45, 4, 118, - 212, 152, 14, 173, 77, 117, 175, 158, 66, 45, 172, 238, 73, 28, 111, - 222, 146, 148, 190, 156, 79, 169, 240, 163, 253, 118, 111, 206, 117, 152, - 225, 141, 251, 182, 181, 49, 63, 21, 237, 121, 196, 105, 135, 128, 236, - 242, 136, 201, 177, 60, 46, 82, 215, 17, 216, 64, 145, 204, 58, 154, - 114, 33, 226, 245, 209, 27, 137, 99, 47, 1, 43, 105, 99, 73, 156, - 128, 10, 115, 101, 143, 147, 14, 2, 214, 220, 29, 222, 203, 241, 241, - 76, 114, 230, 199, 61, 74, 139, 214, 150, 10, 58, 253, 56, 176, 254, - 127, 29, 143, 106, 206, 224, 104, 216, 139, 198, 242, 165, 187, 137, 126, - 69, 100, 195, 50, 135, 121, 255, 132, 215, 59, 9, 69, 187, 175, 181, - 219, 175, 106, 237, 119, 3, 163, 234, 2, 223, 174, 248, 184, 139, 236, - 213, 230, 20, 175, 91, 68, 227, 85, 233, 191, 152, 149, 99, 95, 247, - 201, 173, 97, 148, 56, 29, 172, 222, 137, 203, 176, 245, 242, 165, 162, - 68, 10, 122, 239, 228, 226, 18, 102, 105, 93, 37, 73, 183, 78, 217, - 241, 46, 58, 108, 52, 110, 17, 93, 159, 195, 30, 95, 213, 193, 83, - 253, 38, 83, 67, 253, 214, 165, 75, 213, 234, 138, 101, 43, 75, 225, - 178, 161, 135, 94, 181, 85, 201, 107, 36, 18, 99, 245, 25, 99, 253, - 8, 175, 175, 232, 44, 239, 29, 237, 62, 249, 80, 95, 50, 44, 34, - 231, 198, 37, 200, 178, 168, 216, 236, 68, 87, 22, 92, 184, 78, 33, - 32, 24, 216, 186, 39, 226, 218, 95, 189, 148, 154, 250, 68, 195, 74, - 43, 219, 117, 181, 216, 233, 27, 90, 236, 144, 150, 132, 172, 83, 57, - 43, 233, 120, 2, 182, 7, 14, 34, 18, 100, 77, 226, 47, 53, 182, - 49, 53, 53, 89, 187, 51, 111, 144, 143, 191, 23, 80, 110, 29, 23, - 86, 87, 38, 91, 46, 139, 230, 69, 65, 182, 125, 10, 61, 155, 218, - 209, 224, 222, 61, 80, 114, 51, 234, 64, 135, 117, 211, 1, 159, 187, - 194, 229, 217, 198, 99, 251, 245, 41, 18, 53, 119, 35, 135, 9, 112, - 251, 176, 220, 74, 211, 199, 54, 236, 96, 189, 207, 18, 59, 230, 235, - 11, 163, 30, 180, 99, 107, 121, 140, 41, 176, 234, 179, 235, 163, 230, - 64, 99, 85, 56, 202, 195, 80, 118, 221, 109, 177, 222, 85, 12, 191, - 102, 45, 201, 172, 100, 137, 137, 31, 214, 40, 166, 6, 30, 147, 126, - 124, 32, 88, 33, 105, 225, 70, 128, 76, 210, 245, 116, 185, 250, 20, - 82, 59, 72, 190, 97, 222, 47, 137, 204, 215, 40, 9, 37, 4, 251, - 138, 74, 136, 44, 49, 109, 55, 249, 127, 132, 120, 121, 37, 135, 95, - 152, 45, 173, 203, 154, 35, 138, 4, 147, 71, 208, 81, 69, 43, 34, - 232, 120, 199, 89, 48, 44, 11, 215, 31, 125, 146, 42, 55, 35, 15, - 191, 119, 52, 127, 49, 170, 202, 37, 88, 98, 250, 85, 168, 98, 96, - 63, 82, 145, 156, 229, 148, 246, 34, 153, 197, 248, 26, 237, 46, 46, - 218, 100, 75, 245, 193, 99, 241, 61, 245, 185, 242, 165, 53, 124, 179, - 238, 73, 118, 183, 131, 83, 104, 169, 52, 205, 157, 178, 62, 82, 42, - 82, 144, 167, 48, 191, 242, 96, 195, 34, 236, 13, 31, 37, 6, 99, - 110, 196, 212, 131, 104, 216, 64, 119, 244, 251, 243, 142, 95, 158, 234, - 160, 125, 127, 250, 4, 187, 217, 255, 63, 252, 28, 227, 251, 246, 180, - 127, 255, 28, 3, 255, 180, 9, 138, 128, 32, 68, 164, 95, 159, 83, - 192, 159, 99, 32, 35, 32, 162, 64, 168, 104, 103, 31, 95, 128, 135, - 24, 136, 72, 248, 191, 60, 56, 64, 65, 64, 65, 65, 67, 66, 68, - 194, 128, 157, 35, 64, 34, 132, 232, 184, 47, 240, 32, 75, 93, 81, - 49, 36, 186, 101, 224, 72, 127, 25, 197, 193, 95, 250, 54, 170, 95, - 116, 81, 159, 145, 211, 185, 194, 87, 13, 81, 179, 155, 188, 170, 47, - 235, 191, 4, 196, 188, 46, 110, 100, 32, 128, 137, 69, 132, 41, 61, - 35, 152, 0, 145, 142, 91, 138, 16, 201, 239, 239, 159, 11, 152, 159, - 56, 116, 178, 68, 55, 69, 22, 150, 233, 138, 239, 120, 62, 142, 234, - 77, 136, 191, 200, 50, 83, 25, 145, 242, 233, 176, 35, 251, 92, 254, - 147, 204, 38, 72, 237, 105, 224, 166, 160, 147, 85, 158, 9, 138, 62, - 126, 186, 127, 82, 243, 225, 72, 238, 130, 30, 74, 22, 95, 114, 28, - 234, 52, 33, 238, 5, 213, 192, 237, 252, 167, 165, 174, 250, 121, 86, - 5, 15, 173, 245, 155, 219, 103, 194, 118, 79, 76, 131, 228, 133, 140, - 125, 145, 155, 30, 61, 176, 191, 92, 184, 47, 70, 94, 238, 230, 138, - 77, 94, 39, 199, 202, 129, 48, 77, 235, 115, 121, 125, 137, 189, 198, - 245, 37, 137, 36, 68, 158, 240, 161, 199, 51, 203, 116, 208, 169, 16, - 113, 56, 46, 132, 15, 141, 81, 110, 75, 255, 75, 156, 202, 182, 57, - 241, 200, 188, 126, 6, 143, 14, 23, 131, 41, 94, 2, 55, 57, 107, - 102, 201, 16, 198, 39, 19, 204, 207, 12, 157, 206, 95, 247, 245, 156, - 81, 88, 50, 199, 231, 93, 30, 12, 155, 232, 47, 48, 204, 116, 188, - 83, 247, 168, 42, 17, 159, 242, 173, 155, 140, 229, 167, 107, 71, 110, - 149, 232, 210, 173, 26, 214, 216, 215, 34, 72, 122, 34, 248, 148, 85, - 52, 117, 35, 92, 184, 42, 11, 43, 186, 20, 133, 212, 15, 123, 252, - 248, 205, 235, 181, 22, 41, 67, 214, 253, 28, 135, 90, 226, 18, 121, - 50, 36, 210, 10, 205, 175, 135, 46, 218, 209, 221, 145, 254, 253, 193, - 19, 72, 18, 23, 242, 121, 142, 236, 86, 7, 223, 188, 55, 98, 193, - 143, 51, 81, 87, 11, 245, 82, 243, 106, 233, 157, 215, 96, 229, 110, - 66, 69, 18, 122, 206, 223, 194, 230, 140, 80, 31, 225, 240, 245, 126, - 148, 149, 36, 38, 3, 42, 233, 246, 101, 14, 221, 3, 199, 196, 71, - 101, 159, 27, 208, 52, 153, 233, 152, 184, 13, 214, 122, 14, 21, 238, - 126, 243, 165, 224, 199, 198, 93, 16, 204, 13, 73, 103, 149, 42, 42, - 140, 189, 169, 38, 158, 67, 209, 117, 88, 177, 36, 156, 118, 83, 65, - 102, 252, 83, 97, 93, 4, 205, 84, 111, 124, 166, 12, 65, 3, 134, - 218, 244, 147, 3, 23, 237, 198, 251, 15, 114, 202, 104, 239, 155, 233, - 43, 236, 15, 115, 10, 240, 135, 6, 25, 206, 52, 132, 39, 213, 126, - 182, 65, 115, 253, 200, 205, 195, 255, 194, 226, 128, 234, 14, 226, 246, - 122, 227, 138, 123, 64, 230, 77, 196, 207, 23, 4, 198, 155, 238, 185, - 208, 123, 48, 219, 11, 149, 137, 80, 161, 93, 149, 12, 23, 241, 49, - 63, 133, 72, 170, 77, 22, 40, 16, 6, 4, 201, 132, 227, 144, 51, - 177, 91, 130, 77, 169, 185, 87, 244, 28, 232, 98, 242, 93, 71, 226, - 55, 105, 244, 208, 12, 95, 238, 249, 189, 141, 198, 157, 46, 191, 73, - 67, 120, 191, 79, 224, 240, 234, 146, 101, 93, 222, 162, 31, 11, 94, - 255, 161, 151, 144, 85, 34, 170, 100, 60, 115, 40, 13, 141, 202, 18, - 251, 87, 23, 133, 142, 168, 224, 241, 198, 6, 175, 177, 57, 251, 86, - 9, 68, 125, 164, 83, 104, 98, 140, 162, 66, 239, 195, 39, 202, 80, - 170, 111, 87, 223, 100, 107, 249, 68, 208, 175, 4, 204, 177, 126, 76, - 185, 88, 166, 134, 48, 29, 114, 64, 144, 125, 63, 136, 253, 164, 184, - 60, 120, 119, 89, 255, 20, 162, 122, 132, 49, 66, 132, 108, 43, 176, - 121, 60, 105, 95, 130, 159, 250, 220, 105, 25, 205, 215, 96, 128, 66, - 178, 205, 108, 78, 72, 30, 214, 250, 120, 189, 88, 83, 208, 172, 127, - 44, 51, 227, 179, 186, 214, 215, 62, 146, 199, 216, 116, 221, 111, 91, - 56, 198, 90, 145, 155, 136, 114, 69, 212, 59, 148, 23, 151, 132, 217, - 157, 75, 102, 90, 254, 128, 63, 35, 13, 91, 64, 126, 83, 162, 92, - 49, 223, 126, 142, 120, 149, 128, 205, 251, 245, 231, 65, 113, 19, 18, - 100, 54, 166, 41, 250, 7, 45, 223, 116, 36, 205, 88, 222, 156, 183, - 181, 53, 216, 22, 214, 158, 197, 49, 137, 96, 189, 20, 24, 22, 65, - 245, 165, 23, 39, 128, 67, 99, 218, 101, 186, 101, 119, 73, 209, 177, - 192, 132, 2, 197, 168, 197, 87, 140, 209, 25, 42, 188, 66, 194, 150, - 26, 22, 65, 128, 253, 46, 255, 109, 149, 220, 112, 88, 83, 84, 169, - 239, 214, 241, 237, 253, 71, 244, 177, 131, 253, 53, 239, 109, 235, 134, - 114, 136, 80, 105, 136, 148, 86, 197, 243, 77, 159, 186, 33, 140, 188, - 192, 150, 108, 119, 231, 109, 228, 44, 231, 84, 207, 56, 237, 177, 253, - 4, 69, 167, 133, 211, 34, 80, 11, 57, 40, 79, 14, 226, 88, 223, - 144, 28, 21, 204, 215, 193, 57, 133, 198, 133, 133, 238, 157, 39, 67, - 194, 25, 141, 244, 149, 130, 117, 148, 52, 28, 254, 170, 153, 100, 25, - 180, 33, 99, 110, 68, 251, 181, 247, 164, 46, 214, 146, 151, 35, 125, - 217, 66, 154, 145, 162, 28, 244, 90, 99, 159, 114, 115, 233, 91, 169, - 127, 52, 208, 174, 26, 204, 144, 186, 79, 193, 126, 103, 35, 146, 38, - 76, 14, 59, 231, 125, 76, 58, 227, 244, 51, 47, 195, 61, 175, 207, - 77, 97, 65, 116, 148, 142, 72, 126, 61, 122, 34, 229, 105, 41, 220, - 163, 129, 12, 212, 228, 238, 110, 132, 9, 108, 223, 190, 6, 32, 83, - 211, 112, 86, 223, 177, 159, 194, 96, 29, 48, 101, 94, 93, 30, 191, - 126, 123, 34, 15, 19, 195, 23, 131, 71, 169, 101, 100, 12, 79, 38, - 206, 68, 239, 77, 227, 133, 98, 108, 108, 216, 32, 139, 200, 71, 252, - 192, 120, 108, 45, 198, 208, 131, 64, 145, 152, 144, 204, 203, 168, 191, - 35, 135, 99, 168, 215, 136, 91, 62, 28, 89, 126, 36, 166, 67, 231, - 32, 70, 219, 43, 109, 176, 237, 133, 172, 22, 42, 207, 8, 205, 199, - 130, 109, 115, 62, 2, 148, 224, 58, 15, 200, 216, 144, 223, 222, 243, - 157, 178, 227, 193, 182, 247, 36, 235, 124, 206, 245, 250, 144, 153, 195, - 245, 220, 88, 109, 76, 242, 247, 215, 98, 241, 55, 77, 40, 213, 189, - 196, 39, 5, 212, 100, 150, 175, 249, 106, 185, 109, 70, 222, 175, 175, - 241, 68, 84, 79, 121, 195, 246, 0, 197, 90, 191, 222, 37, 236, 137, - 205, 167, 222, 107, 23, 19, 72, 235, 203, 216, 11, 68, 186, 99, 70, - 179, 122, 117, 12, 131, 175, 100, 170, 220, 212, 26, 140, 220, 17, 220, - 177, 120, 148, 197, 81, 175, 180, 34, 144, 147, 212, 93, 45, 101, 156, - 115, 63, 186, 113, 53, 150, 146, 246, 91, 254, 137, 54, 7, 66, 202, - 151, 118, 181, 160, 1, 119, 75, 150, 167, 134, 117, 235, 45, 65, 227, - 217, 95, 51, 66, 38, 77, 130, 15, 188, 187, 144, 115, 26, 30, 138, - 50, 71, 4, 102, 245, 81, 208, 114, 51, 212, 225, 95, 16, 27, 43, - 10, 167, 37, 85, 95, 137, 24, 253, 152, 161, 47, 164, 116, 59, 120, - 178, 226, 147, 132, 89, 185, 20, 178, 237, 185, 28, 8, 27, 143, 230, - 115, 143, 150, 191, 177, 13, 2, 194, 196, 6, 25, 158, 237, 35, 53, - 41, 173, 185, 74, 245, 100, 164, 143, 41, 194, 88, 228, 5, 231, 35, - 121, 177, 83, 159, 72, 20, 79, 166, 44, 49, 38, 10, 61, 173, 104, - 233, 147, 104, 201, 174, 42, 230, 33, 93, 70, 251, 204, 232, 53, 70, - 193, 146, 28, 249, 73, 35, 145, 76, 0, 209, 44, 255, 250, 109, 182, - 135, 133, 180, 97, 17, 21, 158, 129, 190, 120, 58, 209, 105, 50, 179, - 134, 174, 115, 43, 97, 82, 35, 151, 46, 16, 189, 185, 222, 202, 188, - 252, 70, 19, 91, 117, 83, 13, 95, 242, 11, 218, 45, 203, 160, 235, - 250, 4, 133, 225, 151, 143, 19, 161, 139, 237, 152, 33, 209, 138, 50, - 253, 148, 74, 15, 154, 235, 39, 171, 136, 217, 85, 50, 140, 16, 239, - 75, 172, 247, 35, 27, 197, 12, 73, 225, 43, 248, 10, 68, 40, 85, - 146, 151, 171, 172, 182, 175, 8, 140, 251, 126, 153, 75, 65, 184, 93, - 23, 194, 118, 161, 76, 20, 243, 75, 221, 106, 136, 96, 54, 10, 146, - 237, 149, 251, 120, 41, 43, 214, 79, 145, 195, 111, 166, 122, 119, 239, - 65, 131, 55, 30, 152, 60, 54, 190, 74, 19, 90, 215, 74, 67, 32, - 140, 251, 244, 161, 40, 157, 107, 4, 82, 227, 97, 162, 114, 69, 110, - 124, 138, 164, 12, 242, 252, 219, 162, 195, 227, 182, 55, 78, 72, 100, - 179, 82, 151, 160, 117, 188, 115, 118, 213, 89, 92, 92, 228, 5, 88, - 77, 168, 70, 80, 254, 215, 103, 147, 89, 76, 5, 31, 30, 222, 49, - 144, 226, 113, 139, 22, 93, 205, 162, 84, 195, 16, 221, 229, 37, 212, - 208, 151, 218, 61, 40, 81, 88, 69, 175, 101, 168, 183, 86, 115, 91, - 62, 174, 122, 169, 174, 113, 81, 142, 175, 109, 228, 139, 122, 120, 218, - 238, 10, 70, 53, 129, 142, 166, 76, 187, 168, 251, 220, 194, 241, 124, - 159, 6, 67, 110, 104, 240, 80, 6, 148, 193, 32, 117, 123, 97, 97, - 43, 239, 89, 105, 119, 51, 142, 251, 39, 210, 197, 40, 81, 239, 218, - 154, 180, 216, 242, 172, 55, 106, 197, 132, 80, 161, 106, 228, 213, 8, - 69, 203, 136, 211, 94, 135, 231, 143, 73, 85, 59, 190, 132, 13, 211, - 227, 176, 49, 14, 234, 244, 103, 56, 40, 190, 84, 115, 242, 207, 176, - 108, 219, 225, 239, 214, 26, 92, 207, 100, 119, 204, 38, 126, 199, 99, - 37, 146, 7, 185, 112, 30, 84, 221, 153, 29, 28, 232, 208, 247, 247, - 39, 83, 88, 87, 93, 207, 61, 89, 240, 187, 179, 179, 169, 110, 184, - 40, 54, 124, 105, 194, 83, 163, 49, 170, 116, 81, 143, 109, 253, 158, - 111, 6, 189, 56, 151, 0, 154, 182, 216, 134, 83, 12, 165, 58, 3, - 212, 95, 54, 227, 233, 147, 144, 238, 35, 249, 217, 91, 150, 164, 96, - 238, 157, 31, 223, 73, 92, 137, 10, 229, 11, 211, 105, 27, 250, 9, - 239, 184, 137, 155, 184, 211, 6, 199, 137, 187, 199, 221, 46, 215, 176, - 137, 71, 16, 62, 10, 107, 84, 106, 223, 75, 108, 203, 35, 247, 78, - 196, 99, 28, 31, 217, 242, 139, 186, 128, 150, 110, 151, 87, 90, 109, - 54, 129, 106, 193, 194, 88, 115, 189, 118, 225, 6, 231, 180, 43, 142, - 110, 21, 2, 141, 221, 144, 179, 82, 151, 188, 121, 248, 77, 143, 215, - 143, 10, 182, 188, 186, 208, 82, 215, 60, 18, 196, 185, 159, 68, 68, - 201, 207, 74, 82, 145, 59, 149, 16, 63, 201, 13, 17, 244, 71, 194, - 197, 191, 95, 40, 252, 225, 179, 165, 137, 169, 161, 135, 36, 151, 106, - 171, 138, 236, 185, 45, 131, 92, 220, 225, 18, 78, 251, 98, 102, 21, - 22, 194, 152, 194, 48, 164, 210, 60, 201, 23, 120, 207, 71, 209, 236, - 222, 86, 217, 166, 220, 146, 211, 247, 80, 246, 155, 73, 111, 145, 122, - 227, 119, 103, 180, 85, 100, 168, 211, 204, 80, 168, 72, 152, 79, 110, - 250, 162, 254, 120, 200, 77, 60, 156, 218, 132, 20, 86, 169, 200, 171, - 69, 33, 104, 117, 121, 41, 217, 97, 225, 125, 66, 58, 39, 159, 93, - 234, 184, 240, 229, 16, 82, 49, 68, 209, 135, 209, 158, 15, 6, 211, - 218, 202, 14, 28, 39, 226, 234, 26, 209, 114, 217, 193, 154, 233, 199, - 150, 162, 250, 193, 114, 201, 37, 84, 186, 74, 90, 56, 3, 126, 34, - 215, 195, 73, 87, 30, 186, 10, 38, 212, 181, 39, 132, 189, 109, 75, - 73, 123, 136, 186, 242, 118, 38, 128, 222, 79, 220, 70, 161, 246, 34, - 54, 170, 241, 2, 205, 224, 218, 64, 251, 90, 3, 207, 83, 162, 143, - 75, 131, 108, 172, 193, 152, 114, 120, 37, 14, 205, 232, 54, 40, 131, - 88, 118, 164, 177, 200, 248, 184, 77, 56, 55, 24, 102, 120, 46, 240, - 204, 139, 202, 29, 226, 230, 240, 71, 166, 39, 8, 64, 238, 173, 171, - 122, 210, 134, 8, 250, 50, 141, 14, 21, 9, 203, 131, 132, 150, 29, - 22, 129, 148, 226, 141, 43, 61, 214, 237, 14, 33, 152, 180, 21, 99, - 98, 99, 171, 222, 38, 80, 222, 39, 169, 2, 47, 141, 17, 23, 53, - 83, 18, 90, 10, 84, 180, 53, 180, 241, 12, 186, 39, 92, 80, 8, - 81, 163, 95, 210, 77, 179, 183, 248, 58, 236, 193, 91, 8, 131, 25, - 167, 80, 36, 217, 0, 177, 49, 195, 90, 161, 47, 90, 237, 213, 72, - 36, 91, 15, 165, 14, 10, 63, 49, 109, 204, 113, 179, 217, 135, 88, - 197, 151, 48, 167, 165, 151, 123, 212, 194, 25, 234, 110, 78, 100, 25, - 249, 13, 187, 65, 98, 239, 73, 250, 30, 42, 20, 250, 73, 188, 243, - 18, 95, 211, 146, 62, 215, 84, 84, 160, 190, 72, 17, 245, 110, 159, - 195, 23, 179, 94, 146, 26, 41, 215, 45, 210, 75, 155, 104, 208, 172, - 117, 84, 68, 155, 231, 168, 8, 34, 104, 17, 171, 17, 230, 179, 206, - 33, 31, 154, 141, 46, 24, 15, 212, 250, 50, 72, 45, 125, 195, 230, - 5, 84, 37, 63, 78, 45, 104, 178, 162, 57, 72, 130, 103, 140, 242, - 208, 196, 235, 19, 46, 235, 137, 141, 218, 228, 173, 74, 223, 248, 168, - 221, 12, 88, 231, 197, 113, 187, 186, 236, 189, 225, 199, 91, 17, 109, - 154, 234, 163, 146, 43, 249, 156, 119, 30, 171, 213, 210, 145, 176, 199, - 191, 52, 111, 16, 122, 18, 117, 10, 185, 106, 251, 15, 167, 208, 51, - 250, 93, 192, 86, 190, 254, 205, 252, 60, 211, 197, 138, 19, 166, 69, - 66, 217, 39, 24, 250, 95, 50, 145, 63, 45, 25, 99, 72, 80, 16, - 149, 73, 110, 209, 111, 175, 136, 68, 225, 88, 32, 177, 53, 51, 202, - 14, 96, 108, 14, 210, 156, 246, 137, 249, 177, 97, 107, 157, 92, 29, - 85, 97, 52, 121, 237, 57, 37, 70, 142, 53, 122, 43, 125, 142, 163, - 201, 175, 236, 214, 64, 53, 177, 233, 182, 69, 246, 202, 45, 147, 102, - 226, 219, 174, 46, 161, 15, 168, 241, 212, 139, 14, 163, 145, 184, 53, - 155, 234, 253, 42, 88, 9, 202, 166, 52, 123, 204, 42, 243, 14, 253, - 235, 91, 29, 146, 51, 134, 115, 142, 133, 159, 174, 221, 187, 62, 110, - 68, 190, 229, 243, 134, 243, 232, 197, 222, 5, 134, 18, 18, 250, 37, - 81, 190, 210, 131, 97, 119, 145, 59, 195, 196, 7, 146, 228, 120, 66, - 199, 178, 7, 143, 245, 38, 142, 92, 4, 228, 195, 184, 143, 197, 166, - 166, 114, 212, 246, 146, 34, 194, 199, 218, 136, 197, 202, 142, 194, 42, - 103, 37, 76, 75, 37, 174, 95, 205, 155, 247, 71, 101, 240, 147, 208, - 187, 222, 92, 99, 229, 83, 253, 146, 138, 212, 158, 64, 148, 63, 204, - 212, 245, 73, 196, 51, 158, 26, 17, 212, 57, 90, 199, 164, 210, 202, - 113, 242, 169, 183, 88, 70, 162, 24, 155, 199, 85, 242, 34, 134, 73, - 235, 8, 47, 29, 177, 101, 31, 149, 107, 116, 176, 213, 198, 142, 229, - 148, 84, 99, 14, 17, 107, 248, 170, 171, 122, 83, 10, 42, 172, 154, - 149, 174, 53, 100, 5, 84, 208, 26, 237, 122, 57, 71, 152, 214, 151, - 51, 73, 111, 93, 117, 239, 214, 220, 181, 186, 147, 134, 108, 88, 71, - 76, 107, 66, 179, 115, 59, 101, 35, 24, 59, 193, 36, 50, 52, 94, - 22, 105, 101, 128, 128, 162, 144, 81, 46, 54, 226, 208, 89, 159, 7, - 17, 143, 215, 203, 80, 242, 171, 185, 146, 76, 59, 6, 118, 181, 175, - 187, 191, 40, 47, 146, 33, 150, 147, 3, 87, 106, 56, 50, 193, 252, - 158, 101, 150, 60, 2, 26, 191, 254, 145, 233, 5, 201, 175, 252, 185, - 58, 10, 21, 20, 24, 95, 102, 211, 7, 83, 218, 98, 175, 96, 16, - 87, 88, 80, 211, 134, 77, 248, 220, 147, 148, 231, 80, 203, 162, 83, - 229, 228, 189, 26, 152, 84, 177, 244, 180, 184, 125, 190, 36, 220, 100, - 142, 208, 179, 4, 115, 96, 140, 13, 57, 8, 165, 137, 72, 180, 113, - 224, 246, 64, 149, 193, 10, 30, 105, 188, 49, 50, 219, 126, 80, 4, - 127, 64, 152, 254, 167, 22, 207, 189, 168, 109, 241, 194, 180, 108, 83, - 132, 161, 117, 71, 60, 22, 63, 4, 191, 237, 205, 126, 244, 206, 243, - 115, 56, 16, 122, 235, 230, 248, 35, 174, 30, 82, 10, 170, 172, 229, - 155, 185, 37, 72, 132, 174, 97, 40, 177, 45, 188, 168, 87, 228, 167, - 201, 208, 236, 113, 5, 155, 179, 216, 159, 135, 102, 249, 214, 200, 182, - 183, 124, 51, 147, 42, 107, 194, 68, 98, 101, 110, 118, 160, 13, 107, - 193, 117, 110, 233, 28, 195, 156, 84, 91, 157, 176, 251, 202, 234, 88, - 49, 97, 140, 247, 165, 208, 214, 6, 201, 231, 50, 3, 7, 155, 33, - 93, 197, 85, 23, 147, 236, 76, 217, 91, 133, 119, 44, 24, 141, 137, - 99, 96, 13, 242, 235, 185, 160, 214, 202, 10, 23, 226, 135, 183, 139, - 155, 102, 231, 250, 55, 134, 213, 244, 77, 116, 53, 99, 253, 153, 7, - 100, 163, 62, 248, 5, 186, 180, 183, 30, 221, 98, 66, 195, 31, 175, - 183, 171, 201, 98, 40, 246, 23, 180, 46, 184, 175, 92, 45, 173, 169, - 112, 206, 180, 87, 52, 231, 250, 83, 90, 39, 122, 239, 221, 108, 45, - 20, 61, 61, 163, 103, 252, 155, 17, 60, 51, 29, 43, 61, 248, 53, - 129, 109, 106, 116, 117, 15, 13, 118, 144, 79, 176, 114, 86, 95, 53, - 188, 44, 207, 12, 184, 78, 53, 132, 59, 34, 248, 117, 137, 170, 255, - 243, 123, 181, 16, 110, 20, 247, 130, 29, 38, 216, 157, 103, 230, 61, - 154, 147, 139, 36, 242, 197, 136, 10, 15, 219, 37, 79, 161, 195, 243, - 170, 152, 217, 172, 111, 26, 2, 162, 140, 94, 20, 191, 67, 53, 10, - 159, 212, 102, 31, 186, 189, 31, 133, 63, 82, 212, 66, 212, 159, 104, - 33, 109, 19, 158, 214, 87, 100, 99, 217, 48, 187, 248, 116, 192, 65, - 196, 184, 35, 143, 170, 199, 44, 47, 122, 139, 181, 24, 215, 196, 240, - 157, 12, 149, 85, 232, 10, 58, 199, 173, 46, 59, 196, 52, 243, 130, - 152, 106, 229, 121, 113, 137, 125, 203, 230, 161, 55, 181, 209, 24, 151, - 80, 234, 136, 162, 35, 148, 198, 8, 39, 93, 30, 220, 65, 37, 214, - 252, 38, 141, 168, 16, 78, 154, 204, 207, 121, 10, 153, 134, 61, 245, - 83, 251, 74, 139, 90, 55, 171, 249, 241, 20, 42, 61, 62, 120, 53, - 148, 229, 70, 28, 41, 141, 92, 108, 17, 245, 110, 20, 101, 60, 238, - 169, 11, 71, 198, 251, 108, 221, 248, 135, 77, 78, 78, 56, 233, 36, - 205, 46, 14, 38, 38, 248, 229, 244, 136, 76, 234, 18, 247, 205, 197, - 118, 197, 170, 40, 174, 242, 95, 189, 239, 143, 59, 106, 95, 205, 184, - 56, 223, 227, 115, 218, 207, 23, 11, 213, 146, 103, 88, 78, 180, 87, - 190, 80, 63, 209, 241, 32, 98, 28, 50, 243, 48, 12, 116, 129, 50, - 244, 26, 10, 66, 141, 118, 87, 13, 123, 110, 112, 72, 114, 45, 158, - 191, 69, 168, 137, 177, 143, 54, 25, 102, 56, 122, 45, 182, 74, 126, - 159, 103, 156, 203, 51, 104, 82, 24, 173, 54, 61, 3, 77, 68, 161, - 121, 75, 184, 251, 228, 213, 186, 184, 247, 220, 44, 37, 66, 196, 241, - 216, 182, 243, 144, 8, 94, 95, 29, 149, 3, 77, 9, 149, 7, 69, - 190, 14, 103, 81, 63, 118, 105, 52, 2, 181, 248, 244, 228, 64, 249, - 195, 33, 211, 10, 25, 151, 134, 0, 136, 228, 128, 108, 11, 199, 124, - 38, 27, 247, 252, 37, 202, 198, 21, 217, 91, 228, 50, 137, 147, 171, - 234, 90, 193, 17, 163, 107, 253, 219, 23, 191, 13, 81, 16, 20, 163, - 206, 102, 239, 122, 239, 86, 86, 59, 247, 190, 154, 243, 39, 38, 108, - 82, 154, 11, 166, 38, 55, 96, 41, 173, 14, 44, 244, 33, 187, 77, - 114, 141, 80, 233, 176, 40, 99, 235, 205, 147, 53, 218, 230, 249, 219, - 28, 212, 23, 189, 187, 204, 119, 231, 179, 139, 242, 159, 248, 35, 145, - 137, 146, 215, 250, 28, 218, 229, 21, 54, 239, 105, 151, 60, 236, 52, - 148, 108, 51, 173, 64, 69, 216, 98, 42, 185, 36, 90, 41, 115, 113, - 162, 120, 91, 184, 107, 173, 88, 199, 91, 52, 13, 50, 108, 250, 70, - 182, 210, 162, 52, 36, 153, 43, 205, 27, 27, 169, 81, 223, 189, 95, - 34, 205, 168, 68, 91, 212, 157, 37, 232, 47, 234, 204, 35, 239, 173, - 143, 241, 241, 80, 54, 96, 133, 56, 56, 193, 136, 246, 74, 249, 64, - 183, 226, 165, 237, 149, 43, 153, 172, 17, 215, 159, 27, 187, 183, 200, - 248, 170, 191, 208, 52, 143, 97, 73, 15, 84, 17, 187, 147, 214, 131, - 80, 204, 36, 130, 42, 135, 115, 1, 3, 169, 227, 213, 24, 75, 1, - 75, 204, 133, 226, 39, 1, 85, 145, 232, 65, 122, 246, 152, 142, 174, - 104, 36, 43, 55, 153, 248, 67, 87, 133, 81, 89, 105, 99, 25, 164, - 158, 199, 173, 240, 83, 214, 214, 188, 62, 215, 22, 114, 129, 86, 62, - 156, 118, 73, 149, 5, 18, 136, 62, 255, 204, 150, 190, 81, 131, 227, - 154, 63, 189, 47, 210, 26, 57, 102, 129, 171, 28, 45, 255, 189, 2, - 200, 221, 130, 112, 182, 12, 191, 153, 220, 254, 86, 133, 95, 147, 221, - 66, 255, 100, 61, 166, 223, 183, 115, 200, 47, 195, 34, 166, 250, 88, - 77, 36, 185, 140, 89, 136, 83, 195, 185, 188, 162, 62, 245, 112, 186, - 217, 15, 169, 32, 162, 27, 206, 71, 227, 93, 54, 188, 191, 226, 44, - 28, 118, 145, 180, 152, 192, 36, 155, 229, 147, 123, 183, 242, 94, 141, - 176, 17, 57, 153, 97, 111, 112, 235, 99, 60, 95, 156, 206, 220, 60, - 170, 26, 189, 62, 253, 118, 105, 91, 228, 237, 130, 25, 45, 177, 137, - 170, 139, 156, 250, 153, 100, 108, 183, 52, 53, 77, 155, 174, 11, 60, - 153, 91, 72, 219, 38, 113, 187, 90, 74, 171, 47, 183, 159, 18, 26, - 53, 70, 102, 125, 109, 59, 155, 63, 249, 219, 57, 55, 232, 41, 99, - 182, 244, 151, 75, 83, 82, 171, 186, 111, 167, 107, 211, 40, 74, 89, - 167, 216, 203, 184, 175, 182, 108, 238, 34, 37, 148, 127, 155, 54, 74, - 52, 15, 177, 178, 193, 206, 53, 216, 231, 200, 52, 201, 202, 118, 64, - 21, 74, 184, 127, 84, 149, 203, 16, 104, 236, 159, 206, 199, 27, 195, - 205, 32, 73, 226, 53, 137, 46, 210, 31, 160, 235, 95, 106, 42, 65, - 119, 163, 217, 169, 189, 173, 92, 218, 99, 91, 173, 242, 121, 126, 107, - 90, 60, 183, 142, 194, 183, 141, 182, 112, 49, 205, 138, 30, 166, 201, - 193, 134, 221, 207, 89, 243, 247, 31, 84, 239, 179, 137, 71, 122, 102, - 237, 89, 148, 85, 205, 80, 63, 115, 160, 83, 183, 102, 160, 74, 30, - 15, 18, 23, 214, 169, 53, 113, 195, 252, 188, 51, 26, 142, 21, 184, - 159, 127, 183, 165, 113, 139, 237, 235, 210, 163, 80, 181, 176, 193, 2, - 87, 229, 48, 199, 145, 185, 133, 172, 250, 163, 247, 47, 148, 239, 60, - 98, 180, 226, 72, 229, 25, 80, 48, 125, 169, 95, 119, 216, 245, 201, - 6, 99, 120, 174, 208, 33, 23, 71, 61, 163, 136, 21, 194, 151, 189, - 149, 89, 227, 61, 201, 245, 52, 215, 63, 155, 133, 225, 85, 219, 43, - 253, 76, 21, 250, 57, 155, 34, 61, 167, 161, 55, 143, 90, 108, 21, - 80, 236, 173, 162, 133, 40, 62, 228, 47, 52, 82, 169, 210, 233, 220, - 185, 200, 87, 46, 60, 162, 51, 199, 230, 22, 208, 25, 90, 113, 224, - 220, 197, 46, 230, 139, 162, 38, 39, 56, 223, 167, 41, 27, 23, 200, - 207, 234, 89, 34, 146, 243, 94, 198, 229, 227, 151, 231, 143, 33, 116, - 188, 67, 47, 60, 225, 82, 129, 97, 101, 219, 214, 91, 143, 10, 217, - 234, 108, 25, 195, 181, 134, 166, 108, 109, 174, 221, 60, 234, 144, 27, - 187, 114, 17, 185, 77, 72, 244, 107, 238, 139, 36, 234, 134, 105, 210, - 59, 106, 237, 16, 251, 59, 102, 167, 128, 75, 66, 59, 230, 110, 163, - 99, 140, 23, 58, 82, 170, 231, 140, 18, 38, 54, 30, 149, 177, 182, - 79, 76, 77, 170, 181, 29, 93, 19, 109, 109, 97, 186, 40, 192, 247, - 34, 176, 163, 195, 176, 44, 248, 116, 192, 246, 107, 159, 129, 131, 44, - 97, 131, 4, 123, 253, 248, 158, 103, 9, 71, 115, 68, 226, 230, 103, - 238, 144, 54, 122, 191, 221, 165, 201, 186, 194, 15, 250, 248, 119, 227, - 229, 70, 139, 68, 59, 76, 239, 36, 9, 29, 152, 32, 96, 113, 249, - 163, 206, 132, 33, 222, 29, 208, 72, 20, 145, 67, 86, 200, 73, 250, - 102, 213, 172, 74, 182, 175, 28, 191, 165, 124, 82, 105, 213, 227, 163, - 185, 199, 98, 130, 16, 233, 157, 124, 235, 189, 206, 157, 123, 197, 209, - 237, 197, 101, 197, 165, 206, 251, 205, 85, 222, 56, 87, 174, 206, 151, - 224, 162, 93, 119, 205, 185, 130, 142, 242, 238, 17, 218, 77, 234, 124, - 71, 115, 146, 25, 90, 220, 40, 28, 137, 27, 21, 230, 147, 1, 125, - 183, 162, 27, 219, 165, 104, 195, 89, 204, 172, 189, 170, 154, 243, 158, - 37, 172, 117, 60, 150, 192, 113, 189, 137, 112, 251, 221, 221, 107, 135, - 99, 195, 153, 3, 60, 113, 242, 150, 101, 173, 33, 66, 2, 155, 122, - 165, 49, 183, 33, 110, 67, 134, 72, 221, 112, 130, 85, 117, 242, 113, - 133, 190, 169, 177, 102, 119, 3, 99, 86, 63, 22, 73, 205, 35, 133, - 228, 67, 190, 62, 193, 59, 31, 110, 118, 197, 248, 162, 179, 150, 63, - 120, 149, 60, 230, 67, 192, 59, 61, 103, 168, 152, 129, 5, 105, 187, - 19, 212, 210, 81, 111, 184, 198, 172, 105, 176, 93, 161, 140, 207, 81, - 154, 88, 17, 118, 223, 223, 158, 231, 175, 9, 182, 154, 124, 157, 88, - 112, 95, 110, 211, 68, 56, 227, 50, 111, 10, 74, 218, 94, 43, 250, - 11, 49, 75, 209, 49, 58, 21, 218, 47, 244, 246, 120, 143, 146, 5, - 166, 6, 17, 51, 232, 109, 252, 230, 185, 43, 94, 164, 217, 217, 134, - 88, 168, 11, 81, 171, 32, 76, 55, 200, 248, 135, 74, 224, 199, 179, - 169, 26, 7, 26, 71, 45, 246, 124, 154, 109, 205, 21, 226, 178, 92, - 212, 151, 18, 121, 147, 175, 195, 122, 201, 245, 118, 36, 173, 16, 141, - 244, 92, 134, 62, 210, 219, 8, 106, 125, 65, 163, 153, 185, 201, 148, - 10, 111, 131, 2, 204, 150, 200, 8, 68, 225, 0, 203, 143, 49, 180, - 19, 88, 84, 15, 60, 34, 250, 21, 67, 139, 98, 136, 66, 235, 190, - 220, 221, 90, 77, 108, 66, 35, 56, 140, 22, 12, 56, 33, 233, 149, - 89, 143, 127, 216, 250, 249, 74, 228, 242, 71, 52, 91, 61, 230, 103, - 195, 150, 121, 82, 57, 20, 222, 3, 244, 108, 46, 119, 230, 42, 11, - 173, 253, 4, 55, 51, 35, 6, 142, 205, 210, 175, 84, 13, 200, 23, - 54, 187, 20, 226, 87, 127, 54, 162, 28, 12, 74, 191, 122, 151, 177, - 16, 73, 221, 140, 80, 149, 87, 154, 141, 234, 221, 53, 49, 109, 219, - 216, 151, 142, 4, 40, 2, 134, 181, 183, 223, 55, 23, 215, 229, 166, - 249, 250, 143, 82, 216, 143, 20, 80, 82, 209, 119, 101, 100, 45, 32, - 161, 234, 119, 217, 11, 17, 94, 144, 156, 215, 165, 24, 78, 233, 173, - 21, 125, 140, 218, 166, 231, 225, 59, 17, 48, 111, 220, 19, 206, 33, - 89, 128, 104, 68, 23, 49, 218, 130, 115, 187, 116, 253, 86, 8, 62, - 153, 239, 133, 226, 18, 223, 119, 234, 118, 234, 218, 132, 110, 193, 77, - 15, 162, 232, 133, 115, 146, 2, 60, 122, 147, 159, 73, 217, 126, 68, - 186, 168, 130, 96, 37, 165, 210, 116, 229, 169, 168, 196, 61, 249, 124, - 43, 86, 149, 28, 205, 167, 49, 54, 250, 238, 144, 242, 71, 159, 56, - 217, 117, 142, 55, 237, 239, 31, 27, 167, 102, 124, 107, 77, 110, 138, - 169, 230, 124, 234, 194, 91, 167, 86, 148, 186, 196, 48, 82, 12, 205, - 207, 107, 174, 180, 92, 99, 159, 98, 87, 215, 222, 205, 126, 194, 255, - 16, 181, 40, 157, 193, 222, 195, 218, 142, 131, 204, 114, 111, 143, 78, - 147, 241, 179, 4, 250, 137, 56, 115, 60, 49, 153, 134, 35, 206, 51, - 146, 65, 59, 206, 167, 225, 239, 217, 174, 222, 143, 9, 191, 113, 23, - 85, 246, 196, 86, 56, 223, 222, 246, 20, 138, 222, 83, 233, 97, 201, - 209, 186, 138, 47, 143, 235, 67, 88, 188, 178, 203, 225, 155, 109, 41, - 92, 108, 18, 219, 170, 119, 91, 255, 99, 104, 251, 129, 150, 78, 111, - 166, 225, 198, 189, 182, 155, 219, 91, 116, 29, 174, 183, 187, 2, 28, - 119, 238, 149, 8, 115, 34, 238, 92, 81, 188, 132, 18, 69, 26, 22, - 239, 112, 215, 142, 255, 205, 187, 133, 212, 146, 121, 157, 139, 182, 42, - 29, 5, 26, 104, 17, 225, 194, 23, 130, 217, 203, 43, 73, 88, 9, - 137, 125, 48, 218, 8, 168, 238, 226, 36, 126, 102, 55, 82, 83, 235, - 204, 224, 120, 230, 207, 51, 179, 195, 255, 80, 234, 155, 181, 115, 169, - 214, 59, 197, 120, 193, 59, 72, 247, 179, 75, 221, 189, 119, 19, 57, - 72, 90, 11, 156, 10, 219, 143, 76, 100, 198, 179, 153, 247, 238, 87, - 157, 11, 123, 162, 110, 163, 99, 149, 28, 60, 242, 230, 9, 42, 151, - 209, 64, 216, 73, 76, 213, 210, 211, 167, 69, 41, 37, 116, 87, 202, - 104, 66, 22, 13, 165, 218, 122, 78, 161, 178, 197, 219, 54, 25, 88, - 53, 93, 209, 218, 51, 104, 146, 164, 23, 191, 242, 202, 94, 46, 207, - 117, 150, 54, 18, 83, 46, 195, 70, 232, 234, 19, 138, 242, 180, 22, - 255, 212, 162, 234, 115, 58, 216, 231, 217, 129, 108, 208, 79, 72, 219, - 10, 133, 63, 237, 127, 242, 154, 217, 242, 74, 8, 173, 181, 168, 190, - 5, 57, 212, 122, 1, 189, 169, 137, 8, 69, 57, 221, 135, 163, 36, - 152, 184, 103, 232, 226, 164, 167, 212, 193, 102, 211, 146, 40, 205, 142, - 180, 208, 122, 162, 161, 166, 49, 237, 218, 161, 247, 110, 177, 132, 178, - 187, 197, 5, 163, 147, 196, 158, 147, 172, 7, 235, 225, 84, 220, 12, - 212, 116, 111, 39, 92, 98, 70, 198, 100, 35, 194, 11, 171, 243, 187, - 27, 123, 158, 17, 167, 100, 76, 6, 5, 111, 138, 105, 51, 27, 238, - 60, 86, 181, 167, 13, 37, 65, 198, 231, 75, 44, 39, 168, 228, 114, - 23, 248, 12, 107, 37, 138, 187, 90, 15, 155, 182, 162, 102, 240, 30, - 133, 153, 169, 239, 229, 190, 209, 149, 97, 37, 109, 251, 54, 198, 127, - 188, 102, 125, 18, 95, 217, 83, 50, 98, 118, 190, 141, 222, 214, 81, - 216, 123, 189, 8, 169, 219, 166, 19, 87, 231, 186, 151, 248, 242, 80, - 242, 50, 191, 63, 227, 107, 250, 89, 241, 23, 40, 94, 99, 203, 148, - 118, 54, 28, 195, 115, 188, 242, 81, 1, 138, 129, 162, 237, 83, 130, - 229, 175, 149, 85, 218, 251, 58, 87, 100, 70, 9, 240, 189, 218, 82, - 24, 200, 199, 52, 41, 144, 102, 163, 5, 2, 142, 186, 39, 251, 47, - 170, 90, 63, 70, 224, 159, 144, 163, 49, 186, 231, 162, 69, 25, 50, - 37, 52, 42, 121, 185, 196, 111, 185, 111, 104, 15, 177, 40, 134, 249, - 18, 20, 177, 89, 180, 148, 113, 165, 66, 147, 1, 226, 153, 43, 148, - 40, 239, 200, 226, 9, 29, 41, 224, 22, 109, 156, 144, 8, 78, 239, - 79, 249, 20, 120, 125, 56, 178, 160, 222, 241, 80, 148, 98, 50, 131, - 222, 239, 114, 71, 57, 181, 201, 161, 247, 122, 112, 47, 244, 34, 163, - 181, 121, 86, 54, 24, 105, 48, 229, 252, 62, 110, 15, 229, 135, 57, - 11, 233, 193, 227, 73, 228, 200, 209, 194, 142, 200, 186, 54, 119, 36, - 42, 207, 243, 142, 185, 150, 177, 6, 92, 146, 46, 168, 232, 226, 36, - 204, 153, 124, 236, 9, 164, 35, 146, 60, 220, 33, 90, 88, 197, 244, - 202, 229, 210, 5, 87, 82, 100, 47, 182, 111, 98, 217, 162, 111, 11, - 164, 149, 16, 23, 84, 106, 25, 36, 228, 91, 223, 167, 190, 207, 167, - 125, 207, 53, 247, 6, 95, 4, 73, 81, 77, 219, 205, 55, 142, 74, - 182, 182, 119, 146, 240, 63, 177, 225, 52, 20, 189, 47, 228, 102, 21, - 223, 144, 182, 122, 186, 100, 216, 109, 177, 168, 114, 173, 61, 213, 215, - 44, 142, 205, 75, 24, 225, 50, 241, 205, 157, 130, 124, 68, 196, 128, - 249, 168, 163, 107, 39, 58, 230, 36, 47, 121, 31, 148, 6, 170, 86, - 154, 152, 48, 74, 118, 116, 197, 37, 240, 54, 62, 228, 176, 84, 99, - 106, 128, 18, 184, 13, 253, 234, 60, 180, 134, 21, 75, 195, 98, 52, - 149, 110, 210, 233, 110, 54, 81, 123, 98, 10, 124, 225, 165, 116, 47, - 115, 160, 147, 42, 8, 12, 137, 167, 185, 192, 115, 232, 229, 89, 202, - 210, 144, 142, 143, 206, 129, 36, 211, 127, 82, 148, 21, 70, 84, 202, - 119, 87, 139, 157, 61, 146, 5, 175, 252, 129, 240, 65, 205, 193, 163, - 246, 246, 97, 157, 162, 26, 135, 0, 254, 25, 136, 174, 143, 162, 35, - 54, 32, 113, 8, 123, 51, 128, 63, 168, 83, 74, 253, 118, 219, 99, - 129, 103, 186, 88, 217, 159, 175, 48, 202, 122, 112, 163, 181, 190, 136, - 61, 133, 148, 37, 77, 50, 46, 243, 73, 102, 16, 102, 235, 58, 35, - 116, 142, 106, 44, 121, 191, 45, 165, 128, 20, 23, 244, 26, 170, 95, - 173, 147, 134, 235, 102, 142, 127, 243, 214, 59, 231, 166, 234, 61, 83, - 64, 167, 80, 12, 161, 211, 207, 25, 50, 51, 187, 36, 119, 246, 61, - 224, 187, 146, 152, 75, 171, 218, 213, 104, 174, 78, 201, 134, 43, 203, - 167, 179, 180, 187, 48, 20, 99, 170, 160, 233, 167, 215, 209, 111, 216, - 236, 67, 220, 182, 210, 18, 163, 55, 201, 103, 39, 95, 58, 68, 50, - 192, 66, 167, 124, 49, 42, 90, 86, 121, 214, 156, 101, 101, 66, 251, - 13, 131, 105, 83, 38, 62, 165, 199, 240, 248, 66, 111, 95, 181, 84, - 46, 18, 106, 97, 61, 27, 182, 239, 210, 85, 15, 199, 158, 39, 5, - 250, 57, 157, 41, 28, 172, 180, 95, 21, 214, 226, 98, 59, 15, 28, - 123, 158, 9, 172, 139, 220, 227, 214, 71, 124, 94, 200, 160, 239, 218, - 117, 167, 150, 67, 251, 194, 158, 154, 88, 23, 67, 5, 109, 32, 91, - 119, 116, 1, 22, 77, 224, 253, 220, 52, 242, 133, 162, 52, 231, 210, - 36, 111, 117, 19, 141, 167, 151, 136, 194, 174, 119, 12, 198, 38, 29, - 75, 159, 136, 237, 12, 237, 82, 102, 186, 198, 52, 205, 222, 47, 247, - 154, 84, 73, 204, 185, 89, 175, 238, 232, 192, 202, 29, 255, 181, 198, - 90, 121, 244, 85, 112, 182, 84, 214, 19, 207, 135, 82, 168, 8, 202, - 172, 234, 11, 58, 236, 53, 218, 36, 56, 183, 220, 52, 248, 143, 34, - 194, 228, 244, 165, 3, 58, 185, 197, 101, 6, 230, 173, 94, 178, 5, - 54, 124, 66, 197, 170, 48, 94, 182, 46, 90, 248, 80, 115, 173, 84, - 51, 212, 155, 196, 138, 76, 147, 86, 157, 16, 147, 32, 154, 229, 128, - 179, 165, 59, 43, 226, 116, 168, 111, 237, 99, 222, 2, 225, 198, 59, - 89, 175, 39, 13, 15, 189, 44, 198, 89, 199, 43, 240, 165, 113, 154, - 199, 35, 138, 39, 83, 171, 61, 207, 105, 83, 169, 62, 26, 79, 240, - 10, 250, 64, 161, 115, 238, 21, 57, 6, 166, 3, 125, 93, 91, 212, - 162, 30, 90, 183, 68, 182, 149, 21, 70, 73, 125, 155, 123, 192, 12, - 127, 51, 223, 124, 181, 142, 3, 131, 87, 97, 254, 189, 99, 217, 209, - 69, 233, 161, 14, 90, 236, 193, 186, 89, 101, 180, 225, 110, 54, 212, - 103, 163, 247, 153, 181, 10, 107, 108, 41, 48, 204, 27, 141, 80, 25, - 148, 30, 143, 105, 106, 245, 123, 163, 5, 245, 47, 231, 212, 155, 243, - 173, 106, 108, 107, 223, 136, 165, 13, 45, 226, 234, 157, 229, 99, 176, - 178, 220, 153, 77, 179, 237, 224, 146, 242, 151, 48, 103, 14, 79, 58, - 166, 99, 140, 55, 105, 102, 62, 169, 196, 209, 202, 228, 243, 78, 174, - 43, 22, 64, 13, 22, 12, 232, 145, 201, 63, 48, 225, 43, 142, 41, - 64, 20, 140, 41, 207, 214, 113, 178, 124, 200, 210, 153, 86, 145, 209, - 209, 224, 197, 86, 197, 135, 18, 77, 48, 81, 140, 129, 237, 157, 98, - 63, 72, 93, 138, 171, 86, 22, 182, 234, 3, 201, 140, 28, 15, 13, - 74, 53, 17, 133, 220, 188, 94, 63, 251, 134, 73, 185, 252, 42, 113, - 82, 154, 182, 169, 44, 77, 1, 181, 63, 159, 110, 67, 19, 183, 175, - 135, 242, 163, 128, 50, 182, 42, 173, 60, 220, 121, 42, 121, 156, 15, - 146, 60, 82, 104, 91, 68, 227, 47, 71, 39, 207, 21, 154, 72, 107, - 162, 183, 18, 160, 60, 9, 173, 242, 170, 66, 195, 121, 26, 219, 36, - 164, 87, 167, 34, 208, 148, 188, 101, 113, 175, 157, 133, 203, 40, 80, - 70, 50, 36, 64, 34, 225, 100, 234, 193, 12, 164, 93, 218, 166, 27, - 28, 34, 4, 241, 180, 208, 216, 6, 25, 105, 107, 190, 130, 82, 8, - 139, 76, 34, 51, 201, 238, 219, 44, 247, 112, 13, 141, 213, 71, 110, - 161, 33, 93, 16, 242, 101, 173, 223, 97, 183, 189, 82, 63, 200, 194, - 84, 17, 217, 59, 136, 108, 161, 28, 165, 240, 58, 229, 189, 174, 76, - 63, 102, 199, 167, 241, 225, 151, 186, 221, 44, 26, 44, 106, 218, 247, - 77, 223, 214, 220, 201, 26, 151, 188, 103, 107, 8, 229, 181, 145, 208, - 235, 215, 201, 25, 208, 196, 132, 31, 29, 164, 9, 140, 72, 115, 218, - 175, 176, 154, 16, 15, 116, 10, 92, 145, 21, 115, 91, 59, 97, 199, - 60, 188, 80, 125, 43, 195, 24, 211, 81, 23, 185, 81, 73, 66, 248, - 158, 14, 59, 21, 58, 127, 126, 155, 28, 123, 48, 138, 28, 237, 91, - 39, 214, 75, 187, 75, 36, 235, 90, 132, 65, 109, 137, 249, 15, 227, - 158, 120, 8, 107, 208, 173, 204, 15, 96, 177, 179, 141, 122, 51, 94, - 231, 249, 54, 19, 218, 164, 220, 238, 23, 20, 163, 190, 110, 165, 219, - 145, 21, 132, 137, 206, 230, 94, 77, 157, 197, 38, 223, 194, 216, 27, - 165, 157, 181, 150, 127, 31, 149, 78, 145, 242, 17, 250, 178, 184, 245, - 253, 68, 148, 123, 102, 110, 200, 177, 40, 152, 245, 250, 70, 220, 171, - 11, 219, 219, 239, 18, 24, 171, 171, 60, 26, 130, 66, 217, 242, 217, - 59, 61, 86, 138, 248, 212, 63, 175, 222, 215, 12, 197, 49, 119, 213, - 58, 226, 23, 109, 221, 199, 174, 197, 217, 174, 105, 179, 100, 29, 239, - 213, 194, 138, 84, 131, 94, 83, 63, 118, 90, 232, 144, 48, 245, 123, - 234, 82, 148, 182, 174, 248, 40, 135, 35, 211, 64, 223, 152, 152, 244, - 190, 227, 139, 183, 46, 74, 196, 172, 235, 196, 214, 142, 241, 77, 3, - 41, 141, 121, 167, 208, 199, 150, 155, 79, 43, 115, 180, 27, 144, 176, - 63, 103, 150, 75, 111, 23, 149, 193, 42, 190, 58, 223, 240, 45, 83, - 77, 171, 41, 196, 194, 120, 151, 96, 183, 187, 59, 220, 61, 36, 217, - 196, 35, 57, 49, 186, 1, 200, 184, 146, 82, 71, 206, 135, 53, 218, - 122, 230, 235, 171, 76, 227, 114, 124, 35, 152, 98, 151, 250, 102, 124, - 206, 111, 164, 39, 223, 118, 179, 25, 29, 252, 50, 210, 51, 18, 170, - 214, 214, 42, 191, 156, 247, 153, 187, 101, 228, 128, 145, 95, 204, 194, - 207, 176, 128, 238, 70, 163, 231, 104, 5, 251, 139, 161, 30, 71, 199, - 26, 15, 238, 210, 119, 60, 24, 244, 86, 208, 87, 155, 165, 97, 214, - 160, 26, 234, 244, 5, 76, 45, 99, 162, 120, 138, 251, 214, 233, 253, - 25, 215, 10, 145, 178, 234, 50, 210, 185, 175, 69, 135, 74, 132, 80, - 233, 142, 173, 79, 245, 77, 102, 21, 51, 145, 32, 94, 123, 250, 66, - 131, 122, 187, 71, 173, 175, 58, 11, 235, 70, 147, 122, 158, 85, 188, - 63, 207, 74, 102, 182, 152, 38, 255, 195, 113, 2, 109, 102, 219, 59, - 36, 229, 239, 159, 4, 68, 115, 109, 125, 114, 188, 99, 195, 181, 83, - 224, 193, 247, 88, 10, 5, 187, 206, 240, 173, 250, 76, 199, 226, 13, - 149, 236, 108, 43, 84, 151, 252, 214, 9, 127, 65, 237, 183, 60, 221, - 3, 137, 23, 47, 182, 148, 91, 37, 132, 61, 10, 30, 69, 116, 165, - 247, 54, 187, 171, 174, 48, 38, 168, 157, 91, 53, 140, 141, 37, 169, - 63, 129, 89, 16, 106, 115, 120, 128, 149, 111, 95, 211, 112, 68, 156, - 169, 189, 80, 104, 212, 45, 16, 209, 104, 249, 124, 80, 124, 239, 11, - 175, 209, 88, 145, 127, 61, 164, 23, 129, 200, 252, 126, 201, 228, 20, - 66, 13, 62, 29, 30, 90, 83, 123, 167, 238, 56, 139, 31, 153, 118, - 125, 145, 82, 67, 103, 16, 149, 248, 99, 147, 111, 197, 73, 183, 82, - 193, 61, 43, 173, 123, 177, 87, 42, 80, 167, 208, 4, 8, 36, 24, - 60, 28, 135, 90, 44, 44, 172, 181, 145, 231, 40, 221, 231, 102, 69, - 199, 176, 239, 14, 47, 53, 100, 159, 123, 199, 210, 238, 230, 175, 202, - 123, 162, 52, 85, 115, 191, 99, 231, 206, 68, 110, 167, 43, 178, 151, - 196, 114, 126, 254, 201, 155, 240, 185, 4, 71, 63, 250, 53, 209, 107, - 137, 155, 18, 3, 62, 111, 180, 16, 103, 5, 76, 18, 118, 174, 63, - 175, 117, 187, 230, 161, 64, 156, 99, 255, 14, 233, 206, 226, 129, 209, - 246, 190, 255, 76, 82, 91, 212, 123, 163, 150, 59, 138, 219, 219, 205, - 155, 232, 199, 85, 123, 201, 41, 227, 155, 175, 62, 189, 38, 153, 64, - 154, 91, 27, 208, 233, 119, 170, 101, 245, 205, 33, 35, 134, 228, 142, - 223, 9, 175, 88, 93, 165, 231, 159, 148, 52, 170, 165, 121, 125, 178, - 30, 111, 23, 60, 144, 117, 29, 219, 141, 185, 222, 139, 97, 149, 165, - 131, 83, 233, 35, 126, 45, 225, 121, 86, 212, 54, 177, 139, 35, 62, - 151, 213, 98, 123, 11, 30, 199, 155, 48, 189, 199, 78, 9, 198, 77, - 98, 47, 207, 116, 33, 217, 67, 167, 178, 194, 150, 243, 111, 239, 154, - 155, 255, 246, 225, 233, 135, 134, 172, 226, 16, 181, 152, 150, 39, 14, - 109, 46, 183, 93, 22, 38, 116, 245, 253, 25, 248, 55, 73, 189, 77, - 173, 6, 18, 242, 252, 181, 6, 198, 242, 34, 252, 44, 164, 137, 138, - 247, 179, 124, 106, 178, 232, 197, 66, 98, 104, 194, 219, 88, 152, 219, - 40, 167, 105, 38, 220, 135, 89, 180, 45, 219, 103, 106, 131, 5, 48, - 61, 30, 119, 62, 46, 49, 24, 215, 204, 233, 204, 162, 172, 55, 60, - 210, 154, 101, 16, 136, 187, 118, 61, 185, 225, 19, 186, 159, 164, 189, - 210, 78, 183, 98, 94, 92, 249, 34, 9, 93, 169, 67, 6, 122, 97, - 172, 227, 19, 158, 114, 206, 76, 151, 151, 119, 237, 140, 52, 40, 21, - 252, 66, 194, 90, 231, 190, 192, 136, 77, 163, 155, 33, 4, 95, 212, - 82, 56, 148, 251, 250, 176, 23, 125, 84, 249, 35, 135, 137, 158, 214, - 167, 176, 58, 131, 38, 225, 252, 252, 43, 172, 97, 149, 151, 206, 51, - 49, 81, 51, 140, 4, 133, 221, 245, 172, 17, 49, 20, 78, 142, 236, - 110, 24, 101, 125, 249, 149, 224, 157, 124, 234, 40, 171, 153, 14, 167, - 222, 107, 138, 43, 155, 42, 2, 138, 53, 149, 230, 217, 154, 68, 108, - 86, 46, 166, 35, 3, 169, 73, 61, 39, 38, 90, 62, 31, 51, 243, - 26, 30, 158, 220, 108, 46, 85, 19, 10, 140, 126, 240, 13, 79, 93, - 184, 56, 237, 209, 163, 143, 82, 250, 47, 91, 115, 164, 166, 195, 222, - 250, 112, 187, 88, 58, 126, 27, 122, 221, 109, 136, 113, 205, 155, 228, - 146, 104, 247, 220, 43, 225, 186, 88, 246, 148, 151, 184, 16, 123, 112, - 216, 51, 159, 228, 227, 247, 171, 131, 250, 67, 163, 220, 251, 10, 131, - 216, 232, 171, 183, 155, 138, 125, 46, 83, 169, 62, 100, 136, 98, 43, - 109, 127, 77, 20, 126, 245, 196, 196, 227, 20, 10, 184, 38, 91, 248, - 176, 245, 235, 45, 241, 20, 202, 235, 94, 201, 241, 241, 251, 195, 82, - 82, 142, 55, 87, 38, 239, 18, 51, 20, 46, 4, 229, 40, 58, 30, - 14, 223, 98, 204, 201, 98, 11, 176, 22, 38, 158, 188, 131, 58, 80, - 109, 211, 155, 135, 16, 157, 193, 60, 103, 127, 249, 133, 160, 70, 223, - 202, 163, 81, 86, 230, 103, 106, 159, 215, 247, 69, 116, 46, 223, 204, - 109, 226, 36, 189, 41, 100, 123, 237, 164, 179, 132, 144, 69, 223, 151, - 232, 203, 48, 46, 214, 1, 197, 41, 148, 126, 88, 102, 153, 140, 140, - 231, 223, 76, 139, 235, 65, 217, 161, 67, 20, 253, 177, 191, 205, 52, - 81, 70, 3, 175, 53, 107, 136, 11, 65, 158, 86, 48, 244, 157, 42, - 222, 98, 79, 206, 171, 14, 114, 86, 35, 195, 98, 212, 43, 114, 209, - 175, 196, 21, 158, 223, 115, 38, 230, 77, 201, 37, 77, 185, 151, 194, - 58, 100, 200, 77, 211, 164, 172, 193, 17, 194, 106, 114, 67, 39, 250, - 68, 85, 20, 67, 150, 202, 58, 166, 43, 107, 239, 154, 131, 187, 117, - 182, 215, 170, 42, 181, 103, 57, 139, 152, 152, 112, 110, 192, 124, 26, - 245, 107, 98, 55, 20, 105, 94, 91, 154, 254, 119, 108, 149, 158, 37, - 168, 175, 10, 50, 218, 211, 217, 35, 154, 91, 66, 238, 190, 230, 76, - 167, 226, 120, 85, 238, 44, 83, 114, 223, 178, 110, 119, 72, 48, 97, - 126, 49, 171, 113, 48, 179, 41, 209, 222, 212, 178, 78, 61, 175, 57, - 210, 129, 53, 238, 98, 178, 122, 134, 136, 213, 13, 95, 65, 29, 110, - 185, 50, 8, 10, 232, 53, 209, 242, 40, 65, 107, 186, 175, 24, 250, - 144, 223, 233, 170, 35, 193, 210, 142, 250, 88, 22, 27, 82, 60, 157, - 180, 241, 140, 115, 118, 116, 225, 23, 132, 83, 200, 115, 37, 22, 77, - 86, 37, 195, 154, 175, 78, 31, 242, 15, 123, 231, 106, 180, 28, 38, - 234, 59, 118, 89, 210, 152, 224, 75, 145, 12, 27, 26, 63, 155, 176, - 203, 149, 56, 93, 255, 161, 181, 83, 136, 64, 189, 25, 207, 84, 68, - 255, 62, 255, 41, 116, 251, 42, 217, 144, 146, 135, 65, 100, 65, 219, - 164, 190, 139, 170, 178, 202, 106, 117, 170, 63, 25, 241, 203, 15, 10, - 215, 9, 58, 6, 117, 60, 189, 170, 104, 92, 60, 136, 23, 165, 212, - 23, 243, 103, 197, 161, 237, 26, 239, 41, 156, 12, 137, 211, 30, 183, - 147, 43, 165, 105, 88, 248, 251, 190, 170, 31, 234, 149, 207, 237, 90, - 153, 198, 147, 156, 191, 77, 134, 79, 211, 132, 254, 241, 129, 135, 203, - 162, 90, 239, 186, 186, 236, 62, 91, 235, 142, 17, 11, 154, 138, 225, - 228, 157, 46, 79, 137, 126, 61, 235, 160, 168, 80, 35, 45, 122, 195, - 90, 117, 106, 221, 146, 219, 147, 239, 61, 84, 155, 72, 163, 186, 230, - 144, 198, 243, 217, 15, 90, 204, 239, 101, 189, 72, 55, 66, 151, 151, - 106, 70, 160, 153, 29, 206, 226, 167, 228, 210, 75, 189, 18, 131, 228, - 34, 220, 182, 177, 250, 204, 49, 195, 191, 50, 236, 93, 238, 178, 207, - 84, 47, 141, 160, 88, 242, 251, 137, 88, 68, 196, 132, 147, 46, 207, - 238, 190, 81, 242, 146, 203, 200, 77, 120, 197, 157, 99, 29, 199, 138, - 37, 174, 235, 108, 133, 68, 40, 173, 167, 208, 240, 41, 52, 103, 67, - 180, 61, 189, 47, 66, 143, 126, 179, 142, 136, 222, 208, 211, 199, 237, - 218, 61, 204, 118, 158, 64, 35, 132, 56, 66, 193, 175, 223, 202, 138, - 114, 42, 199, 102, 80, 57, 208, 67, 168, 216, 240, 79, 76, 239, 118, - 170, 125, 93, 193, 115, 48, 145, 75, 219, 247, 195, 204, 43, 12, 209, - 96, 238, 88, 190, 171, 158, 105, 118, 10, 241, 174, 21, 104, 16, 170, - 11, 197, 80, 95, 127, 146, 207, 201, 179, 20, 134, 105, 227, 248, 158, - 224, 125, 104, 168, 189, 214, 10, 54, 115, 182, 6, 239, 128, 165, 218, - 114, 29, 97, 120, 83, 189, 161, 71, 182, 23, 106, 126, 96, 123, 167, - 108, 59, 196, 81, 56, 255, 117, 84, 235, 107, 89, 18, 49, 191, 150, - 62, 59, 110, 0, 29, 132, 248, 46, 183, 195, 251, 194, 18, 211, 35, - 43, 70, 87, 58, 199, 192, 40, 46, 201, 113, 164, 116, 124, 132, 40, - 84, 193, 248, 248, 135, 226, 172, 153, 175, 207, 149, 65, 92, 133, 24, - 148, 87, 93, 150, 230, 175, 228, 233, 112, 65, 31, 203, 137, 197, 180, - 49, 31, 233, 144, 92, 144, 190, 72, 250, 84, 212, 123, 146, 115, 66, - 85, 147, 255, 72, 224, 118, 227, 179, 46, 97, 225, 128, 34, 57, 204, - 171, 136, 242, 177, 104, 131, 123, 206, 88, 35, 185, 55, 18, 4, 179, - 81, 88, 139, 229, 69, 223, 58, 99, 185, 225, 95, 112, 100, 180, 226, - 140, 192, 72, 86, 241, 33, 146, 51, 84, 184, 248, 234, 234, 144, 71, - 248, 126, 253, 81, 153, 198, 124, 175, 237, 122, 206, 53, 118, 207, 4, - 217, 201, 148, 231, 174, 243, 45, 52, 76, 213, 21, 237, 179, 100, 87, - 142, 82, 80, 75, 229, 94, 40, 47, 244, 87, 157, 48, 61, 194, 33, - 65, 24, 187, 245, 164, 88, 179, 47, 231, 106, 164, 228, 81, 89, 50, - 83, 188, 42, 223, 108, 23, 79, 138, 137, 31, 3, 29, 59, 233, 144, - 68, 220, 187, 172, 221, 243, 158, 239, 13, 52, 241, 181, 84, 63, 135, - 166, 74, 123, 22, 22, 58, 171, 153, 222, 153, 122, 43, 169, 42, 152, - 216, 217, 54, 215, 213, 53, 63, 223, 195, 234, 197, 106, 50, 100, 92, - 148, 35, 93, 234, 129, 142, 137, 183, 208, 75, 153, 119, 244, 118, 105, - 76, 236, 209, 165, 88, 42, 219, 151, 146, 34, 232, 162, 181, 211, 141, - 138, 119, 134, 132, 42, 179, 232, 162, 155, 19, 207, 213, 233, 214, 47, - 40, 162, 61, 205, 233, 29, 189, 86, 42, 118, 173, 125, 216, 50, 171, - 83, 137, 132, 51, 240, 206, 84, 13, 154, 163, 113, 153, 186, 183, 74, - 105, 145, 95, 19, 47, 225, 251, 27, 158, 185, 76, 57, 55, 213, 165, - 234, 102, 138, 16, 212, 95, 84, 125, 222, 62, 164, 208, 200, 61, 167, - 233, 45, 43, 67, 172, 33, 80, 212, 84, 127, 194, 119, 77, 89, 123, - 191, 164, 214, 138, 143, 101, 228, 51, 153, 138, 183, 126, 42, 229, 170, - 249, 183, 4, 85, 92, 51, 61, 36, 226, 114, 235, 227, 202, 54, 44, - 114, 178, 119, 23, 132, 31, 68, 11, 17, 122, 196, 168, 190, 170, 247, - 15, 52, 189, 197, 26, 63, 166, 209, 80, 158, 79, 67, 127, 10, 17, - 93, 83, 79, 81, 229, 46, 120, 112, 205, 224, 218, 75, 105, 126, 6, - 147, 112, 246, 5, 181, 190, 21, 237, 129, 188, 140, 72, 77, 62, 236, - 168, 214, 215, 91, 88, 59, 70, 39, 67, 254, 187, 85, 106, 19, 163, - 58, 99, 217, 225, 252, 35, 164, 115, 149, 162, 230, 118, 60, 31, 179, - 249, 158, 84, 40, 222, 108, 43, 12, 201, 136, 126, 169, 144, 175, 231, - 190, 125, 20, 154, 40, 97, 111, 201, 55, 52, 217, 128, 197, 186, 54, - 78, 110, 251, 208, 144, 50, 248, 72, 53, 162, 99, 161, 103, 32, 77, - 222, 70, 141, 56, 151, 133, 140, 152, 0, 225, 136, 45, 159, 173, 246, - 88, 76, 21, 51, 171, 111, 30, 71, 190, 45, 181, 220, 214, 152, 50, - 206, 46, 202, 102, 60, 155, 234, 110, 209, 90, 148, 141, 47, 215, 117, - 73, 25, 11, 13, 2, 230, 36, 229, 169, 22, 233, 55, 175, 210, 228, - 49, 155, 83, 62, 52, 188, 186, 82, 193, 156, 144, 165, 172, 81, 84, - 115, 121, 188, 243, 19, 251, 62, 41, 147, 34, 90, 38, 243, 203, 7, - 46, 150, 44, 147, 117, 62, 15, 229, 167, 231, 44, 74, 242, 3, 188, - 55, 54, 183, 187, 109, 137, 205, 59, 178, 159, 217, 87, 19, 197, 161, - 222, 192, 46, 145, 126, 29, 212, 105, 248, 74, 242, 144, 140, 198, 142, - 101, 101, 230, 162, 101, 195, 156, 38, 86, 135, 184, 250, 56, 7, 57, - 173, 0, 187, 147, 129, 43, 67, 14, 98, 10, 198, 220, 80, 64, 122, - 186, 226, 68, 41, 170, 67, 181, 232, 67, 22, 104, 130, 224, 155, 43, - 187, 197, 209, 13, 97, 143, 71, 81, 8, 177, 87, 16, 13, 41, 214, - 118, 203, 162, 214, 91, 37, 43, 146, 67, 7, 234, 20, 93, 144, 154, - 177, 56, 89, 7, 166, 110, 160, 157, 246, 62, 91, 194, 125, 223, 151, - 89, 35, 199, 209, 216, 169, 252, 205, 165, 250, 64, 142, 115, 28, 187, - 55, 234, 9, 73, 121, 35, 19, 115, 199, 158, 115, 197, 43, 54, 87, - 85, 218, 81, 83, 123, 1, 86, 202, 28, 10, 157, 154, 34, 3, 133, - 224, 102, 254, 9, 251, 164, 111, 75, 89, 130, 236, 183, 76, 67, 159, - 133, 220, 93, 223, 78, 50, 157, 148, 231, 153, 199, 240, 235, 14, 9, - 17, 227, 66, 203, 214, 94, 120, 170, 16, 95, 25, 61, 113, 53, 41, - 34, 91, 107, 111, 234, 33, 250, 4, 233, 18, 37, 197, 116, 74, 103, - 37, 65, 223, 219, 56, 254, 27, 47, 220, 103, 153, 55, 79, 161, 9, - 61, 86, 61, 222, 97, 125, 89, 232, 107, 59, 179, 60, 173, 93, 152, - 191, 231, 222, 80, 173, 229, 160, 118, 243, 155, 160, 143, 6, 201, 132, - 252, 29, 27, 28, 143, 15, 130, 12, 217, 155, 209, 120, 66, 125, 177, - 10, 91, 250, 215, 123, 140, 221, 144, 179, 251, 66, 241, 154, 87, 12, - 66, 38, 184, 69, 179, 166, 212, 7, 89, 161, 35, 155, 78, 204, 79, - 87, 227, 45, 226, 155, 14, 93, 251, 101, 203, 205, 154, 199, 81, 173, - 12, 183, 36, 233, 25, 169, 68, 11, 247, 179, 83, 88, 125, 21, 42, - 87, 200, 222, 49, 155, 222, 149, 27, 207, 117, 198, 115, 93, 73, 103, - 224, 97, 120, 76, 28, 12, 37, 143, 175, 217, 134, 89, 176, 75, 77, - 16, 171, 4, 163, 183, 197, 61, 42, 248, 58, 183, 60, 164, 97, 57, - 207, 195, 241, 117, 61, 165, 131, 170, 61, 169, 224, 46, 39, 71, 89, - 181, 1, 218, 147, 173, 10, 52, 155, 224, 112, 33, 243, 192, 168, 243, - 105, 21, 87, 241, 69, 241, 50, 93, 216, 209, 229, 102, 47, 232, 236, - 222, 115, 49, 161, 176, 118, 157, 77, 253, 146, 252, 218, 220, 181, 77, - 69, 218, 40, 138, 96, 151, 168, 101, 207, 25, 161, 236, 99, 48, 243, - 146, 3, 15, 170, 226, 50, 245, 26, 187, 75, 165, 122, 29, 126, 106, - 163, 252, 71, 234, 160, 237, 149, 225, 88, 108, 4, 63, 17, 2, 49, - 134, 253, 97, 27, 230, 201, 17, 85, 129, 214, 208, 79, 161, 182, 1, - 213, 108, 50, 46, 56, 231, 8, 108, 172, 151, 178, 141, 40, 177, 115, - 162, 88, 35, 23, 114, 187, 191, 241, 226, 237, 243, 14, 12, 22, 115, - 19, 147, 24, 231, 36, 167, 110, 177, 71, 173, 12, 246, 156, 111, 83, - 200, 40, 188, 157, 0, 51, 16, 45, 205, 40, 225, 46, 149, 146, 90, - 101, 11, 23, 171, 59, 237, 151, 219, 225, 223, 90, 158, 110, 83, 210, - 11, 79, 174, 126, 107, 53, 37, 25, 72, 150, 225, 214, 203, 146, 136, - 123, 53, 37, 18, 25, 158, 38, 73, 38, 197, 226, 234, 25, 241, 200, - 225, 72, 233, 249, 78, 253, 88, 54, 113, 130, 28, 46, 98, 155, 158, - 175, 197, 92, 138, 217, 68, 134, 105, 199, 156, 118, 242, 156, 90, 82, - 236, 117, 194, 23, 105, 135, 99, 8, 123, 116, 89, 149, 31, 39, 181, - 135, 111, 66, 180, 175, 57, 21, 135, 174, 123, 219, 165, 223, 232, 243, - 175, 155, 199, 229, 151, 109, 38, 46, 163, 245, 201, 166, 246, 98, 157, - 204, 36, 25, 117, 49, 167, 113, 193, 245, 141, 138, 98, 142, 254, 82, - 206, 113, 185, 59, 131, 106, 235, 146, 231, 70, 218, 96, 31, 202, 103, - 1, 50, 68, 113, 180, 100, 225, 181, 15, 29, 41, 220, 143, 70, 57, - 49, 89, 88, 48, 115, 141, 253, 194, 162, 250, 230, 122, 54, 171, 40, - 124, 90, 24, 89, 50, 237, 71, 10, 244, 42, 173, 71, 79, 212, 118, - 215, 94, 239, 105, 112, 144, 96, 169, 226, 47, 50, 109, 106, 52, 99, - 30, 249, 172, 112, 20, 219, 85, 98, 77, 241, 92, 233, 34, 225, 28, - 163, 15, 42, 125, 91, 133, 131, 59, 93, 241, 106, 125, 148, 104, 150, - 141, 68, 220, 242, 201, 186, 52, 94, 148, 77, 254, 186, 229, 128, 216, - 149, 175, 170, 132, 157, 184, 38, 50, 235, 242, 171, 215, 61, 75, 112, - 39, 52, 149, 219, 110, 60, 126, 106, 73, 29, 109, 12, 189, 189, 19, - 211, 146, 45, 195, 91, 45, 100, 25, 156, 89, 110, 207, 28, 157, 190, - 252, 190, 166, 108, 137, 162, 116, 112, 9, 59, 235, 115, 250, 22, 109, - 179, 100, 184, 218, 225, 129, 246, 138, 244, 235, 98, 254, 121, 131, 209, - 33, 166, 152, 142, 176, 231, 66, 171, 59, 43, 173, 131, 148, 15, 163, - 89, 237, 51, 77, 12, 37, 111, 159, 66, 3, 135, 30, 59, 6, 146, - 247, 237, 158, 222, 123, 170, 144, 56, 65, 230, 121, 172, 119, 71, 15, - 229, 158, 122, 177, 137, 137, 190, 101, 108, 26, 19, 142, 126, 139, 234, - 78, 222, 139, 226, 114, 138, 39, 183, 30, 83, 14, 83, 5, 31, 196, - 111, 113, 248, 141, 23, 229, 208, 9, 205, 246, 222, 101, 107, 247, 90, - 227, 147, 84, 91, 155, 145, 145, 147, 151, 31, 145, 253, 186, 125, 77, - 237, 50, 203, 72, 125, 107, 177, 29, 143, 91, 243, 251, 164, 59, 125, - 67, 16, 177, 248, 245, 61, 134, 53, 90, 15, 159, 175, 61, 195, 12, - 170, 40, 154, 134, 250, 248, 23, 240, 82, 191, 124, 26, 24, 126, 244, - 88, 170, 149, 176, 79, 35, 92, 200, 147, 23, 177, 48, 219, 107, 34, - 24, 147, 219, 93, 100, 3, 59, 55, 237, 112, 101, 62, 34, 129, 250, - 60, 163, 72, 20, 77, 92, 220, 241, 164, 176, 101, 99, 113, 38, 13, - 165, 146, 212, 253, 226, 126, 195, 227, 83, 136, 223, 119, 166, 244, 190, - 131, 214, 34, 253, 83, 95, 100, 150, 209, 198, 107, 62, 167, 125, 59, - 98, 73, 28, 235, 100, 6, 61, 77, 132, 2, 118, 26, 235, 203, 239, - 22, 43, 179, 75, 110, 236, 146, 87, 115, 189, 122, 213, 116, 213, 167, - 255, 142, 206, 65, 196, 14, 147, 222, 192, 90, 133, 214, 41, 84, 229, - 124, 238, 248, 238, 65, 252, 240, 69, 10, 124, 239, 196, 150, 187, 43, - 136, 147, 74, 220, 226, 104, 142, 232, 7, 86, 93, 174, 73, 249, 171, - 62, 131, 62, 89, 229, 70, 7, 102, 151, 47, 178, 105, 62, 87, 189, - 200, 253, 172, 124, 119, 149, 116, 114, 202, 85, 172, 127, 168, 211, 91, - 155, 242, 117, 38, 15, 207, 237, 199, 230, 111, 197, 139, 15, 52, 238, - 83, 245, 22, 126, 59, 234, 160, 214, 218, 60, 204, 205, 87, 125, 200, - 158, 33, 73, 136, 182, 22, 48, 151, 159, 232, 29, 113, 80, 177, 94, - 237, 121, 239, 81, 29, 238, 219, 88, 206, 33, 239, 170, 221, 83, 40, - 205, 45, 109, 144, 220, 248, 170, 180, 141, 56, 78, 138, 231, 88, 36, - 54, 61, 126, 181, 251, 215, 100, 149, 85, 164, 234, 92, 99, 226, 17, - 127, 19, 228, 175, 21, 201, 205, 45, 147, 185, 213, 118, 190, 72, 216, - 229, 211, 187, 47, 16, 93, 194, 166, 182, 198, 228, 5, 47, 113, 199, - 33, 197, 189, 242, 98, 127, 133, 248, 255, 152, 251, 238, 176, 40, 146, - 231, 239, 37, 232, 154, 80, 84, 84, 48, 174, 1, 19, 138, 128, 98, - 32, 237, 204, 168, 96, 150, 83, 48, 7, 64, 5, 5, 84, 196, 128, - 9, 88, 64, 49, 11, 102, 209, 83, 49, 220, 137, 152, 0, 81, 81, - 1, 215, 156, 191, 162, 39, 138, 98, 88, 3, 6, 76, 152, 21, 65, - 223, 238, 221, 233, 158, 94, 220, 157, 89, 126, 187, 127, 188, 247, 60, - 60, 214, 51, 215, 93, 53, 85, 83, 159, 234, 234, 234, 176, 113, 35, - 67, 19, 70, 165, 218, 205, 142, 29, 51, 197, 219, 37, 175, 243, 145, - 159, 206, 117, 18, 223, 158, 30, 80, 100, 57, 119, 195, 187, 215, 255, - 203, 161, 172, 39, 55, 95, 21, 189, 103, 146, 181, 229, 116, 235, 224, - 135, 91, 2, 191, 126, 45, 233, 89, 245, 162, 185, 137, 200, 201, 225, - 238, 144, 26, 131, 142, 44, 189, 111, 107, 148, 119, 201, 216, 178, 87, - 199, 196, 225, 115, 99, 199, 31, 233, 179, 34, 113, 246, 119, 143, 135, - 57, 235, 139, 47, 250, 118, 61, 126, 254, 194, 196, 230, 59, 30, 133, - 22, 30, 29, 181, 125, 244, 198, 143, 149, 90, 53, 61, 155, 122, 193, - 190, 126, 179, 216, 2, 81, 181, 143, 103, 87, 181, 152, 178, 170, 164, - 243, 207, 123, 99, 51, 82, 141, 211, 182, 7, 230, 173, 27, 239, 58, - 204, 126, 73, 233, 181, 254, 71, 110, 31, 113, 244, 237, 221, 181, 123, - 69, 241, 223, 115, 215, 93, 157, 241, 106, 222, 152, 127, 246, 7, 15, - 178, 171, 243, 171, 166, 131, 217, 178, 231, 73, 11, 63, 29, 28, 179, - 244, 221, 189, 83, 227, 118, 25, 175, 111, 183, 160, 66, 134, 85, 201, - 128, 3, 127, 167, 219, 126, 60, 79, 221, 217, 153, 94, 241, 174, 40, - 62, 241, 75, 199, 14, 31, 31, 53, 252, 52, 186, 167, 197, 215, 47, - 247, 191, 110, 62, 183, 68, 210, 252, 68, 45, 75, 247, 177, 77, 14, - 127, 186, 21, 102, 118, 207, 161, 228, 192, 141, 139, 238, 61, 103, 13, - 47, 248, 222, 42, 255, 89, 78, 199, 177, 33, 237, 251, 92, 91, 252, - 168, 121, 219, 109, 177, 215, 210, 236, 175, 70, 134, 13, 237, 153, 212, - 226, 201, 104, 233, 18, 183, 224, 106, 51, 182, 57, 77, 180, 152, 254, - 245, 164, 245, 127, 87, 235, 90, 198, 250, 68, 141, 171, 242, 213, 170, - 96, 253, 191, 233, 71, 110, 251, 31, 168, 231, 22, 116, 179, 111, 219, - 38, 143, 191, 85, 254, 246, 185, 94, 106, 112, 187, 138, 19, 36, 11, - 219, 103, 63, 62, 58, 98, 236, 251, 185, 159, 179, 18, 70, 36, 95, - 9, 170, 56, 136, 154, 254, 172, 249, 138, 33, 231, 55, 190, 51, 22, - 251, 55, 24, 113, 177, 210, 160, 251, 7, 188, 158, 2, 135, 27, 176, - 62, 173, 112, 89, 199, 134, 9, 251, 6, 157, 55, 50, 218, 88, 227, - 202, 10, 227, 176, 176, 195, 137, 105, 59, 175, 29, 201, 77, 144, 90, - 53, 60, 246, 211, 251, 112, 220, 111, 145, 107, 131, 12, 159, 110, 222, - 15, 221, 159, 45, 156, 88, 146, 59, 249, 248, 225, 136, 95, 183, 140, - 250, 116, 107, 86, 121, 208, 253, 129, 197, 67, 130, 44, 190, 73, 242, - 220, 123, 76, 49, 202, 143, 75, 121, 233, 186, 219, 247, 254, 250, 103, - 251, 237, 51, 101, 231, 250, 61, 245, 17, 31, 152, 249, 207, 192, 185, - 14, 97, 19, 108, 247, 153, 45, 221, 213, 123, 230, 39, 144, 43, 22, - 188, 190, 254, 43, 126, 244, 222, 144, 246, 50, 241, 215, 157, 91, 151, - 135, 31, 127, 248, 79, 221, 228, 235, 23, 189, 178, 69, 39, 118, 27, - 53, 79, 254, 247, 99, 199, 46, 67, 162, 115, 91, 77, 113, 107, 209, - 54, 244, 88, 239, 61, 23, 237, 107, 255, 22, 93, 233, 82, 103, 198, - 207, 226, 137, 109, 119, 30, 13, 54, 105, 91, 225, 249, 189, 136, 46, - 174, 21, 66, 63, 118, 56, 234, 217, 126, 104, 207, 161, 162, 208, 164, - 116, 179, 95, 185, 19, 166, 78, 89, 254, 210, 234, 181, 227, 17, 185, - 81, 252, 253, 58, 226, 205, 142, 78, 85, 75, 230, 216, 5, 180, 147, - 248, 78, 52, 31, 226, 33, 174, 159, 252, 32, 48, 197, 163, 185, 53, - 211, 62, 41, 170, 69, 13, 167, 35, 7, 19, 90, 247, 154, 48, 249, - 242, 237, 6, 33, 30, 75, 239, 254, 106, 63, 212, 255, 192, 17, 73, - 146, 115, 74, 69, 170, 249, 164, 15, 55, 234, 140, 12, 158, 177, 111, - 167, 127, 152, 168, 203, 210, 109, 93, 204, 198, 220, 14, 54, 86, 88, - 69, 85, 205, 156, 250, 229, 74, 164, 237, 62, 115, 167, 153, 235, 124, - 2, 166, 26, 187, 102, 175, 168, 154, 145, 150, 50, 242, 185, 233, 39, - 209, 89, 143, 154, 63, 102, 213, 240, 151, 213, 152, 236, 107, 69, 15, - 202, 253, 104, 101, 53, 65, 122, 213, 251, 115, 225, 210, 49, 233, 51, - 18, 218, 54, 59, 246, 120, 85, 97, 247, 183, 159, 3, 246, 30, 111, - 223, 243, 129, 200, 104, 243, 182, 90, 190, 81, 86, 93, 76, 214, 143, - 48, 59, 176, 108, 244, 178, 9, 11, 170, 255, 21, 20, 93, 213, 207, - 105, 78, 150, 219, 232, 58, 191, 255, 251, 186, 237, 192, 223, 206, 99, - 198, 190, 185, 179, 160, 212, 239, 200, 187, 133, 23, 23, 172, 78, 79, - 105, 240, 97, 90, 238, 193, 153, 165, 238, 167, 38, 254, 37, 95, 115, - 176, 222, 253, 23, 67, 67, 218, 123, 189, 202, 123, 43, 61, 62, 46, - 119, 199, 133, 255, 253, 22, 245, 46, 157, 250, 101, 108, 206, 188, 205, - 83, 74, 157, 158, 230, 63, 240, 115, 28, 98, 41, 94, 91, 250, 86, - 114, 245, 127, 231, 54, 174, 247, 119, 232, 253, 164, 247, 157, 163, 165, - 131, 139, 251, 28, 248, 177, 249, 216, 219, 110, 173, 102, 153, 156, 185, - 176, 155, 41, 237, 82, 220, 252, 240, 181, 177, 153, 25, 25, 13, 54, - 201, 47, 252, 188, 151, 48, 182, 239, 247, 26, 159, 79, 6, 205, 12, - 95, 115, 95, 145, 60, 252, 180, 251, 249, 1, 143, 30, 223, 57, 244, - 198, 121, 209, 190, 143, 43, 171, 116, 235, 186, 216, 109, 194, 183, 73, - 179, 222, 122, 205, 247, 30, 180, 176, 237, 190, 184, 21, 205, 101, 206, - 29, 155, 12, 57, 124, 98, 202, 197, 228, 54, 109, 45, 19, 86, 201, - 229, 185, 125, 38, 79, 238, 92, 115, 228, 129, 23, 139, 31, 55, 46, - 248, 22, 100, 147, 81, 119, 229, 179, 117, 70, 55, 98, 140, 79, 14, - 251, 228, 113, 176, 81, 224, 230, 191, 108, 22, 110, 237, 255, 107, 87, - 163, 113, 97, 245, 110, 79, 54, 206, 153, 118, 101, 75, 212, 226, 22, - 126, 251, 199, 30, 165, 26, 15, 253, 126, 191, 90, 218, 166, 143, 146, - 233, 230, 161, 151, 238, 92, 190, 178, 123, 111, 231, 170, 54, 201, 41, - 213, 29, 106, 93, 221, 213, 205, 56, 194, 166, 203, 149, 53, 195, 95, - 79, 27, 26, 252, 163, 206, 146, 118, 87, 187, 84, 180, 31, 60, 178, - 195, 158, 116, 47, 219, 142, 65, 255, 60, 48, 126, 49, 186, 239, 181, - 163, 91, 15, 37, 222, 170, 247, 63, 171, 166, 67, 234, 214, 105, 97, - 118, 168, 153, 91, 197, 177, 238, 137, 142, 63, 115, 7, 181, 15, 121, - 28, 124, 41, 202, 230, 237, 249, 57, 119, 122, 47, 191, 20, 208, 240, - 201, 121, 102, 152, 108, 215, 30, 151, 131, 191, 190, 238, 155, 119, 46, - 112, 197, 194, 117, 49, 157, 198, 215, 117, 168, 226, 97, 47, 77, 240, - 222, 248, 210, 114, 100, 207, 37, 115, 143, 154, 22, 100, 36, 216, 12, - 31, 124, 241, 214, 139, 119, 245, 235, 52, 207, 184, 240, 91, 244, 229, - 118, 114, 114, 179, 27, 99, 74, 71, 215, 107, 219, 106, 224, 163, 254, - 195, 45, 86, 223, 57, 244, 98, 76, 11, 73, 179, 126, 86, 62, 237, - 198, 158, 184, 113, 224, 192, 229, 148, 186, 93, 172, 197, 69, 65, 147, - 206, 173, 93, 99, 243, 177, 85, 66, 104, 142, 247, 144, 228, 81, 7, - 76, 21, 153, 133, 137, 230, 103, 246, 76, 25, 253, 35, 43, 47, 112, - 253, 224, 251, 213, 115, 134, 231, 255, 19, 102, 118, 105, 112, 147, 197, - 219, 66, 186, 188, 176, 61, 56, 105, 95, 244, 209, 74, 145, 107, 26, - 100, 138, 46, 77, 99, 150, 103, 143, 238, 62, 180, 191, 119, 179, 79, - 237, 101, 91, 110, 93, 169, 59, 113, 204, 192, 209, 163, 50, 239, 85, - 183, 185, 191, 59, 96, 68, 45, 247, 144, 210, 172, 213, 14, 214, 3, - 250, 123, 231, 23, 207, 152, 59, 198, 42, 122, 253, 149, 140, 67, 85, - 46, 159, 186, 63, 61, 45, 255, 104, 65, 224, 250, 252, 209, 113, 25, - 87, 163, 29, 188, 31, 122, 46, 15, 30, 21, 185, 113, 229, 241, 245, - 255, 182, 47, 169, 215, 44, 165, 170, 109, 43, 255, 154, 63, 42, 214, - 120, 49, 225, 85, 78, 216, 180, 251, 237, 111, 119, 158, 228, 179, 125, - 84, 71, 55, 83, 217, 151, 143, 37, 254, 78, 171, 54, 108, 235, 227, - 216, 55, 108, 242, 196, 197, 97, 145, 171, 79, 53, 172, 244, 50, 240, - 195, 235, 253, 159, 223, 30, 92, 87, 55, 224, 127, 135, 23, 90, 153, - 84, 219, 245, 121, 239, 145, 187, 145, 97, 116, 226, 16, 102, 135, 241, - 85, 163, 17, 185, 10, 139, 143, 201, 247, 183, 72, 27, 143, 168, 209, - 173, 120, 93, 255, 248, 148, 214, 109, 75, 158, 119, 165, 62, 207, 219, - 48, 252, 82, 241, 244, 172, 141, 79, 227, 167, 52, 207, 119, 153, 89, - 24, 231, 151, 99, 124, 251, 203, 237, 85, 178, 37, 207, 127, 5, 252, - 156, 101, 155, 36, 237, 191, 99, 245, 237, 213, 67, 171, 13, 91, 119, - 223, 120, 224, 122, 151, 77, 149, 74, 27, 28, 177, 56, 158, 109, 223, - 182, 202, 182, 54, 91, 214, 109, 27, 249, 57, 122, 210, 210, 211, 107, - 198, 62, 150, 249, 181, 152, 90, 122, 254, 102, 233, 22, 139, 110, 126, - 219, 22, 47, 232, 190, 112, 157, 255, 149, 153, 19, 221, 182, 184, 246, - 57, 208, 115, 216, 162, 102, 86, 244, 167, 211, 103, 247, 228, 116, 31, - 178, 50, 90, 30, 229, 77, 109, 75, 138, 52, 118, 201, 11, 218, 145, - 217, 127, 218, 194, 171, 227, 23, 219, 121, 236, 169, 244, 241, 229, 75, - 155, 216, 42, 227, 147, 63, 136, 253, 7, 57, 121, 108, 104, 95, 101, - 85, 248, 192, 69, 173, 173, 199, 117, 116, 158, 253, 52, 209, 225, 86, - 90, 119, 247, 1, 70, 62, 93, 187, 236, 217, 251, 185, 208, 115, 129, - 104, 251, 67, 202, 37, 172, 241, 132, 152, 189, 161, 149, 37, 117, 242, - 122, 21, 13, 185, 181, 58, 130, 170, 120, 185, 197, 165, 70, 45, 222, - 39, 110, 166, 170, 13, 167, 68, 173, 29, 170, 63, 139, 236, 192, 28, - 173, 213, 194, 188, 206, 242, 97, 149, 86, 91, 172, 140, 59, 177, 126, - 201, 125, 219, 225, 141, 107, 102, 151, 182, 152, 243, 121, 111, 255, 33, - 243, 3, 141, 90, 86, 137, 75, 246, 200, 207, 221, 209, 250, 113, 132, - 139, 105, 155, 238, 11, 142, 46, 90, 250, 169, 120, 100, 159, 209, 179, - 215, 123, 219, 12, 167, 60, 99, 107, 215, 206, 238, 220, 107, 138, 251, - 199, 73, 178, 134, 35, 205, 143, 236, 105, 177, 82, 180, 101, 123, 124, - 193, 63, 251, 255, 25, 182, 126, 202, 228, 11, 23, 226, 163, 229, 95, - 134, 92, 119, 27, 219, 50, 230, 247, 173, 175, 219, 246, 219, 206, 254, - 223, 135, 131, 29, 31, 52, 203, 157, 85, 210, 224, 245, 151, 59, 59, - 75, 71, 60, 184, 19, 126, 248, 249, 111, 145, 215, 161, 249, 27, 226, - 86, 70, 31, 169, 243, 207, 169, 238, 103, 223, 39, 189, 109, 219, 215, - 121, 219, 170, 229, 49, 103, 195, 91, 93, 217, 213, 32, 195, 246, 245, - 154, 41, 247, 35, 3, 254, 155, 108, 183, 229, 229, 142, 130, 6, 62, - 23, 37, 77, 18, 65, 16, 237, 103, 59, 251, 76, 208, 241, 192, 182, - 219, 135, 197, 92, 30, 215, 193, 124, 126, 189, 169, 67, 118, 100, 191, - 169, 31, 117, 197, 106, 244, 11, 191, 157, 63, 34, 231, 13, 111, 116, - 125, 238, 251, 137, 85, 90, 53, 237, 250, 97, 144, 120, 91, 220, 24, - 89, 214, 197, 241, 181, 76, 236, 55, 86, 243, 89, 215, 188, 253, 197, - 79, 19, 23, 189, 127, 151, 191, 225, 169, 29, 125, 217, 61, 199, 181, - 190, 247, 148, 186, 125, 109, 234, 24, 37, 156, 253, 32, 250, 49, 108, - 94, 250, 137, 208, 91, 198, 244, 197, 55, 13, 102, 250, 117, 243, 217, - 214, 193, 118, 113, 157, 228, 33, 223, 63, 88, 217, 173, 58, 107, 245, - 60, 112, 100, 196, 22, 139, 129, 127, 167, 157, 90, 241, 81, 222, 169, - 90, 192, 143, 67, 133, 57, 201, 199, 46, 119, 106, 178, 188, 197, 187, - 7, 212, 214, 49, 169, 37, 174, 131, 78, 91, 90, 246, 110, 241, 180, - 249, 235, 167, 131, 221, 143, 103, 74, 114, 253, 146, 143, 22, 221, 221, - 21, 113, 239, 228, 137, 29, 141, 127, 139, 226, 79, 109, 186, 119, 254, - 227, 222, 16, 179, 244, 104, 179, 224, 189, 47, 115, 63, 117, 248, 116, - 196, 101, 249, 213, 246, 251, 231, 244, 29, 112, 249, 213, 63, 63, 67, - 141, 215, 61, 252, 183, 77, 106, 173, 115, 243, 235, 30, 249, 90, 152, - 59, 63, 45, 112, 97, 157, 180, 184, 120, 179, 162, 142, 5, 191, 70, - 78, 220, 189, 178, 221, 43, 191, 132, 125, 183, 188, 229, 119, 131, 63, - 217, 186, 125, 206, 61, 179, 121, 232, 147, 75, 163, 247, 245, 246, 241, - 179, 170, 119, 249, 68, 232, 152, 227, 77, 2, 47, 88, 239, 155, 236, - 121, 41, 216, 253, 99, 188, 253, 245, 119, 217, 123, 7, 197, 173, 60, - 184, 188, 66, 194, 4, 239, 71, 23, 54, 221, 123, 211, 120, 86, 142, - 125, 248, 250, 97, 179, 28, 211, 30, 141, 88, 24, 208, 98, 128, 248, - 223, 83, 5, 71, 7, 223, 246, 218, 238, 125, 161, 232, 85, 53, 201, - 206, 152, 23, 79, 47, 23, 15, 62, 209, 118, 221, 106, 155, 206, 255, - 172, 31, 95, 115, 104, 195, 215, 83, 159, 59, 68, 218, 94, 107, 188, - 54, 121, 153, 205, 158, 181, 78, 195, 229, 151, 172, 22, 63, 155, 250, - 205, 38, 167, 234, 151, 166, 15, 141, 179, 206, 213, 28, 84, 107, 122, - 101, 135, 3, 115, 179, 221, 11, 190, 175, 190, 86, 255, 196, 94, 175, - 13, 171, 107, 53, 90, 167, 184, 188, 42, 230, 193, 234, 31, 235, 103, - 6, 157, 58, 112, 239, 189, 71, 80, 221, 10, 97, 29, 98, 236, 62, - 58, 157, 220, 220, 200, 107, 71, 254, 192, 199, 201, 139, 246, 83, 105, - 98, 35, 135, 117, 78, 31, 127, 100, 57, 85, 122, 215, 225, 248, 222, - 45, 151, 54, 245, 170, 179, 176, 69, 68, 171, 58, 125, 135, 94, 190, - 183, 201, 220, 188, 225, 241, 172, 245, 173, 199, 213, 170, 176, 241, 244, - 209, 161, 31, 106, 223, 77, 30, 125, 247, 240, 155, 65, 79, 170, 120, - 117, 139, 15, 97, 230, 142, 57, 57, 164, 227, 243, 255, 26, 29, 174, - 178, 167, 123, 5, 207, 244, 189, 1, 29, 219, 62, 253, 190, 45, 59, - 123, 178, 233, 127, 116, 64, 223, 177, 25, 118, 187, 86, 133, 173, 29, - 88, 144, 59, 53, 33, 228, 198, 229, 241, 39, 86, 143, 108, 55, 218, - 163, 70, 114, 243, 131, 191, 230, 30, 157, 236, 94, 79, 210, 172, 209, - 173, 146, 139, 255, 210, 102, 199, 135, 239, 44, 233, 217, 215, 173, 91, - 167, 90, 195, 231, 159, 142, 236, 18, 55, 36, 250, 146, 151, 121, 238, - 186, 253, 81, 139, 93, 6, 137, 251, 206, 77, 155, 60, 189, 253, 198, - 36, 179, 101, 109, 90, 186, 214, 190, 182, 209, 173, 160, 224, 198, 29, - 201, 41, 102, 245, 217, 241, 187, 79, 237, 12, 255, 236, 88, 189, 119, - 235, 156, 38, 115, 63, 54, 244, 72, 104, 114, 111, 83, 243, 117, 61, - 3, 105, 177, 165, 217, 242, 232, 26, 73, 43, 134, 59, 207, 118, 24, - 127, 168, 93, 219, 245, 49, 141, 27, 206, 60, 189, 227, 212, 94, 23, - 35, 217, 252, 136, 103, 47, 247, 212, 176, 178, 146, 139, 254, 59, 54, - 168, 147, 73, 133, 85, 167, 92, 186, 216, 205, 106, 55, 223, 171, 112, - 90, 149, 140, 216, 142, 181, 106, 68, 137, 47, 223, 179, 105, 218, 34, - 189, 242, 19, 143, 197, 77, 188, 115, 135, 55, 181, 172, 16, 63, 59, - 74, 225, 118, 77, 84, 53, 181, 202, 85, 227, 36, 59, 170, 232, 227, - 251, 237, 35, 71, 7, 223, 47, 217, 55, 64, 18, 45, 241, 216, 221, - 243, 104, 203, 75, 157, 91, 249, 248, 25, 69, 101, 204, 140, 115, 91, - 223, 222, 119, 204, 58, 219, 185, 3, 99, 106, 244, 45, 30, 75, 217, - 228, 14, 14, 162, 140, 77, 58, 182, 171, 24, 63, 173, 160, 241, 212, - 89, 49, 126, 171, 36, 167, 175, 214, 245, 169, 108, 180, 190, 249, 162, - 253, 51, 70, 222, 95, 184, 255, 91, 188, 239, 248, 41, 39, 222, 53, - 120, 255, 178, 222, 40, 175, 35, 133, 149, 39, 30, 108, 126, 185, 193, - 219, 105, 133, 55, 198, 254, 206, 253, 60, 118, 239, 35, 199, 88, 241, - 152, 160, 236, 147, 45, 236, 6, 154, 77, 10, 123, 112, 113, 174, 223, - 204, 23, 63, 55, 251, 121, 196, 202, 44, 194, 250, 108, 72, 109, 181, - 190, 235, 236, 222, 31, 238, 12, 127, 180, 39, 189, 174, 131, 69, 204, - 231, 86, 19, 243, 135, 127, 61, 54, 180, 69, 99, 105, 137, 251, 158, - 97, 29, 140, 3, 94, 214, 48, 74, 188, 147, 86, 116, 121, 87, 237, - 246, 214, 217, 121, 138, 157, 15, 118, 122, 251, 157, 180, 49, 91, 121, - 245, 151, 185, 211, 156, 25, 11, 219, 50, 189, 243, 35, 154, 244, 111, - 212, 110, 130, 67, 181, 240, 78, 213, 106, 175, 104, 119, 160, 187, 185, - 209, 86, 231, 129, 223, 15, 95, 15, 221, 150, 48, 44, 157, 146, 52, - 54, 165, 166, 140, 22, 221, 235, 107, 85, 219, 100, 220, 30, 234, 109, - 224, 166, 171, 62, 93, 154, 12, 62, 211, 225, 88, 226, 102, 231, 5, - 210, 6, 206, 181, 188, 38, 43, 170, 20, 127, 255, 242, 239, 230, 61, - 107, 47, 154, 230, 13, 31, 96, 99, 229, 95, 233, 183, 168, 241, 177, - 121, 118, 163, 41, 209, 66, 227, 243, 127, 101, 108, 27, 241, 115, 70, - 233, 131, 45, 222, 169, 241, 146, 51, 93, 199, 212, 60, 243, 108, 251, - 6, 48, 231, 239, 111, 225, 180, 239, 218, 107, 115, 119, 73, 179, 53, - 169, 115, 26, 94, 124, 91, 56, 182, 229, 30, 191, 124, 255, 220, 187, - 157, 15, 189, 153, 37, 138, 115, 184, 251, 124, 234, 201, 253, 13, 156, - 103, 92, 109, 26, 178, 32, 209, 221, 207, 164, 183, 116, 131, 159, 123, - 162, 215, 23, 187, 160, 97, 206, 205, 198, 249, 14, 107, 75, 187, 196, - 13, 255, 58, 113, 225, 203, 118, 11, 214, 167, 167, 101, 250, 120, 152, - 207, 111, 19, 57, 101, 99, 73, 157, 65, 215, 198, 181, 221, 240, 172, - 235, 187, 253, 37, 125, 142, 57, 13, 222, 208, 221, 209, 113, 102, 140, - 212, 97, 187, 169, 149, 81, 226, 219, 152, 185, 91, 102, 84, 61, 56, - 97, 136, 183, 243, 173, 243, 46, 244, 224, 199, 27, 18, 210, 189, 223, - 207, 11, 26, 213, 189, 118, 247, 51, 237, 19, 221, 77, 35, 171, 198, - 181, 157, 248, 122, 194, 138, 124, 209, 248, 164, 2, 199, 85, 107, 123, - 55, 184, 93, 124, 37, 226, 115, 251, 97, 102, 183, 155, 210, 79, 191, - 5, 231, 158, 24, 243, 121, 205, 98, 123, 249, 18, 197, 192, 165, 169, - 159, 95, 118, 206, 205, 185, 247, 168, 85, 175, 194, 65, 149, 106, 86, - 173, 235, 251, 60, 188, 246, 209, 253, 147, 219, 38, 245, 79, 16, 53, - 148, 53, 221, 16, 17, 246, 109, 223, 36, 39, 219, 81, 255, 4, 220, - 238, 109, 101, 245, 120, 233, 207, 6, 35, 92, 179, 122, 60, 28, 49, - 183, 71, 166, 101, 197, 57, 199, 102, 212, 202, 74, 24, 185, 160, 243, - 236, 232, 54, 23, 141, 36, 115, 166, 130, 201, 218, 146, 252, 156, 218, - 199, 183, 156, 31, 23, 226, 179, 196, 183, 235, 212, 18, 233, 128, 165, - 201, 183, 71, 182, 184, 88, 181, 107, 241, 134, 51, 131, 199, 48, 23, - 199, 4, 62, 173, 211, 106, 182, 120, 115, 147, 172, 245, 209, 15, 178, - 122, 29, 88, 120, 172, 95, 130, 180, 119, 222, 193, 7, 55, 246, 254, - 117, 234, 219, 79, 143, 59, 37, 199, 87, 222, 153, 87, 117, 103, 159, - 173, 94, 110, 85, 92, 219, 59, 217, 81, 189, 71, 47, 168, 85, 239, - 165, 81, 225, 224, 196, 117, 37, 251, 150, 210, 247, 168, 154, 198, 179, - 147, 110, 57, 108, 79, 200, 127, 251, 216, 230, 235, 188, 195, 51, 38, - 121, 139, 100, 153, 226, 91, 77, 102, 237, 53, 53, 137, 55, 218, 85, - 91, 124, 33, 247, 219, 200, 30, 33, 67, 134, 95, 218, 125, 230, 205, - 253, 208, 79, 65, 123, 67, 186, 156, 141, 238, 44, 142, 125, 248, 182, - 175, 232, 174, 168, 185, 155, 141, 91, 243, 255, 29, 95, 190, 57, 174, - 209, 206, 5, 207, 58, 153, 182, 106, 92, 177, 75, 193, 182, 26, 83, - 246, 124, 172, 208, 162, 145, 236, 94, 196, 162, 7, 7, 2, 186, 214, - 204, 61, 19, 87, 177, 201, 243, 156, 3, 162, 61, 205, 255, 238, 20, - 222, 35, 174, 244, 184, 104, 89, 208, 200, 1, 35, 163, 35, 171, 85, - 118, 185, 112, 161, 145, 89, 98, 236, 170, 248, 109, 182, 255, 181, 218, - 251, 109, 102, 192, 233, 208, 53, 171, 223, 28, 168, 248, 52, 111, 70, - 171, 87, 237, 122, 87, 105, 92, 101, 203, 69, 183, 6, 115, 59, 121, - 30, 144, 58, 250, 180, 124, 150, 178, 126, 203, 242, 240, 112, 39, 179, - 37, 77, 159, 5, 84, 28, 238, 215, 125, 234, 161, 26, 199, 143, 111, - 78, 46, 25, 187, 106, 179, 213, 18, 111, 187, 86, 177, 125, 143, 63, - 63, 222, 232, 224, 228, 153, 54, 169, 223, 199, 175, 184, 109, 237, 63, - 103, 78, 230, 138, 196, 223, 183, 123, 125, 251, 39, 222, 120, 198, 162, - 105, 51, 94, 245, 60, 249, 246, 233, 153, 1, 222, 247, 230, 39, 91, - 173, 188, 64, 111, 27, 191, 126, 213, 78, 79, 153, 209, 126, 139, 210, - 206, 219, 106, 255, 251, 186, 212, 105, 113, 78, 243, 225, 166, 238, 43, - 138, 162, 91, 245, 255, 45, 58, 149, 60, 103, 246, 203, 152, 195, 81, - 95, 234, 87, 219, 108, 190, 39, 230, 140, 251, 155, 27, 125, 171, 54, - 236, 115, 91, 90, 82, 251, 221, 171, 43, 243, 140, 127, 158, 63, 56, - 112, 252, 186, 148, 85, 45, 170, 155, 138, 172, 2, 54, 111, 206, 79, - 12, 61, 254, 122, 251, 222, 229, 249, 171, 123, 59, 216, 15, 41, 76, - 218, 189, 173, 195, 216, 157, 253, 118, 120, 135, 251, 109, 42, 168, 187, - 234, 163, 104, 127, 231, 161, 46, 251, 50, 82, 94, 229, 83, 111, 222, - 36, 61, 252, 178, 254, 135, 104, 208, 225, 235, 181, 31, 87, 63, 237, - 120, 39, 204, 113, 214, 187, 169, 187, 50, 102, 54, 159, 184, 186, 119, - 212, 132, 158, 78, 169, 159, 134, 238, 216, 184, 175, 78, 235, 5, 135, - 189, 147, 214, 109, 148, 157, 11, 245, 184, 18, 49, 244, 249, 179, 156, - 55, 153, 131, 189, 253, 78, 125, 152, 210, 98, 74, 183, 184, 254, 133, - 57, 143, 194, 220, 223, 110, 9, 189, 84, 127, 252, 184, 227, 111, 206, - 135, 126, 159, 188, 109, 202, 250, 253, 61, 115, 166, 53, 219, 151, 96, - 213, 36, 52, 118, 130, 231, 188, 78, 38, 135, 247, 49, 117, 38, 44, - 235, 148, 54, 35, 230, 233, 199, 32, 233, 137, 44, 19, 187, 9, 230, - 30, 3, 138, 254, 123, 126, 123, 255, 178, 213, 107, 42, 184, 181, 140, - 18, 79, 171, 85, 81, 58, 111, 88, 228, 30, 155, 214, 173, 44, 215, - 52, 152, 34, 94, 25, 85, 117, 234, 233, 161, 73, 3, 155, 212, 114, - 219, 118, 98, 231, 215, 13, 117, 69, 33, 83, 58, 126, 249, 250, 170, - 106, 157, 191, 55, 154, 123, 172, 220, 248, 246, 175, 180, 123, 179, 154, - 47, 250, 175, 199, 92, 219, 27, 9, 183, 38, 220, 220, 57, 75, 225, - 246, 52, 40, 236, 208, 198, 161, 247, 199, 75, 63, 199, 221, 205, 61, - 40, 189, 107, 83, 84, 209, 168, 246, 79, 143, 31, 135, 95, 254, 116, - 188, 75, 215, 170, 148, 215, 228, 232, 202, 168, 95, 247, 188, 122, 13, - 203, 95, 27, 46, 110, 180, 114, 199, 202, 160, 225, 209, 103, 223, 75, - 39, 126, 10, 127, 59, 34, 57, 151, 121, 122, 110, 150, 241, 236, 235, - 119, 134, 86, 189, 102, 250, 209, 228, 148, 135, 201, 249, 78, 53, 71, - 79, 222, 112, 105, 204, 147, 0, 203, 39, 174, 221, 123, 90, 119, 108, - 177, 98, 137, 243, 84, 251, 244, 137, 129, 138, 106, 219, 86, 14, 62, - 186, 225, 221, 203, 21, 166, 239, 237, 83, 236, 75, 11, 124, 19, 143, - 184, 28, 107, 231, 60, 245, 228, 178, 121, 51, 43, 12, 75, 252, 149, - 211, 106, 101, 190, 111, 82, 240, 141, 202, 53, 207, 70, 207, 175, 212, - 196, 253, 75, 80, 76, 235, 106, 212, 170, 243, 173, 130, 7, 196, 108, - 167, 42, 57, 228, 159, 93, 18, 243, 56, 251, 120, 211, 0, 217, 147, - 95, 55, 187, 82, 185, 111, 98, 154, 250, 44, 190, 55, 59, 60, 50, - 43, 217, 184, 223, 58, 243, 113, 83, 15, 209, 180, 164, 32, 125, 142, - 172, 184, 209, 177, 153, 87, 171, 191, 148, 88, 42, 102, 173, 122, 155, - 187, 195, 248, 131, 169, 213, 16, 103, 143, 135, 119, 134, 153, 26, 27, - 129, 121, 99, 222, 163, 130, 201, 162, 132, 126, 11, 159, 84, 252, 57, - 173, 249, 213, 234, 171, 51, 158, 236, 172, 155, 223, 116, 89, 109, 241, - 171, 5, 197, 233, 143, 197, 97, 14, 205, 103, 53, 153, 186, 127, 198, - 134, 233, 99, 168, 189, 159, 134, 12, 24, 176, 55, 125, 229, 193, 53, - 223, 166, 229, 180, 9, 218, 208, 102, 141, 113, 85, 115, 135, 188, 235, - 155, 142, 124, 252, 100, 187, 224, 250, 240, 249, 183, 226, 187, 54, 45, - 242, 253, 181, 171, 120, 230, 237, 175, 63, 36, 109, 174, 37, 172, 246, - 122, 119, 110, 192, 181, 163, 9, 245, 250, 230, 141, 56, 215, 196, 170, - 253, 247, 69, 205, 82, 170, 117, 232, 91, 244, 241, 229, 193, 223, 119, - 69, 34, 81, 119, 90, 36, 10, 6, 255, 122, 22, 77, 20, 215, 99, - 47, 8, 147, 39, 114, 119, 232, 137, 148, 109, 186, 251, 78, 158, 16, - 234, 171, 253, 190, 57, 68, 73, 0, 183, 16, 70, 36, 146, 73, 69, - 162, 68, 64, 87, 3, 180, 72, 202, 119, 103, 29, 146, 15, 101, 214, - 35, 56, 193, 247, 41, 43, 223, 214, 206, 206, 94, 219, 125, 119, 34, - 145, 131, 232, 218, 213, 171, 174, 34, 209, 69, 86, 166, 68, 39, 249, - 253, 64, 171, 116, 240, 111, 78, 206, 68, 113, 147, 63, 120, 162, 54, - 253, 124, 39, 135, 252, 249, 220, 20, 223, 49, 134, 46, 176, 131, 122, - 163, 63, 248, 31, 69, 169, 236, 16, 194, 108, 74, 176, 114, 83, 251, - 255, 198, 38, 34, 246, 61, 193, 59, 118, 98, 109, 70, 81, 255, 215, - 123, 2, 123, 123, 2, 155, 65, 137, 192, 142, 230, 232, 59, 250, 76, - 18, 171, 183, 161, 199, 205, 152, 52, 117, 138, 173, 239, 140, 96, 223, - 233, 156, 53, 177, 205, 129, 13, 60, 101, 234, 223, 30, 254, 71, 119, - 87, 253, 11, 239, 5, 244, 100, 219, 181, 97, 251, 121, 70, 113, 237, - 115, 82, 254, 236, 251, 39, 175, 250, 74, 203, 25, 107, 176, 181, 247, - 188, 62, 29, 176, 140, 40, 78, 70, 14, 120, 39, 40, 83, 121, 31, - 226, 42, 93, 100, 52, 208, 42, 35, 188, 210, 207, 20, 36, 3, 242, - 197, 122, 64, 25, 172, 46, 118, 33, 147, 116, 144, 209, 80, 171, 140, - 101, 107, 218, 186, 98, 61, 8, 25, 34, 86, 166, 210, 83, 236, 116, - 145, 97, 165, 85, 134, 245, 133, 72, 41, 148, 81, 196, 218, 221, 154, - 245, 199, 226, 132, 101, 167, 160, 29, 145, 63, 34, 58, 212, 113, 9, - 205, 61, 47, 139, 99, 37, 119, 99, 69, 171, 250, 76, 159, 201, 29, - 83, 88, 175, 103, 80, 251, 138, 223, 189, 153, 5, 204, 41, 222, 190, - 197, 98, 63, 230, 159, 156, 56, 59, 213, 211, 96, 70, 218, 254, 111, - 37, 93, 249, 243, 92, 198, 58, 227, 128, 29, 95, 223, 159, 11, 99, - 25, 215, 238, 13, 216, 54, 43, 49, 221, 38, 127, 61, 241, 92, 115, - 95, 100, 3, 232, 23, 164, 13, 224, 119, 70, 54, 64, 52, 180, 1, - 247, 92, 187, 13, 182, 135, 60, 180, 71, 54, 64, 237, 161, 13, 150, - 111, 156, 154, 42, 100, 3, 231, 190, 14, 105, 200, 6, 203, 183, 210, - 105, 200, 6, 11, 55, 15, 75, 19, 178, 129, 111, 184, 60, 21, 217, - 0, 209, 208, 6, 220, 115, 1, 27, 0, 191, 69, 54, 248, 12, 108, - 0, 253, 16, 217, 0, 209, 109, 59, 45, 161, 185, 231, 154, 249, 209, - 45, 234, 51, 158, 54, 245, 178, 145, 13, 80, 123, 57, 176, 1, 149, - 179, 131, 183, 111, 35, 96, 131, 59, 253, 66, 221, 144, 13, 186, 198, - 199, 40, 233, 206, 192, 6, 242, 246, 107, 220, 248, 250, 126, 6, 54, - 200, 189, 98, 236, 134, 108, 128, 232, 70, 192, 6, 220, 115, 126, 27, - 64, 92, 145, 126, 0, 113, 130, 108, 128, 232, 64, 224, 7, 220, 115, - 205, 252, 174, 0, 63, 152, 249, 119, 140, 20, 217, 0, 181, 175, 10, - 108, 80, 218, 59, 130, 183, 239, 103, 96, 131, 150, 38, 179, 165, 200, - 6, 33, 1, 97, 74, 186, 26, 176, 193, 163, 240, 89, 82, 33, 63, - 176, 127, 17, 46, 69, 54, 64, 116, 107, 96, 3, 238, 185, 230, 190, - 104, 12, 128, 113, 31, 141, 1, 33, 230, 147, 196, 20, 49, 158, 255, - 49, 6, 56, 168, 143, 1, 20, 232, 235, 249, 215, 36, 193, 49, 0, - 182, 67, 113, 77, 46, 225, 218, 43, 60, 39, 233, 56, 6, 24, 105, - 140, 107, 16, 239, 72, 6, 228, 139, 100, 80, 128, 166, 216, 241, 44, - 68, 39, 25, 13, 180, 202, 128, 120, 194, 122, 16, 50, 160, 222, 72, - 23, 159, 154, 186, 142, 1, 154, 101, 64, 127, 197, 99, 192, 95, 147, - 212, 198, 0, 138, 149, 81, 100, 174, 235, 24, 160, 89, 6, 244, 7, - 40, 195, 133, 181, 187, 53, 219, 198, 236, 221, 223, 114, 46, 110, 202, - 164, 136, 94, 232, 150, 73, 241, 197, 83, 35, 35, 35, 99, 196, 47, - 164, 12, 63, 46, 6, 201, 164, 136, 134, 252, 248, 98, 19, 201, 15, - 218, 147, 228, 199, 225, 89, 38, 69, 52, 228, 199, 135, 115, 146, 31, - 180, 29, 201, 143, 195, 134, 76, 138, 104, 200, 143, 15, 51, 144, 31, - 194, 12, 196, 9, 194, 140, 39, 24, 79, 201, 220, 233, 15, 204, 116, - 84, 199, 76, 136, 17, 240, 27, 90, 24, 51, 176, 29, 242, 131, 34, - 17, 215, 222, 147, 214, 15, 51, 163, 173, 162, 112, 222, 4, 249, 182, - 193, 23, 253, 78, 18, 67, 153, 74, 92, 82, 250, 97, 166, 94, 117, - 9, 198, 76, 8, 33, 3, 234, 141, 116, 9, 161, 244, 195, 140, 44, - 102, 56, 206, 155, 32, 95, 18, 51, 33, 72, 134, 104, 162, 94, 152, - 89, 180, 51, 18, 99, 6, 218, 221, 90, 99, 206, 47, 147, 66, 155, - 114, 57, 189, 182, 251, 182, 213, 125, 18, 218, 88, 27, 63, 104, 191, - 242, 242, 11, 225, 225, 7, 109, 85, 110, 126, 162, 137, 90, 249, 65, - 187, 232, 202, 15, 97, 6, 226, 4, 97, 38, 241, 32, 240, 53, 115, - 30, 204, 116, 82, 199, 76, 74, 252, 68, 177, 36, 90, 24, 51, 176, - 29, 242, 3, 187, 120, 238, 219, 167, 68, 25, 110, 156, 177, 35, 100, - 36, 130, 119, 74, 97, 229, 80, 81, 134, 27, 103, 32, 95, 36, 3, - 234, 141, 116, 201, 145, 25, 110, 156, 145, 68, 171, 99, 38, 145, 181, - 175, 143, 204, 112, 227, 12, 180, 59, 242, 161, 68, 170, 131, 198, 113, - 38, 62, 109, 63, 165, 75, 222, 238, 194, 218, 152, 228, 167, 105, 156, - 129, 252, 116, 201, 129, 93, 88, 123, 90, 227, 216, 212, 65, 227, 56, - 35, 79, 221, 79, 233, 146, 79, 186, 176, 182, 35, 223, 79, 211, 56, - 35, 3, 239, 167, 107, 110, 6, 113, 130, 48, 227, 179, 23, 228, 90, - 41, 60, 185, 153, 99, 153, 234, 10, 232, 155, 184, 95, 24, 51, 176, - 29, 246, 231, 3, 92, 123, 187, 253, 250, 97, 134, 156, 159, 67, 190, - 216, 159, 1, 13, 101, 42, 109, 187, 79, 63, 204, 144, 243, 115, 9, - 33, 3, 234, 141, 116, 241, 220, 167, 31, 102, 200, 249, 57, 228, 75, - 98, 70, 194, 202, 80, 236, 213, 15, 51, 104, 126, 238, 194, 218, 29, - 249, 144, 204, 71, 44, 191, 55, 112, 139, 99, 217, 249, 121, 191, 196, - 13, 84, 255, 140, 204, 195, 186, 196, 113, 104, 99, 146, 223, 160, 27, - 255, 164, 151, 157, 235, 66, 126, 133, 55, 207, 118, 210, 133, 159, 39, - 193, 175, 245, 40, 177, 220, 110, 227, 195, 19, 101, 231, 141, 137, 25, - 27, 168, 87, 83, 174, 186, 234, 52, 14, 238, 37, 198, 45, 240, 126, - 85, 183, 70, 253, 49, 7, 155, 191, 125, 3, 101, 179, 125, 158, 78, - 185, 25, 196, 9, 198, 204, 78, 224, 7, 7, 121, 198, 153, 206, 234, - 152, 81, 36, 79, 18, 251, 236, 17, 198, 12, 108, 135, 252, 192, 39, - 153, 104, 159, 164, 43, 102, 42, 104, 244, 3, 82, 134, 15, 33, 67, - 1, 222, 73, 193, 202, 73, 252, 87, 87, 204, 8, 203, 128, 124, 177, - 30, 128, 70, 186, 80, 255, 232, 138, 25, 29, 244, 216, 163, 142, 25, - 5, 107, 95, 197, 78, 93, 49, 163, 77, 134, 76, 137, 153, 118, 70, - 42, 187, 91, 43, 91, 130, 248, 223, 166, 157, 156, 108, 131, 40, 42, - 37, 134, 226, 203, 85, 96, 220, 149, 15, 44, 161, 126, 244, 125, 114, - 136, 141, 128, 116, 82, 172, 106, 92, 146, 228, 249, 210, 22, 199, 159, - 117, 228, 235, 91, 84, 59, 142, 94, 21, 176, 137, 197, 106, 18, 174, - 159, 213, 126, 121, 142, 110, 237, 124, 236, 48, 95, 223, 183, 245, 10, - 233, 161, 116, 245, 163, 108, 165, 152, 249, 175, 203, 173, 35, 202, 90, - 113, 73, 37, 230, 81, 227, 204, 35, 124, 125, 75, 77, 106, 48, 92, - 173, 206, 2, 211, 33, 47, 172, 24, 161, 26, 30, 178, 31, 244, 41, - 67, 217, 207, 161, 250, 41, 7, 100, 191, 93, 57, 170, 113, 24, 218, - 143, 57, 97, 126, 72, 200, 126, 182, 23, 118, 164, 35, 251, 161, 216, - 4, 237, 103, 221, 254, 84, 39, 33, 251, 45, 217, 106, 209, 25, 217, - 47, 124, 215, 3, 71, 100, 191, 196, 105, 103, 29, 133, 236, 199, 213, - 249, 44, 48, 13, 237, 39, 84, 255, 67, 246, 131, 120, 65, 246, 75, - 109, 173, 217, 126, 13, 116, 176, 223, 245, 126, 37, 212, 214, 174, 191, - 93, 145, 253, 130, 76, 77, 148, 121, 135, 223, 93, 95, 58, 38, 184, - 34, 111, 14, 50, 205, 34, 142, 182, 90, 116, 244, 4, 178, 31, 138, - 197, 217, 111, 207, 209, 227, 34, 46, 241, 214, 225, 238, 88, 22, 210, - 73, 61, 76, 164, 200, 126, 181, 59, 94, 86, 202, 154, 45, 170, 204, - 28, 51, 57, 194, 43, 215, 198, 180, 6, 195, 213, 8, 45, 48, 125, - 236, 185, 21, 35, 84, 59, 68, 246, 131, 177, 64, 221, 255, 100, 82, - 245, 53, 18, 228, 127, 50, 222, 188, 41, 11, 248, 223, 239, 109, 40, - 183, 178, 163, 71, 23, 168, 232, 182, 192, 255, 78, 180, 229, 175, 195, - 253, 6, 254, 103, 180, 14, 141, 61, 73, 184, 230, 55, 28, 248, 95, - 254, 145, 121, 188, 125, 75, 128, 255, 57, 116, 27, 143, 237, 87, 104, - 23, 164, 164, 221, 128, 255, 109, 138, 153, 204, 47, 23, 248, 31, 87, - 95, 180, 192, 116, 0, 240, 63, 161, 186, 35, 30, 243, 118, 114, 99, - 158, 124, 43, 136, 227, 123, 121, 198, 188, 174, 101, 198, 188, 29, 160, - 253, 118, 29, 198, 188, 29, 196, 88, 177, 131, 107, 95, 148, 104, 184, - 185, 149, 15, 33, 67, 1, 222, 73, 193, 202, 145, 37, 26, 110, 110, - 5, 249, 98, 61, 0, 141, 116, 73, 217, 102, 184, 185, 149, 207, 246, - 50, 99, 30, 107, 95, 106, 155, 225, 230, 86, 208, 238, 250, 206, 173, - 200, 60, 76, 150, 168, 255, 220, 138, 228, 7, 237, 169, 239, 220, 138, - 228, 71, 109, 211, 127, 110, 69, 230, 137, 16, 39, 8, 51, 178, 141, - 192, 15, 118, 242, 96, 166, 91, 153, 186, 55, 232, 43, 255, 91, 135, - 186, 247, 86, 162, 246, 181, 133, 107, 159, 179, 89, 87, 204, 152, 104, - 158, 147, 52, 201, 227, 234, 222, 91, 136, 186, 55, 160, 161, 76, 165, - 207, 109, 210, 21, 51, 154, 101, 36, 126, 95, 152, 134, 245, 32, 100, - 64, 189, 145, 46, 69, 9, 186, 98, 70, 179, 140, 103, 230, 71, 48, - 102, 32, 95, 181, 186, 55, 178, 87, 130, 174, 152, 209, 44, 99, 65, - 143, 169, 74, 204, 164, 179, 118, 183, 86, 182, 20, 137, 126, 44, 110, - 42, 133, 118, 196, 115, 23, 150, 182, 82, 236, 38, 158, 107, 142, 187, - 207, 155, 228, 73, 35, 22, 62, 70, 109, 168, 183, 214, 79, 149, 180, - 199, 210, 113, 212, 175, 30, 175, 121, 251, 142, 109, 113, 128, 226, 248, - 43, 48, 237, 176, 208, 140, 230, 147, 139, 176, 144, 206, 126, 91, 82, - 15, 248, 173, 144, 30, 136, 134, 122, 112, 207, 181, 235, 97, 118, 117, - 25, 106, 67, 217, 255, 111, 121, 26, 210, 163, 228, 246, 170, 52, 33, - 61, 56, 254, 10, 76, 67, 61, 248, 228, 146, 122, 64, 255, 65, 122, - 248, 44, 105, 42, 133, 254, 128, 244, 64, 244, 139, 71, 187, 137, 231, - 154, 223, 229, 73, 163, 60, 233, 145, 159, 89, 168, 13, 181, 100, 196, - 73, 37, 189, 120, 201, 56, 106, 151, 253, 121, 222, 190, 78, 64, 15, - 142, 191, 2, 211, 109, 128, 30, 124, 114, 73, 61, 68, 132, 30, 149, - 129, 30, 208, 231, 144, 30, 136, 174, 5, 190, 7, 247, 92, 243, 187, - 108, 0, 223, 99, 211, 81, 156, 47, 80, 47, 66, 85, 116, 91, 240, - 61, 222, 54, 8, 230, 237, 59, 2, 232, 193, 241, 87, 96, 218, 30, - 232, 193, 39, 151, 140, 137, 48, 14, 162, 152, 72, 173, 5, 56, 223, - 170, 61, 38, 218, 219, 149, 217, 87, 3, 250, 202, 214, 11, 199, 68, - 216, 14, 225, 92, 182, 129, 107, 111, 190, 94, 191, 60, 194, 190, 162, - 145, 61, 146, 1, 249, 226, 88, 2, 101, 108, 100, 231, 206, 235, 244, - 203, 35, 18, 190, 108, 195, 49, 81, 68, 200, 128, 122, 35, 93, 236, - 214, 233, 151, 71, 72, 253, 238, 226, 152, 8, 249, 146, 49, 81, 196, - 202, 144, 175, 213, 47, 143, 56, 121, 33, 0, 231, 17, 208, 238, 218, - 234, 252, 208, 166, 229, 93, 55, 128, 54, 214, 198, 15, 218, 175, 188, - 252, 236, 120, 248, 65, 91, 149, 151, 31, 180, 157, 54, 126, 208, 46, - 229, 93, 215, 128, 56, 193, 235, 26, 191, 129, 31, 108, 228, 193, 76, - 153, 61, 84, 242, 53, 96, 188, 94, 45, 140, 25, 216, 14, 143, 241, - 107, 136, 60, 98, 149, 225, 114, 111, 138, 144, 33, 7, 239, 36, 103, - 229, 248, 172, 50, 92, 238, 13, 249, 98, 61, 0, 141, 116, 41, 138, - 55, 92, 238, 77, 173, 86, 199, 140, 156, 181, 175, 44, 222, 112, 185, - 55, 180, 187, 33, 215, 53, 124, 86, 25, 118, 93, 3, 218, 211, 144, - 235, 26, 178, 120, 3, 175, 107, 252, 38, 106, 180, 63, 129, 31, 172, - 229, 193, 76, 153, 61, 39, 18, 208, 55, 177, 84, 135, 117, 141, 223, - 196, 122, 192, 47, 98, 93, 163, 84, 63, 204, 248, 165, 189, 229, 214, - 53, 126, 17, 235, 26, 128, 134, 50, 149, 182, 45, 209, 15, 51, 65, - 195, 214, 96, 204, 72, 8, 25, 80, 111, 164, 139, 103, 137, 126, 152, - 185, 226, 122, 145, 91, 215, 40, 45, 179, 174, 193, 202, 80, 252, 212, - 15, 51, 162, 243, 17, 220, 186, 70, 169, 246, 184, 11, 109, 90, 238, - 56, 94, 162, 157, 31, 180, 95, 121, 249, 121, 242, 240, 131, 182, 42, - 247, 250, 254, 79, 237, 252, 160, 93, 202, 59, 206, 64, 156, 32, 204, - 20, 125, 0, 126, 240, 91, 3, 102, 198, 249, 134, 134, 204, 156, 110, - 27, 60, 193, 95, 189, 198, 83, 12, 230, 183, 63, 116, 168, 241, 20, - 19, 181, 145, 98, 34, 55, 251, 166, 43, 102, 42, 107, 244, 131, 111, - 79, 114, 92, 112, 109, 132, 144, 161, 0, 239, 164, 96, 229, 200, 63, - 235, 138, 25, 205, 50, 22, 220, 153, 142, 101, 64, 190, 88, 15, 64, - 35, 93, 66, 62, 234, 138, 25, 205, 50, 228, 189, 27, 102, 99, 61, - 126, 148, 169, 241, 176, 246, 205, 121, 171, 43, 102, 52, 203, 232, 245, - 116, 190, 18, 51, 13, 141, 85, 118, 183, 86, 182, 84, 237, 79, 132, - 118, 68, 126, 131, 104, 143, 244, 181, 52, 247, 92, 115, 220, 253, 60, - 160, 27, 83, 191, 205, 57, 182, 77, 63, 6, 181, 55, 206, 26, 200, - 12, 113, 254, 143, 183, 239, 47, 198, 139, 185, 121, 253, 62, 219, 102, - 24, 99, 237, 247, 144, 237, 59, 146, 153, 253, 249, 145, 64, 95, 31, - 102, 173, 248, 49, 219, 102, 60, 243, 174, 201, 45, 85, 223, 8, 127, - 38, 98, 225, 21, 254, 190, 81, 147, 152, 43, 235, 15, 177, 109, 130, - 153, 112, 201, 191, 108, 223, 41, 76, 135, 228, 141, 188, 125, 127, 71, - 77, 99, 130, 150, 174, 96, 219, 204, 96, 204, 219, 203, 216, 190, 179, - 152, 128, 109, 19, 4, 228, 206, 97, 110, 212, 114, 100, 219, 204, 103, - 34, 206, 180, 84, 210, 70, 17, 50, 230, 81, 139, 42, 2, 125, 99, - 152, 129, 81, 205, 216, 54, 177, 204, 167, 253, 214, 172, 220, 197, 204, - 134, 123, 173, 5, 250, 46, 99, 14, 37, 181, 97, 219, 172, 196, 116, - 198, 167, 120, 226, 185, 246, 113, 26, 250, 11, 196, 16, 233, 47, 16, - 19, 120, 30, 202, 210, 208, 95, 184, 231, 218, 253, 229, 234, 127, 67, - 176, 191, 160, 246, 208, 95, 106, 252, 51, 135, 183, 111, 41, 240, 151, - 232, 90, 139, 176, 191, 36, 117, 93, 142, 253, 229, 127, 99, 86, 9, - 250, 203, 171, 53, 27, 177, 191, 52, 250, 185, 14, 251, 75, 161, 116, - 173, 160, 191, 100, 95, 88, 138, 253, 229, 80, 238, 2, 236, 47, 3, - 47, 132, 11, 244, 157, 198, 84, 233, 22, 130, 253, 197, 114, 232, 56, - 236, 47, 45, 103, 14, 17, 244, 23, 233, 14, 26, 251, 203, 241, 182, - 78, 216, 95, 82, 156, 109, 4, 253, 229, 179, 79, 7, 236, 47, 131, - 69, 182, 216, 95, 210, 182, 181, 19, 244, 151, 111, 152, 255, 74, 76, - 67, 127, 249, 38, 32, 23, 249, 11, 140, 135, 164, 191, 192, 248, 134, - 252, 5, 209, 157, 128, 191, 112, 207, 53, 243, 59, 9, 252, 229, 138, - 159, 17, 222, 3, 142, 218, 155, 1, 127, 105, 177, 183, 41, 111, 223, - 239, 192, 95, 102, 56, 58, 102, 35, 127, 57, 145, 226, 170, 164, 127, - 103, 142, 100, 222, 217, 184, 243, 246, 173, 220, 221, 135, 145, 191, 252, - 43, 27, 249, 139, 127, 137, 135, 146, 182, 6, 254, 226, 55, 134, 230, - 237, 107, 20, 61, 137, 185, 84, 161, 117, 54, 242, 23, 139, 150, 150, - 42, 26, 248, 203, 112, 247, 74, 188, 125, 197, 209, 211, 152, 227, 117, - 222, 101, 33, 127, 153, 58, 247, 170, 146, 54, 5, 254, 146, 240, 48, - 57, 139, 175, 111, 30, 240, 151, 181, 127, 5, 100, 33, 127, 57, 115, - 154, 86, 210, 69, 225, 50, 102, 212, 208, 183, 153, 124, 125, 127, 2, - 127, 113, 238, 101, 149, 133, 252, 229, 80, 96, 173, 44, 228, 47, 157, - 86, 84, 205, 18, 242, 151, 122, 38, 239, 50, 145, 191, 32, 26, 250, - 11, 247, 156, 223, 95, 224, 216, 70, 250, 11, 28, 171, 144, 191, 32, - 26, 198, 23, 238, 185, 102, 126, 159, 128, 191, 172, 50, 139, 192, 251, - 229, 81, 123, 19, 224, 47, 137, 187, 249, 251, 194, 248, 18, 145, 131, - 214, 227, 134, 49, 227, 166, 170, 104, 24, 95, 122, 85, 231, 95, 167, - 131, 241, 229, 81, 248, 92, 41, 242, 151, 192, 34, 21, 109, 2, 252, - 229, 130, 139, 64, 95, 16, 95, 190, 134, 206, 199, 251, 244, 59, 213, - 82, 205, 117, 140, 128, 191, 132, 166, 134, 75, 133, 226, 139, 43, 141, - 244, 157, 193, 72, 146, 35, 216, 190, 179, 24, 147, 218, 145, 82, 161, - 248, 146, 184, 16, 181, 153, 207, 252, 62, 16, 41, 197, 227, 145, 192, - 122, 40, 140, 47, 109, 255, 135, 250, 198, 50, 230, 215, 85, 52, 244, - 151, 175, 215, 133, 228, 46, 99, 92, 30, 68, 226, 179, 5, 136, 134, - 254, 194, 61, 231, 159, 231, 193, 60, 21, 229, 172, 241, 133, 32, 15, - 251, 201, 155, 179, 42, 15, 153, 225, 61, 188, 160, 111, 206, 27, 29, - 246, 73, 127, 32, 246, 73, 23, 113, 237, 125, 222, 232, 55, 207, 131, - 99, 46, 222, 39, 93, 68, 236, 251, 7, 24, 128, 50, 149, 152, 125, - 173, 223, 60, 15, 198, 105, 188, 239, 255, 45, 39, 3, 234, 141, 116, - 145, 189, 214, 111, 158, 7, 177, 141, 207, 176, 189, 81, 207, 89, 61, - 217, 92, 213, 252, 181, 126, 243, 60, 232, 15, 184, 150, 241, 70, 125, - 175, 61, 151, 187, 200, 164, 136, 126, 194, 100, 82, 124, 57, 141, 218, - 222, 253, 215, 234, 252, 184, 177, 13, 228, 192, 44, 13, 249, 241, 141, - 121, 106, 235, 156, 101, 248, 113, 177, 79, 38, 69, 52, 228, 199, 23, - 19, 73, 126, 230, 101, 248, 113, 216, 144, 73, 17, 13, 249, 241, 97, - 134, 156, 231, 65, 156, 224, 179, 5, 207, 129, 31, 124, 16, 194, 140, - 3, 254, 30, 230, 160, 111, 252, 75, 97, 204, 192, 118, 200, 15, 226, - 95, 113, 237, 37, 47, 13, 135, 25, 200, 23, 201, 48, 7, 52, 148, - 169, 92, 103, 127, 97, 56, 204, 152, 19, 50, 160, 222, 72, 23, 234, - 133, 225, 48, 3, 249, 146, 152, 49, 103, 101, 228, 60, 55, 28, 102, - 160, 221, 113, 173, 192, 116, 126, 182, 38, 204, 136, 194, 26, 235, 140, - 25, 104, 99, 146, 159, 38, 204, 64, 126, 186, 98, 134, 42, 195, 79, - 19, 102, 32, 63, 93, 49, 3, 109, 71, 242, 211, 132, 25, 200, 79, - 87, 204, 64, 156, 32, 204, 152, 63, 1, 126, 80, 40, 132, 153, 142, - 220, 25, 219, 130, 73, 98, 207, 103, 194, 152, 129, 237, 240, 24, 80, - 64, 156, 97, 123, 106, 56, 204, 120, 18, 50, 114, 192, 59, 229, 176, - 114, 66, 158, 26, 14, 51, 144, 47, 214, 3, 208, 88, 151, 167, 134, - 195, 140, 231, 51, 117, 204, 228, 176, 246, 141, 127, 98, 56, 204, 64, - 187, 235, 139, 25, 178, 198, 29, 242, 84, 127, 204, 144, 252, 68, 79, - 245, 199, 12, 201, 15, 218, 78, 95, 204, 144, 185, 25, 196, 9, 174, - 193, 63, 0, 126, 240, 92, 8, 51, 157, 240, 247, 136, 127, 60, 73, - 156, 248, 72, 24, 51, 176, 29, 30, 3, 30, 19, 53, 248, 71, 250, - 97, 134, 172, 39, 154, 19, 50, 226, 21, 0, 251, 172, 28, 249, 67, - 253, 48, 67, 214, 19, 33, 95, 92, 131, 7, 239, 142, 116, 241, 124, - 168, 31, 102, 200, 122, 34, 228, 75, 98, 6, 202, 84, 198, 151, 7, - 250, 97, 6, 213, 19, 93, 88, 187, 227, 179, 0, 167, 171, 159, 220, - 248, 34, 243, 143, 122, 34, 165, 216, 45, 173, 242, 228, 150, 78, 227, - 2, 180, 49, 226, 231, 35, 175, 126, 242, 65, 163, 15, 206, 101, 235, - 77, 230, 128, 223, 13, 105, 172, 78, 252, 60, 9, 126, 242, 206, 53, - 78, 166, 54, 116, 254, 163, 30, 161, 120, 189, 91, 26, 223, 164, 110, - 182, 78, 53, 248, 7, 4, 191, 83, 213, 79, 54, 158, 59, 239, 143, - 249, 170, 29, 220, 151, 97, 163, 219, 158, 49, 136, 19, 132, 25, 197, - 61, 64, 63, 17, 194, 140, 35, 87, 31, 190, 15, 230, 63, 249, 58, - 212, 224, 239, 19, 181, 235, 251, 92, 251, 214, 148, 167, 142, 152, 169, - 165, 209, 15, 58, 186, 72, 156, 112, 237, 154, 144, 161, 0, 239, 164, - 96, 229, 180, 46, 234, 171, 35, 102, 52, 203, 56, 229, 242, 245, 56, - 214, 35, 159, 208, 3, 208, 72, 151, 214, 241, 131, 116, 196, 140, 102, - 25, 207, 95, 62, 116, 198, 122, 228, 151, 169, 193, 179, 246, 109, 77, - 245, 211, 17, 51, 154, 101, 140, 250, 165, 26, 103, 186, 154, 170, 236, - 110, 173, 108, 41, 18, 69, 180, 105, 39, 135, 118, 68, 62, 132, 232, - 110, 41, 49, 20, 247, 92, 115, 220, 13, 28, 88, 66, 221, 173, 214, - 10, 239, 237, 182, 237, 227, 164, 164, 187, 79, 243, 167, 175, 247, 31, - 200, 187, 79, 250, 205, 146, 205, 52, 135, 213, 36, 92, 239, 55, 141, - 72, 166, 249, 176, 170, 172, 151, 68, 237, 167, 155, 95, 42, 102, 219, - 164, 208, 41, 79, 191, 41, 105, 113, 68, 26, 221, 237, 215, 103, 23, - 254, 26, 217, 97, 122, 162, 59, 90, 91, 200, 160, 223, 88, 30, 97, - 235, 147, 199, 233, 126, 175, 55, 243, 246, 45, 142, 202, 162, 205, 62, - 141, 99, 219, 200, 233, 95, 238, 110, 74, 250, 87, 248, 105, 58, 112, - 179, 165, 192, 59, 159, 163, 19, 186, 84, 98, 219, 92, 164, 93, 102, - 154, 176, 114, 47, 211, 167, 39, 148, 58, 243, 215, 254, 175, 209, 255, - 171, 86, 153, 237, 155, 67, 203, 220, 234, 179, 182, 186, 73, 247, 14, - 225, 31, 187, 197, 209, 185, 180, 111, 52, 197, 182, 201, 163, 47, 84, - 154, 175, 164, 171, 71, 220, 163, 151, 93, 220, 44, 176, 230, 240, 128, - 62, 251, 24, 173, 147, 40, 104, 179, 1, 166, 174, 42, 125, 159, 208, - 13, 108, 234, 243, 126, 223, 111, 81, 5, 180, 223, 227, 78, 108, 155, - 151, 244, 149, 10, 61, 149, 244, 207, 240, 66, 250, 65, 27, 111, 87, - 126, 59, 191, 165, 27, 87, 25, 199, 182, 41, 162, 229, 19, 3, 85, - 116, 196, 71, 122, 224, 133, 105, 174, 252, 53, 158, 47, 244, 222, 239, - 51, 217, 54, 223, 233, 27, 86, 51, 92, 85, 245, 176, 98, 250, 155, - 83, 168, 43, 255, 55, 42, 165, 71, 248, 142, 71, 109, 152, 143, 139, - 84, 239, 96, 36, 53, 98, 150, 30, 240, 227, 237, 43, 58, 101, 204, - 92, 104, 141, 222, 205, 148, 233, 246, 45, 72, 73, 87, 144, 86, 96, - 18, 206, 249, 243, 246, 253, 45, 175, 200, 48, 174, 3, 216, 54, 149, - 24, 231, 3, 82, 21, 45, 173, 204, 56, 55, 177, 231, 215, 87, 94, - 133, 217, 145, 208, 132, 109, 83, 141, 217, 209, 183, 142, 146, 254, 29, - 94, 157, 201, 61, 40, 18, 176, 85, 77, 134, 91, 103, 179, 192, 116, - 198, 167, 186, 140, 208, 250, 27, 142, 37, 32, 190, 162, 88, 50, 15, - 196, 18, 24, 47, 81, 44, 65, 52, 60, 231, 192, 61, 215, 204, 111, - 17, 136, 37, 5, 171, 37, 89, 40, 150, 44, 200, 87, 213, 132, 103, - 130, 88, 18, 179, 176, 22, 111, 29, 184, 20, 196, 18, 110, 156, 78, - 194, 107, 65, 70, 32, 150, 240, 141, 211, 42, 27, 236, 167, 15, 78, - 138, 195, 177, 100, 141, 245, 90, 22, 151, 105, 116, 216, 99, 254, 53, - 57, 99, 16, 75, 70, 108, 221, 129, 99, 73, 163, 135, 241, 74, 186, - 10, 136, 37, 53, 157, 35, 120, 251, 126, 1, 177, 36, 229, 59, 122, - 103, 57, 109, 26, 36, 119, 86, 189, 243, 105, 90, 242, 112, 37, 111, - 60, 48, 137, 62, 71, 43, 198, 63, 117, 70, 177, 196, 43, 181, 169, - 82, 86, 101, 16, 75, 154, 164, 254, 37, 16, 255, 174, 209, 211, 70, - 39, 224, 88, 146, 185, 41, 155, 181, 213, 77, 186, 81, 222, 83, 222, - 190, 159, 162, 114, 233, 236, 122, 53, 92, 81, 44, 89, 185, 161, 30, - 27, 15, 238, 209, 109, 235, 73, 4, 124, 237, 1, 45, 94, 83, 215, - 21, 197, 146, 228, 11, 42, 218, 56, 226, 9, 221, 191, 164, 46, 63, - 62, 64, 44, 169, 224, 89, 31, 199, 18, 119, 214, 223, 77, 34, 10, - 233, 101, 79, 90, 8, 96, 250, 45, 109, 92, 161, 35, 142, 37, 67, - 171, 117, 98, 251, 126, 164, 247, 213, 118, 20, 144, 251, 133, 78, 29, - 106, 131, 99, 73, 82, 159, 22, 236, 59, 23, 211, 155, 93, 27, 9, - 198, 18, 145, 71, 77, 28, 75, 188, 3, 171, 170, 250, 130, 88, 242, - 239, 138, 10, 188, 125, 171, 128, 88, 98, 126, 161, 42, 142, 37, 190, - 193, 111, 148, 223, 165, 22, 136, 37, 121, 238, 167, 120, 191, 209, 75, - 16, 75, 222, 236, 184, 225, 140, 98, 201, 137, 109, 3, 148, 244, 47, - 183, 202, 76, 242, 246, 236, 12, 222, 119, 6, 177, 100, 141, 236, 167, - 51, 138, 37, 77, 150, 54, 114, 65, 177, 68, 212, 104, 180, 139, 80, - 44, 225, 214, 96, 45, 48, 13, 99, 137, 208, 218, 44, 142, 37, 32, - 143, 66, 177, 228, 75, 171, 118, 114, 152, 23, 161, 88, 130, 232, 217, - 7, 99, 40, 238, 185, 102, 126, 123, 61, 74, 168, 167, 139, 209, 90, - 153, 29, 253, 120, 244, 56, 37, 61, 106, 170, 63, 125, 169, 229, 2, - 222, 117, 176, 62, 177, 155, 105, 46, 71, 79, 194, 235, 132, 217, 32, - 150, 240, 229, 232, 74, 61, 22, 238, 167, 195, 61, 235, 100, 163, 88, - 50, 112, 84, 129, 50, 110, 117, 137, 73, 163, 207, 183, 221, 198, 27, - 195, 146, 34, 14, 211, 45, 169, 9, 56, 150, 220, 91, 31, 160, 252, - 254, 203, 231, 30, 167, 71, 25, 95, 230, 245, 151, 170, 178, 44, 250, - 91, 190, 137, 27, 138, 37, 139, 43, 152, 43, 233, 53, 32, 47, 137, - 108, 222, 144, 119, 63, 92, 11, 16, 75, 78, 191, 169, 227, 134, 98, - 137, 115, 70, 53, 37, 61, 31, 196, 18, 191, 40, 19, 254, 125, 230, - 32, 150, 52, 114, 188, 231, 138, 98, 137, 34, 240, 136, 146, 158, 0, - 98, 201, 177, 13, 171, 249, 207, 201, 197, 228, 210, 86, 117, 135, 224, - 88, 242, 248, 199, 89, 165, 238, 9, 145, 247, 232, 17, 85, 87, 156, - 224, 235, 107, 25, 253, 128, 14, 25, 224, 147, 133, 98, 73, 231, 159, - 199, 149, 244, 106, 144, 151, 172, 120, 98, 204, 251, 141, 254, 149, 21, - 208, 141, 188, 28, 178, 81, 44, 25, 253, 122, 128, 146, 126, 54, 191, - 144, 14, 241, 15, 226, 237, 27, 12, 98, 201, 67, 183, 168, 108, 20, - 75, 134, 236, 90, 162, 164, 183, 135, 127, 164, 55, 87, 92, 205, 219, - 119, 61, 136, 37, 109, 159, 111, 202, 70, 177, 228, 116, 151, 45, 74, - 250, 83, 120, 49, 253, 102, 241, 54, 222, 190, 37, 32, 150, 88, 120, - 110, 70, 109, 152, 202, 225, 9, 217, 40, 47, 17, 37, 111, 200, 230, - 199, 180, 49, 99, 210, 110, 93, 54, 138, 37, 69, 215, 214, 40, 105, - 83, 16, 75, 238, 79, 229, 127, 231, 122, 167, 42, 50, 197, 118, 107, - 178, 81, 44, 249, 217, 60, 78, 73, 119, 0, 121, 137, 85, 221, 101, - 252, 235, 216, 167, 170, 48, 51, 174, 200, 178, 81, 44, 25, 247, 51, - 84, 73, 127, 0, 177, 196, 241, 172, 119, 182, 80, 44, 225, 214, 231, - 45, 48, 125, 2, 196, 18, 161, 117, 123, 110, 142, 211, 15, 199, 146, - 37, 32, 47, 129, 243, 31, 20, 75, 16, 237, 10, 242, 18, 238, 185, - 102, 126, 59, 64, 94, 210, 242, 197, 28, 124, 254, 210, 172, 149, 138, - 166, 65, 94, 226, 226, 61, 155, 183, 239, 71, 144, 151, 112, 243, 243, - 36, 188, 134, 108, 2, 98, 9, 223, 252, 92, 53, 246, 236, 167, 223, - 159, 70, 109, 82, 232, 99, 78, 17, 82, 148, 151, 196, 164, 241, 159, - 251, 44, 141, 58, 76, 239, 216, 133, 244, 202, 160, 247, 207, 87, 209, - 98, 144, 151, 100, 120, 241, 235, 11, 231, 56, 77, 175, 33, 185, 114, - 250, 235, 20, 150, 6, 121, 201, 85, 115, 161, 119, 62, 71, 103, 122, - 160, 54, 23, 233, 39, 203, 195, 89, 125, 47, 211, 149, 111, 10, 173, - 39, 95, 163, 227, 99, 145, 94, 57, 244, 165, 231, 104, 61, 249, 38, - 109, 228, 33, 180, 174, 155, 75, 175, 57, 134, 218, 228, 209, 190, 25, - 42, 218, 20, 204, 113, 58, 28, 229, 239, 43, 6, 177, 36, 42, 10, - 181, 81, 208, 127, 109, 83, 201, 53, 7, 121, 137, 85, 22, 255, 59, - 139, 162, 11, 232, 204, 157, 232, 251, 190, 164, 143, 119, 81, 173, 189, - 255, 6, 115, 156, 140, 43, 252, 190, 241, 3, 196, 146, 101, 230, 97, - 82, 20, 75, 196, 79, 102, 74, 85, 243, 163, 143, 244, 226, 67, 51, - 164, 252, 185, 227, 23, 122, 116, 143, 233, 82, 20, 75, 94, 190, 15, - 101, 109, 85, 76, 207, 216, 28, 42, 96, 171, 82, 186, 213, 8, 212, - 87, 196, 20, 236, 86, 209, 48, 150, 236, 252, 50, 157, 255, 251, 130, - 88, 18, 217, 103, 6, 62, 19, 188, 110, 217, 12, 182, 111, 5, 102, - 239, 85, 254, 119, 54, 2, 177, 196, 247, 17, 106, 83, 137, 217, 22, - 169, 210, 215, 20, 196, 18, 69, 19, 254, 59, 1, 225, 28, 39, 126, - 59, 178, 85, 53, 230, 47, 153, 202, 182, 191, 64, 44, 185, 238, 58, - 87, 42, 20, 75, 184, 189, 27, 22, 152, 62, 6, 98, 137, 208, 158, - 14, 84, 35, 83, 214, 197, 80, 173, 244, 246, 36, 177, 207, 3, 161, - 26, 89, 23, 92, 127, 241, 1, 125, 21, 121, 194, 53, 50, 216, 14, - 215, 175, 238, 114, 237, 67, 242, 12, 183, 22, 3, 249, 226, 250, 21, - 160, 161, 76, 21, 100, 12, 183, 22, 227, 67, 200, 128, 122, 35, 93, - 226, 239, 24, 110, 45, 6, 242, 37, 107, 100, 62, 172, 12, 201, 29, - 195, 173, 197, 64, 187, 27, 114, 253, 82, 148, 103, 216, 245, 75, 104, - 79, 67, 174, 95, 74, 238, 24, 118, 253, 18, 226, 4, 175, 197, 220, - 4, 126, 112, 79, 8, 51, 93, 185, 189, 250, 160, 111, 226, 45, 29, - 206, 67, 220, 38, 214, 48, 114, 137, 181, 152, 91, 134, 195, 12, 228, - 139, 207, 67, 0, 26, 202, 84, 142, 140, 255, 25, 14, 51, 18, 66, - 6, 212, 27, 233, 226, 249, 159, 225, 48, 3, 249, 170, 157, 135, 96, - 101, 40, 110, 26, 14, 51, 208, 238, 134, 92, 191, 132, 54, 54, 228, - 250, 165, 231, 127, 134, 93, 191, 132, 182, 51, 228, 250, 37, 196, 9, - 94, 139, 185, 6, 252, 224, 182, 16, 102, 186, 113, 235, 4, 55, 64, - 60, 207, 209, 97, 45, 230, 6, 49, 6, 220, 224, 218, 167, 92, 215, - 15, 51, 205, 158, 85, 227, 206, 17, 16, 50, 20, 224, 157, 20, 172, - 28, 234, 186, 126, 152, 249, 57, 32, 60, 11, 235, 145, 67, 232, 1, - 104, 164, 75, 206, 255, 244, 195, 204, 218, 199, 5, 220, 157, 23, 57, - 101, 214, 98, 88, 251, 250, 252, 79, 63, 204, 4, 206, 242, 229, 238, - 19, 188, 174, 253, 76, 13, 180, 41, 162, 181, 201, 249, 99, 95, 11, - 15, 63, 104, 191, 242, 242, 131, 246, 212, 198, 15, 218, 170, 188, 252, - 124, 120, 248, 65, 187, 232, 202, 15, 231, 102, 215, 136, 220, 236, 18, - 240, 131, 155, 2, 152, 177, 183, 227, 242, 6, 208, 87, 113, 69, 135, - 220, 236, 26, 225, 207, 87, 137, 220, 236, 138, 1, 115, 179, 171, 132, - 63, 3, 26, 202, 84, 54, 186, 98, 192, 220, 140, 144, 1, 245, 70, - 186, 196, 95, 54, 96, 110, 118, 165, 76, 110, 198, 202, 144, 92, 54, - 96, 110, 118, 197, 176, 227, 140, 232, 138, 97, 199, 25, 104, 79, 67, - 142, 51, 146, 203, 134, 29, 103, 32, 78, 112, 110, 118, 14, 248, 193, - 53, 33, 204, 112, 123, 152, 37, 160, 111, 226, 5, 29, 114, 179, 75, - 68, 78, 115, 145, 200, 205, 46, 24, 48, 55, 187, 72, 228, 102, 128, - 134, 50, 149, 185, 217, 121, 3, 230, 102, 132, 12, 168, 55, 210, 197, - 243, 188, 1, 115, 179, 11, 101, 114, 51, 86, 134, 226, 156, 1, 115, - 179, 11, 134, 157, 207, 64, 27, 27, 114, 62, 227, 121, 222, 176, 243, - 25, 104, 59, 67, 206, 103, 32, 78, 240, 89, 213, 163, 192, 15, 46, - 105, 199, 76, 232, 164, 0, 209, 12, 50, 111, 56, 11, 226, 249, 153, - 73, 98, 127, 255, 150, 114, 127, 255, 102, 204, 137, 248, 5, 217, 157, - 123, 198, 75, 255, 200, 205, 206, 18, 99, 192, 89, 226, 78, 4, 185, - 38, 63, 128, 99, 100, 17, 221, 115, 232, 211, 172, 150, 243, 166, 56, - 171, 48, 83, 69, 163, 31, 164, 140, 59, 142, 125, 205, 135, 144, 161, - 0, 239, 164, 96, 229, 196, 103, 105, 151, 177, 125, 118, 167, 236, 236, - 226, 66, 103, 21, 102, 52, 203, 184, 107, 245, 15, 55, 6, 156, 33, - 244, 0, 52, 214, 229, 132, 118, 25, 199, 99, 26, 158, 220, 22, 33, - 118, 83, 97, 70, 179, 140, 191, 159, 53, 224, 114, 204, 51, 101, 114, - 179, 51, 236, 190, 210, 12, 237, 50, 234, 45, 235, 37, 125, 103, 19, - 43, 85, 97, 70, 179, 140, 25, 5, 170, 189, 101, 195, 140, 85, 118, - 183, 86, 182, 84, 157, 13, 130, 118, 68, 252, 16, 13, 207, 6, 113, - 207, 69, 162, 53, 162, 230, 162, 221, 162, 22, 162, 84, 240, 135, 239, - 114, 28, 208, 141, 113, 112, 221, 194, 182, 233, 199, 160, 246, 166, 89, - 3, 25, 187, 174, 114, 222, 49, 224, 55, 227, 197, 220, 105, 115, 147, - 109, 51, 140, 121, 57, 44, 91, 73, 91, 101, 141, 100, 230, 45, 74, - 230, 237, 107, 220, 221, 135, 233, 99, 126, 136, 109, 51, 158, 89, 53, - 49, 93, 73, 87, 44, 157, 200, 252, 232, 120, 132, 183, 111, 123, 211, - 169, 76, 223, 160, 189, 108, 155, 25, 76, 97, 229, 68, 37, 93, 224, - 54, 147, 57, 106, 191, 133, 183, 111, 177, 124, 22, 211, 163, 194, 70, - 182, 205, 108, 230, 199, 134, 117, 42, 90, 58, 135, 57, 214, 118, 13, - 191, 190, 242, 185, 204, 193, 51, 171, 216, 54, 243, 25, 187, 247, 241, - 153, 170, 186, 183, 140, 113, 220, 178, 130, 191, 111, 84, 12, 115, 160, - 46, 234, 27, 203, 220, 159, 181, 56, 83, 85, 159, 92, 196, 124, 106, - 185, 64, 64, 238, 98, 230, 68, 220, 84, 182, 205, 82, 198, 44, 200, - 143, 237, 187, 140, 25, 235, 238, 45, 208, 119, 57, 227, 230, 219, 19, - 159, 67, 67, 244, 253, 57, 113, 196, 115, 237, 99, 60, 244, 53, 136, - 63, 210, 215, 32, 158, 144, 175, 33, 26, 250, 26, 247, 28, 250, 90, - 83, 214, 215, 90, 98, 126, 239, 128, 175, 141, 176, 90, 133, 125, 13, - 181, 135, 190, 246, 209, 106, 143, 160, 175, 73, 173, 210, 177, 175, 73, - 126, 108, 193, 190, 22, 154, 183, 72, 208, 215, 114, 125, 226, 176, 175, - 237, 90, 185, 90, 73, 139, 129, 175, 109, 186, 186, 94, 208, 215, 134, - 164, 175, 198, 190, 102, 50, 51, 30, 251, 154, 99, 65, 156, 160, 175, - 13, 154, 18, 135, 125, 237, 139, 91, 28, 246, 181, 132, 26, 113, 130, - 190, 70, 21, 175, 196, 190, 182, 172, 69, 28, 246, 181, 195, 215, 248, - 251, 194, 115, 104, 67, 71, 174, 197, 190, 86, 177, 247, 42, 236, 107, - 15, 78, 198, 9, 250, 218, 138, 244, 37, 216, 215, 230, 251, 199, 98, - 95, 11, 178, 140, 17, 244, 181, 37, 142, 225, 216, 215, 16, 13, 125, - 141, 123, 206, 239, 107, 48, 14, 147, 190, 6, 227, 42, 242, 53, 68, - 187, 3, 95, 227, 158, 67, 95, 171, 9, 124, 205, 10, 248, 90, 35, - 204, 175, 0, 248, 218, 189, 31, 245, 241, 25, 89, 212, 190, 2, 240, - 181, 248, 218, 252, 235, 116, 166, 221, 189, 152, 121, 63, 26, 225, 51, - 178, 77, 71, 171, 126, 111, 9, 250, 218, 90, 185, 57, 111, 95, 19, - 224, 107, 223, 60, 43, 225, 51, 178, 118, 115, 69, 217, 200, 215, 54, - 86, 122, 195, 187, 206, 110, 11, 124, 173, 192, 228, 10, 62, 231, 26, - 36, 75, 201, 66, 190, 246, 248, 209, 158, 44, 33, 95, 235, 119, 107, - 123, 22, 242, 181, 37, 39, 55, 101, 33, 95, 123, 153, 188, 134, 183, - 239, 79, 224, 107, 233, 253, 22, 225, 51, 178, 225, 221, 99, 149, 116, - 5, 224, 107, 73, 141, 163, 179, 132, 124, 173, 114, 149, 227, 248, 140, - 108, 154, 245, 126, 37, 93, 5, 248, 218, 208, 67, 255, 242, 247, 5, - 190, 246, 176, 150, 44, 11, 249, 90, 223, 51, 67, 178, 84, 251, 65, - 150, 49, 238, 190, 237, 179, 4, 125, 205, 242, 5, 231, 107, 44, 253, - 0, 250, 26, 126, 206, 239, 107, 112, 60, 38, 125, 13, 142, 175, 200, - 215, 16, 13, 227, 26, 247, 28, 250, 218, 76, 224, 107, 179, 128, 175, - 133, 169, 197, 181, 89, 21, 230, 227, 243, 181, 168, 61, 140, 107, 84, - 45, 129, 181, 69, 16, 215, 146, 163, 195, 241, 249, 218, 251, 53, 85, - 116, 125, 224, 107, 213, 182, 243, 175, 1, 193, 184, 22, 24, 26, 142, - 207, 215, 46, 121, 164, 162, 127, 151, 76, 100, 172, 167, 241, 175, 195, - 218, 192, 49, 52, 133, 59, 35, 235, 251, 69, 69, 67, 95, 251, 183, - 162, 192, 58, 44, 240, 181, 27, 141, 80, 155, 217, 204, 206, 14, 44, - 13, 124, 109, 6, 29, 41, 21, 138, 107, 123, 70, 113, 231, 107, 15, - 143, 65, 103, 100, 101, 204, 115, 255, 72, 193, 243, 181, 175, 158, 70, - 224, 243, 181, 207, 140, 216, 179, 185, 192, 215, 30, 155, 11, 201, 93, - 204, 140, 11, 65, 109, 150, 50, 167, 214, 163, 190, 203, 152, 38, 89, - 66, 125, 151, 51, 94, 119, 185, 179, 185, 136, 134, 113, 141, 123, 206, - 63, 175, 133, 121, 57, 202, 209, 83, 14, 129, 188, 243, 28, 111, 142, - 174, 126, 54, 23, 244, 45, 58, 44, 156, 163, 195, 118, 248, 108, 238, - 17, 142, 191, 236, 176, 174, 57, 186, 230, 185, 26, 204, 19, 240, 217, - 220, 35, 196, 111, 24, 1, 26, 202, 84, 174, 73, 31, 214, 53, 71, - 215, 44, 3, 142, 15, 88, 15, 66, 6, 212, 27, 233, 146, 152, 174, - 107, 142, 174, 69, 6, 136, 11, 88, 143, 195, 101, 126, 195, 136, 149, - 97, 151, 174, 107, 142, 174, 89, 6, 244, 7, 124, 246, 245, 176, 250, - 89, 85, 46, 223, 146, 73, 17, 253, 163, 123, 38, 197, 151, 135, 169, - 157, 125, 45, 195, 143, 27, 83, 101, 82, 68, 67, 126, 124, 99, 173, - 218, 221, 129, 233, 101, 248, 225, 184, 9, 248, 177, 180, 146, 31, 79, - 60, 85, 187, 59, 176, 12, 63, 14, 27, 50, 41, 162, 33, 63, 62, - 204, 144, 243, 90, 136, 19, 124, 207, 182, 93, 160, 184, 232, 168, 16, - 102, 184, 179, 185, 118, 160, 111, 74, 170, 48, 102, 96, 59, 228, 7, - 41, 105, 28, 127, 42, 213, 112, 152, 129, 124, 241, 239, 36, 1, 26, - 202, 84, 206, 157, 83, 12, 135, 25, 59, 66, 6, 212, 27, 233, 226, - 147, 98, 56, 204, 64, 190, 36, 102, 236, 88, 25, 148, 125, 160, 193, - 48, 3, 237, 142, 107, 35, 191, 229, 110, 154, 48, 35, 10, 123, 40, - 213, 21, 51, 208, 198, 36, 63, 77, 152, 129, 252, 116, 197, 140, 15, - 201, 239, 23, 224, 167, 1, 51, 242, 89, 15, 165, 186, 98, 6, 218, - 142, 124, 63, 77, 152, 129, 239, 167, 43, 102, 32, 78, 112, 253, 212, - 37, 80, 156, 114, 72, 8, 51, 220, 217, 92, 10, 244, 77, 116, 11, - 20, 196, 12, 108, 135, 235, 142, 82, 238, 219, 219, 185, 5, 26, 12, - 51, 144, 47, 174, 159, 2, 26, 202, 84, 218, 214, 53, 208, 96, 152, - 145, 16, 50, 160, 222, 72, 23, 79, 30, 25, 229, 197, 12, 228, 171, - 86, 63, 101, 101, 40, 92, 12, 135, 25, 104, 119, 125, 49, 163, 182, - 182, 237, 26, 168, 55, 102, 212, 214, 182, 73, 126, 255, 71, 204, 168, - 173, 109, 187, 232, 143, 25, 181, 181, 109, 23, 14, 51, 146, 174, 129, - 98, 185, 93, 160, 0, 102, 184, 179, 185, 10, 231, 64, 177, 143, 147, - 48, 102, 96, 59, 92, 119, 116, 230, 248, 23, 117, 211, 15, 51, 106, - 245, 83, 66, 134, 2, 188, 147, 130, 149, 35, 235, 166, 31, 102, 212, - 234, 167, 78, 132, 30, 128, 70, 186, 152, 119, 211, 15, 51, 106, 245, - 83, 39, 117, 204, 64, 153, 202, 252, 175, 171, 126, 152, 65, 245, 83, - 23, 214, 238, 248, 142, 85, 121, 245, 147, 179, 254, 125, 243, 71, 253, - 20, 158, 165, 245, 30, 146, 162, 181, 126, 170, 118, 207, 9, 193, 79, - 113, 162, 250, 201, 13, 253, 236, 179, 202, 214, 200, 226, 31, 237, 150, - 182, 9, 136, 208, 90, 35, 83, 203, 245, 8, 126, 146, 46, 53, 78, - 42, 6, 121, 254, 81, 7, 41, 122, 189, 91, 218, 122, 98, 77, 173, - 117, 16, 181, 92, 175, 43, 193, 239, 116, 245, 147, 141, 183, 207, 253, - 99, 174, 11, 207, 230, 46, 28, 30, 174, 117, 174, 75, 142, 51, 16, - 39, 120, 109, 219, 17, 248, 129, 139, 16, 102, 184, 179, 185, 137, 93, - 2, 197, 146, 206, 194, 152, 129, 237, 240, 24, 208, 133, 227, 223, 58, - 113, 128, 142, 152, 209, 124, 222, 244, 183, 243, 66, 124, 54, 87, 66, - 200, 72, 4, 239, 148, 200, 202, 105, 29, 50, 80, 71, 204, 104, 150, - 177, 161, 168, 176, 27, 214, 163, 51, 161, 7, 160, 145, 46, 173, 115, - 70, 235, 136, 25, 205, 50, 162, 198, 191, 194, 103, 115, 37, 157, 213, - 49, 3, 101, 194, 127, 147, 126, 14, 208, 17, 51, 154, 101, 244, 35, - 207, 230, 2, 187, 163, 125, 235, 129, 109, 218, 201, 161, 29, 17, 63, - 68, 119, 74, 137, 161, 184, 231, 224, 255, 84, 3, 253, 128, 127, 59, - 19, 117, 224, 102, 3, 75, 168, 169, 109, 70, 225, 243, 116, 45, 215, - 132, 42, 105, 239, 105, 254, 180, 120, 209, 66, 92, 247, 25, 12, 240, - 17, 0, 254, 230, 137, 36, 92, 173, 106, 201, 102, 154, 195, 106, 18, - 94, 223, 128, 231, 233, 248, 176, 42, 98, 207, 211, 5, 53, 69, 117, - 230, 20, 218, 102, 122, 34, 91, 83, 77, 163, 11, 207, 110, 16, 168, - 169, 30, 166, 87, 180, 66, 117, 209, 12, 154, 154, 19, 195, 202, 61, - 78, 23, 174, 155, 39, 208, 55, 139, 78, 79, 69, 99, 165, 156, 238, - 190, 46, 140, 149, 123, 154, 190, 57, 123, 154, 192, 186, 193, 57, 250, - 99, 189, 137, 108, 155, 139, 116, 161, 253, 48, 182, 239, 101, 58, 191, - 111, 47, 1, 185, 215, 232, 169, 118, 150, 108, 155, 28, 122, 120, 108, - 11, 213, 26, 75, 196, 77, 122, 248, 125, 59, 129, 190, 185, 244, 240, - 108, 20, 171, 242, 104, 171, 76, 118, 109, 36, 226, 30, 253, 205, 50, - 73, 224, 157, 31, 208, 135, 211, 142, 177, 109, 20, 244, 148, 227, 215, - 84, 117, 254, 136, 39, 116, 207, 211, 143, 121, 251, 138, 163, 11, 232, - 186, 235, 191, 179, 109, 94, 210, 245, 236, 170, 43, 253, 161, 114, 68, - 33, 189, 177, 142, 132, 183, 38, 248, 46, 234, 45, 237, 188, 212, 131, - 109, 83, 68, 79, 179, 31, 164, 164, 75, 194, 63, 210, 30, 121, 163, - 4, 234, 152, 95, 232, 9, 145, 131, 217, 54, 223, 233, 110, 212, 0, - 246, 174, 191, 98, 186, 154, 81, 111, 254, 51, 158, 81, 165, 180, 123, - 39, 23, 212, 134, 153, 254, 165, 91, 150, 170, 182, 100, 196, 108, 63, - 210, 133, 183, 175, 209, 41, 99, 166, 141, 87, 119, 182, 141, 41, 147, - 191, 206, 89, 85, 123, 149, 86, 96, 2, 238, 116, 20, 168, 219, 86, - 100, 46, 78, 170, 205, 182, 169, 196, 60, 247, 170, 162, 164, 127, 187, - 85, 102, 236, 41, 35, 129, 250, 105, 21, 102, 143, 83, 37, 182, 77, - 53, 166, 117, 134, 169, 146, 54, 137, 168, 206, 244, 244, 255, 41, 240, - 125, 107, 50, 220, 186, 162, 5, 166, 225, 121, 58, 114, 189, 81, 100, - 212, 66, 84, 29, 252, 53, 54, 106, 241, 231, 25, 24, 16, 95, 81, - 44, 105, 213, 186, 157, 28, 198, 75, 20, 75, 16, 253, 241, 96, 12, - 197, 61, 215, 28, 75, 118, 245, 41, 161, 238, 157, 104, 129, 207, 211, - 85, 17, 181, 87, 210, 57, 161, 254, 180, 155, 184, 115, 54, 23, 75, - 44, 65, 44, 177, 4, 177, 164, 30, 238, 219, 116, 233, 102, 154, 27, - 167, 147, 240, 250, 213, 143, 240, 100, 154, 111, 156, 22, 41, 207, 61, - 237, 167, 47, 247, 240, 192, 177, 228, 91, 211, 186, 44, 62, 210, 232, - 247, 191, 46, 241, 158, 17, 251, 9, 207, 192, 12, 148, 156, 64, 177, - 36, 211, 207, 77, 117, 254, 24, 196, 146, 131, 78, 209, 78, 66, 177, - 100, 244, 145, 67, 78, 40, 150, 180, 126, 248, 203, 9, 197, 146, 207, - 198, 214, 206, 66, 177, 36, 181, 133, 11, 62, 155, 187, 244, 104, 176, - 179, 234, 155, 95, 166, 123, 252, 195, 127, 174, 183, 66, 244, 53, 218, - 163, 205, 38, 103, 20, 75, 172, 188, 127, 43, 233, 106, 32, 150, 92, - 163, 29, 4, 238, 38, 200, 165, 7, 191, 62, 132, 207, 249, 87, 141, - 221, 166, 164, 187, 129, 88, 210, 170, 201, 50, 222, 190, 133, 32, 150, - 140, 58, 127, 238, 24, 138, 37, 158, 221, 140, 149, 118, 126, 21, 254, - 132, 62, 231, 28, 193, 235, 167, 95, 163, 10, 104, 251, 210, 36, 28, - 75, 102, 39, 92, 85, 210, 165, 225, 133, 116, 113, 167, 34, 222, 190, - 223, 64, 44, 89, 183, 185, 26, 142, 37, 70, 209, 22, 42, 108, 129, - 88, 210, 127, 98, 67, 193, 88, 242, 81, 84, 31, 199, 146, 15, 149, - 234, 227, 88, 82, 100, 94, 159, 31, 151, 32, 150, 48, 243, 234, 225, - 88, 146, 118, 78, 117, 214, 220, 4, 196, 146, 86, 230, 252, 114, 225, - 217, 92, 197, 30, 59, 28, 75, 38, 246, 80, 181, 111, 8, 98, 201, - 146, 251, 98, 222, 190, 143, 65, 44, 185, 187, 98, 64, 38, 138, 37, - 15, 125, 45, 50, 85, 107, 49, 149, 153, 71, 97, 233, 252, 254, 12, - 98, 201, 8, 71, 52, 6, 86, 99, 218, 57, 170, 214, 24, 225, 25, - 152, 153, 147, 210, 4, 198, 153, 154, 12, 183, 110, 108, 129, 105, 24, - 75, 200, 245, 100, 222, 88, 2, 242, 40, 20, 75, 106, 128, 88, 2, - 243, 34, 20, 75, 16, 13, 207, 230, 114, 207, 53, 199, 146, 215, 30, - 37, 84, 77, 103, 55, 28, 75, 46, 231, 251, 42, 233, 246, 83, 253, - 233, 131, 62, 11, 136, 88, 82, 15, 196, 18, 11, 37, 15, 212, 215, - 35, 118, 51, 205, 229, 232, 73, 120, 125, 242, 36, 200, 75, 248, 114, - 116, 216, 119, 83, 244, 126, 218, 230, 191, 247, 89, 40, 150, 12, 126, - 41, 87, 210, 211, 64, 44, 185, 243, 106, 21, 239, 119, 243, 5, 177, - 228, 197, 139, 202, 89, 40, 150, 204, 127, 211, 67, 105, 179, 160, 240, - 227, 116, 251, 6, 141, 120, 177, 245, 0, 196, 146, 249, 177, 119, 241, - 157, 33, 189, 76, 108, 149, 103, 94, 95, 132, 159, 166, 29, 92, 167, - 242, 158, 145, 93, 2, 98, 9, 179, 229, 31, 87, 20, 75, 170, 139, - 142, 42, 233, 39, 225, 151, 233, 11, 99, 46, 242, 246, 157, 11, 98, - 73, 160, 199, 77, 124, 54, 183, 161, 60, 67, 73, 175, 142, 188, 73, - 223, 108, 190, 141, 183, 175, 83, 76, 46, 253, 189, 208, 6, 159, 205, - 109, 96, 45, 81, 190, 255, 29, 16, 75, 94, 45, 203, 224, 245, 181, - 69, 178, 7, 244, 86, 159, 191, 241, 217, 220, 58, 23, 238, 40, 233, - 55, 243, 159, 208, 225, 179, 43, 243, 174, 235, 230, 131, 188, 36, 217, - 200, 10, 159, 205, 173, 51, 85, 117, 135, 242, 79, 144, 151, 132, 126, - 248, 139, 183, 239, 151, 200, 183, 244, 237, 238, 11, 241, 217, 220, 54, - 39, 84, 103, 85, 175, 204, 255, 72, 63, 108, 177, 137, 183, 239, 49, - 16, 75, 94, 223, 77, 192, 103, 115, 135, 214, 85, 157, 181, 253, 21, - 94, 76, 111, 27, 244, 55, 255, 90, 116, 116, 41, 189, 214, 29, 183, - 97, 168, 223, 42, 89, 21, 65, 44, 121, 118, 52, 129, 255, 92, 175, - 220, 152, 185, 186, 149, 59, 155, 187, 251, 173, 234, 172, 173, 49, 136, - 37, 177, 46, 252, 103, 115, 45, 78, 85, 100, 82, 155, 114, 103, 115, - 63, 184, 169, 244, 109, 39, 173, 204, 4, 140, 228, 63, 155, 91, 253, - 84, 21, 166, 214, 142, 40, 124, 54, 247, 235, 137, 25, 74, 186, 24, - 196, 146, 237, 201, 67, 5, 207, 230, 114, 251, 2, 44, 48, 125, 28, - 196, 18, 114, 191, 128, 200, 200, 10, 196, 18, 43, 16, 75, 172, 254, - 136, 37, 112, 190, 132, 98, 73, 36, 152, 227, 244, 35, 206, 230, 34, - 218, 9, 204, 113, 250, 17, 103, 115, 85, 177, 36, 12, 196, 18, 110, - 77, 120, 38, 152, 227, 84, 242, 158, 133, 207, 230, 86, 157, 161, 58, - 83, 216, 27, 204, 113, 6, 68, 112, 231, 17, 7, 139, 102, 136, 224, - 142, 188, 121, 162, 233, 184, 239, 123, 120, 54, 23, 207, 207, 147, 240, - 250, 51, 60, 155, 203, 55, 63, 23, 177, 247, 15, 181, 234, 27, 129, - 207, 230, 58, 95, 99, 105, 16, 75, 6, 12, 140, 20, 60, 155, 219, - 241, 127, 220, 217, 220, 235, 31, 209, 221, 199, 199, 233, 195, 85, 101, - 2, 231, 107, 179, 104, 235, 55, 145, 248, 108, 110, 215, 44, 180, 174, - 123, 154, 238, 187, 82, 104, 93, 247, 28, 125, 207, 42, 18, 159, 205, - 61, 248, 9, 157, 175, 189, 76, 47, 184, 38, 240, 59, 178, 96, 142, - 227, 145, 205, 157, 205, 157, 251, 62, 130, 181, 213, 77, 122, 191, 68, - 72, 223, 92, 250, 84, 17, 119, 54, 247, 98, 1, 119, 54, 247, 250, - 61, 254, 190, 70, 209, 15, 232, 252, 134, 220, 217, 220, 49, 243, 35, - 216, 115, 204, 79, 232, 71, 249, 252, 107, 254, 181, 65, 44, 249, 215, - 45, 28, 159, 205, 237, 192, 254, 222, 109, 125, 16, 75, 254, 110, 207, - 127, 102, 244, 49, 200, 75, 102, 47, 155, 133, 207, 230, 158, 106, 175, - 242, 171, 183, 32, 47, 177, 206, 153, 46, 112, 174, 247, 11, 93, 119, - 23, 119, 54, 183, 235, 180, 233, 248, 108, 238, 8, 55, 129, 243, 181, - 32, 47, 177, 252, 139, 59, 155, 59, 113, 33, 119, 54, 55, 227, 152, - 240, 217, 220, 65, 125, 185, 179, 185, 94, 155, 185, 179, 185, 67, 94, - 11, 159, 205, 109, 90, 97, 38, 62, 155, 107, 177, 69, 69, 155, 128, - 88, 82, 217, 113, 150, 84, 104, 142, 179, 32, 142, 59, 155, 107, 28, - 48, 155, 61, 3, 93, 157, 249, 89, 71, 248, 108, 46, 183, 239, 195, - 2, 211, 48, 47, 33, 247, 131, 136, 140, 102, 129, 88, 50, 11, 196, - 146, 89, 127, 238, 101, 119, 228, 106, 100, 158, 17, 129, 98, 73, 87, - 161, 26, 25, 119, 54, 87, 2, 250, 38, 118, 20, 174, 145, 193, 118, - 184, 126, 213, 137, 88, 139, 233, 104, 192, 181, 152, 78, 68, 253, 10, - 208, 80, 166, 50, 186, 68, 26, 112, 45, 134, 144, 1, 245, 70, 186, - 80, 145, 6, 92, 139, 233, 88, 102, 45, 134, 149, 145, 19, 97, 192, - 181, 152, 142, 129, 6, 93, 191, 132, 54, 54, 228, 250, 37, 21, 25, - 104, 208, 245, 75, 104, 59, 67, 174, 95, 66, 156, 224, 187, 133, 231, - 2, 63, 112, 20, 194, 12, 119, 54, 55, 39, 60, 80, 236, 57, 95, - 24, 51, 176, 29, 190, 147, 55, 156, 227, 175, 152, 103, 56, 204, 120, - 18, 50, 114, 192, 59, 229, 176, 114, 66, 230, 25, 14, 51, 144, 47, - 214, 3, 208, 88, 151, 121, 134, 195, 140, 231, 124, 117, 204, 64, 153, - 202, 181, 140, 185, 134, 195, 12, 180, 187, 33, 215, 47, 67, 230, 25, - 118, 253, 82, 52, 207, 176, 235, 151, 208, 118, 134, 92, 191, 132, 56, - 65, 152, 201, 153, 9, 252, 32, 66, 8, 51, 220, 217, 220, 248, 57, - 160, 239, 108, 97, 204, 192, 118, 248, 110, 225, 57, 28, 255, 196, 48, - 253, 48, 227, 89, 235, 43, 119, 183, 48, 33, 35, 30, 188, 83, 60, - 43, 199, 46, 76, 63, 204, 132, 121, 158, 193, 247, 164, 66, 190, 88, - 15, 64, 35, 93, 228, 179, 244, 195, 140, 229, 198, 57, 248, 247, 253, - 204, 103, 171, 99, 6, 202, 84, 234, 58, 75, 63, 204, 68, 79, 228, - 48, 3, 237, 174, 237, 172, 42, 180, 41, 199, 91, 243, 127, 127, 236, - 221, 226, 225, 7, 237, 87, 94, 126, 208, 158, 218, 248, 65, 91, 149, - 151, 159, 39, 15, 63, 104, 23, 93, 249, 33, 204, 64, 156, 224, 223, - 74, 153, 6, 232, 185, 2, 152, 33, 206, 230, 122, 130, 190, 57, 211, - 133, 49, 3, 219, 225, 49, 96, 6, 199, 223, 103, 186, 225, 198, 25, - 200, 23, 143, 1, 128, 134, 50, 149, 51, 131, 80, 195, 141, 51, 158, - 132, 12, 168, 55, 210, 69, 22, 106, 184, 113, 6, 242, 85, 251, 173, - 20, 86, 134, 121, 168, 225, 198, 25, 104, 119, 67, 142, 51, 208, 198, - 134, 28, 103, 100, 161, 134, 29, 103, 204, 67, 13, 59, 206, 40, 113, - 130, 246, 56, 4, 3, 63, 152, 41, 132, 25, 110, 15, 179, 57, 232, - 43, 153, 42, 140, 25, 216, 14, 143, 1, 33, 28, 255, 148, 41, 134, - 195, 12, 228, 139, 231, 26, 224, 157, 160, 76, 229, 92, 99, 138, 225, - 48, 3, 249, 226, 57, 19, 160, 145, 46, 57, 147, 13, 135, 25, 201, - 212, 50, 107, 254, 83, 85, 188, 125, 38, 27, 14, 51, 208, 238, 134, - 156, 207, 80, 83, 12, 59, 159, 129, 246, 52, 228, 124, 198, 103, 178, - 97, 231, 51, 16, 39, 24, 51, 19, 128, 31, 76, 211, 132, 153, 80, - 223, 41, 147, 102, 78, 86, 110, 250, 39, 190, 135, 15, 232, 171, 8, - 12, 20, 190, 3, 34, 152, 216, 247, 21, 196, 181, 151, 79, 10, 212, - 241, 60, 187, 169, 70, 63, 24, 113, 230, 73, 10, 222, 247, 21, 68, - 236, 251, 2, 52, 148, 169, 244, 185, 137, 129, 58, 158, 103, 215, 44, - 227, 88, 250, 90, 123, 172, 7, 33, 3, 234, 141, 116, 145, 5, 4, - 234, 120, 158, 93, 179, 12, 215, 253, 215, 113, 110, 6, 249, 170, 221, - 1, 193, 202, 240, 241, 15, 212, 241, 60, 187, 102, 25, 182, 7, 84, - 191, 189, 92, 196, 218, 221, 90, 217, 82, 117, 174, 8, 218, 17, 249, - 16, 162, 67, 29, 151, 208, 220, 115, 205, 113, 87, 209, 170, 62, 35, - 251, 22, 197, 254, 182, 114, 63, 6, 181, 175, 248, 221, 155, 9, 110, - 145, 196, 219, 183, 88, 236, 199, 188, 92, 94, 133, 253, 61, 244, 96, - 166, 176, 175, 175, 146, 174, 252, 121, 46, 211, 249, 112, 42, 239, 239, - 164, 255, 92, 24, 203, 28, 95, 60, 211, 70, 245, 116, 37, 166, 219, - 228, 175, 39, 158, 107, 31, 123, 138, 88, 191, 32, 109, 0, 191, 51, - 178, 1, 162, 161, 13, 184, 231, 218, 109, 208, 100, 102, 91, 7, 100, - 3, 212, 30, 218, 192, 117, 209, 40, 123, 33, 27, 204, 60, 124, 56, - 5, 217, 32, 54, 171, 118, 42, 178, 193, 145, 154, 147, 82, 133, 108, - 112, 194, 164, 233, 62, 100, 3, 68, 67, 27, 112, 207, 249, 109, 0, - 253, 22, 217, 224, 59, 176, 1, 244, 67, 100, 3, 68, 223, 234, 180, - 132, 230, 158, 107, 230, 39, 105, 89, 159, 73, 173, 49, 197, 13, 217, - 0, 181, 247, 1, 54, 184, 94, 146, 192, 219, 119, 45, 176, 193, 186, - 51, 165, 153, 200, 6, 63, 7, 171, 246, 181, 124, 253, 52, 151, 249, - 154, 185, 131, 119, 109, 241, 43, 176, 129, 255, 29, 159, 12, 100, 3, - 68, 183, 4, 54, 224, 158, 243, 219, 0, 226, 138, 244, 3, 136, 19, - 100, 3, 68, 67, 63, 224, 158, 107, 247, 131, 2, 92, 87, 239, 199, - 160, 246, 74, 63, 200, 227, 239, 11, 253, 32, 44, 44, 18, 255, 150, - 228, 213, 125, 42, 26, 250, 193, 149, 18, 254, 220, 7, 250, 1, 55, - 175, 88, 137, 105, 232, 7, 34, 129, 223, 131, 196, 99, 192, 4, 98, - 175, 164, 47, 136, 107, 193, 188, 99, 128, 131, 218, 24, 0, 250, 42, - 198, 233, 48, 6, 76, 32, 98, 231, 120, 174, 125, 200, 184, 64, 189, - 238, 52, 137, 153, 180, 192, 14, 199, 206, 241, 196, 24, 0, 104, 40, - 83, 217, 104, 92, 160, 94, 119, 154, 76, 72, 110, 159, 138, 245, 32, - 100, 64, 189, 145, 46, 241, 126, 129, 122, 221, 105, 114, 126, 113, 40, - 119, 63, 215, 184, 50, 99, 0, 43, 67, 226, 23, 168, 215, 157, 38, - 38, 43, 136, 123, 128, 198, 105, 159, 175, 66, 155, 150, 119, 254, 43, - 226, 225, 7, 237, 87, 94, 126, 208, 158, 218, 248, 65, 91, 149, 151, - 159, 132, 135, 31, 180, 75, 121, 231, 231, 16, 39, 120, 237, 100, 52, - 240, 131, 9, 188, 152, 233, 72, 98, 70, 2, 250, 74, 198, 10, 99, - 6, 182, 195, 243, 0, 31, 98, 237, 196, 71, 63, 204, 92, 75, 119, - 193, 254, 12, 249, 98, 25, 224, 157, 160, 76, 229, 124, 102, 140, 126, - 152, 89, 30, 249, 13, 231, 77, 144, 47, 158, 107, 0, 26, 233, 66, - 141, 209, 15, 51, 169, 55, 219, 225, 251, 230, 36, 99, 203, 204, 53, - 88, 251, 230, 140, 214, 15, 51, 207, 6, 19, 191, 151, 229, 163, 221, - 135, 160, 77, 203, 235, 147, 208, 198, 218, 248, 65, 251, 149, 151, 31, - 197, 195, 15, 218, 170, 188, 252, 160, 237, 180, 241, 131, 118, 41, 47, - 102, 32, 78, 240, 218, 201, 112, 224, 7, 190, 188, 152, 233, 68, 98, - 38, 103, 84, 160, 216, 115, 164, 48, 102, 96, 59, 92, 111, 26, 69, - 172, 157, 140, 208, 15, 51, 48, 175, 196, 245, 38, 66, 70, 14, 120, - 167, 28, 86, 78, 200, 8, 253, 48, 3, 243, 54, 172, 199, 72, 66, - 15, 64, 99, 93, 70, 232, 135, 25, 152, 23, 97, 61, 70, 150, 89, - 59, 97, 237, 27, 63, 92, 63, 204, 64, 159, 192, 107, 39, 35, 136, - 115, 44, 84, 7, 57, 151, 159, 203, 164, 136, 142, 79, 219, 79, 233, - 146, 183, 187, 176, 54, 38, 249, 113, 185, 174, 76, 138, 104, 200, 79, - 151, 28, 216, 133, 181, 39, 254, 205, 58, 186, 131, 156, 203, 27, 101, - 82, 68, 123, 2, 126, 186, 228, 147, 46, 172, 237, 200, 247, 227, 240, - 1, 255, 85, 209, 240, 253, 116, 205, 205, 32, 78, 240, 218, 137, 23, - 240, 131, 209, 188, 152, 113, 36, 49, 19, 63, 12, 244, 29, 42, 140, - 25, 216, 14, 175, 57, 12, 35, 214, 78, 134, 232, 135, 25, 114, 126, - 110, 78, 200, 136, 7, 239, 20, 207, 202, 177, 27, 162, 31, 102, 200, - 249, 57, 228, 139, 245, 0, 52, 210, 69, 238, 173, 31, 102, 200, 249, - 185, 249, 208, 50, 107, 39, 172, 125, 61, 189, 245, 195, 12, 154, 159, - 187, 176, 118, 199, 191, 203, 232, 35, 150, 135, 228, 118, 119, 44, 59, - 63, 239, 151, 184, 129, 90, 245, 35, 232, 176, 78, 107, 39, 101, 248, - 205, 152, 242, 219, 177, 236, 92, 23, 242, 75, 219, 106, 121, 68, 167, - 181, 19, 111, 98, 92, 248, 75, 44, 247, 218, 218, 205, 173, 236, 188, - 209, 243, 214, 6, 234, 95, 219, 20, 103, 157, 214, 78, 8, 126, 41, - 99, 197, 242, 42, 107, 162, 254, 152, 131, 237, 218, 190, 129, 10, 250, - 107, 142, 78, 53, 45, 136, 19, 124, 223, 156, 39, 160, 135, 243, 98, - 166, 51, 137, 25, 79, 208, 55, 103, 144, 48, 102, 96, 59, 60, 6, - 12, 38, 230, 51, 127, 233, 138, 153, 10, 90, 98, 39, 49, 150, 13, - 38, 198, 0, 64, 67, 153, 74, 127, 110, 172, 43, 102, 132, 101, 120, - 18, 50, 160, 222, 72, 23, 159, 70, 186, 98, 70, 7, 61, 6, 149, - 89, 59, 65, 246, 106, 168, 43, 102, 42, 240, 142, 51, 237, 140, 84, - 118, 183, 86, 182, 4, 152, 108, 211, 78, 174, 94, 87, 86, 253, 7, - 127, 75, 141, 47, 87, 129, 113, 87, 62, 176, 132, 138, 166, 87, 28, - 98, 51, 109, 26, 253, 127, 73, 158, 47, 13, 158, 119, 228, 235, 91, - 84, 59, 142, 254, 210, 137, 98, 177, 149, 132, 235, 103, 181, 95, 158, - 163, 199, 109, 11, 56, 204, 215, 247, 109, 189, 66, 122, 229, 194, 84, - 22, 127, 166, 204, 133, 201, 11, 148, 180, 73, 73, 37, 38, 253, 74, - 224, 17, 190, 190, 165, 38, 53, 24, 174, 86, 103, 129, 233, 144, 23, - 86, 140, 80, 13, 15, 217, 15, 250, 148, 161, 236, 215, 183, 81, 183, - 116, 77, 246, 3, 207, 59, 9, 217, 239, 253, 209, 98, 108, 63, 20, - 155, 160, 253, 46, 93, 174, 115, 68, 200, 126, 178, 69, 254, 71, 145, - 253, 190, 188, 183, 57, 138, 236, 215, 112, 162, 229, 81, 33, 251, 113, - 117, 62, 11, 76, 67, 251, 9, 213, 255, 144, 253, 32, 94, 144, 253, - 86, 104, 177, 223, 52, 29, 236, 183, 215, 179, 132, 26, 231, 114, 43, - 179, 172, 253, 154, 222, 243, 165, 31, 186, 243, 255, 182, 231, 133, 58, - 113, 180, 243, 221, 46, 110, 200, 126, 40, 22, 119, 252, 124, 142, 158, - 117, 224, 51, 239, 249, 153, 234, 245, 11, 233, 3, 123, 173, 78, 34, - 251, 117, 152, 116, 87, 185, 31, 249, 65, 133, 202, 204, 49, 251, 19, - 188, 251, 154, 39, 152, 214, 96, 184, 26, 161, 5, 166, 239, 23, 88, - 49, 66, 181, 67, 100, 63, 24, 11, 212, 253, 239, 207, 188, 73, 229, - 127, 252, 121, 19, 244, 191, 71, 183, 35, 165, 156, 253, 84, 237, 219, - 2, 255, 139, 183, 224, 239, 91, 217, 34, 142, 174, 184, 36, 10, 239, - 107, 70, 99, 207, 56, 224, 127, 179, 38, 205, 225, 223, 7, 106, 89, - 72, 23, 126, 24, 139, 247, 144, 54, 58, 31, 160, 164, 251, 1, 255, - 27, 226, 23, 200, 255, 91, 56, 192, 126, 92, 125, 209, 2, 211, 19, - 128, 255, 9, 213, 29, 241, 253, 77, 158, 220, 152, 71, 89, 130, 56, - 238, 197, 59, 230, 117, 37, 199, 188, 16, 208, 87, 86, 95, 120, 204, - 131, 237, 80, 28, 151, 53, 224, 218, 155, 215, 55, 220, 220, 10, 242, - 197, 99, 5, 160, 161, 76, 101, 46, 106, 101, 184, 185, 149, 136, 144, - 1, 245, 70, 186, 216, 89, 25, 110, 110, 5, 249, 146, 99, 158, 136, - 149, 33, 183, 52, 220, 220, 10, 218, 93, 223, 185, 149, 218, 25, 124, - 43, 253, 231, 86, 106, 121, 167, 149, 254, 115, 43, 181, 188, 211, 82, - 255, 185, 21, 153, 39, 66, 156, 32, 204, 136, 106, 5, 138, 139, 60, - 121, 49, 211, 141, 196, 140, 188, 94, 160, 152, 170, 43, 140, 25, 216, - 14, 249, 1, 85, 143, 107, 239, 89, 71, 87, 204, 152, 104, 244, 3, - 247, 71, 219, 241, 188, 135, 34, 100, 200, 193, 59, 201, 89, 57, 62, - 22, 186, 98, 70, 179, 140, 156, 254, 94, 105, 88, 143, 186, 132, 30, - 128, 70, 186, 132, 212, 214, 21, 51, 154, 101, 248, 72, 215, 226, 123, - 53, 168, 186, 234, 152, 145, 179, 246, 149, 213, 210, 21, 51, 154, 101, - 28, 174, 52, 83, 137, 153, 116, 214, 238, 214, 202, 150, 34, 209, 143, - 197, 77, 165, 208, 142, 200, 135, 16, 221, 243, 214, 110, 226, 185, 230, - 184, 155, 209, 40, 79, 106, 92, 247, 52, 106, 67, 189, 217, 115, 65, - 73, 59, 166, 140, 163, 190, 46, 123, 106, 207, 231, 127, 143, 90, 29, - 160, 56, 254, 10, 76, 59, 44, 52, 163, 133, 228, 34, 61, 224, 183, - 37, 245, 128, 223, 10, 233, 129, 104, 168, 7, 247, 92, 187, 30, 57, - 43, 34, 80, 27, 170, 223, 251, 232, 52, 164, 135, 91, 215, 117, 105, - 66, 122, 112, 252, 21, 152, 134, 122, 8, 201, 69, 122, 64, 255, 65, - 122, 44, 91, 217, 84, 10, 253, 1, 233, 129, 232, 43, 55, 119, 19, - 207, 181, 140, 191, 198, 121, 210, 133, 39, 83, 81, 27, 234, 68, 254, - 17, 37, 157, 249, 207, 56, 202, 104, 112, 78, 54, 159, 30, 121, 214, - 7, 40, 142, 191, 2, 211, 135, 22, 152, 209, 66, 114, 145, 30, 208, - 71, 145, 30, 219, 150, 52, 149, 66, 159, 67, 122, 32, 250, 76, 222, - 110, 226, 185, 102, 126, 222, 13, 242, 164, 147, 75, 167, 162, 54, 212, - 127, 141, 84, 244, 143, 3, 227, 40, 31, 121, 32, 111, 92, 219, 1, - 190, 7, 199, 95, 129, 233, 230, 224, 123, 8, 201, 69, 49, 17, 198, - 65, 124, 63, 87, 127, 128, 115, 75, 190, 152, 104, 111, 71, 198, 68, - 89, 205, 64, 113, 226, 64, 225, 152, 8, 219, 97, 156, 215, 36, 214, - 53, 6, 234, 151, 71, 60, 186, 102, 138, 99, 162, 136, 144, 33, 51, - 7, 99, 60, 43, 71, 62, 64, 191, 60, 194, 216, 246, 0, 94, 59, - 129, 124, 241, 218, 9, 124, 119, 86, 134, 231, 0, 253, 242, 136, 13, - 212, 39, 188, 22, 8, 249, 146, 49, 17, 202, 84, 126, 221, 254, 250, - 229, 17, 22, 118, 92, 189, 9, 218, 93, 91, 157, 31, 218, 180, 188, - 235, 6, 208, 198, 218, 248, 65, 251, 149, 151, 159, 39, 15, 63, 104, - 171, 242, 242, 131, 182, 211, 198, 15, 218, 165, 188, 235, 26, 16, 39, - 248, 126, 174, 222, 224, 187, 212, 226, 197, 140, 218, 30, 42, 69, 191, - 64, 177, 79, 95, 97, 204, 192, 118, 120, 109, 187, 31, 113, 63, 87, - 31, 195, 229, 222, 62, 132, 12, 5, 120, 39, 5, 43, 71, 214, 199, - 112, 185, 55, 228, 139, 245, 0, 52, 210, 197, 188, 143, 225, 114, 111, - 159, 190, 101, 238, 231, 98, 237, 155, 216, 219, 112, 185, 55, 180, 187, - 33, 215, 53, 100, 125, 12, 187, 174, 97, 222, 199, 176, 235, 26, 208, - 118, 134, 92, 215, 128, 56, 193, 251, 14, 123, 0, 63, 232, 207, 139, - 25, 181, 61, 39, 137, 189, 2, 197, 18, 15, 97, 204, 192, 118, 120, - 221, 185, 23, 177, 87, 215, 93, 63, 204, 236, 147, 89, 226, 49, 64, - 66, 200, 72, 4, 239, 148, 200, 202, 161, 220, 245, 195, 76, 161, 201, - 69, 110, 253, 220, 131, 208, 3, 208, 72, 151, 156, 158, 250, 97, 38, - 41, 185, 42, 183, 126, 238, 81, 102, 253, 156, 181, 175, 79, 79, 253, - 48, 179, 98, 115, 56, 183, 87, 215, 93, 123, 220, 133, 54, 45, 247, - 122, 55, 15, 63, 104, 191, 114, 175, 119, 247, 212, 206, 15, 218, 170, - 188, 252, 124, 120, 248, 65, 187, 148, 119, 156, 129, 56, 65, 152, 145, - 81, 192, 15, 122, 107, 192, 204, 4, 223, 80, 248, 195, 83, 51, 216, - 205, 186, 120, 15, 17, 232, 171, 96, 116, 216, 167, 213, 131, 24, 3, - 186, 19, 227, 12, 173, 223, 124, 245, 171, 127, 50, 183, 199, 181, 59, - 49, 6, 0, 26, 202, 84, 49, 208, 111, 190, 218, 212, 249, 45, 206, - 155, 124, 8, 25, 80, 111, 164, 139, 93, 13, 253, 230, 171, 143, 186, - 155, 74, 177, 30, 76, 153, 125, 90, 172, 12, 170, 186, 126, 243, 85, - 239, 38, 195, 240, 124, 21, 218, 29, 205, 43, 224, 254, 68, 104, 71, - 228, 55, 136, 30, 244, 247, 2, 154, 123, 174, 57, 238, 62, 76, 53, - 99, 102, 20, 61, 96, 219, 244, 99, 80, 251, 186, 111, 198, 51, 75, - 46, 173, 227, 237, 251, 125, 73, 20, 51, 117, 127, 33, 91, 123, 94, - 137, 233, 132, 211, 127, 19, 207, 249, 231, 71, 34, 66, 143, 111, 64, - 15, 248, 173, 144, 30, 136, 222, 4, 244, 224, 158, 107, 230, 183, 52, - 205, 140, 169, 61, 122, 1, 254, 221, 12, 212, 254, 9, 208, 99, 203, - 174, 16, 222, 190, 166, 75, 163, 152, 230, 14, 238, 110, 72, 15, 68, - 199, 3, 61, 184, 231, 252, 122, 64, 255, 65, 122, 124, 0, 122, 64, - 127, 192, 185, 50, 75, 215, 219, 178, 128, 230, 158, 107, 230, 151, 126, - 200, 140, 249, 247, 131, 20, 239, 23, 69, 237, 169, 119, 227, 153, 231, - 103, 242, 120, 223, 165, 30, 208, 195, 105, 177, 35, 254, 30, 136, 142, - 2, 122, 112, 207, 249, 245, 128, 62, 138, 235, 7, 64, 15, 232, 115, - 72, 15, 68, 143, 1, 223, 131, 123, 174, 153, 223, 79, 224, 87, 87, - 77, 123, 97, 61, 80, 251, 110, 224, 123, 4, 196, 143, 225, 223, 247, - 10, 252, 170, 75, 229, 121, 120, 239, 42, 162, 55, 0, 61, 184, 231, - 252, 121, 4, 140, 131, 184, 134, 87, 5, 224, 188, 7, 127, 76, 116, - 32, 235, 75, 102, 96, 126, 91, 77, 135, 26, 158, 25, 81, 251, 50, - 227, 218, 231, 84, 213, 47, 143, 200, 74, 94, 134, 199, 95, 138, 144, - 33, 7, 239, 36, 103, 229, 248, 84, 213, 47, 143, 24, 172, 136, 199, - 245, 53, 200, 23, 235, 1, 104, 164, 75, 81, 21, 253, 242, 136, 152, - 167, 117, 113, 76, 164, 170, 149, 169, 225, 177, 246, 149, 85, 209, 47, - 143, 216, 188, 191, 19, 206, 35, 160, 221, 181, 141, 171, 208, 166, 229, - 30, 167, 121, 248, 65, 251, 149, 151, 31, 180, 167, 214, 189, 181, 192, - 86, 229, 229, 39, 227, 225, 7, 237, 82, 222, 60, 2, 226, 4, 255, - 110, 65, 133, 64, 49, 196, 16, 31, 102, 58, 146, 245, 135, 202, 160, - 109, 37, 29, 106, 60, 149, 9, 63, 168, 204, 181, 143, 23, 235, 135, - 25, 89, 225, 255, 48, 102, 68, 132, 12, 25, 120, 39, 25, 43, 71, - 34, 214, 15, 51, 155, 54, 137, 79, 98, 61, 42, 17, 122, 64, 189, - 89, 25, 41, 21, 245, 195, 204, 3, 207, 35, 156, 30, 149, 202, 212, - 120, 88, 251, 82, 21, 245, 195, 76, 252, 137, 86, 24, 51, 208, 238, - 218, 124, 8, 218, 180, 188, 62, 41, 225, 225, 7, 237, 87, 94, 126, - 208, 158, 218, 248, 65, 91, 149, 123, 110, 192, 195, 15, 218, 165, 188, - 152, 129, 56, 193, 185, 183, 17, 248, 46, 85, 248, 49, 211, 137, 144, - 77, 129, 190, 114, 19, 97, 204, 192, 118, 120, 12, 48, 37, 214, 138, - 76, 244, 195, 204, 191, 189, 250, 98, 95, 131, 124, 241, 24, 0, 104, - 40, 83, 89, 35, 49, 214, 15, 51, 37, 155, 190, 227, 252, 158, 34, - 100, 64, 189, 145, 46, 33, 198, 250, 97, 166, 198, 254, 255, 112, 126, - 15, 249, 146, 152, 161, 144, 189, 140, 245, 195, 76, 147, 248, 48, 140, - 25, 104, 119, 109, 62, 4, 109, 170, 139, 15, 145, 53, 20, 104, 99, - 109, 252, 160, 253, 202, 203, 47, 132, 135, 31, 180, 85, 121, 249, 137, - 120, 248, 65, 187, 232, 202, 15, 231, 102, 70, 68, 141, 167, 29, 240, - 131, 10, 252, 152, 113, 36, 101, 131, 190, 146, 14, 194, 152, 129, 237, - 240, 24, 32, 34, 106, 60, 182, 250, 97, 134, 156, 175, 66, 190, 184, - 198, 3, 223, 201, 136, 141, 207, 182, 250, 97, 134, 156, 175, 66, 190, - 184, 198, 3, 104, 164, 75, 78, 123, 253, 48, 67, 206, 87, 37, 29, - 202, 212, 120, 88, 251, 250, 180, 215, 15, 51, 104, 190, 234, 194, 218, - 29, 249, 80, 142, 175, 88, 222, 114, 235, 138, 63, 230, 171, 223, 35, - 79, 82, 59, 102, 228, 185, 234, 20, 199, 9, 126, 149, 198, 137, 229, - 3, 91, 159, 251, 99, 222, 24, 15, 248, 85, 221, 87, 55, 91, 167, - 26, 79, 123, 142, 159, 221, 26, 177, 60, 226, 86, 190, 91, 217, 249, - 219, 217, 169, 39, 169, 61, 63, 90, 73, 117, 202, 29, 9, 126, 150, - 19, 196, 242, 255, 242, 199, 252, 49, 143, 122, 22, 113, 146, 138, 24, - 214, 95, 183, 243, 216, 237, 8, 204, 88, 3, 63, 48, 226, 199, 76, - 103, 178, 254, 0, 250, 42, 218, 234, 80, 227, 105, 71, 212, 70, 108, - 136, 243, 216, 109, 244, 59, 143, 173, 182, 94, 97, 67, 212, 120, 0, - 13, 101, 42, 125, 174, 181, 126, 231, 177, 213, 244, 32, 100, 64, 189, - 145, 46, 178, 86, 250, 157, 199, 86, 211, 163, 109, 153, 26, 15, 43, - 195, 167, 165, 126, 231, 177, 209, 90, 66, 17, 107, 119, 116, 6, 53, - 78, 203, 222, 193, 1, 58, 236, 29, 172, 232, 89, 66, 45, 202, 247, - 255, 99, 239, 224, 140, 60, 95, 250, 224, 3, 127, 222, 186, 192, 249, - 218, 113, 116, 141, 84, 132, 213, 36, 92, 79, 26, 84, 114, 157, 54, - 9, 203, 227, 173, 15, 173, 168, 37, 98, 184, 250, 147, 5, 166, 79, - 109, 177, 97, 132, 234, 82, 248, 60, 118, 107, 206, 6, 43, 181, 216, - 96, 164, 14, 54, 240, 0, 54, 72, 76, 77, 116, 41, 107, 131, 51, - 192, 6, 75, 210, 19, 121, 239, 37, 217, 10, 108, 176, 157, 57, 135, - 239, 91, 71, 241, 165, 43, 176, 65, 250, 254, 186, 188, 251, 0, 150, - 1, 27, 112, 181, 43, 11, 76, 67, 27, 8, 213, 180, 240, 121, 236, - 86, 156, 13, 70, 107, 177, 193, 248, 52, 97, 27, 56, 140, 40, 161, - 236, 141, 15, 101, 149, 181, 193, 141, 103, 190, 244, 114, 230, 16, 239, - 247, 216, 104, 22, 71, 159, 255, 144, 143, 247, 144, 162, 152, 232, 246, - 253, 58, 189, 252, 103, 43, 222, 154, 140, 4, 216, 128, 171, 123, 89, - 96, 58, 19, 216, 64, 168, 30, 134, 207, 99, 183, 228, 108, 176, 66, - 203, 62, 208, 80, 29, 246, 129, 30, 2, 126, 48, 220, 39, 230, 143, - 125, 160, 189, 238, 250, 210, 117, 164, 252, 123, 57, 71, 3, 63, 8, - 184, 51, 6, 239, 3, 69, 113, 188, 26, 240, 131, 162, 161, 253, 121, - 251, 198, 2, 27, 112, 53, 51, 11, 76, 67, 63, 16, 170, 165, 225, - 49, 192, 154, 56, 143, 221, 20, 196, 181, 118, 252, 99, 64, 87, 50, - 62, 129, 190, 138, 230, 58, 140, 1, 214, 68, 236, 108, 65, 156, 95, - 104, 174, 95, 222, 4, 235, 193, 56, 118, 182, 32, 198, 0, 64, 67, - 153, 202, 70, 205, 245, 203, 155, 96, 173, 22, 235, 65, 200, 128, 122, - 35, 93, 226, 155, 233, 151, 55, 193, 58, 42, 214, 163, 121, 153, 49, - 128, 149, 33, 105, 166, 95, 222, 4, 107, 156, 56, 151, 111, 206, 229, - 17, 241, 62, 187, 229, 92, 93, 93, 38, 69, 180, 220, 162, 34, 205, - 87, 111, 87, 59, 143, 77, 240, 147, 249, 238, 150, 115, 245, 109, 153, - 20, 209, 150, 128, 31, 95, 221, 91, 237, 60, 118, 51, 142, 31, 53, - 110, 183, 156, 171, 51, 203, 164, 136, 126, 89, 171, 34, 205, 87, 127, - 86, 171, 31, 16, 252, 82, 128, 190, 92, 189, 87, 38, 69, 116, 18, - 120, 63, 190, 58, 176, 218, 121, 236, 166, 68, 77, 43, 7, 248, 129, - 53, 63, 102, 186, 17, 223, 67, 2, 250, 74, 62, 232, 112, 30, 187, - 41, 49, 15, 144, 16, 251, 150, 100, 122, 238, 91, 90, 83, 11, 207, - 53, 32, 95, 44, 3, 240, 133, 50, 149, 243, 153, 34, 253, 48, 179, - 181, 225, 99, 78, 134, 140, 152, 107, 0, 189, 145, 46, 84, 145, 126, - 152, 241, 120, 189, 158, 187, 251, 233, 67, 153, 185, 6, 107, 35, 234, - 134, 126, 152, 153, 229, 74, 236, 91, 146, 241, 236, 91, 2, 54, 45, - 239, 252, 23, 218, 88, 27, 63, 104, 191, 242, 242, 163, 120, 248, 65, - 91, 149, 155, 223, 13, 237, 252, 160, 93, 202, 59, 63, 135, 56, 65, - 152, 9, 145, 4, 137, 19, 155, 242, 98, 70, 185, 217, 15, 215, 91, - 64, 95, 74, 161, 67, 77, 43, 135, 168, 55, 61, 38, 206, 99, 167, - 234, 135, 153, 108, 199, 5, 220, 218, 201, 99, 162, 222, 4, 222, 9, - 202, 84, 142, 101, 169, 250, 97, 230, 212, 241, 177, 120, 12, 128, 124, - 177, 30, 80, 6, 210, 37, 85, 207, 113, 102, 103, 33, 167, 135, 162, - 204, 218, 9, 107, 223, 248, 20, 253, 48, 51, 33, 117, 56, 119, 30, - 59, 85, 187, 15, 65, 155, 150, 183, 206, 26, 194, 195, 15, 218, 175, - 188, 252, 68, 60, 252, 160, 173, 202, 203, 15, 218, 78, 235, 189, 36, - 192, 46, 229, 173, 3, 67, 156, 224, 123, 57, 69, 65, 98, 121, 14, - 63, 102, 200, 61, 24, 137, 118, 160, 175, 81, 144, 240, 190, 37, 208, - 14, 255, 86, 178, 57, 215, 222, 211, 55, 72, 175, 61, 24, 100, 110, - 6, 249, 226, 223, 124, 6, 52, 148, 169, 204, 109, 124, 130, 244, 218, - 131, 65, 230, 102, 118, 132, 12, 168, 55, 210, 69, 70, 7, 233, 181, - 7, 131, 204, 205, 32, 95, 181, 223, 124, 102, 101, 196, 83, 65, 122, - 237, 193, 64, 185, 89, 58, 107, 119, 188, 230, 223, 35, 214, 77, 83, - 110, 86, 117, 207, 117, 169, 208, 94, 8, 207, 239, 245, 168, 115, 174, - 173, 88, 31, 166, 168, 21, 107, 157, 148, 244, 209, 235, 155, 169, 6, - 99, 103, 240, 230, 97, 45, 219, 63, 163, 56, 254, 230, 56, 15, 28, - 20, 212, 145, 214, 117, 15, 6, 252, 182, 72, 15, 151, 150, 177, 110, - 154, 114, 194, 46, 7, 175, 75, 133, 246, 66, 28, 104, 96, 73, 37, - 44, 104, 138, 245, 184, 62, 182, 161, 146, 110, 148, 179, 153, 170, 243, - 169, 26, 175, 30, 73, 29, 158, 81, 28, 127, 115, 156, 127, 46, 11, - 238, 72, 235, 186, 7, 3, 250, 15, 210, 99, 238, 224, 88, 55, 77, - 185, 104, 215, 127, 175, 75, 133, 246, 66, 108, 127, 81, 143, 154, 119, - 195, 14, 235, 113, 184, 66, 47, 37, 29, 7, 190, 135, 113, 98, 44, - 175, 30, 63, 108, 158, 81, 28, 127, 115, 156, 247, 158, 12, 236, 72, - 235, 186, 7, 3, 250, 40, 210, 163, 158, 117, 172, 155, 166, 28, 56, - 44, 245, 186, 84, 104, 47, 132, 125, 35, 75, 202, 51, 18, 253, 78, - 5, 69, 197, 175, 85, 253, 222, 69, 51, 240, 61, 34, 111, 133, 240, - 230, 207, 167, 192, 247, 224, 248, 155, 227, 124, 123, 61, 248, 30, 186, - 238, 193, 128, 113, 16, 197, 196, 20, 81, 176, 24, 198, 72, 190, 152, - 72, 238, 193, 144, 229, 4, 137, 139, 140, 131, 133, 215, 147, 115, 136, - 152, 168, 224, 248, 203, 52, 244, 45, 87, 157, 63, 221, 7, 231, 197, - 144, 47, 142, 137, 128, 134, 50, 149, 86, 209, 73, 134, 246, 60, 98, - 233, 254, 48, 44, 195, 142, 144, 1, 245, 70, 186, 36, 26, 5, 235, - 149, 71, 28, 9, 251, 136, 215, 18, 32, 95, 181, 152, 200, 202, 176, - 211, 73, 134, 246, 60, 226, 248, 16, 110, 47, 39, 180, 187, 182, 113, - 21, 218, 180, 188, 227, 180, 57, 15, 63, 104, 191, 242, 242, 131, 246, - 212, 198, 15, 218, 170, 188, 252, 236, 120, 248, 65, 187, 148, 55, 143, - 128, 56, 193, 231, 108, 250, 4, 139, 33, 134, 52, 98, 38, 116, 82, - 192, 68, 118, 51, 39, 254, 158, 160, 111, 226, 0, 97, 204, 192, 118, - 220, 249, 20, 174, 125, 74, 255, 96, 189, 242, 8, 133, 127, 50, 113, - 62, 133, 147, 33, 1, 52, 148, 169, 204, 93, 251, 5, 235, 149, 71, - 4, 56, 191, 197, 152, 145, 16, 50, 160, 222, 72, 151, 156, 190, 193, - 122, 229, 17, 15, 137, 181, 49, 200, 87, 237, 183, 87, 88, 25, 138, - 62, 193, 122, 229, 17, 94, 196, 94, 78, 104, 119, 114, 47, 39, 180, - 35, 242, 27, 68, 123, 254, 189, 128, 230, 158, 107, 142, 187, 247, 82, - 205, 152, 93, 209, 203, 216, 54, 253, 24, 212, 190, 214, 155, 241, 76, - 251, 211, 71, 120, 251, 194, 189, 156, 159, 198, 162, 122, 244, 74, 76, - 195, 189, 156, 220, 115, 254, 113, 11, 126, 91, 82, 15, 248, 173, 144, - 30, 136, 246, 2, 122, 112, 207, 53, 243, 83, 0, 61, 250, 159, 173, - 131, 239, 13, 69, 237, 173, 128, 30, 251, 7, 222, 18, 220, 147, 122, - 112, 80, 63, 87, 164, 7, 162, 161, 30, 220, 115, 126, 61, 160, 255, - 32, 61, 190, 0, 61, 30, 18, 123, 57, 17, 125, 22, 232, 241, 80, - 160, 118, 253, 46, 205, 140, 105, 117, 219, 30, 239, 129, 68, 237, 135, - 190, 29, 207, 56, 154, 63, 227, 205, 105, 170, 44, 141, 98, 190, 92, - 172, 128, 247, 164, 34, 122, 25, 208, 131, 123, 206, 175, 7, 244, 81, - 242, 123, 120, 17, 123, 57, 17, 61, 22, 232, 225, 37, 80, 127, 46, - 1, 223, 99, 78, 170, 7, 214, 3, 181, 119, 2, 223, 227, 68, 170, - 240, 94, 206, 7, 89, 220, 94, 78, 68, 195, 189, 156, 220, 115, 254, - 60, 2, 198, 65, 124, 142, 202, 29, 140, 141, 162, 96, 254, 152, 232, - 64, 156, 241, 233, 29, 44, 246, 233, 37, 28, 19, 97, 59, 92, 147, - 238, 205, 181, 47, 242, 208, 47, 143, 232, 221, 105, 30, 254, 173, 115, - 31, 66, 134, 2, 188, 147, 130, 149, 35, 243, 208, 47, 143, 120, 92, - 181, 29, 222, 203, 9, 249, 98, 61, 0, 141, 116, 49, 247, 208, 47, - 143, 88, 166, 216, 197, 213, 214, 123, 169, 199, 68, 5, 107, 223, 68, - 119, 253, 242, 136, 245, 49, 83, 184, 115, 84, 30, 218, 199, 85, 104, - 211, 242, 142, 211, 50, 30, 126, 208, 126, 229, 206, 75, 120, 248, 65, - 91, 149, 59, 47, 113, 215, 206, 15, 218, 165, 188, 121, 4, 196, 9, - 222, 47, 64, 3, 63, 232, 35, 128, 153, 142, 68, 61, 162, 103, 176, - 88, 210, 67, 24, 51, 176, 29, 30, 227, 123, 18, 121, 68, 119, 253, - 48, 115, 183, 105, 12, 246, 103, 9, 33, 35, 17, 188, 83, 34, 43, - 135, 234, 174, 31, 102, 206, 116, 120, 135, 253, 25, 242, 197, 122, 0, - 26, 233, 146, 195, 232, 135, 25, 199, 119, 151, 185, 115, 84, 61, 212, - 49, 147, 200, 218, 215, 135, 209, 15, 51, 89, 199, 164, 220, 30, 155, - 238, 218, 125, 8, 218, 180, 188, 62, 73, 241, 240, 131, 246, 43, 47, - 63, 104, 79, 109, 252, 160, 173, 202, 203, 207, 135, 135, 31, 180, 75, - 121, 49, 3, 113, 130, 115, 111, 87, 224, 7, 238, 2, 152, 233, 68, - 172, 253, 129, 190, 137, 82, 97, 204, 192, 118, 120, 12, 160, 184, 246, - 118, 82, 253, 48, 19, 186, 182, 18, 55, 6, 80, 196, 24, 0, 104, - 40, 83, 153, 123, 187, 233, 135, 153, 243, 117, 55, 114, 231, 168, 8, - 25, 80, 111, 164, 139, 167, 155, 126, 152, 73, 108, 31, 200, 205, 33, - 164, 234, 152, 241, 97, 101, 40, 92, 245, 195, 140, 223, 26, 226, 238, - 94, 169, 118, 31, 130, 54, 45, 239, 90, 12, 180, 177, 214, 251, 169, - 129, 253, 202, 203, 207, 147, 135, 31, 180, 85, 121, 249, 65, 219, 105, - 227, 7, 237, 82, 222, 181, 34, 136, 19, 156, 155, 117, 3, 126, 64, - 11, 96, 198, 145, 200, 27, 92, 128, 111, 58, 235, 144, 155, 185, 16, - 254, 236, 66, 228, 102, 78, 250, 97, 134, 156, 175, 250, 16, 50, 20, - 224, 157, 20, 172, 28, 153, 147, 126, 152, 33, 231, 171, 144, 47, 214, - 3, 208, 72, 23, 115, 39, 253, 48, 67, 206, 87, 125, 156, 203, 228, - 102, 172, 125, 19, 187, 233, 135, 25, 47, 98, 47, 39, 180, 59, 185, - 151, 211, 98, 235, 138, 63, 230, 171, 112, 47, 103, 236, 140, 188, 44, - 157, 114, 51, 130, 31, 220, 203, 185, 164, 245, 185, 63, 230, 141, 112, - 47, 103, 215, 125, 117, 117, 218, 147, 96, 78, 240, 131, 123, 57, 195, - 137, 189, 156, 15, 137, 189, 156, 73, 58, 238, 229, 132, 182, 35, 247, - 114, 222, 36, 246, 114, 122, 17, 123, 57, 195, 117, 220, 203, 9, 113, - 130, 49, 227, 0, 252, 192, 85, 0, 51, 157, 137, 188, 161, 43, 24, - 151, 186, 232, 144, 155, 117, 37, 114, 154, 174, 68, 251, 206, 193, 6, - 219, 203, 41, 33, 100, 36, 130, 119, 74, 100, 229, 40, 58, 5, 27, - 108, 47, 39, 228, 139, 245, 0, 52, 210, 69, 222, 49, 216, 96, 123, - 57, 37, 93, 202, 228, 102, 172, 125, 19, 29, 130, 13, 182, 151, 19, - 218, 221, 80, 123, 57, 39, 229, 251, 255, 177, 143, 17, 238, 229, 92, - 245, 192, 159, 119, 31, 35, 220, 203, 89, 154, 178, 2, 239, 99, 68, - 88, 133, 123, 57, 95, 204, 202, 227, 173, 241, 192, 189, 156, 92, 253, - 201, 2, 211, 112, 255, 154, 80, 93, 10, 217, 0, 250, 133, 161, 246, - 114, 94, 79, 77, 252, 99, 63, 43, 220, 203, 153, 145, 158, 200, 187, - 198, 2, 247, 114, 222, 103, 206, 225, 253, 172, 40, 190, 192, 189, 156, - 138, 253, 117, 121, 235, 42, 112, 47, 39, 87, 187, 178, 192, 52, 180, - 129, 80, 77, 11, 239, 233, 237, 24, 108, 176, 189, 156, 29, 180, 236, - 229, 92, 166, 195, 94, 206, 115, 196, 94, 206, 135, 196, 94, 206, 101, - 58, 236, 229, 124, 72, 236, 229, 124, 72, 236, 229, 124, 168, 227, 94, - 78, 136, 171, 255, 31, 246, 114, 250, 19, 123, 57, 189, 136, 189, 156, - 239, 116, 216, 203, 233, 69, 236, 229, 244, 34, 246, 114, 122, 233, 184, - 151, 19, 198, 125, 124, 127, 251, 104, 16, 215, 186, 9, 140, 1, 93, - 137, 248, 100, 15, 98, 237, 88, 29, 198, 0, 123, 34, 118, 218, 19, - 115, 13, 59, 253, 242, 38, 88, 15, 198, 177, 147, 144, 145, 8, 248, - 38, 178, 114, 236, 198, 234, 151, 55, 193, 90, 45, 183, 239, 129, 144, - 1, 248, 34, 93, 228, 99, 244, 203, 155, 96, 29, 149, 251, 45, 146, - 50, 99, 0, 107, 35, 207, 49, 250, 229, 77, 176, 198, 137, 231, 26, - 118, 193, 196, 125, 235, 187, 229, 92, 93, 93, 38, 69, 244, 69, 139, - 138, 52, 95, 189, 93, 109, 237, 105, 108, 176, 218, 222, 80, 174, 190, - 45, 147, 34, 26, 238, 13, 229, 171, 123, 171, 221, 207, 53, 134, 227, - 103, 238, 183, 91, 206, 213, 153, 101, 82, 68, 167, 212, 174, 72, 243, - 213, 159, 213, 238, 231, 34, 248, 193, 189, 156, 92, 189, 87, 38, 69, - 52, 220, 203, 201, 87, 7, 86, 187, 191, 125, 52, 135, 153, 248, 225, - 192, 15, 28, 4, 48, 211, 141, 184, 91, 28, 244, 205, 25, 41, 140, - 25, 216, 14, 223, 123, 62, 138, 107, 239, 51, 82, 63, 204, 148, 100, - 54, 200, 226, 126, 139, 36, 152, 248, 45, 146, 96, 49, 148, 169, 156, - 207, 140, 208, 15, 51, 197, 15, 189, 178, 185, 223, 34, 33, 244, 0, - 239, 142, 116, 145, 141, 208, 15, 51, 84, 158, 59, 167, 199, 72, 117, - 204, 120, 178, 50, 204, 71, 232, 135, 153, 171, 47, 231, 112, 191, 125, - 59, 82, 251, 124, 21, 218, 180, 188, 243, 95, 104, 99, 109, 252, 160, - 253, 202, 203, 79, 198, 195, 15, 218, 170, 188, 252, 204, 121, 248, 65, - 187, 148, 119, 126, 14, 113, 130, 127, 143, 202, 27, 248, 193, 104, 126, - 204, 192, 205, 156, 248, 183, 111, 65, 223, 248, 161, 194, 152, 129, 237, - 240, 111, 120, 12, 227, 218, 75, 134, 234, 135, 153, 230, 138, 219, 89, - 220, 111, 145, 4, 19, 191, 69, 2, 116, 26, 174, 226, 157, 50, 68, - 63, 204, 156, 43, 110, 146, 197, 253, 22, 9, 161, 7, 120, 119, 164, - 11, 53, 68, 63, 204, 212, 59, 158, 229, 198, 253, 22, 137, 58, 102, - 204, 89, 25, 57, 222, 250, 97, 102, 67, 149, 96, 140, 25, 104, 119, - 109, 62, 4, 109, 90, 222, 58, 43, 180, 177, 54, 126, 208, 126, 229, - 174, 43, 243, 240, 131, 182, 42, 119, 93, 217, 91, 59, 63, 104, 151, - 242, 214, 129, 33, 78, 240, 190, 165, 8, 224, 7, 195, 5, 48, 67, - 236, 193, 200, 241, 2, 241, 124, 176, 48, 102, 96, 59, 60, 6, 120, - 17, 227, 204, 32, 253, 246, 96, 144, 185, 153, 39, 33, 35, 7, 188, - 83, 14, 43, 39, 228, 47, 253, 246, 96, 144, 185, 25, 228, 203, 253, - 22, 9, 208, 157, 149, 33, 243, 212, 111, 15, 6, 153, 155, 121, 14, - 86, 199, 76, 14, 107, 95, 187, 72, 253, 246, 96, 160, 220, 44, 157, - 181, 59, 90, 43, 111, 238, 24, 235, 166, 41, 55, 171, 149, 121, 93, - 42, 180, 23, 226, 98, 85, 75, 74, 116, 106, 4, 59, 142, 80, 84, - 230, 165, 137, 74, 250, 197, 245, 205, 84, 175, 128, 37, 188, 103, 145, - 131, 109, 159, 81, 28, 127, 115, 156, 7, 126, 8, 234, 72, 235, 186, - 7, 3, 126, 91, 164, 199, 246, 14, 177, 110, 154, 114, 66, 199, 172, - 235, 82, 161, 189, 16, 29, 106, 89, 82, 135, 110, 254, 204, 68, 122, - 84, 114, 106, 167, 148, 95, 12, 244, 248, 17, 190, 153, 55, 63, 85, - 0, 61, 56, 254, 230, 56, 255, 108, 27, 220, 145, 214, 117, 15, 6, - 244, 31, 164, 71, 146, 67, 172, 155, 166, 92, 116, 45, 248, 30, 66, - 123, 33, 246, 86, 183, 164, 106, 143, 246, 195, 123, 57, 127, 14, 155, - 170, 164, 223, 3, 61, 30, 55, 90, 198, 155, 199, 38, 2, 61, 56, - 254, 230, 56, 239, 173, 10, 244, 208, 117, 15, 6, 244, 81, 164, 135, - 168, 101, 172, 155, 166, 28, 184, 231, 201, 235, 82, 161, 189, 16, 254, - 141, 44, 169, 102, 191, 67, 241, 94, 206, 150, 231, 166, 41, 233, 198, - 57, 155, 169, 201, 245, 166, 240, 230, 207, 251, 59, 60, 163, 56, 254, - 230, 56, 223, 94, 1, 244, 208, 117, 15, 6, 140, 131, 248, 76, 200, - 92, 128, 115, 111, 129, 152, 72, 236, 193, 176, 3, 125, 83, 230, 235, - 176, 47, 45, 130, 195, 121, 74, 56, 215, 158, 154, 175, 95, 30, 177, - 33, 203, 18, 231, 197, 144, 47, 222, 203, 9, 104, 40, 83, 25, 83, - 230, 233, 151, 71, 188, 173, 181, 19, 199, 93, 59, 66, 6, 212, 27, - 233, 226, 51, 79, 191, 60, 98, 113, 238, 75, 44, 3, 242, 85, 219, - 203, 201, 202, 40, 154, 171, 95, 30, 225, 182, 125, 46, 206, 35, 160, - 221, 181, 142, 171, 192, 166, 229, 30, 167, 231, 105, 231, 7, 237, 87, - 238, 245, 95, 30, 126, 208, 86, 229, 229, 7, 109, 167, 141, 31, 180, - 75, 121, 243, 8, 136, 19, 140, 153, 233, 192, 15, 34, 52, 96, 198, - 127, 194, 228, 153, 196, 205, 156, 72, 118, 209, 156, 96, 113, 200, 236, - 96, 177, 191, 127, 75, 185, 191, 127, 51, 230, 68, 252, 130, 236, 206, - 61, 227, 165, 101, 49, 3, 219, 33, 63, 8, 153, 195, 241, 247, 12, - 211, 228, 7, 240, 221, 45, 152, 221, 173, 26, 102, 190, 19, 253, 112, - 229, 171, 243, 127, 165, 151, 225, 49, 62, 132, 144, 81, 4, 222, 169, - 136, 149, 99, 55, 75, 187, 12, 143, 234, 21, 50, 31, 205, 173, 237, - 198, 87, 231, 95, 253, 239, 18, 44, 3, 242, 197, 122, 0, 26, 233, - 98, 62, 83, 187, 140, 47, 61, 46, 103, 30, 107, 83, 81, 202, 87, - 231, 191, 120, 115, 50, 206, 35, 66, 102, 171, 99, 6, 202, 84, 254, - 59, 157, 71, 198, 73, 47, 233, 248, 16, 153, 148, 175, 206, 223, 255, - 74, 24, 174, 243, 67, 187, 147, 191, 27, 14, 237, 136, 248, 33, 90, - 121, 47, 39, 126, 46, 18, 173, 17, 181, 17, 237, 22, 217, 136, 246, - 138, 218, 225, 184, 251, 32, 213, 140, 9, 111, 126, 130, 187, 151, 147, - 109, 111, 246, 121, 4, 211, 123, 113, 36, 239, 24, 250, 181, 234, 100, - 38, 236, 107, 7, 182, 205, 124, 38, 231, 157, 137, 146, 54, 41, 137, - 102, 206, 183, 190, 198, 91, 31, 47, 53, 89, 194, 200, 54, 206, 195, - 119, 72, 34, 58, 228, 197, 26, 226, 57, 127, 125, 23, 250, 5, 105, - 3, 248, 157, 145, 13, 16, 61, 24, 216, 128, 123, 174, 217, 6, 143, - 224, 126, 214, 12, 57, 182, 1, 106, 95, 29, 216, 64, 252, 112, 182, - 160, 13, 58, 15, 107, 140, 109, 224, 61, 249, 63, 23, 100, 131, 237, - 212, 10, 65, 27, 68, 244, 219, 234, 140, 108, 128, 232, 105, 192, 6, - 220, 115, 126, 27, 64, 191, 69, 54, 248, 14, 108, 0, 253, 16, 217, - 0, 209, 211, 129, 13, 184, 231, 208, 6, 118, 192, 6, 221, 128, 13, - 156, 48, 191, 246, 105, 102, 140, 171, 243, 30, 188, 23, 22, 181, 239, - 1, 108, 32, 218, 235, 205, 155, 131, 124, 6, 54, 24, 48, 214, 196, - 13, 217, 224, 242, 195, 93, 74, 123, 252, 254, 25, 205, 120, 187, 121, - 184, 10, 217, 192, 204, 99, 141, 19, 178, 1, 162, 161, 13, 184, 231, - 252, 54, 128, 184, 34, 253, 0, 226, 4, 217, 0, 209, 127, 1, 27, - 112, 207, 161, 13, 194, 128, 13, 102, 2, 27, 204, 192, 252, 242, 129, - 31, 228, 62, 8, 197, 251, 79, 81, 251, 170, 192, 6, 213, 139, 103, - 243, 230, 47, 95, 128, 13, 58, 204, 68, 251, 240, 231, 51, 61, 62, - 169, 206, 195, 66, 63, 40, 253, 16, 41, 21, 178, 193, 236, 111, 145, - 120, 239, 42, 162, 33, 22, 184, 231, 252, 121, 19, 140, 251, 248, 252, - 249, 20, 16, 215, 230, 10, 141, 1, 14, 92, 124, 10, 5, 237, 167, - 233, 48, 6, 132, 18, 177, 51, 148, 136, 101, 211, 116, 29, 3, 180, - 220, 169, 8, 240, 142, 99, 39, 33, 163, 8, 240, 45, 98, 229, 196, - 135, 232, 58, 6, 104, 150, 1, 241, 132, 245, 152, 70, 232, 1, 104, - 164, 75, 202, 84, 93, 199, 0, 205, 50, 160, 191, 98, 61, 166, 149, - 25, 3, 88, 27, 81, 83, 117, 29, 3, 52, 203, 128, 254, 128, 207, - 170, 78, 227, 242, 8, 179, 119, 127, 203, 185, 184, 41, 147, 34, 250, - 16, 149, 73, 241, 197, 83, 181, 179, 170, 33, 234, 252, 184, 24, 36, - 147, 34, 58, 13, 240, 227, 139, 77, 106, 245, 156, 169, 234, 252, 56, - 60, 203, 164, 136, 134, 252, 248, 112, 174, 86, 207, 41, 195, 143, 195, - 134, 76, 138, 104, 168, 47, 31, 102, 212, 238, 84, 156, 194, 97, 70, - 22, 8, 252, 96, 186, 16, 102, 58, 114, 231, 207, 65, 95, 121, 176, - 48, 102, 96, 59, 124, 54, 124, 50, 145, 55, 5, 27, 14, 51, 144, - 47, 62, 27, 14, 104, 40, 83, 185, 63, 34, 200, 112, 152, 161, 8, - 25, 80, 111, 164, 75, 72, 144, 225, 48, 3, 249, 170, 221, 169, 136, - 236, 21, 100, 56, 204, 64, 187, 35, 31, 146, 139, 78, 158, 212, 132, - 25, 201, 187, 249, 58, 99, 6, 218, 152, 228, 167, 9, 51, 144, 159, - 174, 152, 9, 41, 195, 79, 19, 102, 40, 192, 79, 87, 204, 136, 202, - 240, 211, 132, 25, 17, 224, 167, 43, 102, 32, 78, 240, 239, 60, 250, - 3, 63, 152, 34, 132, 153, 78, 220, 247, 0, 125, 101, 19, 133, 49, - 3, 219, 225, 59, 21, 39, 113, 252, 205, 39, 26, 14, 51, 144, 47, - 246, 53, 40, 35, 144, 221, 139, 19, 96, 56, 204, 136, 8, 25, 80, - 111, 164, 139, 93, 128, 225, 48, 3, 249, 170, 253, 206, 35, 43, 67, - 238, 111, 56, 204, 64, 187, 235, 139, 25, 114, 237, 9, 218, 88, 95, - 204, 144, 252, 236, 2, 244, 199, 12, 201, 15, 218, 78, 95, 204, 144, - 185, 25, 196, 9, 190, 35, 222, 15, 248, 65, 160, 16, 102, 28, 185, - 59, 56, 38, 128, 120, 62, 94, 24, 51, 176, 29, 30, 3, 38, 112, - 252, 115, 198, 233, 135, 25, 114, 126, 78, 17, 50, 228, 224, 157, 228, - 172, 28, 159, 113, 250, 97, 134, 156, 159, 67, 190, 88, 15, 64, 35, - 93, 138, 252, 244, 195, 12, 57, 63, 167, 198, 171, 99, 6, 202, 84, - 114, 243, 211, 15, 51, 104, 126, 238, 194, 218, 29, 255, 94, 209, 88, - 177, 124, 212, 215, 230, 127, 204, 207, 115, 228, 215, 165, 73, 71, 214, - 107, 157, 155, 170, 213, 160, 8, 126, 121, 99, 196, 242, 129, 30, 213, - 255, 152, 235, 74, 78, 93, 151, 118, 251, 172, 27, 63, 104, 79, 188, - 183, 118, 128, 88, 158, 22, 93, 226, 90, 118, 222, 40, 187, 112, 93, - 186, 188, 118, 180, 214, 121, 163, 218, 222, 90, 130, 31, 5, 222, 207, - 57, 42, 242, 143, 57, 152, 2, 188, 95, 24, 53, 75, 235, 28, 76, - 237, 142, 120, 63, 98, 15, 70, 77, 224, 7, 254, 66, 152, 233, 204, - 157, 233, 247, 13, 22, 123, 54, 18, 198, 12, 108, 135, 253, 192, 151, - 227, 31, 111, 165, 43, 102, 106, 104, 244, 131, 149, 177, 18, 28, 159, - 69, 132, 12, 153, 15, 192, 62, 43, 39, 167, 142, 174, 152, 209, 44, - 163, 105, 159, 100, 110, 12, 240, 33, 214, 198, 128, 222, 72, 23, 243, - 90, 186, 98, 70, 179, 140, 134, 146, 71, 120, 44, 131, 124, 213, 238, - 136, 247, 97, 177, 223, 78, 87, 204, 104, 150, 17, 248, 75, 53, 206, - 44, 48, 81, 217, 221, 90, 217, 82, 245, 27, 220, 208, 142, 136, 31, - 162, 123, 165, 196, 80, 220, 115, 240, 127, 170, 137, 68, 173, 69, 45, - 69, 206, 224, 15, 197, 221, 103, 3, 75, 168, 154, 45, 27, 226, 125, - 155, 237, 219, 183, 81, 182, 31, 150, 231, 75, 167, 244, 179, 199, 99, - 212, 96, 145, 181, 40, 0, 244, 155, 71, 244, 253, 89, 59, 142, 94, - 48, 216, 129, 187, 135, 148, 197, 170, 105, 201, 62, 250, 150, 251, 58, - 222, 58, 82, 169, 201, 33, 218, 249, 202, 14, 182, 77, 6, 221, 100, - 208, 126, 182, 30, 150, 73, 27, 221, 61, 138, 251, 166, 128, 62, 233, - 162, 246, 162, 12, 240, 135, 207, 190, 154, 156, 161, 205, 162, 206, 178, - 109, 46, 210, 131, 91, 252, 79, 73, 27, 69, 92, 166, 63, 127, 185, - 137, 251, 102, 129, 62, 167, 68, 182, 162, 115, 224, 15, 245, 253, 21, - 117, 141, 190, 58, 0, 221, 145, 154, 67, 239, 217, 125, 95, 73, 27, - 71, 220, 164, 23, 138, 30, 243, 214, 95, 126, 71, 229, 210, 39, 115, - 10, 216, 54, 121, 244, 251, 137, 133, 108, 223, 123, 116, 83, 163, 247, - 184, 239, 101, 81, 7, 209, 255, 192, 95, 14, 248, 195, 250, 70, 61, - 160, 235, 0, 44, 168, 90, 40, 104, 227, 89, 95, 149, 180, 121, 196, - 19, 250, 201, 235, 79, 184, 239, 77, 16, 55, 110, 129, 126, 183, 137, - 190, 38, 209, 5, 116, 114, 255, 103, 108, 155, 151, 244, 167, 181, 119, - 85, 182, 138, 40, 164, 37, 247, 255, 135, 251, 230, 129, 62, 247, 128, - 174, 247, 9, 125, 139, 163, 222, 210, 75, 219, 160, 122, 93, 17, 93, - 241, 247, 97, 37, 93, 26, 254, 145, 254, 231, 214, 94, 220, 247, 17, - 176, 213, 99, 240, 247, 148, 248, 70, 197, 81, 95, 232, 216, 103, 137, - 108, 155, 239, 116, 241, 240, 4, 182, 111, 49, 189, 228, 250, 42, 220, - 183, 0, 244, 121, 1, 254, 94, 129, 111, 140, 250, 254, 136, 42, 165, - 15, 245, 194, 181, 68, 102, 217, 213, 88, 21, 45, 53, 98, 2, 61, - 23, 224, 190, 111, 64, 159, 119, 224, 175, 136, 232, 251, 91, 110, 204, - 220, 190, 182, 136, 109, 99, 202, 220, 14, 88, 204, 126, 223, 138, 204, - 237, 205, 92, 125, 242, 35, 232, 243, 25, 252, 125, 39, 250, 254, 138, - 170, 204, 84, 183, 64, 109, 170, 49, 237, 130, 150, 176, 223, 168, 58, - 211, 231, 52, 215, 183, 20, 246, 49, 178, 17, 85, 48, 34, 251, 214, - 100, 184, 26, 176, 5, 166, 51, 62, 213, 101, 200, 218, 112, 21, 208, - 167, 58, 248, 171, 69, 244, 69, 184, 132, 177, 10, 225, 18, 238, 41, - 135, 177, 7, 225, 18, 209, 238, 0, 151, 220, 115, 205, 184, 84, 0, - 92, 238, 23, 87, 192, 184, 244, 15, 59, 164, 108, 63, 28, 224, 50, - 248, 57, 63, 46, 107, 90, 196, 209, 59, 119, 55, 196, 184, 68, 99, - 94, 21, 128, 203, 106, 11, 248, 113, 249, 11, 224, 242, 249, 200, 61, - 24, 151, 155, 163, 50, 48, 46, 7, 239, 190, 160, 1, 151, 132, 175, - 1, 92, 86, 140, 191, 135, 113, 105, 122, 237, 165, 138, 6, 184, 156, - 255, 250, 61, 129, 75, 91, 128, 203, 14, 0, 151, 36, 62, 174, 209, - 183, 107, 124, 199, 184, 28, 94, 90, 202, 126, 243, 155, 116, 208, 23, - 35, 222, 154, 170, 81, 116, 46, 61, 98, 141, 169, 27, 194, 229, 233, - 87, 98, 37, 109, 10, 112, 105, 79, 85, 117, 227, 112, 105, 7, 112, - 105, 7, 112, 105, 79, 248, 248, 3, 186, 210, 236, 218, 110, 8, 151, - 191, 247, 212, 84, 210, 205, 33, 46, 243, 107, 184, 113, 184, 180, 7, - 184, 180, 7, 184, 228, 250, 26, 3, 92, 230, 47, 68, 181, 220, 151, - 116, 71, 107, 213, 251, 255, 12, 47, 164, 79, 185, 189, 34, 112, 105, - 7, 112, 217, 1, 224, 146, 211, 183, 0, 224, 114, 158, 243, 45, 140, - 75, 207, 190, 215, 84, 247, 173, 3, 92, 46, 30, 121, 158, 192, 165, - 45, 192, 165, 45, 192, 165, 45, 97, 171, 47, 116, 103, 219, 203, 24, - 151, 157, 141, 174, 178, 62, 94, 76, 59, 222, 186, 70, 224, 210, 22, - 224, 210, 22, 224, 146, 236, 91, 74, 111, 250, 245, 31, 198, 229, 158, - 41, 42, 218, 24, 224, 50, 227, 225, 77, 2, 151, 182, 0, 151, 182, - 0, 151, 92, 95, 209, 41, 99, 198, 102, 197, 85, 140, 203, 71, 54, - 23, 216, 56, 84, 145, 233, 52, 41, 147, 192, 165, 45, 192, 165, 45, - 192, 37, 17, 179, 1, 46, 99, 20, 123, 48, 46, 59, 157, 221, 166, - 170, 123, 135, 87, 103, 138, 119, 175, 35, 112, 9, 124, 209, 168, 29, - 192, 101, 59, 53, 92, 114, 235, 18, 22, 152, 134, 184, 36, 215, 43, - 248, 112, 9, 199, 119, 132, 203, 165, 0, 151, 112, 188, 70, 184, 68, - 244, 82, 128, 75, 238, 185, 102, 92, 54, 255, 171, 132, 170, 215, 245, - 50, 198, 229, 95, 45, 95, 43, 219, 223, 190, 231, 75, 47, 121, 215, - 196, 149, 195, 101, 11, 22, 151, 109, 112, 223, 39, 117, 226, 232, 85, - 247, 141, 240, 30, 127, 148, 59, 206, 5, 184, 52, 63, 26, 197, 187, - 230, 80, 223, 244, 16, 221, 244, 244, 90, 55, 132, 75, 171, 129, 59, - 149, 116, 5, 128, 203, 224, 251, 169, 110, 28, 46, 93, 1, 46, 41, - 128, 75, 6, 247, 189, 15, 112, 121, 211, 237, 172, 27, 194, 165, 115, - 227, 155, 74, 250, 109, 248, 101, 122, 169, 217, 93, 55, 14, 151, 61, - 1, 46, 61, 0, 46, 123, 115, 249, 1, 192, 101, 106, 245, 199, 110, - 8, 151, 119, 255, 123, 174, 164, 63, 134, 223, 164, 183, 110, 252, 127, - 180, 93, 7, 124, 84, 197, 243, 191, 132, 64, 32, 8, 4, 136, 244, - 18, 58, 136, 98, 128, 159, 10, 36, 228, 238, 61, 154, 74, 11, 130, - 34, 61, 180, 208, 67, 232, 45, 229, 146, 208, 107, 64, 20, 148, 22, - 21, 165, 9, 134, 38, 144, 220, 133, 208, 164, 67, 168, 210, 57, 122, - 145, 18, 122, 11, 240, 159, 121, 239, 109, 185, 112, 217, 119, 126, 242, - 254, 124, 62, 249, 56, 159, 231, 238, 204, 219, 185, 249, 206, 236, 206, - 238, 188, 189, 35, 196, 101, 105, 192, 229, 183, 7, 31, 80, 92, 30, - 186, 249, 76, 161, 75, 3, 46, 247, 121, 189, 225, 112, 217, 28, 112, - 217, 18, 112, 217, 138, 246, 221, 5, 184, 76, 168, 154, 135, 220, 143, - 45, 85, 88, 165, 214, 49, 196, 199, 92, 150, 238, 215, 202, 101, 102, - 184, 12, 1, 92, 134, 0, 46, 91, 211, 190, 53, 1, 151, 141, 234, - 63, 160, 184, 204, 29, 173, 126, 215, 227, 15, 192, 229, 252, 29, 255, - 4, 51, 92, 182, 0, 92, 126, 9, 184, 252, 156, 221, 177, 110, 189, - 43, 21, 106, 188, 43, 152, 224, 178, 241, 208, 52, 133, 182, 3, 46, - 135, 254, 154, 18, 204, 112, 217, 4, 112, 217, 24, 112, 217, 136, 225, - 35, 238, 137, 212, 33, 104, 123, 48, 193, 101, 239, 3, 42, 159, 2, - 128, 203, 241, 157, 247, 6, 51, 92, 54, 1, 92, 54, 1, 92, 54, - 101, 191, 17, 224, 178, 233, 230, 35, 193, 52, 94, 102, 166, 43, 116, - 77, 192, 229, 54, 75, 122, 48, 195, 101, 51, 192, 101, 51, 192, 101, - 51, 218, 183, 24, 224, 242, 233, 235, 191, 131, 9, 46, 125, 235, 170, - 239, 92, 18, 112, 185, 111, 193, 186, 96, 134, 203, 38, 128, 203, 198, - 128, 75, 102, 27, 187, 1, 151, 233, 161, 139, 130, 9, 46, 127, 25, - 48, 91, 161, 247, 2, 46, 167, 143, 158, 16, 204, 112, 105, 6, 92, - 54, 4, 92, 6, 178, 239, 186, 0, 46, 217, 94, 153, 31, 165, 237, - 128, 75, 126, 15, 205, 199, 163, 62, 224, 178, 62, 224, 178, 254, 59, - 184, 196, 57, 49, 63, 143, 197, 57, 46, 193, 37, 161, 45, 128, 75, - 246, 156, 224, 114, 20, 224, 114, 20, 229, 183, 19, 226, 101, 155, 8, - 43, 173, 59, 105, 168, 181, 175, 15, 241, 242, 84, 105, 214, 183, 45, - 244, 233, 3, 127, 227, 184, 190, 149, 32, 94, 14, 92, 16, 77, 235, - 78, 200, 26, 172, 4, 224, 114, 72, 248, 72, 225, 62, 88, 65, 192, - 101, 222, 46, 195, 204, 4, 151, 221, 102, 170, 223, 112, 43, 10, 184, - 252, 117, 235, 32, 51, 195, 229, 48, 192, 229, 80, 192, 229, 16, 118, - 199, 161, 215, 14, 41, 224, 167, 126, 102, 130, 203, 83, 1, 97, 234, - 62, 24, 196, 203, 234, 145, 189, 204, 12, 151, 17, 128, 203, 193, 128, - 203, 112, 46, 110, 29, 148, 126, 49, 247, 48, 19, 92, 46, 248, 41, - 84, 165, 33, 94, 206, 123, 34, 254, 254, 75, 65, 192, 101, 158, 176, - 46, 102, 130, 203, 50, 195, 58, 153, 213, 185, 232, 25, 169, 180, 181, - 131, 153, 225, 114, 16, 224, 114, 0, 224, 114, 0, 231, 15, 206, 75, - 15, 210, 218, 81, 92, 90, 215, 124, 173, 208, 11, 33, 94, 154, 23, - 126, 195, 225, 178, 31, 224, 178, 63, 224, 178, 63, 237, 123, 55, 246, - 154, 52, 127, 21, 145, 123, 83, 10, 234, 208, 221, 172, 218, 218, 109, - 105, 88, 158, 222, 102, 134, 203, 129, 128, 203, 65, 128, 203, 193, 180, - 239, 50, 136, 151, 177, 3, 136, 174, 50, 164, 33, 182, 254, 10, 253, - 47, 224, 178, 90, 129, 129, 102, 134, 203, 8, 192, 101, 4, 224, 114, - 136, 83, 188, 188, 185, 186, 191, 153, 224, 114, 203, 19, 149, 143, 23, - 224, 114, 74, 195, 126, 102, 134, 203, 8, 192, 101, 4, 224, 50, 130, - 179, 241, 215, 210, 132, 222, 125, 72, 27, 57, 102, 158, 74, 231, 3, - 92, 142, 221, 75, 159, 3, 46, 7, 3, 46, 7, 3, 46, 217, 59, - 123, 0, 46, 123, 60, 35, 252, 189, 228, 167, 29, 6, 152, 201, 60, - 182, 98, 121, 118, 62, 236, 33, 200, 123, 12, 239, 251, 156, 123, 231, - 199, 128, 203, 224, 252, 100, 127, 245, 61, 185, 146, 143, 250, 205, 192, - 23, 128, 203, 23, 121, 153, 77, 190, 6, 187, 242, 240, 24, 6, 184, - 28, 206, 141, 183, 176, 204, 246, 111, 253, 40, 189, 5, 112, 201, 239, - 235, 250, 120, 140, 0, 92, 142, 0, 92, 142, 120, 247, 140, 122, 97, - 174, 30, 182, 6, 172, 91, 123, 232, 229, 20, 234, 177, 243, 211, 208, - 55, 180, 166, 126, 78, 1, 219, 209, 179, 221, 190, 92, 13, 249, 7, - 198, 229, 174, 145, 47, 187, 63, 5, 198, 84, 88, 203, 95, 125, 96, - 92, 238, 26, 249, 178, 251, 83, 6, 122, 147, 177, 248, 126, 96, 92, - 238, 58, 180, 102, 150, 26, 242, 154, 90, 14, 190, 134, 113, 185, 107, - 212, 187, 145, 251, 61, 214, 15, 140, 221, 239, 241, 253, 192, 216, 253, - 30, 212, 157, 145, 251, 61, 136, 19, 250, 125, 159, 202, 96, 7, 133, - 245, 48, 83, 159, 213, 182, 85, 31, 232, 237, 95, 77, 31, 51, 216, - 142, 214, 15, 86, 231, 190, 239, 83, 213, 56, 204, 248, 115, 50, 18, - 225, 157, 18, 53, 57, 150, 170, 198, 97, 6, 249, 210, 113, 0, 77, - 198, 146, 94, 197, 56, 204, 248, 87, 203, 82, 63, 88, 77, 203, 195, - 85, 49, 14, 51, 168, 119, 35, 247, 123, 44, 85, 141, 221, 239, 65, - 125, 26, 185, 223, 19, 90, 197, 216, 253, 30, 196, 9, 189, 63, 197, - 31, 236, 160, 134, 14, 102, 106, 7, 112, 119, 123, 12, 244, 118, 84, - 212, 199, 12, 182, 99, 247, 142, 48, 254, 17, 21, 141, 195, 12, 242, - 165, 49, 0, 104, 148, 169, 52, 170, 104, 28, 102, 66, 57, 25, 56, - 110, 50, 150, 132, 10, 198, 97, 6, 249, 58, 125, 223, 71, 147, 225, - 95, 193, 56, 204, 160, 222, 141, 140, 51, 166, 138, 198, 198, 25, 212, - 167, 145, 113, 198, 191, 130, 177, 113, 6, 113, 66, 207, 48, 135, 12, - 242, 118, 84, 214, 195, 12, 59, 195, 156, 224, 24, 232, 29, 146, 161, - 143, 25, 108, 71, 237, 57, 129, 251, 237, 143, 24, 135, 25, 228, 75, - 107, 161, 224, 157, 80, 166, 242, 142, 233, 198, 97, 6, 249, 210, 253, - 30, 160, 201, 88, 2, 252, 251, 27, 134, 153, 144, 140, 44, 181, 80, - 25, 154, 140, 128, 1, 198, 157, 95, 59, 98, 108, 156, 65, 29, 27, - 122, 174, 192, 191, 191, 161, 113, 6, 117, 103, 100, 156, 65, 156, 208, - 250, 193, 208, 65, 222, 136, 33, 49, 102, 216, 153, 79, 135, 47, 244, - 173, 61, 72, 23, 51, 216, 142, 98, 6, 104, 194, 63, 49, 96, 144, - 113, 152, 225, 100, 36, 192, 59, 57, 52, 57, 1, 2, 25, 255, 21, - 51, 200, 151, 214, 245, 2, 77, 198, 146, 216, 125, 144, 97, 152, 241, - 229, 100, 152, 52, 153, 202, 56, 68, 50, 254, 35, 102, 80, 239, 70, - 198, 153, 128, 44, 252, 114, 26, 103, 80, 159, 70, 198, 153, 128, 44, - 252, 114, 26, 103, 16, 39, 52, 206, 56, 6, 121, 35, 134, 178, 193, - 12, 86, 152, 105, 60, 180, 12, 28, 244, 245, 175, 224, 10, 51, 30, - 78, 152, 193, 118, 116, 29, 80, 145, 241, 15, 77, 207, 222, 14, 138, - 172, 241, 72, 253, 37, 181, 68, 144, 168, 86, 230, 80, 241, 105, 236, - 123, 40, 21, 153, 140, 68, 120, 39, 148, 169, 52, 250, 51, 123, 25, - 173, 242, 122, 167, 174, 184, 149, 55, 72, 84, 43, 243, 221, 39, 83, - 217, 119, 17, 43, 112, 227, 0, 154, 140, 197, 177, 58, 123, 25, 123, - 90, 28, 176, 45, 73, 206, 45, 172, 149, 185, 115, 129, 157, 197, 241, - 175, 224, 140, 25, 148, 169, 156, 201, 249, 35, 123, 25, 151, 190, 250, - 218, 252, 112, 136, 184, 86, 102, 253, 94, 86, 43, 131, 122, 231, 235, - 3, 80, 143, 132, 31, 161, 177, 86, 134, 61, 199, 188, 104, 5, 211, - 50, 83, 121, 211, 42, 248, 227, 107, 101, 186, 70, 38, 211, 239, 158, - 147, 246, 88, 43, 243, 120, 112, 140, 93, 175, 78, 100, 239, 159, 1, - 118, 82, 31, 240, 126, 241, 220, 118, 82, 31, 96, 46, 144, 110, 211, - 171, 15, 40, 63, 32, 214, 70, 234, 3, 8, 141, 245, 1, 236, 185, - 184, 70, 2, 237, 130, 215, 1, 254, 206, 68, 7, 132, 198, 90, 25, - 246, 220, 181, 14, 176, 86, 102, 119, 237, 109, 84, 7, 164, 61, 214, - 202, 76, 206, 51, 86, 87, 7, 63, 252, 94, 158, 234, 160, 230, 135, - 39, 109, 68, 7, 1, 197, 18, 116, 117, 240, 219, 163, 21, 41, 68, - 7, 132, 198, 58, 17, 246, 92, 172, 3, 180, 91, 190, 86, 6, 237, - 144, 232, 128, 208, 88, 43, 195, 158, 163, 14, 106, 129, 14, 62, 5, - 29, 124, 230, 84, 43, 19, 211, 132, 213, 202, 144, 246, 88, 43, 83, - 113, 163, 126, 173, 76, 151, 30, 172, 86, 230, 207, 243, 172, 86, 38, - 178, 142, 126, 173, 204, 237, 174, 9, 180, 86, 134, 208, 168, 3, 246, - 92, 172, 3, 196, 21, 111, 7, 136, 19, 162, 3, 66, 99, 173, 12, - 123, 142, 58, 24, 12, 58, 24, 4, 58, 24, 228, 84, 43, 147, 121, - 150, 213, 202, 144, 246, 88, 43, 19, 255, 92, 191, 86, 102, 247, 48, - 86, 43, 83, 234, 33, 171, 149, 201, 204, 208, 175, 149, 185, 241, 148, - 213, 202, 16, 26, 177, 192, 158, 235, 204, 155, 28, 44, 6, 88, 151, - 15, 242, 78, 10, 21, 198, 0, 167, 122, 73, 11, 232, 47, 109, 165, - 126, 12, 192, 118, 244, 172, 228, 42, 198, 63, 100, 165, 187, 49, 192, - 245, 92, 0, 241, 78, 207, 74, 174, 98, 50, 44, 64, 91, 52, 159, - 233, 88, 225, 110, 12, 112, 45, 3, 241, 68, 199, 193, 201, 192, 113, - 147, 177, 68, 172, 112, 55, 6, 184, 150, 129, 246, 74, 199, 177, 210, - 57, 6, 88, 136, 190, 86, 184, 27, 3, 92, 203, 64, 123, 160, 231, - 254, 87, 14, 114, 170, 29, 97, 126, 211, 106, 38, 52, 214, 142, 136, - 252, 169, 211, 185, 255, 21, 206, 252, 152, 15, 178, 154, 9, 141, 181, - 45, 34, 223, 228, 116, 238, 63, 11, 63, 134, 103, 171, 153, 208, 200, - 79, 132, 115, 167, 252, 65, 22, 126, 12, 27, 86, 51, 161, 113, 188, - 34, 204, 56, 157, 251, 95, 206, 48, 99, 89, 10, 243, 38, 135, 30, - 102, 216, 90, 195, 4, 125, 173, 191, 235, 99, 6, 219, 209, 179, 146, - 203, 24, 127, 223, 223, 141, 195, 12, 242, 165, 182, 134, 50, 150, 107, - 235, 128, 223, 140, 195, 140, 137, 147, 129, 227, 38, 99, 9, 248, 205, - 56, 204, 32, 95, 167, 115, 255, 154, 140, 180, 165, 198, 97, 6, 245, - 206, 207, 189, 93, 97, 6, 231, 222, 238, 98, 6, 117, 204, 243, 115, - 133, 25, 92, 107, 184, 139, 153, 128, 44, 252, 92, 97, 6, 215, 26, - 238, 98, 6, 117, 199, 243, 115, 133, 25, 28, 175, 187, 152, 65, 156, - 208, 60, 240, 86, 176, 131, 229, 122, 152, 97, 245, 101, 105, 191, 130, - 63, 255, 69, 31, 51, 216, 142, 198, 128, 95, 25, 255, 244, 159, 141, - 195, 140, 133, 147, 145, 6, 239, 148, 166, 201, 9, 253, 217, 56, 204, - 32, 95, 58, 14, 160, 201, 88, 50, 18, 141, 195, 140, 229, 23, 103, - 204, 160, 76, 133, 91, 162, 113, 152, 65, 189, 231, 20, 51, 78, 123, - 19, 63, 231, 28, 51, 60, 63, 212, 103, 78, 49, 195, 243, 179, 38, - 230, 28, 51, 252, 220, 12, 113, 66, 239, 70, 72, 1, 59, 88, 170, - 135, 25, 86, 95, 230, 15, 125, 19, 237, 250, 152, 193, 118, 116, 237, - 156, 202, 248, 7, 216, 115, 134, 25, 126, 125, 142, 124, 233, 218, 25, - 104, 148, 169, 216, 156, 45, 103, 152, 225, 215, 231, 254, 156, 12, 28, - 55, 25, 75, 136, 45, 103, 152, 225, 215, 231, 200, 215, 233, 94, 50, - 77, 134, 35, 37, 103, 152, 33, 235, 243, 32, 77, 239, 196, 134, 38, - 119, 243, 78, 219, 62, 188, 194, 59, 235, 115, 172, 149, 105, 184, 243, - 135, 108, 215, 166, 78, 126, 220, 198, 248, 125, 11, 252, 62, 242, 40, - 243, 206, 90, 55, 3, 248, 117, 176, 184, 199, 47, 132, 227, 103, 105, - 237, 157, 22, 254, 236, 117, 195, 172, 235, 70, 203, 238, 195, 102, 255, - 188, 113, 217, 174, 27, 157, 230, 142, 41, 140, 95, 72, 87, 239, 180, - 203, 221, 99, 222, 89, 131, 165, 111, 59, 108, 62, 210, 120, 100, 182, - 107, 48, 62, 206, 32, 78, 40, 102, 214, 130, 29, 108, 213, 195, 12, - 171, 47, 115, 36, 15, 242, 14, 221, 162, 143, 25, 108, 71, 243, 192, - 201, 92, 30, 120, 163, 187, 152, 113, 93, 255, 241, 119, 80, 179, 100, - 154, 7, 230, 100, 56, 224, 157, 28, 154, 28, 199, 90, 119, 49, 227, - 90, 198, 163, 238, 54, 42, 3, 249, 210, 113, 0, 77, 198, 146, 246, - 183, 187, 152, 113, 45, 35, 239, 252, 43, 108, 79, 115, 139, 51, 102, - 80, 166, 66, 236, 112, 23, 51, 174, 101, 124, 205, 213, 202, 160, 222, - 249, 51, 134, 168, 71, 194, 143, 208, 88, 43, 195, 158, 147, 51, 134, - 149, 77, 129, 240, 199, 215, 202, 172, 182, 149, 160, 223, 121, 95, 115, - 89, 109, 143, 181, 50, 47, 182, 212, 182, 57, 159, 201, 175, 108, 26, - 103, 170, 196, 214, 226, 69, 103, 73, 213, 143, 126, 76, 191, 243, 78, - 176, 154, 59, 243, 15, 169, 103, 187, 239, 133, 121, 36, 172, 149, 169, - 223, 151, 124, 139, 105, 179, 244, 195, 185, 53, 118, 114, 38, 255, 73, - 72, 178, 157, 157, 49, 44, 103, 218, 0, 127, 155, 77, 101, 157, 106, - 101, 50, 143, 236, 177, 147, 51, 134, 126, 187, 142, 217, 213, 51, 104, - 251, 164, 69, 193, 167, 237, 236, 140, 97, 89, 211, 54, 83, 25, 211, - 46, 248, 227, 107, 101, 166, 246, 184, 104, 39, 103, 12, 115, 127, 117, - 213, 78, 206, 228, 199, 72, 183, 132, 249, 43, 172, 149, 169, 240, 215, - 61, 59, 57, 99, 184, 250, 224, 35, 187, 122, 70, 253, 140, 20, 120, - 237, 185, 157, 157, 49, 44, 109, 58, 4, 127, 233, 240, 199, 206, 138, - 159, 151, 58, 174, 246, 72, 37, 103, 12, 151, 109, 52, 41, 116, 161, - 232, 203, 146, 99, 220, 91, 59, 59, 99, 88, 218, 116, 28, 254, 78, - 114, 125, 189, 226, 174, 73, 181, 223, 102, 216, 201, 25, 195, 202, 91, - 174, 171, 122, 142, 190, 45, 61, 24, 122, 206, 206, 206, 24, 150, 54, - 157, 129, 177, 158, 227, 198, 107, 138, 187, 43, 141, 26, 113, 200, 78, - 206, 24, 250, 23, 221, 161, 141, 247, 161, 180, 43, 105, 147, 157, 157, - 49, 44, 99, 186, 4, 250, 186, 194, 233, 249, 69, 236, 19, 105, 189, - 99, 185, 157, 156, 49, 60, 127, 101, 177, 93, 173, 5, 120, 41, 125, - 118, 99, 174, 157, 157, 49, 44, 103, 186, 1, 127, 183, 184, 223, 247, - 73, 236, 107, 41, 127, 171, 41, 164, 141, 124, 161, 206, 4, 133, 126, - 27, 236, 33, 239, 46, 30, 107, 103, 103, 12, 203, 155, 238, 193, 95, - 6, 215, 23, 107, 101, 206, 245, 140, 183, 147, 51, 134, 251, 28, 241, - 154, 158, 243, 200, 191, 159, 25, 111, 103, 103, 12, 203, 155, 30, 195, - 223, 115, 174, 47, 214, 202, 124, 92, 101, 146, 157, 156, 49, 236, 222, - 114, 178, 54, 222, 130, 242, 119, 35, 232, 251, 152, 94, 99, 31, 143, - 242, 166, 220, 30, 229, 157, 206, 228, 179, 28, 176, 31, 165, 241, 76, - 62, 159, 27, 246, 129, 62, 5, 225, 175, 8, 215, 151, 224, 18, 125, - 21, 95, 43, 131, 190, 135, 224, 146, 208, 205, 0, 151, 236, 185, 107, - 92, 94, 6, 92, 46, 190, 146, 151, 226, 50, 79, 17, 187, 210, 190, - 61, 224, 50, 111, 141, 122, 66, 92, 230, 242, 155, 37, 53, 235, 254, - 1, 197, 37, 137, 121, 222, 128, 203, 122, 233, 115, 133, 184, 196, 90, - 153, 74, 35, 151, 82, 92, 38, 167, 39, 81, 92, 182, 173, 105, 23, - 226, 242, 21, 224, 50, 96, 197, 1, 138, 203, 138, 205, 78, 81, 92, - 22, 47, 118, 65, 136, 75, 172, 149, 249, 96, 243, 85, 138, 203, 181, - 241, 183, 40, 46, 63, 105, 125, 79, 136, 75, 172, 149, 241, 254, 224, - 33, 197, 229, 228, 143, 158, 107, 248, 56, 35, 149, 168, 253, 70, 136, - 75, 172, 149, 169, 153, 199, 155, 226, 114, 246, 184, 220, 10, 93, 22, - 112, 121, 43, 35, 87, 42, 195, 101, 41, 192, 101, 41, 192, 101, 41, - 167, 90, 153, 221, 205, 31, 80, 92, 118, 254, 253, 138, 66, 103, 70, - 221, 150, 94, 153, 78, 10, 113, 121, 59, 246, 174, 148, 252, 114, 59, - 197, 229, 254, 7, 41, 234, 125, 54, 81, 15, 165, 218, 183, 54, 112, - 184, 44, 251, 14, 46, 241, 236, 239, 212, 94, 127, 81, 92, 166, 123, - 108, 210, 240, 241, 82, 42, 182, 100, 19, 135, 203, 178, 128, 203, 178, - 128, 203, 178, 156, 141, 191, 150, 102, 21, 182, 81, 92, 134, 15, 85, - 229, 98, 173, 76, 203, 99, 201, 28, 46, 203, 2, 46, 203, 2, 46, - 203, 58, 213, 202, 36, 236, 221, 72, 113, 25, 90, 108, 29, 197, 101, - 230, 159, 43, 57, 92, 150, 5, 92, 150, 3, 92, 150, 227, 222, 57, - 159, 188, 172, 227, 18, 138, 203, 42, 199, 231, 83, 92, 46, 111, 57, - 135, 195, 37, 244, 241, 40, 247, 14, 46, 217, 190, 132, 31, 165, 17, - 151, 252, 126, 133, 8, 151, 24, 223, 9, 46, 167, 0, 46, 49, 94, - 19, 92, 18, 26, 107, 101, 216, 115, 196, 101, 21, 192, 101, 21, 192, - 101, 21, 202, 175, 114, 155, 76, 203, 121, 243, 1, 90, 43, 243, 79, - 244, 85, 165, 253, 137, 51, 221, 165, 132, 207, 249, 90, 153, 138, 128, - 203, 42, 128, 203, 106, 180, 239, 137, 247, 103, 73, 31, 205, 243, 164, - 181, 50, 100, 238, 56, 10, 112, 153, 184, 42, 86, 184, 231, 80, 214, - 107, 189, 180, 104, 0, 171, 149, 105, 115, 243, 23, 133, 206, 11, 184, - 28, 218, 155, 175, 149, 105, 0, 184, 12, 2, 92, 6, 211, 190, 167, - 1, 151, 126, 119, 118, 208, 90, 153, 181, 41, 106, 77, 198, 157, 168, - 125, 82, 145, 95, 79, 113, 181, 50, 18, 224, 178, 17, 224, 178, 137, - 83, 173, 204, 184, 241, 14, 90, 43, 115, 225, 83, 181, 86, 230, 81, - 212, 81, 233, 202, 205, 127, 133, 123, 29, 101, 1, 151, 183, 61, 88, - 173, 204, 197, 210, 106, 173, 76, 25, 192, 101, 183, 79, 95, 115, 181, - 50, 205, 0, 151, 95, 0, 46, 191, 164, 125, 83, 0, 151, 211, 55, - 229, 166, 103, 242, 147, 6, 168, 181, 50, 93, 98, 46, 75, 114, 121, - 190, 86, 166, 5, 224, 178, 57, 224, 178, 57, 237, 91, 3, 112, 249, - 83, 249, 135, 180, 86, 102, 191, 183, 250, 206, 155, 1, 151, 115, 50, - 78, 115, 181, 50, 159, 3, 46, 155, 2, 46, 27, 211, 190, 151, 172, - 119, 37, 105, 206, 30, 90, 43, 19, 24, 177, 67, 171, 179, 121, 40, - 213, 106, 147, 202, 213, 202, 200, 128, 75, 9, 112, 105, 225, 206, 213, - 63, 145, 66, 95, 176, 90, 153, 47, 122, 176, 90, 153, 122, 251, 119, - 115, 181, 50, 18, 224, 82, 2, 92, 202, 220, 217, 248, 215, 82, 174, - 101, 135, 104, 173, 204, 253, 250, 7, 21, 186, 22, 224, 114, 245, 129, - 253, 92, 173, 76, 35, 192, 165, 12, 184, 100, 125, 125, 1, 151, 159, - 214, 218, 78, 107, 101, 30, 199, 171, 53, 61, 62, 128, 203, 239, 107, - 173, 225, 106, 101, 36, 192, 165, 5, 112, 201, 108, 227, 32, 224, 114, - 215, 177, 159, 104, 173, 76, 133, 181, 179, 20, 250, 72, 84, 65, 185, - 110, 194, 120, 174, 86, 38, 16, 112, 89, 31, 112, 89, 143, 155, 31, - 20, 150, 217, 94, 153, 31, 165, 177, 86, 134, 223, 67, 243, 241, 248, - 20, 112, 249, 41, 224, 242, 211, 119, 112, 137, 115, 98, 126, 30, 251, - 53, 87, 43, 243, 53, 87, 43, 243, 245, 59, 181, 50, 17, 240, 70, - 17, 78, 181, 50, 23, 135, 176, 90, 153, 175, 180, 246, 245, 32, 94, - 94, 47, 193, 215, 202, 68, 0, 46, 35, 0, 151, 172, 111, 5, 136, - 151, 249, 35, 89, 173, 12, 89, 131, 21, 7, 92, 30, 28, 58, 82, - 184, 15, 134, 181, 50, 3, 70, 178, 90, 153, 65, 235, 88, 173, 76, - 151, 123, 124, 173, 204, 64, 192, 229, 0, 192, 37, 171, 59, 201, 229, - 181, 67, 170, 114, 136, 213, 202, 180, 30, 198, 106, 101, 46, 237, 226, - 107, 101, 250, 1, 46, 251, 2, 46, 251, 56, 213, 202, 108, 152, 199, - 106, 101, 124, 94, 135, 154, 73, 188, 236, 217, 163, 155, 48, 215, 82, - 8, 112, 185, 227, 18, 171, 149, 185, 244, 136, 213, 202, 220, 200, 221, - 145, 171, 149, 9, 3, 92, 246, 6, 92, 246, 102, 53, 188, 128, 203, - 99, 109, 191, 166, 184, 236, 92, 65, 173, 143, 153, 6, 241, 210, 251, - 62, 95, 43, 211, 19, 112, 217, 19, 112, 217, 139, 246, 125, 24, 123, - 77, 234, 62, 159, 213, 202, 180, 46, 174, 214, 202, 28, 1, 92, 222, - 252, 190, 23, 87, 43, 19, 6, 184, 236, 3, 184, 236, 75, 251, 174, - 133, 120, 57, 125, 87, 95, 90, 43, 243, 97, 45, 181, 246, 229, 38, - 224, 114, 206, 15, 3, 184, 90, 153, 126, 128, 203, 126, 128, 75, 86, - 163, 243, 10, 112, 233, 253, 39, 171, 149, 217, 33, 247, 167, 181, 50, - 214, 147, 124, 173, 76, 127, 192, 101, 63, 192, 101, 63, 167, 120, 121, - 173, 127, 95, 90, 43, 211, 120, 103, 95, 90, 43, 243, 91, 217, 126, - 92, 173, 76, 63, 192, 101, 63, 192, 101, 63, 167, 120, 57, 243, 139, - 1, 180, 86, 230, 220, 124, 181, 166, 231, 109, 84, 30, 121, 212, 103, - 131, 185, 90, 153, 254, 128, 203, 254, 128, 75, 102, 27, 79, 1, 151, - 211, 231, 177, 90, 153, 171, 221, 212, 90, 153, 87, 128, 203, 218, 213, - 249, 90, 153, 129, 128, 203, 129, 128, 203, 65, 78, 241, 146, 237, 223, - 250, 81, 26, 107, 101, 248, 125, 93, 31, 232, 83, 16, 254, 138, 112, - 125, 105, 78, 97, 45, 151, 187, 158, 5, 235, 228, 20, 189, 156, 194, - 103, 108, 189, 155, 4, 109, 183, 187, 145, 83, 72, 226, 214, 226, 73, - 140, 127, 194, 54, 227, 114, 215, 161, 156, 12, 43, 188, 147, 67, 147, - 227, 191, 205, 184, 220, 53, 242, 165, 235, 125, 160, 201, 88, 146, 210, - 140, 203, 93, 155, 182, 59, 231, 20, 80, 166, 226, 27, 211, 140, 203, - 93, 163, 222, 141, 220, 239, 241, 223, 102, 236, 126, 15, 234, 211, 200, - 253, 30, 75, 154, 177, 251, 61, 136, 19, 154, 135, 155, 6, 118, 176, - 86, 15, 51, 172, 190, 204, 31, 250, 38, 206, 112, 35, 119, 61, 139, - 203, 249, 206, 228, 114, 215, 51, 140, 195, 12, 242, 165, 185, 107, 160, - 81, 166, 146, 35, 155, 110, 28, 102, 252, 57, 25, 56, 110, 50, 150, - 144, 233, 198, 97, 6, 249, 58, 229, 174, 53, 25, 142, 105, 198, 97, - 6, 245, 110, 228, 126, 15, 234, 216, 200, 253, 158, 144, 233, 198, 238, - 247, 160, 238, 140, 220, 239, 65, 156, 208, 154, 204, 73, 96, 7, 179, - 244, 48, 195, 234, 203, 28, 83, 1, 99, 83, 220, 136, 51, 83, 185, - 56, 51, 149, 241, 207, 152, 108, 96, 156, 225, 100, 56, 224, 157, 28, - 154, 28, 235, 100, 227, 48, 131, 124, 233, 56, 128, 38, 99, 241, 157, - 108, 28, 102, 66, 167, 100, 201, 93, 79, 209, 206, 71, 76, 50, 14, - 51, 168, 119, 35, 227, 140, 117, 178, 177, 113, 198, 119, 178, 177, 113, - 6, 117, 103, 100, 156, 65, 156, 208, 154, 204, 56, 176, 131, 105, 58, - 152, 225, 234, 203, 18, 39, 130, 63, 159, 160, 143, 25, 108, 71, 99, - 192, 68, 198, 63, 105, 188, 113, 152, 241, 231, 100, 36, 194, 59, 37, - 106, 114, 44, 227, 141, 195, 12, 242, 165, 227, 0, 154, 140, 37, 61, - 222, 56, 204, 248, 79, 200, 114, 134, 121, 130, 118, 62, 34, 222, 56, - 204, 160, 222, 141, 140, 51, 150, 241, 198, 198, 25, 212, 167, 145, 113, - 38, 52, 222, 216, 56, 131, 56, 33, 152, 9, 240, 7, 59, 152, 164, - 135, 25, 118, 230, 51, 20, 250, 58, 172, 250, 152, 193, 118, 52, 6, - 196, 50, 254, 17, 86, 227, 48, 131, 124, 105, 12, 0, 26, 101, 42, - 243, 191, 196, 1, 134, 97, 38, 148, 147, 129, 227, 38, 99, 9, 240, - 31, 104, 24, 102, 144, 175, 83, 77, 166, 38, 35, 201, 223, 56, 204, - 160, 222, 141, 140, 51, 168, 99, 67, 207, 175, 249, 15, 52, 52, 206, - 160, 238, 140, 140, 51, 136, 19, 186, 158, 169, 28, 238, 237, 136, 115, - 129, 153, 190, 35, 6, 245, 30, 58, 98, 88, 173, 129, 189, 77, 195, - 121, 31, 248, 113, 184, 183, 127, 173, 112, 253, 218, 127, 104, 71, 253, - 51, 208, 244, 252, 90, 205, 240, 108, 237, 160, 88, 197, 49, 54, 143, - 37, 203, 27, 168, 152, 201, 231, 210, 14, 106, 118, 169, 193, 226, 12, - 39, 35, 17, 222, 41, 81, 147, 99, 173, 145, 189, 140, 69, 99, 110, - 216, 74, 12, 159, 159, 172, 98, 198, 181, 140, 95, 254, 153, 195, 214, - 76, 181, 184, 113, 0, 77, 198, 18, 80, 45, 123, 25, 11, 23, 22, - 218, 186, 219, 119, 191, 77, 197, 140, 107, 25, 135, 151, 109, 100, 231, - 125, 56, 25, 38, 77, 166, 50, 71, 171, 156, 189, 140, 55, 199, 218, - 154, 175, 79, 34, 152, 113, 45, 227, 199, 251, 209, 10, 102, 202, 120, - 170, 122, 175, 162, 180, 84, 235, 3, 80, 143, 132, 31, 161, 155, 109, - 152, 43, 177, 231, 38, 211, 34, 83, 101, 211, 50, 83, 21, 211, 10, - 110, 159, 228, 81, 171, 250, 242, 157, 61, 205, 108, 164, 62, 128, 180, - 207, 101, 111, 45, 47, 110, 86, 73, 24, 163, 222, 200, 237, 228, 143, - 251, 23, 214, 218, 124, 43, 47, 216, 252, 70, 193, 147, 167, 189, 147, - 124, 114, 225, 25, 97, 60, 122, 45, 135, 202, 163, 82, 227, 180, 54, - 189, 228, 53, 254, 179, 212, 190, 209, 97, 114, 245, 30, 243, 132, 125, - 223, 196, 246, 147, 171, 174, 189, 170, 181, 25, 40, 127, 120, 197, 219, - 166, 230, 84, 195, 229, 157, 131, 202, 138, 223, 57, 118, 136, 188, 165, - 36, 217, 151, 29, 46, 223, 89, 209, 88, 235, 59, 82, 46, 219, 160, - 141, 78, 223, 49, 114, 163, 159, 191, 177, 145, 122, 8, 203, 69, 149, - 246, 140, 182, 202, 13, 58, 181, 215, 233, 27, 47, 103, 206, 104, 162, - 181, 153, 40, 199, 167, 52, 212, 250, 78, 150, 125, 110, 125, 162, 211, - 119, 154, 124, 114, 211, 135, 180, 174, 136, 208, 155, 31, 37, 112, 207, - 179, 143, 211, 104, 47, 136, 33, 222, 94, 16, 19, 196, 94, 8, 221, - 20, 236, 133, 61, 71, 123, 169, 2, 246, 82, 25, 236, 133, 237, 119, - 63, 0, 123, 169, 55, 182, 53, 181, 23, 210, 30, 237, 101, 234, 200, - 5, 186, 246, 210, 192, 103, 19, 181, 151, 139, 197, 213, 253, 57, 180, - 151, 137, 85, 46, 217, 244, 236, 197, 179, 92, 110, 59, 177, 151, 23, - 149, 189, 236, 196, 94, 30, 69, 231, 210, 57, 15, 210, 79, 182, 4, - 220, 178, 17, 123, 73, 40, 245, 143, 166, 251, 112, 217, 225, 181, 75, - 215, 94, 142, 62, 249, 131, 218, 75, 253, 207, 23, 83, 123, 89, 250, - 211, 44, 93, 123, 105, 177, 207, 74, 237, 101, 211, 144, 209, 90, 95, - 171, 252, 162, 102, 152, 174, 189, 228, 13, 137, 164, 246, 146, 80, 49, - 142, 218, 75, 153, 178, 19, 117, 237, 229, 193, 103, 51, 168, 189, 16, - 26, 237, 133, 61, 23, 219, 11, 250, 67, 222, 94, 208, 191, 17, 123, - 33, 244, 195, 245, 115, 37, 246, 28, 237, 165, 20, 216, 75, 57, 176, - 23, 182, 175, 91, 0, 236, 165, 225, 229, 130, 169, 196, 94, 72, 251, - 218, 96, 47, 77, 79, 36, 10, 127, 183, 247, 26, 181, 147, 63, 170, - 217, 192, 78, 236, 229, 120, 201, 117, 202, 187, 191, 181, 117, 146, 219, - 87, 243, 16, 214, 134, 239, 7, 123, 217, 119, 220, 210, 144, 216, 75, - 241, 151, 181, 20, 186, 5, 216, 203, 39, 69, 42, 9, 235, 183, 242, - 197, 245, 147, 107, 248, 5, 5, 18, 123, 217, 212, 113, 161, 34, 55, - 15, 216, 75, 249, 114, 213, 133, 239, 92, 53, 110, 136, 188, 164, 29, - 57, 251, 50, 92, 158, 88, 82, 221, 171, 47, 3, 246, 98, 186, 122, - 95, 216, 119, 30, 216, 75, 219, 147, 213, 82, 137, 189, 212, 111, 80, - 95, 161, 247, 69, 89, 229, 118, 47, 58, 165, 138, 250, 62, 1, 123, - 169, 176, 131, 220, 87, 61, 81, 142, 90, 165, 182, 71, 123, 217, 250, - 93, 143, 84, 49, 62, 166, 201, 175, 242, 69, 164, 18, 123, 33, 52, - 218, 11, 123, 46, 182, 23, 140, 109, 188, 189, 96, 172, 34, 246, 66, - 104, 140, 71, 236, 57, 218, 203, 72, 176, 151, 81, 96, 47, 236, 123, - 120, 143, 193, 94, 58, 85, 142, 166, 245, 106, 164, 189, 39, 216, 139, - 185, 132, 78, 205, 25, 248, 151, 165, 118, 210, 230, 91, 185, 214, 153, - 24, 51, 241, 47, 155, 117, 214, 31, 111, 192, 94, 246, 47, 32, 109, - 122, 201, 125, 126, 214, 250, 130, 189, 84, 254, 77, 167, 47, 248, 151, - 243, 247, 72, 155, 129, 242, 39, 103, 73, 223, 112, 121, 198, 110, 113, - 95, 19, 216, 203, 207, 179, 73, 155, 225, 242, 63, 23, 181, 26, 59, - 176, 151, 247, 106, 69, 139, 199, 11, 246, 242, 180, 123, 36, 173, 207, - 155, 180, 69, 187, 187, 19, 252, 203, 202, 190, 99, 205, 122, 254, 37, - 173, 15, 105, 51, 81, 14, 121, 61, 198, 76, 236, 229, 210, 156, 49, - 102, 61, 255, 242, 89, 250, 104, 90, 219, 71, 104, 180, 23, 246, 92, - 39, 159, 8, 246, 66, 247, 173, 204, 225, 222, 1, 254, 194, 57, 171, - 83, 109, 159, 163, 82, 184, 119, 104, 69, 253, 57, 43, 182, 99, 223, - 197, 97, 115, 175, 140, 10, 238, 206, 89, 93, 175, 93, 48, 230, 178, - 239, 226, 132, 115, 223, 197, 129, 185, 183, 38, 199, 90, 193, 221, 57, - 171, 107, 25, 232, 167, 217, 119, 113, 184, 113, 0, 77, 198, 226, 91, - 193, 221, 57, 171, 107, 25, 136, 109, 58, 142, 138, 206, 115, 86, 148, - 169, 204, 93, 253, 221, 157, 179, 186, 150, 129, 246, 64, 243, 137, 21, - 194, 157, 106, 221, 216, 220, 197, 106, 38, 244, 101, 217, 102, 17, 205, - 105, 156, 242, 137, 89, 248, 177, 216, 102, 53, 19, 26, 249, 137, 98, - 158, 83, 62, 49, 11, 63, 230, 251, 172, 102, 66, 35, 63, 145, 79, - 116, 202, 39, 250, 59, 243, 99, 216, 176, 154, 9, 141, 252, 68, 152, - 113, 218, 183, 50, 51, 204, 164, 7, 130, 29, 112, 235, 9, 215, 152, - 97, 181, 125, 254, 208, 55, 177, 161, 62, 102, 176, 29, 93, 131, 5, - 51, 254, 1, 254, 198, 97, 6, 249, 210, 53, 24, 208, 40, 83, 145, - 209, 208, 56, 204, 248, 115, 50, 112, 220, 100, 44, 105, 65, 198, 97, - 6, 249, 58, 237, 91, 105, 50, 66, 130, 140, 195, 76, 0, 103, 67, - 38, 175, 200, 84, 87, 152, 49, 141, 42, 231, 54, 102, 80, 199, 60, - 63, 87, 152, 65, 126, 238, 98, 6, 245, 73, 249, 121, 70, 166, 186, - 194, 12, 242, 115, 23, 51, 33, 65, 206, 239, 231, 10, 51, 200, 207, - 93, 204, 32, 78, 232, 253, 36, 159, 129, 29, 152, 245, 48, 195, 106, - 251, 66, 160, 111, 122, 125, 125, 204, 96, 59, 250, 45, 169, 6, 140, - 127, 104, 125, 227, 48, 131, 124, 233, 183, 164, 128, 70, 153, 74, 44, - 171, 103, 28, 102, 66, 56, 25, 56, 110, 50, 22, 107, 61, 227, 48, - 131, 124, 121, 204, 132, 104, 50, 124, 235, 25, 135, 25, 212, 123, 78, - 49, 195, 231, 184, 81, 199, 57, 197, 12, 207, 207, 90, 47, 231, 152, - 225, 249, 249, 214, 203, 57, 102, 248, 185, 25, 226, 132, 96, 38, 164, - 46, 216, 65, 160, 30, 102, 88, 109, 159, 47, 244, 77, 248, 68, 31, - 51, 216, 142, 126, 75, 234, 83, 198, 223, 255, 147, 156, 97, 134, 207, - 39, 34, 95, 250, 45, 41, 160, 81, 166, 146, 187, 254, 95, 206, 48, - 195, 231, 19, 125, 57, 25, 56, 110, 50, 22, 203, 255, 114, 134, 25, - 62, 159, 136, 124, 121, 204, 248, 106, 50, 210, 235, 230, 12, 51, 36, - 159, 24, 164, 233, 157, 216, 80, 232, 246, 130, 91, 43, 109, 29, 253, - 78, 62, 209, 226, 88, 102, 254, 59, 178, 100, 182, 249, 68, 167, 28, - 247, 255, 156, 249, 237, 154, 243, 213, 59, 249, 38, 228, 247, 121, 181, - 5, 217, 230, 155, 156, 206, 0, 113, 252, 28, 53, 11, 109, 173, 177, - 173, 96, 106, 214, 124, 68, 250, 237, 101, 230, 184, 203, 137, 217, 230, - 35, 156, 238, 158, 175, 203, 189, 223, 182, 130, 91, 227, 11, 190, 187, - 94, 245, 135, 247, 91, 84, 38, 38, 219, 245, 42, 31, 103, 16, 39, - 116, 110, 22, 0, 118, 240, 153, 30, 102, 88, 109, 95, 122, 29, 240, - 231, 181, 245, 49, 131, 237, 104, 12, 168, 195, 248, 87, 79, 111, 227, - 38, 102, 138, 186, 180, 3, 252, 255, 52, 6, 112, 50, 210, 225, 157, - 210, 53, 57, 213, 3, 58, 187, 137, 25, 215, 50, 240, 255, 211, 113, - 212, 230, 198, 1, 52, 25, 75, 223, 142, 239, 229, 114, 15, 51, 174, - 101, 224, 255, 167, 227, 168, 237, 140, 25, 148, 169, 140, 35, 173, 165, - 155, 152, 113, 45, 99, 231, 191, 234, 190, 213, 112, 47, 85, 239, 85, - 148, 150, 234, 153, 104, 212, 35, 225, 71, 104, 60, 19, 205, 158, 187, - 190, 215, 99, 107, 235, 76, 203, 247, 85, 167, 164, 144, 51, 209, 43, - 158, 169, 185, 243, 224, 33, 97, 210, 136, 15, 74, 101, 169, 33, 170, - 98, 138, 226, 242, 247, 119, 167, 44, 144, 24, 86, 151, 211, 124, 191, - 87, 244, 74, 73, 132, 85, 147, 82, 235, 182, 90, 242, 88, 190, 86, - 147, 155, 36, 141, 251, 106, 122, 138, 154, 159, 92, 39, 201, 47, 91, - 166, 136, 115, 70, 27, 165, 207, 150, 142, 79, 33, 231, 169, 71, 108, - 249, 86, 203, 223, 39, 75, 97, 31, 84, 23, 231, 254, 99, 237, 210, - 249, 106, 223, 213, 83, 159, 166, 73, 3, 150, 188, 215, 64, 149, 187, - 93, 58, 52, 48, 190, 129, 56, 247, 176, 75, 90, 31, 126, 96, 11, - 57, 139, 125, 98, 183, 99, 139, 42, 119, 159, 244, 212, 255, 201, 22, - 113, 223, 131, 210, 185, 233, 73, 245, 201, 89, 236, 251, 55, 91, 52, - 80, 251, 30, 149, 54, 239, 74, 212, 145, 123, 66, 42, 220, 35, 87, - 32, 57, 139, 189, 227, 246, 43, 173, 239, 25, 169, 103, 225, 7, 58, - 125, 207, 75, 219, 242, 183, 104, 64, 206, 98, 87, 11, 91, 83, 95, - 237, 123, 89, 58, 240, 225, 221, 205, 98, 61, 95, 147, 22, 87, 251, - 117, 11, 57, 139, 221, 170, 176, 90, 247, 233, 25, 125, 91, 26, 208, - 108, 113, 178, 88, 238, 93, 233, 248, 223, 249, 83, 200, 89, 236, 139, - 129, 149, 181, 223, 247, 161, 116, 51, 41, 72, 103, 143, 229, 137, 212, - 97, 76, 227, 20, 114, 22, 187, 219, 244, 38, 218, 239, 251, 82, 234, - 189, 164, 169, 78, 223, 215, 82, 249, 163, 117, 73, 27, 249, 238, 214, - 122, 170, 92, 179, 135, 108, 91, 221, 80, 108, 87, 105, 158, 242, 94, - 223, 182, 90, 27, 47, 249, 229, 228, 112, 173, 111, 110, 249, 7, 211, - 4, 157, 190, 121, 228, 34, 219, 22, 106, 109, 242, 202, 253, 191, 93, - 175, 245, 205, 39, 239, 188, 191, 87, 167, 175, 143, 44, 21, 184, 171, - 181, 121, 79, 126, 147, 223, 83, 205, 213, 155, 11, 200, 29, 103, 23, - 176, 137, 251, 22, 148, 43, 39, 19, 156, 250, 202, 45, 211, 253, 181, - 190, 133, 229, 17, 215, 171, 234, 244, 45, 34, 179, 61, 58, 63, 74, - 159, 27, 243, 190, 204, 239, 221, 249, 120, 84, 49, 21, 132, 191, 34, - 30, 85, 156, 230, 127, 138, 31, 2, 223, 76, 252, 16, 214, 50, 162, - 175, 37, 126, 136, 208, 193, 224, 135, 216, 115, 215, 126, 104, 19, 248, - 161, 73, 211, 6, 211, 154, 169, 164, 120, 117, 62, 219, 16, 252, 80, - 193, 70, 191, 113, 126, 168, 178, 82, 203, 24, 197, 237, 11, 161, 31, - 98, 49, 126, 57, 221, 71, 66, 63, 36, 138, 241, 196, 15, 37, 29, - 75, 177, 17, 63, 228, 255, 249, 46, 27, 241, 67, 227, 109, 135, 108, - 122, 126, 232, 147, 149, 187, 109, 196, 15, 21, 59, 170, 237, 41, 129, - 31, 122, 241, 226, 136, 206, 62, 137, 93, 250, 170, 231, 85, 27, 241, - 67, 23, 199, 223, 176, 17, 63, 52, 224, 247, 219, 54, 61, 63, 36, - 247, 38, 123, 86, 123, 164, 31, 219, 95, 212, 250, 238, 147, 30, 124, - 113, 222, 166, 231, 135, 230, 103, 92, 176, 17, 63, 52, 235, 249, 57, - 27, 241, 67, 19, 77, 103, 109, 122, 126, 232, 230, 193, 99, 54, 226, - 135, 110, 141, 59, 102, 35, 126, 232, 118, 141, 99, 54, 61, 63, 244, - 100, 196, 105, 27, 241, 67, 77, 125, 206, 106, 239, 124, 89, 154, 183, - 248, 156, 78, 223, 107, 210, 23, 59, 201, 187, 221, 148, 218, 154, 200, - 59, 223, 150, 186, 4, 233, 245, 189, 43, 213, 142, 39, 58, 201, 144, - 98, 147, 72, 223, 135, 210, 145, 243, 122, 227, 125, 34, 237, 137, 63, - 101, 35, 126, 168, 200, 193, 147, 54, 226, 135, 58, 23, 59, 97, 211, - 243, 67, 11, 70, 81, 157, 200, 37, 226, 143, 218, 136, 31, 250, 126, - 166, 216, 54, 176, 38, 100, 93, 200, 113, 27, 241, 67, 129, 245, 14, - 218, 136, 31, 218, 90, 254, 111, 155, 158, 31, 202, 252, 125, 157, 141, - 248, 161, 194, 214, 165, 54, 226, 135, 170, 118, 248, 65, 252, 206, 224, - 135, 154, 140, 140, 177, 17, 63, 180, 171, 239, 112, 234, 135, 90, 117, - 234, 167, 235, 135, 98, 170, 140, 165, 126, 104, 173, 35, 150, 250, 161, - 95, 215, 76, 212, 245, 67, 108, 239, 215, 143, 210, 232, 135, 248, 61, - 97, 31, 143, 202, 224, 135, 42, 131, 31, 170, 252, 142, 31, 194, 249, - 27, 241, 67, 117, 192, 15, 225, 124, 140, 248, 33, 66, 251, 130, 31, - 98, 207, 93, 215, 84, 159, 106, 153, 105, 217, 59, 238, 137, 157, 248, - 33, 219, 179, 252, 202, 92, 255, 252, 224, 48, 105, 250, 238, 114, 169, - 204, 15, 149, 1, 63, 84, 10, 252, 80, 73, 218, 247, 231, 137, 11, - 36, 182, 54, 88, 78, 247, 39, 87, 131, 31, 18, 173, 13, 176, 239, - 124, 240, 67, 81, 117, 138, 216, 137, 31, 122, 254, 170, 182, 66, 23, - 138, 91, 39, 189, 120, 212, 70, 184, 119, 55, 125, 242, 70, 105, 81, - 129, 221, 180, 30, 59, 104, 137, 250, 158, 159, 140, 79, 150, 170, 222, - 234, 40, 92, 199, 175, 29, 101, 151, 118, 46, 93, 147, 74, 252, 80, - 224, 201, 93, 10, 93, 115, 244, 118, 201, 49, 236, 156, 176, 111, 25, - 240, 67, 167, 111, 253, 147, 74, 252, 80, 100, 137, 11, 10, 221, 10, - 252, 208, 31, 77, 174, 10, 251, 182, 138, 59, 40, 221, 124, 118, 55, - 149, 248, 161, 164, 230, 207, 20, 186, 60, 248, 161, 41, 33, 166, 173, - 194, 189, 89, 240, 67, 59, 46, 228, 219, 74, 252, 208, 226, 203, 42, - 125, 23, 252, 208, 152, 235, 249, 132, 125, 143, 96, 109, 90, 11, 194, - 223, 33, 249, 44, 83, 229, 174, 143, 186, 44, 125, 244, 215, 61, 225, - 59, 223, 1, 63, 148, 239, 244, 245, 84, 226, 135, 174, 238, 184, 168, - 208, 143, 162, 110, 75, 101, 254, 60, 37, 236, 187, 11, 252, 208, 164, - 190, 135, 83, 137, 31, 170, 26, 176, 79, 161, 79, 68, 61, 148, 22, - 60, 223, 41, 236, 123, 23, 252, 208, 119, 189, 183, 165, 18, 63, 244, - 96, 108, 170, 66, 123, 131, 31, 234, 146, 144, 34, 236, 219, 44, 238, - 181, 84, 107, 86, 50, 105, 35, 119, 201, 220, 160, 254, 70, 224, 135, - 230, 244, 249, 83, 216, 183, 15, 248, 161, 237, 127, 47, 77, 37, 126, - 40, 224, 192, 124, 133, 238, 15, 126, 104, 251, 222, 233, 194, 190, 23, - 192, 15, 61, 249, 136, 228, 144, 242, 202, 251, 39, 169, 251, 195, 169, - 193, 249, 228, 207, 110, 215, 19, 246, 93, 8, 126, 104, 66, 177, 146, - 169, 196, 15, 149, 159, 158, 71, 161, 255, 10, 46, 32, 47, 42, 126, - 83, 136, 133, 116, 240, 67, 229, 158, 239, 179, 19, 63, 180, 183, 101, - 170, 66, 63, 8, 46, 44, 63, 249, 109, 173, 176, 239, 107, 240, 67, - 236, 76, 129, 31, 165, 207, 131, 31, 226, 207, 26, 248, 120, 148, 3, - 63, 84, 14, 252, 80, 185, 119, 231, 67, 176, 198, 227, 231, 67, 184, - 102, 35, 126, 136, 208, 184, 46, 99, 207, 93, 223, 235, 102, 135, 249, - 208, 79, 199, 163, 104, 173, 234, 244, 25, 42, 45, 193, 124, 40, 195, - 28, 197, 213, 170, 142, 4, 63, 52, 18, 252, 208, 72, 182, 31, 15, - 243, 33, 150, 83, 88, 78, 247, 189, 61, 193, 15, 137, 114, 10, 106, - 220, 90, 45, 253, 189, 135, 180, 73, 146, 198, 172, 81, 233, 50, 48, - 31, 170, 57, 87, 188, 159, 108, 141, 219, 40, 125, 95, 192, 74, 235, - 92, 79, 29, 83, 247, 135, 207, 195, 124, 200, 54, 85, 188, 175, 107, - 129, 249, 80, 205, 149, 164, 222, 49, 77, 138, 243, 80, 235, 32, 199, - 68, 109, 151, 54, 119, 236, 43, 236, 155, 1, 126, 232, 100, 173, 190, - 180, 70, 182, 244, 76, 181, 70, 246, 125, 240, 67, 157, 239, 246, 18, - 246, 173, 0, 126, 168, 235, 10, 86, 35, 59, 176, 128, 90, 35, 91, - 28, 252, 144, 121, 72, 23, 97, 223, 21, 224, 135, 252, 127, 106, 79, - 107, 100, 135, 207, 83, 233, 175, 193, 15, 237, 153, 219, 94, 216, 247, - 58, 248, 33, 207, 65, 93, 104, 141, 236, 154, 199, 106, 61, 238, 69, - 240, 67, 101, 35, 123, 8, 251, 62, 2, 63, 212, 46, 162, 23, 173, - 145, 141, 170, 22, 166, 213, 125, 222, 150, 126, 188, 208, 71, 216, 247, - 1, 248, 161, 31, 31, 176, 251, 228, 194, 139, 171, 181, 167, 248, 77, - 137, 250, 13, 7, 10, 251, 98, 141, 236, 145, 251, 3, 105, 141, 108, - 224, 164, 65, 102, 50, 31, 90, 90, 46, 92, 216, 55, 47, 248, 161, - 136, 206, 180, 141, 60, 161, 251, 96, 90, 35, 187, 52, 44, 66, 216, - 55, 55, 248, 161, 13, 195, 135, 210, 26, 217, 4, 179, 90, 231, 234, - 5, 126, 104, 140, 207, 72, 97, 223, 103, 224, 135, 138, 158, 34, 185, - 103, 88, 151, 117, 85, 207, 29, 188, 0, 63, 180, 230, 234, 56, 241, - 120, 193, 15, 205, 44, 18, 69, 235, 107, 187, 167, 170, 244, 91, 240, - 67, 1, 253, 197, 231, 35, 112, 62, 244, 123, 18, 105, 227, 43, 231, - 58, 173, 210, 56, 31, 10, 245, 136, 49, 235, 205, 135, 216, 89, 21, - 63, 74, 227, 124, 136, 63, 195, 226, 227, 49, 10, 252, 208, 40, 240, - 67, 163, 222, 201, 163, 99, 30, 144, 158, 203, 45, 19, 238, 29, 82, - 87, 47, 39, 200, 106, 115, 67, 160, 111, 98, 57, 55, 246, 158, 2, - 184, 125, 206, 242, 220, 126, 109, 57, 3, 247, 107, 203, 115, 251, 181, - 64, 163, 76, 197, 67, 148, 53, 112, 191, 150, 147, 129, 227, 38, 99, - 9, 41, 107, 224, 126, 109, 185, 44, 251, 181, 154, 12, 71, 25, 3, - 247, 107, 203, 25, 187, 95, 139, 58, 54, 114, 191, 54, 164, 172, 177, - 251, 181, 168, 59, 35, 247, 107, 17, 39, 180, 206, 176, 68, 184, 119, - 122, 128, 30, 102, 88, 109, 174, 163, 116, 184, 119, 104, 41, 55, 206, - 5, 149, 230, 206, 211, 148, 230, 206, 5, 149, 52, 240, 92, 16, 39, - 195, 1, 239, 228, 208, 228, 88, 75, 26, 120, 46, 168, 20, 55, 14, - 160, 201, 88, 124, 75, 26, 120, 46, 168, 84, 150, 115, 65, 165, 180, - 115, 65, 37, 12, 60, 23, 84, 210, 216, 253, 90, 107, 73, 99, 247, - 107, 125, 75, 26, 187, 95, 139, 186, 51, 114, 191, 22, 113, 66, 235, - 12, 139, 130, 29, 148, 209, 195, 12, 119, 247, 99, 241, 112, 111, 255, - 98, 110, 212, 127, 20, 231, 98, 64, 113, 198, 63, 233, 253, 156, 97, - 166, 88, 209, 143, 26, 210, 24, 192, 201, 72, 132, 119, 74, 212, 228, - 88, 222, 207, 25, 102, 254, 57, 81, 139, 125, 239, 181, 24, 55, 14, - 160, 201, 88, 210, 253, 114, 134, 153, 162, 195, 186, 178, 113, 20, 203, - 82, 255, 81, 76, 229, 29, 234, 151, 51, 204, 28, 168, 206, 213, 25, - 190, 207, 217, 80, 22, 126, 168, 83, 198, 219, 245, 191, 119, 246, 87, - 5, 252, 80, 127, 255, 149, 31, 234, 51, 59, 126, 168, 171, 255, 202, - 47, 84, 192, 15, 245, 226, 46, 63, 90, 103, 88, 148, 97, 38, 32, - 6, 236, 160, 132, 14, 102, 248, 187, 31, 161, 175, 163, 176, 62, 102, - 176, 29, 141, 1, 69, 24, 255, 136, 194, 198, 197, 25, 228, 75, 99, - 0, 208, 40, 83, 105, 84, 216, 184, 56, 19, 202, 201, 192, 113, 147, - 177, 36, 248, 26, 23, 103, 144, 175, 83, 157, 161, 38, 35, 41, 198, - 184, 56, 131, 122, 55, 50, 206, 152, 10, 27, 27, 103, 80, 159, 70, - 198, 25, 212, 157, 145, 113, 6, 113, 66, 48, 147, 49, 22, 236, 160, - 168, 30, 102, 216, 153, 237, 164, 232, 112, 239, 128, 40, 125, 204, 96, - 59, 98, 7, 1, 209, 140, 127, 90, 164, 113, 152, 9, 224, 100, 36, - 193, 59, 37, 105, 114, 66, 34, 141, 195, 12, 242, 165, 227, 0, 154, - 140, 197, 49, 206, 56, 204, 4, 68, 57, 99, 6, 101, 42, 254, 101, - 156, 113, 152, 65, 189, 27, 185, 158, 9, 137, 52, 118, 61, 131, 250, - 52, 114, 61, 19, 49, 206, 216, 245, 12, 226, 132, 222, 97, 52, 4, - 236, 32, 70, 128, 153, 161, 253, 76, 125, 135, 179, 223, 35, 2, 250, - 102, 140, 214, 199, 12, 182, 35, 118, 144, 49, 134, 241, 79, 28, 153, - 189, 29, 116, 191, 227, 101, 75, 159, 82, 52, 72, 84, 155, 235, 8, - 241, 160, 119, 63, 34, 95, 34, 35, 2, 104, 148, 169, 96, 102, 120, - 246, 50, 230, 60, 219, 106, 251, 241, 236, 252, 32, 81, 109, 238, 44, - 207, 82, 20, 51, 17, 156, 12, 28, 55, 29, 203, 208, 236, 101, 60, - 223, 113, 38, 53, 237, 227, 163, 65, 162, 218, 220, 198, 246, 191, 232, - 252, 15, 249, 242, 152, 137, 208, 100, 164, 15, 202, 94, 198, 213, 94, - 125, 204, 193, 30, 177, 194, 218, 220, 95, 158, 176, 218, 92, 212, 59, - 95, 11, 133, 122, 36, 252, 8, 141, 181, 80, 236, 57, 230, 129, 171, - 154, 150, 193, 223, 10, 110, 63, 30, 107, 161, 230, 253, 91, 88, 107, - 211, 66, 38, 237, 177, 22, 106, 212, 235, 87, 194, 250, 55, 172, 181, - 188, 21, 113, 77, 107, 243, 173, 28, 121, 236, 159, 64, 181, 111, 39, - 185, 208, 167, 251, 116, 250, 134, 202, 247, 46, 164, 104, 109, 122, 201, - 77, 63, 248, 83, 161, 115, 101, 246, 149, 195, 234, 139, 239, 100, 125, - 157, 107, 176, 124, 166, 246, 100, 173, 205, 112, 185, 254, 180, 33, 129, - 106, 206, 109, 132, 92, 234, 68, 191, 64, 113, 206, 109, 164, 124, 36, - 79, 31, 173, 205, 104, 185, 119, 175, 111, 180, 190, 99, 228, 23, 219, - 154, 232, 244, 29, 43, 135, 238, 247, 211, 218, 68, 202, 203, 27, 21, - 81, 199, 27, 109, 149, 119, 87, 206, 43, 30, 111, 108, 188, 220, 40, - 101, 137, 214, 102, 162, 124, 239, 223, 149, 90, 223, 201, 242, 143, 101, - 254, 210, 233, 59, 77, 94, 108, 137, 215, 218, 204, 164, 52, 214, 66, - 177, 231, 217, 199, 105, 180, 23, 196, 16, 111, 47, 136, 9, 98, 47, - 132, 70, 123, 97, 207, 201, 57, 10, 231, 243, 92, 104, 47, 173, 31, - 150, 165, 181, 185, 164, 61, 218, 139, 103, 253, 146, 186, 181, 185, 47, - 90, 20, 163, 181, 185, 95, 127, 252, 62, 173, 205, 93, 91, 216, 207, - 166, 103, 47, 227, 182, 23, 181, 17, 123, 177, 135, 22, 181, 17, 123, - 25, 112, 161, 136, 77, 207, 94, 38, 31, 44, 76, 235, 107, 223, 236, - 40, 98, 35, 246, 178, 192, 163, 168, 77, 207, 94, 6, 28, 34, 239, - 54, 90, 110, 28, 95, 212, 70, 236, 165, 108, 189, 34, 54, 61, 123, - 233, 183, 175, 0, 173, 205, 141, 126, 146, 143, 214, 114, 255, 214, 232, - 73, 138, 158, 189, 100, 164, 39, 165, 16, 123, 241, 54, 111, 73, 33, - 246, 82, 110, 245, 182, 20, 61, 123, 41, 86, 185, 36, 173, 205, 37, - 52, 218, 11, 123, 46, 182, 23, 244, 135, 188, 189, 160, 127, 35, 246, - 66, 232, 79, 192, 94, 216, 115, 180, 151, 178, 239, 236, 119, 239, 4, - 123, 233, 82, 117, 18, 189, 35, 146, 180, 127, 15, 236, 229, 180, 148, - 38, 220, 167, 51, 53, 106, 39, 159, 142, 188, 72, 107, 115, 175, 212, - 80, 247, 235, 189, 192, 94, 98, 7, 228, 22, 206, 79, 61, 26, 133, - 202, 231, 7, 21, 73, 37, 246, 178, 113, 134, 186, 87, 158, 15, 236, - 229, 139, 205, 181, 132, 125, 243, 120, 13, 150, 251, 133, 53, 74, 37, - 246, 210, 120, 76, 251, 84, 117, 31, 98, 132, 236, 27, 221, 89, 216, - 215, 107, 219, 72, 57, 176, 114, 207, 84, 98, 47, 15, 246, 246, 211, - 250, 142, 145, 15, 15, 22, 207, 169, 159, 130, 189, 164, 118, 141, 161, - 181, 185, 121, 151, 71, 42, 116, 27, 176, 151, 106, 7, 134, 136, 247, - 247, 193, 94, 198, 7, 123, 209, 218, 220, 15, 60, 212, 239, 149, 183, - 3, 123, 57, 180, 195, 67, 172, 171, 184, 105, 242, 254, 120, 86, 155, - 75, 232, 149, 96, 47, 236, 185, 216, 94, 48, 182, 57, 213, 254, 63, - 97, 103, 157, 9, 141, 254, 133, 61, 71, 123, 25, 245, 206, 190, 36, - 126, 43, 226, 139, 132, 24, 90, 155, 75, 218, 99, 237, 255, 134, 147, - 209, 102, 61, 255, 210, 127, 84, 52, 173, 205, 157, 93, 153, 244, 237, - 36, 111, 62, 18, 165, 91, 155, 107, 233, 21, 69, 107, 115, 77, 215, - 213, 61, 77, 47, 176, 151, 149, 13, 35, 197, 125, 193, 191, 236, 108, - 49, 142, 214, 215, 78, 148, 198, 154, 137, 127, 249, 235, 205, 24, 179, - 158, 127, 121, 188, 144, 180, 25, 45, 123, 53, 24, 99, 38, 254, 197, - 239, 31, 241, 154, 233, 13, 216, 75, 116, 230, 40, 90, 155, 219, 168, - 232, 104, 237, 91, 182, 86, 249, 235, 240, 209, 58, 123, 124, 241, 114, - 252, 158, 40, 90, 155, 27, 127, 37, 74, 235, 59, 89, 142, 127, 19, - 165, 91, 155, 91, 233, 24, 171, 205, 37, 52, 250, 23, 246, 92, 188, - 206, 195, 121, 42, 173, 153, 234, 15, 243, 176, 177, 194, 57, 171, 83, - 109, 174, 9, 250, 166, 15, 212, 159, 179, 98, 59, 250, 189, 215, 8, - 174, 102, 106, 160, 187, 115, 86, 215, 107, 23, 140, 185, 244, 123, 175, - 17, 220, 57, 115, 156, 223, 13, 209, 106, 166, 6, 184, 59, 103, 205, - 38, 103, 9, 126, 154, 238, 191, 13, 226, 206, 203, 195, 187, 147, 177, - 88, 7, 184, 59, 103, 117, 45, 3, 177, 77, 207, 203, 15, 204, 82, - 51, 165, 205, 85, 125, 7, 184, 59, 103, 117, 45, 3, 237, 129, 230, - 215, 6, 58, 215, 170, 178, 185, 139, 213, 76, 104, 172, 85, 21, 205, - 105, 248, 117, 20, 234, 152, 231, 199, 98, 155, 213, 76, 104, 228, 39, - 138, 121, 78, 181, 190, 89, 248, 49, 223, 103, 53, 19, 26, 249, 137, - 124, 162, 83, 173, 111, 22, 126, 12, 27, 86, 51, 161, 145, 159, 8, - 51, 252, 58, 15, 113, 66, 107, 166, 194, 192, 14, 134, 232, 97, 134, - 213, 230, 250, 66, 223, 132, 190, 110, 212, 76, 245, 231, 106, 141, 250, - 113, 53, 83, 125, 141, 195, 12, 242, 165, 53, 83, 64, 163, 76, 37, - 183, 208, 199, 56, 204, 248, 114, 50, 112, 220, 100, 44, 150, 62, 198, - 97, 6, 249, 58, 213, 76, 105, 50, 210, 195, 140, 195, 12, 234, 157, - 207, 21, 184, 194, 12, 230, 10, 220, 197, 12, 234, 152, 231, 231, 10, - 51, 200, 207, 93, 204, 88, 120, 126, 111, 198, 165, 186, 194, 140, 101, - 68, 57, 183, 49, 131, 186, 227, 223, 207, 21, 102, 240, 253, 220, 197, - 12, 226, 132, 96, 198, 183, 7, 216, 65, 127, 61, 204, 176, 218, 220, - 244, 222, 225, 222, 33, 189, 220, 168, 153, 234, 205, 197, 128, 222, 140, - 191, 163, 167, 113, 152, 9, 225, 100, 164, 195, 59, 165, 107, 114, 34, - 122, 26, 135, 25, 228, 75, 199, 1, 52, 29, 75, 79, 227, 48, 19, - 210, 43, 75, 205, 84, 47, 45, 207, 223, 195, 56, 204, 160, 222, 115, - 138, 25, 62, 199, 29, 209, 51, 231, 152, 113, 202, 233, 247, 204, 57, - 102, 156, 114, 250, 61, 114, 142, 25, 126, 110, 134, 56, 161, 103, 138, - 186, 128, 29, 132, 233, 97, 134, 213, 230, 38, 116, 15, 247, 78, 236, - 166, 143, 25, 108, 71, 99, 64, 119, 238, 76, 81, 183, 156, 97, 134, - 207, 39, 250, 114, 50, 18, 66, 1, 251, 154, 156, 180, 174, 57, 195, - 12, 159, 79, 68, 190, 116, 63, 25, 222, 157, 140, 37, 164, 107, 206, - 48, 195, 231, 19, 145, 47, 143, 25, 148, 169, 140, 181, 75, 206, 48, - 67, 242, 137, 65, 154, 222, 169, 13, 109, 43, 184, 53, 108, 97, 222, - 119, 242, 137, 88, 171, 154, 250, 215, 219, 192, 236, 242, 137, 78, 103, - 138, 186, 114, 181, 180, 105, 5, 183, 254, 89, 98, 89, 74, 214, 124, - 147, 47, 240, 251, 95, 169, 234, 217, 230, 155, 156, 114, 250, 28, 63, - 203, 129, 130, 91, 131, 194, 174, 188, 147, 143, 176, 92, 90, 102, 254, - 227, 208, 234, 108, 243, 17, 78, 57, 253, 46, 206, 227, 237, 60, 238, - 221, 245, 42, 142, 183, 88, 193, 152, 108, 215, 171, 78, 103, 138, 186, - 112, 231, 35, 58, 2, 221, 67, 15, 51, 220, 189, 155, 157, 195, 189, - 67, 59, 185, 113, 166, 168, 51, 183, 15, 219, 153, 139, 51, 167, 91, - 184, 137, 25, 215, 245, 166, 121, 255, 215, 184, 62, 221, 135, 229, 100, - 56, 224, 157, 28, 154, 156, 18, 99, 90, 187, 137, 25, 215, 50, 42, - 124, 153, 196, 190, 247, 218, 137, 27, 7, 208, 100, 44, 37, 190, 8, - 113, 19, 51, 174, 101, 148, 77, 219, 199, 246, 147, 59, 101, 57, 83, - 212, 73, 149, 145, 55, 95, 27, 55, 49, 227, 90, 198, 5, 174, 54, - 23, 245, 206, 215, 230, 162, 30, 9, 63, 66, 227, 25, 112, 246, 60, - 251, 218, 220, 232, 113, 73, 26, 174, 2, 164, 66, 219, 47, 42, 180, - 60, 36, 76, 154, 190, 46, 31, 205, 223, 183, 133, 62, 125, 224, 47, - 138, 235, 251, 124, 202, 2, 137, 97, 117, 57, 205, 247, 227, 25, 112, - 17, 86, 77, 218, 25, 240, 25, 242, 125, 173, 77, 146, 180, 97, 210, - 99, 45, 39, 189, 78, 58, 123, 224, 133, 56, 23, 30, 187, 81, 154, - 188, 179, 136, 38, 119, 179, 84, 241, 185, 143, 66, 231, 138, 78, 150, - 54, 215, 204, 21, 36, 206, 31, 216, 165, 192, 190, 27, 52, 254, 105, - 82, 193, 51, 9, 106, 14, 62, 122, 187, 116, 124, 94, 71, 161, 92, - 83, 220, 46, 105, 247, 247, 205, 181, 54, 123, 164, 223, 154, 28, 111, - 160, 202, 221, 39, 5, 63, 243, 169, 47, 234, 155, 25, 123, 80, 242, - 120, 48, 80, 243, 67, 233, 210, 183, 179, 22, 168, 116, 244, 81, 233, - 245, 111, 105, 58, 57, 213, 19, 210, 208, 32, 226, 195, 78, 73, 255, - 244, 94, 171, 229, 99, 207, 72, 65, 179, 82, 116, 234, 152, 207, 75, - 77, 182, 29, 214, 218, 56, 164, 143, 22, 188, 76, 81, 223, 249, 178, - 180, 48, 89, 156, 67, 206, 140, 189, 38, 149, 105, 218, 138, 214, 196, - 217, 71, 132, 168, 121, 111, 172, 137, 251, 237, 43, 221, 154, 184, 159, - 254, 87, 150, 214, 196, 101, 78, 240, 209, 106, 241, 30, 74, 199, 215, - 220, 215, 173, 205, 45, 219, 242, 28, 173, 205, 237, 125, 249, 184, 86, - 215, 251, 82, 90, 51, 234, 160, 110, 109, 110, 197, 149, 23, 104, 109, - 110, 194, 202, 19, 180, 54, 247, 245, 202, 3, 186, 181, 185, 131, 226, - 214, 210, 218, 220, 123, 45, 102, 209, 218, 220, 180, 90, 29, 117, 107, - 115, 223, 92, 74, 214, 234, 79, 243, 202, 235, 122, 236, 221, 164, 246, - 205, 39, 95, 253, 97, 67, 3, 113, 95, 31, 249, 250, 202, 214, 154, - 93, 189, 39, 151, 95, 55, 67, 219, 23, 42, 32, 167, 205, 92, 175, - 179, 47, 84, 80, 94, 52, 230, 140, 214, 198, 87, 110, 242, 213, 29, - 173, 111, 97, 249, 214, 7, 111, 116, 250, 22, 145, 217, 30, 157, 31, - 165, 241, 12, 56, 191, 119, 231, 227, 81, 213, 84, 16, 254, 138, 120, - 84, 125, 167, 22, 5, 125, 51, 241, 67, 211, 193, 15, 161, 175, 37, - 126, 136, 208, 102, 240, 67, 236, 185, 107, 63, 180, 17, 252, 208, 159, - 109, 231, 211, 123, 70, 199, 141, 155, 169, 208, 173, 193, 15, 237, 73, - 142, 231, 252, 80, 53, 240, 67, 213, 192, 15, 177, 251, 12, 95, 128, - 31, 98, 49, 126, 57, 221, 71, 242, 0, 63, 36, 138, 241, 196, 15, - 45, 178, 215, 167, 181, 185, 7, 110, 5, 218, 136, 31, 122, 249, 126, - 176, 110, 109, 238, 165, 243, 53, 104, 109, 238, 245, 253, 31, 219, 136, - 31, 186, 191, 69, 252, 205, 219, 92, 113, 118, 105, 87, 70, 51, 90, - 155, 59, 249, 155, 161, 218, 55, 56, 183, 75, 17, 93, 103, 10, 251, - 62, 141, 221, 37, 245, 248, 114, 55, 173, 205, 61, 220, 228, 8, 173, - 205, 45, 41, 157, 213, 173, 205, 253, 170, 251, 86, 90, 155, 235, 215, - 101, 3, 173, 205, 61, 245, 237, 10, 155, 56, 87, 127, 66, 74, 120, - 243, 43, 173, 205, 125, 82, 102, 182, 246, 206, 103, 164, 38, 35, 35, - 197, 251, 96, 224, 135, 138, 174, 169, 78, 107, 115, 119, 238, 124, 168, - 252, 94, 111, 163, 46, 75, 121, 107, 205, 77, 209, 243, 67, 3, 138, - 94, 79, 38, 126, 232, 169, 41, 81, 253, 166, 0, 248, 33, 191, 34, - 71, 27, 136, 229, 222, 149, 174, 109, 148, 2, 137, 31, 42, 83, 187, - 67, 32, 241, 67, 95, 252, 17, 17, 168, 231, 135, 174, 79, 168, 31, - 72, 252, 208, 166, 247, 106, 4, 18, 63, 52, 245, 187, 18, 129, 122, - 126, 232, 204, 69, 178, 95, 107, 146, 219, 12, 240, 12, 36, 126, 104, - 246, 221, 139, 13, 244, 252, 80, 226, 134, 245, 13, 136, 31, 234, 177, - 245, 117, 125, 226, 135, 102, 183, 59, 182, 69, 207, 15, 21, 251, 188, - 34, 253, 70, 192, 197, 9, 221, 233, 55, 2, 118, 119, 79, 208, 253, - 70, 192, 179, 15, 22, 211, 111, 4, 60, 63, 189, 49, 133, 248, 161, - 204, 201, 7, 83, 244, 252, 208, 190, 67, 79, 83, 136, 31, 170, 177, - 40, 55, 173, 205, 253, 247, 104, 33, 221, 218, 92, 182, 247, 235, 71, - 105, 244, 67, 252, 158, 176, 232, 27, 1, 56, 127, 35, 126, 168, 50, - 248, 33, 156, 143, 17, 63, 68, 232, 194, 224, 135, 216, 115, 215, 181, - 185, 105, 45, 51, 45, 63, 127, 243, 146, 214, 230, 174, 120, 163, 214, - 230, 22, 3, 63, 180, 237, 227, 50, 194, 218, 220, 197, 224, 135, 216, - 218, 96, 57, 221, 159, 244, 3, 63, 36, 90, 27, 96, 223, 123, 224, - 135, 110, 252, 246, 3, 173, 205, 141, 45, 49, 67, 221, 111, 4, 63, - 212, 102, 90, 188, 112, 175, 178, 101, 220, 70, 233, 211, 162, 83, 104, - 109, 238, 130, 179, 125, 20, 218, 10, 126, 232, 195, 248, 134, 194, 190, - 131, 97, 62, 228, 63, 99, 20, 245, 67, 151, 231, 239, 84, 126, 195, - 212, 168, 237, 82, 88, 254, 230, 58, 54, 190, 75, 106, 80, 167, 2, - 253, 86, 201, 240, 193, 241, 74, 223, 254, 224, 135, 94, 62, 54, 9, - 127, 243, 21, 241, 7, 165, 144, 133, 85, 169, 31, 58, 253, 67, 1, - 229, 61, 95, 91, 143, 74, 63, 72, 67, 133, 239, 252, 19, 248, 161, - 157, 253, 30, 208, 123, 150, 111, 204, 174, 164, 252, 46, 255, 195, 154, - 184, 200, 86, 194, 188, 197, 142, 184, 243, 210, 245, 95, 172, 236, 254, - 243, 195, 243, 20, 250, 36, 248, 161, 231, 30, 226, 90, 85, 71, 228, - 53, 201, 199, 124, 146, 214, 230, 22, 41, 171, 214, 34, 207, 143, 186, - 45, 237, 185, 117, 77, 216, 55, 22, 252, 80, 163, 58, 71, 104, 109, - 174, 215, 133, 125, 90, 77, 240, 67, 105, 255, 52, 113, 109, 238, 85, - 240, 67, 35, 62, 98, 181, 185, 105, 77, 213, 218, 220, 220, 224, 135, - 170, 134, 234, 215, 230, 166, 218, 89, 109, 238, 207, 245, 55, 42, 116, - 8, 248, 161, 216, 245, 226, 241, 246, 223, 230, 41, 215, 121, 194, 106, - 115, 59, 159, 82, 107, 115, 7, 130, 31, 10, 93, 47, 174, 205, 61, - 9, 126, 168, 116, 195, 193, 180, 54, 247, 247, 196, 182, 234, 55, 151, - 131, 243, 201, 62, 5, 197, 181, 185, 75, 192, 15, 109, 241, 103, 181, - 185, 247, 207, 169, 181, 185, 91, 130, 11, 200, 195, 155, 220, 18, 218, - 198, 17, 240, 67, 131, 106, 30, 160, 181, 185, 193, 83, 183, 210, 218, - 220, 248, 127, 215, 233, 214, 230, 178, 51, 5, 126, 148, 198, 218, 92, - 254, 172, 129, 168, 54, 23, 215, 120, 124, 109, 238, 5, 174, 54, 247, - 2, 87, 155, 123, 193, 141, 218, 220, 113, 251, 88, 109, 110, 105, 173, - 54, 23, 215, 101, 133, 191, 20, 215, 230, 226, 186, 140, 229, 20, 150, - 211, 125, 111, 92, 151, 137, 114, 10, 100, 62, 148, 191, 41, 171, 205, - 173, 212, 149, 124, 235, 121, 157, 20, 56, 82, 167, 166, 16, 230, 67, - 165, 70, 199, 208, 218, 220, 61, 9, 164, 111, 178, 52, 114, 133, 222, - 55, 166, 237, 146, 227, 102, 12, 173, 205, 205, 245, 44, 198, 76, 214, - 101, 223, 121, 90, 205, 122, 126, 40, 230, 86, 12, 173, 205, 53, 221, - 38, 114, 247, 73, 177, 183, 197, 114, 61, 226, 14, 74, 155, 203, 88, - 105, 109, 110, 29, 173, 46, 185, 0, 204, 135, 30, 124, 35, 238, 91, - 28, 252, 208, 246, 46, 209, 180, 54, 183, 244, 42, 117, 175, 30, 253, - 144, 244, 92, 252, 125, 234, 80, 240, 67, 53, 27, 142, 166, 181, 185, - 94, 99, 212, 122, 211, 16, 88, 151, 29, 95, 47, 174, 85, 173, 13, - 243, 161, 241, 213, 250, 210, 218, 220, 26, 191, 132, 105, 245, 181, 183, - 165, 54, 101, 123, 11, 251, 222, 0, 63, 244, 237, 50, 86, 155, 91, - 61, 159, 90, 155, 251, 16, 252, 208, 229, 254, 226, 218, 220, 23, 224, - 135, 174, 21, 30, 68, 107, 115, 103, 46, 103, 181, 185, 159, 154, 245, - 107, 115, 71, 246, 99, 181, 185, 201, 3, 88, 109, 110, 190, 112, 253, - 218, 220, 21, 227, 89, 109, 174, 169, 45, 171, 205, 237, 89, 65, 92, - 155, 251, 20, 252, 144, 215, 19, 86, 155, 187, 99, 52, 171, 205, 13, - 207, 212, 175, 205, 253, 181, 52, 171, 205, 181, 238, 96, 181, 185, 29, - 7, 232, 215, 230, 102, 174, 103, 181, 185, 167, 207, 177, 218, 220, 191, - 114, 235, 215, 230, 178, 179, 42, 126, 148, 86, 190, 85, 242, 196, 189, - 218, 92, 37, 15, 72, 114, 195, 223, 132, 123, 135, 118, 209, 203, 9, - 178, 218, 220, 80, 232, 235, 248, 214, 141, 250, 143, 142, 92, 190, 174, - 3, 87, 255, 241, 173, 113, 123, 79, 200, 151, 230, 235, 128, 70, 153, - 234, 17, 27, 227, 246, 158, 66, 57, 25, 56, 110, 50, 150, 132, 246, - 198, 237, 61, 33, 95, 167, 250, 15, 77, 134, 127, 123, 227, 246, 158, - 80, 239, 70, 238, 215, 154, 190, 53, 118, 191, 22, 245, 105, 228, 126, - 173, 127, 123, 99, 247, 107, 17, 39, 116, 239, 233, 43, 176, 131, 142, - 122, 152, 225, 238, 205, 133, 190, 137, 237, 220, 248, 254, 248, 55, 220, - 158, 205, 215, 220, 222, 83, 59, 227, 48, 131, 124, 105, 13, 32, 208, - 40, 83, 137, 170, 109, 141, 195, 140, 63, 39, 3, 199, 77, 198, 18, - 210, 214, 56, 204, 32, 95, 167, 122, 118, 77, 134, 227, 43, 227, 48, - 131, 122, 55, 114, 191, 22, 117, 108, 228, 126, 109, 72, 91, 99, 247, - 107, 81, 119, 70, 238, 215, 34, 78, 232, 222, 83, 75, 176, 131, 111, - 244, 48, 195, 221, 155, 219, 6, 252, 121, 136, 27, 123, 79, 109, 184, - 24, 208, 134, 171, 205, 109, 157, 51, 204, 236, 245, 119, 176, 24, 192, - 201, 112, 192, 59, 57, 52, 57, 150, 214, 57, 195, 204, 238, 233, 185, - 217, 189, 185, 33, 220, 56, 128, 38, 99, 73, 111, 149, 51, 204, 220, - 169, 187, 147, 238, 215, 134, 134, 100, 217, 123, 10, 209, 106, 115, 91, - 229, 12, 51, 187, 182, 176, 253, 90, 212, 123, 118, 181, 170, 168, 83, - 198, 219, 245, 191, 119, 206, 241, 8, 248, 161, 254, 254, 43, 63, 212, - 103, 118, 252, 80, 87, 255, 149, 95, 168, 128, 31, 234, 197, 93, 126, - 116, 110, 214, 146, 155, 155, 125, 1, 118, 240, 149, 14, 102, 248, 218, - 92, 232, 235, 104, 238, 198, 220, 172, 37, 103, 207, 45, 184, 185, 89, - 115, 3, 231, 102, 45, 56, 123, 6, 26, 101, 42, 141, 154, 27, 56, - 55, 227, 100, 224, 184, 201, 88, 18, 190, 52, 112, 110, 214, 60, 203, - 220, 76, 147, 225, 255, 165, 129, 115, 179, 230, 198, 198, 25, 83, 115, - 99, 227, 12, 234, 211, 200, 56, 227, 255, 165, 177, 113, 6, 113, 66, - 231, 102, 77, 192, 14, 90, 234, 97, 134, 157, 217, 246, 135, 190, 137, - 205, 220, 152, 155, 125, 193, 205, 105, 62, 231, 230, 102, 205, 12, 156, - 155, 125, 206, 205, 205, 128, 70, 153, 202, 220, 172, 169, 129, 115, 51, - 78, 6, 142, 155, 140, 37, 164, 169, 129, 115, 179, 102, 89, 230, 102, - 154, 12, 71, 19, 3, 231, 102, 205, 140, 93, 207, 160, 142, 141, 92, - 207, 132, 52, 53, 118, 61, 131, 186, 51, 114, 61, 131, 56, 161, 152, - 153, 49, 216, 59, 241, 11, 23, 152, 25, 56, 98, 80, 143, 238, 67, - 149, 26, 7, 19, 63, 111, 104, 12, 254, 188, 81, 184, 247, 213, 252, - 83, 210, 62, 183, 135, 200, 163, 90, 108, 181, 215, 222, 216, 215, 242, - 206, 220, 172, 49, 23, 3, 26, 51, 254, 22, 57, 123, 59, 56, 246, - 176, 248, 134, 103, 245, 122, 212, 85, 49, 227, 229, 210, 14, 156, 98, - 25, 39, 195, 1, 239, 228, 208, 228, 248, 75, 217, 203, 152, 218, 62, - 120, 195, 234, 9, 211, 234, 170, 152, 209, 151, 129, 124, 233, 56, 128, - 166, 99, 153, 53, 56, 91, 25, 215, 66, 170, 165, 30, 26, 26, 23, - 172, 98, 198, 141, 113, 52, 202, 50, 55, 107, 164, 97, 102, 70, 246, - 50, 46, 189, 26, 101, 254, 41, 146, 212, 179, 103, 39, 195, 170, 96, - 38, 67, 211, 123, 21, 165, 165, 90, 11, 229, 204, 79, 253, 55, 244, - 147, 41, 18, 223, 123, 137, 169, 162, 105, 61, 252, 165, 194, 31, 221, - 235, 168, 86, 74, 62, 252, 193, 146, 36, 181, 69, 11, 153, 180, 205, - 243, 252, 107, 249, 218, 202, 232, 143, 69, 62, 251, 165, 119, 15, 185, - 248, 191, 113, 1, 234, 211, 129, 242, 219, 106, 39, 21, 58, 223, 227, - 177, 242, 31, 177, 53, 106, 11, 115, 110, 19, 38, 202, 29, 187, 207, - 213, 218, 204, 164, 116, 141, 179, 63, 112, 207, 179, 143, 61, 25, 154, - 93, 24, 165, 131, 230, 253, 61, 255, 116, 165, 131, 34, 43, 211, 63, - 210, 211, 193, 241, 41, 39, 107, 17, 29, 204, 30, 253, 241, 199, 68, - 7, 185, 175, 76, 253, 88, 79, 7, 33, 213, 30, 125, 76, 116, 64, - 104, 212, 1, 123, 46, 214, 1, 218, 173, 158, 14, 90, 191, 163, 131, - 194, 154, 14, 106, 82, 126, 209, 160, 3, 203, 234, 111, 26, 102, 213, - 65, 41, 208, 193, 65, 123, 77, 225, 220, 34, 79, 222, 30, 114, 190, - 239, 2, 236, 68, 7, 139, 6, 36, 40, 116, 41, 208, 193, 196, 37, - 87, 197, 123, 49, 160, 131, 169, 21, 62, 167, 117, 129, 132, 70, 29, - 176, 231, 98, 29, 32, 174, 156, 117, 96, 229, 230, 234, 42, 173, 218, - 1, 211, 201, 18, 147, 3, 116, 112, 17, 116, 112, 209, 201, 14, 250, - 86, 177, 154, 153, 14, 84, 26, 237, 32, 223, 3, 113, 46, 23, 237, - 96, 44, 229, 63, 80, 62, 221, 89, 109, 239, 3, 58, 88, 27, 38, - 206, 33, 163, 29, 124, 228, 59, 142, 214, 186, 17, 26, 117, 192, 158, - 235, 172, 207, 65, 7, 244, 123, 115, 83, 6, 123, 135, 54, 17, 197, - 128, 58, 206, 49, 96, 58, 180, 159, 54, 88, 63, 6, 64, 59, 234, - 59, 167, 51, 95, 150, 49, 117, 176, 155, 49, 192, 245, 92, 0, 241, - 78, 125, 39, 39, 195, 1, 239, 228, 208, 228, 88, 5, 50, 156, 99, - 128, 107, 25, 136, 39, 58, 142, 105, 220, 56, 128, 38, 99, 241, 157, - 234, 110, 12, 112, 45, 3, 237, 149, 142, 131, 147, 97, 210, 100, 226, - 127, 19, 167, 184, 27, 3, 92, 203, 64, 123, 160, 181, 105, 83, 7, - 59, 213, 126, 49, 191, 105, 53, 19, 122, 66, 176, 205, 34, 242, 167, - 78, 181, 105, 89, 248, 49, 31, 100, 53, 19, 26, 249, 137, 124, 147, - 83, 109, 90, 22, 126, 12, 207, 86, 51, 161, 199, 3, 63, 17, 206, - 157, 238, 161, 156, 226, 204, 143, 97, 195, 106, 38, 52, 190, 159, 8, - 51, 252, 188, 9, 113, 66, 115, 90, 227, 193, 14, 184, 248, 252, 46, - 102, 234, 58, 97, 38, 113, 242, 96, 111, 255, 73, 250, 152, 193, 118, - 116, 29, 48, 153, 241, 79, 154, 104, 28, 102, 252, 57, 25, 137, 240, - 78, 137, 154, 28, 203, 68, 227, 48, 131, 124, 233, 56, 128, 38, 99, - 73, 159, 96, 28, 102, 252, 39, 57, 99, 6, 101, 42, 235, 244, 9, - 198, 97, 6, 245, 78, 108, 40, 209, 242, 177, 75, 204, 36, 172, 91, - 237, 54, 102, 44, 89, 248, 185, 194, 12, 242, 115, 23, 51, 168, 79, - 122, 159, 23, 240, 115, 133, 25, 228, 231, 46, 102, 66, 39, 56, 191, - 159, 43, 204, 32, 63, 119, 49, 131, 56, 161, 57, 45, 43, 216, 193, - 20, 17, 102, 254, 231, 132, 153, 80, 232, 235, 136, 211, 199, 12, 182, - 163, 49, 32, 158, 241, 143, 136, 51, 14, 51, 200, 151, 198, 0, 160, - 81, 166, 210, 40, 206, 56, 204, 132, 114, 50, 112, 220, 100, 44, 9, - 177, 198, 97, 6, 249, 58, 229, 180, 52, 25, 254, 177, 198, 97, 6, - 245, 158, 83, 204, 56, 229, 180, 226, 114, 142, 25, 167, 156, 86, 108, - 206, 49, 227, 148, 211, 138, 205, 57, 102, 156, 114, 90, 86, 134, 153, - 144, 63, 192, 14, 198, 139, 48, 243, 137, 115, 156, 249, 19, 48, 182, - 198, 141, 56, 243, 39, 231, 159, 255, 100, 252, 3, 172, 57, 195, 140, - 83, 222, 140, 147, 145, 8, 239, 148, 168, 201, 73, 90, 157, 51, 204, - 56, 141, 99, 13, 55, 14, 160, 201, 88, 44, 171, 115, 134, 25, 167, - 113, 172, 201, 18, 103, 214, 104, 177, 236, 143, 156, 97, 134, 172, 207, - 131, 52, 189, 19, 27, 178, 134, 122, 167, 189, 4, 61, 103, 93, 151, - 89, 146, 42, 89, 94, 214, 187, 188, 46, 187, 181, 169, 83, 77, 245, - 106, 103, 126, 107, 64, 167, 174, 248, 173, 153, 144, 127, 189, 59, 252, - 44, 28, 191, 209, 109, 188, 211, 170, 159, 78, 125, 103, 191, 100, 244, - 230, 74, 150, 230, 207, 130, 27, 102, 183, 110, 116, 138, 91, 127, 56, - 191, 31, 234, 42, 235, 26, 172, 47, 188, 95, 239, 248, 152, 108, 215, - 96, 78, 53, 213, 127, 112, 152, 249, 5, 108, 205, 42, 194, 204, 167, - 78, 152, 73, 95, 53, 216, 59, 100, 165, 62, 102, 176, 29, 173, 69, - 94, 197, 197, 153, 229, 238, 98, 198, 91, 215, 214, 66, 56, 25, 233, - 240, 78, 233, 154, 156, 132, 223, 221, 197, 140, 190, 12, 228, 75, 199, - 1, 52, 25, 75, 210, 82, 119, 49, 227, 198, 56, 86, 58, 99, 6, - 101, 42, 255, 253, 197, 93, 204, 120, 11, 49, 179, 212, 67, 213, 123, - 21, 165, 165, 90, 235, 230, 42, 151, 129, 103, 42, 249, 222, 165, 193, - 30, 235, 194, 95, 51, 46, 159, 147, 214, 58, 211, 82, 207, 190, 43, - 137, 156, 169, 108, 250, 222, 0, 37, 46, 249, 159, 234, 46, 237, 107, - 88, 176, 14, 233, 219, 13, 250, 12, 131, 191, 73, 92, 223, 140, 162, - 179, 164, 101, 13, 8, 86, 151, 211, 188, 73, 222, 145, 27, 224, 121, - 246, 88, 85, 207, 99, 238, 144, 74, 62, 41, 190, 129, 156, 49, 148, - 90, 250, 109, 80, 243, 7, 167, 165, 185, 161, 133, 55, 144, 190, 251, - 160, 207, 113, 248, 59, 199, 245, 125, 233, 125, 93, 234, 151, 92, 103, - 61, 57, 175, 183, 238, 253, 117, 107, 145, 202, 61, 246, 153, 84, 169, - 86, 42, 125, 231, 107, 208, 231, 46, 252, 61, 230, 250, 190, 145, 77, - 114, 7, 107, 96, 93, 114, 110, 238, 78, 13, 139, 66, 231, 202, 204, - 43, 119, 236, 222, 180, 46, 233, 251, 10, 251, 120, 84, 52, 229, 243, - 168, 200, 125, 183, 172, 144, 204, 180, 233, 71, 233, 136, 27, 37, 101, - 94, 207, 69, 161, 79, 105, 248, 171, 204, 245, 37, 191, 27, 218, 178, - 81, 191, 219, 129, 27, 219, 214, 146, 223, 237, 242, 15, 105, 31, 147, - 223, 109, 249, 203, 211, 181, 245, 126, 183, 95, 38, 78, 115, 249, 187, - 253, 50, 49, 123, 159, 72, 127, 183, 142, 193, 244, 119, 107, 95, 179, - 30, 253, 221, 42, 214, 175, 171, 251, 187, 249, 207, 109, 72, 127, 183, - 79, 174, 22, 78, 34, 191, 219, 185, 218, 62, 117, 245, 126, 55, 159, - 200, 246, 244, 119, 43, 187, 170, 61, 253, 221, 46, 221, 106, 255, 255, - 254, 187, 161, 127, 32, 191, 219, 160, 234, 174, 127, 183, 204, 63, 245, - 127, 183, 184, 230, 153, 150, 61, 27, 223, 79, 37, 191, 91, 72, 188, - 250, 29, 180, 35, 167, 187, 75, 187, 192, 207, 80, 174, 239, 177, 63, - 122, 142, 251, 253, 89, 82, 200, 201, 84, 123, 214, 223, 173, 208, 168, - 13, 210, 176, 199, 217, 199, 30, 236, 187, 125, 242, 14, 233, 151, 50, - 165, 131, 201, 239, 214, 246, 235, 102, 10, 221, 233, 217, 105, 201, 55, - 169, 127, 48, 251, 221, 204, 240, 187, 53, 131, 223, 173, 37, 237, 91, - 49, 239, 117, 41, 215, 248, 184, 96, 242, 187, 101, 212, 142, 80, 232, - 79, 199, 61, 147, 126, 153, 25, 26, 204, 126, 183, 175, 224, 119, 107, - 5, 191, 91, 11, 218, 247, 10, 252, 110, 77, 203, 149, 9, 38, 191, - 91, 155, 127, 238, 43, 239, 249, 231, 171, 188, 114, 120, 135, 89, 13, - 217, 239, 102, 134, 223, 173, 30, 252, 110, 31, 179, 251, 148, 178, 249, - 221, 198, 252, 135, 223, 13, 125, 46, 249, 221, 102, 41, 120, 123, 55, - 214, 170, 120, 99, 191, 99, 105, 136, 177, 117, 225, 175, 25, 151, 239, - 220, 2, 120, 43, 112, 44, 146, 158, 61, 247, 185, 173, 210, 149, 1, - 111, 222, 30, 236, 236, 121, 55, 211, 121, 192, 219, 121, 192, 219, 121, - 39, 188, 45, 160, 49, 126, 57, 205, 173, 22, 0, 188, 137, 98, 60, - 246, 125, 6, 120, 179, 206, 141, 164, 103, 177, 191, 46, 165, 206, 163, - 115, 3, 222, 14, 254, 203, 190, 101, 182, 15, 228, 29, 135, 95, 237, - 156, 233, 44, 203, 149, 2, 222, 162, 94, 141, 162, 231, 154, 103, 159, - 85, 247, 200, 10, 1, 222, 126, 142, 103, 125, 175, 153, 78, 195, 239, - 118, 6, 126, 183, 51, 12, 171, 240, 187, 253, 86, 52, 138, 158, 47, - 206, 223, 80, 203, 203, 2, 222, 102, 239, 101, 239, 252, 10, 199, 233, - 113, 1, 126, 55, 246, 206, 153, 202, 239, 102, 53, 179, 223, 77, 165, - 135, 40, 191, 27, 211, 115, 81, 232, 83, 26, 254, 42, 115, 125, 233, - 156, 230, 23, 46, 223, 180, 8, 226, 244, 31, 162, 57, 77, 61, 231, - 57, 205, 207, 208, 62, 209, 141, 57, 205, 207, 220, 92, 224, 103, 46, - 223, 180, 196, 184, 181, 115, 8, 39, 35, 29, 222, 41, 93, 147, 99, - 89, 98, 220, 218, 25, 249, 210, 113, 0, 77, 198, 146, 190, 216, 184, - 181, 115, 72, 98, 150, 57, 77, 162, 150, 111, 90, 108, 96, 190, 105, - 137, 193, 249, 166, 37, 6, 231, 155, 22, 27, 156, 111, 90, 108, 112, - 190, 105, 17, 151, 111, 250, 17, 236, 224, 23, 17, 102, 234, 59, 231, - 155, 160, 175, 99, 129, 27, 249, 166, 69, 92, 158, 102, 33, 183, 14, - 88, 96, 96, 190, 105, 33, 151, 111, 2, 26, 101, 42, 141, 22, 24, - 152, 111, 226, 100, 224, 184, 201, 88, 18, 126, 50, 48, 223, 180, 32, - 75, 190, 73, 147, 225, 255, 147, 129, 249, 166, 5, 6, 231, 155, 22, - 24, 156, 111, 250, 201, 224, 124, 211, 79, 6, 231, 155, 126, 100, 152, - 9, 253, 30, 236, 96, 145, 0, 51, 181, 3, 156, 48, 227, 15, 125, - 19, 231, 233, 99, 6, 219, 209, 92, 208, 124, 46, 223, 52, 47, 103, - 152, 57, 219, 173, 100, 29, 154, 11, 154, 207, 229, 130, 128, 70, 153, - 202, 25, 170, 31, 114, 134, 153, 201, 223, 140, 11, 160, 227, 224, 100, - 224, 184, 201, 88, 66, 126, 200, 25, 102, 30, 157, 63, 196, 206, 80, - 205, 115, 198, 140, 191, 38, 195, 241, 125, 206, 48, 51, 231, 195, 254, - 44, 223, 52, 111, 112, 182, 103, 87, 81, 167, 255, 245, 44, 44, 234, - 56, 59, 126, 168, 191, 255, 202, 47, 68, 192, 15, 117, 245, 95, 249, - 161, 238, 178, 227, 135, 122, 249, 175, 103, 117, 17, 39, 116, 255, 124, - 54, 216, 193, 143, 34, 204, 100, 57, 67, 53, 23, 252, 249, 119, 110, - 236, 159, 207, 229, 98, 192, 92, 110, 255, 124, 142, 129, 251, 231, 156, - 12, 7, 188, 147, 67, 147, 99, 157, 99, 224, 254, 249, 119, 220, 56, - 128, 38, 99, 241, 157, 99, 224, 254, 249, 119, 89, 246, 207, 191, 211, - 246, 207, 103, 27, 184, 127, 62, 199, 216, 56, 99, 157, 99, 108, 156, - 241, 157, 99, 108, 156, 65, 221, 25, 25, 103, 16, 39, 4, 51, 233, - 153, 96, 7, 223, 139, 48, 227, 124, 230, 36, 49, 1, 48, 246, 198, - 141, 125, 141, 4, 206, 63, 191, 229, 226, 76, 130, 113, 152, 65, 190, - 52, 206, 0, 157, 168, 241, 14, 120, 99, 28, 102, 252, 57, 25, 56, - 110, 50, 150, 180, 215, 198, 97, 6, 249, 58, 197, 25, 77, 70, 200, - 107, 227, 48, 131, 122, 55, 114, 61, 131, 58, 54, 114, 61, 131, 250, - 52, 114, 61, 19, 242, 218, 216, 245, 12, 226, 132, 126, 43, 246, 1, - 204, 105, 102, 187, 192, 204, 160, 222, 195, 187, 247, 236, 62, 52, 98, - 196, 48, 211, 192, 222, 97, 236, 123, 217, 208, 55, 253, 229, 96, 239, - 176, 176, 48, 115, 88, 88, 30, 203, 154, 102, 151, 236, 159, 95, 250, - 233, 221, 187, 116, 51, 185, 245, 249, 43, 198, 223, 250, 60, 123, 59, - 152, 112, 102, 146, 253, 113, 225, 47, 27, 138, 238, 209, 249, 169, 204, - 109, 250, 221, 75, 228, 75, 215, 231, 64, 163, 76, 5, 51, 79, 179, - 151, 177, 183, 247, 123, 182, 85, 61, 31, 11, 239, 209, 185, 121, 98, - 62, 149, 17, 194, 201, 192, 113, 147, 177, 56, 30, 101, 47, 227, 243, - 97, 37, 182, 126, 187, 196, 203, 44, 186, 71, 167, 242, 161, 85, 236, - 155, 228, 47, 157, 49, 19, 162, 201, 72, 120, 144, 189, 140, 82, 126, - 157, 204, 147, 14, 91, 133, 247, 232, 36, 189, 141, 160, 247, 232, 160, - 222, 249, 123, 11, 80, 143, 132, 31, 161, 27, 111, 152, 43, 177, 231, - 174, 115, 165, 255, 182, 170, 47, 223, 170, 116, 147, 222, 163, 67, 218, - 123, 217, 91, 203, 83, 99, 111, 11, 191, 135, 231, 221, 168, 157, 156, - 80, 207, 91, 203, 77, 126, 43, 155, 11, 238, 83, 218, 23, 179, 119, - 146, 155, 172, 152, 32, 236, 123, 71, 14, 149, 187, 228, 253, 137, 222, - 139, 210, 106, 240, 32, 133, 174, 26, 29, 38, 87, 111, 47, 254, 118, - 214, 213, 216, 126, 242, 145, 25, 191, 4, 145, 115, 145, 53, 186, 223, - 85, 232, 7, 81, 225, 178, 189, 120, 153, 134, 194, 115, 145, 177, 67, - 228, 33, 94, 126, 90, 155, 225, 114, 231, 153, 197, 20, 218, 35, 122, - 164, 220, 184, 68, 73, 97, 223, 55, 177, 99, 228, 252, 65, 37, 180, - 54, 145, 114, 175, 194, 106, 95, 188, 23, 165, 184, 173, 176, 78, 223, - 120, 185, 250, 180, 92, 90, 155, 137, 114, 212, 239, 38, 77, 238, 100, - 121, 105, 252, 43, 157, 239, 14, 78, 147, 67, 234, 121, 53, 164, 103, - 122, 53, 26, 239, 45, 96, 207, 179, 143, 211, 104, 47, 136, 33, 222, - 94, 16, 19, 196, 94, 8, 253, 1, 216, 11, 123, 238, 218, 94, 150, - 130, 189, 148, 108, 204, 206, 244, 146, 246, 69, 192, 94, 172, 189, 26, - 9, 199, 113, 87, 110, 39, 143, 250, 59, 130, 222, 163, 179, 241, 151, - 85, 42, 13, 246, 82, 237, 210, 5, 225, 111, 94, 160, 81, 168, 60, - 122, 243, 110, 106, 47, 141, 38, 170, 223, 16, 44, 10, 246, 114, 188, - 236, 10, 225, 247, 165, 238, 128, 189, 132, 109, 79, 160, 246, 146, 59, - 237, 128, 66, 63, 3, 123, 137, 232, 34, 214, 95, 38, 216, 203, 210, - 145, 175, 131, 136, 189, 52, 145, 94, 104, 223, 169, 28, 41, 223, 202, - 255, 36, 72, 207, 94, 6, 109, 62, 19, 68, 236, 229, 121, 165, 131, - 65, 234, 111, 110, 149, 139, 188, 90, 27, 164, 103, 47, 207, 58, 206, - 10, 34, 246, 242, 116, 198, 116, 77, 238, 100, 249, 73, 218, 20, 93, - 123, 233, 208, 61, 41, 136, 216, 11, 161, 209, 94, 216, 115, 177, 189, - 160, 63, 36, 246, 242, 20, 236, 5, 253, 27, 177, 23, 66, 183, 254, - 115, 174, 196, 158, 187, 182, 151, 118, 82, 125, 249, 178, 119, 222, 173, - 196, 94, 72, 123, 219, 214, 214, 178, 215, 182, 121, 194, 57, 102, 181, - 198, 237, 228, 184, 106, 31, 167, 18, 123, 57, 59, 106, 129, 178, 167, - 147, 23, 236, 165, 220, 240, 197, 194, 113, 52, 50, 135, 202, 215, 35, - 66, 130, 137, 189, 60, 171, 242, 133, 66, 15, 141, 13, 147, 35, 155, - 53, 14, 22, 245, 45, 26, 215, 79, 78, 255, 170, 127, 67, 98, 47, - 143, 182, 91, 21, 91, 27, 7, 246, 210, 52, 98, 163, 240, 236, 249, - 11, 176, 151, 191, 31, 125, 64, 239, 224, 73, 63, 170, 214, 239, 44, - 142, 26, 41, 215, 105, 187, 64, 56, 222, 17, 49, 99, 228, 227, 215, - 211, 233, 61, 58, 169, 239, 95, 84, 232, 208, 40, 171, 188, 178, 245, - 43, 97, 223, 253, 96, 47, 133, 139, 31, 165, 247, 232, 120, 14, 82, - 191, 17, 245, 44, 106, 178, 188, 110, 199, 118, 97, 223, 215, 96, 47, - 157, 87, 236, 160, 231, 229, 9, 189, 5, 236, 133, 61, 23, 219, 11, - 198, 54, 222, 191, 96, 172, 34, 246, 66, 232, 2, 224, 95, 216, 243, - 108, 236, 5, 252, 203, 194, 164, 94, 244, 188, 60, 105, 95, 17, 252, - 203, 141, 17, 195, 132, 107, 136, 83, 224, 95, 252, 102, 70, 209, 123, - 116, 70, 251, 107, 223, 1, 2, 123, 9, 235, 32, 254, 14, 208, 51, - 136, 71, 39, 38, 143, 165, 247, 232, 252, 252, 84, 165, 125, 208, 191, - 152, 197, 107, 151, 167, 224, 95, 106, 159, 138, 161, 231, 244, 175, 237, - 86, 233, 247, 163, 195, 229, 249, 155, 196, 103, 252, 63, 140, 27, 34, - 207, 49, 69, 209, 59, 120, 124, 38, 168, 123, 79, 181, 193, 191, 156, - 203, 59, 92, 216, 119, 21, 248, 151, 19, 91, 251, 210, 123, 116, 62, - 175, 172, 126, 203, 231, 14, 216, 139, 207, 189, 80, 241, 120, 193, 94, - 174, 127, 221, 143, 222, 163, 99, 127, 170, 229, 55, 192, 191, 204, 152, - 55, 80, 247, 30, 157, 158, 157, 7, 210, 218, 2, 66, 163, 127, 97, - 207, 197, 235, 60, 156, 167, 210, 125, 171, 43, 48, 15, 203, 20, 206, - 89, 157, 238, 209, 73, 200, 128, 181, 206, 61, 253, 57, 43, 182, 163, - 235, 163, 251, 140, 191, 239, 157, 236, 231, 97, 101, 194, 174, 219, 251, - 87, 92, 162, 205, 89, 125, 92, 206, 195, 70, 221, 236, 72, 235, 37, - 145, 47, 93, 231, 1, 141, 50, 21, 110, 183, 178, 151, 113, 164, 198, - 14, 219, 249, 182, 185, 181, 57, 171, 107, 25, 119, 30, 70, 179, 154, - 76, 78, 6, 142, 155, 140, 37, 227, 122, 246, 50, 26, 46, 121, 158, - 250, 252, 211, 66, 218, 156, 213, 181, 140, 67, 121, 87, 179, 117, 222, - 189, 44, 235, 60, 77, 70, 232, 213, 236, 101, 124, 17, 217, 217, 252, - 73, 53, 50, 103, 117, 45, 163, 229, 37, 117, 206, 250, 173, 167, 170, - 247, 42, 74, 75, 213, 71, 160, 30, 9, 63, 66, 55, 5, 31, 193, - 158, 187, 246, 17, 15, 193, 71, 212, 26, 58, 135, 222, 229, 71, 218, - 227, 93, 91, 145, 101, 90, 136, 191, 23, 9, 62, 226, 117, 211, 175, - 82, 136, 143, 104, 118, 234, 134, 66, 207, 7, 31, 49, 33, 164, 174, - 176, 239, 16, 152, 131, 172, 9, 78, 166, 115, 144, 106, 107, 213, 111, - 122, 158, 43, 217, 79, 46, 249, 105, 9, 225, 60, 34, 58, 223, 96, - 249, 155, 55, 63, 208, 187, 31, 115, 159, 235, 167, 126, 43, 49, 112, - 132, 220, 56, 126, 147, 112, 254, 210, 59, 109, 164, 188, 254, 228, 66, - 173, 205, 104, 121, 164, 237, 119, 133, 190, 16, 60, 70, 238, 185, 48, - 73, 216, 247, 69, 218, 88, 185, 227, 123, 151, 82, 136, 143, 88, 18, - 121, 88, 251, 134, 179, 85, 126, 17, 60, 37, 69, 28, 23, 226, 229, - 146, 77, 170, 211, 57, 136, 169, 127, 73, 117, 14, 98, 158, 36, 15, - 206, 44, 44, 140, 191, 111, 211, 38, 203, 249, 239, 221, 214, 190, 67, - 58, 85, 254, 242, 135, 154, 218, 247, 64, 167, 201, 15, 219, 92, 215, - 249, 30, 232, 116, 185, 195, 179, 33, 244, 30, 64, 66, 159, 27, 51, - 139, 123, 158, 125, 60, 66, 91, 67, 252, 241, 182, 134, 120, 34, 182, - 70, 104, 92, 31, 177, 231, 174, 109, 237, 14, 216, 90, 239, 173, 54, - 106, 107, 164, 61, 174, 143, 102, 68, 132, 137, 191, 129, 13, 182, 86, - 38, 113, 52, 181, 181, 60, 221, 230, 40, 116, 2, 216, 90, 253, 33, - 203, 133, 58, 24, 0, 182, 38, 255, 251, 34, 133, 216, 218, 230, 146, - 223, 43, 250, 158, 14, 182, 118, 230, 94, 71, 161, 173, 13, 6, 91, - 91, 85, 176, 1, 157, 179, 94, 217, 84, 87, 225, 147, 6, 182, 22, - 168, 243, 29, 107, 180, 181, 223, 87, 63, 165, 182, 182, 97, 134, 122, - 239, 37, 218, 218, 212, 13, 181, 133, 227, 125, 14, 182, 214, 43, 45, - 148, 222, 27, 249, 143, 173, 55, 189, 55, 242, 227, 53, 99, 108, 122, - 243, 221, 158, 61, 167, 179, 123, 35, 15, 253, 160, 217, 203, 36, 185, - 99, 174, 133, 41, 122, 182, 54, 232, 48, 185, 159, 115, 170, 252, 253, - 46, 139, 141, 216, 90, 74, 74, 127, 155, 158, 173, 245, 45, 60, 159, - 218, 26, 161, 209, 214, 216, 115, 177, 173, 161, 31, 230, 109, 13, 253, - 42, 177, 53, 66, 127, 6, 182, 198, 158, 187, 182, 181, 221, 96, 107, - 109, 98, 182, 164, 18, 91, 35, 237, 243, 227, 29, 130, 83, 87, 166, - 138, 215, 71, 237, 228, 129, 167, 151, 210, 185, 114, 249, 197, 139, 82, - 137, 173, 45, 237, 254, 131, 176, 111, 39, 176, 181, 133, 62, 211, 232, - 157, 147, 99, 91, 171, 237, 159, 23, 239, 39, 167, 172, 250, 77, 216, - 183, 58, 216, 218, 155, 58, 243, 232, 124, 247, 7, 191, 57, 10, 125, - 28, 108, 237, 238, 161, 4, 97, 223, 126, 96, 107, 117, 75, 37, 208, - 59, 39, 107, 254, 79, 165, 255, 5, 91, 123, 191, 149, 184, 111, 221, - 109, 99, 229, 204, 148, 185, 116, 174, 188, 249, 196, 76, 133, 126, 5, - 182, 86, 175, 91, 184, 176, 239, 75, 107, 188, 60, 111, 144, 143, 157, - 216, 218, 141, 165, 234, 119, 110, 75, 91, 38, 201, 182, 22, 237, 133, - 243, 251, 122, 219, 38, 203, 55, 254, 45, 155, 74, 108, 173, 119, 195, - 46, 10, 237, 13, 182, 182, 185, 229, 76, 161, 92, 159, 109, 211, 229, - 127, 159, 237, 164, 243, 108, 66, 223, 0, 91, 99, 207, 197, 182, 134, - 241, 152, 183, 53, 140, 175, 196, 214, 8, 221, 4, 108, 141, 61, 119, - 109, 107, 247, 192, 214, 2, 54, 132, 211, 121, 54, 105, 143, 49, 116, - 75, 200, 16, 221, 251, 42, 87, 44, 25, 78, 231, 217, 87, 103, 170, - 243, 242, 197, 96, 107, 143, 162, 134, 10, 251, 14, 199, 24, 90, 51, - 156, 206, 179, 151, 254, 161, 242, 49, 131, 95, 155, 54, 93, 124, 127, - 99, 119, 176, 181, 34, 139, 70, 210, 185, 114, 163, 78, 35, 20, 122, - 39, 216, 218, 151, 249, 71, 8, 251, 134, 129, 173, 181, 152, 50, 130, - 222, 87, 89, 103, 137, 74, 163, 95, 203, 191, 81, 220, 247, 37, 248, - 181, 220, 237, 70, 208, 121, 118, 129, 67, 42, 237, 13, 182, 86, 243, - 175, 81, 186, 243, 236, 57, 19, 99, 232, 60, 187, 202, 95, 42, 237, - 13, 126, 237, 254, 65, 241, 218, 160, 32, 216, 218, 209, 41, 68, 39, - 83, 101, 243, 125, 245, 44, 90, 49, 176, 181, 166, 237, 196, 223, 174, - 244, 4, 91, 235, 86, 143, 205, 209, 9, 125, 22, 108, 141, 61, 23, - 207, 209, 113, 94, 78, 230, 232, 1, 23, 129, 126, 160, 55, 71, 103, - 247, 246, 133, 66, 95, 199, 37, 253, 57, 58, 182, 163, 123, 139, 151, - 185, 115, 50, 151, 220, 205, 43, 103, 179, 79, 82, 207, 171, 33, 221, - 91, 188, 204, 237, 45, 2, 141, 50, 149, 70, 151, 220, 205, 43, 187, - 150, 129, 185, 20, 58, 14, 78, 6, 142, 155, 140, 37, 193, 225, 110, - 94, 217, 181, 12, 92, 127, 211, 113, 92, 202, 114, 78, 70, 147, 145, - 116, 209, 221, 188, 178, 107, 25, 184, 102, 163, 231, 100, 46, 101, 169, - 215, 165, 249, 69, 171, 153, 208, 120, 247, 163, 40, 239, 232, 244, 29, - 200, 44, 252, 88, 254, 201, 106, 38, 52, 242, 19, 229, 165, 156, 190, - 3, 233, 112, 230, 199, 242, 19, 86, 51, 161, 145, 159, 40, 111, 225, - 84, 3, 115, 209, 153, 31, 91, 191, 90, 205, 132, 70, 126, 162, 117, - 45, 191, 23, 163, 224, 68, 227, 151, 113, 6, 236, 224, 138, 30, 102, - 216, 189, 125, 73, 23, 6, 123, 7, 156, 215, 199, 12, 182, 35, 118, - 16, 112, 129, 241, 79, 59, 231, 238, 186, 54, 27, 123, 134, 185, 53, - 145, 17, 192, 201, 72, 130, 119, 74, 210, 228, 132, 156, 115, 119, 93, - 235, 90, 6, 206, 169, 232, 56, 206, 115, 227, 0, 154, 140, 197, 113, - 214, 221, 117, 173, 107, 25, 24, 75, 233, 56, 206, 59, 99, 6, 101, - 42, 254, 229, 172, 187, 235, 90, 215, 50, 208, 135, 210, 253, 193, 115, - 89, 108, 156, 174, 81, 192, 198, 53, 250, 69, 35, 176, 113, 193, 218, - 197, 105, 127, 48, 11, 63, 54, 15, 181, 154, 9, 141, 252, 68, 243, - 83, 167, 115, 45, 103, 157, 249, 177, 185, 134, 213, 76, 104, 228, 39, - 154, 131, 240, 252, 34, 178, 240, 99, 241, 196, 106, 38, 52, 242, 19, - 197, 25, 30, 51, 136, 19, 130, 153, 164, 147, 96, 7, 23, 245, 48, - 195, 238, 237, 139, 128, 190, 25, 167, 244, 49, 131, 237, 136, 29, 100, - 156, 230, 246, 47, 79, 25, 23, 103, 144, 47, 145, 17, 1, 52, 202, - 84, 242, 77, 167, 140, 139, 51, 17, 156, 12, 28, 55, 25, 75, 226, - 63, 198, 197, 25, 228, 203, 99, 38, 66, 147, 17, 240, 143, 113, 113, - 6, 245, 206, 127, 175, 202, 85, 156, 193, 239, 85, 185, 27, 103, 124, - 179, 240, 115, 21, 103, 144, 159, 187, 113, 6, 245, 73, 249, 229, 137, - 76, 117, 21, 103, 252, 129, 159, 187, 113, 38, 224, 31, 231, 247, 115, - 21, 103, 240, 253, 220, 141, 51, 136, 19, 130, 153, 136, 163, 96, 7, - 103, 244, 48, 195, 238, 237, 11, 128, 190, 73, 199, 245, 49, 131, 237, - 104, 12, 56, 193, 248, 91, 142, 27, 23, 103, 144, 47, 141, 1, 64, - 163, 76, 108, 147, 126, 204, 184, 56, 19, 192, 201, 192, 113, 147, 177, - 132, 30, 51, 46, 206, 32, 95, 30, 51, 1, 154, 140, 140, 163, 198, - 197, 25, 212, 59, 181, 161, 183, 105, 193, 174, 226, 140, 105, 212, 5, - 179, 187, 113, 6, 117, 204, 243, 115, 21, 103, 144, 159, 187, 113, 38, - 148, 231, 119, 40, 45, 216, 85, 156, 177, 134, 93, 48, 187, 27, 103, - 80, 119, 148, 223, 203, 180, 96, 87, 113, 198, 50, 226, 130, 217, 221, - 56, 131, 56, 161, 123, 14, 7, 193, 14, 78, 234, 97, 230, 83, 250, - 123, 100, 28, 1, 127, 158, 174, 143, 25, 108, 71, 99, 192, 17, 174, - 86, 230, 176, 113, 113, 38, 130, 147, 145, 1, 239, 148, 161, 201, 177, - 28, 54, 46, 206, 32, 95, 58, 14, 160, 201, 88, 210, 15, 25, 23, - 103, 34, 210, 157, 49, 131, 50, 21, 92, 30, 50, 46, 206, 160, 222, - 115, 26, 103, 248, 243, 142, 150, 195, 57, 143, 51, 60, 63, 212, 103, - 78, 227, 12, 207, 47, 244, 80, 206, 227, 140, 83, 14, 224, 32, 87, - 43, 179, 23, 236, 224, 168, 30, 102, 184, 187, 32, 160, 175, 99, 191, - 27, 57, 128, 131, 220, 218, 249, 0, 151, 3, 216, 111, 92, 156, 65, - 190, 52, 7, 0, 52, 202, 84, 26, 237, 55, 46, 206, 132, 114, 50, - 112, 220, 100, 44, 9, 251, 140, 139, 51, 200, 215, 41, 7, 160, 201, - 240, 223, 103, 92, 156, 65, 189, 231, 52, 206, 240, 54, 105, 218, 159, - 243, 56, 195, 243, 67, 125, 230, 52, 206, 240, 252, 252, 247, 229, 60, - 206, 240, 152, 65, 156, 208, 90, 153, 93, 96, 7, 7, 245, 48, 195, - 221, 5, 1, 125, 19, 119, 235, 99, 6, 219, 209, 61, 225, 61, 220, - 25, 230, 221, 57, 139, 51, 252, 121, 76, 228, 75, 247, 182, 129, 70, - 153, 74, 158, 225, 239, 156, 197, 25, 254, 60, 166, 63, 39, 3, 199, - 77, 198, 18, 242, 119, 206, 226, 12, 127, 30, 19, 249, 58, 237, 109, - 107, 50, 28, 187, 114, 22, 103, 200, 121, 204, 32, 77, 239, 244, 158, - 239, 139, 5, 183, 162, 158, 179, 158, 199, 244, 191, 178, 204, 92, 185, - 244, 158, 108, 207, 215, 57, 157, 57, 254, 155, 227, 183, 183, 224, 86, - 212, 105, 214, 243, 122, 25, 142, 101, 230, 78, 19, 39, 186, 197, 47, - 132, 227, 151, 56, 162, 252, 86, 212, 97, 214, 243, 92, 105, 211, 86, - 152, 151, 127, 60, 59, 213, 29, 126, 168, 59, 138, 153, 214, 133, 182, - 166, 219, 122, 189, 115, 222, 39, 228, 222, 50, 243, 200, 97, 195, 204, - 34, 126, 180, 86, 102, 23, 87, 43, 179, 13, 236, 96, 175, 30, 102, - 184, 187, 32, 118, 130, 63, 223, 161, 143, 25, 108, 71, 99, 192, 78, - 174, 86, 102, 123, 206, 226, 12, 127, 30, 36, 148, 147, 225, 128, 119, - 114, 104, 114, 172, 219, 115, 22, 103, 248, 243, 32, 200, 151, 142, 3, - 104, 50, 22, 223, 237, 57, 139, 51, 252, 121, 144, 208, 29, 89, 106, - 101, 118, 104, 121, 134, 109, 57, 139, 51, 228, 60, 72, 144, 166, 119, - 250, 125, 159, 212, 130, 91, 215, 108, 59, 242, 206, 121, 16, 199, 197, - 101, 230, 168, 189, 117, 108, 238, 216, 164, 149, 227, 103, 217, 86, 112, - 107, 207, 197, 97, 239, 236, 249, 251, 3, 102, 218, 220, 140, 117, 139, - 159, 47, 199, 47, 241, 203, 66, 91, 23, 95, 158, 241, 206, 190, 174, - 227, 238, 50, 243, 210, 70, 235, 221, 194, 12, 234, 142, 242, 59, 83, - 112, 107, 80, 167, 145, 239, 236, 221, 37, 93, 94, 102, 190, 189, 103, - 176, 91, 152, 65, 156, 80, 204, 164, 130, 29, 236, 210, 193, 12, 119, - 23, 68, 98, 26, 96, 44, 85, 31, 51, 216, 142, 250, 231, 173, 140, - 255, 158, 201, 159, 187, 25, 103, 138, 184, 180, 131, 136, 30, 149, 183, - 80, 25, 91, 185, 56, 3, 52, 202, 84, 226, 196, 223, 69, 114, 185, - 23, 103, 92, 203, 8, 121, 156, 212, 128, 198, 25, 78, 6, 142, 155, - 140, 229, 243, 205, 205, 221, 140, 51, 174, 101, 212, 158, 158, 196, 206, - 130, 165, 102, 137, 51, 68, 198, 169, 236, 199, 225, 28, 103, 92, 203, - 216, 156, 17, 163, 96, 166, 158, 151, 170, 247, 42, 74, 75, 147, 105, - 118, 141, 15, 211, 80, 143, 132, 31, 161, 241, 59, 29, 236, 185, 106, - 59, 13, 76, 37, 157, 246, 127, 119, 180, 206, 180, 200, 95, 84, 165, - 119, 102, 159, 27, 49, 77, 161, 111, 71, 132, 73, 127, 61, 223, 35, - 60, 3, 158, 103, 202, 2, 137, 197, 183, 229, 180, 198, 160, 78, 244, - 74, 73, 20, 223, 148, 125, 201, 184, 213, 82, 242, 163, 10, 90, 155, - 36, 105, 127, 254, 79, 26, 168, 231, 145, 214, 73, 93, 218, 230, 23, - 158, 197, 41, 31, 183, 81, 10, 89, 58, 155, 222, 153, 93, 225, 167, - 59, 54, 245, 156, 101, 178, 180, 97, 127, 37, 187, 168, 239, 79, 177, - 118, 105, 79, 106, 172, 214, 38, 77, 218, 125, 96, 188, 93, 61, 103, - 185, 93, 66, 123, 21, 245, 61, 17, 187, 75, 90, 178, 184, 190, 214, - 102, 143, 180, 54, 185, 162, 93, 61, 103, 185, 79, 242, 57, 157, 95, - 216, 215, 39, 238, 160, 212, 254, 223, 146, 90, 155, 116, 233, 155, 47, - 189, 213, 179, 6, 209, 71, 165, 216, 144, 91, 194, 241, 158, 141, 61, - 33, 5, 214, 251, 134, 222, 153, 61, 165, 126, 144, 66, 231, 143, 62, - 35, 221, 14, 172, 40, 236, 251, 52, 246, 188, 212, 182, 219, 50, 122, - 103, 246, 217, 37, 59, 20, 250, 85, 212, 101, 105, 211, 197, 139, 194, - 190, 120, 103, 182, 229, 147, 123, 90, 155, 155, 210, 135, 141, 30, 105, - 231, 120, 110, 75, 69, 218, 60, 23, 246, 53, 197, 221, 149, 174, 36, - 60, 210, 218, 100, 72, 251, 54, 95, 87, 207, 75, 69, 63, 148, 22, - 56, 78, 235, 200, 125, 34, 157, 136, 252, 75, 107, 243, 92, 58, 125, - 86, 187, 83, 60, 250, 165, 148, 209, 96, 145, 176, 175, 71, 220, 107, - 201, 81, 105, 41, 105, 35, 55, 79, 248, 78, 61, 19, 104, 246, 144, - 39, 100, 198, 137, 229, 166, 121, 202, 213, 126, 39, 119, 69, 123, 201, - 27, 43, 189, 167, 142, 215, 156, 91, 222, 34, 191, 74, 17, 218, 243, - 182, 60, 114, 173, 182, 221, 180, 190, 121, 229, 82, 109, 2, 20, 186, - 144, 57, 159, 60, 172, 133, 135, 80, 238, 243, 52, 31, 185, 111, 224, - 34, 237, 76, 224, 123, 242, 255, 164, 42, 10, 46, 30, 71, 21, 148, - 205, 150, 21, 66, 28, 189, 142, 45, 44, 179, 218, 30, 63, 74, 111, - 121, 84, 76, 214, 171, 249, 33, 190, 4, 253, 43, 239, 75, 208, 95, - 210, 220, 136, 70, 163, 47, 97, 207, 93, 251, 146, 237, 224, 75, 122, - 6, 29, 14, 36, 190, 164, 72, 211, 26, 138, 252, 154, 67, 194, 164, - 208, 204, 8, 225, 187, 252, 5, 190, 132, 205, 109, 151, 211, 250, 147, - 66, 224, 75, 68, 115, 91, 69, 127, 177, 171, 165, 71, 55, 223, 6, - 18, 95, 242, 253, 93, 245, 46, 143, 87, 81, 235, 164, 152, 31, 163, - 235, 139, 109, 109, 163, 84, 179, 177, 103, 10, 241, 37, 81, 237, 99, - 85, 26, 124, 201, 204, 233, 219, 82, 196, 186, 183, 75, 87, 190, 243, - 161, 247, 94, 159, 140, 204, 175, 217, 248, 118, 9, 227, 146, 168, 175, - 87, 220, 46, 233, 246, 194, 11, 41, 196, 151, 68, 122, 70, 164, 168, - 231, 204, 247, 73, 95, 150, 202, 159, 44, 150, 123, 80, 250, 227, 220, - 161, 64, 226, 75, 58, 158, 254, 80, 209, 207, 155, 168, 163, 82, 106, - 163, 161, 58, 186, 58, 33, 213, 172, 65, 106, 166, 78, 73, 111, 146, - 215, 107, 125, 207, 72, 83, 91, 236, 18, 246, 125, 3, 190, 164, 106, - 229, 191, 131, 136, 47, 217, 123, 126, 183, 86, 199, 114, 89, 26, 48, - 111, 175, 78, 223, 107, 210, 225, 26, 187, 131, 136, 47, 41, 56, 123, - 103, 16, 241, 37, 45, 159, 111, 211, 233, 123, 87, 106, 184, 52, 37, - 136, 248, 18, 239, 85, 91, 52, 185, 15, 165, 163, 107, 55, 233, 244, - 125, 34, 213, 140, 39, 109, 158, 75, 91, 126, 222, 162, 201, 125, 41, - 53, 75, 75, 17, 246, 125, 27, 251, 90, 122, 85, 147, 198, 49, 185, - 234, 7, 105, 218, 185, 87, 15, 185, 73, 245, 205, 98, 185, 224, 75, - 236, 210, 119, 65, 196, 151, 36, 183, 85, 227, 170, 9, 124, 201, 142, - 222, 241, 98, 185, 105, 121, 228, 79, 190, 39, 117, 74, 121, 229, 225, - 251, 102, 171, 227, 5, 95, 178, 254, 237, 28, 157, 190, 62, 242, 140, - 244, 25, 65, 196, 151, 60, 49, 205, 212, 198, 91, 80, 222, 217, 125, - 166, 142, 174, 10, 203, 172, 238, 203, 143, 210, 155, 193, 151, 232, 213, - 131, 17, 95, 130, 243, 40, 226, 75, 58, 124, 240, 97, 26, 206, 139, - 136, 47, 33, 244, 124, 240, 37, 236, 57, 241, 37, 197, 157, 248, 133, - 180, 205, 180, 132, 22, 61, 108, 39, 190, 164, 166, 199, 103, 202, 220, - 186, 183, 28, 38, 93, 216, 62, 81, 120, 126, 178, 173, 215, 2, 137, - 173, 107, 151, 211, 218, 36, 219, 252, 149, 146, 104, 93, 139, 125, 63, - 30, 187, 90, 234, 153, 158, 102, 39, 190, 228, 200, 212, 122, 10, 206, - 154, 14, 95, 39, 249, 62, 254, 187, 161, 168, 239, 150, 241, 27, 165, - 15, 255, 173, 25, 76, 124, 73, 174, 80, 171, 66, 143, 141, 73, 150, - 234, 21, 89, 21, 44, 234, 59, 37, 220, 46, 21, 169, 243, 58, 152, - 248, 146, 54, 191, 120, 40, 115, 255, 146, 147, 182, 75, 56, 247, 20, - 245, 237, 99, 221, 37, 253, 240, 227, 223, 193, 196, 151, 196, 253, 182, - 76, 161, 3, 199, 237, 147, 102, 220, 152, 44, 148, 59, 16, 230, 37, - 125, 147, 58, 208, 239, 220, 245, 31, 93, 81, 161, 127, 6, 95, 178, - 40, 250, 164, 112, 188, 115, 198, 158, 144, 130, 71, 215, 165, 190, 228, - 158, 79, 128, 226, 183, 226, 98, 206, 72, 141, 146, 155, 9, 253, 223, - 45, 235, 121, 41, 170, 81, 239, 134, 196, 151, 204, 190, 241, 155, 122, - 166, 40, 242, 178, 228, 99, 58, 45, 148, 219, 27, 124, 73, 191, 93, - 175, 27, 18, 95, 82, 98, 80, 62, 229, 157, 183, 70, 221, 150, 206, - 60, 42, 42, 28, 239, 93, 240, 37, 35, 110, 151, 164, 223, 230, 187, - 100, 47, 174, 208, 18, 248, 146, 42, 179, 223, 23, 246, 237, 23, 247, - 68, 234, 218, 210, 39, 152, 248, 146, 78, 166, 103, 202, 59, 76, 6, - 95, 178, 163, 163, 248, 157, 243, 195, 188, 228, 147, 7, 137, 164, 141, - 252, 145, 105, 136, 66, 191, 13, 246, 144, 79, 149, 241, 23, 246, 45, - 182, 205, 83, 190, 122, 118, 10, 245, 37, 205, 62, 154, 172, 196, 138, - 218, 224, 75, 110, 148, 56, 36, 212, 243, 40, 152, 151, 244, 249, 169, - 149, 157, 248, 146, 66, 125, 127, 81, 232, 209, 224, 75, 58, 254, 121, - 94, 56, 103, 221, 12, 190, 164, 213, 130, 242, 169, 196, 151, 220, 146, - 205, 10, 221, 17, 230, 37, 95, 12, 139, 22, 226, 232, 37, 248, 18, - 86, 19, 232, 71, 233, 83, 224, 75, 244, 106, 5, 169, 47, 57, 197, - 230, 37, 243, 97, 94, 130, 235, 31, 226, 75, 8, 253, 57, 248, 18, - 246, 156, 248, 146, 30, 78, 252, 94, 192, 188, 100, 224, 176, 24, 250, - 45, 194, 77, 199, 212, 58, 174, 147, 131, 195, 164, 9, 23, 70, 9, - 177, 53, 121, 194, 2, 137, 229, 180, 150, 211, 186, 181, 107, 48, 47, - 17, 229, 180, 20, 95, 108, 93, 45, 221, 234, 74, 238, 103, 73, 146, - 106, 191, 85, 223, 161, 51, 172, 113, 112, 173, 39, 234, 187, 41, 126, - 163, 84, 167, 51, 233, 187, 89, 250, 123, 163, 250, 158, 165, 173, 201, - 146, 127, 238, 33, 194, 190, 225, 209, 118, 41, 166, 90, 23, 51, 241, - 37, 209, 101, 59, 43, 116, 9, 235, 118, 9, 215, 153, 162, 190, 135, - 192, 151, 140, 218, 49, 192, 76, 124, 73, 158, 63, 84, 89, 103, 35, - 247, 73, 249, 103, 137, 117, 53, 11, 230, 37, 91, 166, 142, 165, 223, - 94, 188, 255, 163, 250, 29, 198, 51, 224, 75, 150, 47, 143, 22, 246, - 189, 15, 243, 146, 207, 19, 201, 111, 116, 74, 186, 242, 175, 86, 179, - 7, 107, 156, 212, 210, 98, 93, 189, 133, 121, 201, 5, 250, 251, 58, - 164, 207, 61, 99, 180, 59, 229, 47, 75, 235, 18, 196, 114, 95, 131, - 47, 9, 56, 65, 206, 214, 222, 148, 110, 71, 71, 105, 114, 111, 75, - 191, 85, 143, 50, 235, 205, 75, 126, 191, 29, 73, 191, 23, 89, 89, - 251, 174, 101, 46, 240, 37, 191, 20, 143, 210, 121, 231, 39, 210, 237, - 249, 164, 205, 115, 105, 180, 103, 180, 153, 204, 75, 242, 12, 212, 123, - 231, 215, 82, 80, 121, 106, 243, 114, 234, 16, 141, 134, 121, 137, 101, - 103, 140, 88, 46, 204, 75, 90, 190, 136, 161, 223, 169, 156, 245, 72, - 211, 21, 248, 146, 35, 119, 197, 125, 113, 141, 51, 246, 40, 105, 147, - 87, 14, 171, 164, 210, 121, 192, 151, 180, 26, 46, 126, 231, 60, 219, - 124, 228, 230, 121, 200, 120, 223, 147, 191, 24, 162, 98, 176, 8, 204, - 75, 202, 55, 27, 109, 22, 175, 233, 10, 203, 172, 94, 212, 143, 210, - 56, 47, 209, 171, 35, 165, 57, 178, 84, 110, 255, 50, 101, 176, 183, - 255, 54, 189, 28, 25, 171, 51, 76, 180, 67, 123, 155, 27, 57, 50, - 59, 151, 191, 178, 51, 254, 155, 63, 127, 47, 151, 123, 121, 101, 215, - 121, 159, 14, 49, 5, 105, 142, 204, 159, 147, 145, 8, 239, 148, 168, - 201, 241, 111, 153, 189, 12, 231, 188, 178, 107, 25, 5, 191, 89, 155, - 76, 199, 97, 227, 198, 1, 52, 25, 75, 117, 255, 174, 110, 230, 149, - 93, 203, 24, 112, 103, 61, 171, 101, 180, 101, 249, 78, 190, 77, 219, - 35, 173, 220, 213, 205, 188, 178, 107, 25, 21, 184, 28, 25, 234, 157, - 196, 15, 19, 196, 15, 212, 35, 221, 191, 212, 232, 10, 16, 63, 216, - 115, 213, 118, 170, 155, 74, 57, 251, 226, 150, 153, 150, 27, 101, 143, - 208, 185, 232, 175, 245, 206, 42, 244, 117, 88, 215, 222, 148, 174, 11, - 99, 232, 123, 83, 23, 72, 44, 159, 189, 156, 214, 52, 190, 137, 90, - 41, 137, 242, 217, 42, 206, 87, 75, 190, 82, 21, 27, 137, 31, 62, - 55, 203, 105, 249, 151, 117, 146, 247, 172, 18, 226, 122, 38, 88, 215, - 190, 191, 176, 60, 205, 145, 45, 106, 90, 67, 235, 155, 44, 85, 123, - 80, 71, 167, 6, 203, 46, 229, 58, 255, 5, 93, 215, 230, 233, 161, - 230, 158, 252, 96, 93, 27, 118, 163, 135, 176, 111, 47, 88, 215, 142, - 77, 251, 205, 70, 226, 135, 61, 92, 125, 207, 125, 176, 174, 45, 189, - 227, 159, 6, 194, 119, 182, 30, 148, 230, 95, 168, 219, 144, 196, 143, - 3, 27, 26, 41, 116, 203, 232, 163, 210, 228, 137, 109, 133, 231, 50, - 190, 131, 248, 49, 242, 248, 18, 58, 23, 173, 125, 102, 136, 66, 63, - 133, 117, 237, 171, 146, 149, 133, 103, 48, 238, 67, 252, 184, 179, 118, - 11, 93, 215, 62, 120, 255, 176, 66, 103, 70, 93, 150, 164, 49, 87, - 117, 190, 177, 112, 77, 42, 222, 246, 31, 186, 174, 189, 63, 254, 44, - 93, 215, 254, 253, 215, 69, 157, 190, 119, 37, 71, 220, 3, 186, 174, - 221, 62, 254, 126, 16, 201, 145, 253, 58, 241, 174, 176, 175, 39, 204, - 69, 131, 71, 159, 167, 235, 218, 181, 53, 212, 117, 106, 30, 136, 31, - 151, 206, 172, 19, 246, 197, 248, 209, 181, 251, 100, 186, 174, 173, 210, - 163, 83, 16, 137, 31, 39, 61, 170, 138, 223, 25, 226, 135, 207, 149, - 196, 64, 18, 63, 82, 95, 239, 10, 84, 235, 88, 114, 203, 94, 37, - 255, 21, 222, 59, 252, 2, 214, 181, 79, 204, 108, 93, 187, 247, 214, - 92, 133, 206, 13, 241, 99, 238, 119, 63, 234, 212, 145, 250, 200, 71, - 46, 53, 164, 235, 218, 213, 155, 212, 124, 207, 91, 152, 139, 134, 22, - 24, 94, 95, 172, 231, 194, 50, 171, 37, 246, 163, 52, 230, 200, 244, - 106, 140, 137, 47, 65, 255, 74, 124, 9, 126, 135, 30, 253, 37, 241, - 37, 132, 54, 131, 47, 97, 207, 179, 241, 37, 48, 23, 141, 29, 58, - 208, 70, 124, 137, 247, 233, 169, 10, 109, 1, 95, 114, 182, 219, 207, - 226, 92, 238, 148, 5, 18, 219, 203, 90, 78, 107, 86, 61, 97, 46, - 42, 218, 203, 82, 253, 193, 106, 233, 198, 192, 41, 212, 151, 28, 177, - 206, 85, 232, 220, 224, 75, 14, 206, 93, 34, 196, 116, 190, 184, 141, - 210, 237, 192, 253, 212, 151, 252, 30, 184, 70, 251, 70, 79, 178, 20, - 88, 127, 182, 176, 239, 57, 240, 37, 3, 109, 177, 13, 136, 47, 105, - 82, 33, 116, 139, 186, 222, 218, 46, 93, 217, 191, 37, 89, 212, 55, - 45, 118, 151, 84, 245, 135, 189, 212, 151, 36, 237, 113, 104, 121, 239, - 125, 82, 243, 23, 207, 132, 114, 243, 194, 186, 246, 203, 37, 100, 92, - 233, 82, 187, 222, 95, 105, 227, 61, 42, 173, 41, 186, 95, 88, 71, - 122, 5, 124, 137, 231, 189, 55, 129, 196, 151, 60, 127, 113, 66, 161, - 63, 133, 185, 232, 55, 94, 171, 133, 54, 126, 1, 124, 201, 163, 126, - 29, 104, 190, 189, 123, 147, 197, 10, 125, 19, 124, 73, 211, 35, 135, - 133, 239, 252, 12, 124, 201, 200, 181, 103, 104, 190, 125, 228, 246, 243, - 52, 223, 30, 126, 204, 97, 211, 243, 37, 103, 222, 238, 163, 249, 246, - 57, 237, 118, 218, 72, 142, 172, 229, 10, 187, 78, 223, 39, 82, 235, - 219, 54, 154, 111, 223, 16, 186, 197, 70, 230, 162, 37, 254, 217, 40, - 236, 107, 130, 117, 109, 141, 101, 235, 105, 190, 253, 222, 235, 101, 54, - 146, 35, 251, 173, 221, 66, 155, 158, 47, 41, 244, 225, 24, 154, 111, - 127, 61, 180, 175, 141, 228, 200, 76, 201, 237, 117, 234, 117, 243, 200, - 189, 34, 251, 210, 124, 251, 139, 203, 253, 109, 36, 71, 54, 243, 139, - 65, 54, 61, 95, 114, 250, 127, 4, 131, 239, 201, 5, 222, 14, 178, - 145, 28, 217, 136, 239, 134, 216, 244, 124, 9, 171, 21, 247, 163, 52, - 206, 69, 245, 106, 200, 137, 47, 193, 121, 20, 241, 37, 54, 240, 37, - 56, 47, 34, 190, 132, 208, 85, 193, 151, 176, 231, 196, 151, 148, 112, - 226, 55, 31, 124, 137, 87, 239, 43, 116, 94, 178, 254, 171, 42, 202, - 186, 250, 71, 88, 215, 126, 177, 161, 139, 112, 141, 189, 10, 214, 181, - 108, 31, 123, 57, 173, 73, 190, 0, 190, 68, 180, 143, 141, 125, 11, - 196, 175, 150, 182, 21, 77, 75, 37, 190, 164, 215, 147, 131, 10, 253, - 101, 204, 58, 169, 228, 213, 179, 194, 179, 86, 119, 193, 151, 180, 14, - 242, 216, 74, 124, 201, 216, 133, 143, 149, 246, 111, 103, 37, 75, 143, - 190, 185, 46, 236, 187, 111, 188, 93, 186, 209, 99, 113, 42, 241, 37, - 59, 54, 116, 87, 232, 74, 224, 75, 154, 213, 203, 35, 236, 59, 126, - 194, 46, 41, 169, 201, 77, 234, 75, 166, 191, 63, 69, 153, 79, 44, - 137, 218, 39, 173, 253, 177, 170, 240, 59, 64, 107, 6, 28, 148, 130, - 207, 255, 70, 115, 100, 99, 218, 109, 86, 232, 123, 99, 143, 74, 183, - 223, 223, 39, 236, 59, 215, 122, 66, 58, 112, 116, 105, 48, 241, 37, - 230, 66, 243, 21, 122, 18, 204, 75, 186, 124, 61, 77, 216, 55, 32, - 254, 188, 36, 143, 142, 15, 38, 190, 100, 223, 228, 126, 10, 93, 53, - 230, 178, 52, 44, 119, 11, 97, 223, 55, 209, 215, 164, 99, 126, 36, - 87, 117, 83, 74, 90, 252, 82, 25, 239, 202, 168, 219, 82, 250, 39, - 151, 132, 115, 169, 137, 224, 75, 78, 7, 189, 79, 115, 100, 7, 51, - 84, 186, 11, 248, 146, 45, 75, 139, 9, 229, 214, 135, 121, 73, 159, - 106, 158, 52, 71, 118, 111, 215, 117, 69, 86, 67, 240, 37, 243, 62, - 219, 43, 148, 27, 12, 190, 164, 102, 202, 18, 154, 35, 123, 47, 100, - 168, 66, 251, 131, 47, 25, 94, 170, 138, 176, 239, 123, 219, 60, 229, - 110, 7, 194, 104, 142, 108, 253, 237, 135, 138, 143, 47, 7, 190, 164, - 230, 163, 59, 66, 76, 143, 134, 117, 237, 151, 109, 218, 211, 28, 89, - 245, 124, 191, 43, 244, 56, 240, 37, 150, 31, 28, 194, 58, 240, 95, - 113, 239, 238, 64, 5, 154, 35, 43, 218, 215, 162, 214, 159, 71, 22, - 148, 231, 15, 143, 18, 218, 228, 85, 240, 37, 236, 91, 0, 126, 148, - 62, 14, 190, 68, 239, 27, 1, 196, 151, 224, 122, 137, 248, 146, 185, - 224, 75, 42, 112, 57, 50, 66, 227, 222, 93, 133, 44, 57, 178, 234, - 166, 8, 39, 126, 123, 192, 151, 248, 53, 137, 162, 57, 50, 191, 178, - 234, 250, 252, 85, 68, 152, 84, 115, 187, 120, 125, 94, 19, 230, 37, - 236, 12, 203, 114, 90, 115, 94, 19, 124, 137, 232, 12, 11, 246, 149, - 227, 86, 75, 147, 251, 15, 162, 57, 178, 85, 33, 234, 247, 135, 66, - 96, 94, 82, 226, 211, 62, 194, 115, 150, 79, 96, 141, 211, 170, 94, - 87, 154, 35, 203, 157, 174, 126, 235, 104, 149, 53, 89, 26, 217, 191, - 167, 176, 111, 51, 171, 93, 122, 94, 104, 56, 205, 145, 13, 91, 163, - 214, 84, 111, 139, 220, 46, 201, 77, 197, 245, 216, 111, 97, 94, 82, - 249, 172, 149, 230, 200, 134, 182, 81, 219, 215, 141, 217, 39, 141, 250, - 55, 82, 216, 119, 43, 172, 113, 254, 55, 38, 130, 230, 200, 34, 98, - 212, 26, 248, 199, 81, 71, 165, 13, 19, 197, 231, 74, 207, 193, 188, - 228, 219, 126, 67, 105, 142, 172, 88, 127, 245, 253, 111, 131, 47, 249, - 173, 255, 72, 157, 119, 62, 47, 205, 90, 56, 138, 230, 200, 78, 149, - 27, 163, 229, 170, 46, 75, 21, 127, 30, 43, 236, 123, 3, 230, 37, - 51, 90, 176, 28, 217, 196, 43, 42, 253, 6, 124, 201, 232, 177, 226, - 251, 167, 51, 193, 151, 124, 86, 44, 138, 230, 200, 26, 21, 100, 57, - 178, 214, 121, 162, 116, 222, 249, 137, 148, 118, 144, 229, 200, 242, 52, - 136, 214, 114, 115, 47, 165, 22, 191, 139, 229, 226, 26, 39, 53, 128, - 229, 200, 38, 141, 97, 57, 178, 144, 237, 58, 191, 47, 204, 75, 174, - 189, 97, 57, 178, 190, 79, 89, 142, 236, 223, 187, 49, 58, 245, 246, - 121, 228, 126, 123, 89, 142, 236, 247, 98, 44, 71, 118, 177, 167, 248, - 157, 115, 111, 243, 145, 7, 222, 138, 164, 57, 178, 223, 251, 168, 24, - 204, 7, 243, 18, 175, 94, 163, 117, 116, 85, 88, 102, 223, 122, 240, - 163, 52, 206, 75, 244, 190, 1, 65, 207, 43, 167, 112, 223, 92, 222, - 52, 216, 27, 115, 102, 226, 28, 25, 171, 191, 244, 135, 190, 137, 91, - 220, 56, 175, 156, 194, 229, 175, 146, 185, 243, 202, 105, 198, 213, 197, - 32, 95, 154, 191, 2, 26, 101, 42, 50, 182, 24, 87, 23, 227, 207, - 201, 192, 113, 147, 177, 164, 109, 54, 174, 46, 6, 249, 58, 157, 35, - 211, 100, 132, 108, 54, 174, 46, 6, 245, 110, 100, 253, 37, 234, 216, - 200, 250, 75, 212, 167, 145, 245, 151, 33, 155, 141, 173, 191, 68, 156, - 16, 204, 36, 172, 7, 59, 72, 209, 195, 12, 171, 191, 12, 129, 190, - 233, 27, 221, 248, 230, 242, 38, 238, 91, 197, 127, 49, 254, 161, 27, - 141, 171, 139, 65, 190, 244, 155, 203, 64, 163, 76, 197, 99, 111, 48, - 174, 46, 38, 132, 147, 129, 227, 38, 99, 177, 110, 48, 174, 46, 6, - 249, 58, 125, 115, 89, 147, 225, 187, 193, 184, 186, 24, 212, 187, 145, - 245, 151, 168, 99, 35, 235, 47, 173, 27, 140, 173, 191, 244, 221, 96, - 108, 253, 37, 226, 132, 126, 79, 198, 18, 238, 157, 190, 73, 15, 51, - 172, 254, 210, 23, 250, 38, 172, 213, 199, 12, 182, 35, 118, 144, 176, - 142, 241, 247, 95, 107, 92, 156, 65, 190, 68, 134, 47, 208, 40, 83, - 153, 197, 38, 25, 23, 103, 124, 57, 25, 56, 110, 50, 22, 75, 146, - 113, 113, 6, 249, 242, 152, 241, 213, 100, 36, 193, 111, 99, 84, 156, - 65, 189, 27, 89, 127, 137, 58, 54, 178, 254, 210, 146, 100, 108, 253, - 37, 234, 206, 200, 250, 75, 196, 9, 253, 182, 127, 227, 71, 158, 9, - 235, 245, 48, 195, 213, 95, 102, 132, 123, 103, 124, 245, 200, 83, 183, - 254, 18, 218, 209, 26, 252, 144, 55, 158, 244, 23, 135, 190, 70, 197, - 25, 228, 75, 109, 173, 199, 35, 79, 148, 169, 216, 156, 64, 198, 127, - 141, 51, 200, 151, 214, 69, 3, 95, 50, 150, 196, 54, 217, 203, 248, - 175, 113, 6, 249, 242, 152, 65, 153, 202, 254, 101, 227, 236, 101, 252, - 215, 56, 131, 122, 55, 178, 254, 210, 55, 11, 191, 156, 214, 95, 162, - 62, 141, 172, 191, 68, 221, 25, 89, 127, 137, 56, 161, 223, 147, 233, - 11, 118, 192, 249, 51, 215, 152, 97, 245, 151, 9, 141, 160, 175, 172, - 143, 25, 108, 71, 99, 64, 35, 246, 219, 39, 74, 217, 219, 129, 59, - 113, 102, 210, 194, 8, 59, 141, 1, 156, 140, 4, 120, 167, 4, 77, - 142, 111, 255, 236, 101, 184, 19, 103, 22, 116, 98, 53, 43, 200, 151, - 142, 3, 104, 50, 150, 196, 126, 217, 203, 112, 39, 206, 216, 46, 60, - 11, 166, 227, 144, 157, 49, 131, 50, 149, 117, 153, 64, 134, 59, 113, - 166, 249, 160, 110, 20, 51, 168, 247, 236, 238, 238, 66, 157, 50, 222, - 174, 255, 189, 51, 247, 233, 159, 61, 63, 212, 223, 127, 229, 135, 250, - 204, 142, 31, 234, 234, 191, 242, 11, 16, 240, 67, 189, 184, 203, 143, - 126, 79, 166, 47, 195, 76, 68, 47, 160, 57, 127, 230, 26, 51, 172, - 254, 50, 0, 250, 38, 133, 233, 99, 6, 219, 209, 239, 176, 244, 97, - 252, 45, 97, 57, 139, 51, 163, 63, 107, 79, 231, 102, 200, 151, 198, - 50, 160, 81, 166, 146, 113, 235, 157, 179, 56, 147, 158, 60, 138, 206, - 205, 2, 56, 25, 56, 110, 50, 150, 208, 222, 57, 139, 51, 127, 124, - 249, 47, 197, 12, 242, 117, 250, 158, 140, 38, 35, 163, 87, 206, 226, - 76, 207, 251, 61, 216, 247, 100, 194, 178, 183, 33, 212, 233, 127, 181, - 73, 212, 113, 118, 252, 80, 127, 255, 149, 95, 168, 128, 31, 234, 234, - 191, 242, 67, 221, 101, 199, 15, 245, 242, 95, 49, 163, 224, 132, 172, - 107, 35, 193, 14, 250, 234, 96, 166, 14, 171, 191, 204, 232, 249, 200, - 51, 49, 90, 31, 51, 216, 142, 230, 155, 98, 24, 127, 107, 207, 156, - 197, 25, 167, 188, 89, 12, 147, 225, 15, 116, 134, 198, 59, 32, 58, - 103, 113, 198, 41, 111, 198, 201, 192, 113, 147, 177, 164, 69, 229, 44, - 206, 56, 229, 205, 162, 157, 49, 227, 175, 201, 8, 137, 202, 89, 156, - 113, 250, 110, 89, 79, 206, 134, 12, 88, 207, 160, 142, 141, 92, 207, - 160, 62, 141, 92, 207, 132, 68, 57, 191, 95, 78, 215, 51, 136, 19, - 154, 55, 27, 253, 200, 51, 162, 151, 30, 102, 216, 121, 204, 16, 232, - 155, 62, 86, 31, 51, 216, 142, 230, 155, 198, 49, 254, 161, 99, 141, - 91, 207, 32, 95, 154, 55, 3, 26, 101, 42, 184, 30, 99, 220, 122, - 38, 132, 147, 129, 227, 38, 99, 177, 142, 49, 110, 61, 131, 124, 157, - 242, 102, 154, 12, 223, 49, 198, 173, 103, 80, 239, 70, 174, 103, 80, - 199, 70, 174, 103, 172, 99, 140, 93, 207, 248, 142, 49, 118, 61, 131, - 56, 33, 152, 9, 25, 14, 118, 16, 169, 135, 25, 246, 29, 102, 95, - 232, 155, 48, 82, 31, 51, 216, 142, 174, 53, 70, 49, 254, 254, 35, - 141, 139, 51, 200, 151, 174, 53, 128, 70, 153, 74, 190, 105, 132, 113, - 113, 198, 151, 147, 129, 227, 38, 99, 177, 140, 48, 46, 206, 32, 95, - 167, 188, 153, 38, 35, 125, 184, 113, 113, 6, 245, 110, 228, 254, 12, - 234, 216, 200, 253, 25, 203, 136, 156, 199, 25, 167, 185, 227, 240, 156, - 199, 25, 126, 110, 134, 56, 161, 152, 233, 2, 118, 48, 90, 15, 51, - 236, 59, 204, 233, 195, 30, 121, 250, 119, 211, 199, 12, 182, 163, 49, - 96, 24, 227, 239, 24, 106, 92, 156, 9, 225, 100, 36, 194, 59, 165, - 107, 114, 146, 186, 26, 23, 103, 144, 47, 157, 255, 1, 77, 198, 98, - 233, 106, 92, 156, 241, 239, 230, 140, 25, 148, 169, 232, 186, 139, 113, - 113, 6, 245, 110, 228, 254, 12, 234, 216, 200, 253, 25, 75, 215, 156, - 199, 25, 39, 204, 116, 201, 121, 156, 113, 194, 76, 23, 134, 25, 107, - 42, 216, 193, 240, 108, 48, 51, 188, 251, 208, 97, 89, 238, 145, 77, - 239, 12, 237, 59, 185, 129, 153, 206, 28, 102, 58, 51, 254, 1, 29, - 179, 183, 131, 216, 214, 211, 236, 7, 10, 52, 212, 48, 227, 229, 58, - 7, 208, 39, 15, 187, 227, 149, 147, 145, 14, 239, 148, 174, 201, 241, - 237, 32, 144, 177, 176, 76, 234, 189, 220, 165, 131, 85, 204, 184, 150, - 113, 115, 116, 5, 54, 255, 235, 196, 141, 3, 104, 50, 150, 140, 246, - 217, 203, 24, 155, 249, 40, 245, 232, 192, 175, 181, 187, 151, 93, 203, - 8, 253, 242, 61, 154, 255, 11, 233, 228, 140, 25, 148, 169, 16, 91, - 179, 151, 209, 236, 239, 174, 230, 253, 251, 8, 102, 92, 203, 168, 126, - 92, 173, 149, 201, 208, 244, 94, 69, 105, 169, 222, 39, 130, 122, 164, - 57, 0, 141, 14, 89, 56, 94, 98, 207, 93, 159, 37, 57, 181, 182, - 128, 92, 108, 72, 43, 237, 188, 119, 11, 153, 180, 247, 121, 220, 81, - 158, 148, 80, 73, 184, 118, 121, 154, 127, 144, 188, 251, 205, 4, 122, - 79, 102, 171, 17, 234, 221, 142, 185, 50, 227, 228, 182, 59, 215, 136, - 107, 26, 114, 77, 145, 55, 92, 76, 165, 119, 93, 18, 58, 226, 198, - 119, 220, 243, 236, 231, 107, 25, 154, 93, 240, 58, 192, 223, 153, 232, - 128, 208, 168, 3, 246, 60, 123, 29, 172, 152, 18, 78, 239, 138, 34, - 237, 81, 7, 30, 47, 11, 218, 244, 116, 176, 237, 230, 28, 122, 79, - 215, 160, 204, 70, 41, 68, 7, 27, 118, 120, 166, 232, 233, 224, 250, - 248, 127, 147, 137, 14, 8, 141, 58, 96, 207, 197, 58, 64, 187, 229, - 117, 128, 118, 72, 116, 64, 232, 54, 160, 3, 246, 60, 155, 111, 214, - 128, 14, 46, 151, 252, 202, 78, 116, 64, 218, 231, 7, 29, 244, 45, - 34, 62, 187, 255, 4, 116, 112, 114, 219, 80, 122, 127, 212, 161, 98, - 37, 109, 68, 7, 79, 23, 39, 235, 234, 96, 226, 252, 69, 41, 68, - 7, 132, 70, 29, 176, 231, 98, 29, 32, 174, 120, 29, 32, 78, 136, - 14, 8, 141, 118, 192, 158, 103, 111, 7, 7, 183, 198, 208, 187, 117, - 72, 251, 124, 160, 131, 252, 167, 197, 231, 200, 208, 14, 254, 188, 19, - 67, 239, 154, 249, 94, 59, 191, 137, 58, 168, 245, 72, 220, 23, 117, - 208, 129, 158, 83, 155, 73, 105, 212, 65, 7, 157, 243, 107, 36, 6, - 160, 223, 167, 49, 96, 19, 248, 181, 46, 194, 24, 224, 116, 47, 163, - 9, 250, 90, 109, 24, 3, 170, 166, 133, 133, 85, 148, 55, 148, 158, - 187, 181, 195, 166, 222, 22, 169, 145, 135, 83, 12, 192, 118, 196, 175, - 89, 237, 220, 250, 60, 37, 123, 191, 182, 96, 84, 160, 189, 66, 169, - 239, 133, 49, 224, 92, 196, 253, 20, 34, 3, 249, 82, 223, 137, 50, - 82, 181, 57, 77, 114, 246, 50, 194, 62, 44, 159, 218, 98, 252, 246, - 134, 162, 24, 208, 170, 194, 192, 64, 58, 14, 78, 6, 142, 155, 140, - 197, 127, 75, 246, 50, 28, 233, 143, 82, 27, 253, 220, 77, 24, 3, - 222, 126, 146, 143, 198, 0, 228, 235, 180, 223, 72, 244, 181, 57, 123, - 25, 219, 7, 132, 154, 167, 108, 21, 199, 0, 180, 67, 98, 247, 168, - 119, 222, 238, 81, 143, 132, 31, 161, 209, 238, 217, 115, 147, 233, 59, - 83, 77, 211, 50, 211, 135, 166, 85, 240, 71, 108, 232, 52, 216, 253, - 149, 219, 201, 245, 137, 221, 147, 246, 232, 255, 50, 206, 188, 175, 235, - 255, 254, 90, 97, 165, 216, 239, 208, 243, 39, 138, 253, 191, 167, 172, - 178, 233, 217, 253, 208, 111, 237, 244, 14, 55, 66, 163, 221, 179, 231, - 98, 236, 163, 93, 240, 58, 192, 223, 153, 232, 128, 208, 168, 3, 246, - 28, 117, 240, 225, 59, 58, 64, 236, 183, 237, 227, 77, 239, 83, 39, - 237, 81, 7, 223, 166, 87, 12, 212, 211, 193, 235, 179, 151, 146, 137, - 14, 110, 207, 108, 67, 99, 64, 201, 215, 147, 117, 253, 223, 45, 207, - 89, 212, 255, 17, 26, 117, 192, 158, 139, 117, 128, 118, 203, 235, 0, - 237, 144, 232, 128, 208, 24, 3, 216, 115, 212, 193, 71, 160, 131, 154, - 160, 131, 154, 78, 49, 224, 196, 208, 214, 52, 6, 144, 246, 24, 3, - 62, 220, 152, 161, 27, 3, 186, 79, 235, 69, 237, 96, 124, 61, 31, - 106, 7, 11, 60, 23, 234, 234, 224, 74, 116, 36, 213, 1, 161, 81, - 7, 236, 185, 78, 12, 216, 236, 172, 3, 230, 175, 173, 102, 66, 163, - 29, 240, 126, 252, 59, 83, 99, 208, 65, 99, 208, 65, 99, 39, 59, - 8, 220, 205, 98, 0, 105, 143, 49, 160, 205, 121, 253, 24, 144, 114, - 143, 197, 128, 181, 15, 88, 12, 88, 233, 70, 12, 232, 193, 197, 128, - 30, 92, 12, 232, 225, 110, 12, 216, 196, 98, 128, 101, 61, 248, 181, - 84, 189, 24, 192, 242, 77, 38, 232, 107, 221, 168, 191, 14, 192, 118, - 212, 119, 254, 197, 248, 251, 110, 116, 119, 29, 224, 122, 61, 136, 115, - 62, 234, 59, 255, 226, 124, 39, 202, 216, 164, 237, 109, 111, 112, 119, - 29, 224, 90, 6, 206, 169, 232, 56, 56, 25, 56, 110, 50, 150, 128, - 13, 238, 174, 3, 92, 203, 192, 57, 11, 29, 199, 198, 44, 49, 64, - 147, 145, 182, 222, 221, 117, 64, 54, 121, 134, 187, 49, 116, 237, 140, - 122, 231, 239, 244, 97, 115, 103, 171, 153, 208, 235, 44, 54, 139, 104, - 78, 237, 180, 223, 189, 193, 153, 31, 155, 135, 90, 205, 132, 94, 15, - 252, 68, 243, 83, 167, 253, 238, 44, 252, 216, 156, 206, 106, 38, 52, - 242, 19, 205, 245, 156, 206, 23, 175, 119, 230, 199, 230, 71, 86, 51, - 161, 145, 159, 104, 222, 196, 175, 157, 17, 39, 4, 51, 105, 127, 131, - 29, 108, 210, 195, 12, 203, 55, 165, 173, 123, 228, 105, 89, 171, 63, - 111, 194, 118, 196, 14, 44, 235, 24, 255, 244, 36, 119, 231, 77, 174, - 237, 0, 99, 36, 145, 97, 225, 100, 164, 193, 59, 165, 105, 114, 66, - 147, 220, 157, 55, 185, 150, 129, 49, 136, 142, 99, 45, 55, 14, 160, - 201, 88, 146, 118, 187, 59, 111, 114, 45, 3, 125, 60, 29, 199, 90, - 103, 204, 160, 76, 101, 254, 183, 219, 221, 121, 147, 107, 25, 61, 56, - 204, 160, 222, 121, 27, 98, 115, 13, 171, 153, 208, 104, 67, 162, 57, - 136, 211, 126, 119, 22, 126, 44, 110, 91, 205, 132, 70, 126, 162, 120, - 238, 148, 191, 218, 237, 204, 143, 197, 64, 171, 153, 208, 200, 79, 20, - 27, 157, 242, 87, 89, 248, 245, 224, 48, 211, 131, 195, 76, 15, 55, - 49, 131, 56, 161, 107, 141, 237, 96, 7, 235, 245, 48, 195, 234, 78, - 44, 208, 55, 109, 167, 126, 156, 193, 118, 212, 158, 119, 49, 254, 33, - 59, 141, 139, 51, 200, 151, 218, 51, 208, 40, 83, 201, 3, 239, 48, - 46, 206, 88, 56, 25, 56, 110, 50, 150, 136, 29, 198, 197, 25, 228, - 203, 99, 198, 66, 244, 181, 195, 184, 56, 131, 122, 39, 54, 148, 102, - 218, 186, 213, 85, 156, 49, 221, 139, 116, 59, 206, 160, 142, 121, 126, - 174, 226, 12, 242, 115, 55, 206, 68, 100, 225, 231, 42, 206, 32, 63, - 119, 227, 140, 41, 11, 63, 87, 113, 6, 249, 185, 27, 103, 16, 39, - 236, 14, 35, 176, 131, 191, 245, 48, 195, 234, 78, 76, 208, 215, 154, - 230, 198, 250, 124, 59, 55, 167, 217, 198, 248, 39, 29, 54, 46, 206, - 32, 95, 106, 107, 40, 99, 187, 230, 159, 15, 27, 23, 103, 76, 156, - 12, 28, 55, 25, 75, 250, 33, 227, 226, 12, 242, 117, 154, 155, 105, - 50, 66, 15, 25, 23, 103, 80, 239, 188, 13, 185, 138, 51, 104, 67, - 238, 198, 25, 75, 22, 126, 174, 226, 12, 242, 115, 55, 206, 160, 62, - 121, 126, 174, 226, 12, 242, 115, 55, 206, 132, 102, 225, 231, 42, 206, - 32, 63, 119, 227, 12, 226, 132, 221, 97, 4, 118, 176, 93, 15, 51, - 159, 114, 119, 24, 61, 242, 116, 236, 119, 227, 12, 253, 65, 102, 7, - 142, 3, 140, 127, 196, 126, 227, 226, 12, 242, 101, 119, 24, 61, 242, - 68, 153, 74, 163, 253, 198, 197, 153, 80, 78, 6, 142, 155, 140, 37, - 97, 159, 113, 113, 6, 249, 58, 223, 97, 164, 229, 205, 246, 25, 23, - 103, 80, 239, 57, 141, 51, 38, 167, 59, 140, 114, 30, 103, 76, 78, - 119, 24, 229, 60, 206, 152, 156, 238, 48, 202, 121, 156, 49, 57, 221, - 97, 196, 48, 19, 122, 14, 236, 224, 160, 30, 102, 62, 227, 238, 48, - 122, 228, 153, 120, 65, 63, 206, 96, 59, 186, 183, 125, 145, 219, 11, - 188, 96, 92, 156, 65, 190, 116, 111, 27, 104, 148, 169, 172, 7, 206, - 27, 23, 103, 252, 57, 25, 56, 110, 50, 150, 144, 243, 198, 197, 25, - 228, 235, 116, 182, 81, 147, 225, 56, 103, 92, 156, 65, 189, 231, 52, - 206, 56, 157, 69, 60, 159, 243, 56, 227, 116, 22, 241, 124, 206, 227, - 12, 207, 15, 117, 151, 211, 56, 195, 99, 6, 113, 66, 239, 99, 57, - 5, 118, 176, 87, 15, 51, 172, 238, 196, 113, 22, 252, 249, 25, 253, - 56, 131, 237, 104, 12, 56, 203, 248, 103, 156, 206, 89, 156, 225, 247, - 207, 67, 57, 25, 14, 120, 39, 135, 38, 199, 122, 58, 103, 113, 134, - 223, 63, 71, 190, 116, 28, 64, 147, 177, 248, 158, 206, 89, 156, 225, - 247, 207, 67, 207, 56, 99, 6, 101, 42, 249, 191, 83, 57, 139, 51, - 100, 255, 60, 72, 211, 59, 189, 211, 167, 155, 119, 218, 232, 3, 207, - 222, 217, 63, 79, 74, 59, 108, 158, 248, 251, 232, 192, 236, 246, 12, - 157, 106, 120, 57, 126, 37, 186, 122, 167, 205, 47, 253, 107, 80, 214, - 189, 104, 199, 246, 195, 230, 209, 241, 110, 222, 97, 196, 241, 75, 107, - 225, 157, 86, 108, 72, 155, 134, 89, 247, 117, 67, 79, 30, 54, 23, - 110, 255, 149, 221, 29, 126, 168, 59, 194, 47, 52, 212, 59, 13, 117, - 149, 117, 143, 212, 10, 227, 109, 50, 54, 198, 189, 59, 140, 78, 113, - 235, 153, 99, 96, 7, 231, 244, 48, 195, 234, 78, 18, 255, 1, 127, - 126, 82, 63, 206, 96, 59, 26, 3, 254, 225, 214, 51, 39, 114, 22, - 103, 248, 253, 70, 127, 78, 70, 34, 188, 83, 162, 38, 199, 114, 34, - 103, 113, 134, 223, 111, 68, 190, 116, 28, 64, 147, 177, 164, 31, 207, - 89, 156, 225, 247, 27, 253, 79, 102, 57, 167, 117, 82, 91, 207, 28, - 207, 89, 156, 33, 251, 141, 65, 154, 222, 137, 13, 205, 7, 204, 92, - 26, 243, 216, 150, 117, 191, 49, 13, 108, 104, 229, 184, 207, 178, 221, - 111, 116, 90, 207, 112, 252, 38, 3, 191, 6, 107, 199, 217, 222, 217, - 187, 219, 118, 216, 28, 212, 229, 97, 182, 123, 119, 78, 235, 153, 227, - 140, 223, 104, 192, 76, 205, 125, 223, 52, 204, 186, 15, 150, 4, 152, - 233, 180, 169, 117, 182, 251, 96, 78, 235, 153, 227, 206, 152, 65, 93, - 101, 221, 83, 66, 204, 252, 58, 62, 251, 61, 37, 167, 245, 204, 49, - 110, 61, 115, 9, 236, 224, 148, 14, 102, 184, 123, 191, 66, 161, 175, - 227, 136, 27, 235, 153, 99, 92, 12, 56, 202, 213, 55, 222, 113, 55, - 206, 20, 116, 105, 7, 43, 228, 125, 244, 155, 198, 200, 151, 198, 0, - 160, 81, 166, 50, 183, 185, 229, 110, 156, 113, 45, 35, 180, 79, 50, - 91, 207, 112, 50, 112, 220, 100, 44, 137, 215, 220, 141, 51, 217, 200, - 184, 91, 143, 197, 178, 35, 89, 214, 51, 154, 12, 255, 203, 238, 198, - 25, 215, 50, 182, 189, 82, 49, 243, 121, 46, 85, 239, 85, 148, 150, - 38, 83, 116, 141, 15, 211, 80, 143, 132, 31, 161, 27, 36, 197, 91, - 216, 115, 215, 223, 33, 29, 220, 58, 211, 210, 191, 95, 121, 205, 158, - 3, 164, 197, 129, 181, 20, 250, 127, 167, 186, 75, 248, 219, 137, 206, - 181, 188, 231, 55, 75, 98, 241, 109, 57, 61, 19, 150, 63, 243, 15, - 73, 20, 223, 176, 111, 102, 174, 245, 210, 189, 184, 181, 244, 190, 157, - 193, 203, 212, 187, 172, 60, 50, 109, 210, 143, 77, 19, 132, 231, 170, - 94, 229, 218, 33, 133, 140, 220, 77, 191, 225, 103, 93, 175, 221, 71, - 149, 121, 64, 106, 241, 188, 144, 240, 60, 210, 203, 92, 199, 164, 246, - 123, 63, 208, 218, 156, 146, 138, 127, 25, 164, 210, 209, 103, 164, 65, - 62, 77, 132, 125, 95, 199, 158, 151, 102, 31, 108, 169, 181, 113, 72, - 158, 141, 212, 24, 137, 223, 151, 31, 178, 249, 27, 97, 223, 92, 113, - 215, 164, 239, 31, 182, 213, 218, 220, 148, 202, 111, 234, 162, 208, 190, - 209, 183, 165, 135, 227, 250, 8, 251, 150, 143, 187, 43, 33, 150, 180, - 153, 157, 100, 181, 68, 42, 244, 252, 232, 135, 82, 159, 51, 221, 133, - 125, 15, 199, 62, 145, 26, 77, 190, 64, 191, 233, 233, 223, 82, 189, - 155, 106, 75, 212, 75, 233, 235, 53, 167, 55, 139, 250, 218, 98, 95, - 75, 79, 99, 190, 161, 223, 7, 222, 95, 98, 170, 66, 191, 10, 246, - 144, 207, 223, 93, 46, 190, 143, 42, 205, 83, 30, 177, 176, 15, 253, - 14, 223, 155, 15, 219, 169, 116, 116, 30, 121, 112, 171, 143, 116, 238, - 159, 201, 39, 159, 121, 213, 136, 126, 227, 247, 217, 167, 13, 232, 221, - 53, 126, 67, 3, 116, 239, 174, 97, 103, 19, 253, 40, 141, 223, 191, - 210, 59, 179, 72, 176, 133, 254, 134, 96, 11, 239, 193, 66, 255, 65, - 231, 72, 26, 45, 1, 182, 216, 115, 215, 216, 218, 6, 216, 202, 95, - 109, 90, 10, 193, 86, 82, 155, 207, 21, 58, 24, 176, 245, 217, 202, - 199, 194, 187, 157, 26, 2, 182, 216, 92, 111, 57, 61, 107, 88, 11, - 176, 37, 154, 235, 97, 223, 2, 94, 235, 165, 60, 39, 124, 236, 4, - 91, 219, 171, 202, 10, 157, 15, 176, 21, 62, 102, 140, 208, 94, 254, - 5, 108, 45, 155, 246, 43, 189, 219, 110, 198, 89, 155, 66, 63, 126, - 117, 64, 58, 248, 193, 73, 97, 95, 47, 175, 99, 210, 218, 186, 119, - 40, 182, 22, 188, 246, 80, 206, 45, 215, 3, 108, 229, 205, 240, 22, - 126, 199, 208, 39, 254, 188, 132, 190, 156, 96, 171, 240, 60, 31, 133, - 246, 138, 187, 44, 229, 63, 147, 33, 148, 219, 127, 252, 53, 233, 88, - 68, 56, 197, 214, 149, 184, 210, 138, 126, 126, 6, 108, 85, 92, 90, - 65, 232, 195, 74, 143, 187, 43, 69, 22, 205, 71, 191, 113, 217, 223, - 175, 136, 66, 127, 111, 125, 40, 221, 133, 184, 34, 234, 123, 9, 176, - 213, 120, 246, 210, 134, 4, 91, 123, 199, 215, 87, 104, 63, 192, 214, - 197, 233, 213, 133, 182, 246, 32, 230, 181, 36, 207, 43, 64, 198, 37, - 247, 75, 104, 163, 208, 179, 1, 91, 185, 23, 77, 21, 142, 247, 14, - 96, 171, 89, 46, 114, 119, 161, 151, 252, 123, 165, 177, 10, 93, 8, - 176, 53, 178, 107, 127, 29, 31, 150, 79, 126, 83, 169, 134, 157, 96, - 107, 206, 7, 185, 21, 58, 51, 170, 160, 92, 184, 231, 118, 155, 30, - 182, 216, 153, 87, 63, 74, 227, 247, 179, 245, 206, 194, 210, 184, 117, - 141, 97, 107, 22, 98, 11, 226, 38, 197, 150, 70, 43, 216, 162, 207, - 9, 182, 222, 189, 175, 242, 104, 183, 149, 244, 251, 217, 197, 103, 77, - 87, 232, 98, 167, 187, 75, 9, 227, 186, 8, 223, 165, 111, 177, 89, - 18, 91, 247, 44, 167, 103, 88, 195, 94, 255, 33, 137, 214, 61, 216, - 119, 50, 96, 235, 11, 223, 227, 20, 91, 255, 171, 80, 68, 177, 83, - 11, 96, 107, 154, 165, 129, 208, 198, 127, 6, 108, 181, 92, 62, 36, - 149, 96, 171, 121, 216, 116, 133, 62, 6, 216, 250, 242, 233, 18, 97, - 223, 23, 128, 173, 118, 215, 215, 166, 18, 108, 149, 239, 189, 71, 161, - 243, 198, 156, 145, 186, 175, 58, 38, 236, 107, 25, 127, 94, 194, 57, - 12, 193, 214, 221, 63, 174, 42, 116, 163, 217, 151, 37, 251, 169, 227, - 194, 190, 227, 18, 174, 73, 109, 27, 206, 77, 37, 216, 178, 125, 92, - 95, 161, 235, 143, 191, 45, 13, 238, 61, 93, 168, 171, 69, 157, 239, - 74, 127, 125, 82, 142, 98, 171, 118, 68, 3, 133, 94, 51, 225, 161, - 116, 4, 230, 83, 162, 190, 243, 162, 158, 72, 201, 103, 250, 80, 108, - 45, 238, 222, 89, 241, 157, 211, 70, 191, 148, 74, 255, 28, 35, 148, - 251, 89, 212, 107, 169, 72, 255, 71, 20, 91, 17, 113, 249, 149, 119, - 158, 0, 216, 42, 91, 173, 108, 170, 30, 182, 70, 143, 32, 223, 16, - 246, 146, 171, 52, 120, 165, 240, 241, 2, 108, 205, 61, 243, 143, 80, - 238, 77, 192, 86, 205, 87, 75, 41, 182, 34, 214, 170, 247, 136, 222, - 5, 108, 125, 123, 172, 157, 176, 111, 38, 96, 139, 157, 165, 246, 163, - 116, 50, 96, 75, 239, 140, 53, 141, 91, 151, 25, 182, 240, 219, 244, - 56, 95, 36, 216, 34, 52, 126, 3, 150, 61, 119, 253, 13, 216, 52, - 192, 86, 194, 124, 118, 79, 210, 230, 100, 149, 174, 8, 113, 203, 113, - 78, 124, 214, 249, 113, 209, 89, 18, 203, 1, 44, 167, 103, 163, 243, - 66, 220, 18, 229, 0, 148, 24, 0, 216, 170, 190, 147, 221, 117, 20, - 81, 68, 253, 230, 103, 41, 192, 214, 31, 161, 227, 132, 125, 11, 121, - 237, 144, 198, 121, 140, 166, 223, 98, 45, 127, 95, 253, 38, 106, 69, - 152, 19, 254, 118, 78, 124, 79, 82, 115, 192, 86, 157, 242, 225, 244, - 123, 170, 69, 188, 251, 41, 180, 4, 113, 235, 199, 177, 97, 194, 190, - 29, 226, 206, 75, 56, 119, 39, 216, 218, 237, 173, 126, 55, 192, 110, - 189, 44, 181, 110, 217, 91, 216, 183, 119, 204, 53, 105, 40, 189, 75, - 233, 166, 180, 161, 135, 58, 198, 47, 163, 110, 75, 87, 3, 196, 186, - 218, 20, 123, 87, 42, 91, 123, 52, 253, 158, 234, 147, 153, 42, 221, - 8, 230, 132, 7, 238, 136, 191, 211, 187, 21, 226, 86, 169, 147, 209, - 244, 123, 170, 159, 255, 21, 163, 125, 199, 245, 165, 244, 113, 115, 241, - 29, 75, 15, 97, 78, 120, 195, 70, 191, 215, 42, 95, 14, 82, 105, - 188, 191, 204, 97, 139, 212, 189, 115, 104, 83, 72, 20, 253, 158, 106, - 112, 66, 148, 118, 215, 81, 30, 185, 69, 161, 104, 179, 222, 156, 240, - 219, 127, 163, 233, 55, 81, 189, 191, 32, 247, 66, 21, 148, 55, 254, - 30, 99, 214, 139, 91, 236, 140, 190, 31, 165, 113, 78, 168, 119, 118, - 159, 238, 127, 92, 226, 114, 185, 177, 176, 110, 60, 166, 183, 198, 102, - 231, 224, 67, 97, 61, 152, 56, 75, 63, 47, 21, 202, 173, 27, 29, - 233, 92, 205, 237, 116, 119, 243, 82, 174, 215, 141, 63, 70, 236, 164, - 247, 94, 35, 95, 186, 198, 6, 26, 101, 42, 235, 223, 201, 238, 230, - 165, 92, 203, 168, 210, 38, 141, 202, 8, 229, 100, 224, 184, 201, 88, - 252, 39, 184, 155, 151, 114, 45, 35, 207, 125, 137, 237, 227, 204, 202, - 178, 198, 214, 100, 36, 198, 186, 155, 151, 114, 45, 163, 49, 183, 198, - 70, 189, 19, 127, 26, 9, 254, 20, 245, 72, 248, 17, 26, 215, 216, - 236, 57, 241, 167, 31, 154, 2, 185, 51, 224, 3, 193, 159, 14, 247, - 47, 75, 191, 207, 255, 127, 228, 125, 119, 116, 20, 85, 244, 255, 38, - 244, 30, 32, 116, 132, 208, 73, 1, 150, 42, 66, 96, 119, 134, 162, - 244, 80, 20, 172, 132, 14, 210, 130, 244, 146, 176, 9, 32, 82, 132, - 40, 8, 34, 136, 1, 21, 34, 2, 198, 0, 138, 144, 132, 13, 77, - 164, 70, 138, 70, 138, 44, 189, 72, 9, 33, 129, 16, 8, 252, 238, - 157, 153, 87, 38, 108, 102, 246, 251, 203, 251, 227, 123, 206, 55, 231, - 236, 225, 158, 225, 221, 123, 231, 221, 185, 159, 119, 95, 187, 239, 149, - 232, 30, 164, 208, 45, 161, 61, 197, 239, 71, 120, 251, 90, 2, 45, - 35, 224, 55, 147, 219, 59, 93, 10, 198, 1, 108, 62, 44, 150, 238, - 185, 47, 9, 237, 169, 209, 124, 24, 242, 90, 160, 61, 13, 47, 122, - 172, 45, 105, 79, 227, 214, 191, 163, 222, 179, 2, 237, 105, 74, 232, - 70, 218, 63, 141, 3, 158, 237, 240, 219, 105, 105, 196, 48, 3, 125, - 149, 132, 116, 114, 39, 205, 33, 169, 126, 72, 101, 37, 22, 23, 132, - 246, 52, 103, 195, 171, 180, 79, 157, 8, 60, 201, 240, 59, 192, 241, - 230, 192, 24, 123, 114, 249, 129, 237, 72, 123, 122, 227, 89, 68, 59, - 50, 198, 62, 60, 109, 62, 229, 61, 12, 60, 199, 45, 141, 45, 41, - 240, 227, 239, 169, 70, 127, 38, 237, 169, 245, 194, 114, 133, 46, 14, - 99, 108, 91, 204, 114, 202, 123, 18, 120, 78, 195, 239, 47, 142, 55, - 59, 242, 154, 180, 225, 206, 92, 122, 31, 100, 161, 59, 170, 94, 188, - 55, 35, 229, 249, 68, 202, 155, 10, 60, 103, 225, 119, 158, 123, 231, - 202, 48, 198, 190, 208, 115, 70, 59, 210, 158, 222, 122, 109, 176, 66, - 55, 135, 246, 180, 70, 237, 174, 148, 247, 34, 240, 93, 2, 190, 43, - 28, 47, 158, 79, 237, 10, 46, 65, 251, 42, 133, 171, 169, 247, 231, - 166, 65, 123, 122, 110, 214, 8, 106, 231, 107, 192, 115, 3, 126, 183, - 184, 111, 116, 24, 218, 211, 137, 67, 206, 145, 113, 184, 92, 51, 76, - 205, 243, 194, 246, 180, 79, 246, 30, 250, 125, 239, 0, 207, 61, 248, - 165, 113, 188, 79, 161, 61, 205, 217, 96, 163, 119, 240, 84, 236, 59, - 175, 173, 218, 38, 22, 150, 223, 232, 157, 66, 231, 95, 210, 129, 39, - 3, 126, 89, 28, 47, 182, 167, 117, 35, 106, 183, 33, 237, 233, 142, - 35, 167, 119, 145, 246, 212, 119, 116, 56, 213, 155, 131, 60, 94, 65, - 150, 66, 94, 65, 186, 246, 148, 229, 126, 248, 82, 26, 219, 83, 62, - 39, 164, 56, 240, 148, 134, 95, 57, 142, 151, 142, 3, 62, 209, 143, - 177, 177, 253, 32, 216, 34, 52, 142, 3, 216, 115, 247, 216, 194, 49, - 246, 249, 83, 75, 232, 93, 211, 227, 78, 118, 84, 232, 70, 128, 173, - 202, 217, 236, 158, 169, 190, 192, 51, 2, 126, 51, 57, 222, 50, 128, - 45, 54, 55, 28, 75, 115, 57, 42, 0, 182, 140, 230, 134, 149, 111, - 94, 96, 155, 244, 236, 55, 114, 127, 242, 78, 233, 159, 71, 218, 253, - 80, 128, 173, 147, 171, 202, 183, 99, 216, 106, 4, 216, 106, 164, 195, - 86, 58, 96, 107, 244, 170, 246, 237, 8, 182, 250, 78, 121, 179, 157, - 186, 159, 255, 168, 84, 180, 239, 24, 67, 108, 213, 130, 190, 74, 175, - 117, 163, 40, 182, 90, 215, 93, 168, 249, 233, 89, 169, 214, 137, 229, - 134, 216, 122, 7, 250, 42, 216, 142, 19, 108, 189, 253, 243, 143, 10, - 61, 22, 250, 42, 247, 247, 27, 99, 235, 222, 156, 107, 210, 235, 147, - 239, 208, 251, 173, 146, 34, 235, 42, 118, 251, 15, 176, 213, 177, 89, - 151, 68, 134, 173, 70, 128, 173, 32, 192, 22, 107, 195, 134, 133, 223, - 149, 18, 55, 91, 146, 8, 182, 182, 62, 45, 163, 208, 27, 194, 211, - 165, 17, 65, 53, 147, 24, 182, 252, 1, 91, 254, 128, 173, 134, 28, - 62, 50, 165, 183, 26, 164, 39, 18, 108, 109, 219, 118, 82, 161, 255, - 4, 108, 21, 237, 180, 45, 145, 97, 203, 31, 176, 21, 0, 216, 10, - 160, 188, 223, 1, 182, 14, 223, 161, 99, 20, 185, 74, 85, 117, 238, - 227, 54, 96, 235, 139, 65, 3, 18, 25, 182, 2, 0, 91, 129, 128, - 173, 64, 221, 157, 52, 47, 122, 189, 71, 199, 216, 183, 19, 187, 39, - 170, 237, 80, 97, 121, 196, 170, 70, 137, 12, 91, 129, 128, 173, 64, - 192, 86, 32, 215, 14, 21, 147, 187, 119, 56, 79, 239, 149, 153, 61, - 70, 189, 123, 254, 41, 140, 3, 238, 55, 98, 121, 79, 57, 200, 227, - 6, 91, 44, 167, 200, 151, 210, 56, 198, 230, 115, 141, 140, 176, 133, - 113, 150, 96, 107, 9, 96, 11, 227, 38, 193, 22, 161, 17, 91, 236, - 57, 98, 203, 255, 37, 108, 237, 7, 108, 149, 61, 203, 198, 216, 107, - 55, 168, 119, 84, 85, 133, 49, 118, 217, 107, 253, 18, 140, 176, 53, - 1, 198, 216, 108, 157, 36, 150, 230, 8, 141, 134, 49, 182, 209, 58, - 9, 242, 206, 131, 184, 181, 114, 255, 41, 58, 198, 62, 89, 83, 29, - 99, 183, 1, 108, 189, 63, 132, 141, 177, 227, 224, 187, 109, 135, 239, - 190, 147, 243, 151, 207, 1, 91, 247, 158, 179, 49, 246, 128, 46, 234, - 24, 251, 56, 140, 177, 143, 71, 179, 49, 118, 162, 165, 62, 96, 171, - 62, 96, 171, 30, 229, 173, 94, 232, 148, 212, 169, 111, 28, 29, 99, - 55, 206, 58, 168, 208, 1, 48, 198, 158, 210, 231, 100, 18, 195, 86, - 93, 192, 86, 29, 192, 86, 109, 202, 59, 26, 198, 216, 216, 135, 33, - 216, 10, 125, 113, 69, 161, 7, 125, 126, 89, 90, 187, 134, 141, 207, - 79, 90, 106, 1, 182, 106, 1, 182, 24, 239, 8, 24, 99, 63, 29, - 20, 77, 199, 216, 203, 6, 55, 81, 232, 213, 115, 110, 75, 155, 167, - 142, 226, 176, 85, 15, 176, 213, 80, 135, 173, 75, 239, 222, 149, 238, - 183, 12, 162, 99, 108, 215, 244, 206, 10, 29, 53, 63, 93, 146, 161, - 63, 197, 176, 101, 5, 108, 53, 5, 108, 53, 165, 188, 205, 97, 140, - 109, 153, 57, 129, 198, 45, 223, 231, 95, 41, 109, 247, 197, 169, 217, - 210, 168, 107, 11, 18, 245, 113, 43, 72, 135, 173, 117, 179, 114, 164, - 230, 109, 188, 73, 189, 228, 173, 77, 43, 40, 244, 100, 192, 214, 168, - 172, 6, 73, 12, 91, 254, 128, 45, 127, 192, 86, 67, 221, 24, 123, - 86, 168, 15, 29, 99, 187, 182, 169, 227, 109, 196, 86, 221, 95, 175, - 115, 216, 242, 7, 108, 249, 3, 182, 252, 185, 57, 183, 98, 114, 213, - 233, 63, 210, 49, 118, 194, 13, 117, 174, 236, 58, 96, 107, 85, 60, - 27, 99, 231, 224, 187, 122, 5, 0, 182, 152, 173, 158, 2, 182, 88, - 174, 154, 47, 165, 119, 3, 182, 248, 28, 182, 226, 192, 83, 26, 126, - 229, 56, 94, 26, 183, 34, 245, 99, 236, 142, 220, 24, 187, 35, 55, - 198, 238, 248, 210, 24, 187, 35, 96, 171, 163, 110, 140, 253, 211, 106, - 54, 198, 238, 145, 192, 198, 216, 255, 113, 99, 236, 190, 192, 51, 2, - 126, 51, 57, 94, 28, 99, 179, 53, 195, 88, 154, 123, 134, 99, 108, - 163, 53, 67, 228, 45, 6, 216, 90, 149, 202, 198, 216, 139, 36, 117, - 12, 86, 9, 176, 53, 113, 19, 27, 99, 199, 1, 207, 118, 248, 237, - 180, 116, 96, 119, 87, 195, 24, 251, 240, 52, 54, 198, 14, 140, 157, - 172, 208, 53, 33, 110, 77, 250, 251, 35, 27, 195, 86, 7, 192, 86, - 7, 192, 86, 7, 238, 46, 246, 83, 82, 191, 109, 227, 233, 24, 123, - 197, 118, 245, 126, 151, 142, 216, 39, 108, 49, 210, 198, 176, 37, 3, - 182, 100, 192, 150, 76, 121, 37, 136, 91, 216, 119, 39, 216, 106, 48, - 81, 189, 211, 101, 17, 196, 173, 135, 225, 108, 124, 126, 210, 34, 1, - 182, 36, 192, 150, 68, 121, 163, 97, 140, 61, 35, 112, 26, 29, 99, - 191, 177, 77, 173, 227, 24, 24, 99, 159, 105, 197, 108, 149, 10, 239, - 122, 22, 126, 231, 57, 91, 197, 195, 24, 123, 99, 97, 54, 198, 126, - 175, 190, 74, 183, 130, 62, 161, 79, 103, 54, 198, 190, 8, 124, 151, - 224, 119, 133, 171, 239, 17, 136, 91, 103, 226, 216, 157, 37, 227, 180, - 251, 135, 159, 66, 220, 122, 56, 158, 233, 189, 6, 250, 110, 192, 239, - 22, 167, 247, 17, 196, 173, 126, 85, 217, 24, 123, 255, 31, 179, 232, - 157, 37, 173, 166, 179, 49, 246, 29, 224, 185, 7, 191, 52, 142, 23, - 199, 216, 127, 212, 97, 99, 236, 94, 19, 217, 24, 251, 157, 114, 108, - 140, 157, 14, 60, 25, 240, 203, 226, 120, 177, 79, 88, 33, 135, 141, - 177, 223, 255, 128, 141, 177, 191, 223, 195, 222, 57, 7, 121, 188, 58, - 2, 182, 58, 234, 226, 22, 203, 129, 244, 165, 52, 246, 9, 249, 220, - 200, 226, 192, 83, 26, 126, 229, 56, 94, 186, 247, 35, 146, 141, 177, - 45, 107, 96, 204, 124, 201, 108, 140, 205, 242, 63, 98, 28, 15, 189, - 237, 107, 205, 215, 177, 177, 28, 205, 205, 248, 134, 203, 153, 250, 90, - 220, 190, 92, 148, 75, 115, 51, 224, 157, 80, 167, 50, 70, 253, 90, - 220, 190, 92, 148, 75, 235, 1, 52, 169, 75, 218, 26, 113, 251, 114, - 237, 107, 115, 229, 76, 173, 213, 246, 125, 173, 17, 183, 47, 23, 237, - 46, 50, 255, 35, 244, 107, 177, 249, 31, 104, 79, 145, 249, 31, 142, - 53, 98, 243, 63, 16, 39, 52, 207, 112, 229, 67, 111, 191, 72, 51, - 204, 176, 252, 15, 199, 106, 40, 251, 149, 249, 188, 20, 150, 163, 126, - 176, 154, 201, 143, 94, 37, 110, 95, 174, 133, 211, 225, 128, 119, 114, - 104, 122, 252, 86, 137, 219, 151, 139, 114, 105, 61, 128, 38, 117, 137, - 251, 82, 220, 190, 92, 203, 87, 122, 204, 160, 78, 165, 79, 240, 165, - 184, 125, 185, 104, 119, 145, 249, 31, 126, 171, 196, 230, 127, 160, 61, - 69, 230, 127, 216, 191, 20, 155, 255, 129, 56, 161, 121, 134, 203, 224, - 187, 172, 49, 195, 12, 203, 255, 176, 3, 175, 243, 11, 15, 242, 12, - 87, 114, 49, 96, 5, 151, 103, 248, 133, 192, 60, 195, 21, 92, 12, - 0, 26, 117, 42, 61, 164, 229, 2, 243, 12, 57, 29, 88, 111, 82, - 151, 176, 229, 2, 243, 12, 191, 200, 149, 103, 72, 236, 181, 92, 96, - 158, 225, 23, 98, 243, 63, 208, 198, 34, 243, 63, 194, 150, 139, 205, - 255, 176, 44, 23, 155, 255, 129, 56, 161, 231, 39, 110, 5, 63, 88, - 105, 134, 25, 150, 255, 97, 1, 94, 199, 103, 30, 228, 25, 46, 227, - 98, 192, 231, 220, 25, 16, 159, 9, 204, 51, 252, 156, 243, 53, 212, - 177, 76, 139, 1, 63, 9, 204, 51, 228, 116, 96, 189, 73, 93, 236, - 63, 9, 204, 51, 252, 44, 87, 158, 161, 166, 35, 101, 171, 184, 56, - 131, 118, 23, 153, 255, 129, 54, 22, 153, 255, 97, 255, 73, 108, 254, - 7, 218, 78, 100, 254, 7, 226, 132, 222, 213, 179, 9, 252, 96, 153, - 25, 102, 88, 254, 71, 202, 150, 135, 222, 33, 155, 61, 56, 63, 113, - 11, 119, 238, 224, 22, 238, 204, 209, 31, 197, 197, 153, 16, 78, 71, - 10, 188, 83, 138, 166, 39, 236, 71, 113, 113, 6, 229, 210, 122, 0, - 77, 235, 242, 163, 184, 56, 19, 178, 57, 215, 249, 137, 155, 181, 92, - 198, 77, 226, 226, 12, 218, 93, 228, 120, 38, 236, 71, 177, 227, 25, - 203, 143, 98, 199, 51, 104, 59, 145, 227, 25, 196, 9, 189, 67, 225, - 123, 240, 131, 173, 102, 152, 97, 249, 31, 209, 63, 0, 111, 172, 121, - 156, 193, 114, 244, 220, 233, 31, 184, 189, 236, 27, 197, 197, 25, 31, - 78, 71, 52, 188, 83, 180, 166, 199, 186, 81, 92, 156, 65, 185, 180, - 30, 64, 147, 186, 56, 55, 136, 139, 51, 62, 177, 185, 238, 234, 137, - 213, 114, 25, 55, 136, 139, 51, 104, 119, 145, 227, 25, 235, 70, 177, - 227, 25, 180, 167, 200, 241, 76, 200, 6, 177, 227, 25, 196, 9, 189, - 71, 241, 5, 208, 155, 76, 48, 195, 221, 59, 18, 2, 188, 41, 223, - 122, 112, 135, 194, 247, 92, 12, 248, 142, 59, 163, 241, 91, 113, 113, - 6, 229, 210, 24, 0, 52, 234, 84, 230, 180, 214, 139, 139, 51, 33, - 156, 14, 172, 55, 169, 139, 99, 189, 184, 56, 131, 114, 117, 119, 40, - 104, 58, 226, 94, 136, 139, 51, 104, 119, 145, 227, 25, 180, 177, 200, - 241, 140, 99, 189, 216, 241, 12, 218, 78, 228, 120, 70, 193, 137, 38, - 47, 45, 27, 252, 224, 123, 51, 204, 176, 253, 92, 113, 207, 31, 122, - 91, 115, 204, 227, 12, 150, 163, 119, 79, 61, 103, 242, 157, 207, 196, - 197, 25, 43, 167, 35, 14, 222, 41, 78, 211, 19, 242, 76, 92, 156, - 65, 185, 180, 30, 64, 147, 186, 184, 158, 138, 139, 51, 214, 28, 61, - 102, 80, 167, 210, 199, 124, 42, 46, 206, 160, 221, 69, 142, 103, 66, - 158, 137, 29, 207, 160, 61, 69, 142, 103, 194, 158, 138, 29, 207, 32, - 78, 232, 61, 138, 143, 192, 15, 94, 152, 97, 134, 157, 3, 25, 6, - 188, 105, 89, 230, 113, 6, 203, 209, 59, 59, 159, 112, 247, 91, 101, - 137, 139, 51, 40, 151, 232, 8, 3, 26, 117, 42, 243, 12, 89, 226, - 226, 76, 24, 167, 3, 235, 77, 234, 18, 243, 88, 92, 156, 65, 185, - 60, 102, 194, 52, 29, 214, 199, 226, 226, 12, 218, 93, 228, 120, 198, - 39, 75, 236, 120, 6, 237, 41, 114, 60, 99, 125, 44, 118, 60, 131, - 56, 161, 247, 40, 166, 131, 31, 100, 155, 97, 134, 157, 3, 105, 5, - 222, 184, 12, 243, 56, 131, 229, 104, 12, 200, 228, 238, 81, 204, 16, - 23, 103, 80, 46, 141, 1, 64, 163, 78, 101, 12, 253, 80, 92, 156, - 177, 114, 58, 176, 222, 164, 46, 161, 15, 197, 197, 25, 148, 171, 187, - 71, 81, 211, 145, 150, 46, 46, 206, 160, 221, 69, 142, 103, 208, 198, - 34, 199, 51, 161, 15, 197, 142, 103, 208, 118, 34, 199, 51, 136, 19, - 122, 222, 112, 161, 12, 239, 184, 71, 110, 48, 19, 54, 108, 204, 148, - 81, 234, 121, 243, 22, 238, 123, 164, 61, 120, 232, 237, 87, 58, 3, - 48, 83, 88, 26, 62, 188, 134, 188, 102, 73, 216, 158, 10, 217, 85, - 236, 47, 221, 163, 248, 128, 139, 1, 15, 184, 243, 185, 74, 101, 228, - 233, 7, 72, 29, 59, 122, 84, 195, 140, 183, 197, 219, 226, 254, 143, - 198, 0, 94, 71, 127, 192, 190, 166, 199, 89, 210, 19, 29, 213, 60, - 211, 209, 159, 219, 107, 95, 38, 195, 155, 212, 197, 199, 35, 29, 213, - 61, 210, 129, 114, 233, 57, 19, 168, 67, 187, 211, 36, 180, 132, 145, - 14, 135, 237, 216, 209, 197, 26, 102, 242, 210, 225, 176, 209, 115, 38, - 56, 29, 49, 240, 253, 80, 167, 82, 162, 152, 59, 29, 86, 9, 117, - 76, 156, 239, 179, 167, 83, 237, 162, 90, 123, 88, 196, 45, 46, 117, - 245, 40, 205, 213, 3, 104, 63, 77, 71, 76, 145, 188, 117, 188, 223, - 196, 127, 79, 15, 239, 251, 208, 190, 120, 83, 29, 5, 12, 116, 248, - 113, 58, 44, 154, 78, 229, 155, 23, 202, 91, 71, 219, 125, 243, 183, - 213, 89, 176, 164, 153, 212, 161, 128, 105, 61, 166, 105, 62, 90, 79, - 177, 170, 122, 38, 185, 222, 246, 218, 152, 115, 205, 92, 73, 103, 233, - 60, 238, 165, 96, 37, 186, 83, 122, 246, 245, 133, 114, 30, 46, 161, - 235, 99, 78, 211, 124, 249, 127, 203, 187, 248, 252, 47, 122, 23, 196, - 134, 254, 93, 28, 220, 125, 178, 14, 27, 123, 23, 135, 205, 252, 93, - 28, 54, 246, 46, 42, 173, 190, 139, 195, 102, 246, 46, 223, 121, 169, - 24, 170, 167, 120, 86, 222, 118, 25, 217, 99, 149, 206, 46, 195, 44, - 175, 88, 28, 150, 38, 150, 37, 150, 214, 44, 7, 117, 127, 39, 249, - 243, 246, 101, 219, 230, 182, 139, 151, 173, 135, 252, 202, 208, 155, 191, - 25, 189, 139, 87, 114, 79, 121, 236, 137, 47, 180, 62, 93, 136, 92, - 240, 217, 120, 37, 182, 20, 182, 245, 150, 111, 45, 56, 108, 56, 158, - 41, 146, 220, 71, 110, 148, 213, 76, 139, 149, 253, 228, 55, 254, 94, - 160, 208, 245, 18, 251, 203, 206, 105, 52, 135, 218, 45, 111, 147, 14, - 239, 201, 101, 10, 70, 104, 101, 66, 229, 133, 41, 106, 62, 251, 91, - 109, 135, 203, 94, 247, 203, 26, 222, 223, 120, 113, 255, 88, 185, 145, - 125, 132, 86, 102, 146, 60, 54, 92, 221, 163, 123, 190, 141, 67, 254, - 178, 229, 97, 67, 222, 156, 253, 243, 229, 194, 157, 125, 246, 168, 79, - 151, 80, 250, 173, 65, 95, 112, 207, 141, 191, 27, 182, 75, 228, 187, - 133, 142, 157, 97, 75, 88, 152, 216, 58, 247, 119, 11, 253, 98, 129, - 109, 84, 246, 122, 118, 198, 7, 124, 51, 252, 69, 194, 175, 128, 218, - 82, 121, 47, 216, 215, 73, 238, 59, 183, 122, 187, 220, 223, 173, 27, - 124, 183, 222, 99, 179, 13, 109, 239, 13, 223, 45, 248, 80, 209, 68, - 242, 221, 66, 166, 118, 85, 232, 204, 246, 189, 229, 30, 229, 62, 54, - 180, 125, 182, 179, 143, 156, 146, 180, 41, 145, 124, 183, 211, 87, 15, - 41, 244, 195, 132, 254, 242, 221, 31, 140, 109, 127, 69, 126, 79, 78, - 187, 244, 122, 18, 249, 110, 77, 166, 169, 123, 186, 143, 180, 25, 46, - 59, 7, 173, 54, 228, 253, 2, 190, 219, 216, 173, 251, 233, 119, 59, - 95, 234, 162, 66, 255, 2, 223, 109, 208, 149, 98, 134, 182, 127, 4, - 223, 109, 230, 4, 127, 250, 221, 8, 221, 31, 190, 27, 123, 110, 252, - 221, 176, 173, 55, 195, 219, 168, 92, 120, 27, 170, 125, 183, 37, 240, - 163, 57, 193, 128, 183, 148, 204, 38, 187, 220, 225, 109, 195, 254, 146, - 175, 25, 189, 203, 11, 103, 79, 121, 226, 224, 166, 109, 200, 119, 187, - 80, 185, 123, 27, 149, 183, 183, 252, 250, 137, 225, 109, 140, 121, 251, - 200, 53, 83, 3, 218, 144, 239, 54, 229, 86, 21, 133, 246, 6, 188, - 221, 111, 115, 220, 80, 239, 115, 248, 110, 227, 223, 248, 250, 53, 242, - 221, 86, 6, 141, 87, 232, 130, 128, 183, 140, 226, 87, 90, 27, 241, - 62, 131, 239, 86, 184, 190, 119, 107, 242, 221, 42, 117, 252, 202, 170, - 242, 58, 228, 87, 235, 70, 237, 52, 230, 157, 47, 191, 17, 176, 178, - 41, 249, 110, 132, 238, 1, 223, 141, 61, 55, 158, 223, 192, 190, 38, - 157, 19, 244, 130, 126, 78, 186, 81, 191, 179, 153, 174, 223, 233, 44, - 152, 225, 237, 44, 96, 222, 239, 196, 114, 116, 207, 78, 65, 214, 39, - 8, 41, 224, 105, 63, 199, 253, 248, 3, 219, 20, 186, 103, 135, 211, - 129, 239, 228, 212, 244, 184, 188, 61, 237, 231, 120, 185, 237, 231, 160, - 255, 211, 122, 20, 208, 247, 115, 72, 93, 194, 188, 61, 237, 231, 184, - 175, 7, 126, 43, 58, 191, 86, 32, 67, 119, 190, 60, 107, 55, 29, - 54, 66, 175, 178, 37, 216, 141, 218, 83, 221, 217, 224, 222, 122, 121, - 12, 207, 14, 27, 161, 151, 133, 236, 182, 27, 225, 92, 183, 54, 155, - 75, 30, 243, 51, 135, 141, 208, 171, 225, 253, 140, 252, 143, 31, 247, - 160, 207, 209, 61, 54, 17, 25, 222, 118, 174, 207, 248, 178, 255, 53, - 215, 249, 95, 24, 250, 171, 197, 220, 255, 176, 28, 157, 151, 178, 48, - 249, 113, 179, 197, 249, 31, 202, 165, 227, 30, 160, 81, 167, 226, 35, - 179, 197, 249, 95, 152, 69, 239, 127, 164, 46, 41, 17, 226, 252, 15, - 109, 194, 159, 211, 230, 206, 255, 66, 43, 172, 240, 216, 255, 236, 156, - 60, 251, 160, 34, 110, 253, 47, 12, 228, 121, 234, 127, 88, 87, 34, - 207, 1, 239, 231, 206, 255, 82, 124, 87, 120, 236, 127, 232, 115, 116, - 255, 253, 204, 12, 239, 52, 47, 35, 255, 107, 161, 243, 191, 148, 240, - 12, 239, 148, 89, 230, 254, 135, 229, 232, 26, 95, 56, 147, 31, 58, - 75, 156, 255, 133, 112, 58, 240, 157, 82, 52, 61, 105, 51, 197, 249, - 31, 202, 213, 173, 241, 105, 58, 28, 51, 197, 249, 31, 218, 36, 191, - 254, 167, 91, 227, 155, 153, 127, 255, 211, 173, 241, 205, 204, 191, 255, - 241, 241, 23, 125, 142, 198, 223, 137, 25, 222, 33, 17, 70, 254, 215, - 82, 231, 127, 142, 25, 25, 222, 142, 169, 230, 254, 135, 229, 232, 119, - 155, 193, 228, 251, 76, 245, 116, 222, 199, 203, 116, 190, 196, 194, 233, - 112, 76, 135, 247, 210, 244, 196, 76, 241, 116, 222, 199, 92, 7, 202, - 165, 245, 0, 154, 212, 197, 58, 197, 211, 121, 31, 15, 234, 193, 233, - 112, 76, 131, 122, 76, 215, 230, 50, 38, 123, 58, 239, 227, 101, 58, - 239, 131, 114, 105, 61, 128, 182, 104, 58, 66, 38, 231, 175, 61, 208, - 213, 131, 211, 129, 62, 130, 58, 149, 254, 208, 164, 252, 181, 7, 186, - 239, 49, 85, 223, 30, 88, 52, 29, 97, 147, 242, 215, 30, 16, 29, - 193, 154, 143, 242, 120, 115, 55, 174, 24, 234, 216, 99, 55, 154, 223, - 208, 173, 157, 76, 17, 43, 207, 42, 88, 30, 250, 153, 94, 222, 203, - 115, 40, 170, 60, 135, 205, 19, 121, 33, 188, 188, 111, 11, 58, 167, - 125, 80, 114, 79, 238, 247, 75, 123, 88, 207, 62, 115, 201, 103, 237, - 243, 154, 7, 209, 245, 39, 39, 113, 237, 243, 255, 231, 248, 92, 215, - 159, 156, 164, 175, 111, 244, 161, 79, 155, 229, 150, 103, 143, 171, 99, - 143, 62, 84, 42, 62, 175, 113, 163, 174, 63, 57, 145, 139, 231, 149, - 192, 15, 103, 26, 181, 167, 173, 244, 253, 73, 224, 13, 11, 243, 160, - 63, 57, 145, 235, 79, 126, 196, 249, 122, 77, 79, 219, 211, 130, 166, - 237, 16, 202, 165, 253, 73, 160, 81, 167, 130, 223, 87, 60, 109, 79, - 205, 117, 132, 113, 58, 210, 38, 64, 223, 71, 171, 139, 179, 186, 167, - 237, 169, 7, 245, 152, 192, 213, 3, 232, 48, 77, 71, 76, 53, 79, - 219, 211, 130, 166, 237, 105, 24, 167, 35, 13, 190, 31, 234, 84, 252, - 166, 170, 167, 237, 105, 33, 183, 237, 16, 150, 161, 245, 8, 227, 234, - 1, 116, 152, 166, 195, 85, 217, 211, 246, 180, 144, 219, 246, 20, 203, - 208, 122, 132, 229, 234, 223, 135, 105, 253, 171, 74, 158, 182, 167, 238, - 235, 129, 255, 79, 239, 246, 172, 153, 65, 239, 246, 196, 92, 110, 119, - 237, 21, 230, 114, 231, 110, 175, 154, 88, 2, 94, 58, 47, 77, 255, - 46, 234, 159, 95, 234, 32, 211, 185, 230, 180, 242, 75, 185, 50, 177, - 148, 30, 247, 236, 132, 41, 111, 116, 57, 11, 55, 31, 237, 75, 233, - 189, 95, 7, 202, 102, 188, 196, 6, 136, 161, 255, 235, 54, 64, 140, - 255, 95, 183, 1, 182, 65, 122, 27, 188, 28, 107, 85, 27, 232, 99, - 109, 19, 139, 175, 215, 203, 54, 112, 216, 152, 13, 84, 90, 181, 129, - 241, 90, 135, 106, 3, 118, 174, 1, 161, 85, 27, 24, 243, 170, 54, - 112, 216, 152, 13, 84, 90, 181, 129, 49, 47, 218, 32, 200, 75, 109, - 35, 235, 41, 45, 7, 188, 249, 217, 91, 118, 108, 243, 72, 61, 8, - 125, 37, 125, 144, 196, 158, 147, 179, 29, 94, 177, 116, 128, 31, 145, - 183, 115, 244, 82, 169, 219, 116, 210, 183, 96, 223, 114, 118, 210, 118, - 201, 246, 99, 222, 125, 11, 197, 126, 61, 246, 73, 115, 27, 47, 212, - 222, 55, 69, 58, 219, 104, 155, 66, 103, 31, 248, 87, 106, 114, 249, - 50, 173, 199, 90, 75, 31, 203, 102, 203, 251, 150, 68, 203, 40, 202, - 59, 184, 229, 3, 41, 115, 70, 97, 226, 131, 242, 230, 86, 215, 148, - 242, 203, 23, 22, 150, 51, 75, 239, 165, 188, 127, 90, 38, 89, 46, - 1, 95, 154, 37, 148, 157, 117, 240, 71, 41, 185, 204, 7, 229, 119, - 17, 251, 17, 186, 240, 91, 213, 184, 231, 216, 160, 54, 177, 148, 134, - 95, 13, 175, 38, 47, 217, 15, 219, 127, 98, 191, 110, 255, 221, 178, - 99, 123, 78, 236, 71, 232, 42, 155, 103, 72, 236, 57, 218, 175, 153, - 114, 110, 114, 111, 248, 145, 245, 138, 209, 167, 54, 74, 172, 47, 197, - 236, 247, 214, 170, 88, 201, 108, 173, 99, 109, 145, 157, 82, 135, 83, - 123, 146, 136, 253, 98, 254, 78, 80, 232, 70, 79, 92, 210, 181, 93, - 187, 232, 186, 193, 231, 150, 58, 96, 191, 58, 150, 61, 240, 35, 188, - 222, 33, 233, 82, 249, 213, 123, 216, 185, 161, 45, 39, 43, 107, 38, - 213, 27, 148, 147, 49, 118, 17, 222, 147, 150, 32, 229, 44, 149, 98, - 94, 237, 41, 239, 251, 203, 202, 203, 246, 97, 51, 127, 35, 246, 35, - 116, 147, 65, 213, 184, 231, 22, 75, 41, 206, 126, 132, 151, 216, 15, - 99, 27, 177, 95, 107, 176, 31, 198, 42, 98, 63, 66, 35, 142, 216, - 115, 180, 95, 45, 176, 95, 19, 240, 191, 38, 58, 28, 157, 250, 143, - 244, 29, 153, 253, 138, 78, 217, 14, 207, 243, 238, 59, 34, 111, 214, - 130, 125, 210, 180, 232, 162, 219, 136, 253, 138, 252, 108, 85, 232, 226, - 25, 255, 74, 85, 82, 67, 183, 49, 255, 107, 2, 246, 107, 2, 254, - 199, 120, 31, 151, 120, 32, 253, 178, 126, 30, 41, 35, 143, 174, 56, - 120, 155, 58, 127, 95, 88, 254, 98, 191, 109, 27, 243, 191, 38, 96, - 191, 38, 150, 251, 186, 181, 142, 82, 242, 200, 42, 206, 70, 196, 126, - 132, 238, 1, 246, 99, 207, 221, 251, 31, 157, 63, 168, 196, 250, 187, - 113, 229, 161, 239, 51, 209, 168, 191, 219, 90, 63, 127, 80, 17, 198, - 133, 21, 60, 152, 63, 168, 200, 245, 75, 42, 114, 243, 7, 21, 196, - 205, 95, 89, 56, 29, 248, 78, 14, 77, 79, 140, 175, 184, 249, 43, - 148, 171, 27, 175, 106, 58, 172, 190, 226, 230, 175, 208, 38, 34, 231, - 79, 177, 254, 34, 231, 79, 173, 190, 98, 231, 79, 209, 231, 232, 61, - 28, 189, 192, 142, 149, 140, 252, 239, 53, 157, 255, 89, 129, 215, 90, - 206, 220, 255, 176, 28, 221, 35, 87, 142, 201, 119, 150, 21, 231, 127, - 40, 151, 238, 245, 3, 26, 117, 42, 115, 50, 101, 197, 249, 159, 181, - 156, 222, 255, 72, 93, 92, 62, 226, 252, 15, 109, 34, 114, 254, 52, - 164, 172, 216, 249, 83, 172, 171, 200, 249, 83, 244, 57, 186, 126, 212, - 61, 195, 59, 174, 188, 129, 255, 53, 181, 234, 252, 207, 15, 120, 253, - 122, 154, 251, 31, 150, 163, 251, 180, 122, 114, 235, 71, 61, 196, 249, - 31, 202, 165, 251, 180, 128, 70, 157, 74, 255, 179, 135, 56, 255, 243, - 235, 153, 107, 159, 150, 86, 151, 148, 238, 2, 215, 143, 122, 8, 94, - 63, 234, 33, 120, 253, 168, 187, 224, 245, 163, 238, 220, 124, 83, 151, - 12, 239, 152, 94, 70, 254, 167, 223, 183, 153, 210, 45, 195, 59, 165, - 171, 7, 235, 71, 221, 184, 245, 163, 110, 220, 250, 81, 87, 129, 235, - 71, 156, 14, 124, 167, 20, 77, 79, 90, 23, 129, 235, 71, 93, 115, - 173, 31, 105, 58, 28, 93, 4, 174, 31, 117, 21, 188, 126, 212, 69, - 240, 250, 81, 23, 193, 235, 71, 93, 184, 254, 95, 167, 12, 239, 144, - 238, 70, 254, 167, 223, 191, 225, 120, 3, 250, 89, 175, 123, 208, 255, - 123, 131, 251, 110, 111, 112, 253, 191, 215, 5, 246, 255, 56, 29, 248, - 78, 14, 77, 79, 76, 103, 129, 253, 191, 215, 115, 245, 255, 52, 29, - 214, 206, 2, 251, 127, 175, 11, 238, 255, 117, 22, 220, 255, 235, 44, - 184, 255, 215, 137, 249, 159, 143, 12, 118, 236, 226, 198, 255, 180, 60, - 143, 49, 195, 134, 235, 251, 127, 192, 27, 215, 33, 195, 52, 63, 10, - 203, 209, 254, 95, 71, 38, 63, 90, 206, 107, 14, 217, 98, 119, 55, - 223, 158, 251, 187, 61, 250, 47, 188, 29, 237, 255, 117, 228, 250, 127, - 64, 163, 78, 165, 208, 120, 79, 116, 84, 203, 83, 199, 245, 153, 237, - 232, 189, 130, 86, 78, 7, 214, 155, 212, 197, 53, 214, 19, 29, 213, - 243, 212, 177, 180, 109, 203, 36, 90, 143, 14, 122, 31, 183, 106, 58, - 156, 99, 140, 116, 188, 60, 223, 254, 82, 206, 74, 163, 153, 54, 50, - 111, 134, 118, 39, 243, 102, 184, 215, 15, 237, 72, 228, 17, 186, 247, - 154, 185, 18, 123, 238, 190, 13, 59, 255, 115, 41, 249, 68, 90, 61, - 186, 71, 147, 148, 47, 153, 241, 142, 124, 96, 238, 2, 67, 222, 71, - 37, 198, 202, 55, 27, 111, 213, 202, 204, 146, 165, 38, 123, 181, 243, - 164, 163, 228, 148, 185, 39, 12, 121, 115, 10, 44, 144, 255, 110, 120, - 169, 29, 217, 55, 71, 232, 176, 27, 203, 184, 231, 121, 183, 227, 105, - 154, 95, 240, 54, 192, 239, 76, 108, 64, 104, 220, 235, 204, 158, 187, - 151, 247, 15, 216, 32, 34, 120, 96, 34, 177, 1, 41, 95, 28, 108, - 208, 112, 112, 75, 67, 222, 199, 96, 131, 118, 195, 171, 38, 18, 27, - 52, 218, 171, 238, 89, 69, 27, 220, 123, 254, 36, 193, 204, 6, 187, - 238, 157, 76, 32, 54, 32, 52, 218, 128, 61, 55, 182, 1, 250, 45, - 111, 3, 244, 67, 98, 3, 66, 15, 7, 27, 176, 231, 238, 229, 149, - 140, 47, 37, 23, 252, 37, 50, 137, 216, 128, 148, 111, 4, 54, 24, - 56, 181, 118, 146, 153, 31, 148, 143, 59, 64, 109, 208, 239, 143, 48, - 133, 246, 2, 27, 116, 221, 85, 44, 209, 204, 6, 129, 99, 98, 218, - 18, 27, 16, 122, 2, 216, 128, 61, 55, 182, 1, 226, 138, 183, 1, - 226, 132, 216, 128, 208, 232, 7, 236, 121, 222, 126, 112, 183, 208, 116, - 186, 231, 157, 148, 71, 63, 24, 18, 111, 204, 139, 54, 72, 220, 65, - 206, 63, 157, 37, 251, 201, 234, 121, 166, 232, 7, 191, 126, 19, 97, - 51, 179, 65, 249, 247, 72, 153, 37, 148, 70, 63, 96, 207, 141, 251, - 32, 216, 238, 211, 179, 229, 70, 66, 187, 214, 201, 48, 6, 40, 249, - 75, 116, 15, 37, 216, 207, 249, 161, 121, 12, 192, 114, 116, 127, 231, - 104, 110, 15, 233, 135, 158, 198, 0, 247, 177, 27, 241, 78, 247, 119, - 142, 230, 246, 169, 2, 109, 215, 218, 76, 215, 40, 79, 99, 128, 123, - 29, 136, 39, 90, 15, 78, 7, 214, 155, 212, 37, 108, 148, 167, 49, - 192, 189, 14, 244, 87, 90, 143, 15, 115, 237, 83, 37, 246, 26, 229, - 105, 12, 112, 175, 3, 253, 129, 206, 11, 124, 168, 223, 7, 202, 218, - 77, 135, 141, 208, 219, 236, 9, 118, 163, 246, 84, 183, 175, 96, 148, - 94, 30, 107, 131, 28, 54, 66, 163, 60, 163, 182, 73, 183, 175, 32, - 151, 60, 134, 103, 135, 141, 208, 241, 32, 207, 8, 231, 186, 51, 132, - 114, 201, 99, 216, 112, 216, 8, 141, 239, 103, 132, 25, 190, 223, 132, - 56, 161, 249, 126, 67, 129, 150, 205, 48, 195, 242, 202, 45, 192, 235, - 24, 110, 142, 25, 44, 71, 251, 212, 35, 184, 126, 251, 112, 113, 152, - 65, 185, 212, 215, 80, 199, 72, 173, 223, 62, 76, 28, 102, 44, 156, - 14, 172, 55, 169, 139, 117, 152, 56, 204, 160, 92, 221, 216, 64, 211, - 225, 28, 42, 14, 51, 104, 119, 62, 103, 212, 29, 102, 48, 103, 212, - 83, 204, 160, 141, 121, 121, 238, 48, 131, 242, 60, 197, 140, 53, 151, - 60, 119, 152, 241, 3, 121, 158, 98, 6, 109, 199, 203, 115, 135, 25, - 124, 63, 79, 49, 163, 224, 132, 200, 27, 4, 126, 48, 210, 12, 51, - 44, 175, 220, 57, 4, 218, 243, 193, 230, 152, 193, 114, 52, 6, 12, - 97, 242, 173, 54, 79, 49, 83, 192, 20, 51, 118, 78, 135, 19, 222, - 201, 169, 233, 177, 183, 247, 20, 51, 5, 76, 49, 131, 114, 105, 61, - 128, 38, 117, 9, 105, 231, 41, 102, 10, 152, 98, 198, 62, 88, 143, - 25, 212, 169, 140, 111, 131, 61, 197, 76, 1, 67, 204, 108, 215, 236, - 94, 79, 27, 215, 123, 239, 124, 152, 228, 14, 51, 23, 198, 150, 183, - 155, 245, 219, 135, 223, 13, 179, 63, 255, 120, 151, 86, 38, 198, 126, - 114, 82, 178, 66, 191, 82, 37, 222, 126, 60, 102, 191, 33, 222, 74, - 252, 118, 132, 147, 239, 162, 116, 226, 215, 143, 237, 158, 140, 23, 182, - 107, 223, 150, 212, 227, 246, 175, 15, 147, 220, 97, 245, 44, 212, 195, - 172, 239, 61, 0, 234, 145, 232, 53, 108, 55, 169, 199, 187, 221, 50, - 21, 186, 57, 212, 195, 254, 69, 101, 67, 156, 151, 130, 122, 48, 249, - 46, 74, 239, 134, 122, 120, 210, 231, 223, 174, 249, 15, 169, 199, 181, - 239, 31, 38, 185, 107, 35, 26, 140, 46, 111, 55, 235, 63, 23, 114, - 133, 217, 167, 142, 105, 145, 68, 234, 113, 227, 245, 242, 10, 221, 160, - 81, 188, 253, 104, 169, 130, 73, 70, 245, 168, 182, 251, 8, 39, 223, - 69, 233, 123, 171, 31, 219, 61, 233, 183, 111, 215, 124, 148, 212, 163, - 30, 248, 149, 187, 182, 233, 10, 124, 15, 179, 62, 176, 3, 190, 71, - 47, 218, 63, 143, 177, 127, 25, 164, 222, 85, 240, 168, 114, 188, 253, - 243, 161, 179, 12, 219, 181, 34, 240, 61, 152, 124, 23, 165, 157, 240, - 61, 60, 237, 123, 99, 59, 72, 239, 232, 107, 13, 56, 31, 106, 214, - 38, 178, 251, 3, 92, 109, 51, 188, 67, 219, 152, 183, 137, 88, 142, - 222, 159, 215, 150, 201, 79, 123, 45, 127, 253, 8, 126, 254, 37, 148, - 211, 225, 130, 119, 114, 105, 122, 28, 175, 229, 175, 31, 193, 207, 191, - 160, 92, 90, 15, 160, 73, 93, 124, 94, 203, 95, 63, 130, 159, 127, - 9, 109, 163, 111, 19, 81, 167, 226, 25, 173, 243, 215, 143, 32, 243, - 47, 193, 154, 221, 73, 92, 109, 24, 90, 196, 249, 124, 80, 151, 151, - 230, 95, 124, 156, 39, 108, 217, 173, 230, 122, 212, 143, 112, 112, 242, - 156, 32, 111, 70, 252, 240, 151, 230, 50, 162, 147, 79, 216, 54, 182, - 203, 123, 62, 66, 119, 222, 13, 39, 47, 109, 36, 200, 43, 212, 250, - 165, 121, 1, 215, 129, 19, 182, 189, 155, 91, 36, 121, 212, 207, 105, - 205, 228, 69, 195, 251, 245, 253, 112, 198, 75, 99, 236, 80, 168, 111, - 145, 55, 103, 122, 212, 143, 64, 156, 16, 204, 184, 154, 66, 252, 29, - 100, 134, 25, 118, 127, 64, 204, 171, 25, 222, 126, 173, 204, 49, 131, - 229, 232, 122, 222, 171, 220, 154, 77, 51, 79, 49, 83, 198, 173, 31, - 164, 93, 14, 161, 119, 78, 250, 113, 58, 98, 224, 157, 98, 52, 61, - 161, 239, 121, 138, 25, 247, 58, 124, 127, 237, 65, 117, 160, 92, 90, - 15, 160, 73, 93, 98, 6, 120, 138, 25, 247, 58, 70, 149, 60, 78, - 251, 17, 126, 173, 114, 173, 75, 182, 210, 198, 221, 253, 60, 197, 140, - 123, 29, 155, 158, 171, 231, 211, 204, 45, 160, 218, 189, 158, 82, 82, - 221, 235, 135, 118, 36, 242, 8, 253, 70, 220, 28, 59, 123, 238, 190, - 221, 189, 218, 235, 153, 253, 76, 219, 42, 244, 126, 176, 95, 255, 236, - 164, 148, 31, 144, 58, 72, 242, 122, 220, 212, 240, 220, 193, 167, 229, - 151, 74, 12, 171, 177, 116, 126, 212, 235, 217, 102, 201, 8, 171, 22, - 229, 110, 202, 109, 82, 141, 113, 81, 90, 153, 157, 82, 249, 209, 31, - 43, 52, 222, 107, 89, 98, 228, 66, 147, 249, 206, 125, 210, 130, 107, - 203, 232, 221, 123, 155, 162, 190, 162, 247, 90, 30, 173, 185, 206, 144, - 215, 82, 240, 148, 84, 233, 242, 70, 122, 247, 222, 231, 235, 227, 212, - 121, 214, 136, 179, 210, 25, 239, 29, 198, 122, 35, 47, 72, 181, 247, - 36, 208, 187, 247, 90, 212, 85, 251, 92, 94, 17, 151, 37, 121, 193, - 1, 67, 94, 175, 168, 107, 82, 86, 193, 67, 244, 94, 203, 26, 29, - 143, 169, 115, 195, 17, 183, 165, 129, 115, 78, 26, 242, 214, 138, 186, - 43, 69, 251, 166, 210, 123, 45, 251, 79, 191, 161, 208, 221, 34, 210, - 165, 93, 174, 71, 134, 188, 225, 81, 153, 210, 202, 187, 69, 181, 125, - 111, 89, 82, 237, 113, 85, 21, 122, 72, 68, 182, 116, 58, 35, 176, - 189, 17, 239, 127, 142, 28, 105, 228, 67, 122, 199, 183, 236, 172, 212, - 95, 161, 71, 219, 188, 228, 167, 109, 7, 24, 242, 166, 58, 189, 229, - 22, 161, 77, 181, 50, 5, 101, 231, 136, 90, 10, 189, 54, 188, 176, - 188, 123, 182, 151, 33, 239, 209, 200, 98, 242, 107, 235, 137, 77, 74, - 202, 242, 37, 245, 27, 61, 108, 95, 74, 254, 219, 59, 198, 120, 30, - 221, 89, 90, 110, 255, 234, 231, 90, 25, 31, 57, 120, 139, 234, 75, - 57, 237, 203, 202, 11, 235, 204, 49, 228, 125, 225, 44, 39, 179, 57, - 126, 95, 74, 159, 159, 94, 65, 54, 155, 251, 167, 184, 124, 79, 143, - 75, 108, 123, 8, 46, 9, 253, 58, 224, 146, 61, 119, 47, 239, 18, - 224, 178, 204, 124, 255, 96, 130, 75, 239, 61, 146, 82, 190, 27, 222, - 45, 214, 171, 172, 97, 223, 246, 38, 224, 146, 197, 188, 88, 58, 103, - 95, 5, 112, 105, 20, 243, 144, 183, 72, 193, 109, 82, 114, 15, 47, - 122, 111, 95, 145, 183, 127, 81, 116, 21, 3, 92, 190, 26, 216, 207, - 80, 239, 35, 192, 101, 220, 165, 154, 109, 8, 46, 79, 76, 246, 83, - 222, 255, 217, 211, 163, 82, 250, 228, 213, 134, 109, 73, 118, 129, 83, - 210, 43, 247, 110, 4, 19, 92, 222, 93, 86, 158, 222, 55, 219, 101, - 112, 29, 67, 219, 63, 5, 92, 246, 216, 100, 167, 184, 60, 18, 244, - 154, 66, 215, 6, 92, 62, 216, 218, 212, 144, 183, 24, 224, 242, 183, - 20, 111, 138, 203, 35, 255, 170, 247, 190, 122, 1, 46, 253, 170, 125, - 108, 248, 206, 87, 34, 239, 74, 251, 31, 173, 108, 75, 112, 249, 247, - 187, 23, 148, 61, 162, 15, 194, 211, 165, 253, 43, 182, 237, 54, 110, - 75, 50, 165, 216, 175, 246, 237, 38, 184, 188, 115, 168, 104, 130, 218, - 14, 101, 75, 243, 247, 55, 49, 180, 243, 139, 200, 28, 233, 210, 221, - 209, 164, 140, 188, 114, 203, 167, 10, 237, 5, 184, 180, 13, 253, 222, - 144, 23, 239, 196, 108, 244, 233, 254, 4, 130, 203, 255, 126, 79, 85, - 233, 136, 194, 242, 170, 181, 22, 67, 223, 192, 187, 197, 46, 220, 47, - 71, 239, 237, 107, 240, 101, 109, 149, 182, 149, 146, 223, 24, 19, 96, - 204, 11, 184, 44, 115, 187, 69, 34, 193, 229, 46, 223, 215, 52, 222, - 178, 242, 32, 155, 241, 154, 18, 226, 146, 173, 59, 249, 82, 26, 113, - 105, 182, 30, 69, 112, 137, 241, 157, 224, 114, 1, 224, 18, 227, 53, - 193, 37, 161, 151, 3, 46, 217, 115, 247, 242, 222, 234, 253, 204, 238, - 119, 147, 248, 163, 85, 10, 12, 216, 167, 148, 47, 112, 118, 144, 20, - 212, 245, 186, 161, 237, 47, 151, 3, 92, 210, 190, 99, 44, 93, 71, - 250, 0, 112, 105, 212, 119, 84, 244, 226, 157, 127, 125, 171, 37, 17, - 92, 118, 169, 85, 72, 161, 223, 6, 92, 158, 251, 251, 130, 161, 13, - 110, 2, 46, 219, 95, 251, 60, 145, 224, 114, 76, 117, 155, 66, 223, - 4, 92, 70, 92, 141, 51, 124, 231, 58, 16, 47, 119, 15, 113, 180, - 37, 184, 252, 115, 172, 122, 159, 116, 81, 192, 101, 211, 210, 141, 12, - 177, 181, 14, 112, 185, 224, 239, 69, 20, 151, 39, 187, 170, 49, 62, - 21, 112, 89, 38, 209, 97, 200, 123, 41, 242, 154, 116, 125, 241, 3, - 122, 87, 109, 131, 170, 125, 20, 122, 95, 248, 109, 105, 195, 227, 25, - 134, 216, 186, 7, 184, 140, 158, 251, 52, 129, 224, 50, 112, 205, 79, - 10, 61, 221, 145, 46, 85, 59, 211, 217, 176, 190, 71, 33, 94, 150, - 95, 84, 149, 222, 167, 233, 31, 171, 246, 51, 240, 174, 218, 87, 170, - 159, 53, 238, 91, 204, 206, 145, 46, 23, 10, 162, 241, 178, 92, 231, - 38, 10, 157, 6, 184, 60, 60, 183, 153, 97, 204, 171, 152, 236, 45, - 91, 143, 61, 110, 71, 112, 57, 229, 59, 181, 159, 177, 15, 226, 165, - 99, 115, 73, 67, 189, 159, 2, 46, 165, 14, 165, 41, 46, 67, 135, - 111, 81, 232, 61, 16, 47, 27, 76, 118, 25, 250, 198, 74, 192, 101, - 249, 138, 165, 147, 8, 46, 123, 156, 175, 174, 208, 201, 16, 47, 247, - 125, 21, 104, 232, 147, 143, 1, 151, 108, 45, 212, 151, 210, 151, 0, - 151, 102, 107, 164, 4, 151, 216, 39, 230, 227, 37, 246, 113, 9, 46, - 9, 141, 57, 43, 236, 185, 123, 121, 7, 32, 94, 214, 155, 193, 114, - 86, 142, 105, 229, 235, 67, 188, 12, 41, 102, 204, 123, 15, 226, 37, - 27, 131, 197, 210, 181, 205, 194, 128, 75, 163, 49, 152, 218, 23, 221, - 6, 254, 50, 139, 222, 197, 249, 119, 11, 237, 174, 70, 192, 229, 234, - 127, 195, 13, 121, 159, 2, 46, 183, 239, 140, 160, 119, 113, 70, 100, - 147, 117, 206, 163, 210, 27, 193, 179, 77, 244, 158, 146, 170, 84, 158, - 77, 239, 226, 140, 216, 31, 161, 221, 17, 121, 86, 138, 251, 202, 120, - 174, 229, 57, 224, 242, 65, 25, 58, 79, 35, 253, 81, 156, 240, 94, - 150, 214, 21, 50, 227, 189, 38, 221, 93, 16, 65, 239, 226, 124, 255, - 107, 194, 123, 91, 58, 22, 103, 204, 251, 2, 112, 217, 122, 69, 4, - 189, 139, 243, 122, 119, 149, 46, 2, 253, 216, 229, 5, 140, 121, 125, - 1, 151, 7, 78, 176, 187, 56, 87, 13, 81, 109, 254, 10, 196, 203, - 222, 143, 103, 24, 242, 158, 130, 120, 153, 29, 57, 133, 222, 197, 217, - 112, 176, 74, 151, 5, 92, 246, 151, 167, 24, 242, 62, 132, 120, 185, - 113, 248, 12, 122, 23, 103, 167, 213, 170, 63, 60, 0, 92, 190, 83, - 208, 248, 157, 159, 2, 46, 203, 116, 101, 119, 113, 254, 123, 91, 243, - 13, 136, 151, 157, 119, 27, 251, 6, 198, 203, 82, 95, 18, 191, 242, - 145, 71, 214, 32, 247, 135, 150, 149, 247, 127, 103, 236, 147, 24, 47, - 217, 250, 188, 47, 165, 49, 94, 154, 173, 219, 147, 57, 5, 156, 71, - 160, 243, 112, 189, 97, 156, 220, 218, 108, 78, 129, 221, 21, 21, 10, - 188, 161, 125, 205, 231, 20, 176, 28, 157, 191, 226, 198, 198, 105, 125, - 196, 173, 231, 161, 92, 58, 15, 7, 239, 132, 58, 21, 105, 125, 196, - 173, 231, 161, 92, 90, 15, 212, 161, 213, 197, 167, 143, 184, 245, 188, - 208, 190, 185, 230, 225, 250, 106, 243, 22, 189, 197, 173, 231, 161, 221, - 69, 174, 231, 57, 250, 136, 93, 207, 243, 233, 35, 118, 61, 15, 109, - 39, 114, 61, 15, 113, 66, 231, 225, 2, 51, 188, 93, 77, 205, 48, - 195, 238, 138, 138, 105, 2, 24, 107, 236, 193, 60, 92, 19, 110, 254, - 170, 9, 183, 119, 191, 145, 56, 204, 248, 113, 58, 98, 224, 157, 98, - 52, 61, 246, 70, 226, 48, 131, 114, 105, 61, 128, 38, 117, 73, 9, - 18, 135, 25, 191, 198, 185, 230, 225, 26, 107, 243, 137, 65, 226, 48, - 131, 118, 207, 47, 102, 44, 252, 125, 104, 141, 242, 143, 25, 94, 30, - 218, 51, 191, 152, 225, 229, 133, 6, 229, 31, 51, 186, 56, 19, 200, - 229, 91, 53, 0, 63, 232, 109, 134, 25, 118, 87, 84, 40, 98, 204, - 223, 131, 56, 19, 200, 197, 128, 0, 38, 63, 204, 95, 28, 102, 80, - 46, 141, 1, 64, 163, 78, 165, 144, 191, 56, 204, 132, 114, 58, 176, - 222, 164, 46, 209, 13, 197, 97, 6, 229, 242, 152, 9, 213, 116, 248, - 53, 20, 135, 25, 180, 187, 200, 56, 99, 241, 23, 27, 103, 208, 158, - 34, 227, 140, 95, 67, 177, 113, 6, 113, 66, 48, 19, 90, 7, 252, - 32, 208, 4, 51, 77, 217, 93, 81, 126, 192, 27, 83, 207, 28, 51, - 88, 142, 198, 128, 250, 220, 190, 145, 122, 226, 48, 131, 114, 105, 12, - 0, 26, 117, 42, 235, 197, 117, 197, 97, 198, 143, 211, 129, 245, 38, - 117, 9, 169, 43, 14, 51, 40, 151, 199, 140, 159, 166, 195, 85, 71, - 28, 102, 208, 238, 34, 227, 12, 218, 88, 100, 156, 9, 169, 43, 54, - 206, 160, 237, 68, 198, 25, 196, 9, 221, 107, 245, 28, 252, 160, 129, - 25, 102, 216, 158, 94, 87, 109, 104, 207, 107, 121, 176, 175, 160, 54, - 23, 3, 106, 115, 227, 25, 63, 129, 227, 25, 78, 135, 11, 222, 201, - 165, 233, 113, 248, 9, 28, 207, 212, 226, 234, 1, 52, 169, 75, 220, - 11, 129, 227, 153, 90, 185, 198, 51, 181, 180, 62, 230, 11, 129, 227, - 25, 63, 193, 227, 25, 63, 177, 113, 6, 237, 41, 50, 206, 216, 95, - 136, 141, 51, 136, 19, 138, 153, 199, 224, 7, 117, 242, 198, 204, 71, - 163, 70, 88, 38, 113, 223, 195, 14, 188, 206, 103, 238, 48, 163, 191, - 247, 6, 203, 209, 189, 131, 57, 76, 126, 204, 211, 188, 207, 211, 146, - 239, 183, 76, 250, 240, 120, 169, 96, 163, 92, 168, 155, 73, 195, 233, - 62, 25, 148, 75, 247, 14, 2, 141, 58, 21, 105, 217, 121, 235, 72, - 191, 87, 60, 97, 210, 238, 38, 134, 185, 80, 43, 39, 5, 177, 61, - 144, 156, 14, 172, 55, 169, 75, 232, 147, 188, 117, 188, 83, 229, 213, - 164, 184, 244, 118, 237, 141, 114, 161, 106, 206, 108, 65, 247, 226, 160, - 92, 221, 62, 120, 77, 135, 61, 43, 111, 29, 65, 83, 166, 218, 250, - 79, 118, 24, 230, 66, 53, 121, 155, 229, 66, 161, 221, 249, 252, 15, - 180, 35, 145, 71, 104, 204, 133, 98, 207, 45, 150, 101, 150, 122, 150, - 141, 150, 186, 150, 31, 225, 71, 218, 221, 115, 63, 151, 146, 253, 251, - 251, 210, 60, 32, 82, 30, 115, 161, 110, 204, 155, 97, 56, 39, 141, - 249, 31, 242, 154, 111, 104, 14, 140, 79, 191, 120, 154, 7, 244, 229, - 241, 36, 211, 28, 152, 11, 93, 78, 104, 101, 150, 80, 26, 243, 63, - 216, 243, 188, 99, 79, 154, 230, 23, 188, 13, 240, 59, 19, 27, 16, - 26, 115, 96, 216, 115, 180, 65, 32, 216, 32, 8, 108, 16, 164, 203, - 129, 201, 118, 244, 166, 249, 96, 164, 60, 230, 192, 188, 21, 93, 199, - 52, 31, 236, 207, 243, 133, 104, 62, 216, 167, 125, 175, 5, 19, 27, - 248, 239, 58, 18, 108, 102, 131, 202, 59, 214, 5, 19, 27, 16, 26, - 109, 192, 158, 27, 219, 0, 253, 150, 183, 1, 250, 33, 177, 1, 161, - 49, 23, 138, 61, 71, 27, 84, 7, 27, 84, 7, 27, 84, 215, 229, - 66, 221, 27, 205, 114, 161, 72, 121, 204, 133, 234, 181, 185, 150, 105, - 46, 212, 238, 227, 251, 168, 31, 236, 217, 61, 134, 230, 66, 29, 154, - 81, 200, 212, 15, 214, 7, 236, 167, 185, 80, 132, 198, 92, 40, 246, - 220, 216, 6, 136, 43, 222, 6, 136, 19, 98, 3, 66, 163, 31, 176, - 231, 104, 131, 241, 96, 131, 241, 96, 131, 241, 58, 63, 8, 175, 199, - 114, 161, 72, 121, 244, 131, 105, 46, 243, 92, 168, 149, 119, 89, 46, - 84, 151, 217, 44, 23, 106, 180, 203, 60, 23, 106, 220, 58, 150, 11, - 69, 104, 244, 3, 246, 220, 100, 63, 230, 99, 46, 23, 234, 33, 180, - 107, 207, 13, 99, 128, 62, 23, 10, 120, 157, 153, 30, 196, 128, 199, - 92, 219, 249, 136, 203, 133, 202, 244, 52, 6, 184, 239, 11, 32, 222, - 105, 219, 249, 136, 139, 1, 64, 163, 78, 165, 223, 145, 225, 105, 12, - 112, 175, 3, 241, 68, 235, 193, 233, 192, 122, 147, 186, 132, 101, 120, - 26, 3, 220, 235, 64, 127, 165, 245, 200, 204, 21, 3, 136, 189, 50, - 60, 141, 1, 238, 117, 160, 63, 208, 190, 124, 166, 62, 55, 136, 181, - 155, 14, 27, 161, 49, 215, 200, 168, 61, 213, 229, 66, 101, 232, 229, - 177, 54, 200, 97, 35, 52, 230, 26, 25, 181, 77, 186, 92, 168, 92, - 242, 24, 158, 29, 54, 66, 227, 251, 25, 225, 92, 55, 127, 144, 75, - 30, 195, 134, 195, 70, 104, 124, 63, 35, 204, 232, 114, 161, 30, 114, - 243, 192, 119, 192, 15, 30, 155, 97, 134, 203, 133, 2, 94, 191, 251, - 230, 152, 193, 114, 52, 135, 40, 157, 155, 7, 190, 39, 14, 51, 40, - 151, 142, 157, 225, 157, 80, 167, 226, 115, 247, 196, 97, 6, 229, 210, - 57, 0, 160, 73, 93, 82, 238, 138, 195, 140, 223, 253, 92, 243, 192, - 247, 181, 190, 217, 93, 113, 152, 65, 187, 243, 125, 111, 119, 152, 193, - 190, 183, 167, 152, 177, 231, 146, 231, 14, 51, 40, 207, 83, 204, 160, - 61, 121, 121, 238, 48, 131, 99, 13, 79, 49, 19, 154, 75, 158, 59, - 204, 224, 251, 121, 138, 25, 196, 9, 157, 7, 190, 9, 126, 240, 208, - 12, 51, 44, 23, 42, 20, 120, 93, 183, 205, 49, 131, 229, 232, 216, - 249, 63, 110, 30, 248, 182, 56, 204, 160, 92, 58, 118, 6, 26, 117, - 42, 133, 110, 139, 195, 76, 40, 167, 3, 235, 77, 234, 18, 125, 75, - 28, 102, 80, 174, 110, 30, 88, 211, 225, 119, 75, 28, 102, 208, 238, - 249, 197, 12, 63, 103, 100, 185, 157, 127, 204, 240, 242, 208, 158, 249, - 197, 12, 47, 207, 239, 86, 254, 49, 195, 247, 205, 16, 39, 116, 30, - 248, 42, 248, 193, 29, 51, 204, 176, 92, 25, 63, 224, 141, 185, 110, - 142, 25, 44, 71, 99, 192, 13, 110, 30, 248, 122, 254, 48, 195, 143, - 207, 81, 46, 141, 1, 64, 163, 78, 101, 30, 248, 90, 254, 48, 195, - 143, 207, 253, 56, 29, 88, 111, 82, 151, 144, 107, 249, 195, 12, 63, - 62, 71, 185, 186, 121, 96, 77, 135, 235, 106, 254, 48, 67, 198, 231, - 193, 154, 221, 137, 15, 133, 132, 22, 113, 230, 92, 144, 95, 26, 159, - 251, 57, 79, 216, 174, 254, 55, 54, 207, 241, 185, 46, 167, 245, 154, - 62, 87, 198, 59, 180, 206, 203, 99, 93, 144, 23, 213, 169, 113, 158, - 99, 93, 221, 249, 252, 156, 188, 155, 35, 139, 56, 135, 128, 13, 115, - 143, 27, 157, 7, 78, 216, 74, 103, 54, 207, 115, 220, 168, 235, 59, - 94, 213, 231, 202, 216, 54, 204, 120, 121, 12, 6, 239, 247, 100, 86, - 222, 99, 48, 62, 206, 32, 78, 104, 223, 236, 18, 248, 193, 77, 51, - 204, 176, 92, 25, 215, 21, 104, 207, 47, 155, 99, 6, 203, 209, 24, - 112, 133, 203, 149, 57, 239, 41, 102, 220, 231, 127, 212, 157, 220, 155, - 222, 77, 30, 202, 233, 112, 193, 59, 185, 52, 61, 49, 169, 158, 98, - 198, 189, 142, 192, 14, 61, 169, 14, 148, 75, 235, 1, 52, 169, 139, - 235, 180, 167, 152, 113, 175, 99, 221, 26, 150, 43, 19, 122, 57, 215, - 60, 240, 101, 173, 111, 118, 212, 83, 204, 184, 215, 17, 203, 231, 202, - 156, 103, 123, 12, 151, 250, 7, 57, 209, 142, 68, 30, 161, 59, 199, - 205, 177, 179, 231, 228, 76, 232, 134, 150, 182, 240, 35, 237, 174, 171, - 215, 51, 251, 124, 248, 70, 100, 143, 225, 125, 123, 15, 165, 124, 175, - 212, 65, 210, 168, 169, 13, 232, 156, 111, 95, 139, 191, 101, 4, 240, - 205, 228, 120, 31, 149, 95, 42, 49, 172, 198, 210, 249, 51, 239, 103, - 155, 37, 35, 172, 146, 61, 134, 78, 199, 96, 186, 39, 255, 203, 240, - 97, 10, 141, 185, 50, 97, 51, 70, 82, 222, 56, 224, 221, 14, 124, - 59, 57, 222, 231, 5, 246, 73, 31, 72, 147, 233, 222, 223, 119, 142, - 206, 86, 104, 204, 149, 217, 18, 56, 143, 242, 38, 2, 79, 50, 252, - 14, 232, 120, 79, 73, 31, 255, 180, 56, 145, 236, 49, 44, 49, 97, - 89, 34, 217, 99, 120, 252, 207, 21, 148, 247, 48, 240, 28, 183, 212, - 177, 164, 192, 143, 223, 99, 88, 117, 216, 218, 68, 178, 199, 240, 114, - 179, 53, 10, 93, 44, 226, 178, 244, 173, 229, 43, 202, 123, 18, 120, - 78, 195, 47, 149, 227, 125, 18, 121, 77, 250, 126, 242, 162, 68, 178, - 199, 112, 198, 115, 245, 142, 202, 130, 17, 183, 165, 55, 231, 71, 25, - 246, 5, 106, 68, 221, 149, 134, 7, 76, 79, 36, 123, 12, 23, 182, - 90, 160, 208, 99, 34, 210, 165, 152, 179, 95, 80, 222, 11, 240, 206, - 151, 224, 119, 133, 211, 27, 29, 149, 41, 101, 13, 254, 37, 145, 236, - 49, 188, 90, 251, 188, 66, 143, 138, 200, 150, 126, 207, 178, 208, 246, - 234, 154, 165, 182, 229, 134, 165, 150, 229, 150, 165, 38, 229, 221, 235, - 200, 145, 18, 151, 208, 253, 178, 242, 76, 167, 85, 161, 107, 219, 188, - 228, 38, 105, 108, 47, 236, 29, 104, 227, 238, 193, 47, 141, 155, 35, - 75, 119, 122, 203, 151, 127, 171, 146, 68, 246, 24, 30, 252, 182, 148, - 66, 159, 11, 47, 44, 23, 204, 184, 77, 223, 57, 221, 82, 195, 146, - 1, 58, 179, 44, 126, 148, 247, 66, 100, 49, 57, 61, 115, 23, 221, - 251, 219, 214, 246, 181, 118, 183, 103, 41, 185, 217, 176, 37, 148, 55, - 7, 222, 217, 203, 171, 142, 165, 144, 23, 251, 190, 89, 206, 210, 114, - 221, 148, 40, 186, 39, 255, 213, 10, 170, 221, 158, 183, 47, 43, 47, - 94, 56, 198, 116, 79, 62, 155, 3, 246, 165, 52, 238, 49, 228, 231, - 134, 139, 131, 190, 210, 240, 43, 199, 233, 165, 123, 242, 83, 25, 46, - 63, 3, 92, 98, 219, 67, 215, 63, 52, 186, 35, 224, 146, 61, 119, - 143, 203, 51, 128, 203, 18, 247, 139, 211, 28, 182, 176, 58, 93, 149, - 242, 109, 1, 151, 143, 222, 188, 210, 150, 225, 178, 161, 134, 75, 127, - 93, 174, 12, 139, 121, 177, 116, 78, 183, 16, 224, 210, 40, 230, 17, - 92, 254, 147, 89, 141, 230, 176, 157, 223, 238, 163, 157, 217, 149, 32, - 93, 152, 88, 168, 29, 195, 101, 32, 224, 50, 16, 112, 25, 168, 219, - 251, 187, 176, 254, 173, 96, 130, 203, 164, 222, 169, 193, 100, 239, 111, - 214, 172, 223, 131, 25, 46, 3, 1, 151, 1, 128, 203, 0, 150, 75, - 86, 240, 148, 52, 41, 253, 16, 205, 149, 217, 243, 223, 230, 96, 21, - 31, 103, 165, 110, 55, 215, 6, 51, 92, 6, 0, 46, 3, 0, 151, - 140, 55, 27, 112, 121, 123, 237, 176, 96, 130, 203, 6, 173, 135, 42, - 116, 97, 192, 229, 144, 63, 7, 7, 51, 92, 250, 3, 46, 3, 0, - 151, 140, 215, 18, 117, 77, 186, 242, 252, 11, 186, 39, 127, 103, 240, - 214, 96, 178, 247, 119, 221, 140, 131, 134, 125, 234, 39, 145, 119, 165, - 147, 235, 238, 7, 19, 92, 174, 222, 148, 173, 210, 128, 203, 245, 255, - 120, 183, 99, 184, 12, 4, 92, 6, 2, 46, 3, 185, 182, 36, 83, - 122, 45, 248, 81, 48, 193, 165, 163, 210, 35, 77, 47, 224, 50, 61, - 51, 152, 225, 50, 16, 112, 25, 8, 184, 12, 228, 222, 57, 71, 58, - 246, 40, 139, 148, 145, 35, 239, 168, 186, 188, 1, 151, 27, 222, 47, - 214, 142, 225, 50, 16, 112, 25, 8, 184, 12, 212, 229, 202, 172, 186, - 84, 149, 238, 201, 239, 151, 229, 167, 229, 36, 21, 150, 183, 215, 99, - 185, 15, 233, 192, 147, 1, 191, 44, 206, 55, 48, 87, 230, 208, 63, - 129, 52, 135, 109, 171, 83, 245, 37, 47, 91, 41, 185, 86, 11, 107, - 59, 134, 75, 224, 241, 10, 2, 92, 6, 113, 216, 42, 45, 159, 40, - 220, 156, 230, 176, 213, 89, 216, 76, 227, 45, 43, 79, 45, 213, 204, - 52, 135, 141, 173, 75, 248, 82, 26, 113, 201, 175, 87, 20, 7, 125, - 165, 225, 87, 142, 211, 75, 247, 228, 159, 102, 184, 252, 4, 112, 137, - 241, 154, 224, 146, 208, 203, 0, 151, 236, 57, 226, 210, 31, 144, 229, - 15, 184, 100, 216, 234, 219, 251, 153, 253, 69, 171, 186, 52, 87, 166, - 242, 212, 195, 106, 249, 179, 131, 164, 110, 210, 21, 46, 94, 6, 2, - 46, 253, 1, 151, 13, 88, 110, 85, 185, 165, 18, 235, 59, 198, 210, - 117, 134, 247, 0, 151, 70, 125, 71, 228, 237, 93, 112, 155, 180, 100, - 99, 85, 154, 43, 83, 230, 31, 245, 252, 133, 190, 128, 203, 121, 101, - 254, 229, 226, 101, 13, 192, 101, 77, 192, 101, 45, 93, 174, 76, 219, - 23, 203, 105, 188, 244, 122, 212, 73, 161, 111, 61, 61, 42, 69, 94, - 222, 151, 192, 112, 89, 7, 112, 89, 15, 112, 201, 222, 185, 46, 224, - 114, 201, 183, 111, 180, 33, 184, 236, 216, 241, 148, 226, 119, 37, 0, - 151, 175, 93, 173, 222, 142, 225, 210, 95, 195, 37, 243, 181, 173, 128, - 75, 185, 237, 92, 154, 43, 19, 116, 98, 154, 154, 211, 58, 251, 178, - 52, 185, 206, 168, 118, 12, 151, 141, 0, 151, 141, 0, 151, 236, 187, - 29, 135, 120, 89, 229, 206, 247, 20, 151, 101, 47, 87, 81, 231, 64, - 195, 111, 75, 51, 55, 71, 24, 238, 223, 40, 2, 241, 242, 210, 249, - 102, 52, 94, 62, 190, 175, 174, 171, 148, 138, 76, 151, 106, 173, 252, - 57, 129, 225, 178, 30, 224, 178, 62, 224, 146, 213, 247, 52, 196, 203, - 26, 35, 75, 210, 92, 153, 97, 99, 212, 92, 153, 111, 195, 179, 165, - 154, 219, 92, 237, 244, 184, 108, 12, 184, 180, 82, 222, 25, 17, 57, - 210, 153, 45, 52, 39, 70, 174, 217, 183, 181, 66, 31, 4, 92, 102, - 62, 108, 215, 158, 225, 178, 37, 224, 178, 37, 224, 178, 21, 229, 109, - 150, 236, 45, 23, 155, 80, 156, 230, 150, 134, 222, 254, 167, 157, 218, - 183, 40, 44, 7, 28, 123, 157, 195, 101, 51, 192, 165, 85, 135, 203, - 121, 128, 203, 94, 242, 185, 4, 130, 203, 160, 173, 235, 149, 250, 238, - 128, 120, 121, 102, 94, 42, 23, 47, 235, 107, 241, 146, 197, 248, 79, - 1, 151, 233, 29, 74, 208, 92, 153, 7, 73, 170, 143, 37, 64, 188, - 44, 221, 52, 192, 120, 45, 11, 112, 201, 214, 202, 124, 41, 141, 185, - 50, 252, 26, 90, 113, 175, 234, 128, 203, 234, 128, 203, 234, 47, 231, - 150, 30, 213, 231, 202, 196, 114, 185, 50, 177, 92, 174, 76, 44, 151, - 43, 163, 198, 203, 9, 128, 203, 9, 186, 92, 25, 236, 63, 19, 92, - 254, 194, 229, 202, 36, 149, 99, 188, 125, 129, 103, 4, 252, 102, 90, - 194, 116, 185, 50, 108, 12, 22, 75, 215, 190, 48, 94, 26, 141, 193, - 72, 188, 188, 247, 53, 203, 149, 121, 222, 49, 220, 70, 226, 101, 233, - 59, 44, 31, 34, 14, 244, 109, 135, 223, 78, 78, 47, 198, 203, 173, - 71, 89, 174, 204, 232, 234, 179, 105, 174, 76, 195, 49, 236, 157, 19, - 129, 39, 25, 126, 7, 56, 94, 204, 149, 201, 28, 200, 114, 101, 62, - 106, 58, 155, 230, 202, 52, 173, 202, 120, 15, 3, 207, 113, 248, 165, - 112, 188, 216, 143, 237, 177, 147, 229, 202, 188, 157, 204, 114, 101, 134, - 29, 102, 243, 52, 39, 129, 231, 52, 252, 82, 117, 188, 215, 164, 215, - 187, 205, 166, 185, 50, 227, 7, 207, 166, 185, 50, 43, 167, 207, 54, - 205, 149, 185, 251, 238, 108, 154, 43, 243, 79, 128, 74, 23, 134, 120, - 121, 224, 9, 211, 123, 1, 244, 93, 130, 223, 21, 78, 111, 57, 192, - 229, 39, 37, 103, 211, 92, 153, 105, 90, 174, 73, 13, 136, 151, 61, - 63, 100, 103, 184, 92, 3, 158, 27, 240, 187, 197, 241, 158, 142, 204, - 145, 166, 87, 154, 70, 115, 101, 182, 30, 156, 170, 174, 85, 2, 46, - 175, 79, 158, 106, 99, 184, 28, 7, 184, 28, 7, 184, 28, 199, 245, - 39, 189, 229, 123, 103, 89, 174, 204, 131, 127, 85, 127, 120, 12, 253, - 216, 203, 215, 217, 247, 77, 7, 159, 200, 128, 95, 22, 167, 247, 25, - 224, 114, 242, 167, 44, 87, 230, 104, 51, 109, 157, 19, 226, 229, 84, - 46, 39, 41, 7, 121, 188, 194, 0, 151, 97, 186, 92, 153, 57, 167, - 89, 174, 204, 199, 111, 178, 92, 153, 5, 127, 153, 231, 202, 176, 245, - 91, 95, 74, 99, 188, 228, 215, 117, 139, 123, 141, 7, 92, 142, 7, - 92, 142, 127, 121, 15, 243, 37, 46, 87, 230, 36, 140, 147, 175, 154, - 205, 41, 112, 185, 50, 192, 27, 122, 218, 131, 185, 235, 75, 220, 120, - 223, 197, 237, 45, 59, 37, 112, 238, 218, 197, 141, 247, 129, 70, 157, - 138, 180, 83, 2, 231, 174, 121, 29, 80, 111, 82, 23, 159, 83, 226, - 230, 174, 81, 174, 110, 238, 90, 211, 17, 115, 82, 220, 220, 53, 218, - 93, 228, 122, 143, 227, 148, 216, 245, 30, 159, 83, 98, 215, 123, 208, - 118, 34, 215, 123, 16, 39, 116, 189, 231, 16, 248, 193, 37, 51, 204, - 112, 185, 50, 127, 66, 249, 195, 230, 152, 193, 114, 20, 51, 71, 184, - 245, 158, 195, 2, 49, 115, 132, 243, 103, 160, 81, 167, 26, 76, 4, - 98, 134, 211, 129, 245, 38, 117, 137, 254, 67, 224, 122, 207, 225, 92, - 152, 209, 116, 248, 253, 33, 112, 189, 231, 176, 224, 245, 158, 195, 130, - 215, 123, 254, 16, 188, 222, 243, 135, 224, 245, 158, 67, 220, 122, 207, - 254, 12, 111, 191, 147, 102, 152, 97, 185, 50, 126, 192, 27, 115, 208, - 131, 245, 158, 67, 220, 58, 201, 239, 220, 122, 207, 65, 113, 152, 65, - 185, 116, 189, 7, 104, 212, 169, 174, 11, 136, 195, 140, 31, 167, 3, - 235, 77, 234, 18, 114, 64, 28, 102, 80, 174, 110, 189, 71, 211, 225, - 218, 47, 14, 51, 104, 119, 145, 113, 6, 109, 44, 50, 206, 132, 28, - 16, 27, 103, 208, 118, 34, 227, 12, 226, 132, 198, 153, 61, 224, 7, - 135, 76, 48, 195, 229, 202, 184, 246, 65, 31, 104, 175, 7, 235, 61, - 251, 184, 24, 176, 143, 235, 155, 37, 139, 195, 76, 40, 167, 195, 5, - 239, 228, 210, 244, 56, 146, 197, 97, 6, 229, 210, 122, 0, 77, 234, - 226, 147, 44, 176, 111, 182, 55, 215, 122, 207, 94, 173, 111, 230, 20, - 216, 55, 75, 22, 27, 103, 28, 201, 98, 227, 140, 79, 178, 216, 56, - 131, 182, 19, 26, 103, 246, 112, 113, 102, 55, 248, 193, 126, 51, 204, - 176, 61, 159, 126, 136, 177, 68, 15, 226, 204, 30, 174, 125, 78, 226, - 226, 76, 162, 192, 56, 147, 196, 197, 25, 160, 81, 167, 18, 103, 18, - 4, 198, 25, 78, 7, 214, 155, 212, 37, 36, 65, 96, 156, 73, 204, - 21, 103, 52, 29, 174, 221, 2, 227, 76, 162, 224, 56, 147, 32, 56, - 206, 36, 8, 142, 51, 187, 5, 199, 153, 221, 28, 102, 182, 131, 31, - 236, 113, 135, 153, 145, 227, 63, 26, 52, 77, 217, 35, 109, 225, 219, - 192, 93, 128, 177, 223, 60, 200, 47, 219, 197, 181, 207, 187, 152, 124, - 251, 206, 252, 221, 27, 84, 179, 91, 249, 166, 180, 125, 230, 116, 184, - 224, 157, 92, 154, 30, 191, 95, 243, 119, 111, 144, 37, 118, 94, 60, - 173, 199, 111, 92, 61, 128, 166, 117, 249, 37, 127, 247, 6, 253, 52, - 124, 49, 59, 183, 246, 183, 92, 113, 230, 55, 13, 51, 219, 243, 119, - 111, 208, 225, 38, 83, 104, 174, 12, 218, 93, 151, 35, 1, 118, 164, - 123, 93, 52, 250, 163, 150, 11, 36, 246, 220, 125, 187, 235, 106, 80, - 85, 46, 111, 209, 46, 211, 195, 28, 9, 173, 124, 225, 172, 55, 229, - 90, 239, 148, 50, 228, 205, 46, 50, 88, 182, 219, 30, 169, 23, 65, - 90, 198, 200, 13, 106, 252, 165, 208, 197, 50, 102, 200, 145, 119, 190, - 183, 26, 241, 62, 157, 247, 177, 60, 123, 152, 151, 149, 228, 7, 16, - 218, 255, 220, 10, 238, 185, 113, 142, 4, 250, 5, 111, 3, 252, 206, - 212, 166, 26, 141, 54, 96, 207, 243, 182, 65, 153, 175, 99, 226, 137, - 13, 72, 121, 180, 193, 225, 14, 142, 120, 51, 27, 244, 248, 104, 96, - 60, 177, 193, 142, 174, 114, 60, 177, 65, 159, 165, 21, 227, 205, 108, - 208, 227, 204, 135, 63, 19, 27, 16, 26, 109, 192, 158, 27, 219, 0, - 253, 150, 183, 1, 250, 33, 177, 1, 161, 187, 128, 13, 216, 115, 247, - 242, 194, 192, 6, 103, 127, 141, 165, 185, 50, 164, 252, 43, 96, 131, - 179, 9, 31, 27, 242, 22, 47, 58, 88, 238, 251, 219, 135, 73, 196, - 6, 253, 170, 116, 87, 104, 63, 176, 193, 222, 134, 53, 12, 121, 159, - 131, 13, 42, 253, 52, 133, 230, 76, 17, 26, 109, 192, 158, 27, 219, - 0, 113, 197, 219, 0, 113, 66, 108, 64, 232, 241, 96, 3, 246, 220, - 189, 188, 179, 96, 131, 162, 145, 31, 209, 92, 25, 82, 190, 40, 216, - 160, 255, 29, 99, 222, 39, 224, 7, 227, 35, 72, 158, 205, 24, 185, - 196, 5, 117, 46, 26, 253, 32, 243, 246, 44, 155, 153, 31, 20, 91, - 48, 155, 230, 202, 16, 26, 109, 192, 158, 27, 247, 155, 176, 221, 167, - 119, 183, 174, 133, 118, 109, 183, 81, 12, 208, 223, 93, 232, 218, 6, - 229, 227, 61, 136, 1, 219, 184, 182, 115, 27, 55, 214, 248, 57, 127, - 57, 198, 136, 119, 218, 118, 114, 58, 92, 240, 78, 46, 77, 79, 220, - 55, 249, 203, 49, 70, 60, 209, 122, 196, 115, 245, 0, 154, 212, 197, - 254, 77, 254, 114, 140, 209, 95, 105, 61, 226, 115, 197, 128, 120, 45, - 183, 96, 109, 254, 114, 140, 209, 31, 232, 88, 227, 103, 125, 238, 8, - 107, 55, 29, 54, 66, 207, 107, 159, 96, 55, 106, 79, 117, 57, 193, - 223, 232, 229, 177, 54, 200, 97, 35, 52, 202, 51, 106, 155, 116, 121, - 4, 185, 228, 49, 60, 59, 108, 132, 158, 11, 242, 140, 112, 174, 203, - 35, 88, 171, 151, 199, 176, 225, 176, 17, 26, 223, 207, 8, 51, 186, - 251, 102, 215, 114, 247, 45, 126, 5, 126, 176, 221, 8, 51, 205, 117, - 152, 73, 249, 58, 195, 59, 100, 141, 57, 102, 176, 28, 189, 111, 246, - 107, 38, 223, 181, 90, 28, 102, 66, 56, 29, 41, 240, 78, 41, 154, - 158, 176, 213, 226, 48, 131, 114, 105, 61, 128, 166, 117, 89, 45, 14, - 51, 33, 107, 244, 152, 65, 157, 202, 92, 243, 87, 226, 48, 131, 118, - 39, 62, 20, 99, 111, 226, 22, 51, 209, 241, 91, 60, 198, 76, 88, - 46, 121, 238, 48, 131, 242, 60, 197, 140, 133, 147, 23, 10, 242, 220, - 97, 6, 229, 121, 138, 25, 180, 29, 255, 126, 238, 48, 131, 242, 60, - 197, 12, 226, 132, 96, 38, 229, 11, 240, 131, 181, 70, 152, 105, 161, - 195, 76, 244, 42, 224, 253, 210, 28, 51, 88, 142, 248, 129, 207, 42, - 46, 47, 127, 165, 56, 204, 248, 112, 58, 162, 225, 157, 162, 53, 61, - 214, 149, 226, 48, 131, 114, 105, 61, 128, 38, 117, 113, 174, 16, 135, - 25, 159, 47, 245, 152, 65, 157, 202, 28, 192, 10, 113, 152, 65, 187, - 231, 23, 51, 252, 156, 145, 117, 101, 254, 49, 195, 203, 67, 123, 230, - 23, 51, 188, 188, 144, 21, 249, 199, 12, 223, 55, 67, 156, 16, 204, - 68, 127, 6, 244, 87, 70, 152, 105, 169, 195, 76, 8, 240, 166, 44, - 51, 199, 12, 150, 163, 49, 96, 57, 183, 239, 127, 89, 254, 48, 195, - 143, 207, 81, 46, 141, 1, 64, 163, 78, 165, 255, 247, 121, 254, 48, - 195, 143, 207, 67, 56, 29, 88, 111, 82, 23, 199, 231, 249, 195, 12, - 63, 62, 71, 185, 186, 187, 211, 53, 29, 62, 159, 231, 15, 51, 100, - 124, 30, 172, 217, 157, 191, 27, 58, 232, 113, 177, 151, 198, 231, 97, - 97, 19, 237, 157, 227, 170, 53, 245, 164, 29, 71, 27, 243, 242, 190, - 29, 243, 238, 75, 99, 93, 148, 247, 107, 139, 213, 241, 30, 173, 249, - 115, 242, 222, 24, 81, 196, 217, 109, 251, 232, 151, 198, 141, 149, 199, - 79, 180, 251, 253, 28, 227, 209, 189, 50, 62, 156, 188, 56, 120, 191, - 218, 221, 167, 189, 52, 6, 155, 6, 239, 55, 179, 203, 36, 143, 226, - 140, 130, 19, 50, 127, 186, 17, 252, 224, 11, 35, 204, 180, 210, 97, - 38, 230, 167, 12, 111, 191, 173, 30, 156, 103, 249, 19, 55, 71, 251, - 19, 147, 239, 216, 236, 41, 102, 10, 187, 247, 103, 126, 174, 153, 211, - 17, 3, 239, 20, 163, 233, 113, 109, 242, 20, 51, 230, 58, 80, 46, - 173, 7, 208, 164, 46, 246, 31, 60, 197, 140, 7, 245, 216, 154, 43, - 143, 121, 171, 182, 118, 178, 209, 83, 204, 228, 165, 195, 161, 96, 102, - 164, 151, 106, 247, 122, 74, 73, 117, 143, 97, 46, 121, 22, 178, 199, - 80, 199, 93, 178, 190, 165, 153, 69, 253, 145, 118, 215, 217, 235, 153, - 189, 208, 159, 73, 141, 201, 30, 195, 41, 213, 212, 184, 228, 151, 58, - 72, 58, 242, 222, 135, 134, 49, 42, 173, 252, 82, 41, 32, 131, 96, - 53, 150, 206, 159, 149, 30, 151, 36, 61, 141, 175, 102, 56, 31, 150, - 254, 217, 63, 146, 227, 83, 167, 149, 236, 155, 203, 185, 125, 74, 161, - 11, 205, 120, 44, 205, 26, 120, 214, 80, 239, 115, 217, 34, 255, 85, - 171, 72, 83, 178, 127, 237, 102, 195, 210, 77, 213, 61, 134, 69, 229, - 77, 243, 43, 25, 234, 205, 41, 80, 70, 102, 243, 124, 190, 148, 14, - 187, 81, 69, 54, 155, 255, 35, 182, 71, 127, 20, 101, 251, 223, 19, - 223, 137, 35, 182, 63, 212, 83, 141, 225, 104, 251, 50, 143, 143, 255, - 108, 102, 251, 9, 211, 73, 187, 22, 75, 231, 237, 208, 246, 15, 27, - 175, 142, 55, 179, 125, 212, 234, 228, 120, 98, 251, 1, 125, 23, 197, - 19, 219, 47, 159, 242, 81, 188, 153, 237, 235, 22, 255, 229, 103, 98, - 251, 128, 38, 235, 127, 38, 182, 191, 176, 99, 254, 207, 102, 182, 103, - 243, 139, 190, 148, 70, 219, 155, 205, 59, 18, 219, 35, 78, 137, 237, - 83, 243, 176, 253, 103, 30, 216, 222, 187, 207, 51, 251, 221, 224, 15, - 104, 46, 74, 82, 45, 181, 191, 243, 243, 63, 131, 164, 55, 6, 158, - 53, 236, 251, 84, 2, 219, 151, 218, 53, 154, 238, 121, 39, 49, 224, - 202, 216, 36, 233, 147, 173, 49, 134, 115, 120, 49, 203, 254, 145, 46, - 94, 221, 150, 68, 108, 127, 240, 96, 180, 66, 247, 154, 249, 88, 106, - 84, 102, 158, 33, 111, 115, 176, 253, 103, 71, 253, 105, 254, 209, 16, - 91, 29, 133, 14, 7, 219, 7, 204, 173, 106, 200, 123, 31, 108, 207, - 230, 53, 125, 41, 221, 21, 108, 111, 54, 223, 73, 108, 143, 237, 151, - 222, 239, 29, 54, 102, 123, 149, 238, 160, 216, 222, 97, 211, 219, 254, - 154, 206, 246, 199, 193, 239, 215, 45, 99, 251, 154, 63, 215, 250, 134, - 77, 192, 239, 47, 255, 103, 124, 222, 250, 109, 176, 125, 66, 183, 105, - 116, 95, 51, 137, 151, 101, 192, 239, 255, 54, 136, 151, 200, 91, 244, - 243, 127, 164, 140, 152, 9, 116, 175, 238, 176, 79, 39, 43, 116, 69, - 240, 251, 54, 231, 77, 206, 151, 7, 219, 63, 34, 251, 85, 193, 246, - 127, 253, 166, 210, 197, 192, 246, 22, 155, 241, 59, 63, 3, 219, 179, - 249, 84, 95, 74, 143, 3, 219, 155, 205, 179, 210, 125, 120, 27, 185, - 57, 203, 111, 97, 12, 246, 153, 81, 140, 111, 173, 143, 241, 27, 32, - 206, 125, 239, 65, 140, 223, 192, 197, 198, 13, 76, 190, 223, 103, 226, - 198, 146, 126, 156, 142, 24, 120, 167, 24, 77, 79, 220, 119, 226, 198, - 146, 40, 151, 214, 3, 104, 82, 23, 251, 119, 226, 198, 146, 126, 223, - 231, 138, 241, 223, 107, 115, 150, 223, 138, 27, 75, 162, 221, 69, 206, - 191, 160, 141, 69, 206, 191, 216, 191, 19, 59, 255, 130, 182, 19, 57, - 255, 130, 56, 161, 231, 34, 46, 1, 63, 216, 104, 132, 153, 215, 244, - 115, 150, 235, 97, 204, 182, 206, 131, 57, 203, 245, 220, 56, 111, 61, - 55, 103, 25, 35, 112, 206, 146, 211, 145, 2, 239, 148, 162, 233, 9, - 139, 17, 56, 103, 185, 142, 171, 7, 208, 164, 46, 113, 75, 5, 206, - 89, 174, 203, 53, 103, 185, 78, 195, 229, 82, 129, 115, 150, 49, 98, - 231, 95, 194, 98, 196, 206, 191, 160, 61, 69, 206, 191, 216, 151, 138, - 157, 127, 65, 156, 208, 115, 228, 22, 130, 31, 124, 107, 128, 153, 166, - 86, 29, 102, 236, 192, 235, 92, 108, 142, 25, 44, 71, 207, 95, 251, - 148, 59, 71, 110, 113, 254, 48, 115, 234, 226, 56, 138, 25, 148, 75, - 207, 145, 3, 26, 117, 42, 184, 92, 148, 63, 204, 248, 237, 77, 165, - 152, 177, 115, 58, 176, 222, 164, 46, 97, 139, 242, 135, 153, 161, 241, - 87, 216, 121, 120, 139, 115, 157, 35, 71, 236, 181, 40, 127, 152, 249, - 121, 20, 119, 142, 220, 98, 230, 67, 185, 229, 161, 77, 115, 247, 175, - 77, 247, 236, 44, 202, 91, 30, 218, 239, 127, 42, 47, 204, 64, 30, - 218, 234, 127, 42, 207, 98, 32, 15, 237, 226, 169, 60, 122, 142, 220, - 66, 134, 25, 251, 199, 224, 7, 75, 140, 48, 163, 223, 83, 100, 1, - 94, 199, 39, 230, 152, 193, 114, 244, 28, 185, 5, 76, 190, 207, 39, - 226, 226, 12, 202, 165, 190, 134, 58, 22, 106, 243, 22, 243, 197, 197, - 25, 11, 167, 3, 235, 77, 234, 98, 157, 47, 46, 206, 160, 92, 30, - 51, 22, 77, 135, 243, 99, 113, 113, 6, 237, 46, 50, 206, 160, 141, - 69, 198, 25, 235, 124, 177, 113, 6, 109, 39, 50, 206, 32, 78, 8, - 102, 44, 81, 224, 7, 11, 141, 48, 163, 223, 131, 225, 156, 7, 237, - 249, 92, 115, 204, 96, 57, 26, 3, 230, 49, 249, 41, 115, 196, 97, - 198, 206, 233, 112, 194, 59, 57, 53, 61, 161, 115, 196, 97, 6, 229, - 210, 122, 0, 77, 234, 146, 22, 37, 14, 51, 246, 185, 122, 204, 160, - 78, 69, 90, 148, 56, 204, 160, 221, 69, 142, 103, 66, 231, 136, 29, - 207, 160, 61, 69, 142, 103, 28, 81, 98, 199, 51, 136, 19, 58, 207, - 255, 97, 166, 183, 253, 99, 119, 152, 25, 53, 120, 212, 32, 188, 26, - 97, 146, 238, 140, 95, 71, 36, 140, 127, 198, 103, 190, 244, 45, 115, - 99, 6, 203, 17, 63, 136, 179, 112, 229, 199, 101, 122, 91, 76, 254, - 140, 246, 174, 182, 238, 48, 141, 222, 91, 128, 114, 233, 28, 0, 188, - 19, 234, 84, 250, 102, 99, 60, 209, 145, 247, 222, 213, 237, 91, 199, - 178, 59, 75, 198, 51, 29, 88, 111, 82, 23, 231, 104, 79, 116, 228, - 189, 119, 117, 218, 233, 222, 108, 14, 128, 211, 97, 209, 116, 42, 255, - 126, 232, 137, 142, 188, 247, 174, 158, 110, 62, 155, 238, 93, 69, 187, - 243, 251, 245, 208, 142, 196, 135, 8, 141, 103, 91, 179, 231, 238, 219, - 93, 60, 219, 186, 94, 121, 114, 46, 70, 119, 153, 148, 199, 179, 173, - 183, 180, 124, 203, 144, 247, 113, 137, 177, 242, 215, 191, 221, 214, 238, - 114, 157, 37, 175, 158, 234, 183, 75, 157, 243, 141, 146, 171, 85, 155, - 210, 214, 120, 206, 119, 129, 188, 187, 223, 112, 122, 198, 57, 161, 241, - 108, 107, 246, 220, 100, 207, 226, 24, 189, 13, 240, 59, 19, 27, 16, - 26, 109, 192, 158, 187, 151, 151, 10, 54, 200, 241, 157, 74, 207, 121, - 39, 229, 139, 129, 13, 154, 141, 29, 109, 122, 206, 123, 244, 180, 161, - 244, 156, 247, 13, 97, 31, 180, 35, 54, 8, 29, 253, 78, 59, 51, - 27, 164, 150, 238, 211, 142, 216, 128, 208, 104, 3, 246, 220, 216, 6, - 232, 183, 188, 13, 208, 15, 137, 13, 8, 141, 54, 96, 207, 243, 182, - 193, 199, 139, 122, 209, 243, 254, 73, 121, 180, 193, 185, 208, 62, 166, - 231, 253, 255, 214, 189, 63, 61, 231, 189, 64, 207, 62, 244, 188, 255, - 133, 79, 122, 154, 158, 243, 30, 90, 211, 78, 247, 174, 18, 26, 109, - 192, 158, 27, 219, 0, 113, 197, 219, 0, 113, 66, 108, 64, 104, 180, - 1, 123, 158, 183, 13, 170, 52, 152, 77, 247, 174, 146, 242, 104, 131, - 203, 173, 102, 155, 158, 243, 94, 214, 62, 155, 158, 243, 254, 203, 27, - 179, 233, 57, 239, 211, 123, 206, 54, 61, 231, 189, 196, 187, 108, 239, - 42, 161, 209, 6, 236, 185, 201, 60, 48, 216, 128, 158, 139, 56, 12, - 218, 153, 40, 179, 24, 192, 206, 172, 142, 25, 149, 233, 237, 55, 210, - 60, 6, 96, 57, 218, 118, 142, 98, 229, 227, 70, 120, 26, 3, 220, - 247, 5, 16, 239, 180, 237, 228, 116, 196, 192, 59, 197, 104, 122, 236, - 35, 60, 141, 1, 238, 117, 32, 158, 104, 61, 70, 114, 245, 0, 154, - 212, 37, 101, 184, 167, 49, 192, 189, 14, 244, 87, 90, 143, 145, 185, - 98, 128, 102, 223, 208, 225, 158, 198, 0, 247, 58, 208, 31, 232, 156, - 209, 136, 76, 221, 94, 78, 214, 110, 58, 108, 132, 198, 115, 207, 141, - 218, 83, 221, 188, 109, 46, 121, 172, 13, 114, 216, 8, 141, 242, 140, - 218, 38, 221, 188, 237, 112, 189, 60, 134, 103, 135, 141, 208, 40, 207, - 8, 231, 186, 126, 93, 46, 121, 12, 27, 14, 27, 161, 81, 158, 17, - 102, 116, 103, 86, 15, 99, 152, 137, 25, 4, 126, 192, 197, 103, 247, - 152, 225, 206, 172, 6, 94, 215, 16, 115, 204, 96, 57, 186, 23, 123, - 40, 43, 31, 54, 68, 28, 102, 80, 46, 221, 139, 13, 52, 234, 84, - 10, 13, 17, 135, 153, 80, 78, 7, 214, 155, 212, 37, 122, 176, 56, - 204, 160, 92, 221, 25, 6, 154, 14, 191, 193, 226, 48, 131, 118, 231, - 243, 198, 220, 97, 6, 243, 198, 60, 197, 140, 37, 151, 60, 119, 152, - 65, 121, 158, 98, 6, 237, 201, 203, 115, 135, 25, 148, 231, 41, 102, - 252, 114, 201, 115, 135, 25, 148, 231, 41, 102, 16, 39, 116, 189, 49, - 28, 252, 96, 152, 25, 102, 184, 51, 171, 17, 99, 179, 205, 49, 131, - 229, 104, 12, 8, 101, 229, 173, 161, 226, 48, 131, 114, 169, 14, 120, - 39, 212, 169, 196, 178, 8, 129, 113, 102, 54, 23, 103, 128, 38, 117, - 177, 71, 8, 140, 51, 179, 115, 197, 25, 205, 190, 41, 225, 226, 48, - 131, 118, 207, 47, 102, 116, 107, 29, 17, 249, 199, 140, 110, 173, 35, - 34, 255, 152, 225, 229, 161, 237, 242, 139, 25, 190, 111, 134, 56, 161, - 57, 18, 211, 193, 15, 6, 153, 97, 134, 157, 89, 157, 50, 43, 211, - 59, 100, 166, 57, 102, 176, 28, 93, 167, 155, 197, 202, 187, 102, 228, - 15, 51, 252, 248, 60, 132, 211, 145, 2, 239, 148, 162, 233, 9, 155, - 145, 63, 204, 240, 227, 115, 148, 75, 235, 1, 52, 173, 203, 140, 252, - 97, 134, 31, 159, 135, 204, 212, 99, 38, 69, 179, 111, 244, 244, 252, - 97, 134, 140, 207, 131, 53, 187, 19, 31, 114, 189, 91, 196, 249, 113, - 133, 243, 193, 185, 199, 231, 209, 71, 78, 216, 206, 22, 76, 246, 232, - 174, 193, 48, 78, 222, 161, 247, 139, 56, 39, 166, 110, 9, 206, 61, - 214, 117, 130, 188, 166, 119, 231, 121, 118, 231, 46, 39, 239, 13, 144, - 183, 123, 111, 159, 132, 220, 227, 198, 80, 144, 119, 183, 243, 4, 207, - 114, 36, 166, 51, 121, 150, 129, 69, 156, 127, 111, 140, 122, 105, 12, - 22, 119, 244, 132, 237, 92, 118, 184, 103, 57, 18, 211, 25, 102, 82, - 154, 131, 31, 132, 155, 97, 166, 21, 219, 191, 63, 13, 120, 167, 154, - 99, 6, 203, 209, 220, 130, 105, 172, 188, 223, 68, 79, 49, 227, 227, - 222, 159, 75, 183, 221, 77, 115, 11, 56, 29, 209, 240, 78, 209, 154, - 30, 107, 176, 167, 152, 113, 175, 99, 218, 241, 177, 109, 104, 61, 166, - 114, 245, 0, 154, 212, 197, 222, 218, 83, 204, 184, 215, 177, 166, 252, - 25, 122, 150, 188, 207, 84, 61, 102, 162, 53, 251, 134, 180, 240, 20, - 51, 238, 117, 124, 243, 66, 197, 140, 179, 128, 106, 247, 122, 74, 73, - 117, 31, 25, 218, 145, 250, 184, 70, 227, 254, 73, 246, 220, 125, 187, - 139, 251, 39, 251, 37, 52, 218, 77, 246, 145, 125, 147, 220, 85, 161, - 131, 82, 7, 73, 15, 14, 142, 48, 228, 245, 241, 93, 42, 157, 10, - 250, 178, 45, 217, 71, 70, 176, 90, 241, 217, 102, 105, 245, 103, 107, - 12, 231, 195, 202, 23, 220, 38, 245, 61, 119, 71, 43, 179, 83, 138, - 125, 165, 182, 130, 157, 170, 207, 18, 164, 230, 39, 122, 24, 198, 158, - 199, 5, 246, 73, 63, 237, 88, 76, 207, 173, 45, 211, 105, 131, 66, - 63, 13, 63, 44, 69, 151, 220, 102, 200, 155, 25, 121, 76, 114, 30, - 76, 214, 202, 164, 72, 63, 120, 29, 209, 120, 79, 74, 253, 131, 79, - 27, 242, 62, 143, 60, 35, 21, 105, 126, 142, 158, 17, 63, 49, 240, - 178, 122, 71, 95, 196, 89, 233, 108, 157, 91, 198, 239, 28, 121, 65, - 122, 107, 98, 6, 61, 35, 126, 219, 219, 143, 180, 243, 229, 47, 75, - 37, 236, 89, 198, 243, 62, 145, 215, 164, 240, 185, 247, 233, 25, 241, - 69, 134, 164, 41, 116, 199, 136, 219, 82, 172, 244, 192, 144, 183, 223, - 156, 187, 82, 224, 205, 235, 244, 204, 219, 218, 209, 69, 149, 125, 138, - 127, 58, 210, 165, 247, 79, 188, 98, 184, 103, 241, 189, 168, 76, 41, - 116, 127, 127, 173, 76, 150, 116, 244, 122, 132, 66, 219, 194, 179, 165, - 249, 94, 203, 12, 121, 227, 34, 114, 164, 236, 10, 241, 244, 140, 248, - 242, 245, 118, 40, 244, 215, 54, 47, 57, 166, 233, 78, 67, 222, 198, - 201, 222, 242, 170, 175, 99, 232, 30, 77, 223, 178, 170, 174, 202, 17, - 133, 229, 55, 174, 143, 55, 228, 221, 22, 89, 76, 238, 191, 180, 161, - 86, 166, 164, 124, 225, 7, 245, 187, 252, 209, 190, 148, 188, 229, 249, - 14, 67, 91, 173, 112, 150, 150, 75, 180, 28, 79, 207, 136, 63, 215, - 163, 137, 66, 239, 110, 95, 86, 14, 40, 127, 209, 208, 159, 241, 204, - 91, 54, 127, 236, 75, 105, 60, 243, 214, 108, 94, 153, 96, 26, 219, - 57, 130, 105, 188, 187, 1, 219, 45, 26, 103, 52, 26, 239, 110, 96, - 207, 221, 203, 251, 23, 48, 157, 250, 93, 17, 186, 47, 119, 210, 218, - 113, 74, 249, 158, 128, 233, 15, 166, 215, 51, 236, 119, 102, 149, 95, - 42, 249, 238, 111, 74, 207, 136, 39, 241, 18, 239, 110, 24, 183, 105, - 186, 241, 121, 220, 5, 182, 73, 213, 215, 134, 211, 51, 226, 51, 143, - 168, 103, 60, 23, 6, 76, 95, 58, 180, 208, 144, 247, 25, 96, 122, - 254, 196, 21, 237, 8, 166, 255, 170, 181, 86, 61, 7, 60, 226, 176, - 148, 147, 181, 174, 157, 49, 46, 143, 73, 71, 131, 55, 180, 35, 152, - 62, 19, 242, 131, 198, 123, 82, 186, 48, 116, 179, 241, 59, 3, 166, - 119, 63, 220, 218, 142, 96, 250, 131, 121, 241, 234, 156, 52, 96, 186, - 96, 165, 95, 12, 121, 45, 81, 23, 164, 111, 198, 236, 166, 231, 88, - 63, 206, 114, 170, 231, 233, 3, 166, 223, 157, 119, 208, 144, 183, 64, - 212, 53, 105, 137, 245, 120, 59, 130, 233, 117, 209, 127, 41, 180, 15, - 96, 250, 113, 218, 191, 134, 188, 205, 162, 238, 74, 143, 222, 188, 209, - 142, 96, 122, 231, 195, 108, 133, 238, 31, 145, 46, 253, 211, 181, 72, - 123, 35, 222, 14, 128, 233, 228, 130, 85, 219, 19, 76, 223, 172, 22, - 216, 94, 197, 86, 182, 228, 104, 25, 108, 200, 219, 52, 50, 71, 106, - 191, 234, 3, 122, 142, 245, 227, 153, 3, 21, 186, 55, 98, 250, 131, - 80, 67, 222, 7, 78, 111, 185, 113, 41, 59, 61, 199, 122, 149, 203, - 170, 208, 127, 132, 23, 150, 39, 46, 42, 103, 200, 123, 6, 48, 189, - 251, 226, 45, 122, 190, 188, 207, 171, 170, 157, 31, 0, 166, 43, 12, - 251, 177, 157, 177, 222, 210, 242, 149, 239, 86, 208, 243, 229, 223, 148, - 23, 41, 116, 22, 96, 186, 77, 242, 108, 99, 191, 2, 76, 179, 245, - 16, 95, 74, 95, 0, 76, 155, 173, 147, 16, 76, 99, 191, 130, 96, - 26, 239, 125, 192, 126, 2, 193, 52, 161, 241, 222, 7, 246, 220, 189, - 188, 211, 128, 233, 107, 79, 147, 219, 18, 76, 119, 45, 122, 85, 41, - 223, 30, 48, 253, 161, 165, 170, 97, 251, 242, 0, 48, 253, 211, 23, - 101, 232, 125, 44, 164, 207, 90, 16, 48, 29, 236, 59, 208, 176, 77, - 44, 0, 113, 186, 207, 175, 163, 232, 125, 44, 199, 146, 35, 212, 187, - 141, 1, 211, 29, 174, 47, 72, 52, 195, 116, 229, 217, 107, 105, 156, - 118, 90, 54, 171, 52, 96, 122, 73, 114, 188, 49, 47, 96, 218, 235, - 195, 93, 52, 78, 255, 60, 110, 143, 198, 123, 82, 122, 123, 226, 126, - 211, 56, 61, 213, 113, 136, 198, 233, 109, 27, 143, 210, 56, 125, 255, - 120, 138, 137, 222, 11, 82, 157, 15, 254, 166, 113, 250, 221, 5, 255, - 104, 188, 151, 165, 232, 237, 231, 18, 141, 219, 131, 107, 210, 188, 123, - 169, 52, 78, 127, 87, 92, 189, 83, 165, 1, 96, 58, 163, 254, 69, - 67, 222, 56, 192, 244, 152, 27, 231, 104, 156, 238, 80, 250, 169, 66, - 79, 159, 157, 46, 85, 108, 88, 202, 48, 230, 165, 0, 166, 223, 250, - 178, 57, 141, 211, 221, 218, 246, 85, 232, 154, 128, 233, 202, 183, 63, - 50, 228, 29, 48, 59, 71, 154, 57, 114, 37, 141, 211, 219, 63, 89, - 165, 208, 223, 3, 166, 247, 111, 92, 109, 200, 123, 21, 48, 189, 233, - 124, 20, 141, 211, 13, 215, 140, 83, 232, 197, 128, 233, 222, 227, 236, - 134, 188, 177, 128, 233, 173, 101, 202, 209, 56, 221, 166, 213, 37, 165, - 190, 23, 0, 211, 247, 254, 216, 99, 104, 171, 191, 1, 211, 201, 182, - 53, 52, 78, 71, 206, 81, 253, 240, 38, 96, 186, 226, 138, 177, 198, - 223, 23, 48, 205, 214, 247, 124, 41, 253, 47, 96, 218, 108, 221, 143, - 96, 26, 251, 241, 124, 223, 27, 251, 229, 4, 211, 132, 198, 190, 55, - 123, 158, 119, 223, 251, 251, 82, 44, 135, 99, 169, 86, 30, 115, 151, - 206, 92, 49, 230, 197, 220, 165, 115, 107, 103, 211, 28, 14, 50, 110, - 44, 0, 152, 30, 83, 195, 108, 13, 109, 155, 212, 172, 232, 108, 122, - 54, 253, 192, 125, 234, 126, 189, 130, 128, 233, 197, 17, 102, 247, 44, - 239, 147, 206, 209, 59, 154, 15, 73, 239, 204, 8, 215, 206, 121, 63, - 44, 173, 178, 27, 231, 112, 96, 156, 62, 127, 143, 228, 127, 164, 72, - 31, 238, 82, 105, 140, 211, 89, 243, 102, 217, 204, 48, 253, 221, 219, - 179, 232, 185, 246, 71, 26, 206, 162, 231, 218, 167, 63, 158, 105, 194, - 123, 65, 218, 176, 113, 38, 61, 215, 222, 54, 127, 166, 141, 96, 58, - 117, 184, 25, 239, 53, 233, 234, 132, 153, 244, 92, 251, 175, 123, 105, - 247, 89, 3, 166, 223, 106, 100, 204, 235, 15, 152, 126, 176, 121, 38, - 205, 149, 249, 226, 152, 122, 94, 79, 56, 196, 233, 196, 187, 83, 13, - 121, 147, 0, 211, 187, 119, 77, 164, 231, 218, 55, 254, 104, 156, 66, - 47, 7, 76, 159, 174, 63, 202, 144, 119, 136, 35, 71, 90, 178, 252, - 61, 122, 174, 125, 171, 148, 119, 213, 92, 25, 192, 116, 149, 146, 239, - 26, 242, 158, 0, 76, 23, 93, 54, 140, 230, 232, 92, 136, 87, 117, - 45, 1, 76, 31, 188, 63, 193, 248, 157, 1, 211, 157, 202, 78, 163, - 231, 218, 63, 94, 171, 214, 61, 29, 48, 189, 100, 152, 177, 111, 100, - 3, 166, 43, 84, 141, 160, 231, 218, 39, 173, 140, 160, 231, 218, 15, - 171, 48, 219, 244, 92, 123, 182, 94, 237, 75, 105, 60, 215, 222, 108, - 29, 155, 230, 204, 55, 103, 115, 40, 214, 129, 64, 79, 55, 155, 67, - 97, 103, 116, 135, 0, 111, 74, 83, 243, 57, 20, 44, 71, 231, 4, - 155, 177, 242, 161, 77, 197, 205, 213, 163, 92, 58, 39, 8, 52, 234, - 84, 188, 207, 42, 110, 174, 62, 132, 211, 129, 245, 38, 117, 113, 88, - 197, 205, 213, 163, 92, 93, 206, 188, 166, 35, 110, 160, 184, 185, 122, - 180, 187, 200, 245, 45, 180, 177, 200, 245, 45, 135, 85, 236, 250, 22, - 218, 78, 228, 250, 150, 130, 19, 77, 94, 218, 59, 224, 7, 205, 205, - 48, 195, 206, 232, 142, 251, 32, 211, 219, 250, 190, 57, 102, 176, 28, - 241, 3, 235, 7, 172, 188, 243, 61, 113, 152, 177, 114, 58, 226, 224, - 157, 226, 52, 61, 33, 239, 137, 195, 12, 202, 165, 245, 0, 154, 212, - 197, 245, 174, 56, 204, 88, 223, 215, 99, 38, 78, 179, 111, 216, 187, - 226, 48, 131, 118, 23, 185, 190, 21, 242, 158, 216, 245, 45, 180, 167, - 200, 245, 173, 176, 119, 197, 174, 111, 33, 78, 8, 102, 226, 222, 2, - 63, 24, 104, 130, 25, 238, 140, 238, 48, 224, 77, 27, 96, 142, 25, - 44, 71, 252, 32, 237, 109, 86, 222, 49, 64, 28, 102, 80, 46, 209, - 17, 6, 52, 234, 84, 34, 247, 0, 113, 152, 9, 227, 116, 96, 189, - 73, 93, 98, 250, 139, 195, 12, 202, 229, 49, 19, 166, 233, 176, 246, - 23, 135, 25, 180, 187, 200, 56, 227, 51, 64, 108, 156, 65, 123, 138, - 140, 51, 214, 254, 98, 227, 12, 226, 132, 96, 38, 172, 15, 248, 193, - 59, 102, 152, 97, 123, 182, 173, 192, 27, 215, 207, 28, 51, 88, 142, - 198, 128, 55, 89, 121, 123, 63, 113, 152, 65, 185, 52, 6, 0, 141, - 58, 149, 145, 80, 95, 113, 152, 177, 114, 58, 176, 222, 164, 46, 161, - 125, 197, 97, 6, 229, 242, 152, 177, 106, 58, 210, 250, 136, 195, 12, - 218, 93, 100, 156, 65, 27, 139, 140, 51, 161, 125, 197, 198, 25, 180, - 157, 200, 56, 131, 56, 161, 103, 116, 119, 7, 63, 120, 203, 12, 51, - 108, 143, 107, 90, 239, 76, 239, 152, 158, 230, 152, 193, 114, 116, 95, - 80, 47, 110, 239, 81, 79, 129, 123, 143, 122, 113, 251, 130, 128, 70, - 157, 74, 255, 175, 135, 56, 204, 248, 113, 58, 176, 222, 164, 46, 33, - 61, 196, 97, 6, 229, 234, 206, 181, 215, 116, 184, 186, 11, 220, 123, - 212, 83, 108, 156, 65, 27, 139, 140, 51, 33, 61, 196, 198, 25, 180, - 157, 200, 56, 131, 56, 161, 152, 233, 4, 125, 154, 62, 121, 98, 230, - 163, 81, 35, 70, 106, 50, 180, 89, 165, 110, 153, 222, 161, 93, 73, - 121, 95, 25, 111, 170, 192, 140, 165, 151, 238, 79, 233, 198, 237, 63, - 237, 198, 197, 153, 46, 153, 121, 222, 111, 240, 101, 74, 243, 221, 181, - 188, 146, 218, 27, 229, 6, 37, 255, 23, 201, 238, 208, 226, 116, 184, - 224, 157, 92, 154, 30, 191, 55, 242, 214, 113, 124, 70, 221, 36, 203, - 148, 27, 109, 141, 114, 131, 78, 245, 237, 206, 246, 159, 118, 229, 234, - 1, 52, 173, 203, 235, 121, 235, 240, 143, 94, 148, 20, 245, 209, 174, - 182, 70, 185, 65, 203, 198, 244, 98, 103, 26, 119, 213, 99, 198, 165, - 217, 215, 213, 41, 111, 29, 255, 38, 15, 180, 253, 94, 194, 97, 120, - 174, 125, 70, 111, 150, 27, 132, 118, 231, 243, 33, 208, 142, 68, 30, - 161, 49, 31, 130, 61, 199, 251, 62, 155, 88, 54, 90, 172, 150, 31, - 185, 59, 94, 49, 55, 168, 236, 152, 63, 180, 50, 221, 101, 82, 30, - 115, 131, 198, 207, 27, 100, 24, 163, 48, 55, 168, 85, 220, 11, 109, - 109, 103, 150, 156, 54, 110, 109, 27, 117, 46, 55, 74, 206, 184, 18, - 178, 219, 120, 62, 118, 129, 124, 239, 249, 251, 218, 250, 207, 18, 74, - 99, 62, 4, 123, 158, 119, 236, 73, 211, 252, 130, 183, 1, 126, 103, - 98, 3, 66, 163, 13, 216, 115, 180, 65, 16, 216, 32, 16, 108, 16, - 168, 203, 9, 73, 123, 240, 38, 205, 139, 33, 229, 49, 39, 228, 191, - 130, 93, 77, 243, 98, 130, 47, 203, 52, 47, 230, 217, 158, 96, 154, - 23, 211, 224, 135, 214, 166, 121, 49, 137, 205, 173, 52, 47, 134, 208, - 104, 3, 246, 220, 216, 6, 232, 183, 188, 13, 208, 15, 137, 13, 8, - 141, 54, 96, 207, 209, 6, 141, 220, 218, 224, 148, 181, 59, 181, 1, - 41, 143, 54, 8, 110, 30, 98, 106, 131, 39, 23, 222, 164, 54, 216, - 48, 180, 55, 181, 65, 213, 81, 230, 185, 65, 67, 130, 88, 110, 16, - 161, 209, 6, 236, 185, 177, 13, 16, 87, 188, 13, 16, 39, 196, 6, - 132, 70, 27, 176, 231, 104, 131, 105, 96, 131, 105, 96, 131, 105, 58, - 27, 124, 215, 153, 229, 6, 145, 242, 104, 131, 31, 251, 153, 231, 6, - 29, 121, 143, 229, 6, 45, 30, 202, 114, 131, 126, 29, 101, 158, 27, - 84, 118, 50, 203, 13, 34, 52, 218, 128, 61, 55, 238, 55, 97, 187, - 79, 243, 67, 37, 104, 215, 186, 27, 198, 0, 93, 126, 168, 171, 35, - 148, 239, 224, 65, 12, 232, 200, 181, 157, 29, 153, 252, 52, 217, 211, - 24, 224, 190, 47, 128, 120, 167, 109, 39, 167, 195, 5, 239, 228, 210, - 244, 56, 100, 79, 99, 128, 123, 29, 136, 39, 90, 143, 14, 92, 61, - 128, 38, 117, 241, 145, 61, 141, 1, 238, 117, 160, 191, 210, 122, 116, - 200, 21, 3, 52, 251, 198, 72, 158, 198, 0, 247, 58, 208, 31, 104, - 223, 91, 214, 231, 202, 176, 118, 211, 97, 35, 52, 230, 202, 24, 181, - 167, 186, 121, 219, 92, 242, 88, 27, 228, 176, 17, 26, 229, 25, 181, - 77, 186, 241, 126, 46, 121, 12, 207, 14, 27, 161, 81, 158, 17, 206, - 117, 227, 125, 73, 47, 143, 97, 195, 97, 35, 52, 202, 51, 194, 140, - 238, 126, 83, 137, 235, 55, 5, 129, 31, 116, 50, 195, 12, 151, 79, - 103, 135, 254, 118, 99, 115, 204, 96, 57, 218, 71, 111, 194, 141, 53, - 26, 139, 195, 12, 202, 165, 99, 13, 160, 81, 167, 50, 214, 104, 36, - 14, 51, 126, 156, 14, 172, 55, 169, 75, 72, 35, 113, 152, 65, 185, - 186, 177, 134, 166, 195, 21, 36, 14, 51, 104, 119, 190, 239, 237, 14, - 51, 216, 247, 246, 20, 51, 104, 99, 94, 158, 59, 204, 160, 60, 79, - 49, 19, 146, 75, 158, 59, 204, 160, 60, 79, 49, 131, 182, 227, 229, - 185, 195, 12, 202, 243, 20, 51, 136, 19, 26, 103, 26, 102, 122, 251, - 73, 102, 152, 97, 249, 116, 174, 64, 192, 88, 128, 7, 113, 38, 144, - 107, 159, 3, 185, 56, 227, 47, 48, 206, 112, 58, 92, 240, 78, 46, - 77, 143, 195, 95, 96, 156, 9, 224, 234, 1, 52, 169, 139, 143, 191, - 192, 56, 19, 144, 43, 206, 104, 246, 141, 105, 40, 48, 206, 248, 231, - 31, 51, 252, 156, 145, 195, 63, 255, 152, 225, 229, 249, 248, 231, 31, - 51, 188, 60, 180, 93, 126, 49, 195, 247, 205, 16, 39, 52, 111, 187, - 14, 248, 65, 144, 25, 102, 88, 62, 93, 76, 3, 192, 88, 125, 15, - 226, 76, 3, 46, 6, 52, 224, 242, 182, 235, 229, 15, 51, 252, 248, - 220, 143, 211, 17, 3, 239, 20, 163, 233, 177, 215, 203, 31, 102, 248, - 241, 57, 202, 165, 245, 0, 154, 212, 37, 165, 110, 254, 48, 195, 143, - 207, 253, 234, 231, 202, 167, 211, 236, 27, 90, 55, 127, 152, 33, 227, - 243, 96, 205, 238, 196, 135, 252, 222, 43, 226, 252, 44, 235, 104, 66, - 238, 241, 185, 227, 200, 9, 91, 192, 131, 253, 121, 142, 207, 117, 121, - 219, 156, 188, 79, 62, 40, 226, 28, 89, 249, 203, 132, 220, 99, 93, - 235, 209, 19, 182, 11, 47, 134, 229, 57, 214, 213, 229, 109, 215, 101, - 242, 124, 222, 47, 226, 76, 92, 243, 106, 66, 238, 113, 35, 230, 6, - 205, 223, 51, 62, 207, 113, 163, 46, 111, 155, 147, 87, 116, 96, 17, - 103, 203, 45, 81, 47, 141, 193, 156, 248, 126, 213, 35, 242, 28, 131, - 233, 242, 182, 235, 112, 125, 179, 90, 224, 7, 13, 205, 48, 195, 242, - 233, 66, 129, 215, 85, 203, 28, 51, 88, 142, 198, 128, 218, 92, 223, - 172, 186, 167, 152, 113, 159, 239, 210, 54, 180, 35, 187, 179, 189, 54, - 23, 3, 128, 70, 157, 10, 102, 42, 123, 138, 25, 247, 58, 2, 50, - 70, 209, 188, 157, 80, 78, 7, 214, 155, 212, 37, 196, 215, 83, 204, - 184, 215, 33, 117, 187, 64, 117, 160, 92, 93, 222, 182, 166, 195, 90, - 210, 83, 204, 184, 215, 177, 130, 203, 13, 66, 187, 243, 251, 19, 209, - 142, 68, 30, 161, 113, 127, 34, 123, 142, 103, 76, 55, 177, 52, 4, - 220, 180, 133, 31, 191, 63, 113, 76, 199, 202, 116, 207, 241, 134, 226, - 29, 20, 58, 48, 117, 144, 116, 43, 101, 44, 229, 237, 11, 60, 35, - 224, 55, 147, 227, 45, 229, 187, 84, 74, 76, 107, 181, 155, 236, 79, - 36, 88, 45, 255, 108, 179, 84, 98, 102, 140, 225, 92, 90, 185, 130, - 219, 164, 87, 187, 223, 10, 38, 251, 19, 187, 246, 171, 161, 204, 47, - 87, 121, 150, 32, 93, 45, 240, 6, 157, 107, 142, 179, 52, 181, 108, - 183, 52, 179, 236, 180, 52, 103, 249, 61, 5, 246, 73, 187, 253, 23, - 208, 60, 130, 173, 239, 169, 185, 3, 152, 27, 148, 49, 121, 11, 229, - 77, 180, 180, 176, 36, 91, 90, 90, 14, 88, 90, 177, 185, 135, 200, - 99, 210, 188, 51, 187, 104, 30, 193, 145, 142, 251, 20, 250, 89, 248, - 73, 233, 234, 182, 35, 38, 185, 0, 103, 164, 17, 11, 254, 164, 121, - 4, 183, 127, 73, 165, 121, 4, 19, 175, 94, 164, 188, 135, 65, 223, - 113, 203, 171, 150, 20, 248, 49, 189, 23, 164, 249, 235, 238, 208, 60, - 130, 155, 245, 210, 84, 58, 226, 178, 212, 118, 211, 67, 202, 123, 18, - 120, 78, 91, 90, 91, 254, 178, 180, 166, 188, 94, 81, 215, 164, 83, - 115, 238, 210, 60, 130, 168, 87, 31, 40, 116, 175, 136, 219, 210, 198, - 255, 50, 40, 111, 42, 240, 158, 5, 190, 243, 28, 239, 71, 115, 238, - 74, 242, 226, 251, 52, 143, 224, 82, 139, 210, 202, 62, 252, 139, 142, - 116, 41, 250, 112, 93, 186, 39, 255, 34, 240, 92, 178, 188, 102, 185, - 2, 222, 65, 120, 135, 69, 101, 74, 239, 47, 31, 72, 243, 8, 190, - 191, 52, 71, 161, 131, 195, 179, 165, 170, 143, 86, 82, 222, 107, 22, - 155, 229, 134, 69, 182, 220, 178, 116, 162, 188, 225, 17, 57, 82, 102, - 253, 157, 52, 143, 96, 111, 249, 221, 10, 253, 139, 205, 75, 174, 241, - 60, 145, 242, 222, 177, 116, 177, 220, 179, 116, 181, 164, 193, 143, 238, - 169, 76, 246, 150, 35, 46, 125, 71, 243, 8, 70, 39, 173, 80, 232, - 130, 17, 133, 229, 43, 55, 39, 81, 222, 116, 203, 235, 150, 12, 208, - 153, 101, 177, 83, 222, 31, 35, 139, 201, 19, 195, 131, 218, 147, 253, - 137, 27, 250, 169, 117, 63, 216, 190, 148, 108, 251, 124, 23, 181, 85, - 14, 214, 211, 171, 181, 165, 144, 87, 11, 202, 251, 185, 179, 180, 188, - 168, 196, 20, 154, 71, 112, 57, 165, 133, 66, 255, 214, 190, 172, 60, - 99, 202, 13, 195, 249, 93, 204, 13, 98, 243, 199, 190, 148, 190, 60, - 189, 130, 204, 207, 43, 23, 247, 178, 90, 74, 195, 175, 156, 151, 245, - 229, 60, 130, 202, 250, 60, 2, 108, 183, 8, 166, 9, 221, 9, 48, - 205, 158, 35, 166, 45, 47, 97, 250, 111, 192, 244, 206, 177, 55, 40, - 166, 23, 140, 89, 174, 230, 32, 0, 166, 103, 159, 172, 156, 192, 48, - 109, 213, 48, 221, 152, 205, 83, 151, 95, 42, 189, 114, 182, 62, 205, - 35, 32, 241, 18, 115, 131, 62, 59, 217, 215, 112, 110, 24, 247, 28, - 87, 28, 217, 147, 230, 17, 188, 255, 102, 31, 45, 7, 33, 65, 250, - 94, 126, 43, 145, 97, 58, 16, 48, 29, 8, 152, 14, 212, 237, 57, - 62, 241, 247, 32, 154, 71, 112, 252, 226, 72, 109, 79, 254, 97, 233, - 216, 144, 49, 137, 12, 211, 129, 128, 233, 64, 192, 116, 160, 110, 207, - 113, 141, 197, 97, 44, 223, 111, 247, 71, 26, 239, 73, 169, 249, 127, - 147, 76, 243, 8, 254, 120, 103, 50, 205, 35, 176, 125, 53, 85, 203, - 217, 59, 43, 237, 248, 103, 122, 34, 195, 116, 32, 96, 58, 16, 48, - 29, 168, 219, 115, 60, 175, 231, 108, 154, 71, 16, 248, 174, 131, 230, - 251, 149, 47, 19, 153, 200, 48, 29, 0, 152, 14, 0, 76, 7, 112, - 57, 73, 215, 164, 114, 21, 34, 104, 30, 193, 183, 61, 212, 242, 37, - 0, 211, 7, 163, 231, 36, 50, 76, 7, 0, 166, 3, 0, 211, 140, - 183, 86, 212, 93, 105, 224, 190, 121, 52, 143, 96, 115, 208, 114, 133, - 238, 18, 145, 46, 13, 252, 114, 125, 34, 195, 116, 0, 96, 58, 0, - 48, 237, 79, 121, 95, 7, 76, 59, 187, 144, 220, 200, 44, 41, 241, - 194, 69, 45, 127, 33, 91, 122, 54, 229, 121, 34, 195, 116, 67, 192, - 116, 3, 192, 52, 187, 143, 224, 245, 200, 28, 201, 175, 91, 77, 154, - 71, 48, 224, 114, 45, 133, 110, 8, 152, 174, 51, 189, 110, 18, 195, - 116, 93, 192, 116, 29, 192, 116, 29, 202, 155, 225, 244, 150, 171, 188, - 82, 130, 230, 17, 60, 173, 103, 81, 232, 127, 195, 11, 203, 159, 76, - 100, 57, 153, 233, 150, 122, 128, 233, 250, 128, 233, 6, 148, 247, 6, - 96, 186, 247, 48, 45, 175, 4, 48, 61, 187, 248, 103, 10, 253, 4, - 48, 125, 255, 125, 102, 171, 28, 172, 167, 87, 0, 96, 154, 125, 163, - 39, 128, 233, 253, 187, 198, 210, 60, 130, 140, 117, 161, 10, 253, 28, - 48, 253, 201, 130, 190, 134, 190, 129, 123, 142, 217, 122, 136, 47, 165, - 113, 207, 49, 191, 78, 82, 28, 244, 149, 134, 95, 57, 78, 47, 205, - 35, 240, 213, 99, 26, 251, 9, 4, 211, 132, 198, 220, 32, 246, 220, - 61, 166, 79, 1, 166, 255, 25, 180, 139, 98, 250, 251, 132, 107, 74, - 249, 118, 128, 233, 41, 49, 21, 19, 94, 142, 211, 12, 211, 25, 128, - 233, 244, 223, 139, 82, 76, 147, 62, 107, 33, 192, 244, 252, 79, 223, - 55, 92, 235, 40, 8, 113, 250, 175, 133, 163, 41, 166, 99, 219, 68, - 210, 220, 160, 98, 113, 139, 115, 97, 58, 0, 48, 29, 160, 203, 13, - 122, 163, 216, 122, 138, 233, 251, 177, 113, 52, 55, 40, 49, 235, 87, - 14, 211, 254, 128, 105, 127, 192, 116, 67, 93, 110, 208, 95, 139, 156, - 20, 211, 255, 245, 59, 72, 115, 131, 30, 189, 114, 212, 20, 211, 243, - 154, 254, 73, 49, 125, 165, 254, 95, 52, 55, 200, 94, 253, 28, 135, - 233, 134, 128, 233, 6, 128, 105, 230, 107, 79, 1, 211, 9, 21, 175, - 80, 76, 251, 84, 191, 70, 115, 131, 6, 213, 186, 193, 97, 186, 1, - 96, 186, 1, 96, 186, 129, 46, 55, 104, 181, 237, 50, 197, 244, 128, - 255, 174, 42, 244, 43, 128, 233, 230, 43, 111, 112, 152, 110, 0, 152, - 110, 0, 152, 102, 188, 147, 1, 211, 133, 182, 221, 160, 152, 222, 185, - 71, 197, 71, 58, 96, 186, 241, 22, 150, 27, 116, 17, 120, 46, 1, - 62, 174, 0, 78, 8, 111, 52, 96, 186, 122, 231, 32, 154, 27, 52, - 189, 64, 103, 245, 158, 101, 192, 116, 202, 239, 3, 147, 24, 166, 235, - 0, 166, 107, 1, 166, 107, 82, 222, 214, 142, 28, 233, 249, 150, 79, - 40, 166, 199, 215, 88, 168, 208, 145, 128, 233, 113, 75, 22, 113, 152, - 174, 14, 152, 174, 6, 152, 174, 70, 121, 239, 1, 166, 75, 198, 142, - 161, 152, 246, 31, 58, 64, 161, 183, 0, 166, 93, 87, 154, 36, 49, - 76, 215, 0, 76, 251, 1, 166, 89, 123, 176, 11, 48, 189, 186, 69, - 97, 154, 27, 84, 199, 91, 253, 94, 87, 1, 211, 19, 250, 109, 227, - 48, 13, 237, 143, 87, 67, 192, 52, 107, 195, 46, 2, 166, 11, 221, - 90, 70, 49, 29, 189, 64, 109, 3, 238, 1, 166, 195, 222, 30, 110, - 188, 134, 6, 152, 102, 235, 123, 190, 148, 198, 220, 32, 126, 221, 207, - 8, 211, 216, 143, 231, 251, 222, 43, 184, 220, 160, 21, 92, 110, 208, - 10, 46, 55, 72, 197, 244, 52, 192, 244, 52, 93, 223, 123, 95, 9, - 150, 27, 244, 25, 151, 27, 244, 245, 13, 198, 219, 23, 120, 70, 192, - 111, 38, 199, 139, 185, 65, 209, 63, 176, 220, 32, 50, 110, 196, 220, - 160, 113, 118, 227, 181, 59, 140, 211, 150, 166, 44, 55, 232, 155, 76, - 150, 27, 212, 126, 23, 27, 115, 198, 1, 207, 118, 248, 237, 212, 241, - 238, 147, 90, 182, 137, 160, 185, 65, 225, 167, 89, 110, 208, 186, 117, - 44, 255, 35, 209, 50, 21, 48, 61, 21, 48, 61, 85, 23, 167, 7, - 191, 29, 78, 115, 131, 126, 11, 12, 167, 185, 65, 62, 207, 205, 115, - 131, 86, 255, 195, 114, 131, 22, 110, 97, 185, 65, 211, 35, 25, 239, - 97, 208, 119, 28, 126, 41, 58, 189, 23, 164, 146, 77, 103, 209, 220, - 32, 159, 106, 179, 104, 110, 144, 111, 33, 198, 123, 18, 120, 78, 195, - 239, 47, 29, 239, 53, 41, 35, 96, 22, 205, 13, 74, 168, 160, 210, - 69, 1, 211, 115, 44, 140, 55, 21, 120, 206, 194, 239, 60, 199, 235, - 7, 152, 110, 62, 97, 22, 205, 13, 186, 113, 72, 189, 191, 123, 48, - 96, 186, 147, 223, 116, 27, 195, 244, 84, 192, 244, 84, 192, 244, 20, - 29, 166, 127, 24, 56, 153, 230, 6, 125, 149, 16, 166, 222, 57, 14, - 152, 142, 175, 52, 198, 198, 48, 61, 25, 48, 61, 9, 48, 253, 17, - 229, 221, 15, 152, 110, 90, 127, 16, 205, 13, 170, 57, 41, 84, 161, - 251, 0, 166, 95, 221, 59, 208, 198, 48, 61, 30, 48, 61, 30, 48, - 61, 158, 242, 158, 7, 76, 79, 79, 29, 73, 115, 131, 126, 30, 175, - 234, 218, 12, 152, 30, 184, 102, 162, 141, 97, 122, 2, 96, 250, 35, - 192, 244, 36, 202, 123, 12, 48, 189, 235, 149, 233, 52, 55, 232, 47, - 155, 90, 247, 76, 192, 244, 47, 41, 204, 55, 114, 176, 158, 94, 83, - 1, 211, 204, 175, 158, 2, 166, 207, 127, 200, 114, 131, 18, 206, 176, - 220, 160, 175, 236, 230, 185, 65, 108, 189, 218, 151, 210, 24, 167, 249, - 117, 236, 226, 160, 175, 52, 252, 202, 113, 122, 233, 92, 125, 45, 110, - 207, 118, 137, 76, 111, 87, 29, 179, 57, 148, 87, 217, 121, 57, 229, - 51, 189, 67, 202, 153, 207, 161, 96, 57, 154, 183, 83, 158, 59, 147, - 168, 172, 184, 185, 250, 16, 78, 71, 10, 188, 83, 138, 166, 39, 172, - 172, 184, 185, 122, 148, 75, 235, 1, 52, 173, 75, 89, 113, 115, 245, - 33, 229, 114, 157, 73, 164, 217, 55, 218, 71, 220, 92, 61, 218, 93, - 228, 250, 86, 88, 89, 177, 235, 91, 150, 178, 98, 215, 183, 208, 118, - 34, 215, 183, 16, 39, 116, 207, 118, 145, 76, 239, 208, 90, 102, 152, - 97, 249, 116, 86, 224, 141, 43, 102, 142, 25, 44, 71, 247, 58, 23, - 231, 246, 210, 21, 19, 135, 25, 148, 75, 247, 108, 3, 141, 58, 21, - 159, 43, 42, 14, 51, 86, 78, 7, 214, 155, 212, 37, 180, 168, 56, - 204, 160, 92, 221, 158, 109, 77, 71, 90, 17, 113, 152, 65, 187, 139, - 92, 223, 66, 27, 139, 92, 223, 10, 45, 42, 118, 125, 11, 109, 39, - 114, 125, 11, 113, 66, 115, 80, 11, 128, 31, 148, 48, 195, 12, 203, - 167, 75, 43, 156, 233, 29, 86, 200, 28, 51, 88, 142, 230, 237, 20, - 230, 190, 125, 33, 113, 152, 9, 227, 116, 164, 129, 220, 52, 77, 79, - 116, 65, 113, 152, 65, 185, 180, 30, 64, 147, 186, 248, 21, 20, 135, - 153, 176, 66, 122, 204, 164, 105, 54, 138, 43, 32, 14, 51, 104, 119, - 145, 113, 6, 109, 44, 50, 206, 248, 21, 20, 27, 103, 208, 118, 34, - 227, 12, 226, 132, 174, 111, 125, 10, 126, 80, 196, 4, 51, 92, 62, - 93, 156, 119, 166, 119, 204, 82, 115, 204, 96, 57, 26, 3, 188, 185, - 245, 173, 165, 226, 48, 99, 229, 116, 196, 121, 1, 246, 53, 61, 206, - 37, 226, 48, 131, 114, 233, 186, 51, 188, 59, 169, 75, 200, 18, 129, - 123, 143, 150, 230, 202, 65, 245, 210, 246, 30, 125, 42, 112, 239, 209, - 82, 177, 113, 6, 109, 44, 50, 206, 132, 44, 17, 27, 103, 208, 118, - 34, 227, 12, 226, 132, 238, 61, 90, 0, 126, 80, 192, 12, 51, 220, - 30, 215, 197, 208, 151, 91, 228, 193, 222, 163, 197, 220, 122, 237, 98, - 110, 239, 209, 66, 129, 123, 143, 56, 29, 46, 120, 39, 151, 166, 199, - 177, 80, 224, 222, 163, 69, 92, 61, 128, 38, 117, 241, 89, 40, 112, - 239, 209, 162, 92, 123, 143, 52, 251, 198, 44, 16, 184, 247, 104, 161, - 216, 56, 227, 88, 40, 54, 206, 248, 44, 20, 27, 103, 208, 118, 34, - 227, 12, 226, 132, 158, 229, 157, 3, 126, 240, 169, 27, 204, 76, 30, - 51, 142, 187, 54, 136, 237, 139, 249, 36, 211, 219, 111, 190, 7, 119, - 70, 124, 194, 237, 217, 249, 132, 149, 79, 153, 235, 105, 62, 93, 49, - 183, 126, 176, 235, 102, 54, 219, 179, 195, 233, 136, 129, 119, 138, 209, - 244, 56, 162, 60, 205, 167, 115, 175, 99, 94, 197, 74, 44, 6, 204, - 231, 234, 1, 52, 169, 139, 213, 225, 105, 62, 157, 123, 29, 190, 127, - 180, 179, 209, 122, 204, 207, 181, 247, 72, 179, 111, 74, 142, 167, 249, - 116, 238, 117, 28, 220, 216, 80, 209, 81, 221, 91, 181, 123, 61, 165, - 164, 154, 15, 129, 118, 36, 62, 68, 232, 215, 183, 47, 151, 216, 115, - 247, 237, 238, 195, 158, 175, 201, 223, 214, 201, 164, 57, 33, 164, 124, - 129, 196, 94, 114, 61, 159, 103, 198, 235, 21, 114, 63, 249, 250, 145, - 23, 90, 153, 1, 242, 131, 14, 94, 202, 188, 184, 119, 226, 187, 242, - 253, 117, 222, 134, 103, 108, 229, 200, 161, 242, 193, 33, 133, 180, 50, - 67, 229, 207, 111, 23, 84, 121, 35, 134, 203, 7, 86, 21, 76, 50, - 158, 83, 29, 37, 251, 61, 246, 210, 202, 140, 145, 187, 132, 171, 107, - 14, 94, 17, 227, 228, 107, 133, 159, 155, 172, 177, 76, 144, 119, 63, - 121, 162, 149, 153, 36, 143, 44, 243, 68, 91, 39, 153, 34, 87, 168, - 151, 101, 194, 59, 93, 14, 153, 151, 77, 115, 96, 124, 163, 179, 181, - 117, 83, 135, 188, 250, 251, 108, 19, 222, 57, 242, 209, 247, 30, 107, - 101, 62, 150, 135, 159, 33, 103, 172, 126, 34, 91, 122, 62, 50, 225, - 93, 36, 63, 75, 120, 76, 243, 103, 8, 189, 243, 97, 52, 247, 60, - 239, 56, 141, 254, 130, 24, 226, 253, 5, 49, 65, 252, 133, 208, 157, - 193, 95, 216, 115, 247, 242, 210, 192, 95, 130, 94, 121, 66, 239, 153, - 34, 229, 209, 95, 110, 14, 173, 110, 234, 47, 11, 22, 52, 162, 254, - 50, 162, 97, 155, 68, 226, 47, 157, 127, 239, 156, 104, 230, 47, 5, - 63, 36, 231, 1, 14, 149, 139, 186, 222, 83, 245, 130, 191, 236, 104, - 252, 174, 241, 122, 40, 248, 203, 249, 186, 175, 39, 18, 127, 137, 31, - 164, 233, 5, 127, 249, 120, 109, 35, 83, 127, 57, 220, 181, 58, 245, - 151, 212, 209, 101, 169, 191, 220, 94, 92, 216, 212, 95, 202, 191, 250, - 40, 129, 248, 139, 189, 218, 189, 4, 149, 215, 33, 199, 92, 185, 144, - 96, 230, 47, 101, 74, 222, 74, 32, 254, 178, 233, 244, 237, 4, 226, - 47, 157, 190, 190, 147, 96, 230, 47, 237, 55, 221, 167, 121, 119, 132, - 70, 127, 97, 207, 141, 253, 5, 219, 67, 222, 95, 176, 125, 35, 254, - 66, 232, 150, 224, 47, 236, 185, 123, 121, 201, 224, 47, 177, 155, 58, - 208, 124, 43, 82, 190, 20, 248, 203, 163, 213, 193, 134, 188, 133, 58, - 244, 147, 7, 100, 183, 182, 17, 127, 217, 247, 119, 75, 133, 46, 4, - 254, 82, 127, 71, 51, 67, 222, 59, 224, 47, 173, 74, 5, 217, 136, - 191, 196, 190, 171, 210, 190, 224, 47, 153, 75, 131, 12, 121, 11, 68, - 141, 146, 191, 233, 216, 212, 70, 252, 165, 66, 235, 22, 10, 93, 4, - 252, 101, 101, 224, 171, 134, 188, 229, 162, 38, 200, 93, 198, 181, 177, - 17, 127, 249, 99, 70, 123, 133, 246, 1, 127, 113, 204, 151, 13, 121, - 143, 129, 191, 180, 216, 222, 149, 230, 151, 13, 91, 222, 93, 161, 31, - 135, 59, 228, 49, 253, 66, 140, 207, 40, 3, 127, 185, 48, 187, 139, - 141, 248, 203, 137, 66, 111, 168, 52, 248, 203, 129, 69, 157, 109, 102, - 254, 50, 120, 98, 103, 154, 155, 70, 104, 244, 23, 246, 220, 216, 95, - 48, 182, 241, 254, 130, 177, 138, 248, 11, 161, 155, 131, 191, 176, 231, - 238, 229, 37, 129, 191, 220, 154, 81, 155, 250, 11, 41, 143, 254, 146, - 126, 197, 223, 248, 187, 129, 191, 140, 56, 209, 136, 250, 203, 168, 43, - 86, 117, 109, 17, 252, 37, 236, 113, 115, 67, 222, 123, 224, 47, 159, - 250, 182, 161, 254, 210, 245, 204, 107, 10, 93, 14, 252, 229, 149, 31, - 95, 51, 246, 83, 240, 151, 172, 177, 45, 169, 191, 124, 182, 76, 245, - 205, 146, 224, 47, 149, 126, 107, 98, 200, 91, 27, 252, 101, 220, 183, - 65, 212, 95, 158, 221, 107, 160, 174, 165, 130, 191, 148, 108, 83, 199, - 144, 55, 30, 252, 101, 196, 209, 202, 212, 95, 42, 134, 87, 84, 207, - 180, 3, 127, 169, 121, 177, 172, 33, 239, 99, 240, 151, 189, 91, 170, - 82, 127, 89, 177, 178, 186, 66, 191, 8, 255, 68, 30, 28, 89, 195, - 212, 95, 238, 44, 174, 65, 253, 133, 208, 232, 47, 236, 185, 241, 56, - 15, 251, 169, 244, 46, 141, 39, 208, 15, 91, 96, 210, 103, 109, 198, - 173, 169, 60, 203, 244, 14, 121, 234, 193, 93, 26, 207, 184, 245, 158, - 103, 220, 186, 85, 118, 254, 206, 128, 192, 152, 75, 215, 123, 56, 29, - 41, 240, 78, 41, 154, 158, 176, 236, 252, 157, 1, 129, 237, 52, 173, - 199, 83, 174, 30, 64, 211, 186, 100, 231, 239, 12, 8, 196, 54, 173, - 199, 211, 92, 235, 86, 154, 125, 163, 159, 228, 239, 12, 8, 244, 7, - 58, 87, 144, 173, 207, 237, 99, 125, 23, 135, 141, 208, 151, 229, 4, - 187, 81, 159, 70, 183, 110, 149, 75, 30, 139, 109, 14, 27, 161, 81, - 158, 81, 204, 211, 173, 91, 229, 146, 199, 218, 62, 135, 141, 208, 40, - 207, 168, 77, 212, 205, 119, 62, 209, 203, 99, 216, 112, 216, 8, 141, - 242, 140, 48, 163, 187, 75, 227, 9, 119, 151, 70, 6, 248, 65, 142, - 9, 102, 154, 115, 247, 60, 100, 1, 239, 99, 15, 238, 210, 200, 226, - 238, 160, 200, 98, 229, 99, 30, 137, 195, 140, 15, 167, 35, 26, 222, - 41, 90, 211, 99, 125, 36, 14, 51, 40, 151, 214, 3, 104, 82, 23, - 103, 166, 56, 204, 248, 60, 206, 117, 151, 134, 102, 223, 144, 76, 113, - 152, 65, 187, 211, 251, 88, 10, 206, 74, 114, 135, 25, 203, 212, 26, - 30, 99, 198, 154, 75, 158, 59, 204, 160, 60, 79, 49, 131, 246, 228, - 229, 185, 195, 12, 202, 243, 20, 51, 33, 185, 228, 185, 195, 12, 202, - 243, 20, 51, 136, 19, 130, 25, 231, 191, 64, 63, 49, 193, 76, 11, - 238, 92, 79, 224, 77, 73, 247, 224, 236, 212, 12, 46, 6, 60, 228, - 206, 78, 77, 23, 135, 25, 148, 75, 99, 0, 208, 168, 83, 153, 179, - 124, 32, 14, 51, 33, 156, 14, 172, 55, 169, 75, 220, 69, 113, 152, - 65, 185, 186, 179, 83, 53, 29, 246, 139, 226, 48, 131, 118, 207, 47, - 102, 116, 107, 169, 15, 242, 143, 25, 94, 30, 218, 51, 191, 152, 225, - 229, 217, 47, 230, 31, 51, 124, 223, 76, 193, 137, 38, 207, 113, 22, - 252, 32, 195, 4, 51, 45, 217, 247, 176, 3, 175, 243, 188, 57, 102, - 176, 28, 241, 3, 231, 5, 86, 62, 228, 124, 254, 48, 195, 207, 39, - 162, 92, 162, 195, 14, 52, 234, 84, 250, 127, 231, 242, 135, 25, 126, - 62, 209, 206, 233, 192, 122, 147, 186, 132, 157, 203, 31, 102, 248, 249, - 68, 148, 203, 99, 198, 78, 236, 117, 46, 127, 152, 33, 243, 137, 193, - 154, 221, 105, 46, 227, 197, 210, 123, 214, 14, 169, 146, 148, 123, 62, - 209, 239, 202, 70, 91, 155, 132, 251, 158, 229, 164, 159, 99, 242, 98, - 14, 149, 222, 147, 24, 255, 85, 66, 238, 249, 38, 151, 107, 163, 237, - 225, 153, 122, 158, 245, 245, 56, 121, 161, 115, 42, 237, 249, 189, 124, - 216, 75, 243, 17, 33, 206, 88, 91, 157, 93, 205, 61, 138, 51, 22, - 254, 253, 82, 124, 247, 52, 140, 207, 105, 159, 123, 188, 106, 159, 25, - 107, 11, 41, 216, 212, 163, 56, 131, 56, 33, 152, 177, 164, 130, 31, - 252, 107, 130, 153, 86, 220, 247, 0, 94, 71, 170, 57, 102, 176, 28, - 241, 3, 199, 63, 172, 124, 195, 144, 30, 69, 60, 195, 76, 57, 183, - 126, 112, 169, 73, 52, 189, 231, 12, 229, 82, 95, 67, 29, 103, 181, - 113, 64, 63, 79, 116, 84, 203, 83, 71, 213, 239, 206, 210, 60, 67, - 11, 167, 3, 235, 77, 234, 210, 208, 81, 178, 128, 103, 152, 113, 175, - 99, 183, 227, 36, 205, 99, 70, 185, 60, 102, 44, 154, 142, 232, 185, - 158, 232, 168, 146, 167, 142, 245, 183, 212, 117, 171, 214, 5, 85, 187, - 215, 83, 74, 194, 159, 127, 144, 19, 237, 72, 124, 136, 208, 119, 126, - 154, 99, 103, 207, 221, 183, 187, 49, 221, 159, 217, 135, 255, 68, 230, - 179, 173, 210, 200, 63, 171, 42, 244, 236, 176, 225, 210, 47, 29, 90, - 25, 206, 133, 23, 89, 176, 90, 98, 88, 141, 165, 243, 253, 205, 34, - 54, 73, 70, 88, 85, 199, 241, 91, 164, 82, 255, 144, 59, 71, 226, - 164, 1, 195, 18, 19, 213, 249, 131, 120, 201, 47, 253, 7, 67, 222, - 115, 145, 59, 164, 105, 111, 126, 70, 243, 43, 138, 77, 249, 88, 221, - 203, 30, 190, 75, 42, 219, 100, 170, 33, 239, 147, 200, 68, 233, 163, - 195, 36, 239, 201, 41, 93, 108, 166, 230, 61, 21, 142, 216, 43, 117, - 91, 61, 209, 144, 215, 43, 234, 128, 244, 222, 161, 72, 154, 155, 241, - 253, 245, 249, 106, 174, 86, 196, 97, 233, 105, 193, 37, 38, 188, 199, - 164, 144, 85, 43, 104, 110, 198, 234, 152, 181, 218, 60, 240, 73, 233, - 193, 198, 13, 134, 188, 25, 145, 103, 164, 212, 61, 219, 105, 110, 198, - 176, 230, 59, 19, 213, 249, 146, 179, 146, 107, 195, 110, 147, 59, 210, - 46, 72, 95, 29, 216, 65, 115, 51, 102, 223, 217, 78, 243, 173, 134, - 149, 223, 110, 50, 119, 125, 77, 250, 248, 234, 118, 154, 155, 209, 127, - 255, 14, 141, 247, 182, 212, 240, 187, 95, 76, 120, 239, 74, 51, 165, - 157, 52, 55, 227, 203, 214, 187, 52, 222, 116, 233, 151, 38, 9, 38, - 190, 145, 41, 189, 159, 177, 135, 230, 91, 93, 79, 78, 214, 230, 189, - 179, 165, 113, 75, 247, 153, 232, 205, 145, 58, 151, 164, 247, 224, 200, - 165, 110, 28, 80, 121, 109, 94, 242, 233, 228, 223, 77, 114, 151, 188, - 229, 25, 91, 142, 104, 101, 10, 202, 239, 37, 29, 211, 120, 11, 201, - 237, 78, 156, 48, 225, 45, 44, 127, 240, 132, 248, 115, 81, 121, 118, - 197, 83, 26, 111, 49, 121, 93, 243, 51, 198, 247, 227, 36, 23, 151, - 43, 54, 78, 165, 185, 90, 141, 186, 158, 215, 214, 23, 74, 203, 195, - 162, 174, 154, 212, 183, 172, 204, 214, 217, 124, 41, 189, 243, 97, 69, - 217, 108, 253, 141, 180, 37, 216, 190, 146, 182, 228, 83, 104, 75, 176, - 189, 36, 109, 9, 161, 59, 196, 205, 177, 179, 231, 238, 229, 237, 237, - 245, 204, 126, 252, 139, 158, 193, 164, 45, 57, 176, 188, 168, 66, 119, - 156, 48, 92, 74, 159, 30, 214, 214, 136, 119, 55, 180, 37, 44, 78, - 199, 210, 181, 160, 210, 208, 150, 24, 197, 105, 228, 189, 11, 109, 73, - 124, 106, 8, 109, 75, 126, 156, 240, 182, 134, 143, 120, 233, 131, 226, - 131, 77, 124, 109, 135, 52, 107, 109, 8, 109, 75, 202, 58, 186, 104, - 190, 182, 75, 250, 97, 144, 108, 194, 155, 40, 77, 43, 222, 134, 182, - 37, 171, 59, 183, 208, 120, 247, 74, 206, 168, 198, 38, 188, 7, 164, - 227, 15, 26, 210, 182, 228, 171, 9, 117, 105, 238, 230, 136, 7, 53, - 77, 120, 143, 73, 175, 12, 172, 74, 219, 146, 161, 49, 149, 104, 238, - 230, 230, 75, 190, 166, 121, 94, 231, 173, 190, 180, 45, 249, 62, 172, - 28, 205, 221, 28, 23, 231, 99, 194, 123, 65, 90, 50, 189, 20, 109, - 75, 92, 165, 74, 210, 182, 164, 233, 250, 226, 166, 109, 201, 129, 2, - 37, 104, 91, 242, 226, 151, 162, 180, 45, 121, 237, 67, 179, 181, 172, - 187, 210, 241, 172, 23, 9, 164, 45, 217, 182, 240, 169, 182, 150, 149, - 46, 173, 170, 254, 56, 193, 172, 45, 121, 113, 144, 148, 201, 146, 246, - 78, 126, 164, 173, 101, 101, 75, 243, 234, 102, 38, 152, 181, 37, 75, - 207, 166, 145, 50, 114, 165, 121, 15, 19, 72, 91, 18, 211, 228, 81, - 130, 89, 91, 98, 77, 240, 162, 109, 201, 188, 185, 222, 180, 45, 57, - 219, 189, 128, 105, 91, 210, 179, 49, 169, 111, 81, 121, 228, 68, 173, - 190, 208, 150, 68, 237, 124, 108, 162, 183, 184, 60, 106, 47, 25, 11, - 150, 148, 151, 206, 85, 223, 25, 219, 146, 127, 139, 62, 77, 48, 107, - 75, 216, 26, 172, 47, 165, 177, 45, 49, 91, 155, 165, 253, 18, 232, - 71, 145, 182, 36, 182, 78, 144, 19, 251, 69, 164, 45, 33, 244, 244, - 77, 115, 236, 236, 121, 30, 253, 146, 218, 207, 236, 21, 178, 11, 208, - 60, 175, 45, 251, 212, 245, 151, 209, 93, 135, 75, 223, 252, 211, 199, - 112, 44, 121, 173, 195, 106, 137, 245, 209, 99, 233, 58, 97, 161, 197, - 155, 36, 163, 62, 58, 242, 214, 141, 216, 34, 141, 248, 203, 199, 70, - 218, 146, 33, 146, 218, 55, 143, 152, 26, 47, 45, 31, 243, 143, 225, - 125, 124, 161, 51, 119, 72, 133, 238, 110, 111, 79, 218, 146, 8, 251, - 6, 133, 94, 56, 115, 151, 116, 251, 208, 74, 67, 222, 59, 208, 150, - 164, 126, 176, 170, 61, 105, 75, 174, 94, 93, 171, 208, 242, 236, 189, - 210, 226, 177, 223, 25, 242, 78, 135, 126, 201, 167, 111, 253, 210, 158, - 180, 37, 141, 55, 236, 83, 232, 25, 208, 150, 92, 205, 78, 49, 228, - 173, 62, 231, 152, 228, 19, 120, 169, 61, 105, 75, 14, 44, 73, 87, - 232, 165, 208, 150, 148, 125, 225, 101, 104, 171, 249, 17, 103, 164, 118, - 153, 229, 104, 126, 217, 166, 132, 10, 218, 58, 231, 89, 169, 175, 163, - 178, 33, 239, 120, 104, 75, 126, 241, 41, 77, 243, 203, 126, 237, 95, - 66, 161, 127, 10, 191, 44, 197, 125, 83, 212, 120, 125, 21, 218, 146, - 58, 43, 138, 210, 252, 178, 42, 13, 84, 186, 0, 180, 37, 229, 118, - 22, 49, 228, 45, 29, 117, 87, 202, 172, 88, 132, 230, 151, 253, 25, - 164, 242, 250, 67, 91, 178, 95, 46, 102, 200, 155, 5, 109, 201, 193, - 147, 37, 105, 126, 89, 245, 63, 213, 247, 127, 16, 158, 45, 133, 158, - 240, 49, 228, 189, 14, 109, 201, 200, 26, 229, 105, 126, 217, 249, 59, - 42, 157, 211, 222, 75, 238, 188, 219, 215, 120, 109, 49, 217, 91, 254, - 99, 79, 121, 154, 95, 22, 189, 86, 45, 95, 30, 218, 146, 225, 225, - 21, 140, 215, 248, 146, 11, 203, 83, 23, 85, 178, 145, 182, 228, 135, - 69, 234, 186, 91, 16, 180, 37, 95, 46, 126, 197, 120, 173, 13, 218, - 146, 208, 183, 234, 208, 220, 52, 185, 159, 186, 62, 120, 46, 188, 180, - 60, 175, 151, 241, 218, 226, 83, 104, 75, 216, 250, 188, 47, 165, 19, - 161, 45, 49, 91, 183, 167, 253, 146, 185, 172, 45, 105, 1, 253, 18, - 28, 255, 144, 182, 132, 208, 163, 96, 140, 195, 158, 231, 129, 203, 174, - 207, 236, 75, 94, 244, 164, 109, 73, 137, 141, 109, 21, 186, 227, 251, - 195, 165, 37, 75, 234, 27, 242, 206, 124, 123, 181, 196, 198, 231, 177, - 116, 13, 121, 251, 252, 77, 146, 209, 248, 28, 121, 83, 103, 110, 145, - 118, 132, 134, 208, 182, 228, 234, 113, 245, 238, 177, 47, 167, 197, 75, - 233, 5, 140, 239, 42, 43, 229, 216, 33, 121, 183, 30, 71, 243, 77, - 91, 188, 170, 222, 49, 182, 28, 198, 56, 75, 154, 79, 50, 241, 211, - 68, 105, 209, 70, 146, 119, 232, 148, 98, 98, 62, 82, 104, 43, 244, - 75, 190, 91, 101, 124, 87, 89, 61, 104, 75, 166, 45, 26, 71, 115, - 85, 15, 37, 140, 86, 232, 14, 208, 150, 124, 123, 119, 164, 33, 239, - 183, 48, 198, 217, 51, 114, 24, 205, 85, 181, 134, 170, 57, 148, 31, - 67, 91, 210, 237, 77, 227, 251, 213, 150, 58, 206, 72, 101, 175, 246, - 162, 109, 73, 223, 134, 61, 105, 91, 50, 127, 108, 119, 67, 222, 221, - 208, 150, 148, 94, 208, 151, 182, 37, 171, 6, 189, 169, 249, 233, 101, - 233, 204, 107, 253, 141, 207, 213, 133, 182, 196, 225, 223, 159, 182, 37, - 139, 199, 246, 183, 145, 126, 201, 202, 159, 251, 155, 172, 189, 223, 149, - 54, 86, 27, 64, 219, 146, 65, 131, 212, 242, 229, 161, 45, 241, 221, - 248, 150, 33, 239, 51, 104, 75, 198, 119, 239, 71, 219, 146, 215, 239, - 171, 49, 237, 41, 180, 37, 117, 63, 239, 109, 200, 251, 16, 218, 146, - 90, 119, 122, 209, 182, 228, 243, 190, 42, 253, 2, 218, 146, 194, 187, - 123, 26, 242, 122, 67, 91, 18, 242, 110, 47, 218, 150, 12, 140, 83, - 203, 151, 132, 182, 100, 68, 33, 99, 222, 74, 208, 150, 252, 247, 101, - 119, 218, 150, 252, 217, 90, 221, 47, 82, 7, 218, 146, 174, 169, 175, - 27, 242, 150, 129, 49, 78, 70, 175, 14, 180, 45, 249, 40, 198, 166, - 237, 17, 41, 45, 151, 149, 90, 219, 204, 250, 37, 108, 239, 134, 47, - 165, 127, 131, 182, 196, 108, 79, 7, 153, 35, 195, 121, 49, 186, 22, - 115, 42, 211, 219, 113, 214, 100, 142, 172, 53, 155, 127, 113, 252, 13, - 101, 255, 50, 159, 35, 195, 114, 116, 222, 231, 111, 86, 62, 250, 140, - 184, 181, 24, 11, 167, 195, 1, 239, 228, 208, 244, 248, 157, 17, 183, - 22, 131, 114, 105, 61, 176, 222, 154, 142, 184, 211, 226, 214, 98, 44, - 127, 233, 231, 200, 28, 154, 125, 237, 167, 197, 173, 197, 160, 221, 69, - 174, 95, 250, 157, 17, 187, 126, 137, 246, 20, 185, 126, 105, 63, 45, - 118, 253, 18, 113, 66, 243, 238, 238, 195, 119, 73, 53, 193, 204, 107, - 220, 58, 1, 240, 58, 255, 244, 96, 45, 230, 20, 183, 134, 113, 146, - 91, 139, 249, 83, 28, 102, 80, 46, 93, 139, 1, 26, 117, 42, 145, - 34, 69, 28, 102, 236, 156, 14, 172, 55, 169, 75, 88, 138, 56, 204, - 160, 92, 221, 90, 140, 166, 35, 238, 190, 56, 204, 160, 221, 69, 174, - 95, 162, 141, 69, 174, 95, 134, 165, 136, 93, 191, 68, 219, 137, 92, - 191, 68, 156, 208, 187, 31, 111, 131, 31, 156, 50, 198, 76, 83, 43, - 151, 19, 118, 47, 211, 219, 122, 215, 131, 187, 31, 239, 113, 121, 119, - 247, 184, 187, 31, 239, 228, 15, 51, 55, 35, 70, 179, 220, 107, 78, - 71, 28, 188, 83, 156, 166, 39, 228, 78, 254, 48, 83, 48, 229, 14, - 93, 239, 65, 185, 180, 30, 64, 147, 186, 184, 254, 203, 31, 102, 90, - 54, 255, 182, 61, 173, 199, 221, 92, 121, 119, 154, 125, 195, 254, 203, - 31, 102, 66, 155, 126, 196, 238, 126, 188, 195, 249, 144, 238, 207, 97, - 67, 155, 18, 58, 47, 61, 47, 237, 67, 49, 144, 135, 246, 251, 159, - 202, 67, 123, 230, 37, 15, 109, 245, 63, 149, 23, 102, 32, 15, 237, - 226, 169, 60, 122, 247, 227, 109, 238, 28, 145, 235, 224, 7, 247, 77, - 48, 195, 229, 16, 133, 1, 111, 218, 77, 15, 238, 126, 188, 205, 229, - 94, 223, 226, 238, 126, 188, 41, 46, 206, 160, 92, 154, 123, 13, 52, - 234, 196, 50, 62, 55, 197, 197, 153, 48, 78, 7, 214, 155, 212, 37, - 230, 134, 184, 56, 131, 114, 117, 119, 63, 106, 58, 172, 55, 196, 197, - 25, 180, 187, 200, 56, 227, 115, 83, 108, 156, 65, 123, 138, 140, 51, - 214, 27, 98, 227, 12, 226, 132, 158, 35, 114, 25, 252, 224, 182, 9, - 102, 184, 61, 204, 86, 224, 141, 187, 234, 193, 221, 143, 215, 185, 24, - 112, 141, 59, 71, 228, 170, 56, 204, 160, 92, 26, 3, 128, 70, 157, - 202, 236, 193, 21, 113, 152, 177, 114, 58, 176, 222, 164, 46, 161, 87, - 196, 97, 6, 229, 234, 206, 17, 209, 116, 164, 93, 22, 135, 25, 180, - 187, 200, 241, 12, 218, 88, 228, 120, 38, 244, 138, 216, 241, 12, 218, - 78, 228, 120, 6, 113, 66, 207, 201, 223, 14, 126, 112, 61, 47, 204, - 96, 122, 247, 36, 221, 29, 70, 105, 151, 50, 189, 99, 246, 120, 112, - 247, 227, 37, 46, 6, 92, 98, 229, 125, 18, 61, 197, 76, 113, 183, - 126, 112, 241, 200, 183, 236, 254, 95, 78, 71, 154, 11, 176, 175, 233, - 113, 236, 242, 20, 51, 238, 117, 212, 72, 232, 69, 117, 160, 92, 154, - 15, 11, 245, 38, 117, 73, 251, 213, 83, 204, 184, 215, 145, 22, 104, - 163, 152, 65, 185, 186, 115, 68, 92, 26, 46, 119, 120, 138, 25, 247, - 58, 106, 206, 87, 247, 150, 13, 240, 86, 237, 94, 79, 41, 169, 230, - 6, 161, 29, 137, 15, 17, 26, 115, 85, 217, 243, 60, 246, 96, 244, - 124, 77, 110, 182, 245, 59, 173, 76, 119, 153, 148, 247, 78, 236, 37, - 175, 94, 107, 204, 139, 185, 135, 255, 6, 146, 50, 3, 100, 111, 199, - 122, 141, 247, 93, 185, 254, 233, 117, 38, 188, 161, 242, 133, 229, 49, - 90, 153, 161, 242, 157, 37, 223, 168, 231, 103, 63, 27, 41, 255, 216, - 116, 173, 33, 111, 78, 129, 241, 242, 204, 97, 107, 180, 50, 147, 228, - 137, 151, 190, 106, 167, 174, 35, 78, 150, 39, 56, 190, 106, 103, 188, - 142, 56, 69, 94, 113, 118, 149, 86, 102, 154, 220, 232, 232, 42, 141, - 119, 186, 188, 63, 113, 149, 9, 239, 12, 121, 247, 8, 34, 127, 150, - 156, 241, 190, 74, 99, 174, 106, 106, 43, 99, 189, 152, 123, 88, 188, - 225, 74, 173, 204, 199, 114, 249, 186, 43, 53, 189, 243, 229, 74, 181, - 87, 154, 232, 253, 68, 62, 148, 78, 202, 44, 148, 155, 13, 39, 239, - 188, 72, 94, 243, 143, 89, 125, 23, 203, 245, 45, 223, 104, 101, 150, - 80, 250, 252, 244, 165, 220, 243, 188, 99, 60, 250, 26, 226, 143, 247, - 53, 196, 19, 241, 53, 66, 163, 175, 177, 231, 121, 251, 218, 241, 211, - 125, 169, 175, 145, 242, 232, 107, 131, 110, 247, 52, 245, 53, 235, 244, - 238, 212, 215, 42, 87, 235, 74, 125, 205, 146, 248, 186, 169, 175, 157, - 121, 210, 129, 250, 90, 253, 2, 18, 245, 181, 101, 101, 218, 153, 250, - 90, 215, 203, 173, 169, 175, 213, 28, 222, 156, 250, 154, 111, 145, 102, - 166, 190, 246, 188, 105, 19, 234, 107, 203, 150, 52, 166, 190, 214, 240, - 191, 70, 166, 190, 118, 119, 112, 99, 234, 107, 199, 107, 88, 169, 175, - 245, 41, 253, 170, 169, 175, 157, 146, 122, 82, 95, 251, 171, 106, 79, - 234, 107, 3, 138, 244, 52, 245, 181, 234, 150, 14, 212, 215, 158, 92, - 104, 71, 125, 237, 239, 221, 173, 77, 125, 109, 102, 251, 102, 212, 215, - 8, 141, 190, 198, 158, 27, 251, 26, 182, 195, 188, 175, 97, 187, 74, - 124, 141, 208, 232, 107, 236, 121, 222, 190, 246, 90, 57, 27, 205, 121, - 36, 229, 209, 215, 42, 52, 53, 230, 69, 95, 251, 118, 128, 141, 230, - 60, 254, 213, 202, 70, 115, 30, 139, 85, 48, 227, 13, 149, 71, 174, - 104, 79, 115, 30, 219, 13, 104, 111, 35, 190, 246, 118, 161, 246, 54, - 51, 95, 203, 153, 210, 142, 230, 45, 206, 58, 167, 210, 232, 107, 107, - 50, 140, 215, 22, 45, 201, 83, 228, 31, 187, 18, 249, 211, 228, 158, - 27, 84, 218, 27, 124, 45, 221, 203, 248, 157, 189, 146, 103, 200, 195, - 234, 216, 105, 206, 99, 153, 37, 54, 109, 141, 202, 33, 175, 107, 221, - 206, 100, 205, 122, 142, 188, 243, 68, 19, 154, 243, 248, 196, 170, 230, - 135, 150, 5, 95, 91, 61, 200, 106, 200, 91, 60, 249, 19, 185, 120, - 253, 86, 54, 226, 107, 91, 195, 213, 92, 209, 226, 224, 107, 43, 206, - 180, 55, 121, 231, 197, 114, 131, 83, 175, 211, 124, 73, 66, 163, 175, - 177, 231, 198, 190, 134, 241, 152, 247, 53, 140, 175, 196, 215, 8, 141, - 190, 198, 158, 231, 237, 107, 43, 86, 55, 164, 190, 70, 202, 163, 175, - 21, 153, 211, 208, 212, 215, 42, 191, 219, 144, 250, 218, 250, 143, 27, - 82, 95, 11, 138, 111, 104, 234, 107, 17, 93, 253, 89, 62, 246, 74, - 127, 234, 107, 11, 159, 251, 155, 250, 90, 181, 31, 2, 168, 175, 77, - 234, 16, 64, 125, 173, 120, 64, 128, 169, 175, 21, 62, 238, 79, 125, - 173, 205, 40, 127, 234, 107, 227, 10, 250, 155, 250, 218, 210, 63, 26, - 80, 95, 235, 57, 80, 173, 99, 69, 240, 181, 208, 95, 140, 245, 222, - 6, 95, 155, 181, 160, 53, 245, 53, 223, 94, 42, 93, 14, 124, 237, - 98, 83, 227, 181, 54, 31, 240, 181, 198, 63, 55, 163, 190, 246, 239, - 127, 141, 52, 63, 93, 36, 151, 169, 239, 111, 178, 182, 184, 88, 158, - 50, 132, 229, 230, 18, 26, 125, 141, 61, 55, 30, 215, 98, 191, 156, - 244, 209, 99, 78, 64, 191, 243, 178, 89, 31, 157, 221, 153, 24, 10, - 188, 174, 120, 243, 62, 58, 150, 163, 231, 35, 109, 99, 229, 195, 226, - 243, 55, 174, 197, 126, 2, 61, 31, 105, 27, 119, 62, 18, 208, 168, - 83, 41, 20, 159, 191, 113, 45, 198, 7, 90, 15, 78, 7, 214, 155, - 212, 37, 250, 231, 252, 141, 107, 177, 93, 160, 245, 136, 207, 117, 47, - 143, 166, 195, 239, 231, 252, 141, 107, 209, 31, 232, 124, 98, 188, 62, - 87, 149, 245, 183, 28, 54, 66, 63, 233, 144, 96, 55, 234, 135, 233, - 242, 43, 114, 201, 99, 49, 213, 97, 35, 52, 202, 51, 138, 181, 186, - 92, 218, 159, 245, 242, 88, 187, 233, 176, 17, 26, 229, 25, 181, 167, - 186, 117, 196, 92, 242, 24, 54, 28, 54, 66, 163, 60, 35, 204, 240, - 227, 90, 196, 9, 61, 235, 239, 8, 248, 193, 118, 51, 204, 176, 59, - 19, 253, 128, 55, 230, 152, 57, 102, 176, 28, 29, 15, 30, 231, 206, - 250, 59, 38, 14, 51, 40, 151, 158, 143, 4, 52, 234, 84, 214, 53, - 142, 138, 195, 140, 31, 167, 3, 235, 77, 234, 18, 114, 84, 28, 102, - 80, 174, 238, 158, 81, 77, 135, 235, 136, 56, 204, 160, 221, 233, 220, - 200, 11, 103, 123, 119, 152, 177, 76, 253, 215, 230, 41, 102, 208, 198, - 188, 60, 119, 152, 65, 121, 158, 98, 38, 132, 151, 247, 212, 217, 222, - 29, 102, 28, 147, 255, 181, 121, 138, 25, 180, 29, 149, 247, 196, 217, - 222, 29, 102, 44, 32, 207, 83, 204, 32, 78, 232, 89, 127, 191, 131, - 31, 156, 48, 195, 12, 187, 51, 209, 117, 24, 218, 243, 63, 204, 49, - 131, 229, 104, 12, 56, 204, 157, 245, 119, 72, 28, 102, 66, 57, 29, - 46, 120, 39, 151, 166, 199, 113, 72, 28, 102, 80, 46, 173, 7, 208, - 164, 46, 62, 135, 196, 97, 38, 244, 143, 92, 103, 253, 105, 246, 141, - 249, 93, 28, 102, 208, 238, 249, 197, 12, 63, 167, 239, 56, 148, 127, - 204, 232, 214, 48, 14, 229, 31, 51, 186, 53, 140, 223, 243, 143, 25, - 190, 111, 134, 56, 161, 243, 167, 123, 193, 15, 142, 152, 97, 134, 221, - 153, 24, 115, 16, 218, 243, 3, 30, 156, 245, 119, 144, 139, 1, 7, - 185, 123, 70, 247, 231, 15, 51, 252, 252, 169, 31, 167, 35, 6, 222, - 41, 70, 211, 99, 223, 159, 63, 204, 240, 243, 167, 40, 151, 214, 3, - 104, 82, 151, 148, 125, 249, 195, 12, 63, 127, 234, 119, 32, 215, 89, - 127, 154, 125, 67, 247, 229, 15, 51, 100, 254, 52, 88, 179, 59, 241, - 33, 151, 179, 244, 158, 11, 15, 55, 188, 52, 127, 234, 227, 218, 104, - 235, 28, 240, 173, 71, 113, 193, 158, 75, 158, 213, 58, 224, 165, 57, - 50, 148, 215, 179, 68, 79, 143, 228, 161, 61, 169, 188, 51, 165, 247, - 76, 170, 213, 241, 165, 121, 16, 235, 229, 141, 182, 98, 141, 219, 123, - 20, 103, 66, 57, 121, 150, 11, 165, 247, 140, 247, 169, 251, 210, 88, - 215, 5, 242, 126, 24, 237, 239, 81, 156, 65, 156, 208, 190, 153, 19, - 252, 224, 119, 51, 204, 180, 98, 125, 109, 224, 117, 57, 61, 24, 207, - 236, 229, 98, 64, 50, 135, 153, 237, 111, 228, 43, 55, 119, 67, 115, - 7, 187, 103, 52, 153, 139, 1, 64, 163, 78, 44, 83, 249, 183, 55, - 242, 149, 155, 59, 171, 111, 122, 27, 90, 15, 78, 7, 214, 155, 212, - 37, 174, 69, 191, 34, 158, 97, 198, 189, 142, 7, 95, 165, 208, 220, - 92, 148, 171, 27, 207, 104, 58, 42, 191, 230, 137, 142, 188, 115, 115, - 235, 220, 102, 185, 185, 104, 119, 178, 111, 125, 140, 127, 144, 19, 237, - 72, 124, 136, 208, 13, 227, 230, 216, 217, 115, 247, 237, 238, 245, 158, - 207, 236, 163, 250, 44, 210, 112, 96, 149, 252, 71, 196, 42, 244, 43, - 19, 134, 75, 253, 3, 14, 25, 198, 148, 39, 11, 86, 75, 12, 171, - 177, 116, 125, 195, 43, 98, 147, 100, 132, 85, 139, 150, 155, 187, 241, - 147, 245, 90, 153, 56, 201, 49, 120, 189, 118, 103, 103, 188, 244, 118, - 240, 122, 67, 222, 130, 81, 59, 164, 6, 161, 223, 107, 101, 118, 74, - 227, 178, 212, 88, 90, 46, 98, 151, 52, 55, 218, 120, 14, 190, 100, - 84, 162, 20, 252, 39, 169, 175, 83, 170, 58, 106, 150, 66, 151, 136, - 216, 43, 37, 53, 30, 100, 200, 123, 55, 242, 128, 244, 251, 169, 102, - 244, 126, 211, 33, 213, 171, 41, 244, 131, 240, 195, 82, 167, 225, 5, - 140, 231, 219, 35, 143, 73, 207, 236, 46, 45, 31, 41, 69, 250, 233, - 120, 106, 176, 90, 223, 147, 210, 236, 247, 254, 52, 204, 83, 194, 251, - 77, 99, 122, 220, 209, 202, 164, 74, 37, 94, 188, 80, 232, 130, 17, - 103, 165, 158, 169, 197, 12, 245, 122, 71, 93, 144, 122, 44, 173, 76, - 239, 55, 109, 211, 161, 65, 59, 149, 247, 178, 212, 229, 113, 75, 67, - 222, 167, 145, 215, 164, 202, 75, 122, 208, 251, 77, 39, 253, 248, 174, - 66, 63, 15, 191, 45, 109, 56, 52, 202, 144, 55, 59, 242, 174, 212, - 220, 54, 141, 222, 111, 218, 247, 105, 184, 118, 175, 106, 186, 180, 237, - 92, 164, 137, 111, 100, 74, 33, 187, 29, 90, 153, 44, 233, 122, 249, - 72, 109, 190, 61, 91, 154, 53, 198, 140, 55, 71, 106, 84, 51, 138, - 148, 145, 103, 204, 136, 210, 230, 204, 189, 228, 223, 207, 68, 153, 204, - 153, 123, 203, 62, 79, 72, 153, 130, 114, 177, 97, 115, 52, 222, 66, - 114, 129, 63, 231, 24, 223, 65, 155, 92, 88, 94, 244, 23, 41, 83, - 84, 254, 176, 228, 199, 234, 59, 219, 138, 201, 221, 228, 79, 76, 244, - 22, 151, 11, 93, 248, 84, 43, 83, 82, 94, 21, 242, 153, 134, 163, - 210, 114, 210, 171, 95, 154, 212, 183, 172, 204, 214, 21, 125, 41, 141, - 249, 116, 102, 235, 141, 164, 45, 193, 246, 149, 180, 37, 227, 160, 45, - 193, 246, 146, 180, 37, 132, 182, 66, 91, 194, 158, 187, 151, 87, 165, - 215, 51, 123, 175, 13, 163, 105, 91, 50, 45, 64, 189, 11, 248, 85, - 104, 75, 134, 118, 93, 107, 218, 150, 176, 56, 29, 75, 215, 175, 176, - 45, 49, 138, 211, 164, 45, 249, 75, 238, 69, 219, 146, 35, 187, 180, - 181, 44, 104, 75, 156, 205, 66, 76, 238, 14, 222, 33, 149, 217, 223, - 151, 182, 37, 191, 84, 82, 121, 139, 64, 91, 210, 103, 116, 87, 67, - 222, 98, 208, 150, 92, 94, 101, 163, 109, 201, 133, 77, 234, 58, 82, - 41, 104, 75, 218, 236, 174, 102, 200, 155, 14, 109, 73, 151, 198, 55, - 131, 73, 91, 178, 222, 251, 160, 66, 103, 65, 91, 210, 48, 245, 91, - 195, 246, 0, 243, 252, 111, 102, 174, 161, 109, 201, 205, 143, 230, 40, - 116, 97, 104, 75, 250, 92, 236, 107, 200, 251, 56, 242, 140, 148, 253, - 243, 218, 182, 164, 45, 233, 52, 231, 23, 133, 46, 15, 109, 201, 157, - 126, 199, 13, 99, 197, 147, 200, 11, 82, 192, 189, 185, 193, 164, 45, - 185, 228, 245, 131, 122, 172, 92, 248, 101, 233, 156, 239, 49, 67, 189, - 89, 120, 95, 91, 208, 189, 96, 210, 150, 196, 84, 206, 86, 105, 204, - 167, 243, 46, 96, 242, 125, 239, 74, 25, 201, 207, 130, 73, 91, 50, - 127, 177, 202, 139, 121, 254, 85, 251, 103, 25, 234, 125, 1, 109, 73, - 235, 110, 15, 130, 73, 91, 210, 219, 245, 72, 107, 119, 179, 165, 113, - 147, 159, 5, 155, 181, 37, 251, 211, 139, 210, 182, 228, 148, 179, 52, - 109, 75, 46, 45, 241, 53, 109, 75, 234, 204, 170, 74, 219, 146, 200, - 106, 53, 104, 91, 242, 239, 174, 90, 166, 109, 73, 163, 243, 181, 105, - 91, 210, 108, 87, 3, 141, 183, 152, 220, 230, 203, 32, 211, 182, 100, - 119, 242, 171, 180, 45, 137, 255, 43, 152, 182, 37, 171, 44, 175, 155, - 182, 37, 108, 221, 216, 151, 210, 216, 150, 152, 173, 39, 211, 126, 9, - 244, 163, 104, 91, 82, 43, 200, 137, 253, 34, 210, 150, 16, 58, 251, - 135, 57, 118, 246, 220, 189, 188, 229, 85, 159, 217, 83, 215, 22, 167, - 249, 116, 111, 157, 85, 207, 16, 61, 60, 116, 184, 116, 178, 150, 113, - 110, 110, 111, 104, 75, 88, 31, 61, 150, 174, 79, 214, 129, 182, 196, - 168, 143, 174, 174, 107, 108, 145, 58, 124, 222, 134, 230, 211, 181, 169, - 168, 158, 141, 186, 0, 218, 146, 59, 171, 140, 207, 198, 13, 158, 183, - 67, 250, 127, 180, 93, 7, 96, 83, 213, 215, 191, 73, 10, 5, 25, - 22, 68, 134, 50, 202, 134, 50, 236, 96, 183, 205, 107, 203, 222, 5, - 10, 20, 16, 218, 180, 73, 219, 208, 54, 9, 73, 186, 24, 109, 5, - 100, 201, 222, 178, 172, 34, 75, 65, 202, 80, 144, 182, 73, 4, 65, - 28, 104, 21, 197, 173, 117, 15, 80, 64, 101, 202, 248, 126, 231, 190, - 151, 151, 87, 90, 192, 127, 202, 39, 158, 247, 206, 189, 239, 222, 223, - 29, 231, 220, 115, 206, 125, 35, 29, 254, 122, 31, 249, 123, 186, 17, - 11, 196, 103, 28, 123, 230, 30, 137, 92, 217, 227, 222, 207, 83, 246, - 228, 151, 68, 254, 56, 180, 190, 252, 61, 93, 181, 29, 62, 156, 159, - 63, 227, 104, 228, 219, 93, 254, 188, 231, 247, 181, 219, 242, 143, 71, - 118, 218, 125, 90, 254, 54, 183, 223, 23, 14, 206, 175, 157, 249, 78, - 100, 78, 139, 151, 238, 89, 215, 153, 123, 42, 178, 235, 147, 75, 228, - 111, 115, 127, 253, 105, 129, 86, 28, 239, 71, 145, 51, 236, 115, 239, - 89, 247, 16, 226, 146, 226, 186, 107, 181, 110, 91, 210, 98, 206, 11, - 156, 255, 3, 182, 228, 224, 237, 87, 238, 89, 247, 2, 226, 146, 209, - 139, 223, 208, 186, 109, 73, 75, 149, 216, 127, 29, 226, 146, 174, 121, - 63, 222, 179, 110, 108, 222, 79, 145, 51, 252, 85, 242, 247, 116, 23, - 198, 87, 231, 252, 161, 153, 191, 71, 118, 157, 95, 235, 158, 243, 252, - 14, 108, 201, 190, 149, 53, 229, 239, 233, 178, 54, 139, 58, 86, 15, - 182, 164, 203, 206, 123, 215, 125, 104, 246, 165, 72, 221, 222, 58, 242, - 247, 116, 117, 103, 60, 44, 126, 243, 13, 91, 114, 124, 192, 189, 127, - 143, 246, 91, 216, 18, 125, 138, 252, 13, 110, 212, 147, 49, 226, 55, - 181, 55, 180, 170, 168, 254, 17, 13, 239, 251, 61, 157, 254, 90, 3, - 249, 123, 186, 174, 39, 164, 111, 160, 97, 75, 124, 87, 221, 187, 110, - 27, 216, 18, 231, 134, 198, 242, 247, 116, 23, 183, 61, 206, 249, 39, - 96, 75, 206, 239, 187, 247, 61, 153, 27, 176, 37, 27, 95, 106, 227, - 249, 187, 145, 7, 197, 189, 233, 153, 89, 117, 163, 118, 159, 12, 188, - 239, 183, 185, 158, 247, 2, 26, 200, 60, 125, 155, 123, 191, 247, 5, - 228, 184, 164, 183, 199, 150, 44, 233, 208, 217, 69, 251, 31, 183, 45, - 113, 243, 189, 246, 206, 137, 240, 228, 87, 142, 247, 225, 192, 27, 17, - 139, 26, 14, 149, 109, 201, 141, 111, 196, 53, 186, 214, 148, 20, 249, - 122, 192, 189, 159, 55, 54, 134, 45, 241, 236, 207, 119, 202, 207, 159, - 187, 194, 150, 220, 107, 127, 238, 182, 37, 221, 236, 93, 100, 91, 178, - 166, 187, 248, 108, 62, 6, 182, 164, 213, 149, 123, 207, 223, 19, 115, - 95, 141, 108, 241, 240, 19, 178, 45, 177, 159, 21, 127, 127, 249, 218, - 83, 71, 34, 223, 253, 236, 222, 191, 43, 190, 43, 175, 36, 242, 229, - 95, 163, 101, 91, 178, 180, 233, 68, 206, 111, 134, 45, 169, 43, 36, - 222, 179, 110, 45, 196, 37, 246, 243, 41, 242, 183, 185, 250, 254, 233, - 156, 95, 128, 184, 228, 139, 245, 247, 254, 174, 119, 29, 246, 56, 199, - 143, 102, 200, 223, 230, 198, 46, 201, 20, 127, 219, 26, 182, 228, 253, - 241, 89, 247, 172, 219, 28, 182, 164, 217, 71, 118, 249, 219, 220, 129, - 210, 247, 196, 97, 176, 37, 173, 76, 150, 123, 214, 157, 10, 91, 18, - 215, 38, 93, 254, 54, 247, 233, 127, 196, 254, 79, 132, 45, 73, 56, - 166, 191, 103, 93, 1, 113, 73, 217, 208, 39, 101, 91, 114, 121, 252, - 4, 206, 111, 192, 30, 39, 197, 112, 239, 239, 107, 207, 195, 150, 20, - 133, 142, 151, 109, 9, 203, 27, 39, 253, 13, 218, 191, 34, 7, 30, - 29, 123, 159, 239, 122, 47, 69, 126, 49, 203, 243, 109, 174, 35, 114, - 140, 108, 75, 182, 84, 27, 125, 159, 118, 111, 70, 46, 125, 211, 243, - 109, 174, 230, 49, 145, 191, 5, 91, 146, 107, 30, 113, 159, 103, 254, - 234, 40, 123, 140, 231, 219, 220, 126, 71, 60, 223, 230, 214, 241, 191, - 119, 221, 198, 176, 37, 166, 215, 61, 223, 230, 126, 48, 72, 252, 54, - 183, 45, 108, 201, 161, 79, 239, 125, 191, 184, 246, 27, 15, 69, 109, - 174, 235, 249, 54, 247, 234, 104, 209, 6, 92, 131, 45, 201, 250, 178, - 167, 112, 191, 184, 196, 243, 222, 71, 3, 153, 63, 2, 91, 114, 191, - 247, 65, 228, 103, 49, 46, 197, 125, 229, 151, 47, 169, 203, 142, 222, - 239, 30, 153, 231, 111, 98, 22, 236, 189, 164, 246, 127, 229, 63, 220, - 87, 222, 171, 184, 31, 187, 87, 113, 143, 108, 207, 131, 123, 22, 227, - 175, 104, 163, 0, 125, 42, 144, 218, 137, 216, 243, 224, 158, 197, 16, - 174, 60, 14, 240, 238, 177, 148, 238, 126, 112, 207, 98, 252, 95, 185, - 227, 190, 178, 52, 191, 241, 187, 31, 220, 179, 24, 154, 247, 7, 249, - 252, 50, 98, 207, 131, 125, 126, 73, 243, 249, 32, 159, 95, 198, 239, - 126, 176, 207, 47, 105, 157, 200, 239, 201, 236, 184, 164, 142, 119, 221, - 111, 205, 120, 254, 38, 102, 60, 173, 177, 93, 255, 225, 190, 242, 203, - 138, 251, 177, 47, 41, 222, 147, 217, 245, 0, 223, 147, 121, 73, 113, - 95, 25, 60, 181, 201, 11, 237, 122, 128, 239, 201, 40, 218, 160, 113, - 187, 199, 178, 124, 231, 3, 124, 79, 102, 215, 29, 247, 149, 165, 54, - 252, 119, 62, 192, 247, 100, 118, 61, 216, 231, 151, 108, 215, 131, 125, - 126, 73, 243, 249, 32, 159, 95, 250, 239, 124, 176, 207, 47, 105, 157, - 200, 207, 98, 182, 66, 15, 94, 190, 207, 154, 81, 252, 77, 76, 127, - 212, 45, 216, 246, 31, 222, 147, 217, 161, 240, 1, 219, 21, 239, 201, - 108, 171, 218, 154, 169, 187, 245, 5, 143, 15, 216, 174, 240, 1, 224, - 169, 77, 30, 77, 190, 88, 181, 53, 115, 230, 141, 30, 30, 95, 166, - 104, 131, 198, 237, 30, 75, 244, 139, 85, 91, 51, 175, 124, 50, 212, - 243, 158, 204, 182, 59, 222, 147, 145, 218, 40, 219, 90, 181, 53, 115, - 179, 105, 19, 207, 123, 50, 219, 238, 254, 173, 42, 205, 169, 155, 191, - 91, 59, 21, 222, 147, 121, 241, 238, 120, 52, 127, 255, 43, 94, 244, - 61, 240, 104, 174, 254, 87, 60, 154, 187, 187, 225, 209, 188, 252, 87, - 60, 57, 54, 219, 170, 136, 205, 54, 65, 15, 118, 220, 111, 205, 40, - 254, 38, 230, 11, 208, 205, 231, 254, 195, 123, 50, 47, 40, 124, 192, - 11, 138, 216, 108, 203, 3, 124, 79, 70, 209, 70, 1, 250, 84, 38, - 181, 19, 177, 229, 1, 198, 102, 207, 41, 214, 37, 120, 247, 88, 74, - 55, 63, 192, 216, 236, 185, 59, 98, 51, 105, 126, 227, 55, 63, 192, - 216, 108, 203, 131, 245, 51, 17, 91, 30, 172, 159, 161, 249, 124, 144, - 126, 38, 126, 243, 131, 245, 51, 180, 78, 228, 216, 108, 61, 244, 96, - 235, 253, 214, 140, 226, 29, 102, 212, 45, 219, 240, 31, 98, 179, 77, - 138, 152, 102, 163, 34, 54, 219, 240, 0, 99, 179, 141, 138, 117, 9, - 158, 218, 228, 133, 54, 60, 192, 216, 76, 209, 6, 141, 219, 61, 150, - 229, 207, 62, 192, 216, 108, 195, 29, 177, 153, 212, 134, 255, 179, 15, - 48, 54, 219, 240, 96, 247, 51, 108, 195, 131, 221, 207, 208, 124, 62, - 200, 253, 140, 255, 179, 15, 118, 63, 67, 235, 68, 254, 59, 178, 107, - 160, 7, 155, 148, 107, 102, 100, 194, 96, 139, 89, 252, 163, 66, 229, - 48, 164, 184, 1, 117, 253, 215, 93, 82, 135, 132, 236, 136, 60, 245, - 94, 97, 228, 160, 200, 22, 111, 164, 188, 59, 61, 114, 100, 212, 29, - 177, 217, 122, 133, 15, 88, 167, 240, 51, 107, 43, 211, 131, 157, 145, - 116, 95, 16, 227, 137, 8, 9, 153, 19, 49, 50, 170, 206, 93, 245, - 128, 202, 200, 62, 96, 157, 194, 7, 128, 167, 54, 185, 159, 249, 79, - 109, 212, 253, 79, 109, 248, 175, 187, 195, 7, 72, 99, 41, 93, 243, - 95, 218, 120, 248, 190, 109, 132, 73, 115, 82, 121, 28, 177, 147, 99, - 121, 120, 69, 237, 218, 140, 245, 97, 3, 65, 189, 42, 238, 207, 31, - 48, 30, 141, 245, 65, 224, 201, 127, 19, 110, 141, 226, 239, 91, 173, - 70, 156, 179, 190, 50, 253, 235, 86, 169, 254, 185, 255, 59, 245, 94, - 154, 235, 212, 123, 173, 162, 94, 25, 168, 115, 92, 238, 176, 73, 112, - 235, 159, 252, 247, 128, 86, 43, 222, 57, 94, 117, 73, 29, 189, 166, - 178, 54, 186, 87, 218, 70, 52, 234, 18, 133, 132, 108, 140, 76, 74, - 122, 44, 106, 214, 230, 199, 93, 205, 110, 132, 71, 220, 169, 227, 84, - 166, 99, 37, 125, 43, 88, 117, 55, 221, 104, 16, 21, 255, 252, 77, - 103, 244, 19, 45, 129, 165, 230, 143, 56, 169, 238, 157, 127, 168, 128, - 174, 83, 27, 217, 18, 86, 91, 94, 146, 177, 17, 193, 214, 72, 186, - 230, 198, 115, 243, 61, 90, 149, 42, 242, 105, 238, 77, 152, 247, 116, - 118, 4, 36, 63, 239, 249, 250, 118, 36, 181, 237, 190, 119, 232, 230, - 211, 108, 157, 162, 60, 249, 140, 141, 81, 53, 97, 31, 131, 242, 107, - 215, 171, 248, 247, 167, 87, 41, 126, 7, 131, 93, 86, 211, 28, 87, - 156, 211, 30, 149, 206, 105, 193, 74, 200, 121, 197, 37, 245, 245, 219, - 125, 143, 222, 186, 221, 176, 111, 243, 211, 239, 149, 140, 57, 181, 88, - 184, 115, 78, 169, 156, 188, 166, 87, 42, 236, 198, 242, 138, 115, 26, - 15, 251, 167, 102, 239, 68, 141, 238, 189, 108, 63, 217, 194, 145, 81, - 143, 242, 217, 84, 87, 50, 167, 116, 93, 94, 211, 138, 54, 168, 79, - 5, 82, 59, 5, 145, 151, 43, 180, 113, 245, 229, 233, 111, 196, 140, - 173, 222, 247, 135, 207, 91, 29, 178, 241, 54, 26, 210, 253, 226, 74, - 219, 232, 168, 90, 32, 255, 22, 18, 225, 150, 219, 111, 73, 109, 228, - 71, 84, 108, 35, 122, 172, 234, 232, 164, 177, 103, 163, 14, 127, 192, - 14, 69, 241, 54, 26, 221, 181, 141, 175, 46, 205, 231, 109, 28, 148, - 230, 164, 173, 84, 38, 111, 253, 51, 111, 184, 247, 26, 241, 252, 44, - 242, 154, 77, 115, 35, 149, 123, 144, 41, 208, 137, 197, 160, 253, 10, - 221, 152, 184, 167, 78, 212, 168, 222, 203, 130, 121, 121, 54, 44, 202, - 93, 118, 92, 199, 167, 165, 185, 149, 246, 24, 172, 9, 243, 133, 110, - 116, 1, 185, 117, 67, 243, 249, 75, 81, 110, 124, 146, 133, 155, 111, - 253, 243, 159, 81, 202, 118, 39, 169, 210, 217, 108, 208, 94, 85, 122, - 185, 152, 240, 130, 52, 239, 109, 249, 136, 193, 103, 213, 56, 170, 156, - 123, 55, 255, 217, 147, 175, 151, 251, 157, 141, 238, 232, 75, 2, 104, - 33, 243, 244, 165, 113, 245, 181, 145, 54, 169, 205, 234, 227, 106, 202, - 237, 23, 239, 24, 24, 245, 216, 109, 207, 179, 177, 67, 24, 251, 55, - 32, 31, 69, 95, 78, 61, 181, 48, 42, 229, 211, 86, 61, 249, 202, - 122, 105, 167, 60, 7, 55, 79, 191, 21, 69, 178, 119, 167, 131, 49, - 246, 88, 80, 158, 98, 14, 118, 205, 249, 67, 110, 139, 116, 197, 205, - 27, 78, 54, 238, 171, 156, 131, 61, 104, 239, 99, 80, 126, 237, 205, - 154, 59, 231, 128, 244, 194, 61, 7, 43, 90, 14, 61, 234, 174, 71, - 186, 225, 230, 183, 213, 157, 247, 134, 18, 47, 191, 118, 38, 95, 231, - 241, 10, 89, 142, 204, 175, 22, 65, 122, 196, 159, 251, 140, 93, 34, - 219, 228, 141, 55, 124, 162, 122, 189, 207, 122, 186, 211, 75, 49, 111, - 175, 130, 190, 84, 204, 95, 113, 108, 116, 212, 12, 105, 158, 198, 142, - 157, 47, 143, 233, 229, 220, 237, 81, 81, 138, 118, 107, 98, 12, 129, - 160, 113, 138, 249, 155, 216, 245, 61, 121, 206, 72, 151, 221, 188, 179, - 89, 141, 190, 74, 185, 205, 197, 188, 189, 12, 250, 76, 49, 127, 242, - 111, 134, 192, 166, 200, 126, 225, 201, 203, 106, 255, 85, 149, 217, 151, - 94, 229, 214, 131, 143, 219, 190, 196, 93, 86, 23, 76, 185, 124, 223, - 184, 132, 202, 201, 246, 37, 206, 179, 22, 3, 167, 92, 126, 96, 113, - 137, 191, 162, 13, 234, 83, 129, 212, 142, 107, 242, 229, 7, 22, 151, - 16, 110, 57, 251, 34, 181, 17, 253, 159, 218, 248, 111, 113, 9, 205, - 137, 55, 126, 191, 51, 187, 8, 218, 87, 241, 126, 206, 228, 7, 139, - 23, 253, 128, 240, 228, 152, 225, 73, 143, 254, 21, 78, 188, 172, 38, - 125, 172, 168, 127, 189, 43, 245, 111, 101, 147, 46, 171, 137, 244, 97, - 31, 189, 81, 248, 193, 180, 190, 47, 233, 222, 61, 90, 250, 217, 236, - 10, 49, 3, 149, 169, 44, 102, 8, 156, 84, 153, 220, 104, 205, 13, - 193, 250, 241, 59, 70, 169, 145, 81, 53, 165, 152, 65, 197, 42, 123, - 129, 218, 29, 51, 16, 150, 59, 102, 248, 117, 220, 202, 163, 31, 60, - 19, 19, 117, 231, 189, 168, 231, 179, 114, 163, 108, 150, 144, 163, 158, - 121, 121, 218, 167, 11, 203, 128, 37, 25, 236, 121, 206, 153, 80, 171, - 239, 91, 3, 79, 72, 101, 60, 253, 56, 242, 232, 162, 190, 127, 183, - 234, 127, 204, 93, 183, 136, 61, 130, 250, 77, 84, 249, 181, 59, 87, - 152, 83, 154, 71, 63, 197, 120, 105, 142, 43, 204, 41, 253, 48, 99, - 37, 115, 26, 136, 186, 68, 73, 73, 117, 223, 56, 245, 222, 151, 81, - 115, 92, 239, 148, 204, 113, 109, 168, 16, 51, 80, 153, 202, 230, 52, - 127, 194, 221, 230, 244, 100, 212, 67, 159, 182, 14, 19, 99, 134, 58, - 119, 141, 195, 168, 140, 123, 78, 9, 203, 61, 167, 71, 91, 212, 61, - 42, 214, 23, 241, 220, 124, 151, 162, 91, 145, 158, 124, 81, 215, 218, - 195, 190, 154, 21, 54, 182, 251, 168, 69, 10, 191, 120, 82, 230, 47, - 204, 175, 81, 206, 87, 156, 96, 70, 86, 71, 101, 228, 24, 110, 121, - 140, 31, 201, 216, 57, 194, 29, 119, 89, 221, 179, 82, 189, 103, 108, - 252, 200, 241, 102, 107, 154, 190, 66, 254, 125, 55, 223, 149, 206, 147, - 39, 142, 112, 231, 157, 122, 175, 105, 228, 255, 0, 34, 173, 65, 75, - 36, 123, 0, 255, 197, 196, 50, 70, 35, 43, 139, 189, 172, 126, 212, - 189, 127, 77, 43, 47, 227, 152, 88, 147, 33, 219, 46, 221, 247, 177, - 228, 192, 9, 103, 219, 69, 157, 242, 151, 203, 104, 164, 186, 129, 152, - 199, 210, 81, 240, 51, 163, 69, 162, 200, 142, 168, 195, 143, 122, 223, - 219, 248, 207, 237, 92, 72, 7, 26, 72, 229, 27, 184, 239, 159, 140, - 21, 219, 181, 160, 126, 23, 156, 237, 125, 205, 38, 119, 57, 186, 230, - 46, 183, 28, 60, 213, 243, 71, 185, 230, 20, 111, 27, 172, 93, 221, - 229, 150, 43, 202, 69, 128, 167, 122, 5, 177, 146, 175, 200, 191, 170, - 118, 151, 139, 80, 148, 187, 16, 115, 89, 77, 245, 10, 163, 47, 171, - 123, 73, 114, 117, 151, 163, 107, 238, 114, 5, 224, 169, 158, 37, 90, - 196, 43, 240, 187, 46, 227, 21, 40, 202, 69, 131, 167, 122, 133, 102, - 248, 78, 242, 237, 58, 15, 94, 180, 162, 28, 3, 79, 245, 162, 205, - 226, 90, 75, 31, 144, 102, 118, 151, 99, 138, 114, 133, 99, 80, 6, - 233, 50, 211, 101, 181, 192, 241, 18, 237, 238, 114, 116, 205, 93, 46, - 30, 60, 213, 179, 160, 92, 232, 29, 227, 136, 87, 148, 243, 3, 79, - 245, 2, 165, 113, 216, 141, 153, 6, 119, 57, 63, 69, 57, 23, 228, - 71, 245, 252, 129, 71, 119, 145, 202, 246, 223, 144, 199, 75, 215, 220, - 229, 44, 224, 169, 158, 43, 93, 92, 207, 86, 131, 65, 150, 155, 69, - 81, 142, 244, 129, 234, 229, 167, 139, 237, 234, 236, 102, 171, 187, 156, - 191, 162, 28, 233, 15, 213, 11, 76, 23, 245, 39, 3, 5, 221, 229, - 232, 90, 3, 165, 143, 70, 185, 11, 146, 190, 54, 104, 249, 23, 239, - 95, 160, 164, 67, 110, 187, 151, 104, 54, 217, 173, 230, 52, 168, 137, - 127, 184, 255, 64, 93, 186, 97, 152, 57, 217, 152, 216, 53, 217, 96, - 239, 155, 97, 181, 26, 76, 164, 103, 82, 129, 14, 29, 217, 53, 142, - 65, 154, 237, 175, 192, 48, 39, 76, 53, 36, 218, 81, 223, 3, 70, - 0, 35, 179, 76, 188, 18, 159, 103, 30, 107, 199, 122, 234, 176, 70, - 183, 60, 191, 211, 27, 237, 201, 55, 38, 249, 119, 48, 153, 237, 254, - 34, 102, 87, 163, 62, 205, 96, 55, 166, 27, 252, 195, 252, 3, 59, - 250, 235, 76, 122, 255, 14, 21, 175, 116, 15, 236, 216, 135, 5, 121, - 218, 177, 40, 240, 152, 164, 135, 180, 187, 39, 157, 115, 231, 183, 174, - 153, 102, 48, 37, 219, 83, 208, 107, 163, 201, 222, 161, 220, 200, 71, - 163, 29, 51, 41, 156, 206, 222, 161, 163, 127, 128, 127, 183, 238, 29, - 253, 59, 249, 119, 231, 248, 157, 73, 79, 21, 56, 164, 111, 36, 3, - 235, 48, 163, 173, 226, 20, 68, 74, 23, 109, 52, 13, 188, 62, 25, - 40, 210, 213, 10, 245, 255, 75, 71, 208, 229, 14, 202, 246, 58, 118, - 100, 242, 61, 74, 37, 166, 7, 68, 167, 215, 147, 109, 202, 52, 184, - 123, 82, 174, 126, 87, 139, 217, 34, 103, 116, 236, 236, 31, 212, 81, - 158, 195, 64, 229, 28, 214, 172, 57, 144, 242, 233, 142, 172, 191, 178, - 157, 36, 116, 27, 213, 209, 113, 127, 37, 108, 31, 198, 124, 169, 124, - 7, 90, 11, 233, 138, 242, 247, 235, 88, 103, 8, 153, 121, 228, 152, - 175, 168, 203, 126, 183, 112, 204, 198, 212, 55, 37, 230, 157, 234, 16, - 238, 223, 165, 107, 47, 15, 134, 91, 255, 57, 6, 214, 158, 219, 166, - 147, 29, 127, 84, 25, 79, 197, 122, 236, 122, 76, 172, 197, 106, 78, - 182, 26, 108, 54, 110, 209, 249, 127, 134, 236, 202, 109, 58, 3, 78, - 160, 17, 235, 86, 34, 249, 94, 193, 175, 149, 219, 116, 42, 47, 219, - 174, 84, 177, 124, 105, 138, 104, 211, 7, 140, 238, 223, 95, 182, 93, - 169, 10, 219, 69, 229, 80, 207, 130, 114, 237, 72, 119, 109, 25, 9, - 178, 237, 82, 148, 243, 3, 79, 245, 2, 83, 68, 92, 37, 158, 159, - 162, 156, 107, 42, 108, 23, 210, 101, 201, 151, 213, 244, 180, 160, 215, - 142, 243, 30, 219, 53, 85, 97, 187, 192, 83, 189, 124, 148, 107, 195, - 202, 143, 195, 162, 40, 231, 15, 158, 234, 249, 163, 92, 39, 242, 51, - 71, 254, 146, 241, 252, 21, 229, 74, 49, 63, 84, 207, 149, 116, 89, - 221, 146, 48, 166, 37, 200, 120, 116, 205, 93, 142, 230, 145, 234, 69, - 160, 92, 228, 29, 237, 230, 43, 202, 209, 188, 83, 189, 50, 195, 101, - 53, 173, 203, 252, 79, 47, 202, 237, 6, 26, 203, 219, 66, 170, 87, - 96, 16, 231, 197, 208, 145, 245, 119, 219, 194, 210, 20, 111, 109, 161, - 216, 39, 210, 113, 139, 2, 35, 221, 150, 108, 51, 152, 108, 124, 61, - 151, 183, 5, 99, 120, 54, 44, 193, 164, 192, 201, 30, 253, 12, 84, - 212, 101, 9, 105, 6, 247, 58, 35, 217, 40, 108, 162, 12, 219, 213, - 104, 139, 54, 219, 140, 180, 114, 58, 192, 234, 245, 113, 247, 33, 95, - 81, 190, 166, 91, 125, 19, 116, 214, 187, 90, 101, 51, 147, 237, 153, - 191, 178, 174, 209, 98, 86, 152, 164, 187, 154, 51, 26, 4, 213, 39, - 189, 32, 121, 202, 245, 211, 209, 174, 46, 217, 96, 67, 101, 79, 167, - 81, 55, 202, 172, 55, 26, 200, 14, 218, 184, 191, 234, 71, 113, 70, - 82, 229, 125, 238, 234, 230, 129, 97, 200, 212, 165, 117, 112, 99, 78, - 34, 3, 232, 78, 116, 244, 239, 226, 31, 52, 153, 204, 98, 80, 96, - 96, 215, 64, 22, 18, 236, 150, 105, 153, 225, 63, 218, 66, 197, 88, - 185, 241, 243, 23, 49, 184, 175, 50, 40, 237, 223, 64, 93, 228, 104, - 233, 158, 36, 242, 103, 223, 37, 22, 142, 28, 29, 105, 77, 215, 217, - 51, 172, 6, 86, 249, 189, 228, 68, 96, 38, 122, 108, 68, 141, 74, - 246, 83, 231, 84, 98, 185, 167, 42, 105, 163, 44, 30, 58, 236, 139, - 53, 100, 72, 203, 52, 218, 238, 30, 183, 6, 238, 90, 223, 54, 117, - 109, 168, 179, 179, 230, 82, 120, 209, 245, 70, 33, 174, 83, 59, 157, - 29, 213, 159, 134, 127, 119, 107, 110, 136, 191, 34, 214, 174, 62, 192, - 207, 57, 99, 90, 71, 231, 160, 128, 117, 65, 119, 143, 197, 239, 164, - 251, 197, 240, 255, 61, 175, 124, 251, 119, 195, 255, 95, 242, 64, 249, - 141, 118, 172, 90, 180, 112, 135, 152, 213, 104, 7, 255, 182, 123, 119, - 173, 246, 92, 140, 51, 223, 219, 182, 232, 102, 189, 246, 238, 250, 183, - 111, 117, 22, 244, 183, 106, 57, 207, 245, 154, 114, 128, 255, 142, 109, - 241, 123, 197, 11, 206, 230, 57, 247, 77, 29, 200, 31, 70, 129, 231, - 121, 241, 185, 81, 7, 40, 189, 31, 249, 224, 67, 220, 245, 231, 247, - 170, 227, 200, 62, 214, 199, 57, 57, 250, 153, 32, 69, 125, 65, 81, - 223, 73, 121, 58, 94, 135, 49, 202, 215, 113, 44, 177, 254, 219, 153, - 198, 146, 155, 69, 95, 56, 116, 51, 23, 239, 119, 223, 47, 38, 249, - 147, 156, 221, 242, 47, 104, 36, 233, 11, 233, 77, 115, 145, 146, 12, - 233, 25, 86, 254, 219, 207, 149, 75, 225, 169, 179, 173, 28, 134, 195, - 9, 66, 187, 227, 9, 206, 55, 162, 38, 10, 79, 47, 109, 20, 177, - 224, 239, 9, 66, 255, 87, 94, 20, 252, 203, 201, 247, 191, 236, 197, - 60, 148, 117, 37, 79, 200, 91, 63, 35, 44, 119, 216, 150, 208, 58, - 3, 87, 85, 248, 38, 241, 173, 27, 121, 66, 236, 191, 77, 67, 115, - 94, 107, 198, 127, 83, 248, 252, 130, 154, 69, 127, 148, 229, 9, 223, - 110, 255, 151, 239, 81, 47, 125, 218, 60, 108, 124, 206, 191, 197, 53, - 190, 201, 187, 171, 252, 124, 74, 134, 5, 46, 174, 111, 32, 55, 199, - 172, 151, 230, 132, 220, 190, 157, 39, 60, 110, 122, 101, 59, 165, 111, - 172, 183, 108, 63, 189, 108, 117, 59, 119, 223, 173, 243, 253, 156, 147, - 158, 232, 232, 12, 88, 184, 52, 152, 255, 78, 242, 247, 121, 194, 251, - 207, 125, 23, 186, 183, 245, 31, 188, 253, 53, 174, 79, 138, 82, 175, - 229, 9, 91, 34, 196, 191, 91, 58, 229, 244, 31, 97, 117, 235, 13, - 45, 30, 247, 173, 216, 254, 204, 97, 29, 132, 195, 25, 53, 156, 151, - 126, 47, 45, 166, 250, 41, 231, 91, 11, 179, 98, 250, 58, 223, 233, - 126, 144, 63, 119, 157, 25, 211, 87, 72, 78, 107, 46, 68, 119, 22, - 248, 223, 65, 14, 236, 113, 48, 188, 119, 103, 65, 123, 107, 230, 116, - 241, 91, 132, 209, 117, 157, 181, 107, 175, 112, 54, 254, 253, 49, 39, - 127, 231, 72, 219, 90, 248, 167, 67, 63, 33, 76, 250, 221, 215, 87, - 127, 136, 114, 234, 178, 155, 10, 13, 119, 79, 230, 223, 213, 168, 78, - 93, 8, 47, 252, 123, 136, 227, 209, 166, 57, 188, 254, 233, 189, 58, - 109, 205, 164, 63, 181, 36, 35, 165, 252, 73, 198, 119, 174, 127, 210, - 137, 178, 199, 69, 178, 27, 19, 140, 186, 123, 200, 127, 212, 190, 20, - 167, 50, 61, 200, 254, 137, 243, 85, 91, 35, 87, 201, 71, 26, 109, - 96, 21, 228, 95, 107, 82, 158, 80, 20, 147, 20, 246, 89, 221, 209, - 225, 241, 45, 34, 42, 252, 14, 245, 111, 243, 102, 9, 207, 238, 45, - 46, 249, 163, 207, 199, 252, 218, 242, 117, 71, 195, 143, 28, 207, 21, - 26, 143, 119, 240, 249, 127, 248, 227, 247, 195, 223, 92, 93, 189, 36, - 126, 73, 110, 165, 242, 127, 21, 178, 122, 161, 109, 92, 88, 64, 73, - 71, 254, 119, 16, 142, 55, 138, 43, 254, 22, 121, 79, 157, 121, 129, - 235, 90, 241, 199, 1, 161, 191, 133, 108, 57, 82, 44, 221, 51, 182, - 65, 254, 19, 32, 255, 67, 171, 79, 115, 249, 231, 159, 201, 21, 190, - 251, 250, 195, 226, 243, 175, 23, 241, 249, 47, 219, 114, 61, 172, 235, - 220, 60, 97, 93, 196, 68, 222, 159, 212, 85, 135, 75, 166, 59, 245, - 225, 27, 150, 138, 237, 151, 254, 222, 93, 120, 234, 201, 64, 231, 245, - 23, 63, 210, 82, 253, 219, 39, 78, 59, 110, 142, 159, 171, 61, 49, - 35, 142, 95, 247, 141, 157, 235, 200, 251, 217, 230, 188, 101, 111, 205, - 229, 247, 22, 242, 27, 102, 180, 118, 104, 174, 159, 229, 233, 216, 189, - 7, 157, 135, 178, 7, 70, 244, 8, 201, 228, 243, 243, 126, 219, 219, - 142, 47, 141, 67, 29, 1, 181, 196, 191, 27, 86, 54, 37, 91, 91, - 52, 53, 203, 25, 187, 122, 55, 111, 255, 135, 71, 199, 10, 27, 54, - 180, 211, 46, 126, 94, 252, 27, 133, 243, 71, 158, 112, 142, 207, 186, - 40, 60, 252, 204, 158, 114, 242, 39, 25, 87, 176, 255, 208, 9, 87, - 19, 145, 236, 58, 171, 45, 195, 118, 119, 5, 120, 183, 172, 188, 108, - 51, 191, 73, 20, 246, 143, 252, 218, 17, 252, 79, 161, 179, 42, 242, - 127, 228, 201, 92, 225, 211, 14, 223, 133, 31, 249, 243, 163, 226, 78, - 105, 5, 21, 190, 89, 189, 188, 45, 79, 88, 217, 239, 233, 208, 252, - 155, 99, 249, 252, 31, 109, 63, 179, 120, 205, 123, 57, 194, 212, 140, - 56, 62, 95, 151, 59, 13, 47, 89, 127, 45, 206, 113, 58, 59, 167, - 82, 249, 127, 254, 111, 158, 16, 242, 113, 199, 176, 192, 182, 226, 223, - 53, 15, 110, 31, 80, 124, 10, 121, 227, 15, 175, 228, 233, 238, 91, - 150, 134, 78, 237, 190, 58, 244, 208, 45, 81, 254, 118, 200, 255, 73, - 200, 63, 215, 62, 128, 219, 228, 169, 103, 103, 9, 62, 207, 44, 60, - 242, 203, 0, 53, 95, 175, 103, 38, 143, 236, 243, 41, 116, 37, 39, - 189, 6, 175, 111, 30, 168, 214, 142, 59, 194, 66, 71, 160, 28, 165, - 243, 98, 125, 4, 253, 194, 199, 157, 77, 62, 248, 52, 156, 234, 127, - 220, 249, 159, 162, 134, 183, 102, 57, 35, 231, 222, 230, 253, 111, 124, - 107, 150, 208, 107, 75, 81, 241, 184, 173, 255, 114, 249, 69, 35, 127, - 228, 214, 127, 195, 147, 107, 205, 20, 255, 78, 96, 239, 1, 218, 14, - 167, 223, 118, 46, 233, 16, 192, 215, 127, 191, 143, 27, 133, 205, 169, - 155, 43, 188, 215, 238, 95, 94, 127, 234, 159, 89, 206, 233, 77, 247, - 21, 23, 53, 201, 21, 191, 171, 251, 33, 87, 251, 231, 197, 43, 37, - 89, 183, 197, 111, 117, 246, 236, 141, 117, 198, 214, 154, 234, 140, 30, - 188, 180, 156, 252, 73, 198, 21, 214, 255, 227, 158, 184, 33, 221, 96, - 215, 221, 75, 7, 198, 76, 31, 95, 206, 54, 135, 60, 187, 175, 232, - 106, 114, 154, 112, 173, 112, 227, 225, 170, 200, 63, 246, 143, 60, 225, - 192, 183, 142, 176, 159, 230, 158, 61, 242, 244, 250, 205, 21, 254, 246, - 252, 98, 216, 127, 237, 185, 230, 197, 91, 142, 61, 201, 117, 227, 227, - 46, 77, 195, 62, 120, 53, 79, 248, 237, 7, 45, 159, 143, 207, 90, - 79, 47, 218, 229, 212, 150, 164, 30, 174, 220, 254, 175, 2, 126, 135, - 178, 162, 176, 173, 143, 28, 231, 216, 171, 125, 138, 139, 179, 254, 204, - 19, 222, 60, 216, 139, 167, 63, 251, 245, 104, 232, 143, 7, 34, 67, - 151, 42, 228, 63, 25, 242, 143, 121, 242, 5, 46, 127, 225, 209, 153, - 66, 167, 201, 47, 21, 13, 153, 28, 204, 229, 63, 122, 194, 142, 208, - 166, 144, 191, 186, 78, 62, 255, 219, 214, 53, 167, 4, 107, 223, 250, - 119, 93, 175, 230, 13, 69, 249, 189, 122, 235, 71, 237, 135, 73, 205, - 157, 154, 109, 245, 74, 168, 126, 157, 78, 147, 138, 223, 184, 62, 203, - 185, 59, 70, 148, 255, 209, 235, 179, 132, 126, 97, 103, 139, 127, 188, - 122, 141, 203, 255, 125, 228, 159, 186, 122, 45, 252, 237, 250, 98, 253, - 29, 13, 67, 180, 7, 79, 142, 114, 77, 13, 20, 229, 111, 99, 113, - 97, 181, 110, 207, 18, 52, 61, 111, 137, 223, 223, 23, 218, 157, 155, - 126, 113, 21, 31, 243, 21, 191, 213, 28, 56, 113, 173, 54, 171, 221, - 191, 37, 191, 21, 138, 223, 88, 69, 47, 110, 225, 10, 180, 219, 156, - 173, 6, 191, 89, 78, 254, 228, 243, 101, 255, 143, 120, 143, 108, 63, - 249, 255, 252, 71, 69, 74, 203, 72, 71, 148, 124, 119, 233, 149, 212, - 83, 239, 223, 51, 254, 160, 176, 114, 197, 51, 206, 153, 191, 6, 29, - 200, 107, 60, 34, 98, 241, 212, 83, 66, 88, 244, 187, 7, 170, 226, - 255, 87, 118, 158, 42, 124, 25, 215, 36, 120, 193, 184, 25, 129, 127, - 127, 253, 190, 227, 206, 90, 213, 83, 59, 11, 63, 246, 9, 119, 246, - 220, 211, 152, 63, 195, 5, 47, 80, 222, 188, 191, 159, 230, 207, 122, - 89, 146, 99, 95, 243, 109, 43, 247, 223, 43, 126, 171, 138, 255, 175, - 38, 181, 255, 113, 168, 150, 199, 107, 63, 160, 125, 202, 91, 60, 198, - 143, 167, 55, 189, 63, 53, 228, 231, 109, 93, 228, 246, 143, 109, 174, - 237, 124, 111, 167, 221, 241, 89, 255, 65, 60, 239, 37, 75, 77, 33, - 228, 250, 120, 231, 230, 106, 223, 240, 254, 6, 95, 31, 207, 243, 28, - 189, 135, 240, 250, 43, 144, 239, 236, 61, 68, 142, 255, 190, 14, 95, - 237, 252, 66, 55, 207, 153, 241, 115, 79, 158, 183, 188, 199, 76, 33, - 105, 250, 19, 218, 41, 111, 126, 199, 199, 15, 222, 65, 121, 95, 108, - 94, 202, 227, 63, 87, 35, 255, 144, 87, 63, 153, 45, 199, 127, 35, - 62, 255, 72, 27, 109, 202, 21, 126, 202, 157, 93, 46, 254, 35, 25, - 223, 185, 254, 73, 39, 226, 31, 193, 158, 184, 37, 236, 127, 138, 217, - 170, 203, 190, 187, 244, 156, 198, 191, 130, 149, 233, 182, 157, 71, 185, - 242, 190, 31, 37, 36, 58, 84, 221, 170, 178, 254, 247, 27, 115, 133, - 143, 191, 53, 5, 182, 60, 250, 217, 62, 195, 254, 31, 42, 248, 255, - 15, 95, 206, 17, 52, 131, 19, 28, 66, 227, 24, 241, 217, 254, 224, - 4, 45, 229, 253, 213, 104, 60, 223, 95, 92, 41, 154, 184, 223, 47, - 105, 255, 222, 123, 201, 191, 237, 158, 181, 251, 191, 217, 247, 12, 151, - 255, 51, 127, 157, 15, 185, 5, 249, 151, 188, 60, 142, 199, 243, 7, - 223, 89, 221, 62, 99, 211, 79, 219, 220, 245, 237, 119, 200, 127, 215, - 158, 27, 218, 144, 29, 83, 156, 95, 204, 24, 207, 229, 21, 188, 99, - 138, 176, 3, 121, 143, 221, 28, 198, 211, 175, 69, 47, 13, 105, 156, - 191, 91, 150, 127, 55, 253, 81, 231, 130, 103, 91, 151, 172, 47, 88, - 201, 235, 151, 212, 10, 116, 62, 246, 85, 111, 103, 151, 199, 167, 112, - 121, 53, 249, 170, 55, 207, 251, 163, 145, 147, 203, 179, 3, 242, 47, - 53, 114, 6, 187, 235, 127, 174, 95, 234, 234, 49, 244, 185, 240, 131, - 97, 237, 185, 252, 23, 45, 92, 163, 93, 112, 198, 46, 212, 206, 154, - 44, 198, 255, 103, 236, 78, 202, 91, 59, 253, 77, 158, 238, 188, 114, - 99, 200, 191, 131, 183, 202, 242, 63, 211, 178, 129, 163, 125, 215, 121, - 17, 227, 132, 241, 221, 148, 242, 39, 57, 187, 229, 239, 234, 40, 218, - 125, 210, 137, 136, 122, 34, 233, 236, 105, 186, 123, 108, 255, 216, 83, - 155, 26, 29, 80, 166, 187, 12, 91, 44, 52, 125, 183, 179, 179, 253, - 137, 54, 251, 171, 34, 255, 146, 183, 146, 133, 192, 234, 170, 160, 245, - 151, 158, 219, 31, 158, 80, 241, 239, 101, 183, 63, 216, 90, 136, 252, - 176, 159, 144, 180, 187, 17, 31, 47, 120, 103, 7, 228, 229, 71, 140, - 229, 243, 103, 186, 94, 243, 64, 89, 141, 109, 247, 92, 255, 243, 158, - 154, 127, 32, 105, 72, 14, 223, 175, 253, 118, 244, 26, 151, 255, 180, - 35, 121, 92, 254, 143, 143, 89, 214, 254, 177, 160, 239, 183, 187, 235, - 103, 72, 246, 223, 45, 255, 224, 171, 51, 132, 53, 55, 187, 57, 222, - 188, 50, 128, 183, 183, 238, 102, 55, 109, 8, 242, 22, 22, 205, 221, - 71, 233, 15, 150, 143, 12, 62, 19, 122, 49, 80, 126, 111, 229, 208, - 111, 194, 194, 183, 163, 35, 150, 111, 28, 192, 231, 191, 218, 202, 233, - 194, 198, 183, 70, 57, 90, 14, 12, 226, 250, 10, 94, 75, 121, 125, - 30, 58, 195, 241, 26, 15, 8, 10, 138, 124, 232, 140, 44, 255, 190, - 79, 190, 24, 177, 167, 186, 143, 235, 250, 121, 235, 65, 254, 27, 103, - 63, 229, 9, 199, 159, 253, 61, 108, 105, 245, 54, 188, 252, 158, 103, - 127, 47, 110, 129, 188, 203, 23, 222, 230, 235, 97, 196, 188, 39, 130, - 243, 102, 191, 37, 143, 63, 108, 246, 120, 87, 183, 221, 219, 34, 102, - 173, 168, 209, 93, 41, 127, 146, 241, 157, 235, 159, 116, 130, 117, 133, - 47, 232, 116, 89, 157, 104, 213, 153, 140, 25, 233, 119, 149, 222, 199, - 95, 110, 47, 183, 254, 87, 92, 171, 235, 154, 122, 161, 141, 163, 81, - 204, 233, 144, 160, 42, 200, 191, 65, 96, 174, 240, 237, 41, 159, 32, - 117, 215, 87, 246, 173, 139, 248, 187, 194, 250, 255, 225, 68, 182, 112, - 124, 254, 52, 199, 240, 135, 219, 242, 246, 193, 107, 41, 111, 83, 248, - 30, 222, 108, 234, 39, 221, 246, 63, 123, 173, 219, 190, 123, 201, 255, - 236, 69, 159, 131, 61, 95, 81, 117, 224, 254, 243, 171, 91, 92, 254, - 57, 230, 28, 46, 255, 14, 215, 78, 181, 27, 21, 249, 240, 54, 165, - 252, 167, 64, 254, 237, 37, 249, 251, 6, 78, 21, 6, 190, 255, 190, - 99, 97, 193, 87, 124, 254, 7, 191, 255, 190, 182, 6, 242, 22, 12, - 136, 230, 233, 254, 63, 254, 29, 60, 224, 157, 126, 178, 252, 141, 49, - 105, 194, 213, 205, 190, 17, 99, 206, 104, 184, 252, 227, 119, 46, 118, - 76, 109, 151, 233, 28, 58, 74, 199, 245, 23, 188, 160, 67, 222, 47, - 255, 116, 228, 235, 169, 43, 242, 235, 95, 234, 40, 219, 255, 228, 220, - 116, 215, 75, 189, 55, 185, 244, 225, 111, 242, 188, 63, 38, 212, 214, - 62, 181, 102, 150, 176, 117, 233, 112, 94, 31, 188, 243, 119, 228, 77, - 12, 88, 193, 211, 19, 95, 125, 42, 228, 81, 163, 77, 94, 255, 221, - 191, 153, 224, 250, 233, 179, 247, 35, 234, 236, 243, 43, 39, 127, 146, - 179, 91, 254, 36, 111, 254, 96, 179, 158, 39, 254, 51, 232, 238, 181, - 251, 135, 93, 58, 107, 117, 142, 239, 151, 42, 248, 133, 62, 234, 26, - 54, 113, 154, 246, 242, 51, 231, 132, 13, 213, 159, 117, 77, 157, 60, - 188, 74, 251, 127, 253, 190, 9, 130, 163, 251, 92, 173, 235, 72, 92, - 88, 239, 173, 191, 87, 88, 255, 29, 227, 27, 8, 45, 198, 14, 22, - 222, 95, 57, 145, 95, 59, 126, 184, 191, 179, 120, 23, 98, 172, 168, - 95, 120, 122, 90, 189, 167, 181, 95, 78, 251, 194, 113, 250, 216, 228, - 74, 229, 79, 190, 222, 241, 250, 207, 7, 146, 230, 95, 228, 235, 191, - 52, 183, 54, 151, 255, 63, 239, 214, 221, 201, 159, 81, 175, 63, 187, - 61, 186, 197, 107, 173, 220, 125, 207, 148, 226, 255, 118, 146, 252, 135, - 180, 15, 22, 186, 133, 191, 167, 205, 252, 70, 252, 221, 133, 191, 67, - 46, 58, 182, 172, 209, 9, 218, 113, 173, 74, 196, 87, 163, 31, 114, - 198, 254, 246, 148, 35, 189, 241, 112, 209, 254, 206, 243, 143, 232, 209, - 184, 44, 98, 212, 154, 212, 8, 170, 191, 239, 100, 83, 225, 208, 250, - 65, 194, 178, 154, 103, 120, 249, 215, 215, 15, 114, 30, 89, 241, 168, - 16, 17, 23, 203, 99, 157, 213, 200, 143, 140, 139, 213, 214, 122, 59, - 155, 215, 95, 180, 241, 104, 68, 151, 209, 93, 35, 6, 60, 218, 219, - 65, 245, 59, 52, 157, 40, 156, 248, 250, 140, 227, 131, 1, 5, 124, - 188, 113, 253, 90, 104, 95, 105, 52, 64, 40, 12, 18, 255, 22, 251, - 200, 75, 183, 29, 115, 254, 248, 203, 177, 126, 134, 248, 219, 38, 193, - 215, 135, 186, 218, 174, 58, 27, 97, 131, 140, 202, 237, 255, 58, 221, - 177, 254, 187, 138, 118, 95, 41, 127, 254, 117, 193, 93, 164, 183, 240, - 172, 85, 24, 35, 201, 191, 197, 196, 105, 142, 127, 32, 255, 141, 144, - 127, 167, 201, 195, 157, 85, 145, 255, 218, 135, 210, 132, 86, 101, 103, - 74, 142, 95, 111, 81, 210, 240, 72, 73, 5, 249, 255, 242, 91, 47, - 97, 110, 141, 32, 129, 125, 83, 196, 227, 245, 1, 103, 58, 59, 111, - 213, 237, 38, 108, 62, 150, 200, 231, 175, 40, 190, 137, 35, 121, 70, - 7, 109, 208, 154, 156, 255, 23, 249, 159, 242, 77, 17, 54, 140, 217, - 168, 93, 182, 120, 45, 111, 239, 235, 126, 91, 29, 251, 158, 183, 10, - 134, 79, 183, 243, 254, 204, 254, 105, 137, 118, 222, 140, 183, 195, 47, - 238, 17, 127, 239, 224, 243, 118, 195, 35, 142, 245, 63, 17, 241, 221, - 236, 175, 156, 110, 249, 67, 230, 66, 147, 154, 103, 194, 221, 242, 119, - 66, 254, 117, 33, 115, 73, 254, 225, 127, 79, 137, 117, 60, 44, 201, - 127, 161, 36, 255, 160, 6, 189, 185, 252, 108, 51, 199, 10, 223, 159, - 171, 229, 156, 230, 183, 137, 235, 143, 61, 242, 79, 237, 207, 67, 250, - 11, 195, 126, 252, 134, 247, 231, 237, 159, 214, 105, 83, 15, 239, 208, - 134, 189, 40, 254, 29, 245, 16, 73, 254, 87, 39, 76, 115, 148, 219, - 255, 117, 244, 200, 159, 226, 61, 178, 253, 228, 255, 11, 218, 139, 148, - 146, 145, 110, 176, 222, 227, 6, 192, 243, 75, 155, 105, 219, 212, 140, - 208, 126, 54, 251, 140, 227, 215, 69, 42, 33, 254, 212, 10, 103, 173, - 183, 222, 114, 54, 94, 212, 176, 74, 235, 255, 221, 14, 121, 194, 163, - 143, 116, 9, 63, 243, 73, 215, 146, 250, 182, 41, 21, 190, 77, 216, - 176, 116, 150, 240, 121, 204, 153, 240, 86, 187, 14, 241, 107, 67, 30, - 255, 169, 36, 113, 213, 44, 225, 140, 90, 252, 61, 180, 181, 95, 189, - 88, 50, 142, 189, 86, 210, 185, 125, 238, 255, 139, 255, 31, 16, 215, - 64, 88, 116, 100, 164, 51, 237, 134, 248, 183, 129, 198, 78, 142, 22, - 206, 235, 235, 11, 62, 215, 63, 228, 242, 184, 181, 189, 77, 248, 57, - 223, 43, 225, 109, 206, 137, 251, 127, 219, 95, 249, 206, 122, 199, 223, - 10, 79, 109, 92, 139, 183, 93, 237, 246, 59, 37, 127, 233, 115, 5, - 237, 195, 49, 188, 252, 69, 125, 174, 115, 217, 205, 15, 74, 86, 188, - 46, 240, 180, 6, 249, 167, 95, 23, 194, 159, 136, 23, 247, 159, 253, - 78, 36, 8, 231, 114, 95, 142, 24, 155, 213, 131, 235, 79, 205, 97, - 83, 156, 218, 171, 55, 28, 219, 236, 226, 223, 169, 9, 155, 119, 83, - 251, 240, 231, 147, 156, 53, 14, 85, 231, 250, 99, 76, 249, 169, 248, - 213, 143, 30, 210, 86, 91, 40, 182, 255, 246, 164, 62, 174, 134, 121, - 59, 34, 46, 44, 82, 149, 223, 255, 181, 175, 232, 255, 73, 39, 242, - 219, 138, 36, 255, 233, 191, 187, 72, 239, 155, 243, 189, 202, 173, 205, - 167, 223, 93, 34, 124, 121, 125, 155, 243, 165, 182, 230, 226, 170, 196, - 127, 113, 65, 86, 225, 151, 220, 212, 18, 77, 233, 185, 34, 207, 223, - 22, 245, 252, 231, 251, 207, 80, 33, 118, 211, 99, 194, 174, 176, 98, - 126, 255, 53, 237, 137, 199, 156, 155, 6, 15, 17, 190, 233, 243, 43, - 159, 191, 153, 173, 71, 148, 252, 56, 233, 147, 240, 31, 6, 86, 46, - 255, 193, 123, 243, 132, 179, 154, 161, 37, 87, 122, 55, 224, 247, 15, - 14, 223, 28, 18, 30, 134, 188, 165, 19, 58, 243, 116, 155, 181, 77, - 139, 122, 191, 211, 166, 104, 243, 237, 242, 247, 127, 154, 117, 152, 207, - 253, 239, 129, 134, 25, 194, 128, 177, 171, 28, 131, 227, 223, 227, 247, - 27, 99, 102, 172, 210, 14, 251, 118, 154, 112, 234, 84, 11, 190, 254, - 222, 61, 249, 74, 216, 141, 9, 254, 218, 196, 147, 226, 254, 125, 123, - 181, 233, 66, 204, 107, 197, 130, 240, 227, 215, 124, 253, 38, 159, 172, - 227, 220, 120, 114, 148, 243, 234, 149, 134, 188, 60, 120, 161, 245, 228, - 122, 206, 129, 97, 226, 119, 61, 223, 35, 127, 107, 216, 115, 37, 145, - 169, 98, 253, 239, 198, 244, 116, 125, 58, 236, 33, 215, 187, 87, 215, - 115, 249, 191, 17, 186, 222, 145, 219, 216, 40, 12, 104, 184, 138, 215, - 95, 222, 218, 230, 60, 214, 181, 192, 241, 237, 141, 218, 124, 62, 158, - 110, 118, 178, 164, 87, 226, 34, 237, 185, 96, 241, 254, 207, 224, 143, - 213, 174, 55, 246, 154, 34, 134, 44, 13, 43, 39, 127, 146, 113, 133, - 253, 31, 116, 34, 190, 181, 72, 137, 58, 171, 229, 94, 247, 255, 22, - 213, 74, 40, 247, 55, 253, 74, 130, 190, 42, 73, 77, 154, 44, 236, - 122, 101, 93, 81, 85, 228, 159, 154, 169, 19, 90, 255, 88, 219, 113, - 99, 196, 172, 146, 53, 223, 253, 84, 65, 254, 53, 62, 110, 40, 124, - 87, 58, 66, 248, 108, 158, 153, 183, 63, 250, 177, 1, 206, 26, 141, - 31, 22, 22, 205, 93, 207, 231, 163, 186, 159, 201, 177, 125, 184, 160, - 77, 157, 96, 175, 84, 254, 191, 221, 202, 19, 78, 207, 254, 179, 79, - 235, 81, 7, 185, 188, 63, 252, 229, 183, 35, 203, 144, 247, 221, 199, - 165, 220, 126, 63, 180, 239, 96, 209, 149, 167, 74, 67, 247, 222, 204, - 147, 215, 63, 237, 255, 38, 249, 110, 230, 235, 127, 238, 182, 1, 194, - 236, 204, 150, 194, 249, 159, 235, 115, 249, 191, 100, 110, 233, 28, 191, - 115, 128, 240, 183, 185, 63, 239, 207, 67, 243, 76, 197, 135, 250, 90, - 67, 55, 95, 117, 235, 207, 54, 237, 249, 157, 199, 34, 86, 175, 45, - 224, 242, 143, 107, 216, 222, 153, 51, 83, 235, 60, 236, 91, 159, 247, - 55, 123, 166, 86, 56, 29, 22, 224, 236, 149, 43, 254, 190, 228, 243, - 200, 223, 156, 59, 167, 100, 249, 231, 162, 252, 173, 51, 198, 186, 182, - 47, 156, 226, 186, 249, 236, 26, 46, 255, 157, 218, 28, 167, 16, 220, - 81, 251, 72, 96, 75, 94, 127, 199, 55, 254, 142, 219, 35, 102, 58, - 7, 21, 229, 115, 253, 223, 157, 215, 209, 241, 176, 238, 209, 18, 215, - 80, 177, 254, 197, 188, 169, 174, 105, 11, 135, 69, 216, 222, 235, 85, - 78, 254, 36, 227, 59, 229, 79, 58, 161, 188, 255, 119, 47, 29, 48, - 15, 105, 85, 46, 54, 111, 38, 172, 211, 94, 57, 244, 169, 54, 243, - 183, 86, 225, 85, 145, 255, 208, 244, 56, 97, 254, 38, 75, 201, 198, - 73, 133, 197, 197, 223, 92, 169, 32, 255, 236, 99, 190, 194, 134, 235, - 177, 194, 210, 199, 182, 240, 249, 110, 180, 119, 188, 243, 92, 104, 117, - 97, 254, 222, 27, 188, 63, 71, 166, 189, 81, 178, 121, 196, 142, 240, - 75, 183, 102, 85, 42, 255, 244, 75, 121, 194, 51, 126, 179, 194, 14, - 165, 54, 228, 242, 27, 53, 104, 102, 241, 232, 43, 121, 66, 219, 218, - 187, 185, 252, 183, 30, 105, 84, 252, 100, 226, 142, 208, 241, 55, 242, - 100, 255, 79, 242, 79, 110, 178, 147, 203, 127, 195, 19, 213, 29, 147, - 215, 205, 18, 84, 133, 226, 239, 252, 249, 174, 152, 229, 212, 135, 251, - 56, 246, 86, 143, 226, 237, 255, 58, 170, 83, 73, 220, 170, 222, 37, - 131, 231, 136, 245, 55, 60, 182, 209, 53, 242, 179, 235, 17, 93, 234, - 254, 197, 229, 223, 102, 255, 215, 37, 175, 255, 51, 203, 121, 113, 222, - 92, 94, 254, 240, 63, 179, 132, 78, 230, 159, 74, 34, 34, 211, 57, - 222, 5, 228, 15, 139, 76, 47, 137, 171, 33, 233, 207, 165, 25, 14, - 199, 234, 125, 174, 175, 98, 195, 185, 252, 15, 246, 204, 114, 110, 190, - 145, 238, 112, 245, 253, 131, 215, 255, 176, 87, 142, 246, 187, 192, 44, - 103, 108, 81, 17, 79, 107, 179, 95, 47, 153, 81, 243, 124, 201, 239, - 129, 226, 248, 219, 246, 181, 185, 236, 203, 31, 141, 24, 115, 34, 160, - 156, 252, 201, 231, 43, 229, 207, 109, 63, 252, 63, 171, 43, 146, 219, - 255, 223, 45, 6, 12, 92, 218, 204, 209, 14, 254, 255, 75, 248, 255, - 111, 23, 169, 156, 211, 225, 255, 175, 158, 120, 203, 121, 125, 97, 195, - 42, 197, 127, 111, 189, 158, 43, 188, 235, 95, 86, 124, 114, 113, 181, - 162, 63, 67, 222, 172, 176, 255, 203, 30, 54, 67, 216, 221, 180, 175, - 99, 109, 76, 99, 46, 191, 214, 227, 251, 106, 127, 249, 125, 186, 240, - 166, 113, 50, 47, 251, 227, 178, 141, 125, 54, 108, 138, 15, 143, 221, - 156, 247, 255, 226, 255, 19, 14, 63, 175, 221, 247, 156, 213, 25, 61, - 169, 39, 111, 239, 157, 247, 172, 194, 138, 118, 47, 104, 125, 30, 142, - 225, 250, 184, 163, 224, 179, 176, 30, 29, 154, 149, 148, 74, 247, 159, - 215, 143, 106, 237, 10, 142, 74, 114, 148, 254, 22, 199, 227, 175, 193, - 236, 221, 146, 63, 224, 255, 247, 213, 141, 225, 242, 254, 19, 254, 255, - 244, 173, 15, 74, 246, 189, 46, 254, 214, 104, 208, 195, 49, 225, 109, - 16, 11, 184, 253, 255, 212, 227, 9, 194, 69, 248, 255, 71, 178, 122, - 240, 190, 215, 184, 152, 237, 220, 253, 152, 222, 113, 114, 188, 248, 155, - 178, 195, 103, 79, 214, 142, 41, 203, 118, 118, 237, 116, 152, 247, 103, - 152, 121, 127, 120, 237, 185, 171, 75, 86, 79, 200, 45, 231, 255, 63, - 133, 140, 202, 237, 255, 234, 86, 92, 255, 164, 19, 101, 181, 68, 242, - 124, 94, 92, 185, 244, 126, 56, 223, 171, 220, 189, 217, 121, 240, 255, - 191, 193, 255, 191, 208, 198, 28, 86, 149, 245, 79, 191, 49, 64, 191, - 171, 64, 191, 133, 176, 71, 254, 253, 2, 197, 254, 47, 236, 25, 199, - 173, 173, 25, 194, 51, 123, 215, 240, 241, 183, 211, 88, 157, 246, 29, - 203, 28, 183, 124, 3, 184, 173, 136, 110, 215, 75, 251, 79, 179, 55, - 139, 115, 92, 51, 42, 149, 127, 14, 124, 253, 190, 189, 67, 74, 138, - 63, 13, 228, 235, 253, 88, 225, 144, 240, 125, 200, 235, 21, 250, 60, - 127, 9, 254, 155, 130, 39, 66, 187, 213, 254, 229, 245, 163, 119, 248, - 255, 230, 87, 231, 114, 255, 255, 254, 135, 163, 132, 184, 106, 245, 132, - 38, 250, 189, 188, 253, 147, 49, 245, 157, 41, 171, 71, 9, 173, 84, - 9, 60, 109, 110, 219, 162, 36, 242, 91, 87, 137, 207, 203, 226, 252, - 127, 60, 110, 174, 176, 117, 198, 178, 136, 192, 143, 252, 249, 250, 15, - 135, 255, 63, 12, 255, 127, 252, 74, 67, 222, 95, 240, 194, 213, 39, - 235, 57, 11, 224, 243, 249, 243, 7, 228, 79, 68, 44, 16, 37, 249, - 255, 195, 240, 255, 53, 134, 63, 228, 218, 113, 117, 61, 159, 31, 223, - 181, 233, 206, 88, 199, 94, 109, 171, 223, 31, 225, 245, 181, 194, 1, - 71, 187, 195, 102, 231, 228, 139, 199, 185, 254, 189, 173, 81, 107, 19, - 114, 215, 148, 76, 8, 23, 215, 255, 166, 38, 173, 92, 198, 171, 186, - 136, 172, 239, 58, 150, 147, 63, 201, 184, 194, 243, 63, 232, 132, 171, - 166, 72, 146, 237, 191, 171, 6, 188, 241, 80, 66, 185, 223, 248, 60, - 6, 255, 63, 13, 254, 63, 106, 239, 186, 208, 170, 200, 127, 78, 74, - 158, 48, 170, 254, 229, 176, 236, 232, 99, 71, 154, 172, 207, 169, 16, - 255, 107, 154, 228, 10, 89, 159, 92, 13, 183, 39, 126, 206, 253, 247, - 216, 144, 107, 37, 15, 109, 157, 37, 12, 60, 106, 231, 101, 179, 187, - 117, 235, 211, 82, 200, 44, 177, 46, 172, 124, 253, 239, 129, 175, 255, - 125, 73, 73, 159, 152, 132, 119, 184, 252, 155, 156, 124, 237, 200, 115, - 240, 245, 135, 254, 173, 193, 199, 51, 244, 196, 59, 161, 191, 159, 169, - 81, 108, 187, 225, 121, 254, 75, 235, 127, 89, 207, 5, 92, 254, 198, - 213, 225, 194, 165, 57, 157, 132, 214, 22, 241, 249, 227, 222, 191, 59, - 57, 63, 156, 31, 46, 52, 123, 237, 11, 94, 255, 197, 167, 118, 21, - 151, 196, 198, 151, 172, 88, 38, 214, 15, 233, 219, 69, 72, 101, 207, - 71, 212, 46, 91, 212, 155, 234, 247, 134, 255, 223, 8, 255, 191, 202, - 183, 62, 151, 31, 120, 225, 37, 248, 255, 2, 248, 124, 30, 131, 33, - 95, 143, 88, 96, 153, 228, 255, 135, 195, 255, 127, 7, 255, 95, 246, - 236, 26, 62, 63, 61, 45, 51, 157, 51, 119, 125, 22, 62, 127, 168, - 134, 215, 79, 202, 250, 172, 68, 181, 44, 215, 217, 242, 214, 21, 62, - 31, 1, 241, 26, 109, 143, 133, 111, 21, 117, 254, 78, 148, 191, 49, - 122, 144, 235, 214, 156, 43, 66, 164, 169, 91, 57, 249, 147, 140, 43, - 60, 255, 171, 85, 169, 255, 175, 84, 7, 94, 30, 210, 170, 156, 108, - 90, 194, 255, 255, 9, 255, 63, 250, 183, 86, 37, 85, 145, 127, 226, - 249, 4, 33, 187, 231, 248, 240, 210, 35, 89, 97, 187, 135, 156, 173, - 224, 255, 255, 114, 61, 34, 60, 114, 35, 90, 40, 85, 23, 242, 249, - 254, 160, 83, 180, 179, 78, 70, 125, 33, 90, 251, 37, 239, 207, 205, - 83, 207, 134, 251, 143, 126, 161, 164, 115, 118, 229, 241, 127, 236, 229, - 60, 97, 248, 134, 252, 176, 208, 137, 63, 112, 249, 127, 197, 242, 139, - 227, 254, 65, 222, 71, 157, 56, 222, 95, 7, 127, 13, 245, 173, 22, - 80, 252, 254, 245, 60, 249, 249, 15, 201, 191, 218, 204, 149, 92, 254, - 157, 51, 85, 142, 197, 191, 204, 18, 150, 46, 90, 201, 203, 31, 62, - 55, 203, 121, 243, 37, 149, 163, 227, 167, 93, 120, 250, 181, 249, 163, - 194, 34, 39, 207, 43, 62, 125, 81, 172, 255, 113, 235, 5, 46, 215, - 75, 31, 70, 76, 104, 55, 72, 180, 255, 133, 95, 151, 56, 224, 255, - 223, 157, 55, 151, 247, 215, 9, 255, 223, 47, 253, 167, 146, 169, 240, - 249, 60, 222, 71, 126, 119, 196, 2, 9, 146, 255, 63, 113, 97, 134, - 227, 93, 248, 255, 67, 177, 225, 124, 126, 214, 117, 205, 118, 214, 217, - 105, 118, 148, 54, 92, 203, 235, 143, 186, 106, 213, 118, 153, 149, 237, - 12, 217, 222, 130, 167, 75, 84, 185, 225, 155, 110, 235, 194, 63, 105, - 38, 214, 223, 218, 125, 132, 75, 181, 110, 129, 112, 187, 36, 184, 156, - 252, 233, 153, 159, 82, 254, 252, 29, 32, 122, 254, 87, 77, 36, 241, - 253, 159, 187, 59, 128, 220, 179, 173, 180, 19, 15, 39, 8, 141, 142, - 39, 56, 157, 81, 19, 157, 179, 150, 54, 138, 120, 230, 239, 9, 194, - 176, 87, 94, 172, 146, 255, 255, 25, 242, 105, 145, 250, 84, 241, 182, - 191, 119, 21, 253, 62, 101, 121, 133, 247, 127, 70, 97, 93, 182, 105, - 244, 120, 232, 11, 147, 58, 242, 249, 78, 221, 84, 173, 168, 229, 183, - 121, 66, 190, 85, 197, 231, 111, 101, 94, 64, 241, 162, 137, 170, 240, - 99, 95, 254, 255, 188, 255, 83, 92, 150, 39, 188, 51, 246, 151, 208, - 113, 99, 196, 223, 154, 126, 237, 198, 23, 69, 163, 175, 229, 9, 62, - 187, 71, 112, 251, 187, 199, 247, 74, 241, 175, 3, 135, 134, 181, 251, - 90, 108, 127, 112, 163, 14, 194, 94, 115, 13, 231, 192, 6, 159, 240, - 111, 115, 12, 231, 91, 11, 121, 49, 125, 157, 117, 122, 28, 228, 253, - 5, 47, 232, 210, 154, 11, 99, 58, 11, 92, 215, 31, 69, 254, 168, - 206, 130, 195, 253, 254, 79, 211, 209, 117, 157, 15, 215, 94, 225, 244, - 251, 253, 49, 222, 247, 134, 161, 173, 133, 86, 129, 253, 132, 88, 125, - 1, 175, 95, 244, 69, 148, 211, 100, 110, 42, 176, 101, 83, 184, 63, - 222, 247, 248, 223, 37, 151, 255, 26, 162, 109, 255, 136, 120, 255, 107, - 213, 94, 157, 246, 146, 225, 79, 45, 201, 168, 220, 254, 175, 90, 37, - 251, 63, 232, 68, 188, 70, 36, 241, 253, 159, 187, 203, 191, 254, 190, - 148, 114, 243, 59, 208, 254, 137, 211, 97, 107, 228, 234, 112, 90, 227, - 168, 202, 250, 175, 151, 145, 39, 252, 121, 107, 114, 113, 73, 72, 96, - 73, 98, 231, 138, 239, 255, 156, 59, 55, 75, 248, 37, 190, 164, 228, - 160, 105, 63, 215, 247, 65, 237, 143, 134, 167, 190, 149, 43, 52, 205, - 16, 239, 7, 204, 235, 189, 167, 228, 157, 117, 183, 194, 116, 151, 42, - 95, 255, 70, 200, 106, 214, 115, 137, 97, 9, 123, 67, 185, 189, 204, - 93, 156, 88, 188, 1, 121, 63, 124, 254, 54, 127, 126, 239, 168, 23, - 94, 52, 107, 243, 155, 125, 118, 41, 222, 255, 33, 255, 159, 191, 100, - 7, 127, 166, 242, 122, 143, 60, 225, 93, 221, 177, 226, 129, 199, 215, - 243, 190, 253, 125, 250, 231, 176, 188, 156, 60, 161, 201, 124, 241, 183, - 241, 255, 222, 182, 38, 252, 130, 209, 86, 178, 251, 43, 177, 253, 161, - 197, 193, 66, 225, 236, 64, 231, 217, 3, 111, 242, 245, 255, 196, 91, - 167, 29, 141, 99, 231, 106, 143, 204, 136, 227, 239, 79, 213, 143, 157, - 235, 152, 241, 179, 205, 249, 88, 70, 107, 46, 63, 202, 87, 101, 180, - 214, 246, 146, 222, 255, 49, 238, 61, 232, 60, 144, 61, 48, 226, 108, - 112, 38, 151, 223, 160, 185, 87, 28, 97, 103, 7, 57, 18, 13, 19, - 121, 253, 216, 152, 108, 109, 157, 148, 44, 103, 224, 137, 61, 188, 253, - 151, 199, 140, 119, 182, 251, 188, 163, 227, 246, 73, 13, 111, 191, 113, - 255, 19, 206, 159, 210, 46, 10, 255, 190, 183, 167, 156, 252, 73, 198, - 21, 246, 127, 208, 9, 150, 43, 146, 244, 238, 199, 93, 21, 224, 88, - 89, 126, 185, 247, 191, 108, 223, 36, 10, 93, 162, 191, 118, 212, 253, - 167, 80, 168, 138, 252, 77, 207, 231, 10, 95, 15, 254, 160, 164, 241, - 171, 207, 135, 189, 16, 240, 102, 133, 247, 127, 66, 79, 230, 9, 151, - 182, 169, 194, 226, 222, 111, 203, 231, 191, 250, 208, 217, 197, 11, 139, - 167, 11, 15, 93, 24, 206, 231, 239, 143, 178, 199, 195, 255, 73, 29, - 161, 237, 184, 116, 122, 229, 254, 255, 223, 60, 225, 74, 84, 231, 48, - 161, 243, 122, 142, 253, 229, 250, 206, 197, 175, 33, 207, 49, 102, 37, - 79, 47, 217, 178, 182, 232, 197, 179, 171, 138, 182, 223, 242, 200, 159, - 214, 191, 37, 225, 56, 127, 166, 242, 217, 249, 89, 66, 195, 167, 123, - 247, 121, 180, 68, 197, 229, 83, 125, 125, 100, 209, 243, 216, 83, 94, - 56, 176, 140, 219, 131, 245, 7, 85, 142, 201, 155, 86, 20, 239, 251, - 73, 244, 191, 177, 90, 31, 225, 82, 191, 230, 206, 247, 244, 165, 252, - 253, 143, 115, 205, 254, 41, 106, 114, 107, 150, 179, 241, 220, 219, 188, - 255, 224, 133, 190, 27, 138, 138, 235, 110, 21, 223, 231, 249, 122, 206, - 237, 146, 144, 173, 255, 150, 164, 74, 239, 255, 36, 134, 14, 208, 62, - 124, 250, 109, 231, 238, 14, 226, 254, 109, 246, 246, 3, 161, 31, 204, - 205, 21, 54, 31, 252, 146, 215, 223, 127, 49, 203, 121, 217, 180, 183, - 216, 231, 236, 44, 62, 254, 182, 167, 114, 29, 150, 85, 159, 134, 23, - 77, 23, 127, 159, 55, 229, 133, 88, 231, 186, 198, 83, 157, 103, 198, - 44, 45, 31, 255, 231, 86, 242, 252, 79, 83, 233, 251, 63, 149, 234, - 192, 171, 9, 227, 143, 40, 211, 239, 172, 223, 87, 244, 65, 114, 154, - 112, 102, 214, 198, 94, 85, 145, 127, 194, 31, 121, 130, 53, 182, 164, - 248, 55, 245, 178, 162, 31, 114, 103, 86, 120, 255, 103, 25, 100, 213, - 172, 244, 82, 209, 188, 31, 234, 241, 249, 206, 154, 171, 10, 171, 129, - 189, 214, 212, 246, 225, 124, 62, 114, 235, 212, 46, 190, 144, 30, 30, - 62, 227, 80, 229, 246, 191, 7, 240, 87, 197, 149, 132, 69, 132, 159, - 226, 242, 126, 122, 110, 73, 113, 247, 63, 243, 132, 58, 83, 123, 242, - 244, 249, 186, 239, 22, 61, 251, 85, 68, 81, 246, 29, 242, 111, 46, - 244, 224, 235, 127, 104, 251, 153, 66, 116, 226, 202, 35, 237, 63, 13, - 228, 242, 239, 255, 189, 189, 40, 226, 231, 60, 225, 219, 69, 63, 240, - 254, 60, 117, 42, 208, 241, 121, 202, 79, 197, 187, 234, 136, 242, 91, - 113, 228, 71, 109, 90, 78, 43, 103, 63, 85, 27, 254, 254, 87, 76, - 235, 73, 197, 39, 174, 207, 114, 174, 138, 17, 229, 255, 230, 245, 89, - 66, 108, 175, 179, 197, 239, 93, 189, 198, 229, 191, 4, 249, 199, 174, - 94, 43, 121, 95, 122, 255, 103, 88, 227, 16, 237, 150, 147, 163, 92, - 243, 3, 69, 249, 39, 7, 173, 15, 173, 6, 123, 215, 162, 240, 45, - 94, 191, 176, 196, 238, 124, 182, 246, 137, 226, 234, 187, 214, 112, 249, - 251, 180, 95, 235, 216, 180, 247, 141, 240, 199, 159, 177, 241, 250, 19, - 22, 181, 112, 109, 154, 106, 115, 190, 58, 248, 77, 46, 127, 250, 29, - 40, 250, 62, 200, 18, 127, 89, 61, 207, 253, 61, 95, 102, 249, 239, - 13, 35, 251, 218, 140, 118, 166, 75, 53, 232, 153, 248, 205, 97, 96, - 96, 144, 244, 142, 185, 248, 45, 137, 63, 202, 103, 137, 84, 122, 242, - 166, 231, 55, 85, 144, 255, 180, 251, 123, 18, 127, 233, 91, 194, 191, - 254, 46, 135, 125, 191, 247, 202, 221, 239, 168, 135, 73, 24, 110, 188, - 82, 63, 180, 133, 180, 101, 122, 90, 185, 207, 132, 239, 247, 158, 178, - 18, 143, 48, 228, 254, 129, 231, 125, 156, 253, 79, 185, 254, 221, 239, - 189, 215, 114, 253, 83, 224, 93, 80, 163, 127, 72, 23, 246, 191, 3, - 239, 62, 239, 81, 42, 241, 8, 195, 141, 151, 15, 158, 240, 163, 39, - 151, 159, 191, 251, 189, 151, 167, 196, 203, 87, 224, 249, 129, 39, 252, - 248, 254, 166, 114, 243, 119, 191, 247, 188, 148, 120, 126, 10, 188, 229, - 179, 16, 39, 18, 94, 209, 29, 227, 189, 207, 123, 67, 74, 60, 194, - 112, 227, 249, 131, 39, 252, 136, 130, 148, 114, 253, 187, 223, 123, 40, - 74, 60, 127, 5, 94, 225, 204, 203, 106, 194, 47, 75, 155, 90, 14, - 239, 126, 239, 53, 40, 241, 8, 195, 141, 23, 1, 158, 240, 203, 250, - 149, 199, 187, 223, 115, 114, 37, 94, 132, 2, 175, 116, 6, 116, 5, - 233, 64, 255, 244, 114, 120, 247, 123, 238, 86, 78, 159, 103, 40, 244, - 25, 60, 239, 227, 194, 242, 191, 41, 115, 191, 231, 56, 229, 244, 89, - 129, 119, 97, 58, 244, 25, 233, 248, 127, 141, 229, 231, 239, 62, 207, - 5, 202, 233, 243, 116, 133, 62, 131, 39, 252, 210, 27, 102, 223, 59, - 245, 249, 126, 152, 178, 62, 43, 240, 252, 192, 19, 126, 33, 75, 171, - 32, 143, 123, 61, 183, 46, 167, 207, 10, 188, 130, 28, 232, 51, 199, - 52, 85, 42, 143, 123, 97, 202, 127, 47, 51, 199, 131, 23, 8, 158, - 240, 149, 127, 127, 92, 150, 199, 125, 58, 40, 255, 86, 133, 2, 207, - 149, 125, 89, 77, 248, 241, 199, 43, 149, 199, 61, 17, 229, 223, 170, - 200, 246, 224, 69, 131, 231, 125, 188, 232, 145, 135, 230, 63, 236, 251, - 149, 120, 209, 10, 188, 50, 248, 2, 194, 47, 140, 79, 175, 196, 62, - 223, 123, 192, 242, 111, 143, 102, 121, 240, 44, 224, 9, 63, 126, 216, - 165, 74, 236, 243, 127, 195, 179, 40, 240, 200, 87, 241, 62, 222, 170, - 212, 62, 255, 167, 249, 99, 74, 60, 9, 63, 223, 113, 87, 251, 124, - 87, 76, 183, 15, 38, 191, 235, 246, 193, 101, 67, 160, 43, 241, 30, - 63, 204, 125, 176, 221, 104, 74, 70, 171, 70, 123, 98, 74, 176, 228, - 132, 221, 62, 216, 31, 117, 163, 135, 98, 61, 69, 167, 251, 150, 30, - 78, 241, 149, 109, 96, 166, 194, 6, 102, 72, 120, 141, 254, 241, 218, - 7, 19, 134, 108, 3, 193, 19, 254, 242, 122, 222, 251, 224, 8, 5, - 94, 169, 29, 250, 130, 116, 105, 200, 37, 175, 125, 48, 97, 200, 54, - 16, 60, 225, 151, 5, 121, 239, 131, 227, 21, 120, 23, 108, 232, 27, - 210, 254, 79, 121, 239, 131, 9, 67, 182, 129, 224, 9, 63, 250, 5, - 179, 215, 62, 56, 95, 129, 231, 7, 158, 240, 253, 119, 120, 239, 131, - 253, 20, 120, 5, 86, 232, 51, 245, 113, 171, 209, 107, 31, 76, 24, - 178, 13, 4, 207, 251, 24, 237, 189, 15, 14, 84, 224, 185, 166, 193, - 6, 34, 93, 214, 214, 123, 31, 76, 24, 178, 13, 4, 79, 248, 165, - 129, 38, 175, 125, 112, 180, 2, 175, 112, 36, 236, 11, 210, 236, 51, - 239, 125, 48, 97, 200, 235, 13, 60, 225, 151, 125, 225, 189, 15, 142, - 80, 224, 149, 142, 192, 122, 67, 186, 160, 200, 123, 31, 76, 24, 242, - 122, 3, 79, 248, 254, 193, 222, 251, 224, 120, 5, 222, 133, 225, 144, - 5, 210, 101, 19, 189, 247, 193, 132, 33, 175, 55, 240, 132, 31, 239, - 242, 222, 7, 231, 43, 240, 252, 192, 19, 126, 65, 247, 169, 94, 251, - 96, 63, 5, 94, 193, 48, 172, 55, 26, 243, 33, 239, 125, 48, 97, - 200, 235, 13, 60, 225, 199, 239, 243, 222, 7, 7, 42, 240, 92, 240, - 47, 132, 31, 223, 210, 123, 31, 76, 24, 242, 122, 3, 79, 248, 101, - 223, 121, 239, 131, 163, 135, 150, 247, 193, 132, 207, 54, 121, 239, 131, - 201, 239, 186, 125, 112, 96, 24, 124, 91, 102, 57, 31, 108, 215, 153, - 244, 228, 132, 105, 51, 236, 222, 6, 203, 62, 216, 130, 186, 5, 168, - 19, 93, 116, 75, 109, 241, 59, 83, 83, 142, 59, 134, 40, 250, 56, - 68, 194, 155, 225, 189, 15, 102, 10, 188, 229, 131, 17, 39, 12, 161, - 223, 45, 240, 222, 7, 19, 134, 188, 239, 2, 79, 248, 209, 179, 188, - 247, 193, 254, 10, 188, 194, 65, 152, 67, 164, 93, 58, 239, 125, 48, - 97, 200, 54, 16, 60, 225, 199, 127, 229, 189, 15, 142, 80, 224, 149, - 14, 132, 13, 68, 186, 32, 223, 123, 31, 76, 24, 178, 13, 4, 79, - 248, 165, 107, 188, 247, 193, 241, 10, 188, 11, 3, 128, 133, 116, 193, - 94, 239, 125, 48, 97, 200, 54, 16, 60, 225, 251, 77, 240, 222, 7, - 231, 43, 240, 252, 192, 19, 126, 190, 202, 123, 31, 236, 167, 192, 43, - 232, 15, 44, 164, 151, 247, 244, 222, 7, 19, 134, 108, 3, 193, 19, - 190, 235, 27, 239, 125, 112, 160, 2, 207, 213, 15, 178, 32, 204, 239, - 189, 247, 193, 132, 33, 219, 64, 240, 132, 95, 240, 246, 93, 109, 254, - 125, 245, 57, 90, 129, 87, 40, 96, 172, 72, 199, 135, 123, 239, 131, - 9, 67, 94, 111, 224, 9, 223, 47, 193, 123, 31, 28, 161, 192, 43, - 213, 98, 189, 33, 173, 252, 187, 245, 255, 171, 15, 38, 12, 121, 189, - 129, 39, 252, 248, 48, 239, 125, 112, 188, 2, 239, 66, 56, 214, 155, - 150, 246, 213, 119, 141, 137, 238, 235, 131, 9, 67, 94, 111, 224, 9, - 191, 192, 233, 189, 15, 206, 87, 224, 249, 129, 39, 124, 255, 14, 222, - 251, 96, 63, 5, 30, 249, 43, 194, 47, 248, 213, 123, 31, 76, 24, - 74, 31, 76, 248, 254, 159, 121, 239, 131, 201, 239, 186, 125, 112, 97, - 16, 226, 131, 33, 74, 31, 108, 231, 251, 95, 120, 94, 163, 93, 246, - 192, 30, 31, 236, 10, 165, 248, 19, 250, 90, 221, 228, 91, 86, 236, - 217, 7, 83, 190, 188, 230, 66, 165, 239, 91, 170, 121, 239, 131, 163, - 21, 120, 101, 125, 176, 230, 144, 182, 216, 188, 247, 193, 132, 33, 223, - 235, 0, 79, 248, 254, 83, 189, 247, 193, 22, 5, 30, 3, 79, 248, - 126, 81, 222, 251, 96, 166, 192, 91, 222, 27, 99, 69, 58, 255, 144, - 247, 62, 152, 48, 228, 152, 3, 60, 225, 199, 47, 241, 222, 7, 251, - 43, 240, 10, 123, 193, 127, 32, 29, 127, 208, 123, 31, 76, 24, 178, - 13, 4, 79, 248, 174, 120, 239, 125, 112, 132, 2, 175, 180, 39, 108, - 96, 47, 250, 13, 169, 169, 229, 108, 254, 255, 226, 131, 9, 67, 182, - 129, 224, 9, 63, 63, 194, 123, 31, 28, 175, 192, 187, 208, 3, 54, - 16, 233, 248, 54, 222, 251, 96, 194, 144, 109, 32, 120, 194, 143, 190, - 233, 189, 15, 206, 87, 224, 249, 129, 39, 252, 11, 23, 189, 247, 193, - 126, 10, 188, 130, 238, 152, 59, 164, 203, 126, 240, 126, 31, 76, 24, - 114, 204, 1, 158, 240, 227, 135, 120, 239, 131, 3, 21, 120, 174, 110, - 180, 199, 68, 31, 167, 121, 239, 131, 9, 67, 182, 127, 224, 9, 191, - 236, 160, 247, 62, 56, 90, 129, 87, 22, 130, 181, 129, 244, 133, 67, - 222, 223, 139, 38, 12, 217, 254, 129, 231, 125, 252, 214, 123, 31, 108, - 81, 224, 49, 240, 132, 111, 41, 243, 222, 7, 51, 5, 222, 114, 248, - 23, 194, 143, 239, 239, 189, 15, 38, 12, 217, 254, 129, 39, 124, 215, - 21, 239, 125, 176, 127, 112, 121, 31, 76, 248, 17, 7, 188, 247, 193, - 228, 119, 221, 62, 216, 127, 23, 100, 17, 86, 209, 7, 243, 15, 110, - 197, 187, 210, 240, 196, 30, 31, 28, 129, 186, 203, 81, 39, 250, 113, - 147, 111, 126, 174, 199, 7, 83, 190, 108, 3, 3, 69, 188, 194, 71, - 188, 247, 193, 132, 33, 219, 64, 240, 132, 239, 223, 209, 123, 31, 28, - 175, 192, 179, 92, 160, 251, 128, 24, 119, 92, 21, 124, 240, 5, 197, - 120, 243, 161, 47, 129, 244, 27, 185, 222, 251, 96, 194, 144, 251, 183, - 15, 58, 8, 124, 215, 58, 239, 125, 48, 97, 200, 58, 3, 158, 240, - 203, 54, 123, 239, 131, 153, 2, 111, 121, 33, 250, 135, 116, 244, 214, - 42, 60, 15, 46, 84, 248, 244, 189, 208, 23, 224, 185, 182, 120, 239, - 131, 9, 67, 246, 233, 224, 9, 63, 162, 177, 247, 62, 56, 66, 129, - 87, 250, 10, 124, 58, 210, 5, 45, 189, 247, 193, 132, 33, 235, 51, - 120, 194, 143, 111, 234, 189, 15, 142, 87, 224, 93, 216, 3, 249, 34, - 237, 58, 237, 189, 15, 38, 12, 217, 167, 131, 39, 252, 130, 51, 222, - 251, 224, 124, 5, 158, 31, 120, 194, 95, 126, 192, 123, 31, 236, 167, - 192, 43, 216, 13, 127, 73, 99, 158, 236, 189, 15, 38, 12, 217, 167, - 131, 39, 252, 130, 113, 222, 251, 224, 64, 5, 158, 235, 101, 96, 33, - 173, 252, 155, 161, 255, 171, 15, 38, 12, 217, 167, 131, 39, 252, 232, - 92, 239, 247, 193, 209, 10, 188, 178, 151, 160, 43, 132, 25, 97, 242, - 218, 7, 19, 134, 108, 175, 192, 19, 126, 193, 50, 239, 125, 176, 69, - 129, 199, 192, 19, 126, 97, 45, 239, 125, 48, 83, 224, 145, 191, 34, - 124, 255, 143, 188, 247, 193, 132, 161, 244, 193, 132, 159, 191, 202, 123, - 31, 76, 126, 215, 237, 131, 227, 183, 96, 172, 65, 21, 125, 112, 136, - 199, 1, 151, 123, 39, 171, 112, 39, 116, 127, 11, 189, 131, 100, 242, - 141, 31, 224, 241, 193, 148, 47, 219, 192, 157, 34, 222, 5, 149, 247, - 62, 56, 66, 129, 87, 186, 3, 125, 68, 218, 101, 170, 194, 59, 89, - 59, 20, 54, 16, 60, 225, 151, 25, 188, 247, 193, 241, 10, 188, 11, - 219, 49, 31, 72, 231, 167, 84, 225, 157, 172, 237, 10, 27, 8, 158, - 240, 93, 39, 170, 240, 78, 150, 2, 207, 15, 60, 225, 251, 47, 244, - 222, 7, 251, 41, 240, 10, 182, 97, 172, 72, 71, 111, 241, 222, 7, - 19, 134, 108, 3, 193, 19, 190, 197, 207, 123, 31, 28, 168, 192, 115, - 189, 8, 123, 128, 116, 129, 206, 123, 31, 76, 24, 178, 13, 4, 79, - 248, 236, 33, 239, 125, 112, 180, 2, 175, 108, 43, 100, 75, 125, 20, - 188, 247, 193, 132, 33, 219, 64, 240, 132, 239, 119, 205, 123, 31, 108, - 81, 224, 49, 240, 132, 191, 252, 119, 239, 125, 48, 83, 224, 45, 127, - 1, 178, 69, 250, 194, 23, 222, 251, 96, 194, 144, 247, 53, 224, 9, - 223, 127, 128, 247, 62, 216, 95, 129, 87, 248, 60, 198, 138, 244, 242, - 169, 222, 251, 96, 194, 144, 237, 31, 120, 194, 47, 248, 192, 123, 31, - 28, 161, 192, 43, 45, 128, 253, 67, 186, 240, 128, 247, 251, 96, 194, - 144, 237, 31, 120, 194, 47, 60, 227, 253, 62, 56, 94, 129, 87, 248, - 28, 236, 31, 210, 249, 59, 189, 247, 193, 132, 33, 207, 31, 120, 194, - 247, 143, 244, 222, 7, 71, 40, 240, 200, 95, 17, 126, 254, 223, 222, - 251, 96, 194, 80, 250, 96, 194, 207, 63, 234, 189, 15, 38, 191, 43, - 191, 147, 181, 10, 99, 221, 85, 209, 7, 119, 187, 139, 15, 190, 176, - 25, 235, 125, 181, 68, 35, 61, 127, 123, 130, 242, 101, 31, 178, 89, - 250, 219, 37, 35, 189, 247, 193, 249, 10, 60, 63, 240, 132, 95, 214, - 198, 123, 31, 236, 167, 192, 43, 216, 132, 249, 35, 204, 137, 222, 251, - 96, 194, 144, 125, 8, 120, 194, 47, 235, 228, 189, 15, 14, 84, 224, - 185, 54, 98, 253, 34, 29, 253, 138, 247, 62, 152, 48, 100, 31, 2, - 158, 240, 11, 158, 245, 222, 7, 71, 43, 240, 202, 54, 192, 135, 32, - 237, 90, 234, 189, 15, 38, 12, 217, 135, 128, 39, 252, 252, 245, 222, - 251, 96, 139, 2, 143, 129, 39, 124, 86, 223, 251, 231, 193, 76, 129, - 183, 252, 89, 248, 16, 26, 115, 105, 121, 159, 254, 191, 248, 96, 194, - 144, 125, 8, 120, 194, 247, 111, 236, 189, 15, 246, 87, 224, 21, 174, - 135, 255, 64, 58, 240, 124, 21, 222, 201, 90, 175, 176, 129, 224, 9, - 63, 254, 163, 42, 188, 147, 165, 192, 43, 93, 7, 27, 136, 180, 95, - 191, 138, 250, 252, 159, 223, 201, 90, 167, 240, 33, 224, 9, 127, 249, - 132, 42, 188, 147, 165, 192, 187, 176, 22, 62, 4, 233, 248, 209, 85, - 120, 39, 107, 173, 194, 254, 129, 39, 252, 130, 29, 85, 120, 39, 75, - 129, 231, 7, 158, 240, 253, 166, 87, 225, 157, 44, 5, 94, 193, 26, - 172, 53, 164, 11, 83, 238, 42, 143, 251, 191, 147, 181, 70, 97, 255, - 192, 19, 126, 252, 51, 85, 120, 39, 75, 129, 231, 130, 111, 33, 124, - 139, 111, 21, 222, 201, 90, 173, 176, 127, 224, 9, 191, 224, 100, 21, - 222, 201, 90, 125, 199, 59, 89, 72, 251, 189, 84, 133, 119, 178, 86, - 41, 158, 7, 255, 138, 185, 219, 82, 209, 7, 119, 191, 139, 15, 182, - 144, 207, 254, 141, 158, 167, 154, 124, 3, 179, 60, 251, 96, 202, 151, - 251, 184, 74, 250, 187, 146, 185, 85, 120, 39, 75, 129, 183, 124, 37, - 228, 129, 116, 254, 212, 42, 188, 147, 181, 82, 97, 3, 193, 19, 126, - 129, 174, 10, 239, 100, 41, 240, 10, 87, 192, 30, 32, 29, 161, 247, - 140, 87, 243, 63, 250, 96, 194, 144, 109, 32, 120, 194, 47, 59, 85, - 133, 119, 178, 20, 120, 165, 203, 177, 222, 144, 46, 155, 91, 133, 119, - 178, 150, 43, 198, 123, 30, 99, 5, 158, 223, 134, 42, 60, 15, 62, - 175, 24, 47, 120, 194, 143, 46, 244, 254, 219, 164, 8, 5, 94, 233, - 159, 24, 239, 121, 250, 182, 203, 123, 31, 76, 24, 178, 205, 7, 79, - 248, 174, 106, 85, 120, 30, 172, 192, 187, 240, 7, 198, 139, 116, 105, - 104, 21, 158, 7, 255, 161, 176, 249, 224, 9, 191, 244, 159, 42, 60, - 15, 86, 224, 249, 129, 39, 252, 232, 159, 171, 240, 60, 88, 129, 87, - 112, 14, 107, 23, 105, 203, 71, 85, 120, 30, 124, 78, 97, 243, 193, - 19, 126, 89, 100, 21, 158, 7, 43, 240, 92, 103, 97, 11, 144, 142, - 78, 170, 194, 243, 224, 179, 10, 155, 15, 158, 240, 227, 223, 173, 194, - 243, 96, 5, 94, 217, 239, 208, 61, 164, 93, 129, 222, 251, 96, 194, - 144, 99, 94, 240, 132, 95, 118, 170, 10, 207, 131, 21, 120, 12, 60, - 225, 71, 188, 88, 133, 231, 193, 10, 188, 229, 240, 47, 132, 31, 223, - 185, 10, 207, 131, 127, 83, 216, 123, 240, 188, 143, 231, 170, 240, 60, - 248, 183, 59, 158, 7, 255, 70, 239, 24, 86, 225, 121, 240, 175, 30, - 31, 124, 97, 9, 250, 182, 170, 162, 15, 238, 113, 23, 31, 28, 65, - 62, 123, 41, 202, 211, 111, 9, 86, 247, 236, 131, 41, 95, 182, 129, - 191, 72, 62, 120, 88, 21, 158, 7, 255, 162, 176, 129, 224, 9, 191, - 192, 191, 10, 207, 131, 21, 120, 23, 126, 134, 189, 66, 186, 112, 156, - 247, 62, 152, 48, 100, 27, 8, 158, 240, 11, 218, 123, 191, 15, 206, - 87, 224, 249, 129, 231, 125, 220, 230, 189, 15, 246, 83, 224, 21, 252, - 4, 27, 72, 125, 92, 227, 189, 15, 38, 12, 217, 6, 130, 39, 252, - 252, 69, 222, 251, 224, 64, 5, 158, 235, 71, 204, 29, 210, 17, 171, - 189, 223, 7, 19, 134, 108, 3, 193, 19, 126, 252, 112, 239, 125, 112, - 180, 2, 175, 236, 7, 216, 63, 164, 45, 254, 169, 94, 239, 131, 9, - 67, 182, 129, 224, 9, 191, 236, 17, 239, 125, 176, 69, 129, 199, 126, - 160, 247, 157, 160, 51, 191, 123, 239, 131, 153, 2, 111, 249, 247, 24, - 43, 97, 158, 242, 222, 7, 19, 134, 108, 3, 193, 19, 190, 69, 239, - 253, 62, 216, 95, 129, 87, 248, 29, 98, 94, 164, 163, 199, 86, 225, - 189, 232, 239, 20, 49, 32, 120, 194, 47, 27, 94, 133, 247, 162, 21, - 120, 165, 101, 176, 45, 223, 209, 183, 118, 85, 120, 47, 186, 76, 97, - 255, 192, 19, 126, 105, 70, 21, 222, 139, 86, 224, 21, 46, 3, 22, - 210, 165, 51, 189, 223, 7, 19, 134, 60, 127, 224, 9, 223, 127, 190, - 247, 62, 56, 66, 129, 87, 10, 255, 66, 248, 129, 26, 239, 125, 48, - 97, 200, 243, 7, 158, 247, 241, 77, 239, 125, 112, 252, 210, 242, 62, - 152, 240, 3, 111, 123, 239, 131, 201, 239, 186, 125, 176, 101, 14, 198, - 251, 107, 69, 31, 220, 243, 46, 62, 56, 159, 124, 246, 28, 241, 61, - 209, 192, 111, 60, 62, 152, 242, 101, 31, 178, 68, 194, 27, 236, 189, - 15, 246, 83, 224, 21, 44, 134, 189, 95, 66, 127, 159, 59, 221, 107, - 31, 76, 24, 178, 15, 1, 79, 248, 150, 209, 222, 251, 224, 64, 5, - 158, 235, 25, 248, 144, 197, 244, 251, 198, 222, 251, 96, 194, 144, 125, - 8, 120, 194, 191, 112, 221, 123, 31, 28, 173, 192, 43, 91, 4, 31, - 130, 180, 255, 10, 239, 125, 48, 97, 200, 62, 4, 60, 225, 71, 204, - 243, 222, 7, 91, 20, 120, 12, 60, 225, 23, 220, 246, 222, 7, 51, - 5, 222, 242, 133, 144, 237, 34, 250, 190, 203, 251, 231, 193, 132, 33, - 251, 16, 240, 132, 191, 156, 165, 122, 189, 15, 246, 87, 224, 21, 46, - 0, 22, 210, 129, 121, 222, 251, 96, 194, 144, 109, 224, 2, 122, 214, - 143, 117, 252, 179, 247, 62, 56, 66, 129, 87, 58, 31, 88, 11, 40, - 206, 247, 222, 7, 19, 134, 108, 3, 193, 19, 254, 242, 108, 239, 125, - 112, 188, 2, 239, 194, 60, 248, 15, 234, 99, 174, 247, 62, 152, 48, - 228, 24, 26, 60, 225, 23, 12, 246, 222, 7, 231, 43, 240, 252, 192, - 19, 126, 217, 38, 239, 125, 176, 159, 2, 175, 224, 105, 216, 63, 164, - 151, 79, 243, 222, 7, 19, 134, 108, 255, 192, 19, 126, 180, 221, 123, - 31, 28, 168, 192, 115, 205, 197, 220, 33, 93, 54, 219, 123, 31, 76, - 24, 178, 253, 3, 79, 248, 241, 75, 188, 247, 193, 209, 10, 60, 242, - 87, 188, 143, 78, 239, 125, 48, 97, 40, 125, 48, 225, 23, 94, 246, - 222, 7, 147, 223, 157, 167, 192, 187, 176, 68, 233, 131, 179, 116, 105, - 169, 156, 85, 124, 153, 196, 109, 152, 88, 6, 117, 75, 175, 136, 84, - 152, 228, 241, 193, 76, 209, 199, 229, 179, 165, 119, 178, 108, 222, 251, - 96, 194, 144, 109, 32, 225, 1, 159, 37, 120, 191, 15, 246, 87, 224, - 21, 62, 5, 125, 70, 218, 47, 199, 123, 31, 76, 24, 50, 222, 109, - 216, 64, 224, 249, 247, 170, 194, 247, 193, 183, 21, 54, 21, 60, 225, - 151, 157, 174, 194, 189, 104, 5, 94, 233, 45, 224, 33, 29, 189, 187, - 10, 247, 162, 111, 41, 108, 42, 120, 194, 95, 190, 162, 10, 223, 7, - 43, 240, 46, 220, 132, 62, 33, 29, 255, 114, 21, 190, 15, 190, 169, - 176, 169, 224, 9, 191, 52, 166, 10, 223, 7, 43, 240, 252, 192, 19, - 126, 89, 231, 42, 124, 31, 172, 192, 43, 184, 1, 155, 138, 116, 116, - 72, 21, 190, 15, 190, 161, 176, 169, 224, 9, 63, 255, 139, 42, 124, - 31, 172, 192, 115, 253, 11, 123, 133, 116, 252, 215, 85, 248, 62, 248, - 95, 133, 77, 5, 79, 248, 254, 111, 84, 225, 251, 96, 5, 94, 217, - 117, 216, 212, 127, 233, 123, 54, 239, 125, 48, 97, 200, 49, 37, 120, - 194, 143, 159, 236, 189, 15, 182, 40, 240, 24, 120, 194, 47, 59, 234, - 189, 15, 102, 10, 188, 229, 215, 16, 83, 94, 39, 251, 226, 189, 15, - 38, 12, 217, 158, 130, 39, 124, 127, 135, 247, 247, 162, 253, 21, 120, - 133, 87, 97, 11, 174, 209, 239, 230, 85, 225, 157, 172, 171, 10, 251, - 7, 158, 240, 203, 90, 87, 225, 157, 44, 5, 30, 247, 85, 72, 199, - 255, 88, 133, 119, 178, 174, 220, 241, 78, 22, 240, 10, 190, 251, 223, - 125, 240, 192, 97, 35, 163, 106, 227, 252, 213, 245, 250, 108, 168, 91, - 190, 243, 76, 190, 42, 150, 207, 52, 72, 244, 27, 17, 25, 116, 35, - 138, 177, 65, 77, 69, 39, 76, 215, 199, 32, 115, 68, 228, 240, 254, - 191, 96, 209, 4, 152, 12, 217, 118, 22, 96, 177, 26, 50, 89, 64, - 146, 209, 106, 67, 2, 86, 210, 206, 178, 89, 14, 155, 206, 178, 88, - 118, 186, 209, 132, 3, 236, 112, 14, 113, 57, 196, 161, 82, 150, 81, - 143, 130, 198, 4, 102, 210, 165, 27, 38, 5, 119, 155, 204, 50, 108, - 44, 41, 77, 151, 204, 44, 58, 61, 163, 139, 70, 125, 66, 154, 57, - 49, 149, 80, 211, 12, 122, 12, 68, 44, 26, 212, 35, 112, 50, 179, - 155, 237, 44, 49, 195, 154, 105, 160, 35, 227, 229, 236, 57, 22, 3, - 179, 165, 152, 179, 82, 13, 57, 204, 98, 182, 81, 25, 67, 154, 33, - 157, 241, 11, 86, 116, 139, 99, 4, 88, 13, 73, 84, 130, 46, 217, - 236, 214, 73, 33, 193, 147, 69, 222, 56, 157, 131, 101, 234, 210, 152, - 212, 174, 209, 98, 70, 227, 86, 115, 58, 65, 81, 29, 91, 90, 134, - 213, 146, 194, 116, 137, 60, 21, 16, 96, 75, 180, 26, 45, 118, 27, - 10, 81, 191, 145, 45, 102, 80, 113, 137, 195, 8, 77, 6, 150, 102, - 48, 1, 19, 135, 0, 26, 1, 31, 165, 141, 153, 232, 146, 141, 137, - 199, 0, 180, 156, 198, 2, 108, 134, 180, 52, 234, 68, 34, 3, 151, - 200, 2, 50, 76, 122, 115, 92, 66, 70, 18, 227, 12, 13, 138, 51, - 28, 42, 209, 156, 110, 161, 137, 97, 188, 231, 54, 131, 33, 149, 233, - 173, 186, 172, 233, 102, 244, 55, 197, 156, 166, 103, 137, 105, 70, 139, - 13, 35, 166, 179, 193, 164, 103, 38, 131, 157, 146, 56, 81, 10, 24, - 54, 94, 129, 87, 71, 5, 51, 161, 74, 231, 32, 38, 246, 31, 157, - 195, 60, 192, 73, 165, 99, 54, 168, 31, 1, 233, 70, 75, 186, 206, - 50, 41, 8, 50, 48, 167, 50, 18, 116, 146, 149, 198, 68, 220, 180, - 12, 93, 154, 209, 158, 195, 236, 22, 93, 178, 129, 79, 9, 38, 34, - 193, 136, 198, 178, 173, 6, 11, 203, 161, 131, 61, 139, 250, 96, 207, - 162, 46, 208, 165, 68, 179, 222, 64, 50, 177, 240, 114, 1, 22, 93, - 98, 170, 65, 79, 2, 103, 118, 67, 118, 162, 153, 161, 49, 187, 116, - 52, 25, 146, 249, 44, 234, 185, 64, 3, 204, 9, 83, 13, 137, 152, - 97, 148, 99, 22, 171, 121, 170, 120, 204, 225, 199, 233, 84, 195, 66, - 191, 41, 99, 78, 178, 77, 10, 153, 204, 231, 136, 206, 40, 204, 59, - 150, 136, 113, 90, 211, 209, 118, 26, 179, 50, 192, 50, 76, 158, 33, - 41, 46, 19, 209, 7, 46, 37, 233, 18, 153, 201, 108, 165, 19, 114, - 232, 20, 144, 162, 51, 233, 209, 169, 0, 11, 151, 96, 128, 205, 78, - 103, 27, 179, 81, 95, 108, 84, 10, 50, 164, 163, 221, 74, 163, 177, - 101, 164, 161, 103, 137, 152, 26, 70, 74, 199, 149, 172, 67, 128, 222, - 108, 180, 119, 236, 208, 17, 92, 162, 46, 45, 45, 1, 67, 165, 84, - 166, 193, 106, 51, 154, 77, 76, 199, 160, 111, 124, 104, 188, 74, 80, - 143, 201, 152, 243, 116, 29, 169, 70, 130, 97, 18, 82, 72, 216, 39, - 117, 155, 140, 255, 197, 102, 209, 69, 196, 35, 57, 140, 174, 163, 73, - 36, 141, 54, 3, 151, 166, 61, 195, 154, 144, 1, 53, 22, 23, 125, - 162, 217, 100, 183, 210, 138, 228, 35, 73, 166, 67, 2, 29, 48, 203, - 118, 106, 123, 186, 65, 172, 170, 55, 88, 236, 41, 34, 203, 225, 209, - 158, 56, 87, 86, 179, 133, 47, 98, 98, 114, 220, 12, 95, 209, 98, - 14, 24, 18, 176, 65, 103, 231, 50, 166, 51, 108, 2, 73, 152, 235, - 134, 13, 66, 72, 2, 38, 179, 209, 124, 36, 25, 13, 113, 124, 88, - 152, 96, 76, 103, 90, 70, 178, 145, 43, 115, 2, 178, 12, 166, 76, - 170, 162, 207, 176, 210, 56, 49, 103, 36, 33, 190, 142, 179, 153, 193, - 100, 176, 38, 231, 48, 189, 17, 3, 177, 97, 162, 68, 173, 7, 195, - 85, 130, 165, 232, 140, 38, 59, 2, 52, 123, 16, 29, 130, 25, 148, - 85, 44, 161, 75, 183, 192, 42, 232, 244, 114, 29, 152, 108, 200, 205, - 12, 247, 14, 88, 172, 89, 126, 53, 69, 151, 102, 182, 217, 161, 159, - 1, 233, 200, 157, 212, 107, 50, 163, 153, 181, 89, 12, 137, 86, 126, - 76, 230, 199, 4, 150, 110, 180, 90, 233, 144, 76, 135, 4, 166, 75, - 79, 176, 210, 129, 115, 201, 116, 96, 134, 116, 250, 89, 95, 147, 88, - 1, 243, 206, 116, 105, 150, 20, 29, 131, 213, 225, 57, 108, 58, 77, - 6, 211, 233, 245, 44, 149, 132, 144, 2, 141, 195, 218, 213, 7, 241, - 99, 48, 31, 113, 48, 89, 8, 43, 202, 98, 169, 192, 20, 144, 133, - 72, 100, 86, 104, 51, 21, 231, 99, 224, 215, 197, 241, 101, 36, 120, - 114, 18, 204, 102, 18, 115, 114, 2, 172, 7, 214, 65, 156, 104, 18, - 33, 86, 190, 68, 226, 72, 227, 232, 156, 70, 115, 2, 43, 27, 68, - 170, 106, 194, 140, 27, 249, 47, 16, 179, 164, 20, 234, 102, 26, 173, - 170, 164, 20, 62, 209, 217, 57, 252, 34, 211, 231, 64, 221, 73, 22, - 162, 177, 238, 222, 125, 50, 231, 76, 25, 48, 87, 54, 40, 179, 129, - 219, 43, 115, 26, 228, 110, 201, 166, 67, 14, 29, 166, 51, 200, 146, - 40, 152, 217, 176, 32, 179, 57, 23, 0, 45, 230, 138, 141, 35, 230, - 141, 155, 94, 146, 42, 166, 158, 95, 130, 180, 9, 8, 22, 152, 214, - 171, 213, 108, 167, 83, 150, 81, 26, 46, 250, 171, 151, 116, 214, 158, - 130, 188, 20, 44, 31, 42, 72, 133, 116, 88, 183, 140, 86, 59, 105, - 78, 74, 16, 75, 193, 60, 6, 177, 36, 28, 67, 88, 138, 17, 157, - 167, 162, 180, 120, 184, 102, 233, 236, 113, 38, 43, 179, 152, 236, 182, - 12, 126, 204, 4, 182, 205, 156, 150, 33, 158, 50, 153, 217, 138, 134, - 50, 196, 83, 38, 55, 217, 25, 252, 8, 47, 151, 138, 133, 135, 90, - 226, 25, 233, 4, 244, 61, 193, 48, 221, 206, 76, 88, 119, 196, 102, - 194, 54, 113, 195, 4, 163, 37, 122, 41, 24, 54, 172, 173, 0, 114, - 27, 9, 228, 40, 205, 86, 216, 54, 202, 227, 174, 193, 144, 201, 27, - 197, 48, 245, 40, 133, 106, 65, 116, 192, 172, 193, 28, 26, 248, 188, - 19, 71, 230, 140, 116, 65, 92, 2, 41, 8, 46, 153, 168, 227, 217, - 230, 36, 150, 3, 10, 32, 235, 147, 164, 75, 55, 166, 229, 112, 135, - 26, 144, 153, 132, 165, 207, 103, 62, 145, 79, 44, 157, 116, 122, 43, - 183, 185, 48, 86, 92, 61, 144, 13, 11, 100, 39, 227, 67, 141, 90, - 117, 22, 172, 16, 123, 186, 206, 150, 202, 50, 131, 88, 102, 48, 203, - 12, 97, 153, 221, 152, 37, 195, 132, 235, 162, 185, 206, 200, 148, 150, - 39, 4, 69, 19, 106, 50, 115, 211, 138, 205, 12, 164, 104, 39, 219, - 29, 192, 93, 0, 150, 117, 90, 134, 157, 27, 86, 76, 117, 150, 129, - 91, 163, 0, 125, 22, 181, 41, 165, 48, 110, 76, 47, 169, 127, 34, - 7, 193, 145, 252, 113, 82, 18, 55, 237, 233, 88, 33, 64, 209, 139, - 39, 187, 120, 74, 231, 221, 13, 208, 139, 167, 116, 82, 150, 0, 120, - 114, 99, 98, 106, 14, 159, 115, 248, 69, 210, 139, 0, 51, 172, 182, - 45, 35, 221, 44, 89, 110, 180, 201, 235, 219, 210, 205, 102, 73, 117, - 176, 118, 244, 198, 76, 110, 63, 225, 46, 68, 253, 178, 39, 113, 109, - 200, 226, 81, 67, 6, 63, 102, 242, 99, 22, 154, 196, 26, 230, 209, - 11, 124, 143, 184, 18, 200, 174, 91, 164, 137, 196, 57, 136, 14, 193, - 116, 8, 161, 3, 173, 77, 41, 194, 128, 252, 161, 186, 228, 173, 172, - 180, 8, 3, 116, 226, 138, 11, 128, 75, 55, 144, 71, 206, 50, 91, - 185, 7, 74, 208, 33, 141, 160, 33, 9, 94, 64, 90, 2, 102, 88, - 113, 58, 235, 221, 62, 76, 47, 45, 10, 184, 91, 242, 7, 76, 239, - 102, 204, 9, 30, 15, 33, 182, 103, 52, 101, 74, 105, 76, 19, 196, - 106, 19, 165, 196, 205, 58, 4, 46, 250, 104, 234, 17, 231, 50, 44, - 238, 11, 89, 176, 201, 88, 215, 60, 137, 115, 166, 81, 172, 146, 96, - 206, 144, 188, 175, 62, 195, 130, 238, 211, 49, 41, 137, 78, 228, 212, - 113, 34, 75, 108, 75, 162, 31, 52, 135, 147, 132, 14, 97, 101, 195, - 214, 144, 226, 66, 111, 173, 118, 35, 204, 63, 220, 46, 228, 96, 135, - 241, 215, 103, 164, 167, 231, 196, 5, 49, 171, 187, 12, 13, 144, 108, - 162, 30, 58, 99, 207, 166, 120, 138, 132, 11, 127, 14, 11, 142, 104, - 197, 12, 31, 203, 125, 153, 57, 45, 13, 54, 128, 174, 99, 224, 148, - 155, 70, 161, 137, 197, 12, 125, 72, 72, 144, 103, 9, 142, 132, 151, - 33, 169, 37, 67, 88, 124, 4, 110, 38, 24, 38, 218, 104, 195, 138, - 48, 91, 140, 137, 3, 36, 3, 40, 42, 160, 9, 50, 35, 103, 2, - 147, 101, 20, 253, 108, 138, 25, 70, 31, 135, 100, 58, 36, 208, 33, - 149, 77, 55, 64, 165, 113, 72, 166, 67, 2, 29, 82, 201, 252, 167, - 98, 253, 217, 236, 146, 37, 52, 219, 50, 172, 6, 150, 108, 197, 252, - 33, 42, 34, 145, 19, 19, 101, 206, 30, 173, 211, 27, 17, 237, 218, - 82, 115, 56, 62, 218, 49, 242, 198, 104, 22, 233, 204, 87, 56, 49, - 41, 70, 238, 3, 172, 252, 152, 204, 143, 9, 252, 152, 202, 143, 162, - 7, 0, 3, 167, 44, 90, 5, 240, 50, 131, 94, 112, 103, 206, 244, - 8, 130, 72, 62, 230, 36, 146, 15, 78, 228, 195, 233, 4, 93, 78, - 129, 191, 162, 224, 1, 188, 17, 209, 0, 143, 8, 69, 183, 1, 229, - 77, 193, 82, 177, 200, 28, 133, 9, 8, 152, 16, 11, 162, 48, 50, - 37, 55, 2, 95, 142, 131, 17, 150, 28, 28, 14, 70, 186, 76, 37, - 105, 46, 177, 72, 147, 13, 38, 44, 59, 216, 126, 30, 125, 232, 210, - 81, 202, 150, 205, 108, 136, 91, 40, 28, 48, 208, 1, 222, 32, 25, - 125, 160, 104, 129, 135, 123, 60, 108, 16, 131, 230, 12, 30, 180, 24, - 244, 201, 134, 209, 252, 56, 144, 31, 163, 88, 18, 92, 15, 98, 84, - 3, 10, 101, 91, 200, 87, 231, 240, 99, 146, 213, 48, 141, 51, 52, - 30, 49, 166, 207, 182, 37, 166, 176, 28, 58, 100, 235, 96, 159, 114, - 232, 144, 77, 139, 214, 134, 58, 252, 100, 211, 37, 33, 226, 129, 118, - 147, 173, 135, 17, 54, 81, 160, 13, 20, 10, 204, 141, 233, 124, 54, - 160, 96, 92, 127, 220, 33, 174, 77, 178, 203, 220, 185, 115, 78, 111, - 22, 199, 102, 182, 65, 201, 173, 182, 56, 155, 65, 236, 54, 133, 37, - 192, 179, 167, 35, 32, 163, 179, 88, 138, 56, 138, 1, 232, 108, 20, - 179, 200, 59, 163, 25, 113, 127, 3, 173, 20, 153, 36, 106, 94, 100, - 211, 205, 153, 70, 137, 69, 0, 153, 110, 192, 196, 5, 192, 110, 32, - 210, 15, 160, 232, 74, 52, 29, 56, 82, 76, 19, 144, 108, 53, 103, - 88, 104, 43, 129, 101, 67, 122, 29, 144, 132, 42, 136, 176, 80, 24, - 162, 48, 154, 25, 223, 39, 136, 177, 19, 102, 138, 229, 80, 136, 111, - 37, 171, 203, 157, 14, 31, 52, 154, 203, 242, 88, 20, 74, 121, 236, - 137, 5, 43, 80, 97, 109, 200, 39, 203, 215, 168, 164, 219, 38, 209, - 21, 11, 207, 33, 151, 174, 75, 19, 57, 93, 14, 15, 188, 18, 17, - 212, 241, 173, 150, 206, 74, 150, 133, 161, 139, 188, 91, 201, 86, 35, - 109, 87, 200, 193, 129, 210, 179, 89, 58, 4, 154, 141, 109, 64, 142, - 153, 226, 23, 30, 140, 242, 179, 142, 199, 53, 57, 82, 58, 71, 74, - 147, 216, 101, 38, 135, 163, 137, 187, 44, 106, 60, 1, 30, 9, 151, - 160, 85, 217, 210, 25, 110, 35, 33, 25, 19, 14, 187, 203, 123, 168, - 103, 220, 181, 96, 153, 51, 238, 6, 129, 46, 70, 12, 217, 252, 100, - 52, 241, 62, 34, 201, 207, 80, 66, 216, 35, 150, 106, 64, 152, 133, - 77, 41, 157, 117, 60, 244, 227, 44, 47, 98, 53, 243, 86, 51, 131, - 245, 36, 0, 163, 157, 92, 45, 136, 130, 1, 84, 161, 20, 204, 31, - 84, 204, 142, 117, 202, 18, 225, 175, 48, 43, 140, 162, 43, 152, 24, - 62, 61, 36, 70, 218, 174, 225, 76, 243, 150, 14, 243, 148, 32, 30, - 205, 188, 211, 169, 22, 51, 0, 224, 251, 80, 129, 118, 56, 180, 101, - 165, 157, 176, 168, 4, 36, 213, 108, 126, 164, 189, 130, 53, 135, 199, - 152, 105, 226, 34, 231, 187, 60, 113, 187, 107, 225, 209, 25, 109, 189, - 210, 200, 130, 144, 191, 228, 219, 48, 163, 61, 77, 220, 159, 235, 141, - 86, 73, 39, 145, 63, 169, 23, 237, 0, 147, 40, 146, 182, 242, 16, - 195, 36, 45, 89, 88, 157, 180, 12, 132, 116, 180, 183, 151, 55, 238, - 86, 131, 157, 246, 213, 52, 38, 178, 131, 216, 1, 33, 39, 195, 106, - 74, 202, 48, 37, 210, 30, 40, 128, 174, 88, 152, 217, 108, 33, 33, - 217, 140, 124, 173, 5, 112, 179, 64, 198, 1, 195, 66, 199, 121, 100, - 193, 239, 203, 241, 208, 10, 61, 20, 21, 75, 148, 45, 133, 58, 113, - 80, 155, 180, 20, 49, 178, 176, 24, 179, 227, 160, 124, 113, 124, 3, - 110, 207, 182, 75, 114, 2, 71, 183, 152, 3, 44, 57, 113, 100, 234, - 56, 99, 200, 228, 174, 25, 28, 100, 96, 23, 253, 154, 232, 250, 116, - 153, 6, 238, 202, 236, 134, 116, 11, 13, 191, 7, 166, 129, 26, 114, - 243, 98, 56, 234, 78, 81, 175, 50, 220, 9, 218, 217, 32, 67, 153, - 180, 25, 166, 201, 201, 28, 123, 138, 217, 228, 78, 217, 72, 251, 221, - 9, 105, 63, 104, 147, 125, 149, 141, 235, 35, 95, 222, 100, 80, 56, - 3, 239, 174, 19, 23, 60, 95, 68, 220, 222, 219, 105, 147, 164, 207, - 22, 249, 28, 226, 115, 152, 184, 20, 196, 117, 192, 75, 98, 42, 69, - 179, 9, 134, 108, 40, 87, 35, 114, 247, 32, 93, 170, 157, 223, 153, - 201, 164, 72, 25, 209, 35, 246, 7, 136, 255, 2, 16, 0, 6, 32, - 2, 12, 224, 197, 3, 16, 119, 34, 224, 48, 100, 160, 233, 148, 105, - 48, 64, 70, 147, 148, 202, 154, 70, 24, 30, 155, 64, 5, 41, 224, - 68, 38, 157, 40, 41, 181, 195, 121, 131, 85, 50, 172, 118, 143, 193, - 193, 181, 108, 58, 228, 240, 18, 113, 182, 44, 4, 163, 156, 51, 144, - 221, 165, 43, 98, 30, 49, 98, 22, 93, 5, 4, 191, 117, 33, 178, - 124, 13, 113, 179, 7, 45, 163, 60, 90, 80, 201, 6, 113, 223, 141, - 138, 202, 36, 93, 38, 45, 232, 216, 33, 211, 108, 212, 75, 5, 202, - 103, 240, 225, 98, 178, 245, 50, 128, 156, 226, 253, 230, 234, 157, 97, - 228, 75, 72, 188, 141, 35, 121, 37, 218, 210, 192, 206, 113, 223, 64, - 235, 64, 186, 233, 67, 81, 99, 55, 178, 224, 54, 67, 16, 29, 130, - 233, 16, 194, 32, 13, 189, 217, 196, 111, 44, 96, 69, 114, 80, 210, - 7, 190, 200, 172, 217, 160, 28, 177, 42, 101, 144, 136, 160, 74, 162, - 156, 197, 35, 13, 26, 242, 230, 235, 145, 210, 112, 42, 144, 21, 114, - 68, 38, 93, 151, 152, 66, 203, 64, 220, 225, 243, 18, 124, 199, 101, - 32, 173, 195, 153, 124, 19, 133, 201, 220, 95, 138, 93, 224, 67, 225, - 183, 207, 96, 33, 147, 2, 249, 145, 119, 120, 154, 120, 228, 253, 158, - 22, 130, 192, 108, 154, 164, 135, 34, 99, 225, 55, 29, 209, 4, 44, - 10, 173, 38, 110, 101, 48, 26, 126, 203, 9, 97, 173, 184, 156, 16, - 86, 240, 190, 99, 203, 75, 55, 90, 40, 34, 68, 244, 74, 71, 132, - 167, 60, 80, 32, 51, 38, 37, 121, 52, 140, 184, 49, 81, 140, 235, - 40, 234, 48, 233, 16, 125, 144, 150, 138, 91, 122, 132, 120, 226, 54, - 144, 70, 194, 221, 14, 213, 225, 97, 111, 138, 49, 77, 79, 140, 168, - 151, 4, 139, 16, 131, 20, 132, 74, 82, 207, 176, 113, 16, 55, 254, - 48, 199, 54, 38, 25, 15, 19, 98, 46, 115, 22, 109, 216, 209, 65, - 88, 124, 222, 35, 244, 156, 239, 221, 41, 250, 183, 88, 13, 10, 239, - 71, 238, 221, 227, 39, 197, 158, 80, 21, 168, 165, 89, 12, 17, 204, - 180, 167, 33, 247, 193, 131, 44, 233, 182, 25, 122, 153, 158, 32, 174, - 107, 92, 12, 225, 251, 158, 100, 233, 204, 131, 209, 116, 76, 191, 45, - 205, 204, 55, 76, 220, 87, 100, 99, 71, 238, 137, 80, 41, 135, 162, - 91, 218, 96, 73, 230, 141, 16, 221, 60, 76, 1, 44, 64, 0, 217, - 68, 186, 141, 151, 68, 13, 33, 108, 227, 231, 116, 115, 134, 205, 16, - 135, 136, 194, 16, 103, 53, 112, 67, 72, 119, 123, 232, 10, 212, 206, - 150, 102, 148, 78, 113, 162, 109, 149, 18, 8, 219, 36, 206, 144, 35, - 115, 114, 94, 10, 65, 80, 85, 210, 118, 27, 2, 65, 152, 116, 140, - 54, 93, 202, 166, 218, 18, 135, 218, 110, 78, 206, 75, 193, 254, 134, - 240, 109, 8, 12, 245, 54, 66, 181, 81, 35, 6, 202, 51, 80, 158, - 129, 242, 12, 200, 75, 162, 114, 73, 84, 46, 137, 202, 37, 241, 114, - 54, 125, 10, 56, 58, 80, 141, 36, 170, 145, 68, 53, 146, 168, 6, - 228, 71, 141, 227, 200, 121, 3, 231, 169, 150, 137, 208, 77, 132, 110, - 202, 2, 161, 54, 229, 36, 81, 78, 18, 114, 146, 40, 199, 12, 95, - 23, 20, 220, 11, 138, 135, 64, 138, 51, 220, 253, 137, 89, 70, 41, - 75, 188, 241, 141, 164, 196, 137, 158, 211, 76, 62, 131, 132, 164, 75, - 163, 57, 98, 208, 69, 76, 8, 229, 75, 215, 113, 129, 79, 150, 24, - 0, 199, 97, 30, 40, 0, 21, 79, 113, 146, 42, 74, 41, 110, 108, - 168, 42, 221, 59, 227, 53, 137, 129, 30, 27, 249, 125, 56, 126, 206, - 145, 90, 71, 236, 153, 38, 222, 99, 19, 91, 140, 147, 235, 208, 21, - 44, 26, 40, 53, 178, 220, 146, 15, 72, 164, 37, 225, 185, 245, 200, - 232, 230, 113, 0, 15, 41, 2, 192, 114, 134, 246, 233, 226, 182, 132, - 116, 151, 124, 121, 0, 48, 41, 130, 225, 102, 152, 14, 193, 244, 248, - 34, 217, 96, 31, 225, 222, 24, 219, 205, 201, 201, 105, 6, 57, 137, - 74, 25, 34, 135, 30, 43, 19, 88, 17, 70, 93, 154, 92, 142, 22, - 56, 173, 53, 43, 221, 69, 75, 163, 157, 3, 236, 53, 67, 56, 15, - 61, 52, 80, 104, 79, 27, 66, 121, 247, 141, 234, 50, 79, 101, 196, - 200, 129, 34, 160, 145, 226, 253, 97, 104, 60, 157, 121, 129, 4, 179, - 62, 71, 220, 179, 103, 164, 65, 213, 105, 179, 64, 243, 66, 203, 3, - 203, 58, 64, 60, 27, 77, 60, 252, 163, 139, 193, 140, 246, 239, 162, - 132, 211, 115, 96, 118, 113, 209, 146, 97, 231, 143, 22, 108, 98, 105, - 68, 77, 33, 244, 36, 64, 76, 209, 196, 128, 232, 214, 142, 190, 59, - 183, 24, 124, 171, 47, 198, 217, 60, 72, 53, 98, 59, 79, 251, 7, - 216, 88, 61, 197, 75, 201, 220, 32, 83, 130, 143, 208, 125, 63, 36, - 88, 230, 96, 98, 77, 122, 184, 135, 0, 30, 36, 96, 188, 169, 134, - 68, 179, 5, 145, 28, 191, 243, 170, 167, 251, 14, 250, 73, 65, 212, - 65, 3, 173, 243, 113, 20, 80, 163, 5, 50, 31, 60, 156, 229, 19, - 194, 173, 167, 116, 63, 129, 243, 210, 45, 4, 90, 222, 58, 180, 226, - 169, 131, 201, 206, 72, 187, 35, 75, 175, 55, 232, 43, 43, 105, 182, - 167, 24, 172, 212, 60, 172, 30, 249, 113, 168, 14, 78, 100, 233, 41, - 32, 231, 113, 28, 140, 32, 120, 169, 101, 200, 221, 205, 33, 38, 16, - 123, 64, 55, 167, 68, 142, 180, 203, 106, 4, 0, 221, 24, 129, 117, - 139, 131, 54, 197, 5, 201, 28, 221, 20, 53, 235, 220, 185, 30, 30, - 106, 103, 142, 134, 70, 200, 250, 19, 96, 55, 75, 162, 39, 113, 199, - 144, 86, 39, 195, 10, 39, 98, 2, 210, 176, 103, 226, 240, 180, 129, - 21, 109, 59, 111, 94, 230, 225, 45, 165, 4, 114, 185, 167, 161, 28, - 206, 240, 108, 49, 11, 222, 139, 130, 94, 8, 150, 159, 3, 232, 168, - 75, 179, 241, 93, 25, 109, 29, 233, 44, 62, 21, 9, 224, 55, 78, - 249, 237, 40, 242, 60, 196, 208, 253, 77, 29, 127, 162, 68, 30, 0, - 110, 147, 223, 11, 193, 58, 147, 166, 134, 183, 195, 239, 251, 240, 172, - 32, 73, 144, 65, 242, 53, 145, 35, 31, 238, 174, 65, 188, 52, 137, - 238, 193, 72, 0, 138, 71, 6, 226, 141, 92, 43, 53, 75, 12, 38, - 128, 223, 54, 166, 4, 73, 73, 7, 149, 32, 85, 162, 187, 136, 210, - 189, 150, 0, 186, 217, 194, 55, 147, 20, 211, 27, 249, 67, 138, 0, - 76, 60, 221, 183, 7, 182, 123, 52, 124, 103, 66, 207, 190, 232, 44, - 46, 92, 189, 24, 61, 195, 185, 26, 164, 123, 79, 110, 221, 163, 218, - 18, 47, 173, 58, 186, 65, 79, 119, 12, 161, 229, 113, 162, 138, 103, - 154, 177, 129, 32, 189, 54, 153, 248, 95, 5, 176, 67, 165, 50, 68, - 185, 89, 232, 109, 92, 210, 158, 184, 100, 56, 64, 146, 152, 200, 144, - 238, 232, 232, 54, 131, 180, 123, 226, 235, 114, 82, 207, 201, 76, 188, - 106, 182, 160, 9, 171, 251, 182, 147, 152, 114, 171, 50, 51, 97, 183, - 66, 237, 218, 248, 34, 69, 239, 229, 12, 10, 192, 177, 66, 41, 114, - 10, 72, 38, 91, 199, 183, 108, 201, 210, 131, 39, 158, 195, 111, 228, - 209, 83, 72, 138, 51, 184, 43, 231, 174, 151, 162, 70, 126, 79, 84, - 103, 76, 163, 51, 162, 29, 143, 36, 224, 174, 61, 9, 186, 249, 98, - 47, 23, 74, 40, 2, 139, 4, 132, 132, 28, 52, 145, 30, 111, 136, - 240, 6, 91, 16, 29, 184, 129, 8, 225, 227, 21, 227, 47, 29, 177, - 208, 69, 126, 66, 175, 96, 50, 12, 38, 190, 214, 165, 199, 47, 210, - 189, 68, 108, 117, 68, 69, 73, 227, 61, 11, 128, 242, 64, 138, 180, - 50, 104, 254, 40, 60, 225, 83, 109, 35, 195, 41, 26, 116, 190, 170, - 166, 211, 146, 158, 158, 46, 190, 77, 19, 51, 33, 186, 255, 139, 244, - 188, 159, 158, 94, 100, 240, 35, 182, 155, 88, 10, 25, 226, 137, 98, - 147, 52, 51, 100, 151, 193, 143, 124, 177, 98, 222, 51, 48, 195, 140, - 2, 107, 54, 140, 2, 146, 97, 16, 90, 20, 245, 29, 17, 83, 176, - 141, 31, 141, 252, 152, 196, 143, 180, 13, 79, 12, 225, 57, 33, 60, - 39, 132, 231, 116, 227, 57, 221, 120, 78, 55, 172, 83, 204, 63, 29, - 146, 216, 224, 126, 64, 76, 176, 234, 16, 42, 15, 198, 150, 122, 168, - 33, 39, 138, 239, 107, 193, 176, 49, 124, 159, 203, 91, 141, 193, 38, - 109, 24, 137, 148, 24, 22, 205, 159, 55, 14, 32, 119, 220, 87, 188, - 165, 50, 152, 111, 58, 249, 35, 207, 193, 233, 81, 25, 73, 108, 56, - 10, 50, 201, 162, 16, 27, 205, 31, 89, 17, 215, 55, 170, 31, 185, - 203, 190, 244, 44, 49, 10, 129, 42, 235, 111, 202, 28, 14, 87, 58, - 140, 172, 196, 120, 236, 29, 217, 112, 201, 185, 177, 113, 3, 232, 78, - 60, 63, 242, 58, 195, 17, 36, 247, 167, 232, 154, 152, 40, 29, 84, - 38, 138, 84, 46, 202, 156, 205, 162, 12, 211, 99, 208, 91, 244, 40, - 42, 218, 76, 51, 57, 130, 158, 42, 244, 229, 143, 17, 162, 233, 41, - 2, 70, 39, 166, 134, 15, 160, 152, 128, 31, 7, 163, 92, 140, 152, - 236, 103, 160, 123, 172, 227, 197, 232, 33, 138, 54, 21, 82, 214, 56, - 114, 107, 195, 197, 35, 250, 204, 134, 143, 17, 111, 154, 15, 167, 133, - 60, 50, 113, 48, 180, 5, 93, 183, 35, 211, 192, 134, 209, 200, 19, - 196, 122, 3, 249, 93, 132, 132, 72, 241, 150, 117, 66, 52, 221, 178, - 30, 70, 49, 249, 120, 126, 243, 105, 52, 191, 157, 196, 5, 57, 154, - 47, 32, 62, 192, 49, 124, 91, 42, 86, 29, 128, 13, 145, 52, 187, - 81, 3, 233, 70, 203, 56, 236, 218, 67, 250, 241, 83, 112, 63, 54, - 134, 66, 27, 18, 25, 103, 162, 200, 191, 114, 110, 12, 188, 51, 103, - 184, 120, 16, 65, 65, 117, 33, 92, 158, 53, 146, 238, 20, 136, 21, - 185, 188, 56, 203, 37, 58, 22, 110, 19, 253, 102, 9, 99, 196, 125, - 24, 78, 124, 200, 56, 247, 215, 83, 201, 68, 107, 36, 118, 112, 140, - 64, 7, 166, 153, 19, 32, 156, 49, 180, 225, 225, 210, 224, 156, 36, - 97, 222, 60, 118, 153, 252, 246, 101, 127, 186, 109, 3, 85, 238, 47, - 62, 153, 136, 202, 192, 114, 7, 15, 129, 88, 237, 238, 179, 49, 17, - 221, 36, 177, 83, 134, 56, 117, 152, 167, 244, 4, 54, 56, 85, 199, - 202, 117, 120, 140, 33, 141, 244, 172, 31, 162, 195, 145, 38, 140, 147, - 98, 50, 236, 104, 232, 18, 230, 23, 206, 140, 54, 199, 44, 97, 4, - 60, 238, 24, 110, 140, 89, 194, 112, 10, 216, 221, 137, 24, 51, 22, - 157, 59, 1, 253, 78, 48, 235, 172, 122, 119, 218, 93, 223, 157, 238, - 235, 54, 222, 238, 12, 8, 204, 131, 59, 26, 122, 107, 78, 247, 164, - 228, 106, 208, 10, 27, 102, 214, 157, 244, 160, 185, 111, 192, 179, 132, - 254, 217, 216, 6, 217, 8, 154, 114, 209, 50, 191, 169, 33, 242, 145, - 210, 205, 121, 112, 122, 189, 184, 122, 20, 89, 92, 149, 60, 233, 49, - 164, 251, 119, 36, 1, 143, 57, 191, 179, 38, 87, 43, 79, 210, 61, - 86, 79, 206, 157, 21, 160, 87, 158, 132, 168, 132, 138, 180, 188, 149, - 242, 228, 113, 149, 245, 36, 197, 249, 241, 164, 165, 105, 145, 51, 198, - 136, 254, 59, 97, 140, 232, 198, 196, 190, 147, 101, 163, 231, 213, 146, - 30, 243, 225, 112, 92, 178, 69, 98, 15, 137, 227, 89, 238, 88, 37, - 146, 60, 4, 61, 47, 224, 11, 172, 175, 116, 23, 80, 154, 42, 119, - 146, 227, 185, 23, 162, 167, 247, 80, 2, 88, 180, 116, 218, 203, 42, - 51, 99, 232, 201, 78, 140, 89, 153, 53, 218, 76, 78, 121, 152, 49, - 213, 160, 204, 29, 134, 64, 177, 98, 238, 0, 114, 219, 89, 100, 114, - 42, 32, 136, 34, 119, 231, 177, 152, 97, 253, 71, 168, 152, 138, 169, - 241, 207, 71, 250, 87, 3, 254, 161, 6, 254, 249, 240, 163, 31, 171, - 141, 127, 141, 113, 246, 99, 254, 252, 24, 200, 202, 88, 52, 107, 202, - 236, 224, 27, 48, 61, 40, 141, 249, 243, 151, 153, 162, 217, 110, 245, - 78, 22, 173, 106, 204, 22, 168, 178, 217, 65, 214, 141, 249, 169, 34, - 112, 101, 16, 155, 139, 171, 97, 168, 19, 200, 126, 229, 229, 106, 163, - 214, 32, 28, 207, 169, 136, 163, 150, 232, 207, 147, 15, 67, 78, 103, - 22, 129, 84, 182, 234, 28, 235, 128, 242, 53, 52, 11, 52, 253, 192, - 181, 97, 139, 85, 22, 148, 41, 96, 11, 24, 33, 174, 102, 155, 88, - 44, 107, 160, 166, 214, 27, 179, 175, 80, 47, 2, 189, 184, 128, 252, - 166, 232, 85, 99, 92, 101, 172, 23, 35, 140, 77, 64, 44, 21, 191, - 187, 69, 235, 53, 144, 26, 196, 82, 64, 157, 113, 45, 141, 193, 243, - 160, 55, 249, 232, 65, 24, 48, 194, 128, 86, 67, 21, 1, 132, 97, - 44, 27, 165, 155, 2, 163, 27, 40, 13, 184, 84, 127, 53, 242, 44, - 170, 6, 168, 81, 128, 178, 139, 89, 60, 80, 196, 127, 62, 104, 115, - 76, 204, 232, 190, 203, 80, 238, 33, 204, 229, 67, 252, 172, 98, 181, - 192, 215, 228, 164, 1, 190, 56, 203, 106, 86, 141, 213, 145, 231, 187, - 26, 171, 11, 222, 23, 156, 47, 248, 135, 193, 139, 51, 95, 13, 189, - 208, 200, 101, 124, 88, 117, 86, 15, 105, 119, 57, 95, 164, 235, 35, - 237, 46, 91, 3, 233, 71, 100, 9, 138, 229, 169, 100, 3, 126, 244, - 212, 241, 197, 191, 71, 121, 29, 79, 189, 26, 200, 107, 40, 73, 222, - 7, 61, 245, 65, 207, 125, 208, 243, 70, 188, 30, 93, 173, 9, 122, - 8, 84, 11, 163, 172, 129, 20, 3, 169, 192, 215, 102, 77, 48, 18, - 198, 71, 64, 61, 247, 67, 141, 122, 200, 171, 142, 107, 245, 65, 143, - 224, 90, 3, 16, 181, 216, 144, 95, 123, 76, 186, 70, 232, 141, 192, - 169, 81, 90, 141, 92, 186, 246, 56, 80, 31, 71, 233, 199, 129, 237, - 139, 35, 225, 169, 33, 3, 53, 107, 6, 106, 206, 203, 212, 100, 45, - 144, 83, 155, 99, 60, 14, 125, 100, 172, 37, 242, 91, 161, 124, 107, - 96, 182, 1, 82, 91, 92, 107, 39, 213, 105, 15, 234, 0, 234, 136, - 84, 53, 228, 7, 128, 239, 4, 234, 12, 234, 194, 241, 154, 35, 191, - 57, 80, 154, 243, 183, 227, 186, 34, 239, 9, 80, 32, 90, 169, 195, - 219, 96, 44, 8, 233, 96, 80, 8, 240, 187, 161, 92, 119, 80, 15, - 164, 123, 130, 122, 225, 122, 111, 156, 251, 128, 66, 209, 183, 48, 244, - 136, 230, 62, 28, 164, 149, 234, 137, 125, 110, 137, 249, 33, 60, 177, - 95, 52, 46, 1, 20, 129, 126, 71, 130, 162, 64, 125, 65, 253, 64, - 253, 65, 3, 64, 3, 65, 131, 248, 120, 154, 177, 193, 24, 97, 125, - 169, 63, 143, 98, 164, 67, 48, 210, 161, 160, 97, 192, 24, 46, 225, - 141, 0, 141, 4, 69, 131, 70, 129, 70, 131, 198, 128, 98, 64, 99, - 209, 143, 113, 160, 241, 232, 95, 44, 16, 27, 34, 111, 2, 104, 34, - 104, 18, 232, 73, 204, 216, 100, 204, 214, 20, 224, 199, 209, 27, 213, - 244, 198, 52, 40, 1, 125, 72, 4, 233, 81, 198, 0, 74, 2, 159, - 12, 74, 1, 25, 65, 83, 65, 169, 160, 52, 80, 58, 200, 132, 217, - 174, 203, 251, 88, 147, 153, 233, 77, 86, 208, 52, 180, 107, 5, 217, - 144, 103, 71, 153, 12, 80, 38, 40, 11, 121, 217, 200, 203, 193, 121, - 58, 159, 167, 142, 92, 63, 149, 248, 51, 184, 30, 248, 112, 201, 85, - 147, 198, 73, 125, 39, 189, 153, 137, 242, 179, 32, 205, 218, 188, 239, - 173, 88, 46, 40, 15, 229, 243, 165, 57, 126, 74, 158, 91, 31, 54, - 27, 52, 71, 154, 171, 17, 24, 103, 107, 62, 151, 190, 176, 74, 190, - 236, 105, 208, 60, 208, 124, 208, 2, 208, 66, 208, 34, 208, 51, 40, - 187, 24, 180, 4, 180, 84, 106, 219, 141, 187, 12, 180, 28, 180, 2, - 180, 18, 121, 171, 64, 171, 65, 107, 64, 79, 128, 214, 130, 214, 129, - 214, 131, 158, 149, 230, 102, 3, 151, 37, 245, 179, 3, 219, 136, 241, - 108, 66, 223, 55, 227, 250, 22, 104, 99, 83, 133, 110, 60, 199, 231, - 89, 13, 11, 83, 113, 174, 159, 7, 189, 0, 218, 10, 122, 17, 180, - 13, 180, 29, 180, 3, 229, 119, 130, 118, 41, 244, 233, 37, 208, 203, - 160, 221, 200, 223, 3, 122, 5, 173, 239, 149, 245, 169, 11, 159, 197, - 250, 60, 221, 21, 250, 43, 182, 79, 237, 22, 222, 209, 238, 62, 208, - 126, 208, 1, 208, 65, 208, 171, 160, 215, 64, 135, 64, 135, 65, 175, - 131, 142, 128, 138, 64, 197, 160, 18, 144, 3, 228, 4, 185, 64, 111, - 128, 142, 130, 142, 1, 251, 77, 232, 195, 113, 208, 9, 200, 227, 57, - 208, 91, 200, 59, 9, 122, 27, 244, 14, 232, 93, 148, 123, 15, 116, - 10, 244, 62, 232, 3, 122, 91, 22, 180, 7, 244, 33, 232, 35, 148, - 57, 13, 250, 24, 117, 63, 145, 117, 216, 61, 174, 174, 236, 12, 234, - 124, 10, 250, 12, 244, 57, 232, 11, 208, 151, 40, 243, 21, 168, 30, - 31, 247, 19, 176, 95, 226, 58, 250, 26, 244, 13, 174, 127, 43, 201, - 182, 57, 95, 245, 180, 62, 130, 96, 179, 130, 248, 202, 87, 73, 50, - 41, 148, 202, 148, 221, 97, 75, 191, 3, 125, 15, 250, 1, 244, 35, - 232, 39, 208, 207, 160, 39, 64, 191, 112, 157, 246, 133, 191, 243, 101, - 191, 193, 18, 136, 235, 63, 132, 253, 14, 59, 114, 22, 116, 78, 234, - 243, 31, 18, 246, 159, 40, 111, 64, 217, 243, 124, 189, 249, 194, 151, - 249, 178, 139, 160, 191, 64, 127, 195, 242, 144, 13, 254, 7, 116, 9, - 101, 47, 131, 174, 128, 174, 162, 151, 215, 232, 5, 111, 208, 191, 160, - 27, 176, 78, 212, 183, 155, 82, 185, 91, 160, 107, 160, 27, 176, 88, - 245, 65, 12, 228, 30, 211, 109, 158, 47, 182, 205, 84, 106, 166, 2, - 169, 65, 26, 144, 15, 168, 26, 168, 58, 200, 87, 5, 31, 0, 170, - 169, 234, 206, 30, 82, 117, 99, 181, 84, 61, 177, 226, 60, 99, 169, - 173, 162, 177, 180, 99, 117, 84, 237, 88, 93, 21, 141, 169, 23, 123, - 88, 5, 47, 172, 162, 177, 213, 98, 245, 80, 183, 190, 74, 57, 46, - 31, 110, 75, 30, 81, 209, 152, 197, 246, 27, 224, 250, 163, 160, 134, - 160, 70, 138, 126, 208, 90, 234, 6, 34, 95, 208, 24, 215, 154, 128, - 30, 3, 61, 14, 106, 10, 106, 6, 106, 14, 195, 221, 2, 228, 175, - 122, 130, 181, 84, 245, 70, 191, 122, 115, 171, 172, 98, 238, 254, 54, - 98, 173, 64, 173, 85, 162, 175, 105, 131, 115, 91, 80, 59, 80, 123, - 80, 7, 149, 91, 254, 110, 31, 231, 195, 58, 170, 200, 159, 244, 129, - 174, 104, 88, 128, 74, 195, 58, 129, 58, 131, 186, 160, 157, 174, 160, - 219, 104, 225, 9, 156, 253, 96, 245, 201, 103, 6, 168, 124, 80, 198, - 7, 101, 124, 42, 41, 19, 198, 113, 3, 113, 45, 8, 109, 5, 243, - 60, 198, 66, 84, 226, 90, 239, 166, 18, 125, 68, 119, 85, 77, 214, - 67, 21, 206, 125, 126, 79, 180, 223, 75, 165, 133, 62, 10, 72, 135, - 179, 222, 40, 211, 7, 20, 138, 216, 132, 244, 47, 76, 129, 115, 27, - 43, 222, 7, 231, 25, 160, 100, 250, 210, 0, 100, 132, 5, 32, 31, - 26, 174, 234, 139, 113, 121, 100, 165, 85, 185, 245, 206, 45, 159, 154, - 76, 64, 187, 17, 160, 72, 96, 71, 169, 4, 214, 87, 21, 201, 250, - 169, 162, 88, 127, 212, 29, 192, 101, 215, 143, 13, 196, 245, 65, 104, - 191, 29, 104, 176, 234, 78, 61, 85, 179, 33, 210, 28, 14, 229, 50, - 245, 101, 195, 80, 111, 184, 170, 191, 228, 67, 61, 250, 53, 130, 151, - 99, 108, 36, 250, 30, 13, 26, 5, 106, 198, 215, 73, 119, 54, 90, - 229, 238, 215, 0, 30, 35, 145, 157, 31, 195, 231, 166, 29, 139, 81, - 13, 68, 222, 64, 122, 231, 157, 251, 233, 177, 42, 242, 169, 237, 96, - 203, 61, 118, 115, 28, 202, 142, 7, 197, 130, 38, 160, 208, 68, 232, - 227, 36, 208, 147, 178, 78, 210, 28, 12, 98, 147, 85, 131, 217, 20, - 94, 95, 156, 143, 56, 62, 39, 181, 88, 60, 159, 143, 33, 76, 39, - 233, 106, 2, 206, 137, 42, 113, 140, 122, 149, 184, 30, 13, 56, 39, - 129, 146, 65, 41, 32, 163, 202, 151, 199, 142, 110, 251, 48, 21, 237, - 166, 130, 210, 64, 233, 32, 19, 198, 107, 6, 89, 64, 211, 64, 86, - 144, 13, 100, 7, 101, 128, 50, 81, 63, 11, 148, 13, 202, 1, 77, - 7, 205, 0, 205, 4, 205, 2, 229, 130, 242, 128, 147, 15, 122, 10, - 244, 39, 198, 62, 91, 69, 118, 172, 22, 155, 131, 126, 207, 5, 61, - 13, 154, 199, 229, 51, 128, 205, 7, 45, 64, 157, 133, 192, 94, 4, - 122, 6, 124, 16, 230, 99, 49, 104, 137, 74, 180, 71, 75, 81, 126, - 153, 106, 40, 188, 143, 199, 230, 23, 72, 62, 98, 57, 202, 175, 0, - 173, 4, 173, 2, 173, 6, 173, 1, 173, 5, 173, 3, 173, 87, 137, - 118, 255, 117, 201, 246, 63, 11, 204, 13, 200, 219, 8, 218, 4, 218, - 140, 54, 183, 112, 189, 246, 101, 207, 33, 93, 0, 122, 30, 244, 2, - 104, 43, 232, 69, 208, 54, 208, 118, 208, 14, 208, 78, 208, 46, 208, - 75, 168, 243, 50, 104, 55, 104, 15, 232, 21, 21, 217, 119, 146, 27, - 217, 118, 26, 239, 48, 62, 191, 123, 113, 173, 16, 180, 79, 210, 183, - 253, 56, 31, 0, 29, 4, 189, 10, 122, 13, 116, 8, 116, 24, 244, - 58, 48, 142, 0, 187, 8, 84, 12, 42, 81, 13, 199, 90, 29, 142, - 25, 28, 14, 29, 34, 153, 249, 192, 158, 251, 112, 28, 7, 202, 59, - 85, 20, 71, 140, 224, 54, 199, 165, 18, 125, 247, 27, 56, 31, 5, - 29, 227, 237, 137, 114, 122, 19, 116, 28, 116, 2, 244, 22, 232, 36, - 174, 189, 13, 122, 7, 244, 46, 232, 61, 80, 56, 234, 158, 194, 249, - 125, 208, 7, 160, 82, 208, 135, 160, 143, 64, 167, 97, 139, 62, 6, - 125, 2, 254, 12, 232, 83, 208, 103, 160, 207, 65, 95, 128, 190, 148, - 236, 194, 87, 56, 127, 13, 250, 6, 244, 45, 168, 140, 143, 1, 62, - 7, 244, 61, 232, 7, 208, 143, 208, 137, 159, 64, 63, 131, 126, 1, - 253, 170, 26, 201, 119, 63, 245, 177, 54, 126, 131, 140, 127, 71, 250, - 172, 138, 98, 14, 232, 56, 198, 255, 135, 42, 154, 253, 73, 250, 173, - 162, 241, 143, 98, 23, 160, 55, 23, 85, 195, 216, 95, 92, 127, 70, - 192, 126, 208, 92, 143, 134, 189, 162, 58, 20, 15, 186, 109, 44, 108, - 9, 249, 33, 156, 255, 65, 95, 46, 129, 46, 3, 227, 138, 106, 12, - 34, 153, 49, 244, 93, 9, 159, 211, 171, 184, 126, 13, 116, 29, 244, - 47, 232, 6, 232, 38, 201, 159, 124, 17, 234, 220, 150, 100, 199, 212, - 226, 252, 171, 212, 176, 245, 32, 13, 200, 71, 45, 206, 49, 197, 191, - 213, 212, 240, 175, 32, 95, 181, 24, 127, 158, 87, 209, 120, 176, 51, - 66, 153, 154, 160, 135, 64, 181, 64, 181, 65, 117, 64, 117, 65, 15, - 83, 125, 80, 61, 80, 125, 208, 35, 168, 219, 0, 244, 168, 122, 52, - 107, 168, 30, 195, 26, 169, 99, 96, 143, 26, 193, 174, 208, 190, 163, - 33, 107, 172, 110, 200, 154, 128, 30, 67, 153, 199, 65, 77, 65, 205, - 64, 205, 81, 183, 5, 200, 31, 212, 18, 212, 74, 61, 22, 241, 192, - 88, 178, 58, 210, 24, 125, 88, 107, 96, 181, 81, 215, 100, 109, 213, - 181, 88, 59, 181, 103, 207, 209, 30, 229, 59, 128, 58, 130, 2, 212, - 180, 175, 17, 125, 78, 39, 240, 157, 213, 62, 124, 127, 20, 170, 162, - 62, 140, 67, 140, 60, 14, 152, 227, 36, 76, 236, 71, 80, 166, 43, - 199, 133, 223, 83, 139, 117, 8, 43, 16, 237, 4, 225, 28, 140, 105, - 11, 1, 117, 3, 223, 29, 212, 67, 77, 243, 175, 102, 61, 193, 247, - 2, 245, 86, 147, 157, 25, 15, 29, 31, 15, 220, 241, 114, 95, 63, - 97, 30, 204, 191, 201, 143, 168, 99, 209, 126, 44, 202, 196, 202, 101, - 234, 33, 146, 10, 5, 94, 24, 240, 195, 65, 90, 144, 160, 22, 237, - 106, 132, 90, 92, 107, 145, 56, 71, 129, 250, 226, 90, 63, 156, 251, - 171, 41, 6, 87, 179, 1, 56, 15, 68, 31, 7, 225, 60, 88, 61, - 17, 154, 54, 17, 216, 19, 21, 216, 212, 126, 45, 54, 68, 26, 207, - 80, 181, 219, 223, 210, 184, 38, 129, 159, 132, 242, 147, 238, 40, 223, - 138, 13, 83, 139, 250, 214, 71, 45, 174, 7, 170, 59, 28, 52, 130, - 250, 133, 113, 55, 151, 108, 64, 103, 245, 147, 168, 243, 36, 48, 158, - 148, 49, 70, 170, 91, 176, 104, 140, 103, 20, 104, 52, 205, 29, 151, - 129, 15, 27, 3, 138, 1, 238, 88, 200, 125, 28, 104, 60, 250, 29, - 11, 154, 0, 154, 168, 158, 44, 237, 97, 177, 39, 66, 185, 39, 49, - 206, 201, 160, 41, 160, 56, 80, 60, 72, 7, 74, 0, 37, 130, 244, - 192, 53, 168, 197, 125, 105, 18, 202, 207, 82, 77, 65, 63, 196, 189, - 109, 50, 198, 155, 2, 50, 170, 71, 178, 169, 40, 147, 10, 74, 3, - 165, 131, 76, 32, 51, 201, 10, 52, 13, 100, 5, 217, 56, 14, 252, - 2, 206, 25, 234, 56, 196, 112, 113, 124, 39, 166, 2, 101, 170, 107, - 179, 44, 174, 59, 241, 88, 9, 241, 124, 119, 70, 249, 217, 40, 151, - 131, 242, 159, 168, 220, 251, 110, 29, 116, 80, 199, 119, 110, 158, 235, - 113, 108, 58, 104, 134, 122, 10, 155, 137, 178, 179, 64, 185, 160, 60, - 80, 62, 230, 225, 41, 204, 65, 107, 85, 67, 54, 27, 231, 57, 200, - 155, 11, 122, 26, 52, 15, 227, 187, 10, 123, 50, 31, 252, 2, 208, - 66, 164, 23, 129, 158, 1, 45, 6, 45, 65, 222, 82, 208, 50, 208, - 114, 181, 40, 203, 21, 152, 195, 149, 160, 85, 160, 213, 160, 53, 160, - 181, 152, 131, 117, 160, 245, 234, 4, 126, 103, 225, 89, 148, 221, 160, - 38, 187, 231, 195, 54, 170, 19, 249, 157, 166, 77, 106, 218, 203, 38, - 178, 205, 72, 111, 1, 61, 167, 22, 247, 105, 5, 106, 26, 147, 30, - 179, 169, 71, 41, 61, 143, 91, 155, 75, 251, 43, 146, 211, 243, 40, - 251, 2, 250, 178, 21, 229, 95, 4, 109, 227, 229, 13, 252, 206, 203, - 118, 181, 123, 255, 73, 251, 78, 218, 95, 138, 123, 79, 113, 223, 89, - 83, 218, 119, 38, 33, 218, 79, 162, 111, 11, 129, 157, 196, 118, 160, - 142, 251, 94, 134, 184, 215, 19, 239, 5, 236, 4, 238, 46, 208, 75, - 160, 151, 65, 187, 65, 123, 64, 175, 128, 246, 146, 29, 195, 60, 238, - 3, 237, 7, 191, 30, 253, 60, 128, 126, 29, 228, 54, 129, 100, 79, - 123, 117, 236, 153, 112, 253, 53, 181, 1, 251, 190, 36, 118, 72, 157, - 196, 14, 131, 94, 199, 188, 28, 81, 39, 99, 31, 81, 139, 21, 113, - 190, 22, 43, 150, 215, 6, 141, 37, 5, 215, 82, 120, 68, 167, 82, - 220, 55, 40, 225, 243, 109, 196, 220, 25, 121, 164, 87, 241, 154, 184, - 255, 88, 143, 29, 99, 11, 16, 3, 221, 89, 134, 246, 176, 14, 244, - 201, 9, 114, 161, 223, 111, 128, 218, 163, 205, 163, 72, 31, 3, 189, - 9, 58, 14, 58, 1, 122, 11, 116, 18, 244, 54, 232, 29, 208, 187, - 160, 247, 64, 167, 64, 239, 3, 235, 3, 80, 41, 232, 67, 208, 71, - 160, 211, 100, 131, 89, 42, 251, 88, 157, 134, 246, 210, 232, 219, 240, - 74, 219, 79, 69, 253, 116, 208, 39, 106, 49, 246, 63, 131, 243, 167, - 160, 207, 164, 182, 62, 231, 125, 75, 135, 76, 218, 177, 47, 164, 121, - 41, 31, 227, 81, 236, 133, 253, 29, 202, 125, 5, 250, 26, 244, 141, - 90, 220, 31, 215, 99, 38, 72, 216, 132, 182, 77, 60, 14, 166, 249, - 248, 86, 186, 78, 123, 211, 50, 181, 47, 143, 133, 190, 83, 155, 185, - 55, 168, 207, 177, 197, 54, 190, 71, 91, 63, 64, 22, 63, 162, 204, - 79, 160, 159, 65, 191, 128, 126, 5, 253, 6, 250, 29, 116, 22, 116, - 142, 203, 152, 98, 76, 101, 159, 124, 216, 31, 232, 243, 104, 156, 255, - 196, 156, 158, 87, 91, 88, 109, 126, 23, 196, 82, 110, 14, 242, 85, - 180, 247, 242, 236, 37, 47, 0, 239, 162, 186, 49, 251, 11, 237, 254, - 173, 158, 134, 40, 100, 26, 191, 115, 34, 218, 51, 178, 201, 62, 236, - 31, 201, 14, 94, 194, 249, 50, 232, 138, 218, 227, 15, 175, 130, 174, - 129, 174, 131, 254, 5, 221, 0, 221, 4, 221, 2, 221, 6, 193, 193, - 50, 21, 72, 13, 210, 128, 124, 64, 213, 64, 213, 65, 190, 160, 26, - 160, 154, 160, 135, 64, 181, 64, 181, 65, 117, 64, 117, 65, 15, 131, - 252, 64, 245, 64, 245, 65, 143, 128, 26, 128, 30, 5, 53, 4, 53, - 2, 53, 6, 53, 1, 61, 6, 122, 28, 212, 20, 212, 12, 212, 28, - 212, 2, 228, 15, 106, 169, 97, 172, 21, 168, 53, 168, 13, 168, 173, - 198, 202, 218, 129, 218, 107, 124, 88, 7, 80, 71, 80, 0, 168, 19, - 168, 179, 198, 151, 117, 1, 117, 5, 61, 129, 186, 129, 160, 32, 80, - 48, 40, 68, 99, 99, 221, 64, 221, 193, 247, 0, 245, 212, 208, 90, - 105, 195, 122, 105, 200, 7, 217, 177, 154, 232, 99, 89, 187, 180, 79, - 16, 231, 188, 55, 202, 244, 1, 133, 106, 196, 249, 167, 253, 86, 24, - 202, 135, 107, 50, 48, 255, 84, 78, 212, 27, 45, 202, 8, 28, 47, - 147, 239, 65, 220, 242, 162, 123, 13, 125, 212, 89, 124, 159, 53, 22, - 251, 132, 8, 141, 91, 207, 178, 177, 70, 225, 27, 129, 27, 165, 17, - 203, 247, 197, 216, 250, 129, 250, 107, 114, 248, 189, 64, 113, 127, 67, - 245, 24, 27, 128, 252, 129, 154, 233, 168, 35, 166, 7, 161, 206, 96, - 208, 219, 146, 108, 251, 168, 103, 200, 253, 25, 130, 54, 134, 74, 253, - 29, 166, 153, 201, 191, 114, 31, 171, 162, 53, 234, 195, 134, 107, 102, - 49, 95, 169, 220, 80, 92, 24, 1, 26, 169, 17, 49, 62, 65, 123, - 209, 154, 92, 148, 111, 199, 70, 33, 127, 52, 104, 140, 38, 15, 125, - 200, 67, 141, 60, 89, 15, 123, 75, 216, 49, 56, 143, 5, 141, 211, - 184, 199, 233, 222, 95, 229, 179, 241, 26, 113, 237, 197, 226, 218, 4, - 62, 47, 79, 241, 121, 157, 168, 153, 141, 51, 249, 216, 124, 172, 157, - 124, 250, 141, 3, 70, 95, 29, 79, 210, 120, 230, 236, 73, 9, 147, - 218, 153, 172, 81, 115, 63, 62, 69, 227, 198, 158, 3, 236, 60, 22, - 135, 252, 120, 144, 14, 216, 9, 154, 185, 124, 239, 155, 168, 17, 247, - 124, 95, 168, 159, 198, 218, 31, 196, 244, 10, 76, 7, 48, 156, 106, - 81, 174, 6, 228, 39, 97, 142, 146, 113, 78, 1, 133, 34, 207, 136, - 243, 84, 205, 60, 126, 199, 157, 202, 167, 106, 220, 117, 230, 179, 52, - 9, 39, 29, 103, 19, 200, 172, 89, 192, 239, 117, 39, 202, 248, 212, - 102, 95, 102, 209, 136, 243, 58, 13, 249, 86, 210, 123, 182, 144, 223, - 123, 108, 38, 223, 223, 38, 187, 78, 241, 232, 34, 46, 95, 63, 46, - 99, 183, 124, 9, 227, 25, 172, 121, 119, 190, 47, 179, 161, 143, 118, - 141, 184, 167, 188, 32, 237, 43, 105, 31, 153, 129, 188, 76, 80, 22, - 218, 203, 214, 44, 150, 251, 220, 236, 142, 113, 126, 34, 221, 239, 204, - 65, 95, 166, 107, 150, 192, 238, 83, 27, 162, 221, 156, 129, 250, 99, - 84, 100, 215, 220, 122, 130, 189, 163, 102, 41, 90, 17, 211, 111, 75, - 54, 107, 22, 242, 115, 65, 121, 160, 124, 205, 50, 254, 132, 226, 254, - 109, 209, 94, 97, 57, 183, 82, 164, 115, 79, 65, 46, 179, 65, 115, - 128, 49, 23, 244, 52, 215, 187, 21, 92, 15, 231, 97, 220, 243, 185, - 174, 33, 94, 208, 136, 58, 72, 122, 52, 70, 51, 7, 109, 205, 161, - 159, 116, 129, 126, 204, 41, 167, 31, 164, 23, 11, 53, 158, 189, 252, - 23, 234, 81, 252, 62, 9, 237, 131, 23, 1, 255, 25, 208, 98, 208, - 18, 141, 15, 223, 23, 44, 5, 191, 12, 180, 92, 67, 235, 110, 37, - 250, 41, 238, 115, 190, 80, 123, 48, 87, 0, 115, 37, 214, 245, 42, - 13, 237, 133, 17, 135, 128, 95, 163, 169, 197, 218, 171, 250, 178, 181, - 154, 190, 108, 29, 174, 175, 215, 136, 251, 187, 103, 53, 226, 30, 239, - 21, 201, 103, 210, 62, 127, 161, 74, 121, 239, 115, 8, 235, 194, 219, - 168, 201, 54, 160, 205, 141, 146, 12, 55, 225, 188, 25, 180, 5, 244, - 28, 168, 0, 244, 188, 70, 148, 237, 11, 56, 111, 213, 136, 99, 120, - 17, 231, 109, 160, 237, 160, 29, 154, 242, 247, 84, 119, 34, 189, 11, - 125, 123, 73, 211, 149, 189, 140, 185, 219, 13, 106, 135, 118, 246, 104, - 220, 253, 236, 203, 94, 65, 255, 246, 130, 10, 53, 140, 235, 151, 251, - 30, 195, 62, 169, 223, 52, 134, 253, 224, 15, 0, 235, 32, 232, 85, - 140, 249, 53, 62, 214, 249, 210, 30, 144, 238, 195, 175, 98, 135, 52, - 116, 79, 179, 38, 59, 172, 33, 127, 133, 189, 59, 202, 30, 1, 21, - 129, 138, 65, 37, 32, 7, 200, 169, 161, 231, 21, 140, 185, 208, 222, - 27, 154, 213, 210, 115, 26, 95, 118, 20, 215, 142, 129, 222, 68, 91, - 199, 65, 39, 52, 107, 176, 46, 215, 160, 228, 154, 59, 98, 118, 113, - 141, 61, 39, 173, 187, 242, 49, 58, 233, 195, 90, 96, 174, 69, 189, - 181, 220, 6, 137, 251, 107, 248, 120, 21, 233, 192, 186, 255, 235, 236, - 92, 114, 26, 134, 129, 48, 236, 104, 186, 235, 138, 75, 112, 6, 164, - 74, 89, 32, 144, 96, 211, 75, 32, 245, 58, 221, 181, 168, 105, 120, - 174, 56, 73, 161, 45, 239, 247, 155, 2, 226, 28, 124, 191, 39, 9, - 1, 177, 234, 98, 148, 100, 60, 246, 216, 227, 177, 199, 254, 103, 17, - 124, 160, 79, 89, 159, 178, 94, 24, 153, 199, 227, 133, 80, 143, 173, - 117, 60, 103, 30, 140, 230, 47, 54, 243, 131, 189, 28, 216, 102, 208, - 233, 45, 64, 73, 244, 169, 102, 56, 196, 255, 27, 197, 121, 254, 8, - 187, 142, 173, 23, 38, 150, 114, 119, 74, 145, 75, 145, 75, 233, 79, - 51, 76, 139, 253, 226, 24, 27, 157, 64, 167, 133, 191, 42, 62, 44, - 213, 176, 164, 178, 143, 245, 190, 157, 33, 127, 14, 93, 64, 151, 166, - 76, 129, 235, 187, 66, 223, 181, 249, 30, 114, 195, 243, 22, 186, 179, - 1, 235, 99, 160, 223, 139, 196, 188, 98, 55, 113, 61, 37, 14, 215, - 137, 109, 122, 140, 104, 37, 235, 81, 230, 222, 50, 74, 50, 234, 100, - 124, 203, 110, 101, 189, 82, 110, 173, 26, 163, 100, 31, 208, 241, 104, - 67, 244, 40, 127, 58, 172, 238, 166, 79, 166, 57, 212, 28, 11, 63, - 115, 204, 68, 247, 177, 86, 146, 227, 11, 57, 178, 57, 178, 90, 199, - 210, 225, 254, 234, 241, 197, 109, 243, 204, 248, 54, 160, 23, 232, 21, - 122, 179, 45, 90, 94, 12, 51, 222, 223, 25, 219, 7, 54, 252, 180, - 237, 130, 167, 126, 53, 216, 203, 197, 219, 169, 120, 126, 119, 22, 111, - 247, 31, 222, 94, 156, 183, 153, 237, 71, 92, 254, 119, 206, 146, 115, - 28, 122, 190, 108, 181, 189, 178, 172, 60, 240, 55, 121, 216, 88, 60, }; - - *dataSize = 138801; - - // allocate a new array - *data = new unsigned char[138801]; - // and copy it. Now we are certain that the calling function - // can control the memory location - for (int i = 0; i < 138801 /* tmp array size */; i++) - { - (*data)[i] = load_blend[i]; - } - -} - - - diff --git a/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.h b/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.h deleted file mode 100644 index d5c1b210454..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file GPC_RawLoadDotBlendArray.h - * \ingroup player - */ - -#ifndef __GPC_RAWLOADDOTBLENDARRAY_H__ -#define __GPC_RAWLOADDOTBLENDARRAY_H__ - -void GetRawLoadingAnimation(unsigned char **data, int *dataSize); - -#endif /* __GPC_RAWLOADDOTBLENDARRAY_H__ */ diff --git a/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp b/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp deleted file mode 100644 index 2f58e9a692f..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp +++ /dev/null @@ -1,1462 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp - * \ingroup player - */ - - -// This file is automatically generated. Do not edit by hand! - -#include "GPC_RawLogoArrays.h" - -void GetRawBlenderLogo(unsigned char **data, int *width, int *height) -{ - // create an array that will automatically be deleted when) - // we're outta this scope - static unsigned char logo_blender_raw[] = { - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 20, 20, 20, 21, 44, 44, 44, - 45, 26, 26, 26, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12, 12, 12, 124, - 124, 124, 124, 232, 232, 232, 232, 248, 248, 248, 248, 243, 243, 243, 243, - 160, 160, 160, 160, 44, 44, 44, 44, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 13, 13, 13, 13, 172, 172, 172, 173, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 235, - 235, 235, 235, 95, 95, 95, 95, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 88, 88, 88, 88, - 255, 255, 255, 255, 255, 255, 255, 255, 254, 235, 217, 255, 253, 202, 152, - 255, 253, 216, 183, 255, 255, 250, 246, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 155, 155, 155, 155, 20, 20, 20, 20, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 255, 255, 255, 255, 255, - 249, 245, 255, 250, 162, 78, 255, 250, 145, 40, 255, 250, 149, 49, 255, - 251, 175, 104, 255, 254, 236, 219, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 202, 202, 202, 203, 53, 53, 53, 53, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 113, 113, 113, 113, 255, 255, 255, 255, 255, 253, 253, 255, 251, 196, - 147, 255, 249, 150, 51, 255, 249, 152, 55, 255, 248, 149, 50, 255, 249, - 160, 74, 255, 253, 219, 192, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 236, 236, 236, 236, 90, 90, 90, 90, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11, 76, 76, - 76, 76, 120, 120, 120, 120, 138, 138, 138, 138, 167, 167, 167, 167, 167, - 167, 167, 167, 167, 167, 167, 167, 163, 163, 163, 164, 196, 196, 196, 198, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 252, 206, 166, - 255, 248, 153, 61, 255, 247, 149, 52, 255, 247, 150, 53, 255, 247, 150, - 54, 255, 251, 196, 150, 255, 255, 249, 246, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 143, 143, 143, 143, 14, 14, 14, 14, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 43, 43, 43, 42, 198, 198, 198, 199, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 253, 226, 203, 255, - 248, 165, 85, 255, 246, 150, 53, 255, 246, 151, 55, 255, 246, 145, 46, - 255, 248, 175, 106, 255, 253, 238, 226, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 189, 189, 189, 189, 39, 39, 39, 39, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 22, 22, 22, 22, 214, 214, 214, 216, 255, - 255, 255, 255, 255, 255, 255, 255, 252, 245, 238, 255, 251, 233, 218, 255, - 251, 231, 215, 255, 251, 232, 216, 255, 251, 232, 216, 255, 252, 232, 216, - 255, 252, 232, 216, 255, 252, 232, 216, 255, 252, 232, 216, 255, 252, 232, - 216, 255, 252, 232, 217, 255, 252, 236, 223, 255, 251, 214, 186, 255, 245, - 156, 72, 255, 245, 150, 54, 255, 245, 151, 56, 255, 245, 146, 48, 255, - 246, 159, 76, 255, 252, 223, 198, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 226, 226, 226, 226, 71, 71, 71, 71, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 93, 93, 93, 93, 255, 255, 255, 255, 253, 253, 252, 255, 248, 209, - 173, 255, 244, 155, 66, 255, 244, 152, 62, 255, 245, 152, 62, 255, 245, - 153, 62, 255, 245, 153, 62, 255, 245, 152, 62, 255, 245, 152, 62, 255, - 245, 152, 62, 255, 245, 152, 62, 255, 245, 152, 62, 255, 245, 152, 62, - 255, 245, 153, 62, 255, 245, 155, 66, 255, 244, 152, 62, 255, 244, 150, - 56, 255, 244, 150, 57, 255, 244, 150, 56, 255, 243, 146, 49, 255, 243, - 147, 54, 255, 249, 203, 162, 255, 254, 253, 254, 255, 255, 255, 255, 255, - 248, 248, 248, 248, 143, 143, 143, 143, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 119, 119, 119, 120, 119, - 119, 119, 120, 119, 119, 119, 120, 119, 119, 119, 120, 119, 119, 119, 120, - 119, 119, 119, 120, 119, 119, 119, 120, 119, 119, 119, 120, 119, 119, 119, - 120, 119, 119, 119, 120, 119, 119, 119, 120, 119, 119, 119, 120, 119, 119, - 119, 120, 119, 119, 119, 120, 119, 119, 119, 120, 119, 119, 119, 120, 119, - 119, 119, 120, 119, 119, 119, 120, 119, 119, 119, 120, 118, 118, 118, 120, - 118, 118, 118, 120, 118, 118, 118, 120, 118, 118, 118, 120, 118, 118, 118, - 120, 118, 118, 118, 119, 118, 118, 118, 119, 118, 118, 118, 120, 118, 118, - 118, 119, 111, 111, 111, 112, 75, 75, 75, 75, 20, 20, 20, 20, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 125, 125, 125, 126, - 255, 255, 255, 255, 250, 242, 234, 255, 242, 149, 57, 255, 242, 142, 42, - 255, 243, 146, 48, 255, 243, 146, 48, 255, 243, 146, 48, 255, 243, 145, - 48, 255, 243, 145, 48, 255, 243, 147, 51, 255, 244, 149, 55, 255, 244, - 149, 55, 255, 243, 149, 54, 255, 243, 149, 54, 255, 243, 149, 55, 255, - 243, 148, 52, 255, 243, 146, 49, 255, 243, 146, 49, 255, 243, 146, 49, - 255, 243, 147, 52, 255, 242, 149, 55, 255, 242, 147, 52, 255, 241, 142, - 45, 255, 246, 181, 122, 255, 252, 244, 238, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 223, 223, 223, 223, 102, 102, 102, 102, 12, 12, - 12, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 109, 109, 109, 110, 255, 255, 255, 255, 251, - 251, 250, 255, 245, 194, 149, 255, 243, 166, 90, 255, 243, 167, 95, 255, - 243, 168, 96, 255, 243, 168, 96, 255, 244, 168, 96, 255, 244, 173, 105, - 255, 244, 164, 89, 255, 242, 148, 55, 255, 242, 149, 56, 255, 242, 149, - 56, 255, 242, 148, 54, 255, 241, 143, 46, 255, 242, 149, 58, 255, 244, - 165, 90, 255, 244, 172, 102, 255, 244, 169, 96, 255, 242, 154, 69, 255, - 241, 142, 45, 255, 241, 146, 50, 255, 241, 147, 54, 255, 240, 141, 42, - 255, 243, 166, 94, 255, 251, 237, 226, 255, 254, 255, 255, 255, 253, 253, - 253, 255, 253, 253, 253, 255, 254, 254, 254, 255, 225, 232, 238, 255, 215, - 224, 231, 255, 246, 247, 249, 255, 255, 254, 254, 255, 253, 253, 253, 255, - 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, - 255, 253, 253, 253, 255, 253, 253, 253, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 254, 254, 254, 255, 253, 253, 253, 255, 253, - 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, - 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, - 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, - 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, - 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, - 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, - 255, 252, 252, 252, 255, 252, 252, 252, 255, 252, 252, 252, 255, 253, 253, - 253, 255, 255, 254, 253, 255, 244, 246, 247, 255, 208, 220, 229, 255, 234, - 238, 241, 255, 253, 253, 253, 255, 252, 252, 252, 255, 251, 251, 251, 255, - 251, 251, 251, 255, 251, 251, 251, 255, 251, 251, 251, 255, 251, 251, 251, - 255, 251, 251, 251, 255, 251, 251, 251, 255, 250, 250, 250, 255, 250, 250, - 250, 255, 250, 250, 250, 255, 250, 250, 250, 255, 250, 250, 250, 255, 250, - 250, 250, 255, 249, 249, 249, 255, 249, 249, 249, 255, 253, 253, 252, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 184, 183, 183, 182, 25, 25, 25, - 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 45, 45, 45, 45, 244, 244, 244, 248, 255, 255, 255, 255, 250, 252, - 254, 255, 250, 247, 246, 255, 250, 248, 246, 255, 250, 248, 246, 255, 250, - 249, 248, 255, 251, 254, 255, 255, 249, 230, 214, 255, 243, 167, 95, 255, - 241, 145, 50, 255, 241, 148, 56, 255, 241, 145, 51, 255, 241, 148, 56, - 255, 245, 182, 123, 255, 249, 227, 209, 255, 255, 253, 250, 255, 255, 255, - 254, 255, 255, 255, 254, 255, 253, 241, 232, 255, 246, 195, 152, 255, 241, - 155, 72, 255, 240, 142, 45, 255, 240, 147, 54, 255, 240, 141, 43, 255, - 242, 161, 86, 255, 250, 233, 222, 255, 252, 255, 255, 255, 252, 252, 253, - 255, 255, 255, 255, 255, 154, 181, 201, 255, 8, 78, 129, 255, 70, 124, - 161, 255, 249, 249, 250, 255, 255, 255, 254, 255, 253, 253, 253, 255, 253, - 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, 253, 253, 253, 255, - 254, 254, 254, 255, 213, 226, 233, 255, 119, 159, 186, 255, 127, 167, 191, - 255, 245, 247, 249, 255, 254, 254, 254, 255, 252, 252, 253, 255, 252, 252, - 252, 255, 253, 253, 253, 255, 255, 255, 254, 255, 255, 254, 254, 255, 253, - 253, 253, 255, 252, 252, 252, 255, 253, 253, 253, 255, 253, 253, 253, 255, - 253, 253, 253, 255, 252, 252, 252, 255, 252, 252, 252, 255, 252, 252, 252, - 255, 252, 252, 252, 255, 252, 252, 252, 255, 253, 253, 253, 255, 252, 252, - 252, 255, 252, 252, 252, 255, 252, 252, 252, 255, 252, 252, 252, 255, 252, - 252, 252, 255, 252, 252, 252, 255, 252, 252, 252, 255, 252, 252, 252, 255, - 252, 252, 252, 255, 252, 252, 252, 255, 255, 255, 255, 255, 206, 218, 228, - 255, 38, 105, 148, 255, 13, 91, 139, 255, 202, 213, 222, 255, 255, 255, - 255, 255, 251, 251, 251, 255, 251, 251, 251, 255, 251, 251, 251, 255, 253, - 252, 252, 255, 253, 252, 252, 255, 251, 251, 251, 255, 250, 250, 250, 255, - 250, 250, 250, 255, 250, 250, 250, 255, 250, 250, 250, 255, 249, 249, 249, - 255, 249, 249, 249, 255, 249, 249, 249, 255, 249, 249, 249, 255, 250, 250, - 249, 255, 252, 252, 251, 255, 228, 232, 236, 255, 198, 210, 220, 255, 226, - 229, 234, 255, 239, 244, 249, 255, 179, 181, 183, 190, 15, 15, 14, 13, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 94, 94, 94, 94, 220, 220, 220, 220, 250, 251, 251, 254, 250, 251, 252, - 255, 250, 251, 252, 255, 250, 253, 255, 255, 250, 255, 255, 255, 246, 216, - 188, 255, 241, 151, 62, 255, 240, 144, 49, 255, 240, 148, 56, 255, 240, - 145, 50, 255, 240, 149, 59, 255, 247, 214, 184, 255, 254, 255, 255, 255, - 255, 255, 255, 255, 238, 241, 245, 255, 210, 220, 230, 255, 215, 224, 232, - 255, 249, 252, 254, 255, 255, 255, 255, 255, 249, 234, 222, 255, 241, 165, - 94, 255, 239, 142, 44, 255, 239, 146, 53, 255, 238, 141, 44, 255, 240, - 156, 78, 255, 250, 237, 226, 255, 252, 255, 255, 255, 255, 255, 255, 255, - 154, 181, 201, 255, 0, 71, 125, 255, 29, 98, 142, 255, 246, 246, 248, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 252, 252, 252, 255, 255, 255, 255, 255, 173, - 199, 214, 255, 0, 68, 122, 255, 0, 83, 132, 255, 236, 241, 244, 255, - 255, 255, 254, 255, 255, 254, 253, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 251, 248, 248, 255, 254, 250, 250, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 254, 253, 255, 252, 252, 252, 255, 253, 253, 253, 255, 255, - 255, 254, 255, 255, 255, 254, 255, 253, 253, 252, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 253, 253, 252, 255, 251, 251, 251, 255, 251, 251, 251, 255, 253, 252, - 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 177, 201, 216, 255, 0, 81, 132, 255, - 7, 86, 136, 255, 203, 213, 222, 255, 255, 255, 255, 255, 251, 251, 251, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 249, 247, 247, 255, 248, 246, - 246, 255, 255, 255, 253, 255, 255, 255, 255, 255, 252, 251, 251, 255, 249, - 249, 249, 255, 249, 249, 249, 255, 251, 251, 250, 255, 251, 250, 250, 255, - 251, 250, 249, 255, 255, 255, 254, 255, 255, 251, 250, 255, 253, 251, 249, - 255, 218, 225, 231, 255, 155, 174, 193, 255, 175, 186, 200, 255, 170, 184, - 200, 255, 240, 244, 248, 255, 134, 133, 133, 133, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, - 56, 56, 57, 237, 237, 237, 239, 252, 252, 252, 255, 249, 254, 255, 255, - 249, 247, 246, 255, 243, 191, 141, 255, 239, 144, 50, 255, 239, 144, 50, - 255, 239, 147, 55, 255, 239, 146, 52, 255, 239, 146, 55, 255, 246, 214, - 185, 255, 253, 255, 255, 255, 252, 253, 254, 255, 156, 184, 203, 255, 38, - 103, 146, 255, 11, 89, 137, 255, 11, 87, 136, 255, 65, 123, 160, 255, - 199, 214, 225, 255, 255, 255, 255, 255, 250, 238, 229, 255, 239, 159, 82, - 255, 237, 142, 47, 255, 238, 145, 52, 255, 236, 137, 37, 255, 244, 193, - 145, 255, 251, 255, 255, 255, 255, 255, 255, 255, 154, 181, 201, 255, 0, - 73, 126, 255, 41, 105, 147, 255, 227, 231, 236, 255, 176, 198, 212, 255, - 134, 170, 194, 255, 120, 161, 187, 255, 151, 178, 198, 255, 203, 217, 226, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 178, 201, 215, 255, 0, 79, - 130, 255, 15, 93, 139, 255, 235, 241, 244, 255, 255, 255, 255, 255, 244, - 246, 247, 255, 163, 190, 207, 255, 101, 144, 174, 255, 54, 109, 148, 255, - 65, 116, 153, 255, 114, 154, 181, 255, 175, 198, 212, 255, 245, 246, 247, - 255, 253, 253, 253, 255, 246, 247, 248, 255, 236, 240, 244, 255, 238, 242, - 245, 255, 255, 254, 252, 255, 200, 215, 225, 255, 128, 164, 188, 255, 104, - 147, 177, 255, 128, 165, 189, 255, 186, 202, 216, 255, 248, 247, 248, 255, - 252, 252, 252, 255, 254, 254, 253, 255, 252, 251, 251, 255, 186, 203, 216, - 255, 135, 171, 194, 255, 121, 162, 188, 255, 140, 174, 196, 255, 191, 209, - 221, 255, 171, 196, 212, 255, 3, 86, 135, 255, 9, 87, 136, 255, 202, - 212, 221, 255, 255, 255, 255, 255, 254, 252, 251, 255, 186, 204, 217, 255, - 115, 157, 184, 255, 61, 116, 154, 255, 56, 111, 151, 255, 101, 146, 175, - 255, 169, 191, 208, 255, 240, 242, 243, 255, 254, 253, 252, 255, 247, 247, - 247, 255, 244, 243, 244, 255, 246, 243, 244, 255, 246, 247, 246, 255, 163, - 190, 206, 255, 90, 132, 165, 255, 139, 167, 189, 255, 236, 237, 239, 255, - 198, 206, 217, 255, 198, 205, 215, 255, 181, 193, 206, 255, 246, 247, 248, - 255, 229, 228, 228, 233, 24, 24, 24, 24, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 62, 62, 62, 63, 209, 209, 209, 212, 250, 251, - 251, 253, 249, 254, 255, 255, 247, 235, 223, 255, 240, 170, 103, 255, 237, - 139, 41, 255, 237, 144, 52, 255, 238, 146, 54, 255, 238, 145, 54, 255, - 238, 140, 44, 255, 242, 181, 123, 255, 251, 255, 255, 255, 253, 253, 253, - 255, 133, 169, 192, 255, 0, 78, 130, 255, 0, 82, 132, 255, 2, 85, - 134, 255, 2, 85, 134, 255, 0, 78, 129, 255, 23, 92, 138, 255, 196, - 210, 221, 255, 255, 255, 255, 255, 245, 212, 185, 255, 236, 141, 46, 255, - 237, 144, 51, 255, 236, 141, 45, 255, 239, 163, 90, 255, 250, 248, 247, - 255, 255, 255, 255, 255, 153, 181, 200, 255, 0, 75, 127, 255, 22, 93, - 139, 255, 42, 106, 148, 255, 0, 69, 122, 255, 0, 63, 118, 255, 0, - 62, 117, 255, 0, 70, 123, 255, 9, 84, 133, 255, 150, 179, 199, 255, - 255, 255, 255, 255, 178, 201, 215, 255, 0, 78, 129, 255, 14, 92, 138, - 255, 241, 245, 247, 255, 234, 240, 243, 255, 69, 126, 163, 255, 0, 70, - 123, 255, 0, 72, 124, 255, 43, 109, 150, 255, 39, 106, 147, 255, 0, - 74, 126, 255, 0, 72, 125, 255, 107, 149, 177, 255, 255, 255, 255, 255, - 176, 199, 213, 255, 15, 89, 136, 255, 28, 101, 145, 255, 101, 145, 174, - 255, 0, 79, 129, 255, 0, 70, 122, 255, 0, 69, 122, 255, 0, 71, - 124, 255, 0, 78, 128, 255, 125, 162, 186, 255, 255, 255, 254, 255, 246, - 247, 248, 255, 107, 151, 179, 255, 1, 80, 130, 255, 0, 69, 123, 255, - 0, 65, 120, 255, 0, 67, 121, 255, 0, 77, 128, 255, 30, 102, 146, - 255, 8, 88, 136, 255, 10, 88, 136, 255, 204, 213, 222, 255, 248, 250, - 250, 255, 111, 154, 182, 255, 0, 81, 131, 255, 0, 73, 126, 255, 37, - 105, 148, 255, 52, 115, 154, 255, 4, 83, 132, 255, 0, 74, 126, 255, - 74, 128, 163, 255, 236, 239, 242, 255, 223, 228, 232, 255, 61, 114, 152, - 255, 63, 114, 152, 255, 89, 137, 168, 255, 0, 76, 127, 255, 0, 57, - 114, 255, 73, 125, 161, 255, 255, 250, 248, 255, 249, 248, 248, 255, 247, - 247, 247, 255, 247, 247, 246, 255, 245, 245, 245, 255, 255, 255, 255, 255, - 112, 112, 112, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 107, 107, 107, 108, - 246, 246, 246, 249, 255, 255, 255, 255, 247, 252, 255, 255, 243, 215, 190, - 255, 237, 151, 69, 255, 236, 139, 43, 255, 236, 144, 53, 255, 236, 145, - 53, 255, 237, 145, 53, 255, 237, 144, 52, 255, 236, 143, 53, 255, 245, - 217, 197, 255, 255, 255, 255, 255, 206, 218, 227, 255, 8, 87, 135, 255, - 0, 83, 132, 255, 5, 86, 135, 255, 5, 86, 135, 255, 5, 86, 135, - 255, 5, 86, 134, 255, 0, 76, 127, 255, 73, 128, 162, 255, 251, 252, - 253, 255, 250, 241, 234, 255, 237, 151, 69, 255, 236, 141, 48, 255, 236, - 142, 49, 255, 236, 145, 57, 255, 247, 230, 219, 255, 255, 255, 255, 255, - 153, 180, 200, 255, 0, 76, 127, 255, 0, 79, 129, 255, 8, 87, 134, - 255, 100, 146, 176, 255, 144, 174, 196, 255, 123, 163, 188, 255, 36, 104, - 147, 255, 0, 75, 126, 255, 10, 82, 130, 255, 202, 214, 223, 255, 186, - 206, 219, 255, 0, 78, 128, 255, 15, 93, 138, 255, 243, 245, 246, 255, - 113, 152, 179, 255, 0, 68, 120, 255, 7, 82, 131, 255, 154, 181, 201, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 163, 186, 203, 255, 2, 79, - 129, 255, 0, 75, 126, 255, 167, 188, 204, 255, 177, 199, 212, 255, 0, - 77, 127, 255, 0, 79, 129, 255, 0, 80, 129, 255, 90, 140, 171, 255, - 185, 197, 211, 255, 158, 181, 200, 255, 28, 100, 144, 255, 0, 75, 126, - 255, 34, 102, 145, 255, 252, 251, 249, 255, 147, 178, 197, 255, 0, 73, - 125, 255, 0, 79, 130, 255, 60, 120, 158, 255, 139, 173, 195, 255, 147, - 175, 196, 255, 83, 135, 167, 255, 0, 81, 130, 255, 1, 83, 133, 255, - 11, 88, 136, 255, 214, 219, 226, 255, 167, 192, 207, 255, 0, 75, 127, - 255, 0, 79, 129, 255, 116, 156, 182, 255, 255, 254, 252, 255, 255, 255, - 254, 255, 196, 208, 219, 255, 25, 96, 140, 255, 0, 71, 124, 255, 110, - 153, 180, 255, 219, 224, 229, 255, 7, 87, 134, 255, 0, 79, 130, 255, - 0, 80, 129, 255, 72, 126, 161, 255, 124, 161, 187, 255, 168, 191, 207, - 255, 249, 247, 246, 255, 246, 246, 246, 255, 245, 245, 245, 255, 245, 245, - 244, 255, 244, 244, 244, 255, 255, 255, 255, 255, 166, 166, 166, 171, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 22, - 22, 22, 157, 157, 157, 158, 255, 255, 255, 255, 250, 254, 255, 255, 246, - 247, 248, 255, 240, 196, 154, 255, 234, 141, 50, 255, 235, 141, 47, 255, - 235, 144, 53, 255, 235, 141, 48, 255, 235, 143, 52, 255, 235, 144, 53, - 255, 235, 142, 50, 255, 236, 149, 63, 255, 246, 237, 230, 255, 255, 255, - 255, 255, 167, 192, 208, 255, 0, 81, 131, 255, 3, 85, 133, 255, 5, - 86, 134, 255, 5, 85, 134, 255, 5, 85, 134, 255, 4, 85, 134, 255, - 0, 81, 131, 255, 40, 104, 146, 255, 240, 243, 245, 255, 251, 249, 250, - 255, 237, 163, 99, 255, 235, 139, 43, 255, 235, 142, 50, 255, 234, 139, - 47, 255, 243, 209, 184, 255, 255, 255, 255, 255, 152, 180, 199, 255, 0, - 75, 126, 255, 2, 76, 127, 255, 143, 172, 193, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 191, 207, 218, 255, 4, 83, 131, - 255, 0, 70, 122, 255, 107, 150, 178, 255, 186, 205, 217, 255, 0, 79, - 128, 255, 20, 95, 141, 255, 207, 218, 226, 255, 15, 90, 136, 255, 0, - 76, 127, 255, 33, 101, 144, 255, 170, 193, 208, 255, 172, 195, 210, 255, - 173, 197, 211, 255, 157, 185, 203, 255, 8, 88, 135, 255, 0, 75, 126, - 255, 40, 105, 146, 255, 155, 181, 200, 255, 1, 83, 131, 255, 0, 74, - 125, 255, 92, 140, 172, 255, 255, 255, 254, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 137, 171, 192, 255, 0, 73, 124, 255, 20, 95, 141, 255, - 223, 229, 235, 255, 39, 104, 145, 255, 0, 75, 126, 255, 50, 112, 151, - 255, 243, 242, 243, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 253, - 252, 255, 101, 144, 173, 255, 0, 76, 127, 255, 12, 89, 135, 255, 200, - 208, 218, 255, 71, 125, 160, 255, 0, 77, 128, 255, 12, 89, 136, 255, - 152, 180, 198, 255, 174, 197, 211, 255, 170, 194, 209, 255, 177, 197, 210, - 255, 61, 118, 155, 255, 0, 75, 126, 255, 44, 110, 150, 255, 202, 212, - 221, 255, 17, 92, 137, 255, 0, 75, 126, 255, 76, 130, 164, 255, 251, - 248, 246, 255, 255, 255, 254, 255, 255, 252, 250, 255, 244, 244, 244, 255, - 244, 244, 244, 255, 244, 244, 244, 255, 244, 244, 244, 255, 243, 243, 243, - 255, 254, 254, 254, 255, 172, 172, 172, 179, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 31, 31, 31, 199, 199, 199, 202, 255, 255, 255, - 255, 247, 252, 255, 255, 244, 235, 228, 255, 237, 175, 114, 255, 232, 137, - 42, 255, 233, 141, 49, 255, 234, 142, 51, 255, 233, 138, 44, 255, 235, - 156, 79, 255, 234, 146, 59, 255, 234, 142, 51, 255, 234, 142, 50, 255, - 235, 146, 59, 255, 245, 229, 219, 255, 255, 255, 255, 255, 192, 208, 219, - 255, 0, 81, 130, 255, 1, 83, 132, 255, 4, 85, 133, 255, 4, 85, - 133, 255, 4, 85, 133, 255, 4, 85, 133, 255, 0, 78, 128, 255, 53, - 115, 153, 255, 245, 247, 249, 255, 250, 246, 244, 255, 236, 155, 80, 255, - 234, 139, 45, 255, 233, 142, 50, 255, 232, 137, 42, 255, 241, 201, 169, - 255, 255, 255, 255, 255, 152, 179, 198, 255, 0, 73, 123, 255, 15, 92, - 137, 255, 235, 238, 240, 255, 254, 252, 251, 255, 248, 248, 248, 255, 252, - 251, 250, 255, 242, 243, 244, 255, 33, 99, 142, 255, 0, 71, 124, 255, - 76, 131, 165, 255, 175, 198, 213, 255, 0, 79, 128, 255, 22, 97, 142, - 255, 182, 198, 211, 255, 9, 85, 133, 255, 0, 81, 129, 255, 0, 81, - 129, 255, 0, 72, 123, 255, 0, 71, 122, 255, 0, 71, 122, 255, 0, - 72, 123, 255, 0, 75, 125, 255, 0, 73, 124, 255, 14, 88, 134, 255, - 134, 166, 187, 255, 1, 83, 131, 255, 2, 79, 128, 255, 185, 198, 210, - 255, 255, 255, 255, 255, 248, 248, 248, 255, 255, 255, 255, 255, 161, 186, - 202, 255, 0, 74, 125, 255, 23, 97, 141, 255, 204, 216, 225, 255, 14, - 91, 137, 255, 0, 72, 124, 255, 103, 147, 175, 255, 255, 255, 252, 255, - 248, 248, 248, 255, 247, 247, 247, 255, 255, 255, 255, 255, 174, 196, 211, - 255, 0, 79, 129, 255, 12, 89, 135, 255, 179, 194, 207, 255, 20, 95, - 141, 255, 1, 82, 131, 255, 4, 84, 133, 255, 0, 77, 127, 255, 0, - 74, 124, 255, 0, 74, 125, 255, 0, 74, 125, 255, 0, 77, 127, 255, - 0, 76, 125, 255, 15, 89, 135, 255, 184, 198, 210, 255, 18, 93, 138, - 255, 0, 72, 123, 255, 136, 169, 191, 255, 255, 255, 253, 255, 244, 244, - 244, 255, 244, 244, 244, 255, 244, 244, 244, 255, 243, 243, 243, 255, 243, - 243, 243, 255, 243, 243, 243, 255, 242, 242, 242, 255, 255, 255, 255, 255, - 165, 165, 165, 171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 21, 21, 21, 198, - 198, 198, 203, 255, 255, 255, 255, 244, 249, 253, 255, 241, 219, 201, 255, - 233, 154, 79, 255, 231, 135, 38, 255, 232, 141, 51, 255, 232, 140, 48, - 255, 232, 137, 42, 255, 237, 176, 119, 255, 243, 230, 220, 255, 234, 149, - 67, 255, 233, 140, 49, 255, 233, 142, 51, 255, 232, 138, 45, 255, 240, - 201, 168, 255, 249, 254, 255, 255, 243, 243, 244, 255, 72, 126, 160, 255, - 0, 73, 124, 255, 2, 83, 131, 255, 4, 84, 132, 255, 4, 84, 132, - 255, 0, 80, 130, 255, 0, 74, 125, 255, 147, 175, 195, 255, 255, 255, - 255, 255, 245, 229, 216, 255, 233, 144, 55, 255, 233, 140, 48, 255, 233, - 140, 49, 255, 232, 138, 47, 255, 241, 210, 186, 255, 255, 255, 255, 255, - 151, 178, 197, 255, 0, 73, 123, 255, 11, 88, 134, 255, 218, 225, 231, - 255, 255, 255, 253, 255, 247, 247, 247, 255, 255, 253, 252, 255, 232, 236, - 239, 255, 18, 92, 137, 255, 0, 71, 123, 255, 83, 136, 167, 255, 178, - 199, 213, 255, 0, 79, 128, 255, 22, 96, 140, 255, 189, 204, 215, 255, - 6, 84, 132, 255, 0, 76, 126, 255, 45, 108, 148, 255, 166, 183, 200, - 255, 162, 179, 197, 255, 160, 179, 197, 255, 168, 184, 200, 255, 175, 189, - 204, 255, 167, 183, 200, 255, 175, 190, 205, 255, 154, 180, 198, 255, 0, - 78, 128, 255, 7, 84, 132, 255, 206, 214, 222, 255, 254, 253, 251, 255, - 247, 247, 247, 255, 255, 255, 254, 255, 157, 183, 200, 255, 0, 74, 124, - 255, 22, 96, 141, 255, 210, 220, 227, 255, 20, 93, 138, 255, 0, 72, - 124, 255, 88, 136, 168, 255, 255, 255, 252, 255, 249, 249, 248, 255, 247, - 247, 247, 255, 255, 255, 255, 255, 164, 188, 204, 255, 0, 77, 127, 255, - 12, 88, 134, 255, 186, 198, 210, 255, 38, 104, 146, 255, 0, 78, 128, - 255, 22, 93, 138, 255, 159, 177, 196, 255, 162, 181, 198, 255, 159, 178, - 196, 255, 164, 182, 199, 255, 173, 187, 203, 255, 165, 182, 199, 255, 171, - 186, 202, 255, 199, 209, 218, 255, 12, 89, 134, 255, 0, 77, 126, 255, - 175, 189, 202, 255, 254, 251, 249, 255, 243, 243, 243, 255, 243, 243, 243, - 255, 243, 243, 243, 255, 243, 243, 243, 255, 242, 242, 242, 255, 242, 242, - 242, 255, 242, 242, 242, 255, 255, 255, 255, 255, 127, 127, 127, 127, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 123, 123, 123, 126, 255, 255, 255, 255, 244, 247, - 250, 255, 237, 204, 174, 255, 230, 140, 50, 255, 230, 136, 43, 255, 231, - 141, 52, 255, 231, 138, 45, 255, 231, 138, 48, 255, 237, 190, 146, 255, - 245, 246, 249, 255, 245, 247, 251, 255, 235, 164, 103, 255, 231, 137, 42, - 255, 232, 141, 51, 255, 231, 137, 43, 255, 235, 163, 95, 255, 244, 243, - 244, 255, 252, 253, 254, 255, 228, 230, 234, 255, 79, 129, 162, 255, 0, - 79, 128, 255, 0, 72, 123, 255, 0, 73, 124, 255, 17, 88, 134, 255, - 128, 164, 186, 255, 251, 249, 248, 255, 249, 253, 255, 255, 238, 189, 144, - 255, 231, 137, 42, 255, 232, 141, 50, 255, 232, 139, 47, 255, 232, 144, - 57, 255, 244, 231, 221, 255, 255, 255, 255, 255, 151, 177, 196, 255, 0, - 74, 124, 255, 0, 74, 125, 255, 91, 138, 169, 255, 244, 244, 245, 255, - 255, 255, 253, 255, 251, 250, 248, 255, 128, 163, 187, 255, 0, 77, 127, - 255, 0, 69, 121, 255, 136, 167, 190, 255, 187, 206, 217, 255, 0, 77, - 127, 255, 18, 92, 137, 255, 226, 231, 235, 255, 51, 111, 149, 255, 0, - 69, 121, 255, 38, 103, 143, 255, 227, 231, 234, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 206, 217, 225, 255, 145, 173, 193, 255, 229, 234, 237, - 255, 255, 255, 255, 255, 169, 192, 207, 255, 0, 76, 126, 255, 7, 85, - 132, 255, 210, 217, 224, 255, 253, 251, 250, 255, 246, 246, 246, 255, 255, - 255, 253, 255, 157, 182, 200, 255, 0, 74, 124, 255, 17, 93, 138, 255, - 238, 239, 241, 255, 89, 135, 165, 255, 0, 72, 123, 255, 19, 90, 135, - 255, 180, 197, 211, 255, 255, 251, 249, 255, 255, 254, 251, 255, 220, 226, - 231, 255, 52, 112, 150, 255, 0, 77, 126, 255, 10, 86, 132, 255, 209, - 214, 221, 255, 121, 157, 182, 255, 0, 70, 122, 255, 12, 86, 133, 255, - 188, 202, 214, 255, 255, 255, 255, 255, 255, 255, 255, 255, 227, 232, 235, - 255, 142, 173, 194, 255, 222, 227, 231, 255, 255, 255, 254, 255, 210, 218, - 224, 255, 10, 86, 132, 255, 0, 77, 125, 255, 175, 189, 202, 255, 254, - 250, 248, 255, 242, 242, 242, 255, 242, 242, 242, 255, 242, 242, 242, 255, - 242, 242, 242, 255, 242, 242, 242, 255, 241, 241, 241, 255, 246, 246, 246, - 255, 231, 231, 231, 241, 39, 39, 39, 38, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 9, - 215, 215, 215, 222, 249, 253, 255, 255, 239, 219, 201, 255, 229, 139, 51, - 255, 229, 137, 45, 255, 229, 140, 50, 255, 229, 135, 41, 255, 230, 143, - 57, 255, 238, 204, 173, 255, 244, 249, 253, 255, 245, 246, 248, 255, 244, - 250, 255, 255, 237, 194, 154, 255, 230, 135, 40, 255, 231, 141, 50, 255, - 231, 140, 50, 255, 231, 136, 44, 255, 237, 185, 141, 255, 245, 248, 253, - 255, 251, 252, 254, 255, 251, 248, 246, 255, 175, 193, 207, 255, 113, 152, - 179, 255, 128, 162, 186, 255, 210, 217, 224, 255, 255, 253, 252, 255, 248, - 254, 255, 255, 240, 211, 185, 255, 230, 139, 49, 255, 231, 139, 47, 255, - 231, 140, 50, 255, 230, 136, 42, 255, 233, 158, 87, 255, 245, 244, 243, - 255, 255, 255, 255, 255, 148, 175, 194, 255, 0, 69, 121, 255, 0, 78, - 127, 255, 0, 74, 124, 255, 41, 104, 144, 255, 109, 149, 176, 255, 65, - 120, 156, 255, 0, 75, 124, 255, 0, 69, 121, 255, 36, 100, 141, 255, - 239, 240, 241, 255, 177, 199, 212, 255, 0, 71, 123, 255, 6, 86, 132, - 255, 241, 244, 244, 255, 190, 203, 214, 255, 13, 83, 129, 255, 0, 68, - 119, 255, 24, 94, 138, 255, 119, 160, 185, 255, 107, 151, 178, 255, 4, - 82, 129, 255, 0, 57, 112, 255, 70, 120, 155, 255, 254, 253, 252, 255, - 166, 190, 205, 255, 0, 70, 122, 255, 0, 80, 128, 255, 207, 215, 222, - 255, 253, 251, 250, 255, 246, 246, 246, 255, 255, 255, 253, 255, 154, 180, - 198, 255, 0, 68, 120, 255, 8, 87, 134, 255, 240, 243, 243, 255, 192, - 207, 217, 255, 4, 80, 128, 255, 0, 73, 124, 255, 3, 82, 129, 255, - 82, 130, 162, 255, 101, 143, 171, 255, 21, 90, 135, 255, 0, 72, 123, - 255, 0, 78, 127, 255, 1, 80, 128, 255, 204, 212, 219, 255, 222, 228, - 233, 255, 36, 101, 143, 255, 0, 70, 121, 255, 11, 85, 131, 255, 104, - 147, 174, 255, 119, 158, 183, 255, 35, 100, 141, 255, 0, 62, 116, 255, - 34, 98, 140, 255, 232, 233, 235, 255, 211, 218, 224, 255, 2, 81, 129, - 255, 0, 72, 121, 255, 172, 186, 200, 255, 253, 250, 248, 255, 242, 242, - 242, 255, 241, 241, 241, 255, 241, 241, 241, 255, 241, 241, 241, 255, 240, - 240, 240, 255, 241, 241, 241, 255, 255, 255, 255, 255, 140, 140, 140, 145, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 19, 19, 19, 19, 231, 231, 231, 238, 245, - 251, 255, 255, 236, 199, 168, 255, 227, 130, 35, 255, 228, 136, 45, 255, - 227, 132, 37, 255, 230, 152, 77, 255, 239, 219, 202, 255, 244, 250, 255, - 255, 251, 251, 252, 255, 245, 245, 245, 255, 244, 248, 251, 255, 240, 221, - 204, 255, 230, 140, 52, 255, 230, 138, 47, 255, 230, 140, 50, 255, 230, - 139, 48, 255, 229, 136, 44, 255, 235, 180, 132, 255, 243, 235, 230, 255, - 246, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 252, 255, 255, 255, 244, 244, 245, 255, 238, 198, 161, 255, 230, 141, - 53, 255, 230, 138, 45, 255, 230, 139, 49, 255, 230, 139, 49, 255, 229, - 132, 36, 255, 236, 184, 136, 255, 245, 250, 254, 255, 254, 253, 252, 255, - 164, 185, 201, 255, 39, 95, 137, 255, 72, 121, 155, 255, 141, 170, 190, - 255, 31, 96, 139, 255, 0, 70, 120, 255, 0, 70, 120, 255, 5, 81, - 128, 255, 62, 115, 151, 255, 201, 211, 219, 255, 255, 255, 254, 255, 185, - 203, 214, 255, 41, 100, 141, 255, 52, 112, 149, 255, 233, 237, 239, 255, - 255, 254, 252, 255, 187, 202, 213, 255, 74, 123, 157, 255, 17, 88, 133, - 255, 0, 70, 120, 255, 0, 72, 122, 255, 20, 92, 136, 255, 75, 124, - 158, 255, 183, 200, 212, 255, 253, 253, 252, 255, 179, 197, 210, 255, 41, - 99, 141, 255, 47, 107, 146, 255, 213, 219, 225, 255, 251, 249, 248, 255, - 245, 245, 245, 255, 253, 252, 251, 255, 170, 190, 204, 255, 40, 97, 138, - 255, 54, 113, 150, 255, 232, 236, 239, 255, 254, 252, 249, 255, 165, 186, - 201, 255, 39, 101, 142, 255, 2, 79, 127, 255, 0, 71, 121, 255, 0, - 73, 123, 255, 52, 111, 150, 255, 113, 152, 178, 255, 46, 107, 146, 255, - 46, 106, 145, 255, 203, 211, 218, 255, 255, 254, 252, 255, 213, 219, 226, - 255, 90, 136, 166, 255, 21, 91, 136, 255, 0, 74, 124, 255, 0, 72, - 122, 255, 14, 87, 133, 255, 65, 118, 154, 255, 166, 190, 205, 255, 249, - 249, 247, 255, 212, 219, 224, 255, 48, 107, 145, 255, 40, 99, 139, 255, - 181, 193, 205, 255, 250, 248, 246, 255, 241, 241, 241, 255, 241, 241, 241, - 255, 240, 240, 240, 255, 240, 240, 240, 255, 240, 240, 240, 255, 255, 255, - 255, 255, 199, 199, 199, 205, 10, 10, 10, 9, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 8, 8, 8, 7, 194, 194, 194, 202, 250, 253, 254, 255, 238, 227, - 219, 255, 230, 161, 95, 255, 228, 143, 60, 255, 231, 170, 111, 255, 239, - 231, 224, 255, 245, 250, 254, 255, 255, 255, 255, 255, 159, 159, 159, 163, - 136, 136, 136, 139, 253, 253, 254, 255, 243, 246, 250, 255, 234, 179, 130, - 255, 228, 132, 36, 255, 229, 139, 50, 255, 229, 139, 50, 255, 229, 138, - 48, 255, 229, 134, 41, 255, 230, 150, 72, 255, 236, 193, 154, 255, 239, - 216, 194, 255, 240, 223, 211, 255, 240, 220, 203, 255, 238, 204, 172, 255, - 232, 163, 97, 255, 228, 135, 42, 255, 229, 137, 46, 255, 229, 139, 49, - 255, 229, 139, 49, 255, 229, 135, 43, 255, 229, 140, 54, 255, 241, 223, - 207, 255, 245, 248, 251, 255, 244, 244, 244, 255, 241, 241, 242, 255, 236, - 237, 239, 255, 239, 239, 240, 255, 253, 250, 248, 255, 233, 235, 237, 255, - 190, 200, 211, 255, 173, 187, 200, 255, 201, 210, 218, 255, 244, 244, 244, - 255, 252, 251, 248, 255, 245, 245, 244, 255, 242, 242, 243, 255, 237, 238, - 239, 255, 238, 239, 240, 255, 244, 244, 244, 255, 245, 245, 244, 255, 253, - 250, 248, 255, 248, 246, 245, 255, 224, 228, 232, 255, 197, 206, 215, 255, - 201, 209, 217, 255, 228, 231, 235, 255, 248, 247, 245, 255, 252, 249, 248, - 255, 244, 244, 244, 255, 242, 242, 242, 255, 237, 238, 239, 255, 237, 238, - 239, 255, 243, 243, 243, 255, 244, 244, 244, 255, 244, 244, 244, 255, 244, - 244, 244, 255, 241, 242, 242, 255, 237, 238, 239, 255, 237, 238, 239, 255, - 243, 243, 243, 255, 244, 244, 244, 255, 252, 249, 247, 255, 232, 234, 236, - 255, 192, 201, 212, 255, 173, 187, 200, 255, 198, 207, 216, 255, 241, 241, - 241, 255, 250, 247, 246, 255, 236, 237, 238, 255, 236, 237, 238, 255, 241, - 241, 241, 255, 243, 243, 243, 255, 249, 247, 246, 255, 250, 246, 245, 255, - 227, 230, 233, 255, 199, 208, 216, 255, 193, 203, 212, 255, 220, 225, 229, - 255, 243, 242, 242, 255, 251, 248, 246, 255, 241, 241, 241, 255, 240, 240, - 240, 255, 234, 235, 237, 255, 233, 234, 236, 255, 237, 238, 238, 255, 240, - 240, 240, 255, 240, 240, 240, 255, 240, 240, 240, 255, 240, 240, 240, 255, - 244, 244, 244, 255, 254, 254, 254, 255, 194, 194, 194, 199, 43, 43, 43, - 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 84, 84, 84, 87, 253, 253, 252, 255, 246, 247, 248, 255, 240, 238, 238, - 255, 239, 234, 229, 255, 240, 242, 243, 255, 250, 252, 254, 255, 247, 247, - 246, 252, 134, 134, 134, 134, 0, 0, 0, 0, 30, 30, 30, 31, 226, - 226, 225, 235, 248, 250, 253, 255, 240, 231, 225, 255, 230, 154, 83, 255, - 227, 133, 39, 255, 228, 138, 49, 255, 228, 138, 49, 255, 228, 138, 49, - 255, 228, 135, 44, 255, 227, 133, 39, 255, 228, 138, 49, 255, 228, 140, - 55, 255, 228, 139, 52, 255, 227, 134, 42, 255, 227, 134, 41, 255, 228, - 138, 48, 255, 228, 138, 49, 255, 228, 138, 49, 255, 228, 135, 43, 255, - 228, 137, 47, 255, 237, 205, 176, 255, 245, 248, 252, 255, 253, 253, 253, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 254, 254, 255, 253, 253, - 253, 255, 253, 253, 253, 255, 254, 254, 254, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 254, 253, 255, - 252, 252, 252, 255, 252, 252, 252, 255, 252, 252, 252, 255, 255, 254, 253, - 255, 255, 254, 253, 255, 252, 252, 252, 255, 251, 251, 251, 255, 251, 251, - 251, 255, 252, 252, 252, 255, 254, 254, 254, 255, 225, 225, 225, 232, 141, - 141, 141, 145, 8, 8, 8, 7, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 124, - 124, 124, 127, 236, 236, 236, 242, 255, 255, 255, 255, 254, 255, 255, 255, - 254, 255, 255, 255, 215, 215, 215, 219, 98, 98, 98, 99, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 90, 90, 90, 92, 255, 255, - 255, 255, 244, 247, 250, 255, 238, 224, 214, 255, 229, 152, 81, 255, 226, - 131, 36, 255, 227, 137, 47, 255, 227, 138, 49, 255, 227, 138, 49, 255, - 227, 137, 48, 255, 227, 137, 47, 255, 227, 136, 46, 255, 227, 136, 46, - 255, 227, 137, 48, 255, 227, 138, 48, 255, 227, 138, 48, 255, 227, 137, - 48, 255, 226, 133, 39, 255, 227, 137, 48, 255, 235, 196, 160, 255, 244, - 249, 254, 255, 247, 248, 248, 255, 183, 183, 183, 190, 162, 162, 162, 169, - 163, 163, 163, 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, 164, - 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, - 164, 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, - 164, 164, 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, 164, 170, - 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, 164, - 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, - 164, 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, 164, 164, 170, 164, - 164, 164, 170, 163, 163, 163, 170, 163, 163, 163, 170, 163, 163, 163, 170, - 163, 163, 163, 170, 163, 163, 163, 170, 163, 163, 163, 170, 163, 163, 163, - 170, 163, 163, 163, 170, 163, 163, 163, 170, 163, 163, 163, 170, 163, 163, - 163, 170, 163, 163, 163, 170, 163, 163, 163, 170, 163, 163, 163, 170, 163, - 163, 163, 170, 163, 163, 163, 170, 163, 163, 163, 170, 162, 162, 162, 170, - 162, 162, 162, 170, 162, 162, 162, 170, 162, 162, 162, 170, 162, 162, 162, - 170, 162, 162, 162, 170, 162, 162, 162, 170, 162, 162, 162, 170, 162, 162, - 162, 170, 162, 162, 162, 169, 162, 162, 162, 169, 162, 162, 162, 169, 162, - 162, 162, 169, 161, 161, 161, 169, 161, 161, 161, 169, 161, 161, 161, 169, - 161, 161, 161, 169, 161, 161, 161, 169, 162, 162, 162, 171, 156, 156, 156, - 162, 112, 112, 112, 112, 32, 32, 32, 32, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, - 47, 46, 131, 131, 131, 134, 147, 147, 147, 152, 105, 105, 105, 106, 12, - 12, 12, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 2, 2, 2, 144, 144, 144, 147, 254, 254, 254, - 255, 243, 246, 250, 255, 238, 228, 221, 255, 230, 168, 111, 255, 225, 134, - 45, 255, 225, 131, 37, 255, 226, 135, 43, 255, 226, 136, 46, 255, 226, - 137, 48, 255, 226, 137, 48, 255, 226, 137, 48, 255, 226, 137, 47, 255, - 226, 135, 45, 255, 225, 133, 40, 255, 225, 130, 36, 255, 228, 152, 76, - 255, 237, 209, 184, 255, 244, 248, 253, 255, 255, 255, 255, 255, 167, 167, - 167, 172, 5, 5, 5, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 9, 9, 9, 8, 153, 153, 153, 158, 249, 249, 249, 255, - 246, 248, 251, 255, 239, 242, 246, 255, 235, 207, 184, 255, 229, 165, 105, - 255, 226, 146, 70, 255, 225, 135, 48, 255, 224, 130, 38, 255, 224, 129, - 34, 255, 224, 129, 34, 255, 224, 131, 40, 255, 226, 141, 58, 255, 228, - 158, 91, 255, 233, 190, 151, 255, 240, 237, 235, 255, 247, 251, 255, 255, - 250, 250, 251, 255, 177, 177, 177, 180, 23, 23, 23, 22, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 113, 113, 113, 115, 225, 225, 225, 233, 253, - 254, 254, 255, 244, 248, 252, 255, 239, 241, 244, 255, 238, 232, 228, 255, - 235, 209, 191, 255, 232, 190, 152, 255, 231, 184, 138, 255, 232, 185, 138, - 255, 232, 196, 164, 255, 237, 225, 217, 255, 240, 240, 240, 255, 246, 250, - 255, 255, 255, 255, 255, 255, 230, 230, 230, 235, 110, 110, 110, 111, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 40, 40, 40, 40, 149, 149, 149, 153, 220, 220, - 220, 229, 251, 252, 252, 255, 252, 254, 255, 255, 249, 253, 255, 255, 246, - 252, 255, 255, 245, 251, 255, 255, 246, 252, 255, 255, 248, 254, 255, 255, - 253, 255, 255, 255, 250, 251, 252, 255, 217, 218, 218, 226, 153, 153, 153, - 157, 45, 45, 45, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 25, 25, 25, 25, 102, 102, 102, - 102, 152, 152, 152, 157, 175, 175, 175, 185, 197, 197, 197, 210, 202, 203, - 203, 215, 197, 197, 197, 209, 180, 180, 180, 188, 155, 155, 155, 160, 97, - 97, 97, 98, 13, 13, 13, 13, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 7, 7, 7, 7, 8, 8, 8, 8, 7, 7, 7, - 6, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; - - *width = 115; - *height = 32; - - // only load the requested logo - // allocate a new array - *data = new unsigned char[14720]; - // and copy it. Now we are certain that the calling function - // can control the memory location - for (int i = 0; i < 14720 /* tmp array size */; i++) - { - (*data)[i] = logo_blender_raw[i]; - } - -} - - -void GetRawBlender3DLogo(unsigned char **data, int *width, int *height) -{ - // create an array that will automatically be deleted when) - // we're outta this scope - static unsigned char logo_blender3d_raw[] = { - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 57, 255, 255, - 255, 243, 255, 255, 255, 252, 255, 255, 255, 251, 255, 255, 255, 200, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 57, 255, 255, 255, 243, 255, 255, 255, 252, 255, 255, 255, - 251, 255, 255, 255, 200, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 141, 255, 255, 255, 248, - 255, 255, 255, 253, 255, 255, 255, 248, 255, 255, 255, 141, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 17, 255, 255, 255, 159, 255, 255, 255, 231, 255, 255, 255, 247, 255, 255, - 255, 247, 255, 255, 255, 234, 255, 255, 255, 176, 255, 255, 255, 36, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 141, 255, 255, 255, - 248, 255, 255, 255, 253, 255, 255, 255, 248, 255, 255, 255, 141, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 86, 207, 207, 207, 255, 70, 70, 70, 255, 118, 118, 118, 255, 255, - 255, 255, 236, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 86, 207, 207, 207, 255, 70, 70, 70, - 255, 118, 118, 118, 255, 255, 255, 255, 236, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 170, - 153, 153, 153, 255, 70, 70, 70, 255, 153, 153, 153, 255, 255, 255, 255, - 170, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 141, 255, 255, 255, 255, 239, 239, 239, 255, 153, 153, 153, 255, 137, 137, - 137, 255, 137, 137, 137, 255, 153, 153, 153, 255, 223, 223, 223, 255, 255, - 255, 255, 255, 255, 255, 255, 141, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 170, 153, 153, 153, 255, 70, 70, 70, 255, 153, 153, 153, 255, 255, 255, - 255, 170, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, - 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, - 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, - 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 86, 255, 255, - 255, 172, 255, 255, 255, 172, 255, 255, 255, 86, 255, 255, 255, 86, 255, - 255, 255, 144, 255, 255, 255, 144, 255, 255, 255, 57, 255, 255, 255, 86, - 255, 255, 255, 144, 255, 255, 255, 207, 255, 255, 255, 207, 255, 255, 255, - 172, 255, 255, 255, 86, 255, 255, 255, 86, 255, 255, 255, 144, 255, 255, - 255, 144, 255, 255, 255, 57, 255, 255, 255, 86, 255, 255, 255, 144, 255, - 255, 255, 207, 255, 255, 255, 207, 255, 255, 255, 172, 255, 255, 255, 86, - 255, 255, 255, 86, 255, 255, 255, 144, 255, 255, 255, 144, 255, 255, 255, - 57, 255, 255, 255, 86, 255, 255, 255, 144, 255, 255, 255, 144, 255, 255, - 255, 57, 255, 255, 255, 144, 187, 187, 187, 255, 0, 0, 0, 253, 70, - 70, 70, 255, 255, 255, 255, 255, 255, 255, 255, 254, 255, 255, 255, 255, - 255, 255, 255, 251, 255, 255, 255, 207, 255, 255, 255, 163, 187, 187, 187, - 255, 0, 0, 0, 253, 70, 70, 70, 255, 255, 255, 255, 251, 255, 255, - 255, 0, 255, 255, 255, 141, 255, 255, 255, 235, 255, 255, 255, 254, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 250, 255, 255, 255, 188, - 255, 255, 255, 54, 255, 255, 255, 198, 255, 255, 255, 234, 255, 255, 255, - 243, 255, 255, 255, 248, 255, 255, 255, 254, 255, 255, 255, 254, 255, 255, - 255, 251, 255, 255, 255, 207, 255, 255, 255, 17, 255, 255, 255, 0, 255, - 255, 255, 170, 255, 255, 255, 250, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 137, 137, 137, 255, 0, 0, 0, 253, 137, 137, 137, - 255, 255, 255, 255, 228, 255, 255, 255, 141, 255, 255, 255, 235, 255, 255, - 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 250, 255, - 255, 255, 188, 255, 255, 255, 54, 255, 255, 255, 198, 255, 255, 255, 234, - 255, 255, 255, 237, 255, 255, 255, 248, 255, 255, 255, 254, 255, 255, 255, - 253, 255, 255, 255, 255, 153, 153, 153, 255, 0, 0, 0, 253, 0, 0, - 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, 0, - 0, 0, 253, 153, 153, 153, 255, 255, 255, 255, 251, 255, 255, 255, 0, - 255, 255, 255, 170, 255, 255, 255, 250, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 137, 137, 137, 255, 0, 0, 0, 253, 137, 137, - 137, 255, 255, 255, 255, 228, 255, 255, 255, 0, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 86, 255, 255, 255, 215, 255, 255, 255, 240, - 255, 255, 255, 231, 255, 255, 255, 159, 255, 255, 255, 17, 255, 255, 255, - 0, 255, 255, 255, 57, 255, 255, 255, 206, 255, 255, 255, 237, 255, 255, - 255, 231, 255, 255, 255, 159, 255, 255, 255, 35, 255, 255, 255, 105, 255, - 255, 255, 142, 255, 255, 255, 208, 255, 255, 255, 229, 255, 255, 255, 237, - 255, 255, 255, 215, 255, 255, 255, 205, 255, 255, 255, 228, 255, 255, 255, - 234, 255, 255, 255, 198, 255, 255, 255, 36, 255, 255, 255, 0, 255, 255, - 255, 227, 187, 187, 187, 255, 187, 187, 187, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 187, 187, 187, 255, 207, 207, 207, 255, 255, 255, 255, 254, - 255, 255, 255, 255, 187, 187, 187, 255, 207, 207, 207, 255, 187, 187, 187, - 255, 187, 187, 187, 255, 255, 255, 255, 255, 255, 255, 255, 255, 187, 187, - 187, 255, 207, 207, 207, 255, 255, 255, 255, 254, 255, 255, 255, 255, 187, - 187, 187, 255, 207, 207, 207, 255, 187, 187, 187, 255, 187, 187, 187, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 187, 187, 187, 255, 207, 207, 207, - 255, 255, 255, 255, 254, 255, 255, 255, 255, 187, 187, 187, 255, 207, 207, - 207, 255, 255, 255, 255, 170, 255, 255, 255, 172, 187, 187, 187, 255, 0, - 0, 0, 253, 70, 70, 70, 255, 153, 153, 153, 255, 86, 86, 86, 255, - 70, 70, 70, 255, 118, 118, 118, 255, 239, 239, 239, 255, 255, 255, 255, - 255, 187, 187, 187, 255, 0, 0, 0, 253, 70, 70, 70, 255, 255, 255, - 255, 254, 255, 255, 255, 246, 255, 255, 255, 255, 153, 153, 153, 255, 118, - 118, 118, 255, 69, 69, 69, 254, 70, 70, 70, 255, 137, 137, 137, 255, - 239, 239, 239, 255, 255, 255, 255, 254, 223, 223, 223, 255, 137, 137, 137, - 255, 153, 153, 153, 255, 169, 169, 169, 255, 102, 102, 102, 255, 70, 70, - 70, 255, 118, 118, 118, 255, 239, 239, 239, 255, 255, 255, 255, 236, 255, - 255, 255, 236, 255, 255, 255, 255, 137, 137, 137, 255, 70, 70, 70, 255, - 70, 70, 70, 255, 137, 137, 137, 255, 118, 118, 118, 255, 0, 0, 0, - 253, 137, 137, 137, 255, 255, 255, 255, 254, 255, 255, 255, 255, 153, 153, - 153, 255, 118, 118, 118, 255, 69, 69, 69, 254, 70, 70, 70, 255, 137, - 137, 137, 255, 239, 239, 239, 255, 255, 255, 255, 254, 223, 223, 223, 255, - 137, 137, 137, 255, 153, 153, 153, 255, 207, 207, 207, 255, 86, 86, 86, - 255, 70, 70, 70, 255, 223, 223, 223, 255, 0, 0, 0, 253, 0, 0, - 0, 253, 137, 137, 137, 255, 255, 255, 255, 255, 239, 239, 239, 255, 86, - 86, 86, 255, 0, 0, 0, 253, 34, 34, 34, 255, 255, 255, 255, 253, - 255, 255, 255, 236, 255, 255, 255, 255, 137, 137, 137, 255, 70, 70, 70, - 255, 70, 70, 70, 255, 137, 137, 137, 255, 118, 118, 118, 255, 0, 0, - 0, 253, 137, 137, 137, 255, 255, 255, 255, 233, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 214, 255, 255, 255, 255, 187, 187, 187, 255, - 137, 137, 137, 255, 153, 153, 153, 255, 239, 239, 239, 255, 255, 255, 255, - 254, 255, 255, 255, 224, 255, 255, 255, 255, 207, 207, 207, 255, 137, 137, - 137, 255, 153, 153, 153, 255, 239, 239, 239, 255, 255, 255, 255, 255, 239, - 239, 239, 255, 187, 187, 187, 255, 223, 223, 223, 255, 169, 169, 169, 255, - 137, 137, 137, 255, 187, 187, 187, 255, 255, 255, 255, 255, 153, 153, 153, - 255, 137, 137, 137, 255, 223, 223, 223, 255, 255, 255, 255, 255, 255, 255, - 255, 36, 255, 255, 255, 205, 86, 86, 86, 255, 0, 0, 0, 253, 239, - 239, 239, 255, 222, 222, 222, 255, 0, 0, 0, 253, 18, 18, 18, 255, - 255, 255, 255, 255, 207, 207, 207, 255, 0, 0, 0, 253, 137, 137, 137, - 255, 86, 86, 86, 255, 0, 0, 0, 253, 239, 239, 239, 255, 222, 222, - 222, 255, 0, 0, 0, 253, 18, 18, 18, 255, 255, 255, 255, 255, 207, - 207, 207, 255, 0, 0, 0, 253, 137, 137, 137, 255, 86, 86, 86, 255, - 0, 0, 0, 253, 239, 239, 239, 255, 222, 222, 222, 255, 0, 0, 0, - 253, 18, 18, 18, 255, 255, 255, 255, 255, 207, 207, 207, 255, 0, 0, - 0, 253, 137, 137, 137, 255, 255, 255, 255, 116, 255, 255, 255, 172, 187, - 187, 187, 255, 0, 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, - 70, 70, 70, 254, 33, 33, 33, 255, 0, 0, 0, 253, 18, 18, 18, - 255, 239, 239, 239, 255, 187, 187, 187, 255, 0, 0, 0, 253, 70, 70, - 70, 255, 255, 255, 255, 254, 255, 255, 255, 255, 50, 50, 50, 255, 0, - 0, 0, 253, 69, 69, 69, 254, 137, 137, 137, 254, 103, 103, 103, 254, - 0, 0, 0, 253, 18, 18, 18, 255, 239, 239, 239, 255, 187, 187, 187, - 255, 0, 0, 0, 253, 0, 0, 0, 253, 18, 18, 18, 255, 69, 69, - 69, 254, 18, 18, 18, 255, 0, 0, 0, 253, 70, 70, 70, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 70, 70, 70, 255, 0, 0, 0, 253, - 18, 18, 18, 255, 69, 69, 69, 254, 18, 18, 18, 255, 0, 0, 0, - 253, 0, 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, 255, 50, 50, - 50, 255, 0, 0, 0, 253, 69, 69, 69, 254, 137, 137, 137, 254, 103, - 103, 103, 254, 0, 0, 0, 253, 18, 18, 18, 255, 239, 239, 239, 255, - 187, 187, 187, 255, 0, 0, 0, 253, 34, 34, 34, 255, 18, 18, 18, - 255, 0, 0, 0, 253, 0, 0, 0, 253, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 86, 86, 86, 255, 0, 0, 0, 253, 34, 34, 34, 255, - 255, 255, 255, 253, 255, 255, 255, 255, 70, 70, 70, 255, 0, 0, 0, - 253, 18, 18, 18, 255, 69, 69, 69, 254, 18, 18, 18, 255, 0, 0, - 0, 253, 0, 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, 233, 255, - 255, 255, 0, 255, 255, 255, 57, 255, 255, 255, 255, 102, 102, 102, 255, - 0, 0, 0, 253, 49, 49, 49, 253, 18, 18, 18, 255, 18, 18, 18, - 255, 223, 223, 223, 255, 255, 255, 255, 255, 102, 102, 102, 255, 0, 0, - 0, 253, 49, 49, 49, 253, 18, 18, 18, 255, 18, 18, 18, 255, 207, - 207, 207, 255, 187, 187, 187, 255, 0, 0, 0, 253, 18, 18, 18, 255, - 50, 50, 50, 254, 18, 18, 18, 255, 0, 0, 0, 253, 34, 34, 34, - 255, 70, 70, 70, 253, 18, 18, 18, 255, 0, 0, 0, 253, 223, 223, - 223, 255, 255, 255, 255, 170, 255, 255, 255, 230, 153, 153, 153, 255, 0, - 0, 0, 253, 169, 169, 169, 255, 153, 153, 153, 255, 18, 18, 18, 255, - 0, 0, 0, 253, 207, 207, 207, 255, 137, 137, 137, 255, 0, 0, 0, - 253, 207, 207, 207, 255, 153, 153, 153, 255, 0, 0, 0, 253, 169, 169, - 169, 255, 153, 153, 153, 255, 18, 18, 18, 255, 0, 0, 0, 253, 207, - 207, 207, 255, 137, 137, 137, 255, 0, 0, 0, 253, 207, 207, 207, 255, - 153, 153, 153, 255, 0, 0, 0, 253, 169, 169, 169, 255, 153, 153, 153, - 255, 18, 18, 18, 255, 0, 0, 0, 253, 207, 207, 207, 255, 137, 137, - 137, 255, 0, 0, 0, 253, 207, 207, 207, 255, 255, 255, 255, 170, 255, - 255, 255, 172, 187, 187, 187, 255, 0, 0, 0, 253, 18, 18, 18, 255, - 207, 207, 207, 255, 255, 255, 255, 255, 255, 255, 255, 255, 86, 86, 86, - 255, 0, 0, 0, 253, 137, 137, 137, 255, 187, 187, 187, 255, 0, 0, - 0, 253, 70, 70, 70, 255, 255, 255, 255, 255, 169, 169, 169, 255, 0, - 0, 0, 253, 86, 86, 86, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 137, 137, 137, 255, 0, 0, 0, 253, 137, 137, 137, - 255, 187, 187, 187, 255, 0, 0, 0, 253, 0, 0, 0, 253, 207, 207, - 207, 255, 255, 255, 255, 255, 223, 223, 223, 255, 0, 0, 0, 253, 0, - 0, 0, 253, 255, 255, 255, 255, 187, 187, 187, 255, 0, 0, 0, 253, - 34, 34, 34, 255, 239, 239, 239, 255, 255, 255, 255, 255, 239, 239, 239, - 255, 50, 50, 50, 255, 0, 0, 0, 253, 137, 137, 137, 255, 169, 169, - 169, 255, 0, 0, 0, 253, 86, 86, 86, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 137, 137, 137, 255, 0, 0, 0, 253, - 137, 137, 137, 255, 187, 187, 187, 255, 0, 0, 0, 253, 0, 0, 0, - 253, 137, 137, 137, 255, 255, 255, 255, 255, 169, 169, 169, 255, 255, 255, - 255, 255, 255, 255, 255, 0, 255, 255, 255, 86, 138, 138, 138, 236, 0, - 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, 18, 18, 18, 255, - 223, 223, 223, 255, 255, 255, 255, 255, 187, 187, 187, 255, 0, 0, 0, - 253, 34, 34, 34, 255, 239, 239, 239, 255, 255, 255, 255, 255, 239, 239, - 239, 255, 50, 50, 50, 255, 0, 0, 0, 253, 137, 137, 137, 255, 255, - 255, 255, 233, 255, 255, 255, 0, 255, 255, 255, 170, 207, 207, 207, 255, - 0, 0, 0, 253, 118, 118, 118, 255, 255, 255, 255, 255, 187, 187, 187, - 255, 0, 0, 0, 253, 137, 137, 137, 254, 207, 207, 207, 255, 0, 0, - 0, 253, 118, 118, 118, 255, 255, 255, 255, 255, 239, 239, 239, 255, 0, - 0, 0, 253, 86, 86, 86, 255, 187, 187, 187, 255, 0, 0, 0, 253, - 86, 86, 86, 255, 255, 255, 255, 255, 169, 169, 169, 255, 0, 0, 0, - 253, 102, 102, 102, 255, 255, 255, 255, 255, 169, 169, 169, 255, 0, 0, - 0, 253, 137, 137, 137, 255, 255, 255, 255, 198, 255, 255, 255, 141, 239, - 239, 239, 255, 0, 0, 0, 253, 102, 102, 102, 255, 102, 102, 102, 255, - 86, 86, 86, 255, 18, 18, 18, 255, 137, 137, 137, 255, 86, 86, 86, - 255, 34, 34, 34, 255, 255, 255, 255, 255, 239, 239, 239, 255, 0, 0, - 0, 253, 102, 102, 102, 255, 102, 102, 102, 255, 86, 86, 86, 255, 18, - 18, 18, 255, 137, 137, 137, 255, 86, 86, 86, 255, 34, 34, 34, 255, - 255, 255, 255, 255, 239, 239, 239, 255, 0, 0, 0, 253, 102, 102, 102, - 255, 102, 102, 102, 255, 86, 86, 86, 255, 18, 18, 18, 255, 137, 137, - 137, 255, 86, 86, 86, 255, 34, 34, 34, 255, 255, 255, 255, 255, 255, - 255, 255, 57, 255, 255, 255, 172, 187, 187, 187, 255, 0, 0, 0, 253, - 70, 70, 70, 255, 255, 255, 255, 255, 255, 255, 255, 57, 255, 255, 255, - 245, 187, 187, 187, 255, 0, 0, 0, 253, 70, 70, 70, 255, 187, 187, - 187, 255, 0, 0, 0, 253, 70, 70, 70, 255, 255, 255, 255, 255, 137, - 137, 137, 255, 0, 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, - 0, 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, - 253, 70, 70, 70, 255, 187, 187, 187, 255, 0, 0, 0, 253, 70, 70, - 70, 255, 255, 255, 255, 255, 255, 255, 255, 95, 255, 255, 255, 255, 0, - 0, 0, 253, 0, 0, 0, 253, 255, 255, 255, 255, 137, 137, 137, 255, - 0, 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, 254, 255, 255, 255, - 35, 255, 255, 255, 253, 137, 137, 137, 255, 0, 0, 0, 253, 137, 137, - 137, 255, 137, 137, 137, 255, 0, 0, 0, 253, 0, 0, 0, 253, 0, - 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, - 0, 0, 0, 253, 70, 70, 70, 255, 187, 187, 187, 255, 0, 0, 0, - 253, 50, 50, 50, 255, 255, 255, 255, 255, 255, 255, 255, 222, 255, 255, - 255, 213, 255, 255, 255, 252, 255, 255, 255, 254, 255, 255, 255, 254, 187, - 187, 187, 255, 137, 137, 137, 255, 137, 137, 137, 255, 34, 34, 34, 255, - 0, 0, 0, 253, 34, 34, 34, 255, 255, 255, 255, 255, 137, 137, 137, - 255, 0, 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, 254, 255, 255, - 255, 35, 255, 255, 255, 253, 137, 137, 137, 255, 0, 0, 0, 253, 137, - 137, 137, 255, 255, 255, 255, 233, 255, 255, 255, 0, 255, 255, 255, 194, - 137, 137, 137, 255, 0, 0, 0, 253, 187, 187, 187, 255, 255, 255, 255, - 242, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 137, 137, - 137, 255, 0, 0, 0, 253, 187, 187, 187, 255, 255, 255, 255, 234, 255, - 255, 255, 255, 70, 70, 70, 255, 18, 18, 18, 255, 187, 187, 187, 255, - 0, 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, 253, 187, 187, 187, - 255, 0, 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, 252, 187, 187, - 187, 255, 0, 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, 233, 255, - 255, 255, 17, 255, 255, 255, 255, 70, 70, 70, 255, 34, 34, 34, 255, - 50, 50, 50, 255, 137, 137, 137, 255, 86, 86, 86, 255, 70, 70, 70, - 255, 0, 0, 0, 253, 118, 118, 118, 255, 255, 255, 255, 253, 255, 255, - 255, 255, 70, 70, 70, 255, 34, 34, 34, 255, 50, 50, 50, 255, 137, - 137, 137, 255, 86, 86, 86, 255, 70, 70, 70, 255, 0, 0, 0, 253, - 118, 118, 118, 255, 255, 255, 255, 253, 255, 255, 255, 255, 70, 70, 70, - 255, 34, 34, 34, 255, 50, 50, 50, 255, 137, 137, 137, 255, 86, 86, - 86, 255, 70, 70, 70, 255, 0, 0, 0, 253, 118, 118, 118, 255, 255, - 255, 255, 255, 255, 255, 255, 252, 255, 255, 255, 254, 187, 187, 187, 255, - 0, 0, 0, 253, 50, 50, 50, 255, 255, 255, 255, 255, 255, 255, 255, - 250, 255, 255, 255, 255, 153, 153, 153, 255, 0, 0, 0, 253, 86, 86, - 86, 255, 187, 187, 187, 255, 0, 0, 0, 253, 70, 70, 70, 255, 255, - 255, 255, 255, 137, 137, 137, 255, 0, 0, 0, 253, 86, 86, 86, 255, - 187, 187, 187, 255, 187, 187, 187, 255, 187, 187, 187, 255, 187, 187, 187, - 255, 187, 187, 187, 255, 207, 207, 207, 255, 187, 187, 187, 255, 0, 0, - 0, 253, 70, 70, 70, 255, 255, 255, 255, 254, 255, 255, 255, 0, 255, - 255, 255, 255, 0, 0, 0, 253, 0, 0, 0, 253, 255, 255, 255, 255, - 137, 137, 137, 255, 0, 0, 0, 253, 102, 102, 102, 255, 255, 255, 255, - 255, 255, 255, 255, 243, 255, 255, 255, 255, 118, 118, 118, 255, 0, 0, - 0, 253, 137, 137, 137, 255, 137, 137, 137, 255, 0, 0, 0, 253, 86, - 86, 86, 255, 187, 187, 187, 255, 187, 187, 187, 255, 187, 187, 187, 255, - 187, 187, 187, 255, 187, 187, 187, 255, 207, 207, 207, 255, 187, 187, 187, - 255, 0, 0, 0, 253, 70, 70, 70, 255, 255, 255, 255, 254, 255, 255, - 255, 0, 255, 255, 255, 86, 153, 153, 153, 255, 70, 70, 70, 255, 102, - 102, 102, 255, 255, 255, 255, 255, 255, 255, 255, 254, 255, 255, 255, 255, - 187, 187, 187, 255, 0, 0, 0, 253, 0, 0, 0, 253, 187, 187, 187, - 255, 137, 137, 137, 255, 0, 0, 0, 253, 102, 102, 102, 255, 255, 255, - 255, 255, 255, 255, 255, 243, 255, 255, 255, 255, 118, 118, 118, 255, 0, - 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, 254, 255, 255, 255, 252, - 255, 255, 255, 254, 153, 153, 153, 255, 0, 0, 0, 253, 169, 169, 169, - 255, 255, 255, 255, 251, 255, 255, 255, 255, 187, 187, 187, 255, 207, 207, - 207, 255, 153, 153, 153, 255, 0, 0, 0, 253, 169, 169, 169, 255, 255, - 255, 255, 248, 255, 255, 255, 255, 50, 50, 50, 255, 34, 34, 34, 255, - 187, 187, 187, 255, 0, 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, - 249, 187, 187, 187, 255, 0, 0, 0, 253, 137, 137, 137, 255, 255, 255, - 255, 249, 187, 187, 187, 255, 0, 0, 0, 253, 137, 137, 137, 255, 255, - 255, 255, 233, 255, 255, 255, 0, 255, 255, 255, 241, 137, 137, 137, 255, - 0, 0, 0, 253, 0, 0, 0, 253, 207, 207, 207, 255, 153, 153, 153, - 255, 0, 0, 0, 253, 0, 0, 0, 253, 207, 207, 207, 255, 255, 255, - 255, 200, 255, 255, 255, 241, 137, 137, 137, 255, 0, 0, 0, 253, 0, - 0, 0, 253, 207, 207, 207, 255, 153, 153, 153, 255, 0, 0, 0, 253, - 0, 0, 0, 253, 207, 207, 207, 255, 255, 255, 255, 200, 255, 255, 255, - 241, 137, 137, 137, 255, 0, 0, 0, 253, 0, 0, 0, 253, 207, 207, - 207, 255, 153, 153, 153, 255, 0, 0, 0, 253, 0, 0, 0, 253, 207, - 207, 207, 255, 207, 207, 207, 255, 70, 70, 70, 255, 118, 118, 118, 255, - 187, 187, 187, 255, 0, 0, 0, 253, 0, 0, 0, 253, 86, 86, 86, - 255, 187, 187, 187, 255, 153, 153, 153, 255, 18, 18, 18, 255, 0, 0, - 0, 253, 169, 169, 169, 255, 187, 187, 187, 255, 0, 0, 0, 253, 70, - 70, 70, 255, 255, 255, 255, 255, 223, 223, 223, 255, 0, 0, 0, 253, - 18, 18, 18, 255, 169, 169, 169, 255, 255, 255, 255, 255, 223, 223, 223, - 255, 50, 50, 50, 255, 0, 0, 0, 253, 138, 138, 138, 248, 187, 187, - 187, 255, 0, 0, 0, 253, 70, 70, 70, 255, 255, 255, 255, 254, 255, - 255, 255, 0, 255, 255, 255, 255, 0, 0, 0, 253, 0, 0, 0, 253, - 255, 255, 255, 255, 223, 223, 223, 255, 18, 18, 18, 255, 0, 0, 0, - 253, 137, 137, 137, 255, 187, 187, 187, 255, 137, 137, 137, 255, 0, 0, - 0, 253, 0, 0, 0, 253, 137, 137, 137, 255, 223, 223, 223, 255, 0, - 0, 0, 253, 18, 18, 18, 255, 169, 169, 169, 255, 255, 255, 255, 255, - 223, 223, 223, 255, 50, 50, 50, 255, 0, 0, 0, 253, 138, 138, 138, - 248, 187, 187, 187, 255, 0, 0, 0, 253, 70, 70, 70, 255, 255, 255, - 255, 254, 255, 255, 255, 0, 255, 255, 255, 141, 186, 186, 186, 252, 0, - 0, 0, 253, 0, 0, 0, 253, 118, 118, 118, 255, 187, 187, 187, 255, - 169, 169, 169, 255, 50, 50, 50, 255, 0, 0, 0, 253, 18, 18, 18, - 255, 255, 255, 255, 255, 223, 223, 223, 255, 18, 18, 18, 255, 0, 0, - 0, 253, 137, 137, 137, 255, 187, 187, 187, 255, 137, 137, 137, 255, 0, - 0, 0, 253, 0, 0, 0, 253, 137, 137, 137, 255, 207, 207, 207, 255, - 70, 70, 70, 255, 118, 118, 118, 255, 223, 223, 223, 255, 0, 0, 0, - 253, 86, 86, 86, 255, 239, 239, 239, 255, 137, 137, 137, 255, 0, 0, - 0, 253, 153, 153, 153, 249, 223, 223, 223, 255, 0, 0, 0, 253, 86, - 86, 86, 255, 239, 239, 239, 255, 187, 187, 187, 255, 0, 0, 0, 253, - 102, 102, 102, 255, 187, 187, 187, 255, 0, 0, 0, 253, 137, 137, 137, - 255, 255, 255, 255, 249, 187, 187, 187, 255, 0, 0, 0, 253, 137, 137, - 137, 255, 255, 255, 255, 249, 187, 187, 187, 255, 0, 0, 0, 253, 137, - 137, 137, 255, 255, 255, 255, 233, 255, 255, 255, 0, 255, 255, 255, 170, - 223, 223, 223, 255, 0, 0, 0, 253, 18, 18, 18, 255, 255, 255, 255, - 255, 223, 223, 223, 255, 0, 0, 0, 253, 34, 34, 34, 255, 255, 255, - 255, 255, 255, 255, 255, 57, 255, 255, 255, 170, 223, 223, 223, 255, 0, - 0, 0, 253, 18, 18, 18, 255, 255, 255, 255, 255, 223, 223, 223, 255, - 0, 0, 0, 253, 34, 34, 34, 255, 255, 255, 255, 255, 255, 255, 255, - 57, 255, 255, 255, 170, 223, 223, 223, 255, 0, 0, 0, 253, 18, 18, - 18, 255, 255, 255, 255, 255, 223, 223, 223, 255, 0, 0, 0, 253, 34, - 34, 34, 255, 255, 255, 255, 255, 187, 187, 187, 247, 0, 0, 0, 253, - 70, 70, 70, 253, 187, 187, 187, 255, 0, 0, 0, 253, 34, 34, 34, - 255, 50, 50, 50, 255, 0, 0, 0, 253, 0, 0, 0, 253, 0, 0, - 0, 253, 137, 137, 137, 255, 255, 255, 255, 255, 187, 187, 187, 255, 0, - 0, 0, 253, 70, 70, 70, 255, 255, 255, 255, 241, 255, 255, 255, 255, - 169, 169, 169, 255, 34, 34, 34, 255, 0, 0, 0, 253, 0, 0, 0, - 253, 0, 0, 0, 253, 18, 18, 18, 255, 137, 137, 137, 255, 255, 255, - 255, 255, 187, 187, 187, 255, 0, 0, 0, 253, 70, 70, 70, 255, 255, - 255, 255, 236, 255, 255, 255, 0, 255, 255, 255, 255, 0, 0, 0, 253, - 0, 0, 0, 253, 255, 255, 255, 255, 255, 255, 255, 254, 153, 153, 153, - 255, 18, 18, 18, 255, 0, 0, 0, 253, 0, 0, 0, 253, 18, 18, - 18, 255, 70, 70, 70, 255, 0, 0, 0, 253, 137, 137, 137, 255, 255, - 255, 255, 255, 169, 169, 169, 255, 34, 34, 34, 255, 0, 0, 0, 253, - 0, 0, 0, 253, 0, 0, 0, 253, 18, 18, 18, 255, 137, 137, 137, - 255, 255, 255, 255, 255, 187, 187, 187, 255, 0, 0, 0, 253, 70, 70, - 70, 255, 255, 255, 255, 236, 255, 255, 255, 0, 255, 255, 255, 86, 255, - 255, 255, 255, 153, 153, 153, 255, 34, 34, 34, 255, 0, 0, 0, 253, - 0, 0, 0, 253, 0, 0, 0, 253, 0, 0, 0, 253, 50, 50, 50, - 255, 187, 187, 187, 255, 255, 255, 255, 254, 255, 255, 255, 254, 153, 153, - 153, 255, 18, 18, 18, 255, 0, 0, 0, 253, 0, 0, 0, 253, 18, - 18, 18, 255, 70, 70, 70, 255, 0, 0, 0, 253, 137, 137, 137, 255, - 187, 187, 187, 251, 0, 0, 0, 253, 70, 70, 70, 252, 255, 255, 255, - 255, 153, 153, 153, 255, 18, 18, 18, 255, 0, 0, 0, 253, 0, 0, - 0, 253, 102, 102, 102, 255, 255, 255, 255, 255, 255, 255, 255, 255, 153, - 153, 153, 255, 18, 18, 18, 255, 0, 0, 0, 253, 0, 0, 0, 253, - 70, 70, 70, 255, 239, 239, 239, 255, 187, 187, 187, 255, 0, 0, 0, - 253, 137, 137, 137, 255, 255, 255, 255, 215, 187, 187, 187, 255, 0, 0, - 0, 253, 137, 137, 137, 255, 255, 255, 255, 215, 187, 187, 187, 255, 0, - 0, 0, 253, 137, 137, 137, 255, 255, 255, 255, 170, 255, 255, 255, 0, - 255, 255, 255, 36, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 251, 255, 255, 255, 0, 255, 255, 255, 36, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 251, 255, 255, 255, 0, 255, 255, 255, 36, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 253, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 215, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 236, - 255, 255, 255, 113, 255, 255, 255, 253, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 215, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 236, 255, 255, 255, 0, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 141, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 222, 255, 255, 255, 253, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 215, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 236, 255, 255, 255, 0, 255, - 255, 255, 0, 255, 255, 255, 141, 255, 255, 255, 253, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 250, 255, 255, 255, 86, 255, 255, - 255, 141, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 248, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 214, 255, - 255, 255, 141, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 246, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 215, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 215, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 170, }; - - *width = 136; - *height = 11; - - // only load the requested logo - // allocate a new array - *data = new unsigned char[5984]; - // and copy it. Now we are certain that the calling function - // can control the memory location - for (int i = 0; i < 5984 /* tmp array size */; i++) - { - (*data)[i] = logo_blender3d_raw[i]; - } - -} - - - diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp index 70a05f7425b..e8c29d5aa4f 100644 --- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp +++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp @@ -37,6 +37,7 @@ #include "RAS_LightObject.h" #include "RAS_ICanvas.h" #include "RAS_GLExtensionManager.h" +#include "RAS_MeshObject.h" #include "KX_GameObject.h" #include "KX_PolygonMaterial.h" @@ -166,6 +167,11 @@ void GPC_RenderTools::SetClientObject(RAS_IRasterizer *rasty, void* obj) bool GPC_RenderTools::RayHit(KX_ClientObjectInfo *client, KX_RayCast *result, void * const data) { double* const oglmatrix = (double* const) data; + + RAS_Polygon* poly = result->m_hitMesh->GetPolygon(result->m_hitPolygon); + if (!poly->IsVisible()) + return false; + MT_Point3 resultpoint(result->m_hitPoint); MT_Vector3 resultnormal(result->m_hitNormal); MT_Vector3 left(oglmatrix[0],oglmatrix[1],oglmatrix[2]); diff --git a/source/gameengine/GamePlayer/common/GPC_System.cpp b/source/gameengine/GamePlayer/common/GPC_System.cpp deleted file mode 100644 index 2c99c99114e..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_System.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file gameengine/GamePlayer/common/GPC_System.cpp - * \ingroup player - */ - - -#include "GPC_System.h" - -#include "GPC_KeyboardDevice.h" -#include "NG_NetworkDeviceInterface.h" - -GPC_System::GPC_System() -// : m_ndi(0) -{ -} - -/* -void GPC_System::NextFrame() -{ - // Have the imput devices proceed - std::vector<SCA_IInputDevice*>::iterator idev; - for (idev = m_inputDevices.begin(); !(idev == m_inputDevices.end()); idev++) { - (*idev)->NextFrame(); - } - - // Have the network device proceed - if (m_ndi) { - m_ndi->NextFrame(); - } -} - -void GPC_System::StartMainLoop() -{ -} - - -void GPC_System::Sleep(int millisec) -{ - // do nothing for now ;) -} - - -void GPC_System::AddKey(unsigned char key, bool down) -{ - GPC_KeyboardDevice* keydev = (GPC_KeyboardDevice*) this->GetKeyboardDevice(); - if (keydev) { - //SCA_IInputDevice::KX_EnumInputs inp = keydev->ToNative(key); - keydev->ConvertEvent(key, down); - } -} - - -void GPC_System::SetNetworkDevice(NG_NetworkDeviceInterface* ndi) -{ - m_ndi = ndi; -} - - -NG_NetworkDeviceInterface* GPC_System::GetNetworkDevice() const -{ - return m_ndi; -} -*/ diff --git a/source/gameengine/GamePlayer/common/GPC_System.h b/source/gameengine/GamePlayer/common/GPC_System.h deleted file mode 100644 index 4169064179e..00000000000 --- a/source/gameengine/GamePlayer/common/GPC_System.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file GPC_System.h - * \ingroup player - */ - -#ifndef __GPC_SYSTEM_H__ -#define __GPC_SYSTEM_H__ - -#if defined(WIN32) -#pragma warning (disable:4786) // suppress stl-MSVC debug info warning -#endif /* WIN32 */ - -#include "KX_ISystem.h" - -//class NG_NetworkDeviceInterface; - -class GPC_System : public KX_ISystem -{ -public: - GPC_System(); - -// virtual void NextFrame(); -// virtual void StartMainLoop(); - virtual double GetTimeInSeconds() = 0; -// virtual void Sleep(int millisec); - //virtual bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode); -// void AddKey(unsigned char key, bool down); - -// virtual void SetNetworkDevice(NG_NetworkDeviceInterface* ndi); -// virtual NG_NetworkDeviceInterface* GetNetworkDevice() const; - -//protected: -// NG_NetworkDeviceInterface* m_ndi; -}; - -#endif /* __GPC_SYSTEM_H__ */ diff --git a/source/gameengine/GamePlayer/common/SConscript b/source/gameengine/GamePlayer/common/SConscript index 96fda6dd548..85c4b091718 100644 --- a/source/gameengine/GamePlayer/common/SConscript +++ b/source/gameengine/GamePlayer/common/SConscript @@ -30,16 +30,10 @@ Import ('env') source_files = [ - 'bmfont.cpp', 'GPC_Canvas.cpp', - 'GPC_Engine.cpp', 'GPC_KeyboardDevice.cpp', 'GPC_MouseDevice.cpp', - 'GPC_RawImage.cpp', - 'GPC_RawLoadDotBlendArray.cpp', - 'GPC_RawLogoArrays.cpp', 'GPC_RenderTools.cpp', - 'GPC_System.cpp', ] incs = [ diff --git a/source/gameengine/GamePlayer/common/bmfont.cpp b/source/gameengine/GamePlayer/common/bmfont.cpp deleted file mode 100644 index 8e073f7d17b..00000000000 --- a/source/gameengine/GamePlayer/common/bmfont.cpp +++ /dev/null @@ -1,299 +0,0 @@ -/* - * bmfont.c - * - * 04-10-2000 frank - * - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * - */ - -/** \file gameengine/GamePlayer/common/bmfont.cpp - * \ingroup player - */ - - -/** - * Two external functions: - * - * void detectBitmapFont(ImBuf *ibuf) - * detects if an image buffer contains a bitmap font. It makes the - * specific bitmap data which is stored in the bitmap invisible to blender. - * - * void matrixGlyph(ImBuf *ibuf, unsigned short unicode, *float x 7) - * returns all the information about the character (unicode) in the floats - * - * Room for improvement: - * add kerning data in the bitmap - * all calculations in matrixGlyph() are static and could be done during - * initialization - */ - -#include <stdio.h> - -#include "MEM_guardedalloc.h" -#include "BLI_blenlib.h" -#include "BKE_global.h" -#include "IMB_imbuf_types.h" - -#include "BKE_bmfont.h" -#include "BKE_bmfont_types.h" - -#if 0 -void printfGlyph(bmGlyph *glyph) -{ - printf("unicode: %d '%c'\n", glyph->unicode, glyph->unicode); - printf(" locx: %4d locy: %4d\n", glyph->locx, glyph->locy); - printf(" sizex: %3d sizey: %3d\n", glyph->sizex, glyph->sizey); - printf(" ofsx: %3d ofsy: %3d\n", glyph->ofsx, glyph->ofsy); - printf(" advan: %3d reser: %3d\n", glyph->advance, glyph->reserved); -} -#endif - -void calcAlpha(ImBuf *ibuf) -{ - int i; - char * rect; - - if (ibuf) { - rect = (char *) ibuf->rect; - for (i = ibuf->x * ibuf->y ; i > 0 ; i--) { - rect[3] = MAX3(rect[0], rect[1], rect[2]); - rect += 4; - } - } -} - -void readBitmapFontVersion0(ImBuf *ibuf, unsigned char *rect, int step) -{ - int glyphcount, bytes, i, index, linelength, ysize; - unsigned char * buffer; - bmFont * bmfont; - - linelength = ibuf->x * step; - - glyphcount = (rect[6 * step] << 8) | rect[7 * step]; - bytes = ((glyphcount - 1) * sizeof(bmGlyph)) + sizeof(bmFont); - - ysize = (bytes + (ibuf->x - 1)) / ibuf->x; - - if (ysize < ibuf->y) { - // we're first going to copy all data into a linear buffer. - // step can be 4 or 1 bytes, and the data is not sequential because - // the bitmap was flipped vertically. - - buffer = (unsigned char*)MEM_mallocN(bytes, "readBitmapFontVersion0:buffer"); - - index = 0; - for (i = 0; i < bytes; i++) { - buffer[i] = rect[index]; - index += step; - if (index >= linelength) { - // we've read one line, no skip to the line *before* that - rect -= linelength; - index -= linelength; - } - } - - // we're now going to endian convert the data - - bmfont = (bmFont*)MEM_mallocN(bytes, "readBitmapFontVersion0:bmfont"); - index = 0; - - // first read the header - bmfont->magic[0] = buffer[index++]; - bmfont->magic[1] = buffer[index++]; - bmfont->magic[2] = buffer[index++]; - bmfont->magic[3] = buffer[index++]; - bmfont->version = (buffer[index] << 8) | buffer[index + 1]; index += 2; - bmfont->glyphcount = (buffer[index] << 8) | buffer[index + 1]; index += 2; - bmfont->xsize = (buffer[index] << 8) | buffer[index + 1]; index += 2; - bmfont->ysize = (buffer[index] << 8) | buffer[index + 1]; index += 2; - - for (i = 0; i < bmfont->glyphcount; i++) { - bmfont->glyphs[i].unicode = (buffer[index] << 8) | buffer[index + 1]; index += 2; - bmfont->glyphs[i].locx = (buffer[index] << 8) | buffer[index + 1]; index += 2; - bmfont->glyphs[i].locy = (buffer[index] << 8) | buffer[index + 1]; index += 2; - bmfont->glyphs[i].ofsx = buffer[index++]; - bmfont->glyphs[i].ofsy = buffer[index++]; - bmfont->glyphs[i].sizex = buffer[index++]; - bmfont->glyphs[i].sizey = buffer[index++]; - bmfont->glyphs[i].advance = buffer[index++]; - bmfont->glyphs[i].reserved = buffer[index++]; - /* MAART: - if (G.debug & G_DEBUG) { - printfGlyph(&bmfont->glyphs[i]); - } - */ - } - - MEM_freeN(buffer); - - /* MAART: - if (G.debug & G_DEBUG) { - printf("Oldy = %d Newy = %d\n", ibuf->y, ibuf->y - ysize); - printf("glyphcount = %d\n", glyphcount); - printf("bytes = %d\n", bytes); - } - */ - - // we've read the data from the image. Now we're going - // to crop the image vertically so only the bitmap data - // remains visible - - ibuf->y -= ysize; - ibuf->userdata = bmfont; - ibuf->userflags |= IB_BITMAPFONT; - - if (ibuf->planes < 32) { - // we're going to fake alpha here: - calcAlpha(ibuf); - } - } else { - /* MAART: - printf("readBitmapFontVersion0: corrupted bitmapfont\n"); - */ - } -} - -void detectBitmapFont(ImBuf *ibuf) -{ - unsigned char * rect; - unsigned short version; - long i; - - if (ibuf != NULL) { - // bitmap must have an x size that is a power of two - if (is_power_of_two(ibuf->x)) { - rect = (unsigned char *) (ibuf->rect + (ibuf->x * (ibuf->y - 1))); - // printf ("starts with: %s %c %c %c %c\n", rect, rect[0], rect[1], rect[2], rect[3]); - if (rect[0] == 'B' && rect[1] == 'F' && rect[2] == 'N' && rect[3] == 'T') { - // printf("found 8bit font !\n"); - // round y size down - // do the 8 bit font stuff. (not yet) - } else { - // we try all 4 possible combinations - for (i = 0; i < 4; i++) { - if (rect[0] == 'B' && rect[4] == 'F' && rect[8] == 'N' && rect[12] == 'T') { - // printf("found 24bit font !\n"); - // We're going to parse the file: - - version = (rect[16] << 8) | rect[20]; - - if (version == 0) { - readBitmapFontVersion0(ibuf, rect, 4); - } else { - //printf("detectBitmapFont :Unsupported version %d\n", version); - } - - // on succes ibuf->userdata points to the bitmapfont - if (ibuf->userdata) { - break; - } - } - rect++; - } - } - } - } -} - -int locateGlyph(bmFont *bmfont, unsigned short unicode) -{ - int min, max, current = 0; - - if (bmfont) { - min = 0; - max = bmfont->glyphcount; - while (1) { - // look halfway for glyph - current = (min + max) >> 1; - - if (bmfont->glyphs[current].unicode == unicode) { - break; - } else if (bmfont->glyphs[current].unicode < unicode) { - // have to move up - min = current; - } else { - // have to move down - max = current; - } - - if (max - min <= 1) { - // unable to locate glyph - current = 0; - break; - } - } - } - - return(current); -} - -void matrixGlyph(ImBuf *ibuf, unsigned short unicode, - float *centerx, float *centery, - float *sizex, float *sizey, - float *transx, float *transy, - float *movex, float *movey, - float *advance) -{ - int index; - bmFont *bmfont; - - *centerx = *centery = 0.0; - *sizex = *sizey = 1.0; - *transx = *transy = 0.0; - *movex = *movey = 0.0; - *advance = 1.0; - - if (ibuf) { - bmfont = (bmFont*)ibuf->userdata; - if (bmfont && (ibuf->userflags & IB_BITMAPFONT)) { - index = locateGlyph(bmfont, unicode); - if (index) { - - *sizex = (bmfont->glyphs[index].sizex) / (float) (bmfont->glyphs[0].sizex); - *sizey = (bmfont->glyphs[index].sizey) / (float) (bmfont->glyphs[0].sizey); - - *transx = bmfont->glyphs[index].locx / (float) ibuf->x; - *transy = (ibuf->y - bmfont->glyphs[index].locy) / (float) ibuf->y; - - *centerx = bmfont->glyphs[0].locx / (float) ibuf->x; - *centery = (ibuf->y - bmfont->glyphs[0].locy) / (float) ibuf->y; - - // 2.0 units is the default size of an object - - *movey = (float)(1.0 - *sizey + 2.0 * (bmfont->glyphs[index].ofsy - bmfont->glyphs[0].ofsy) / (float) bmfont->glyphs[0].sizey); - *movex = (float)(*sizex - 1.0 + 2.0 * (bmfont->glyphs[index].ofsx - bmfont->glyphs[0].ofsx) / (float) bmfont->glyphs[0].sizex); - - *advance = (float)(2.0 * bmfont->glyphs[index].advance / (float) bmfont->glyphs[0].advance); - - // printfGlyph(&bmfont->glyphs[index]); - // printf("%c %d %0.5f %0.5f %0.5f %0.5f %0.5f\n", unicode, index, *sizex, *sizey, *transx, *transy, *advance); - } - } - } -} diff --git a/source/gameengine/GamePlayer/common/load.blend b/source/gameengine/GamePlayer/common/load.blend Binary files differdeleted file mode 100644 index ae520504971..00000000000 --- a/source/gameengine/GamePlayer/common/load.blend +++ /dev/null diff --git a/source/gameengine/GamePlayer/common/logo_blender.raw b/source/gameengine/GamePlayer/common/logo_blender.raw Binary files differdeleted file mode 100644 index 82bf25a2c6e..00000000000 --- a/source/gameengine/GamePlayer/common/logo_blender.raw +++ /dev/null diff --git a/source/gameengine/GamePlayer/common/logo_blender3d.raw b/source/gameengine/GamePlayer/common/logo_blender3d.raw Binary files differdeleted file mode 100644 index 6a86626bb10..00000000000 --- a/source/gameengine/GamePlayer/common/logo_blender3d.raw +++ /dev/null diff --git a/source/gameengine/GamePlayer/common/logo_nan.raw b/source/gameengine/GamePlayer/common/logo_nan.raw Binary files differdeleted file mode 100644 index b86308bd017..00000000000 --- a/source/gameengine/GamePlayer/common/logo_nan.raw +++ /dev/null diff --git a/source/gameengine/GamePlayer/ghost/CMakeLists.txt b/source/gameengine/GamePlayer/ghost/CMakeLists.txt index 0e9422c07aa..6a5d97e8ede 100644 --- a/source/gameengine/GamePlayer/ghost/CMakeLists.txt +++ b/source/gameengine/GamePlayer/ghost/CMakeLists.txt @@ -49,16 +49,17 @@ set(INC ../../../../intern/container ../../../../intern/ghost ../../../../intern/guardedalloc - ../../../../intern/moto/include ../../../../intern/string ) set(INC_SYS + ../../../../intern/moto/include ${GLEW_INCLUDE_PATH} ${PYTHON_INCLUDE_DIRS} + ${BOOST_INCLUDE_DIR} ) -set(SRC +set(SRC GPG_Application.cpp GPG_Canvas.cpp GPG_KeyboardDevice.cpp @@ -81,4 +82,11 @@ if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() +if(WITH_AUDASPACE) + list(APPEND INC + ../../../../intern/audaspace/intern + ) + add_definitions(-DWITH_AUDASPACE) +endif() + blender_add_lib_nolist(ge_player_ghost "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index 5baca2540a4..6f7a87804dc 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -99,6 +99,12 @@ extern "C" #include "GHOST_IWindow.h" #include "GHOST_Rect.h" +#ifdef WITH_AUDASPACE +# include "AUD_C-API.h" +# include "AUD_I3DDevice.h" +# include "AUD_IDevice.h" +#endif + static void frameTimerProc(GHOST_ITimerTask* task, GHOST_TUns64 time); static GHOST_ISystem* fSystem = 0; @@ -576,7 +582,12 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) m_canvas = new GPG_Canvas(window); if (!m_canvas) return false; - + + if (gm->vsync == VSYNC_ADAPTIVE) + m_canvas->SetSwapInterval(-1); + else + m_canvas->SetSwapInterval(gm->vsync); // VSYNC_OFF == 0, VSYNC_ON == 1, so this works + m_canvas->Init(); if (gm->flag & GAME_SHOW_MOUSE) m_canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL); @@ -725,6 +736,15 @@ bool GPG_Application::startEngine(void) if (m_startScene->gm.stereoflag == STEREO_DOME) m_ketsjiengine->InitDome(m_startScene->gm.dome.res, m_startScene->gm.dome.mode, m_startScene->gm.dome.angle, m_startScene->gm.dome.resbuf, m_startScene->gm.dome.tilt, m_startScene->gm.dome.warptext); + // initialize 3D Audio Settings + AUD_I3DDevice* dev = AUD_get3DDevice(); + if (dev) + { + dev->setSpeedOfSound(m_startScene->audio.speed_of_sound); + dev->setDopplerFactor(m_startScene->audio.doppler_factor); + dev->setDistanceModel(AUD_DistanceModel(m_startScene->audio.distance_model)); + } + #ifdef WITH_PYTHON // Set the GameLogic.globalDict from marshal'd data, so we can // load new blend files and keep data in GameLogic.globalDict diff --git a/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp b/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp index c438dcdd4a6..e0559385ee6 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Canvas.cpp @@ -55,9 +55,8 @@ void GPG_Canvas::Init() { if (m_window) { - GHOST_TSuccess success; - success = m_window->setDrawingContextType(GHOST_kDrawingContextTypeOpenGL); - assert(success == GHOST_kSuccess); + m_window->setDrawingContextType(GHOST_kDrawingContextTypeOpenGL); + assert(m_window->getDrawingContextType() == GHOST_kDrawingContextTypeOpenGL); } } @@ -108,6 +107,20 @@ void GPG_Canvas::SwapBuffers() } } +void GPG_Canvas::SetSwapInterval(int interval) +{ + if (m_window) + m_window->setSwapInterval(interval); +} + +int GPG_Canvas::GetSwapInterval() +{ + if (m_window) + return m_window->getSwapInterval(); + + return 0; +} + void GPG_Canvas::ResizeWindow(int width, int height) { if (m_window->getState() == GHOST_kWindowStateFullScreen) diff --git a/source/gameengine/GamePlayer/ghost/GPG_Canvas.h b/source/gameengine/GamePlayer/ghost/GPG_Canvas.h index 6168d96b337..6e1f86cac0e 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Canvas.h +++ b/source/gameengine/GamePlayer/ghost/GPG_Canvas.h @@ -55,6 +55,9 @@ public: virtual void SetMousePosition(int x, int y); virtual void SetMouseState(RAS_MouseState mousestate); virtual void SwapBuffers(); + virtual void SetSwapInterval(int interval); + virtual int GetSwapInterval(); + virtual int GetMouseX(int x) { return x; } virtual int GetMouseY(int y) { return y; } virtual float GetMouseNormalizedX(int x); diff --git a/source/gameengine/GamePlayer/ghost/GPG_System.h b/source/gameengine/GamePlayer/ghost/GPG_System.h index d68fc812dd3..1ec7a06d1cf 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_System.h +++ b/source/gameengine/GamePlayer/ghost/GPG_System.h @@ -37,11 +37,11 @@ #pragma warning (disable:4786) // suppress stl-MSVC debug info warning #endif /* WIN32 */ -#include "GPC_System.h" +#include "KX_ISystem.h" class GHOST_ISystem; -class GPG_System : public GPC_System +class GPG_System : public KX_ISystem { GHOST_ISystem* m_system; diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index 2c642d4bd04..817a4d8efac 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -813,9 +813,8 @@ int main(int argc, char** argv) if (!bfd) { // just add "//" in front of it - char temppath[242]; - strcpy(temppath, "//"); - strcat(temppath, basedpath); + char temppath[FILE_MAX] = "//"; + BLI_strncpy(temppath + 2, basedpath, FILE_MAX - 2); BLI_path_abs(temppath, pathname); bfd = load_game_data(temppath); @@ -1031,10 +1030,9 @@ int main(int argc, char** argv) * removal is needed else the system will free an already freed value */ system->removeEventConsumer(&app); - /* nodesystem relies on blendfile data, free it first */ - free_nodesystem(); - BLO_blendfiledata_free(bfd); + /* G.main == bfd->main, it gets referenced in free_nodesystem so we can't have a dangling pointer */ + G.main = NULL; if (python_main) MEM_freeN(python_main); } } while (exitcode == KX_EXIT_REQUEST_RESTART_GAME || exitcode == KX_EXIT_REQUEST_START_OTHER_GAME); @@ -1052,6 +1050,13 @@ int main(int argc, char** argv) } } + /* refer to WM_exit_ext() and free_blender(), + * these are not called in the player but we need to match some of there behavior here, + * if the order of function calls or blenders state isn't matching that of blender proper, + * we may get troubles later on */ + + free_nodesystem(); + // Cleanup RNA_exit(); BLF_exit(); diff --git a/source/gameengine/GamePlayer/ghost/SConscript b/source/gameengine/GamePlayer/ghost/SConscript index 8590aa24004..1b1d1fc1d91 100644 --- a/source/gameengine/GamePlayer/ghost/SConscript +++ b/source/gameengine/GamePlayer/ghost/SConscript @@ -43,6 +43,7 @@ incs = [ '#intern/guardedalloc', '#intern/moto/include', '#intern/container', + '#intern/audaspace/intern', '#source/gameengine/Rasterizer/RAS_OpenGLRasterizer', '#source/gameengine/BlenderRoutines', '#source/gameengine/Converter', @@ -70,6 +71,7 @@ incs = [ ] incs.append(env['BF_PTHREADS_INC']) +incs.append(env['BF_BOOST_INC']) defs = [ 'GLEW_STATIC', diff --git a/source/gameengine/Ketsji/CMakeLists.txt b/source/gameengine/Ketsji/CMakeLists.txt index 3baa72eb3c8..7da63dcc6f4 100644 --- a/source/gameengine/Ketsji/CMakeLists.txt +++ b/source/gameengine/Ketsji/CMakeLists.txt @@ -50,16 +50,16 @@ set(INC ../../blender/python/mathutils ../../../intern/container ../../../intern/guardedalloc - ../../../intern/moto/include ../../../intern/string ) set(INC_SYS + ../../../intern/moto/include + ../../../extern/recastnavigation/Recast/Include + ../../../extern/recastnavigation/Detour/Include ${PTHREADS_INCLUDE_DIRS} ${GLEW_INCLUDE_PATH} ${BOOST_INCLUDE_DIR} - ../../../extern/recastnavigation/Recast/Include - ../../../extern/recastnavigation/Detour/Include ) set(SRC @@ -185,7 +185,6 @@ set(SRC KX_OrientationInterpolator.h KX_ParentActuator.h KX_PhysicsEngineEnums.h - KX_PhysicsPropertiesobsolete.h KX_PolyProxy.h KX_PolygonMaterial.h KX_PositionInterpolator.h diff --git a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt index d5e2b375c72..0c661cf2c87 100644 --- a/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt +++ b/source/gameengine/Ketsji/KXNetwork/CMakeLists.txt @@ -31,12 +31,11 @@ set(INC ../../Network ../../SceneGraph ../../../../intern/container - ../../../../intern/moto/include ../../../../intern/string ) set(INC_SYS - + ../../../../intern/moto/include ) set(SRC diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp index 630b2f0b32a..28abdc898ae 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp @@ -157,6 +157,11 @@ Material *KX_BlenderMaterial::GetBlenderMaterial() const return mMaterial->material; } +Image *KX_BlenderMaterial::GetBlenderImage() const +{ + return mMaterial->tface.tpage; +} + Scene* KX_BlenderMaterial::GetBlenderScene() const { return mScene->GetBlenderScene(); diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h index c34a49e1bde..0a2675f04a8 100644 --- a/source/gameengine/Ketsji/KX_BlenderMaterial.h +++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h @@ -78,6 +78,7 @@ public: )const; Material* GetBlenderMaterial() const; + Image* GetBlenderImage() const; MTFace* GetMTFace(void) const; unsigned int* GetMCol(void) const; BL_Texture * getTex (unsigned int idx) { diff --git a/source/gameengine/Ketsji/KX_FontObject.cpp b/source/gameengine/Ketsji/KX_FontObject.cpp index 95798900ccc..c6d1041a12a 100644 --- a/source/gameengine/Ketsji/KX_FontObject.cpp +++ b/source/gameengine/Ketsji/KX_FontObject.cpp @@ -76,12 +76,14 @@ static std::vector<STR_String> split_string(STR_String str) KX_FontObject::KX_FontObject(void* sgReplicationInfo, SG_Callbacks callbacks, RAS_IRenderTools* rendertools, - Object *ob): + Object *ob, + bool do_color_management): KX_GameObject(sgReplicationInfo, callbacks), m_object(ob), m_dpi(72), m_resolution(1.f), - m_rendertools(rendertools) + m_rendertools(rendertools), + m_do_color_management(do_color_management) { Curve *text = static_cast<Curve *> (ob->data); m_text = split_string(text->str); @@ -174,6 +176,15 @@ void KX_FontObject::DrawText() /* update the animated color */ this->GetObjectColor().getValue(m_color); + /* Font Objects don't use the glsl shader, this color management code is copied from gpu_shader_material.glsl */ + float color[4]; + if (m_do_color_management) { + linearrgb_to_srgb_v4(color, m_color); + } + else { + copy_v4_v4(color, m_color); + } + /* HARDCODED MULTIPLICATION FACTOR - this will affect the render resolution directly */ const float RES = BGE_FONT_RES * m_resolution; @@ -201,7 +212,7 @@ void KX_FontObject::DrawText() mat[13] -= spacing[1]; mat[14] -= spacing[2]; } - m_rendertools->RenderText3D(m_fontid, m_text[i], int(size), m_dpi, m_color, mat, aspect); + m_rendertools->RenderText3D(m_fontid, m_text[i], int(size), m_dpi, color, mat, aspect); } } diff --git a/source/gameengine/Ketsji/KX_FontObject.h b/source/gameengine/Ketsji/KX_FontObject.h index ac22de6fb6f..3d8c1d99dcc 100644 --- a/source/gameengine/Ketsji/KX_FontObject.h +++ b/source/gameengine/Ketsji/KX_FontObject.h @@ -42,7 +42,8 @@ public: KX_FontObject(void* sgReplicationInfo, SG_Callbacks callbacks, RAS_IRenderTools* rendertools, - Object *ob); + Object *ob, + bool do_color_management); virtual ~KX_FontObject(); @@ -69,6 +70,8 @@ protected: class RAS_IRenderTools* m_rendertools; //needed for drawing routine + bool m_do_color_management; + #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); diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp index 871318bcedc..ec62ae63f0c 100644 --- a/source/gameengine/Ketsji/KX_GameObject.cpp +++ b/source/gameengine/Ketsji/KX_GameObject.cpp @@ -38,6 +38,8 @@ #if defined(_WIN64) && !defined(FREE_WINDOWS64) typedef unsigned __int64 uint_ptr; +#elif defined(FREE_WINDOWS64) +typedef unsigned long long uint_ptr; #else typedef unsigned long uint_ptr; #endif diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.cpp b/source/gameengine/Ketsji/KX_IPO_SGController.cpp index 4c43633d4c5..f221b7c6cd4 100644 --- a/source/gameengine/Ketsji/KX_IPO_SGController.cpp +++ b/source/gameengine/Ketsji/KX_IPO_SGController.cpp @@ -33,6 +33,8 @@ #if defined(_WIN64) && !defined(FREE_WINDOWS64) typedef unsigned __int64 uint_ptr; +#elif defined(FREE_WINDOWS64) +typedef unsigned long long uint_ptr; #else typedef unsigned long uint_ptr; #endif diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 1061e9fd571..360a337f852 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -129,8 +129,6 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system) m_keyboarddevice(NULL), m_mousedevice(NULL), - m_propertiesPresent(false), - m_bInitialized(false), m_activecam(0), m_bFixedTime(false), @@ -515,7 +513,7 @@ void KX_KetsjiEngine::EndFrame() // Show profiling info m_logger->StartLog(tc_overhead, m_kxsystem->GetTimeInSeconds(), true); - if (m_show_framerate || m_show_profile || (m_show_debug_properties && m_propertiesPresent)) + if (m_show_framerate || m_show_profile || (m_show_debug_properties)) { RenderDebugProperties(); } @@ -1389,7 +1387,6 @@ void KX_KetsjiEngine::AddScene(KX_Scene* scene) { m_scenes.push_back(scene); PostProcessScene(scene); - SceneListsChanged(); } @@ -1533,7 +1530,7 @@ void KX_KetsjiEngine::RenderDebugProperties() ycoord += title_y_top_margin; /* Property display*/ - if (m_show_debug_properties && m_propertiesPresent) { + if (m_show_debug_properties) { /* Title for debugging("Debug properties") */ m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED, @@ -1548,18 +1545,22 @@ void KX_KetsjiEngine::RenderDebugProperties() // Add the title indent afterwards ycoord += title_y_bottom_margin; + /* Calculate amount of properties that can displayed. */ + unsigned propsAct = 0; + unsigned propsMax = (m_canvas->GetHeight() - ycoord) / const_ysize; + KX_SceneList::iterator sceneit; for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); sceneit++) { KX_Scene* scene = *sceneit; /* the 'normal' debug props */ vector<SCA_DebugProp*>& debugproplist = scene->GetDebugProperties(); - for (vector<SCA_DebugProp*>::iterator it = debugproplist.begin(); - !(it==debugproplist.end());it++) + for (unsigned i=0; i < debugproplist.size() && propsAct < propsMax; i++) { - CValue *propobj = (*it)->m_obj; + CValue *propobj = debugproplist[i]->m_obj; STR_String objname = propobj->GetName(); - STR_String propname = (*it)->m_name; + STR_String propname = debugproplist[i]->m_name; + propsAct++; if (propname == "__state__") { // reserve name for object state KX_GameObject* gameobj = static_cast<KX_GameObject*>(propobj); @@ -1943,24 +1944,6 @@ void KX_KetsjiEngine::ProcessScheduledScenes(void) ReplaceScheduledScenes(); RemoveScheduledScenes(); AddScheduledScenes(); - - // Notify - SceneListsChanged(); - } -} - - - -void KX_KetsjiEngine::SceneListsChanged(void) -{ - m_propertiesPresent = false; - KX_SceneList::iterator sceneit = m_scenes.begin(); - while ((sceneit != m_scenes.end()) && (!m_propertiesPresent)) - { - KX_Scene* scene = *sceneit; - vector<SCA_DebugProp*>& debugproplist = scene->GetDebugProperties(); - m_propertiesPresent = !debugproplist.empty(); - sceneit++; } } diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h index 4e69c7d35f7..4dd8ea10e62 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.h +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h @@ -437,7 +437,6 @@ protected: /** * This method is invoked when the scene lists have changed. */ - void SceneListsChanged(void); void RemoveScheduledScenes(void); void AddScheduledScenes(void); diff --git a/source/gameengine/Ketsji/KX_PhysicsPropertiesobsolete.h b/source/gameengine/Ketsji/KX_PhysicsPropertiesobsolete.h deleted file mode 100644 index ee685edb9c1..00000000000 --- a/source/gameengine/Ketsji/KX_PhysicsPropertiesobsolete.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file KX_PhysicsPropertiesobsolete.h - * \ingroup ketsji - * \todo check if this file is still needed - */ - -#ifndef __KX_PHYSICSPROPERTIESOBSOLETE_H__ -#define __KX_PHYSICSPROPERTIESOBSOLETE_H__ - -#include <MT_Scalar.h> - -// Properties of dynamic objects -struct KX_ShapeProps { - MT_Scalar m_mass; // Total mass - MT_Scalar m_inertia; // Inertia, should be a tensor some time - MT_Scalar m_lin_drag; // Linear drag (air, water) 0 = concrete, 1 = vacuum - MT_Scalar m_ang_drag; // Angular drag - MT_Scalar m_friction_scaling[3]; // Scaling for anisotropic friction. Component in range [0, 1] - bool m_do_anisotropic; // Should I do anisotropic friction? - bool m_do_fh; // Should the object have a linear Fh spring? - bool m_do_rot_fh; // Should the object have an angular Fh spring? -}; - - -// Properties of collidable objects (non-ghost objects) -struct KX_MaterialProps { - MT_Scalar m_restitution; // restitution of energie after a collision 0 = inelastic, 1 = elastic - MT_Scalar m_friction; // Coulomb friction (= ratio between the normal en maximum friction force) - MT_Scalar m_fh_spring; // Spring constant (both linear and angular) - MT_Scalar m_fh_damping; // Damping factor (linear and angular) in range [0, 1] - MT_Scalar m_fh_distance; // The range above the surface where Fh is active. - bool m_fh_normal; // Should the object slide off slopes? -}; - -#endif /* __KX_PHYSICSPROPERTIESOBSOLETE_H__ */ diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 58996f7b86f..e595f24a662 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -1372,6 +1372,29 @@ static PyObject *gPyGetMipmapping(PyObject *) return PyLong_FromLong(gp_Rasterizer->GetMipmapping()); } +static PyObject *gPySetVsync(PyObject *, PyObject *args) +{ + int interval; + + if (!PyArg_ParseTuple(args, "i:setVsync", &interval)) + return NULL; + + if (interval < VSYNC_OFF || interval > VSYNC_ADAPTIVE) { + PyErr_SetString(PyExc_ValueError, "Rasterizer.setVsync(value): value must be VSYNC_OFF, VSYNC_ON, or VSYNC_ADAPTIVE"); + return NULL; + } + + if (interval == VSYNC_ADAPTIVE) + interval = -1; + gp_Canvas->SetSwapInterval(interval); + Py_RETURN_NONE; +} + +static PyObject *gPyGetVsync(PyObject *) +{ + return PyLong_FromLong(gp_Canvas->GetSwapInterval()); +} + static struct PyMethodDef rasterizer_methods[] = { {"getWindowWidth",(PyCFunction) gPyGetWindowWidth, METH_VARARGS, "getWindowWidth doc"}, @@ -1417,6 +1440,8 @@ static struct PyMethodDef rasterizer_methods[] = { {"getFullScreen", (PyCFunction) gPyGetFullScreen, METH_NOARGS, ""}, {"setMipmapping", (PyCFunction) gPySetMipmapping, METH_VARARGS, ""}, {"getMipmapping", (PyCFunction) gPyGetMipmapping, METH_NOARGS, ""}, + {"setVsync", (PyCFunction) gPySetVsync, METH_VARARGS, ""}, + {"getVsync", (PyCFunction) gPyGetVsync, METH_NOARGS, ""}, { NULL, (PyCFunction) NULL, 0, NULL } }; @@ -2122,6 +2147,7 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene *startscene, Main * "'render':__import__('Rasterizer'), " "'events':__import__('GameKeys'), " "'constraints':__import__('PhysicsConstraints'), " + "'physics':__import__('PhysicsConstraints')," "'types':__import__('GameTypes'), " "'texture':__import__('VideoTexture')});" /* so we can do 'import bge.foo as bar' */ @@ -2130,6 +2156,7 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene *startscene, Main * "'bge.render':bge.render, " "'bge.events':bge.events, " "'bge.constraints':bge.constraints, " + "'bge.physics':bge.physics," "'bge.types':bge.types, " "'bge.texture':bge.texture})" ); @@ -2187,6 +2214,11 @@ PyObject *initRasterizer(RAS_IRasterizer* rasty,RAS_ICanvas* canvas) KX_MACRO_addTypesToDict(d, RAS_MIPMAP_NEAREST, RAS_IRasterizer::RAS_MIPMAP_NEAREST); KX_MACRO_addTypesToDict(d, RAS_MIPMAP_LINEAR, RAS_IRasterizer::RAS_MIPMAP_LINEAR); + /* for get/setVsync */ + KX_MACRO_addTypesToDict(d, VSYNC_OFF, VSYNC_OFF); + KX_MACRO_addTypesToDict(d, VSYNC_ON, VSYNC_ON); + KX_MACRO_addTypesToDict(d, VSYNC_ADAPTIVE, VSYNC_ADAPTIVE); + // XXXX Add constants here // Check for errors diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp index 24323f91c3e..247f4173d1d 100644 --- a/source/gameengine/Ketsji/KX_PythonSeq.cpp +++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp @@ -404,7 +404,8 @@ static PyObject *KX_PythonSeq_richcmp(PyObject *a, PyObject *b, int op) switch (op) { case Py_NE: - ok = !ok; /* pass through */ + ok = !ok; + /* fall-through */ case Py_EQ: res = ok ? Py_False : Py_True; break; diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index 13fb168221d..35084061ab0 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -59,6 +59,7 @@ #include "SCA_JoystickManager.h" #include "KX_PyMath.h" #include "RAS_MeshObject.h" +#include "SCA_IScene.h" #include "RAS_IRasterizer.h" #include "RAS_BucketManager.h" @@ -73,6 +74,7 @@ #include "SG_Tree.h" #include "DNA_group_types.h" #include "DNA_scene_types.h" +#include "DNA_property_types.h" #include "KX_SG_NodeRelationships.h" @@ -438,6 +440,21 @@ void KX_Scene::EnableZBufferClearing(bool isclearingZbuffer) m_isclearingZbuffer = isclearingZbuffer; } +void KX_Scene::AddObjectDebugProperties(class KX_GameObject* gameobj) +{ + Object* blenderobject = gameobj->GetBlenderObject(); + bProperty* prop = (bProperty*)blenderobject->prop.first; + + while(prop) { + if (prop->flag & PROP_DEBUG) + AddDebugProperty(gameobj,STR_String(prop->name)); + prop = prop->next; + } + + if (blenderobject->scaflag & OB_DEBUGSTATE) + AddDebugProperty(gameobj,STR_String("__state__")); +} + void KX_Scene::RemoveNodeDestructObject(class SG_IObject* node,class CValue* gameobj) { KX_GameObject* orgobj = (KX_GameObject*)gameobj; @@ -561,6 +578,8 @@ KX_GameObject* KX_Scene::AddNodeReplicaObject(class SG_IObject* node, class CVal // SCA_IObject::ReParentLogic(), make sure it preserves the order of the bricks. void KX_Scene::ReplicateLogic(KX_GameObject* newobj) { + /* add properties to debug list, for added objects and DupliGroups */ + AddObjectDebugProperties(newobj); // also relink the controller to sensors/actuators SCA_ControllerList& controllers = newobj->GetControllers(); //SCA_SensorList& sensors = newobj->GetSensors(); @@ -972,6 +991,9 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj) int ret; KX_GameObject* newobj = (KX_GameObject*) gameobj; + /* remove property to debug list */ + RemoveObjectDebugProperties(newobj); + /* Invalidate the python reference, since the object may exist in script lists * its possible that it wont be automatically invalidated, so do it manually here, * @@ -1556,9 +1578,37 @@ void KX_Scene::AddAnimatedObject(CValue* gameobj) void KX_Scene::UpdateAnimations(double curtime) { - // Update any animations - for (int i=0; i<m_animatedlist->GetCount(); ++i) - ((KX_GameObject*)m_animatedlist->GetValue(i))->UpdateActionManager(curtime); + KX_GameObject *gameobj; + bool needs_update; + + for (int i=0; i<m_animatedlist->GetCount(); ++i) { + gameobj = (KX_GameObject*)m_animatedlist->GetValue(i); + + // Non-armature updates are fast enough, so just update them + needs_update = gameobj->GetGameObjectType() != SCA_IObject::OBJ_ARMATURE; + + if (!needs_update) { + // If we got here, we're looking to update an armature, so check its children meshes + // to see if we need to bother with a more expensive pose update + CListValue *children = gameobj->GetChildren(); + KX_GameObject *child; + + // Check for meshes that haven't been culled + for (int j=0; j<children->GetCount(); ++j) { + child = (KX_GameObject*)children->GetValue(j); + + if (child->GetMeshCount() > 0 && !child->GetCulled()) { + needs_update = true; + break; + } + } + + children->Release(); + } + + if (needs_update) + gameobj->UpdateActionManager(curtime); + } } void KX_Scene::LogicUpdateFrame(double curtime, bool frame) @@ -1911,6 +1961,7 @@ bool KX_Scene::MergeScene(KX_Scene *other) { KX_GameObject* gameobj = (KX_GameObject*)other->GetObjectList()->GetValue(i); MergeScene_GameObject(gameobj, this, other); + AddObjectDebugProperties(gameobj); // add properties to debug list for LibLoad objects gameobj->UpdateBuckets(false); /* only for active objects */ } diff --git a/source/gameengine/Ketsji/KX_Scene.h b/source/gameengine/Ketsji/KX_Scene.h index 7c3ea946044..edaa0663b22 100644 --- a/source/gameengine/Ketsji/KX_Scene.h +++ b/source/gameengine/Ketsji/KX_Scene.h @@ -324,6 +324,7 @@ public: return (m_groupGameObjects.empty() || m_groupGameObjects.find(gameobj) != m_groupGameObjects.end()); } + void AddObjectDebugProperties(class KX_GameObject* gameobj); SCA_IObject* AddReplicaObject(CValue* gameobj, CValue* locationobj, int lifespan=0); diff --git a/source/gameengine/Network/CMakeLists.txt b/source/gameengine/Network/CMakeLists.txt index e1390e40382..bae00c464f2 100644 --- a/source/gameengine/Network/CMakeLists.txt +++ b/source/gameengine/Network/CMakeLists.txt @@ -26,12 +26,11 @@ set(INC . ../../../intern/container - ../../../intern/moto/include ../../../intern/string ) set(INC_SYS - + ../../../intern/moto/include ) set(SRC diff --git a/source/gameengine/Physics/Bullet/CMakeLists.txt b/source/gameengine/Physics/Bullet/CMakeLists.txt index 89d7f41ab4d..87d851016dd 100644 --- a/source/gameengine/Physics/Bullet/CMakeLists.txt +++ b/source/gameengine/Physics/Bullet/CMakeLists.txt @@ -39,11 +39,11 @@ set(INC ../../../blender/makesdna ../../../../intern/container ../../../../intern/guardedalloc - ../../../../intern/moto/include ../../../../intern/string ) set(INC_SYS + ../../../../intern/moto/include ${GLEW_INCLUDE_PATH} ${PYTHON_INCLUDE_DIRS} ) diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index b389347cdb0..1a8fda0749a 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -1146,7 +1146,7 @@ void CcdPhysicsController::ApplyTorque(float torqueX,float torqueY,float torque { //workaround for incompatibility between 'DYNAMIC' game object, and angular factor //a DYNAMIC object has some inconsistency: it has no angular effect due to collisions, but still has torque - const btVector3& angFac = body->getAngularFactor(); + const btVector3 angFac = body->getAngularFactor(); btVector3 tmpFac(1,1,1); body->setAngularFactor(tmpFac); body->applyTorque(torque); @@ -1587,6 +1587,11 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, if (mf->v4 && vert_tag_array[mf->v4] == false) {vert_tag_array[mf->v4] = true; tot_bt_verts++;} } } + + /* Can happen with ngons */ + if (!tot_bt_verts) { + goto cleanup_empty_mesh; + } m_vertexArray.resize(tot_bt_verts*3); @@ -1662,6 +1667,11 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, } } + /* Can happen with ngons */ + if (!tot_bt_verts) { + goto cleanup_empty_mesh; + } + m_vertexArray.resize(tot_bt_verts*3); m_polygonIndexArray.resize(tot_bt_tris); m_triFaceArray.resize(tot_bt_tris*3); @@ -1804,6 +1814,19 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm, m_meshShapeMap.insert(std::pair<RAS_MeshObject*,CcdShapeConstructionInfo*>(meshobj,this)); } return true; + + +cleanup_empty_mesh: + m_shapeType = PHY_SHAPE_NONE; + m_meshObject = NULL; + m_vertexArray.clear(); + m_polygonIndexArray.clear(); + m_triFaceArray.clear(); + m_triFaceUVcoArray.clear(); + if (free_dm) { + dm->release(dm); + } + return false; } #include <cstdio> diff --git a/source/gameengine/Physics/Dummy/CMakeLists.txt b/source/gameengine/Physics/Dummy/CMakeLists.txt index 529a75b2a62..692331f1ce4 100644 --- a/source/gameengine/Physics/Dummy/CMakeLists.txt +++ b/source/gameengine/Physics/Dummy/CMakeLists.txt @@ -26,11 +26,10 @@ set(INC . ../common - ../../../../intern/moto/include ) set(INC_SYS - + ../../../../intern/moto/include ) set(SRC diff --git a/source/gameengine/Rasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/CMakeLists.txt index 3ea26c3be9d..9061532ba5d 100644 --- a/source/gameengine/Rasterizer/CMakeLists.txt +++ b/source/gameengine/Rasterizer/CMakeLists.txt @@ -33,11 +33,11 @@ set(INC ../../blender/blenkernel ../../../intern/container ../../../intern/guardedalloc - ../../../intern/moto/include ../../../intern/string ) set(INC_SYS + ../../../intern/moto/include ${GLEW_INCLUDE_PATH} ${PYTHON_INCLUDE_DIRS} ) diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp index 79ce8538210..bfe29a48c69 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp +++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp @@ -429,6 +429,11 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas) glActiveTextureARB(GL_TEXTURE0); canvas->SetViewPort(0, 0, rect_width-1, rect_height-1); + // We do this to make side-by-side stereo rendering work correctly with 2D filters. It would probably be nicer to just set the viewport, + // but it can be easier for writing shaders to have the coordinates for the whole screen instead of just part of the screen. + RAS_Rect scissor_rect = canvas->GetDisplayArea(); + glScissor(scissor_rect.GetLeft()+viewport[0], scissor_rect.GetBottom()+viewport[1], scissor_rect.GetWidth()+1, scissor_rect.GetHeight()+1); + glDisable(GL_DEPTH_TEST); // in case the previous material was wire glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); diff --git a/source/gameengine/Rasterizer/RAS_ICanvas.h b/source/gameengine/Rasterizer/RAS_ICanvas.h index 1b1e43a5257..9e8a6e8ccf6 100644 --- a/source/gameengine/Rasterizer/RAS_ICanvas.h +++ b/source/gameengine/Rasterizer/RAS_ICanvas.h @@ -105,6 +105,17 @@ public: void SwapBuffers( )=0; + + virtual + void + SetSwapInterval( + int interval + )=0; + + virtual + int + GetSwapInterval( + )=0; virtual void diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt index d61f90378bb..6b53990770f 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt @@ -33,11 +33,11 @@ set(INC ../../../blender/gpu ../../../blender/makesdna ../../../../intern/container - ../../../../intern/moto/include ../../../../intern/string ) set(INC_SYS + ../../../../intern/moto/include ${GLEW_INCLUDE_PATH} ) diff --git a/source/gameengine/SceneGraph/CMakeLists.txt b/source/gameengine/SceneGraph/CMakeLists.txt index 7b7f05da3e3..bbad429bbcd 100644 --- a/source/gameengine/SceneGraph/CMakeLists.txt +++ b/source/gameengine/SceneGraph/CMakeLists.txt @@ -25,11 +25,10 @@ set(INC . - ../../../intern/moto/include ) set(INC_SYS - + ../../../intern/moto/include ) set(SRC diff --git a/source/gameengine/VideoTexture/CMakeLists.txt b/source/gameengine/VideoTexture/CMakeLists.txt index f436fecf6b7..3ca3917cf6d 100644 --- a/source/gameengine/VideoTexture/CMakeLists.txt +++ b/source/gameengine/VideoTexture/CMakeLists.txt @@ -43,11 +43,11 @@ set(INC ../../../intern/container ../../../intern/ffmpeg ../../../intern/guardedalloc - ../../../intern/moto/include ../../../intern/string ) set(INC_SYS + ../../../intern/moto/include ${GLEW_INCLUDE_PATH} ) |