diff options
665 files changed, 13751 insertions, 14135 deletions
diff --git a/.clang-tidy b/.clang-tidy index 25be61ff649..10738f574d6 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -38,17 +38,11 @@ Checks: > -modernize-deprecated-headers, -modernize-avoid-c-arrays, -modernize-use-equals-default, - -modernize-use-nullptr, - -modernize-concat-nested-namespaces, - -modernize-use-emplace, -modernize-use-nodiscard, -modernize-use-using, - -modernize-redundant-void-arg, - -modernize-use-bool-literals, -modernize-loop-convert, -modernize-pass-by-value, -modernize-use-default-member-init, - -modernize-make-unique, -modernize-raw-string-literal, -modernize-avoid-bind, -modernize-use-override, diff --git a/CMakeLists.txt b/CMakeLists.txt index 15b272a8d2e..aa791a53f81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1522,6 +1522,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter) ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_VARIABLE -Wno-unused-variable) ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS -Wno-unused-macros) + ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISLEADING_INDENTATION -Wno-misleading-indentation) ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations) ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_INCOMPAT_PTR_DISCARD_QUAL -Wno-incompatible-pointer-types-discards-qualifiers) @@ -1532,6 +1533,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef) ADD_CHECK_C_COMPILER_FLAG(C_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn) + ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter) ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field) ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing) ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor) @@ -1541,6 +1543,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "Clang") ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_TYPEDEFS -Wno-unused-local-typedefs) ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNDEFINED_VAR_TEMPLATE -Wno-undefined-var-template) ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_INSTANTIATION_AFTER_SPECIALIZATION -Wno-instantiation-after-specialization) + ADD_CHECK_CXX_COMPILER_FLAG(CXX_REMOVE_STRICT_FLAGS CXX_WARN_NO_MISLEADING_INDENTATION -Wno-misleading-indentation) elseif(CMAKE_C_COMPILER_ID MATCHES "Intel") diff --git a/build_files/cmake/Modules/FindClangTidy.cmake b/build_files/cmake/Modules/FindClangTidy.cmake index d576ad8f100..04c5dfda448 100644 --- a/build_files/cmake/Modules/FindClangTidy.cmake +++ b/build_files/cmake/Modules/FindClangTidy.cmake @@ -43,7 +43,10 @@ find_program(CLANG_TIDY_EXECUTABLE ${_clang_tidy_SEARCH_DIRS} ) -if(CLANG_TIDY_EXECUTABLE) +if(CLANG_TIDY_EXECUTABLE AND NOT EXISTS ${CLANG_TIDY_EXECUTABLE}) + message(WARNING "Cached or directly specified Clang-Tidy executable does not exist.") + set(CLANG_TIDY_FOUND FALSE) +elseif(CLANG_TIDY_EXECUTABLE) # Mark clang-tidy as found. set(CLANG_TIDY_FOUND TRUE) diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index ebc08fb411c..3f0ed2a4def 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -869,28 +869,26 @@ GHOST_TSuccess GHOST_WindowCocoa::setProgressBar(float progress) NSImage *dockIcon = [[NSImage alloc] initWithSize:NSMakeSize(128, 128)]; [dockIcon lockFocus]; - NSRect progressBox = {{4, 4}, {120, 16}}; [[NSImage imageNamed:@"NSApplicationIcon"] drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:1.0]; - // Track & Outline - [[NSColor blackColor] setFill]; - NSRectFill(progressBox); + NSRect progressRect = {{8, 8}, {112, 14}}; + NSBezierPath *progressPath; - [[NSColor whiteColor] set]; - NSFrameRect(progressBox); + /* Draw white track. */ + [[[NSColor whiteColor] colorWithAlphaComponent:0.6] setFill]; + progressPath = [NSBezierPath bezierPathWithRoundedRect:progressRect xRadius:7 yRadius:7]; + [progressPath fill]; - // Progress fill - progressBox = NSInsetRect(progressBox, 1, 1); - - progressBox.size.width = progressBox.size.width * progress; - NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor darkGrayColor] - endingColor:[NSColor lightGrayColor]]; - [gradient drawInRect:progressBox angle:90]; - [gradient release]; + /* Black progress fill. */ + [[[NSColor blackColor] colorWithAlphaComponent:0.7] setFill]; + progressRect = NSInsetRect(progressRect, 2, 2); + progressRect.size.width *= progress; + progressPath = [NSBezierPath bezierPathWithRoundedRect:progressRect xRadius:5 yRadius:5]; + [progressPath fill]; [dockIcon unlockFocus]; diff --git a/intern/libmv/CMakeLists.txt b/intern/libmv/CMakeLists.txt index b372cfe92bb..6fcf664d1f5 100644 --- a/intern/libmv/CMakeLists.txt +++ b/intern/libmv/CMakeLists.txt @@ -51,8 +51,6 @@ if(WITH_LIBMV) list(APPEND INC ${GFLAGS_INCLUDE_DIRS} ${GLOG_INCLUDE_DIRS} - ../../extern/ceres/include - ../../extern/ceres/config ../guardedalloc ) @@ -60,6 +58,8 @@ if(WITH_LIBMV) ${EIGEN3_INCLUDE_DIRS} ${PNG_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} + ../../extern/ceres/include + ../../extern/ceres/config ) list(APPEND LIB diff --git a/intern/libmv/bundle.sh b/intern/libmv/bundle.sh index 48da102b801..db8f88845a8 100755 --- a/intern/libmv/bundle.sh +++ b/intern/libmv/bundle.sh @@ -127,8 +127,6 @@ if(WITH_LIBMV) list(APPEND INC \${GFLAGS_INCLUDE_DIRS} \${GLOG_INCLUDE_DIRS} - ../../extern/ceres/include - ../../extern/ceres/config ../guardedalloc ) @@ -136,6 +134,8 @@ if(WITH_LIBMV) \${EIGEN3_INCLUDE_DIRS} \${PNG_INCLUDE_DIRS} \${ZLIB_INCLUDE_DIRS} + ../../extern/ceres/include + ../../extern/ceres/config ) list(APPEND LIB diff --git a/intern/mantaflow/extern/manta_fluid_API.h b/intern/mantaflow/extern/manta_fluid_API.h index 6827ac35050..e4ad4c66d8a 100644 --- a/intern/mantaflow/extern/manta_fluid_API.h +++ b/intern/mantaflow/extern/manta_fluid_API.h @@ -33,44 +33,44 @@ struct MANTA; /* Fluid functions */ struct MANTA *manta_init(int *res, struct FluidModifierData *fmd); void manta_free(struct MANTA *fluid); -int manta_ensure_obstacle(struct MANTA *fluid, struct FluidModifierData *fmd); -int manta_ensure_guiding(struct MANTA *fluid, struct FluidModifierData *fmd); -int manta_ensure_invelocity(struct MANTA *fluid, struct FluidModifierData *fmd); -int manta_ensure_outflow(struct MANTA *fluid, struct FluidModifierData *fmd); -int manta_write_config(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); -int manta_write_data(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); -int manta_write_noise(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); -int manta_read_config(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); -int manta_read_data(struct MANTA *fluid, - struct FluidModifierData *fmd, - int framenr, - bool resumable); -int manta_read_noise(struct MANTA *fluid, +bool manta_ensure_obstacle(struct MANTA *fluid, struct FluidModifierData *fmd); +bool manta_ensure_guiding(struct MANTA *fluid, struct FluidModifierData *fmd); +bool manta_ensure_invelocity(struct MANTA *fluid, struct FluidModifierData *fmd); +bool manta_ensure_outflow(struct MANTA *fluid, struct FluidModifierData *fmd); +bool manta_write_config(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); +bool manta_write_data(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); +bool manta_write_noise(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); +bool manta_read_config(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); +bool manta_read_data(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr, bool resumable); -int manta_read_mesh(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); -int manta_read_particles(struct MANTA *fluid, - struct FluidModifierData *fmd, - int framenr, - bool resumable); -int manta_read_guiding(struct MANTA *fluid, - struct FluidModifierData *fmd, - int framenr, - bool sourceDomain); -int manta_bake_data(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); -int manta_bake_noise(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); -int manta_bake_mesh(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); -int manta_bake_particles(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); -int manta_bake_guiding(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); -int manta_has_data(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); -int manta_has_noise(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); -int manta_has_mesh(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); -int manta_has_particles(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); -int manta_has_guiding(struct MANTA *fluid, +bool manta_read_noise(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr, - bool domain); + bool resumable); +bool manta_read_mesh(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); +bool manta_read_particles(struct MANTA *fluid, + struct FluidModifierData *fmd, + int framenr, + bool resumable); +bool manta_read_guiding(struct MANTA *fluid, + struct FluidModifierData *fmd, + int framenr, + bool sourceDomain); +bool manta_bake_data(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); +bool manta_bake_noise(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); +bool manta_bake_mesh(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); +bool manta_bake_particles(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); +bool manta_bake_guiding(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); +bool manta_has_data(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); +bool manta_has_noise(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); +bool manta_has_mesh(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); +bool manta_has_particles(struct MANTA *fluid, struct FluidModifierData *fmd, int framenr); +bool manta_has_guiding(struct MANTA *fluid, + struct FluidModifierData *fmd, + int framenr, + bool domain); void manta_update_variables(struct MANTA *fluid, struct FluidModifierData *fmd); int manta_get_frame(struct MANTA *fluid); @@ -113,7 +113,7 @@ float *manta_get_phi(struct MANTA *fluid); float *manta_get_pressure(struct MANTA *fluid); /* Smoke functions */ -void manta_smoke_export_script(struct MANTA *smoke, struct FluidModifierData *fmd); +bool manta_smoke_export_script(struct MANTA *smoke, struct FluidModifierData *fmd); void manta_smoke_get_rgba(struct MANTA *smoke, float *data, int sequential); void manta_noise_get_rgba(struct MANTA *smoke, float *data, int sequential); void manta_smoke_get_rgba_fixed_color(struct MANTA *smoke, @@ -124,9 +124,9 @@ void manta_noise_get_rgba_fixed_color(struct MANTA *smoke, float color[3], float *data, int sequential); -int manta_smoke_ensure_heat(struct MANTA *smoke, struct FluidModifierData *fmd); -int manta_smoke_ensure_fire(struct MANTA *smoke, struct FluidModifierData *fmd); -int manta_smoke_ensure_colors(struct MANTA *smoke, struct FluidModifierData *fmd); +bool manta_smoke_ensure_heat(struct MANTA *smoke, struct FluidModifierData *fmd); +bool manta_smoke_ensure_fire(struct MANTA *smoke, struct FluidModifierData *fmd); +bool manta_smoke_ensure_colors(struct MANTA *smoke, struct FluidModifierData *fmd); /* Smoke accessors */ float *manta_smoke_get_density(struct MANTA *smoke); @@ -147,9 +147,9 @@ float *manta_smoke_get_color_b_in(struct MANTA *smoke); float *manta_smoke_get_fuel_in(struct MANTA *smoke); float *manta_smoke_get_react_in(struct MANTA *smoke); float *manta_smoke_get_emission_in(struct MANTA *smoke); -int manta_smoke_has_heat(struct MANTA *smoke); -int manta_smoke_has_fuel(struct MANTA *smoke); -int manta_smoke_has_colors(struct MANTA *smoke); +bool manta_smoke_has_heat(struct MANTA *smoke); +bool manta_smoke_has_fuel(struct MANTA *smoke); +bool manta_smoke_has_colors(struct MANTA *smoke); float *manta_noise_get_density(struct MANTA *smoke); float *manta_noise_get_fuel(struct MANTA *smoke); float *manta_noise_get_react(struct MANTA *smoke); @@ -163,14 +163,14 @@ float *manta_noise_get_texture_u2(struct MANTA *smoke); float *manta_noise_get_texture_v2(struct MANTA *smoke); float *manta_noise_get_texture_w2(struct MANTA *smoke); float *manta_noise_get_flame(struct MANTA *smoke); -int manta_noise_has_fuel(struct MANTA *smoke); -int manta_noise_has_colors(struct MANTA *smoke); +bool manta_noise_has_fuel(struct MANTA *smoke); +bool manta_noise_has_colors(struct MANTA *smoke); void manta_noise_get_res(struct MANTA *smoke, int *res); int manta_noise_get_cells(struct MANTA *smoke); /* Liquid functions */ -void manta_liquid_export_script(struct MANTA *smoke, struct FluidModifierData *fmd); -int manta_liquid_ensure_sndparts(struct MANTA *fluid, struct FluidModifierData *fmd); +bool manta_liquid_export_script(struct MANTA *smoke, struct FluidModifierData *fmd); +bool manta_liquid_ensure_sndparts(struct MANTA *fluid, struct FluidModifierData *fmd); /* Liquid accessors */ int manta_liquid_get_particle_res_x(struct MANTA *liquid); @@ -212,9 +212,6 @@ float manta_liquid_get_snd_particle_position_z_at(struct MANTA *liquid, int i); float manta_liquid_get_snd_particle_velocity_x_at(struct MANTA *liquid, int i); float manta_liquid_get_snd_particle_velocity_y_at(struct MANTA *liquid, int i); float manta_liquid_get_snd_particle_velocity_z_at(struct MANTA *liquid, int i); -bool manta_liquid_flip_from_file(struct MANTA *liquid); -bool manta_liquid_mesh_from_file(struct MANTA *liquid); -bool manta_liquid_particle_from_file(struct MANTA *liquid); #ifdef __cplusplus } diff --git a/intern/mantaflow/intern/MANTA_main.cpp b/intern/mantaflow/intern/MANTA_main.cpp index 0dbbd1ee9d0..fef6399ab23 100644 --- a/intern/mantaflow/intern/MANTA_main.cpp +++ b/intern/mantaflow/intern/MANTA_main.cpp @@ -458,8 +458,7 @@ bool MANTA::initObstacle(FluidModifierData *fmd) string finalString = parseScript(tmpString, fmd); pythonCommands.push_back(finalString); - mUsingObstacle = true; - return runPythonString(pythonCommands); + return (mUsingObstacle = runPythonString(pythonCommands)); } return false; } @@ -473,8 +472,7 @@ bool MANTA::initGuiding(FluidModifierData *fmd) string finalString = parseScript(tmpString, fmd); pythonCommands.push_back(finalString); - mUsingGuiding = true; - return runPythonString(pythonCommands); + return (mUsingGuiding = runPythonString(pythonCommands)); } return false; } @@ -486,8 +484,7 @@ bool MANTA::initFractions(FluidModifierData *fmd) string finalString = parseScript(tmpString, fmd); pythonCommands.push_back(finalString); - mUsingFractions = true; - return runPythonString(pythonCommands); + return (mUsingFractions = runPythonString(pythonCommands)); } bool MANTA::initInVelocity(FluidModifierData *fmd) @@ -498,8 +495,7 @@ bool MANTA::initInVelocity(FluidModifierData *fmd) string finalString = parseScript(tmpString, fmd); pythonCommands.push_back(finalString); - mUsingInvel = true; - return runPythonString(pythonCommands); + return (mUsingInvel = runPythonString(pythonCommands)); } return false; } @@ -512,8 +508,7 @@ bool MANTA::initOutflow(FluidModifierData *fmd) string finalString = parseScript(tmpString, fmd); pythonCommands.push_back(finalString); - mUsingOutflow = true; - return runPythonString(pythonCommands); + return (mUsingOutflow = runPythonString(pythonCommands)); } return false; } @@ -565,7 +560,7 @@ MANTA::~MANTA() pythonCommands.push_back(finalString); result = runPythonString(pythonCommands); - assert(result); + BLI_assert(result); UNUSED_VARS(result); } @@ -610,7 +605,7 @@ bool MANTA::runPythonString(vector<string> commands) } PyGILState_Release(gilstate); - assert(success); + BLI_assert(success); return success; } @@ -1590,7 +1585,7 @@ bool MANTA::updateVariables(FluidModifierData *fmd) return runPythonString(pythonCommands); } -void MANTA::exportSmokeScript(FluidModifierData *fmd) +bool MANTA::exportSmokeScript(FluidModifierData *fmd) { if (with_debug) cout << "MANTA::exportSmokeScript()" << endl; @@ -1696,9 +1691,14 @@ void MANTA::exportSmokeScript(FluidModifierData *fmd) myfile.open(cacheDirScript); myfile << final_script; myfile.close(); + if (!myfile) { + cerr << "Fluid Error -- Could not export standalone Mantaflow smoke domain script"; + return false; + } + return true; } -void MANTA::exportLiquidScript(FluidModifierData *fmd) +bool MANTA::exportLiquidScript(FluidModifierData *fmd) { if (with_debug) cout << "MANTA::exportLiquidScript()" << endl; @@ -1804,6 +1804,11 @@ void MANTA::exportLiquidScript(FluidModifierData *fmd) myfile.open(cacheDirScript); myfile << final_script; myfile.close(); + if (!myfile) { + cerr << "Fluid Error -- Could not export standalone Mantaflow liquid domain script"; + return false; + } + return true; } /* Call Mantaflow Python functions through this function. Use isAttribute for object attributes, diff --git a/intern/mantaflow/intern/MANTA_main.h b/intern/mantaflow/intern/MANTA_main.h index 6425614cf4b..163b168e43d 100644 --- a/intern/mantaflow/intern/MANTA_main.h +++ b/intern/mantaflow/intern/MANTA_main.h @@ -104,8 +104,8 @@ struct MANTA { bool bakeGuiding(FluidModifierData *fmd, int framenr); /* IO for Mantaflow scene script. */ - void exportSmokeScript(struct FluidModifierData *fmd); - void exportLiquidScript(struct FluidModifierData *fmd); + bool exportSmokeScript(struct FluidModifierData *fmd); + bool exportLiquidScript(struct FluidModifierData *fmd); /* Check cache status by frame. */ bool hasConfig(FluidModifierData *fmd, int framenr); diff --git a/intern/mantaflow/intern/manta_fluid_API.cpp b/intern/mantaflow/intern/manta_fluid_API.cpp index e4754131f34..c04180c8c46 100644 --- a/intern/mantaflow/intern/manta_fluid_API.cpp +++ b/intern/mantaflow/intern/manta_fluid_API.cpp @@ -37,203 +37,145 @@ void manta_free(MANTA *fluid) fluid = nullptr; } -int manta_ensure_obstacle(MANTA *fluid, struct FluidModifierData *fmd) +bool manta_ensure_obstacle(MANTA *fluid, struct FluidModifierData *fmd) { - if (!fluid || !fmd) - return 0; return fluid->initObstacle(fmd); } -int manta_ensure_guiding(MANTA *fluid, struct FluidModifierData *fmd) +bool manta_ensure_guiding(MANTA *fluid, struct FluidModifierData *fmd) { - if (!fluid || !fmd) - return 0; return fluid->initGuiding(fmd); } -int manta_ensure_invelocity(MANTA *fluid, struct FluidModifierData *fmd) +bool manta_ensure_invelocity(MANTA *fluid, struct FluidModifierData *fmd) { - if (!fluid || !fmd) - return 0; return fluid->initInVelocity(fmd); } -int manta_ensure_outflow(MANTA *fluid, struct FluidModifierData *fmd) +bool manta_ensure_outflow(MANTA *fluid, struct FluidModifierData *fmd) { - if (!fluid || !fmd) - return 0; return fluid->initOutflow(fmd); } -int manta_write_config(MANTA *fluid, FluidModifierData *fmd, int framenr) +bool manta_write_config(MANTA *fluid, FluidModifierData *fmd, int framenr) { - if (!fluid || !fmd) - return 0; return fluid->writeConfiguration(fmd, framenr); } -int manta_write_data(MANTA *fluid, FluidModifierData *fmd, int framenr) +bool manta_write_data(MANTA *fluid, FluidModifierData *fmd, int framenr) { - if (!fluid || !fmd) - return 0; return fluid->writeData(fmd, framenr); } -int manta_write_noise(MANTA *fluid, FluidModifierData *fmd, int framenr) +bool manta_write_noise(MANTA *fluid, FluidModifierData *fmd, int framenr) { - if (!fluid || !fmd) - return 0; return fluid->writeNoise(fmd, framenr); } -int manta_read_config(MANTA *fluid, FluidModifierData *fmd, int framenr) +bool manta_read_config(MANTA *fluid, FluidModifierData *fmd, int framenr) { - if (!fluid || !fmd) - return 0; return fluid->readConfiguration(fmd, framenr); } -int manta_read_data(MANTA *fluid, FluidModifierData *fmd, int framenr, bool resumable) +bool manta_read_data(MANTA *fluid, FluidModifierData *fmd, int framenr, bool resumable) { - if (!fluid || !fmd) - return 0; return fluid->readData(fmd, framenr, resumable); } -int manta_read_noise(MANTA *fluid, FluidModifierData *fmd, int framenr, bool resumable) +bool manta_read_noise(MANTA *fluid, FluidModifierData *fmd, int framenr, bool resumable) { - if (!fluid || !fmd) - return 0; return fluid->readNoise(fmd, framenr, resumable); } -int manta_read_mesh(MANTA *fluid, FluidModifierData *fmd, int framenr) +bool manta_read_mesh(MANTA *fluid, FluidModifierData *fmd, int framenr) { - if (!fluid || !fmd) - return 0; return fluid->readMesh(fmd, framenr); } -int manta_read_particles(MANTA *fluid, FluidModifierData *fmd, int framenr, bool resumable) +bool manta_read_particles(MANTA *fluid, FluidModifierData *fmd, int framenr, bool resumable) { - if (!fluid || !fmd) - return 0; return fluid->readParticles(fmd, framenr, resumable); } -int manta_read_guiding(MANTA *fluid, FluidModifierData *fmd, int framenr, bool sourceDomain) +bool manta_read_guiding(MANTA *fluid, FluidModifierData *fmd, int framenr, bool sourceDomain) { - if (!fluid || !fmd) - return 0; return fluid->readGuiding(fmd, framenr, sourceDomain); } -int manta_bake_data(MANTA *fluid, FluidModifierData *fmd, int framenr) +bool manta_bake_data(MANTA *fluid, FluidModifierData *fmd, int framenr) { - if (!fluid || !fmd) - return 0; return fluid->bakeData(fmd, framenr); } -int manta_bake_noise(MANTA *fluid, FluidModifierData *fmd, int framenr) +bool manta_bake_noise(MANTA *fluid, FluidModifierData *fmd, int framenr) { - if (!fluid || !fmd) - return 0; return fluid->bakeNoise(fmd, framenr); } -int manta_bake_mesh(MANTA *fluid, FluidModifierData *fmd, int framenr) +bool manta_bake_mesh(MANTA *fluid, FluidModifierData *fmd, int framenr) { - if (!fluid || !fmd) - return 0; return fluid->bakeMesh(fmd, framenr); } -int manta_bake_particles(MANTA *fluid, FluidModifierData *fmd, int framenr) +bool manta_bake_particles(MANTA *fluid, FluidModifierData *fmd, int framenr) { - if (!fluid || !fmd) - return 0; return fluid->bakeParticles(fmd, framenr); } -int manta_bake_guiding(MANTA *fluid, FluidModifierData *fmd, int framenr) +bool manta_bake_guiding(MANTA *fluid, FluidModifierData *fmd, int framenr) { - if (!fluid || !fmd) - return 0; return fluid->bakeGuiding(fmd, framenr); } -int manta_has_data(MANTA *fluid, FluidModifierData *fmd, int framenr) +bool manta_has_data(MANTA *fluid, FluidModifierData *fmd, int framenr) { - if (!fluid || !fmd) - return 0; return fluid->hasData(fmd, framenr); } -int manta_has_noise(MANTA *fluid, FluidModifierData *fmd, int framenr) +bool manta_has_noise(MANTA *fluid, FluidModifierData *fmd, int framenr) { - if (!fluid || !fmd) - return 0; return fluid->hasNoise(fmd, framenr); } -int manta_has_mesh(MANTA *fluid, FluidModifierData *fmd, int framenr) +bool manta_has_mesh(MANTA *fluid, FluidModifierData *fmd, int framenr) { - if (!fluid || !fmd) - return 0; return fluid->hasMesh(fmd, framenr); } -int manta_has_particles(MANTA *fluid, FluidModifierData *fmd, int framenr) +bool manta_has_particles(MANTA *fluid, FluidModifierData *fmd, int framenr) { - if (!fluid || !fmd) - return 0; return fluid->hasParticles(fmd, framenr); } -int manta_has_guiding(MANTA *fluid, FluidModifierData *fmd, int framenr, bool domain) +bool manta_has_guiding(MANTA *fluid, FluidModifierData *fmd, int framenr, bool domain) { - if (!fluid || !fmd) - return 0; return fluid->hasGuiding(fmd, framenr, domain); } void manta_update_variables(MANTA *fluid, FluidModifierData *fmd) { - if (!fluid) - return; fluid->updateVariables(fmd); } int manta_get_frame(MANTA *fluid) { - if (!fluid) - return 0; return fluid->getFrame(); } float manta_get_timestep(MANTA *fluid) { - if (!fluid) - return 0; return fluid->getTimestep(); } void manta_adapt_timestep(MANTA *fluid) { - if (!fluid) - return; fluid->adaptTimestep(); } bool manta_needs_realloc(MANTA *fluid, FluidModifierData *fmd) { - if (!fluid || !fmd) - return false; return fluid->needsRealloc(fmd); } void manta_update_pointers(struct MANTA *fluid, struct FluidModifierData *fmd, bool flush) { - if (!fluid || !fmd) - return; fluid->updatePointers(fmd, flush); } @@ -372,11 +314,9 @@ float *manta_get_pressure(MANTA *fluid) } /* Smoke functions */ -void manta_smoke_export_script(MANTA *smoke, FluidModifierData *fmd) +bool manta_smoke_export_script(MANTA *smoke, FluidModifierData *fmd) { - if (!smoke || !fmd) - return; - smoke->exportSmokeScript(fmd); + return smoke->exportSmokeScript(fmd); } static void get_rgba( @@ -452,18 +392,13 @@ void manta_noise_get_rgba_fixed_color(MANTA *smoke, float color[3], float *data, get_rgba_fixed_color(color, smoke->getTotalCellsHigh(), data, sequential); } -int manta_smoke_ensure_heat(MANTA *smoke, struct FluidModifierData *fmd) +bool manta_smoke_ensure_heat(MANTA *smoke, struct FluidModifierData *fmd) { - if (!smoke || !fmd) - return 0; return smoke->initHeat(fmd); } -int manta_smoke_ensure_fire(MANTA *smoke, struct FluidModifierData *fmd) +bool manta_smoke_ensure_fire(MANTA *smoke, struct FluidModifierData *fmd) { - if (!smoke || !fmd) - return 0; - bool result = smoke->initFire(fmd); if (smoke->usingNoise()) { result &= smoke->initFireHigh(fmd); @@ -471,11 +406,8 @@ int manta_smoke_ensure_fire(MANTA *smoke, struct FluidModifierData *fmd) return result; } -int manta_smoke_ensure_colors(MANTA *smoke, struct FluidModifierData *fmd) +bool manta_smoke_ensure_colors(MANTA *smoke, struct FluidModifierData *fmd) { - if (!smoke || !fmd) - return 0; - bool result = smoke->initColors(fmd); if (smoke->usingNoise()) { result &= smoke->initColorsHigh(fmd); @@ -560,107 +492,104 @@ float *manta_smoke_get_emission_in(MANTA *smoke) return smoke->getEmissionIn(); } -int manta_smoke_has_heat(MANTA *smoke) +bool manta_smoke_has_heat(MANTA *smoke) { - return (smoke->getHeat()) ? 1 : 0; + return smoke->getHeat() != nullptr; + ; } -int manta_smoke_has_fuel(MANTA *smoke) +bool manta_smoke_has_fuel(MANTA *smoke) { - return (smoke->getFuel()) ? 1 : 0; + return smoke->getFuel() != nullptr; } -int manta_smoke_has_colors(MANTA *smoke) +bool manta_smoke_has_colors(MANTA *smoke) { - return (smoke->getColorR() && smoke->getColorG() && smoke->getColorB()) ? 1 : 0; + return smoke->getColorR() != nullptr && smoke->getColorG() != nullptr && + smoke->getColorB() != nullptr; } float *manta_noise_get_density(MANTA *smoke) { - return (smoke && smoke->usingNoise()) ? smoke->getDensityHigh() : nullptr; + return smoke->getDensityHigh(); } float *manta_noise_get_fuel(MANTA *smoke) { - return (smoke && smoke->usingNoise()) ? smoke->getFuelHigh() : nullptr; + return smoke->getFuelHigh(); } float *manta_noise_get_react(MANTA *smoke) { - return (smoke && smoke->usingNoise()) ? smoke->getReactHigh() : nullptr; + return smoke->getReactHigh(); } float *manta_noise_get_color_r(MANTA *smoke) { - return (smoke && smoke->usingNoise()) ? smoke->getColorRHigh() : nullptr; + return smoke->getColorRHigh(); } float *manta_noise_get_color_g(MANTA *smoke) { - return (smoke && smoke->usingNoise()) ? smoke->getColorGHigh() : nullptr; + return smoke->getColorGHigh(); } float *manta_noise_get_color_b(MANTA *smoke) { - return (smoke && smoke->usingNoise()) ? smoke->getColorBHigh() : nullptr; + return smoke->getColorBHigh(); } float *manta_noise_get_flame(MANTA *smoke) { - return (smoke && smoke->usingNoise()) ? smoke->getFlameHigh() : nullptr; + return smoke->getFlameHigh(); } float *manta_noise_get_texture_u(MANTA *smoke) { - return (smoke && smoke->usingNoise()) ? smoke->getTextureU() : nullptr; + return smoke->getTextureU(); } float *manta_noise_get_texture_v(MANTA *smoke) { - return (smoke && smoke->usingNoise()) ? smoke->getTextureV() : nullptr; + return smoke->getTextureV(); } float *manta_noise_get_texture_w(MANTA *smoke) { - return (smoke && smoke->usingNoise()) ? smoke->getTextureW() : nullptr; + return smoke->getTextureW(); } float *manta_noise_get_texture_u2(MANTA *smoke) { - return (smoke && smoke->usingNoise()) ? smoke->getTextureU2() : nullptr; + return smoke->getTextureU2(); } float *manta_noise_get_texture_v2(MANTA *smoke) { - return (smoke && smoke->usingNoise()) ? smoke->getTextureV2() : nullptr; + return smoke->getTextureV2(); } float *manta_noise_get_texture_w2(MANTA *smoke) { - return (smoke && smoke->usingNoise()) ? smoke->getTextureW2() : nullptr; + return smoke->getTextureW2(); } -int manta_noise_has_fuel(MANTA *smoke) +bool manta_noise_has_fuel(MANTA *smoke) { - return (smoke->getFuelHigh()) ? 1 : 0; + return smoke->getFuelHigh() != nullptr; } -int manta_noise_has_colors(MANTA *smoke) +bool manta_noise_has_colors(MANTA *smoke) { - return (smoke->getColorRHigh() && smoke->getColorGHigh() && smoke->getColorBHigh()) ? 1 : 0; + return smoke->getColorRHigh() != nullptr && smoke->getColorGHigh() != nullptr && + smoke->getColorBHigh() != nullptr; + ; } void manta_noise_get_res(MANTA *smoke, int *res) { - if (smoke && smoke->usingNoise()) { - res[0] = smoke->getResXHigh(); - res[1] = smoke->getResYHigh(); - res[2] = smoke->getResZHigh(); - } + res[0] = smoke->getResXHigh(); + res[1] = smoke->getResYHigh(); + res[2] = smoke->getResZHigh(); } int manta_noise_get_cells(MANTA *smoke) { - int total_cells_high = smoke->getResXHigh() * smoke->getResYHigh() * smoke->getResZHigh(); - return (smoke && smoke->usingNoise()) ? total_cells_high : 0; + return smoke->getResXHigh() * smoke->getResYHigh() * smoke->getResZHigh(); } /* Liquid functions */ -void manta_liquid_export_script(MANTA *liquid, FluidModifierData *fmd) +bool manta_liquid_export_script(MANTA *liquid, FluidModifierData *fmd) { - if (!liquid || !fmd) - return; - liquid->exportLiquidScript(fmd); + return liquid->exportLiquidScript(fmd); } -int manta_liquid_ensure_sndparts(MANTA *liquid, struct FluidModifierData *fmd) +bool manta_liquid_ensure_sndparts(MANTA *liquid, struct FluidModifierData *fmd) { - if (!liquid || !fmd) - return 0; return liquid->initLiquidSndParts(fmd); } @@ -834,16 +763,3 @@ float manta_liquid_get_snd_particle_velocity_z_at(MANTA *liquid, int i) { return liquid->getSndParticleVelocityZAt(i); } - -bool manta_liquid_flip_from_file(MANTA *liquid) -{ - return liquid->usingFlipFromFile(); -} -bool manta_liquid_mesh_from_file(MANTA *liquid) -{ - return liquid->usingMeshFromFile(); -} -bool manta_liquid_particle_from_file(MANTA *liquid) -{ - return liquid->usingParticleFromFile(); -} diff --git a/intern/sky/source/sky_model.cpp b/intern/sky/source/sky_model.cpp index e835e04d164..165444003d3 100644 --- a/intern/sky/source/sky_model.cpp +++ b/intern/sky/source/sky_model.cpp @@ -272,9 +272,8 @@ static double ArHosekSkyModel_CookRadianceConfiguration(ArHosekSkyModel_Radiance return res; } -static double ArHosekSkyModel_GetRadianceInternal(SKY_ArHosekSkyModelConfiguration configuration, - double theta, - double gamma) +static double ArHosekSkyModel_GetRadianceInternal( + const SKY_ArHosekSkyModelConfiguration configuration, const double theta, const double gamma) { const double expM = exp(configuration[4] * gamma); const double rayM = cos(gamma) * cos(gamma); diff --git a/intern/sky/source/sky_nishita.cpp b/intern/sky/source/sky_nishita.cpp index f36bfcc3d7b..e3b6ca021fe 100644 --- a/intern/sky/source/sky_nishita.cpp +++ b/intern/sky/source/sky_nishita.cpp @@ -87,7 +87,7 @@ static float3 geographical_to_direction(float lat, float lon) return make_float3(cosf(lat) * cosf(lon), cosf(lat) * sinf(lon), sinf(lat)); } -static float3 spec_to_xyz(float *spectrum) +static float3 spec_to_xyz(const float *spectrum) { float3 xyz = make_float3(0.0f, 0.0f, 0.0f); for (int i = 0; i < num_wavelengths; i++) { @@ -112,10 +112,12 @@ static float density_mie(float height) static float density_ozone(float height) { float den = 0.0f; - if (height >= 10000.0f && height < 25000.0f) + if (height >= 10000.0f && height < 25000.0f) { den = 1.0f / 15000.0f * height - 2.0f / 3.0f; - else if (height >= 25000 && height < 40000) + } + else if (height >= 25000 && height < 40000) { den = -(1.0f / 15000.0f * height - 8.0f / 3.0f); + } return den; } @@ -133,15 +135,16 @@ static float phase_mie(float mu) /* Intersection helpers */ static bool surface_intersection(float3 pos, float3 dir) { - if (dir.z >= 0) + if (dir.z >= 0) { return false; + } float b = -2.0f * dot(dir, -pos); float c = len_squared(pos) - sqr(earth_radius); float t = b * b - 4.0f * c; - if (t >= 0.0f) + if (t >= 0.0f) { return true; - else - return false; + } + return false; } static float3 atmosphere_intersection(float3 pos, float3 dir) diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py index e41858587bf..8201ce080b1 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -881,13 +881,18 @@ class GreasePencilLayerDisplayPanel: gpd = ob.data gpl = gpd.layers.active - row = layout.row(align=True) + use_colors = context.preferences.edit.use_anim_channel_group_colors + + col = layout.column(align=True) + col.active = use_colors + row = col.row(align=True) row.prop(gpl, "channel_color") + if not use_colors: + col.label(text="Channel Colors are disabled in Animation preferences") row = layout.row(align=True) row.prop(gpl, "use_solo_mode", text="Show Only on Keyframed") - class GreasePencilFlipTintColors(Operator): bl_label = "Flip Colors" bl_idname = "gpencil.tint_flip" diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index 9a716621b08..676e93f4ce9 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -347,7 +347,6 @@ class DOPESHEET_MT_view(Menu): col.active = context.space_data.mode != 'SHAPEKEY' col.prop(st, "show_sliders") - layout.prop(st, "show_group_colors") layout.prop(st, "show_interpolation") layout.prop(st, "show_extremes") layout.prop(st, "use_auto_merge_keyframes") diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index 0171fa902db..3f92fce81f6 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -1188,6 +1188,21 @@ class SEQUENCER_PT_effect_text_style(SequencerButtonsPanel, Panel): subsub.prop(strip, "shadow_color", text="") row.prop_decorator(strip, "shadow_color") + row = layout.row(align=True, heading="Box") + row.use_property_decorate = False + sub = row.row(align=True) + sub.prop(strip, "use_box", text="") + subsub = sub.row(align=True) + subsub.active = strip.use_box and (not strip.mute) + subsub.prop(strip, "box_color", text="") + row.prop_decorator(strip, "box_color") + + row = layout.row(align=True, heading="Box Margin") + row.use_property_decorate = False + sub = row.row(align=True) + sub.prop(strip, "box_margin") + sub.active = strip.use_box and (not strip.mute) + class SEQUENCER_PT_source(SequencerButtonsPanel, Panel): bl_label = "Source" diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 8c1409f00ac..91871acfbc5 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -543,6 +543,7 @@ class USERPREF_PT_animation_fcurves(AnimationPanel, CenterAlignMixIn, Panel): flow.prop(edit, "keyframe_new_interpolation_type", text="Default Interpolation") flow.prop(edit, "keyframe_new_handle_type", text="Default Handles") flow.prop(edit, "use_insertkey_xyz_to_rgb", text="XYZ to RGB") + flow.prop(edit, "use_anim_channel_group_colors") # ----------------------------------------------------------------------------- diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 699387a18c7..d8605941974 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -30,6 +30,12 @@ extern "C" { #endif +struct BlendWriter; +struct BlendDataReader; +struct BlendLibReader; +struct BlendExpander; +struct bArmature; + /* The following structures are defined in DNA_action_types.h, and DNA_anim_types.h */ struct AnimationEvalContext; struct FCurve; @@ -216,6 +222,11 @@ void BKE_pose_rest(struct bPose *pose, bool selected_bones_only); /* Tag pose for recalc. Also tag all related data to be recalc. */ void BKE_pose_tag_recalc(struct Main *bmain, struct bPose *pose); +void BKE_pose_blend_write(struct BlendWriter *writer, struct bPose *pose, struct bArmature *arm); +void BKE_pose_blend_read_data(struct BlendDataReader *reader, struct bPose *pose); +void BKE_pose_blend_read_lib(struct BlendLibReader *reader, struct Object *ob, struct bPose *pose); +void BKE_pose_blend_read_expand(struct BlendExpander *expander, struct bPose *pose); + #ifdef __cplusplus }; #endif diff --git a/source/blender/blenkernel/BKE_anim_visualization.h b/source/blender/blenkernel/BKE_anim_visualization.h index fb7875a112e..decb2e0b210 100644 --- a/source/blender/blenkernel/BKE_anim_visualization.h +++ b/source/blender/blenkernel/BKE_anim_visualization.h @@ -32,6 +32,8 @@ struct Scene; struct bAnimVizSettings; struct bMotionPath; struct bPoseChannel; +struct BlendWriter; +struct BlendDataReader; /* ---------------------------------------------------- */ /* Animation Visualization */ @@ -48,6 +50,9 @@ struct bMotionPath *animviz_verify_motionpaths(struct ReportList *reports, struct Object *ob, struct bPoseChannel *pchan); +void animviz_motionpath_blend_write(struct BlendWriter *writer, struct bMotionPath *mpath); +void animviz_motionpath_blend_read_data(struct BlendDataReader *reader, struct bMotionPath *mpath); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index 5a64140b917..9fa32013ba6 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -39,7 +39,7 @@ extern "C" { /* Blender file format version. */ #define BLENDER_FILE_VERSION BLENDER_VERSION -#define BLENDER_FILE_SUBVERSION 3 +#define BLENDER_FILE_SUBVERSION 4 /* Minimum Blender version that supports reading file written with the current * version. Older Blender versions will test this and show a warning if the file diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h index e56a1ac9ce3..3631feb5071 100644 --- a/source/blender/blenkernel/BKE_colortools.h +++ b/source/blender/blenkernel/BKE_colortools.h @@ -139,6 +139,11 @@ void BKE_color_managed_view_settings_copy(struct ColorManagedViewSettings *new_s const struct ColorManagedViewSettings *settings); void BKE_color_managed_view_settings_free(struct ColorManagedViewSettings *settings); +void BKE_color_managed_view_settings_blend_write(struct BlendWriter *writer, + struct ColorManagedViewSettings *settings); +void BKE_color_managed_view_settings_blend_read_data(struct BlendDataReader *reader, + struct ColorManagedViewSettings *settings); + void BKE_color_managed_colorspace_settings_init( struct ColorManagedColorspaceSettings *colorspace_settings); void BKE_color_managed_colorspace_settings_copy( diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h index 5ff0e7597e9..e5c4535560d 100644 --- a/source/blender/blenkernel/BKE_constraint.h +++ b/source/blender/blenkernel/BKE_constraint.h @@ -31,6 +31,10 @@ struct Scene; struct bConstraint; struct bConstraintTarget; struct bPoseChannel; +struct BlendWriter; +struct BlendDataReader; +struct BlendLibReader; +struct BlendExpander; /* ---------------------------------------------------------------------------- */ #ifdef __cplusplus @@ -222,6 +226,13 @@ void BKE_constraints_solve(struct Depsgraph *depsgraph, struct bConstraintOb *cob, float ctime); +void BKE_constraint_blend_write(struct BlendWriter *writer, struct ListBase *conlist); +void BKE_constraint_blend_read_data(struct BlendDataReader *reader, struct ListBase *lb); +void BKE_constraint_blend_read_lib(struct BlendLibReader *reader, + struct ID *id, + struct ListBase *conlist); +void BKE_constraint_blend_read_expand(struct BlendExpander *expander, struct ListBase *lb); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_gpencil_modifier.h b/source/blender/blenkernel/BKE_gpencil_modifier.h index 78a17e3568d..7729d2c53ab 100644 --- a/source/blender/blenkernel/BKE_gpencil_modifier.h +++ b/source/blender/blenkernel/BKE_gpencil_modifier.h @@ -35,6 +35,9 @@ struct Main; struct ModifierUpdateDepsgraphContext; struct Object; struct Scene; +struct BlendWriter; +struct BlendDataReader; +struct BlendLibReader; /* NOTE: bakeModifier() called from UI: * needs to create new data-blocks, hence the need for this. */ struct bGPDframe; @@ -303,6 +306,10 @@ struct bGPDframe *BKE_gpencil_frame_retime_get(struct Depsgraph *depsgraph, struct Object *ob, struct bGPDlayer *gpl); +void BKE_gpencil_modifier_blend_write(struct BlendWriter *writer, struct ListBase *modbase); +void BKE_gpencil_modifier_blend_read_data(struct BlendDataReader *reader, struct ListBase *lb); +void BKE_gpencil_modifier_blend_read_lib(struct BlendLibReader *reader, struct Object *ob); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h index 3d5062eada0..1fb3e746b37 100644 --- a/source/blender/blenkernel/BKE_layer.h +++ b/source/blender/blenkernel/BKE_layer.h @@ -36,6 +36,7 @@ extern "C" { struct Base; struct BlendDataReader; struct BlendLibReader; +struct BlendWriter; struct Collection; struct Depsgraph; struct LayerCollection; @@ -151,6 +152,7 @@ void BKE_layer_eval_view_layer_indexed(struct Depsgraph *depsgraph, /* .blend file I/O */ +void BKE_view_layer_blend_write(struct BlendWriter *writer, struct ViewLayer *view_layer); void BKE_view_layer_blend_read_data(struct BlendDataReader *reader, struct ViewLayer *view_layer); void BKE_view_layer_blend_read_lib(struct BlendLibReader *reader, struct Library *lib, diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 253b0480b3a..807f13efe14 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -188,6 +188,9 @@ void BKE_mesh_material_index_clear(struct Mesh *me); void BKE_mesh_material_remap(struct Mesh *me, const unsigned int *remap, unsigned int remap_len); void BKE_mesh_smooth_flag_set(struct Mesh *me, const bool use_smooth); +/* Needed after converting a mesh with subsurf optimal display to mesh. */ +void BKE_mesh_edges_set_draw_render(struct Mesh *me); + const char *BKE_mesh_cmp(struct Mesh *me1, struct Mesh *me2, float thresh); struct BoundBox *BKE_mesh_boundbox_get(struct Object *ob); diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 4909fe012b5..a2c3787bcd2 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -30,6 +30,7 @@ extern "C" { struct ARegionType; struct BMEditMesh; struct BlendDataReader; +struct BlendLibReader; struct BlendWriter; struct CustomData_MeshMasks; struct DepsNodeHandle; @@ -535,6 +536,12 @@ struct Mesh *BKE_modifier_get_evaluated_mesh_from_evaluated_object(struct Object void BKE_modifier_check_uuids_unique_and_report(const struct Object *object); +void BKE_modifier_blend_write(struct BlendWriter *writer, struct ListBase *modbase); +void BKE_modifier_blend_read_data(struct BlendDataReader *reader, + struct ListBase *lb, + struct Object *ob); +void BKE_modifier_blend_read_lib(struct BlendLibReader *reader, struct Object *ob); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index b7015942cb4..28c912a4c9a 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -416,6 +416,14 @@ void BKE_object_to_mesh_clear(struct Object *object); void BKE_object_check_uuids_unique_and_report(const struct Object *object); +void BKE_object_modifiers_lib_link_common(void *userData, + struct Object *ob, + struct ID **idpoin, + int cb_flag); + +struct PartEff; +struct PartEff *BKE_object_do_version_give_parteff_245(struct Object *ob); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index bb1d1781e31..a58bf760ad5 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -66,6 +66,9 @@ struct ViewLayer; struct bContext; struct bToolRef; struct tPaletteColorHSV; +struct BlendWriter; +struct BlendDataReader; +struct BlendLibReader; enum eOverlayFlags; @@ -217,6 +220,15 @@ void BKE_paint_toolslots_brush_update(struct Paint *paint); void BKE_paint_toolslots_brush_validate(struct Main *bmain, struct Paint *paint); struct Brush *BKE_paint_toolslots_brush_get(struct Paint *paint, int slot_index); +/* .blend I/O */ +void BKE_paint_blend_write(struct BlendWriter *writer, struct Paint *paint); +void BKE_paint_blend_read_data(struct BlendDataReader *reader, + const struct Scene *scene, + struct Paint *paint); +void BKE_paint_blend_read_lib(struct BlendLibReader *reader, + struct Scene *scene, + struct Paint *paint); + #define SCULPT_FACE_SET_NONE 0 /* Used for both vertex color and weight paint */ diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index 5df42e4ccd6..73815325594 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -45,6 +45,7 @@ struct ParticleSystemModifierData; struct BVHTreeRay; struct BVHTreeRayHit; +struct BlendWriter; struct BlendDataReader; struct BlendLibReader; struct CustomData_MeshMasks; @@ -633,6 +634,13 @@ void BKE_particle_partdeflect_blend_read_data(struct BlendDataReader *reader, void BKE_particle_partdeflect_blend_read_lib(struct BlendLibReader *reader, struct ID *id, struct PartDeflect *pd); +void BKE_particle_system_blend_write(struct BlendWriter *writer, struct ListBase *particles); +void BKE_particle_system_blend_read_data(struct BlendDataReader *reader, + struct ListBase *particles); +void BKE_particle_system_blend_read_lib(struct BlendLibReader *reader, + struct Object *ob, + struct ID *id, + struct ListBase *particles); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index a45b134f825..470d53f6655 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -91,6 +91,8 @@ struct RigidBodyWorld; struct Scene; struct SoftBody; struct ViewLayer; +struct BlendWriter; +struct BlendDataReader; /* temp structure for read/write */ typedef struct PTCacheData { @@ -374,6 +376,14 @@ void BKE_ptcache_validate(struct PointCache *cache, int framenr); /* Set correct flags after unsuccessful simulation step */ void BKE_ptcache_invalidate(struct PointCache *cache); +/********************** .blend File I/O *********************/ + +void BKE_ptcache_blend_write(struct BlendWriter *writer, struct ListBase *ptcaches); +void BKE_ptcache_blend_read_data(struct BlendDataReader *reader, + struct ListBase *ptcaches, + struct PointCache **ocache, + int force_disk); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index fd7f20d8839..fd5339940dd 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -465,6 +465,7 @@ void BKE_screen_view3d_do_versions_250(struct View3D *v3d, ListBase *regions); void BKE_screen_area_blend_read_lib(struct BlendLibReader *reader, struct ID *parent_id, struct ScrArea *area); +bool BKE_screen_blend_read_data(struct BlendDataReader *reader, struct bScreen *screen); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_shader_fx.h b/source/blender/blenkernel/BKE_shader_fx.h index 4b9688f9515..7c2d363be5c 100644 --- a/source/blender/blenkernel/BKE_shader_fx.h +++ b/source/blender/blenkernel/BKE_shader_fx.h @@ -33,6 +33,9 @@ struct ListBase; struct ModifierUpdateDepsgraphContext; struct Object; struct ShaderFxData; +struct BlendWriter; +struct BlendDataReader; +struct BlendLibReader; #define SHADER_FX_ACTIVE(_fx, _is_render) \ ((((_fx)->mode & eShaderFxMode_Realtime) && (_is_render == false)) || \ @@ -170,6 +173,10 @@ void BKE_shaderfx_foreach_ID_link(struct Object *ob, ShaderFxIDWalkFunc walk, vo bool BKE_shaderfx_has_gpencil(struct Object *ob); +void BKE_shaderfx_blend_write(struct BlendWriter *writer, struct ListBase *fxbase); +void BKE_shaderfx_blend_read_data(struct BlendDataReader *reader, struct ListBase *lb); +void BKE_shaderfx_blend_read_lib(struct BlendLibReader *reader, struct Object *ob); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index e091bf61f6a..d6185ae3f5a 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -39,7 +39,7 @@ set(INC ../sequencer ../shader_fx ../simulation - ../render/extern/include + ../render ../../../intern/ghost ../../../intern/glew-mx ../../../intern/guardedalloc diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index c77153960ea..126063288d8 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -61,6 +61,7 @@ #include "BKE_main.h" #include "BKE_object.h" +#include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" #include "BIK_api.h" @@ -1846,3 +1847,174 @@ void BKE_pose_check_uuids_unique_and_report(const bPose *pose) BLI_gset_free(used_uuids, NULL); } + +void BKE_pose_blend_write(BlendWriter *writer, bPose *pose, bArmature *arm) +{ + /* Write each channel */ + if (pose == NULL) { + return; + } + + BLI_assert(arm != NULL); + + /* Write channels */ + LISTBASE_FOREACH (bPoseChannel *, chan, &pose->chanbase) { + /* Write ID Properties -- and copy this comment EXACTLY for easy finding + * of library blocks that implement this.*/ + if (chan->prop) { + IDP_BlendWrite(writer, chan->prop); + } + + BKE_constraint_blend_write(writer, &chan->constraints); + + animviz_motionpath_blend_write(writer, chan->mpath); + + /* Prevent crashes with autosave, + * when a bone duplicated in edit-mode has not yet been assigned to its pose-channel. + * Also needed with memundo, in some cases we can store a step before pose has been + * properly rebuilt from previous undo step. */ + Bone *bone = (pose->flag & POSE_RECALC) ? BKE_armature_find_bone_name(arm, chan->name) : + chan->bone; + if (bone != NULL) { + /* gets restored on read, for library armatures */ + chan->selectflag = bone->flag & BONE_SELECTED; + } + + BLO_write_struct(writer, bPoseChannel, chan); + } + + /* Write groups */ + LISTBASE_FOREACH (bActionGroup *, grp, &pose->agroups) { + BLO_write_struct(writer, bActionGroup, grp); + } + + /* write IK param */ + if (pose->ikparam) { + const char *structname = BKE_pose_ikparam_get_name(pose); + if (structname) { + BLO_write_struct_by_name(writer, structname, pose->ikparam); + } + } + + /* Write this pose */ + BLO_write_struct(writer, bPose, pose); +} + +void BKE_pose_blend_read_data(BlendDataReader *reader, bPose *pose) +{ + if (!pose) { + return; + } + + BLO_read_list(reader, &pose->chanbase); + BLO_read_list(reader, &pose->agroups); + + pose->chanhash = NULL; + pose->chan_array = NULL; + + LISTBASE_FOREACH (bPoseChannel *, pchan, &pose->chanbase) { + BKE_pose_channel_runtime_reset(&pchan->runtime); + BKE_pose_channel_session_uuid_generate(pchan); + + pchan->bone = NULL; + BLO_read_data_address(reader, &pchan->parent); + BLO_read_data_address(reader, &pchan->child); + BLO_read_data_address(reader, &pchan->custom_tx); + + BLO_read_data_address(reader, &pchan->bbone_prev); + BLO_read_data_address(reader, &pchan->bbone_next); + + BKE_constraint_blend_read_data(reader, &pchan->constraints); + + BLO_read_data_address(reader, &pchan->prop); + IDP_BlendDataRead(reader, &pchan->prop); + + BLO_read_data_address(reader, &pchan->mpath); + if (pchan->mpath) { + animviz_motionpath_blend_read_data(reader, pchan->mpath); + } + + BLI_listbase_clear(&pchan->iktree); + BLI_listbase_clear(&pchan->siktree); + + /* in case this value changes in future, clamp else we get undefined behavior */ + CLAMP(pchan->rotmode, ROT_MODE_MIN, ROT_MODE_MAX); + + pchan->draw_data = NULL; + } + pose->ikdata = NULL; + if (pose->ikparam != NULL) { + BLO_read_data_address(reader, &pose->ikparam); + } +} + +void BKE_pose_blend_read_lib(BlendLibReader *reader, Object *ob, bPose *pose) +{ + bArmature *arm = ob->data; + + if (!pose || !arm) { + return; + } + + /* always rebuild to match proxy or lib changes, but on Undo */ + bool rebuild = false; + + if (!BLO_read_lib_is_undo(reader)) { + if (ob->proxy || ob->id.lib != arm->id.lib) { + rebuild = true; + } + } + + if (ob->proxy) { + /* sync proxy layer */ + if (pose->proxy_layer) { + arm->layer = pose->proxy_layer; + } + + /* sync proxy active bone */ + if (pose->proxy_act_bone[0]) { + Bone *bone = BKE_armature_find_bone_name(arm, pose->proxy_act_bone); + if (bone) { + arm->act_bone = bone; + } + } + } + + LISTBASE_FOREACH (bPoseChannel *, pchan, &pose->chanbase) { + BKE_constraint_blend_read_lib(reader, (ID *)ob, &pchan->constraints); + + pchan->bone = BKE_armature_find_bone_name(arm, pchan->name); + + IDP_BlendReadLib(reader, pchan->prop); + + BLO_read_id_address(reader, arm->id.lib, &pchan->custom); + if (UNLIKELY(pchan->bone == NULL)) { + rebuild = true; + } + else if ((ob->id.lib == NULL) && arm->id.lib) { + /* local pose selection copied to armature, bit hackish */ + pchan->bone->flag &= ~BONE_SELECTED; + pchan->bone->flag |= pchan->selectflag; + } + } + + if (rebuild) { + Main *bmain = BLO_read_lib_get_main(reader); + DEG_id_tag_update_ex( + bmain, &ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION); + BKE_pose_tag_recalc(bmain, pose); + } +} + +void BKE_pose_blend_read_expand(BlendExpander *expander, bPose *pose) +{ + if (!pose) { + return; + } + + LISTBASE_FOREACH (bPoseChannel *, chan, &pose->chanbase) { + BKE_constraint_blend_read_expand(expander, &chan->constraints); + IDP_BlendReadExpand(expander, chan->prop); + BLO_expand(expander, chan->custom); + } +} diff --git a/source/blender/blenkernel/intern/anim_visualization.c b/source/blender/blenkernel/intern/anim_visualization.c index 5452e2513fb..ecd71ec08fe 100644 --- a/source/blender/blenkernel/intern/anim_visualization.c +++ b/source/blender/blenkernel/intern/anim_visualization.c @@ -34,6 +34,8 @@ #include "GPU_batch.h" +#include "BLO_read_write.h" + /* ******************************************************************** */ /* Animation Visualization */ @@ -224,3 +226,32 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, /* return it */ return mpath; } + +void animviz_motionpath_blend_write(BlendWriter *writer, bMotionPath *mpath) +{ + /* sanity checks */ + if (mpath == NULL) { + return; + } + + /* firstly, just write the motionpath struct */ + BLO_write_struct(writer, bMotionPath, mpath); + + /* now write the array of data */ + BLO_write_struct_array(writer, bMotionPathVert, mpath->length, mpath->points); +} + +void animviz_motionpath_blend_read_data(BlendDataReader *reader, bMotionPath *mpath) +{ + /* sanity check */ + if (mpath == NULL) { + return; + } + + /* relink points cache */ + BLO_read_data_address(reader, &mpath->points); + + mpath->points_vbo = NULL; + mpath->batch_line = NULL; + mpath->batch_points = NULL; +} diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 8723cd13e35..3eb9fb6161d 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -1819,6 +1819,24 @@ void BKE_color_managed_view_settings_free(ColorManagedViewSettings *settings) } } +void BKE_color_managed_view_settings_blend_write(BlendWriter *writer, + ColorManagedViewSettings *settings) +{ + if (settings->curve_mapping) { + BKE_curvemapping_blend_write(writer, settings->curve_mapping); + } +} + +void BKE_color_managed_view_settings_blend_read_data(BlendDataReader *reader, + ColorManagedViewSettings *settings) +{ + BLO_read_data_address(reader, &settings->curve_mapping); + + if (settings->curve_mapping) { + BKE_curvemapping_blend_read(reader, settings->curve_mapping); + } +} + void BKE_color_managed_colorspace_settings_init( ColorManagedColorspaceSettings *colorspace_settings) { diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index d21529467a1..a1b53b721d3 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -21,6 +21,9 @@ * \ingroup bke */ +/* Allow using deprecated functionality for .blend file I/O. */ +#define DNA_DEPRECATED_ALLOW + #include <float.h> #include <math.h> #include <stddef.h> @@ -80,6 +83,8 @@ #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" +#include "BLO_read_write.h" + #include "CLG_log.h" #ifdef WITH_PYTHON @@ -6086,3 +6091,174 @@ void BKE_constraints_solve(struct Depsgraph *depsgraph, } } } + +void BKE_constraint_blend_write(BlendWriter *writer, ListBase *conlist) +{ + LISTBASE_FOREACH (bConstraint *, con, conlist) { + const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); + + /* Write the specific data */ + if (cti && con->data) { + /* firstly, just write the plain con->data struct */ + BLO_write_struct_by_name(writer, cti->structName, con->data); + + /* do any constraint specific stuff */ + switch (con->type) { + case CONSTRAINT_TYPE_PYTHON: { + bPythonConstraint *data = con->data; + + /* write targets */ + LISTBASE_FOREACH (bConstraintTarget *, ct, &data->targets) { + BLO_write_struct(writer, bConstraintTarget, ct); + } + + /* Write ID Properties -- and copy this comment EXACTLY for easy finding + * of library blocks that implement this.*/ + IDP_BlendWrite(writer, data->prop); + + break; + } + case CONSTRAINT_TYPE_ARMATURE: { + bArmatureConstraint *data = con->data; + + /* write targets */ + LISTBASE_FOREACH (bConstraintTarget *, ct, &data->targets) { + BLO_write_struct(writer, bConstraintTarget, ct); + } + + break; + } + case CONSTRAINT_TYPE_SPLINEIK: { + bSplineIKConstraint *data = con->data; + + /* write points array */ + BLO_write_float_array(writer, data->numpoints, data->points); + + break; + } + } + } + + /* Write the constraint */ + BLO_write_struct(writer, bConstraint, con); + } +} + +void BKE_constraint_blend_read_data(BlendDataReader *reader, ListBase *lb) +{ + BLO_read_list(reader, lb); + LISTBASE_FOREACH (bConstraint *, con, lb) { + BLO_read_data_address(reader, &con->data); + + switch (con->type) { + case CONSTRAINT_TYPE_PYTHON: { + bPythonConstraint *data = con->data; + + BLO_read_list(reader, &data->targets); + + BLO_read_data_address(reader, &data->prop); + IDP_BlendDataRead(reader, &data->prop); + break; + } + case CONSTRAINT_TYPE_ARMATURE: { + bArmatureConstraint *data = con->data; + + BLO_read_list(reader, &data->targets); + + break; + } + case CONSTRAINT_TYPE_SPLINEIK: { + bSplineIKConstraint *data = con->data; + + BLO_read_data_address(reader, &data->points); + break; + } + case CONSTRAINT_TYPE_KINEMATIC: { + bKinematicConstraint *data = con->data; + + con->lin_error = 0.0f; + con->rot_error = 0.0f; + + /* version patch for runtime flag, was not cleared in some case */ + data->flag &= ~CONSTRAINT_IK_AUTO; + break; + } + case CONSTRAINT_TYPE_CHILDOF: { + /* XXX version patch, in older code this flag wasn't always set, and is inherent to type */ + if (con->ownspace == CONSTRAINT_SPACE_POSE) { + con->flag |= CONSTRAINT_SPACEONCE; + } + break; + } + case CONSTRAINT_TYPE_TRANSFORM_CACHE: { + bTransformCacheConstraint *data = con->data; + data->reader = NULL; + data->reader_object_path[0] = '\0'; + } + } + } +} + +/* temp struct used to transport needed info to lib_link_constraint_cb() */ +typedef struct tConstraintLinkData { + BlendLibReader *reader; + ID *id; +} tConstraintLinkData; +/* callback function used to relink constraint ID-links */ +static void lib_link_constraint_cb(bConstraint *UNUSED(con), + ID **idpoin, + bool UNUSED(is_reference), + void *userdata) +{ + tConstraintLinkData *cld = (tConstraintLinkData *)userdata; + BLO_read_id_address(cld->reader, cld->id->lib, idpoin); +} + +void BKE_constraint_blend_read_lib(BlendLibReader *reader, ID *id, ListBase *conlist) +{ + tConstraintLinkData cld; + + /* legacy fixes */ + LISTBASE_FOREACH (bConstraint *, con, conlist) { + /* patch for error introduced by changing constraints (dunno how) */ + /* if con->data type changes, dna cannot resolve the pointer! (ton) */ + if (con->data == NULL) { + con->type = CONSTRAINT_TYPE_NULL; + } + /* own ipo, all constraints have it */ + BLO_read_id_address(reader, id->lib, &con->ipo); /* XXX deprecated - old animation system */ + + /* If linking from a library, clear 'local' library override flag. */ + if (id->lib != NULL) { + con->flag &= ~CONSTRAINT_OVERRIDE_LIBRARY_LOCAL; + } + } + + /* relink all ID-blocks used by the constraints */ + cld.reader = reader; + cld.id = id; + + BKE_constraints_id_loop(conlist, lib_link_constraint_cb, &cld); +} + +/* callback function used to expand constraint ID-links */ +static void expand_constraint_cb(bConstraint *UNUSED(con), + ID **idpoin, + bool UNUSED(is_reference), + void *userdata) +{ + BlendExpander *expander = userdata; + BLO_expand(expander, *idpoin); +} + +void BKE_constraint_blend_read_expand(BlendExpander *expander, ListBase *lb) +{ + BKE_constraints_id_loop(lb, expand_constraint_cb, expander); + + /* deprecated manual expansion stuff */ + LISTBASE_FOREACH (bConstraint *, curcon, lb) { + if (curcon->ipo) { + BLO_expand(expander, curcon->ipo); /* XXX deprecated - old animation system */ + } + } +} diff --git a/source/blender/blenkernel/intern/fcurve_test.cc b/source/blender/blenkernel/intern/fcurve_test.cc index a230c8f2e96..97dd541e2b9 100644 --- a/source/blender/blenkernel/intern/fcurve_test.cc +++ b/source/blender/blenkernel/intern/fcurve_test.cc @@ -290,7 +290,7 @@ TEST(fcurve_active_keyframe, ActiveKeyframe) EXPECT_EQ(BKE_fcurve_active_keyframe_index(fcu), 2); /* Check clearing the index. */ - BKE_fcurve_active_keyframe_set(fcu, NULL); + BKE_fcurve_active_keyframe_set(fcu, nullptr); EXPECT_EQ(fcu->active_keyframe_index, FCURVE_ACTIVE_KEYFRAME_NONE); EXPECT_EQ(BKE_fcurve_active_keyframe_index(fcu), FCURVE_ACTIVE_KEYFRAME_NONE); diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c index 934791ccc35..be06638ab64 100644 --- a/source/blender/blenkernel/intern/gpencil_modifier.c +++ b/source/blender/blenkernel/intern/gpencil_modifier.c @@ -37,10 +37,12 @@ #include "DNA_gpencil_modifier_types.h" #include "DNA_gpencil_types.h" #include "DNA_meshdata_types.h" +#include "DNA_modifier_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" +#include "BKE_colortools.h" #include "BKE_gpencil.h" #include "BKE_gpencil_geom.h" #include "BKE_gpencil_modifier.h" @@ -55,6 +57,8 @@ #include "MOD_gpencil_modifiertypes.h" +#include "BLO_read_write.h" + #include "CLG_log.h" static CLG_LogRef LOG = {"bke.gpencil_modifier"}; @@ -777,3 +781,159 @@ void BKE_gpencil_modifiers_calc(Depsgraph *depsgraph, Scene *scene, Object *ob) /* Clear any lattice data. */ BKE_gpencil_lattice_clear(ob); } + +void BKE_gpencil_modifier_blend_write(BlendWriter *writer, ListBase *modbase) +{ + if (modbase == NULL) { + return; + } + + LISTBASE_FOREACH (GpencilModifierData *, md, modbase) { + const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type); + if (mti == NULL) { + return; + } + + BLO_write_struct_by_name(writer, mti->struct_name, md); + + if (md->type == eGpencilModifierType_Thick) { + ThickGpencilModifierData *gpmd = (ThickGpencilModifierData *)md; + + if (gpmd->curve_thickness) { + BKE_curvemapping_blend_write(writer, gpmd->curve_thickness); + } + } + else if (md->type == eGpencilModifierType_Noise) { + NoiseGpencilModifierData *gpmd = (NoiseGpencilModifierData *)md; + + if (gpmd->curve_intensity) { + BKE_curvemapping_blend_write(writer, gpmd->curve_intensity); + } + } + else if (md->type == eGpencilModifierType_Hook) { + HookGpencilModifierData *gpmd = (HookGpencilModifierData *)md; + + if (gpmd->curfalloff) { + BKE_curvemapping_blend_write(writer, gpmd->curfalloff); + } + } + else if (md->type == eGpencilModifierType_Tint) { + TintGpencilModifierData *gpmd = (TintGpencilModifierData *)md; + if (gpmd->colorband) { + BLO_write_struct(writer, ColorBand, gpmd->colorband); + } + if (gpmd->curve_intensity) { + BKE_curvemapping_blend_write(writer, gpmd->curve_intensity); + } + } + else if (md->type == eGpencilModifierType_Smooth) { + SmoothGpencilModifierData *gpmd = (SmoothGpencilModifierData *)md; + if (gpmd->curve_intensity) { + BKE_curvemapping_blend_write(writer, gpmd->curve_intensity); + } + } + else if (md->type == eGpencilModifierType_Color) { + ColorGpencilModifierData *gpmd = (ColorGpencilModifierData *)md; + if (gpmd->curve_intensity) { + BKE_curvemapping_blend_write(writer, gpmd->curve_intensity); + } + } + else if (md->type == eGpencilModifierType_Opacity) { + OpacityGpencilModifierData *gpmd = (OpacityGpencilModifierData *)md; + if (gpmd->curve_intensity) { + BKE_curvemapping_blend_write(writer, gpmd->curve_intensity); + } + } + } +} + +void BKE_gpencil_modifier_blend_read_data(BlendDataReader *reader, ListBase *lb) +{ + BLO_read_list(reader, lb); + + LISTBASE_FOREACH (GpencilModifierData *, md, lb) { + md->error = NULL; + + /* if modifiers disappear, or for upward compatibility */ + if (NULL == BKE_gpencil_modifier_get_info(md->type)) { + md->type = eModifierType_None; + } + + if (md->type == eGpencilModifierType_Lattice) { + LatticeGpencilModifierData *gpmd = (LatticeGpencilModifierData *)md; + gpmd->cache_data = NULL; + } + else if (md->type == eGpencilModifierType_Hook) { + HookGpencilModifierData *hmd = (HookGpencilModifierData *)md; + + BLO_read_data_address(reader, &hmd->curfalloff); + if (hmd->curfalloff) { + BKE_curvemapping_blend_read(reader, hmd->curfalloff); + } + } + else if (md->type == eGpencilModifierType_Noise) { + NoiseGpencilModifierData *gpmd = (NoiseGpencilModifierData *)md; + + BLO_read_data_address(reader, &gpmd->curve_intensity); + if (gpmd->curve_intensity) { + BKE_curvemapping_blend_read(reader, gpmd->curve_intensity); + /* initialize the curve. Maybe this could be moved to modififer logic */ + BKE_curvemapping_init(gpmd->curve_intensity); + } + } + else if (md->type == eGpencilModifierType_Thick) { + ThickGpencilModifierData *gpmd = (ThickGpencilModifierData *)md; + + BLO_read_data_address(reader, &gpmd->curve_thickness); + if (gpmd->curve_thickness) { + BKE_curvemapping_blend_read(reader, gpmd->curve_thickness); + BKE_curvemapping_init(gpmd->curve_thickness); + } + } + else if (md->type == eGpencilModifierType_Tint) { + TintGpencilModifierData *gpmd = (TintGpencilModifierData *)md; + BLO_read_data_address(reader, &gpmd->colorband); + BLO_read_data_address(reader, &gpmd->curve_intensity); + if (gpmd->curve_intensity) { + BKE_curvemapping_blend_read(reader, gpmd->curve_intensity); + BKE_curvemapping_init(gpmd->curve_intensity); + } + } + else if (md->type == eGpencilModifierType_Smooth) { + SmoothGpencilModifierData *gpmd = (SmoothGpencilModifierData *)md; + BLO_read_data_address(reader, &gpmd->curve_intensity); + if (gpmd->curve_intensity) { + BKE_curvemapping_blend_read(reader, gpmd->curve_intensity); + BKE_curvemapping_init(gpmd->curve_intensity); + } + } + else if (md->type == eGpencilModifierType_Color) { + ColorGpencilModifierData *gpmd = (ColorGpencilModifierData *)md; + BLO_read_data_address(reader, &gpmd->curve_intensity); + if (gpmd->curve_intensity) { + BKE_curvemapping_blend_read(reader, gpmd->curve_intensity); + BKE_curvemapping_init(gpmd->curve_intensity); + } + } + else if (md->type == eGpencilModifierType_Opacity) { + OpacityGpencilModifierData *gpmd = (OpacityGpencilModifierData *)md; + BLO_read_data_address(reader, &gpmd->curve_intensity); + if (gpmd->curve_intensity) { + BKE_curvemapping_blend_read(reader, gpmd->curve_intensity); + BKE_curvemapping_init(gpmd->curve_intensity); + } + } + } +} + +void BKE_gpencil_modifier_blend_read_lib(BlendLibReader *reader, Object *ob) +{ + BKE_gpencil_modifiers_foreach_ID_link(ob, BKE_object_modifiers_lib_link_common, reader); + + /* If linking from a library, clear 'local' library override flag. */ + if (ob->id.lib != NULL) { + LISTBASE_FOREACH (GpencilModifierData *, mod, &ob->greasepencil_modifiers) { + mod->flag &= ~eGpencilModifierFlag_OverrideLibrary_Local; + } + } +} diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 5d2defa3030..9696d920640 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -52,6 +52,7 @@ #include "BLI_blenlib.h" #include "BLI_dynstr.h" +#include "BLI_endian_switch.h" #include "BLI_string_utils.h" #include "BLI_utildefines.h" @@ -75,6 +76,8 @@ #include "SEQ_sequencer.h" +#include "BLO_read_write.h" + #ifdef WIN32 # include "BLI_math_base.h" /* M_PI */ #endif @@ -110,6 +113,69 @@ static void ipo_free_data(ID *id) } } +static void ipo_blend_read_data(BlendDataReader *reader, ID *id) +{ + Ipo *ipo = (Ipo *)id; + + BLO_read_list(reader, &(ipo->curve)); + + LISTBASE_FOREACH (IpoCurve *, icu, &ipo->curve) { + BLO_read_data_address(reader, &icu->bezt); + BLO_read_data_address(reader, &icu->bp); + BLO_read_data_address(reader, &icu->driver); + + /* Undo generic endian switching. */ + if (BLO_read_requires_endian_switch(reader)) { + BLI_endian_switch_int16(&icu->blocktype); + if (icu->driver != NULL) { + + /* Undo generic endian switching. */ + if (BLO_read_requires_endian_switch(reader)) { + BLI_endian_switch_int16(&icu->blocktype); + if (icu->driver != NULL) { + BLI_endian_switch_int16(&icu->driver->blocktype); + } + } + } + + /* Undo generic endian switching. */ + if (BLO_read_requires_endian_switch(reader)) { + BLI_endian_switch_int16(&ipo->blocktype); + if (icu->driver != NULL) { + BLI_endian_switch_int16(&icu->driver->blocktype); + } + } + } + } + + /* Undo generic endian switching. */ + if (BLO_read_requires_endian_switch(reader)) { + BLI_endian_switch_int16(&ipo->blocktype); + } +} + +static void ipo_blend_read_lib(BlendLibReader *reader, ID *id) +{ + Ipo *ipo = (Ipo *)id; + + LISTBASE_FOREACH (IpoCurve *, icu, &ipo->curve) { + if (icu->driver) { + BLO_read_id_address(reader, ipo->id.lib, &icu->driver->ob); + } + } +} + +static void ipo_blend_read_expand(BlendExpander *expander, ID *id) +{ + Ipo *ipo = (Ipo *)id; + + LISTBASE_FOREACH (IpoCurve *, icu, &ipo->curve) { + if (icu->driver) { + BLO_expand(expander, icu->driver->ob); + } + } +} + IDTypeInfo IDType_ID_IP = { .id_code = ID_IP, .id_filter = 0, @@ -129,9 +195,9 @@ IDTypeInfo IDType_ID_IP = { .foreach_cache = NULL, .blend_write = NULL, - .blend_read_data = NULL, - .blend_read_lib = NULL, - .blend_read_expand = NULL, + .blend_read_data = ipo_blend_read_data, + .blend_read_lib = ipo_blend_read_lib, + .blend_read_expand = ipo_blend_read_expand, .blend_read_undo_preserve = NULL, }; diff --git a/source/blender/blenkernel/intern/lattice_deform_test.cc b/source/blender/blenkernel/intern/lattice_deform_test.cc index 7db9d941458..f08d0349598 100644 --- a/source/blender/blenkernel/intern/lattice_deform_test.cc +++ b/source/blender/blenkernel/intern/lattice_deform_test.cc @@ -83,7 +83,7 @@ static void test_lattice_deform_free(LatticeDeformTestContext *ctx) TEST(lattice_deform_performance, performance_no_dvert_1) { const int32_t num_items = 1; - LatticeDeformTestContext ctx = {{{0}}}; + LatticeDeformTestContext ctx = {{{nullptr}}}; RandomNumberGenerator rng; test_lattice_deform_init(&ctx, &rng, num_items); test_lattice_deform(&ctx, num_items); @@ -92,7 +92,7 @@ TEST(lattice_deform_performance, performance_no_dvert_1) TEST(lattice_deform_performance, performance_no_dvert_1000) { const int32_t num_items = 1000; - LatticeDeformTestContext ctx = {{{0}}}; + LatticeDeformTestContext ctx = {{{nullptr}}}; RandomNumberGenerator rng; test_lattice_deform_init(&ctx, &rng, num_items); test_lattice_deform(&ctx, num_items); @@ -101,7 +101,7 @@ TEST(lattice_deform_performance, performance_no_dvert_1000) TEST(lattice_deform_performance, performance_no_dvert_10000) { const int32_t num_items = 10000; - LatticeDeformTestContext ctx = {{{0}}}; + LatticeDeformTestContext ctx = {{{nullptr}}}; RandomNumberGenerator rng; test_lattice_deform_init(&ctx, &rng, num_items); test_lattice_deform(&ctx, num_items); @@ -110,7 +110,7 @@ TEST(lattice_deform_performance, performance_no_dvert_10000) TEST(lattice_deform_performance, performance_no_dvert_100000) { const int32_t num_items = 100000; - LatticeDeformTestContext ctx = {{{0}}}; + LatticeDeformTestContext ctx = {{{nullptr}}}; RandomNumberGenerator rng; test_lattice_deform_init(&ctx, &rng, num_items); test_lattice_deform(&ctx, num_items); @@ -119,7 +119,7 @@ TEST(lattice_deform_performance, performance_no_dvert_100000) TEST(lattice_deform_performance, performance_no_dvert_1000000) { const int32_t num_items = 1000000; - LatticeDeformTestContext ctx = {{{0}}}; + LatticeDeformTestContext ctx = {{{nullptr}}}; RandomNumberGenerator rng; test_lattice_deform_init(&ctx, &rng, num_items); test_lattice_deform(&ctx, num_items); @@ -128,7 +128,7 @@ TEST(lattice_deform_performance, performance_no_dvert_1000000) TEST(lattice_deform_performance, performance_no_dvert_10000000) { const int32_t num_items = 10000000; - LatticeDeformTestContext ctx = {{{0}}}; + LatticeDeformTestContext ctx = {{{nullptr}}}; RandomNumberGenerator rng; test_lattice_deform_init(&ctx, &rng, num_items); test_lattice_deform(&ctx, num_items); diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 4915ad4eaac..784cd5b2edf 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -1833,6 +1833,34 @@ void BKE_layer_eval_view_layer_indexed(struct Depsgraph *depsgraph, layer_eval_view_layer(depsgraph, scene, view_layer); } +static void write_layer_collections(BlendWriter *writer, ListBase *lb) +{ + LISTBASE_FOREACH (LayerCollection *, lc, lb) { + BLO_write_struct(writer, LayerCollection, lc); + + write_layer_collections(writer, &lc->layer_collections); + } +} + +void BKE_view_layer_blend_write(BlendWriter *writer, ViewLayer *view_layer) +{ + BLO_write_struct(writer, ViewLayer, view_layer); + BLO_write_struct_list(writer, Base, &view_layer->object_bases); + + if (view_layer->id_properties) { + IDP_BlendWrite(writer, view_layer->id_properties); + } + + LISTBASE_FOREACH (FreestyleModuleConfig *, fmc, &view_layer->freestyle_config.modules) { + BLO_write_struct(writer, FreestyleModuleConfig, fmc); + } + + LISTBASE_FOREACH (FreestyleLineSet *, fls, &view_layer->freestyle_config.linesets) { + BLO_write_struct(writer, FreestyleLineSet, fls); + } + write_layer_collections(writer, &view_layer->layer_collections); +} + static void direct_link_layer_collections(BlendDataReader *reader, ListBase *lb, bool master) { BLO_read_list(reader, lb); diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c index 9711dcc8ef3..8272bd07411 100644 --- a/source/blender/blenkernel/intern/mesh_convert.c +++ b/source/blender/blenkernel/intern/mesh_convert.c @@ -980,6 +980,14 @@ void BKE_mesh_from_pointcloud(const PointCloud *pointcloud, Mesh *me) CustomData_free_layer(&me->vdata, CD_PROP_FLOAT3, me->totvert, layer_idx); } +void BKE_mesh_edges_set_draw_render(Mesh *mesh) +{ + MEdge *med = mesh->medge; + for (int i = 0; i < mesh->totedge; i++, med++) { + med->flag |= ME_EDGEDRAW | ME_EDGERENDER; + } +} + void BKE_pointcloud_to_mesh(Main *bmain, Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob) { BLI_assert(ob->type == OB_POINTCLOUD); diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 0054d2f76d1..3c8b685a0e0 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -24,6 +24,9 @@ * \ingroup bke */ +/* Allow using deprecated functionality for .blend file I/O. */ +#define DNA_DEPRECATED_ALLOW + #include <float.h> #include <math.h> #include <stdarg.h> @@ -34,8 +37,12 @@ #include "MEM_guardedalloc.h" #include "DNA_armature_types.h" +#include "DNA_cloth_types.h" +#include "DNA_fluid_types.h" #include "DNA_gpencil_modifier_types.h" #include "DNA_mesh_types.h" +#include "DNA_object_fluidsim_types.h" +#include "DNA_object_force_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" @@ -54,6 +61,8 @@ #include "BKE_appdir.h" #include "BKE_editmesh.h" #include "BKE_editmesh_cache.h" +#include "BKE_effect.h" +#include "BKE_fluid.h" #include "BKE_global.h" #include "BKE_gpencil_modifier.h" #include "BKE_idtype.h" @@ -64,6 +73,7 @@ #include "BKE_mesh_wrapper.h" #include "BKE_multires.h" #include "BKE_object.h" +#include "BKE_pointcache.h" /* may move these, only for BKE_modifier_path_relbase */ #include "BKE_main.h" @@ -74,6 +84,8 @@ #include "MOD_modifiertypes.h" +#include "BLO_read_write.h" + #include "CLG_log.h" static CLG_LogRef LOG = {"bke.modifier"}; @@ -1116,3 +1128,423 @@ void BKE_modifier_check_uuids_unique_and_report(const Object *object) BLI_gset_free(used_uuids, NULL); } + +void BKE_modifier_blend_write(BlendWriter *writer, ListBase *modbase) +{ + if (modbase == NULL) { + return; + } + + LISTBASE_FOREACH (ModifierData *, md, modbase) { + const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type); + if (mti == NULL) { + return; + } + + BLO_write_struct_by_name(writer, mti->structName, md); + + if (md->type == eModifierType_Cloth) { + ClothModifierData *clmd = (ClothModifierData *)md; + + BLO_write_struct(writer, ClothSimSettings, clmd->sim_parms); + BLO_write_struct(writer, ClothCollSettings, clmd->coll_parms); + BLO_write_struct(writer, EffectorWeights, clmd->sim_parms->effector_weights); + BKE_ptcache_blend_write(writer, &clmd->ptcaches); + } + else if (md->type == eModifierType_Fluid) { + FluidModifierData *fmd = (FluidModifierData *)md; + + if (fmd->type & MOD_FLUID_TYPE_DOMAIN) { + BLO_write_struct(writer, FluidDomainSettings, fmd->domain); + + if (fmd->domain) { + BKE_ptcache_blend_write(writer, &(fmd->domain->ptcaches[0])); + + /* create fake pointcache so that old blender versions can read it */ + fmd->domain->point_cache[1] = BKE_ptcache_add(&fmd->domain->ptcaches[1]); + fmd->domain->point_cache[1]->flag |= PTCACHE_DISK_CACHE | PTCACHE_FAKE_SMOKE; + fmd->domain->point_cache[1]->step = 1; + + BKE_ptcache_blend_write(writer, &(fmd->domain->ptcaches[1])); + + if (fmd->domain->coba) { + BLO_write_struct(writer, ColorBand, fmd->domain->coba); + } + + /* cleanup the fake pointcache */ + BKE_ptcache_free_list(&fmd->domain->ptcaches[1]); + fmd->domain->point_cache[1] = NULL; + + BLO_write_struct(writer, EffectorWeights, fmd->domain->effector_weights); + } + } + else if (fmd->type & MOD_FLUID_TYPE_FLOW) { + BLO_write_struct(writer, FluidFlowSettings, fmd->flow); + } + else if (fmd->type & MOD_FLUID_TYPE_EFFEC) { + BLO_write_struct(writer, FluidEffectorSettings, fmd->effector); + } + } + else if (md->type == eModifierType_Fluidsim) { + FluidsimModifierData *fluidmd = (FluidsimModifierData *)md; + + BLO_write_struct(writer, FluidsimSettings, fluidmd->fss); + } + else if (md->type == eModifierType_DynamicPaint) { + DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md; + + if (pmd->canvas) { + BLO_write_struct(writer, DynamicPaintCanvasSettings, pmd->canvas); + + /* write surfaces */ + LISTBASE_FOREACH (DynamicPaintSurface *, surface, &pmd->canvas->surfaces) { + BLO_write_struct(writer, DynamicPaintSurface, surface); + } + /* write caches and effector weights */ + LISTBASE_FOREACH (DynamicPaintSurface *, surface, &pmd->canvas->surfaces) { + BKE_ptcache_blend_write(writer, &(surface->ptcaches)); + + BLO_write_struct(writer, EffectorWeights, surface->effector_weights); + } + } + if (pmd->brush) { + BLO_write_struct(writer, DynamicPaintBrushSettings, pmd->brush); + BLO_write_struct(writer, ColorBand, pmd->brush->paint_ramp); + BLO_write_struct(writer, ColorBand, pmd->brush->vel_ramp); + } + } + else if (md->type == eModifierType_Collision) { + +#if 0 + CollisionModifierData *collmd = (CollisionModifierData *)md; + // TODO: CollisionModifier should use pointcache + // + have proper reset events before enabling this + writestruct(wd, DATA, MVert, collmd->numverts, collmd->x); + writestruct(wd, DATA, MVert, collmd->numverts, collmd->xnew); + writestruct(wd, DATA, MFace, collmd->numfaces, collmd->mfaces); +#endif + } + + if (mti->blendWrite != NULL) { + mti->blendWrite(writer, md); + } + } +} + +/* TODO(sergey): Find a better place for this. + * + * Unfortunately, this can not be done as a regular do_versions() since the modifier type is + * set to NONE, so the do_versions code wouldn't know where the modifier came from. + * + * The best approach seems to have the functionality in versioning_280.c but still call the + * function from #BKE_modifier_blend_read_data(). + */ + +/* Domain, inflow, ... */ +static void modifier_ensure_type(FluidModifierData *fluid_modifier_data, int type) +{ + fluid_modifier_data->type = type; + BKE_fluid_modifier_free(fluid_modifier_data); + BKE_fluid_modifier_create_type_data(fluid_modifier_data); +} + +/** + * \note The old_modifier_data is NOT linked. + * This means that in order to access sub-data pointers #BLO_read_get_new_data_address is to be + * used. + */ +static ModifierData *modifier_replace_with_fluid(BlendDataReader *reader, + Object *object, + ListBase *modifiers, + ModifierData *old_modifier_data) +{ + ModifierData *new_modifier_data = BKE_modifier_new(eModifierType_Fluid); + FluidModifierData *fluid_modifier_data = (FluidModifierData *)new_modifier_data; + + if (old_modifier_data->type == eModifierType_Fluidsim) { + FluidsimModifierData *old_fluidsim_modifier_data = (FluidsimModifierData *)old_modifier_data; + FluidsimSettings *old_fluidsim_settings = BLO_read_get_new_data_address( + reader, old_fluidsim_modifier_data->fss); + switch (old_fluidsim_settings->type) { + case OB_FLUIDSIM_ENABLE: + modifier_ensure_type(fluid_modifier_data, 0); + break; + case OB_FLUIDSIM_DOMAIN: + modifier_ensure_type(fluid_modifier_data, MOD_FLUID_TYPE_DOMAIN); + BKE_fluid_domain_type_set(object, fluid_modifier_data->domain, FLUID_DOMAIN_TYPE_LIQUID); + break; + case OB_FLUIDSIM_FLUID: + modifier_ensure_type(fluid_modifier_data, MOD_FLUID_TYPE_FLOW); + BKE_fluid_flow_type_set(object, fluid_modifier_data->flow, FLUID_FLOW_TYPE_LIQUID); + /* No need to emit liquid far away from surface. */ + fluid_modifier_data->flow->surface_distance = 0.0f; + break; + case OB_FLUIDSIM_OBSTACLE: + modifier_ensure_type(fluid_modifier_data, MOD_FLUID_TYPE_EFFEC); + BKE_fluid_effector_type_set( + object, fluid_modifier_data->effector, FLUID_EFFECTOR_TYPE_COLLISION); + break; + case OB_FLUIDSIM_INFLOW: + modifier_ensure_type(fluid_modifier_data, MOD_FLUID_TYPE_FLOW); + BKE_fluid_flow_type_set(object, fluid_modifier_data->flow, FLUID_FLOW_TYPE_LIQUID); + BKE_fluid_flow_behavior_set(object, fluid_modifier_data->flow, FLUID_FLOW_BEHAVIOR_INFLOW); + /* No need to emit liquid far away from surface. */ + fluid_modifier_data->flow->surface_distance = 0.0f; + break; + case OB_FLUIDSIM_OUTFLOW: + modifier_ensure_type(fluid_modifier_data, MOD_FLUID_TYPE_FLOW); + BKE_fluid_flow_type_set(object, fluid_modifier_data->flow, FLUID_FLOW_TYPE_LIQUID); + BKE_fluid_flow_behavior_set( + object, fluid_modifier_data->flow, FLUID_FLOW_BEHAVIOR_OUTFLOW); + break; + case OB_FLUIDSIM_PARTICLE: + /* "Particle" type objects not being used by Mantaflow fluid simulations. + * Skip this object, secondary particles can only be enabled through the domain object. */ + break; + case OB_FLUIDSIM_CONTROL: + /* "Control" type objects not being used by Mantaflow fluid simulations. + * Use guiding type instead which is similar. */ + modifier_ensure_type(fluid_modifier_data, MOD_FLUID_TYPE_EFFEC); + BKE_fluid_effector_type_set( + object, fluid_modifier_data->effector, FLUID_EFFECTOR_TYPE_GUIDE); + break; + } + } + else if (old_modifier_data->type == eModifierType_Smoke) { + SmokeModifierData *old_smoke_modifier_data = (SmokeModifierData *)old_modifier_data; + modifier_ensure_type(fluid_modifier_data, old_smoke_modifier_data->type); + if (fluid_modifier_data->type == MOD_FLUID_TYPE_DOMAIN) { + BKE_fluid_domain_type_set(object, fluid_modifier_data->domain, FLUID_DOMAIN_TYPE_GAS); + } + else if (fluid_modifier_data->type == MOD_FLUID_TYPE_FLOW) { + BKE_fluid_flow_type_set(object, fluid_modifier_data->flow, FLUID_FLOW_TYPE_SMOKE); + } + else if (fluid_modifier_data->type == MOD_FLUID_TYPE_EFFEC) { + BKE_fluid_effector_type_set( + object, fluid_modifier_data->effector, FLUID_EFFECTOR_TYPE_COLLISION); + } + } + + /* Replace modifier data in the stack. */ + new_modifier_data->next = old_modifier_data->next; + new_modifier_data->prev = old_modifier_data->prev; + if (new_modifier_data->prev != NULL) { + new_modifier_data->prev->next = new_modifier_data; + } + if (new_modifier_data->next != NULL) { + new_modifier_data->next->prev = new_modifier_data; + } + if (modifiers->first == old_modifier_data) { + modifiers->first = new_modifier_data; + } + if (modifiers->last == old_modifier_data) { + modifiers->last = new_modifier_data; + } + + /* Free old modifier data. */ + MEM_freeN(old_modifier_data); + + return new_modifier_data; +} + +void BKE_modifier_blend_read_data(BlendDataReader *reader, ListBase *lb, Object *ob) +{ + BLO_read_list(reader, lb); + + LISTBASE_FOREACH (ModifierData *, md, lb) { + BKE_modifier_session_uuid_generate(md); + + md->error = NULL; + md->runtime = NULL; + + /* Modifier data has been allocated as a part of data migration process and + * no reading of nested fields from file is needed. */ + bool is_allocated = false; + + if (md->type == eModifierType_Fluidsim) { + BLO_reportf_wrap( + BLO_read_data_reports(reader), + RPT_WARNING, + TIP_("Possible data loss when saving this file! %s modifier is deprecated (Object: %s)"), + md->name, + ob->id.name + 2); + md = modifier_replace_with_fluid(reader, ob, lb, md); + is_allocated = true; + } + else if (md->type == eModifierType_Smoke) { + BLO_reportf_wrap( + BLO_read_data_reports(reader), + RPT_WARNING, + TIP_("Possible data loss when saving this file! %s modifier is deprecated (Object: %s)"), + md->name, + ob->id.name + 2); + md = modifier_replace_with_fluid(reader, ob, lb, md); + is_allocated = true; + } + + const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type); + + /* if modifiers disappear, or for upward compatibility */ + if (mti == NULL) { + md->type = eModifierType_None; + } + + if (is_allocated) { + /* All the fields has been properly allocated. */ + } + else if (md->type == eModifierType_Cloth) { + ClothModifierData *clmd = (ClothModifierData *)md; + + clmd->clothObject = NULL; + clmd->hairdata = NULL; + + BLO_read_data_address(reader, &clmd->sim_parms); + BLO_read_data_address(reader, &clmd->coll_parms); + + BKE_ptcache_blend_read_data(reader, &clmd->ptcaches, &clmd->point_cache, 0); + + if (clmd->sim_parms) { + if (clmd->sim_parms->presets > 10) { + clmd->sim_parms->presets = 0; + } + + clmd->sim_parms->reset = 0; + + BLO_read_data_address(reader, &clmd->sim_parms->effector_weights); + + if (!clmd->sim_parms->effector_weights) { + clmd->sim_parms->effector_weights = BKE_effector_add_weights(NULL); + } + } + + clmd->solver_result = NULL; + } + else if (md->type == eModifierType_Fluid) { + + FluidModifierData *fmd = (FluidModifierData *)md; + + if (fmd->type == MOD_FLUID_TYPE_DOMAIN) { + fmd->flow = NULL; + fmd->effector = NULL; + BLO_read_data_address(reader, &fmd->domain); + fmd->domain->fmd = fmd; + + fmd->domain->fluid = NULL; + fmd->domain->fluid_mutex = BLI_rw_mutex_alloc(); + fmd->domain->tex_density = NULL; + fmd->domain->tex_color = NULL; + fmd->domain->tex_shadow = NULL; + fmd->domain->tex_flame = NULL; + fmd->domain->tex_flame_coba = NULL; + fmd->domain->tex_coba = NULL; + fmd->domain->tex_field = NULL; + fmd->domain->tex_velocity_x = NULL; + fmd->domain->tex_velocity_y = NULL; + fmd->domain->tex_velocity_z = NULL; + fmd->domain->tex_wt = NULL; + fmd->domain->mesh_velocities = NULL; + BLO_read_data_address(reader, &fmd->domain->coba); + + BLO_read_data_address(reader, &fmd->domain->effector_weights); + if (!fmd->domain->effector_weights) { + fmd->domain->effector_weights = BKE_effector_add_weights(NULL); + } + + BKE_ptcache_blend_read_data( + reader, &(fmd->domain->ptcaches[0]), &(fmd->domain->point_cache[0]), 1); + + /* Manta sim uses only one cache from now on, so store pointer convert */ + if (fmd->domain->ptcaches[1].first || fmd->domain->point_cache[1]) { + if (fmd->domain->point_cache[1]) { + PointCache *cache = BLO_read_get_new_data_address(reader, fmd->domain->point_cache[1]); + if (cache->flag & PTCACHE_FAKE_SMOKE) { + /* Manta-sim/smoke was already saved in "new format" and this cache is a fake one. */ + } + else { + printf( + "High resolution manta cache not available due to pointcache update. Please " + "reset the simulation.\n"); + } + BKE_ptcache_free(cache); + } + BLI_listbase_clear(&fmd->domain->ptcaches[1]); + fmd->domain->point_cache[1] = NULL; + } + } + else if (fmd->type == MOD_FLUID_TYPE_FLOW) { + fmd->domain = NULL; + fmd->effector = NULL; + BLO_read_data_address(reader, &fmd->flow); + fmd->flow->fmd = fmd; + fmd->flow->mesh = NULL; + fmd->flow->verts_old = NULL; + fmd->flow->numverts = 0; + BLO_read_data_address(reader, &fmd->flow->psys); + } + else if (fmd->type == MOD_FLUID_TYPE_EFFEC) { + fmd->flow = NULL; + fmd->domain = NULL; + BLO_read_data_address(reader, &fmd->effector); + if (fmd->effector) { + fmd->effector->fmd = fmd; + fmd->effector->verts_old = NULL; + fmd->effector->numverts = 0; + fmd->effector->mesh = NULL; + } + else { + fmd->type = 0; + fmd->flow = NULL; + fmd->domain = NULL; + fmd->effector = NULL; + } + } + } + else if (md->type == eModifierType_DynamicPaint) { + DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md; + + if (pmd->canvas) { + BLO_read_data_address(reader, &pmd->canvas); + pmd->canvas->pmd = pmd; + pmd->canvas->flags &= ~MOD_DPAINT_BAKING; /* just in case */ + + if (pmd->canvas->surfaces.first) { + BLO_read_list(reader, &pmd->canvas->surfaces); + + LISTBASE_FOREACH (DynamicPaintSurface *, surface, &pmd->canvas->surfaces) { + surface->canvas = pmd->canvas; + surface->data = NULL; + BKE_ptcache_blend_read_data(reader, &(surface->ptcaches), &(surface->pointcache), 1); + + BLO_read_data_address(reader, &surface->effector_weights); + if (surface->effector_weights == NULL) { + surface->effector_weights = BKE_effector_add_weights(NULL); + } + } + } + } + if (pmd->brush) { + BLO_read_data_address(reader, &pmd->brush); + pmd->brush->pmd = pmd; + BLO_read_data_address(reader, &pmd->brush->psys); + BLO_read_data_address(reader, &pmd->brush->paint_ramp); + BLO_read_data_address(reader, &pmd->brush->vel_ramp); + } + } + + if (mti->blendRead != NULL) { + mti->blendRead(reader, md); + } + } +} + +void BKE_modifier_blend_read_lib(BlendLibReader *reader, Object *ob) +{ + BKE_modifiers_foreach_ID_link(ob, BKE_object_modifiers_lib_link_common, reader); + + /* If linking from a library, clear 'local' library override flag. */ + if (ob->id.lib != NULL) { + LISTBASE_FOREACH (ModifierData *, mod, &ob->modifiers) { + mod->flag &= ~eModifierFlag_OverrideLibrary_Local; + } + } +} diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index f658594d878..f9aa6dcca6a 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -21,6 +21,9 @@ * \ingroup bke */ +/* Allow using deprecated functionality for .blend file I/O. */ +#define DNA_DEPRECATED_ALLOW + #include <math.h> #include <stdio.h> #include <string.h> @@ -35,6 +38,7 @@ #include "DNA_collection_types.h" #include "DNA_constraint_types.h" #include "DNA_defaults.h" +#include "DNA_effect_types.h" #include "DNA_fluid_types.h" #include "DNA_gpencil_modifier_types.h" #include "DNA_gpencil_types.h" @@ -47,6 +51,8 @@ #include "DNA_meshdata_types.h" #include "DNA_meta_types.h" #include "DNA_movieclip_types.h" +#include "DNA_nla_types.h" +#include "DNA_object_fluidsim_types.h" #include "DNA_object_types.h" #include "DNA_pointcloud_types.h" #include "DNA_rigidbody_types.h" @@ -135,6 +141,8 @@ #include "DRW_engine.h" +#include "BLO_read_write.h" + #include "SEQ_sequencer.h" #ifdef WITH_PYTHON @@ -517,6 +525,614 @@ static void object_foreach_id(ID *id, LibraryForeachIDData *data) } } +static void write_defgroups(BlendWriter *writer, ListBase *defbase) +{ + LISTBASE_FOREACH (bDeformGroup *, defgroup, defbase) { + BLO_write_struct(writer, bDeformGroup, defgroup); + } +} + +static void write_fmaps(BlendWriter *writer, ListBase *fbase) +{ + LISTBASE_FOREACH (bFaceMap *, fmap, fbase) { + BLO_write_struct(writer, bFaceMap, fmap); + } +} + +static void object_blend_write(BlendWriter *writer, ID *id, const void *id_address) +{ + Object *ob = (Object *)id; + + const bool is_undo = BLO_write_is_undo(writer); + if (ob->id.us > 0 || is_undo) { + /* Clean up, important in undo case to reduce false detection of changed data-blocks. */ + BKE_object_runtime_reset(ob); + + if (is_undo) { + /* For undo we stay in object mode during undo presses, so keep edit-mode disabled on save as + * well, can help reducing false detection of changed data-blocks. */ + ob->mode &= ~OB_MODE_EDIT; + } + + /* write LibData */ + BLO_write_id_struct(writer, Object, id_address, &ob->id); + BKE_id_blend_write(writer, &ob->id); + + if (ob->adt) { + BKE_animdata_blend_write(writer, ob->adt); + } + + /* direct data */ + BLO_write_pointer_array(writer, ob->totcol, ob->mat); + BLO_write_raw(writer, sizeof(char) * ob->totcol, ob->matbits); + + bArmature *arm = NULL; + if (ob->type == OB_ARMATURE) { + arm = ob->data; + if (arm && ob->pose && arm->act_bone) { + BLI_strncpy( + ob->pose->proxy_act_bone, arm->act_bone->name, sizeof(ob->pose->proxy_act_bone)); + } + } + + BKE_pose_blend_write(writer, ob->pose, arm); + write_defgroups(writer, &ob->defbase); + write_fmaps(writer, &ob->fmaps); + BKE_constraint_blend_write(writer, &ob->constraints); + animviz_motionpath_blend_write(writer, ob->mpath); + + BLO_write_struct(writer, PartDeflect, ob->pd); + if (ob->soft) { + /* Set deprecated pointers to prevent crashes of older Blenders */ + ob->soft->pointcache = ob->soft->shared->pointcache; + ob->soft->ptcaches = ob->soft->shared->ptcaches; + BLO_write_struct(writer, SoftBody, ob->soft); + BLO_write_struct(writer, SoftBody_Shared, ob->soft->shared); + BKE_ptcache_blend_write(writer, &(ob->soft->shared->ptcaches)); + BLO_write_struct(writer, EffectorWeights, ob->soft->effector_weights); + } + + if (ob->rigidbody_object) { + /* TODO: if any extra data is added to handle duplis, will need separate function then */ + BLO_write_struct(writer, RigidBodyOb, ob->rigidbody_object); + } + if (ob->rigidbody_constraint) { + BLO_write_struct(writer, RigidBodyCon, ob->rigidbody_constraint); + } + + if (ob->type == OB_EMPTY && ob->empty_drawtype == OB_EMPTY_IMAGE) { + BLO_write_struct(writer, ImageUser, ob->iuser); + } + + BKE_particle_system_blend_write(writer, &ob->particlesystem); + BKE_modifier_blend_write(writer, &ob->modifiers); + BKE_gpencil_modifier_blend_write(writer, &ob->greasepencil_modifiers); + BKE_shaderfx_blend_write(writer, &ob->shader_fx); + + BLO_write_struct_list(writer, LinkData, &ob->pc_ids); + + BKE_previewimg_blend_write(writer, ob->preview); + } +} + +/* XXX deprecated - old animation system */ +static void direct_link_nlastrips(BlendDataReader *reader, ListBase *strips) +{ + BLO_read_list(reader, strips); + + LISTBASE_FOREACH (bActionStrip *, strip, strips) { + BLO_read_list(reader, &strip->modifiers); + } +} + +static void object_blend_read_data(BlendDataReader *reader, ID *id) +{ + Object *ob = (Object *)id; + + PartEff *paf; + + /* XXX This should not be needed - but seems like it can happen in some cases, + * so for now play safe. */ + ob->proxy_from = NULL; + + const bool is_undo = BLO_read_data_is_undo(reader); + if (ob->id.tag & (LIB_TAG_EXTERN | LIB_TAG_INDIRECT)) { + /* Do not allow any non-object mode for linked data. + * See T34776, T42780, T81027 for more information. */ + ob->mode &= ~OB_MODE_ALL_MODE_DATA; + } + else if (is_undo) { + /* For undo we want to stay in object mode during undo presses, so keep some edit modes + * disabled. + * TODO: Check if we should not disable more edit modes here? */ + ob->mode &= ~(OB_MODE_EDIT | OB_MODE_PARTICLE_EDIT); + } + + BLO_read_data_address(reader, &ob->adt); + BKE_animdata_blend_read_data(reader, ob->adt); + + BLO_read_data_address(reader, &ob->pose); + BKE_pose_blend_read_data(reader, ob->pose); + + BLO_read_data_address(reader, &ob->mpath); + if (ob->mpath) { + animviz_motionpath_blend_read_data(reader, ob->mpath); + } + + BLO_read_list(reader, &ob->defbase); + BLO_read_list(reader, &ob->fmaps); + /* XXX deprecated - old animation system <<< */ + direct_link_nlastrips(reader, &ob->nlastrips); + BLO_read_list(reader, &ob->constraintChannels); + /* >>> XXX deprecated - old animation system */ + + BLO_read_pointer_array(reader, (void **)&ob->mat); + BLO_read_data_address(reader, &ob->matbits); + + /* do it here, below old data gets converted */ + BKE_modifier_blend_read_data(reader, &ob->modifiers, ob); + BKE_gpencil_modifier_blend_read_data(reader, &ob->greasepencil_modifiers); + BKE_shaderfx_blend_read_data(reader, &ob->shader_fx); + + BLO_read_list(reader, &ob->effect); + paf = ob->effect.first; + while (paf) { + if (paf->type == EFF_PARTICLE) { + paf->keys = NULL; + } + if (paf->type == EFF_WAVE) { + WaveEff *wav = (WaveEff *)paf; + PartEff *next = paf->next; + WaveModifierData *wmd = (WaveModifierData *)BKE_modifier_new(eModifierType_Wave); + + wmd->damp = wav->damp; + wmd->flag = wav->flag; + wmd->height = wav->height; + wmd->lifetime = wav->lifetime; + wmd->narrow = wav->narrow; + wmd->speed = wav->speed; + wmd->startx = wav->startx; + wmd->starty = wav->startx; + wmd->timeoffs = wav->timeoffs; + wmd->width = wav->width; + + BLI_addtail(&ob->modifiers, wmd); + + BLI_remlink(&ob->effect, paf); + MEM_freeN(paf); + + paf = next; + continue; + } + if (paf->type == EFF_BUILD) { + BuildEff *baf = (BuildEff *)paf; + PartEff *next = paf->next; + BuildModifierData *bmd = (BuildModifierData *)BKE_modifier_new(eModifierType_Build); + + bmd->start = baf->sfra; + bmd->length = baf->len; + bmd->randomize = 0; + bmd->seed = 1; + + BLI_addtail(&ob->modifiers, bmd); + + BLI_remlink(&ob->effect, paf); + MEM_freeN(paf); + + paf = next; + continue; + } + paf = paf->next; + } + + BLO_read_data_address(reader, &ob->pd); + BKE_particle_partdeflect_blend_read_data(reader, ob->pd); + BLO_read_data_address(reader, &ob->soft); + if (ob->soft) { + SoftBody *sb = ob->soft; + + sb->bpoint = NULL; /* init pointers so it gets rebuilt nicely */ + sb->bspring = NULL; + sb->scratch = NULL; + /* although not used anymore */ + /* still have to be loaded to be compatible with old files */ + BLO_read_pointer_array(reader, (void **)&sb->keys); + if (sb->keys) { + for (int a = 0; a < sb->totkey; a++) { + BLO_read_data_address(reader, &sb->keys[a]); + } + } + + BLO_read_data_address(reader, &sb->effector_weights); + if (!sb->effector_weights) { + sb->effector_weights = BKE_effector_add_weights(NULL); + } + + BLO_read_data_address(reader, &sb->shared); + if (sb->shared == NULL) { + /* Link deprecated caches if they exist, so we can use them for versioning. + * We should only do this when sb->shared == NULL, because those pointers + * are always set (for compatibility with older Blenders). We mustn't link + * the same pointcache twice. */ + BKE_ptcache_blend_read_data(reader, &sb->ptcaches, &sb->pointcache, false); + } + else { + /* link caches */ + BKE_ptcache_blend_read_data(reader, &sb->shared->ptcaches, &sb->shared->pointcache, false); + } + } + BLO_read_data_address(reader, &ob->fluidsimSettings); /* NT */ + + BLO_read_data_address(reader, &ob->rigidbody_object); + if (ob->rigidbody_object) { + RigidBodyOb *rbo = ob->rigidbody_object; + /* Allocate runtime-only struct */ + rbo->shared = MEM_callocN(sizeof(*rbo->shared), "RigidBodyObShared"); + } + BLO_read_data_address(reader, &ob->rigidbody_constraint); + if (ob->rigidbody_constraint) { + ob->rigidbody_constraint->physics_constraint = NULL; + } + + BLO_read_list(reader, &ob->particlesystem); + BKE_particle_system_blend_read_data(reader, &ob->particlesystem); + + BKE_constraint_blend_read_data(reader, &ob->constraints); + + BLO_read_list(reader, &ob->hooks); + while (ob->hooks.first) { + ObHook *hook = ob->hooks.first; + HookModifierData *hmd = (HookModifierData *)BKE_modifier_new(eModifierType_Hook); + + BLO_read_int32_array(reader, hook->totindex, &hook->indexar); + + /* Do conversion here because if we have loaded + * a hook we need to make sure it gets converted + * and freed, regardless of version. + */ + copy_v3_v3(hmd->cent, hook->cent); + hmd->falloff = hook->falloff; + hmd->force = hook->force; + hmd->indexar = hook->indexar; + hmd->object = hook->parent; + memcpy(hmd->parentinv, hook->parentinv, sizeof(hmd->parentinv)); + hmd->totindex = hook->totindex; + + BLI_addhead(&ob->modifiers, hmd); + BLI_remlink(&ob->hooks, hook); + + BKE_modifier_unique_name(&ob->modifiers, (ModifierData *)hmd); + + MEM_freeN(hook); + } + + BLO_read_data_address(reader, &ob->iuser); + if (ob->type == OB_EMPTY && ob->empty_drawtype == OB_EMPTY_IMAGE && !ob->iuser) { + BKE_object_empty_draw_type_set(ob, ob->empty_drawtype); + } + + BKE_object_runtime_reset(ob); + BLO_read_list(reader, &ob->pc_ids); + + /* in case this value changes in future, clamp else we get undefined behavior */ + CLAMP(ob->rotmode, ROT_MODE_MIN, ROT_MODE_MAX); + + if (ob->sculpt) { + ob->sculpt = NULL; + /* Only create data on undo, otherwise rely on editor mode switching. */ + if (BLO_read_data_is_undo(reader) && (ob->mode & OB_MODE_ALL_SCULPT)) { + BKE_object_sculpt_data_create(ob); + } + } + + BLO_read_data_address(reader, &ob->preview); + BKE_previewimg_blend_read(reader, ob->preview); +} + +/* XXX deprecated - old animation system */ +static void lib_link_nlastrips(BlendLibReader *reader, ID *id, ListBase *striplist) +{ + LISTBASE_FOREACH (bActionStrip *, strip, striplist) { + BLO_read_id_address(reader, id->lib, &strip->object); + BLO_read_id_address(reader, id->lib, &strip->act); + BLO_read_id_address(reader, id->lib, &strip->ipo); + LISTBASE_FOREACH (bActionModifier *, amod, &strip->modifiers) { + BLO_read_id_address(reader, id->lib, &amod->ob); + } + } +} + +/* XXX deprecated - old animation system */ +static void lib_link_constraint_channels(BlendLibReader *reader, ID *id, ListBase *chanbase) +{ + LISTBASE_FOREACH (bConstraintChannel *, chan, chanbase) { + BLO_read_id_address(reader, id->lib, &chan->ipo); + } +} + +static void object_blend_read_lib(BlendLibReader *reader, ID *id) +{ + Object *ob = (Object *)id; + + bool warn = false; + + /* XXX deprecated - old animation system <<< */ + BLO_read_id_address(reader, ob->id.lib, &ob->ipo); + BLO_read_id_address(reader, ob->id.lib, &ob->action); + /* >>> XXX deprecated - old animation system */ + + BLO_read_id_address(reader, ob->id.lib, &ob->parent); + BLO_read_id_address(reader, ob->id.lib, &ob->track); + BLO_read_id_address(reader, ob->id.lib, &ob->poselib); + + /* 2.8x drops support for non-empty dupli instances. */ + if (ob->type == OB_EMPTY) { + BLO_read_id_address(reader, ob->id.lib, &ob->instance_collection); + } + else { + if (ob->instance_collection != NULL) { + ID *new_id = BLO_read_get_new_id_address(reader, ob->id.lib, &ob->instance_collection->id); + BLO_reportf_wrap(BLO_read_lib_reports(reader), + RPT_WARNING, + TIP_("Non-Empty object '%s' cannot duplicate collection '%s' " + "anymore in Blender 2.80, removed instancing"), + ob->id.name + 2, + new_id->name + 2); + } + ob->instance_collection = NULL; + ob->transflag &= ~OB_DUPLICOLLECTION; + } + + BLO_read_id_address(reader, ob->id.lib, &ob->proxy); + if (ob->proxy) { + /* paranoia check, actually a proxy_from pointer should never be written... */ + if (ob->proxy->id.lib == NULL) { + ob->proxy->proxy_from = NULL; + ob->proxy = NULL; + + if (ob->id.lib) { + printf("Proxy lost from object %s lib %s\n", ob->id.name + 2, ob->id.lib->filepath); + } + else { + printf("Proxy lost from object %s lib <NONE>\n", ob->id.name + 2); + } + } + else { + /* this triggers object_update to always use a copy */ + ob->proxy->proxy_from = ob; + } + } + BLO_read_id_address(reader, ob->id.lib, &ob->proxy_group); + + void *poin = ob->data; + BLO_read_id_address(reader, ob->id.lib, &ob->data); + + if (ob->data == NULL && poin != NULL) { + if (ob->id.lib) { + printf("Can't find obdata of %s lib %s\n", ob->id.name + 2, ob->id.lib->filepath); + } + else { + printf("Object %s lost data.\n", ob->id.name + 2); + } + + ob->type = OB_EMPTY; + warn = true; + + if (ob->pose) { + /* we can't call #BKE_pose_free() here because of library linking + * freeing will recurse down into every pose constraints ID pointers + * which are not always valid, so for now free directly and suffer + * some leaked memory rather than crashing immediately + * while bad this _is_ an exceptional case - campbell */ +#if 0 + BKE_pose_free(ob->pose); +#else + MEM_freeN(ob->pose); +#endif + ob->pose = NULL; + ob->mode &= ~OB_MODE_POSE; + } + } + for (int a = 0; a < ob->totcol; a++) { + BLO_read_id_address(reader, ob->id.lib, &ob->mat[a]); + } + + /* When the object is local and the data is library its possible + * the material list size gets out of sync. T22663. */ + if (ob->data && ob->id.lib != ((ID *)ob->data)->lib) { + const short *totcol_data = BKE_object_material_len_p(ob); + /* Only expand so as not to lose any object materials that might be set. */ + if (totcol_data && (*totcol_data > ob->totcol)) { + /* printf("'%s' %d -> %d\n", ob->id.name, ob->totcol, *totcol_data); */ + BKE_object_material_resize(BLO_read_lib_get_main(reader), ob, *totcol_data, false); + } + } + + BLO_read_id_address(reader, ob->id.lib, &ob->gpd); + + /* if id.us==0 a new base will be created later on */ + + /* WARNING! Also check expand_object(), should reflect the stuff below. */ + BKE_pose_blend_read_lib(reader, ob, ob->pose); + BKE_constraint_blend_read_lib(reader, &ob->id, &ob->constraints); + + /* XXX deprecated - old animation system <<< */ + lib_link_constraint_channels(reader, &ob->id, &ob->constraintChannels); + lib_link_nlastrips(reader, &ob->id, &ob->nlastrips); + /* >>> XXX deprecated - old animation system */ + + LISTBASE_FOREACH (PartEff *, paf, &ob->effect) { + if (paf->type == EFF_PARTICLE) { + BLO_read_id_address(reader, ob->id.lib, &paf->group); + } + } + + { + FluidsimModifierData *fluidmd = (FluidsimModifierData *)BKE_modifiers_findby_type( + ob, eModifierType_Fluidsim); + + if (fluidmd && fluidmd->fss) { + BLO_read_id_address( + reader, ob->id.lib, &fluidmd->fss->ipo); /* XXX deprecated - old animation system */ + } + } + + { + FluidModifierData *fmd = (FluidModifierData *)BKE_modifiers_findby_type(ob, + eModifierType_Fluid); + + if (fmd && (fmd->type == MOD_FLUID_TYPE_DOMAIN) && fmd->domain) { + /* Flag for refreshing the simulation after loading */ + fmd->domain->flags |= FLUID_DOMAIN_FILE_LOAD; + } + else if (fmd && (fmd->type == MOD_FLUID_TYPE_FLOW) && fmd->flow) { + fmd->flow->flags &= ~FLUID_FLOW_NEEDS_UPDATE; + } + else if (fmd && (fmd->type == MOD_FLUID_TYPE_EFFEC) && fmd->effector) { + fmd->effector->flags &= ~FLUID_EFFECTOR_NEEDS_UPDATE; + } + } + + /* texture field */ + if (ob->pd) { + BKE_particle_partdeflect_blend_read_lib(reader, &ob->id, ob->pd); + } + + if (ob->soft) { + BLO_read_id_address(reader, ob->id.lib, &ob->soft->collision_group); + + BLO_read_id_address(reader, ob->id.lib, &ob->soft->effector_weights->group); + } + + BKE_particle_system_blend_read_lib(reader, ob, &ob->id, &ob->particlesystem); + BKE_modifier_blend_read_lib(reader, ob); + BKE_gpencil_modifier_blend_read_lib(reader, ob); + BKE_shaderfx_blend_read_lib(reader, ob); + + if (ob->rigidbody_constraint) { + BLO_read_id_address(reader, ob->id.lib, &ob->rigidbody_constraint->ob1); + BLO_read_id_address(reader, ob->id.lib, &ob->rigidbody_constraint->ob2); + } + + if (warn) { + BLO_reportf_wrap(BLO_read_lib_reports(reader), RPT_WARNING, "Warning in console"); + } +} + +/* XXX deprecated - old animation system */ +static void expand_constraint_channels(BlendExpander *expander, ListBase *chanbase) +{ + LISTBASE_FOREACH (bConstraintChannel *, chan, chanbase) { + BLO_expand(expander, chan->ipo); + } +} + +static void expand_object_expandModifiers(void *userData, + Object *UNUSED(ob), + ID **idpoin, + int UNUSED(cb_flag)) +{ + BlendExpander *expander = userData; + BLO_expand(expander, *idpoin); +} + +PartEff *BKE_object_do_version_give_parteff_245(Object *ob) +{ + PartEff *paf; + + paf = ob->effect.first; + while (paf) { + if (paf->type == EFF_PARTICLE) { + return paf; + } + paf = paf->next; + } + return NULL; +} + +static void object_blend_read_expand(BlendExpander *expander, ID *id) +{ + Object *ob = (Object *)id; + + BLO_expand(expander, ob->data); + + /* expand_object_expandModifier() */ + if (ob->modifiers.first) { + BKE_modifiers_foreach_ID_link(ob, expand_object_expandModifiers, expander); + } + + /* expand_object_expandModifier() */ + if (ob->greasepencil_modifiers.first) { + BKE_gpencil_modifiers_foreach_ID_link(ob, expand_object_expandModifiers, expander); + } + + /* expand_object_expandShaderFx() */ + if (ob->shader_fx.first) { + BKE_shaderfx_foreach_ID_link(ob, expand_object_expandModifiers, expander); + } + + BKE_pose_blend_read_expand(expander, ob->pose); + BLO_expand(expander, ob->poselib); + BKE_constraint_blend_read_expand(expander, &ob->constraints); + + BLO_expand(expander, ob->gpd); + + /* XXX deprecated - old animation system (for version patching only) */ + BLO_expand(expander, ob->ipo); + BLO_expand(expander, ob->action); + + expand_constraint_channels(expander, &ob->constraintChannels); + + LISTBASE_FOREACH (bActionStrip *, strip, &ob->nlastrips) { + BLO_expand(expander, strip->object); + BLO_expand(expander, strip->act); + BLO_expand(expander, strip->ipo); + } + /* XXX deprecated - old animation system (for version patching only) */ + + for (int a = 0; a < ob->totcol; a++) { + BLO_expand(expander, ob->mat[a]); + } + + PartEff *paf = BKE_object_do_version_give_parteff_245(ob); + if (paf && paf->group) { + BLO_expand(expander, paf->group); + } + + if (ob->instance_collection) { + BLO_expand(expander, ob->instance_collection); + } + + if (ob->proxy) { + BLO_expand(expander, ob->proxy); + } + if (ob->proxy_group) { + BLO_expand(expander, ob->proxy_group); + } + + LISTBASE_FOREACH (ParticleSystem *, psys, &ob->particlesystem) { + BLO_expand(expander, psys->part); + } + + if (ob->pd) { + BLO_expand(expander, ob->pd->tex); + BLO_expand(expander, ob->pd->f_source); + } + + if (ob->soft) { + BLO_expand(expander, ob->soft->collision_group); + + if (ob->soft->effector_weights) { + BLO_expand(expander, ob->soft->effector_weights->group); + } + } + + if (ob->rigidbody_constraint) { + BLO_expand(expander, ob->rigidbody_constraint->ob1); + BLO_expand(expander, ob->rigidbody_constraint->ob2); + } +} + IDTypeInfo IDType_ID_OB = { .id_code = ID_OB, .id_filter = FILTER_ID_OB, @@ -534,10 +1150,10 @@ IDTypeInfo IDType_ID_OB = { .foreach_id = object_foreach_id, .foreach_cache = NULL, - .blend_write = NULL, - .blend_read_data = NULL, - .blend_read_lib = NULL, - .blend_read_expand = NULL, + .blend_write = object_blend_write, + .blend_read_data = object_blend_read_data, + .blend_read_lib = object_blend_read_lib, + .blend_read_expand = object_blend_read_expand, .blend_read_undo_preserve = NULL, }; @@ -4807,3 +5423,16 @@ void BKE_object_check_uuids_unique_and_report(const Object *object) BKE_pose_check_uuids_unique_and_report(object->pose); BKE_modifier_check_uuids_unique_and_report(object); } + +void BKE_object_modifiers_lib_link_common(void *userData, + struct Object *ob, + struct ID **idpoin, + int cb_flag) +{ + BlendLibReader *reader = userData; + + BLO_read_id_address(reader, ob->id.lib, idpoin); + if (*idpoin != NULL && (cb_flag & IDWALK_CB_USER) != 0) { + id_us_plus_no_lib(*idpoin); + } +} diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index f2af5520d16..d726a4b1e37 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -1176,6 +1176,56 @@ void BKE_paint_stroke_get_average(Scene *scene, Object *ob, float stroke[3]) } } +void BKE_paint_blend_write(BlendWriter *writer, Paint *p) +{ + if (p->cavity_curve) { + BKE_curvemapping_blend_write(writer, p->cavity_curve); + } + BLO_write_struct_array(writer, PaintToolSlot, p->tool_slots_len, p->tool_slots); +} + +void BKE_paint_blend_read_data(BlendDataReader *reader, const Scene *scene, Paint *p) +{ + if (p->num_input_samples < 1) { + p->num_input_samples = 1; + } + + BLO_read_data_address(reader, &p->cavity_curve); + if (p->cavity_curve) { + BKE_curvemapping_blend_read(reader, p->cavity_curve); + } + else { + BKE_paint_cavity_curve_preset(p, CURVE_PRESET_LINE); + } + + BLO_read_data_address(reader, &p->tool_slots); + + /* Workaround for invalid data written in older versions. */ + const size_t expected_size = sizeof(PaintToolSlot) * p->tool_slots_len; + if (p->tool_slots && MEM_allocN_len(p->tool_slots) < expected_size) { + MEM_freeN(p->tool_slots); + p->tool_slots = MEM_callocN(expected_size, "PaintToolSlot"); + } + + BKE_paint_runtime_init(scene->toolsettings, p); +} + +void BKE_paint_blend_read_lib(BlendLibReader *reader, Scene *sce, Paint *p) +{ + if (p) { + BLO_read_id_address(reader, sce->id.lib, &p->brush); + for (int i = 0; i < p->tool_slots_len; i++) { + if (p->tool_slots[i].brush != NULL) { + BLO_read_id_address(reader, sce->id.lib, &p->tool_slots[i].brush); + } + } + BLO_read_id_address(reader, sce->id.lib, &p->palette); + p->paint_cursor = NULL; + + BKE_paint_runtime_init(sce->toolsettings, p); + } +} + /* returns non-zero if any of the face's vertices * are hidden, zero otherwise */ bool paint_is_face_hidden(const MLoopTri *lt, const MVert *mvert, const MLoop *mloop) diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index d323849d72d..222325727c1 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -32,6 +32,7 @@ #include "DNA_defaults.h" +#include "DNA_cloth_types.h" #include "DNA_collection_types.h" #include "DNA_curve_types.h" #include "DNA_dynamicpaint_types.h" @@ -5239,3 +5240,172 @@ void BKE_particle_batch_cache_free(ParticleSystem *psys) BKE_particle_batch_cache_free_cb(psys); } } + +void BKE_particle_system_blend_write(BlendWriter *writer, ListBase *particles) +{ + LISTBASE_FOREACH (ParticleSystem *, psys, particles) { + BLO_write_struct(writer, ParticleSystem, psys); + + if (psys->particles) { + BLO_write_struct_array(writer, ParticleData, psys->totpart, psys->particles); + + if (psys->particles->hair) { + ParticleData *pa = psys->particles; + + for (int a = 0; a < psys->totpart; a++, pa++) { + BLO_write_struct_array(writer, HairKey, pa->totkey, pa->hair); + } + } + + if (psys->particles->boid && (psys->part->phystype == PART_PHYS_BOIDS)) { + BLO_write_struct_array(writer, BoidParticle, psys->totpart, psys->particles->boid); + } + + if (psys->part->fluid && (psys->part->phystype == PART_PHYS_FLUID) && + (psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS)) { + BLO_write_struct_array( + writer, ParticleSpring, psys->tot_fluidsprings, psys->fluid_springs); + } + } + LISTBASE_FOREACH (ParticleTarget *, pt, &psys->targets) { + BLO_write_struct(writer, ParticleTarget, pt); + } + + if (psys->child) { + BLO_write_struct_array(writer, ChildParticle, psys->totchild, psys->child); + } + + if (psys->clmd) { + BLO_write_struct(writer, ClothModifierData, psys->clmd); + BLO_write_struct(writer, ClothSimSettings, psys->clmd->sim_parms); + BLO_write_struct(writer, ClothCollSettings, psys->clmd->coll_parms); + } + + BKE_ptcache_blend_write(writer, &psys->ptcaches); + } +} + +void BKE_particle_system_blend_read_data(BlendDataReader *reader, ListBase *particles) +{ + ParticleData *pa; + int a; + + LISTBASE_FOREACH (ParticleSystem *, psys, particles) { + BLO_read_data_address(reader, &psys->particles); + + if (psys->particles && psys->particles->hair) { + for (a = 0, pa = psys->particles; a < psys->totpart; a++, pa++) { + BLO_read_data_address(reader, &pa->hair); + } + } + + if (psys->particles && psys->particles->keys) { + for (a = 0, pa = psys->particles; a < psys->totpart; a++, pa++) { + pa->keys = NULL; + pa->totkey = 0; + } + + psys->flag &= ~PSYS_KEYED; + } + + if (psys->particles && psys->particles->boid) { + pa = psys->particles; + BLO_read_data_address(reader, &pa->boid); + + /* This is purely runtime data, but still can be an issue if left dangling. */ + pa->boid->ground = NULL; + + for (a = 1, pa++; a < psys->totpart; a++, pa++) { + pa->boid = (pa - 1)->boid + 1; + pa->boid->ground = NULL; + } + } + else if (psys->particles) { + for (a = 0, pa = psys->particles; a < psys->totpart; a++, pa++) { + pa->boid = NULL; + } + } + + BLO_read_data_address(reader, &psys->fluid_springs); + + BLO_read_data_address(reader, &psys->child); + psys->effectors = NULL; + + BLO_read_list(reader, &psys->targets); + + psys->edit = NULL; + psys->free_edit = NULL; + psys->pathcache = NULL; + psys->childcache = NULL; + BLI_listbase_clear(&psys->pathcachebufs); + BLI_listbase_clear(&psys->childcachebufs); + psys->pdd = NULL; + + if (psys->clmd) { + BLO_read_data_address(reader, &psys->clmd); + psys->clmd->clothObject = NULL; + psys->clmd->hairdata = NULL; + + BLO_read_data_address(reader, &psys->clmd->sim_parms); + BLO_read_data_address(reader, &psys->clmd->coll_parms); + + if (psys->clmd->sim_parms) { + psys->clmd->sim_parms->effector_weights = NULL; + if (psys->clmd->sim_parms->presets > 10) { + psys->clmd->sim_parms->presets = 0; + } + } + + psys->hair_in_mesh = psys->hair_out_mesh = NULL; + psys->clmd->solver_result = NULL; + } + + BKE_ptcache_blend_read_data(reader, &psys->ptcaches, &psys->pointcache, 0); + if (psys->clmd) { + psys->clmd->point_cache = psys->pointcache; + } + + psys->tree = NULL; + psys->bvhtree = NULL; + + psys->orig_psys = NULL; + psys->batch_cache = NULL; + } +} + +void BKE_particle_system_blend_read_lib(BlendLibReader *reader, + Object *ob, + ID *id, + ListBase *particles) +{ + LISTBASE_FOREACH_MUTABLE (ParticleSystem *, psys, particles) { + + BLO_read_id_address(reader, id->lib, &psys->part); + if (psys->part) { + LISTBASE_FOREACH (ParticleTarget *, pt, &psys->targets) { + BLO_read_id_address(reader, id->lib, &pt->ob); + } + + BLO_read_id_address(reader, id->lib, &psys->parent); + BLO_read_id_address(reader, id->lib, &psys->target_ob); + + if (psys->clmd) { + /* XXX - from reading existing code this seems correct but intended usage of + * pointcache /w cloth should be added in 'ParticleSystem' - campbell */ + psys->clmd->point_cache = psys->pointcache; + psys->clmd->ptcaches.first = psys->clmd->ptcaches.last = NULL; + BLO_read_id_address(reader, id->lib, &psys->clmd->coll_parms->group); + psys->clmd->modifier.error = NULL; + } + } + else { + /* particle modifier must be removed before particle system */ + ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys); + BLI_remlink(&ob->modifiers, psmd); + BKE_modifier_free((ModifierData *)psmd); + + BLI_remlink(particles, psys); + MEM_freeN(psys); + } + } +} diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 33b1c7a0ab3..069251e7e41 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -44,6 +44,7 @@ #include "DNA_simulation_types.h" #include "BLI_blenlib.h" +#include "BLI_endian_switch.h" #include "BLI_math.h" #include "BLI_string.h" #include "BLI_utildefines.h" @@ -67,6 +68,8 @@ #include "BKE_scene.h" #include "BKE_softbody.h" +#include "BLO_read_write.h" + #include "BIK_api.h" #ifdef WITH_BULLET @@ -3776,3 +3779,124 @@ void BKE_ptcache_invalidate(PointCache *cache) cache->last_exact = MIN2(cache->startframe, 0); } } + +static const char *ptcache_data_struct[] = { + "", // BPHYS_DATA_INDEX + "", // BPHYS_DATA_LOCATION + "", // BPHYS_DATA_VELOCITY + "", // BPHYS_DATA_ROTATION + "", // BPHYS_DATA_AVELOCITY / BPHYS_DATA_XCONST */ + "", // BPHYS_DATA_SIZE: + "", // BPHYS_DATA_TIMES: + "BoidData", // case BPHYS_DATA_BOIDS: +}; +static const char *ptcache_extra_struct[] = { + "", + "ParticleSpring", + "vec3f", +}; +void BKE_ptcache_blend_write(BlendWriter *writer, ListBase *ptcaches) +{ + LISTBASE_FOREACH (PointCache *, cache, ptcaches) { + BLO_write_struct(writer, PointCache, cache); + + if ((cache->flag & PTCACHE_DISK_CACHE) == 0) { + LISTBASE_FOREACH (PTCacheMem *, pm, &cache->mem_cache) { + BLO_write_struct(writer, PTCacheMem, pm); + + for (int i = 0; i < BPHYS_TOT_DATA; i++) { + if (pm->data[i] && pm->data_types & (1 << i)) { + if (ptcache_data_struct[i][0] == '\0') { + BLO_write_raw(writer, MEM_allocN_len(pm->data[i]), pm->data[i]); + } + else { + BLO_write_struct_array_by_name( + writer, ptcache_data_struct[i], pm->totpoint, pm->data[i]); + } + } + } + + LISTBASE_FOREACH (PTCacheExtra *, extra, &pm->extradata) { + if (ptcache_extra_struct[extra->type][0] == '\0') { + continue; + } + BLO_write_struct(writer, PTCacheExtra, extra); + BLO_write_struct_array_by_name( + writer, ptcache_extra_struct[extra->type], extra->totdata, extra->data); + } + } + } + } +} + +static void direct_link_pointcache_cb(BlendDataReader *reader, void *data) +{ + PTCacheMem *pm = data; + for (int i = 0; i < BPHYS_TOT_DATA; i++) { + BLO_read_data_address(reader, &pm->data[i]); + + /* the cache saves non-struct data without DNA */ + if (pm->data[i] && ptcache_data_struct[i][0] == '\0' && + BLO_read_requires_endian_switch(reader)) { + /* data_size returns bytes. */ + int tot = (BKE_ptcache_data_size(i) * pm->totpoint) / sizeof(int); + + int *poin = pm->data[i]; + + BLI_endian_switch_int32_array(poin, tot); + } + } + + BLO_read_list(reader, &pm->extradata); + + LISTBASE_FOREACH (PTCacheExtra *, extra, &pm->extradata) { + BLO_read_data_address(reader, &extra->data); + } +} + +static void direct_link_pointcache(BlendDataReader *reader, PointCache *cache) +{ + if ((cache->flag & PTCACHE_DISK_CACHE) == 0) { + BLO_read_list_cb(reader, &cache->mem_cache, direct_link_pointcache_cb); + } + else { + BLI_listbase_clear(&cache->mem_cache); + } + + cache->flag &= ~PTCACHE_SIMULATION_VALID; + cache->simframe = 0; + cache->edit = NULL; + cache->free_edit = NULL; + cache->cached_frames = NULL; + cache->cached_frames_len = 0; +} + +void BKE_ptcache_blend_read_data(BlendDataReader *reader, + ListBase *ptcaches, + PointCache **ocache, + int force_disk) +{ + if (ptcaches->first) { + BLO_read_list(reader, ptcaches); + LISTBASE_FOREACH (PointCache *, cache, ptcaches) { + direct_link_pointcache(reader, cache); + if (force_disk) { + cache->flag |= PTCACHE_DISK_CACHE; + cache->step = 1; + } + } + + BLO_read_data_address(reader, ocache); + } + else if (*ocache) { + /* old "single" caches need to be linked too */ + BLO_read_data_address(reader, ocache); + direct_link_pointcache(reader, *ocache); + if (force_disk) { + (*ocache)->flag |= PTCACHE_DISK_CACHE; + (*ocache)->step = 1; + } + + ptcaches->first = ptcaches->last = *ocache; + } +} diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 5153618d6e7..bed10df5ace 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -21,6 +21,9 @@ * \ingroup bke */ +/* Allow using deprecated functionality for .blend file I/O. */ +#define DNA_DEPRECATED_ALLOW + #include <stddef.h> #include <stdio.h> #include <string.h> @@ -70,6 +73,7 @@ #include "BKE_curveprofile.h" #include "BKE_duplilist.h" #include "BKE_editmesh.h" +#include "BKE_effect.h" #include "BKE_fcurve.h" #include "BKE_freestyle.h" #include "BKE_gpencil.h" @@ -87,6 +91,7 @@ #include "BKE_node.h" #include "BKE_object.h" #include "BKE_paint.h" +#include "BKE_pointcache.h" #include "BKE_rigidbody.h" #include "BKE_scene.h" #include "BKE_screen.h" @@ -785,6 +790,873 @@ static void scene_foreach_cache(ID *id, user_data); } +static void scene_blend_write(BlendWriter *writer, ID *id, const void *id_address) +{ + Scene *sce = (Scene *)id; + + if (BLO_write_is_undo(writer)) { + /* Clean up, important in undo case to reduce false detection of changed data-blocks. */ + /* XXX This UI data should not be stored in Scene at all... */ + memset(&sce->cursor, 0, sizeof(sce->cursor)); + } + + /* write LibData */ + BLO_write_id_struct(writer, Scene, id_address, &sce->id); + BKE_id_blend_write(writer, &sce->id); + + if (sce->adt) { + BKE_animdata_blend_write(writer, sce->adt); + } + BKE_keyingsets_blend_write(writer, &sce->keyingsets); + + /* direct data */ + ToolSettings *tos = sce->toolsettings; + BLO_write_struct(writer, ToolSettings, tos); + if (tos->vpaint) { + BLO_write_struct(writer, VPaint, tos->vpaint); + BKE_paint_blend_write(writer, &tos->vpaint->paint); + } + if (tos->wpaint) { + BLO_write_struct(writer, VPaint, tos->wpaint); + BKE_paint_blend_write(writer, &tos->wpaint->paint); + } + if (tos->sculpt) { + BLO_write_struct(writer, Sculpt, tos->sculpt); + BKE_paint_blend_write(writer, &tos->sculpt->paint); + } + if (tos->uvsculpt) { + BLO_write_struct(writer, UvSculpt, tos->uvsculpt); + BKE_paint_blend_write(writer, &tos->uvsculpt->paint); + } + if (tos->gp_paint) { + BLO_write_struct(writer, GpPaint, tos->gp_paint); + BKE_paint_blend_write(writer, &tos->gp_paint->paint); + } + if (tos->gp_vertexpaint) { + BLO_write_struct(writer, GpVertexPaint, tos->gp_vertexpaint); + BKE_paint_blend_write(writer, &tos->gp_vertexpaint->paint); + } + if (tos->gp_sculptpaint) { + BLO_write_struct(writer, GpSculptPaint, tos->gp_sculptpaint); + BKE_paint_blend_write(writer, &tos->gp_sculptpaint->paint); + } + if (tos->gp_weightpaint) { + BLO_write_struct(writer, GpWeightPaint, tos->gp_weightpaint); + BKE_paint_blend_write(writer, &tos->gp_weightpaint->paint); + } + /* write grease-pencil custom ipo curve to file */ + if (tos->gp_interpolate.custom_ipo) { + BKE_curvemapping_blend_write(writer, tos->gp_interpolate.custom_ipo); + } + /* write grease-pencil multiframe falloff curve to file */ + if (tos->gp_sculpt.cur_falloff) { + BKE_curvemapping_blend_write(writer, tos->gp_sculpt.cur_falloff); + } + /* write grease-pencil primitive curve to file */ + if (tos->gp_sculpt.cur_primitive) { + BKE_curvemapping_blend_write(writer, tos->gp_sculpt.cur_primitive); + } + /* Write the curve profile to the file. */ + if (tos->custom_bevel_profile_preset) { + BKE_curveprofile_blend_write(writer, tos->custom_bevel_profile_preset); + } + + BKE_paint_blend_write(writer, &tos->imapaint.paint); + + Editing *ed = sce->ed; + if (ed) { + Sequence *seq; + + BLO_write_struct(writer, Editing, ed); + + /* reset write flags too */ + + SEQ_ALL_BEGIN (ed, seq) { + if (seq->strip) { + seq->strip->done = false; + } + BLO_write_struct(writer, Sequence, seq); + } + SEQ_ALL_END; + + SEQ_ALL_BEGIN (ed, seq) { + if (seq->strip && seq->strip->done == 0) { + /* write strip with 'done' at 0 because readfile */ + + if (seq->effectdata) { + switch (seq->type) { + case SEQ_TYPE_COLOR: + BLO_write_struct(writer, SolidColorVars, seq->effectdata); + break; + case SEQ_TYPE_SPEED: + BLO_write_struct(writer, SpeedControlVars, seq->effectdata); + break; + case SEQ_TYPE_WIPE: + BLO_write_struct(writer, WipeVars, seq->effectdata); + break; + case SEQ_TYPE_GLOW: + BLO_write_struct(writer, GlowVars, seq->effectdata); + break; + case SEQ_TYPE_TRANSFORM: + BLO_write_struct(writer, TransformVars, seq->effectdata); + break; + case SEQ_TYPE_GAUSSIAN_BLUR: + BLO_write_struct(writer, GaussianBlurVars, seq->effectdata); + break; + case SEQ_TYPE_TEXT: + BLO_write_struct(writer, TextVars, seq->effectdata); + break; + case SEQ_TYPE_COLORMIX: + BLO_write_struct(writer, ColorMixVars, seq->effectdata); + break; + } + } + + BLO_write_struct(writer, Stereo3dFormat, seq->stereo3d_format); + + Strip *strip = seq->strip; + BLO_write_struct(writer, Strip, strip); + if (strip->crop) { + BLO_write_struct(writer, StripCrop, strip->crop); + } + if (strip->transform) { + BLO_write_struct(writer, StripTransform, strip->transform); + } + if (strip->proxy) { + BLO_write_struct(writer, StripProxy, strip->proxy); + } + if (seq->type == SEQ_TYPE_IMAGE) { + BLO_write_struct_array(writer, + StripElem, + MEM_allocN_len(strip->stripdata) / sizeof(struct StripElem), + strip->stripdata); + } + else if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) { + BLO_write_struct(writer, StripElem, strip->stripdata); + } + + strip->done = true; + } + + if (seq->prop) { + IDP_BlendWrite(writer, seq->prop); + } + + BKE_sequence_modifier_blend_write(writer, &seq->modifiers); + } + SEQ_ALL_END; + + /* new; meta stack too, even when its nasty restore code */ + LISTBASE_FOREACH (MetaStack *, ms, &ed->metastack) { + BLO_write_struct(writer, MetaStack, ms); + } + } + + if (sce->r.avicodecdata) { + BLO_write_struct(writer, AviCodecData, sce->r.avicodecdata); + if (sce->r.avicodecdata->lpFormat) { + BLO_write_raw(writer, (size_t)sce->r.avicodecdata->cbFormat, sce->r.avicodecdata->lpFormat); + } + if (sce->r.avicodecdata->lpParms) { + BLO_write_raw(writer, (size_t)sce->r.avicodecdata->cbParms, sce->r.avicodecdata->lpParms); + } + } + if (sce->r.ffcodecdata.properties) { + IDP_BlendWrite(writer, sce->r.ffcodecdata.properties); + } + + /* writing dynamic list of TimeMarkers to the blend file */ + LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) { + BLO_write_struct(writer, TimeMarker, marker); + + if (marker->prop != NULL) { + IDP_BlendWrite(writer, marker->prop); + } + } + + /* writing dynamic list of TransformOrientations to the blend file */ + LISTBASE_FOREACH (TransformOrientation *, ts, &sce->transform_spaces) { + BLO_write_struct(writer, TransformOrientation, ts); + } + + /* writing MultiView to the blend file */ + LISTBASE_FOREACH (SceneRenderView *, srv, &sce->r.views) { + BLO_write_struct(writer, SceneRenderView, srv); + } + + if (sce->nodetree) { + BLO_write_struct(writer, bNodeTree, sce->nodetree); + ntreeBlendWrite(writer, sce->nodetree); + } + + BKE_color_managed_view_settings_blend_write(writer, &sce->view_settings); + + /* writing RigidBodyWorld data to the blend file */ + if (sce->rigidbody_world) { + /* Set deprecated pointers to prevent crashes of older Blenders */ + sce->rigidbody_world->pointcache = sce->rigidbody_world->shared->pointcache; + sce->rigidbody_world->ptcaches = sce->rigidbody_world->shared->ptcaches; + BLO_write_struct(writer, RigidBodyWorld, sce->rigidbody_world); + + BLO_write_struct(writer, RigidBodyWorld_Shared, sce->rigidbody_world->shared); + BLO_write_struct(writer, EffectorWeights, sce->rigidbody_world->effector_weights); + BKE_ptcache_blend_write(writer, &(sce->rigidbody_world->shared->ptcaches)); + } + + BKE_previewimg_blend_write(writer, sce->preview); + BKE_curvemapping_curves_blend_write(writer, &sce->r.mblur_shutter_curve); + + LISTBASE_FOREACH (ViewLayer *, view_layer, &sce->view_layers) { + BKE_view_layer_blend_write(writer, view_layer); + } + + if (sce->master_collection) { + BLO_write_struct(writer, Collection, sce->master_collection); + BKE_collection_blend_write_nolib(writer, sce->master_collection); + } + + /* Eevee Lightcache */ + if (sce->eevee.light_cache_data && !BLO_write_is_undo(writer)) { + BLO_write_struct(writer, LightCache, sce->eevee.light_cache_data); + EEVEE_lightcache_blend_write(writer, sce->eevee.light_cache_data); + } + + BKE_screen_view3d_shading_blend_write(writer, &sce->display.shading); + + /* Freed on doversion. */ + BLI_assert(sce->layer_properties == NULL); +} + +static void direct_link_paint_helper(BlendDataReader *reader, const Scene *scene, Paint **paint) +{ + /* TODO. is this needed */ + BLO_read_data_address(reader, paint); + + if (*paint) { + BKE_paint_blend_read_data(reader, scene, *paint); + } +} + +static void link_recurs_seq(BlendDataReader *reader, ListBase *lb) +{ + BLO_read_list(reader, lb); + + LISTBASE_FOREACH (Sequence *, seq, lb) { + if (seq->seqbase.first) { + link_recurs_seq(reader, &seq->seqbase); + } + } +} + +static void scene_blend_read_data(BlendDataReader *reader, ID *id) +{ + Scene *sce = (Scene *)id; + + sce->depsgraph_hash = NULL; + sce->fps_info = NULL; + + memset(&sce->customdata_mask, 0, sizeof(sce->customdata_mask)); + memset(&sce->customdata_mask_modal, 0, sizeof(sce->customdata_mask_modal)); + + BKE_sound_reset_scene_runtime(sce); + + /* set users to one by default, not in lib-link, this will increase it for compo nodes */ + id_us_ensure_real(&sce->id); + + BLO_read_list(reader, &(sce->base)); + + BLO_read_data_address(reader, &sce->adt); + BKE_animdata_blend_read_data(reader, sce->adt); + + BLO_read_list(reader, &sce->keyingsets); + BKE_keyingsets_blend_read_data(reader, &sce->keyingsets); + + BLO_read_data_address(reader, &sce->basact); + + BLO_read_data_address(reader, &sce->toolsettings); + if (sce->toolsettings) { + + /* Reset last_location and last_hit, so they are not remembered across sessions. In some files + * these are also NaN, which could lead to crashes in painting. */ + struct UnifiedPaintSettings *ups = &sce->toolsettings->unified_paint_settings; + zero_v3(ups->last_location); + ups->last_hit = 0; + + direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->sculpt); + direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->vpaint); + direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->wpaint); + direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->uvsculpt); + direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->gp_paint); + direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->gp_vertexpaint); + direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->gp_sculptpaint); + direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->gp_weightpaint); + + BKE_paint_blend_read_data(reader, sce, &sce->toolsettings->imapaint.paint); + + sce->toolsettings->particle.paintcursor = NULL; + sce->toolsettings->particle.scene = NULL; + sce->toolsettings->particle.object = NULL; + sce->toolsettings->gp_sculpt.paintcursor = NULL; + + /* relink grease pencil interpolation curves */ + BLO_read_data_address(reader, &sce->toolsettings->gp_interpolate.custom_ipo); + if (sce->toolsettings->gp_interpolate.custom_ipo) { + BKE_curvemapping_blend_read(reader, sce->toolsettings->gp_interpolate.custom_ipo); + } + /* relink grease pencil multiframe falloff curve */ + BLO_read_data_address(reader, &sce->toolsettings->gp_sculpt.cur_falloff); + if (sce->toolsettings->gp_sculpt.cur_falloff) { + BKE_curvemapping_blend_read(reader, sce->toolsettings->gp_sculpt.cur_falloff); + } + /* relink grease pencil primitive curve */ + BLO_read_data_address(reader, &sce->toolsettings->gp_sculpt.cur_primitive); + if (sce->toolsettings->gp_sculpt.cur_primitive) { + BKE_curvemapping_blend_read(reader, sce->toolsettings->gp_sculpt.cur_primitive); + } + + /* Relink toolsettings curve profile */ + BLO_read_data_address(reader, &sce->toolsettings->custom_bevel_profile_preset); + if (sce->toolsettings->custom_bevel_profile_preset) { + BKE_curveprofile_blend_read(reader, sce->toolsettings->custom_bevel_profile_preset); + } + } + + if (sce->ed) { + ListBase *old_seqbasep = &sce->ed->seqbase; + + BLO_read_data_address(reader, &sce->ed); + Editing *ed = sce->ed; + + BLO_read_data_address(reader, &ed->act_seq); + ed->cache = NULL; + ed->prefetch_job = NULL; + + /* recursive link sequences, lb will be correctly initialized */ + link_recurs_seq(reader, &ed->seqbase); + + Sequence *seq; + SEQ_ALL_BEGIN (ed, seq) { + /* Do as early as possible, so that other parts of reading can rely on valid session UUID. */ + BKE_sequence_session_uuid_generate(seq); + + BLO_read_data_address(reader, &seq->seq1); + BLO_read_data_address(reader, &seq->seq2); + BLO_read_data_address(reader, &seq->seq3); + + /* a patch: after introduction of effects with 3 input strips */ + if (seq->seq3 == NULL) { + seq->seq3 = seq->seq2; + } + + BLO_read_data_address(reader, &seq->effectdata); + BLO_read_data_address(reader, &seq->stereo3d_format); + + if (seq->type & SEQ_TYPE_EFFECT) { + seq->flag |= SEQ_EFFECT_NOT_LOADED; + } + + if (seq->type == SEQ_TYPE_SPEED) { + SpeedControlVars *s = seq->effectdata; + s->frameMap = NULL; + } + + if (seq->type == SEQ_TYPE_TEXT) { + TextVars *t = seq->effectdata; + t->text_blf_id = SEQ_FONT_NOT_LOADED; + } + + BLO_read_data_address(reader, &seq->prop); + IDP_BlendDataRead(reader, &seq->prop); + + BLO_read_data_address(reader, &seq->strip); + if (seq->strip && seq->strip->done == 0) { + seq->strip->done = true; + + if (ELEM(seq->type, + SEQ_TYPE_IMAGE, + SEQ_TYPE_MOVIE, + SEQ_TYPE_SOUND_RAM, + SEQ_TYPE_SOUND_HD)) { + BLO_read_data_address(reader, &seq->strip->stripdata); + } + else { + seq->strip->stripdata = NULL; + } + BLO_read_data_address(reader, &seq->strip->crop); + BLO_read_data_address(reader, &seq->strip->transform); + BLO_read_data_address(reader, &seq->strip->proxy); + if (seq->strip->proxy) { + seq->strip->proxy->anim = NULL; + } + else if (seq->flag & SEQ_USE_PROXY) { + SEQ_proxy_set(seq, true); + } + + /* need to load color balance to it could be converted to modifier */ + BLO_read_data_address(reader, &seq->strip->color_balance); + } + + BKE_sequence_modifier_blend_read_data(reader, &seq->modifiers); + } + SEQ_ALL_END; + + /* link metastack, slight abuse of structs here, + * have to restore pointer to internal part in struct */ + { + Sequence temp; + void *poin; + intptr_t offset; + + offset = ((intptr_t) & (temp.seqbase)) - ((intptr_t)&temp); + + /* root pointer */ + if (ed->seqbasep == old_seqbasep) { + ed->seqbasep = &ed->seqbase; + } + else { + poin = POINTER_OFFSET(ed->seqbasep, -offset); + + poin = BLO_read_get_new_data_address(reader, poin); + + if (poin) { + ed->seqbasep = (ListBase *)POINTER_OFFSET(poin, offset); + } + else { + ed->seqbasep = &ed->seqbase; + } + } + /* stack */ + BLO_read_list(reader, &(ed->metastack)); + + LISTBASE_FOREACH (MetaStack *, ms, &ed->metastack) { + BLO_read_data_address(reader, &ms->parseq); + + if (ms->oldbasep == old_seqbasep) { + ms->oldbasep = &ed->seqbase; + } + else { + poin = POINTER_OFFSET(ms->oldbasep, -offset); + poin = BLO_read_get_new_data_address(reader, poin); + if (poin) { + ms->oldbasep = (ListBase *)POINTER_OFFSET(poin, offset); + } + else { + ms->oldbasep = &ed->seqbase; + } + } + } + } + } + +#ifdef DURIAN_CAMERA_SWITCH + /* Runtime */ + sce->r.mode &= ~R_NO_CAMERA_SWITCH; +#endif + + BLO_read_data_address(reader, &sce->r.avicodecdata); + if (sce->r.avicodecdata) { + BLO_read_data_address(reader, &sce->r.avicodecdata->lpFormat); + BLO_read_data_address(reader, &sce->r.avicodecdata->lpParms); + } + if (sce->r.ffcodecdata.properties) { + BLO_read_data_address(reader, &sce->r.ffcodecdata.properties); + IDP_BlendDataRead(reader, &sce->r.ffcodecdata.properties); + } + + BLO_read_list(reader, &(sce->markers)); + LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) { + BLO_read_data_address(reader, &marker->prop); + IDP_BlendDataRead(reader, &marker->prop); + } + + BLO_read_list(reader, &(sce->transform_spaces)); + BLO_read_list(reader, &(sce->r.layers)); + BLO_read_list(reader, &(sce->r.views)); + + LISTBASE_FOREACH (SceneRenderLayer *, srl, &sce->r.layers) { + BLO_read_data_address(reader, &srl->prop); + IDP_BlendDataRead(reader, &srl->prop); + BLO_read_list(reader, &(srl->freestyleConfig.modules)); + BLO_read_list(reader, &(srl->freestyleConfig.linesets)); + } + + BKE_color_managed_view_settings_blend_read_data(reader, &sce->view_settings); + + BLO_read_data_address(reader, &sce->rigidbody_world); + RigidBodyWorld *rbw = sce->rigidbody_world; + if (rbw) { + BLO_read_data_address(reader, &rbw->shared); + + if (rbw->shared == NULL) { + /* Link deprecated caches if they exist, so we can use them for versioning. + * We should only do this when rbw->shared == NULL, because those pointers + * are always set (for compatibility with older Blenders). We mustn't link + * the same pointcache twice. */ + BKE_ptcache_blend_read_data(reader, &rbw->ptcaches, &rbw->pointcache, false); + + /* make sure simulation starts from the beginning after loading file */ + if (rbw->pointcache) { + rbw->ltime = (float)rbw->pointcache->startframe; + } + } + else { + /* must nullify the reference to physics sim object, since it no-longer exist + * (and will need to be recalculated) + */ + rbw->shared->physics_world = NULL; + + /* link caches */ + BKE_ptcache_blend_read_data(reader, &rbw->shared->ptcaches, &rbw->shared->pointcache, false); + + /* make sure simulation starts from the beginning after loading file */ + if (rbw->shared->pointcache) { + rbw->ltime = (float)rbw->shared->pointcache->startframe; + } + } + rbw->objects = NULL; + rbw->numbodies = 0; + + /* set effector weights */ + BLO_read_data_address(reader, &rbw->effector_weights); + if (!rbw->effector_weights) { + rbw->effector_weights = BKE_effector_add_weights(NULL); + } + } + + BLO_read_data_address(reader, &sce->preview); + BKE_previewimg_blend_read(reader, sce->preview); + + BKE_curvemapping_blend_read(reader, &sce->r.mblur_shutter_curve); + +#ifdef USE_COLLECTION_COMPAT_28 + /* this runs before the very first doversion */ + if (sce->collection) { + BLO_read_data_address(reader, &sce->collection); + BKE_collection_compat_blend_read_data(reader, sce->collection); + } +#endif + + /* insert into global old-new map for reading without UI (link_global accesses it again) */ + BLO_read_glob_list(reader, &sce->view_layers); + LISTBASE_FOREACH (ViewLayer *, view_layer, &sce->view_layers) { + BKE_view_layer_blend_read_data(reader, view_layer); + } + + if (BLO_read_data_is_undo(reader)) { + /* If it's undo do nothing here, caches are handled by higher-level generic calling code. */ + } + else { + /* else try to read the cache from file. */ + BLO_read_data_address(reader, &sce->eevee.light_cache_data); + if (sce->eevee.light_cache_data) { + EEVEE_lightcache_blend_read_data(reader, sce->eevee.light_cache_data); + } + } + EEVEE_lightcache_info_update(&sce->eevee); + + BKE_screen_view3d_shading_blend_read_data(reader, &sce->display.shading); + + BLO_read_data_address(reader, &sce->layer_properties); + IDP_BlendDataRead(reader, &sce->layer_properties); +} + +/* patch for missing scene IDs, can't be in do-versions */ +static void composite_patch(bNodeTree *ntree, Scene *scene) +{ + + LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { + if (node->id == NULL && node->type == CMP_NODE_R_LAYERS) { + node->id = &scene->id; + } + } +} + +static void scene_blend_read_lib(BlendLibReader *reader, ID *id) +{ + Scene *sce = (Scene *)id; + + BKE_keyingsets_blend_read_lib(reader, &sce->id, &sce->keyingsets); + + BLO_read_id_address(reader, sce->id.lib, &sce->camera); + BLO_read_id_address(reader, sce->id.lib, &sce->world); + BLO_read_id_address(reader, sce->id.lib, &sce->set); + BLO_read_id_address(reader, sce->id.lib, &sce->gpd); + + BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->imapaint.paint); + if (sce->toolsettings->sculpt) { + BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->sculpt->paint); + } + if (sce->toolsettings->vpaint) { + BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->vpaint->paint); + } + if (sce->toolsettings->wpaint) { + BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->wpaint->paint); + } + if (sce->toolsettings->uvsculpt) { + BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->uvsculpt->paint); + } + if (sce->toolsettings->gp_paint) { + BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->gp_paint->paint); + } + if (sce->toolsettings->gp_vertexpaint) { + BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->gp_vertexpaint->paint); + } + if (sce->toolsettings->gp_sculptpaint) { + BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->gp_sculptpaint->paint); + } + if (sce->toolsettings->gp_weightpaint) { + BKE_paint_blend_read_lib(reader, sce, &sce->toolsettings->gp_weightpaint->paint); + } + + if (sce->toolsettings->sculpt) { + BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->sculpt->gravity_object); + } + + if (sce->toolsettings->imapaint.stencil) { + BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->imapaint.stencil); + } + + if (sce->toolsettings->imapaint.clone) { + BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->imapaint.clone); + } + + if (sce->toolsettings->imapaint.canvas) { + BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->imapaint.canvas); + } + + BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->particle.shape_object); + + BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->gp_sculpt.guide.reference_object); + + LISTBASE_FOREACH_MUTABLE (Base *, base_legacy, &sce->base) { + BLO_read_id_address(reader, sce->id.lib, &base_legacy->object); + + if (base_legacy->object == NULL) { + BLO_reportf_wrap(BLO_read_lib_reports(reader), + RPT_WARNING, + TIP_("LIB: object lost from scene: '%s'"), + sce->id.name + 2); + BLI_remlink(&sce->base, base_legacy); + if (base_legacy == sce->basact) { + sce->basact = NULL; + } + MEM_freeN(base_legacy); + } + } + + Sequence *seq; + SEQ_ALL_BEGIN (sce->ed, seq) { + IDP_BlendReadLib(reader, seq->prop); + + if (seq->ipo) { + BLO_read_id_address( + reader, sce->id.lib, &seq->ipo); /* XXX deprecated - old animation system */ + } + seq->scene_sound = NULL; + if (seq->scene) { + BLO_read_id_address(reader, sce->id.lib, &seq->scene); + seq->scene_sound = NULL; + } + if (seq->clip) { + BLO_read_id_address(reader, sce->id.lib, &seq->clip); + } + if (seq->mask) { + BLO_read_id_address(reader, sce->id.lib, &seq->mask); + } + if (seq->scene_camera) { + BLO_read_id_address(reader, sce->id.lib, &seq->scene_camera); + } + if (seq->sound) { + seq->scene_sound = NULL; + if (seq->type == SEQ_TYPE_SOUND_HD) { + seq->type = SEQ_TYPE_SOUND_RAM; + } + else { + BLO_read_id_address(reader, sce->id.lib, &seq->sound); + } + if (seq->sound) { + id_us_plus_no_lib((ID *)seq->sound); + seq->scene_sound = NULL; + } + } + if (seq->type == SEQ_TYPE_TEXT) { + TextVars *t = seq->effectdata; + BLO_read_id_address(reader, sce->id.lib, &t->text_font); + } + BLI_listbase_clear(&seq->anims); + + BKE_sequence_modifier_blend_read_lib(reader, sce, &seq->modifiers); + } + SEQ_ALL_END; + + LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) { + IDP_BlendReadLib(reader, marker->prop); + + if (marker->camera) { + BLO_read_id_address(reader, sce->id.lib, &marker->camera); + } + } + + /* rigidbody world relies on its linked collections */ + if (sce->rigidbody_world) { + RigidBodyWorld *rbw = sce->rigidbody_world; + if (rbw->group) { + BLO_read_id_address(reader, sce->id.lib, &rbw->group); + } + if (rbw->constraints) { + BLO_read_id_address(reader, sce->id.lib, &rbw->constraints); + } + if (rbw->effector_weights) { + BLO_read_id_address(reader, sce->id.lib, &rbw->effector_weights->group); + } + } + + if (sce->nodetree) { + composite_patch(sce->nodetree, sce); + } + + LISTBASE_FOREACH (SceneRenderLayer *, srl, &sce->r.layers) { + BLO_read_id_address(reader, sce->id.lib, &srl->mat_override); + LISTBASE_FOREACH (FreestyleModuleConfig *, fmc, &srl->freestyleConfig.modules) { + BLO_read_id_address(reader, sce->id.lib, &fmc->script); + } + LISTBASE_FOREACH (FreestyleLineSet *, fls, &srl->freestyleConfig.linesets) { + BLO_read_id_address(reader, sce->id.lib, &fls->linestyle); + BLO_read_id_address(reader, sce->id.lib, &fls->group); + } + } + /* Motion Tracking */ + BLO_read_id_address(reader, sce->id.lib, &sce->clip); + +#ifdef USE_COLLECTION_COMPAT_28 + if (sce->collection) { + BKE_collection_compat_blend_read_lib(reader, sce->id.lib, sce->collection); + } +#endif + + LISTBASE_FOREACH (ViewLayer *, view_layer, &sce->view_layers) { + BKE_view_layer_blend_read_lib(reader, sce->id.lib, view_layer); + } + + if (sce->r.bake.cage_object) { + BLO_read_id_address(reader, sce->id.lib, &sce->r.bake.cage_object); + } + +#ifdef USE_SETSCENE_CHECK + if (sce->set != NULL) { + sce->flag |= SCE_READFILE_LIBLINK_NEED_SETSCENE_CHECK; + } +#endif +} + +static void scene_blend_read_expand(BlendExpander *expander, ID *id) +{ + Scene *sce = (Scene *)id; + + LISTBASE_FOREACH (Base *, base_legacy, &sce->base) { + BLO_expand(expander, base_legacy->object); + } + BLO_expand(expander, sce->camera); + BLO_expand(expander, sce->world); + + BKE_keyingsets_blend_read_expand(expander, &sce->keyingsets); + + if (sce->set) { + BLO_expand(expander, sce->set); + } + + LISTBASE_FOREACH (SceneRenderLayer *, srl, &sce->r.layers) { + BLO_expand(expander, srl->mat_override); + LISTBASE_FOREACH (FreestyleModuleConfig *, module, &srl->freestyleConfig.modules) { + if (module->script) { + BLO_expand(expander, module->script); + } + } + LISTBASE_FOREACH (FreestyleLineSet *, lineset, &srl->freestyleConfig.linesets) { + if (lineset->group) { + BLO_expand(expander, lineset->group); + } + BLO_expand(expander, lineset->linestyle); + } + } + + LISTBASE_FOREACH (ViewLayer *, view_layer, &sce->view_layers) { + IDP_BlendReadExpand(expander, view_layer->id_properties); + + LISTBASE_FOREACH (FreestyleModuleConfig *, module, &view_layer->freestyle_config.modules) { + if (module->script) { + BLO_expand(expander, module->script); + } + } + + LISTBASE_FOREACH (FreestyleLineSet *, lineset, &view_layer->freestyle_config.linesets) { + if (lineset->group) { + BLO_expand(expander, lineset->group); + } + BLO_expand(expander, lineset->linestyle); + } + } + + if (sce->gpd) { + BLO_expand(expander, sce->gpd); + } + + if (sce->ed) { + Sequence *seq; + + SEQ_ALL_BEGIN (sce->ed, seq) { + IDP_BlendReadExpand(expander, seq->prop); + + if (seq->scene) { + BLO_expand(expander, seq->scene); + } + if (seq->scene_camera) { + BLO_expand(expander, seq->scene_camera); + } + if (seq->clip) { + BLO_expand(expander, seq->clip); + } + if (seq->mask) { + BLO_expand(expander, seq->mask); + } + if (seq->sound) { + BLO_expand(expander, seq->sound); + } + + if (seq->type == SEQ_TYPE_TEXT && seq->effectdata) { + TextVars *data = seq->effectdata; + BLO_expand(expander, data->text_font); + } + } + SEQ_ALL_END; + } + + if (sce->rigidbody_world) { + BLO_expand(expander, sce->rigidbody_world->group); + BLO_expand(expander, sce->rigidbody_world->constraints); + } + + LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) { + IDP_BlendReadExpand(expander, marker->prop); + + if (marker->camera) { + BLO_expand(expander, marker->camera); + } + } + + BLO_expand(expander, sce->clip); + +#ifdef USE_COLLECTION_COMPAT_28 + if (sce->collection) { + BKE_collection_compat_blend_read_expand(expander, sce->collection); + } +#endif + + if (sce->r.bake.cage_object) { + BLO_expand(expander, sce->r.bake.cage_object); + } +} + static void scene_undo_preserve(BlendLibReader *reader, ID *id_new, ID *id_old) { Scene *scene_new = (Scene *)id_new; @@ -820,10 +1692,10 @@ IDTypeInfo IDType_ID_SCE = { .foreach_id = scene_foreach_id, .foreach_cache = scene_foreach_cache, - .blend_write = NULL, - .blend_read_data = NULL, - .blend_read_lib = NULL, - .blend_read_expand = NULL, + .blend_write = scene_blend_write, + .blend_read_data = scene_blend_read_data, + .blend_read_lib = scene_blend_read_lib, + .blend_read_expand = scene_blend_read_expand, .blend_read_undo_preserve = scene_undo_preserve, }; diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 1b8360a1cec..568c0c6f567 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -254,6 +254,26 @@ static void screen_blend_write(BlendWriter *writer, ID *id, const void *id_addre } } +/* Cannot use IDTypeInfo callback yet, because of the return value. */ +bool BKE_screen_blend_read_data(BlendDataReader *reader, bScreen *screen) +{ + bool success = true; + + screen->regionbase.first = screen->regionbase.last = NULL; + screen->context = NULL; + screen->active_region = NULL; + + BLO_read_data_address(reader, &screen->preview); + BKE_previewimg_blend_read(reader, screen->preview); + + if (!BKE_screen_area_map_blend_read_data(reader, AREAMAP_FROM_SCREEN(screen))) { + printf("Error reading Screen %s... removing it.\n", screen->id.name + 2); + success = false; + } + + return success; +} + /* note: file read without screens option G_FILE_NO_UI; * check lib pointers in call below */ static void screen_blend_read_lib(BlendLibReader *reader, ID *id) diff --git a/source/blender/blenkernel/intern/shader_fx.c b/source/blender/blenkernel/intern/shader_fx.c index 2ae95492708..3727ec866ca 100644 --- a/source/blender/blenkernel/intern/shader_fx.c +++ b/source/blender/blenkernel/intern/shader_fx.c @@ -50,6 +50,8 @@ #include "FX_shader_types.h" +#include "BLO_read_write.h" + static ShaderFxTypeInfo *shader_fx_types[NUM_SHADER_FX_TYPES] = {NULL}; /* *************************************************** */ @@ -276,3 +278,45 @@ ShaderFxData *BKE_shaderfx_findby_name(Object *ob, const char *name) { return BLI_findstring(&(ob->shader_fx), name, offsetof(ShaderFxData, name)); } + +void BKE_shaderfx_blend_write(BlendWriter *writer, ListBase *fxbase) +{ + if (fxbase == NULL) { + return; + } + + LISTBASE_FOREACH (ShaderFxData *, fx, fxbase) { + const ShaderFxTypeInfo *fxi = BKE_shaderfx_get_info(fx->type); + if (fxi == NULL) { + return; + } + + BLO_write_struct_by_name(writer, fxi->struct_name, fx); + } +} + +void BKE_shaderfx_blend_read_data(BlendDataReader *reader, ListBase *lb) +{ + BLO_read_list(reader, lb); + + LISTBASE_FOREACH (ShaderFxData *, fx, lb) { + fx->error = NULL; + + /* if shader disappear, or for upward compatibility */ + if (NULL == BKE_shaderfx_get_info(fx->type)) { + fx->type = eShaderFxType_None; + } + } +} + +void BKE_shaderfx_blend_read_lib(BlendLibReader *reader, Object *ob) +{ + BKE_shaderfx_foreach_ID_link(ob, BKE_object_modifiers_lib_link_common, reader); + + /* If linking from a library, clear 'local' library override flag. */ + if (ob->id.lib != NULL) { + LISTBASE_FOREACH (ShaderFxData *, fx, &ob->shader_fx) { + fx->flag &= ~eShaderFxFlag_OverrideLibrary_Local; + } + } +} diff --git a/source/blender/blenkernel/intern/simulation.cc b/source/blender/blenkernel/intern/simulation.cc index 491cdbacd10..14e6ce63023 100644 --- a/source/blender/blenkernel/intern/simulation.cc +++ b/source/blender/blenkernel/intern/simulation.cc @@ -165,14 +165,14 @@ IDTypeInfo IDType_ID_SIM = { /* free_data */ simulation_free_data, /* make_local */ nullptr, /* foreach_id */ simulation_foreach_id, - /* foreach_cache */ NULL, + /* foreach_cache */ nullptr, /* blend_write */ simulation_blend_write, /* blend_read_data */ simulation_blend_read_data, /* blend_read_lib */ simulation_blend_read_lib, /* blend_read_expand */ simulation_blend_read_expand, - /* blend_read_undo_preserve */ NULL, + /* blend_read_undo_preserve */ nullptr, }; void *BKE_simulation_add(Main *bmain, const char *name) diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index 249a35a0af8..b55f80c6473 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -802,17 +802,12 @@ static char *find_next_negative(const char *str, const char *remaining_str) static char *find_next_op(const char *str, char *remaining_str, int len_max) { int i; - bool scientific_notation = false; for (i = 0; i < len_max; i++) { if (remaining_str[i] == '\0') { return remaining_str + i; } if (ch_is_op(remaining_str[i])) { - if (scientific_notation) { - scientific_notation = false; - } - /* Make sure we don't look backwards before the start of the string. */ if (remaining_str != str && i != 0) { /* Check for velocity or acceleration (e.g. '/' in 'ft/s' is not an op). */ @@ -823,7 +818,6 @@ static char *find_next_op(const char *str, char *remaining_str, int len_max) /* Check for scientific notation. */ if (ELEM(remaining_str[i - 1], 'e', 'E')) { - scientific_notation = true; continue; } diff --git a/source/blender/blenkernel/intern/volume.cc b/source/blender/blenkernel/intern/volume.cc index 9c60cb842ae..bcd71e39b21 100644 --- a/source/blender/blenkernel/intern/volume.cc +++ b/source/blender/blenkernel/intern/volume.cc @@ -265,12 +265,13 @@ static struct VolumeFileCache { struct VolumeGrid { VolumeGrid(const VolumeFileCache::Entry &template_entry, const int simplify_level) - : entry(NULL), simplify_level(simplify_level), is_loaded(false) + : entry(nullptr), simplify_level(simplify_level), is_loaded(false) { entry = GLOBAL_CACHE.add_metadata_user(template_entry); } - VolumeGrid(const openvdb::GridBase::Ptr &grid) : entry(NULL), local_grid(grid), is_loaded(true) + VolumeGrid(const openvdb::GridBase::Ptr &grid) + : entry(nullptr), local_grid(grid), is_loaded(true) { } @@ -295,7 +296,7 @@ struct VolumeGrid { void load(const char *volume_name, const char *filepath) { /* If already loaded or not file-backed, nothing to do. */ - if (is_loaded || entry == NULL) { + if (is_loaded || entry == nullptr) { return; } @@ -337,7 +338,7 @@ struct VolumeGrid { void unload(const char *volume_name) { /* Not loaded or not file-backed, nothing to do. */ - if (!is_loaded || entry == NULL) { + if (!is_loaded || entry == nullptr) { return; } @@ -364,7 +365,7 @@ struct VolumeGrid { local_grid = grid()->copyGridWithNewTree(); if (entry) { GLOBAL_CACHE.remove_user(*entry, is_loaded); - entry = NULL; + entry = nullptr; } is_loaded = true; } @@ -378,7 +379,7 @@ struct VolumeGrid { local_grid = grid()->deepCopyGrid(); if (entry) { GLOBAL_CACHE.remove_user(*entry, is_loaded); - entry = NULL; + entry = nullptr; } is_loaded = true; } @@ -398,7 +399,7 @@ struct VolumeGrid { return entry->error_msg.c_str(); } - return NULL; + return nullptr; } bool grid_is_loaded() const @@ -562,7 +563,7 @@ static void volume_blend_write(BlendWriter *writer, ID *id, const void *id_addre Volume *volume = (Volume *)id; if (volume->id.us > 0 || BLO_write_is_undo(writer)) { /* Clean up, important in undo case to reduce false detection of changed datablocks. */ - volume->runtime.grids = 0; + volume->runtime.grids = nullptr; /* write LibData */ BLO_write_id_struct(writer, Volume, id_address, &volume->id); @@ -634,13 +635,13 @@ IDTypeInfo IDType_ID_VO = { /* blend_read_lib */ volume_blend_read_lib, /* blend_read_expand */ volume_blend_read_expand, - /* blend_read_undo_preserve */ NULL, + /* blend_read_undo_preserve */ nullptr, }; void BKE_volume_init_grids(Volume *volume) { #ifdef WITH_OPENVDB - if (volume->runtime.grids == NULL) { + if (volume->runtime.grids == nullptr) { volume->runtime.grids = OBJECT_GUARDED_NEW(VolumeGridVector); } #else @@ -871,11 +872,11 @@ BoundBox *BKE_volume_boundbox_get(Object *ob) { BLI_assert(ob->type == OB_VOLUME); - if (ob->runtime.bb != NULL && (ob->runtime.bb->flag & BOUNDBOX_DIRTY) == 0) { + if (ob->runtime.bb != nullptr && (ob->runtime.bb->flag & BOUNDBOX_DIRTY) == 0) { return ob->runtime.bb; } - if (ob->runtime.bb == NULL) { + if (ob->runtime.bb == nullptr) { Volume *volume = (Volume *)ob->data; ob->runtime.bb = (BoundBox *)MEM_callocN(sizeof(BoundBox), "volume boundbox"); @@ -1006,7 +1007,7 @@ static Volume *volume_evaluate_modifiers(struct Depsgraph *depsgraph, if (volume_next && volume_next != volume) { /* If the modifier returned a new volume, release the old one. */ if (volume != volume_input) { - BKE_id_free(NULL, volume); + BKE_id_free(nullptr, volume); } volume = volume_next; } @@ -1057,7 +1058,7 @@ void BKE_volume_grids_backup_restore(Volume *volume, VolumeGridVector *grids, co /* Restore grids after datablock was re-copied from original by depsgraph, * we don't want to load them again if possible. */ BLI_assert(volume->id.tag & LIB_TAG_COPIED_ON_WRITE); - BLI_assert(volume->runtime.grids != NULL && grids != NULL); + BLI_assert(volume->runtime.grids != nullptr && grids != nullptr); if (!grids->is_loaded()) { /* No grids loaded in CoW datablock, nothing lost by discarding. */ @@ -1080,8 +1081,8 @@ void BKE_volume_grids_backup_restore(Volume *volume, VolumeGridVector *grids, co /* Draw Cache */ -void (*BKE_volume_batch_cache_dirty_tag_cb)(Volume *volume, int mode) = NULL; -void (*BKE_volume_batch_cache_free_cb)(Volume *volume) = NULL; +void (*BKE_volume_batch_cache_dirty_tag_cb)(Volume *volume, int mode) = nullptr; +void (*BKE_volume_batch_cache_free_cb)(Volume *volume) = nullptr; void BKE_volume_batch_cache_dirty_tag(Volume *volume, int mode) { @@ -1138,7 +1139,7 @@ VolumeGrid *BKE_volume_grid_get(const Volume *volume, int grid_index) return &grid; } } - return NULL; + return nullptr; #else UNUSED_VARS(volume, grid_index); return NULL; @@ -1149,7 +1150,7 @@ VolumeGrid *BKE_volume_grid_active_get(const Volume *volume) { const int num_grids = BKE_volume_num_grids(volume); if (num_grids == 0) { - return NULL; + return nullptr; } const int index = clamp_i(volume->active_grid, 0, num_grids - 1); @@ -1167,7 +1168,7 @@ VolumeGrid *BKE_volume_grid_find(const Volume *volume, const char *name) } } - return NULL; + return nullptr; } /* Grid Loading */ @@ -1352,7 +1353,7 @@ bool BKE_volume_grid_bounds(const VolumeGrid *volume_grid, float min[3], float m Volume *BKE_volume_new_for_eval(const Volume *volume_src) { - Volume *volume_dst = (Volume *)BKE_id_new_nomain(ID_VO, NULL); + Volume *volume_dst = (Volume *)BKE_id_new_nomain(ID_VO, nullptr); STRNCPY(volume_dst->id.name, volume_src->id.name); volume_dst->mat = (Material **)MEM_dupallocN(volume_src->mat); @@ -1372,7 +1373,7 @@ Volume *BKE_volume_copy_for_eval(Volume *volume_src, bool reference) flags |= LIB_ID_COPY_CD_REFERENCE; } - Volume *result = (Volume *)BKE_id_copy_ex(NULL, &volume_src->id, NULL, flags); + Volume *result = (Volume *)BKE_id_copy_ex(nullptr, &volume_src->id, nullptr, flags); return result; } @@ -1395,12 +1396,12 @@ VolumeGrid *BKE_volume_grid_add(Volume *volume, const char *name, VolumeGridType { #ifdef WITH_OPENVDB VolumeGridVector &grids = *volume->runtime.grids; - BLI_assert(BKE_volume_grid_find(volume, name) == NULL); + BLI_assert(BKE_volume_grid_find(volume, name) == nullptr); BLI_assert(type != VOLUME_GRID_UNKNOWN); openvdb::GridBase::Ptr vdb_grid = BKE_volume_grid_type_operation(type, CreateGridOp{}); if (!vdb_grid) { - return NULL; + return nullptr; } vdb_grid->setName(name); diff --git a/source/blender/blenkernel/intern/volume_render.cc b/source/blender/blenkernel/intern/volume_render.cc index 37b397a9c6d..55e04911d42 100644 --- a/source/blender/blenkernel/intern/volume_render.cc +++ b/source/blender/blenkernel/intern/volume_render.cc @@ -123,7 +123,7 @@ bool BKE_volume_grid_dense_floats(const Volume *volume, const int channels = BKE_volume_grid_channels(volume_grid); const int elem_size = sizeof(float) * channels; float *voxels = static_cast<float *>(MEM_malloc_arrayN(num_voxels, elem_size, __func__)); - if (voxels == NULL) { + if (voxels == nullptr) { return false; } @@ -143,7 +143,7 @@ bool BKE_volume_grid_dense_floats(const Volume *volume, void BKE_volume_dense_float_grid_clear(DenseFloatVolumeGrid *dense_grid) { - if (dense_grid->voxels != NULL) { + if (dense_grid->voxels != nullptr) { MEM_freeN(dense_grid->voxels); } } @@ -339,7 +339,7 @@ void BKE_volume_grid_wireframe(const Volume *volume, void *cb_userdata) { if (volume->display.wireframe_type == VOLUME_WIREFRAME_NONE) { - cb(cb_userdata, NULL, NULL, 0, 0); + cb(cb_userdata, nullptr, nullptr, 0, 0); return; } diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index a9a55b10a9e..c0a9ea91e75 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -358,6 +358,14 @@ bool isect_plane_plane_v3(const float plane_a[4], float r_isect_co[3], float r_isect_no[3]) ATTR_WARN_UNUSED_RESULT; +bool isect_planes_v3_fn( + const float planes[][4], + const int planes_len, + const float eps_coplanar, + const float eps_isect, + void (*callback_fn)(const float co[3], int i, int j, int k, void *user_data), + void *user_data); + /* line/ray triangle */ bool isect_line_segment_tri_v3(const float p1[3], const float p2[3], diff --git a/source/blender/blenlib/intern/delaunay_2d.cc b/source/blender/blenlib/intern/delaunay_2d.cc index 568a3206b18..daa006fd5cc 100644 --- a/source/blender/blenlib/intern/delaunay_2d.cc +++ b/source/blender/blenlib/intern/delaunay_2d.cc @@ -654,12 +654,12 @@ template<typename T> inline bool is_border_edge(const CDTEdge<T> *e, const CDT_s template<typename T> inline bool is_constrained_edge(const CDTEdge<T> *e) { - return e->input_ids != NULL; + return e->input_ids != nullptr; } template<typename T> inline bool is_deleted_edge(const CDTEdge<T> *e) { - return e->symedges[0].next == NULL; + return e->symedges[0].next == nullptr; } template<typename T> inline bool is_original_vert(const CDTVert<T> *v, CDT_state<T> *cdt) @@ -1386,8 +1386,8 @@ void fill_crossdata_for_through_vert(CDTVert<T> *v, cd_next->lambda = T(0); cd_next->vert = v; - cd_next->in = NULL; - cd_next->out = NULL; + cd_next->in = nullptr; + cd_next->out = nullptr; if (cd->lambda == 0) { cd->out = cd_out; } @@ -1630,10 +1630,10 @@ void add_edge_constraint( if (dbg_level > 0) { std::cout << "\nADD EDGE CONSTRAINT\n" << vertname(v1) << " " << vertname(v2) << "\n"; } - LinkNodePair edge_list = {NULL, NULL}; + LinkNodePair edge_list = {nullptr, nullptr}; if (r_edges) { - *r_edges = NULL; + *r_edges = nullptr; } /* @@ -1648,7 +1648,7 @@ void add_edge_constraint( if (t != nullptr) { /* Segment already there. */ add_to_input_ids(&t->edge->input_ids, input_id); - if (r_edges != NULL) { + if (r_edges != nullptr) { BLI_linklist_append(&edge_list, t->edge); *r_edges = edge_list.list; } @@ -1736,15 +1736,15 @@ void add_edge_constraint( SymEdge<T> *se; if (cd_prev->lambda == 0.0) { se = find_symedge_between_verts(cd_prev->vert, v); - if (se == NULL) { + if (se == nullptr) { return; } cd_prev->out = se; - cd->in = NULL; + cd->in = nullptr; } else { se = find_symedge_with_face(v, sym(cd_prev->in)->face); - if (se == NULL) { + if (se == nullptr) { return; } cd->in = se; @@ -1783,7 +1783,7 @@ void add_edge_constraint( if (cd->lambda == -1.0) { continue; /* This crossing was deleted. */ } - t = NULL; + t = nullptr; SymEdge<T> *tnext = t; CDTEdge<T> *edge; if (cd->lambda != 0.0) { @@ -1795,7 +1795,7 @@ void add_edge_constraint( else if (cd->lambda == 0.0) { t = cd->in; tnext = cd->out; - if (t == NULL) { + if (t == nullptr) { /* Previous non-deleted crossing must also have been a vert, and segment should exist. */ int j; CrossData<T> *cd_prev; @@ -1809,12 +1809,12 @@ void add_edge_constraint( BLI_assert(cd_prev->out->next->vert == cd->vert); edge = cd_prev->out->edge; add_to_input_ids(&edge->input_ids, input_id); - if (r_edges != NULL) { + if (r_edges != nullptr) { BLI_linklist_append(&edge_list, edge); } } } - if (t != NULL) { + if (t != nullptr) { if (tstart->next->vert == t->vert) { edge = tstart->edge; } @@ -1822,7 +1822,7 @@ void add_edge_constraint( edge = cdt_state->cdt.add_diagonal(tstart, t); } add_to_input_ids(&edge->input_ids, input_id); - if (r_edges != NULL) { + if (r_edges != nullptr) { BLI_linklist_append(&edge_list, edge); } /* Now retriangulate upper and lower gaps. */ @@ -1830,7 +1830,7 @@ void add_edge_constraint( re_delaunay_triangulate(&cdt_state->cdt, &edge->symedges[1]); } if (i < ncrossings - 1) { - if (tnext != NULL) { + if (tnext != nullptr) { tstart = tnext; } } @@ -2011,7 +2011,7 @@ template<typename T> void dissolve_symedge(CDT_state<T> *cdt_state, SymEdge<T> * if (ELEM(cdt->outer_face->symedge, se, symse)) { /* Advancing by 2 to get past possible 'sym(se)'. */ if (se->next->next == se) { - cdt->outer_face->symedge = NULL; + cdt->outer_face->symedge = nullptr; } else { cdt->outer_face->symedge = se->next->next; @@ -2177,9 +2177,9 @@ template<typename T> void remove_outer_edges_until_constraints(CDT_state<T> *cdt } se = se->next; } while (se != se_start); - while (to_dissolve != NULL) { + while (to_dissolve != nullptr) { se = static_cast<SymEdge<T> *>(BLI_linklist_pop(&to_dissolve)); - if (se->next != NULL) { + if (se->next != nullptr) { dissolve_symedge(cdt_state, se); } } diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 1d2480f4d62..2b0018e7662 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -2298,6 +2298,81 @@ bool isect_plane_plane_v3(const float plane_a[4], } /** + * Intersect all planes, calling `callback_fn` for each point that intersects + * 3 of the planes that isn't outside any of the other planes. + * + * This can be thought of as calculating a convex-hull from an array of planes. + * + * \param eps_coplanar: Epsilon for testing if two planes are aligned (co-planar). + * \param eps_isect: Epsilon for testing of a point is behind any of the planes. + * + * \warning As complexity is a little under `O(N^3)`, this is only suitable for small arrays. + * + * \note This function could be optimized by some spatial structure. + */ +bool isect_planes_v3_fn( + const float planes[][4], + const int planes_len, + const float eps_coplanar, + const float eps_isect, + void (*callback_fn)(const float co[3], int i, int j, int k, void *user_data), + void *user_data) +{ + bool found = false; + + float n1n2[3], n2n3[3], n3n1[3]; + + for (int i = 0; i < planes_len; i++) { + const float *n1 = planes[i]; + for (int j = i + 1; j < planes_len; j++) { + const float *n2 = planes[j]; + cross_v3_v3v3(n1n2, n1, n2); + if (len_squared_v3(n1n2) <= eps_coplanar) { + continue; + } + for (int k = j + 1; k < planes_len; k++) { + const float *n3 = planes[k]; + cross_v3_v3v3(n2n3, n2, n3); + if (len_squared_v3(n2n3) <= eps_coplanar) { + continue; + } + + cross_v3_v3v3(n3n1, n3, n1); + if (len_squared_v3(n3n1) <= eps_coplanar) { + continue; + } + const float quotient = -dot_v3v3(n1, n2n3); + if (fabsf(quotient) < eps_coplanar) { + continue; + } + const float co_test[3] = { + ((n2n3[0] * n1[3]) + (n3n1[0] * n2[3]) + (n1n2[0] * n3[3])) / quotient, + ((n2n3[1] * n1[3]) + (n3n1[1] * n2[3]) + (n1n2[1] * n3[3])) / quotient, + ((n2n3[2] * n1[3]) + (n3n1[2] * n2[3]) + (n1n2[2] * n3[3])) / quotient, + }; + int i_test; + for (i_test = 0; i_test < planes_len; i_test++) { + const float *np_test = planes[i_test]; + if (((dot_v3v3(np_test, co_test) + np_test[3]) > eps_isect)) { + /* For low epsilon values the point could intersect it's own plane. */ + if (!ELEM(i_test, i, j, k)) { + break; + } + } + } + + if (i_test == planes_len) { /* ok */ + callback_fn(co_test, i, j, k, user_data); + found = true; + } + } + } + } + + return found; +} + +/** * Intersect two triangles. * * \param r_i1, r_i2: Retrieve the overlapping edge between the 2 triangles. diff --git a/source/blender/blenlib/intern/mesh_boolean.cc b/source/blender/blenlib/intern/mesh_boolean.cc index c85adf835fe..4ff5afdb05f 100644 --- a/source/blender/blenlib/intern/mesh_boolean.cc +++ b/source/blender/blenlib/intern/mesh_boolean.cc @@ -428,7 +428,9 @@ class Cell { BoolOpType bool_optype) { std::copy(from_cell.winding().begin(), from_cell.winding().end(), winding_.begin()); - winding_[shape] += delta; + if (shape >= 0) { + winding_[shape] += delta; + } winding_assigned_ = true; in_output_volume_ = apply_bool_op(bool_optype, winding_); } diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc index b1b8bd61b40..58f78be13b6 100644 --- a/source/blender/blenlib/intern/mesh_intersect.cc +++ b/source/blender/blenlib/intern/mesh_intersect.cc @@ -519,7 +519,7 @@ class IMeshArena::IMeshArenaImpl : NonCopyable, NonMovable { IMeshArena::IMeshArena() { - pimpl_ = std::unique_ptr<IMeshArenaImpl>(new IMeshArenaImpl()); + pimpl_ = std::make_unique<IMeshArenaImpl>(); } IMeshArena::~IMeshArena() @@ -1107,254 +1107,6 @@ static mpq2 project_3d_to_2d(const mpq3 &p3d, int proj_axis) } /** - Is a point in the interior of a 2d triangle or on one of its - * edges but not either endpoint of the edge? - * orient[pi][i] is the orientation test of the point pi against - * the side of the triangle starting at index i. - * Assume the triangle is non-degenerate and CCW-oriented. - * Then answer is true if p is left of or on all three of triangle a's edges, - * and strictly left of at least on of them. - */ -static bool non_trivially_2d_point_in_tri(const int orients[3][3], int pi) -{ - int p_left_01 = orients[pi][0]; - int p_left_12 = orients[pi][1]; - int p_left_20 = orients[pi][2]; - return (p_left_01 >= 0 && p_left_12 >= 0 && p_left_20 >= 0 && - (p_left_01 + p_left_12 + p_left_20) >= 2); -} - -/** - * Given orients as defined in non_trivially_2d_intersect, do the triangles - * overlap in a "hex" pattern? That is, the overlap region is a hexagon, which - * one gets by having, each point of one triangle being strictly right-of one - * edge of the other and strictly left of the other two edges; and vice versa. - * In addition, it must not be the case that all of the points of one triangle - * are totally on the outside of one edge of the other triangle, and vice versa. - */ -static bool non_trivially_2d_hex_overlap(int orients[2][3][3]) -{ - for (int ab = 0; ab < 2; ++ab) { - for (int i = 0; i < 3; ++i) { - bool ok = orients[ab][i][0] + orients[ab][i][1] + orients[ab][i][2] == 1 && - orients[ab][i][0] != 0 && orients[ab][i][1] != 0 && orients[i][2] != 0; - if (!ok) { - return false; - } - int s = orients[ab][0][i] + orients[ab][1][i] + orients[ab][2][i]; - if (s == -3) { - return false; - } - } - } - return true; -} - -/** - * Given orients as defined in non_trivially_2d_intersect, do the triangles - * have one shared edge in a "folded-over" configuration? - * As well as a shared edge, the third vertex of one triangle needs to be - * right-of one and left-of the other two edges of the other triangle. - */ -static bool non_trivially_2d_shared_edge_overlap(int orients[2][3][3], - const mpq2 *a[3], - const mpq2 *b[3]) -{ - for (int i = 0; i < 3; ++i) { - int in = (i + 1) % 3; - int inn = (i + 2) % 3; - for (int j = 0; j < 3; ++j) { - int jn = (j + 1) % 3; - int jnn = (j + 2) % 3; - if (*a[i] == *b[j] && *a[in] == *b[jn]) { - /* Edge from a[i] is shared with edge from b[j]. */ - /* See if a[inn] is right-of or on one of the other edges of b. - * If it is on, then it has to be right-of or left-of the shared edge, - * depending on which edge it is. */ - if (orients[0][inn][jn] < 0 || orients[0][inn][jnn] < 0) { - return true; - } - if (orients[0][inn][jn] == 0 && orients[0][inn][j] == 1) { - return true; - } - if (orients[0][inn][jnn] == 0 && orients[0][inn][j] == -1) { - return true; - } - /* Similarly for `b[jnn]`. */ - if (orients[1][jnn][in] < 0 || orients[1][jnn][inn] < 0) { - return true; - } - if (orients[1][jnn][in] == 0 && orients[1][jnn][i] == 1) { - return true; - } - if (orients[1][jnn][inn] == 0 && orients[1][jnn][i] == -1) { - return true; - } - } - } - } - return false; -} - -/** - * Are the triangles the same, perhaps with some permutation of vertices? - */ -static bool same_triangles(const mpq2 *a[3], const mpq2 *b[3]) -{ - for (int i = 0; i < 3; ++i) { - if (a[0] == b[i] && a[1] == b[(i + 1) % 3] && a[2] == b[(i + 2) % 3]) { - return true; - } - } - return false; -} - -/** - * Do 2d triangles (a[0], a[1], a[2]) and (b[0], b[1], b2[2]) intersect at more than just shared - * vertices or a shared edge? This is true if any point of one triangle is non-trivially inside the - * other. NO: that isn't quite sufficient: there is also the case where the verts are all mutually - * outside the other's triangle, but there is a hexagonal overlap region where they overlap. - */ -static bool non_trivially_2d_intersect(const mpq2 *a[3], const mpq2 *b[3]) -{ - /* TODO: Could experiment with trying bounding box tests before these. - * TODO: Find a less expensive way than 18 orient tests to do this. */ - - /* `orients[0][ai][bi]` is orient of point `a[ai]` compared to segment starting at `b[bi]`. - * `orients[1][bi][ai]` is orient of point `b[bi]` compared to segment starting at `a[ai]`. */ - int orients[2][3][3]; - for (int ab = 0; ab < 2; ++ab) { - for (int ai = 0; ai < 3; ++ai) { - for (int bi = 0; bi < 3; ++bi) { - if (ab == 0) { - orients[0][ai][bi] = orient2d(*b[bi], *b[(bi + 1) % 3], *a[ai]); - } - else { - orients[1][bi][ai] = orient2d(*a[ai], *a[(ai + 1) % 3], *b[bi]); - } - } - } - } - return non_trivially_2d_point_in_tri(orients[0], 0) || - non_trivially_2d_point_in_tri(orients[0], 1) || - non_trivially_2d_point_in_tri(orients[0], 2) || - non_trivially_2d_point_in_tri(orients[1], 0) || - non_trivially_2d_point_in_tri(orients[1], 1) || - non_trivially_2d_point_in_tri(orients[1], 2) || non_trivially_2d_hex_overlap(orients) || - non_trivially_2d_shared_edge_overlap(orients, a, b) || same_triangles(a, b); - return true; -} - -/** - * Does triangle t in tm non-trivially non-co-planar intersect any triangle - * in `CoplanarCluster cl`? Assume t is known to be in the same plane as all - * the triangles in cl, and that proj_axis is a good axis to project down - * to solve this problem in 2d. - */ -static bool non_trivially_coplanar_intersects(const IMesh &tm, - int t, - const CoplanarCluster &cl, - int proj_axis, - const Map<std::pair<int, int>, ITT_value> &itt_map) -{ - const Face &tri = *tm.face(t); - mpq2 v0 = project_3d_to_2d(tri[0]->co_exact, proj_axis); - mpq2 v1 = project_3d_to_2d(tri[1]->co_exact, proj_axis); - mpq2 v2 = project_3d_to_2d(tri[2]->co_exact, proj_axis); - if (orient2d(v0, v1, v2) != 1) { - mpq2 tmp = v1; - v1 = v2; - v2 = tmp; - } - for (const int cl_t : cl) { - if (!itt_map.contains(std::pair<int, int>(t, cl_t)) && - !itt_map.contains(std::pair<int, int>(cl_t, t))) { - continue; - } - const Face &cl_tri = *tm.face(cl_t); - mpq2 ctv0 = project_3d_to_2d(cl_tri[0]->co_exact, proj_axis); - mpq2 ctv1 = project_3d_to_2d(cl_tri[1]->co_exact, proj_axis); - mpq2 ctv2 = project_3d_to_2d(cl_tri[2]->co_exact, proj_axis); - if (orient2d(ctv0, ctv1, ctv2) != 1) { - mpq2 tmp = ctv1; - ctv1 = ctv2; - ctv2 = tmp; - } - const mpq2 *v[] = {&v0, &v1, &v2}; - const mpq2 *ctv[] = {&ctv0, &ctv1, &ctv2}; - if (non_trivially_2d_intersect(v, ctv)) { - return true; - } - } - return false; -} - -/* Keeping this code for a while, but for now, almost all - * trivial intersects are found before calling intersect_tri_tri now. - */ -# if 0 -/** - * Do tri1 and tri2 intersect at all, and if so, is the intersection - * something other than a common vertex or a common edge? - * The \a itt value is the result of calling intersect_tri_tri on tri1, tri2. - */ -static bool non_trivial_intersect(const ITT_value &itt, const Face * tri1, const Face * tri2) -{ - if (itt.kind == INONE) { - return false; - } - const Face * tris[2] = {tri1, tri2}; - if (itt.kind == IPOINT) { - bool has_p_as_vert[2] {false, false}; - for (int i = 0; i < 2; ++i) { - for (const Vert * v : *tris[i]) { - if (itt.p1 == v->co_exact) { - has_p_as_vert[i] = true; - break; - } - } - } - return !(has_p_as_vert[0] && has_p_as_vert[1]); - } - if (itt.kind == ISEGMENT) { - bool has_seg_as_edge[2] = {false, false}; - for (int i = 0; i < 2; ++i) { - const Face &t = *tris[i]; - for (int pos : t.index_range()) { - int nextpos = t.next_pos(pos); - if ((itt.p1 == t[pos]->co_exact && itt.p2 == t[nextpos]->co_exact) || - (itt.p2 == t[pos]->co_exact && itt.p1 == t[nextpos]->co_exact)) { - has_seg_as_edge[i] = true; - break; - } - } - } - return !(has_seg_as_edge[0] && has_seg_as_edge[1]); - } - BLI_assert(itt.kind == ICOPLANAR); - /* TODO: refactor this common code with code above. */ - int proj_axis = mpq3::dominant_axis(tri1->plane.norm_exact); - mpq2 tri_2d[2][3]; - for (int i = 0; i < 2; ++i) { - mpq2 v0 = project_3d_to_2d((*tris[i])[0]->co_exact, proj_axis); - mpq2 v1 = project_3d_to_2d((*tris[i])[1]->co_exact, proj_axis); - mpq2 v2 = project_3d_to_2d((*tris[i])[2]->co_exact, proj_axis); - if (mpq2::orient2d(v0, v1, v2) != 1) { - mpq2 tmp = v1; - v1 = v2; - v2 = tmp; - } - tri_2d[i][0] = v0; - tri_2d[i][1] = v1; - tri_2d[i][2] = v2; - } - const mpq2 *va[] = {&tri_2d[0][0], &tri_2d[0][1], &tri_2d[0][2]}; - const mpq2 *vb[] = {&tri_2d[1][0], &tri_2d[1][1], &tri_2d[1][2]}; - return non_trivially_2d_intersect(va, vb); -} -# endif - -/** * The sup and index functions are defined in the paper: * EXACT GEOMETRIC COMPUTATION USING CASCADING, by * Burnikel, Funke, and Seel. They are used to find absolute @@ -1414,119 +1166,6 @@ constexpr int index_dot_plane_coords = 15; */ constexpr int index_dot_cross = 11; -/* Not using this at the moment. Leaving it for a bit in case we want it again. */ -# if 0 -static double supremum_dot(const double3 &a, const double3 &b) -{ - double3 abs_a = double3::abs(a); - double3 abs_b = double3::abs(b); - return double3::dot(abs_a, abs_b); -} - -static double supremum_orient3d(const double3 &a, - const double3 &b, - const double3 &c, - const double3 &d) -{ - double3 abs_a = double3::abs(a); - double3 abs_b = double3::abs(b); - double3 abs_c = double3::abs(c); - double3 abs_d = double3::abs(d); - double adx = abs_a[0] + abs_d[0]; - double bdx = abs_b[0] + abs_d[0]; - double cdx = abs_c[0] + abs_d[0]; - double ady = abs_a[1] + abs_d[1]; - double bdy = abs_b[1] + abs_d[1]; - double cdy = abs_c[1] + abs_d[1]; - double adz = abs_a[2] + abs_d[2]; - double bdz = abs_b[2] + abs_d[2]; - double cdz = abs_c[2] + abs_d[2]; - - double bdxcdy = bdx * cdy; - double cdxbdy = cdx * bdy; - - double cdxady = cdx * ady; - double adxcdy = adx * cdy; - - double adxbdy = adx * bdy; - double bdxady = bdx * ady; - - double det = adz * (bdxcdy + cdxbdy) + bdz * (cdxady + adxcdy) + cdz * (adxbdy + bdxady); - return det; -} - -/** Actually index_orient3d = 10 + 4 * (max degree of input coordinates) */ -constexpr int index_orient3d = 14; - -/** - * Return the approximate orient3d of the four double3's, with - * the guarantee that if the value is -1 or 1 then the underlying - * mpq3 test would also have returned that value. - * When the return value is 0, we are not sure of the sign. - */ -static int filter_orient3d(const double3 &a, const double3 &b, const double3 &c, const double3 &d) -{ - double o3dfast = orient3d_fast(a, b, c, d); - if (o3dfast == 0.0) { - return 0; - } - double err_bound = supremum_orient3d(a, b, c, d) * index_orient3d * DBL_EPSILON; - if (fabs(o3dfast) > err_bound) { - return o3dfast > 0.0 ? 1 : -1; - } - return 0; -} - -/** - * Return the approximate orient3d of the triangle plane points and v, with - * the guarantee that if the value is -1 or 1 then the underlying - * mpq3 test would also have returned that value. - * When the return value is 0, we are not sure of the sign. - */ -static int filter_tri_plane_vert_orient3d(const Face &tri, const Vert *v) -{ - return filter_orient3d(tri[0]->co, tri[1]->co, tri[2]->co, v->co); -} - -/** - * Are vectors a and b parallel or nearly parallel? - * This routine should only return false if we are certain - * that they are not parallel, taking into account the - * possible numeric errors and input value approximation. - */ -static bool near_parallel_vecs(const double3 &a, const double3 &b) -{ - double3 cr = double3::cross_high_precision(a, b); - double cr_len_sq = cr.length_squared(); - if (cr_len_sq == 0.0) { - return true; - } - double err_bound = supremum_dot_cross(a, b) * index_dot_cross * DBL_EPSILON; - if (cr_len_sq > err_bound) { - return false; - } - return true; -} - -/** - * Return true if we are sure that dot(a,b) > 0, taking into - * account the error bounds due to numeric errors and input value - * approximation. - */ -static bool dot_must_be_positive(const double3 &a, const double3 &b) -{ - double d = double3::dot(a, b); - if (d <= 0.0) { - return false; - } - double err_bound = supremum_dot(a, b) * index_dot_plane_coords * DBL_EPSILON; - if (d > err_bound) { - return true; - } - return false; -} -# endif - /** * Return the approximate side of point p on a plane with normal plane_no and point plane_p. * The answer will be 1 if p is definitely above the plane, -1 if it is definitely below. @@ -1556,83 +1195,6 @@ static int filter_plane_side(const double3 &p, return 0; } -/* Not using this at the moment. Leave it here for a while in case we want it again. */ -# if 0 -/** - * A fast, non-exhaustive test for non_trivial intersection. - * If this returns false then we are sure that tri1 and tri2 - * do not intersect. If it returns true, they may or may not - * non-trivially intersect. - * We assume that bounding box overlap tests have already been - * done, so don't repeat those here. This routine is checking - * for the very common cases (when doing mesh self-intersect) - * where triangles share an edge or a vertex, but don't - * otherwise intersect. - */ -static bool may_non_trivially_intersect(Face *t1, Face *t2) -{ - Face &tri1 = *t1; - Face &tri2 = *t2; - BLI_assert(t1->plane_populated() && t2->plane_populated()); - Face::FacePos share1_pos[3]; - Face::FacePos share2_pos[3]; - int n_shared = 0; - for (Face::FacePos p1 = 0; p1 < 3; ++p1) { - const Vert *v1 = tri1[p1]; - for (Face::FacePos p2 = 0; p2 < 3; ++p2) { - const Vert *v2 = tri2[p2]; - if (v1 == v2) { - share1_pos[n_shared] = p1; - share2_pos[n_shared] = p2; - ++n_shared; - } - } - } - if (n_shared == 2) { - /* t1 and t2 share an entire edge. - * If their normals are not parallel, they cannot non-trivially intersect. */ - if (!near_parallel_vecs(tri1.plane->norm, tri2.plane->norm)) { - return false; - } - /* The normals are parallel or nearly parallel. - * If the normals are in the same direction and the edges have opposite - * directions in the two triangles, they cannot non-trivially intersect. */ - bool erev1 = tri1.prev_pos(share1_pos[0]) == share1_pos[1]; - bool erev2 = tri2.prev_pos(share2_pos[0]) == share2_pos[1]; - if (erev1 != erev2) { - if (dot_must_be_positive(tri1.plane->norm, tri2.plane->norm)) { - return false; - } - } - } - else if (n_shared == 1) { - /* t1 and t2 share a vertex, but not an entire edge. - * If the two non-shared verts of t2 are both on the same - * side of tri1's plane, then they cannot non-trivially intersect. - * (There are some other cases that could be caught here but - * they are more expensive to check). */ - Face::FacePos p = share2_pos[0]; - const Vert *v2a = p == 0 ? tri2[1] : tri2[0]; - const Vert *v2b = (p == 0 || p == 1) ? tri2[2] : tri2[1]; - int o1 = filter_tri_plane_vert_orient3d(tri1, v2a); - int o2 = filter_tri_plane_vert_orient3d(tri1, v2b); - if (o1 == o2 && o1 != 0) { - return false; - } - p = share1_pos[0]; - const Vert *v1a = p == 0 ? tri1[1] : tri1[0]; - const Vert *v1b = (p == 0 || p == 1) ? tri1[2] : tri1[1]; - o1 = filter_tri_plane_vert_orient3d(tri2, v1a); - o2 = filter_tri_plane_vert_orient3d(tri2, v1b); - if (o1 == o2 && o1 != 0) { - return false; - } - } - /* We weren't able to prove that any intersection is trivial. */ - return true; -} -# endif - /* * interesect_tri_tri and helper functions. * This code uses the algorithm of Guigue and Devillers, as described @@ -2460,12 +2022,12 @@ class TriOverlaps { if (two_trees_no_self) { BLI_bvhtree_balance(tree_b_); /* Don't expect a lot of trivial intersects in this case. */ - overlap_ = BLI_bvhtree_overlap(tree_, tree_b_, &overlap_tot_, NULL, NULL); + overlap_ = BLI_bvhtree_overlap(tree_, tree_b_, &overlap_tot_, nullptr, nullptr); } else { CBData cbdata{tm, shape_fn, nshapes, use_self}; if (nshapes == 1) { - overlap_ = BLI_bvhtree_overlap(tree_, tree_, &overlap_tot_, NULL, NULL); + overlap_ = BLI_bvhtree_overlap(tree_, tree_, &overlap_tot_, nullptr, nullptr); } else { overlap_ = BLI_bvhtree_overlap( @@ -2851,7 +2413,6 @@ static CoplanarClusterInfo find_clusters(const IMesh &tm, if (dbg_level > 0) { std::cout << "already has " << curcls.size() << " clusters\n"; } - int proj_axis = mpq3::dominant_axis(tplane.norm_exact); /* Partition `curcls` into those that intersect t non-trivially, and those that don't. */ Vector<CoplanarCluster *> int_cls; Vector<CoplanarCluster *> no_int_cls; @@ -2859,8 +2420,7 @@ static CoplanarClusterInfo find_clusters(const IMesh &tm, if (dbg_level > 1) { std::cout << "consider intersecting with cluster " << cl << "\n"; } - if (bbs_might_intersect(tri_bb[t], cl.bounding_box()) && - non_trivially_coplanar_intersects(tm, t, cl, proj_axis, itt_map)) { + if (bbs_might_intersect(tri_bb[t], cl.bounding_box())) { if (dbg_level > 1) { std::cout << "append to int_cls\n"; } @@ -3316,6 +2876,6 @@ static void dump_perfdata(void) } # endif -}; // namespace blender::meshintersect +} // namespace blender::meshintersect #endif // WITH_GMP diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index f9b6218eae5..4ba533c72aa 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -1634,7 +1634,8 @@ float BLI_noise_mg_ridged_multi_fractal(float x, } } - float result, signal = powf(offset - fabsf(noisefunc(x, y, z)), 2); + float signal = powf(offset - fabsf(noisefunc(x, y, z)), 2); + float result = signal; for (int i = 1; i < (int)octaves; i++) { float pwHL = powf(lacunarity, -H); float pwr = pwHL; /* starts with i=1 instead of 0 */ diff --git a/source/blender/blenlib/intern/task_pool.cc b/source/blender/blenlib/intern/task_pool.cc index cf328ec407c..1a119e135d5 100644 --- a/source/blender/blenlib/intern/task_pool.cc +++ b/source/blender/blenlib/intern/task_pool.cc @@ -83,11 +83,11 @@ class Task { free_taskdata(other.free_taskdata), freedata(other.freedata) { - other.pool = NULL; - other.run = NULL; - other.taskdata = NULL; + other.pool = nullptr; + other.run = nullptr; + other.taskdata = nullptr; other.free_taskdata = false; - other.freedata = NULL; + other.freedata = nullptr; } #if defined(WITH_TBB) && TBB_INTERFACE_VERSION_MAJOR < 10 @@ -302,7 +302,7 @@ static void *background_task_run(void *userdata) task->~Task(); MEM_freeN(task); } - return NULL; + return nullptr; } static void background_task_pool_create(TaskPool *pool) diff --git a/source/blender/blenlib/intern/task_range.cc b/source/blender/blenlib/intern/task_range.cc index 27e0fb0ed07..229129bd088 100644 --- a/source/blender/blenlib/intern/task_range.cc +++ b/source/blender/blenlib/intern/task_range.cc @@ -70,7 +70,7 @@ struct RangeTask { ~RangeTask() { - if (settings->func_free != NULL) { + if (settings->func_free != nullptr) { settings->func_free(userdata, userdata_chunk); } MEM_SAFE_FREE(userdata_chunk); @@ -83,7 +83,7 @@ struct RangeTask { memcpy(userdata_chunk, from_chunk, settings->userdata_chunk_size); } else { - userdata_chunk = NULL; + userdata_chunk = nullptr; } } @@ -139,7 +139,7 @@ void BLI_task_parallel_range(const int start, for (int i = start; i < stop; i++) { func(userdata, i, &tls); } - if (settings->func_free != NULL) { + if (settings->func_free != nullptr) { settings->func_free(userdata, settings->userdata_chunk); } } diff --git a/source/blender/blenlib/tests/BLI_array_store_test.cc b/source/blender/blenlib/tests/BLI_array_store_test.cc index a1ec8ec7bb3..ff050ce24db 100644 --- a/source/blender/blenlib/tests/BLI_array_store_test.cc +++ b/source/blender/blenlib/tests/BLI_array_store_test.cc @@ -125,7 +125,7 @@ static TestBuffer *testbuffer_list_add(ListBase *lb, const void *data, size_t da TestBuffer *tb = (TestBuffer *)MEM_mallocN(sizeof(*tb), __func__); tb->data = data; tb->data_len = data_len; - tb->state = NULL; + tb->state = nullptr; BLI_addtail(lb, tb); return tb; } @@ -244,10 +244,10 @@ static void testbuffer_list_data_randomize(ListBase *lb, unsigned int random_see static void testbuffer_list_store_populate(BArrayStore *bs, ListBase *lb) { - for (TestBuffer *tb = (TestBuffer *)lb->first, *tb_prev = NULL; tb; + for (TestBuffer *tb = (TestBuffer *)lb->first, *tb_prev = nullptr; tb; tb_prev = tb, tb = tb->next) { tb->state = BLI_array_store_state_add( - bs, tb->data, tb->data_len, (tb_prev ? tb_prev->state : NULL)); + bs, tb->data, tb->data_len, (tb_prev ? tb_prev->state : nullptr)); } } @@ -255,7 +255,7 @@ static void testbuffer_list_store_clear(BArrayStore *bs, ListBase *lb) { for (TestBuffer *tb = (TestBuffer *)lb->first; tb; tb = tb->next) { BLI_array_store_state_remove(bs, tb->state); - tb->state = NULL; + tb->state = nullptr; } } @@ -313,7 +313,7 @@ TEST(array_store, NopState) { BArrayStore *bs = BLI_array_store_create(1, 32); const unsigned char data[] = "test"; - BArrayState *state = BLI_array_store_state_add(bs, data, sizeof(data) - 1, NULL); + BArrayState *state = BLI_array_store_state_add(bs, data, sizeof(data) - 1, nullptr); EXPECT_EQ(BLI_array_store_state_size_get(state), sizeof(data) - 1); BLI_array_store_state_remove(bs, state); BLI_array_store_destroy(bs); @@ -324,7 +324,7 @@ TEST(array_store, Single) BArrayStore *bs = BLI_array_store_create(1, 32); const char data_src[] = "test"; const char *data_dst; - BArrayState *state = BLI_array_store_state_add(bs, data_src, sizeof(data_src), NULL); + BArrayState *state = BLI_array_store_state_add(bs, data_src, sizeof(data_src), nullptr); size_t data_dst_len; data_dst = (char *)BLI_array_store_state_data_get_alloc(state, &data_dst_len); EXPECT_STREQ(data_src, data_dst); @@ -339,7 +339,7 @@ TEST(array_store, DoubleNop) const char data_src[] = "test"; const char *data_dst; - BArrayState *state_a = BLI_array_store_state_add(bs, data_src, sizeof(data_src), NULL); + BArrayState *state_a = BLI_array_store_state_add(bs, data_src, sizeof(data_src), nullptr); BArrayState *state_b = BLI_array_store_state_add(bs, data_src, sizeof(data_src), state_a); EXPECT_EQ(BLI_array_store_calc_size_compacted_get(bs), sizeof(data_src)); @@ -366,7 +366,7 @@ TEST(array_store, DoubleDiff) const char data_src_b[] = "####"; const char *data_dst; - BArrayState *state_a = BLI_array_store_state_add(bs, data_src_a, sizeof(data_src_a), NULL); + BArrayState *state_a = BLI_array_store_state_add(bs, data_src_a, sizeof(data_src_a), nullptr); BArrayState *state_b = BLI_array_store_state_add(bs, data_src_b, sizeof(data_src_b), state_a); size_t data_dst_len; @@ -594,7 +594,7 @@ static void testbuffer_list_state_random_data(ListBase *lb, size_t data_len = rand_range_i(rng, data_min_len, data_max_len + stride, stride); char *data = (char *)MEM_mallocN(data_len, __func__); - if (lb->last == NULL) { + if (lb->last == nullptr) { BLI_rng_get_char_n(rng, data, data_len); } else { diff --git a/source/blender/blenlib/tests/BLI_array_utils_test.cc b/source/blender/blenlib/tests/BLI_array_utils_test.cc index 33b4cd35d52..5d12b8fbd4d 100644 --- a/source/blender/blenlib/tests/BLI_array_utils_test.cc +++ b/source/blender/blenlib/tests/BLI_array_utils_test.cc @@ -91,7 +91,7 @@ TEST(array_utils, FindIndexInt4_DupeMid) TEST(array_utils, FindIndexPointer) { - const char *data[4] = {NULL}; + const char *data[4] = {nullptr}; STACK_DECLARE(data); STACK_INIT(data, ARRAY_SIZE(data)); diff --git a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc index caacbf1a2c4..338d6f96bef 100644 --- a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc +++ b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc @@ -1513,7 +1513,7 @@ TEST(delaunay_d, CintTwoFace) input.edges_len = 0; input.faces_len = 2; input.vert_coords = vert_coords; - input.edges = NULL; + input.edges = nullptr; input.faces = faces; input.faces_len_table = faces_len; input.faces_start_table = faces_start; diff --git a/source/blender/blenlib/tests/BLI_expr_pylike_eval_test.cc b/source/blender/blenlib/tests/BLI_expr_pylike_eval_test.cc index aad21ae4ad4..390f687dbd1 100644 --- a/source/blender/blenlib/tests/BLI_expr_pylike_eval_test.cc +++ b/source/blender/blenlib/tests/BLI_expr_pylike_eval_test.cc @@ -12,7 +12,7 @@ static void expr_pylike_parse_fail_test(const char *str) { - ExprPyLike_Parsed *expr = BLI_expr_pylike_parse(str, NULL, 0); + ExprPyLike_Parsed *expr = BLI_expr_pylike_parse(str, nullptr, 0); EXPECT_FALSE(BLI_expr_pylike_is_valid(expr)); @@ -21,7 +21,7 @@ static void expr_pylike_parse_fail_test(const char *str) static void expr_pylike_const_test(const char *str, double value, bool force_const) { - ExprPyLike_Parsed *expr = BLI_expr_pylike_parse(str, NULL, 0); + ExprPyLike_Parsed *expr = BLI_expr_pylike_parse(str, nullptr, 0); if (force_const) { EXPECT_TRUE(BLI_expr_pylike_is_constant(expr)); @@ -32,7 +32,7 @@ static void expr_pylike_const_test(const char *str, double value, bool force_con } double result; - eExprPyLike_EvalStatus status = BLI_expr_pylike_eval(expr, NULL, 0, &result); + eExprPyLike_EvalStatus status = BLI_expr_pylike_eval(expr, nullptr, 0, &result); EXPECT_EQ(status, EXPR_PYLIKE_SUCCESS); EXPECT_EQ(result, value); @@ -344,10 +344,10 @@ TEST_ERROR(Mixed3, "sqrt(x) + 1 / max(0, x)", 1.0, EXPR_PYLIKE_SUCCESS) TEST(expr_pylike, Error_Invalid) { - ExprPyLike_Parsed *expr = BLI_expr_pylike_parse("", NULL, 0); + ExprPyLike_Parsed *expr = BLI_expr_pylike_parse("", nullptr, 0); double result; - EXPECT_EQ(BLI_expr_pylike_eval(expr, NULL, 0, &result), EXPR_PYLIKE_INVALID); + EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID); BLI_expr_pylike_free(expr); } @@ -357,7 +357,7 @@ TEST(expr_pylike, Error_ArgumentCount) ExprPyLike_Parsed *expr = parse_for_eval("x", false); double result; - EXPECT_EQ(BLI_expr_pylike_eval(expr, NULL, 0, &result), EXPR_PYLIKE_FATAL_ERROR); + EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_FATAL_ERROR); BLI_expr_pylike_free(expr); } diff --git a/source/blender/blenlib/tests/BLI_ghash_test.cc b/source/blender/blenlib/tests/BLI_ghash_test.cc index 484f158a85c..a0b24e96fcc 100644 --- a/source/blender/blenlib/tests/BLI_ghash_test.cc +++ b/source/blender/blenlib/tests/BLI_ghash_test.cc @@ -77,7 +77,7 @@ TEST(ghash, InsertLookup) EXPECT_EQ(POINTER_AS_UINT(v), *k); } - BLI_ghash_free(ghash, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); } /* Here we simply insert and then remove all keys, ensuring we do get an empty, @@ -98,14 +98,14 @@ TEST(ghash, InsertRemove) bkt_size = BLI_ghash_buckets_len(ghash); for (i = TESTCASE_SIZE, k = keys; i--; k++) { - void *v = BLI_ghash_popkey(ghash, POINTER_FROM_UINT(*k), NULL); + void *v = BLI_ghash_popkey(ghash, POINTER_FROM_UINT(*k), nullptr); EXPECT_EQ(POINTER_AS_UINT(v), *k); } EXPECT_EQ(BLI_ghash_len(ghash), 0); EXPECT_EQ(BLI_ghash_buckets_len(ghash), bkt_size); - BLI_ghash_free(ghash, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); } /* Same as above, but this time we allow ghash to shrink. */ @@ -126,14 +126,14 @@ TEST(ghash, InsertRemoveShrink) bkt_size = BLI_ghash_buckets_len(ghash); for (i = TESTCASE_SIZE, k = keys; i--; k++) { - void *v = BLI_ghash_popkey(ghash, POINTER_FROM_UINT(*k), NULL); + void *v = BLI_ghash_popkey(ghash, POINTER_FROM_UINT(*k), nullptr); EXPECT_EQ(POINTER_AS_UINT(v), *k); } EXPECT_EQ(BLI_ghash_len(ghash), 0); EXPECT_LT(BLI_ghash_buckets_len(ghash), bkt_size); - BLI_ghash_free(ghash, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); } /* Check copy. */ @@ -152,7 +152,7 @@ TEST(ghash, Copy) EXPECT_EQ(BLI_ghash_len(ghash), TESTCASE_SIZE); - ghash_copy = BLI_ghash_copy(ghash, NULL, NULL); + ghash_copy = BLI_ghash_copy(ghash, nullptr, nullptr); EXPECT_EQ(BLI_ghash_len(ghash_copy), TESTCASE_SIZE); EXPECT_EQ(BLI_ghash_buckets_len(ghash_copy), BLI_ghash_buckets_len(ghash)); @@ -162,8 +162,8 @@ TEST(ghash, Copy) EXPECT_EQ(POINTER_AS_UINT(v), *k); } - BLI_ghash_free(ghash, NULL, NULL); - BLI_ghash_free(ghash_copy, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); + BLI_ghash_free(ghash_copy, nullptr, nullptr); } /* Check pop. */ @@ -205,5 +205,5 @@ TEST(ghash, Pop) } EXPECT_EQ(BLI_ghash_len(ghash), 0); - BLI_ghash_free(ghash, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); } diff --git a/source/blender/blenlib/tests/BLI_heap_simple_test.cc b/source/blender/blenlib/tests/BLI_heap_simple_test.cc index e717a6e2653..f3a65125eeb 100644 --- a/source/blender/blenlib/tests/BLI_heap_simple_test.cc +++ b/source/blender/blenlib/tests/BLI_heap_simple_test.cc @@ -29,7 +29,7 @@ TEST(heap, SimpleEmpty) heap = BLI_heapsimple_new(); EXPECT_TRUE(BLI_heapsimple_is_empty(heap)); EXPECT_EQ(BLI_heapsimple_len(heap), 0); - BLI_heapsimple_free(heap, NULL); + BLI_heapsimple_free(heap, nullptr); } TEST(heap, SimpleOne) @@ -45,7 +45,7 @@ TEST(heap, SimpleOne) EXPECT_EQ(in, BLI_heapsimple_pop_min(heap)); EXPECT_TRUE(BLI_heapsimple_is_empty(heap)); EXPECT_EQ(BLI_heapsimple_len(heap), 0); - BLI_heapsimple_free(heap, NULL); + BLI_heapsimple_free(heap, nullptr); } TEST(heap, SimpleRange) @@ -59,7 +59,7 @@ TEST(heap, SimpleRange) EXPECT_EQ(out_test, POINTER_AS_INT(BLI_heapsimple_pop_min(heap))); } EXPECT_TRUE(BLI_heapsimple_is_empty(heap)); - BLI_heapsimple_free(heap, NULL); + BLI_heapsimple_free(heap, nullptr); } TEST(heap, SimpleRangeReverse) @@ -73,7 +73,7 @@ TEST(heap, SimpleRangeReverse) EXPECT_EQ(-out_test, POINTER_AS_INT(BLI_heapsimple_pop_min(heap))); } EXPECT_TRUE(BLI_heapsimple_is_empty(heap)); - BLI_heapsimple_free(heap, NULL); + BLI_heapsimple_free(heap, nullptr); } TEST(heap, SimpleDuplicates) @@ -81,13 +81,13 @@ TEST(heap, SimpleDuplicates) const int items_total = SIZE; HeapSimple *heap = BLI_heapsimple_new(); for (int in = 0; in < items_total; in++) { - BLI_heapsimple_insert(heap, 1.0f, 0); + BLI_heapsimple_insert(heap, 1.0f, nullptr); } for (int out_test = 0; out_test < items_total; out_test++) { EXPECT_EQ(0, POINTER_AS_INT(BLI_heapsimple_pop_min(heap))); } EXPECT_TRUE(BLI_heapsimple_is_empty(heap)); - BLI_heapsimple_free(heap, NULL); + BLI_heapsimple_free(heap, nullptr); } static void random_heapsimple_helper(const int items_total, const int random_seed) @@ -103,7 +103,7 @@ static void random_heapsimple_helper(const int items_total, const int random_see EXPECT_EQ(out_test, POINTER_AS_INT(BLI_heapsimple_pop_min(heap))); } EXPECT_TRUE(BLI_heapsimple_is_empty(heap)); - BLI_heapsimple_free(heap, NULL); + BLI_heapsimple_free(heap, nullptr); MEM_freeN(values); } diff --git a/source/blender/blenlib/tests/BLI_heap_test.cc b/source/blender/blenlib/tests/BLI_heap_test.cc index 87e68c175a2..8b207c17c84 100644 --- a/source/blender/blenlib/tests/BLI_heap_test.cc +++ b/source/blender/blenlib/tests/BLI_heap_test.cc @@ -28,7 +28,7 @@ TEST(heap, Empty) heap = BLI_heap_new(); EXPECT_TRUE(BLI_heap_is_empty(heap)); EXPECT_EQ(BLI_heap_len(heap), 0); - BLI_heap_free(heap, NULL); + BLI_heap_free(heap, nullptr); } TEST(heap, One) @@ -44,7 +44,7 @@ TEST(heap, One) EXPECT_EQ(in, BLI_heap_pop_min(heap)); EXPECT_TRUE(BLI_heap_is_empty(heap)); EXPECT_EQ(BLI_heap_len(heap), 0); - BLI_heap_free(heap, NULL); + BLI_heap_free(heap, nullptr); } TEST(heap, Range) @@ -58,7 +58,7 @@ TEST(heap, Range) EXPECT_EQ(out_test, POINTER_AS_INT(BLI_heap_pop_min(heap))); } EXPECT_TRUE(BLI_heap_is_empty(heap)); - BLI_heap_free(heap, NULL); + BLI_heap_free(heap, nullptr); } TEST(heap, RangeReverse) @@ -72,7 +72,7 @@ TEST(heap, RangeReverse) EXPECT_EQ(-out_test, POINTER_AS_INT(BLI_heap_pop_min(heap))); } EXPECT_TRUE(BLI_heap_is_empty(heap)); - BLI_heap_free(heap, NULL); + BLI_heap_free(heap, nullptr); } TEST(heap, RangeRemove) @@ -85,13 +85,13 @@ TEST(heap, RangeRemove) } for (int i = 0; i < items_total; i += 2) { BLI_heap_remove(heap, nodes[i]); - nodes[i] = NULL; + nodes[i] = nullptr; } for (int out_test = 1; out_test < items_total; out_test += 2) { EXPECT_EQ(out_test, POINTER_AS_INT(BLI_heap_pop_min(heap))); } EXPECT_TRUE(BLI_heap_is_empty(heap)); - BLI_heap_free(heap, NULL); + BLI_heap_free(heap, nullptr); MEM_freeN(nodes); } @@ -100,13 +100,13 @@ TEST(heap, Duplicates) const int items_total = SIZE; Heap *heap = BLI_heap_new(); for (int in = 0; in < items_total; in++) { - BLI_heap_insert(heap, 1.0f, 0); + BLI_heap_insert(heap, 1.0f, nullptr); } for (int out_test = 0; out_test < items_total; out_test++) { EXPECT_EQ(0, POINTER_AS_INT(BLI_heap_pop_min(heap))); } EXPECT_TRUE(BLI_heap_is_empty(heap)); - BLI_heap_free(heap, NULL); + BLI_heap_free(heap, nullptr); } static void random_heap_helper(const int items_total, const int random_seed) @@ -122,7 +122,7 @@ static void random_heap_helper(const int items_total, const int random_seed) EXPECT_EQ(out_test, POINTER_AS_INT(BLI_heap_pop_min(heap))); } EXPECT_TRUE(BLI_heap_is_empty(heap)); - BLI_heap_free(heap, NULL); + BLI_heap_free(heap, nullptr); MEM_freeN(values); } @@ -156,7 +156,7 @@ TEST(heap, ReInsertSimple) } EXPECT_TRUE(BLI_heap_is_empty(heap)); - BLI_heap_free(heap, NULL); + BLI_heap_free(heap, nullptr); MEM_freeN(nodes); } @@ -181,7 +181,7 @@ static void random_heap_reinsert_helper(const int items_total, const int random_ BLI_heap_pop_min(heap); } EXPECT_TRUE(BLI_heap_is_empty(heap)); - BLI_heap_free(heap, NULL); + BLI_heap_free(heap, nullptr); MEM_freeN(nodes); } diff --git a/source/blender/blenlib/tests/BLI_kdopbvh_test.cc b/source/blender/blenlib/tests/BLI_kdopbvh_test.cc index 2e8032400e3..f921c3ae2a4 100644 --- a/source/blender/blenlib/tests/BLI_kdopbvh_test.cc +++ b/source/blender/blenlib/tests/BLI_kdopbvh_test.cc @@ -82,11 +82,11 @@ static void find_nearest_points_test( BLI_bvhtree_balance(tree); /* first find each point */ - BVHTree_NearestPointCallback callback = optimal ? optimal_check_callback : NULL; + BVHTree_NearestPointCallback callback = optimal ? optimal_check_callback : nullptr; int flags = optimal ? BVH_NEAREST_OPTIMAL_ORDER : 0; for (int i = 0; i < points_len; i++) { - const int j = BLI_bvhtree_find_nearest_ex(tree, points[i], NULL, callback, points, flags); + const int j = BLI_bvhtree_find_nearest_ex(tree, points[i], nullptr, callback, points, flags); if (j != i) { #if 0 const float dist = len_v3v3(points[i], points[j]); diff --git a/source/blender/blenlib/tests/BLI_linklist_lockfree_test.cc b/source/blender/blenlib/tests/BLI_linklist_lockfree_test.cc index d1a527d57ac..f2ae121e8ae 100644 --- a/source/blender/blenlib/tests/BLI_linklist_lockfree_test.cc +++ b/source/blender/blenlib/tests/BLI_linklist_lockfree_test.cc @@ -15,7 +15,7 @@ TEST(LockfreeLinkList, Init) BLI_linklist_lockfree_init(&list); EXPECT_EQ(list.head, &list.dummy_node); EXPECT_EQ(list.tail, &list.dummy_node); - BLI_linklist_lockfree_free(&list, NULL); + BLI_linklist_lockfree_free(&list, nullptr); } TEST(LockfreeLinkList, InsertSingle) @@ -27,7 +27,7 @@ TEST(LockfreeLinkList, InsertSingle) EXPECT_EQ(list.head, &list.dummy_node); EXPECT_EQ(list.head->next, &node); EXPECT_EQ(list.tail, &node); - BLI_linklist_lockfree_free(&list, NULL); + BLI_linklist_lockfree_free(&list, nullptr); } TEST(LockfreeLinkList, InsertMultiple) @@ -45,7 +45,7 @@ TEST(LockfreeLinkList, InsertMultiple) EXPECT_EQ(list.tail, &nodes[num_nodes - 1]); /* Check rest of the nodes. */ int node_index = 0; - for (LockfreeLinkNode *node = BLI_linklist_lockfree_begin(&list); node != NULL; + for (LockfreeLinkNode *node = BLI_linklist_lockfree_begin(&list); node != nullptr; node = node->next, ++node_index) { EXPECT_EQ(node, &nodes[node_index]); if (node_index != num_nodes - 1) { @@ -53,7 +53,7 @@ TEST(LockfreeLinkList, InsertMultiple) } } /* Free list. */ - BLI_linklist_lockfree_free(&list, NULL); + BLI_linklist_lockfree_free(&list, nullptr); } namespace { @@ -84,7 +84,7 @@ TEST(LockfreeLinkList, InsertMultipleConcurrent) TaskPool *pool = BLI_task_pool_create_suspended(&list, TASK_PRIORITY_HIGH); /* Push tasks to the pool. */ for (int i = 0; i < num_nodes; ++i) { - BLI_task_pool_push(pool, concurrent_insert, POINTER_FROM_INT(i), false, NULL); + BLI_task_pool_push(pool, concurrent_insert, POINTER_FROM_INT(i), false, nullptr); } /* Run all the tasks. */ BLI_task_pool_work_and_wait(pool); @@ -92,7 +92,7 @@ TEST(LockfreeLinkList, InsertMultipleConcurrent) EXPECT_EQ(list.head, &list.dummy_node); bool *visited_nodes = (bool *)MEM_callocN(sizeof(bool) * num_nodes, "visited nodes"); /* First, we make sure that none of the nodes are added twice. */ - for (LockfreeLinkNode *node_v = BLI_linklist_lockfree_begin(&list); node_v != NULL; + for (LockfreeLinkNode *node_v = BLI_linklist_lockfree_begin(&list); node_v != nullptr; node_v = node_v->next) { IndexedNode *node = (IndexedNode *)node_v; EXPECT_GE(node->index, 0); diff --git a/source/blender/blenlib/tests/BLI_listbase_test.cc b/source/blender/blenlib/tests/BLI_listbase_test.cc index e5b504a0040..ff85cf79e87 100644 --- a/source/blender/blenlib/tests/BLI_listbase_test.cc +++ b/source/blender/blenlib/tests/BLI_listbase_test.cc @@ -22,19 +22,19 @@ static bool listbase_is_valid(const ListBase *listbase) if (listbase->first) { const Link *prev, *link; link = (Link *)listbase->first; - TESTFAIL(link->prev == NULL); + TESTFAIL(link->prev == nullptr); link = (Link *)listbase->last; - TESTFAIL(link->next == NULL); + TESTFAIL(link->next == nullptr); - prev = NULL; + prev = nullptr; link = (Link *)listbase->first; do { TESTFAIL(link->prev == prev); } while ((void)(prev = link), (link = link->next)); TESTFAIL(prev == listbase->last); - prev = NULL; + prev = nullptr; link = (Link *)listbase->last; do { TESTFAIL(link->next == prev); @@ -42,7 +42,7 @@ static bool listbase_is_valid(const ListBase *listbase) TESTFAIL(prev == listbase->first); } else { - TESTFAIL(listbase->last == NULL); + TESTFAIL(listbase->last == nullptr); } #undef TESTFAIL @@ -73,12 +73,12 @@ TEST(listbase, FindLinkOrIndex) /* Empty list */ BLI_listbase_clear(&lb); - EXPECT_EQ(BLI_findlink(&lb, -1), (void *)NULL); - EXPECT_EQ(BLI_findlink(&lb, 0), (void *)NULL); - EXPECT_EQ(BLI_findlink(&lb, 1), (void *)NULL); - EXPECT_EQ(BLI_rfindlink(&lb, -1), (void *)NULL); - EXPECT_EQ(BLI_rfindlink(&lb, 0), (void *)NULL); - EXPECT_EQ(BLI_rfindlink(&lb, 1), (void *)NULL); + EXPECT_EQ(BLI_findlink(&lb, -1), (void *)nullptr); + EXPECT_EQ(BLI_findlink(&lb, 0), (void *)nullptr); + EXPECT_EQ(BLI_findlink(&lb, 1), (void *)nullptr); + EXPECT_EQ(BLI_rfindlink(&lb, -1), (void *)nullptr); + EXPECT_EQ(BLI_rfindlink(&lb, 0), (void *)nullptr); + EXPECT_EQ(BLI_rfindlink(&lb, 1), (void *)nullptr); EXPECT_EQ(BLI_findindex(&lb, link1), -1); /* One link */ diff --git a/source/blender/blenlib/tests/BLI_map_test.cc b/source/blender/blenlib/tests/BLI_map_test.cc index e61d638c681..ecdf2627520 100644 --- a/source/blender/blenlib/tests/BLI_map_test.cc +++ b/source/blender/blenlib/tests/BLI_map_test.cc @@ -419,9 +419,9 @@ TEST(map, Clear) TEST(map, UniquePtrValue) { - auto value1 = std::unique_ptr<int>(new int()); - auto value2 = std::unique_ptr<int>(new int()); - auto value3 = std::unique_ptr<int>(new int()); + auto value1 = std::unique_ptr<int>(std::make_unique<int>()); + auto value2 = std::unique_ptr<int>(std::make_unique<int>()); + auto value3 = std::unique_ptr<int>(std::make_unique<int>()); int *value1_ptr = value1.get(); @@ -429,12 +429,12 @@ TEST(map, UniquePtrValue) map.add_new(1, std::move(value1)); map.add(2, std::move(value2)); map.add_overwrite(3, std::move(value3)); - map.lookup_or_add_cb(4, []() { return std::unique_ptr<int>(new int()); }); - map.add_new(5, std::unique_ptr<int>(new int())); - map.add(6, std::unique_ptr<int>(new int())); - map.add_overwrite(7, std::unique_ptr<int>(new int())); - map.lookup_or_add(8, std::unique_ptr<int>(new int())); - map.pop_default(9, std::unique_ptr<int>(new int())); + map.lookup_or_add_cb(4, []() { return std::unique_ptr<int>(std::make_unique<int>()); }); + map.add_new(5, std::unique_ptr<int>(std::make_unique<int>())); + map.add(6, std::unique_ptr<int>(std::make_unique<int>())); + map.add_overwrite(7, std::unique_ptr<int>(std::make_unique<int>())); + map.lookup_or_add(8, std::unique_ptr<int>(std::make_unique<int>())); + map.pop_default(9, std::unique_ptr<int>(std::make_unique<int>())); EXPECT_EQ(map.lookup(1).get(), value1_ptr); EXPECT_EQ(map.lookup_ptr(100), nullptr); diff --git a/source/blender/blenlib/tests/BLI_mesh_intersect_test.cc b/source/blender/blenlib/tests/BLI_mesh_intersect_test.cc index 7b0f05444e2..fef4a52d9c9 100644 --- a/source/blender/blenlib/tests/BLI_mesh_intersect_test.cc +++ b/source/blender/blenlib/tests/BLI_mesh_intersect_test.cc @@ -968,6 +968,7 @@ static void fill_grid_data(int x_subdiv, bool triangulate, double size, const double3 ¢er, + double rot_deg, MutableSpan<Face *> face, int vid_start, int fid_start, @@ -991,11 +992,19 @@ static void fill_grid_data(int x_subdiv, double delta_x = size / (x_subdiv - 1); double delta_y = size / (y_subdiv - 1); int vid = vid_start; + double cos_rot = cosf(rot_deg * M_PI / 180.0); + double sin_rot = sinf(rot_deg * M_PI / 180.0); for (int iy = 0; iy < y_subdiv; ++iy) { + double yy = iy * delta_y - r; for (int ix = 0; ix < x_subdiv; ++ix) { - double x = center[0] - r + ix * delta_x; - double y = center[1] - r + iy * delta_y; + double xx = ix * delta_x - r; + double x = center[0] + xx; + double y = center[1] + yy; double z = center[2]; + if (rot_deg != 0.0) { + x = center[0] + xx * cos_rot - yy * sin_rot; + y = center[1] + xx * sin_rot + yy * cos_rot; + } const Vert *v = arena->add_or_find_vert(mpq3(x, y, z), vid++); vert[vert_index_fn(ix, iy)] = v; } @@ -1059,6 +1068,7 @@ static void spheregrid_test(int nrings, int grid_level, double z_offset, bool us true, 4.0, double3(0, 0, 0), + 0.0, MutableSpan<Face *>(tris.begin() + num_sphere_tris, num_grid_tris), num_sphere_verts, num_sphere_tris, @@ -1085,16 +1095,104 @@ static void spheregrid_test(int nrings, int grid_level, double z_offset, bool us BLI_task_scheduler_exit(); } +static void gridgrid_test(int x_level_1, + int y_level_1, + int x_level_2, + int y_level_2, + double x_off, + double y_off, + double rot_deg, + bool use_self) +{ + /* Make two grids, each 4x4, with given subdivision levels in x and y, + * and the second offset from the first by x_off, y_off, and rotated by rot_deg degrees. */ + BLI_task_scheduler_init(); /* Without this, no parallelism. */ + double time_start = PIL_check_seconds_timer(); + IMeshArena arena; + int x_subdivs_1 = 1 << x_level_1; + int y_subdivs_1 = 1 << y_level_1; + int x_subdivs_2 = 1 << x_level_2; + int y_subdivs_2 = 1 << y_level_2; + int num_grid_verts_1; + int num_grid_verts_2; + int num_grid_tris_1; + int num_grid_tris_2; + get_grid_params(x_subdivs_1, y_subdivs_1, true, &num_grid_verts_1, &num_grid_tris_1); + get_grid_params(x_subdivs_2, y_subdivs_2, true, &num_grid_verts_2, &num_grid_tris_2); + Array<Face *> tris(num_grid_tris_1 + num_grid_tris_2); + arena.reserve(num_grid_verts_1 + num_grid_verts_2, num_grid_tris_1 + num_grid_tris_2); + fill_grid_data(x_subdivs_1, + y_subdivs_1, + true, + 4.0, + double3(0, 0, 0), + 0.0, + MutableSpan<Face *>(tris.begin(), num_grid_tris_1), + 0, + 0, + &arena); + fill_grid_data(x_subdivs_2, + y_subdivs_2, + true, + 4.0, + double3(x_off, y_off, 0), + rot_deg, + MutableSpan<Face *>(tris.begin() + num_grid_tris_1, num_grid_tris_2), + num_grid_verts_1, + num_grid_tris_1, + &arena); + IMesh mesh(tris); + double time_create = PIL_check_seconds_timer(); + // write_obj_mesh(mesh, "gridgrid_in"); + IMesh out; + if (use_self) { + out = trimesh_self_intersect(mesh, &arena); + } + else { + int nf = num_grid_tris_1; + out = trimesh_nary_intersect( + mesh, 2, [nf](int t) { return t < nf ? 0 : 1; }, false, &arena); + } + double time_intersect = PIL_check_seconds_timer(); + std::cout << "Create time: " << time_create - time_start << "\n"; + std::cout << "Intersect time: " << time_intersect - time_create << "\n"; + std::cout << "Total time: " << time_intersect - time_start << "\n"; + if (DO_OBJ) { + write_obj_mesh(out, "gridgrid"); + } + BLI_task_scheduler_exit(); +} + TEST(mesh_intersect_perf, SphereSphere) { spheresphere_test(512, 0.5, false); } +TEST(mesh_intersect_perf, SphereSphereSelf) +{ + spheresphere_test(64, 0.5, true); +} + TEST(mesh_intersect_perf, SphereGrid) { spheregrid_test(512, 4, 0.1, false); } +TEST(mesh_intersect_perf, SphereGridSelf) +{ + spheregrid_test(64, 4, 0.1, true); +} + +TEST(mesh_intersect_perf, GridGrid) +{ + gridgrid_test(8, 2, 4, 2, 0.1, 0.1, 0.0, false); +} + +TEST(mesh_intersect_perf, GridGridTilt) +{ + gridgrid_test(8, 2, 4, 2, 0.0, 0.0, 1.0, false); +} + # endif } // namespace blender::meshintersect::tests diff --git a/source/blender/blenlib/tests/BLI_path_util_test.cc b/source/blender/blenlib/tests/BLI_path_util_test.cc index 927d24d2c4c..cf5135731e2 100644 --- a/source/blender/blenlib/tests/BLI_path_util_test.cc +++ b/source/blender/blenlib/tests/BLI_path_util_test.cc @@ -18,46 +18,46 @@ TEST(path_util, Clean) /* "/./" -> "/" */ { char path[FILE_MAX] = "/a/./b/./c/./"; - BLI_path_normalize(NULL, path); + BLI_path_normalize(nullptr, path); EXPECT_STREQ("/a/b/c/", path); } { char path[FILE_MAX] = "/./././"; - BLI_path_normalize(NULL, path); + BLI_path_normalize(nullptr, path); EXPECT_STREQ("/", path); } { char path[FILE_MAX] = "/a/./././b/"; - BLI_path_normalize(NULL, path); + BLI_path_normalize(nullptr, path); EXPECT_STREQ("/a/b/", path); } /* "//" -> "/" */ { char path[FILE_MAX] = "a////"; - BLI_path_normalize(NULL, path); + BLI_path_normalize(nullptr, path); EXPECT_STREQ("a/", path); } - if (0) /* FIXME */ + if (false) /* FIXME */ { char path[FILE_MAX] = "./a////"; - BLI_path_normalize(NULL, path); + BLI_path_normalize(nullptr, path); EXPECT_STREQ("./a/", path); } /* "foo/bar/../" -> "foo/" */ { char path[FILE_MAX] = "/a/b/c/../../../"; - BLI_path_normalize(NULL, path); + BLI_path_normalize(nullptr, path); EXPECT_STREQ("/", path); } { char path[FILE_MAX] = "/a/../a/b/../b/c/../c/"; - BLI_path_normalize(NULL, path); + BLI_path_normalize(nullptr, path); EXPECT_STREQ("/a/b/c/", path); } @@ -96,10 +96,10 @@ TEST(path_util, NameAtIndex_Single) AT_INDEX("//a//", 0, "a"); AT_INDEX("a/b", 0, "a"); - AT_INDEX("/a", 1, NULL); - AT_INDEX("/a/", 1, NULL); - AT_INDEX("a/", 1, NULL); - AT_INDEX("//a//", 1, NULL); + AT_INDEX("/a", 1, nullptr); + AT_INDEX("/a/", 1, nullptr); + AT_INDEX("a/", 1, nullptr); + AT_INDEX("//a//", 1, nullptr); } TEST(path_util, NameAtIndex_SingleNeg) { @@ -109,10 +109,10 @@ TEST(path_util, NameAtIndex_SingleNeg) AT_INDEX("//a//", -1, "a"); AT_INDEX("a/b", -1, "b"); - AT_INDEX("/a", -2, NULL); - AT_INDEX("/a/", -2, NULL); - AT_INDEX("a/", -2, NULL); - AT_INDEX("//a//", -2, NULL); + AT_INDEX("/a", -2, nullptr); + AT_INDEX("/a/", -2, nullptr); + AT_INDEX("a/", -2, nullptr); + AT_INDEX("//a//", -2, nullptr); } TEST(path_util, NameAtIndex_Double) @@ -123,10 +123,10 @@ TEST(path_util, NameAtIndex_Double) AT_INDEX("//ab//", 0, "ab"); AT_INDEX("ab/c", 0, "ab"); - AT_INDEX("/ab", 1, NULL); - AT_INDEX("/ab/", 1, NULL); - AT_INDEX("ab/", 1, NULL); - AT_INDEX("//ab//", 1, NULL); + AT_INDEX("/ab", 1, nullptr); + AT_INDEX("/ab/", 1, nullptr); + AT_INDEX("ab/", 1, nullptr); + AT_INDEX("//ab//", 1, nullptr); } TEST(path_util, NameAtIndex_DoublNeg) @@ -137,10 +137,10 @@ TEST(path_util, NameAtIndex_DoublNeg) AT_INDEX("//ab//", -1, "ab"); AT_INDEX("ab/c", -1, "c"); - AT_INDEX("/ab", -2, NULL); - AT_INDEX("/ab/", -2, NULL); - AT_INDEX("ab/", -2, NULL); - AT_INDEX("//ab//", -2, NULL); + AT_INDEX("/ab", -2, nullptr); + AT_INDEX("/ab/", -2, nullptr); + AT_INDEX("ab/", -2, nullptr); + AT_INDEX("//ab//", -2, nullptr); } TEST(path_util, NameAtIndex_Misc) @@ -149,8 +149,8 @@ TEST(path_util, NameAtIndex_Misc) AT_INDEX("/how/now/brown/cow", 1, "now"); AT_INDEX("/how/now/brown/cow", 2, "brown"); AT_INDEX("/how/now/brown/cow", 3, "cow"); - AT_INDEX("/how/now/brown/cow", 4, NULL); - AT_INDEX("/how/now/brown/cow/", 4, NULL); + AT_INDEX("/how/now/brown/cow", 4, nullptr); + AT_INDEX("/how/now/brown/cow/", 4, nullptr); } TEST(path_util, NameAtIndex_MiscNeg) @@ -159,8 +159,8 @@ TEST(path_util, NameAtIndex_MiscNeg) AT_INDEX("/how/now/brown/cow", 1, "now"); AT_INDEX("/how/now/brown/cow", 2, "brown"); AT_INDEX("/how/now/brown/cow", 3, "cow"); - AT_INDEX("/how/now/brown/cow", 4, NULL); - AT_INDEX("/how/now/brown/cow/", 4, NULL); + AT_INDEX("/how/now/brown/cow", 4, nullptr); + AT_INDEX("/how/now/brown/cow/", 4, nullptr); } TEST(path_util, NameAtIndex_MiscComplex) @@ -169,8 +169,8 @@ TEST(path_util, NameAtIndex_MiscComplex) AT_INDEX("//how///now\\/brown/cow", 1, "now"); AT_INDEX("/how/now\\//brown\\/cow", 2, "brown"); AT_INDEX("/how/now/brown/cow//\\", 3, "cow"); - AT_INDEX("/how/now/brown/\\cow", 4, NULL); - AT_INDEX("how/now/brown/\\cow\\", 4, NULL); + AT_INDEX("/how/now/brown/\\cow", 4, nullptr); + AT_INDEX("how/now/brown/\\cow\\", 4, nullptr); } TEST(path_util, NameAtIndex_MiscComplexNeg) @@ -179,24 +179,24 @@ TEST(path_util, NameAtIndex_MiscComplexNeg) AT_INDEX("//how///now\\/brown/cow", -3, "now"); AT_INDEX("/how/now\\//brown\\/cow", -2, "brown"); AT_INDEX("/how/now/brown/cow//\\", -1, "cow"); - AT_INDEX("/how/now/brown/\\cow", -5, NULL); - AT_INDEX("how/now/brown/\\cow\\", -5, NULL); + AT_INDEX("/how/now/brown/\\cow", -5, nullptr); + AT_INDEX("how/now/brown/\\cow\\", -5, nullptr); } TEST(path_util, NameAtIndex_NoneComplex) { - AT_INDEX("", 0, NULL); - AT_INDEX("/", 0, NULL); - AT_INDEX("//", 0, NULL); - AT_INDEX("///", 0, NULL); + AT_INDEX("", 0, nullptr); + AT_INDEX("/", 0, nullptr); + AT_INDEX("//", 0, nullptr); + AT_INDEX("///", 0, nullptr); } TEST(path_util, NameAtIndex_NoneComplexNeg) { - AT_INDEX("", -1, NULL); - AT_INDEX("/", -1, NULL); - AT_INDEX("//", -1, NULL); - AT_INDEX("///", -1, NULL); + AT_INDEX("", -1, nullptr); + AT_INDEX("/", -1, nullptr); + AT_INDEX("//", -1, nullptr); + AT_INDEX("///", -1, nullptr); } #undef AT_INDEX @@ -590,9 +590,9 @@ TEST(path_util, PathFrameGet) /* BLI_path_extension */ TEST(path_util, PathExtension) { - EXPECT_EQ(NULL, BLI_path_extension("some.def/file")); - EXPECT_EQ(NULL, BLI_path_extension("Text")); - EXPECT_EQ(NULL, BLI_path_extension("Text…001")); + EXPECT_EQ(nullptr, BLI_path_extension("some.def/file")); + EXPECT_EQ(nullptr, BLI_path_extension("Text")); + EXPECT_EQ(nullptr, BLI_path_extension("Text…001")); EXPECT_STREQ(".", BLI_path_extension("some/file.")); EXPECT_STREQ(".gz", BLI_path_extension("some/file.tar.gz")); diff --git a/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc b/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc index 624a296e758..3c9d12c7178 100644 --- a/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc +++ b/source/blender/blenlib/tests/BLI_polyfill_2d_test.cc @@ -118,7 +118,7 @@ static void test_polyfill_topology(const float /*poly*/[][2], } BLI_edgehashIterator_free(ehi); - BLI_edgehash_free(edgehash, NULL); + BLI_edgehash_free(edgehash, nullptr); } /** @@ -205,7 +205,7 @@ static void test_polyfill_template(const char *id, test_polyfill_template_check(id, is_degenerate, poly, poly_tot, tris, tris_tot); BLI_memarena_free(pf_arena); - BLI_heap_free(pf_heap, NULL); + BLI_heap_free(pf_heap, nullptr); } #endif } diff --git a/source/blender/blenlib/tests/BLI_set_test.cc b/source/blender/blenlib/tests/BLI_set_test.cc index dbe820c9d15..840472e4c0b 100644 --- a/source/blender/blenlib/tests/BLI_set_test.cc +++ b/source/blender/blenlib/tests/BLI_set_test.cc @@ -221,10 +221,10 @@ TEST(set, OftenAddRemoveContained) TEST(set, UniquePtrValues) { Set<std::unique_ptr<int>> set; - set.add_new(std::unique_ptr<int>(new int())); - auto value1 = std::unique_ptr<int>(new int()); + set.add_new(std::unique_ptr<int>(std::make_unique<int>())); + auto value1 = std::unique_ptr<int>(std::make_unique<int>()); set.add_new(std::move(value1)); - set.add(std::unique_ptr<int>(new int())); + set.add(std::unique_ptr<int>(std::make_unique<int>())); EXPECT_EQ(set.size(), 3); } diff --git a/source/blender/blenlib/tests/BLI_stack_cxx_test.cc b/source/blender/blenlib/tests/BLI_stack_cxx_test.cc index c03893c5596..57e7bfdfdce 100644 --- a/source/blender/blenlib/tests/BLI_stack_cxx_test.cc +++ b/source/blender/blenlib/tests/BLI_stack_cxx_test.cc @@ -170,8 +170,8 @@ TEST(stack, Peek) TEST(stack, UniquePtrValues) { Stack<std::unique_ptr<int>> stack; - stack.push(std::unique_ptr<int>(new int())); - stack.push(std::unique_ptr<int>(new int())); + stack.push(std::unique_ptr<int>(std::make_unique<int>())); + stack.push(std::unique_ptr<int>(std::make_unique<int>())); std::unique_ptr<int> a = stack.pop(); std::unique_ptr<int> &b = stack.peek(); UNUSED_VARS(a, b); diff --git a/source/blender/blenlib/tests/BLI_string_test.cc b/source/blender/blenlib/tests/BLI_string_test.cc index e8fe505a6c9..58135adbcca 100644 --- a/source/blender/blenlib/tests/BLI_string_test.cc +++ b/source/blender/blenlib/tests/BLI_string_test.cc @@ -66,8 +66,8 @@ TEST(string, StrPartition) /* "" -> "", NULL, NULL, 0 */ pre_ln = BLI_str_partition(str, delim, &sep, &suf); EXPECT_EQ(pre_ln, 0); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } { @@ -76,8 +76,8 @@ TEST(string, StrPartition) /* "material" -> "material", NULL, NULL, 8 */ pre_ln = BLI_str_partition(str, delim, &sep, &suf); EXPECT_EQ(pre_ln, 8); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } } @@ -125,8 +125,8 @@ TEST(string, StrRPartition) /* "" -> "", NULL, NULL, 0 */ pre_ln = BLI_str_rpartition(str, delim, &sep, &suf); EXPECT_EQ(pre_ln, 0); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } { @@ -135,8 +135,8 @@ TEST(string, StrRPartition) /* "material" -> "material", NULL, NULL, 8 */ pre_ln = BLI_str_rpartition(str, delim, &sep, &suf); EXPECT_EQ(pre_ln, 8); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } } @@ -166,8 +166,8 @@ TEST(string, StrPartitionEx) /* "mate.rial" over "mate" -> "mate.rial", NULL, NULL, 4 */ pre_ln = BLI_str_partition_ex(str, str + 4, delim, &sep, &suf, true); EXPECT_EQ(pre_ln, 4); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } } @@ -215,8 +215,8 @@ TEST(string, StrPartitionUtf8) /* "" -> "", NULL, NULL, 0 */ pre_ln = BLI_str_partition_utf8(str, delim, &sep, &suf); EXPECT_EQ(pre_ln, 0); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } { @@ -225,8 +225,8 @@ TEST(string, StrPartitionUtf8) /* "material" -> "material", NULL, NULL, 8 */ pre_ln = BLI_str_partition_utf8(str, delim, &sep, &suf); EXPECT_EQ(pre_ln, 8); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } } @@ -274,8 +274,8 @@ TEST(string, StrRPartitionUtf8) /* "" -> "", NULL, NULL, 0 */ pre_ln = BLI_str_rpartition_utf8(str, delim, &sep, &suf); EXPECT_EQ(pre_ln, 0); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } { @@ -284,8 +284,8 @@ TEST(string, StrRPartitionUtf8) /* "material" -> "material", NULL, NULL, 8 */ pre_ln = BLI_str_rpartition_utf8(str, delim, &sep, &suf); EXPECT_EQ(pre_ln, 8); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } } @@ -316,8 +316,8 @@ TEST(string, StrPartitionExUtf8) /* "mate\xe2\x98\xafrial" over "mate" -> "mate\xe2\x98\xafrial", NULL, NULL, 4 */ pre_ln = BLI_str_partition_ex_utf8(str, str + 4, delim, &sep, &suf, true); EXPECT_EQ(pre_ln, 4); - EXPECT_EQ(sep, (void *)NULL); - EXPECT_EQ(suf, (void *)NULL); + EXPECT_EQ(sep, (void *)nullptr); + EXPECT_EQ(suf, (void *)nullptr); } } @@ -567,7 +567,7 @@ TEST(string, StringStrncasestr) EXPECT_EQ(res, str_test0 + 1); res = BLI_strncasestr(str_test0, "not there", 9); - EXPECT_EQ(res, (void *)NULL); + EXPECT_EQ(res, (void *)nullptr); } /* BLI_string_max_possible_word_count */ diff --git a/source/blender/blenlib/tests/BLI_string_utf8_test.cc b/source/blender/blenlib/tests/BLI_string_utf8_test.cc index 9743c1387a0..1833945b3fd 100644 --- a/source/blender/blenlib/tests/BLI_string_utf8_test.cc +++ b/source/blender/blenlib/tests/BLI_string_utf8_test.cc @@ -262,14 +262,14 @@ const char *utf8_invalid_tests[][3] = { /* For now, we ignore those, they do not seem to be crucial anyway... */ /* 5.3.3 U+FDD0 .. U+FDEF * 5.3.4 U+nFFFE U+nFFFF (for n = 1..10) */ - {NULL, NULL, NULL}, + {nullptr, nullptr, nullptr}, }; /* clang-format on */ /* BLI_utf8_invalid_strip (and indirectly, BLI_utf8_invalid_byte). */ TEST(string, Utf8InvalidBytes) { - for (int i = 0; utf8_invalid_tests[i][0] != NULL; i++) { + for (int i = 0; utf8_invalid_tests[i][0] != nullptr; i++) { const char *tst = utf8_invalid_tests[i][0]; const char *tst_stripped = utf8_invalid_tests[i][1]; const int num_errors = (int)utf8_invalid_tests[i][2][0]; diff --git a/source/blender/blenlib/tests/BLI_task_graph_test.cc b/source/blender/blenlib/tests/BLI_task_graph_test.cc index efcbf923625..475e0270da2 100644 --- a/source/blender/blenlib/tests/BLI_task_graph_test.cc +++ b/source/blender/blenlib/tests/BLI_task_graph_test.cc @@ -52,16 +52,16 @@ TEST(task, GraphSequential) TaskGraph *graph = BLI_task_graph_create(); /* 0 => 1 */ - TaskNode *node_a = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, NULL); + TaskNode *node_a = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, nullptr); /* 1 => 2 */ TaskNode *node_b = BLI_task_graph_node_create( - graph, TaskData_multiply_by_two_value, &data, NULL); + graph, TaskData_multiply_by_two_value, &data, nullptr); /* 2 => 1 */ - TaskNode *node_c = BLI_task_graph_node_create(graph, TaskData_decrease_value, &data, NULL); + TaskNode *node_c = BLI_task_graph_node_create(graph, TaskData_decrease_value, &data, nullptr); /* 2 => 1 */ - TaskNode *node_d = BLI_task_graph_node_create(graph, TaskData_square_value, &data, NULL); + TaskNode *node_d = BLI_task_graph_node_create(graph, TaskData_square_value, &data, nullptr); /* 1 => 1 */ - TaskNode *node_e = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, NULL); + TaskNode *node_e = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, nullptr); /* 1 => 2 */ const int expected_value = 2; @@ -82,12 +82,12 @@ TEST(task, GraphStartAtAnyNode) TaskData data = {4}; TaskGraph *graph = BLI_task_graph_create(); - TaskNode *node_a = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, NULL); + TaskNode *node_a = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, nullptr); TaskNode *node_b = BLI_task_graph_node_create( - graph, TaskData_multiply_by_two_value, &data, NULL); - TaskNode *node_c = BLI_task_graph_node_create(graph, TaskData_decrease_value, &data, NULL); - TaskNode *node_d = BLI_task_graph_node_create(graph, TaskData_square_value, &data, NULL); - TaskNode *node_e = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, NULL); + graph, TaskData_multiply_by_two_value, &data, nullptr); + TaskNode *node_c = BLI_task_graph_node_create(graph, TaskData_decrease_value, &data, nullptr); + TaskNode *node_d = BLI_task_graph_node_create(graph, TaskData_square_value, &data, nullptr); + TaskNode *node_e = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, nullptr); // ((4 - 1) * (4 - 1)) + 1 const int expected_value = 10; @@ -109,11 +109,11 @@ TEST(task, GraphSplit) TaskData data = {1}; TaskGraph *graph = BLI_task_graph_create(); - TaskNode *node_a = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, NULL); - TaskNode *node_b = BLI_task_graph_node_create(graph, TaskData_store_value, &data, NULL); - TaskNode *node_c = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, NULL); + TaskNode *node_a = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, nullptr); + TaskNode *node_b = BLI_task_graph_node_create(graph, TaskData_store_value, &data, nullptr); + TaskNode *node_c = BLI_task_graph_node_create(graph, TaskData_increase_value, &data, nullptr); TaskNode *node_d = BLI_task_graph_node_create( - graph, TaskData_multiply_by_two_store, &data, NULL); + graph, TaskData_multiply_by_two_store, &data, nullptr); BLI_task_graph_edge_create(node_a, node_b); BLI_task_graph_edge_create(node_b, node_c); BLI_task_graph_edge_create(node_b, node_d); @@ -134,12 +134,13 @@ TEST(task, GraphForest) { TaskNode *tree1_node_a = BLI_task_graph_node_create( - graph, TaskData_increase_value, &data1, NULL); - TaskNode *tree1_node_b = BLI_task_graph_node_create(graph, TaskData_store_value, &data1, NULL); + graph, TaskData_increase_value, &data1, nullptr); + TaskNode *tree1_node_b = BLI_task_graph_node_create( + graph, TaskData_store_value, &data1, nullptr); TaskNode *tree1_node_c = BLI_task_graph_node_create( - graph, TaskData_increase_value, &data1, NULL); + graph, TaskData_increase_value, &data1, nullptr); TaskNode *tree1_node_d = BLI_task_graph_node_create( - graph, TaskData_multiply_by_two_store, &data1, NULL); + graph, TaskData_multiply_by_two_store, &data1, nullptr); BLI_task_graph_edge_create(tree1_node_a, tree1_node_b); BLI_task_graph_edge_create(tree1_node_b, tree1_node_c); BLI_task_graph_edge_create(tree1_node_b, tree1_node_d); @@ -148,12 +149,13 @@ TEST(task, GraphForest) { TaskNode *tree2_node_a = BLI_task_graph_node_create( - graph, TaskData_increase_value, &data2, NULL); - TaskNode *tree2_node_b = BLI_task_graph_node_create(graph, TaskData_store_value, &data2, NULL); + graph, TaskData_increase_value, &data2, nullptr); + TaskNode *tree2_node_b = BLI_task_graph_node_create( + graph, TaskData_store_value, &data2, nullptr); TaskNode *tree2_node_c = BLI_task_graph_node_create( - graph, TaskData_increase_value, &data2, NULL); + graph, TaskData_increase_value, &data2, nullptr); TaskNode *tree2_node_d = BLI_task_graph_node_create( - graph, TaskData_multiply_by_two_store, &data2, NULL); + graph, TaskData_multiply_by_two_store, &data2, nullptr); BLI_task_graph_edge_create(tree2_node_a, tree2_node_b); BLI_task_graph_edge_create(tree2_node_b, tree2_node_c); BLI_task_graph_edge_create(tree2_node_b, tree2_node_d); @@ -175,7 +177,7 @@ TEST(task, GraphTaskData) TaskGraph *graph = BLI_task_graph_create(); TaskNode *node_a = BLI_task_graph_node_create( graph, TaskData_store_value, &data, TaskData_increase_value); - TaskNode *node_b = BLI_task_graph_node_create(graph, TaskData_store_value, &data, NULL); + TaskNode *node_b = BLI_task_graph_node_create(graph, TaskData_store_value, &data, nullptr); BLI_task_graph_edge_create(node_a, node_b); EXPECT_TRUE(BLI_task_graph_node_push_work(node_a)); BLI_task_graph_work_and_wait(graph); diff --git a/source/blender/blenlib/tests/BLI_task_test.cc b/source/blender/blenlib/tests/BLI_task_test.cc index 3abaf6a6c0b..2a3fddf5e3d 100644 --- a/source/blender/blenlib/tests/BLI_task_test.cc +++ b/source/blender/blenlib/tests/BLI_task_test.cc @@ -72,7 +72,7 @@ static void task_mempool_iter_func(void *userdata, MempoolIterData *item) int *data = (int *)item; int *count = (int *)userdata; - EXPECT_TRUE(data != NULL); + EXPECT_TRUE(data != nullptr); *data += 1; atomic_sub_and_fetch_uint32((uint32_t *)count, 1); @@ -97,12 +97,12 @@ TEST(task, MempoolIter) for (i = 0; i < NUM_ITEMS; i += 3) { BLI_mempool_free(mempool, data[i]); - data[i] = NULL; + data[i] = nullptr; num_items--; } for (i = 0; i < NUM_ITEMS; i += 7) { - if (data[i] == NULL) { + if (data[i] == nullptr) { data[i] = (int *)BLI_mempool_alloc(mempool); *data[i] = i - 1; num_items++; @@ -111,9 +111,9 @@ TEST(task, MempoolIter) for (i = 0; i < NUM_ITEMS - 5; i += 23) { for (int j = 0; j < 5; j++) { - if (data[i + j] != NULL) { + if (data[i + j] != nullptr) { BLI_mempool_free(mempool, data[i + j]); - data[i + j] = NULL; + data[i + j] = nullptr; num_items--; } } @@ -125,7 +125,7 @@ TEST(task, MempoolIter) * expected. */ EXPECT_EQ(num_items, 0); for (i = 0; i < NUM_ITEMS; i++) { - if (data[i] != NULL) { + if (data[i] != nullptr) { EXPECT_EQ(*data[i], i); } } @@ -150,7 +150,7 @@ static void task_listbase_iter_func(void *userdata, TEST(task, ListBaseIter) { - ListBase list = {NULL, NULL}; + ListBase list = {nullptr, nullptr}; LinkData *items_buffer = (LinkData *)MEM_calloc_arrayN( NUM_ITEMS, sizeof(*items_buffer), __func__); BLI_threadapi_init(); @@ -172,7 +172,7 @@ TEST(task, ListBaseIter) * as expected. */ EXPECT_EQ(num_items, 0); LinkData *item; - for (i = 0, item = (LinkData *)list.first; i < NUM_ITEMS && item != NULL; + for (i = 0, item = (LinkData *)list.first; i < NUM_ITEMS && item != nullptr; i++, item = item->next) { EXPECT_EQ(POINTER_AS_INT(item->data), i); } diff --git a/source/blender/blenlib/tests/BLI_vector_set_test.cc b/source/blender/blenlib/tests/BLI_vector_set_test.cc index 320cb15f450..cbdc597255a 100644 --- a/source/blender/blenlib/tests/BLI_vector_set_test.cc +++ b/source/blender/blenlib/tests/BLI_vector_set_test.cc @@ -142,9 +142,9 @@ TEST(vector_set, AddMultipleTimes) TEST(vector_set, UniquePtrValue) { VectorSet<std::unique_ptr<int>> set; - set.add_new(std::unique_ptr<int>(new int())); - set.add(std::unique_ptr<int>(new int())); - set.index_of_try(std::unique_ptr<int>(new int())); + set.add_new(std::unique_ptr<int>(std::make_unique<int>())); + set.add(std::unique_ptr<int>(std::make_unique<int>())); + set.index_of_try(std::unique_ptr<int>(std::make_unique<int>())); std::unique_ptr<int> value = set.pop(); UNUSED_VARS(value); } diff --git a/source/blender/blenlib/tests/BLI_vector_test.cc b/source/blender/blenlib/tests/BLI_vector_test.cc index e6b2e7c6365..0088ae21983 100644 --- a/source/blender/blenlib/tests/BLI_vector_test.cc +++ b/source/blender/blenlib/tests/BLI_vector_test.cc @@ -79,11 +79,11 @@ struct TestListValue { TEST(vector, ListBaseConstructor) { - TestListValue *value1 = new TestListValue{0, 0, 4}; - TestListValue *value2 = new TestListValue{0, 0, 5}; - TestListValue *value3 = new TestListValue{0, 0, 6}; + TestListValue *value1 = new TestListValue{nullptr, nullptr, 4}; + TestListValue *value2 = new TestListValue{nullptr, nullptr, 5}; + TestListValue *value3 = new TestListValue{nullptr, nullptr, 6}; - ListBase list = {NULL, NULL}; + ListBase list = {nullptr, nullptr}; BLI_addtail(&list, value1); BLI_addtail(&list, value2); BLI_addtail(&list, value3); @@ -456,10 +456,10 @@ TEST(vector, AppendNTimes) TEST(vector, UniquePtrValue) { Vector<std::unique_ptr<int>> vec; - vec.append(std::unique_ptr<int>(new int())); - vec.append(std::unique_ptr<int>(new int())); - vec.append(std::unique_ptr<int>(new int())); - vec.append(std::unique_ptr<int>(new int())); + vec.append(std::unique_ptr<int>(std::make_unique<int>())); + vec.append(std::unique_ptr<int>(std::make_unique<int>())); + vec.append(std::unique_ptr<int>(std::make_unique<int>())); + vec.append(std::unique_ptr<int>(std::make_unique<int>())); EXPECT_EQ(vec.size(), 4); std::unique_ptr<int> &a = vec.last(); diff --git a/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc b/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc index 6400bec93f9..9a374cd0b1f 100644 --- a/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc +++ b/source/blender/blenlib/tests/performance/BLI_ghash_performance_test.cc @@ -152,7 +152,7 @@ static void str_ghash_tests(GHash *ghash, const char *id) TIMEIT_END(string_lookup); } - BLI_ghash_free(ghash, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); MEM_freeN(data); MEM_freeN(data_p); MEM_freeN(data_w); @@ -227,7 +227,7 @@ static void int_ghash_tests(GHash *ghash, const char *id, const unsigned int nbr } EXPECT_EQ(BLI_ghash_len(ghash), 0); - BLI_ghash_free(ghash, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); printf("========== ENDED %s ==========\n\n", id); } @@ -309,7 +309,7 @@ static void randint_ghash_tests(GHash *ghash, const char *id, const unsigned int TIMEIT_END(int_lookup); } - BLI_ghash_free(ghash, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); MEM_freeN(data); printf("========== ENDED %s ==========\n\n", id); @@ -421,7 +421,7 @@ static void int4_ghash_tests(GHash *ghash, const char *id, const unsigned int nb TIMEIT_END(int_v4_lookup); } - BLI_ghash_free(ghash, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); MEM_freeN(data); printf("========== ENDED %s ==========\n\n", id); @@ -506,7 +506,7 @@ static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const unsigned i EXPECT_EQ(POINTER_AS_UINT(v), *dt); } - BLI_ghash_clear(ghash, NULL, NULL); + BLI_ghash_clear(ghash, nullptr, nullptr); MEM_freeN(data); } @@ -538,7 +538,7 @@ static void multi_small_ghash_tests(GHash *ghash, const char *id, const unsigned TIMEIT_END(multi_small2_ghash); - BLI_ghash_free(ghash, NULL, NULL); + BLI_ghash_free(ghash, nullptr, nullptr); BLI_rng_free(rng); printf("========== ENDED %s ==========\n\n", id); diff --git a/source/blender/blenlib/tests/performance/BLI_task_performance_test.cc b/source/blender/blenlib/tests/performance/BLI_task_performance_test.cc index 208f168b599..c5b0f86e384 100644 --- a/source/blender/blenlib/tests/performance/BLI_task_performance_test.cc +++ b/source/blender/blenlib/tests/performance/BLI_task_performance_test.cc @@ -119,7 +119,7 @@ static void task_listbase_test_do(ListBase *list, } LinkData *item; int j; - for (j = 0, item = (LinkData *)list->first; j < num_items && item != NULL; + for (j = 0, item = (LinkData *)list->first; j < num_items && item != nullptr; j++, item = item->next) { EXPECT_EQ(POINTER_AS_INT(item->data), j); item->data = POINTER_FROM_INT(0); @@ -139,7 +139,7 @@ static void task_listbase_test(const char *id, const int nbr, const bool use_thr { printf("\n========== STARTING %s ==========\n", id); - ListBase list = {NULL, NULL}; + ListBase list = {nullptr, nullptr}; LinkData *items_buffer = (LinkData *)MEM_calloc_arrayN(nbr, sizeof(*items_buffer), __func__); BLI_threadapi_init(); diff --git a/source/blender/blenloader/BLO_read_write.h b/source/blender/blenloader/BLO_read_write.h index 3600ae504a1..c4480e2c544 100644 --- a/source/blender/blenloader/BLO_read_write.h +++ b/source/blender/blenloader/BLO_read_write.h @@ -43,6 +43,8 @@ /* for SDNA_TYPE_FROM_STRUCT() macro */ #include "dna_type_offsets.h" +#include "DNA_windowmanager_types.h" /* for ReportType */ + #ifdef __cplusplus extern "C" { #endif @@ -53,6 +55,7 @@ typedef struct BlendLibReader BlendLibReader; typedef struct BlendWriter BlendWriter; struct Main; +struct ReportList; /* Blend Write API * =============== @@ -210,6 +213,9 @@ void BLO_read_pointer_array(BlendDataReader *reader, void **ptr_p); /* Misc. */ bool BLO_read_requires_endian_switch(BlendDataReader *reader); bool BLO_read_data_is_undo(BlendDataReader *reader); +void BLO_read_data_globmap_add(BlendDataReader *reader, void *oldaddr, void *newaddr); +void BLO_read_glob_list(BlendDataReader *reader, struct ListBase *list); +struct ReportList *BLO_read_data_reports(BlendDataReader *reader); /* Blend Read Lib API * =================== @@ -226,6 +232,7 @@ ID *BLO_read_get_new_id_address(BlendLibReader *reader, struct Library *lib, str /* Misc. */ bool BLO_read_lib_is_undo(BlendLibReader *reader); struct Main *BLO_read_lib_get_main(BlendLibReader *reader); +struct ReportList *BLO_read_lib_reports(BlendLibReader *reader); /* Blend Expand API * =================== @@ -238,6 +245,13 @@ void BLO_expand_id(BlendExpander *expander, struct ID *id); #define BLO_expand(expander, id) BLO_expand_id(expander, (struct ID *)id) +/* Report API + * =================== + */ + +void BLO_reportf_wrap(struct ReportList *reports, ReportType type, const char *format, ...) + ATTR_PRINTF_FORMAT(3, 4); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt index 833a5abb630..b65a3c4d58e 100644 --- a/source/blender/blenloader/CMakeLists.txt +++ b/source/blender/blenloader/CMakeLists.txt @@ -30,7 +30,7 @@ set(INC ../makesdna ../makesrna ../nodes - ../render/extern/include + ../render ../sequencer ../windowmanager ../../../intern/clog diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index bceb3cc0021..fca6079ceb6 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -44,59 +44,17 @@ #define DNA_DEPRECATED_ALLOW #include "DNA_anim_types.h" -#include "DNA_armature_types.h" -#include "DNA_brush_types.h" #include "DNA_cachefile_types.h" -#include "DNA_camera_types.h" -#include "DNA_cloth_types.h" -#include "DNA_collection_types.h" -#include "DNA_constraint_types.h" -#include "DNA_curveprofile_types.h" -#include "DNA_dynamicpaint_types.h" -#include "DNA_effect_types.h" #include "DNA_fileglobal_types.h" -#include "DNA_fluid_types.h" #include "DNA_genfile.h" -#include "DNA_gpencil_modifier_types.h" -#include "DNA_gpencil_types.h" -#include "DNA_hair_types.h" -#include "DNA_ipo_types.h" #include "DNA_key_types.h" -#include "DNA_lattice_types.h" #include "DNA_layer_types.h" -#include "DNA_light_types.h" -#include "DNA_lightprobe_types.h" -#include "DNA_linestyle_types.h" -#include "DNA_mask_types.h" -#include "DNA_material_types.h" -#include "DNA_mesh_types.h" -#include "DNA_meshdata_types.h" -#include "DNA_meta_types.h" -#include "DNA_movieclip_types.h" -#include "DNA_nla_types.h" #include "DNA_node_types.h" -#include "DNA_object_fluidsim_types.h" -#include "DNA_object_types.h" #include "DNA_packedFile_types.h" -#include "DNA_particle_types.h" -#include "DNA_pointcache_types.h" -#include "DNA_pointcloud_types.h" -#include "DNA_rigidbody_types.h" -#include "DNA_scene_types.h" -#include "DNA_screen_types.h" #include "DNA_sdna_types.h" -#include "DNA_sequence_types.h" -#include "DNA_shader_fx_types.h" -#include "DNA_simulation_types.h" #include "DNA_sound_types.h" -#include "DNA_space_types.h" -#include "DNA_speaker_types.h" -#include "DNA_text_types.h" -#include "DNA_vfont_types.h" -#include "DNA_view3d_types.h" #include "DNA_volume_types.h" #include "DNA_workspace_types.h" -#include "DNA_world_types.h" #include "MEM_guardedalloc.h" @@ -111,29 +69,12 @@ #include "BLT_translation.h" -#include "BKE_action.h" #include "BKE_anim_data.h" #include "BKE_animsys.h" -#include "BKE_armature.h" -#include "BKE_brush.h" #include "BKE_collection.h" -#include "BKE_colortools.h" -#include "BKE_constraint.h" -#include "BKE_curve.h" -#include "BKE_curveprofile.h" -#include "BKE_deform.h" -#include "BKE_effect.h" -#include "BKE_fcurve.h" -#include "BKE_fcurve_driver.h" -#include "BKE_fluid.h" #include "BKE_global.h" /* for G */ -#include "BKE_gpencil.h" -#include "BKE_gpencil_modifier.h" -#include "BKE_hair.h" -#include "BKE_icons.h" #include "BKE_idprop.h" #include "BKE_idtype.h" -#include "BKE_image.h" #include "BKE_layer.h" #include "BKE_lib_id.h" #include "BKE_lib_override.h" @@ -141,44 +82,28 @@ #include "BKE_main.h" /* for Main */ #include "BKE_main_idmap.h" #include "BKE_material.h" -#include "BKE_mesh.h" /* for ME_ defines (patching) */ -#include "BKE_mesh_runtime.h" #include "BKE_modifier.h" -#include "BKE_multires.h" -#include "BKE_nla.h" #include "BKE_node.h" /* for tree type defines */ #include "BKE_object.h" #include "BKE_packedFile.h" -#include "BKE_paint.h" -#include "BKE_particle.h" -#include "BKE_pointcache.h" -#include "BKE_pointcloud.h" #include "BKE_report.h" #include "BKE_scene.h" #include "BKE_screen.h" -#include "BKE_shader_fx.h" -#include "BKE_sound.h" -#include "BKE_volume.h" + #include "BKE_workspace.h" #include "DRW_engine.h" #include "DEG_depsgraph.h" -#include "NOD_socket.h" - #include "BLO_blend_defs.h" #include "BLO_blend_validate.h" #include "BLO_read_write.h" #include "BLO_readfile.h" #include "BLO_undofile.h" -#include "RE_engine.h" - #include "SEQ_sequencer.h" -#include "engines/eevee/eevee_lightcache.h" - #include "readfile.h" #include <errno.h> @@ -263,7 +188,6 @@ /* local prototypes */ static void read_libraries(FileData *basefd, ListBase *mainlist); static void *read_struct(FileData *fd, BHead *bh, const char *blockname); -static void direct_link_modifiers(BlendDataReader *reader, ListBase *lb, Object *ob); static BHead *find_bhead_from_code_name(FileData *fd, const short idcode, const char *name); static BHead *find_bhead_from_idname(FileData *fd, const char *idname); static bool library_link_idcode_needs_tag_check(const short idcode, const int flag); @@ -293,7 +217,7 @@ typedef struct BHeadN { * bit kludge but better than doubling up on prints, * we could alternatively have a versions of a report function which forces printing - campbell */ -void blo_reportf_wrap(ReportList *reports, ReportType type, const char *format, ...) +void BLO_reportf_wrap(ReportList *reports, ReportType type, const char *format, ...) { char fixed_buf[1024]; /* should be long enough */ @@ -2484,262 +2408,6 @@ static void direct_link_id_common( /** \name Read Animation (legacy for version patching) * \{ */ -/* XXX deprecated - old animation system */ -static void lib_link_ipo(BlendLibReader *reader, Ipo *ipo) -{ - LISTBASE_FOREACH (IpoCurve *, icu, &ipo->curve) { - if (icu->driver) { - BLO_read_id_address(reader, ipo->id.lib, &icu->driver->ob); - } - } -} - -/* XXX deprecated - old animation system */ -static void direct_link_ipo(BlendDataReader *reader, Ipo *ipo) -{ - BLO_read_list(reader, &(ipo->curve)); - - LISTBASE_FOREACH (IpoCurve *, icu, &ipo->curve) { - BLO_read_data_address(reader, &icu->bezt); - BLO_read_data_address(reader, &icu->bp); - BLO_read_data_address(reader, &icu->driver); - - /* Undo generic endian switching. */ - if (BLO_read_requires_endian_switch(reader)) { - BLI_endian_switch_int16(&icu->blocktype); - if (icu->driver != NULL) { - - /* Undo generic endian switching. */ - if (BLO_read_requires_endian_switch(reader)) { - BLI_endian_switch_int16(&icu->blocktype); - if (icu->driver != NULL) { - BLI_endian_switch_int16(&icu->driver->blocktype); - } - } - } - - /* Undo generic endian switching. */ - if (BLO_read_requires_endian_switch(reader)) { - BLI_endian_switch_int16(&ipo->blocktype); - if (icu->driver != NULL) { - BLI_endian_switch_int16(&icu->driver->blocktype); - } - } - } - } - - /* Undo generic endian switching. */ - if (BLO_read_requires_endian_switch(reader)) { - BLI_endian_switch_int16(&ipo->blocktype); - } -} - -/* XXX deprecated - old animation system */ -static void lib_link_nlastrips(BlendLibReader *reader, ID *id, ListBase *striplist) -{ - LISTBASE_FOREACH (bActionStrip *, strip, striplist) { - BLO_read_id_address(reader, id->lib, &strip->object); - BLO_read_id_address(reader, id->lib, &strip->act); - BLO_read_id_address(reader, id->lib, &strip->ipo); - LISTBASE_FOREACH (bActionModifier *, amod, &strip->modifiers) { - BLO_read_id_address(reader, id->lib, &amod->ob); - } - } -} - -/* XXX deprecated - old animation system */ -static void direct_link_nlastrips(BlendDataReader *reader, ListBase *strips) -{ - BLO_read_list(reader, strips); - - LISTBASE_FOREACH (bActionStrip *, strip, strips) { - BLO_read_list(reader, &strip->modifiers); - } -} - -/* XXX deprecated - old animation system */ -static void lib_link_constraint_channels(BlendLibReader *reader, ID *id, ListBase *chanbase) -{ - LISTBASE_FOREACH (bConstraintChannel *, chan, chanbase) { - BLO_read_id_address(reader, id->lib, &chan->ipo); - } -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Read ID: WorkSpace - * \{ */ - -static void lib_link_workspace_instance_hook(BlendLibReader *reader, - WorkSpaceInstanceHook *hook, - ID *id) -{ - WorkSpace *workspace = BKE_workspace_active_get(hook); - BLO_read_id_address(reader, id->lib, &workspace); - BKE_workspace_active_set(hook, workspace); -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Read ID: Armature - * \{ */ - -/* temp struct used to transport needed info to lib_link_constraint_cb() */ -typedef struct tConstraintLinkData { - BlendLibReader *reader; - ID *id; -} tConstraintLinkData; -/* callback function used to relink constraint ID-links */ -static void lib_link_constraint_cb(bConstraint *UNUSED(con), - ID **idpoin, - bool UNUSED(is_reference), - void *userdata) -{ - tConstraintLinkData *cld = (tConstraintLinkData *)userdata; - BLO_read_id_address(cld->reader, cld->id->lib, idpoin); -} - -static void lib_link_constraints(BlendLibReader *reader, ID *id, ListBase *conlist) -{ - tConstraintLinkData cld; - - /* legacy fixes */ - LISTBASE_FOREACH (bConstraint *, con, conlist) { - /* patch for error introduced by changing constraints (dunno how) */ - /* if con->data type changes, dna cannot resolve the pointer! (ton) */ - if (con->data == NULL) { - con->type = CONSTRAINT_TYPE_NULL; - } - /* own ipo, all constraints have it */ - BLO_read_id_address(reader, id->lib, &con->ipo); /* XXX deprecated - old animation system */ - - /* If linking from a library, clear 'local' library override flag. */ - if (id->lib != NULL) { - con->flag &= ~CONSTRAINT_OVERRIDE_LIBRARY_LOCAL; - } - } - - /* relink all ID-blocks used by the constraints */ - cld.reader = reader; - cld.id = id; - - BKE_constraints_id_loop(conlist, lib_link_constraint_cb, &cld); -} - -static void direct_link_constraints(BlendDataReader *reader, ListBase *lb) -{ - BLO_read_list(reader, lb); - LISTBASE_FOREACH (bConstraint *, con, lb) { - BLO_read_data_address(reader, &con->data); - - switch (con->type) { - case CONSTRAINT_TYPE_PYTHON: { - bPythonConstraint *data = con->data; - - BLO_read_list(reader, &data->targets); - - BLO_read_data_address(reader, &data->prop); - IDP_BlendDataRead(reader, &data->prop); - break; - } - case CONSTRAINT_TYPE_ARMATURE: { - bArmatureConstraint *data = con->data; - - BLO_read_list(reader, &data->targets); - - break; - } - case CONSTRAINT_TYPE_SPLINEIK: { - bSplineIKConstraint *data = con->data; - - BLO_read_data_address(reader, &data->points); - break; - } - case CONSTRAINT_TYPE_KINEMATIC: { - bKinematicConstraint *data = con->data; - - con->lin_error = 0.0f; - con->rot_error = 0.0f; - - /* version patch for runtime flag, was not cleared in some case */ - data->flag &= ~CONSTRAINT_IK_AUTO; - break; - } - case CONSTRAINT_TYPE_CHILDOF: { - /* XXX version patch, in older code this flag wasn't always set, and is inherent to type */ - if (con->ownspace == CONSTRAINT_SPACE_POSE) { - con->flag |= CONSTRAINT_SPACEONCE; - } - break; - } - case CONSTRAINT_TYPE_TRANSFORM_CACHE: { - bTransformCacheConstraint *data = con->data; - data->reader = NULL; - data->reader_object_path[0] = '\0'; - } - } - } -} - -static void lib_link_pose(BlendLibReader *reader, Object *ob, bPose *pose) -{ - bArmature *arm = ob->data; - - if (!pose || !arm) { - return; - } - - /* always rebuild to match proxy or lib changes, but on Undo */ - bool rebuild = false; - - if (!BLO_read_lib_is_undo(reader)) { - if (ob->proxy || ob->id.lib != arm->id.lib) { - rebuild = true; - } - } - - if (ob->proxy) { - /* sync proxy layer */ - if (pose->proxy_layer) { - arm->layer = pose->proxy_layer; - } - - /* sync proxy active bone */ - if (pose->proxy_act_bone[0]) { - Bone *bone = BKE_armature_find_bone_name(arm, pose->proxy_act_bone); - if (bone) { - arm->act_bone = bone; - } - } - } - - LISTBASE_FOREACH (bPoseChannel *, pchan, &pose->chanbase) { - lib_link_constraints(reader, (ID *)ob, &pchan->constraints); - - pchan->bone = BKE_armature_find_bone_name(arm, pchan->name); - - IDP_BlendReadLib(reader, pchan->prop); - - BLO_read_id_address(reader, arm->id.lib, &pchan->custom); - if (UNLIKELY(pchan->bone == NULL)) { - rebuild = true; - } - else if ((ob->id.lib == NULL) && arm->id.lib) { - /* local pose selection copied to armature, bit hackish */ - pchan->bone->flag &= ~BONE_SELECTED; - pchan->bone->flag |= pchan->selectflag; - } - } - - if (rebuild) { - DEG_id_tag_update_ex( - reader->main, &ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION); - BKE_pose_tag_recalc(reader->main, pose); - } -} - /** \} */ /* -------------------------------------------------------------------- */ @@ -2757,1202 +2425,9 @@ void blo_do_versions_key_uidgen(Key *key) /** \} */ /* -------------------------------------------------------------------- */ -/** \name Read ID: Particle Settings - * \{ */ - -/* update this also to writefile.c */ -static const char *ptcache_data_struct[] = { - "", /* BPHYS_DATA_INDEX */ - "", /* BPHYS_DATA_LOCATION */ - "", /* BPHYS_DATA_VELOCITY */ - "", /* BPHYS_DATA_ROTATION */ - "", /* BPHYS_DATA_AVELOCITY / BPHYS_DATA_XCONST */ - "", /* BPHYS_DATA_SIZE: */ - "", /* BPHYS_DATA_TIMES: */ - "BoidData", /* case BPHYS_DATA_BOIDS: */ -}; - -static void direct_link_pointcache_cb(BlendDataReader *reader, void *data) -{ - PTCacheMem *pm = data; - for (int i = 0; i < BPHYS_TOT_DATA; i++) { - BLO_read_data_address(reader, &pm->data[i]); - - /* the cache saves non-struct data without DNA */ - if (pm->data[i] && ptcache_data_struct[i][0] == '\0' && - BLO_read_requires_endian_switch(reader)) { - /* data_size returns bytes. */ - int tot = (BKE_ptcache_data_size(i) * pm->totpoint) / sizeof(int); - - int *poin = pm->data[i]; - - BLI_endian_switch_int32_array(poin, tot); - } - } - - BLO_read_list(reader, &pm->extradata); - - LISTBASE_FOREACH (PTCacheExtra *, extra, &pm->extradata) { - BLO_read_data_address(reader, &extra->data); - } -} - -static void direct_link_pointcache(BlendDataReader *reader, PointCache *cache) -{ - if ((cache->flag & PTCACHE_DISK_CACHE) == 0) { - BLO_read_list_cb(reader, &cache->mem_cache, direct_link_pointcache_cb); - } - else { - BLI_listbase_clear(&cache->mem_cache); - } - - cache->flag &= ~PTCACHE_SIMULATION_VALID; - cache->simframe = 0; - cache->edit = NULL; - cache->free_edit = NULL; - cache->cached_frames = NULL; - cache->cached_frames_len = 0; -} - -static void direct_link_pointcache_list(BlendDataReader *reader, - ListBase *ptcaches, - PointCache **ocache, - int force_disk) -{ - if (ptcaches->first) { - BLO_read_list(reader, ptcaches); - LISTBASE_FOREACH (PointCache *, cache, ptcaches) { - direct_link_pointcache(reader, cache); - if (force_disk) { - cache->flag |= PTCACHE_DISK_CACHE; - cache->step = 1; - } - } - - BLO_read_data_address(reader, ocache); - } - else if (*ocache) { - /* old "single" caches need to be linked too */ - BLO_read_data_address(reader, ocache); - direct_link_pointcache(reader, *ocache); - if (force_disk) { - (*ocache)->flag |= PTCACHE_DISK_CACHE; - (*ocache)->step = 1; - } - - ptcaches->first = ptcaches->last = *ocache; - } -} - -static void lib_link_particlesystems(BlendLibReader *reader, - Object *ob, - ID *id, - ListBase *particles) -{ - LISTBASE_FOREACH_MUTABLE (ParticleSystem *, psys, particles) { - - BLO_read_id_address(reader, id->lib, &psys->part); - if (psys->part) { - LISTBASE_FOREACH (ParticleTarget *, pt, &psys->targets) { - BLO_read_id_address(reader, id->lib, &pt->ob); - } - - BLO_read_id_address(reader, id->lib, &psys->parent); - BLO_read_id_address(reader, id->lib, &psys->target_ob); - - if (psys->clmd) { - /* XXX - from reading existing code this seems correct but intended usage of - * pointcache /w cloth should be added in 'ParticleSystem' - campbell */ - psys->clmd->point_cache = psys->pointcache; - psys->clmd->ptcaches.first = psys->clmd->ptcaches.last = NULL; - BLO_read_id_address(reader, id->lib, &psys->clmd->coll_parms->group); - psys->clmd->modifier.error = NULL; - } - } - else { - /* particle modifier must be removed before particle system */ - ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys); - BLI_remlink(&ob->modifiers, psmd); - BKE_modifier_free((ModifierData *)psmd); - - BLI_remlink(particles, psys); - MEM_freeN(psys); - } - } -} -static void direct_link_particlesystems(BlendDataReader *reader, ListBase *particles) -{ - ParticleData *pa; - int a; - - LISTBASE_FOREACH (ParticleSystem *, psys, particles) { - BLO_read_data_address(reader, &psys->particles); - - if (psys->particles && psys->particles->hair) { - for (a = 0, pa = psys->particles; a < psys->totpart; a++, pa++) { - BLO_read_data_address(reader, &pa->hair); - } - } - - if (psys->particles && psys->particles->keys) { - for (a = 0, pa = psys->particles; a < psys->totpart; a++, pa++) { - pa->keys = NULL; - pa->totkey = 0; - } - - psys->flag &= ~PSYS_KEYED; - } - - if (psys->particles && psys->particles->boid) { - pa = psys->particles; - BLO_read_data_address(reader, &pa->boid); - - /* This is purely runtime data, but still can be an issue if left dangling. */ - pa->boid->ground = NULL; - - for (a = 1, pa++; a < psys->totpart; a++, pa++) { - pa->boid = (pa - 1)->boid + 1; - pa->boid->ground = NULL; - } - } - else if (psys->particles) { - for (a = 0, pa = psys->particles; a < psys->totpart; a++, pa++) { - pa->boid = NULL; - } - } - - BLO_read_data_address(reader, &psys->fluid_springs); - - BLO_read_data_address(reader, &psys->child); - psys->effectors = NULL; - - BLO_read_list(reader, &psys->targets); - - psys->edit = NULL; - psys->free_edit = NULL; - psys->pathcache = NULL; - psys->childcache = NULL; - BLI_listbase_clear(&psys->pathcachebufs); - BLI_listbase_clear(&psys->childcachebufs); - psys->pdd = NULL; - - if (psys->clmd) { - BLO_read_data_address(reader, &psys->clmd); - psys->clmd->clothObject = NULL; - psys->clmd->hairdata = NULL; - - BLO_read_data_address(reader, &psys->clmd->sim_parms); - BLO_read_data_address(reader, &psys->clmd->coll_parms); - - if (psys->clmd->sim_parms) { - psys->clmd->sim_parms->effector_weights = NULL; - if (psys->clmd->sim_parms->presets > 10) { - psys->clmd->sim_parms->presets = 0; - } - } - - psys->hair_in_mesh = psys->hair_out_mesh = NULL; - psys->clmd->solver_result = NULL; - } - - direct_link_pointcache_list(reader, &psys->ptcaches, &psys->pointcache, 0); - if (psys->clmd) { - psys->clmd->point_cache = psys->pointcache; - } - - psys->tree = NULL; - psys->bvhtree = NULL; - - psys->orig_psys = NULL; - psys->batch_cache = NULL; - } -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Read ID: Mesh - * \{ */ - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Read ID: Object - * \{ */ - -static void lib_link_modifiers_common(void *userData, Object *ob, ID **idpoin, int cb_flag) -{ - BlendLibReader *reader = userData; - - BLO_read_id_address(reader, ob->id.lib, idpoin); - if (*idpoin != NULL && (cb_flag & IDWALK_CB_USER) != 0) { - id_us_plus_no_lib(*idpoin); - } -} - -static void lib_link_modifiers(BlendLibReader *reader, Object *ob) -{ - BKE_modifiers_foreach_ID_link(ob, lib_link_modifiers_common, reader); - - /* If linking from a library, clear 'local' library override flag. */ - if (ob->id.lib != NULL) { - LISTBASE_FOREACH (ModifierData *, mod, &ob->modifiers) { - mod->flag &= ~eModifierFlag_OverrideLibrary_Local; - } - } -} - -static void lib_link_gpencil_modifiers(BlendLibReader *reader, Object *ob) -{ - BKE_gpencil_modifiers_foreach_ID_link(ob, lib_link_modifiers_common, reader); - - /* If linking from a library, clear 'local' library override flag. */ - if (ob->id.lib != NULL) { - LISTBASE_FOREACH (GpencilModifierData *, mod, &ob->greasepencil_modifiers) { - mod->flag &= ~eGpencilModifierFlag_OverrideLibrary_Local; - } - } -} - -static void lib_link_shaderfxs(BlendLibReader *reader, Object *ob) -{ - BKE_shaderfx_foreach_ID_link(ob, lib_link_modifiers_common, reader); - - /* If linking from a library, clear 'local' library override flag. */ - if (ob->id.lib != NULL) { - LISTBASE_FOREACH (ShaderFxData *, fx, &ob->shader_fx) { - fx->flag &= ~eShaderFxFlag_OverrideLibrary_Local; - } - } -} - -static void lib_link_object(BlendLibReader *reader, Object *ob) -{ - bool warn = false; - - /* XXX deprecated - old animation system <<< */ - BLO_read_id_address(reader, ob->id.lib, &ob->ipo); - BLO_read_id_address(reader, ob->id.lib, &ob->action); - /* >>> XXX deprecated - old animation system */ - - BLO_read_id_address(reader, ob->id.lib, &ob->parent); - BLO_read_id_address(reader, ob->id.lib, &ob->track); - BLO_read_id_address(reader, ob->id.lib, &ob->poselib); - - /* 2.8x drops support for non-empty dupli instances. */ - if (ob->type == OB_EMPTY) { - BLO_read_id_address(reader, ob->id.lib, &ob->instance_collection); - } - else { - if (ob->instance_collection != NULL) { - ID *id = BLO_read_get_new_id_address(reader, ob->id.lib, &ob->instance_collection->id); - blo_reportf_wrap(reader->fd->reports, - RPT_WARNING, - TIP_("Non-Empty object '%s' cannot duplicate collection '%s' " - "anymore in Blender 2.80, removed instancing"), - ob->id.name + 2, - id->name + 2); - } - ob->instance_collection = NULL; - ob->transflag &= ~OB_DUPLICOLLECTION; - } - - BLO_read_id_address(reader, ob->id.lib, &ob->proxy); - if (ob->proxy) { - /* paranoia check, actually a proxy_from pointer should never be written... */ - if (ob->proxy->id.lib == NULL) { - ob->proxy->proxy_from = NULL; - ob->proxy = NULL; - - if (ob->id.lib) { - printf("Proxy lost from object %s lib %s\n", ob->id.name + 2, ob->id.lib->filepath); - } - else { - printf("Proxy lost from object %s lib <NONE>\n", ob->id.name + 2); - } - } - else { - /* this triggers object_update to always use a copy */ - ob->proxy->proxy_from = ob; - } - } - BLO_read_id_address(reader, ob->id.lib, &ob->proxy_group); - - void *poin = ob->data; - BLO_read_id_address(reader, ob->id.lib, &ob->data); - - if (ob->data == NULL && poin != NULL) { - if (ob->id.lib) { - printf("Can't find obdata of %s lib %s\n", ob->id.name + 2, ob->id.lib->filepath); - } - else { - printf("Object %s lost data.\n", ob->id.name + 2); - } - - ob->type = OB_EMPTY; - warn = true; - - if (ob->pose) { - /* we can't call #BKE_pose_free() here because of library linking - * freeing will recurse down into every pose constraints ID pointers - * which are not always valid, so for now free directly and suffer - * some leaked memory rather than crashing immediately - * while bad this _is_ an exceptional case - campbell */ -#if 0 - BKE_pose_free(ob->pose); -#else - MEM_freeN(ob->pose); -#endif - ob->pose = NULL; - ob->mode &= ~OB_MODE_POSE; - } - } - for (int a = 0; a < ob->totcol; a++) { - BLO_read_id_address(reader, ob->id.lib, &ob->mat[a]); - } - - /* When the object is local and the data is library its possible - * the material list size gets out of sync. T22663. */ - if (ob->data && ob->id.lib != ((ID *)ob->data)->lib) { - const short *totcol_data = BKE_object_material_len_p(ob); - /* Only expand so as not to lose any object materials that might be set. */ - if (totcol_data && (*totcol_data > ob->totcol)) { - /* printf("'%s' %d -> %d\n", ob->id.name, ob->totcol, *totcol_data); */ - BKE_object_material_resize(reader->main, ob, *totcol_data, false); - } - } - - BLO_read_id_address(reader, ob->id.lib, &ob->gpd); - - /* if id.us==0 a new base will be created later on */ - - /* WARNING! Also check expand_object(), should reflect the stuff below. */ - lib_link_pose(reader, ob, ob->pose); - lib_link_constraints(reader, &ob->id, &ob->constraints); - - /* XXX deprecated - old animation system <<< */ - lib_link_constraint_channels(reader, &ob->id, &ob->constraintChannels); - lib_link_nlastrips(reader, &ob->id, &ob->nlastrips); - /* >>> XXX deprecated - old animation system */ - - LISTBASE_FOREACH (PartEff *, paf, &ob->effect) { - if (paf->type == EFF_PARTICLE) { - BLO_read_id_address(reader, ob->id.lib, &paf->group); - } - } - - { - FluidsimModifierData *fluidmd = (FluidsimModifierData *)BKE_modifiers_findby_type( - ob, eModifierType_Fluidsim); - - if (fluidmd && fluidmd->fss) { - BLO_read_id_address( - reader, ob->id.lib, &fluidmd->fss->ipo); /* XXX deprecated - old animation system */ - } - } - - { - FluidModifierData *fmd = (FluidModifierData *)BKE_modifiers_findby_type(ob, - eModifierType_Fluid); - - if (fmd && (fmd->type == MOD_FLUID_TYPE_DOMAIN) && fmd->domain) { - /* Flag for refreshing the simulation after loading */ - fmd->domain->flags |= FLUID_DOMAIN_FILE_LOAD; - } - else if (fmd && (fmd->type == MOD_FLUID_TYPE_FLOW) && fmd->flow) { - fmd->flow->flags &= ~FLUID_FLOW_NEEDS_UPDATE; - } - else if (fmd && (fmd->type == MOD_FLUID_TYPE_EFFEC) && fmd->effector) { - fmd->effector->flags &= ~FLUID_EFFECTOR_NEEDS_UPDATE; - } - } - - /* texture field */ - if (ob->pd) { - BKE_particle_partdeflect_blend_read_lib(reader, &ob->id, ob->pd); - } - - if (ob->soft) { - BLO_read_id_address(reader, ob->id.lib, &ob->soft->collision_group); - - BLO_read_id_address(reader, ob->id.lib, &ob->soft->effector_weights->group); - } - - lib_link_particlesystems(reader, ob, &ob->id, &ob->particlesystem); - lib_link_modifiers(reader, ob); - lib_link_gpencil_modifiers(reader, ob); - lib_link_shaderfxs(reader, ob); - - if (ob->rigidbody_constraint) { - BLO_read_id_address(reader, ob->id.lib, &ob->rigidbody_constraint->ob1); - BLO_read_id_address(reader, ob->id.lib, &ob->rigidbody_constraint->ob2); - } - - if (warn) { - BKE_report(reader->fd->reports, RPT_WARNING, "Warning in console"); - } -} - -/* direct data for cache */ -static void direct_link_motionpath(BlendDataReader *reader, bMotionPath *mpath) -{ - /* sanity check */ - if (mpath == NULL) { - return; - } - - /* relink points cache */ - BLO_read_data_address(reader, &mpath->points); - - mpath->points_vbo = NULL; - mpath->batch_line = NULL; - mpath->batch_points = NULL; -} - -static void direct_link_pose(BlendDataReader *reader, bPose *pose) -{ - if (!pose) { - return; - } - - BLO_read_list(reader, &pose->chanbase); - BLO_read_list(reader, &pose->agroups); - - pose->chanhash = NULL; - pose->chan_array = NULL; - - LISTBASE_FOREACH (bPoseChannel *, pchan, &pose->chanbase) { - BKE_pose_channel_runtime_reset(&pchan->runtime); - BKE_pose_channel_session_uuid_generate(pchan); - - pchan->bone = NULL; - BLO_read_data_address(reader, &pchan->parent); - BLO_read_data_address(reader, &pchan->child); - BLO_read_data_address(reader, &pchan->custom_tx); - - BLO_read_data_address(reader, &pchan->bbone_prev); - BLO_read_data_address(reader, &pchan->bbone_next); - - direct_link_constraints(reader, &pchan->constraints); - - BLO_read_data_address(reader, &pchan->prop); - IDP_BlendDataRead(reader, &pchan->prop); - - BLO_read_data_address(reader, &pchan->mpath); - if (pchan->mpath) { - direct_link_motionpath(reader, pchan->mpath); - } - - BLI_listbase_clear(&pchan->iktree); - BLI_listbase_clear(&pchan->siktree); - - /* in case this value changes in future, clamp else we get undefined behavior */ - CLAMP(pchan->rotmode, ROT_MODE_MIN, ROT_MODE_MAX); - - pchan->draw_data = NULL; - } - pose->ikdata = NULL; - if (pose->ikparam != NULL) { - BLO_read_data_address(reader, &pose->ikparam); - } -} - -/* TODO(sergey): Find a better place for this. - * - * Unfortunately, this can not be done as a regular do_versions() since the modifier type is - * set to NONE, so the do_versions code wouldn't know where the modifier came from. - * - * The best approach seems to have the functionality in versioning_280.c but still call the - * function from #direct_link_modifiers(). - */ - -/* Domain, inflow, ... */ -static void modifier_ensure_type(FluidModifierData *fluid_modifier_data, int type) -{ - fluid_modifier_data->type = type; - BKE_fluid_modifier_free(fluid_modifier_data); - BKE_fluid_modifier_create_type_data(fluid_modifier_data); -} - -/** - * \note The old_modifier_data is NOT linked. - * This means that in order to access sub-data pointers #newdataadr is to be used. - */ -static ModifierData *modifier_replace_with_fluid(FileData *fd, - Object *object, - ListBase *modifiers, - ModifierData *old_modifier_data) -{ - ModifierData *new_modifier_data = BKE_modifier_new(eModifierType_Fluid); - FluidModifierData *fluid_modifier_data = (FluidModifierData *)new_modifier_data; - - if (old_modifier_data->type == eModifierType_Fluidsim) { - FluidsimModifierData *old_fluidsim_modifier_data = (FluidsimModifierData *)old_modifier_data; - FluidsimSettings *old_fluidsim_settings = newdataadr(fd, old_fluidsim_modifier_data->fss); - switch (old_fluidsim_settings->type) { - case OB_FLUIDSIM_ENABLE: - modifier_ensure_type(fluid_modifier_data, 0); - break; - case OB_FLUIDSIM_DOMAIN: - modifier_ensure_type(fluid_modifier_data, MOD_FLUID_TYPE_DOMAIN); - BKE_fluid_domain_type_set(object, fluid_modifier_data->domain, FLUID_DOMAIN_TYPE_LIQUID); - break; - case OB_FLUIDSIM_FLUID: - modifier_ensure_type(fluid_modifier_data, MOD_FLUID_TYPE_FLOW); - BKE_fluid_flow_type_set(object, fluid_modifier_data->flow, FLUID_FLOW_TYPE_LIQUID); - /* No need to emit liquid far away from surface. */ - fluid_modifier_data->flow->surface_distance = 0.0f; - break; - case OB_FLUIDSIM_OBSTACLE: - modifier_ensure_type(fluid_modifier_data, MOD_FLUID_TYPE_EFFEC); - BKE_fluid_effector_type_set( - object, fluid_modifier_data->effector, FLUID_EFFECTOR_TYPE_COLLISION); - break; - case OB_FLUIDSIM_INFLOW: - modifier_ensure_type(fluid_modifier_data, MOD_FLUID_TYPE_FLOW); - BKE_fluid_flow_type_set(object, fluid_modifier_data->flow, FLUID_FLOW_TYPE_LIQUID); - BKE_fluid_flow_behavior_set(object, fluid_modifier_data->flow, FLUID_FLOW_BEHAVIOR_INFLOW); - /* No need to emit liquid far away from surface. */ - fluid_modifier_data->flow->surface_distance = 0.0f; - break; - case OB_FLUIDSIM_OUTFLOW: - modifier_ensure_type(fluid_modifier_data, MOD_FLUID_TYPE_FLOW); - BKE_fluid_flow_type_set(object, fluid_modifier_data->flow, FLUID_FLOW_TYPE_LIQUID); - BKE_fluid_flow_behavior_set( - object, fluid_modifier_data->flow, FLUID_FLOW_BEHAVIOR_OUTFLOW); - break; - case OB_FLUIDSIM_PARTICLE: - /* "Particle" type objects not being used by Mantaflow fluid simulations. - * Skip this object, secondary particles can only be enabled through the domain object. */ - break; - case OB_FLUIDSIM_CONTROL: - /* "Control" type objects not being used by Mantaflow fluid simulations. - * Use guiding type instead which is similar. */ - modifier_ensure_type(fluid_modifier_data, MOD_FLUID_TYPE_EFFEC); - BKE_fluid_effector_type_set( - object, fluid_modifier_data->effector, FLUID_EFFECTOR_TYPE_GUIDE); - break; - } - } - else if (old_modifier_data->type == eModifierType_Smoke) { - SmokeModifierData *old_smoke_modifier_data = (SmokeModifierData *)old_modifier_data; - modifier_ensure_type(fluid_modifier_data, old_smoke_modifier_data->type); - if (fluid_modifier_data->type == MOD_FLUID_TYPE_DOMAIN) { - BKE_fluid_domain_type_set(object, fluid_modifier_data->domain, FLUID_DOMAIN_TYPE_GAS); - } - else if (fluid_modifier_data->type == MOD_FLUID_TYPE_FLOW) { - BKE_fluid_flow_type_set(object, fluid_modifier_data->flow, FLUID_FLOW_TYPE_SMOKE); - } - else if (fluid_modifier_data->type == MOD_FLUID_TYPE_EFFEC) { - BKE_fluid_effector_type_set( - object, fluid_modifier_data->effector, FLUID_EFFECTOR_TYPE_COLLISION); - } - } - - /* Replace modifier data in the stack. */ - new_modifier_data->next = old_modifier_data->next; - new_modifier_data->prev = old_modifier_data->prev; - if (new_modifier_data->prev != NULL) { - new_modifier_data->prev->next = new_modifier_data; - } - if (new_modifier_data->next != NULL) { - new_modifier_data->next->prev = new_modifier_data; - } - if (modifiers->first == old_modifier_data) { - modifiers->first = new_modifier_data; - } - if (modifiers->last == old_modifier_data) { - modifiers->last = new_modifier_data; - } - - /* Free old modifier data. */ - MEM_freeN(old_modifier_data); - - return new_modifier_data; -} - -static void direct_link_modifiers(BlendDataReader *reader, ListBase *lb, Object *ob) -{ - BLO_read_list(reader, lb); - - LISTBASE_FOREACH (ModifierData *, md, lb) { - BKE_modifier_session_uuid_generate(md); - - md->error = NULL; - md->runtime = NULL; - - /* Modifier data has been allocated as a part of data migration process and - * no reading of nested fields from file is needed. */ - bool is_allocated = false; - - if (md->type == eModifierType_Fluidsim) { - blo_reportf_wrap( - reader->fd->reports, - RPT_WARNING, - TIP_("Possible data loss when saving this file! %s modifier is deprecated (Object: %s)"), - md->name, - ob->id.name + 2); - md = modifier_replace_with_fluid(reader->fd, ob, lb, md); - is_allocated = true; - } - else if (md->type == eModifierType_Smoke) { - blo_reportf_wrap( - reader->fd->reports, - RPT_WARNING, - TIP_("Possible data loss when saving this file! %s modifier is deprecated (Object: %s)"), - md->name, - ob->id.name + 2); - md = modifier_replace_with_fluid(reader->fd, ob, lb, md); - is_allocated = true; - } - - const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type); - - /* if modifiers disappear, or for upward compatibility */ - if (mti == NULL) { - md->type = eModifierType_None; - } - - if (is_allocated) { - /* All the fields has been properly allocated. */ - } - else if (md->type == eModifierType_Cloth) { - ClothModifierData *clmd = (ClothModifierData *)md; - - clmd->clothObject = NULL; - clmd->hairdata = NULL; - - BLO_read_data_address(reader, &clmd->sim_parms); - BLO_read_data_address(reader, &clmd->coll_parms); - - direct_link_pointcache_list(reader, &clmd->ptcaches, &clmd->point_cache, 0); - - if (clmd->sim_parms) { - if (clmd->sim_parms->presets > 10) { - clmd->sim_parms->presets = 0; - } - - clmd->sim_parms->reset = 0; - - BLO_read_data_address(reader, &clmd->sim_parms->effector_weights); - - if (!clmd->sim_parms->effector_weights) { - clmd->sim_parms->effector_weights = BKE_effector_add_weights(NULL); - } - } - - clmd->solver_result = NULL; - } - else if (md->type == eModifierType_Fluid) { - - FluidModifierData *fmd = (FluidModifierData *)md; - - if (fmd->type == MOD_FLUID_TYPE_DOMAIN) { - fmd->flow = NULL; - fmd->effector = NULL; - BLO_read_data_address(reader, &fmd->domain); - fmd->domain->fmd = fmd; - - fmd->domain->fluid = NULL; - fmd->domain->fluid_mutex = BLI_rw_mutex_alloc(); - fmd->domain->tex_density = NULL; - fmd->domain->tex_color = NULL; - fmd->domain->tex_shadow = NULL; - fmd->domain->tex_flame = NULL; - fmd->domain->tex_flame_coba = NULL; - fmd->domain->tex_coba = NULL; - fmd->domain->tex_field = NULL; - fmd->domain->tex_velocity_x = NULL; - fmd->domain->tex_velocity_y = NULL; - fmd->domain->tex_velocity_z = NULL; - fmd->domain->tex_wt = NULL; - fmd->domain->mesh_velocities = NULL; - BLO_read_data_address(reader, &fmd->domain->coba); - - BLO_read_data_address(reader, &fmd->domain->effector_weights); - if (!fmd->domain->effector_weights) { - fmd->domain->effector_weights = BKE_effector_add_weights(NULL); - } - - direct_link_pointcache_list( - reader, &(fmd->domain->ptcaches[0]), &(fmd->domain->point_cache[0]), 1); - - /* Manta sim uses only one cache from now on, so store pointer convert */ - if (fmd->domain->ptcaches[1].first || fmd->domain->point_cache[1]) { - if (fmd->domain->point_cache[1]) { - PointCache *cache = BLO_read_get_new_data_address(reader, fmd->domain->point_cache[1]); - if (cache->flag & PTCACHE_FAKE_SMOKE) { - /* Manta-sim/smoke was already saved in "new format" and this cache is a fake one. */ - } - else { - printf( - "High resolution manta cache not available due to pointcache update. Please " - "reset the simulation.\n"); - } - BKE_ptcache_free(cache); - } - BLI_listbase_clear(&fmd->domain->ptcaches[1]); - fmd->domain->point_cache[1] = NULL; - } - } - else if (fmd->type == MOD_FLUID_TYPE_FLOW) { - fmd->domain = NULL; - fmd->effector = NULL; - BLO_read_data_address(reader, &fmd->flow); - fmd->flow->fmd = fmd; - fmd->flow->mesh = NULL; - fmd->flow->verts_old = NULL; - fmd->flow->numverts = 0; - BLO_read_data_address(reader, &fmd->flow->psys); - } - else if (fmd->type == MOD_FLUID_TYPE_EFFEC) { - fmd->flow = NULL; - fmd->domain = NULL; - BLO_read_data_address(reader, &fmd->effector); - if (fmd->effector) { - fmd->effector->fmd = fmd; - fmd->effector->verts_old = NULL; - fmd->effector->numverts = 0; - fmd->effector->mesh = NULL; - } - else { - fmd->type = 0; - fmd->flow = NULL; - fmd->domain = NULL; - fmd->effector = NULL; - } - } - } - else if (md->type == eModifierType_DynamicPaint) { - DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md; - - if (pmd->canvas) { - BLO_read_data_address(reader, &pmd->canvas); - pmd->canvas->pmd = pmd; - pmd->canvas->flags &= ~MOD_DPAINT_BAKING; /* just in case */ - - if (pmd->canvas->surfaces.first) { - BLO_read_list(reader, &pmd->canvas->surfaces); - - LISTBASE_FOREACH (DynamicPaintSurface *, surface, &pmd->canvas->surfaces) { - surface->canvas = pmd->canvas; - surface->data = NULL; - direct_link_pointcache_list(reader, &(surface->ptcaches), &(surface->pointcache), 1); - - BLO_read_data_address(reader, &surface->effector_weights); - if (surface->effector_weights == NULL) { - surface->effector_weights = BKE_effector_add_weights(NULL); - } - } - } - } - if (pmd->brush) { - BLO_read_data_address(reader, &pmd->brush); - pmd->brush->pmd = pmd; - BLO_read_data_address(reader, &pmd->brush->psys); - BLO_read_data_address(reader, &pmd->brush->paint_ramp); - BLO_read_data_address(reader, &pmd->brush->vel_ramp); - } - } - - if (mti->blendRead != NULL) { - mti->blendRead(reader, md); - } - } -} - -static void direct_link_gpencil_modifiers(BlendDataReader *reader, ListBase *lb) -{ - BLO_read_list(reader, lb); - - LISTBASE_FOREACH (GpencilModifierData *, md, lb) { - md->error = NULL; - - /* if modifiers disappear, or for upward compatibility */ - if (NULL == BKE_gpencil_modifier_get_info(md->type)) { - md->type = eModifierType_None; - } - - if (md->type == eGpencilModifierType_Lattice) { - LatticeGpencilModifierData *gpmd = (LatticeGpencilModifierData *)md; - gpmd->cache_data = NULL; - } - else if (md->type == eGpencilModifierType_Hook) { - HookGpencilModifierData *hmd = (HookGpencilModifierData *)md; - - BLO_read_data_address(reader, &hmd->curfalloff); - if (hmd->curfalloff) { - BKE_curvemapping_blend_read(reader, hmd->curfalloff); - } - } - else if (md->type == eGpencilModifierType_Noise) { - NoiseGpencilModifierData *gpmd = (NoiseGpencilModifierData *)md; - - BLO_read_data_address(reader, &gpmd->curve_intensity); - if (gpmd->curve_intensity) { - BKE_curvemapping_blend_read(reader, gpmd->curve_intensity); - /* initialize the curve. Maybe this could be moved to modififer logic */ - BKE_curvemapping_init(gpmd->curve_intensity); - } - } - else if (md->type == eGpencilModifierType_Thick) { - ThickGpencilModifierData *gpmd = (ThickGpencilModifierData *)md; - - BLO_read_data_address(reader, &gpmd->curve_thickness); - if (gpmd->curve_thickness) { - BKE_curvemapping_blend_read(reader, gpmd->curve_thickness); - BKE_curvemapping_init(gpmd->curve_thickness); - } - } - else if (md->type == eGpencilModifierType_Tint) { - TintGpencilModifierData *gpmd = (TintGpencilModifierData *)md; - BLO_read_data_address(reader, &gpmd->colorband); - BLO_read_data_address(reader, &gpmd->curve_intensity); - if (gpmd->curve_intensity) { - BKE_curvemapping_blend_read(reader, gpmd->curve_intensity); - BKE_curvemapping_init(gpmd->curve_intensity); - } - } - else if (md->type == eGpencilModifierType_Smooth) { - SmoothGpencilModifierData *gpmd = (SmoothGpencilModifierData *)md; - BLO_read_data_address(reader, &gpmd->curve_intensity); - if (gpmd->curve_intensity) { - BKE_curvemapping_blend_read(reader, gpmd->curve_intensity); - BKE_curvemapping_init(gpmd->curve_intensity); - } - } - else if (md->type == eGpencilModifierType_Color) { - ColorGpencilModifierData *gpmd = (ColorGpencilModifierData *)md; - BLO_read_data_address(reader, &gpmd->curve_intensity); - if (gpmd->curve_intensity) { - BKE_curvemapping_blend_read(reader, gpmd->curve_intensity); - BKE_curvemapping_init(gpmd->curve_intensity); - } - } - else if (md->type == eGpencilModifierType_Opacity) { - OpacityGpencilModifierData *gpmd = (OpacityGpencilModifierData *)md; - BLO_read_data_address(reader, &gpmd->curve_intensity); - if (gpmd->curve_intensity) { - BKE_curvemapping_blend_read(reader, gpmd->curve_intensity); - BKE_curvemapping_init(gpmd->curve_intensity); - } - } - } -} - -static void direct_link_shaderfxs(BlendDataReader *reader, ListBase *lb) -{ - BLO_read_list(reader, lb); - - LISTBASE_FOREACH (ShaderFxData *, fx, lb) { - fx->error = NULL; - - /* if shader disappear, or for upward compatibility */ - if (NULL == BKE_shaderfx_get_info(fx->type)) { - fx->type = eShaderFxType_None; - } - } -} - -static void direct_link_object(BlendDataReader *reader, Object *ob) -{ - PartEff *paf; - - /* XXX This should not be needed - but seems like it can happen in some cases, - * so for now play safe. */ - ob->proxy_from = NULL; - - const bool is_undo = BLO_read_data_is_undo(reader); - if (ob->id.tag & (LIB_TAG_EXTERN | LIB_TAG_INDIRECT)) { - /* Do not allow any non-object mode for linked data. - * See T34776, T42780, T81027 for more information. */ - ob->mode &= ~OB_MODE_ALL_MODE_DATA; - } - else if (is_undo) { - /* For undo we want to stay in object mode during undo presses, so keep some edit modes - * disabled. - * TODO: Check if we should not disable more edit modes here? */ - ob->mode &= ~(OB_MODE_EDIT | OB_MODE_PARTICLE_EDIT); - } - - BLO_read_data_address(reader, &ob->adt); - BKE_animdata_blend_read_data(reader, ob->adt); - - BLO_read_data_address(reader, &ob->pose); - direct_link_pose(reader, ob->pose); - - BLO_read_data_address(reader, &ob->mpath); - if (ob->mpath) { - direct_link_motionpath(reader, ob->mpath); - } - - BLO_read_list(reader, &ob->defbase); - BLO_read_list(reader, &ob->fmaps); - /* XXX deprecated - old animation system <<< */ - direct_link_nlastrips(reader, &ob->nlastrips); - BLO_read_list(reader, &ob->constraintChannels); - /* >>> XXX deprecated - old animation system */ - - BLO_read_pointer_array(reader, (void **)&ob->mat); - BLO_read_data_address(reader, &ob->matbits); - - /* do it here, below old data gets converted */ - direct_link_modifiers(reader, &ob->modifiers, ob); - direct_link_gpencil_modifiers(reader, &ob->greasepencil_modifiers); - direct_link_shaderfxs(reader, &ob->shader_fx); - - BLO_read_list(reader, &ob->effect); - paf = ob->effect.first; - while (paf) { - if (paf->type == EFF_PARTICLE) { - paf->keys = NULL; - } - if (paf->type == EFF_WAVE) { - WaveEff *wav = (WaveEff *)paf; - PartEff *next = paf->next; - WaveModifierData *wmd = (WaveModifierData *)BKE_modifier_new(eModifierType_Wave); - - wmd->damp = wav->damp; - wmd->flag = wav->flag; - wmd->height = wav->height; - wmd->lifetime = wav->lifetime; - wmd->narrow = wav->narrow; - wmd->speed = wav->speed; - wmd->startx = wav->startx; - wmd->starty = wav->startx; - wmd->timeoffs = wav->timeoffs; - wmd->width = wav->width; - - BLI_addtail(&ob->modifiers, wmd); - - BLI_remlink(&ob->effect, paf); - MEM_freeN(paf); - - paf = next; - continue; - } - if (paf->type == EFF_BUILD) { - BuildEff *baf = (BuildEff *)paf; - PartEff *next = paf->next; - BuildModifierData *bmd = (BuildModifierData *)BKE_modifier_new(eModifierType_Build); - - bmd->start = baf->sfra; - bmd->length = baf->len; - bmd->randomize = 0; - bmd->seed = 1; - - BLI_addtail(&ob->modifiers, bmd); - - BLI_remlink(&ob->effect, paf); - MEM_freeN(paf); - - paf = next; - continue; - } - paf = paf->next; - } - - BLO_read_data_address(reader, &ob->pd); - BKE_particle_partdeflect_blend_read_data(reader, ob->pd); - BLO_read_data_address(reader, &ob->soft); - if (ob->soft) { - SoftBody *sb = ob->soft; - - sb->bpoint = NULL; /* init pointers so it gets rebuilt nicely */ - sb->bspring = NULL; - sb->scratch = NULL; - /* although not used anymore */ - /* still have to be loaded to be compatible with old files */ - BLO_read_pointer_array(reader, (void **)&sb->keys); - if (sb->keys) { - for (int a = 0; a < sb->totkey; a++) { - BLO_read_data_address(reader, &sb->keys[a]); - } - } - - BLO_read_data_address(reader, &sb->effector_weights); - if (!sb->effector_weights) { - sb->effector_weights = BKE_effector_add_weights(NULL); - } - - BLO_read_data_address(reader, &sb->shared); - if (sb->shared == NULL) { - /* Link deprecated caches if they exist, so we can use them for versioning. - * We should only do this when sb->shared == NULL, because those pointers - * are always set (for compatibility with older Blenders). We mustn't link - * the same pointcache twice. */ - direct_link_pointcache_list(reader, &sb->ptcaches, &sb->pointcache, false); - } - else { - /* link caches */ - direct_link_pointcache_list(reader, &sb->shared->ptcaches, &sb->shared->pointcache, false); - } - } - BLO_read_data_address(reader, &ob->fluidsimSettings); /* NT */ - - BLO_read_data_address(reader, &ob->rigidbody_object); - if (ob->rigidbody_object) { - RigidBodyOb *rbo = ob->rigidbody_object; - /* Allocate runtime-only struct */ - rbo->shared = MEM_callocN(sizeof(*rbo->shared), "RigidBodyObShared"); - } - BLO_read_data_address(reader, &ob->rigidbody_constraint); - if (ob->rigidbody_constraint) { - ob->rigidbody_constraint->physics_constraint = NULL; - } - - BLO_read_list(reader, &ob->particlesystem); - direct_link_particlesystems(reader, &ob->particlesystem); - - direct_link_constraints(reader, &ob->constraints); - - BLO_read_list(reader, &ob->hooks); - while (ob->hooks.first) { - ObHook *hook = ob->hooks.first; - HookModifierData *hmd = (HookModifierData *)BKE_modifier_new(eModifierType_Hook); - - BLO_read_int32_array(reader, hook->totindex, &hook->indexar); - - /* Do conversion here because if we have loaded - * a hook we need to make sure it gets converted - * and freed, regardless of version. - */ - copy_v3_v3(hmd->cent, hook->cent); - hmd->falloff = hook->falloff; - hmd->force = hook->force; - hmd->indexar = hook->indexar; - hmd->object = hook->parent; - memcpy(hmd->parentinv, hook->parentinv, sizeof(hmd->parentinv)); - hmd->totindex = hook->totindex; - - BLI_addhead(&ob->modifiers, hmd); - BLI_remlink(&ob->hooks, hook); - - BKE_modifier_unique_name(&ob->modifiers, (ModifierData *)hmd); - - MEM_freeN(hook); - } - - BLO_read_data_address(reader, &ob->iuser); - if (ob->type == OB_EMPTY && ob->empty_drawtype == OB_EMPTY_IMAGE && !ob->iuser) { - BKE_object_empty_draw_type_set(ob, ob->empty_drawtype); - } - - BKE_object_runtime_reset(ob); - BLO_read_list(reader, &ob->pc_ids); - - /* in case this value changes in future, clamp else we get undefined behavior */ - CLAMP(ob->rotmode, ROT_MODE_MIN, ROT_MODE_MAX); - - if (ob->sculpt) { - ob->sculpt = NULL; - /* Only create data on undo, otherwise rely on editor mode switching. */ - if (BLO_read_data_is_undo(reader) && (ob->mode & OB_MODE_ALL_SCULPT)) { - BKE_object_sculpt_data_create(ob); - } - } - - BLO_read_data_address(reader, &ob->preview); - BKE_previewimg_blend_read(reader, ob->preview); -} - -static void direct_link_view_settings(BlendDataReader *reader, - ColorManagedViewSettings *view_settings) -{ - BLO_read_data_address(reader, &view_settings->curve_mapping); - - if (view_settings->curve_mapping) { - BKE_curvemapping_blend_read(reader, view_settings->curve_mapping); - } -} - -/** \} */ - -/* -------------------------------------------------------------------- */ /** \name Read ID: Scene * \{ */ -/* patch for missing scene IDs, can't be in do-versions */ -static void composite_patch(bNodeTree *ntree, Scene *scene) -{ - - LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { - if (node->id == NULL && node->type == CMP_NODE_R_LAYERS) { - node->id = &scene->id; - } - } -} - -static void link_paint(BlendLibReader *reader, Scene *sce, Paint *p) -{ - if (p) { - BLO_read_id_address(reader, sce->id.lib, &p->brush); - for (int i = 0; i < p->tool_slots_len; i++) { - if (p->tool_slots[i].brush != NULL) { - BLO_read_id_address(reader, sce->id.lib, &p->tool_slots[i].brush); - } - } - BLO_read_id_address(reader, sce->id.lib, &p->palette); - p->paint_cursor = NULL; - - BKE_paint_runtime_init(sce->toolsettings, p); - } -} - -static void lib_link_sequence_modifiers(BlendLibReader *reader, Scene *scene, ListBase *lb) -{ - LISTBASE_FOREACH (SequenceModifierData *, smd, lb) { - if (smd->mask_id) { - BLO_read_id_address(reader, scene->id.lib, &smd->mask_id); - } - } -} - -static void direct_link_lightcache_texture(BlendDataReader *reader, LightCacheTexture *lctex) -{ - lctex->tex = NULL; - - if (lctex->data) { - BLO_read_data_address(reader, &lctex->data); - if (lctex->data && BLO_read_requires_endian_switch(reader)) { - int data_size = lctex->components * lctex->tex_size[0] * lctex->tex_size[1] * - lctex->tex_size[2]; - - if (lctex->data_type == LIGHTCACHETEX_FLOAT) { - BLI_endian_switch_float_array((float *)lctex->data, data_size * sizeof(float)); - } - else if (lctex->data_type == LIGHTCACHETEX_UINT) { - BLI_endian_switch_uint32_array((uint *)lctex->data, data_size * sizeof(uint)); - } - } - } - - if (lctex->data == NULL) { - zero_v3_int(lctex->tex_size); - } -} - -static void direct_link_lightcache(BlendDataReader *reader, LightCache *cache) -{ - cache->flag &= ~LIGHTCACHE_NOT_USABLE; - direct_link_lightcache_texture(reader, &cache->cube_tx); - direct_link_lightcache_texture(reader, &cache->grid_tx); - - if (cache->cube_mips) { - BLO_read_data_address(reader, &cache->cube_mips); - for (int i = 0; i < cache->mips_len; i++) { - direct_link_lightcache_texture(reader, &cache->cube_mips[i]); - } - } - - BLO_read_data_address(reader, &cache->cube_data); - BLO_read_data_address(reader, &cache->grid_data); -} - -/* check for cyclic set-scene, - * libs can cause this case which is normally prevented, see (T#####) */ -#define USE_SETSCENE_CHECK - #ifdef USE_SETSCENE_CHECK /** * A version of #BKE_scene_validate_setscene with special checks for linked libs. @@ -3989,182 +2464,6 @@ static bool scene_validate_setscene__liblink(Scene *sce, const int totscene) } #endif -static void lib_link_scene(BlendLibReader *reader, Scene *sce) -{ - BKE_keyingsets_blend_read_lib(reader, &sce->id, &sce->keyingsets); - - BLO_read_id_address(reader, sce->id.lib, &sce->camera); - BLO_read_id_address(reader, sce->id.lib, &sce->world); - BLO_read_id_address(reader, sce->id.lib, &sce->set); - BLO_read_id_address(reader, sce->id.lib, &sce->gpd); - - link_paint(reader, sce, &sce->toolsettings->imapaint.paint); - if (sce->toolsettings->sculpt) { - link_paint(reader, sce, &sce->toolsettings->sculpt->paint); - } - if (sce->toolsettings->vpaint) { - link_paint(reader, sce, &sce->toolsettings->vpaint->paint); - } - if (sce->toolsettings->wpaint) { - link_paint(reader, sce, &sce->toolsettings->wpaint->paint); - } - if (sce->toolsettings->uvsculpt) { - link_paint(reader, sce, &sce->toolsettings->uvsculpt->paint); - } - if (sce->toolsettings->gp_paint) { - link_paint(reader, sce, &sce->toolsettings->gp_paint->paint); - } - if (sce->toolsettings->gp_vertexpaint) { - link_paint(reader, sce, &sce->toolsettings->gp_vertexpaint->paint); - } - if (sce->toolsettings->gp_sculptpaint) { - link_paint(reader, sce, &sce->toolsettings->gp_sculptpaint->paint); - } - if (sce->toolsettings->gp_weightpaint) { - link_paint(reader, sce, &sce->toolsettings->gp_weightpaint->paint); - } - - if (sce->toolsettings->sculpt) { - BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->sculpt->gravity_object); - } - - if (sce->toolsettings->imapaint.stencil) { - BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->imapaint.stencil); - } - - if (sce->toolsettings->imapaint.clone) { - BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->imapaint.clone); - } - - if (sce->toolsettings->imapaint.canvas) { - BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->imapaint.canvas); - } - - BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->particle.shape_object); - - BLO_read_id_address(reader, sce->id.lib, &sce->toolsettings->gp_sculpt.guide.reference_object); - - LISTBASE_FOREACH_MUTABLE (Base *, base_legacy, &sce->base) { - BLO_read_id_address(reader, sce->id.lib, &base_legacy->object); - - if (base_legacy->object == NULL) { - blo_reportf_wrap(reader->fd->reports, - RPT_WARNING, - TIP_("LIB: object lost from scene: '%s'"), - sce->id.name + 2); - BLI_remlink(&sce->base, base_legacy); - if (base_legacy == sce->basact) { - sce->basact = NULL; - } - MEM_freeN(base_legacy); - } - } - - Sequence *seq; - SEQ_ALL_BEGIN (sce->ed, seq) { - IDP_BlendReadLib(reader, seq->prop); - - if (seq->ipo) { - BLO_read_id_address( - reader, sce->id.lib, &seq->ipo); /* XXX deprecated - old animation system */ - } - seq->scene_sound = NULL; - if (seq->scene) { - BLO_read_id_address(reader, sce->id.lib, &seq->scene); - seq->scene_sound = NULL; - } - if (seq->clip) { - BLO_read_id_address(reader, sce->id.lib, &seq->clip); - } - if (seq->mask) { - BLO_read_id_address(reader, sce->id.lib, &seq->mask); - } - if (seq->scene_camera) { - BLO_read_id_address(reader, sce->id.lib, &seq->scene_camera); - } - if (seq->sound) { - seq->scene_sound = NULL; - if (seq->type == SEQ_TYPE_SOUND_HD) { - seq->type = SEQ_TYPE_SOUND_RAM; - } - else { - BLO_read_id_address(reader, sce->id.lib, &seq->sound); - } - if (seq->sound) { - id_us_plus_no_lib((ID *)seq->sound); - seq->scene_sound = NULL; - } - } - if (seq->type == SEQ_TYPE_TEXT) { - TextVars *t = seq->effectdata; - BLO_read_id_address(reader, sce->id.lib, &t->text_font); - } - BLI_listbase_clear(&seq->anims); - - lib_link_sequence_modifiers(reader, sce, &seq->modifiers); - } - SEQ_ALL_END; - - LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) { - IDP_BlendReadLib(reader, marker->prop); - - if (marker->camera) { - BLO_read_id_address(reader, sce->id.lib, &marker->camera); - } - } - - /* rigidbody world relies on its linked collections */ - if (sce->rigidbody_world) { - RigidBodyWorld *rbw = sce->rigidbody_world; - if (rbw->group) { - BLO_read_id_address(reader, sce->id.lib, &rbw->group); - } - if (rbw->constraints) { - BLO_read_id_address(reader, sce->id.lib, &rbw->constraints); - } - if (rbw->effector_weights) { - BLO_read_id_address(reader, sce->id.lib, &rbw->effector_weights->group); - } - } - - if (sce->nodetree) { - composite_patch(sce->nodetree, sce); - } - - LISTBASE_FOREACH (SceneRenderLayer *, srl, &sce->r.layers) { - BLO_read_id_address(reader, sce->id.lib, &srl->mat_override); - LISTBASE_FOREACH (FreestyleModuleConfig *, fmc, &srl->freestyleConfig.modules) { - BLO_read_id_address(reader, sce->id.lib, &fmc->script); - } - LISTBASE_FOREACH (FreestyleLineSet *, fls, &srl->freestyleConfig.linesets) { - BLO_read_id_address(reader, sce->id.lib, &fls->linestyle); - BLO_read_id_address(reader, sce->id.lib, &fls->group); - } - } - /* Motion Tracking */ - BLO_read_id_address(reader, sce->id.lib, &sce->clip); - -#ifdef USE_COLLECTION_COMPAT_28 - if (sce->collection) { - BKE_collection_compat_blend_read_lib(reader, sce->id.lib, sce->collection); - } -#endif - - LISTBASE_FOREACH (ViewLayer *, view_layer, &sce->view_layers) { - BKE_view_layer_blend_read_lib(reader, sce->id.lib, view_layer); - } - - if (sce->r.bake.cage_object) { - BLO_read_id_address(reader, sce->id.lib, &sce->r.bake.cage_object); - } - -#ifdef USE_SETSCENE_CHECK - if (sce->set != NULL) { - sce->flag |= SCE_READFILE_LIBLINK_NEED_SETSCENE_CHECK; - } -#endif -} - static void lib_link_scenes_check_set(Main *bmain) { #ifdef USE_SETSCENE_CHECK @@ -4184,508 +2483,6 @@ static void lib_link_scenes_check_set(Main *bmain) #undef USE_SETSCENE_CHECK -static void link_recurs_seq(BlendDataReader *reader, ListBase *lb) -{ - BLO_read_list(reader, lb); - - LISTBASE_FOREACH (Sequence *, seq, lb) { - if (seq->seqbase.first) { - link_recurs_seq(reader, &seq->seqbase); - } - } -} - -static void direct_link_paint(BlendDataReader *reader, const Scene *scene, Paint *p) -{ - if (p->num_input_samples < 1) { - p->num_input_samples = 1; - } - - BLO_read_data_address(reader, &p->cavity_curve); - if (p->cavity_curve) { - BKE_curvemapping_blend_read(reader, p->cavity_curve); - } - else { - BKE_paint_cavity_curve_preset(p, CURVE_PRESET_LINE); - } - - BLO_read_data_address(reader, &p->tool_slots); - - /* Workaround for invalid data written in older versions. */ - const size_t expected_size = sizeof(PaintToolSlot) * p->tool_slots_len; - if (p->tool_slots && MEM_allocN_len(p->tool_slots) < expected_size) { - MEM_freeN(p->tool_slots); - p->tool_slots = MEM_callocN(expected_size, "PaintToolSlot"); - } - - BKE_paint_runtime_init(scene->toolsettings, p); -} - -static void direct_link_paint_helper(BlendDataReader *reader, const Scene *scene, Paint **paint) -{ - /* TODO. is this needed */ - BLO_read_data_address(reader, paint); - - if (*paint) { - direct_link_paint(reader, scene, *paint); - } -} - -static void direct_link_sequence_modifiers(BlendDataReader *reader, ListBase *lb) -{ - BLO_read_list(reader, lb); - - LISTBASE_FOREACH (SequenceModifierData *, smd, lb) { - if (smd->mask_sequence) { - BLO_read_data_address(reader, &smd->mask_sequence); - } - - if (smd->type == seqModifierType_Curves) { - CurvesModifierData *cmd = (CurvesModifierData *)smd; - - BKE_curvemapping_blend_read(reader, &cmd->curve_mapping); - } - else if (smd->type == seqModifierType_HueCorrect) { - HueCorrectModifierData *hcmd = (HueCorrectModifierData *)smd; - - BKE_curvemapping_blend_read(reader, &hcmd->curve_mapping); - } - } -} - -static void direct_link_scene(BlendDataReader *reader, Scene *sce) -{ - sce->depsgraph_hash = NULL; - sce->fps_info = NULL; - - memset(&sce->customdata_mask, 0, sizeof(sce->customdata_mask)); - memset(&sce->customdata_mask_modal, 0, sizeof(sce->customdata_mask_modal)); - - BKE_sound_reset_scene_runtime(sce); - - /* set users to one by default, not in lib-link, this will increase it for compo nodes */ - id_us_ensure_real(&sce->id); - - BLO_read_list(reader, &(sce->base)); - - BLO_read_data_address(reader, &sce->adt); - BKE_animdata_blend_read_data(reader, sce->adt); - - BLO_read_list(reader, &sce->keyingsets); - BKE_keyingsets_blend_read_data(reader, &sce->keyingsets); - - BLO_read_data_address(reader, &sce->basact); - - BLO_read_data_address(reader, &sce->toolsettings); - if (sce->toolsettings) { - - /* Reset last_location and last_hit, so they are not remembered across sessions. In some files - * these are also NaN, which could lead to crashes in painting. */ - struct UnifiedPaintSettings *ups = &sce->toolsettings->unified_paint_settings; - zero_v3(ups->last_location); - ups->last_hit = 0; - - direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->sculpt); - direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->vpaint); - direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->wpaint); - direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->uvsculpt); - direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->gp_paint); - direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->gp_vertexpaint); - direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->gp_sculptpaint); - direct_link_paint_helper(reader, sce, (Paint **)&sce->toolsettings->gp_weightpaint); - - direct_link_paint(reader, sce, &sce->toolsettings->imapaint.paint); - - sce->toolsettings->particle.paintcursor = NULL; - sce->toolsettings->particle.scene = NULL; - sce->toolsettings->particle.object = NULL; - sce->toolsettings->gp_sculpt.paintcursor = NULL; - - /* relink grease pencil interpolation curves */ - BLO_read_data_address(reader, &sce->toolsettings->gp_interpolate.custom_ipo); - if (sce->toolsettings->gp_interpolate.custom_ipo) { - BKE_curvemapping_blend_read(reader, sce->toolsettings->gp_interpolate.custom_ipo); - } - /* relink grease pencil multiframe falloff curve */ - BLO_read_data_address(reader, &sce->toolsettings->gp_sculpt.cur_falloff); - if (sce->toolsettings->gp_sculpt.cur_falloff) { - BKE_curvemapping_blend_read(reader, sce->toolsettings->gp_sculpt.cur_falloff); - } - /* relink grease pencil primitive curve */ - BLO_read_data_address(reader, &sce->toolsettings->gp_sculpt.cur_primitive); - if (sce->toolsettings->gp_sculpt.cur_primitive) { - BKE_curvemapping_blend_read(reader, sce->toolsettings->gp_sculpt.cur_primitive); - } - - /* Relink toolsettings curve profile */ - BLO_read_data_address(reader, &sce->toolsettings->custom_bevel_profile_preset); - if (sce->toolsettings->custom_bevel_profile_preset) { - BKE_curveprofile_blend_read(reader, sce->toolsettings->custom_bevel_profile_preset); - } - } - - if (sce->ed) { - ListBase *old_seqbasep = &sce->ed->seqbase; - - BLO_read_data_address(reader, &sce->ed); - Editing *ed = sce->ed; - - BLO_read_data_address(reader, &ed->act_seq); - ed->cache = NULL; - ed->prefetch_job = NULL; - - /* recursive link sequences, lb will be correctly initialized */ - link_recurs_seq(reader, &ed->seqbase); - - Sequence *seq; - SEQ_ALL_BEGIN (ed, seq) { - /* Do as early as possible, so that other parts of reading can rely on valid session UUID. */ - BKE_sequence_session_uuid_generate(seq); - - BLO_read_data_address(reader, &seq->seq1); - BLO_read_data_address(reader, &seq->seq2); - BLO_read_data_address(reader, &seq->seq3); - - /* a patch: after introduction of effects with 3 input strips */ - if (seq->seq3 == NULL) { - seq->seq3 = seq->seq2; - } - - BLO_read_data_address(reader, &seq->effectdata); - BLO_read_data_address(reader, &seq->stereo3d_format); - - if (seq->type & SEQ_TYPE_EFFECT) { - seq->flag |= SEQ_EFFECT_NOT_LOADED; - } - - if (seq->type == SEQ_TYPE_SPEED) { - SpeedControlVars *s = seq->effectdata; - s->frameMap = NULL; - } - - if (seq->type == SEQ_TYPE_TEXT) { - TextVars *t = seq->effectdata; - t->text_blf_id = SEQ_FONT_NOT_LOADED; - } - - BLO_read_data_address(reader, &seq->prop); - IDP_BlendDataRead(reader, &seq->prop); - - BLO_read_data_address(reader, &seq->strip); - if (seq->strip && seq->strip->done == 0) { - seq->strip->done = true; - - if (ELEM(seq->type, - SEQ_TYPE_IMAGE, - SEQ_TYPE_MOVIE, - SEQ_TYPE_SOUND_RAM, - SEQ_TYPE_SOUND_HD)) { - BLO_read_data_address(reader, &seq->strip->stripdata); - } - else { - seq->strip->stripdata = NULL; - } - BLO_read_data_address(reader, &seq->strip->crop); - BLO_read_data_address(reader, &seq->strip->transform); - BLO_read_data_address(reader, &seq->strip->proxy); - if (seq->strip->proxy) { - seq->strip->proxy->anim = NULL; - } - else if (seq->flag & SEQ_USE_PROXY) { - SEQ_proxy_set(seq, true); - } - - /* need to load color balance to it could be converted to modifier */ - BLO_read_data_address(reader, &seq->strip->color_balance); - } - - direct_link_sequence_modifiers(reader, &seq->modifiers); - } - SEQ_ALL_END; - - /* link metastack, slight abuse of structs here, - * have to restore pointer to internal part in struct */ - { - Sequence temp; - void *poin; - intptr_t offset; - - offset = ((intptr_t) & (temp.seqbase)) - ((intptr_t)&temp); - - /* root pointer */ - if (ed->seqbasep == old_seqbasep) { - ed->seqbasep = &ed->seqbase; - } - else { - poin = POINTER_OFFSET(ed->seqbasep, -offset); - - poin = BLO_read_get_new_data_address(reader, poin); - - if (poin) { - ed->seqbasep = (ListBase *)POINTER_OFFSET(poin, offset); - } - else { - ed->seqbasep = &ed->seqbase; - } - } - /* stack */ - BLO_read_list(reader, &(ed->metastack)); - - LISTBASE_FOREACH (MetaStack *, ms, &ed->metastack) { - BLO_read_data_address(reader, &ms->parseq); - - if (ms->oldbasep == old_seqbasep) { - ms->oldbasep = &ed->seqbase; - } - else { - poin = POINTER_OFFSET(ms->oldbasep, -offset); - poin = BLO_read_get_new_data_address(reader, poin); - if (poin) { - ms->oldbasep = (ListBase *)POINTER_OFFSET(poin, offset); - } - else { - ms->oldbasep = &ed->seqbase; - } - } - } - } - } - -#ifdef DURIAN_CAMERA_SWITCH - /* Runtime */ - sce->r.mode &= ~R_NO_CAMERA_SWITCH; -#endif - - BLO_read_data_address(reader, &sce->r.avicodecdata); - if (sce->r.avicodecdata) { - BLO_read_data_address(reader, &sce->r.avicodecdata->lpFormat); - BLO_read_data_address(reader, &sce->r.avicodecdata->lpParms); - } - if (sce->r.ffcodecdata.properties) { - BLO_read_data_address(reader, &sce->r.ffcodecdata.properties); - IDP_BlendDataRead(reader, &sce->r.ffcodecdata.properties); - } - - BLO_read_list(reader, &(sce->markers)); - LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) { - BLO_read_data_address(reader, &marker->prop); - IDP_BlendDataRead(reader, &marker->prop); - } - - BLO_read_list(reader, &(sce->transform_spaces)); - BLO_read_list(reader, &(sce->r.layers)); - BLO_read_list(reader, &(sce->r.views)); - - LISTBASE_FOREACH (SceneRenderLayer *, srl, &sce->r.layers) { - BLO_read_data_address(reader, &srl->prop); - IDP_BlendDataRead(reader, &srl->prop); - BLO_read_list(reader, &(srl->freestyleConfig.modules)); - BLO_read_list(reader, &(srl->freestyleConfig.linesets)); - } - - direct_link_view_settings(reader, &sce->view_settings); - - BLO_read_data_address(reader, &sce->rigidbody_world); - RigidBodyWorld *rbw = sce->rigidbody_world; - if (rbw) { - BLO_read_data_address(reader, &rbw->shared); - - if (rbw->shared == NULL) { - /* Link deprecated caches if they exist, so we can use them for versioning. - * We should only do this when rbw->shared == NULL, because those pointers - * are always set (for compatibility with older Blenders). We mustn't link - * the same pointcache twice. */ - direct_link_pointcache_list(reader, &rbw->ptcaches, &rbw->pointcache, false); - - /* make sure simulation starts from the beginning after loading file */ - if (rbw->pointcache) { - rbw->ltime = (float)rbw->pointcache->startframe; - } - } - else { - /* must nullify the reference to physics sim object, since it no-longer exist - * (and will need to be recalculated) - */ - rbw->shared->physics_world = NULL; - - /* link caches */ - direct_link_pointcache_list(reader, &rbw->shared->ptcaches, &rbw->shared->pointcache, false); - - /* make sure simulation starts from the beginning after loading file */ - if (rbw->shared->pointcache) { - rbw->ltime = (float)rbw->shared->pointcache->startframe; - } - } - rbw->objects = NULL; - rbw->numbodies = 0; - - /* set effector weights */ - BLO_read_data_address(reader, &rbw->effector_weights); - if (!rbw->effector_weights) { - rbw->effector_weights = BKE_effector_add_weights(NULL); - } - } - - BLO_read_data_address(reader, &sce->preview); - BKE_previewimg_blend_read(reader, sce->preview); - - BKE_curvemapping_blend_read(reader, &sce->r.mblur_shutter_curve); - -#ifdef USE_COLLECTION_COMPAT_28 - /* this runs before the very first doversion */ - if (sce->collection) { - BLO_read_data_address(reader, &sce->collection); - BKE_collection_compat_blend_read_data(reader, sce->collection); - } -#endif - - /* insert into global old-new map for reading without UI (link_global accesses it again) */ - link_glob_list(reader->fd, &sce->view_layers); - LISTBASE_FOREACH (ViewLayer *, view_layer, &sce->view_layers) { - BKE_view_layer_blend_read_data(reader, view_layer); - } - - if (BLO_read_data_is_undo(reader)) { - /* If it's undo do nothing here, caches are handled by higher-level generic calling code. */ - } - else { - /* else try to read the cache from file. */ - BLO_read_data_address(reader, &sce->eevee.light_cache_data); - if (sce->eevee.light_cache_data) { - direct_link_lightcache(reader, sce->eevee.light_cache_data); - } - } - EEVEE_lightcache_info_update(&sce->eevee); - - BKE_screen_view3d_shading_blend_read_data(reader, &sce->display.shading); - - BLO_read_data_address(reader, &sce->layer_properties); - IDP_BlendDataRead(reader, &sce->layer_properties); -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name XR-data - * \{ */ - -static void direct_link_wm_xr_data(BlendDataReader *reader, wmXrData *xr_data) -{ - BKE_screen_view3d_shading_blend_read_data(reader, &xr_data->session_settings.shading); -} - -static void lib_link_wm_xr_data(BlendLibReader *reader, ID *parent_id, wmXrData *xr_data) -{ - BLO_read_id_address(reader, parent_id->lib, &xr_data->session_settings.base_pose_object); -} - -/** \} */ - -/* -------------------------------------------------------------------- */ -/** \name Read ID: Window Manager - * \{ */ - -static void direct_link_windowmanager(BlendDataReader *reader, wmWindowManager *wm) -{ - id_us_ensure_real(&wm->id); - BLO_read_list(reader, &wm->windows); - - LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { - BLO_read_data_address(reader, &win->parent); - - WorkSpaceInstanceHook *hook = win->workspace_hook; - BLO_read_data_address(reader, &win->workspace_hook); - - /* This will be NULL for any pre-2.80 blend file. */ - if (win->workspace_hook != NULL) { - /* We need to restore a pointer to this later when reading workspaces, - * so store in global oldnew-map. - * Note that this is only needed for versioning of older .blend files now.. */ - oldnewmap_insert(reader->fd->globmap, hook, win->workspace_hook, 0); - /* Cleanup pointers to data outside of this data-block scope. */ - win->workspace_hook->act_layout = NULL; - win->workspace_hook->temp_workspace_store = NULL; - win->workspace_hook->temp_layout_store = NULL; - } - - BKE_screen_area_map_blend_read_data(reader, &win->global_areas); - - win->ghostwin = NULL; - win->gpuctx = NULL; - win->eventstate = NULL; - win->cursor_keymap_status = NULL; - win->tweak = NULL; -#ifdef WIN32 - win->ime_data = NULL; -#endif - - BLI_listbase_clear(&win->queue); - BLI_listbase_clear(&win->handlers); - BLI_listbase_clear(&win->modalhandlers); - BLI_listbase_clear(&win->gesture); - - win->active = 0; - - win->cursor = 0; - win->lastcursor = 0; - win->modalcursor = 0; - win->grabcursor = 0; - win->addmousemove = true; - BLO_read_data_address(reader, &win->stereo3d_format); - - /* Multi-view always fallback to anaglyph at file opening - * otherwise quad-buffer saved files can break Blender. */ - if (win->stereo3d_format) { - win->stereo3d_format->display_mode = S3D_DISPLAY_ANAGLYPH; - } - } - - direct_link_wm_xr_data(reader, &wm->xr); - - BLI_listbase_clear(&wm->timers); - BLI_listbase_clear(&wm->operators); - BLI_listbase_clear(&wm->paintcursors); - BLI_listbase_clear(&wm->queue); - BKE_reports_init(&wm->reports, RPT_STORE); - - BLI_listbase_clear(&wm->keyconfigs); - wm->defaultconf = NULL; - wm->addonconf = NULL; - wm->userconf = NULL; - wm->undo_stack = NULL; - - wm->message_bus = NULL; - - wm->xr.runtime = NULL; - - BLI_listbase_clear(&wm->jobs); - BLI_listbase_clear(&wm->drags); - - wm->windrawable = NULL; - wm->winactive = NULL; - wm->initialized = 0; - wm->op_undo_depth = 0; - wm->is_interface_locked = 0; -} - -static void lib_link_windowmanager(BlendLibReader *reader, wmWindowManager *wm) -{ - LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { - if (win->workspace_hook) { /* NULL for old files */ - lib_link_workspace_instance_hook(reader, win->workspace_hook, &wm->id); - } - BLO_read_id_address(reader, wm->id.lib, &win->scene); - /* deprecated, but needed for versioning (will be NULL'ed then) */ - BLO_read_id_address(reader, NULL, &win->screen); - - LISTBASE_FOREACH (ScrArea *, area, &win->global_areas.areabase) { - BKE_screen_area_blend_read_lib(reader, &wm->id, area); - } - - lib_link_wm_xr_data(reader, &wm->id, &wm->xr); - } -} - /** \} */ /* -------------------------------------------------------------------- */ @@ -5168,25 +2965,6 @@ void blo_lib_link_restore(Main *oldmain, BKE_main_idmap_destroy(id_map); } -static bool direct_link_screen(BlendDataReader *reader, bScreen *screen) -{ - bool success = true; - - screen->regionbase.first = screen->regionbase.last = NULL; - screen->context = NULL; - screen->active_region = NULL; - - BLO_read_data_address(reader, &screen->preview); - BKE_previewimg_blend_read(reader, screen->preview); - - if (!BKE_screen_area_map_blend_read_data(reader, AREAMAP_FROM_SCREEN(screen))) { - printf("Error reading Screen %s... removing it.\n", screen->id.name + 2); - success = false; - } - - return success; -} - /** \} */ /* -------------------------------------------------------------------- */ @@ -5201,7 +2979,7 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main) for (newmain = fd->mainlist->first; newmain; newmain = newmain->next) { if (newmain->curlib) { if (BLI_path_cmp(newmain->curlib->filepath_abs, lib->filepath_abs) == 0) { - blo_reportf_wrap(fd->reports, + BLO_reportf_wrap(fd->reports, RPT_WARNING, TIP_("Library '%s', '%s' had multiple instances, save and reload!"), lib->filepath, @@ -5430,58 +3208,13 @@ static bool direct_link_id(FileData *fd, Main *main, const int tag, ID *id, ID * bool success = true; switch (GS(id->name)) { - case ID_WM: - direct_link_windowmanager(&reader, (wmWindowManager *)id); - break; case ID_SCR: - success = direct_link_screen(&reader, (bScreen *)id); - break; - case ID_SCE: - direct_link_scene(&reader, (Scene *)id); - break; - case ID_OB: - direct_link_object(&reader, (Object *)id); - break; - case ID_IP: - direct_link_ipo(&reader, (Ipo *)id); + success = BKE_screen_blend_read_data(&reader, (bScreen *)id); break; case ID_LI: direct_link_library(fd, (Library *)id, main); break; - case ID_WS: - case ID_PA: - case ID_GR: - case ID_ME: - case ID_LT: - case ID_AC: - case ID_NT: - case ID_LS: - case ID_TXT: - case ID_VF: - case ID_MC: - case ID_PAL: - case ID_PC: - case ID_BR: - case ID_IM: - case ID_LA: - case ID_MA: - case ID_MB: - case ID_CU: - case ID_CA: - case ID_WO: - case ID_MSK: - case ID_SPK: - case ID_AR: - case ID_LP: - case ID_KE: - case ID_TE: - case ID_GD: - case ID_HA: - case ID_PT: - case ID_VO: - case ID_SIM: - case ID_SO: - case ID_CF: + default: /* Do nothing. Handled by IDTypeInfo callback. */ break; } @@ -6057,64 +3790,8 @@ static void lib_link_all(FileData *fd, Main *bmain) id_type->blend_read_lib(&reader, id); } - /* Note: ID types are processed in reverse order as defined by INDEX_ID_XXX enums in DNA_ID.h. - * This ensures handling of most dependencies in proper order, as elsewhere in code. - * Please keep order of entries in that switch matching that order, it's easier to quickly see - * whether something is wrong then. */ - switch (GS(id->name)) { - case ID_WM: - lib_link_windowmanager(&reader, (wmWindowManager *)id); - break; - case ID_SCE: - lib_link_scene(&reader, (Scene *)id); - break; - case ID_OB: - lib_link_object(&reader, (Object *)id); - break; - case ID_IP: - /* XXX deprecated... still needs to be maintained for version patches still. */ - lib_link_ipo(&reader, (Ipo *)id); - break; - case ID_LI: - lib_link_library(&reader, (Library *)id); /* Only init users. */ - break; - case ID_WS: - case ID_SCR: - case ID_PA: - case ID_GR: - case ID_ME: - case ID_LT: - case ID_AC: - case ID_NT: - case ID_LS: - case ID_TXT: - case ID_VF: - case ID_MC: - case ID_PAL: - case ID_PC: - case ID_BR: - case ID_IM: - case ID_LA: - case ID_MA: - case ID_MB: - case ID_CU: - case ID_CA: - case ID_WO: - case ID_MSK: - case ID_SPK: - case ID_AR: - case ID_LP: - case ID_KE: - case ID_TE: - case ID_GD: - case ID_HA: - case ID_PT: - case ID_VO: - case ID_SIM: - case ID_SO: - case ID_CF: - /* Do nothing. Handled by IDTypeInfo callback. */ - break; + if (GS(id->name) == ID_LI) { + lib_link_library(&reader, (Library *)id); /* Only init users. */ } id->tag &= ~LIB_TAG_NEED_LINK; @@ -6600,7 +4277,7 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old) if (libmain->curlib == NULL) { const char *idname = blo_bhead_id_name(fd, bhead); - blo_reportf_wrap(fd->reports, + BLO_reportf_wrap(fd->reports, RPT_WARNING, TIP_("LIB: Data refers to main .blend file: '%s' from %s"), idname, @@ -6689,24 +4366,6 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old) static BLOExpandDoitCallback expand_doit; -// XXX deprecated - old animation system -static void expand_ipo(BlendExpander *expander, Ipo *ipo) -{ - LISTBASE_FOREACH (IpoCurve *, icu, &ipo->curve) { - if (icu->driver) { - BLO_expand(expander, icu->driver->ob); - } - } -} - -/* XXX deprecated - old animation system */ -static void expand_constraint_channels(BlendExpander *expander, ListBase *chanbase) -{ - LISTBASE_FOREACH (bConstraintChannel *, chan, chanbase) { - BLO_expand(expander, chan->ipo); - } -} - static void expand_id(BlendExpander *expander, ID *id); static void expand_id_embedded_id(BlendExpander *expander, ID *id) @@ -6744,237 +4403,6 @@ static void expand_id(BlendExpander *expander, ID *id) expand_id_embedded_id(expander, id); } -/* callback function used to expand constraint ID-links */ -static void expand_constraint_cb(bConstraint *UNUSED(con), - ID **idpoin, - bool UNUSED(is_reference), - void *userdata) -{ - BlendExpander *expander = userdata; - BLO_expand(expander, *idpoin); -} - -static void expand_constraints(BlendExpander *expander, ListBase *lb) -{ - BKE_constraints_id_loop(lb, expand_constraint_cb, expander); - - /* deprecated manual expansion stuff */ - LISTBASE_FOREACH (bConstraint *, curcon, lb) { - if (curcon->ipo) { - BLO_expand(expander, curcon->ipo); /* XXX deprecated - old animation system */ - } - } -} - -static void expand_pose(BlendExpander *expander, bPose *pose) -{ - if (!pose) { - return; - } - - LISTBASE_FOREACH (bPoseChannel *, chan, &pose->chanbase) { - expand_constraints(expander, &chan->constraints); - IDP_BlendReadExpand(expander, chan->prop); - BLO_expand(expander, chan->custom); - } -} - -static void expand_object_expandModifiers(void *userData, - Object *UNUSED(ob), - ID **idpoin, - int UNUSED(cb_flag)) -{ - BlendExpander *expander = userData; - BLO_expand(expander, *idpoin); -} - -static void expand_object(BlendExpander *expander, Object *ob) -{ - BLO_expand(expander, ob->data); - - /* expand_object_expandModifier() */ - if (ob->modifiers.first) { - BKE_modifiers_foreach_ID_link(ob, expand_object_expandModifiers, expander); - } - - /* expand_object_expandModifier() */ - if (ob->greasepencil_modifiers.first) { - BKE_gpencil_modifiers_foreach_ID_link(ob, expand_object_expandModifiers, expander); - } - - /* expand_object_expandShaderFx() */ - if (ob->shader_fx.first) { - BKE_shaderfx_foreach_ID_link(ob, expand_object_expandModifiers, expander); - } - - expand_pose(expander, ob->pose); - BLO_expand(expander, ob->poselib); - expand_constraints(expander, &ob->constraints); - - BLO_expand(expander, ob->gpd); - - /* XXX deprecated - old animation system (for version patching only) */ - BLO_expand(expander, ob->ipo); - BLO_expand(expander, ob->action); - - expand_constraint_channels(expander, &ob->constraintChannels); - - LISTBASE_FOREACH (bActionStrip *, strip, &ob->nlastrips) { - BLO_expand(expander, strip->object); - BLO_expand(expander, strip->act); - BLO_expand(expander, strip->ipo); - } - /* XXX deprecated - old animation system (for version patching only) */ - - for (int a = 0; a < ob->totcol; a++) { - BLO_expand(expander, ob->mat[a]); - } - - PartEff *paf = blo_do_version_give_parteff_245(ob); - if (paf && paf->group) { - BLO_expand(expander, paf->group); - } - - if (ob->instance_collection) { - BLO_expand(expander, ob->instance_collection); - } - - if (ob->proxy) { - BLO_expand(expander, ob->proxy); - } - if (ob->proxy_group) { - BLO_expand(expander, ob->proxy_group); - } - - LISTBASE_FOREACH (ParticleSystem *, psys, &ob->particlesystem) { - BLO_expand(expander, psys->part); - } - - if (ob->pd) { - BLO_expand(expander, ob->pd->tex); - BLO_expand(expander, ob->pd->f_source); - } - - if (ob->soft) { - BLO_expand(expander, ob->soft->collision_group); - - if (ob->soft->effector_weights) { - BLO_expand(expander, ob->soft->effector_weights->group); - } - } - - if (ob->rigidbody_constraint) { - BLO_expand(expander, ob->rigidbody_constraint->ob1); - BLO_expand(expander, ob->rigidbody_constraint->ob2); - } -} - -static void expand_scene(BlendExpander *expander, Scene *sce) -{ - LISTBASE_FOREACH (Base *, base_legacy, &sce->base) { - BLO_expand(expander, base_legacy->object); - } - BLO_expand(expander, sce->camera); - BLO_expand(expander, sce->world); - - BKE_keyingsets_blend_read_expand(expander, &sce->keyingsets); - - if (sce->set) { - BLO_expand(expander, sce->set); - } - - LISTBASE_FOREACH (SceneRenderLayer *, srl, &sce->r.layers) { - BLO_expand(expander, srl->mat_override); - LISTBASE_FOREACH (FreestyleModuleConfig *, module, &srl->freestyleConfig.modules) { - if (module->script) { - BLO_expand(expander, module->script); - } - } - LISTBASE_FOREACH (FreestyleLineSet *, lineset, &srl->freestyleConfig.linesets) { - if (lineset->group) { - BLO_expand(expander, lineset->group); - } - BLO_expand(expander, lineset->linestyle); - } - } - - LISTBASE_FOREACH (ViewLayer *, view_layer, &sce->view_layers) { - IDP_BlendReadExpand(expander, view_layer->id_properties); - - LISTBASE_FOREACH (FreestyleModuleConfig *, module, &view_layer->freestyle_config.modules) { - if (module->script) { - BLO_expand(expander, module->script); - } - } - - LISTBASE_FOREACH (FreestyleLineSet *, lineset, &view_layer->freestyle_config.linesets) { - if (lineset->group) { - BLO_expand(expander, lineset->group); - } - BLO_expand(expander, lineset->linestyle); - } - } - - if (sce->gpd) { - BLO_expand(expander, sce->gpd); - } - - if (sce->ed) { - Sequence *seq; - - SEQ_ALL_BEGIN (sce->ed, seq) { - IDP_BlendReadExpand(expander, seq->prop); - - if (seq->scene) { - BLO_expand(expander, seq->scene); - } - if (seq->scene_camera) { - BLO_expand(expander, seq->scene_camera); - } - if (seq->clip) { - BLO_expand(expander, seq->clip); - } - if (seq->mask) { - BLO_expand(expander, seq->mask); - } - if (seq->sound) { - BLO_expand(expander, seq->sound); - } - - if (seq->type == SEQ_TYPE_TEXT && seq->effectdata) { - TextVars *data = seq->effectdata; - BLO_expand(expander, data->text_font); - } - } - SEQ_ALL_END; - } - - if (sce->rigidbody_world) { - BLO_expand(expander, sce->rigidbody_world->group); - BLO_expand(expander, sce->rigidbody_world->constraints); - } - - LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) { - IDP_BlendReadExpand(expander, marker->prop); - - if (marker->camera) { - BLO_expand(expander, marker->camera); - } - } - - BLO_expand(expander, sce->clip); - -#ifdef USE_COLLECTION_COMPAT_28 - if (sce->collection) { - BKE_collection_compat_blend_read_expand(expander, sce->collection); - } -#endif - - if (sce->r.bake.cage_object) { - BLO_expand(expander, sce->r.bake.cage_object); - } -} - /** * Set the callback func used over all ID data found by \a BLO_expand_main func. * @@ -7017,20 +4445,6 @@ void BLO_expand_main(void *fdhandle, Main *mainvar) id_type->blend_read_expand(&expander, id); } - switch (GS(id->name)) { - case ID_OB: - expand_object(&expander, (Object *)id); - break; - case ID_SCE: - expand_scene(&expander, (Scene *)id); - break; - case ID_IP: - expand_ipo(&expander, (Ipo *)id); /* XXX deprecated - old animation system */ - break; - default: - break; - } - do_it = true; id->tag &= ~LIB_TAG_NEED_EXPAND; } @@ -7710,7 +5124,7 @@ static void read_library_linked_id( } if (!is_valid) { - blo_reportf_wrap(reports, + BLO_reportf_wrap(reports, RPT_ERROR, TIP_("LIB: %s: '%s' is directly linked from '%s' (parent '%s'), but is a " "non-linkable data type"), @@ -7729,7 +5143,7 @@ static void read_library_linked_id( read_libblock(fd, mainvar, bhead, id->tag, false, r_id); } else { - blo_reportf_wrap(reports, + BLO_reportf_wrap(reports, RPT_WARNING, TIP_("LIB: %s: '%s' missing from '%s', parent '%s'"), BKE_idtype_idcode_to_name(GS(id->name)), @@ -7834,7 +5248,7 @@ static FileData *read_library_file_data(FileData *basefd, /* Read packed file. */ PackedFile *pf = mainptr->curlib->packedfile; - blo_reportf_wrap(basefd->reports, + BLO_reportf_wrap(basefd->reports, RPT_INFO, TIP_("Read packed library: '%s', parent '%s'"), mainptr->curlib->filepath, @@ -7846,7 +5260,7 @@ static FileData *read_library_file_data(FileData *basefd, } else { /* Read file on disk. */ - blo_reportf_wrap(basefd->reports, + BLO_reportf_wrap(basefd->reports, RPT_INFO, TIP_("Read library: '%s', '%s', parent '%s'"), mainptr->curlib->filepath_abs, @@ -7888,7 +5302,7 @@ static FileData *read_library_file_data(FileData *basefd, } if (fd == NULL) { - blo_reportf_wrap( + BLO_reportf_wrap( basefd->reports, RPT_WARNING, TIP_("Cannot find lib '%s'"), mainptr->curlib->filepath_abs); } @@ -8160,6 +5574,21 @@ bool BLO_read_data_is_undo(BlendDataReader *reader) return reader->fd->memfile != NULL; } +void BLO_read_data_globmap_add(BlendDataReader *reader, void *oldaddr, void *newaddr) +{ + oldnewmap_insert(reader->fd->globmap, oldaddr, newaddr, 0); +} + +void BLO_read_glob_list(BlendDataReader *reader, ListBase *list) +{ + link_glob_list(reader->fd, list); +} + +ReportList *BLO_read_data_reports(BlendDataReader *reader) +{ + return reader->fd->reports; +} + bool BLO_read_lib_is_undo(BlendLibReader *reader) { return reader->fd->memfile != NULL; @@ -8170,6 +5599,11 @@ Main *BLO_read_lib_get_main(BlendLibReader *reader) return reader->main; } +ReportList *BLO_read_lib_reports(BlendLibReader *reader) +{ + return reader->fd->reports; +} + void BLO_expand_id(BlendExpander *expander, ID *id) { expand_doit(expander->fd, expander->main, id); diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index 57d6779d1cb..fb950e37da8 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -173,9 +173,6 @@ const char *blo_bhead_id_name(const FileData *fd, const BHead *bhead); /* do versions stuff */ -void blo_reportf_wrap(struct ReportList *reports, ReportType type, const char *format, ...) - ATTR_PRINTF_FORMAT(3, 4); - void blo_do_versions_dna(struct SDNA *sdna, const int versionfile, const int subversionfile); void blo_do_versions_oldnewmap_insert(struct OldNewMap *onm, @@ -185,7 +182,6 @@ void blo_do_versions_oldnewmap_insert(struct OldNewMap *onm, void *blo_do_versions_newlibadr(struct FileData *fd, const void *lib, const void *adr); void *blo_do_versions_newlibadr_us(struct FileData *fd, const void *lib, const void *adr); -struct PartEff *blo_do_version_give_parteff_245(struct Object *ob); void blo_do_version_old_trackto_to_constraints(struct Object *ob); void blo_do_versions_key_uidgen(struct Key *key); diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c index 9178ec97d3d..d654a0e30bd 100644 --- a/source/blender/blenloader/intern/versioning_legacy.c +++ b/source/blender/blenloader/intern/versioning_legacy.c @@ -75,6 +75,7 @@ #include "BKE_main.h" /* for Main */ #include "BKE_mesh.h" /* for ME_ defines (patching) */ #include "BKE_modifier.h" +#include "BKE_object.h" #include "BKE_particle.h" #include "BKE_pointcache.h" @@ -461,20 +462,6 @@ static void do_version_constraints_245(ListBase *lb) } } -PartEff *blo_do_version_give_parteff_245(Object *ob) -{ - PartEff *paf; - - paf = ob->effect.first; - while (paf) { - if (paf->type == EFF_PARTICLE) { - return paf; - } - paf = paf->next; - } - return NULL; -} - /* NOTE: this version patch is intended for versions < 2.52.2, * but was initially introduced in 2.27 already. */ void blo_do_version_old_trackto_to_constraints(Object *ob) @@ -718,7 +705,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) Object *ob = bmain->objects.first; PartEff *paf; while (ob) { - paf = blo_do_version_give_parteff_245(ob); + paf = BKE_object_do_version_give_parteff_245(ob); if (paf) { if (paf->staticstep == 0) { paf->staticstep = 5; @@ -1476,7 +1463,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) } } - paf = blo_do_version_give_parteff_245(ob); + paf = BKE_object_do_version_give_parteff_245(ob); if (paf) { if (paf->disp == 0) { paf->disp = 100; @@ -2233,7 +2220,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) } /* convert old particles to new system */ - if ((paf = blo_do_version_give_parteff_245(ob))) { + if ((paf = BKE_object_do_version_give_parteff_245(ob))) { ParticleSystem *psys; ModifierData *md; ParticleSystemModifierData *psmd; diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index d152230e4bf..7d7c68beb8f 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -808,6 +808,10 @@ void blo_do_versions_userdef(UserDef *userdef) userdef->uiflag &= ~USER_UIFLAG_UNUSED_3; } + if (!USER_VERSION_ATLEAST(292, 4)) { + userdef->animation_flag = USER_ANIM_SHOW_CHANNEL_GROUP_COLORS; + } + /** * Versioning code until next subversion bump goes here. * diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index e4995c991e1..b640c9f5788 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -93,71 +93,27 @@ /* allow writefile to use deprecated functionality (for forward compatibility code) */ #define DNA_DEPRECATED_ALLOW -#include "DNA_anim_types.h" -#include "DNA_armature_types.h" -#include "DNA_cachefile_types.h" -#include "DNA_cloth_types.h" -#include "DNA_collection_types.h" -#include "DNA_constraint_types.h" -#include "DNA_curveprofile_types.h" -#include "DNA_dynamicpaint_types.h" #include "DNA_fileglobal_types.h" -#include "DNA_fluid_types.h" #include "DNA_genfile.h" -#include "DNA_lightprobe_types.h" -#include "DNA_meshdata_types.h" -#include "DNA_movieclip_types.h" -#include "DNA_object_force_types.h" -#include "DNA_object_types.h" -#include "DNA_particle_types.h" -#include "DNA_pointcache_types.h" -#include "DNA_rigidbody_types.h" -#include "DNA_scene_types.h" -#include "DNA_screen_types.h" #include "DNA_sdna_types.h" -#include "DNA_sequence_types.h" -#include "DNA_shader_fx_types.h" -#include "DNA_space_types.h" -#include "DNA_view3d_types.h" -#include "DNA_windowmanager_types.h" -#include "DNA_workspace_types.h" #include "BLI_bitmap.h" #include "BLI_blenlib.h" #include "BLI_mempool.h" #include "MEM_guardedalloc.h" /* MEM_freeN */ -#include "BKE_action.h" -#include "BKE_anim_data.h" -#include "BKE_animsys.h" -#include "BKE_armature.h" #include "BKE_blender_version.h" #include "BKE_bpath.h" -#include "BKE_collection.h" -#include "BKE_colortools.h" -#include "BKE_constraint.h" -#include "BKE_curveprofile.h" -#include "BKE_deform.h" -#include "BKE_fcurve.h" -#include "BKE_fcurve_driver.h" #include "BKE_global.h" /* for G */ -#include "BKE_gpencil_modifier.h" -#include "BKE_icons.h" #include "BKE_idprop.h" #include "BKE_idtype.h" #include "BKE_layer.h" #include "BKE_lib_id.h" #include "BKE_lib_override.h" #include "BKE_main.h" -#include "BKE_modifier.h" #include "BKE_node.h" -#include "BKE_object.h" #include "BKE_packedFile.h" -#include "BKE_pointcache.h" #include "BKE_report.h" -#include "BKE_screen.h" -#include "BKE_shader_fx.h" -#include "BKE_subsurf.h" #include "BKE_workspace.h" #include "BLO_blend_defs.h" @@ -167,8 +123,6 @@ #include "BLO_undofile.h" #include "BLO_writefile.h" -#include "SEQ_sequencer.h" - #include "readfile.h" #include <errno.h> @@ -806,853 +760,6 @@ static void write_userdef(BlendWriter *writer, const UserDef *userdef) } } -/* update this also to readfile.c */ -static const char *ptcache_data_struct[] = { - "", // BPHYS_DATA_INDEX - "", // BPHYS_DATA_LOCATION - "", // BPHYS_DATA_VELOCITY - "", // BPHYS_DATA_ROTATION - "", // BPHYS_DATA_AVELOCITY / BPHYS_DATA_XCONST */ - "", // BPHYS_DATA_SIZE: - "", // BPHYS_DATA_TIMES: - "BoidData", // case BPHYS_DATA_BOIDS: -}; -static const char *ptcache_extra_struct[] = { - "", - "ParticleSpring", - "vec3f", -}; -static void write_pointcaches(BlendWriter *writer, ListBase *ptcaches) -{ - LISTBASE_FOREACH (PointCache *, cache, ptcaches) { - BLO_write_struct(writer, PointCache, cache); - - if ((cache->flag & PTCACHE_DISK_CACHE) == 0) { - LISTBASE_FOREACH (PTCacheMem *, pm, &cache->mem_cache) { - BLO_write_struct(writer, PTCacheMem, pm); - - for (int i = 0; i < BPHYS_TOT_DATA; i++) { - if (pm->data[i] && pm->data_types & (1 << i)) { - if (ptcache_data_struct[i][0] == '\0') { - BLO_write_raw(writer, MEM_allocN_len(pm->data[i]), pm->data[i]); - } - else { - BLO_write_struct_array_by_name( - writer, ptcache_data_struct[i], pm->totpoint, pm->data[i]); - } - } - } - - LISTBASE_FOREACH (PTCacheExtra *, extra, &pm->extradata) { - if (ptcache_extra_struct[extra->type][0] == '\0') { - continue; - } - BLO_write_struct(writer, PTCacheExtra, extra); - BLO_write_struct_array_by_name( - writer, ptcache_extra_struct[extra->type], extra->totdata, extra->data); - } - } - } - } -} - -static void write_particlesystems(BlendWriter *writer, ListBase *particles) -{ - LISTBASE_FOREACH (ParticleSystem *, psys, particles) { - BLO_write_struct(writer, ParticleSystem, psys); - - if (psys->particles) { - BLO_write_struct_array(writer, ParticleData, psys->totpart, psys->particles); - - if (psys->particles->hair) { - ParticleData *pa = psys->particles; - - for (int a = 0; a < psys->totpart; a++, pa++) { - BLO_write_struct_array(writer, HairKey, pa->totkey, pa->hair); - } - } - - if (psys->particles->boid && (psys->part->phystype == PART_PHYS_BOIDS)) { - BLO_write_struct_array(writer, BoidParticle, psys->totpart, psys->particles->boid); - } - - if (psys->part->fluid && (psys->part->phystype == PART_PHYS_FLUID) && - (psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS)) { - BLO_write_struct_array( - writer, ParticleSpring, psys->tot_fluidsprings, psys->fluid_springs); - } - } - LISTBASE_FOREACH (ParticleTarget *, pt, &psys->targets) { - BLO_write_struct(writer, ParticleTarget, pt); - } - - if (psys->child) { - BLO_write_struct_array(writer, ChildParticle, psys->totchild, psys->child); - } - - if (psys->clmd) { - BLO_write_struct(writer, ClothModifierData, psys->clmd); - BLO_write_struct(writer, ClothSimSettings, psys->clmd->sim_parms); - BLO_write_struct(writer, ClothCollSettings, psys->clmd->coll_parms); - } - - write_pointcaches(writer, &psys->ptcaches); - } -} - -static void write_motionpath(BlendWriter *writer, bMotionPath *mpath) -{ - /* sanity checks */ - if (mpath == NULL) { - return; - } - - /* firstly, just write the motionpath struct */ - BLO_write_struct(writer, bMotionPath, mpath); - - /* now write the array of data */ - BLO_write_struct_array(writer, bMotionPathVert, mpath->length, mpath->points); -} - -static void write_constraints(BlendWriter *writer, ListBase *conlist) -{ - LISTBASE_FOREACH (bConstraint *, con, conlist) { - const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); - - /* Write the specific data */ - if (cti && con->data) { - /* firstly, just write the plain con->data struct */ - BLO_write_struct_by_name(writer, cti->structName, con->data); - - /* do any constraint specific stuff */ - switch (con->type) { - case CONSTRAINT_TYPE_PYTHON: { - bPythonConstraint *data = con->data; - - /* write targets */ - LISTBASE_FOREACH (bConstraintTarget *, ct, &data->targets) { - BLO_write_struct(writer, bConstraintTarget, ct); - } - - /* Write ID Properties -- and copy this comment EXACTLY for easy finding - * of library blocks that implement this.*/ - IDP_BlendWrite(writer, data->prop); - - break; - } - case CONSTRAINT_TYPE_ARMATURE: { - bArmatureConstraint *data = con->data; - - /* write targets */ - LISTBASE_FOREACH (bConstraintTarget *, ct, &data->targets) { - BLO_write_struct(writer, bConstraintTarget, ct); - } - - break; - } - case CONSTRAINT_TYPE_SPLINEIK: { - bSplineIKConstraint *data = con->data; - - /* write points array */ - BLO_write_float_array(writer, data->numpoints, data->points); - - break; - } - } - } - - /* Write the constraint */ - BLO_write_struct(writer, bConstraint, con); - } -} - -static void write_pose(BlendWriter *writer, bPose *pose, bArmature *arm) -{ - /* Write each channel */ - if (pose == NULL) { - return; - } - - BLI_assert(arm != NULL); - - /* Write channels */ - LISTBASE_FOREACH (bPoseChannel *, chan, &pose->chanbase) { - /* Write ID Properties -- and copy this comment EXACTLY for easy finding - * of library blocks that implement this.*/ - if (chan->prop) { - IDP_BlendWrite(writer, chan->prop); - } - - write_constraints(writer, &chan->constraints); - - write_motionpath(writer, chan->mpath); - - /* Prevent crashes with autosave, - * when a bone duplicated in edit-mode has not yet been assigned to its pose-channel. - * Also needed with memundo, in some cases we can store a step before pose has been - * properly rebuilt from previous undo step. */ - Bone *bone = (pose->flag & POSE_RECALC) ? BKE_armature_find_bone_name(arm, chan->name) : - chan->bone; - if (bone != NULL) { - /* gets restored on read, for library armatures */ - chan->selectflag = bone->flag & BONE_SELECTED; - } - - BLO_write_struct(writer, bPoseChannel, chan); - } - - /* Write groups */ - LISTBASE_FOREACH (bActionGroup *, grp, &pose->agroups) { - BLO_write_struct(writer, bActionGroup, grp); - } - - /* write IK param */ - if (pose->ikparam) { - const char *structname = BKE_pose_ikparam_get_name(pose); - if (structname) { - BLO_write_struct_by_name(writer, structname, pose->ikparam); - } - } - - /* Write this pose */ - BLO_write_struct(writer, bPose, pose); -} - -static void write_defgroups(BlendWriter *writer, ListBase *defbase) -{ - LISTBASE_FOREACH (bDeformGroup *, defgroup, defbase) { - BLO_write_struct(writer, bDeformGroup, defgroup); - } -} - -static void write_fmaps(BlendWriter *writer, ListBase *fbase) -{ - LISTBASE_FOREACH (bFaceMap *, fmap, fbase) { - BLO_write_struct(writer, bFaceMap, fmap); - } -} - -static void write_modifiers(BlendWriter *writer, ListBase *modbase) -{ - if (modbase == NULL) { - return; - } - - LISTBASE_FOREACH (ModifierData *, md, modbase) { - const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type); - if (mti == NULL) { - return; - } - - BLO_write_struct_by_name(writer, mti->structName, md); - - if (md->type == eModifierType_Cloth) { - ClothModifierData *clmd = (ClothModifierData *)md; - - BLO_write_struct(writer, ClothSimSettings, clmd->sim_parms); - BLO_write_struct(writer, ClothCollSettings, clmd->coll_parms); - BLO_write_struct(writer, EffectorWeights, clmd->sim_parms->effector_weights); - write_pointcaches(writer, &clmd->ptcaches); - } - else if (md->type == eModifierType_Fluid) { - FluidModifierData *fmd = (FluidModifierData *)md; - - if (fmd->type & MOD_FLUID_TYPE_DOMAIN) { - BLO_write_struct(writer, FluidDomainSettings, fmd->domain); - - if (fmd->domain) { - write_pointcaches(writer, &(fmd->domain->ptcaches[0])); - - /* create fake pointcache so that old blender versions can read it */ - fmd->domain->point_cache[1] = BKE_ptcache_add(&fmd->domain->ptcaches[1]); - fmd->domain->point_cache[1]->flag |= PTCACHE_DISK_CACHE | PTCACHE_FAKE_SMOKE; - fmd->domain->point_cache[1]->step = 1; - - write_pointcaches(writer, &(fmd->domain->ptcaches[1])); - - if (fmd->domain->coba) { - BLO_write_struct(writer, ColorBand, fmd->domain->coba); - } - - /* cleanup the fake pointcache */ - BKE_ptcache_free_list(&fmd->domain->ptcaches[1]); - fmd->domain->point_cache[1] = NULL; - - BLO_write_struct(writer, EffectorWeights, fmd->domain->effector_weights); - } - } - else if (fmd->type & MOD_FLUID_TYPE_FLOW) { - BLO_write_struct(writer, FluidFlowSettings, fmd->flow); - } - else if (fmd->type & MOD_FLUID_TYPE_EFFEC) { - BLO_write_struct(writer, FluidEffectorSettings, fmd->effector); - } - } - else if (md->type == eModifierType_Fluidsim) { - FluidsimModifierData *fluidmd = (FluidsimModifierData *)md; - - BLO_write_struct(writer, FluidsimSettings, fluidmd->fss); - } - else if (md->type == eModifierType_DynamicPaint) { - DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md; - - if (pmd->canvas) { - BLO_write_struct(writer, DynamicPaintCanvasSettings, pmd->canvas); - - /* write surfaces */ - LISTBASE_FOREACH (DynamicPaintSurface *, surface, &pmd->canvas->surfaces) { - BLO_write_struct(writer, DynamicPaintSurface, surface); - } - /* write caches and effector weights */ - LISTBASE_FOREACH (DynamicPaintSurface *, surface, &pmd->canvas->surfaces) { - write_pointcaches(writer, &(surface->ptcaches)); - - BLO_write_struct(writer, EffectorWeights, surface->effector_weights); - } - } - if (pmd->brush) { - BLO_write_struct(writer, DynamicPaintBrushSettings, pmd->brush); - BLO_write_struct(writer, ColorBand, pmd->brush->paint_ramp); - BLO_write_struct(writer, ColorBand, pmd->brush->vel_ramp); - } - } - else if (md->type == eModifierType_Collision) { - -#if 0 - CollisionModifierData *collmd = (CollisionModifierData *)md; - // TODO: CollisionModifier should use pointcache - // + have proper reset events before enabling this - writestruct(wd, DATA, MVert, collmd->numverts, collmd->x); - writestruct(wd, DATA, MVert, collmd->numverts, collmd->xnew); - writestruct(wd, DATA, MFace, collmd->numfaces, collmd->mfaces); -#endif - } - - if (mti->blendWrite != NULL) { - mti->blendWrite(writer, md); - } - } -} - -static void write_gpencil_modifiers(BlendWriter *writer, ListBase *modbase) -{ - if (modbase == NULL) { - return; - } - - LISTBASE_FOREACH (GpencilModifierData *, md, modbase) { - const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(md->type); - if (mti == NULL) { - return; - } - - BLO_write_struct_by_name(writer, mti->struct_name, md); - - if (md->type == eGpencilModifierType_Thick) { - ThickGpencilModifierData *gpmd = (ThickGpencilModifierData *)md; - - if (gpmd->curve_thickness) { - BKE_curvemapping_blend_write(writer, gpmd->curve_thickness); - } - } - else if (md->type == eGpencilModifierType_Noise) { - NoiseGpencilModifierData *gpmd = (NoiseGpencilModifierData *)md; - - if (gpmd->curve_intensity) { - BKE_curvemapping_blend_write(writer, gpmd->curve_intensity); - } - } - else if (md->type == eGpencilModifierType_Hook) { - HookGpencilModifierData *gpmd = (HookGpencilModifierData *)md; - - if (gpmd->curfalloff) { - BKE_curvemapping_blend_write(writer, gpmd->curfalloff); - } - } - else if (md->type == eGpencilModifierType_Tint) { - TintGpencilModifierData *gpmd = (TintGpencilModifierData *)md; - if (gpmd->colorband) { - BLO_write_struct(writer, ColorBand, gpmd->colorband); - } - if (gpmd->curve_intensity) { - BKE_curvemapping_blend_write(writer, gpmd->curve_intensity); - } - } - else if (md->type == eGpencilModifierType_Smooth) { - SmoothGpencilModifierData *gpmd = (SmoothGpencilModifierData *)md; - if (gpmd->curve_intensity) { - BKE_curvemapping_blend_write(writer, gpmd->curve_intensity); - } - } - else if (md->type == eGpencilModifierType_Color) { - ColorGpencilModifierData *gpmd = (ColorGpencilModifierData *)md; - if (gpmd->curve_intensity) { - BKE_curvemapping_blend_write(writer, gpmd->curve_intensity); - } - } - else if (md->type == eGpencilModifierType_Opacity) { - OpacityGpencilModifierData *gpmd = (OpacityGpencilModifierData *)md; - if (gpmd->curve_intensity) { - BKE_curvemapping_blend_write(writer, gpmd->curve_intensity); - } - } - } -} - -static void write_shaderfxs(BlendWriter *writer, ListBase *fxbase) -{ - if (fxbase == NULL) { - return; - } - - LISTBASE_FOREACH (ShaderFxData *, fx, fxbase) { - const ShaderFxTypeInfo *fxi = BKE_shaderfx_get_info(fx->type); - if (fxi == NULL) { - return; - } - - BLO_write_struct_by_name(writer, fxi->struct_name, fx); - } -} - -static void write_object(BlendWriter *writer, Object *ob, const void *id_address) -{ - const bool is_undo = BLO_write_is_undo(writer); - if (ob->id.us > 0 || is_undo) { - /* Clean up, important in undo case to reduce false detection of changed data-blocks. */ - BKE_object_runtime_reset(ob); - - if (is_undo) { - /* For undo we stay in object mode during undo presses, so keep edit-mode disabled on save as - * well, can help reducing false detection of changed data-blocks. */ - ob->mode &= ~OB_MODE_EDIT; - } - - /* write LibData */ - BLO_write_id_struct(writer, Object, id_address, &ob->id); - BKE_id_blend_write(writer, &ob->id); - - if (ob->adt) { - BKE_animdata_blend_write(writer, ob->adt); - } - - /* direct data */ - BLO_write_pointer_array(writer, ob->totcol, ob->mat); - BLO_write_raw(writer, sizeof(char) * ob->totcol, ob->matbits); - - bArmature *arm = NULL; - if (ob->type == OB_ARMATURE) { - arm = ob->data; - if (arm && ob->pose && arm->act_bone) { - BLI_strncpy( - ob->pose->proxy_act_bone, arm->act_bone->name, sizeof(ob->pose->proxy_act_bone)); - } - } - - write_pose(writer, ob->pose, arm); - write_defgroups(writer, &ob->defbase); - write_fmaps(writer, &ob->fmaps); - write_constraints(writer, &ob->constraints); - write_motionpath(writer, ob->mpath); - - BLO_write_struct(writer, PartDeflect, ob->pd); - if (ob->soft) { - /* Set deprecated pointers to prevent crashes of older Blenders */ - ob->soft->pointcache = ob->soft->shared->pointcache; - ob->soft->ptcaches = ob->soft->shared->ptcaches; - BLO_write_struct(writer, SoftBody, ob->soft); - BLO_write_struct(writer, SoftBody_Shared, ob->soft->shared); - write_pointcaches(writer, &(ob->soft->shared->ptcaches)); - BLO_write_struct(writer, EffectorWeights, ob->soft->effector_weights); - } - - if (ob->rigidbody_object) { - /* TODO: if any extra data is added to handle duplis, will need separate function then */ - BLO_write_struct(writer, RigidBodyOb, ob->rigidbody_object); - } - if (ob->rigidbody_constraint) { - BLO_write_struct(writer, RigidBodyCon, ob->rigidbody_constraint); - } - - if (ob->type == OB_EMPTY && ob->empty_drawtype == OB_EMPTY_IMAGE) { - BLO_write_struct(writer, ImageUser, ob->iuser); - } - - write_particlesystems(writer, &ob->particlesystem); - write_modifiers(writer, &ob->modifiers); - write_gpencil_modifiers(writer, &ob->greasepencil_modifiers); - write_shaderfxs(writer, &ob->shader_fx); - - BLO_write_struct_list(writer, LinkData, &ob->pc_ids); - - BKE_previewimg_blend_write(writer, ob->preview); - } -} - -static void write_sequence_modifiers(BlendWriter *writer, ListBase *modbase) -{ - LISTBASE_FOREACH (SequenceModifierData *, smd, modbase) { - const SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(smd->type); - - if (smti) { - BLO_write_struct_by_name(writer, smti->struct_name, smd); - - if (smd->type == seqModifierType_Curves) { - CurvesModifierData *cmd = (CurvesModifierData *)smd; - - BKE_curvemapping_blend_write(writer, &cmd->curve_mapping); - } - else if (smd->type == seqModifierType_HueCorrect) { - HueCorrectModifierData *hcmd = (HueCorrectModifierData *)smd; - - BKE_curvemapping_blend_write(writer, &hcmd->curve_mapping); - } - } - else { - BLO_write_struct(writer, SequenceModifierData, smd); - } - } -} - -static void write_view_settings(BlendWriter *writer, ColorManagedViewSettings *view_settings) -{ - if (view_settings->curve_mapping) { - BKE_curvemapping_blend_write(writer, view_settings->curve_mapping); - } -} - -static void write_paint(BlendWriter *writer, Paint *p) -{ - if (p->cavity_curve) { - BKE_curvemapping_blend_write(writer, p->cavity_curve); - } - BLO_write_struct_array(writer, PaintToolSlot, p->tool_slots_len, p->tool_slots); -} - -static void write_layer_collections(BlendWriter *writer, ListBase *lb) -{ - LISTBASE_FOREACH (LayerCollection *, lc, lb) { - BLO_write_struct(writer, LayerCollection, lc); - - write_layer_collections(writer, &lc->layer_collections); - } -} - -static void write_view_layer(BlendWriter *writer, ViewLayer *view_layer) -{ - BLO_write_struct(writer, ViewLayer, view_layer); - BLO_write_struct_list(writer, Base, &view_layer->object_bases); - - if (view_layer->id_properties) { - IDP_BlendWrite(writer, view_layer->id_properties); - } - - LISTBASE_FOREACH (FreestyleModuleConfig *, fmc, &view_layer->freestyle_config.modules) { - BLO_write_struct(writer, FreestyleModuleConfig, fmc); - } - - LISTBASE_FOREACH (FreestyleLineSet *, fls, &view_layer->freestyle_config.linesets) { - BLO_write_struct(writer, FreestyleLineSet, fls); - } - write_layer_collections(writer, &view_layer->layer_collections); -} - -static void write_lightcache_texture(BlendWriter *writer, LightCacheTexture *tex) -{ - if (tex->data) { - size_t data_size = tex->components * tex->tex_size[0] * tex->tex_size[1] * tex->tex_size[2]; - if (tex->data_type == LIGHTCACHETEX_FLOAT) { - data_size *= sizeof(float); - } - else if (tex->data_type == LIGHTCACHETEX_UINT) { - data_size *= sizeof(uint); - } - - /* FIXME: We can't save more than what 32bit systems can handle. - * The solution would be to split the texture but it is too late for 2.90. (see T78529) */ - if (data_size < INT_MAX) { - BLO_write_raw(writer, data_size, tex->data); - } - } -} - -static void write_lightcache(BlendWriter *writer, LightCache *cache) -{ - write_lightcache_texture(writer, &cache->grid_tx); - write_lightcache_texture(writer, &cache->cube_tx); - - if (cache->cube_mips) { - BLO_write_struct_array(writer, LightCacheTexture, cache->mips_len, cache->cube_mips); - for (int i = 0; i < cache->mips_len; i++) { - write_lightcache_texture(writer, &cache->cube_mips[i]); - } - } - - BLO_write_struct_array(writer, LightGridCache, cache->grid_len, cache->grid_data); - BLO_write_struct_array(writer, LightProbeCache, cache->cube_len, cache->cube_data); -} - -static void write_scene(BlendWriter *writer, Scene *sce, const void *id_address) -{ - if (BLO_write_is_undo(writer)) { - /* Clean up, important in undo case to reduce false detection of changed data-blocks. */ - /* XXX This UI data should not be stored in Scene at all... */ - memset(&sce->cursor, 0, sizeof(sce->cursor)); - } - - /* write LibData */ - BLO_write_id_struct(writer, Scene, id_address, &sce->id); - BKE_id_blend_write(writer, &sce->id); - - if (sce->adt) { - BKE_animdata_blend_write(writer, sce->adt); - } - BKE_keyingsets_blend_write(writer, &sce->keyingsets); - - /* direct data */ - ToolSettings *tos = sce->toolsettings; - BLO_write_struct(writer, ToolSettings, tos); - if (tos->vpaint) { - BLO_write_struct(writer, VPaint, tos->vpaint); - write_paint(writer, &tos->vpaint->paint); - } - if (tos->wpaint) { - BLO_write_struct(writer, VPaint, tos->wpaint); - write_paint(writer, &tos->wpaint->paint); - } - if (tos->sculpt) { - BLO_write_struct(writer, Sculpt, tos->sculpt); - write_paint(writer, &tos->sculpt->paint); - } - if (tos->uvsculpt) { - BLO_write_struct(writer, UvSculpt, tos->uvsculpt); - write_paint(writer, &tos->uvsculpt->paint); - } - if (tos->gp_paint) { - BLO_write_struct(writer, GpPaint, tos->gp_paint); - write_paint(writer, &tos->gp_paint->paint); - } - if (tos->gp_vertexpaint) { - BLO_write_struct(writer, GpVertexPaint, tos->gp_vertexpaint); - write_paint(writer, &tos->gp_vertexpaint->paint); - } - if (tos->gp_sculptpaint) { - BLO_write_struct(writer, GpSculptPaint, tos->gp_sculptpaint); - write_paint(writer, &tos->gp_sculptpaint->paint); - } - if (tos->gp_weightpaint) { - BLO_write_struct(writer, GpWeightPaint, tos->gp_weightpaint); - write_paint(writer, &tos->gp_weightpaint->paint); - } - /* write grease-pencil custom ipo curve to file */ - if (tos->gp_interpolate.custom_ipo) { - BKE_curvemapping_blend_write(writer, tos->gp_interpolate.custom_ipo); - } - /* write grease-pencil multiframe falloff curve to file */ - if (tos->gp_sculpt.cur_falloff) { - BKE_curvemapping_blend_write(writer, tos->gp_sculpt.cur_falloff); - } - /* write grease-pencil primitive curve to file */ - if (tos->gp_sculpt.cur_primitive) { - BKE_curvemapping_blend_write(writer, tos->gp_sculpt.cur_primitive); - } - /* Write the curve profile to the file. */ - if (tos->custom_bevel_profile_preset) { - BKE_curveprofile_blend_write(writer, tos->custom_bevel_profile_preset); - } - - write_paint(writer, &tos->imapaint.paint); - - Editing *ed = sce->ed; - if (ed) { - Sequence *seq; - - BLO_write_struct(writer, Editing, ed); - - /* reset write flags too */ - - SEQ_ALL_BEGIN (ed, seq) { - if (seq->strip) { - seq->strip->done = false; - } - BLO_write_struct(writer, Sequence, seq); - } - SEQ_ALL_END; - - SEQ_ALL_BEGIN (ed, seq) { - if (seq->strip && seq->strip->done == 0) { - /* write strip with 'done' at 0 because readfile */ - - if (seq->effectdata) { - switch (seq->type) { - case SEQ_TYPE_COLOR: - BLO_write_struct(writer, SolidColorVars, seq->effectdata); - break; - case SEQ_TYPE_SPEED: - BLO_write_struct(writer, SpeedControlVars, seq->effectdata); - break; - case SEQ_TYPE_WIPE: - BLO_write_struct(writer, WipeVars, seq->effectdata); - break; - case SEQ_TYPE_GLOW: - BLO_write_struct(writer, GlowVars, seq->effectdata); - break; - case SEQ_TYPE_TRANSFORM: - BLO_write_struct(writer, TransformVars, seq->effectdata); - break; - case SEQ_TYPE_GAUSSIAN_BLUR: - BLO_write_struct(writer, GaussianBlurVars, seq->effectdata); - break; - case SEQ_TYPE_TEXT: - BLO_write_struct(writer, TextVars, seq->effectdata); - break; - case SEQ_TYPE_COLORMIX: - BLO_write_struct(writer, ColorMixVars, seq->effectdata); - break; - } - } - - BLO_write_struct(writer, Stereo3dFormat, seq->stereo3d_format); - - Strip *strip = seq->strip; - BLO_write_struct(writer, Strip, strip); - if (strip->crop) { - BLO_write_struct(writer, StripCrop, strip->crop); - } - if (strip->transform) { - BLO_write_struct(writer, StripTransform, strip->transform); - } - if (strip->proxy) { - BLO_write_struct(writer, StripProxy, strip->proxy); - } - if (seq->type == SEQ_TYPE_IMAGE) { - BLO_write_struct_array(writer, - StripElem, - MEM_allocN_len(strip->stripdata) / sizeof(struct StripElem), - strip->stripdata); - } - else if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) { - BLO_write_struct(writer, StripElem, strip->stripdata); - } - - strip->done = true; - } - - if (seq->prop) { - IDP_BlendWrite(writer, seq->prop); - } - - write_sequence_modifiers(writer, &seq->modifiers); - } - SEQ_ALL_END; - - /* new; meta stack too, even when its nasty restore code */ - LISTBASE_FOREACH (MetaStack *, ms, &ed->metastack) { - BLO_write_struct(writer, MetaStack, ms); - } - } - - if (sce->r.avicodecdata) { - BLO_write_struct(writer, AviCodecData, sce->r.avicodecdata); - if (sce->r.avicodecdata->lpFormat) { - BLO_write_raw(writer, (size_t)sce->r.avicodecdata->cbFormat, sce->r.avicodecdata->lpFormat); - } - if (sce->r.avicodecdata->lpParms) { - BLO_write_raw(writer, (size_t)sce->r.avicodecdata->cbParms, sce->r.avicodecdata->lpParms); - } - } - if (sce->r.ffcodecdata.properties) { - IDP_BlendWrite(writer, sce->r.ffcodecdata.properties); - } - - /* writing dynamic list of TimeMarkers to the blend file */ - LISTBASE_FOREACH (TimeMarker *, marker, &sce->markers) { - BLO_write_struct(writer, TimeMarker, marker); - - if (marker->prop != NULL) { - IDP_BlendWrite(writer, marker->prop); - } - } - - /* writing dynamic list of TransformOrientations to the blend file */ - LISTBASE_FOREACH (TransformOrientation *, ts, &sce->transform_spaces) { - BLO_write_struct(writer, TransformOrientation, ts); - } - - /* writing MultiView to the blend file */ - LISTBASE_FOREACH (SceneRenderView *, srv, &sce->r.views) { - BLO_write_struct(writer, SceneRenderView, srv); - } - - if (sce->nodetree) { - BLO_write_struct(writer, bNodeTree, sce->nodetree); - ntreeBlendWrite(writer, sce->nodetree); - } - - write_view_settings(writer, &sce->view_settings); - - /* writing RigidBodyWorld data to the blend file */ - if (sce->rigidbody_world) { - /* Set deprecated pointers to prevent crashes of older Blenders */ - sce->rigidbody_world->pointcache = sce->rigidbody_world->shared->pointcache; - sce->rigidbody_world->ptcaches = sce->rigidbody_world->shared->ptcaches; - BLO_write_struct(writer, RigidBodyWorld, sce->rigidbody_world); - - BLO_write_struct(writer, RigidBodyWorld_Shared, sce->rigidbody_world->shared); - BLO_write_struct(writer, EffectorWeights, sce->rigidbody_world->effector_weights); - write_pointcaches(writer, &(sce->rigidbody_world->shared->ptcaches)); - } - - BKE_previewimg_blend_write(writer, sce->preview); - BKE_curvemapping_curves_blend_write(writer, &sce->r.mblur_shutter_curve); - - LISTBASE_FOREACH (ViewLayer *, view_layer, &sce->view_layers) { - write_view_layer(writer, view_layer); - } - - if (sce->master_collection) { - BLO_write_struct(writer, Collection, sce->master_collection); - BKE_collection_blend_write_nolib(writer, sce->master_collection); - } - - /* Eevee Lightcache */ - if (sce->eevee.light_cache_data && !BLO_write_is_undo(writer)) { - BLO_write_struct(writer, LightCache, sce->eevee.light_cache_data); - write_lightcache(writer, sce->eevee.light_cache_data); - } - - BKE_screen_view3d_shading_blend_write(writer, &sce->display.shading); - - /* Freed on doversion. */ - BLI_assert(sce->layer_properties == NULL); -} - -static void write_wm_xr_data(BlendWriter *writer, wmXrData *xr_data) -{ - BKE_screen_view3d_shading_blend_write(writer, &xr_data->session_settings.shading); -} - -static void write_windowmanager(BlendWriter *writer, wmWindowManager *wm, const void *id_address) -{ - BLO_write_id_struct(writer, wmWindowManager, id_address, &wm->id); - BKE_id_blend_write(writer, &wm->id); - write_wm_xr_data(writer, &wm->xr); - - LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { - /* update deprecated screen member (for so loading in 2.7x uses the correct screen) */ - win->screen = BKE_workspace_active_screen_get(win->workspace_hook); - - BLO_write_struct(writer, wmWindow, win); - BLO_write_struct(writer, WorkSpaceInstanceHook, win->workspace_hook); - BLO_write_struct(writer, Stereo3dFormat, win->stereo3d_format); - - BKE_screen_area_map_blend_write(writer, &win->global_areas); - - /* data is written, clear deprecated data again */ - win->screen = NULL; - } -} - /* Keep it last of write_foodata functions. */ static void write_libraries(WriteData *wd, Main *main) { @@ -1910,66 +1017,6 @@ static bool write_file_handle(Main *mainvar, id_type->blend_write(&writer, (ID *)id_buffer, id); } - switch ((ID_Type)GS(id->name)) { - case ID_WM: - write_windowmanager(&writer, (wmWindowManager *)id_buffer, id); - break; - case ID_SCE: - write_scene(&writer, (Scene *)id_buffer, id); - break; - case ID_OB: - write_object(&writer, (Object *)id_buffer, id); - break; - case ID_WS: - case ID_SCR: - case ID_PA: - case ID_GR: - case ID_ME: - case ID_LT: - case ID_AC: - case ID_NT: - case ID_LS: - case ID_TXT: - case ID_VF: - case ID_MC: - case ID_PC: - case ID_PAL: - case ID_BR: - case ID_IM: - case ID_LA: - case ID_MA: - case ID_MB: - case ID_CU: - case ID_CA: - case ID_WO: - case ID_MSK: - case ID_SPK: - case ID_AR: - case ID_LP: - case ID_KE: - case ID_TE: - case ID_GD: - case ID_HA: - case ID_PT: - case ID_VO: - case ID_SIM: - case ID_SO: - case ID_CF: - /* Do nothing, handled in IDTypeInfo callback. */ - break; - case ID_LI: - /* Do nothing, handled below - and should never be reached. */ - BLI_assert(0); - break; - case ID_IP: - /* Do nothing, deprecated. */ - break; - default: - /* Should never be reached. */ - BLI_assert(0); - break; - } - if (do_override) { BKE_lib_override_library_operations_store_end(override_storage, id); } diff --git a/source/blender/blenloader/tests/blendfile_loading_base_test.cc b/source/blender/blenloader/tests/blendfile_loading_base_test.cc index cb5fcdbe3c6..a3aabf6ac10 100644 --- a/source/blender/blenloader/tests/blendfile_loading_base_test.cc +++ b/source/blender/blenloader/tests/blendfile_loading_base_test.cc @@ -127,7 +127,7 @@ bool BlendfileLoadingBaseTest::blendfile_load(const char *filepath) char abspath[FILENAME_MAX]; BLI_path_join(abspath, sizeof(abspath), test_assets_dir.c_str(), filepath, NULL); - bfile = BLO_read_from_file(abspath, BLO_READ_SKIP_NONE, NULL /* reports */); + bfile = BLO_read_from_file(abspath, BLO_READ_SKIP_NONE, nullptr /* reports */); if (bfile == nullptr) { ADD_FAILURE() << "Unable to load file '" << filepath << "' from test assets dir '" << test_assets_dir << "'"; @@ -144,7 +144,7 @@ void BlendfileLoadingBaseTest::blendfile_free() wmWindowManager *wm = static_cast<wmWindowManager *>(bfile->main->wm.first); if (wm != nullptr) { - wm_close_and_free(NULL, wm); + wm_close_and_free(nullptr, wm); } BLO_blendfiledata_free(bfile); bfile = nullptr; diff --git a/source/blender/bmesh/tests/bmesh_core_test.cc b/source/blender/bmesh/tests/bmesh_core_test.cc index afbc11e0722..202d16b09e3 100644 --- a/source/blender/bmesh/tests/bmesh_core_test.cc +++ b/source/blender/bmesh/tests/bmesh_core_test.cc @@ -16,8 +16,8 @@ TEST(bmesh_core, BMVertCreate) EXPECT_EQ(bm->totvert, 0); /* make a custom layer so we can see if it is copied properly */ BM_data_layer_add(bm, &bm->vdata, CD_PROP_FLOAT); - bv1 = BM_vert_create(bm, co1, NULL, BM_CREATE_NOP); - ASSERT_TRUE(bv1 != NULL); + bv1 = BM_vert_create(bm, co1, nullptr, BM_CREATE_NOP); + ASSERT_TRUE(bv1 != nullptr); EXPECT_EQ(bv1->co[0], 1.0f); EXPECT_EQ(bv1->co[1], 2.0f); EXPECT_EQ(bv1->co[2], 0.0f); @@ -25,14 +25,14 @@ TEST(bmesh_core, BMVertCreate) EXPECT_EQ(bv1->head.htype, (char)BM_VERT); EXPECT_EQ(bv1->head.hflag, 0); EXPECT_EQ(bv1->head.api_flag, 0); - bv2 = BM_vert_create(bm, NULL, NULL, BM_CREATE_NOP); - ASSERT_TRUE(bv2 != NULL); + bv2 = BM_vert_create(bm, nullptr, nullptr, BM_CREATE_NOP); + ASSERT_TRUE(bv2 != nullptr); EXPECT_TRUE(is_zero_v3(bv2->co)); /* create with example should copy custom data but not select flag */ BM_vert_select_set(bm, bv2, true); BM_elem_float_data_set(&bm->vdata, bv2, CD_PROP_FLOAT, 1.5f); bv3 = BM_vert_create(bm, co1, bv2, BM_CREATE_NOP); - ASSERT_TRUE(bv3 != NULL); + ASSERT_TRUE(bv3 != nullptr); EXPECT_FALSE(BM_elem_flag_test((BMElem *)bv3, BM_ELEM_SELECT)); EXPECT_EQ(BM_elem_float_data_get(&bm->vdata, bv3, CD_PROP_FLOAT), 1.5f); EXPECT_EQ(BM_mesh_elem_count(bm, BM_VERT), 3); diff --git a/source/blender/bmesh/tools/bmesh_boolean.cc b/source/blender/bmesh/tools/bmesh_boolean.cc index 56585cb722e..929bc510672 100644 --- a/source/blender/bmesh/tools/bmesh_boolean.cc +++ b/source/blender/bmesh/tools/bmesh_boolean.cc @@ -30,8 +30,7 @@ #include "bmesh_boolean.h" #include "bmesh_edgesplit.h" -namespace blender { -namespace meshintersect { +namespace blender::meshintersect { #ifdef WITH_GMP @@ -117,11 +116,24 @@ static bool bmvert_attached_to_wire(const BMVert *bmv) return BM_vert_is_wire(bmv); } +static bool bmvert_attached_to_hidden_face(BMVert *bmv) +{ + BMIter iter; + for (BMFace *bmf = static_cast<BMFace *>(BM_iter_new(&iter, nullptr, BM_FACES_OF_VERT, bmv)); + bmf; + bmf = static_cast<BMFace *>(BM_iter_step(&iter))) { + if (BM_elem_flag_test(bmf, BM_ELEM_HIDDEN)) { + return true; + } + } + return false; +} + static bool face_has_verts_in_order(BMesh *bm, BMFace *bmf, const BMVert *v1, const BMVert *v2) { BMIter liter; BMLoop *l = static_cast<BMLoop *>(BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, bmf)); - while (l != NULL) { + while (l != nullptr) { if (l->v == v1 && l->next->v == v2) { return true; } @@ -140,17 +152,19 @@ constexpr uint KEEP_FLAG = (1 << 6); * Also, the #BM_ELEM_TAG header flag is set for those #BMEdge's that come from intersections * resulting from the intersection needed by the Boolean operation. */ -static bool apply_mesh_output_to_bmesh(BMesh *bm, IMesh &m_out) +static bool apply_mesh_output_to_bmesh(BMesh *bm, IMesh &m_out, bool keep_hidden) { bool any_change = false; m_out.populate_vert(); /* Initially mark all existing verts as "don't keep", except hidden verts - * and verts attached to wire edges. */ + * (if keep_hidden is true), and verts attached to wire edges. */ for (int v = 0; v < bm->totvert; ++v) { BMVert *bmv = BM_vert_at_index(bm, v); - if (BM_elem_flag_test(bmv, BM_ELEM_HIDDEN) || bmvert_attached_to_wire(bmv)) { + if ((keep_hidden && + (BM_elem_flag_test(bmv, BM_ELEM_HIDDEN) || bmvert_attached_to_hidden_face(bmv))) || + bmvert_attached_to_wire(bmv)) { BM_elem_flag_enable(bmv, KEEP_FLAG); } else { @@ -184,21 +198,21 @@ static bool apply_mesh_output_to_bmesh(BMesh *bm, IMesh &m_out) for (int i = 0; i < 3; ++i) { co[i] = static_cast<float>(d_co[i]); } - BMVert *bmv = BM_vert_create(bm, co, NULL, BM_CREATE_NOP); + BMVert *bmv = BM_vert_create(bm, co, nullptr, BM_CREATE_NOP); new_bmvs[v] = bmv; BM_elem_flag_enable(bmv, KEEP_FLAG); any_change = true; } } - /* Initially mark all existing faces as "don't keep", except hidden faces. + /* Initially mark all existing faces as "don't keep", except hidden faces (if keep_hidden). * Also, save current #BMFace pointers as creating faces will disturb the table. */ Array<BMFace *> old_bmfs(bm->totface); BM_mesh_elem_index_ensure(bm, BM_FACE); for (int f = 0; f < bm->totface; ++f) { BMFace *bmf = BM_face_at_index(bm, f); old_bmfs[f] = bmf; - if (BM_elem_flag_test(bmf, BM_ELEM_HIDDEN)) { + if (keep_hidden && BM_elem_flag_test(bmf, BM_ELEM_HIDDEN)) { BM_elem_flag_enable(bmf, KEEP_FLAG); } else { @@ -231,7 +245,7 @@ static bool apply_mesh_output_to_bmesh(BMesh *bm, IMesh &m_out) BMFace *bmf = BM_face_exists(face_bmverts.data(), flen); /* #BM_face_exists checks if the face exists with the vertices in either order. * We can only reuse the face if the orientations are the same. */ - if (bmf != NULL && face_has_verts_in_order(bm, bmf, face_bmverts[0], face_bmverts[1])) { + if (bmf != nullptr && face_has_verts_in_order(bm, bmf, face_bmverts[0], face_bmverts[1])) { BM_elem_flag_enable(bmf, KEEP_FLAG); } else { @@ -242,20 +256,20 @@ static bool apply_mesh_output_to_bmesh(BMesh *bm, IMesh &m_out) orig_face = old_bmfs[orig]; } else { - orig_face = NULL; + orig_face = nullptr; } /* Make or find #BMEdge's. */ for (int i = 0; i < flen; ++i) { BMVert *bmv1 = face_bmverts[i]; BMVert *bmv2 = face_bmverts[(i + 1) % flen]; BMEdge *bme = BM_edge_exists(bmv1, bmv2); - if (bme == NULL) { - BMEdge *orig_edge = NULL; + if (bme == nullptr) { + BMEdge *orig_edge = nullptr; if (face.edge_orig[i] != NO_INDEX) { orig_edge = old_edges[face.edge_orig[i]]; } bme = BM_edge_create(bm, bmv1, bmv2, orig_edge, BM_CREATE_NOP); - if (orig_edge != NULL) { + if (orig_edge != nullptr) { BM_elem_select_copy(bm, bme, orig_edge); } } @@ -269,15 +283,15 @@ static bool apply_mesh_output_to_bmesh(BMesh *bm, IMesh &m_out) } BMFace *bmf = BM_face_create( bm, face_bmverts.data(), face_bmedges.data(), flen, orig_face, BM_CREATE_NOP); - if (orig_face != NULL) { + if (orig_face != nullptr) { BM_elem_select_copy(bm, bmf, orig_face); } BM_elem_flag_enable(bmf, KEEP_FLAG); /* Now do interpolation of loop data (e.g., UV's) using the example face. */ - if (orig_face != NULL) { + if (orig_face != nullptr) { BMIter liter; BMLoop *l = static_cast<BMLoop *>(BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, bmf)); - while (l != NULL) { + while (l != nullptr) { BM_loop_interp_from_face(bm, l, orig_face, true, true); l = static_cast<BMLoop *>(BM_iter_step(&liter)); } @@ -290,8 +304,8 @@ static bool apply_mesh_output_to_bmesh(BMesh *bm, IMesh &m_out) /* #BM_ITER_MESH_MUTABLE macro needs type casts for C++, so expand here. * TODO(howard): make some nice C++ iterators for #BMesh. */ BMIter iter; - BMFace *bmf = static_cast<BMFace *>(BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL)); - while (bmf != NULL) { + BMFace *bmf = static_cast<BMFace *>(BM_iter_new(&iter, bm, BM_FACES_OF_MESH, nullptr)); + while (bmf != nullptr) { # ifdef DEBUG iter.count = BM_iter_mesh_count(BM_FACES_OF_MESH, bm); # endif @@ -308,8 +322,8 @@ static bool apply_mesh_output_to_bmesh(BMesh *bm, IMesh &m_out) } bmf = bmf_next; } - BMVert *bmv = static_cast<BMVert *>(BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL)); - while (bmv != NULL) { + BMVert *bmv = static_cast<BMVert *>(BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, nullptr)); + while (bmv != nullptr) { # ifdef DEBUG iter.count = BM_iter_mesh_count(BM_VERTS_OF_MESH, bm); # endif @@ -335,6 +349,7 @@ static bool bmesh_boolean(BMesh *bm, int nshapes, const bool use_self, const bool use_separate_all, + const bool keep_hidden, const BoolOpType boolean_mode) { IMeshArena arena; @@ -364,7 +379,7 @@ static bool bmesh_boolean(BMesh *bm, } IMesh m_out = boolean_mesh( m_in, boolean_mode, nshapes, shape_fn, use_self, &m_triangulated, &arena); - bool any_change = apply_mesh_output_to_bmesh(bm, m_out); + bool any_change = apply_mesh_output_to_bmesh(bm, m_out, keep_hidden); if (use_separate_all) { /* We are supposed to separate all faces that are incident on intersection edges. */ BM_mesh_edgesplit(bm, false, true, false); @@ -374,8 +389,7 @@ static bool bmesh_boolean(BMesh *bm, #endif // WITH_GMP -} // namespace meshintersect -} // namespace blender +} // namespace blender::meshintersect extern "C" { /** @@ -402,6 +416,7 @@ bool BM_mesh_boolean(BMesh *bm, void *user_data, const int nshapes, const bool use_self, + const bool keep_hidden, const int boolean_mode) { return blender::meshintersect::bmesh_boolean( @@ -413,6 +428,7 @@ bool BM_mesh_boolean(BMesh *bm, nshapes, use_self, false, + keep_hidden, static_cast<blender::meshintersect::BoolOpType>(boolean_mode)); } @@ -431,7 +447,8 @@ bool BM_mesh_boolean_knife(BMesh *bm, void *user_data, const int nshapes, const bool use_self, - const bool use_separate_all) + const bool use_separate_all, + const bool keep_hidden) { return blender::meshintersect::bmesh_boolean(bm, looptris, @@ -441,6 +458,7 @@ bool BM_mesh_boolean_knife(BMesh *bm, nshapes, use_self, use_separate_all, + keep_hidden, blender::meshintersect::BoolOpType::None); } #else @@ -451,6 +469,7 @@ bool BM_mesh_boolean(BMesh *UNUSED(bm), void *UNUSED(user_data), const int UNUSED(nshapes), const bool UNUSED(use_self), + const bool UNUSED(keep_hidden), const int UNUSED(boolean_mode)) { UNUSED_VARS(looptris, test_fn); @@ -472,7 +491,8 @@ bool BM_mesh_boolean_knife(BMesh *UNUSED(bm), void *UNUSED(user_data), const int UNUSED(nshapes), const bool UNUSED(use_self), - const bool UNUSED(use_separate_all)) + const bool UNUSED(use_separate_all), + const bool UNUSED(keep_boolean)) { UNUSED_VARS(looptris, test_fn); return false; diff --git a/source/blender/bmesh/tools/bmesh_boolean.h b/source/blender/bmesh/tools/bmesh_boolean.h index 04b5205ec84..2cc32e143fc 100644 --- a/source/blender/bmesh/tools/bmesh_boolean.h +++ b/source/blender/bmesh/tools/bmesh_boolean.h @@ -31,6 +31,7 @@ bool BM_mesh_boolean(BMesh *bm, void *user_data, const int nshapes, const bool use_self, + const bool keep_hidden, const int boolean_mode); bool BM_mesh_boolean_knife(BMesh *bm, @@ -40,7 +41,8 @@ bool BM_mesh_boolean_knife(BMesh *bm, void *user_data, const int nshapes, const bool use_self, - const bool use_separate_all); + const bool use_separate_all, + const bool keep_hidden); #ifdef __cplusplus } diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt index 54dd121952b..fec98f58261 100644 --- a/source/blender/compositor/CMakeLists.txt +++ b/source/blender/compositor/CMakeLists.txt @@ -34,8 +34,8 @@ set(INC ../windowmanager ../nodes/composite ../nodes/intern - ../render/extern/include - ../render/intern/include + ../render + ../render/intern ../../../extern/clew/include ../../../intern/atomic ../../../intern/guardedalloc diff --git a/source/blender/compositor/intern/COM_CPUDevice.cpp b/source/blender/compositor/intern/COM_CPUDevice.cpp index 26fe1ba0bc3..7ea12866148 100644 --- a/source/blender/compositor/intern/COM_CPUDevice.cpp +++ b/source/blender/compositor/intern/COM_CPUDevice.cpp @@ -32,5 +32,5 @@ void CPUDevice::execute(WorkPackage *work) executionGroup->getOutputOperation()->executeRegion(&rect, chunkNumber); - executionGroup->finalizeChunkExecution(chunkNumber, NULL); + executionGroup->finalizeChunkExecution(chunkNumber, nullptr); } diff --git a/source/blender/compositor/intern/COM_CompositorContext.cpp b/source/blender/compositor/intern/COM_CompositorContext.cpp index 3d55fcba086..52e705ffb79 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.cpp +++ b/source/blender/compositor/intern/COM_CompositorContext.cpp @@ -22,13 +22,13 @@ CompositorContext::CompositorContext() { - this->m_scene = NULL; - this->m_rd = NULL; + this->m_scene = nullptr; + this->m_rd = nullptr; this->m_quality = COM_QUALITY_HIGH; this->m_hasActiveOpenCLDevices = false; this->m_fastCalculation = false; - this->m_viewSettings = NULL; - this->m_displaySettings = NULL; + this->m_viewSettings = nullptr; + this->m_displaySettings = nullptr; } int CompositorContext::getFramenumber() const diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp index 15a52d10071..f7250de8566 100644 --- a/source/blender/compositor/intern/COM_Converter.cpp +++ b/source/blender/compositor/intern/COM_Converter.cpp @@ -133,11 +133,11 @@ bool Converter::is_fast_node(bNode *b_node) Node *Converter::convert(bNode *b_node) { - Node *node = NULL; + Node *node = nullptr; /* ignore undefined nodes with missing or invalid node data */ if (!nodeIsRegistered(b_node)) { - return NULL; + return nullptr; } switch (b_node->type) { @@ -439,7 +439,7 @@ NodeOperation *Converter::convertDataType(NodeOperationOutput *from, NodeOperati return new ConvertVectorToColorOperation(); } - return NULL; + return nullptr; } void Converter::convertResolution(NodeOperationBuilder &builder, @@ -498,8 +498,8 @@ void Converter::convertResolution(NodeOperationBuilder &builder, } if (doCenter) { - NodeOperation *first = NULL; - ScaleOperation *scaleOperation = NULL; + NodeOperation *first = nullptr; + ScaleOperation *scaleOperation = nullptr; if (doScale) { scaleOperation = new ScaleOperation(); scaleOperation->getInputSocket(1)->setResizeMode(COM_SC_NO_RESIZE); diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp index ad980177ae5..27cec28f5d5 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp @@ -45,8 +45,8 @@ ExecutionGroup::ExecutionGroup() { this->m_isOutput = false; this->m_complex = false; - this->m_chunkExecutionStates = NULL; - this->m_bTree = NULL; + this->m_chunkExecutionStates = nullptr; + this->m_bTree = nullptr; this->m_height = 0; this->m_width = 0; this->m_cachedMaxReadBufferOffset = 0; @@ -121,13 +121,13 @@ NodeOperation *ExecutionGroup::getOutputOperation() const void ExecutionGroup::initExecution() { - if (this->m_chunkExecutionStates != NULL) { + if (this->m_chunkExecutionStates != nullptr) { MEM_freeN(this->m_chunkExecutionStates); } unsigned int index; determineNumberOfChunks(); - this->m_chunkExecutionStates = NULL; + this->m_chunkExecutionStates = nullptr; if (this->m_numberOfChunks != 0) { this->m_chunkExecutionStates = (ChunkExecutionState *)MEM_mallocN( sizeof(ChunkExecutionState) * this->m_numberOfChunks, __func__); @@ -152,15 +152,15 @@ void ExecutionGroup::initExecution() void ExecutionGroup::deinitExecution() { - if (this->m_chunkExecutionStates != NULL) { + if (this->m_chunkExecutionStates != nullptr) { MEM_freeN(this->m_chunkExecutionStates); - this->m_chunkExecutionStates = NULL; + this->m_chunkExecutionStates = nullptr; } this->m_numberOfChunks = 0; this->m_numberOfXChunks = 0; this->m_numberOfYChunks = 0; this->m_cachedReadOperations.clear(); - this->m_bTree = NULL; + this->m_bTree = nullptr; } void ExecutionGroup::determineResolution(unsigned int resolution[2]) { @@ -415,7 +415,7 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo MemoryBuffer *buffer = memoryBuffers[index]; if (buffer) { if (buffer->isTemporarily()) { - memoryBuffers[index] = NULL; + memoryBuffers[index] = nullptr; delete buffer; } } @@ -478,7 +478,7 @@ MemoryBuffer *ExecutionGroup::allocateOutputBuffer(int /*chunkNumber*/, rcti *re MemoryBuffer *buffer = new MemoryBuffer(writeOperation->getMemoryProxy(), rect); return buffer; } - return NULL; + return nullptr; } bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area) @@ -562,7 +562,7 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph, int xChun determineDependingAreaOfInterest(&rect, readOperation, &area); ExecutionGroup *group = memoryProxy->getExecutor(); - if (group != NULL) { + if (group != nullptr) { if (!group->scheduleAreaWhenPossible(graph, &area)) { canBeExecuted = false; } diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp index f58d7a768cc..a13db6bb09e 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp @@ -83,7 +83,7 @@ MemoryBuffer::MemoryBuffer(DataType dataType, rcti *rect) this->m_width = BLI_rcti_size_x(&this->m_rect); this->m_height = BLI_rcti_size_y(&this->m_rect); this->m_height = this->m_rect.ymax - this->m_rect.ymin; - this->m_memoryProxy = NULL; + this->m_memoryProxy = nullptr; this->m_chunkNumber = -1; this->m_num_channels = determine_num_channels(dataType); this->m_buffer = (float *)MEM_mallocN_aligned( @@ -145,7 +145,7 @@ MemoryBuffer::~MemoryBuffer() { if (this->m_buffer) { MEM_freeN(this->m_buffer); - this->m_buffer = NULL; + this->m_buffer = nullptr; } } diff --git a/source/blender/compositor/intern/COM_MemoryProxy.cpp b/source/blender/compositor/intern/COM_MemoryProxy.cpp index b73bac469d0..7d590cd0ef6 100644 --- a/source/blender/compositor/intern/COM_MemoryProxy.cpp +++ b/source/blender/compositor/intern/COM_MemoryProxy.cpp @@ -20,8 +20,8 @@ MemoryProxy::MemoryProxy(DataType datatype) { - this->m_writeBufferOperation = NULL; - this->m_executor = NULL; + this->m_writeBufferOperation = nullptr; + this->m_executor = nullptr; this->m_datatype = datatype; } @@ -40,6 +40,6 @@ void MemoryProxy::free() { if (this->m_buffer) { delete this->m_buffer; - this->m_buffer = NULL; + this->m_buffer = nullptr; } } diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp index 30ebd7e0d4b..74aefaf0e6d 100644 --- a/source/blender/compositor/intern/COM_Node.cpp +++ b/source/blender/compositor/intern/COM_Node.cpp @@ -37,14 +37,14 @@ **************/ Node::Node(bNode *editorNode, bool create_sockets) - : m_editorNodeTree(NULL), + : m_editorNodeTree(nullptr), m_editorNode(editorNode), m_inActiveGroup(false), m_instanceKey(NODE_INSTANCE_KEY_NONE) { if (create_sockets) { bNodeSocket *input = (bNodeSocket *)editorNode->inputs.first; - while (input != NULL) { + while (input != nullptr) { DataType dt = COM_DT_VALUE; if (input->type == SOCK_RGBA) { dt = COM_DT_COLOR; @@ -57,7 +57,7 @@ Node::Node(bNode *editorNode, bool create_sockets) input = input->next; } bNodeSocket *output = (bNodeSocket *)editorNode->outputs.first; - while (output != NULL) { + while (output != nullptr) { DataType dt = COM_DT_VALUE; if (output->type == SOCK_RGBA) { dt = COM_DT_COLOR; @@ -86,7 +86,7 @@ Node::~Node() void Node::addInputSocket(DataType datatype) { - this->addInputSocket(datatype, NULL); + this->addInputSocket(datatype, nullptr); } void Node::addInputSocket(DataType datatype, bNodeSocket *bSocket) @@ -97,7 +97,7 @@ void Node::addInputSocket(DataType datatype, bNodeSocket *bSocket) void Node::addOutputSocket(DataType datatype) { - this->addOutputSocket(datatype, NULL); + this->addOutputSocket(datatype, nullptr); } void Node::addOutputSocket(DataType datatype, bNodeSocket *bSocket) { @@ -121,27 +121,27 @@ bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex) { bNodeSocket *bSock = (bNodeSocket *)this->getbNode()->inputs.first; int index = 0; - while (bSock != NULL) { + while (bSock != nullptr) { if (index == editorNodeInputSocketIndex) { return bSock; } index++; bSock = bSock->next; } - return NULL; + return nullptr; } bNodeSocket *Node::getEditorOutputSocket(int editorNodeOutputSocketIndex) { bNodeSocket *bSock = (bNodeSocket *)this->getbNode()->outputs.first; int index = 0; - while (bSock != NULL) { + while (bSock != nullptr) { if (index == editorNodeOutputSocketIndex) { return bSock; } index++; bSock = bSock->next; } - return NULL; + return nullptr; } /******************* @@ -149,7 +149,7 @@ bNodeSocket *Node::getEditorOutputSocket(int editorNodeOutputSocketIndex) *******************/ NodeInput::NodeInput(Node *node, bNodeSocket *b_socket, DataType datatype) - : m_node(node), m_editorSocket(b_socket), m_datatype(datatype), m_link(NULL) + : m_node(node), m_editorSocket(b_socket), m_datatype(datatype), m_link(nullptr) { } diff --git a/source/blender/compositor/intern/COM_NodeGraph.cpp b/source/blender/compositor/intern/COM_NodeGraph.cpp index fe680f61a90..b604b8ced88 100644 --- a/source/blender/compositor/intern/COM_NodeGraph.cpp +++ b/source/blender/compositor/intern/COM_NodeGraph.cpp @@ -61,7 +61,7 @@ bNodeSocket *NodeGraph::find_b_node_input(bNode *b_node, const char *identifier) return b_sock; } } - return NULL; + return nullptr; } bNodeSocket *NodeGraph::find_b_node_output(bNode *b_node, const char *identifier) @@ -71,7 +71,7 @@ bNodeSocket *NodeGraph::find_b_node_output(bNode *b_node, const char *identifier return b_sock; } } - return NULL; + return nullptr; } void NodeGraph::add_node(Node *node, @@ -179,7 +179,7 @@ NodeOutput *NodeGraph::find_output(const NodeRange &node_range, bNodeSocket *b_s } } } - return NULL; + return nullptr; } void NodeGraph::add_bNodeLink(const NodeRange &node_range, bNodeLink *b_nodelink) diff --git a/source/blender/compositor/intern/COM_NodeOperation.cpp b/source/blender/compositor/intern/COM_NodeOperation.cpp index 4e3c5d2df6c..0842721a9e5 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.cpp +++ b/source/blender/compositor/intern/COM_NodeOperation.cpp @@ -36,7 +36,7 @@ NodeOperation::NodeOperation() this->m_height = 0; this->m_isResolutionSet = false; this->m_openCL = false; - this->m_btree = NULL; + this->m_btree = nullptr; } NodeOperation::~NodeOperation() @@ -146,7 +146,7 @@ NodeOperation *NodeOperation::getInputOperation(unsigned int inputSocketIndex) return &input->getLink()->getOperation(); } - return NULL; + return nullptr; } void NodeOperation::getConnectedInputSockets(Inputs *sockets) @@ -199,7 +199,7 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti *input, NodeOperationInput::NodeOperationInput(NodeOperation *op, DataType datatype, InputResizeMode resizeMode) - : m_operation(op), m_datatype(datatype), m_resizeMode(resizeMode), m_link(NULL) + : m_operation(op), m_datatype(datatype), m_resizeMode(resizeMode), m_link(nullptr) { } @@ -209,7 +209,7 @@ SocketReader *NodeOperationInput::getReader() return &m_link->getOperation(); } - return NULL; + return nullptr; } void NodeOperationInput::determineResolution(unsigned int resolution[2], diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp b/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp index 53a6d115e97..1237e728079 100644 --- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp +++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp @@ -38,7 +38,7 @@ #include "COM_NodeOperationBuilder.h" /* own include */ NodeOperationBuilder::NodeOperationBuilder(const CompositorContext *context, bNodeTree *b_nodetree) - : m_context(context), m_current_node(NULL), m_active_viewer(NULL) + : m_context(context), m_current_node(nullptr), m_active_viewer(nullptr) { m_graph.from_bNodeTree(*context, b_nodetree); } @@ -61,7 +61,7 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system) node->convertToOperations(converter, *m_context); } - m_current_node = NULL; + m_current_node = nullptr; /* The input map constructed by nodes maps operation inputs to node inputs. * Inverting yields a map of node inputs to all connected operation inputs, @@ -168,7 +168,7 @@ void NodeOperationBuilder::removeInputLink(NodeOperationInput *to) Link &link = *it; if (link.to() == to) { /* unregister with the input */ - to->setLink(NULL); + to->setLink(nullptr); m_links.erase(it); return; @@ -203,15 +203,15 @@ PreviewOperation *NodeOperationBuilder::make_preview_operation() const BLI_assert(m_current_node); if (!(m_current_node->getbNode()->flag & NODE_PREVIEW)) { - return NULL; + return nullptr; } /* previews only in the active group */ if (!m_current_node->isInActiveGroup()) { - return NULL; + return nullptr; } /* do not calculate previews of hidden nodes */ if (m_current_node->getbNode()->flag & NODE_HIDDEN) { - return NULL; + return nullptr; } bNodeInstanceHash *previews = m_context->getPreviewHash(); @@ -223,7 +223,7 @@ PreviewOperation *NodeOperationBuilder::make_preview_operation() const return operation; } - return NULL; + return nullptr; } void NodeOperationBuilder::addPreview(NodeOperationOutput *output) @@ -476,7 +476,7 @@ WriteBufferOperation *NodeOperationBuilder::find_attached_write_buffer_operation } } } - return NULL; + return nullptr; } void NodeOperationBuilder::add_input_buffers(NodeOperation * /*operation*/, @@ -526,13 +526,13 @@ void NodeOperationBuilder::add_output_buffers(NodeOperation *operation, return; } - WriteBufferOperation *writeOperation = NULL; + WriteBufferOperation *writeOperation = nullptr; for (OpInputs::const_iterator it = targets.begin(); it != targets.end(); ++it) { NodeOperationInput *target = *it; /* try to find existing write buffer operation */ if (target->getOperation().isWriteBufferOperation()) { - BLI_assert(writeOperation == NULL); /* there should only be one write op connected */ + BLI_assert(writeOperation == nullptr); /* there should only be one write op connected */ writeOperation = (WriteBufferOperation *)(&target->getOperation()); } else { @@ -728,7 +728,7 @@ void NodeOperationBuilder::group_operations() ReadBufferOperation *read_op = (ReadBufferOperation *)op; MemoryProxy *memproxy = read_op->getMemoryProxy(); - if (memproxy->getExecutor() == NULL) { + if (memproxy->getExecutor() == nullptr) { ExecutionGroup *group = make_group(memproxy->getWriteBufferOperation()); memproxy->setExecutor(group); } diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cpp b/source/blender/compositor/intern/COM_OpenCLDevice.cpp index 2529637801d..51ae9d6652e 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.cpp +++ b/source/blender/compositor/intern/COM_OpenCLDevice.cpp @@ -41,7 +41,7 @@ OpenCLDevice::OpenCLDevice(cl_context context, this->m_device = device; this->m_context = context; this->m_program = program; - this->m_queue = NULL; + this->m_queue = nullptr; this->m_vendorID = vendorId; } @@ -196,7 +196,8 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemo (size_t)outputMemoryBuffer->getHeight(), }; - error = clEnqueueNDRangeKernel(this->m_queue, kernel, 2, NULL, size, 0, 0, 0, NULL); + error = clEnqueueNDRangeKernel( + this->m_queue, kernel, 2, nullptr, size, nullptr, 0, nullptr, nullptr); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } @@ -243,7 +244,8 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } - error = clEnqueueNDRangeKernel(this->m_queue, kernel, 2, NULL, size, 0, 0, 0, NULL); + error = clEnqueueNDRangeKernel( + this->m_queue, kernel, 2, nullptr, size, nullptr, 0, nullptr, nullptr); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp b/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp index 98239166860..5febf3802de 100644 --- a/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp +++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp @@ -20,7 +20,7 @@ SingleThreadedOperation::SingleThreadedOperation() { - this->m_cachedInstance = NULL; + this->m_cachedInstance = nullptr; setComplex(true); } @@ -39,7 +39,7 @@ void SingleThreadedOperation::deinitExecution() deinitMutex(); if (this->m_cachedInstance) { delete this->m_cachedInstance; - this->m_cachedInstance = NULL; + this->m_cachedInstance = nullptr; } } void *SingleThreadedOperation::initializeTileData(rcti *rect) @@ -49,7 +49,7 @@ void *SingleThreadedOperation::initializeTileData(rcti *rect) } lockMutex(); - if (this->m_cachedInstance == NULL) { + if (this->m_cachedInstance == nullptr) { // this->m_cachedInstance = createMemoryBuffer(rect); } diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp index 570e1eeba20..450b64eec5a 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.cpp +++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp @@ -80,7 +80,7 @@ void *WorkScheduler::thread_execute_cpu(void *data) delete work; } - return NULL; + return nullptr; } void *WorkScheduler::thread_execute_gpu(void *data) @@ -93,7 +93,7 @@ void *WorkScheduler::thread_execute_gpu(void *data) delete work; } - return NULL; + return nullptr; } #endif @@ -166,13 +166,13 @@ void WorkScheduler::stop() BLI_thread_queue_nowait(g_cpuqueue); BLI_threadpool_end(&g_cputhreads); BLI_thread_queue_free(g_cpuqueue); - g_cpuqueue = NULL; + g_cpuqueue = nullptr; # ifdef COM_OPENCL_ENABLED if (g_openclActive) { BLI_thread_queue_nowait(g_gpuqueue); BLI_threadpool_end(&g_gputhreads); BLI_thread_queue_free(g_gpuqueue); - g_gpuqueue = NULL; + g_gpuqueue = nullptr; } # endif #endif @@ -234,8 +234,8 @@ void WorkScheduler::initialize(bool use_opencl, int num_cpu_threads) # ifdef COM_OPENCL_ENABLED /* deinitialize OpenCL GPU's */ if (use_opencl && !g_openclInitialized) { - g_context = NULL; - g_program = NULL; + g_context = nullptr; + g_program = nullptr; /* This will check for errors and skip if already initialized. */ if (clewInit() != CLEW_SUCCESS) { @@ -245,7 +245,7 @@ void WorkScheduler::initialize(bool use_opencl, int num_cpu_threads) if (clCreateContextFromType) { cl_uint numberOfPlatforms = 0; cl_int error; - error = clGetPlatformIDs(0, 0, &numberOfPlatforms); + error = clGetPlatformIDs(0, nullptr, &numberOfPlatforms); if (error == -1001) { } /* GPU not supported */ else if (error != CL_SUCCESS) { @@ -256,40 +256,40 @@ void WorkScheduler::initialize(bool use_opencl, int num_cpu_threads) } cl_platform_id *platforms = (cl_platform_id *)MEM_mallocN( sizeof(cl_platform_id) * numberOfPlatforms, __func__); - error = clGetPlatformIDs(numberOfPlatforms, platforms, 0); + error = clGetPlatformIDs(numberOfPlatforms, platforms, nullptr); unsigned int indexPlatform; for (indexPlatform = 0; indexPlatform < numberOfPlatforms; indexPlatform++) { cl_platform_id platform = platforms[indexPlatform]; cl_uint numberOfDevices = 0; - clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, 0, &numberOfDevices); + clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, nullptr, &numberOfDevices); if (numberOfDevices <= 0) { continue; } cl_device_id *cldevices = (cl_device_id *)MEM_mallocN( sizeof(cl_device_id) * numberOfDevices, __func__); - clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numberOfDevices, cldevices, 0); + clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numberOfDevices, cldevices, nullptr); g_context = clCreateContext( - NULL, numberOfDevices, cldevices, clContextError, NULL, &error); + nullptr, numberOfDevices, cldevices, clContextError, nullptr, &error); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } - const char *cl_str[2] = {datatoc_COM_OpenCLKernels_cl, NULL}; - g_program = clCreateProgramWithSource(g_context, 1, cl_str, 0, &error); - error = clBuildProgram(g_program, numberOfDevices, cldevices, 0, 0, 0); + const char *cl_str[2] = {datatoc_COM_OpenCLKernels_cl, nullptr}; + g_program = clCreateProgramWithSource(g_context, 1, cl_str, nullptr, &error); + error = clBuildProgram(g_program, numberOfDevices, cldevices, nullptr, nullptr, nullptr); if (error != CL_SUCCESS) { cl_int error2; size_t ret_val_size = 0; printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); error2 = clGetProgramBuildInfo( - g_program, cldevices[0], CL_PROGRAM_BUILD_LOG, 0, NULL, &ret_val_size); + g_program, cldevices[0], CL_PROGRAM_BUILD_LOG, 0, nullptr, &ret_val_size); if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } char *build_log = (char *)MEM_mallocN(sizeof(char) * ret_val_size + 1, __func__); error2 = clGetProgramBuildInfo( - g_program, cldevices[0], CL_PROGRAM_BUILD_LOG, ret_val_size, build_log, NULL); + g_program, cldevices[0], CL_PROGRAM_BUILD_LOG, ret_val_size, build_log, nullptr); if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } @@ -303,7 +303,7 @@ void WorkScheduler::initialize(bool use_opencl, int num_cpu_threads) cl_device_id device = cldevices[indexDevices]; cl_int vendorID = 0; cl_int error2 = clGetDeviceInfo( - device, CL_DEVICE_VENDOR_ID, sizeof(cl_int), &vendorID, NULL); + device, CL_DEVICE_VENDOR_ID, sizeof(cl_int), &vendorID, nullptr); if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error2, clewErrorString(error2)); } @@ -351,11 +351,11 @@ void WorkScheduler::deinitialize() } if (g_program) { clReleaseProgram(g_program); - g_program = NULL; + g_program = nullptr; } if (g_context) { clReleaseContext(g_context); - g_context = NULL; + g_context = nullptr; } g_openclInitialized = false; diff --git a/source/blender/compositor/nodes/COM_BlurNode.cpp b/source/blender/compositor/nodes/COM_BlurNode.cpp index 808c1b22bdb..b82bede8443 100644 --- a/source/blender/compositor/nodes/COM_BlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BlurNode.cpp @@ -46,7 +46,7 @@ void BlurNode::convertToOperations(NodeConverter &converter, const bool extend_bounds = (editorNode->custom1 & CMP_NODEFLAG_BLUR_EXTEND_BOUNDS) != 0; CompositorQuality quality = context.getQuality(); - NodeOperation *input_operation = NULL, *output_operation = NULL; + NodeOperation *input_operation = nullptr, *output_operation = nullptr; if (data->filtertype == R_FILTER_FAST_GAUSS) { FastGaussianBlurOperation *operationfgb = new FastGaussianBlurOperation(); diff --git a/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp b/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp index d320a6645e1..c927865489b 100644 --- a/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp @@ -36,7 +36,7 @@ void ChannelMatteNode::convertToOperations(NodeConverter &converter, NodeOutput *outputSocketImage = this->getOutputSocket(0); NodeOutput *outputSocketMatte = this->getOutputSocket(1); - NodeOperation *convert = NULL, *inv_convert = NULL; + NodeOperation *convert = nullptr, *inv_convert = nullptr; /* colorspace */ switch (node->custom1) { case CMP_NODE_CHANNEL_MATTE_CS_RGB: @@ -67,7 +67,7 @@ void ChannelMatteNode::convertToOperations(NodeConverter &converter, SetAlphaOperation *operationAlpha = new SetAlphaOperation(); converter.addOperation(operationAlpha); - if (convert != NULL) { + if (convert != nullptr) { converter.addOperation(convert); converter.mapInputSocket(inputSocketImage, convert->getInputSocket(0)); @@ -82,7 +82,7 @@ void ChannelMatteNode::convertToOperations(NodeConverter &converter, converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket(0)); converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1)); - if (inv_convert != NULL) { + if (inv_convert != nullptr) { converter.addOperation(inv_convert); converter.addLink(operationAlpha->getOutputSocket(0), inv_convert->getInputSocket(0)); converter.mapOutputSocket(outputSocketImage, inv_convert->getOutputSocket()); diff --git a/source/blender/compositor/nodes/COM_CombineColorNode.cpp b/source/blender/compositor/nodes/COM_CombineColorNode.cpp index 2f9b14db6af..12968f06a10 100644 --- a/source/blender/compositor/nodes/COM_CombineColorNode.cpp +++ b/source/blender/compositor/nodes/COM_CombineColorNode.cpp @@ -67,7 +67,7 @@ void CombineColorNode::convertToOperations(NodeConverter &converter, NodeOperation *CombineRGBANode::getColorConverter(const CompositorContext & /*context*/) const { - return NULL; /* no conversion needed */ + return nullptr; /* no conversion needed */ } NodeOperation *CombineHSVANode::getColorConverter(const CompositorContext & /*context*/) const diff --git a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp index da8985de5ac..2921b44c95b 100644 --- a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp +++ b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp @@ -23,7 +23,7 @@ void ConvertAlphaNode::convertToOperations(NodeConverter &converter, const CompositorContext & /*context*/) const { - NodeOperation *operation = NULL; + NodeOperation *operation = nullptr; bNode *node = this->getbNode(); /* value hardcoded in rna_nodetree.c */ diff --git a/source/blender/compositor/nodes/COM_DefocusNode.cpp b/source/blender/compositor/nodes/COM_DefocusNode.cpp index 0f09e5bfc91..393b1f2dabb 100644 --- a/source/blender/compositor/nodes/COM_DefocusNode.cpp +++ b/source/blender/compositor/nodes/COM_DefocusNode.cpp @@ -41,7 +41,7 @@ void DefocusNode::convertToOperations(NodeConverter &converter, bNode *node = this->getbNode(); NodeDefocus *data = (NodeDefocus *)node->storage; Scene *scene = node->id ? (Scene *)node->id : context.getScene(); - Object *camob = scene ? scene->camera : NULL; + Object *camob = scene ? scene->camera : nullptr; NodeOperation *radiusOperation; if (data->no_zbuf) { diff --git a/source/blender/compositor/nodes/COM_FilterNode.cpp b/source/blender/compositor/nodes/COM_FilterNode.cpp index 8b8ff55d544..1147c11794f 100644 --- a/source/blender/compositor/nodes/COM_FilterNode.cpp +++ b/source/blender/compositor/nodes/COM_FilterNode.cpp @@ -34,7 +34,7 @@ void FilterNode::convertToOperations(NodeConverter &converter, NodeInput *inputSocket = this->getInputSocket(0); NodeInput *inputImageSocket = this->getInputSocket(1); NodeOutput *outputSocket = this->getOutputSocket(0); - ConvolutionFilterOperation *operation = NULL; + ConvolutionFilterOperation *operation = nullptr; switch (this->getbNode()->custom1) { case CMP_FILT_SOFT: diff --git a/source/blender/compositor/nodes/COM_GlareNode.cpp b/source/blender/compositor/nodes/COM_GlareNode.cpp index 1ff058ce7d4..ef088e42205 100644 --- a/source/blender/compositor/nodes/COM_GlareNode.cpp +++ b/source/blender/compositor/nodes/COM_GlareNode.cpp @@ -38,7 +38,7 @@ void GlareNode::convertToOperations(NodeConverter &converter, bNode *node = this->getbNode(); NodeGlare *glare = (NodeGlare *)node->storage; - GlareBaseOperation *glareoperation = NULL; + GlareBaseOperation *glareoperation = nullptr; switch (glare->type) { default: case 3: diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp b/source/blender/compositor/nodes/COM_ImageNode.cpp index 1662b81c265..596a448e6a0 100644 --- a/source/blender/compositor/nodes/COM_ImageNode.cpp +++ b/source/blender/compositor/nodes/COM_ImageNode.cpp @@ -44,7 +44,7 @@ NodeOperation *ImageNode::doMultilayerCheck(NodeConverter &converter, DataType datatype) const { NodeOutput *outputSocket = this->getOutputSocket(outputsocketIndex); - MultilayerBaseOperation *operation = NULL; + MultilayerBaseOperation *operation = nullptr; switch (datatype) { case COM_DT_VALUE: operation = new MultilayerValueOperation(passindex, view); @@ -84,7 +84,7 @@ void ImageNode::convertToOperations(NodeConverter &converter, /* force a load, we assume iuser index will be set OK anyway */ if (image && image->type == IMA_TYPE_MULTILAYER) { bool is_multilayer_ok = false; - ImBuf *ibuf = BKE_image_acquire_ibuf(image, imageuser, NULL); + ImBuf *ibuf = BKE_image_acquire_ibuf(image, imageuser, nullptr); if (image->rr) { RenderLayer *rl = (RenderLayer *)BLI_findlink(&image->rr->layers, imageuser->layer); if (rl) { @@ -94,7 +94,7 @@ void ImageNode::convertToOperations(NodeConverter &converter, is_multilayer_ok = true; for (index = 0; index < numberOfOutputs; index++) { - NodeOperation *operation = NULL; + NodeOperation *operation = nullptr; socket = this->getOutputSocket(index); bNodeSocket *bnodeSocket = socket->getbNodeSocket(); NodeImageLayer *storage = (NodeImageLayer *)bnodeSocket->storage; @@ -196,13 +196,13 @@ void ImageNode::convertToOperations(NodeConverter &converter, } /* In case we can't load the layer. */ - if (operation == NULL) { + if (operation == nullptr) { converter.setInvalidOutput(getOutputSocket(index)); } } } } - BKE_image_release_ibuf(image, ibuf, NULL); + BKE_image_release_ibuf(image, ibuf, nullptr); /* without this, multilayer that fail to load will crash blender T32490. */ if (is_multilayer_ok == false) { @@ -263,7 +263,7 @@ void ImageNode::convertToOperations(NodeConverter &converter, /* happens when unlinking image datablock from multilayer node */ for (int i = 3; i < numberOfOutputs; i++) { NodeOutput *output = this->getOutputSocket(i); - NodeOperation *operation = NULL; + NodeOperation *operation = nullptr; switch (output->getDataType()) { case COM_DT_VALUE: { SetValueOperation *valueoperation = new SetValueOperation(); diff --git a/source/blender/compositor/nodes/COM_KeyingNode.cpp b/source/blender/compositor/nodes/COM_KeyingNode.cpp index 53cf64c5c3f..9f0cdcbd552 100644 --- a/source/blender/compositor/nodes/COM_KeyingNode.cpp +++ b/source/blender/compositor/nodes/COM_KeyingNode.cpp @@ -228,7 +228,8 @@ void KeyingNode::convertToOperations(NodeConverter &converter, NodeOutput *outputImage = this->getOutputSocket(0); NodeOutput *outputMatte = this->getOutputSocket(1); NodeOutput *outputEdges = this->getOutputSocket(2); - NodeOperationOutput *postprocessedMatte = NULL, *postprocessedImage = NULL, *edgesMatte = NULL; + NodeOperationOutput *postprocessedMatte = nullptr, *postprocessedImage = nullptr, + *edgesMatte = nullptr; /* keying operation */ KeyingOperation *keyingOperation = new KeyingOperation(); diff --git a/source/blender/compositor/nodes/COM_MathNode.cpp b/source/blender/compositor/nodes/COM_MathNode.cpp index 227e26af2b2..0edf880400f 100644 --- a/source/blender/compositor/nodes/COM_MathNode.cpp +++ b/source/blender/compositor/nodes/COM_MathNode.cpp @@ -23,7 +23,7 @@ void MathNode::convertToOperations(NodeConverter &converter, const CompositorContext & /*context*/) const { - MathBaseOperation *operation = NULL; + MathBaseOperation *operation = nullptr; switch (this->getbNode()->custom1) { case NODE_MATH_ADD: diff --git a/source/blender/compositor/nodes/COM_MovieClipNode.cpp b/source/blender/compositor/nodes/COM_MovieClipNode.cpp index 3366a8c20d6..7cc8f2ea19c 100644 --- a/source/blender/compositor/nodes/COM_MovieClipNode.cpp +++ b/source/blender/compositor/nodes/COM_MovieClipNode.cpp @@ -49,7 +49,7 @@ void MovieClipNode::convertToOperations(NodeConverter &converter, MovieClipUser *movieClipUser = (MovieClipUser *)editorNode->storage; bool cacheFrame = !context.isRendering(); - ImBuf *ibuf = NULL; + ImBuf *ibuf = nullptr; if (movieClip) { if (cacheFrame) { ibuf = BKE_movieclip_get_ibuf(movieClip, movieClipUser); diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.cpp b/source/blender/compositor/nodes/COM_OutputFileNode.cpp index 1269e0b7f77..09528e09f1f 100644 --- a/source/blender/compositor/nodes/COM_OutputFileNode.cpp +++ b/source/blender/compositor/nodes/COM_OutputFileNode.cpp @@ -100,7 +100,7 @@ void OutputFileNode::convertToOperations(NodeConverter &converter, /* combine file path for the input */ BLI_join_dirfile(path, FILE_MAX, storage->base_path, sockdata->path); - NodeOperation *outputOperation = NULL; + NodeOperation *outputOperation = nullptr; if (is_multiview && format->views_format == R_IMF_VIEWS_MULTIVIEW) { outputOperation = new OutputOpenExrSingleLayerMultiViewOperation( diff --git a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp index d66dd3fd434..6be86c04c4d 100644 --- a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp +++ b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp @@ -58,17 +58,17 @@ void RenderLayersNode::testRenderLink(NodeConverter &converter, Scene *scene = (Scene *)this->getbNode()->id; const short layerId = this->getbNode()->custom1; RenderResult *rr = RE_AcquireResultRead(re); - if (rr == NULL) { + if (rr == nullptr) { missingRenderLink(converter); return; } ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&scene->view_layers, layerId); - if (view_layer == NULL) { + if (view_layer == nullptr) { missingRenderLink(converter); return; } RenderLayer *rl = RE_GetRenderLayer(rr, view_layer->name); - if (rl == NULL) { + if (rl == nullptr) { missingRenderLink(converter); return; } @@ -78,7 +78,7 @@ void RenderLayersNode::testRenderLink(NodeConverter &converter, NodeImageLayer *storage = (NodeImageLayer *)output->getbNodeSocket()->storage; RenderPass *rpass = (RenderPass *)BLI_findstring( &rl->passes, storage->pass_name, offsetof(RenderPass, name)); - if (rpass == NULL) { + if (rpass == nullptr) { missingSocketLink(converter, output); continue; } @@ -164,9 +164,9 @@ void RenderLayersNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { Scene *scene = (Scene *)this->getbNode()->id; - Render *re = (scene) ? RE_GetSceneRender(scene) : NULL; + Render *re = (scene) ? RE_GetSceneRender(scene) : nullptr; - if (re != NULL) { + if (re != nullptr) { testRenderLink(converter, context, re); RE_ReleaseResult(re); } diff --git a/source/blender/compositor/nodes/COM_SeparateColorNode.cpp b/source/blender/compositor/nodes/COM_SeparateColorNode.cpp index 712ba1e1f2d..203aa25c9e9 100644 --- a/source/blender/compositor/nodes/COM_SeparateColorNode.cpp +++ b/source/blender/compositor/nodes/COM_SeparateColorNode.cpp @@ -99,7 +99,7 @@ void SeparateColorNode::convertToOperations(NodeConverter &converter, NodeOperation *SeparateRGBANode::getColorConverter(const CompositorContext & /*context*/) const { - return NULL; /* no conversion needed */ + return nullptr; /* no conversion needed */ } NodeOperation *SeparateHSVANode::getColorConverter(const CompositorContext & /*context*/) const diff --git a/source/blender/compositor/nodes/COM_ZCombineNode.cpp b/source/blender/compositor/nodes/COM_ZCombineNode.cpp index df201289ca4..b61c018d029 100644 --- a/source/blender/compositor/nodes/COM_ZCombineNode.cpp +++ b/source/blender/compositor/nodes/COM_ZCombineNode.cpp @@ -32,7 +32,7 @@ void ZCombineNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { if ((context.getRenderData()->scemode & R_FULL_SAMPLE) || this->getbNode()->custom2) { - ZCombineOperation *operation = NULL; + ZCombineOperation *operation = nullptr; if (this->getbNode()->custom1) { operation = new ZCombineAlphaOperation(); } diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp index e1e58c9521a..b0d63d7b791 100644 --- a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp +++ b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp @@ -116,7 +116,7 @@ AntiAliasOperation::AntiAliasOperation() { this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); - this->m_valueReader = NULL; + this->m_valueReader = nullptr; this->setComplex(true); } @@ -179,7 +179,7 @@ void AntiAliasOperation::executePixel(float output[4], int x, int y, void *data) void AntiAliasOperation::deinitExecution() { - this->m_valueReader = NULL; + this->m_valueReader = nullptr; } bool AntiAliasOperation::determineDependingAreaOfInterest(rcti *input, diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp index 93193aef360..35b0092fa5f 100644 --- a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp @@ -28,8 +28,8 @@ BilateralBlurOperation::BilateralBlurOperation() this->addOutputSocket(COM_DT_COLOR); this->setComplex(true); - this->m_inputColorProgram = NULL; - this->m_inputDeterminatorProgram = NULL; + this->m_inputColorProgram = nullptr; + this->m_inputDeterminatorProgram = nullptr; } void BilateralBlurOperation::initExecution() @@ -94,8 +94,8 @@ void BilateralBlurOperation::executePixel(float output[4], int x, int y, void *d void BilateralBlurOperation::deinitExecution() { - this->m_inputColorProgram = NULL; - this->m_inputDeterminatorProgram = NULL; + this->m_inputColorProgram = nullptr; + this->m_inputDeterminatorProgram = nullptr; } bool BilateralBlurOperation::determineDependingAreaOfInterest(rcti *input, diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp index 0d9a1a184d6..3fe154c397e 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp @@ -29,7 +29,7 @@ BlurBaseOperation::BlurBaseOperation(DataType data_type) this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(data_type); this->setComplex(true); - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; memset(&m_data, 0, sizeof(NodeBlurData)); this->m_size = 1.0f; this->m_sizeavailable = false; @@ -154,8 +154,8 @@ float *BlurBaseOperation::make_dist_fac_inverse(float rad, int size, int falloff void BlurBaseOperation::deinitExecution() { - this->m_inputProgram = NULL; - this->m_inputSize = NULL; + this->m_inputProgram = nullptr; + this->m_inputSize = nullptr; } void BlurBaseOperation::setData(const NodeBlurData *data) diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp index 987c5946e48..f7b7816e1a1 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp @@ -34,9 +34,9 @@ BokehBlurOperation::BokehBlurOperation() this->m_size = 1.0f; this->m_sizeavailable = false; - this->m_inputProgram = NULL; - this->m_inputBokehProgram = NULL; - this->m_inputBoundingBoxReader = NULL; + this->m_inputProgram = nullptr; + this->m_inputBokehProgram = nullptr; + this->m_inputBoundingBoxReader = nullptr; this->m_extend_bounds = false; } @@ -47,7 +47,7 @@ void *BokehBlurOperation::initializeTileData(rcti * /*rect*/) if (!this->m_sizeavailable) { updateSize(); } - void *buffer = getInputOperation(0)->initializeTileData(NULL); + void *buffer = getInputOperation(0)->initializeTileData(nullptr); unlockMutex(); return buffer; } @@ -133,9 +133,9 @@ void BokehBlurOperation::executePixel(float output[4], int x, int y, void *data) void BokehBlurOperation::deinitExecution() { deinitMutex(); - this->m_inputProgram = NULL; - this->m_inputBokehProgram = NULL; - this->m_inputBoundingBoxReader = NULL; + this->m_inputProgram = nullptr; + this->m_inputBokehProgram = nullptr; + this->m_inputBoundingBoxReader = nullptr; } bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, @@ -196,7 +196,7 @@ void BokehBlurOperation::executeOpenCL(OpenCLDevice *device, list<cl_mem> *clMemToCleanUp, list<cl_kernel> * /*clKernelsToCleanUp*/) { - cl_kernel kernel = device->COM_clCreateKernel("bokehBlurKernel", NULL); + cl_kernel kernel = device->COM_clCreateKernel("bokehBlurKernel", nullptr); if (!this->m_sizeavailable) { updateSize(); } diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.cpp b/source/blender/compositor/operations/COM_BokehImageOperation.cpp index be3f637e4bb..473a43c1776 100644 --- a/source/blender/compositor/operations/COM_BokehImageOperation.cpp +++ b/source/blender/compositor/operations/COM_BokehImageOperation.cpp @@ -113,7 +113,7 @@ void BokehImageOperation::deinitExecution() if (this->m_deleteData) { if (this->m_data) { delete this->m_data; - this->m_data = NULL; + this->m_data = nullptr; } } } diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp index d7d779ed0bb..662b08bdee9 100644 --- a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp @@ -25,8 +25,8 @@ BoxMaskOperation::BoxMaskOperation() this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); - this->m_inputMask = NULL; - this->m_inputValue = NULL; + this->m_inputMask = nullptr; + this->m_inputValue = nullptr; this->m_cosine = 0.0f; this->m_sine = 0.0f; } @@ -105,6 +105,6 @@ void BoxMaskOperation::executePixelSampled(float output[4], float x, float y, Pi void BoxMaskOperation::deinitExecution() { - this->m_inputMask = NULL; - this->m_inputValue = NULL; + this->m_inputMask = nullptr; + this->m_inputValue = nullptr; } diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.cpp b/source/blender/compositor/operations/COM_BrightnessOperation.cpp index c72d227138d..3ae1b4aaef4 100644 --- a/source/blender/compositor/operations/COM_BrightnessOperation.cpp +++ b/source/blender/compositor/operations/COM_BrightnessOperation.cpp @@ -24,7 +24,7 @@ BrightnessOperation::BrightnessOperation() this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; this->m_use_premultiply = false; } @@ -85,7 +85,7 @@ void BrightnessOperation::executePixelSampled(float output[4], void BrightnessOperation::deinitExecution() { - this->m_inputProgram = NULL; - this->m_inputBrightnessProgram = NULL; - this->m_inputContrastProgram = NULL; + this->m_inputProgram = nullptr; + this->m_inputBrightnessProgram = nullptr; + this->m_inputContrastProgram = nullptr; } diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp index 115d415a8f8..9ccf9d7f1ef 100644 --- a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp +++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp @@ -26,7 +26,7 @@ CalculateMeanOperation::CalculateMeanOperation() { this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); this->addOutputSocket(COM_DT_VALUE); - this->m_imageReader = NULL; + this->m_imageReader = nullptr; this->m_iscalculated = false; this->m_setting = 1; this->setComplex(true); @@ -45,7 +45,7 @@ void CalculateMeanOperation::executePixel(float output[4], int /*x*/, int /*y*/, void CalculateMeanOperation::deinitExecution() { - this->m_imageReader = NULL; + this->m_imageReader = nullptr; NodeOperation::deinitMutex(); } @@ -77,7 +77,7 @@ void *CalculateMeanOperation::initializeTileData(rcti *rect) this->m_iscalculated = true; } unlockMutex(); - return NULL; + return nullptr; } void CalculateMeanOperation::calculateMean(MemoryBuffer *tile) diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp index 476626ffcb6..9ef77b9e5ea 100644 --- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp +++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp @@ -99,5 +99,5 @@ void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect) this->m_iscalculated = true; } unlockMutex(); - return NULL; + return nullptr; } diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp index b7ee3ad6de3..6bc9fa53c31 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp @@ -25,7 +25,7 @@ ChangeHSVOperation::ChangeHSVOperation() this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; } void ChangeHSVOperation::initExecution() @@ -38,10 +38,10 @@ void ChangeHSVOperation::initExecution() void ChangeHSVOperation::deinitExecution() { - this->m_inputOperation = NULL; - this->m_hueOperation = NULL; - this->m_saturationOperation = NULL; - this->m_valueOperation = NULL; + this->m_inputOperation = nullptr; + this->m_hueOperation = nullptr; + this->m_saturationOperation = nullptr; + this->m_valueOperation = nullptr; } void ChangeHSVOperation::executePixelSampled(float output[4], diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp index 8dcee8c6070..956a2cc86ee 100644 --- a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp @@ -24,7 +24,7 @@ ChannelMatteOperation::ChannelMatteOperation() addInputSocket(COM_DT_COLOR); addOutputSocket(COM_DT_VALUE); - this->m_inputImageProgram = NULL; + this->m_inputImageProgram = nullptr; } void ChannelMatteOperation::initExecution() @@ -77,7 +77,7 @@ void ChannelMatteOperation::initExecution() void ChannelMatteOperation::deinitExecution() { - this->m_inputImageProgram = NULL; + this->m_inputImageProgram = nullptr; } void ChannelMatteOperation::executePixelSampled(float output[4], diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp index c55f434801d..389aeaf6fed 100644 --- a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp @@ -25,8 +25,8 @@ ChromaMatteOperation::ChromaMatteOperation() addInputSocket(COM_DT_COLOR); addOutputSocket(COM_DT_VALUE); - this->m_inputImageProgram = NULL; - this->m_inputKeyProgram = NULL; + this->m_inputImageProgram = nullptr; + this->m_inputKeyProgram = nullptr; } void ChromaMatteOperation::initExecution() @@ -37,8 +37,8 @@ void ChromaMatteOperation::initExecution() void ChromaMatteOperation::deinitExecution() { - this->m_inputImageProgram = NULL; - this->m_inputKeyProgram = NULL; + this->m_inputImageProgram = nullptr; + this->m_inputKeyProgram = nullptr; } void ChromaMatteOperation::executePixelSampled(float output[4], diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp index 91418c47665..f9eaaf6f7a0 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp @@ -36,8 +36,8 @@ ColorBalanceASCCDLOperation::ColorBalanceASCCDLOperation() this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); - this->m_inputValueOperation = NULL; - this->m_inputColorOperation = NULL; + this->m_inputValueOperation = nullptr; + this->m_inputColorOperation = nullptr; this->setResolutionInputSocketIndex(1); } @@ -76,6 +76,6 @@ void ColorBalanceASCCDLOperation::executePixelSampled(float output[4], void ColorBalanceASCCDLOperation::deinitExecution() { - this->m_inputValueOperation = NULL; - this->m_inputColorOperation = NULL; + this->m_inputValueOperation = nullptr; + this->m_inputColorOperation = nullptr; } diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp index 849540db1fc..df44e87a86a 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp @@ -41,8 +41,8 @@ ColorBalanceLGGOperation::ColorBalanceLGGOperation() this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); - this->m_inputValueOperation = NULL; - this->m_inputColorOperation = NULL; + this->m_inputValueOperation = nullptr; + this->m_inputColorOperation = nullptr; this->setResolutionInputSocketIndex(1); } @@ -81,6 +81,6 @@ void ColorBalanceLGGOperation::executePixelSampled(float output[4], void ColorBalanceLGGOperation::deinitExecution() { - this->m_inputValueOperation = NULL; - this->m_inputColorOperation = NULL; + this->m_inputValueOperation = nullptr; + this->m_inputColorOperation = nullptr; } diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp index d99444344bd..60343c28662 100644 --- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp @@ -26,8 +26,8 @@ ColorCorrectionOperation::ColorCorrectionOperation() this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); - this->m_inputImage = NULL; - this->m_inputMask = NULL; + this->m_inputImage = nullptr; + this->m_inputMask = nullptr; this->m_redChannelEnabled = true; this->m_greenChannelEnabled = true; this->m_blueChannelEnabled = true; @@ -157,6 +157,6 @@ void ColorCorrectionOperation::executePixelSampled(float output[4], void ColorCorrectionOperation::deinitExecution() { - this->m_inputImage = NULL; - this->m_inputMask = NULL; + this->m_inputImage = nullptr; + this->m_inputMask = nullptr; } diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp index 8bdaa8ec28b..ed107a88953 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp @@ -30,10 +30,10 @@ ColorCurveOperation::ColorCurveOperation() this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); - this->m_inputFacProgram = NULL; - this->m_inputImageProgram = NULL; - this->m_inputBlackProgram = NULL; - this->m_inputWhiteProgram = NULL; + this->m_inputFacProgram = nullptr; + this->m_inputImageProgram = nullptr; + this->m_inputBlackProgram = nullptr; + this->m_inputWhiteProgram = nullptr; this->setResolutionInputSocketIndex(1); } @@ -90,10 +90,10 @@ void ColorCurveOperation::executePixelSampled(float output[4], void ColorCurveOperation::deinitExecution() { CurveBaseOperation::deinitExecution(); - this->m_inputFacProgram = NULL; - this->m_inputImageProgram = NULL; - this->m_inputBlackProgram = NULL; - this->m_inputWhiteProgram = NULL; + this->m_inputFacProgram = nullptr; + this->m_inputImageProgram = nullptr; + this->m_inputBlackProgram = nullptr; + this->m_inputWhiteProgram = nullptr; } // Constant level curve mapping @@ -104,8 +104,8 @@ ConstantLevelColorCurveOperation::ConstantLevelColorCurveOperation() this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); - this->m_inputFacProgram = NULL; - this->m_inputImageProgram = NULL; + this->m_inputFacProgram = nullptr; + this->m_inputImageProgram = nullptr; this->setResolutionInputSocketIndex(1); } @@ -148,6 +148,6 @@ void ConstantLevelColorCurveOperation::executePixelSampled(float output[4], void ConstantLevelColorCurveOperation::deinitExecution() { CurveBaseOperation::deinitExecution(); - this->m_inputFacProgram = NULL; - this->m_inputImageProgram = NULL; + this->m_inputFacProgram = nullptr; + this->m_inputImageProgram = nullptr; } diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp index e3aa3aef5a4..b8749bec4b8 100644 --- a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp @@ -25,8 +25,8 @@ ColorMatteOperation::ColorMatteOperation() addInputSocket(COM_DT_COLOR); addOutputSocket(COM_DT_VALUE); - this->m_inputImageProgram = NULL; - this->m_inputKeyProgram = NULL; + this->m_inputImageProgram = nullptr; + this->m_inputKeyProgram = nullptr; } void ColorMatteOperation::initExecution() @@ -37,8 +37,8 @@ void ColorMatteOperation::initExecution() void ColorMatteOperation::deinitExecution() { - this->m_inputImageProgram = NULL; - this->m_inputKeyProgram = NULL; + this->m_inputImageProgram = nullptr; + this->m_inputKeyProgram = nullptr; } void ColorMatteOperation::executePixelSampled(float output[4], diff --git a/source/blender/compositor/operations/COM_ColorRampOperation.cpp b/source/blender/compositor/operations/COM_ColorRampOperation.cpp index e7f5ca1af5e..4d62a293b78 100644 --- a/source/blender/compositor/operations/COM_ColorRampOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorRampOperation.cpp @@ -25,8 +25,8 @@ ColorRampOperation::ColorRampOperation() this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); - this->m_inputProgram = NULL; - this->m_colorBand = NULL; + this->m_inputProgram = nullptr; + this->m_colorBand = nullptr; } void ColorRampOperation::initExecution() { @@ -46,5 +46,5 @@ void ColorRampOperation::executePixelSampled(float output[4], void ColorRampOperation::deinitExecution() { - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; } diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp index 4356eb4b745..050792d8dab 100644 --- a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp @@ -26,8 +26,8 @@ ColorSpillOperation::ColorSpillOperation() addInputSocket(COM_DT_VALUE); addOutputSocket(COM_DT_COLOR); - this->m_inputImageReader = NULL; - this->m_inputFacReader = NULL; + this->m_inputImageReader = nullptr; + this->m_inputFacReader = nullptr; this->m_spillChannel = 1; // GREEN this->m_spillMethod = 0; } @@ -77,8 +77,8 @@ void ColorSpillOperation::initExecution() void ColorSpillOperation::deinitExecution() { - this->m_inputImageReader = NULL; - this->m_inputFacReader = NULL; + this->m_inputImageReader = nullptr; + this->m_inputFacReader = nullptr; } void ColorSpillOperation::executePixelSampled(float output[4], diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp index 63e7817606f..3ec54b1c04d 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cpp +++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp @@ -38,19 +38,19 @@ CompositorOperation::CompositorOperation() this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); - this->setRenderData(NULL); - this->m_outputBuffer = NULL; - this->m_depthBuffer = NULL; - this->m_imageInput = NULL; - this->m_alphaInput = NULL; - this->m_depthInput = NULL; + this->setRenderData(nullptr); + this->m_outputBuffer = nullptr; + this->m_depthBuffer = nullptr; + this->m_imageInput = nullptr; + this->m_alphaInput = nullptr; + this->m_depthInput = nullptr; this->m_useAlphaInput = false; this->m_active = false; - this->m_scene = NULL; + this->m_scene = nullptr; this->m_sceneName[0] = '\0'; - this->m_viewName = NULL; + this->m_viewName = nullptr; } void CompositorOperation::initExecution() @@ -67,7 +67,7 @@ void CompositorOperation::initExecution() this->m_outputBuffer = (float *)MEM_callocN( sizeof(float[4]) * this->getWidth() * this->getHeight(), "CompositorOperation"); } - if (this->m_depthInput != NULL) { + if (this->m_depthInput != nullptr) { this->m_depthBuffer = (float *)MEM_callocN( sizeof(float) * this->getWidth() * this->getHeight(), "CompositorOperation"); } @@ -86,11 +86,11 @@ void CompositorOperation::deinitExecution() if (rr) { RenderView *rv = RE_RenderViewGetByName(rr, this->m_viewName); - if (rv->rectf != NULL) { + if (rv->rectf != nullptr) { MEM_freeN(rv->rectf); } rv->rectf = this->m_outputBuffer; - if (rv->rectz != NULL) { + if (rv->rectz != nullptr) { MEM_freeN(rv->rectz); } rv->rectz = this->m_depthBuffer; @@ -107,13 +107,13 @@ void CompositorOperation::deinitExecution() if (re) { RE_ReleaseResult(re); - re = NULL; + re = nullptr; } BLI_thread_lock(LOCK_DRAW_IMAGE); BKE_image_signal(G.main, BKE_image_ensure_viewer(G.main, IMA_TYPE_R_RESULT, "Render Result"), - NULL, + nullptr, IMA_SIGNAL_FREE); BLI_thread_unlock(LOCK_DRAW_IMAGE); } @@ -126,11 +126,11 @@ void CompositorOperation::deinitExecution() } } - this->m_outputBuffer = NULL; - this->m_depthBuffer = NULL; - this->m_imageInput = NULL; - this->m_alphaInput = NULL; - this->m_depthInput = NULL; + this->m_outputBuffer = nullptr; + this->m_depthBuffer = nullptr; + this->m_imageInput = nullptr; + this->m_alphaInput = nullptr; + this->m_depthInput = nullptr; } void CompositorOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) diff --git a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp index 39143aaf3b8..44468e04ae9 100644 --- a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cpp @@ -24,7 +24,7 @@ ConvertColorProfileOperation::ConvertColorProfileOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; this->m_predivided = false; } @@ -46,5 +46,5 @@ void ConvertColorProfileOperation::executePixelSampled(float output[4], void ConvertColorProfileOperation::deinitExecution() { - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; } diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp index 56c4fb44d4f..fe395ecae9e 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp @@ -25,11 +25,11 @@ ConvertDepthToRadiusOperation::ConvertDepthToRadiusOperation() { this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; this->m_fStop = 128.0f; - this->m_cameraObject = NULL; + this->m_cameraObject = nullptr; this->m_maxRadius = 32.0f; - this->m_blurPostOperation = NULL; + this->m_blurPostOperation = nullptr; } float ConvertDepthToRadiusOperation::determineFocalDistance() @@ -46,7 +46,7 @@ float ConvertDepthToRadiusOperation::determineFocalDistance() void ConvertDepthToRadiusOperation::initExecution() { float cam_sensor = DEFAULT_SENSOR_WIDTH; - Camera *camera = NULL; + Camera *camera = nullptr; if (this->m_cameraObject && this->m_cameraObject->type == OB_CAMERA) { camera = (Camera *)this->m_cameraObject->data; @@ -111,5 +111,5 @@ void ConvertDepthToRadiusOperation::executePixelSampled(float output[4], void ConvertDepthToRadiusOperation::deinitExecution() { - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; } diff --git a/source/blender/compositor/operations/COM_ConvertOperation.cpp b/source/blender/compositor/operations/COM_ConvertOperation.cpp index dae4a9f1bab..cccfd407752 100644 --- a/source/blender/compositor/operations/COM_ConvertOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertOperation.cpp @@ -22,7 +22,7 @@ ConvertBaseOperation::ConvertBaseOperation() { - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; } void ConvertBaseOperation::initExecution() @@ -32,7 +32,7 @@ void ConvertBaseOperation::initExecution() void ConvertBaseOperation::deinitExecution() { - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; } /* ******** Value to Color ******** */ @@ -401,7 +401,7 @@ SeparateChannelOperation::SeparateChannelOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_VALUE); - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; } void SeparateChannelOperation::initExecution() { @@ -410,7 +410,7 @@ void SeparateChannelOperation::initExecution() void SeparateChannelOperation::deinitExecution() { - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; } void SeparateChannelOperation::executePixelSampled(float output[4], @@ -433,10 +433,10 @@ CombineChannelsOperation::CombineChannelsOperation() this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); this->setResolutionInputSocketIndex(0); - this->m_inputChannel1Operation = NULL; - this->m_inputChannel2Operation = NULL; - this->m_inputChannel3Operation = NULL; - this->m_inputChannel4Operation = NULL; + this->m_inputChannel1Operation = nullptr; + this->m_inputChannel2Operation = nullptr; + this->m_inputChannel3Operation = nullptr; + this->m_inputChannel4Operation = nullptr; } void CombineChannelsOperation::initExecution() @@ -449,10 +449,10 @@ void CombineChannelsOperation::initExecution() void CombineChannelsOperation::deinitExecution() { - this->m_inputChannel1Operation = NULL; - this->m_inputChannel2Operation = NULL; - this->m_inputChannel3Operation = NULL; - this->m_inputChannel4Operation = NULL; + this->m_inputChannel1Operation = nullptr; + this->m_inputChannel2Operation = nullptr; + this->m_inputChannel3Operation = nullptr; + this->m_inputChannel4Operation = nullptr; } void CombineChannelsOperation::executePixelSampled(float output[4], diff --git a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp index 1932098fd30..1c2570cd251 100644 --- a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp @@ -42,42 +42,42 @@ void ConvolutionEdgeFilterOperation::executePixel(float output[4], int x, int y, CLAMP(y3, 0, getHeight() - 1); float value[4]; - this->m_inputValueOperation->read(value, x2, y2, NULL); + this->m_inputValueOperation->read(value, x2, y2, nullptr); float mval = 1.0f - value[0]; - this->m_inputOperation->read(in1, x1, y1, NULL); + this->m_inputOperation->read(in1, x1, y1, nullptr); madd_v3_v3fl(res1, in1, this->m_filter[0]); madd_v3_v3fl(res2, in1, this->m_filter[0]); - this->m_inputOperation->read(in1, x2, y1, NULL); + this->m_inputOperation->read(in1, x2, y1, nullptr); madd_v3_v3fl(res1, in1, this->m_filter[1]); madd_v3_v3fl(res2, in1, this->m_filter[3]); - this->m_inputOperation->read(in1, x3, y1, NULL); + this->m_inputOperation->read(in1, x3, y1, nullptr); madd_v3_v3fl(res1, in1, this->m_filter[2]); madd_v3_v3fl(res2, in1, this->m_filter[6]); - this->m_inputOperation->read(in1, x1, y2, NULL); + this->m_inputOperation->read(in1, x1, y2, nullptr); madd_v3_v3fl(res1, in1, this->m_filter[3]); madd_v3_v3fl(res2, in1, this->m_filter[1]); - this->m_inputOperation->read(in2, x2, y2, NULL); + this->m_inputOperation->read(in2, x2, y2, nullptr); madd_v3_v3fl(res1, in2, this->m_filter[4]); madd_v3_v3fl(res2, in2, this->m_filter[4]); - this->m_inputOperation->read(in1, x3, y2, NULL); + this->m_inputOperation->read(in1, x3, y2, nullptr); madd_v3_v3fl(res1, in1, this->m_filter[5]); madd_v3_v3fl(res2, in1, this->m_filter[7]); - this->m_inputOperation->read(in1, x1, y3, NULL); + this->m_inputOperation->read(in1, x1, y3, nullptr); madd_v3_v3fl(res1, in1, this->m_filter[6]); madd_v3_v3fl(res2, in1, this->m_filter[2]); - this->m_inputOperation->read(in1, x2, y3, NULL); + this->m_inputOperation->read(in1, x2, y3, nullptr); madd_v3_v3fl(res1, in1, this->m_filter[7]); madd_v3_v3fl(res2, in1, this->m_filter[5]); - this->m_inputOperation->read(in1, x3, y3, NULL); + this->m_inputOperation->read(in1, x3, y3, nullptr); madd_v3_v3fl(res1, in1, this->m_filter[8]); madd_v3_v3fl(res2, in1, this->m_filter[8]); diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp index fabde28d7a2..7e35f6fb4f6 100644 --- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp @@ -28,7 +28,7 @@ ConvolutionFilterOperation::ConvolutionFilterOperation() this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); this->setResolutionInputSocketIndex(0); - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; this->setComplex(true); } void ConvolutionFilterOperation::initExecution() @@ -55,8 +55,8 @@ void ConvolutionFilterOperation::set3x3Filter( void ConvolutionFilterOperation::deinitExecution() { - this->m_inputOperation = NULL; - this->m_inputValueOperation = NULL; + this->m_inputOperation = nullptr; + this->m_inputValueOperation = nullptr; } void ConvolutionFilterOperation::executePixel(float output[4], int x, int y, void * /*data*/) @@ -76,27 +76,27 @@ void ConvolutionFilterOperation::executePixel(float output[4], int x, int y, voi CLAMP(y2, 0, getHeight() - 1); CLAMP(y3, 0, getHeight() - 1); float value[4]; - this->m_inputValueOperation->read(value, x2, y2, NULL); + this->m_inputValueOperation->read(value, x2, y2, nullptr); const float mval = 1.0f - value[0]; zero_v4(output); - this->m_inputOperation->read(in1, x1, y1, NULL); + this->m_inputOperation->read(in1, x1, y1, nullptr); madd_v4_v4fl(output, in1, this->m_filter[0]); - this->m_inputOperation->read(in1, x2, y1, NULL); + this->m_inputOperation->read(in1, x2, y1, nullptr); madd_v4_v4fl(output, in1, this->m_filter[1]); - this->m_inputOperation->read(in1, x3, y1, NULL); + this->m_inputOperation->read(in1, x3, y1, nullptr); madd_v4_v4fl(output, in1, this->m_filter[2]); - this->m_inputOperation->read(in1, x1, y2, NULL); + this->m_inputOperation->read(in1, x1, y2, nullptr); madd_v4_v4fl(output, in1, this->m_filter[3]); - this->m_inputOperation->read(in2, x2, y2, NULL); + this->m_inputOperation->read(in2, x2, y2, nullptr); madd_v4_v4fl(output, in2, this->m_filter[4]); - this->m_inputOperation->read(in1, x3, y2, NULL); + this->m_inputOperation->read(in1, x3, y2, nullptr); madd_v4_v4fl(output, in1, this->m_filter[5]); - this->m_inputOperation->read(in1, x1, y3, NULL); + this->m_inputOperation->read(in1, x1, y3, nullptr); madd_v4_v4fl(output, in1, this->m_filter[6]); - this->m_inputOperation->read(in1, x2, y3, NULL); + this->m_inputOperation->read(in1, x2, y3, nullptr); madd_v4_v4fl(output, in1, this->m_filter[7]); - this->m_inputOperation->read(in1, x3, y3, NULL); + this->m_inputOperation->read(in1, x3, y3, nullptr); madd_v4_v4fl(output, in1, this->m_filter[8]); output[0] = output[0] * value[0] + in2[0] * mval; diff --git a/source/blender/compositor/operations/COM_CropOperation.cpp b/source/blender/compositor/operations/COM_CropOperation.cpp index 3dda1a94989..408f588871e 100644 --- a/source/blender/compositor/operations/COM_CropOperation.cpp +++ b/source/blender/compositor/operations/COM_CropOperation.cpp @@ -23,8 +23,8 @@ CropBaseOperation::CropBaseOperation() { this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); this->addOutputSocket(COM_DT_COLOR); - this->m_inputOperation = NULL; - this->m_settings = NULL; + this->m_inputOperation = nullptr; + this->m_settings = nullptr; } void CropBaseOperation::updateArea() @@ -75,7 +75,7 @@ void CropBaseOperation::initExecution() void CropBaseOperation::deinitExecution() { - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; } CropOperation::CropOperation() : CropBaseOperation() diff --git a/source/blender/compositor/operations/COM_CurveBaseOperation.cpp b/source/blender/compositor/operations/COM_CurveBaseOperation.cpp index 5cfea97475a..b58efcf0cca 100644 --- a/source/blender/compositor/operations/COM_CurveBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_CurveBaseOperation.cpp @@ -22,14 +22,14 @@ CurveBaseOperation::CurveBaseOperation() { - this->m_curveMapping = NULL; + this->m_curveMapping = nullptr; } CurveBaseOperation::~CurveBaseOperation() { if (this->m_curveMapping) { BKE_curvemapping_free(this->m_curveMapping); - this->m_curveMapping = NULL; + this->m_curveMapping = nullptr; } } @@ -41,7 +41,7 @@ void CurveBaseOperation::deinitExecution() { if (this->m_curveMapping) { BKE_curvemapping_free(this->m_curveMapping); - this->m_curveMapping = NULL; + this->m_curveMapping = nullptr; } } diff --git a/source/blender/compositor/operations/COM_DenoiseOperation.cpp b/source/blender/compositor/operations/COM_DenoiseOperation.cpp index 97e2dba5e18..bc33e5f75c4 100644 --- a/source/blender/compositor/operations/COM_DenoiseOperation.cpp +++ b/source/blender/compositor/operations/COM_DenoiseOperation.cpp @@ -32,7 +32,7 @@ DenoiseOperation::DenoiseOperation() this->addInputSocket(COM_DT_VECTOR); this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); - this->m_settings = NULL; + this->m_settings = nullptr; } void DenoiseOperation::initExecution() { @@ -44,9 +44,9 @@ void DenoiseOperation::initExecution() void DenoiseOperation::deinitExecution() { - this->m_inputProgramColor = NULL; - this->m_inputProgramNormal = NULL; - this->m_inputProgramAlbedo = NULL; + this->m_inputProgramColor = nullptr; + this->m_inputProgramNormal = nullptr; + this->m_inputProgramAlbedo = nullptr; SingleThreadedOperation::deinitExecution(); } diff --git a/source/blender/compositor/operations/COM_DespeckleOperation.cpp b/source/blender/compositor/operations/COM_DespeckleOperation.cpp index 5d8481562ab..901445c6875 100644 --- a/source/blender/compositor/operations/COM_DespeckleOperation.cpp +++ b/source/blender/compositor/operations/COM_DespeckleOperation.cpp @@ -28,7 +28,7 @@ DespeckleOperation::DespeckleOperation() this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); this->setResolutionInputSocketIndex(0); - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; this->setComplex(true); } void DespeckleOperation::initExecution() @@ -39,8 +39,8 @@ void DespeckleOperation::initExecution() void DespeckleOperation::deinitExecution() { - this->m_inputOperation = NULL; - this->m_inputValueOperation = NULL; + this->m_inputOperation = nullptr; + this->m_inputValueOperation = nullptr; } BLI_INLINE int color_diff(const float a[3], const float b[3], const float threshold) @@ -69,10 +69,10 @@ void DespeckleOperation::executePixel(float output[4], int x, int y, void * /*da CLAMP(y2, 0, getHeight() - 1); CLAMP(y3, 0, getHeight() - 1); float value[4]; - this->m_inputValueOperation->read(value, x2, y2, NULL); + this->m_inputValueOperation->read(value, x2, y2, nullptr); // const float mval = 1.0f - value[0]; - this->m_inputOperation->read(color_org, x2, y2, NULL); + this->m_inputOperation->read(color_org, x2, y2, nullptr); #define TOT_DIV_ONE 1.0f #define TOT_DIV_CNR (float)M_SQRT1_2 @@ -91,13 +91,13 @@ void DespeckleOperation::executePixel(float output[4], int x, int y, void * /*da zero_v4(color_mid); zero_v4(color_mid_ok); - this->m_inputOperation->read(in1, x1, y1, NULL); + this->m_inputOperation->read(in1, x1, y1, nullptr); COLOR_ADD(TOT_DIV_CNR) - this->m_inputOperation->read(in1, x2, y1, NULL); + this->m_inputOperation->read(in1, x2, y1, nullptr); COLOR_ADD(TOT_DIV_ONE) - this->m_inputOperation->read(in1, x3, y1, NULL); + this->m_inputOperation->read(in1, x3, y1, nullptr); COLOR_ADD(TOT_DIV_CNR) - this->m_inputOperation->read(in1, x1, y2, NULL); + this->m_inputOperation->read(in1, x1, y2, nullptr); COLOR_ADD(TOT_DIV_ONE) #if 0 @@ -105,13 +105,13 @@ void DespeckleOperation::executePixel(float output[4], int x, int y, void * /*da madd_v4_v4fl(color_mid, in2, this->m_filter[4]); #endif - this->m_inputOperation->read(in1, x3, y2, NULL); + this->m_inputOperation->read(in1, x3, y2, nullptr); COLOR_ADD(TOT_DIV_ONE) - this->m_inputOperation->read(in1, x1, y3, NULL); + this->m_inputOperation->read(in1, x1, y3, nullptr); COLOR_ADD(TOT_DIV_CNR) - this->m_inputOperation->read(in1, x2, y3, NULL); + this->m_inputOperation->read(in1, x2, y3, nullptr); COLOR_ADD(TOT_DIV_ONE) - this->m_inputOperation->read(in1, x3, y3, NULL); + this->m_inputOperation->read(in1, x3, y3, nullptr); COLOR_ADD(TOT_DIV_CNR) mul_v4_fl(color_mid, 1.0f / (4.0f + (4.0f * (float)M_SQRT1_2))); diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp index 92a804ec3ec..cca99a42c0c 100644 --- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp @@ -25,8 +25,8 @@ DifferenceMatteOperation::DifferenceMatteOperation() addInputSocket(COM_DT_COLOR); addOutputSocket(COM_DT_VALUE); - this->m_inputImage1Program = NULL; - this->m_inputImage2Program = NULL; + this->m_inputImage1Program = nullptr; + this->m_inputImage2Program = nullptr; } void DifferenceMatteOperation::initExecution() @@ -36,8 +36,8 @@ void DifferenceMatteOperation::initExecution() } void DifferenceMatteOperation::deinitExecution() { - this->m_inputImage1Program = NULL; - this->m_inputImage2Program = NULL; + this->m_inputImage1Program = nullptr; + this->m_inputImage2Program = nullptr; } void DifferenceMatteOperation::executePixelSampled(float output[4], diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp index 0fbdb37081b..74f5fceacfb 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp @@ -28,7 +28,7 @@ DilateErodeThresholdOperation::DilateErodeThresholdOperation() this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); this->setComplex(true); - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; this->m_inset = 0.0f; this->m__switch = 0.5f; this->m_distance = 0.0f; @@ -54,7 +54,7 @@ void DilateErodeThresholdOperation::initExecution() void *DilateErodeThresholdOperation::initializeTileData(rcti * /*rect*/) { - void *buffer = this->m_inputProgram->initializeTileData(NULL); + void *buffer = this->m_inputProgram->initializeTileData(nullptr); return buffer; } @@ -142,7 +142,7 @@ void DilateErodeThresholdOperation::executePixel(float output[4], int x, int y, void DilateErodeThresholdOperation::deinitExecution() { - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; } bool DilateErodeThresholdOperation::determineDependingAreaOfInterest( @@ -164,7 +164,7 @@ DilateDistanceOperation::DilateDistanceOperation() this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); this->setComplex(true); - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; this->m_distance = 0.0f; this->setOpenCL(true); } @@ -179,7 +179,7 @@ void DilateDistanceOperation::initExecution() void *DilateDistanceOperation::initializeTileData(rcti * /*rect*/) { - void *buffer = this->m_inputProgram->initializeTileData(NULL); + void *buffer = this->m_inputProgram->initializeTileData(nullptr); return buffer; } @@ -217,7 +217,7 @@ void DilateDistanceOperation::executePixel(float output[4], int x, int y, void * void DilateDistanceOperation::deinitExecution() { - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; } bool DilateDistanceOperation::determineDependingAreaOfInterest(rcti *input, @@ -241,7 +241,7 @@ void DilateDistanceOperation::executeOpenCL(OpenCLDevice *device, list<cl_mem> *clMemToCleanUp, list<cl_kernel> * /*clKernelsToCleanUp*/) { - cl_kernel dilateKernel = device->COM_clCreateKernel("dilateKernel", NULL); + cl_kernel dilateKernel = device->COM_clCreateKernel("dilateKernel", nullptr); cl_int distanceSquared = this->m_distance * this->m_distance; cl_int scope = this->m_scope; @@ -301,7 +301,7 @@ void ErodeDistanceOperation::executeOpenCL(OpenCLDevice *device, list<cl_mem> *clMemToCleanUp, list<cl_kernel> * /*clKernelsToCleanUp*/) { - cl_kernel erodeKernel = device->COM_clCreateKernel("erodeKernel", NULL); + cl_kernel erodeKernel = device->COM_clCreateKernel("erodeKernel", nullptr); cl_int distanceSquared = this->m_distance * this->m_distance; cl_int scope = this->m_scope; @@ -322,7 +322,7 @@ DilateStepOperation::DilateStepOperation() this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); this->setComplex(true); - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; } void DilateStepOperation::initExecution() { @@ -351,7 +351,7 @@ static tile_info *create_cache(int xmin, int xmax, int ymin, int ymax) void *DilateStepOperation::initializeTileData(rcti *rect) { - MemoryBuffer *tile = (MemoryBuffer *)this->m_inputProgram->initializeTileData(NULL); + MemoryBuffer *tile = (MemoryBuffer *)this->m_inputProgram->initializeTileData(nullptr); int x, y, i; int width = tile->getWidth(); int height = tile->getHeight(); @@ -448,7 +448,7 @@ void DilateStepOperation::executePixel(float output[4], int x, int y, void *data void DilateStepOperation::deinitExecution() { - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; } void DilateStepOperation::deinitializeTileData(rcti * /*rect*/, void *data) @@ -480,7 +480,7 @@ ErodeStepOperation::ErodeStepOperation() : DilateStepOperation() void *ErodeStepOperation::initializeTileData(rcti *rect) { - MemoryBuffer *tile = (MemoryBuffer *)this->m_inputProgram->initializeTileData(NULL); + MemoryBuffer *tile = (MemoryBuffer *)this->m_inputProgram->initializeTileData(nullptr); int x, y, i; int width = tile->getWidth(); int height = tile->getHeight(); diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp index efe40cc8b58..c0b9c9b6f1d 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp @@ -30,7 +30,7 @@ DirectionalBlurOperation::DirectionalBlurOperation() this->setComplex(true); this->setOpenCL(true); - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; } void DirectionalBlurOperation::initExecution() @@ -103,7 +103,7 @@ void DirectionalBlurOperation::executeOpenCL(OpenCLDevice *device, list<cl_mem> *clMemToCleanUp, list<cl_kernel> * /*clKernelsToCleanUp*/) { - cl_kernel directionalBlurKernel = device->COM_clCreateKernel("directionalBlurKernel", NULL); + cl_kernel directionalBlurKernel = device->COM_clCreateKernel("directionalBlurKernel", nullptr); cl_int iterations = pow(2.0f, this->m_data->iter); cl_float2 ltxy = {{this->m_tx, this->m_ty}}; @@ -128,7 +128,7 @@ void DirectionalBlurOperation::executeOpenCL(OpenCLDevice *device, void DirectionalBlurOperation::deinitExecution() { - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; } bool DirectionalBlurOperation::determineDependingAreaOfInterest(rcti * /*input*/, diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.cpp b/source/blender/compositor/operations/COM_DisplaceOperation.cpp index 31b4d41320f..fcc8bc4670e 100644 --- a/source/blender/compositor/operations/COM_DisplaceOperation.cpp +++ b/source/blender/compositor/operations/COM_DisplaceOperation.cpp @@ -29,10 +29,10 @@ DisplaceOperation::DisplaceOperation() this->addOutputSocket(COM_DT_COLOR); this->setComplex(true); - this->m_inputColorProgram = NULL; - this->m_inputVectorProgram = NULL; - this->m_inputScaleXProgram = NULL; - this->m_inputScaleYProgram = NULL; + this->m_inputColorProgram = nullptr; + this->m_inputVectorProgram = nullptr; + this->m_inputScaleXProgram = nullptr; + this->m_inputScaleYProgram = nullptr; } void DisplaceOperation::initExecution() @@ -143,10 +143,10 @@ void DisplaceOperation::pixelTransform(const float xy[2], float r_uv[2], float r void DisplaceOperation::deinitExecution() { - this->m_inputColorProgram = NULL; - this->m_inputVectorProgram = NULL; - this->m_inputScaleXProgram = NULL; - this->m_inputScaleYProgram = NULL; + this->m_inputColorProgram = nullptr; + this->m_inputVectorProgram = nullptr; + this->m_inputScaleXProgram = nullptr; + this->m_inputScaleYProgram = nullptr; } bool DisplaceOperation::determineDependingAreaOfInterest(rcti *input, @@ -155,7 +155,7 @@ bool DisplaceOperation::determineDependingAreaOfInterest(rcti *input, { rcti colorInput; rcti vectorInput; - NodeOperation *operation = NULL; + NodeOperation *operation = nullptr; /* the vector buffer only needs a 2x2 buffer. The image needs whole buffer */ /* image */ diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp index 10d274b6fc5..bbc4d63305b 100644 --- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp +++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp @@ -28,10 +28,10 @@ DisplaceSimpleOperation::DisplaceSimpleOperation() this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); - this->m_inputColorProgram = NULL; - this->m_inputVectorProgram = NULL; - this->m_inputScaleXProgram = NULL; - this->m_inputScaleYProgram = NULL; + this->m_inputColorProgram = nullptr; + this->m_inputVectorProgram = nullptr; + this->m_inputScaleXProgram = nullptr; + this->m_inputScaleYProgram = nullptr; } void DisplaceSimpleOperation::initExecution() @@ -86,10 +86,10 @@ void DisplaceSimpleOperation::executePixelSampled(float output[4], void DisplaceSimpleOperation::deinitExecution() { - this->m_inputColorProgram = NULL; - this->m_inputVectorProgram = NULL; - this->m_inputScaleXProgram = NULL; - this->m_inputScaleYProgram = NULL; + this->m_inputColorProgram = nullptr; + this->m_inputVectorProgram = nullptr; + this->m_inputScaleXProgram = nullptr; + this->m_inputScaleYProgram = nullptr; } bool DisplaceSimpleOperation::determineDependingAreaOfInterest(rcti *input, @@ -97,7 +97,7 @@ bool DisplaceSimpleOperation::determineDependingAreaOfInterest(rcti *input, rcti *output) { rcti colorInput; - NodeOperation *operation = NULL; + NodeOperation *operation = nullptr; /* the vector buffer only needs a 2x2 buffer. The image needs whole buffer */ /* image */ diff --git a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp index 23e133ad711..7d79dcc657d 100644 --- a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp @@ -25,8 +25,8 @@ DistanceRGBMatteOperation::DistanceRGBMatteOperation() this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_VALUE); - this->m_inputImageProgram = NULL; - this->m_inputKeyProgram = NULL; + this->m_inputImageProgram = nullptr; + this->m_inputKeyProgram = nullptr; } void DistanceRGBMatteOperation::initExecution() @@ -37,8 +37,8 @@ void DistanceRGBMatteOperation::initExecution() void DistanceRGBMatteOperation::deinitExecution() { - this->m_inputImageProgram = NULL; - this->m_inputKeyProgram = NULL; + this->m_inputImageProgram = nullptr; + this->m_inputKeyProgram = nullptr; } float DistanceRGBMatteOperation::calculateDistance(float key[4], float image[4]) diff --git a/source/blender/compositor/operations/COM_DotproductOperation.cpp b/source/blender/compositor/operations/COM_DotproductOperation.cpp index 263a7060a49..750e4308d11 100644 --- a/source/blender/compositor/operations/COM_DotproductOperation.cpp +++ b/source/blender/compositor/operations/COM_DotproductOperation.cpp @@ -24,8 +24,8 @@ DotproductOperation::DotproductOperation() this->addInputSocket(COM_DT_VECTOR); this->addOutputSocket(COM_DT_VALUE); this->setResolutionInputSocketIndex(0); - this->m_input1Operation = NULL; - this->m_input2Operation = NULL; + this->m_input1Operation = nullptr; + this->m_input2Operation = nullptr; } void DotproductOperation::initExecution() { @@ -35,8 +35,8 @@ void DotproductOperation::initExecution() void DotproductOperation::deinitExecution() { - this->m_input1Operation = NULL; - this->m_input2Operation = NULL; + this->m_input1Operation = nullptr; + this->m_input2Operation = nullptr; } /** \todo: current implementation is the inverse of a dotproduct. not 'logically' correct diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp index de60e53d3d0..7ef0d7b7606 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp @@ -1311,8 +1311,8 @@ DoubleEdgeMaskOperation::DoubleEdgeMaskOperation() this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); - this->m_inputInnerMask = NULL; - this->m_inputOuterMask = NULL; + this->m_inputInnerMask = nullptr; + this->m_inputOuterMask = nullptr; this->m_adjecentOnly = false; this->m_keepInside = false; this->setComplex(true); @@ -1322,7 +1322,7 @@ bool DoubleEdgeMaskOperation::determineDependingAreaOfInterest(rcti * /*input*/, ReadBufferOperation *readOperation, rcti *output) { - if (this->m_cachedInstance == NULL) { + if (this->m_cachedInstance == nullptr) { rcti newInput; newInput.xmax = this->getWidth(); newInput.xmin = 0; @@ -1339,7 +1339,7 @@ void DoubleEdgeMaskOperation::initExecution() this->m_inputInnerMask = this->getInputSocketReader(0); this->m_inputOuterMask = this->getInputSocketReader(1); initMutex(); - this->m_cachedInstance = NULL; + this->m_cachedInstance = nullptr; } void *DoubleEdgeMaskOperation::initializeTileData(rcti *rect) @@ -1349,7 +1349,7 @@ void *DoubleEdgeMaskOperation::initializeTileData(rcti *rect) } lockMutex(); - if (this->m_cachedInstance == NULL) { + if (this->m_cachedInstance == nullptr) { MemoryBuffer *innerMask = (MemoryBuffer *)this->m_inputInnerMask->initializeTileData(rect); MemoryBuffer *outerMask = (MemoryBuffer *)this->m_inputOuterMask->initializeTileData(rect); float *data = (float *)MEM_mallocN(sizeof(float) * this->getWidth() * this->getHeight(), @@ -1371,11 +1371,11 @@ void DoubleEdgeMaskOperation::executePixel(float output[4], int x, int y, void * void DoubleEdgeMaskOperation::deinitExecution() { - this->m_inputInnerMask = NULL; - this->m_inputOuterMask = NULL; + this->m_inputInnerMask = nullptr; + this->m_inputOuterMask = nullptr; deinitMutex(); if (this->m_cachedInstance) { MEM_freeN(this->m_cachedInstance); - this->m_cachedInstance = NULL; + this->m_cachedInstance = nullptr; } } diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp index 1dc1b0e2be6..38541f91fc8 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp @@ -25,8 +25,8 @@ EllipseMaskOperation::EllipseMaskOperation() this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); - this->m_inputMask = NULL; - this->m_inputValue = NULL; + this->m_inputMask = nullptr; + this->m_inputValue = nullptr; this->m_cosine = 0.0f; this->m_sine = 0.0f; } @@ -114,6 +114,6 @@ void EllipseMaskOperation::executePixelSampled(float output[4], void EllipseMaskOperation::deinitExecution() { - this->m_inputMask = NULL; - this->m_inputValue = NULL; + this->m_inputMask = nullptr; + this->m_inputValue = nullptr; } diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp index 0387f495f0c..e87d40b4c86 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp @@ -24,7 +24,7 @@ FastGaussianBlurOperation::FastGaussianBlurOperation() : BlurBaseOperation(COM_DT_COLOR) { - this->m_iirgaus = NULL; + this->m_iirgaus = nullptr; } void FastGaussianBlurOperation::executePixel(float output[4], int x, int y, void *data) @@ -70,7 +70,7 @@ void FastGaussianBlurOperation::deinitExecution() { if (this->m_iirgaus) { delete this->m_iirgaus; - this->m_iirgaus = NULL; + this->m_iirgaus = nullptr; } BlurBaseOperation::deinitMutex(); } @@ -260,8 +260,8 @@ FastGaussianBlurValueOperation::FastGaussianBlurValueOperation() { this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); - this->m_iirgaus = NULL; - this->m_inputprogram = NULL; + this->m_iirgaus = nullptr; + this->m_inputprogram = nullptr; this->m_sigma = 1.0f; this->m_overlay = 0; setComplex(true); @@ -300,7 +300,7 @@ void FastGaussianBlurValueOperation::deinitExecution() { if (this->m_iirgaus) { delete this->m_iirgaus; - this->m_iirgaus = NULL; + this->m_iirgaus = nullptr; } deinitMutex(); } diff --git a/source/blender/compositor/operations/COM_FlipOperation.cpp b/source/blender/compositor/operations/COM_FlipOperation.cpp index f248133d389..37eaf4868d3 100644 --- a/source/blender/compositor/operations/COM_FlipOperation.cpp +++ b/source/blender/compositor/operations/COM_FlipOperation.cpp @@ -23,7 +23,7 @@ FlipOperation::FlipOperation() this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->setResolutionInputSocketIndex(0); - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; this->m_flipX = true; this->m_flipY = false; } @@ -34,7 +34,7 @@ void FlipOperation::initExecution() void FlipOperation::deinitExecution() { - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; } void FlipOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp b/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp index a333ca18fc2..d67d67f8e57 100644 --- a/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp +++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.cpp @@ -23,7 +23,7 @@ GammaCorrectOperation::GammaCorrectOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; } void GammaCorrectOperation::initExecution() { @@ -58,14 +58,14 @@ void GammaCorrectOperation::executePixelSampled(float output[4], void GammaCorrectOperation::deinitExecution() { - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; } GammaUncorrectOperation::GammaUncorrectOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; } void GammaUncorrectOperation::initExecution() { @@ -100,5 +100,5 @@ void GammaUncorrectOperation::executePixelSampled(float output[4], void GammaUncorrectOperation::deinitExecution() { - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; } diff --git a/source/blender/compositor/operations/COM_GammaOperation.cpp b/source/blender/compositor/operations/COM_GammaOperation.cpp index af483e612f0..6baa52a290c 100644 --- a/source/blender/compositor/operations/COM_GammaOperation.cpp +++ b/source/blender/compositor/operations/COM_GammaOperation.cpp @@ -24,8 +24,8 @@ GammaOperation::GammaOperation() this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); - this->m_inputProgram = NULL; - this->m_inputGammaProgram = NULL; + this->m_inputProgram = nullptr; + this->m_inputGammaProgram = nullptr; } void GammaOperation::initExecution() { @@ -51,6 +51,6 @@ void GammaOperation::executePixelSampled(float output[4], float x, float y, Pixe void GammaOperation::deinitExecution() { - this->m_inputProgram = NULL; - this->m_inputGammaProgram = NULL; + this->m_inputProgram = nullptr; + this->m_inputGammaProgram = nullptr; } diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp index c028a2c0e4c..a7d8f030269 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp @@ -24,7 +24,7 @@ GaussianAlphaXBlurOperation::GaussianAlphaXBlurOperation() : BlurBaseOperation(COM_DT_VALUE) { - this->m_gausstab = NULL; + this->m_gausstab = nullptr; this->m_filtersize = 0; this->m_falloff = -1; /* intentionally invalid, so we can detect uninitialized values */ } @@ -35,7 +35,7 @@ void *GaussianAlphaXBlurOperation::initializeTileData(rcti * /*rect*/) if (!this->m_sizeavailable) { updateGauss(); } - void *buffer = getInputOperation(0)->initializeTileData(NULL); + void *buffer = getInputOperation(0)->initializeTileData(nullptr); unlockMutex(); return buffer; } @@ -57,7 +57,7 @@ void GaussianAlphaXBlurOperation::initExecution() void GaussianAlphaXBlurOperation::updateGauss() { - if (this->m_gausstab == NULL) { + if (this->m_gausstab == nullptr) { updateSize(); float rad = max_ff(m_size * m_data.sizex, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); @@ -65,7 +65,7 @@ void GaussianAlphaXBlurOperation::updateGauss() m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize); } - if (this->m_distbuf_inv == NULL) { + if (this->m_distbuf_inv == nullptr) { updateSize(); float rad = max_ff(m_size * m_data.sizex, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); @@ -143,12 +143,12 @@ void GaussianAlphaXBlurOperation::deinitExecution() if (this->m_gausstab) { MEM_freeN(this->m_gausstab); - this->m_gausstab = NULL; + this->m_gausstab = nullptr; } if (this->m_distbuf_inv) { MEM_freeN(this->m_distbuf_inv); - this->m_distbuf_inv = NULL; + this->m_distbuf_inv = nullptr; } deinitMutex(); @@ -172,7 +172,7 @@ bool GaussianAlphaXBlurOperation::determineDependingAreaOfInterest( else #endif { - if (this->m_sizeavailable && this->m_gausstab != NULL) { + if (this->m_sizeavailable && this->m_gausstab != nullptr) { newInput.xmax = input->xmax + this->m_filtersize + 1; newInput.xmin = input->xmin - this->m_filtersize - 1; newInput.ymax = input->ymax; diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp index 35abe4cd47b..f1bc8751329 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp @@ -24,7 +24,7 @@ GaussianAlphaYBlurOperation::GaussianAlphaYBlurOperation() : BlurBaseOperation(COM_DT_VALUE) { - this->m_gausstab = NULL; + this->m_gausstab = nullptr; this->m_filtersize = 0; this->m_falloff = -1; /* intentionally invalid, so we can detect uninitialized values */ } @@ -35,7 +35,7 @@ void *GaussianAlphaYBlurOperation::initializeTileData(rcti * /*rect*/) if (!this->m_sizeavailable) { updateGauss(); } - void *buffer = getInputOperation(0)->initializeTileData(NULL); + void *buffer = getInputOperation(0)->initializeTileData(nullptr); unlockMutex(); return buffer; } @@ -57,7 +57,7 @@ void GaussianAlphaYBlurOperation::initExecution() void GaussianAlphaYBlurOperation::updateGauss() { - if (this->m_gausstab == NULL) { + if (this->m_gausstab == nullptr) { updateSize(); float rad = max_ff(m_size * m_data.sizey, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); @@ -65,7 +65,7 @@ void GaussianAlphaYBlurOperation::updateGauss() m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize); } - if (this->m_distbuf_inv == NULL) { + if (this->m_distbuf_inv == nullptr) { updateSize(); float rad = max_ff(m_size * m_data.sizey, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); @@ -143,12 +143,12 @@ void GaussianAlphaYBlurOperation::deinitExecution() if (this->m_gausstab) { MEM_freeN(this->m_gausstab); - this->m_gausstab = NULL; + this->m_gausstab = nullptr; } if (this->m_distbuf_inv) { MEM_freeN(this->m_distbuf_inv); - this->m_distbuf_inv = NULL; + this->m_distbuf_inv = nullptr; } deinitMutex(); @@ -172,7 +172,7 @@ bool GaussianAlphaYBlurOperation::determineDependingAreaOfInterest( else #endif { - if (this->m_sizeavailable && this->m_gausstab != NULL) { + if (this->m_sizeavailable && this->m_gausstab != nullptr) { newInput.xmax = input->xmax; newInput.xmin = input->xmin; newInput.ymax = input->ymax + this->m_filtersize + 1; diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp index dd479da864c..d489c64953e 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp @@ -24,7 +24,7 @@ GaussianBokehBlurOperation::GaussianBokehBlurOperation() : BlurBaseOperation(COM_DT_COLOR) { - this->m_gausstab = NULL; + this->m_gausstab = nullptr; } void *GaussianBokehBlurOperation::initializeTileData(rcti * /*rect*/) @@ -33,7 +33,7 @@ void *GaussianBokehBlurOperation::initializeTileData(rcti * /*rect*/) if (!this->m_sizeavailable) { updateGauss(); } - void *buffer = getInputOperation(0)->initializeTileData(NULL); + void *buffer = getInputOperation(0)->initializeTileData(nullptr); unlockMutex(); return buffer; } @@ -51,7 +51,7 @@ void GaussianBokehBlurOperation::initExecution() void GaussianBokehBlurOperation::updateGauss() { - if (this->m_gausstab == NULL) { + if (this->m_gausstab == nullptr) { float radxf; float radyf; int n; @@ -156,7 +156,7 @@ void GaussianBokehBlurOperation::deinitExecution() if (this->m_gausstab) { MEM_freeN(this->m_gausstab); - this->m_gausstab = NULL; + this->m_gausstab = nullptr; } deinitMutex(); @@ -177,7 +177,7 @@ bool GaussianBokehBlurOperation::determineDependingAreaOfInterest( return true; } - if (this->m_sizeavailable && this->m_gausstab != NULL) { + if (this->m_sizeavailable && this->m_gausstab != nullptr) { newInput.xmin = 0; newInput.ymin = 0; newInput.xmax = this->getWidth(); @@ -197,12 +197,12 @@ bool GaussianBokehBlurOperation::determineDependingAreaOfInterest( // reference image GaussianBlurReferenceOperation::GaussianBlurReferenceOperation() : BlurBaseOperation(COM_DT_COLOR) { - this->m_maintabs = NULL; + this->m_maintabs = nullptr; } void *GaussianBlurReferenceOperation::initializeTileData(rcti * /*rect*/) { - void *buffer = getInputOperation(0)->initializeTileData(NULL); + void *buffer = getInputOperation(0)->initializeTileData(nullptr); return buffer; } diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp index 32ad0482791..e4401b2a91c 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp @@ -25,9 +25,9 @@ GaussianXBlurOperation::GaussianXBlurOperation() : BlurBaseOperation(COM_DT_COLOR) { - this->m_gausstab = NULL; + this->m_gausstab = nullptr; #ifdef __SSE2__ - this->m_gausstab_sse = NULL; + this->m_gausstab_sse = nullptr; #endif this->m_filtersize = 0; } @@ -38,7 +38,7 @@ void *GaussianXBlurOperation::initializeTileData(rcti * /*rect*/) if (!this->m_sizeavailable) { updateGauss(); } - void *buffer = getInputOperation(0)->initializeTileData(NULL); + void *buffer = getInputOperation(0)->initializeTileData(nullptr); unlockMutex(); return buffer; } @@ -63,7 +63,7 @@ void GaussianXBlurOperation::initExecution() void GaussianXBlurOperation::updateGauss() { - if (this->m_gausstab == NULL) { + if (this->m_gausstab == nullptr) { updateSize(); float rad = max_ff(m_size * m_data.sizex, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); @@ -125,14 +125,14 @@ void GaussianXBlurOperation::executeOpenCL(OpenCLDevice *device, list<cl_kernel> * /*clKernelsToCleanUp*/) { cl_kernel gaussianXBlurOperationKernel = device->COM_clCreateKernel( - "gaussianXBlurOperationKernel", NULL); + "gaussianXBlurOperationKernel", nullptr); cl_int filter_size = this->m_filtersize; cl_mem gausstab = clCreateBuffer(device->getContext(), CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, sizeof(float) * (this->m_filtersize * 2 + 1), this->m_gausstab, - NULL); + nullptr); device->COM_clAttachMemoryBufferToKernelParameter(gaussianXBlurOperationKernel, 0, @@ -159,12 +159,12 @@ void GaussianXBlurOperation::deinitExecution() if (this->m_gausstab) { MEM_freeN(this->m_gausstab); - this->m_gausstab = NULL; + this->m_gausstab = nullptr; } #ifdef __SSE2__ if (this->m_gausstab_sse) { MEM_freeN(this->m_gausstab_sse); - this->m_gausstab_sse = NULL; + this->m_gausstab_sse = nullptr; } #endif @@ -189,7 +189,7 @@ bool GaussianXBlurOperation::determineDependingAreaOfInterest(rcti *input, } } { - if (this->m_sizeavailable && this->m_gausstab != NULL) { + if (this->m_sizeavailable && this->m_gausstab != nullptr) { newInput.xmax = input->xmax + this->m_filtersize + 1; newInput.xmin = input->xmin - this->m_filtersize - 1; newInput.ymax = input->ymax; diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp index 3ffa797c0c1..230538ba5e6 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp @@ -25,9 +25,9 @@ GaussianYBlurOperation::GaussianYBlurOperation() : BlurBaseOperation(COM_DT_COLOR) { - this->m_gausstab = NULL; + this->m_gausstab = nullptr; #ifdef __SSE2__ - this->m_gausstab_sse = NULL; + this->m_gausstab_sse = nullptr; #endif this->m_filtersize = 0; } @@ -38,7 +38,7 @@ void *GaussianYBlurOperation::initializeTileData(rcti * /*rect*/) if (!this->m_sizeavailable) { updateGauss(); } - void *buffer = getInputOperation(0)->initializeTileData(NULL); + void *buffer = getInputOperation(0)->initializeTileData(nullptr); unlockMutex(); return buffer; } @@ -62,7 +62,7 @@ void GaussianYBlurOperation::initExecution() void GaussianYBlurOperation::updateGauss() { - if (this->m_gausstab == NULL) { + if (this->m_gausstab == nullptr) { updateSize(); float rad = max_ff(m_size * m_data.sizey, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); @@ -125,14 +125,14 @@ void GaussianYBlurOperation::executeOpenCL(OpenCLDevice *device, list<cl_kernel> * /*clKernelsToCleanUp*/) { cl_kernel gaussianYBlurOperationKernel = device->COM_clCreateKernel( - "gaussianYBlurOperationKernel", NULL); + "gaussianYBlurOperationKernel", nullptr); cl_int filter_size = this->m_filtersize; cl_mem gausstab = clCreateBuffer(device->getContext(), CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, sizeof(float) * (this->m_filtersize * 2 + 1), this->m_gausstab, - NULL); + nullptr); device->COM_clAttachMemoryBufferToKernelParameter(gaussianYBlurOperationKernel, 0, @@ -159,12 +159,12 @@ void GaussianYBlurOperation::deinitExecution() if (this->m_gausstab) { MEM_freeN(this->m_gausstab); - this->m_gausstab = NULL; + this->m_gausstab = nullptr; } #ifdef __SSE2__ if (this->m_gausstab_sse) { MEM_freeN(this->m_gausstab_sse); - this->m_gausstab_sse = NULL; + this->m_gausstab_sse = nullptr; } #endif @@ -189,7 +189,7 @@ bool GaussianYBlurOperation::determineDependingAreaOfInterest(rcti *input, } } { - if (this->m_sizeavailable && this->m_gausstab != NULL) { + if (this->m_sizeavailable && this->m_gausstab != nullptr) { newInput.xmax = input->xmax; newInput.xmin = input->xmin; newInput.ymax = input->ymax + this->m_filtersize + 1; diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.cpp b/source/blender/compositor/operations/COM_GlareBaseOperation.cpp index 633b4821358..7b4d38fba3e 100644 --- a/source/blender/compositor/operations/COM_GlareBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_GlareBaseOperation.cpp @@ -23,7 +23,7 @@ GlareBaseOperation::GlareBaseOperation() { this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); - this->m_settings = NULL; + this->m_settings = nullptr; } void GlareBaseOperation::initExecution() { @@ -33,7 +33,7 @@ void GlareBaseOperation::initExecution() void GlareBaseOperation::deinitExecution() { - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; SingleThreadedOperation::deinitExecution(); } diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp b/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp index e61d4e8d8a7..1a1922f828c 100644 --- a/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp +++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp @@ -25,7 +25,7 @@ GlareThresholdOperation::GlareThresholdOperation() { this->addInputSocket(COM_DT_COLOR, COM_SC_FIT); this->addOutputSocket(COM_DT_COLOR); - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; } void GlareThresholdOperation::determineResolution(unsigned int resolution[2], @@ -65,5 +65,5 @@ void GlareThresholdOperation::executePixelSampled(float output[4], void GlareThresholdOperation::deinitExecution() { - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; } diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp index 1d9c493d52b..df30e75cf27 100644 --- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp +++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cpp @@ -27,7 +27,7 @@ HueSaturationValueCorrectOperation::HueSaturationValueCorrectOperation() this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; } void HueSaturationValueCorrectOperation::initExecution() { @@ -68,5 +68,5 @@ void HueSaturationValueCorrectOperation::executePixelSampled(float output[4], void HueSaturationValueCorrectOperation::deinitExecution() { CurveBaseOperation::deinitExecution(); - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; } diff --git a/source/blender/compositor/operations/COM_ImageOperation.cpp b/source/blender/compositor/operations/COM_ImageOperation.cpp index 73c560ca473..f8fe4eb883c 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.cpp +++ b/source/blender/compositor/operations/COM_ImageOperation.cpp @@ -33,18 +33,18 @@ BaseImageOperation::BaseImageOperation() { - this->m_image = NULL; - this->m_buffer = NULL; - this->m_imageFloatBuffer = NULL; - this->m_imageByteBuffer = NULL; - this->m_imageUser = NULL; + this->m_image = nullptr; + this->m_buffer = nullptr; + this->m_imageFloatBuffer = nullptr; + this->m_imageByteBuffer = nullptr; + this->m_imageUser = nullptr; this->m_imagewidth = 0; this->m_imageheight = 0; this->m_framenumber = 0; - this->m_depthBuffer = NULL; + this->m_depthBuffer = nullptr; this->m_numberOfChannels = 0; - this->m_rd = NULL; - this->m_viewName = NULL; + this->m_rd = nullptr; + this->m_viewName = nullptr; } ImageOperation::ImageOperation() : BaseImageOperation() { @@ -64,8 +64,8 @@ ImBuf *BaseImageOperation::getImBuf() ImBuf *ibuf; ImageUser iuser = *this->m_imageUser; - if (this->m_image == NULL) { - return NULL; + if (this->m_image == nullptr) { + return nullptr; } /* local changes to the original ImageUser */ @@ -73,10 +73,10 @@ ImBuf *BaseImageOperation::getImBuf() iuser.multi_index = BKE_scene_multiview_view_id_get(this->m_rd, this->m_viewName); } - ibuf = BKE_image_acquire_ibuf(this->m_image, &iuser, NULL); - if (ibuf == NULL || (ibuf->rect == NULL && ibuf->rect_float == NULL)) { - BKE_image_release_ibuf(this->m_image, ibuf, NULL); - return NULL; + ibuf = BKE_image_acquire_ibuf(this->m_image, &iuser, nullptr); + if (ibuf == nullptr || (ibuf->rect == nullptr && ibuf->rect_float == nullptr)) { + BKE_image_release_ibuf(this->m_image, ibuf, nullptr); + return nullptr; } return ibuf; } @@ -97,9 +97,9 @@ void BaseImageOperation::initExecution() void BaseImageOperation::deinitExecution() { - this->m_imageFloatBuffer = NULL; - this->m_imageByteBuffer = NULL; - BKE_image_release_ibuf(this->m_image, this->m_buffer, NULL); + this->m_imageFloatBuffer = nullptr; + this->m_imageByteBuffer = nullptr; + BKE_image_release_ibuf(this->m_image, this->m_buffer, nullptr); } void BaseImageOperation::determineResolution(unsigned int resolution[2], @@ -115,7 +115,7 @@ void BaseImageOperation::determineResolution(unsigned int resolution[2], resolution[1] = stackbuf->y; } - BKE_image_release_ibuf(this->m_image, stackbuf, NULL); + BKE_image_release_ibuf(this->m_image, stackbuf, nullptr); } static void sampleImageAtLocation( @@ -124,13 +124,13 @@ static void sampleImageAtLocation( if (ibuf->rect_float) { switch (sampler) { case COM_PS_NEAREST: - nearest_interpolation_color(ibuf, NULL, color, x, y); + nearest_interpolation_color(ibuf, nullptr, color, x, y); break; case COM_PS_BILINEAR: - bilinear_interpolation_color(ibuf, NULL, color, x, y); + bilinear_interpolation_color(ibuf, nullptr, color, x, y); break; case COM_PS_BICUBIC: - bicubic_interpolation_color(ibuf, NULL, color, x, y); + bicubic_interpolation_color(ibuf, nullptr, color, x, y); break; } } @@ -138,13 +138,13 @@ static void sampleImageAtLocation( unsigned char byte_color[4]; switch (sampler) { case COM_PS_NEAREST: - nearest_interpolation_color(ibuf, byte_color, NULL, x, y); + nearest_interpolation_color(ibuf, byte_color, nullptr, x, y); break; case COM_PS_BILINEAR: - bilinear_interpolation_color(ibuf, byte_color, NULL, x, y); + bilinear_interpolation_color(ibuf, byte_color, nullptr, x, y); break; case COM_PS_BICUBIC: - bicubic_interpolation_color(ibuf, byte_color, NULL, x, y); + bicubic_interpolation_color(ibuf, byte_color, nullptr, x, y); break; } rgba_uchar_to_float(color, byte_color); @@ -157,7 +157,7 @@ static void sampleImageAtLocation( void ImageOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) { int ix = x, iy = y; - if (this->m_imageFloatBuffer == NULL && this->m_imageByteBuffer == NULL) { + if (this->m_imageFloatBuffer == nullptr && this->m_imageByteBuffer == nullptr) { zero_v4(output); } else if (ix < 0 || iy < 0 || ix >= this->m_buffer->x || iy >= this->m_buffer->y) { @@ -175,7 +175,7 @@ void ImageAlphaOperation::executePixelSampled(float output[4], { float tempcolor[4]; - if (this->m_imageFloatBuffer == NULL && this->m_imageByteBuffer == NULL) { + if (this->m_imageFloatBuffer == nullptr && this->m_imageByteBuffer == nullptr) { output[0] = 0.0f; } else { @@ -190,7 +190,7 @@ void ImageDepthOperation::executePixelSampled(float output[4], float y, PixelSampler /*sampler*/) { - if (this->m_depthBuffer == NULL) { + if (this->m_depthBuffer == nullptr) { output[0] = 0.0f; } else { diff --git a/source/blender/compositor/operations/COM_InpaintOperation.cpp b/source/blender/compositor/operations/COM_InpaintOperation.cpp index 335af3a8287..502b33d7e14 100644 --- a/source/blender/compositor/operations/COM_InpaintOperation.cpp +++ b/source/blender/compositor/operations/COM_InpaintOperation.cpp @@ -32,19 +32,19 @@ InpaintSimpleOperation::InpaintSimpleOperation() this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->setComplex(true); - this->m_inputImageProgram = NULL; - this->m_pixelorder = NULL; - this->m_manhattan_distance = NULL; - this->m_cached_buffer = NULL; + this->m_inputImageProgram = nullptr; + this->m_pixelorder = nullptr; + this->m_manhattan_distance = nullptr; + this->m_cached_buffer = nullptr; this->m_cached_buffer_ready = false; } void InpaintSimpleOperation::initExecution() { this->m_inputImageProgram = this->getInputSocketReader(0); - this->m_pixelorder = NULL; - this->m_manhattan_distance = NULL; - this->m_cached_buffer = NULL; + this->m_pixelorder = nullptr; + this->m_manhattan_distance = nullptr; + this->m_cached_buffer = nullptr; this->m_cached_buffer_ready = false; this->initMutex(); @@ -246,21 +246,21 @@ void InpaintSimpleOperation::executePixel(float output[4], int x, int y, void * void InpaintSimpleOperation::deinitExecution() { - this->m_inputImageProgram = NULL; + this->m_inputImageProgram = nullptr; this->deinitMutex(); if (this->m_cached_buffer) { MEM_freeN(this->m_cached_buffer); - this->m_cached_buffer = NULL; + this->m_cached_buffer = nullptr; } if (this->m_pixelorder) { MEM_freeN(this->m_pixelorder); - this->m_pixelorder = NULL; + this->m_pixelorder = nullptr; } if (this->m_manhattan_distance) { MEM_freeN(this->m_manhattan_distance); - this->m_manhattan_distance = NULL; + this->m_manhattan_distance = nullptr; } this->m_cached_buffer_ready = false; } diff --git a/source/blender/compositor/operations/COM_InvertOperation.cpp b/source/blender/compositor/operations/COM_InvertOperation.cpp index f0d677d3d2f..d9f436a3e28 100644 --- a/source/blender/compositor/operations/COM_InvertOperation.cpp +++ b/source/blender/compositor/operations/COM_InvertOperation.cpp @@ -23,8 +23,8 @@ InvertOperation::InvertOperation() this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); - this->m_inputValueProgram = NULL; - this->m_inputColorProgram = NULL; + this->m_inputValueProgram = nullptr; + this->m_inputColorProgram = nullptr; this->m_color = true; this->m_alpha = false; setResolutionInputSocketIndex(1); @@ -64,6 +64,6 @@ void InvertOperation::executePixelSampled(float output[4], float x, float y, Pix void InvertOperation::deinitExecution() { - this->m_inputValueProgram = NULL; - this->m_inputColorProgram = NULL; + this->m_inputValueProgram = nullptr; + this->m_inputColorProgram = nullptr; } diff --git a/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp b/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp index 97eea6267b0..b9bb316462d 100644 --- a/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp +++ b/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp @@ -32,8 +32,8 @@ KeyingDespillOperation::KeyingDespillOperation() this->m_despillFactor = 0.5f; this->m_colorBalance = 0.5f; - this->m_pixelReader = NULL; - this->m_screenReader = NULL; + this->m_pixelReader = nullptr; + this->m_screenReader = nullptr; } void KeyingDespillOperation::initExecution() @@ -44,8 +44,8 @@ void KeyingDespillOperation::initExecution() void KeyingDespillOperation::deinitExecution() { - this->m_pixelReader = NULL; - this->m_screenReader = NULL; + this->m_pixelReader = nullptr; + this->m_screenReader = nullptr; } void KeyingDespillOperation::executePixelSampled(float output[4], diff --git a/source/blender/compositor/operations/COM_KeyingOperation.cpp b/source/blender/compositor/operations/COM_KeyingOperation.cpp index dfc433dcfc6..9ef4217d300 100644 --- a/source/blender/compositor/operations/COM_KeyingOperation.cpp +++ b/source/blender/compositor/operations/COM_KeyingOperation.cpp @@ -47,8 +47,8 @@ KeyingOperation::KeyingOperation() this->m_screenBalance = 0.5f; - this->m_pixelReader = NULL; - this->m_screenReader = NULL; + this->m_pixelReader = nullptr; + this->m_screenReader = nullptr; } void KeyingOperation::initExecution() @@ -59,8 +59,8 @@ void KeyingOperation::initExecution() void KeyingOperation::deinitExecution() { - this->m_pixelReader = NULL; - this->m_screenReader = NULL; + this->m_pixelReader = nullptr; + this->m_screenReader = nullptr; } void KeyingOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp b/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp index 36093a931d0..463a6fe49c0 100644 --- a/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp +++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.cpp @@ -33,7 +33,7 @@ KeyingScreenOperation::KeyingScreenOperation() { this->addOutputSocket(COM_DT_COLOR); - this->m_movieClip = NULL; + this->m_movieClip = nullptr; this->m_framenumber = 0; this->m_trackingObject[0] = 0; setComplex(true); @@ -42,7 +42,7 @@ KeyingScreenOperation::KeyingScreenOperation() void KeyingScreenOperation::initExecution() { initMutex(); - this->m_cachedTriangulation = NULL; + this->m_cachedTriangulation = nullptr; } void KeyingScreenOperation::deinitExecution() @@ -64,7 +64,7 @@ void KeyingScreenOperation::deinitExecution() MEM_freeN(this->m_cachedTriangulation); - this->m_cachedTriangulation = NULL; + this->m_cachedTriangulation = nullptr; } } @@ -77,7 +77,7 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri VoronoiSite *sites, *site; ImBuf *ibuf; ListBase *tracksbase; - ListBase edges = {NULL, NULL}; + ListBase edges = {nullptr, nullptr}; int sites_total; int i; int width = this->getWidth(); @@ -88,7 +88,7 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri MovieTrackingObject *object = BKE_tracking_object_get_named(tracking, this->m_trackingObject); if (!object) { - return NULL; + return nullptr; } tracksbase = BKE_tracking_object_get_tracks(tracking, object); @@ -117,14 +117,14 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri } if (!sites_total) { - return NULL; + return nullptr; } BKE_movieclip_user_set_frame(&user, clip_frame); ibuf = BKE_movieclip_get_ibuf(this->m_movieClip, &user); if (!ibuf) { - return NULL; + return nullptr; } triangulation = (TriangulationData *)MEM_callocN(sizeof(TriangulationData), @@ -232,13 +232,13 @@ void *KeyingScreenOperation::initializeTileData(rcti *rect) int chunk_size = 20; int i; - if (this->m_movieClip == NULL) { - return NULL; + if (this->m_movieClip == nullptr) { + return nullptr; } if (!this->m_cachedTriangulation) { lockMutex(); - if (this->m_cachedTriangulation == NULL) { + if (this->m_cachedTriangulation == nullptr) { this->m_cachedTriangulation = buildVoronoiTriangulation(); } unlockMutex(); @@ -247,13 +247,13 @@ void *KeyingScreenOperation::initializeTileData(rcti *rect) triangulation = this->m_cachedTriangulation; if (!triangulation) { - return NULL; + return nullptr; } tile_data = (TileData *)MEM_callocN(sizeof(TileData), "keying screen tile data"); for (i = 0; i < triangulation->triangles_total; i++) { - if (BLI_rcti_isect(rect, &triangulation->triangles_AABB[i], NULL)) { + if (BLI_rcti_isect(rect, &triangulation->triangles_AABB[i], nullptr)) { tile_data->triangles_total++; if (tile_data->triangles_total > triangles_allocated) { diff --git a/source/blender/compositor/operations/COM_KeyingSetAlphaOperation.cpp b/source/blender/compositor/operations/COM_KeyingSetAlphaOperation.cpp index 8e501838d7b..47daef8d190 100644 --- a/source/blender/compositor/operations/COM_KeyingSetAlphaOperation.cpp +++ b/source/blender/compositor/operations/COM_KeyingSetAlphaOperation.cpp @@ -24,8 +24,8 @@ KeyingSetAlphaOperation::KeyingSetAlphaOperation() this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); - this->m_inputColor = NULL; - this->m_inputAlpha = NULL; + this->m_inputColor = nullptr; + this->m_inputAlpha = nullptr; } void KeyingSetAlphaOperation::initExecution() @@ -50,6 +50,6 @@ void KeyingSetAlphaOperation::executePixelSampled(float output[4], void KeyingSetAlphaOperation::deinitExecution() { - this->m_inputColor = NULL; - this->m_inputAlpha = NULL; + this->m_inputColor = nullptr; + this->m_inputAlpha = nullptr; } diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp index 50de043b641..f7cc6e2d4de 100644 --- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp @@ -26,7 +26,7 @@ LuminanceMatteOperation::LuminanceMatteOperation() addInputSocket(COM_DT_COLOR); addOutputSocket(COM_DT_VALUE); - this->m_inputImageProgram = NULL; + this->m_inputImageProgram = nullptr; } void LuminanceMatteOperation::initExecution() @@ -36,7 +36,7 @@ void LuminanceMatteOperation::initExecution() void LuminanceMatteOperation::deinitExecution() { - this->m_inputImageProgram = NULL; + this->m_inputImageProgram = nullptr; } void LuminanceMatteOperation::executePixelSampled(float output[4], diff --git a/source/blender/compositor/operations/COM_MapRangeOperation.cpp b/source/blender/compositor/operations/COM_MapRangeOperation.cpp index e4fe6065164..95b3c27ac2f 100644 --- a/source/blender/compositor/operations/COM_MapRangeOperation.cpp +++ b/source/blender/compositor/operations/COM_MapRangeOperation.cpp @@ -26,7 +26,7 @@ MapRangeOperation::MapRangeOperation() this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; this->m_useClamp = false; } @@ -95,9 +95,9 @@ void MapRangeOperation::executePixelSampled(float output[4], void MapRangeOperation::deinitExecution() { - this->m_inputOperation = NULL; - this->m_sourceMinOperation = NULL; - this->m_sourceMaxOperation = NULL; - this->m_destMinOperation = NULL; - this->m_destMaxOperation = NULL; + this->m_inputOperation = nullptr; + this->m_sourceMinOperation = nullptr; + this->m_sourceMaxOperation = nullptr; + this->m_destMinOperation = nullptr; + this->m_destMaxOperation = nullptr; } diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cpp b/source/blender/compositor/operations/COM_MapUVOperation.cpp index ed250bc28b6..32ab63ae028 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.cpp +++ b/source/blender/compositor/operations/COM_MapUVOperation.cpp @@ -28,8 +28,8 @@ MapUVOperation::MapUVOperation() this->setComplex(true); setResolutionInputSocketIndex(1); - this->m_inputUVProgram = NULL; - this->m_inputColorProgram = NULL; + this->m_inputUVProgram = nullptr; + this->m_inputColorProgram = nullptr; } void MapUVOperation::initExecution() @@ -149,8 +149,8 @@ void MapUVOperation::pixelTransform(const float xy[2], void MapUVOperation::deinitExecution() { - this->m_inputUVProgram = NULL; - this->m_inputColorProgram = NULL; + this->m_inputUVProgram = nullptr; + this->m_inputColorProgram = nullptr; } bool MapUVOperation::determineDependingAreaOfInterest(rcti *input, @@ -159,7 +159,7 @@ bool MapUVOperation::determineDependingAreaOfInterest(rcti *input, { rcti colorInput; rcti uvInput; - NodeOperation *operation = NULL; + NodeOperation *operation = nullptr; /* the uv buffer only needs a 3x3 buffer. The image needs whole buffer */ diff --git a/source/blender/compositor/operations/COM_MapValueOperation.cpp b/source/blender/compositor/operations/COM_MapValueOperation.cpp index 908ad7f1317..7f2044b9139 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.cpp +++ b/source/blender/compositor/operations/COM_MapValueOperation.cpp @@ -22,7 +22,7 @@ MapValueOperation::MapValueOperation() { this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; } void MapValueOperation::initExecution() @@ -55,5 +55,5 @@ void MapValueOperation::executePixelSampled(float output[4], void MapValueOperation::deinitExecution() { - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; } diff --git a/source/blender/compositor/operations/COM_MaskOperation.cpp b/source/blender/compositor/operations/COM_MaskOperation.cpp index 7c21ee5d757..ab908590c55 100644 --- a/source/blender/compositor/operations/COM_MaskOperation.cpp +++ b/source/blender/compositor/operations/COM_MaskOperation.cpp @@ -29,7 +29,7 @@ MaskOperation::MaskOperation() { this->addOutputSocket(COM_DT_VALUE); - this->m_mask = NULL; + this->m_mask = nullptr; this->m_maskWidth = 0; this->m_maskHeight = 0; this->m_maskWidthInv = 0.0f; @@ -42,7 +42,7 @@ MaskOperation::MaskOperation() void MaskOperation::initExecution() { - if (this->m_mask && this->m_rasterMaskHandles[0] == NULL) { + if (this->m_mask && this->m_rasterMaskHandles[0] == nullptr) { if (this->m_rasterMaskHandleTot == 1) { this->m_rasterMaskHandles[0] = BKE_maskrasterize_handle_new(); @@ -61,7 +61,7 @@ void MaskOperation::initExecution() float frame_iter = frame; Mask *mask_temp = (Mask *)BKE_id_copy_ex( - NULL, &this->m_mask->id, NULL, LIB_ID_COPY_LOCALIZE | LIB_ID_COPY_NO_ANIMDATA); + nullptr, &this->m_mask->id, nullptr, LIB_ID_COPY_LOCALIZE | LIB_ID_COPY_NO_ANIMDATA); /* trick so we can get unkeyed edits to display */ { @@ -92,7 +92,7 @@ void MaskOperation::initExecution() frame_iter += frame_step; } - BKE_id_free(NULL, &mask_temp->id); + BKE_id_free(nullptr, &mask_temp->id); } } } @@ -102,7 +102,7 @@ void MaskOperation::deinitExecution() for (unsigned int i = 0; i < this->m_rasterMaskHandleTot; i++) { if (this->m_rasterMaskHandles[i]) { BKE_maskrasterize_handle_free(this->m_rasterMaskHandles[i]); - this->m_rasterMaskHandles[i] = NULL; + this->m_rasterMaskHandles[i] = nullptr; } } } diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp index c37874c7c9b..edd5bb6d139 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp @@ -26,9 +26,9 @@ MathBaseOperation::MathBaseOperation() this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); - this->m_inputValue1Operation = NULL; - this->m_inputValue2Operation = NULL; - this->m_inputValue3Operation = NULL; + this->m_inputValue1Operation = nullptr; + this->m_inputValue2Operation = nullptr; + this->m_inputValue3Operation = nullptr; this->m_useClamp = false; } @@ -41,9 +41,9 @@ void MathBaseOperation::initExecution() void MathBaseOperation::deinitExecution() { - this->m_inputValue1Operation = NULL; - this->m_inputValue2Operation = NULL; - this->m_inputValue3Operation = NULL; + this->m_inputValue1Operation = nullptr; + this->m_inputValue2Operation = nullptr; + this->m_inputValue3Operation = nullptr; } void MathBaseOperation::determineResolution(unsigned int resolution[2], diff --git a/source/blender/compositor/operations/COM_MixOperation.cpp b/source/blender/compositor/operations/COM_MixOperation.cpp index 376e27b1f30..948e69bf8eb 100644 --- a/source/blender/compositor/operations/COM_MixOperation.cpp +++ b/source/blender/compositor/operations/COM_MixOperation.cpp @@ -28,9 +28,9 @@ MixBaseOperation::MixBaseOperation() this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); - this->m_inputValueOperation = NULL; - this->m_inputColor1Operation = NULL; - this->m_inputColor2Operation = NULL; + this->m_inputValueOperation = nullptr; + this->m_inputColor1Operation = nullptr; + this->m_inputColor2Operation = nullptr; this->setUseValueAlphaMultiply(false); this->setUseClamp(false); } @@ -90,9 +90,9 @@ void MixBaseOperation::determineResolution(unsigned int resolution[2], void MixBaseOperation::deinitExecution() { - this->m_inputValueOperation = NULL; - this->m_inputColor1Operation = NULL; - this->m_inputColor2Operation = NULL; + this->m_inputValueOperation = nullptr; + this->m_inputColor1Operation = nullptr; + this->m_inputColor2Operation = nullptr; } /* ******** Mix Add Operation ******** */ diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp index f4e860316b3..725aacc7d34 100644 --- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp @@ -31,7 +31,7 @@ MovieClipAttributeOperation::MovieClipAttributeOperation() void MovieClipAttributeOperation::initExecution() { - if (this->m_clip == NULL) { + if (this->m_clip == nullptr) { return; } float loc[2], scale, angle; diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.cpp b/source/blender/compositor/operations/COM_MovieClipOperation.cpp index 9d1779b3573..4f819bf27af 100644 --- a/source/blender/compositor/operations/COM_MovieClipOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieClipOperation.cpp @@ -28,9 +28,9 @@ MovieClipBaseOperation::MovieClipBaseOperation() { - this->m_movieClip = NULL; - this->m_movieClipBuffer = NULL; - this->m_movieClipUser = NULL; + this->m_movieClip = nullptr; + this->m_movieClipBuffer = nullptr; + this->m_movieClipUser = nullptr; this->m_movieClipwidth = 0; this->m_movieClipheight = 0; this->m_framenumber = 0; @@ -52,7 +52,7 @@ void MovieClipBaseOperation::initExecution() if (ibuf) { this->m_movieClipBuffer = ibuf; - if (ibuf->rect_float == NULL || ibuf->userflags & IB_RECT_INVALID) { + if (ibuf->rect_float == nullptr || ibuf->userflags & IB_RECT_INVALID) { IMB_float_from_rect(ibuf); ibuf->userflags &= ~IB_RECT_INVALID; } @@ -65,7 +65,7 @@ void MovieClipBaseOperation::deinitExecution() if (this->m_movieClipBuffer) { IMB_freeImBuf(this->m_movieClipBuffer); - this->m_movieClipBuffer = NULL; + this->m_movieClipBuffer = nullptr; } } @@ -92,23 +92,23 @@ void MovieClipBaseOperation::executePixelSampled(float output[4], { ImBuf *ibuf = this->m_movieClipBuffer; - if (ibuf == NULL) { + if (ibuf == nullptr) { zero_v4(output); } - else if (ibuf->rect == NULL && ibuf->rect_float == NULL) { + else if (ibuf->rect == nullptr && ibuf->rect_float == nullptr) { /* Happens for multilayer exr, i.e. */ zero_v4(output); } else { switch (sampler) { case COM_PS_NEAREST: - nearest_interpolation_color(ibuf, NULL, output, x, y); + nearest_interpolation_color(ibuf, nullptr, output, x, y); break; case COM_PS_BILINEAR: - bilinear_interpolation_color(ibuf, NULL, output, x, y); + bilinear_interpolation_color(ibuf, nullptr, output, x, y); break; case COM_PS_BICUBIC: - bicubic_interpolation_color(ibuf, NULL, output, x, y); + bicubic_interpolation_color(ibuf, nullptr, output, x, y); break; } } diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp index 5accf9a2dc3..5031d590720 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp @@ -28,8 +28,8 @@ MovieDistortionOperation::MovieDistortionOperation(bool distortion) this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); this->setResolutionInputSocketIndex(0); - this->m_inputOperation = NULL; - this->m_movieClip = NULL; + this->m_inputOperation = nullptr; + this->m_movieClip = nullptr; this->m_apply = distortion; } @@ -66,15 +66,15 @@ void MovieDistortionOperation::initExecution() } else { m_margin[0] = m_margin[1] = 0; - this->m_distortion = NULL; + this->m_distortion = nullptr; } } void MovieDistortionOperation::deinitExecution() { - this->m_inputOperation = NULL; - this->m_movieClip = NULL; - if (this->m_distortion != NULL) { + this->m_inputOperation = nullptr; + this->m_movieClip = nullptr; + if (this->m_distortion != nullptr) { BKE_tracking_distortion_free(this->m_distortion); } } @@ -84,7 +84,7 @@ void MovieDistortionOperation::executePixelSampled(float output[4], float y, PixelSampler /*sampler*/) { - if (this->m_distortion != NULL) { + if (this->m_distortion != nullptr) { /* float overscan = 0.0f; */ const float pixel_aspect = this->m_pixel_aspect; const float w = (float)this->m_width /* / (1 + overscan) */; diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp index 952225d5fb7..023538ee5b1 100644 --- a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp +++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp @@ -42,7 +42,7 @@ ImBuf *MultilayerBaseOperation::getImBuf() } this->m_imageUser->view = view; - return NULL; + return nullptr; } void MultilayerColorOperation::executePixelSampled(float output[4], @@ -50,20 +50,20 @@ void MultilayerColorOperation::executePixelSampled(float output[4], float y, PixelSampler sampler) { - if (this->m_imageFloatBuffer == NULL) { + if (this->m_imageFloatBuffer == nullptr) { zero_v4(output); } else { if (this->m_numberOfChannels == 4) { switch (sampler) { case COM_PS_NEAREST: - nearest_interpolation_color(this->m_buffer, NULL, output, x, y); + nearest_interpolation_color(this->m_buffer, nullptr, output, x, y); break; case COM_PS_BILINEAR: - bilinear_interpolation_color(this->m_buffer, NULL, output, x, y); + bilinear_interpolation_color(this->m_buffer, nullptr, output, x, y); break; case COM_PS_BICUBIC: - bicubic_interpolation_color(this->m_buffer, NULL, output, x, y); + bicubic_interpolation_color(this->m_buffer, nullptr, output, x, y); break; } } @@ -87,7 +87,7 @@ void MultilayerValueOperation::executePixelSampled(float output[4], float y, PixelSampler /*sampler*/) { - if (this->m_imageFloatBuffer == NULL) { + if (this->m_imageFloatBuffer == nullptr) { output[0] = 0.0f; } else { @@ -109,7 +109,7 @@ void MultilayerVectorOperation::executePixelSampled(float output[4], float y, PixelSampler /*sampler*/) { - if (this->m_imageFloatBuffer == NULL) { + if (this->m_imageFloatBuffer == nullptr) { output[0] = 0.0f; } else { diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.cpp b/source/blender/compositor/operations/COM_NormalizeOperation.cpp index 1e7986c6009..a8448685332 100644 --- a/source/blender/compositor/operations/COM_NormalizeOperation.cpp +++ b/source/blender/compositor/operations/COM_NormalizeOperation.cpp @@ -22,8 +22,8 @@ NormalizeOperation::NormalizeOperation() { this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); - this->m_imageReader = NULL; - this->m_cachedInstance = NULL; + this->m_imageReader = nullptr; + this->m_cachedInstance = nullptr; this->setComplex(true); } void NormalizeOperation::initExecution() @@ -37,7 +37,7 @@ void NormalizeOperation::executePixel(float output[4], int x, int y, void *data) /* using generic two floats struct to store x: min y: mult */ NodeTwoFloats *minmult = (NodeTwoFloats *)data; - this->m_imageReader->read(output, x, y, NULL); + this->m_imageReader->read(output, x, y, nullptr); output[0] = (output[0] - minmult->x) * minmult->y; @@ -52,7 +52,7 @@ void NormalizeOperation::executePixel(float output[4], int x, int y, void *data) void NormalizeOperation::deinitExecution() { - this->m_imageReader = NULL; + this->m_imageReader = nullptr; delete this->m_cachedInstance; NodeOperation::deinitMutex(); } @@ -85,7 +85,7 @@ bool NormalizeOperation::determineDependingAreaOfInterest(rcti * /*input*/, void *NormalizeOperation::initializeTileData(rcti *rect) { lockMutex(); - if (this->m_cachedInstance == NULL) { + if (this->m_cachedInstance == nullptr) { MemoryBuffer *tile = (MemoryBuffer *)this->m_imageReader->initializeTileData(rect); /* using generic two floats struct to store x: min y: mult */ NodeTwoFloats *minmult = new NodeTwoFloats(); diff --git a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp index c0fe7237687..f7fabfb9572 100644 --- a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp +++ b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cpp @@ -76,15 +76,15 @@ void *OutputOpenExrSingleLayerMultiViewOperation::get_handle(const char *filenam } IMB_exr_add_view(exrhandle, srv->name); - add_exr_channels(exrhandle, NULL, this->m_datatype, srv->name, width, false, NULL); + add_exr_channels(exrhandle, nullptr, this->m_datatype, srv->name, width, false, nullptr); } BLI_make_existing_file(filename); /* prepare the file with all the channels */ - if (IMB_exr_begin_write(exrhandle, filename, width, height, this->m_format->exr_codec, NULL) == - 0) { + if (IMB_exr_begin_write( + exrhandle, filename, width, height, this->m_format->exr_codec, nullptr) == 0) { printf("Error Writing Singlelayer Multiview Openexr\n"); IMB_exr_close(exrhandle); } @@ -93,7 +93,7 @@ void *OutputOpenExrSingleLayerMultiViewOperation::get_handle(const char *filenam return exrhandle; } } - return NULL; + return nullptr; } void OutputOpenExrSingleLayerMultiViewOperation::deinitExecution() @@ -112,11 +112,11 @@ void OutputOpenExrSingleLayerMultiViewOperation::deinitExecution() R_IMF_IMTYPE_OPENEXR, (this->m_rd->scemode & R_EXTENSION) != 0, true, - NULL); + nullptr); exrhandle = this->get_handle(filename); add_exr_channels(exrhandle, - NULL, + nullptr, this->m_datatype, this->m_viewName, width, @@ -124,15 +124,15 @@ void OutputOpenExrSingleLayerMultiViewOperation::deinitExecution() this->m_outputBuffer); /* memory can only be freed after we write all views to the file */ - this->m_outputBuffer = NULL; - this->m_imageInput = NULL; + this->m_outputBuffer = nullptr; + this->m_imageInput = nullptr; /* ready to close the file */ if (BKE_scene_multiview_is_render_view_last(this->m_rd, this->m_viewName)) { IMB_exr_write_channels(exrhandle); /* free buffer memory for all the views */ - free_exr_channels(exrhandle, this->m_rd, NULL, this->m_datatype); + free_exr_channels(exrhandle, this->m_rd, nullptr, this->m_datatype); /* remove exr handle and data */ IMB_exr_close(exrhandle); @@ -188,14 +188,14 @@ void *OutputOpenExrMultiLayerMultiViewOperation::get_handle(const char *filename srv->name, width, this->m_exr_half_float, - NULL); + nullptr); } } BLI_make_existing_file(filename); /* prepare the file with all the channels for the header */ - if (IMB_exr_begin_write(exrhandle, filename, width, height, this->m_exr_codec, NULL) == 0) { + if (IMB_exr_begin_write(exrhandle, filename, width, height, this->m_exr_codec, nullptr) == 0) { printf("Error Writing Multilayer Multiview Openexr\n"); IMB_exr_close(exrhandle); } @@ -204,7 +204,7 @@ void *OutputOpenExrMultiLayerMultiViewOperation::get_handle(const char *filename return exrhandle; } } - return NULL; + return nullptr; } void OutputOpenExrMultiLayerMultiViewOperation::deinitExecution() @@ -223,7 +223,7 @@ void OutputOpenExrMultiLayerMultiViewOperation::deinitExecution() R_IMF_IMTYPE_MULTILAYER, (this->m_rd->scemode & R_EXTENSION) != 0, true, - NULL); + nullptr); exrhandle = this->get_handle(filename); @@ -239,8 +239,8 @@ void OutputOpenExrMultiLayerMultiViewOperation::deinitExecution() for (unsigned int i = 0; i < this->m_layers.size(); i++) { /* memory can only be freed after we write all views to the file */ - this->m_layers[i].outputBuffer = NULL; - this->m_layers[i].imageInput = NULL; + this->m_layers[i].outputBuffer = nullptr; + this->m_layers[i].imageInput = nullptr; } /* ready to close the file */ @@ -300,7 +300,7 @@ void *OutputStereoOperation::get_handle(const char *filename) return exrhandle; } - return NULL; + return nullptr; } void OutputStereoOperation::deinitExecution() @@ -316,7 +316,7 @@ void OutputStereoOperation::deinitExecution() /* populate single EXR channel with view data */ IMB_exr_add_channel(exrhandle, - NULL, + nullptr, this->m_name, this->m_viewName, 1, @@ -324,19 +324,19 @@ void OutputStereoOperation::deinitExecution() buf, this->m_format->depth == R_IMF_CHAN_DEPTH_16); - this->m_imageInput = NULL; - this->m_outputBuffer = NULL; + this->m_imageInput = nullptr; + this->m_outputBuffer = nullptr; /* create stereo ibuf */ if (BKE_scene_multiview_is_render_view_last(this->m_rd, this->m_viewName)) { - ImBuf *ibuf[3] = {NULL}; + ImBuf *ibuf[3] = {nullptr}; const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME}; char filename[FILE_MAX]; int i; /* get rectf from EXR */ for (i = 0; i < 2; i++) { - float *rectf = IMB_exr_channel_rect(exrhandle, NULL, this->m_name, names[i]); + float *rectf = IMB_exr_channel_rect(exrhandle, nullptr, this->m_name, names[i]); ibuf[i] = IMB_allocImBuf(width, height, this->m_format->planes, 0); ibuf[i]->channels = this->m_channels; @@ -360,7 +360,7 @@ void OutputStereoOperation::deinitExecution() this->m_format, (this->m_rd->scemode & R_EXTENSION) != 0, true, - NULL); + nullptr); BKE_imbuf_write(ibuf[2], filename, this->m_format); diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp index 374189a5c50..c5623fdbd37 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp +++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp @@ -48,25 +48,55 @@ void add_exr_channels(void *exrhandle, switch (datatype) { case COM_DT_VALUE: IMB_exr_add_channel( - exrhandle, layerName, "V", viewName, 1, width, buf ? buf : NULL, use_half_float); + exrhandle, layerName, "V", viewName, 1, width, buf ? buf : nullptr, use_half_float); break; case COM_DT_VECTOR: IMB_exr_add_channel( - exrhandle, layerName, "X", viewName, 3, 3 * width, buf ? buf : NULL, use_half_float); - IMB_exr_add_channel( - exrhandle, layerName, "Y", viewName, 3, 3 * width, buf ? buf + 1 : NULL, use_half_float); - IMB_exr_add_channel( - exrhandle, layerName, "Z", viewName, 3, 3 * width, buf ? buf + 2 : NULL, use_half_float); + exrhandle, layerName, "X", viewName, 3, 3 * width, buf ? buf : nullptr, use_half_float); + IMB_exr_add_channel(exrhandle, + layerName, + "Y", + viewName, + 3, + 3 * width, + buf ? buf + 1 : nullptr, + use_half_float); + IMB_exr_add_channel(exrhandle, + layerName, + "Z", + viewName, + 3, + 3 * width, + buf ? buf + 2 : nullptr, + use_half_float); break; case COM_DT_COLOR: IMB_exr_add_channel( - exrhandle, layerName, "R", viewName, 4, 4 * width, buf ? buf : NULL, use_half_float); - IMB_exr_add_channel( - exrhandle, layerName, "G", viewName, 4, 4 * width, buf ? buf + 1 : NULL, use_half_float); - IMB_exr_add_channel( - exrhandle, layerName, "B", viewName, 4, 4 * width, buf ? buf + 2 : NULL, use_half_float); - IMB_exr_add_channel( - exrhandle, layerName, "A", viewName, 4, 4 * width, buf ? buf + 3 : NULL, use_half_float); + exrhandle, layerName, "R", viewName, 4, 4 * width, buf ? buf : nullptr, use_half_float); + IMB_exr_add_channel(exrhandle, + layerName, + "G", + viewName, + 4, + 4 * width, + buf ? buf + 1 : nullptr, + use_half_float); + IMB_exr_add_channel(exrhandle, + layerName, + "B", + viewName, + 4, + 4 * width, + buf ? buf + 2 : nullptr, + use_half_float); + IMB_exr_add_channel(exrhandle, + layerName, + "A", + viewName, + 4, + 4 * width, + buf ? buf + 3 : nullptr, + use_half_float); break; default: break; @@ -82,7 +112,7 @@ void free_exr_channels(void *exrhandle, /* check renderdata for amount of views */ for (srv = (SceneRenderView *)rd->views.first; srv; srv = srv->next) { - float *rect = NULL; + float *rect = nullptr; if (BKE_scene_multiview_is_render_view_active(rd, srv) == false) { continue; @@ -130,7 +160,7 @@ static float *init_buffer(unsigned int width, unsigned int height, DataType data return (float *)MEM_callocN(width * height * size * sizeof(float), "OutputFile buffer"); } - return NULL; + return nullptr; } static void write_buffer_rect(rcti *rect, @@ -187,9 +217,9 @@ OutputSingleLayerOperation::OutputSingleLayerOperation( this->addInputSocket(datatype); - this->m_outputBuffer = NULL; + this->m_outputBuffer = nullptr; this->m_datatype = datatype; - this->m_imageInput = NULL; + this->m_imageInput = nullptr; this->m_format = format; BLI_strncpy(this->m_path, path, sizeof(this->m_path)); @@ -252,8 +282,8 @@ void OutputSingleLayerOperation::deinitExecution() IMB_freeImBuf(ibuf); } - this->m_outputBuffer = NULL; - this->m_imageInput = NULL; + this->m_outputBuffer = nullptr; + this->m_imageInput = nullptr; } /******************************* MultiLayer *******************************/ @@ -265,8 +295,8 @@ OutputOpenExrLayer::OutputOpenExrLayer(const char *name_, DataType datatype_, bo this->use_layer = use_layer_; /* these are created in initExecution */ - this->outputBuffer = 0; - this->imageInput = 0; + this->outputBuffer = nullptr; + this->imageInput = nullptr; } OutputOpenExrMultiLayerOperation::OutputOpenExrMultiLayerOperation(const RenderData *rd, @@ -356,7 +386,7 @@ void OutputOpenExrMultiLayerOperation::deinitExecution() } /* when the filename has no permissions, this can fail */ - if (IMB_exr_begin_write(exrhandle, filename, width, height, this->m_exr_codec, NULL)) { + if (IMB_exr_begin_write(exrhandle, filename, width, height, this->m_exr_codec, nullptr)) { IMB_exr_write_channels(exrhandle); } else { @@ -369,10 +399,10 @@ void OutputOpenExrMultiLayerOperation::deinitExecution() for (unsigned int i = 0; i < this->m_layers.size(); i++) { if (this->m_layers[i].outputBuffer) { MEM_freeN(this->m_layers[i].outputBuffer); - this->m_layers[i].outputBuffer = NULL; + this->m_layers[i].outputBuffer = nullptr; } - this->m_layers[i].imageInput = NULL; + this->m_layers[i].imageInput = nullptr; } } } diff --git a/source/blender/compositor/operations/COM_PixelateOperation.cpp b/source/blender/compositor/operations/COM_PixelateOperation.cpp index 01cd7fcfd97..0d810c80ab4 100644 --- a/source/blender/compositor/operations/COM_PixelateOperation.cpp +++ b/source/blender/compositor/operations/COM_PixelateOperation.cpp @@ -23,7 +23,7 @@ PixelateOperation::PixelateOperation(DataType datatype) this->addInputSocket(datatype); this->addOutputSocket(datatype); this->setResolutionInputSocketIndex(0); - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; } void PixelateOperation::initExecution() @@ -33,7 +33,7 @@ void PixelateOperation::initExecution() void PixelateOperation::deinitExecution() { - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; } void PixelateOperation::executePixelSampled(float output[4], diff --git a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cpp b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cpp index 0f6d5d0d4d7..c395f795a22 100644 --- a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cpp +++ b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cpp @@ -48,7 +48,7 @@ PlaneDistortWarpImageOperation::PlaneDistortWarpImageOperation() { this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); this->addOutputSocket(COM_DT_COLOR); - this->m_pixelReader = NULL; + this->m_pixelReader = nullptr; this->m_motion_blur_samples = 1; this->m_motion_blur_shutter = 0.5f; this->setComplex(true); @@ -87,7 +87,7 @@ void PlaneDistortWarpImageOperation::initExecution() void PlaneDistortWarpImageOperation::deinitExecution() { - this->m_pixelReader = NULL; + this->m_pixelReader = nullptr; } void PlaneDistortWarpImageOperation::executePixelSampled(float output[4], diff --git a/source/blender/compositor/operations/COM_PlaneTrackOperation.cpp b/source/blender/compositor/operations/COM_PlaneTrackOperation.cpp index ed9a776d0a3..81a598e937b 100644 --- a/source/blender/compositor/operations/COM_PlaneTrackOperation.cpp +++ b/source/blender/compositor/operations/COM_PlaneTrackOperation.cpp @@ -33,7 +33,7 @@ PlaneTrackCommon::PlaneTrackCommon() { - this->m_movieClip = NULL; + this->m_movieClip = nullptr; this->m_framenumber = 0; this->m_trackingObjectName[0] = '\0'; this->m_planeTrackName[0] = '\0'; diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cpp b/source/blender/compositor/operations/COM_PreviewOperation.cpp index 46ac466fd19..063421f6525 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.cpp +++ b/source/blender/compositor/operations/COM_PreviewOperation.cpp @@ -38,9 +38,9 @@ PreviewOperation::PreviewOperation(const ColorManagedViewSettings *viewSettings, { this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); - this->m_preview = NULL; - this->m_outputBuffer = NULL; - this->m_input = NULL; + this->m_preview = nullptr; + this->m_outputBuffer = nullptr; + this->m_input = nullptr; this->m_divider = 1.0f; this->m_viewSettings = viewSettings; this->m_displaySettings = displaySettings; @@ -63,7 +63,7 @@ void PreviewOperation::initExecution() this->m_outputBuffer = this->m_preview->rect; } - if (this->m_outputBuffer == NULL) { + if (this->m_outputBuffer == nullptr) { this->m_outputBuffer = (unsigned char *)MEM_callocN( sizeof(unsigned char) * 4 * getWidth() * getHeight(), "PreviewOperation"); if (this->m_preview->rect) { @@ -77,8 +77,8 @@ void PreviewOperation::initExecution() void PreviewOperation::deinitExecution() { - this->m_outputBuffer = NULL; - this->m_input = NULL; + this->m_outputBuffer = nullptr; + this->m_input = nullptr; } void PreviewOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp index 921b7ed474c..7d459b76cb9 100644 --- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp @@ -26,7 +26,7 @@ ProjectorLensDistortionOperation::ProjectorLensDistortionOperation() this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); this->setComplex(true); - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; this->m_dispersionAvailable = false; this->m_dispersion = 0.0f; } @@ -39,7 +39,7 @@ void ProjectorLensDistortionOperation::initExecution() void *ProjectorLensDistortionOperation::initializeTileData(rcti * /*rect*/) { updateDispersion(); - void *buffer = this->m_inputProgram->initializeTileData(NULL); + void *buffer = this->m_inputProgram->initializeTileData(nullptr); return buffer; } @@ -63,7 +63,7 @@ void ProjectorLensDistortionOperation::executePixel(float output[4], int x, int void ProjectorLensDistortionOperation::deinitExecution() { this->deinitMutex(); - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; } bool ProjectorLensDistortionOperation::determineDependingAreaOfInterest( diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp index 9139ac200c8..2977e6685d2 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp @@ -25,7 +25,7 @@ ReadBufferOperation::ReadBufferOperation(DataType datatype) this->addOutputSocket(datatype); this->m_single_value = false; this->m_offset = 0; - this->m_buffer = NULL; + this->m_buffer = nullptr; } void *ReadBufferOperation::initializeTileData(rcti * /*rect*/) @@ -36,7 +36,7 @@ void *ReadBufferOperation::initializeTileData(rcti * /*rect*/) void ReadBufferOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) { - if (this->m_memoryProxy != NULL) { + if (this->m_memoryProxy != nullptr) { WriteBufferOperation *operation = this->m_memoryProxy->getWriteBufferOperation(); operation->determineResolution(resolution, preferredResolution); operation->setResolution(resolution); @@ -120,7 +120,7 @@ bool ReadBufferOperation::determineDependingAreaOfInterest(rcti *input, void ReadBufferOperation::readResolutionFromWriteBuffer() { - if (this->m_memoryProxy != NULL) { + if (this->m_memoryProxy != nullptr) { WriteBufferOperation *operation = this->m_memoryProxy->getWriteBufferOperation(); this->setWidth(operation->getWidth()); this->setHeight(operation->getHeight()); diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cpp b/source/blender/compositor/operations/COM_RenderLayersProg.cpp index b7b1da1bb89..40a68d4f9e2 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersProg.cpp @@ -31,10 +31,10 @@ RenderLayersProg::RenderLayersProg(const char *passName, DataType type, int elementsize) : m_passName(passName) { - this->setScene(NULL); - this->m_inputBuffer = NULL; + this->setScene(nullptr); + this->m_inputBuffer = nullptr; this->m_elementsize = elementsize; - this->m_rd = NULL; + this->m_rd = nullptr; this->addOutputSocket(type); } @@ -42,8 +42,8 @@ RenderLayersProg::RenderLayersProg(const char *passName, DataType type, int elem void RenderLayersProg::initExecution() { Scene *scene = this->getScene(); - Render *re = (scene) ? RE_GetSceneRender(scene) : NULL; - RenderResult *rr = NULL; + Render *re = (scene) ? RE_GetSceneRender(scene) : nullptr; + RenderResult *rr = nullptr; if (re) { rr = RE_AcquireResultRead(re); @@ -62,7 +62,7 @@ void RenderLayersProg::initExecution() } if (re) { RE_ReleaseResult(re); - re = NULL; + re = nullptr; } } @@ -157,7 +157,7 @@ void RenderLayersProg::executePixelSampled(float output[4], float x, float y, Pi } #endif - if (this->m_inputBuffer == NULL) { + if (this->m_inputBuffer == nullptr) { int elemsize = this->m_elementsize; if (elemsize == 1) { output[0] = 0.0f; @@ -177,15 +177,15 @@ void RenderLayersProg::executePixelSampled(float output[4], float x, float y, Pi void RenderLayersProg::deinitExecution() { - this->m_inputBuffer = NULL; + this->m_inputBuffer = nullptr; } void RenderLayersProg::determineResolution(unsigned int resolution[2], unsigned int /*preferredResolution*/[2]) { Scene *sce = this->getScene(); - Render *re = (sce) ? RE_GetSceneRender(sce) : NULL; - RenderResult *rr = NULL; + Render *re = (sce) ? RE_GetSceneRender(sce) : nullptr; + RenderResult *rr = nullptr; resolution[0] = 0; resolution[1] = 0; @@ -217,7 +217,7 @@ void RenderLayersAOOperation::executePixelSampled(float output[4], PixelSampler sampler) { float *inputBuffer = this->getInputBuffer(); - if (inputBuffer == NULL) { + if (inputBuffer == nullptr) { zero_v3(output); } else { @@ -234,7 +234,7 @@ void RenderLayersAlphaProg::executePixelSampled(float output[4], { float *inputBuffer = this->getInputBuffer(); - if (inputBuffer == NULL) { + if (inputBuffer == nullptr) { output[0] = 0.0f; } else { @@ -254,7 +254,7 @@ void RenderLayersDepthProg::executePixelSampled(float output[4], int iy = y; float *inputBuffer = this->getInputBuffer(); - if (inputBuffer == NULL || ix < 0 || iy < 0 || ix >= (int)this->getWidth() || + if (inputBuffer == nullptr || ix < 0 || iy < 0 || ix >= (int)this->getWidth() || iy >= (int)this->getHeight()) { output[0] = 10e10f; } diff --git a/source/blender/compositor/operations/COM_RotateOperation.cpp b/source/blender/compositor/operations/COM_RotateOperation.cpp index e25d5af1aed..7a21e960c13 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.cpp +++ b/source/blender/compositor/operations/COM_RotateOperation.cpp @@ -25,8 +25,8 @@ RotateOperation::RotateOperation() this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); this->setResolutionInputSocketIndex(0); - this->m_imageSocket = NULL; - this->m_degreeSocket = NULL; + this->m_imageSocket = nullptr; + this->m_degreeSocket = nullptr; this->m_doDegree2RadConversion = false; this->m_isDegreeSet = false; } @@ -40,8 +40,8 @@ void RotateOperation::initExecution() void RotateOperation::deinitExecution() { - this->m_imageSocket = NULL; - this->m_degreeSocket = NULL; + this->m_imageSocket = nullptr; + this->m_degreeSocket = nullptr; } inline void RotateOperation::ensureDegree() diff --git a/source/blender/compositor/operations/COM_ScaleOperation.cpp b/source/blender/compositor/operations/COM_ScaleOperation.cpp index 37ce832209c..9ec4e474ccd 100644 --- a/source/blender/compositor/operations/COM_ScaleOperation.cpp +++ b/source/blender/compositor/operations/COM_ScaleOperation.cpp @@ -42,9 +42,9 @@ ScaleOperation::ScaleOperation() : BaseScaleOperation() this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); this->setResolutionInputSocketIndex(0); - this->m_inputOperation = NULL; - this->m_inputXOperation = NULL; - this->m_inputYOperation = NULL; + this->m_inputOperation = nullptr; + this->m_inputXOperation = nullptr; + this->m_inputYOperation = nullptr; } void ScaleOperation::initExecution() { @@ -57,9 +57,9 @@ void ScaleOperation::initExecution() void ScaleOperation::deinitExecution() { - this->m_inputOperation = NULL; - this->m_inputXOperation = NULL; - this->m_inputYOperation = NULL; + this->m_inputOperation = nullptr; + this->m_inputXOperation = nullptr; + this->m_inputYOperation = nullptr; } void ScaleOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) @@ -117,9 +117,9 @@ ScaleAbsoluteOperation::ScaleAbsoluteOperation() : BaseScaleOperation() this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); this->setResolutionInputSocketIndex(0); - this->m_inputOperation = NULL; - this->m_inputXOperation = NULL; - this->m_inputYOperation = NULL; + this->m_inputOperation = nullptr; + this->m_inputXOperation = nullptr; + this->m_inputYOperation = nullptr; } void ScaleAbsoluteOperation::initExecution() { @@ -132,9 +132,9 @@ void ScaleAbsoluteOperation::initExecution() void ScaleAbsoluteOperation::deinitExecution() { - this->m_inputOperation = NULL; - this->m_inputXOperation = NULL; - this->m_inputYOperation = NULL; + this->m_inputOperation = nullptr; + this->m_inputXOperation = nullptr; + this->m_inputYOperation = nullptr; } void ScaleAbsoluteOperation::executePixelSampled(float output[4], @@ -206,7 +206,7 @@ ScaleFixedSizeOperation::ScaleFixedSizeOperation() : BaseScaleOperation() this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); this->addOutputSocket(COM_DT_COLOR); this->setResolutionInputSocketIndex(0); - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; this->m_is_offset = false; } void ScaleFixedSizeOperation::initExecution() @@ -263,7 +263,7 @@ void ScaleFixedSizeOperation::initExecution() void ScaleFixedSizeOperation::deinitExecution() { - this->m_inputOperation = NULL; + this->m_inputOperation = nullptr; } void ScaleFixedSizeOperation::executePixelSampled(float output[4], diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp index 4b92be65b3e..158ffd4a8c0 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp @@ -31,7 +31,7 @@ ScreenLensDistortionOperation::ScreenLensDistortionOperation() this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); this->setComplex(true); - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; this->m_distortion = 0.0f; this->m_dispersion = 0.0f; this->m_distortion_const = false; @@ -72,7 +72,7 @@ void ScreenLensDistortionOperation::initExecution() void *ScreenLensDistortionOperation::initializeTileData(rcti * /*rect*/) { - void *buffer = this->m_inputProgram->initializeTileData(NULL); + void *buffer = this->m_inputProgram->initializeTileData(nullptr); /* get distortion/dispersion values once, by reading inputs at (0,0) * XXX this assumes invariable values (no image inputs), @@ -202,7 +202,7 @@ void ScreenLensDistortionOperation::executePixel(float output[4], int x, int y, void ScreenLensDistortionOperation::deinitExecution() { this->deinitMutex(); - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; BLI_rng_free(this->m_rng); } diff --git a/source/blender/compositor/operations/COM_SetAlphaOperation.cpp b/source/blender/compositor/operations/COM_SetAlphaOperation.cpp index cc4e4a562db..bf8fbacbfe1 100644 --- a/source/blender/compositor/operations/COM_SetAlphaOperation.cpp +++ b/source/blender/compositor/operations/COM_SetAlphaOperation.cpp @@ -24,8 +24,8 @@ SetAlphaOperation::SetAlphaOperation() this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); - this->m_inputColor = NULL; - this->m_inputAlpha = NULL; + this->m_inputColor = nullptr; + this->m_inputAlpha = nullptr; } void SetAlphaOperation::initExecution() @@ -49,6 +49,6 @@ void SetAlphaOperation::executePixelSampled(float output[4], void SetAlphaOperation::deinitExecution() { - this->m_inputColor = NULL; - this->m_inputAlpha = NULL; + this->m_inputColor = nullptr; + this->m_inputAlpha = nullptr; } diff --git a/source/blender/compositor/operations/COM_SetSamplerOperation.cpp b/source/blender/compositor/operations/COM_SetSamplerOperation.cpp index 3c6a5104352..942d717d19c 100644 --- a/source/blender/compositor/operations/COM_SetSamplerOperation.cpp +++ b/source/blender/compositor/operations/COM_SetSamplerOperation.cpp @@ -30,7 +30,7 @@ void SetSamplerOperation::initExecution() } void SetSamplerOperation::deinitExecution() { - this->m_reader = NULL; + this->m_reader = nullptr; } void SetSamplerOperation::executePixelSampled(float output[4], diff --git a/source/blender/compositor/operations/COM_SplitOperation.cpp b/source/blender/compositor/operations/COM_SplitOperation.cpp index cace3b40b44..fb6214c7522 100644 --- a/source/blender/compositor/operations/COM_SplitOperation.cpp +++ b/source/blender/compositor/operations/COM_SplitOperation.cpp @@ -32,8 +32,8 @@ SplitOperation::SplitOperation() this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); - this->m_image1Input = NULL; - this->m_image2Input = NULL; + this->m_image1Input = nullptr; + this->m_image2Input = nullptr; } void SplitOperation::initExecution() @@ -45,8 +45,8 @@ void SplitOperation::initExecution() void SplitOperation::deinitExecution() { - this->m_image1Input = NULL; - this->m_image2Input = NULL; + this->m_image1Input = nullptr; + this->m_image2Input = nullptr; } void SplitOperation::executePixelSampled(float output[4], diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.cpp b/source/blender/compositor/operations/COM_SunBeamsOperation.cpp index ef3c0700119..7cfa4de7a61 100644 --- a/source/blender/compositor/operations/COM_SunBeamsOperation.cpp +++ b/source/blender/compositor/operations/COM_SunBeamsOperation.cpp @@ -310,7 +310,7 @@ static void accumulate_line(MemoryBuffer *input, void *SunBeamsOperation::initializeTileData(rcti * /*rect*/) { - void *buffer = getInputOperation(0)->initializeTileData(NULL); + void *buffer = getInputOperation(0)->initializeTileData(nullptr); return buffer; } diff --git a/source/blender/compositor/operations/COM_TextureOperation.cpp b/source/blender/compositor/operations/COM_TextureOperation.cpp index 5a8c40d8c8c..e66cd57cb3f 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.cpp +++ b/source/blender/compositor/operations/COM_TextureOperation.cpp @@ -29,11 +29,11 @@ TextureBaseOperation::TextureBaseOperation() { this->addInputSocket(COM_DT_VECTOR); // offset this->addInputSocket(COM_DT_VECTOR); // size - this->m_texture = NULL; - this->m_inputSize = NULL; - this->m_inputOffset = NULL; - this->m_rd = NULL; - this->m_pool = NULL; + this->m_texture = nullptr; + this->m_inputSize = nullptr; + this->m_inputOffset = nullptr; + this->m_rd = nullptr; + this->m_pool = nullptr; this->m_sceneColorManage = false; setComplex(true); } @@ -51,19 +51,20 @@ void TextureBaseOperation::initExecution() this->m_inputOffset = getInputSocketReader(0); this->m_inputSize = getInputSocketReader(1); this->m_pool = BKE_image_pool_new(); - if (this->m_texture != NULL && this->m_texture->nodetree != NULL && this->m_texture->use_nodes) { + if (this->m_texture != nullptr && this->m_texture->nodetree != nullptr && + this->m_texture->use_nodes) { ntreeTexBeginExecTree(this->m_texture->nodetree); } NodeOperation::initExecution(); } void TextureBaseOperation::deinitExecution() { - this->m_inputSize = NULL; - this->m_inputOffset = NULL; + this->m_inputSize = nullptr; + this->m_inputOffset = nullptr; BKE_image_pool_free(this->m_pool); - this->m_pool = NULL; - if (this->m_texture != NULL && this->m_texture->use_nodes && this->m_texture->nodetree != NULL && - this->m_texture->nodetree->execdata != NULL) { + this->m_pool = nullptr; + if (this->m_texture != nullptr && this->m_texture->use_nodes && + this->m_texture->nodetree != nullptr && this->m_texture->nodetree->execdata != nullptr) { ntreeTexEndExecTree(this->m_texture->nodetree->execdata); } NodeOperation::deinitExecution(); @@ -99,7 +100,7 @@ void TextureBaseOperation::executePixelSampled(float output[4], float y, PixelSampler sampler) { - TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL}; + TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, nullptr}; float textureSize[4]; float textureOffset[4]; float vec[3]; @@ -114,7 +115,7 @@ void TextureBaseOperation::executePixelSampled(float output[4], * interpolation and (b) in such configuration multitex() simply floor's the value * which often produces artifacts. */ - if (m_texture != NULL && (m_texture->imaflag & TEX_INTERPOL) == 0) { + if (m_texture != nullptr && (m_texture->imaflag & TEX_INTERPOL) == 0) { u += 0.5f / cx; v += 0.5f / cy; } @@ -127,8 +128,16 @@ void TextureBaseOperation::executePixelSampled(float output[4], vec[2] = textureSize[2] * textureOffset[2]; const int thread_id = WorkScheduler::current_thread_id(); - retval = multitex_ext( - this->m_texture, vec, NULL, NULL, 0, &texres, thread_id, m_pool, m_sceneColorManage, false); + retval = multitex_ext(this->m_texture, + vec, + nullptr, + nullptr, + 0, + &texres, + thread_id, + m_pool, + m_sceneColorManage, + false); if (texres.talpha) { output[3] = texres.ta; diff --git a/source/blender/compositor/operations/COM_TonemapOperation.cpp b/source/blender/compositor/operations/COM_TonemapOperation.cpp index 2e330e287b2..cb0fc747dcb 100644 --- a/source/blender/compositor/operations/COM_TonemapOperation.cpp +++ b/source/blender/compositor/operations/COM_TonemapOperation.cpp @@ -26,9 +26,9 @@ TonemapOperation::TonemapOperation() { this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); this->addOutputSocket(COM_DT_COLOR); - this->m_imageReader = NULL; - this->m_data = NULL; - this->m_cachedInstance = NULL; + this->m_imageReader = nullptr; + this->m_data = nullptr; + this->m_cachedInstance = nullptr; this->setComplex(true); } void TonemapOperation::initExecution() @@ -41,7 +41,7 @@ void TonemapOperation::executePixel(float output[4], int x, int y, void *data) { AvgLogLum *avg = (AvgLogLum *)data; - this->m_imageReader->read(output, x, y, NULL); + this->m_imageReader->read(output, x, y, nullptr); mul_v3_fl(output, avg->al); float dr = output[0] + this->m_data->offset; float dg = output[1] + this->m_data->offset; @@ -65,7 +65,7 @@ void PhotoreceptorTonemapOperation::executePixel(float output[4], int x, int y, const float m = (ntm->m > 0.0f) ? ntm->m : (0.3f + 0.7f * powf(avg->auto_key, 1.4f)); const float ic = 1.0f - ntm->c, ia = 1.0f - ntm->a; - this->m_imageReader->read(output, x, y, NULL); + this->m_imageReader->read(output, x, y, nullptr); const float L = IMB_colormanagement_get_luminance(output); float I_l = output[0] + ic * (L - output[0]); @@ -84,7 +84,7 @@ void PhotoreceptorTonemapOperation::executePixel(float output[4], int x, int y, void TonemapOperation::deinitExecution() { - this->m_imageReader = NULL; + this->m_imageReader = nullptr; delete this->m_cachedInstance; NodeOperation::deinitMutex(); } @@ -109,7 +109,7 @@ bool TonemapOperation::determineDependingAreaOfInterest(rcti * /*input*/, void *TonemapOperation::initializeTileData(rcti *rect) { lockMutex(); - if (this->m_cachedInstance == NULL) { + if (this->m_cachedInstance == nullptr) { MemoryBuffer *tile = (MemoryBuffer *)this->m_imageReader->initializeTileData(rect); AvgLogLum *data = new AvgLogLum(); diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.cpp b/source/blender/compositor/operations/COM_TrackPositionOperation.cpp index eca87a7b5a3..ddabfb7cf6c 100644 --- a/source/blender/compositor/operations/COM_TrackPositionOperation.cpp +++ b/source/blender/compositor/operations/COM_TrackPositionOperation.cpp @@ -31,7 +31,7 @@ TrackPositionOperation::TrackPositionOperation() { this->addOutputSocket(COM_DT_VALUE); - this->m_movieClip = NULL; + this->m_movieClip = nullptr; this->m_framenumber = 0; this->m_trackingObjectName[0] = 0; this->m_trackName[0] = 0; @@ -43,7 +43,7 @@ TrackPositionOperation::TrackPositionOperation() void TrackPositionOperation::initExecution() { - MovieTracking *tracking = NULL; + MovieTracking *tracking = nullptr; MovieClipUser user = {0}; MovieTrackingObject *object; @@ -79,7 +79,7 @@ void TrackPositionOperation::initExecution() this->m_relativeFrame); marker = BKE_tracking_marker_get_exact(track, relative_clip_framenr); - if (marker != NULL && (marker->flag & MARKER_DISABLED) == 0) { + if (marker != nullptr && (marker->flag & MARKER_DISABLED) == 0) { copy_v2_v2(this->m_relativePos, marker->pos); } else { diff --git a/source/blender/compositor/operations/COM_TranslateOperation.cpp b/source/blender/compositor/operations/COM_TranslateOperation.cpp index e92d1034e25..286004cd49b 100644 --- a/source/blender/compositor/operations/COM_TranslateOperation.cpp +++ b/source/blender/compositor/operations/COM_TranslateOperation.cpp @@ -25,9 +25,9 @@ TranslateOperation::TranslateOperation() this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); this->setResolutionInputSocketIndex(0); - this->m_inputOperation = NULL; - this->m_inputXOperation = NULL; - this->m_inputYOperation = NULL; + this->m_inputOperation = nullptr; + this->m_inputXOperation = nullptr; + this->m_inputYOperation = nullptr; this->m_isDeltaSet = false; this->m_factorX = 1.0f; this->m_factorY = 1.0f; @@ -41,9 +41,9 @@ void TranslateOperation::initExecution() void TranslateOperation::deinitExecution() { - this->m_inputOperation = NULL; - this->m_inputXOperation = NULL; - this->m_inputYOperation = NULL; + this->m_inputOperation = nullptr; + this->m_inputXOperation = nullptr; + this->m_inputYOperation = nullptr; } void TranslateOperation::executePixelSampled(float output[4], diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp index afc318a0c5b..414b5bd980a 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp @@ -35,9 +35,9 @@ VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation() this->setComplex(true); this->setOpenCL(true); - this->m_inputProgram = NULL; - this->m_inputBokehProgram = NULL; - this->m_inputSizeProgram = NULL; + this->m_inputProgram = nullptr; + this->m_inputBokehProgram = nullptr; + this->m_inputSizeProgram = nullptr; this->m_maxBlur = 32.0f; this->m_threshold = 1.0f; this->m_do_size_scale = false; @@ -188,7 +188,7 @@ void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice *device, list<cl_mem> *clMemToCleanUp, list<cl_kernel> * /*clKernelsToCleanUp*/) { - cl_kernel defocusKernel = device->COM_clCreateKernel("defocusKernel", NULL); + cl_kernel defocusKernel = device->COM_clCreateKernel("defocusKernel", nullptr); cl_int step = this->getStep(); cl_int maxBlur; @@ -221,9 +221,9 @@ void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice *device, void VariableSizeBokehBlurOperation::deinitExecution() { - this->m_inputProgram = NULL; - this->m_inputBokehProgram = NULL; - this->m_inputSizeProgram = NULL; + this->m_inputProgram = nullptr; + this->m_inputBokehProgram = nullptr; + this->m_inputSizeProgram = nullptr; #ifdef COM_DEFOCUS_SEARCH this->m_inputSearchProgram = NULL; #endif diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp index 4f41a60f3c3..0776c97563e 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp @@ -49,11 +49,11 @@ VectorBlurOperation::VectorBlurOperation() this->addInputSocket(COM_DT_VALUE); // ZBUF this->addInputSocket(COM_DT_COLOR); // SPEED this->addOutputSocket(COM_DT_COLOR); - this->m_settings = NULL; - this->m_cachedInstance = NULL; - this->m_inputImageProgram = NULL; - this->m_inputSpeedProgram = NULL; - this->m_inputZProgram = NULL; + this->m_settings = nullptr; + this->m_cachedInstance = nullptr; + this->m_inputImageProgram = nullptr; + this->m_inputSpeedProgram = nullptr; + this->m_inputZProgram = nullptr; setComplex(true); } void VectorBlurOperation::initExecution() @@ -62,7 +62,7 @@ void VectorBlurOperation::initExecution() this->m_inputImageProgram = getInputSocketReader(0); this->m_inputZProgram = getInputSocketReader(1); this->m_inputSpeedProgram = getInputSocketReader(2); - this->m_cachedInstance = NULL; + this->m_cachedInstance = nullptr; QualityStepHelper::initExecution(COM_QH_INCREASE); } @@ -76,12 +76,12 @@ void VectorBlurOperation::executePixel(float output[4], int x, int y, void *data void VectorBlurOperation::deinitExecution() { deinitMutex(); - this->m_inputImageProgram = NULL; - this->m_inputSpeedProgram = NULL; - this->m_inputZProgram = NULL; + this->m_inputImageProgram = nullptr; + this->m_inputSpeedProgram = nullptr; + this->m_inputZProgram = nullptr; if (this->m_cachedInstance) { MEM_freeN(this->m_cachedInstance); - this->m_cachedInstance = NULL; + this->m_cachedInstance = nullptr; } } void *VectorBlurOperation::initializeTileData(rcti *rect) @@ -91,7 +91,7 @@ void *VectorBlurOperation::initializeTileData(rcti *rect) } lockMutex(); - if (this->m_cachedInstance == NULL) { + if (this->m_cachedInstance == nullptr) { MemoryBuffer *tile = (MemoryBuffer *)this->m_inputImageProgram->initializeTileData(rect); MemoryBuffer *speed = (MemoryBuffer *)this->m_inputSpeedProgram->initializeTileData(rect); MemoryBuffer *z = (MemoryBuffer *)this->m_inputZProgram->initializeTileData(rect); @@ -107,7 +107,7 @@ bool VectorBlurOperation::determineDependingAreaOfInterest(rcti * /*input*/, ReadBufferOperation *readOperation, rcti *output) { - if (this->m_cachedInstance == NULL) { + if (this->m_cachedInstance == nullptr) { rcti newInput; newInput.xmax = this->getWidth(); newInput.xmin = 0; @@ -183,7 +183,7 @@ void zbuf_free_span(ZSpan *zspan) if (zspan->span2) { MEM_freeN(zspan->span2); } - zspan->span1 = zspan->span2 = NULL; + zspan->span1 = zspan->span2 = nullptr; } } @@ -192,7 +192,7 @@ static void zbuf_init_span(ZSpan *zspan) { zspan->miny1 = zspan->miny2 = zspan->recty + 1; zspan->maxy1 = zspan->maxy2 = -1; - zspan->minp1 = zspan->maxp1 = zspan->minp2 = zspan->maxp2 = NULL; + zspan->minp1 = zspan->maxp1 = zspan->minp2 = zspan->maxp2 = nullptr; } static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2]) @@ -243,7 +243,7 @@ static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2]) } /* empty span */ - if (zspan->maxp1 == NULL) { + if (zspan->maxp1 == nullptr) { span = zspan->span1; } else { /* does it complete left span? */ @@ -257,10 +257,10 @@ static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2]) if (span == zspan->span1) { // printf("left span my0 %d my2 %d\n", my0, my2); - if (zspan->minp1 == NULL || zspan->minp1[1] > minv[1]) { + if (zspan->minp1 == nullptr || zspan->minp1[1] > minv[1]) { zspan->minp1 = minv; } - if (zspan->maxp1 == NULL || zspan->maxp1[1] < maxv[1]) { + if (zspan->maxp1 == nullptr || zspan->maxp1[1] < maxv[1]) { zspan->maxp1 = maxv; } if (my0 < zspan->miny1) { @@ -272,10 +272,10 @@ static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2]) } else { // printf("right span my0 %d my2 %d\n", my0, my2); - if (zspan->minp2 == NULL || zspan->minp2[1] > minv[1]) { + if (zspan->minp2 == nullptr || zspan->minp2[1] > minv[1]) { zspan->minp2 = minv; } - if (zspan->maxp2 == NULL || zspan->maxp2[1] < maxv[1]) { + if (zspan->maxp2 == nullptr || zspan->maxp2[1] < maxv[1]) { zspan->maxp2 = maxv; } if (my0 < zspan->miny2) { @@ -321,7 +321,7 @@ static void zbuf_fill_in_rgba( zbuf_add_to_span(zspan, v4, v1); /* clipped */ - if (zspan->minp2 == NULL || zspan->maxp2 == NULL) { + if (zspan->minp2 == nullptr || zspan->maxp2 == nullptr) { return; } @@ -554,7 +554,7 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd, float v1[3], v2[3], v3[3], v4[3], fx, fy; const float *dimg, *dz, *ro; float *rectvz, *dvz, *dvec1, *dvec2, *dz1, *dz2, *rectz; - float *minvecbufrect = NULL, *rectweight, *rw, *rectmax, *rm; + float *minvecbufrect = nullptr, *rectweight, *rw, *rectmax, *rm; float maxspeedsq = (float)nbd->maxspeed * nbd->maxspeed; int y, x, step, maxspeed = nbd->maxspeed, samples = nbd->samples; int tsktsk = 0; @@ -747,7 +747,7 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd, float blendfac, ipodata[4]; /* clear zbuf, if we draw future we fill in not moving pixels */ - if (0) { + if (false) { for (x = xsize * ysize - 1; x >= 0; x--) { rectz[x] = 10e16; } @@ -765,7 +765,7 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd, /* clear drawing buffer */ for (x = xsize * ysize - 1; x >= 0; x--) { - rectdraw[x].colpoin = NULL; + rectdraw[x].colpoin = nullptr; } dimg = imgrect; diff --git a/source/blender/compositor/operations/COM_VectorCurveOperation.cpp b/source/blender/compositor/operations/COM_VectorCurveOperation.cpp index a78a8c47ea3..a883237f870 100644 --- a/source/blender/compositor/operations/COM_VectorCurveOperation.cpp +++ b/source/blender/compositor/operations/COM_VectorCurveOperation.cpp @@ -25,7 +25,7 @@ VectorCurveOperation::VectorCurveOperation() this->addInputSocket(COM_DT_VECTOR); this->addOutputSocket(COM_DT_VECTOR); - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; } void VectorCurveOperation::initExecution() { @@ -48,5 +48,5 @@ void VectorCurveOperation::executePixelSampled(float output[4], void VectorCurveOperation::deinitExecution() { CurveBaseOperation::deinitExecution(); - this->m_inputProgram = NULL; + this->m_inputProgram = nullptr; } diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp index 254d6975bee..025dde8e866 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cpp +++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp @@ -34,25 +34,25 @@ ViewerOperation::ViewerOperation() { - this->setImage(NULL); - this->setImageUser(NULL); - this->m_outputBuffer = NULL; - this->m_depthBuffer = NULL; + this->setImage(nullptr); + this->setImageUser(nullptr); + this->m_outputBuffer = nullptr; + this->m_depthBuffer = nullptr; this->m_active = false; this->m_doDepthBuffer = false; - this->m_viewSettings = NULL; - this->m_displaySettings = NULL; + this->m_viewSettings = nullptr; + this->m_displaySettings = nullptr; this->m_useAlphaInput = false; this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); - this->m_imageInput = NULL; - this->m_alphaInput = NULL; - this->m_depthInput = NULL; - this->m_rd = NULL; - this->m_viewName = NULL; + this->m_imageInput = nullptr; + this->m_alphaInput = nullptr; + this->m_depthInput = nullptr; + this->m_rd = nullptr; + this->m_viewName = nullptr; } void ViewerOperation::initExecution() @@ -61,7 +61,7 @@ void ViewerOperation::initExecution() this->m_imageInput = getInputSocketReader(0); this->m_alphaInput = getInputSocketReader(1); this->m_depthInput = getInputSocketReader(2); - this->m_doDepthBuffer = (this->m_depthInput != NULL); + this->m_doDepthBuffer = (this->m_depthInput != nullptr); if (isActiveViewerOutput()) { initImage(); @@ -70,10 +70,10 @@ void ViewerOperation::initExecution() void ViewerOperation::deinitExecution() { - this->m_imageInput = NULL; - this->m_alphaInput = NULL; - this->m_depthInput = NULL; - this->m_outputBuffer = NULL; + this->m_imageInput = nullptr; + this->m_alphaInput = nullptr; + this->m_depthInput = nullptr; + this->m_outputBuffer = nullptr; } void ViewerOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) @@ -180,7 +180,7 @@ void ViewerOperation::updateImage(rcti *rect) { IMB_partial_display_buffer_update(this->m_ibuf, this->m_outputBuffer, - NULL, + nullptr, getWidth(), 0, 0, diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp index 883dd48ccfe..574978e5a5f 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp @@ -26,13 +26,13 @@ WriteBufferOperation::WriteBufferOperation(DataType datatype) this->addInputSocket(datatype); this->m_memoryProxy = new MemoryProxy(datatype); this->m_memoryProxy->setWriteBufferOperation(this); - this->m_memoryProxy->setExecutor(NULL); + this->m_memoryProxy->setExecutor(nullptr); } WriteBufferOperation::~WriteBufferOperation() { if (this->m_memoryProxy) { delete this->m_memoryProxy; - this->m_memoryProxy = NULL; + this->m_memoryProxy = nullptr; } } @@ -52,7 +52,7 @@ void WriteBufferOperation::initExecution() void WriteBufferOperation::deinitExecution() { - this->m_input = NULL; + this->m_input = nullptr; this->m_memoryProxy->free(); } @@ -82,7 +82,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/ } if (data) { this->m_input->deinitializeTileData(rect, data); - data = NULL; + data = nullptr; } } else { @@ -175,8 +175,8 @@ void WriteBufferOperation::executeOpenCLRegion(OpenCLDevice *device, 0, outputFloatBuffer, 0, - NULL, - NULL); + nullptr, + nullptr); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.cpp b/source/blender/compositor/operations/COM_ZCombineOperation.cpp index 935272e0dbe..22a37a4583e 100644 --- a/source/blender/compositor/operations/COM_ZCombineOperation.cpp +++ b/source/blender/compositor/operations/COM_ZCombineOperation.cpp @@ -27,10 +27,10 @@ ZCombineOperation::ZCombineOperation() this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); - this->m_image1Reader = NULL; - this->m_depth1Reader = NULL; - this->m_image2Reader = NULL; - this->m_depth2Reader = NULL; + this->m_image1Reader = nullptr; + this->m_depth1Reader = nullptr; + this->m_image2Reader = nullptr; + this->m_depth2Reader = nullptr; } void ZCombineOperation::initExecution() @@ -88,10 +88,10 @@ void ZCombineAlphaOperation::executePixelSampled(float output[4], void ZCombineOperation::deinitExecution() { - this->m_image1Reader = NULL; - this->m_depth1Reader = NULL; - this->m_image2Reader = NULL; - this->m_depth2Reader = NULL; + this->m_image1Reader = nullptr; + this->m_depth1Reader = nullptr; + this->m_image2Reader = nullptr; + this->m_depth2Reader = nullptr; } // MASK combine @@ -102,9 +102,9 @@ ZCombineMaskOperation::ZCombineMaskOperation() this->addInputSocket(COM_DT_COLOR); this->addOutputSocket(COM_DT_COLOR); - this->m_maskReader = NULL; - this->m_image1Reader = NULL; - this->m_image2Reader = NULL; + this->m_maskReader = nullptr; + this->m_image1Reader = nullptr; + this->m_image2Reader = nullptr; } void ZCombineMaskOperation::initExecution() @@ -154,7 +154,7 @@ void ZCombineMaskAlphaOperation::executePixelSampled(float output[4], void ZCombineMaskOperation::deinitExecution() { - this->m_image1Reader = NULL; - this->m_maskReader = NULL; - this->m_image2Reader = NULL; + this->m_image1Reader = nullptr; + this->m_maskReader = nullptr; + this->m_image2Reader = nullptr; } diff --git a/source/blender/depsgraph/intern/builder/deg_builder.cc b/source/blender/depsgraph/intern/builder/deg_builder.cc index 39de6054615..e4660c34762 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder.cc @@ -50,8 +50,7 @@ #include "DEG_depsgraph.h" -namespace blender { -namespace deg { +namespace blender::deg { bool deg_check_id_in_depsgraph(const Depsgraph *graph, ID *id_orig) { @@ -241,5 +240,4 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph) } } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_cache.cc b/source/blender/depsgraph/intern/builder/deg_builder_cache.cc index 717239d7c64..df108072142 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_cache.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_cache.cc @@ -31,8 +31,7 @@ #include "BKE_animsys.h" -namespace blender { -namespace deg { +namespace blender::deg { /* Animated property storage. */ @@ -178,5 +177,4 @@ AnimatedPropertyStorage *DepsgraphBuilderCache::ensureInitializedAnimatedPropert return animated_property_storage; } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc b/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc index 6fb11c5b91e..dbc8bbd31fa 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc @@ -37,8 +37,7 @@ #include "intern/depsgraph.h" #include "intern/depsgraph_relation.h" -namespace blender { -namespace deg { +namespace blender::deg { namespace { @@ -235,5 +234,4 @@ void deg_graph_detect_cycles(Depsgraph *graph) } } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_map.cc b/source/blender/depsgraph/intern/builder/deg_builder_map.cc index e605e83a862..5da54350cfc 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_map.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_map.cc @@ -25,8 +25,7 @@ #include "DNA_ID.h" -namespace blender { -namespace deg { +namespace blender::deg { BuilderMap::BuilderMap() { @@ -59,5 +58,4 @@ int BuilderMap::getIDTag(ID *id) const return id_tags_.lookup_default(id, 0); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index a04a33d8cfa..9cae343dcde 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -120,8 +120,7 @@ #include "intern/node/deg_node_id.h" #include "intern/node/deg_node_operation.h" -namespace blender { -namespace deg { +namespace blender::deg { /* ************ */ /* Node Builder */ @@ -1930,5 +1929,4 @@ void DepsgraphNodeBuilder::constraint_walk(bConstraint * /*con*/, } } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc index 62282ac4d37..67a68f718fe 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc @@ -54,8 +54,7 @@ #include "intern/node/deg_node_component.h" #include "intern/node/deg_node_operation.h" -namespace blender { -namespace deg { +namespace blender::deg { void DepsgraphNodeBuilder::build_pose_constraints(Object *object, bPoseChannel *pchan, @@ -345,5 +344,4 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object, bool is_object_visibl op_node->set_as_exit(); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc index fd457e0b2bf..21a32b0d005 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc @@ -25,8 +25,7 @@ #include "DNA_scene_types.h" -namespace blender { -namespace deg { +namespace blender::deg { void DepsgraphNodeBuilder::build_scene_render(Scene *scene, ViewLayer *view_layer) { @@ -88,5 +87,4 @@ void DepsgraphNodeBuilder::build_scene_compositor(Scene *scene) build_nodetree(scene->nodetree); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc index 1d6712d16ef..7a6dc6e2315 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc @@ -55,8 +55,7 @@ #include "intern/node/deg_node_component.h" #include "intern/node/deg_node_operation.h" -namespace blender { -namespace deg { +namespace blender::deg { void DepsgraphNodeBuilder::build_layer_collections(ListBase *lb) { @@ -175,5 +174,4 @@ void DepsgraphNodeBuilder::build_view_layer(Scene *scene, } } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc b/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc index 924088cbc13..4406cc83a0d 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc @@ -28,8 +28,7 @@ #include "BLI_utildefines.h" -namespace blender { -namespace deg { +namespace blender::deg { RootPChanMap::RootPChanMap() { @@ -78,5 +77,4 @@ bool RootPChanMap::has_common_root(const char *bone1, const char *bone2) const return Set<StringRefNull>::Intersects(*bone1_roots, *bone2_roots); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 40b856b1896..a55966632d8 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -120,8 +120,7 @@ #include "intern/depsgraph_relation.h" #include "intern/depsgraph_type.h" -namespace blender { -namespace deg { +namespace blender::deg { /* ***************** */ /* Relations Builder */ @@ -1234,7 +1233,7 @@ void DepsgraphRelationBuilder::build_constraints(ID *id, } } if (cti->flush_constraint_targets) { - cti->flush_constraint_targets(con, &targets, 1); + cti->flush_constraint_targets(con, &targets, true); } } } @@ -2204,7 +2203,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata) /* Layer parenting need react to the parent object transformation. */ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { - if (gpl->parent != NULL) { + if (gpl->parent != nullptr) { ComponentKey gpd_geom_key(&gpd->id, NodeType::GEOMETRY); if (gpl->partype == PARBONE) { @@ -2926,5 +2925,4 @@ void DepsgraphRelationBuilder::constraint_walk(bConstraint * /*con*/, data->builder->build_id(id); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_drivers.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_drivers.cc index 17f364118ae..b9ce29ce8d2 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_drivers.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_drivers.cc @@ -35,8 +35,7 @@ #include "intern/depsgraph_relation.h" #include "intern/node/deg_node.h" -namespace blender { -namespace deg { +namespace blender::deg { DriverDescriptor::DriverDescriptor(PointerRNA *id_ptr, FCurve *fcu) : id_ptr_(id_ptr), @@ -252,5 +251,4 @@ void DepsgraphRelationBuilder::build_driver_relations(IDNode *id_node) } } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc index 2220ba6ee13..e0a7a42ea4a 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc @@ -25,8 +25,7 @@ #include "intern/builder/deg_builder_relations.h" -namespace blender { -namespace deg { +namespace blender::deg { //////////////////////////////////////////////////////////////////////////////// // Time source. @@ -193,5 +192,4 @@ string RNAPathKey::identifier() const return string("RnaPathKey(") + "id: " + id_name + ", prop: '" + prop_name + "')"; } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc index 4c765152a2b..39a60c9029c 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -58,8 +58,7 @@ #include "intern/depsgraph_relation.h" #include "intern/depsgraph_type.h" -namespace blender { -namespace deg { +namespace blender::deg { /* IK Solver Eval Steps */ void DepsgraphRelationBuilder::build_ik_pose(Object *object, @@ -510,5 +509,4 @@ void DepsgraphRelationBuilder::build_proxy_rig(Object *object) } } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc index 703c6c7cd68..74948a336e9 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc @@ -25,8 +25,7 @@ #include "DNA_scene_types.h" -namespace blender { -namespace deg { +namespace blender::deg { void DepsgraphRelationBuilder::build_scene_render(Scene *scene, ViewLayer *view_layer) { @@ -76,5 +75,4 @@ void DepsgraphRelationBuilder::build_scene_compositor(Scene *scene) build_nodetree(scene->nodetree); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc index 6e64eba60dc..b58d4a22712 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc @@ -56,8 +56,7 @@ #include "intern/depsgraph_type.h" -namespace blender { -namespace deg { +namespace blender::deg { void DepsgraphRelationBuilder::build_layer_collections(ListBase *lb) { @@ -154,5 +153,4 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene, } } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_remove_noop.cc b/source/blender/depsgraph/intern/builder/deg_builder_remove_noop.cc index 8d51fa1422a..77d1a89c256 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_remove_noop.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_remove_noop.cc @@ -33,8 +33,7 @@ #include "intern/depsgraph_relation.h" #include "intern/depsgraph_type.h" -namespace blender { -namespace deg { +namespace blender::deg { static inline bool is_unused_noop(OperationNode *op_node) { @@ -85,5 +84,4 @@ void deg_graph_remove_unused_noops(Depsgraph *graph) (::Depsgraph *)graph, BUILD, "Removed %d relations to no-op nodes\n", num_removed_relations); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc index 442537bd79a..4064058f231 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc @@ -48,8 +48,7 @@ #include "intern/node/deg_node_id.h" #include "intern/node/deg_node_operation.h" -namespace blender { -namespace deg { +namespace blender::deg { /* ********************************* ID Data ******************************** */ @@ -400,5 +399,4 @@ RNANodeQueryIDData *RNANodeQuery::ensure_id_data(const ID *id) return id_data.get(); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna_test.cc b/source/blender/depsgraph/intern/builder/deg_builder_rna_test.cc index c91dda87190..b7a5aa7c171 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_rna_test.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_rna_test.cc @@ -25,9 +25,7 @@ #include "testing/testing.h" -namespace blender { -namespace deg { -namespace tests { +namespace blender::deg::tests { class TestableRNANodeQuery : public RNANodeQuery { public: @@ -55,6 +53,4 @@ TEST(deg_builder_rna, contains) EXPECT_FALSE(TestableRNANodeQuery::contains("pose.bone[\"location\"].scale[0]", "location")); } -} // namespace tests -} // namespace deg -} // namespace blender +} // namespace blender::deg::tests diff --git a/source/blender/depsgraph/intern/builder/deg_builder_transitive.cc b/source/blender/depsgraph/intern/builder/deg_builder_transitive.cc index c5e020b3242..c30778e7a91 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_transitive.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_transitive.cc @@ -33,8 +33,7 @@ #include "intern/depsgraph.h" #include "intern/depsgraph_relation.h" -namespace blender { -namespace deg { +namespace blender::deg { /* -------------------------------------------------- */ @@ -110,5 +109,4 @@ void deg_graph_transitive_reduction(Depsgraph *graph) DEG_DEBUG_PRINTF((::Depsgraph *)graph, BUILD, "Removed %d relations\n", num_removed_relations); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/pipeline.cc b/source/blender/depsgraph/intern/builder/pipeline.cc index 76b6f17a243..f7feeea9593 100644 --- a/source/blender/depsgraph/intern/builder/pipeline.cc +++ b/source/blender/depsgraph/intern/builder/pipeline.cc @@ -30,8 +30,7 @@ #include "deg_builder_relations.h" #include "deg_builder_transitive.h" -namespace blender { -namespace deg { +namespace blender::deg { AbstractBuilderPipeline::AbstractBuilderPipeline(::Depsgraph *graph) : deg_graph_(reinterpret_cast<Depsgraph *>(graph)), @@ -124,5 +123,4 @@ unique_ptr<DepsgraphRelationBuilder> AbstractBuilderPipeline::construct_relation return std::make_unique<DepsgraphRelationBuilder>(bmain_, deg_graph_, &builder_cache_); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/pipeline_all_objects.cc b/source/blender/depsgraph/intern/builder/pipeline_all_objects.cc index 81d239239be..d02aa16f26b 100644 --- a/source/blender/depsgraph/intern/builder/pipeline_all_objects.cc +++ b/source/blender/depsgraph/intern/builder/pipeline_all_objects.cc @@ -25,8 +25,7 @@ #include "DNA_layer_types.h" -namespace blender { -namespace deg { +namespace blender::deg { namespace { @@ -73,5 +72,4 @@ unique_ptr<DepsgraphRelationBuilder> AllObjectsBuilderPipeline::construct_relati return std::make_unique<AllObjectsRelationBuilder>(bmain_, deg_graph_, &builder_cache_); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/pipeline_compositor.cc b/source/blender/depsgraph/intern/builder/pipeline_compositor.cc index 2b9922851c1..5fa9788cf72 100644 --- a/source/blender/depsgraph/intern/builder/pipeline_compositor.cc +++ b/source/blender/depsgraph/intern/builder/pipeline_compositor.cc @@ -23,8 +23,7 @@ #include "intern/builder/deg_builder_relations.h" #include "intern/depsgraph.h" -namespace blender { -namespace deg { +namespace blender::deg { CompositorBuilderPipeline::CompositorBuilderPipeline(::Depsgraph *graph, bNodeTree *nodetree) : AbstractBuilderPipeline(graph), nodetree_(nodetree) @@ -44,5 +43,4 @@ void CompositorBuilderPipeline::build_relations(DepsgraphRelationBuilder &relati relation_builder.build_nodetree(nodetree_); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/pipeline_from_ids.cc b/source/blender/depsgraph/intern/builder/pipeline_from_ids.cc index 87cfeb46693..5fd4a0fc3dd 100644 --- a/source/blender/depsgraph/intern/builder/pipeline_from_ids.cc +++ b/source/blender/depsgraph/intern/builder/pipeline_from_ids.cc @@ -25,8 +25,7 @@ #include "intern/builder/deg_builder_relations.h" #include "intern/depsgraph.h" -namespace blender { -namespace deg { +namespace blender::deg { namespace { @@ -146,5 +145,4 @@ void FromIDsBuilderPipeline::build_relations(DepsgraphRelationBuilder &relation_ } } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/pipeline_render.cc b/source/blender/depsgraph/intern/builder/pipeline_render.cc index 3b065f7f1bc..9b40e4644a2 100644 --- a/source/blender/depsgraph/intern/builder/pipeline_render.cc +++ b/source/blender/depsgraph/intern/builder/pipeline_render.cc @@ -23,8 +23,7 @@ #include "intern/builder/deg_builder_relations.h" #include "intern/depsgraph.h" -namespace blender { -namespace deg { +namespace blender::deg { RenderBuilderPipeline::RenderBuilderPipeline(::Depsgraph *graph) : AbstractBuilderPipeline(graph) { @@ -41,5 +40,4 @@ void RenderBuilderPipeline::build_relations(DepsgraphRelationBuilder &relation_b relation_builder.build_scene_render(scene_, view_layer_); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/builder/pipeline_view_layer.cc b/source/blender/depsgraph/intern/builder/pipeline_view_layer.cc index f1852a40a10..5ae577ab031 100644 --- a/source/blender/depsgraph/intern/builder/pipeline_view_layer.cc +++ b/source/blender/depsgraph/intern/builder/pipeline_view_layer.cc @@ -23,8 +23,7 @@ #include "intern/builder/deg_builder_relations.h" #include "intern/depsgraph.h" -namespace blender { -namespace deg { +namespace blender::deg { ViewLayerBuilderPipeline::ViewLayerBuilderPipeline(::Depsgraph *graph) : AbstractBuilderPipeline(graph) @@ -41,5 +40,4 @@ void ViewLayerBuilderPipeline::build_relations(DepsgraphRelationBuilder &relatio relation_builder.build_view_layer(scene_, view_layer_, DEG_ID_LINKED_DIRECTLY); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/debug/deg_debug.cc b/source/blender/depsgraph/intern/debug/deg_debug.cc index ab6adea6416..47c97211886 100644 --- a/source/blender/depsgraph/intern/debug/deg_debug.cc +++ b/source/blender/depsgraph/intern/debug/deg_debug.cc @@ -32,8 +32,7 @@ #include "BKE_global.h" -namespace blender { -namespace deg { +namespace blender::deg { DepsgraphDebug::DepsgraphDebug() : flags(G.debug), is_ever_evaluated(false), graph_evaluation_start_time_(0) @@ -73,7 +72,7 @@ void DepsgraphDebug::end_graph_evaluation() is_ever_evaluated = true; } -bool terminal_do_color(void) +bool terminal_do_color() { return (G.debug & G_DEBUG_DEPSGRAPH_PRETTY) != 0; } @@ -90,7 +89,7 @@ string color_for_pointer(const void *pointer) return string(buffer); } -string color_end(void) +string color_end() { if (!terminal_do_color()) { return ""; @@ -98,5 +97,4 @@ string color_end(void) return string(TRUECOLOR_ANSI_COLOR_FINISH); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc index 04b25a36d6d..a0cbbbc163d 100644 --- a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc +++ b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc @@ -47,8 +47,7 @@ namespace dot = blender::dot; /* ****************** */ /* Graphviz Debugging */ -namespace blender { -namespace deg { +namespace blender::deg { /* Only one should be enabled, defines whether graphviz nodes * get colored by individual types or classes. @@ -510,8 +509,7 @@ static void deg_debug_graphviz_graph_relations(DotExportContext &ctx, const Deps } } -} // namespace deg -} // namespace blender +} // namespace blender::deg void DEG_debug_relations_graphviz(const Depsgraph *graph, FILE *fp, const char *label) { diff --git a/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc b/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc index 42c1fcba1bb..0cdd627dd44 100644 --- a/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc +++ b/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc @@ -38,8 +38,7 @@ namespace deg = blender::deg; -namespace blender { -namespace deg { +namespace blender::deg { namespace { struct DebugContext { @@ -149,8 +148,7 @@ void deg_debug_stats_gnuplot(const DebugContext &ctx) } } // namespace -} // namespace deg -} // namespace blender +} // namespace blender::deg void DEG_debug_stats_gnuplot(const Depsgraph *depsgraph, FILE *fp, diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc index 99804a7cd7d..870a6d3fce8 100644 --- a/source/blender/depsgraph/intern/depsgraph.cc +++ b/source/blender/depsgraph/intern/depsgraph.cc @@ -57,8 +57,7 @@ namespace deg = blender::deg; -namespace blender { -namespace deg { +namespace blender::deg { Depsgraph::Depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluationMode mode) : time_source(nullptr), @@ -263,8 +262,7 @@ ID *Depsgraph::get_cow_id(const ID *id_orig) const return id_node->id_cow; } -} // namespace deg -} // namespace blender +} // namespace blender::deg /* **************** */ /* Public Graph API */ @@ -287,7 +285,7 @@ void DEG_graph_replace_owners(struct Depsgraph *depsgraph, deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(depsgraph); const bool do_update_register = deg_graph->bmain != bmain; - if (do_update_register && deg_graph->bmain != NULL) { + if (do_update_register && deg_graph->bmain != nullptr) { deg::unregister_graph(deg_graph); } diff --git a/source/blender/depsgraph/intern/depsgraph_physics.cc b/source/blender/depsgraph/intern/depsgraph_physics.cc index 0b8203ab05f..8f3aab19e37 100644 --- a/source/blender/depsgraph/intern/depsgraph_physics.cc +++ b/source/blender/depsgraph/intern/depsgraph_physics.cc @@ -174,8 +174,7 @@ void DEG_add_forcefield_relations(DepsNodeHandle *handle, /******************************** Internal API ********************************/ -namespace blender { -namespace deg { +namespace blender::deg { ListBase *build_effector_relations(Depsgraph *graph, Collection *collection) { @@ -245,5 +244,4 @@ void clear_physics_relations(Depsgraph *graph) } } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/depsgraph_query_foreach.cc b/source/blender/depsgraph/intern/depsgraph_query_foreach.cc index ebdd08ce519..ed7011ba306 100644 --- a/source/blender/depsgraph/intern/depsgraph_query_foreach.cc +++ b/source/blender/depsgraph/intern/depsgraph_query_foreach.cc @@ -44,8 +44,7 @@ namespace deg = blender::deg; /* ************************ DEG TRAVERSAL ********************* */ -namespace blender { -namespace deg { +namespace blender::deg { namespace { typedef deque<OperationNode *> TraversalQueue; @@ -265,8 +264,7 @@ void deg_foreach_id(const Depsgraph *depsgraph, DEGForeachIDCallback callback, v } } // namespace -} // namespace deg -} // namespace blender +} // namespace blender::deg void DEG_foreach_dependent_ID(const Depsgraph *depsgraph, const ID *id, diff --git a/source/blender/depsgraph/intern/depsgraph_registry.cc b/source/blender/depsgraph/intern/depsgraph_registry.cc index 623702ee3ae..f348ef6e6e9 100644 --- a/source/blender/depsgraph/intern/depsgraph_registry.cc +++ b/source/blender/depsgraph/intern/depsgraph_registry.cc @@ -27,8 +27,7 @@ #include "intern/depsgraph.h" -namespace blender { -namespace deg { +namespace blender::deg { using GraphRegistry = Map<Main *, VectorSet<Depsgraph *>>; static GraphRegistry &get_graph_registry() @@ -65,5 +64,4 @@ Span<Depsgraph *> get_all_registered_graphs(Main *bmain) return {}; } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/depsgraph_relation.cc b/source/blender/depsgraph/intern/depsgraph_relation.cc index d09247b03d9..904a6b56ae9 100644 --- a/source/blender/depsgraph/intern/depsgraph_relation.cc +++ b/source/blender/depsgraph/intern/depsgraph_relation.cc @@ -28,8 +28,7 @@ #include "intern/depsgraph_type.h" #include "intern/node/deg_node.h" -namespace blender { -namespace deg { +namespace blender::deg { Relation::Relation(Node *from, Node *to, const char *description) : from(from), to(to), name(description), flag(0) @@ -65,5 +64,4 @@ void Relation::unlink() to->inlinks.remove_first_occurrence_and_reorder(this); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index 8055e65595b..aec3dd4b9ea 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -73,8 +73,7 @@ namespace deg = blender::deg; /* *********************** */ /* Update Tagging/Flushing */ -namespace blender { -namespace deg { +namespace blender::deg { namespace { @@ -617,7 +616,7 @@ void id_tag_update(Main *bmain, ID *id, int flag, eUpdateSource update_source) /* Accumulate all tags for an ID between two undo steps, so they can be * replayed for undo. */ - id->recalc_after_undo_push |= deg_recalc_flags_effective(NULL, flag); + id->recalc_after_undo_push |= deg_recalc_flags_effective(nullptr, flag); } void graph_id_tag_update( @@ -676,8 +675,7 @@ void graph_id_tag_update( } } -} // namespace deg -} // namespace blender +} // namespace blender::deg const char *DEG_update_tag_as_string(IDRecalcFlag flag) { diff --git a/source/blender/depsgraph/intern/depsgraph_update.cc b/source/blender/depsgraph/intern/depsgraph_update.cc index 98ff136f7bc..bb72320ca67 100644 --- a/source/blender/depsgraph/intern/depsgraph_update.cc +++ b/source/blender/depsgraph/intern/depsgraph_update.cc @@ -29,8 +29,7 @@ namespace deg = blender::deg; -namespace blender { -namespace deg { +namespace blender::deg { static DEG_EditorUpdateIDCb deg_editor_update_id_cb = nullptr; static DEG_EditorUpdateSceneCb deg_editor_update_scene_cb = nullptr; @@ -49,8 +48,7 @@ void deg_editors_scene_update(const DEGEditorUpdateContext *update_ctx, bool upd } } -} // namespace deg -} // namespace blender +} // namespace blender::deg /* Set callbacks which are being called when depsgraph changes. */ void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func, DEG_EditorUpdateSceneCb scene_func) diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc index 2c4b7f03db5..620e86550cc 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval.cc @@ -54,8 +54,7 @@ #include "intern/node/deg_node_operation.h" #include "intern/node/deg_node_time.h" -namespace blender { -namespace deg { +namespace blender::deg { namespace { @@ -71,7 +70,7 @@ void schedule_children(DepsgraphEvalState *state, void schedule_node_to_pool(OperationNode *node, const int UNUSED(thread_id), TaskPool *pool) { - BLI_task_pool_push(pool, deg_task_run_func, node, false, NULL); + BLI_task_pool_push(pool, deg_task_run_func, node, false, nullptr); } /* Denotes which part of dependency graph is being evaluated. */ @@ -416,5 +415,4 @@ void deg_evaluate_on_refresh(Depsgraph *graph) graph->debug.end_graph_evaluation(); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index 0a92cdb2e64..cff7292abd4 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -101,8 +101,7 @@ #include "intern/node/deg_node.h" #include "intern/node/deg_node_id.h" -namespace blender { -namespace deg { +namespace blender::deg { #define DEBUG_PRINT \ if (G.debug & G_DEBUG_DEPSGRAPH_EVAL) \ @@ -305,7 +304,7 @@ bool id_copy_inplace_no_main(const ID *id, ID *newid) bool result = (BKE_id_copy_ex(nullptr, (ID *)id_for_copy, &newid, - LIB_ID_COPY_LOCALIZE | LIB_ID_CREATE_NO_ALLOCATE) != NULL); + LIB_ID_COPY_LOCALIZE | LIB_ID_CREATE_NO_ALLOCATE) != nullptr); #ifdef NESTED_ID_NASTY_WORKAROUND if (result) { @@ -334,7 +333,7 @@ bool scene_copy_inplace_no_main(const Scene *scene, Scene *new_scene) bool result = (BKE_id_copy_ex(nullptr, id_for_copy, (ID **)&new_scene, - LIB_ID_COPY_LOCALIZE | LIB_ID_CREATE_NO_ALLOCATE) != NULL); + LIB_ID_COPY_LOCALIZE | LIB_ID_CREATE_NO_ALLOCATE) != nullptr); #ifdef NESTED_ID_NASTY_WORKAROUND if (result) { @@ -1127,5 +1126,4 @@ bool deg_copy_on_write_is_needed(const ID_Type id_type) return ID_TYPE_IS_COW(id_type); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc index 73e35b4c77a..fa7cfb305ee 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc @@ -69,8 +69,7 @@ // catch usage of invalid state. #undef INVALIDATE_ON_FLUSH -namespace blender { -namespace deg { +namespace blender::deg { enum { ID_STATE_NONE = 0, @@ -410,5 +409,4 @@ void deg_graph_clear_tags(Depsgraph *graph) graph->time_source->tagged_for_update = false; } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.cc index f3d9422a88b..7a0c1b5b693 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup.cc @@ -29,8 +29,7 @@ #include "DRW_engine.h" -namespace blender { -namespace deg { +namespace blender::deg { RuntimeBackup::RuntimeBackup(const Depsgraph *depsgraph) : have_backup(false), @@ -117,5 +116,4 @@ void RuntimeBackup::restore_to_id(ID *id) } } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc index 6c4eb8a91ee..3c0df93f4b9 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc @@ -32,8 +32,7 @@ #include "intern/depsgraph.h" -namespace blender { -namespace deg { +namespace blender::deg { namespace { @@ -142,5 +141,4 @@ void AnimationBackup::restore_to_id(ID *id) } } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_modifier.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_modifier.cc index 25bcf2bfe72..0594b8a11b6 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_modifier.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_modifier.cc @@ -25,13 +25,11 @@ #include "DNA_modifier_types.h" -namespace blender { -namespace deg { +namespace blender::deg { ModifierDataBackup::ModifierDataBackup(ModifierData *modifier_data) : type(static_cast<ModifierType>(modifier_data->type)), runtime(modifier_data->runtime) { } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_movieclip.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_movieclip.cc index 9d3740258cc..3ee0d018782 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_movieclip.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_movieclip.cc @@ -27,8 +27,7 @@ #include "BLI_utildefines.h" -namespace blender { -namespace deg { +namespace blender::deg { MovieClipBackup::MovieClipBackup(const Depsgraph * /*depsgraph*/) { @@ -59,5 +58,4 @@ void MovieClipBackup::restore_to_movieclip(MovieClip *movieclip) reset(); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_object.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_object.cc index addee3dc539..61299a2d49c 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_object.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_object.cc @@ -32,8 +32,7 @@ #include "BKE_action.h" #include "BKE_object.h" -namespace blender { -namespace deg { +namespace blender::deg { ObjectRuntimeBackup::ObjectRuntimeBackup(const Depsgraph * /*depsgraph*/) : base_flag(0), base_local_view_bits(0) @@ -180,5 +179,4 @@ void ObjectRuntimeBackup::restore_pose_channel_runtime_data(Object *object) } } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_pose.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_pose.cc index 45663378f67..e99d18b442d 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_pose.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_pose.cc @@ -22,9 +22,3 @@ */ #include "intern/eval/deg_eval_runtime_backup_pose.h" - -namespace blender { -namespace deg { - -} -} // namespace blender diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_scene.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_scene.cc index f000c8b5d4d..96a82c24778 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_scene.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_scene.cc @@ -28,8 +28,7 @@ #include "DNA_rigidbody_types.h" #include "DNA_scene_types.h" -namespace blender { -namespace deg { +namespace blender::deg { SceneBackup::SceneBackup(const Depsgraph *depsgraph) : sequencer_backup(depsgraph) { @@ -86,5 +85,4 @@ void SceneBackup::restore_to_scene(Scene *scene) reset(); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequence.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequence.cc index 3866a89cc17..35720140f97 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequence.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequence.cc @@ -25,8 +25,7 @@ #include "DNA_sequence_types.h" -namespace blender { -namespace deg { +namespace blender::deg { SequenceBackup::SequenceBackup(const Depsgraph * /*depsgraph*/) { @@ -56,5 +55,4 @@ bool SequenceBackup::isEmpty() const return (scene_sound == nullptr); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc index 314254c0cf6..c0e284a930e 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc @@ -32,8 +32,7 @@ #include "SEQ_sequencer.h" -namespace blender { -namespace deg { +namespace blender::deg { SequencerBackup::SequencerBackup(const Depsgraph *depsgraph) : depsgraph(depsgraph) { @@ -74,5 +73,4 @@ void SequencerBackup::restore_to_scene(Scene *scene) } } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sound.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sound.cc index 4b63ada8bde..d05245a1c28 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sound.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sound.cc @@ -27,8 +27,7 @@ #include "DNA_sound_types.h" -namespace blender { -namespace deg { +namespace blender::deg { SoundBackup::SoundBackup(const Depsgraph * /*depsgraph*/) { @@ -62,5 +61,4 @@ void SoundBackup::restore_to_sound(bSound *sound) reset(); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_volume.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_volume.cc index 8808673ce6a..8e9fff56023 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_volume.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_volume.cc @@ -33,8 +33,7 @@ #include <stdio.h> -namespace blender { -namespace deg { +namespace blender::deg { VolumeBackup::VolumeBackup(const Depsgraph * /*depsgraph*/) : grids(nullptr) { @@ -58,5 +57,4 @@ void VolumeBackup::restore_to_volume(Volume *volume) } } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/eval/deg_eval_stats.cc b/source/blender/depsgraph/intern/eval/deg_eval_stats.cc index 3c84c781cbb..fb627fa69c5 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_stats.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_stats.cc @@ -32,8 +32,7 @@ #include "intern/node/deg_node_id.h" #include "intern/node/deg_node_operation.h" -namespace blender { -namespace deg { +namespace blender::deg { void deg_eval_stats_aggregate(Depsgraph *graph) { @@ -55,5 +54,4 @@ void deg_eval_stats_aggregate(Depsgraph *graph) } } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/node/deg_node.cc b/source/blender/depsgraph/intern/node/deg_node.cc index 87843006347..6266acae651 100644 --- a/source/blender/depsgraph/intern/node/deg_node.cc +++ b/source/blender/depsgraph/intern/node/deg_node.cc @@ -36,8 +36,7 @@ #include "intern/node/deg_node_operation.h" #include "intern/node/deg_node_time.h" -namespace blender { -namespace deg { +namespace blender::deg { const char *nodeClassAsString(NodeClass node_class) { @@ -340,5 +339,4 @@ void deg_register_base_depsnodes() register_node_typeinfo(&DNTI_ID_REF); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/node/deg_node_component.cc b/source/blender/depsgraph/intern/node/deg_node_component.cc index 2767513d6df..6ffe5db3fec 100644 --- a/source/blender/depsgraph/intern/node/deg_node_component.cc +++ b/source/blender/depsgraph/intern/node/deg_node_component.cc @@ -38,8 +38,7 @@ #include "intern/node/deg_node_id.h" #include "intern/node/deg_node_operation.h" -namespace blender { -namespace deg { +namespace blender::deg { /* *********** */ /* Outer Nodes */ @@ -376,5 +375,4 @@ void deg_register_component_depsnodes() register_node_typeinfo(&DNTI_SIMULATION); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/node/deg_node_factory.cc b/source/blender/depsgraph/intern/node/deg_node_factory.cc index 9bb093139a1..209178f4b73 100644 --- a/source/blender/depsgraph/intern/node/deg_node_factory.cc +++ b/source/blender/depsgraph/intern/node/deg_node_factory.cc @@ -23,8 +23,7 @@ #include "intern/node/deg_node_factory.h" -namespace blender { -namespace deg { +namespace blender::deg { /* Global type registry */ static DepsNodeFactory *node_typeinfo_registry[static_cast<int>(NodeType::NUM_TYPES)] = {nullptr}; @@ -43,5 +42,4 @@ DepsNodeFactory *type_get_factory(const NodeType type) return node_typeinfo_registry[type_as_int]; } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/node/deg_node_id.cc b/source/blender/depsgraph/intern/node/deg_node_id.cc index 53269544afa..345da466960 100644 --- a/source/blender/depsgraph/intern/node/deg_node_id.cc +++ b/source/blender/depsgraph/intern/node/deg_node_id.cc @@ -41,8 +41,7 @@ #include "intern/node/deg_node_factory.h" #include "intern/node/deg_node_time.h" -namespace blender { -namespace deg { +namespace blender::deg { const char *linkedStateAsString(eDepsNode_LinkedState_Type linked_state) { @@ -213,5 +212,4 @@ IDComponentsMask IDNode::get_visible_components_mask() const return result; } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/node/deg_node_operation.cc b/source/blender/depsgraph/intern/node/deg_node_operation.cc index a32a43e2905..97aca6280be 100644 --- a/source/blender/depsgraph/intern/node/deg_node_operation.cc +++ b/source/blender/depsgraph/intern/node/deg_node_operation.cc @@ -32,8 +32,7 @@ #include "intern/node/deg_node_factory.h" #include "intern/node/deg_node_id.h" -namespace blender { -namespace deg { +namespace blender::deg { const char *operationCodeAsString(OperationCode opcode) { @@ -273,5 +272,4 @@ void deg_register_operation_depsnodes() register_node_typeinfo(&DNTI_OPERATION); } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/depsgraph/intern/node/deg_node_time.cc b/source/blender/depsgraph/intern/node/deg_node_time.cc index 4f7f70fef33..59ac4bd3d08 100644 --- a/source/blender/depsgraph/intern/node/deg_node_time.cc +++ b/source/blender/depsgraph/intern/node/deg_node_time.cc @@ -28,8 +28,7 @@ #include "intern/depsgraph.h" #include "intern/depsgraph_relation.h" -namespace blender { -namespace deg { +namespace blender::deg { void TimeSourceNode::tag_update(Depsgraph * /*graph*/, eUpdateSource /*source*/) { @@ -47,5 +46,4 @@ void TimeSourceNode::flush_update_tag(Depsgraph *graph) } } -} // namespace deg -} // namespace blender +} // namespace blender::deg diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt index 4e72e89ae99..cefd52db66c 100644 --- a/source/blender/draw/CMakeLists.txt +++ b/source/blender/draw/CMakeLists.txt @@ -25,6 +25,7 @@ set(INC ../blenfont ../blenkernel ../blenlib + ../blenloader ../blentranslation ../bmesh ../depsgraph @@ -35,13 +36,16 @@ set(INC ../makesdna ../makesrna ../nodes - ../render/extern/include - ../render/intern/include + ../render + ../render/intern ../windowmanager ../../../intern/atomic ../../../intern/glew-mx ../../../intern/guardedalloc + + # dna_type_offsets.h + ${CMAKE_CURRENT_BINARY_DIR}/../makesdna/intern ) set(SRC @@ -446,6 +450,9 @@ endif() blender_add_lib(bf_draw "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") +# Needed so we can use dna_type_offsets.h for defaults initialization. +add_dependencies(bf_draw bf_dna) + if(WITH_GTESTS) if(WITH_OPENGL_DRAW_TESTS) set(TEST_SRC diff --git a/source/blender/draw/engines/eevee/eevee_effects.c b/source/blender/draw/engines/eevee/eevee_effects.c index 3b2a3cc7c01..ca583143572 100644 --- a/source/blender/draw/engines/eevee/eevee_effects.c +++ b/source/blender/draw/engines/eevee/eevee_effects.c @@ -87,6 +87,10 @@ void EEVEE_effects_init(EEVEE_ViewLayerData *sldata, stl->effects->taa_render_sample = 1; } + /* WORKAROUND: EEVEE_lookdev_init can reset TAA and needs a stl->effect. + * So putting this before EEVEE_temporal_sampling_init for now. */ + EEVEE_lookdev_init(vedata); + effects = stl->effects; effects->enabled_effects = 0; diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c index b515ea9c625..040aa8c8d9c 100644 --- a/source/blender/draw/engines/eevee/eevee_lightcache.c +++ b/source/blender/draw/engines/eevee/eevee_lightcache.c @@ -26,6 +26,7 @@ #include "BKE_global.h" +#include "BLI_endian_switch.h" #include "BLI_threads.h" #include "DEG_depsgraph_build.h" @@ -47,6 +48,8 @@ #include "WM_api.h" #include "WM_types.h" +#include "BLO_read_write.h" + #include "wm_window.h" /* Rounded to nearest PowerOfTwo */ @@ -509,6 +512,82 @@ void EEVEE_lightcache_free(LightCache *lcache) MEM_freeN(lcache); } +static void write_lightcache_texture(BlendWriter *writer, LightCacheTexture *tex) +{ + if (tex->data) { + size_t data_size = tex->components * tex->tex_size[0] * tex->tex_size[1] * tex->tex_size[2]; + if (tex->data_type == LIGHTCACHETEX_FLOAT) { + data_size *= sizeof(float); + } + else if (tex->data_type == LIGHTCACHETEX_UINT) { + data_size *= sizeof(uint); + } + + /* FIXME: We can't save more than what 32bit systems can handle. + * The solution would be to split the texture but it is too late for 2.90. (see T78529) */ + if (data_size < INT_MAX) { + BLO_write_raw(writer, data_size, tex->data); + } + } +} + +void EEVEE_lightcache_blend_write(BlendWriter *writer, LightCache *cache) +{ + write_lightcache_texture(writer, &cache->grid_tx); + write_lightcache_texture(writer, &cache->cube_tx); + + if (cache->cube_mips) { + BLO_write_struct_array(writer, LightCacheTexture, cache->mips_len, cache->cube_mips); + for (int i = 0; i < cache->mips_len; i++) { + write_lightcache_texture(writer, &cache->cube_mips[i]); + } + } + + BLO_write_struct_array(writer, LightGridCache, cache->grid_len, cache->grid_data); + BLO_write_struct_array(writer, LightProbeCache, cache->cube_len, cache->cube_data); +} + +static void direct_link_lightcache_texture(BlendDataReader *reader, LightCacheTexture *lctex) +{ + lctex->tex = NULL; + + if (lctex->data) { + BLO_read_data_address(reader, &lctex->data); + if (lctex->data && BLO_read_requires_endian_switch(reader)) { + int data_size = lctex->components * lctex->tex_size[0] * lctex->tex_size[1] * + lctex->tex_size[2]; + + if (lctex->data_type == LIGHTCACHETEX_FLOAT) { + BLI_endian_switch_float_array((float *)lctex->data, data_size * sizeof(float)); + } + else if (lctex->data_type == LIGHTCACHETEX_UINT) { + BLI_endian_switch_uint32_array((uint *)lctex->data, data_size * sizeof(uint)); + } + } + } + + if (lctex->data == NULL) { + zero_v3_int(lctex->tex_size); + } +} + +void EEVEE_lightcache_blend_read_data(BlendDataReader *reader, LightCache *cache) +{ + cache->flag &= ~LIGHTCACHE_NOT_USABLE; + direct_link_lightcache_texture(reader, &cache->cube_tx); + direct_link_lightcache_texture(reader, &cache->grid_tx); + + if (cache->cube_mips) { + BLO_read_data_address(reader, &cache->cube_mips); + for (int i = 0; i < cache->mips_len; i++) { + direct_link_lightcache_texture(reader, &cache->cube_mips[i]); + } + } + + BLO_read_data_address(reader, &cache->cube_data); + BLO_read_data_address(reader, &cache->grid_data); +} + /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.h b/source/blender/draw/engines/eevee/eevee_lightcache.h index 489c9ac22f4..17392c0de0b 100644 --- a/source/blender/draw/engines/eevee/eevee_lightcache.h +++ b/source/blender/draw/engines/eevee/eevee_lightcache.h @@ -30,6 +30,8 @@ struct LightCache; struct Scene; struct SceneEEVEE; struct ViewLayer; +struct BlendWriter; +struct BlendDataReader; /* Light Bake */ struct wmJob *EEVEE_lightbake_job_create(struct wmWindowManager *wm, @@ -61,3 +63,6 @@ struct LightCache *EEVEE_lightcache_create(const int grid_len, void EEVEE_lightcache_free(struct LightCache *lcache); bool EEVEE_lightcache_load(struct LightCache *lcache); void EEVEE_lightcache_info_update(struct SceneEEVEE *eevee); + +void EEVEE_lightcache_blend_write(struct BlendWriter *writer, struct LightCache *cache); +void EEVEE_lightcache_blend_read_data(struct BlendDataReader *reader, struct LightCache *cache); diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c index 5deaf4d4d68..710d2c70479 100644 --- a/source/blender/draw/engines/eevee/eevee_lookdev.c +++ b/source/blender/draw/engines/eevee/eevee_lookdev.c @@ -95,24 +95,13 @@ static void eevee_lookdev_hdri_preview_init(EEVEE_Data *vedata, EEVEE_ViewLayerD } } -void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, - EEVEE_ViewLayerData *sldata, - DRWPass *pass, - EEVEE_LightProbesInfo *pinfo, - DRWShadingGroup **r_shgrp) +void EEVEE_lookdev_init(EEVEE_Data *vedata) { EEVEE_StorageList *stl = vedata->stl; - EEVEE_TextureList *txl = vedata->txl; EEVEE_EffectsInfo *effects = stl->effects; - EEVEE_PrivateData *g_data = stl->g_data; const DRWContextState *draw_ctx = DRW_context_state_get(); /* The view will be NULL when rendering previews. */ const View3D *v3d = draw_ctx->v3d; - const Scene *scene = draw_ctx->scene; - - const bool probe_render = pinfo != NULL; - - effects->lookdev_view = NULL; if (eevee_hdri_preview_overlay_enabled(v3d)) { /* Viewport / Spheres size. */ @@ -142,9 +131,32 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, effects->sphere_size = sphere_size; effects->anchor[0] = rect->xmax; effects->anchor[1] = rect->ymin; + stl->g_data->valid_double_buffer = false; EEVEE_temporal_sampling_reset(vedata); } + } +} + +void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, + EEVEE_ViewLayerData *sldata, + DRWPass *pass, + EEVEE_LightProbesInfo *pinfo, + DRWShadingGroup **r_shgrp) +{ + EEVEE_StorageList *stl = vedata->stl; + EEVEE_TextureList *txl = vedata->txl; + EEVEE_EffectsInfo *effects = stl->effects; + EEVEE_PrivateData *g_data = stl->g_data; + const DRWContextState *draw_ctx = DRW_context_state_get(); + /* The view will be NULL when rendering previews. */ + const View3D *v3d = draw_ctx->v3d; + const Scene *scene = draw_ctx->scene; + + const bool probe_render = pinfo != NULL; + + effects->lookdev_view = NULL; + if (eevee_hdri_preview_overlay_enabled(v3d)) { eevee_lookdev_hdri_preview_init(vedata, sldata); } diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index 5330ea2f770..7d41028195d 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -1357,6 +1357,7 @@ void EEVEE_render_update_passes(struct RenderEngine *engine, struct ViewLayer *view_layer); /** eevee_lookdev.c */ +void EEVEE_lookdev_init(EEVEE_Data *vedata); void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, EEVEE_ViewLayerData *sldata, DRWPass *pass, diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 338cbf2cded..c70a86eab1d 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -54,6 +54,7 @@ #include "DNA_simulation_types.h" #include "DNA_space_types.h" #include "DNA_speaker_types.h" +#include "DNA_userdef_types.h" #include "DNA_volume_types.h" #include "DNA_world_types.h" @@ -170,28 +171,9 @@ static void acf_generic_dataexpand_backdrop(bAnimContext *ac, } /* helper method to test if group colors should be drawn */ -static bool acf_show_channel_colors(bAnimContext *ac) +static bool acf_show_channel_colors(void) { - bool showGroupColors = false; - - if (ac->sl) { - switch (ac->spacetype) { - case SPACE_ACTION: { - SpaceAction *saction = (SpaceAction *)ac->sl; - showGroupColors = !(saction->flag & SACTION_NODRAWGCOLORS); - - break; - } - case SPACE_GRAPH: { - SpaceGraph *sipo = (SpaceGraph *)ac->sl; - showGroupColors = !(sipo->flag & SIPO_NODRAWGCOLORS); - - break; - } - } - } - - return showGroupColors; + return (U.animation_flag & USER_ANIM_SHOW_CHANNEL_GROUP_COLORS) != 0; } /* get backdrop color for generic channels */ @@ -200,7 +182,7 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); bActionGroup *grp = NULL; short indent = (acf->get_indent_level) ? acf->get_indent_level(ac, ale) : 0; - bool showGroupColors = acf_show_channel_colors(ac); + bool showGroupColors = acf_show_channel_colors(); if (ale->type == ANIMTYPE_FCURVE) { FCurve *fcu = (FCurve *)ale->data; @@ -240,7 +222,7 @@ static void acf_gpencil_channel_color(bAnimContext *ac, bAnimListElem *ale, floa { const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); short indent = (acf->get_indent_level) ? acf->get_indent_level(ac, ale) : 0; - bool showGroupColors = acf_show_channel_colors(ac); + bool showGroupColors = acf_show_channel_colors(); if ((showGroupColors) && (ale->type == ANIMTYPE_GPLAYER)) { bGPDlayer *gpl = (bGPDlayer *)ale->data; @@ -848,10 +830,10 @@ static bAnimChannelType ACF_OBJECT = { /* Group ------------------------------------------- */ /* get backdrop color for group widget */ -static void acf_group_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3]) +static void acf_group_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, float r_color[3]) { bActionGroup *agrp = (bActionGroup *)ale->data; - bool showGroupColors = acf_show_channel_colors(ac); + bool showGroupColors = acf_show_channel_colors(); if (showGroupColors && agrp->customCol) { uchar cp[3]; diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 77ebc1606fa..360335a54d7 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -1919,6 +1919,7 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op)) /* send notifier that things have changed */ WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL); + WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, NULL); DEG_relations_tag_update(CTX_data_main(C)); return OPERATOR_FINISHED; diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index f64c6a42f18..a0246174970 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -459,6 +459,8 @@ void ED_view3d_clipping_calc(struct BoundBox *bb, const struct ARegion *region, const struct Object *ob, const struct rcti *rect); +bool ED_view3d_clipping_clamp_minmax(const struct RegionView3D *rv3d, float min[3], float max[3]); + void ED_view3d_clipping_local(struct RegionView3D *rv3d, const float mat[4][4]); bool ED_view3d_clipping_test(const struct RegionView3D *rv3d, const float co[3], diff --git a/source/blender/editors/lattice/CMakeLists.txt b/source/blender/editors/lattice/CMakeLists.txt index f9c08727128..96f0dfcdb9f 100644 --- a/source/blender/editors/lattice/CMakeLists.txt +++ b/source/blender/editors/lattice/CMakeLists.txt @@ -22,7 +22,7 @@ set(INC ../../depsgraph ../../makesdna ../../makesrna - ../../render/extern/include + ../../render ../../windowmanager ../../../../intern/clog ../../../../intern/guardedalloc diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt index 035af772a55..35bf295a678 100644 --- a/source/blender/editors/mesh/CMakeLists.txt +++ b/source/blender/editors/mesh/CMakeLists.txt @@ -28,7 +28,7 @@ set(INC ../../imbuf ../../makesdna ../../makesrna - ../../render/extern/include + ../../render ../../windowmanager ../../../../intern/clog ../../../../intern/glew-mx diff --git a/source/blender/editors/mesh/editmesh_intersect.c b/source/blender/editors/mesh/editmesh_intersect.c index e2112f91060..ff4867454d6 100644 --- a/source/blender/editors/mesh/editmesh_intersect.c +++ b/source/blender/editors/mesh/editmesh_intersect.c @@ -204,8 +204,15 @@ static int edbm_intersect_exec(bContext *C, wmOperator *op) if (exact) { int nshapes = use_self ? 1 : 2; - has_isect = BM_mesh_boolean_knife( - em->bm, em->looptris, em->tottri, test_fn, NULL, nshapes, use_self, use_separate_all); + has_isect = BM_mesh_boolean_knife(em->bm, + em->looptris, + em->tottri, + test_fn, + NULL, + nshapes, + use_self, + use_separate_all, + true); } else { has_isect = BM_mesh_intersect(em->bm, @@ -369,7 +376,7 @@ static int edbm_intersect_boolean_exec(bContext *C, wmOperator *op) if (use_exact) { has_isect = BM_mesh_boolean( - em->bm, em->looptris, em->tottri, test_fn, NULL, 2, use_self, boolean_operation); + em->bm, em->looptris, em->tottri, test_fn, NULL, 2, use_self, true, boolean_operation); } else { has_isect = BM_mesh_intersect(em->bm, diff --git a/source/blender/editors/metaball/CMakeLists.txt b/source/blender/editors/metaball/CMakeLists.txt index 72105ddb00a..4e600dc0277 100644 --- a/source/blender/editors/metaball/CMakeLists.txt +++ b/source/blender/editors/metaball/CMakeLists.txt @@ -22,7 +22,7 @@ set(INC ../../depsgraph ../../makesdna ../../makesrna - ../../render/extern/include + ../../render ../../windowmanager ../../../../intern/clog ../../../../intern/guardedalloc diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt index 2f72f563e68..e4991f31649 100644 --- a/source/blender/editors/object/CMakeLists.txt +++ b/source/blender/editors/object/CMakeLists.txt @@ -32,7 +32,7 @@ set(INC ../../modifiers ../../python ../../shader_fx - ../../render/extern/include + ../../render ../../windowmanager ../../../../intern/clog ../../../../intern/glew-mx diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 8973a74cd1d..e15e64a5e45 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -2686,6 +2686,8 @@ static int object_convert_exec(bContext *C, wmOperator *op) Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); Mesh *me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_eval, &CD_MASK_MESH); me_eval = BKE_mesh_copy_for_eval(me_eval, false); + /* Full (edge-angle based) draw calculation should ideally be performed. */ + BKE_mesh_edges_set_draw_render(me_eval); BKE_mesh_nomain_to_mesh(me_eval, newob->data, newob, &CD_MASK_MESH, true); BKE_object_free_modifiers(newob, 0); /* after derivedmesh calls! */ } diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt index b39dbf74375..46afa390997 100644 --- a/source/blender/editors/render/CMakeLists.txt +++ b/source/blender/editors/render/CMakeLists.txt @@ -28,7 +28,7 @@ set(INC ../../imbuf ../../makesdna ../../makesrna - ../../render/extern/include + ../../render ../../sequencer ../../windowmanager ../../../../intern/glew-mx diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt index 930f9890dd9..9bf3d2610d8 100644 --- a/source/blender/editors/sculpt_paint/CMakeLists.txt +++ b/source/blender/editors/sculpt_paint/CMakeLists.txt @@ -28,7 +28,7 @@ set(INC ../../imbuf ../../makesdna ../../makesrna - ../../render/extern/include + ../../render ../../windowmanager ../../../../intern/atomic ../../../../intern/clog diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c index 5ee38069fd9..ad7b29ae33a 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.c +++ b/source/blender/editors/sculpt_paint/paint_mask.c @@ -400,10 +400,10 @@ static SculptGestureContext *sculpt_gesture_init_from_lasso(bContext *C, wmOpera ED_view3d_ob_project_mat_get( sgcontext->vc.rv3d, sgcontext->vc.obact, sgcontext->lasso.projviewobjmat); BLI_lasso_boundbox(&sgcontext->lasso.boundbox, mcoords, mcoords_len); - sgcontext->lasso.width = sgcontext->lasso.boundbox.xmax - sgcontext->lasso.boundbox.xmin; - sgcontext->lasso.mask_px = BLI_BITMAP_NEW( - sgcontext->lasso.width * (sgcontext->lasso.boundbox.ymax - sgcontext->lasso.boundbox.ymin), - __func__); + const int lasso_width = 1 + sgcontext->lasso.boundbox.xmax - sgcontext->lasso.boundbox.xmin; + const int lasso_height = 1 + sgcontext->lasso.boundbox.ymax - sgcontext->lasso.boundbox.ymin; + sgcontext->lasso.width = lasso_width; + sgcontext->lasso.mask_px = BLI_BITMAP_NEW(lasso_width * lasso_height, __func__); BLI_bitmap_draw_2d_poly_v2i_n(sgcontext->lasso.boundbox.xmin, sgcontext->lasso.boundbox.ymin, @@ -1293,7 +1293,7 @@ static void sculpt_gesture_apply_trim(SculptGestureContext *sgcontext) BLI_assert(false); break; } - BM_mesh_boolean(bm, looptris, tottri, bm_face_isect_pair, NULL, 2, true, boolean_mode); + BM_mesh_boolean(bm, looptris, tottri, bm_face_isect_pair, NULL, 2, true, true, boolean_mode); } MEM_freeN(looptris); diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 8634e5a5f29..5036f22fd0e 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -145,7 +145,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region uchar col1a[4], col2a[4]; uchar col1b[4], col2b[4]; - const bool show_group_colors = !(saction->flag & SACTION_NODRAWGCOLORS); + const bool show_group_colors = U.animation_flag & USER_ANIM_SHOW_CHANNEL_GROUP_COLORS; /* get theme colors */ UI_GetThemeColor4ubv(TH_SHADE2, col2); diff --git a/source/blender/editors/space_file/CMakeLists.txt b/source/blender/editors/space_file/CMakeLists.txt index dcacf5e2504..993a52b9084 100644 --- a/source/blender/editors/space_file/CMakeLists.txt +++ b/source/blender/editors/space_file/CMakeLists.txt @@ -26,7 +26,7 @@ set(INC ../../imbuf ../../makesdna ../../makesrna - ../../render/extern/include + ../../render ../../windowmanager ../../../../intern/atomic ../../../../intern/glew-mx diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt index 96aab8b5d1a..7a1bab0ef14 100644 --- a/source/blender/editors/space_image/CMakeLists.txt +++ b/source/blender/editors/space_image/CMakeLists.txt @@ -28,7 +28,7 @@ set(INC ../../imbuf ../../makesdna ../../makesrna - ../../render/extern/include + ../../render ../../windowmanager ../../../../intern/clog ../../../../intern/glew-mx diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt index 0c970eb7c7b..22766ee7bb0 100644 --- a/source/blender/editors/space_node/CMakeLists.txt +++ b/source/blender/editors/space_node/CMakeLists.txt @@ -27,7 +27,7 @@ set(INC ../../makesdna ../../makesrna ../../nodes - ../../render/extern/include + ../../render ../../compositor ../../windowmanager ../../../../intern/glew-mx diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c index 6c0975498e0..865e06bf0b6 100644 --- a/source/blender/editors/space_outliner/outliner_dragdrop.c +++ b/source/blender/editors/space_outliner/outliner_dragdrop.c @@ -641,6 +641,7 @@ static int material_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmEve BKE_object_material_assign(bmain, ob, ma, ob->totcol + 1, BKE_MAT_ASSIGN_USERPREF); + WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, ob); WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C)); WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma); diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 7335882e947..37dfcdbc765 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -148,7 +148,7 @@ static int sequencer_generic_invoke_xy_guess_channel(bContext *C, int type) Sequence *seq; Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, true); - int cfra = (int)CFRA; + int timeline_frame = (int)CFRA; int proximity = INT_MAX; if (!ed || !ed->seqbasep) { @@ -156,10 +156,10 @@ static int sequencer_generic_invoke_xy_guess_channel(bContext *C, int type) } for (seq = ed->seqbasep->first; seq; seq = seq->next) { - if ((type == -1 || seq->type == type) && (seq->enddisp < cfra) && - (cfra - seq->enddisp < proximity)) { + if ((type == -1 || seq->type == type) && (seq->enddisp < timeline_frame) && + (timeline_frame - seq->enddisp < proximity)) { tgt = seq; - proximity = cfra - seq->enddisp; + proximity = timeline_frame - seq->enddisp; } } @@ -173,17 +173,17 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, i { Scene *scene = CTX_data_scene(C); - int cfra = (int)CFRA; + int timeline_frame = (int)CFRA; /* Effect strips don't need a channel initialized from the mouse. */ if (!(flag & SEQPROP_NOCHAN) && RNA_struct_property_is_set(op->ptr, "channel") == 0) { RNA_int_set(op->ptr, "channel", sequencer_generic_invoke_xy_guess_channel(C, type)); } - RNA_int_set(op->ptr, "frame_start", cfra); + RNA_int_set(op->ptr, "frame_start", timeline_frame); if ((flag & SEQPROP_ENDFRAME) && RNA_struct_property_is_set(op->ptr, "frame_end") == 0) { - RNA_int_set(op->ptr, "frame_end", cfra + 25); /* XXX arbitrary but ok for now. */ + RNA_int_set(op->ptr, "frame_end", timeline_frame + 25); /* XXX arbitrary but ok for now. */ } if (!(flag & SEQPROP_NOPATHS)) { diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 7e23f4ed281..8ac562f0ae0 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -970,14 +970,14 @@ static void fcurve_batch_add_verts(GPUVertBuf *vbo, float y1, float y2, float y_height, - int cfra, + int timeline_frame, float curve_val, unsigned int *vert_count) { float vert_pos[2][2]; - copy_v2_fl2(vert_pos[0], cfra, (curve_val * y_height) + y1); - copy_v2_fl2(vert_pos[1], cfra, y2); + copy_v2_fl2(vert_pos[0], timeline_frame, (curve_val * y_height) + y1); + copy_v2_fl2(vert_pos[1], timeline_frame, y2); GPU_vertbuf_vert_set(vbo, *vert_count, vert_pos[0]); GPU_vertbuf_vert_set(vbo, *vert_count + 1, vert_pos[1]); @@ -1026,23 +1026,25 @@ static void draw_seq_fcurve( float prev_val = INT_MIN; bool skip = false; - for (int cfra = eval_start; cfra <= eval_end; cfra += eval_step) { - curve_val = evaluate_fcurve(fcu, cfra); + for (int timeline_frame = eval_start; timeline_frame <= eval_end; + timeline_frame += eval_step) { + curve_val = evaluate_fcurve(fcu, timeline_frame); CLAMP(curve_val, 0.0f, 1.0f); /* Avoid adding adjacent verts that have the same value. */ - if (curve_val == prev_val && cfra < eval_end - eval_step) { + if (curve_val == prev_val && timeline_frame < eval_end - eval_step) { skip = true; continue; } /* If some frames were skipped above, we need to close the shape. */ if (skip) { - fcurve_batch_add_verts(vbo, y1, y2, y_height, cfra - eval_step, prev_val, &vert_count); + fcurve_batch_add_verts( + vbo, y1, y2, y_height, timeline_frame - eval_step, prev_val, &vert_count); skip = false; } - fcurve_batch_add_verts(vbo, y1, y2, y_height, cfra, curve_val, &vert_count); + fcurve_batch_add_verts(vbo, y1, y2, y_height, timeline_frame, curve_val, &vert_count); prev_val = curve_val; } @@ -1241,7 +1243,7 @@ ImBuf *sequencer_ibuf_get(struct Main *bmain, struct Depsgraph *depsgraph, Scene *scene, SpaceSeq *sseq, - int cfra, + int timeline_frame, int frame_ofs, const char *viewname) { @@ -1285,10 +1287,10 @@ ImBuf *sequencer_ibuf_get(struct Main *bmain, } if (special_seq_update) { - ibuf = SEQ_render_give_ibuf_direct(&context, cfra + frame_ofs, special_seq_update); + ibuf = SEQ_render_give_ibuf_direct(&context, timeline_frame + frame_ofs, special_seq_update); } else { - ibuf = SEQ_render_give_ibuf(&context, cfra + frame_ofs, sseq->chanshown); + ibuf = SEQ_render_give_ibuf(&context, timeline_frame + frame_ofs, sseq->chanshown); } if (viewport) { @@ -1766,7 +1768,7 @@ void sequencer_draw_preview(const bContext *C, Scene *scene, ARegion *region, SpaceSeq *sseq, - int cfra, + int timeline_frame, int offset, bool draw_overlay, bool draw_backdrop) @@ -1788,7 +1790,7 @@ void sequencer_draw_preview(const bContext *C, /* Get image. */ ibuf = sequencer_ibuf_get( - bmain, region, depsgraph, scene, sseq, cfra, offset, names[sseq->multiview_eye]); + bmain, region, depsgraph, scene, sseq, timeline_frame, offset, names[sseq->multiview_eye]); /* Setup off-screen buffers. */ GPUViewport *viewport = WM_draw_region_get_viewport(region); @@ -2318,9 +2320,9 @@ void draw_timeline_seq(const bContext *C, ARegion *region) /* Draw overlap frame frame indicator. */ if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) { - int cfra_over = (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? - scene->ed->over_cfra : - scene->r.cfra + scene->ed->over_ofs; + int overlap_frame = (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? + scene->ed->over_cfra : + scene->r.cfra + scene->ed->over_ofs; uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); @@ -2334,8 +2336,8 @@ void draw_timeline_seq(const bContext *C, ARegion *region) immUniformThemeColor(TH_CFRAME); immBegin(GPU_PRIM_LINES, 2); - immVertex2f(pos, cfra_over, v2d->cur.ymin); - immVertex2f(pos, cfra_over, v2d->cur.ymax); + immVertex2f(pos, overlap_frame, v2d->cur.ymin); + immVertex2f(pos, overlap_frame, v2d->cur.ymax); immEnd(); immUnbindProgram(); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 8f3a3ba50a0..eb4a1601187 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -985,21 +985,21 @@ static bool split_seq_list( return (seq_first_new != NULL); } -static bool sequence_offset_after_frame(Scene *scene, const int delta, const int cfra) +static bool sequence_offset_after_frame(Scene *scene, const int delta, const int timeline_frame) { Sequence *seq; Editing *ed = BKE_sequencer_editing_get(scene, false); bool done = false; TimeMarker *marker; - /* All strips >= cfra are shifted. */ + /* All strips >= timeline_frame are shifted. */ if (ed == NULL) { return 0; } for (seq = ed->seqbasep->first; seq; seq = seq->next) { - if (seq->startdisp >= cfra) { + if (seq->startdisp >= timeline_frame) { BKE_sequence_translate(scene, seq, delta); BKE_sequence_calc(scene, seq); BKE_sequence_invalidate_cache_preprocessed(scene, seq); @@ -1009,7 +1009,7 @@ static bool sequence_offset_after_frame(Scene *scene, const int delta, const int if (!scene->toolsettings->lock_markers) { for (marker = scene->markers.first; marker; marker = marker->next) { - if (marker->frame >= cfra) { + if (marker->frame >= timeline_frame) { marker->frame += delta; } } @@ -1095,7 +1095,7 @@ static int sequencer_gap_remove_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); rctf rectf; - int cfra, efra, sfra; + int timeline_frame, efra, sfra; bool first = false, done; bool do_all = RNA_boolean_get(op->ptr, "all"); @@ -1105,24 +1105,24 @@ static int sequencer_gap_remove_exec(bContext *C, wmOperator *op) efra = (int)rectf.xmax; /* Check if the current frame has a gap already. */ - for (cfra = CFRA; cfra >= sfra; cfra--) { - if (SEQ_render_evaluate_frame(scene, cfra)) { + for (timeline_frame = CFRA; timeline_frame >= sfra; timeline_frame--) { + if (SEQ_render_evaluate_frame(scene, timeline_frame)) { first = true; break; } } - for (; cfra < efra; cfra++) { + for (; timeline_frame < efra; timeline_frame++) { /* There's still no strip to remove a gap for. */ if (first == false) { - if (SEQ_render_evaluate_frame(scene, cfra)) { + if (SEQ_render_evaluate_frame(scene, timeline_frame)) { first = true; } } - else if (SEQ_render_evaluate_frame(scene, cfra) == 0) { + else if (SEQ_render_evaluate_frame(scene, timeline_frame) == 0) { done = true; - while (SEQ_render_evaluate_frame(scene, cfra) == 0) { - done = sequence_offset_after_frame(scene, -1, cfra); + while (SEQ_render_evaluate_frame(scene, timeline_frame) == 0) { + done = sequence_offset_after_frame(scene, -1, timeline_frame); if (done == false) { break; } @@ -2659,7 +2659,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) Sequence *seq, *seq_new; Strip *strip_new; StripElem *se, *se_new; - int start_ofs, cfra, frame_end; + int start_ofs, timeline_frame, frame_end; int step = RNA_int_get(op->ptr, "length"); seq = ed->seqbasep->first; /* Poll checks this is valid. */ @@ -2676,12 +2676,12 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) /* if (seq->ipo) id_us_min(&seq->ipo->id); */ /* XXX, remove fcurve and assign to split image strips */ - start_ofs = cfra = BKE_sequence_tx_get_final_left(seq, false); + start_ofs = timeline_frame = BKE_sequence_tx_get_final_left(seq, false); frame_end = BKE_sequence_tx_get_final_right(seq, false); - while (cfra < frame_end) { + while (timeline_frame < frame_end) { /* New seq. */ - se = SEQ_render_give_stripelem(seq, cfra); + se = SEQ_render_give_stripelem(seq, timeline_frame); seq_new = BKE_sequence_dupli_recursive( scene, scene, ed->seqbasep, seq, SEQ_DUPE_UNIQUE_NAME); @@ -2713,7 +2713,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op) /* XXX, COPY FCURVES */ - cfra++; + timeline_frame++; start_ofs += step; } @@ -3019,11 +3019,12 @@ static bool strip_jump_internal(Scene *scene, const bool do_center) { bool changed = false; - int cfra = CFRA; - int nfra = BKE_sequencer_find_next_prev_edit(scene, cfra, side, do_skip_mute, do_center, false); + int timeline_frame = CFRA; + int next_frame = BKE_sequencer_find_next_prev_edit( + scene, timeline_frame, side, do_skip_mute, do_center, false); - if (nfra != cfra) { - CFRA = nfra; + if (next_frame != timeline_frame) { + CFRA = next_frame; changed = true; } @@ -3788,7 +3789,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) Sequence *seq = BKE_sequencer_active_get(scene); const bool is_relative_path = RNA_boolean_get(op->ptr, "relative_path"); const bool use_placeholders = RNA_boolean_get(op->ptr, "use_placeholders"); - int minframe, numdigits; + int minext_frameme, numdigits; if (seq->type == SEQ_TYPE_IMAGE) { char directory[FILE_MAX]; @@ -3797,7 +3798,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) /* Need to find min/max frame for placeholders. */ if (use_placeholders) { - len = sequencer_image_seq_get_minmax_frame(op, seq->sfra, &minframe, &numdigits); + len = sequencer_image_seq_get_minmax_frame(op, seq->sfra, &minext_frameme, &numdigits); } else { len = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files")); @@ -3821,7 +3822,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) seq->strip->stripdata = se = MEM_callocN(len * sizeof(StripElem), "stripelem"); if (use_placeholders) { - sequencer_image_seq_reserve_frames(op, se, len, minframe, numdigits); + sequencer_image_seq_reserve_frames(op, se, len, minext_frameme, numdigits); } else { RNA_BEGIN (op->ptr, itemptr, "files") { diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index df36453bd2e..1ea4fb05d53 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -47,7 +47,7 @@ void sequencer_draw_preview(const struct bContext *C, struct Scene *scene, struct ARegion *region, struct SpaceSeq *sseq, - int cfra, + int timeline_frame, int offset, bool draw_overlay, bool draw_backdrop); @@ -64,7 +64,7 @@ struct ImBuf *sequencer_ibuf_get(struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct SpaceSeq *sseq, - int cfra, + int timeline_frame, int frame_ofs, const char *viewname); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index f7c8c35d563..a6b2d7feae3 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -975,18 +975,18 @@ static int sequencer_select_side_of_frame_exec(bContext *C, wmOperator *op) if (extend == false) { ED_sequencer_deselect_all(scene); } - const int cfra = CFRA; + const int timeline_frame = CFRA; SEQ_CURRENT_BEGIN (ed, seq) { bool test = false; switch (side) { case -1: - test = (cfra >= seq->enddisp); + test = (timeline_frame >= seq->enddisp); break; case 1: - test = (cfra <= seq->startdisp); + test = (timeline_frame <= seq->startdisp); break; case 0: - test = (cfra <= seq->enddisp) && (cfra >= seq->startdisp); + test = (timeline_frame <= seq->enddisp) && (timeline_frame >= seq->startdisp); break; } diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt index f4d6f7e322c..0371b4e271f 100644 --- a/source/blender/editors/space_view3d/CMakeLists.txt +++ b/source/blender/editors/space_view3d/CMakeLists.txt @@ -27,7 +27,7 @@ set(INC ../../imbuf ../../makesdna ../../makesrna - ../../render/extern/include + ../../render ../../depsgraph ../../windowmanager ../../../../intern/glew-mx diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 897777c9159..c16cd94d90d 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2978,6 +2978,11 @@ static int view3d_all_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } + if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) { + /* This is an approximation, see function documentation for details. */ + ED_view3d_clipping_clamp_minmax(rv3d, min, max); + } + if (use_all_regions) { view3d_from_minmax_multi(C, v3d, min, max, true, smooth_viewtx); } @@ -3125,6 +3130,11 @@ static int viewselected_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } + if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) { + /* This is an approximation, see function documentation for details. */ + ED_view3d_clipping_clamp_minmax(rv3d, min, max); + } + if (use_all_regions) { view3d_from_minmax_multi(C, v3d, min, max, ok_dist, smooth_viewtx); } diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c index 22cdbb090a5..c334b2ce541 100644 --- a/source/blender/editors/space_view3d/view3d_utils.c +++ b/source/blender/editors/space_view3d/view3d_utils.c @@ -331,6 +331,76 @@ void ED_view3d_clipping_calc( /** \} */ /* -------------------------------------------------------------------- */ +/** \name View Clipping Clamp Min/Max + * \{ */ + +struct PointsInPlanesMinMax_UserData { + float min[3]; + float max[3]; +}; + +static void points_in_planes_minmax_fn( + const float co[3], int UNUSED(i), int UNUSED(j), int UNUSED(k), void *user_data_p) +{ + struct PointsInPlanesMinMax_UserData *user_data = user_data_p; + minmax_v3v3_v3(user_data->min, user_data->max, co); +} + +/** + * Clamp min/max by the viewport clipping. + * + * \note This is an approximation, with the limitation that the bounding box from the (mix, max) + * calculation might not have any geometry inside the clipped region. + * Performing a clipping test on each vertex would work well enough for most cases, + * although it's not perfect either as edges/faces may intersect the clipping without having any + * of their vertices inside it. + * A more accurate result would be quite involved. + * + * \return True when the arguments were clamped. + */ +bool ED_view3d_clipping_clamp_minmax(const RegionView3D *rv3d, float min[3], float max[3]) +{ + /* 6 planes for the cube, 4..6 for the current view clipping planes. */ + float planes[6 + 6][4]; + + /* Convert the min/max to 6 planes. */ + for (int i = 0; i < 3; i++) { + float *plane_min = planes[(i * 2) + 0]; + float *plane_max = planes[(i * 2) + 1]; + zero_v3(plane_min); + zero_v3(plane_max); + plane_min[i] = -1.0f; + plane_min[3] = +min[i]; + plane_max[i] = +1.0f; + plane_max[3] = -max[i]; + } + + /* Copy planes from the viewport & flip. */ + int planes_len = 6; + int clip_len = (RV3D_LOCK_FLAGS(rv3d) & RV3D_BOXCLIP) ? 4 : 6; + for (int i = 0; i < clip_len; i++) { + negate_v4_v4(planes[planes_len], rv3d->clip[i]); + planes_len += 1; + } + + /* Calculate points intersecting all planes (effectively intersecting two bounding boxes). */ + struct PointsInPlanesMinMax_UserData user_data; + INIT_MINMAX(user_data.min, user_data.max); + + const float eps_coplanar = 1e-4f; + const float eps_isect = 1e-6f; + if (isect_planes_v3_fn( + planes, planes_len, eps_coplanar, eps_isect, points_in_planes_minmax_fn, &user_data)) { + copy_v3_v3(min, user_data.min); + copy_v3_v3(max, user_data.max); + return true; + } + return false; +} + +/** \} */ + +/* -------------------------------------------------------------------- */ /** \name View Bound-Box Utilities * * \{ */ diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt index 5bf8450246b..73d6a376da6 100644 --- a/source/blender/editors/transform/CMakeLists.txt +++ b/source/blender/editors/transform/CMakeLists.txt @@ -26,7 +26,7 @@ set(INC ../../ikplugin ../../makesdna ../../makesrna - ../../render/extern/include + ../../render ../../depsgraph ../../sequencer ../../windowmanager diff --git a/source/blender/freestyle/CMakeLists.txt b/source/blender/freestyle/CMakeLists.txt index 8270476e9dd..b7eaf018dba 100644 --- a/source/blender/freestyle/CMakeLists.txt +++ b/source/blender/freestyle/CMakeLists.txt @@ -565,8 +565,8 @@ set(INC ../makesrna ../python ../python/intern - ../render/extern/include - ../render/intern/include + ../render + ../render/intern ../../../extern/glew/include ../../../intern/guardedalloc ) diff --git a/source/blender/freestyle/intern/application/AppCanvas.cpp b/source/blender/freestyle/intern/application/AppCanvas.cpp index 66e41222ee6..9187e0ebb05 100644 --- a/source/blender/freestyle/intern/application/AppCanvas.cpp +++ b/source/blender/freestyle/intern/application/AppCanvas.cpp @@ -33,7 +33,7 @@ namespace Freestyle { AppCanvas::AppCanvas() { - _pViewer = 0; + _pViewer = nullptr; _MapsPath = Config::Path::getInstance()->getMapsDir().c_str(); } @@ -49,7 +49,7 @@ AppCanvas::AppCanvas(const AppCanvas &iBrother) : Canvas(iBrother) AppCanvas::~AppCanvas() { - _pViewer = 0; + _pViewer = nullptr; } void AppCanvas::setViewer(AppView *iViewer) diff --git a/source/blender/freestyle/intern/application/AppConfig.cpp b/source/blender/freestyle/intern/application/AppConfig.cpp index 3aae4254b4b..90ded5045dc 100644 --- a/source/blender/freestyle/intern/application/AppConfig.cpp +++ b/source/blender/freestyle/intern/application/AppConfig.cpp @@ -28,16 +28,14 @@ using namespace std; #include "BKE_appdir.h" -namespace Freestyle { +namespace Freestyle::Config { -namespace Config { - -Path *Path::_pInstance = 0; +Path *Path::_pInstance = nullptr; Path::Path() { // get the root directory // soc - setRootDir(BKE_appdir_folder_id(BLENDER_SYSTEM_SCRIPTS, NULL)); + setRootDir(BKE_appdir_folder_id(BLENDER_SYSTEM_SCRIPTS, nullptr)); _pInstance = this; } @@ -62,7 +60,7 @@ void Path::setHomeDir(const string &iHomeDir) Path::~Path() { - _pInstance = 0; + _pInstance = nullptr; } Path *Path::getInstance() @@ -85,6 +83,4 @@ string Path::getEnvVar(const string &iEnvVarName) return value; } -} // namespace Config - -} /* namespace Freestyle */ +} // namespace Freestyle::Config diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp index 0467e057642..63612694e65 100644 --- a/source/blender/freestyle/intern/application/Controller.cpp +++ b/source/blender/freestyle/intern/application/Controller.cpp @@ -93,10 +93,10 @@ Controller::Controller() _DebugNode->addRef(); #endif - _winged_edge = NULL; + _winged_edge = nullptr; - _pView = NULL; - _pRenderMonitor = NULL; + _pView = nullptr; + _pRenderMonitor = nullptr; _edgeTesselationNature = (Nature::SILHOUETTE | Nature::BORDER | Nature::CREASE); @@ -108,9 +108,9 @@ Controller::Controller() _EPSILON = 1.0e-6; _bboxDiag = 0; - _ViewMap = 0; + _ViewMap = nullptr; - _Canvas = 0; + _Canvas = nullptr; _VisibilityAlgo = ViewMapBuilder::ray_casting_adaptive_traditional; //_VisibilityAlgo = ViewMapBuilder::ray_casting; @@ -134,7 +134,7 @@ Controller::Controller() Controller::~Controller() { - if (NULL != _RootNode) { + if (nullptr != _RootNode) { int ref = _RootNode->destroy(); if (0 == ref) { delete _RootNode; @@ -159,27 +159,27 @@ Controller::~Controller() if (_winged_edge) { delete _winged_edge; - _winged_edge = NULL; + _winged_edge = nullptr; } - if (0 != _ViewMap) { + if (nullptr != _ViewMap) { delete _ViewMap; - _ViewMap = 0; + _ViewMap = nullptr; } - if (0 != _Canvas) { + if (nullptr != _Canvas) { delete _Canvas; - _Canvas = 0; + _Canvas = nullptr; } if (_inter) { delete _inter; - _inter = NULL; + _inter = nullptr; } if (_ProgressBar) { delete _ProgressBar; - _ProgressBar = NULL; + _ProgressBar = nullptr; } // delete _current_dirs; @@ -187,7 +187,7 @@ Controller::~Controller() void Controller::setView(AppView *iView) { - if (NULL == iView) { + if (nullptr == iView) { return; } @@ -203,14 +203,14 @@ void Controller::setRenderMonitor(RenderMonitor *iRenderMonitor) void Controller::setPassDiffuse(float *buf, int width, int height) { AppCanvas *app_canvas = dynamic_cast<AppCanvas *>(_Canvas); - BLI_assert(app_canvas != 0); + BLI_assert(app_canvas != nullptr); app_canvas->setPassDiffuse(buf, width, height); } void Controller::setPassZ(float *buf, int width, int height) { AppCanvas *app_canvas = dynamic_cast<AppCanvas *>(_Canvas); - BLI_assert(app_canvas != 0); + BLI_assert(app_canvas != nullptr); app_canvas->setPassZ(buf, width, height); } @@ -226,7 +226,7 @@ bool Controller::hitViewMapCache() return false; } if (sceneHashFunc.match()) { - return (NULL != _ViewMap); + return (nullptr != _ViewMap); } sceneHashFunc.store(); return false; @@ -242,7 +242,7 @@ int Controller::LoadMesh(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph NodeGroup *blenderScene = loader.Load(); - if (blenderScene == NULL) { + if (blenderScene == nullptr) { if (G.debug & G_DEBUG_FREESTYLE) { cout << "Cannot load scene" << endl; } @@ -318,7 +318,7 @@ int Controller::LoadMesh(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph } delete _ViewMap; - _ViewMap = NULL; + _ViewMap = nullptr; } _Chrono.start(); @@ -350,7 +350,7 @@ int Controller::LoadMesh(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph string basename = string(cleaned); #endif - _ListOfModels.push_back("Blender_models"); + _ListOfModels.emplace_back("Blender_models"); _Scene3dBBox = _RootNode->bbox(); @@ -386,14 +386,14 @@ void Controller::CloseFile() _Canvas->Clear(); // soc: reset passes - setPassDiffuse(NULL, 0, 0); - setPassZ(NULL, 0, 0); + setPassDiffuse(nullptr, 0, 0); + setPassZ(nullptr, 0, 0); } void Controller::ClearRootNode() { _pView->DetachModel(); - if (NULL != _RootNode) { + if (nullptr != _RootNode) { int ref = _RootNode->destroy(); if (0 == ref) { _RootNode->addRef(); @@ -406,7 +406,7 @@ void Controller::DeleteWingedEdge() { if (_winged_edge) { delete _winged_edge; - _winged_edge = NULL; + _winged_edge = nullptr; } // clears the grid @@ -454,10 +454,10 @@ void Controller::DeleteViewMap(bool freeCache) } #endif - if (NULL != _ViewMap) { + if (nullptr != _ViewMap) { if (freeCache || !_EnableViewMapCache) { delete _ViewMap; - _ViewMap = NULL; + _ViewMap = nullptr; prevSceneHash = -1.0; } else { @@ -877,7 +877,7 @@ bool Controller::getComputeSteerableViewMapFlag() const int Controller::DrawStrokes() { - if (_ViewMap == 0) { + if (_ViewMap == nullptr) { return 0; } @@ -1129,8 +1129,8 @@ void Controller::init_options() _Canvas->init(); // soc: initialize passes - setPassDiffuse(NULL, 0, 0); - setPassZ(NULL, 0, 0); + setPassDiffuse(nullptr, 0, 0); + setPassZ(nullptr, 0, 0); } } /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp index 291a38d23df..930da3ef471 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp @@ -33,18 +33,18 @@ BlenderFileLoader::BlenderFileLoader(Render *re, ViewLayer *view_layer, Depsgrap { _re = re; _depsgraph = depsgraph; - _Scene = NULL; + _Scene = nullptr; _numFacesRead = 0; #if 0 _minEdgeSize = DBL_MAX; #endif _smooth = (view_layer->freestyle_config.flags & FREESTYLE_FACE_SMOOTHNESS_FLAG) != 0; - _pRenderMonitor = NULL; + _pRenderMonitor = nullptr; } BlenderFileLoader::~BlenderFileLoader() { - _Scene = NULL; + _Scene = nullptr; } NodeGroup *BlenderFileLoader::Load() @@ -104,7 +104,7 @@ NodeGroup *BlenderFileLoader::Load() continue; } - Mesh *mesh = BKE_object_to_mesh(NULL, ob, false); + Mesh *mesh = BKE_object_to_mesh(nullptr, ob, false); if (mesh) { insertShapeNode(ob, mesh, ++id); @@ -422,7 +422,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) // Compute loop normals BKE_mesh_calc_normals_split(me); - float(*lnors)[3] = NULL; + float(*lnors)[3] = nullptr; if (CustomData_has_layer(&me->ldata, CD_NORMAL)) { lnors = (float(*)[3])CustomData_get_layer(&me->ldata, CD_NORMAL); @@ -633,16 +633,16 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) // We might have several times the same vertex. We want a clean // shape with no real-vertex. Here, we are making a cleaning pass. - float *cleanVertices = NULL; + float *cleanVertices = nullptr; unsigned int cvSize; - unsigned int *cleanVIndices = NULL; + unsigned int *cleanVIndices = nullptr; GeomCleaner::CleanIndexedVertexArray( vertices, vSize, VIndices, viSize, &cleanVertices, &cvSize, &cleanVIndices); - float *cleanNormals = NULL; + float *cleanNormals = nullptr; unsigned int cnSize; - unsigned int *cleanNIndices = NULL; + unsigned int *cleanNIndices = nullptr; GeomCleaner::CleanIndexedVertexArray( normals, nSize, NIndices, niSize, &cleanNormals, &cnSize, &cleanNIndices); @@ -777,7 +777,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) cnSize, marray, meshFrsMaterials.size(), - 0, + nullptr, 0, numFaces, numVertexPerFaces, @@ -789,7 +789,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) niSize, MIndices, viSize, - 0, + nullptr, 0, 0); // sets the id of the rep diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index 2f465a973fc..8aaffd4dde8 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -141,7 +141,7 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render *re, int render_count) view_layer->layflag = SCE_LAY_SOLID | SCE_LAY_ZTRA; // Camera - Object *object_camera = BKE_object_add(freestyle_bmain, view_layer, OB_CAMERA, NULL); + Object *object_camera = BKE_object_add(freestyle_bmain, view_layer, OB_CAMERA, nullptr); Camera *camera = (Camera *)object_camera->data; camera->type = CAM_ORTHO; @@ -174,7 +174,7 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render *re, int render_count) BlenderStrokeRenderer::~BlenderStrokeRenderer() { - BLI_ghash_free(_nodetree_hash, NULL, NULL); + BLI_ghash_free(_nodetree_hash, nullptr, nullptr); DEG_graph_free(freestyle_depsgraph); @@ -188,7 +188,7 @@ BlenderStrokeRenderer::~BlenderStrokeRenderer() BKE_main_free(freestyle_bmain); } -float BlenderStrokeRenderer::get_stroke_vertex_z(void) const +float BlenderStrokeRenderer::get_stroke_vertex_z() const { float z = _z; BlenderStrokeRenderer *self = const_cast<BlenderStrokeRenderer *>(this); @@ -199,7 +199,7 @@ float BlenderStrokeRenderer::get_stroke_vertex_z(void) const return -z; } -unsigned int BlenderStrokeRenderer::get_stroke_mesh_id(void) const +unsigned int BlenderStrokeRenderer::get_stroke_mesh_id() const { unsigned mesh_id = _mesh_id; BlenderStrokeRenderer *self = const_cast<BlenderStrokeRenderer *>(this); @@ -213,7 +213,7 @@ Material *BlenderStrokeRenderer::GetStrokeShader(Main *bmain, { Material *ma = BKE_material_add(bmain, "stroke_shader"); bNodeTree *ntree; - bNode *output_linestyle = NULL; + bNode *output_linestyle = nullptr; bNodeSocket *fromsock, *tosock; PointerRNA fromptr, toptr; NodeShaderAttribute *storage; @@ -233,19 +233,19 @@ Material *BlenderStrokeRenderer::GetStrokeShader(Main *bmain, } } else { - ntree = ntreeAddTree(NULL, "stroke_shader", "ShaderNodeTree"); + ntree = ntreeAddTree(nullptr, "stroke_shader", "ShaderNodeTree"); } ma->nodetree = ntree; ma->use_nodes = 1; ma->blend_method = MA_BM_HASHED; - bNode *input_attr_color = nodeAddStaticNode(NULL, ntree, SH_NODE_ATTRIBUTE); + bNode *input_attr_color = nodeAddStaticNode(nullptr, ntree, SH_NODE_ATTRIBUTE); input_attr_color->locx = 0.0f; input_attr_color->locy = -200.0f; storage = (NodeShaderAttribute *)input_attr_color->storage; BLI_strncpy(storage->name, "Color", sizeof(storage->name)); - bNode *mix_rgb_color = nodeAddStaticNode(NULL, ntree, SH_NODE_MIX_RGB); + bNode *mix_rgb_color = nodeAddStaticNode(nullptr, ntree, SH_NODE_MIX_RGB); mix_rgb_color->custom1 = MA_RAMP_BLEND; // Mix mix_rgb_color->locx = 200.0f; mix_rgb_color->locy = -200.0f; @@ -253,13 +253,13 @@ Material *BlenderStrokeRenderer::GetStrokeShader(Main *bmain, RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, tosock, &toptr); RNA_float_set(&toptr, "default_value", 0.0f); - bNode *input_attr_alpha = nodeAddStaticNode(NULL, ntree, SH_NODE_ATTRIBUTE); + bNode *input_attr_alpha = nodeAddStaticNode(nullptr, ntree, SH_NODE_ATTRIBUTE); input_attr_alpha->locx = 400.0f; input_attr_alpha->locy = 300.0f; storage = (NodeShaderAttribute *)input_attr_alpha->storage; BLI_strncpy(storage->name, "Alpha", sizeof(storage->name)); - bNode *mix_rgb_alpha = nodeAddStaticNode(NULL, ntree, SH_NODE_MIX_RGB); + bNode *mix_rgb_alpha = nodeAddStaticNode(nullptr, ntree, SH_NODE_MIX_RGB); mix_rgb_alpha->custom1 = MA_RAMP_BLEND; // Mix mix_rgb_alpha->locx = 600.0f; mix_rgb_alpha->locy = 300.0f; @@ -267,27 +267,27 @@ Material *BlenderStrokeRenderer::GetStrokeShader(Main *bmain, RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, tosock, &toptr); RNA_float_set(&toptr, "default_value", 0.0f); - bNode *shader_emission = nodeAddStaticNode(NULL, ntree, SH_NODE_EMISSION); + bNode *shader_emission = nodeAddStaticNode(nullptr, ntree, SH_NODE_EMISSION); shader_emission->locx = 400.0f; shader_emission->locy = -200.0f; - bNode *input_light_path = nodeAddStaticNode(NULL, ntree, SH_NODE_LIGHT_PATH); + bNode *input_light_path = nodeAddStaticNode(nullptr, ntree, SH_NODE_LIGHT_PATH); input_light_path->locx = 400.0f; input_light_path->locy = 100.0f; - bNode *mix_shader_color = nodeAddStaticNode(NULL, ntree, SH_NODE_MIX_SHADER); + bNode *mix_shader_color = nodeAddStaticNode(nullptr, ntree, SH_NODE_MIX_SHADER); mix_shader_color->locx = 600.0f; mix_shader_color->locy = -100.0f; - bNode *shader_transparent = nodeAddStaticNode(NULL, ntree, SH_NODE_BSDF_TRANSPARENT); + bNode *shader_transparent = nodeAddStaticNode(nullptr, ntree, SH_NODE_BSDF_TRANSPARENT); shader_transparent->locx = 600.0f; shader_transparent->locy = 100.0f; - bNode *mix_shader_alpha = nodeAddStaticNode(NULL, ntree, SH_NODE_MIX_SHADER); + bNode *mix_shader_alpha = nodeAddStaticNode(nullptr, ntree, SH_NODE_MIX_SHADER); mix_shader_alpha->locx = 800.0f; mix_shader_alpha->locy = 100.0f; - bNode *output_material = nodeAddStaticNode(NULL, ntree, SH_NODE_OUTPUT_MATERIAL); + bNode *output_material = nodeAddStaticNode(nullptr, ntree, SH_NODE_OUTPUT_MATERIAL); output_material->locx = 1000.0f; output_material->locy = 100.0f; @@ -393,7 +393,7 @@ Material *BlenderStrokeRenderer::GetStrokeShader(Main *bmain, bNodeSocket *sock = (bNodeSocket *)BLI_findlink(&node->outputs, 0); // add new UV Map node - bNode *input_uvmap = nodeAddStaticNode(NULL, ntree, SH_NODE_UVMAP); + bNode *input_uvmap = nodeAddStaticNode(nullptr, ntree, SH_NODE_UVMAP); input_uvmap->locx = node->locx - 200.0f; input_uvmap->locy = node->locy; NodeShaderUVMap *storage = (NodeShaderUVMap *)input_uvmap->storage; @@ -590,31 +590,31 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex) mesh->totcol = group->materials.size(); mesh->mvert = (MVert *)CustomData_add_layer( - &mesh->vdata, CD_MVERT, CD_CALLOC, NULL, mesh->totvert); + &mesh->vdata, CD_MVERT, CD_CALLOC, nullptr, mesh->totvert); mesh->medge = (MEdge *)CustomData_add_layer( - &mesh->edata, CD_MEDGE, CD_CALLOC, NULL, mesh->totedge); + &mesh->edata, CD_MEDGE, CD_CALLOC, nullptr, mesh->totedge); mesh->mpoly = (MPoly *)CustomData_add_layer( - &mesh->pdata, CD_MPOLY, CD_CALLOC, NULL, mesh->totpoly); + &mesh->pdata, CD_MPOLY, CD_CALLOC, nullptr, mesh->totpoly); mesh->mloop = (MLoop *)CustomData_add_layer( - &mesh->ldata, CD_MLOOP, CD_CALLOC, NULL, mesh->totloop); + &mesh->ldata, CD_MLOOP, CD_CALLOC, nullptr, mesh->totloop); MVert *vertices = mesh->mvert; MEdge *edges = mesh->medge; MPoly *polys = mesh->mpoly; MLoop *loops = mesh->mloop; - MLoopUV *loopsuv[2] = {NULL}; + MLoopUV *loopsuv[2] = {nullptr}; if (hasTex) { // First UV layer CustomData_add_layer_named( - &mesh->ldata, CD_MLOOPUV, CD_CALLOC, NULL, mesh->totloop, uvNames[0]); + &mesh->ldata, CD_MLOOPUV, CD_CALLOC, nullptr, mesh->totloop, uvNames[0]); CustomData_set_layer_active(&mesh->ldata, CD_MLOOPUV, 0); BKE_mesh_update_customdata_pointers(mesh, true); loopsuv[0] = mesh->mloopuv; // Second UV layer CustomData_add_layer_named( - &mesh->ldata, CD_MLOOPUV, CD_CALLOC, NULL, mesh->totloop, uvNames[1]); + &mesh->ldata, CD_MLOOPUV, CD_CALLOC, nullptr, mesh->totloop, uvNames[1]); CustomData_set_layer_active(&mesh->ldata, CD_MLOOPUV, 1); BKE_mesh_update_customdata_pointers(mesh, true); loopsuv[1] = mesh->mloopuv; @@ -622,9 +622,9 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex) // colors and transparency (the latter represented by grayscale colors) MLoopCol *colors = (MLoopCol *)CustomData_add_layer_named( - &mesh->ldata, CD_MLOOPCOL, CD_CALLOC, NULL, mesh->totloop, "Color"); + &mesh->ldata, CD_MLOOPCOL, CD_CALLOC, nullptr, mesh->totloop, "Color"); MLoopCol *transp = (MLoopCol *)CustomData_add_layer_named( - &mesh->ldata, CD_MLOOPCOL, CD_CALLOC, NULL, mesh->totloop, "Alpha"); + &mesh->ldata, CD_MLOOPCOL, CD_CALLOC, nullptr, mesh->totloop, "Alpha"); mesh->mloopcol = colors; mesh->mat = (Material **)MEM_mallocN(sizeof(Material *) * mesh->totcol, "MaterialList"); diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp index 9680e7d25a3..65fa193f92f 100644 --- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp +++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp @@ -59,7 +59,7 @@ using namespace Freestyle; #include "DEG_depsgraph_query.h" -#include "renderpipeline.h" +#include "pipeline.h" #include "FRS_freestyle.h" @@ -72,9 +72,9 @@ struct FreestyleGlobals g_freestyle; // Freestyle configuration static bool freestyle_is_initialized = false; -static Config::Path *pathconfig = NULL; -static Controller *controller = NULL; -static AppView *view = NULL; +static Config::Path *pathconfig = nullptr; +static Controller *controller = nullptr; +static AppView *view = nullptr; // line set buffer for copy & paste static FreestyleLineSet lineset_buffer; @@ -89,10 +89,10 @@ static void load_post_callback(struct Main * /*main*/, } static bCallbackFuncStore load_post_callback_funcstore = { - NULL, - NULL, /* next, prev */ + nullptr, + nullptr, /* next, prev */ load_post_callback, /* func */ - NULL, /* arg */ + nullptr, /* arg */ 0 /* alloc */ }; @@ -111,12 +111,12 @@ void FRS_init() view = new AppView; controller->setView(view); controller->Clear(); - g_freestyle.scene = NULL; + g_freestyle.scene = nullptr; lineset_copied = false; BKE_callback_add(&load_post_callback_funcstore, BKE_CB_EVT_LOAD_POST); - freestyle_is_initialized = 1; + freestyle_is_initialized = true; } void FRS_set_context(bContext *C) @@ -312,7 +312,7 @@ static void prepare(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph) // load mesh re->i.infostr = TIP_("Freestyle: Mesh loading"); re->stats_draw(re->sdh, &re->i); - re->i.infostr = NULL; + re->i.infostr = nullptr; if (controller->LoadMesh( re, view_layer, depsgraph)) { // returns if scene cannot be loaded or if empty return; @@ -507,7 +507,7 @@ static void prepare(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph) // compute view map re->i.infostr = TIP_("Freestyle: View map creation"); re->stats_draw(re->sdh, &re->i); - re->i.infostr = NULL; + re->i.infostr = nullptr; controller->ComputeViewMap(); } @@ -517,7 +517,7 @@ void FRS_composite_result(Render *re, ViewLayer *view_layer, Render *freestyle_r float *src, *dest, *pixSrc, *pixDest; int x, y, rectx, recty; - if (freestyle_render == NULL || freestyle_render->result == NULL) { + if (freestyle_render == nullptr || freestyle_render->result == nullptr) { return; } @@ -676,15 +676,15 @@ void FRS_do_stroke_rendering(Render *re, ViewLayer *view_layer) // render strokes re->i.infostr = TIP_("Freestyle: Stroke rendering"); re->stats_draw(re->sdh, &re->i); - re->i.infostr = NULL; + re->i.infostr = nullptr; g_freestyle.scene = DEG_get_evaluated_scene(depsgraph); int strokeCount = controller->DrawStrokes(); - Render *freestyle_render = NULL; + Render *freestyle_render = nullptr; if (strokeCount > 0) { freestyle_render = controller->RenderStrokes(re, true); } controller->CloseFile(); - g_freestyle.scene = NULL; + g_freestyle.scene = nullptr; // composite result if (freestyle_render) { @@ -762,7 +762,7 @@ void FRS_paste_active_lineset(FreestyleConfig *config) lineset->exclude_edge_types = lineset_buffer.exclude_edge_types; if (lineset->group) { id_us_min(&lineset->group->id); - lineset->group = NULL; + lineset->group = nullptr; } if (lineset_buffer.group) { lineset->group = lineset_buffer.group; @@ -790,14 +790,14 @@ void FRS_delete_active_lineset(FreestyleConfig *config) bool FRS_move_active_lineset(FreestyleConfig *config, int direction) { FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config); - return (lineset != NULL) && BLI_listbase_link_move(&config->linesets, lineset, direction); + return (lineset != nullptr) && BLI_listbase_link_move(&config->linesets, lineset, direction); } // Testing Material *FRS_create_stroke_material(Main *bmain, struct FreestyleLineStyle *linestyle) { - bNodeTree *nt = (linestyle->use_nodes) ? linestyle->nodetree : NULL; + bNodeTree *nt = (linestyle->use_nodes) ? linestyle->nodetree : nullptr; Material *ma = BlenderStrokeRenderer::GetStrokeShader(bmain, nt, true); ma->id.us = 0; return ma; diff --git a/source/blender/freestyle/intern/geometry/Bezier.cpp b/source/blender/freestyle/intern/geometry/Bezier.cpp index 4ae30ff893c..4eec3d72db9 100644 --- a/source/blender/freestyle/intern/geometry/Bezier.cpp +++ b/source/blender/freestyle/intern/geometry/Bezier.cpp @@ -73,8 +73,8 @@ void BezierCurveSegment::Build() float increment = 1.0 / (float)nvertices; float t = 0.0f; for (int i = 0; i <= nvertices; ++i) { - _Vertices.push_back(Vec2d((x[3] + t * (x[2] + t * (x[1] + t * x[0]))), - (y[3] + t * (y[2] + t * (y[1] + t * y[0]))))); + _Vertices.emplace_back((x[3] + t * (x[2] + t * (x[1] + t * x[0]))), + (y[3] + t * (y[2] + t * (y[1] + t * y[0])))); t += increment; } } diff --git a/source/blender/freestyle/intern/geometry/FastGrid.cpp b/source/blender/freestyle/intern/geometry/FastGrid.cpp index 1e5707690a0..1e0ae06da19 100644 --- a/source/blender/freestyle/intern/geometry/FastGrid.cpp +++ b/source/blender/freestyle/intern/geometry/FastGrid.cpp @@ -40,7 +40,7 @@ void FastGrid::clear() } } delete[] _cells; - _cells = NULL; + _cells = nullptr; _cells_size = 0; Grid::clear(); diff --git a/source/blender/freestyle/intern/geometry/FitCurve.cpp b/source/blender/freestyle/intern/geometry/FitCurve.cpp index aeb4902e5b0..5682ccc9298 100644 --- a/source/blender/freestyle/intern/geometry/FitCurve.cpp +++ b/source/blender/freestyle/intern/geometry/FitCurve.cpp @@ -493,7 +493,7 @@ void FitCurveWrapper::FitCurve(vector<Vec2d> &data, vector<Vec2d> &oCurve, doubl // copy results for (vector<Vector2>::iterator v = _vertices.begin(), vend = _vertices.end(); v != vend; ++v) { - oCurve.push_back(Vec2d(v->x(), v->y())); + oCurve.emplace_back(v->x(), v->y()); } } diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp index 76e63764e4d..b1d0a6c7e2a 100644 --- a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp +++ b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp @@ -54,8 +54,7 @@ void GeomCleaner::SortIndexedVertexArray(const float *iVertices, list<IndexedVertex> indexedVertices; unsigned i; for (i = 0; i < iVSize; i += 3) { - indexedVertices.push_back( - IndexedVertex(Vec3f(iVertices[i], iVertices[i + 1], iVertices[i + 2]), i / 3)); + indexedVertices.emplace_back(Vec3f(iVertices[i], iVertices[i + 1], iVertices[i + 2]), i / 3); } // q-sort @@ -99,7 +98,7 @@ void GeomCleaner::CompressIndexedVertexArray(const float *iVertices, vector<Vec3f> vertices; unsigned i; for (i = 0; i < iVSize; i += 3) { - vertices.push_back(Vec3f(iVertices[i], iVertices[i + 1], iVertices[i + 2])); + vertices.emplace_back(iVertices[i], iVertices[i + 1], iVertices[i + 2]); } unsigned *mapVertex = new unsigned[iVSize]; @@ -207,7 +206,7 @@ void GeomCleaner::CleanIndexedVertexArray(const float *iVertices, vector<Vec3f> vertices; unsigned i; for (i = 0; i < iVSize; i += 3) { - vertices.push_back(Vec3f(iVertices[i], iVertices[i + 1], iVertices[i + 2])); + vertices.emplace_back(iVertices[i], iVertices[i + 1], iVertices[i + 2]); } cleanHashTable ht; diff --git a/source/blender/freestyle/intern/geometry/GeomUtils.cpp b/source/blender/freestyle/intern/geometry/GeomUtils.cpp index 925bc3c9f94..51727fd2288 100644 --- a/source/blender/freestyle/intern/geometry/GeomUtils.cpp +++ b/source/blender/freestyle/intern/geometry/GeomUtils.cpp @@ -21,9 +21,7 @@ #include "GeomUtils.h" -namespace Freestyle { - -namespace GeomUtils { +namespace Freestyle::GeomUtils { // This internal procedure is defined below. bool intersect2dSegPoly(Vec2r *seg, Vec2r *poly, unsigned n); @@ -846,6 +844,4 @@ inline void fromCoordAToCoordB(const Vec3r &p, Vec3r &q, const real transform[4] } } -} // end of namespace GeomUtils - -} /* namespace Freestyle */ +} // namespace Freestyle::GeomUtils diff --git a/source/blender/freestyle/intern/geometry/Grid.cpp b/source/blender/freestyle/intern/geometry/Grid.cpp index 46e91197764..fad5a63ea4f 100644 --- a/source/blender/freestyle/intern/geometry/Grid.cpp +++ b/source/blender/freestyle/intern/geometry/Grid.cpp @@ -75,7 +75,7 @@ void firstIntersectionGridVisitor::examineOccluder(Polygon3r *occ) } } else { - occ->userdata2 = 0; + occ->userdata2 = nullptr; } } } @@ -321,11 +321,11 @@ void Grid::castInfiniteRay(const Vec3r &orig, Polygon3r *Grid::castRayToFindFirstIntersection( const Vec3r &orig, const Vec3r &dir, double &t, double &u, double &v, unsigned timestamp) { - Polygon3r *occluder = 0; + Polygon3r *occluder = nullptr; Vec3r end = Vec3r(orig + FLT_MAX * dir / dir.norm()); bool inter = initInfiniteRay(orig, dir, timestamp); if (!inter) { - return 0; + return nullptr; } firstIntersectionGridVisitor visitor(orig, dir, _cell_size); castRayInternal(visitor); diff --git a/source/blender/freestyle/intern/geometry/matrix_util.cpp b/source/blender/freestyle/intern/geometry/matrix_util.cpp index 637c2d05574..5b5d9582e8f 100644 --- a/source/blender/freestyle/intern/geometry/matrix_util.cpp +++ b/source/blender/freestyle/intern/geometry/matrix_util.cpp @@ -33,11 +33,7 @@ #include "BLI_math.h" -namespace Freestyle { - -namespace OGF { - -namespace MatrixUtil { +namespace Freestyle::OGF::MatrixUtil { static const double EPS = 0.00001; static int MAX_ITER = 100; @@ -252,8 +248,4 @@ void semi_definite_symmetric_eigen(const double *mat, int n, double *eigen_vec, //_________________________________________________________ -} // namespace MatrixUtil - -} // namespace OGF - -} /* namespace Freestyle */ +} // namespace Freestyle::OGF::MatrixUtil diff --git a/source/blender/freestyle/intern/geometry/normal_cycle.cpp b/source/blender/freestyle/intern/geometry/normal_cycle.cpp index d02b5cc2d5b..01d52646eb0 100644 --- a/source/blender/freestyle/intern/geometry/normal_cycle.cpp +++ b/source/blender/freestyle/intern/geometry/normal_cycle.cpp @@ -32,9 +32,7 @@ #include "normal_cycle.h" #include "matrix_util.h" -namespace Freestyle { - -namespace OGF { +namespace Freestyle::OGF { //_________________________________________________________ @@ -88,6 +86,4 @@ void NormalCycle::end() //_________________________________________________________ -} // namespace OGF - -} /* namespace Freestyle */ +} // namespace Freestyle::OGF diff --git a/source/blender/freestyle/intern/image/GaussianFilter.cpp b/source/blender/freestyle/intern/image/GaussianFilter.cpp index ca476bee0d3..3bbe86ee986 100644 --- a/source/blender/freestyle/intern/image/GaussianFilter.cpp +++ b/source/blender/freestyle/intern/image/GaussianFilter.cpp @@ -28,7 +28,7 @@ namespace Freestyle { GaussianFilter::GaussianFilter(float iSigma) { _sigma = iSigma; - _mask = 0; + _mask = nullptr; computeMask(); } diff --git a/source/blender/freestyle/intern/python/BPy_BBox.cpp b/source/blender/freestyle/intern/python/BPy_BBox.cpp index 17a0e53876e..e61ab2fe8c4 100644 --- a/source/blender/freestyle/intern/python/BPy_BBox.cpp +++ b/source/blender/freestyle/intern/python/BPy_BBox.cpp @@ -29,7 +29,7 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int BBox_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -53,7 +53,7 @@ PyDoc_STRVAR(BBox_doc, static int BBox_init(BPy_BBox *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -76,42 +76,42 @@ static PyObject *BBox_repr(BPy_BBox *self) /*-----------------------BPy_BBox type definition ------------------------------*/ PyTypeObject BBox_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "BBox", /* tp_name */ + PyVarObject_HEAD_INIT(nullptr, 0) "BBox", /* tp_name */ sizeof(BPy_BBox), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)BBox_dealloc, /* tp_dealloc */ 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ (reprfunc)BBox_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ BBox_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)BBox_init, /* tp_init */ - 0, /* tp_alloc */ + nullptr, /* tp_alloc */ PyType_GenericNew, /* tp_new */ }; diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp index 42b13bf4920..a24a0308017 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp @@ -32,7 +32,7 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int BinaryPredicate0D_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -72,7 +72,7 @@ static char BinaryPredicate0D___doc__[] = static int BinaryPredicate0D___init__(BPy_BinaryPredicate0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -98,7 +98,7 @@ static PyObject *BinaryPredicate0D___call__(BPy_BinaryPredicate0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"inter1", "inter2", NULL}; + static const char *kwlist[] = {"inter1", "inter2", nullptr}; BPy_Interface0D *obj1, *obj2; if (!PyArg_ParseTupleAndKeywords(args, @@ -109,18 +109,18 @@ static PyObject *BinaryPredicate0D___call__(BPy_BinaryPredicate0D *self, &obj1, &Interface0D_Type, &obj2)) { - return NULL; + return nullptr; } if (typeid(*(self->bp0D)) == typeid(BinaryPredicate0D)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->bp0D->operator()(*(obj1->if0D), *(obj2->if0D)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return PyBool_from_bool(self->bp0D->result); } @@ -138,50 +138,54 @@ static PyObject *BinaryPredicate0D_name_get(BPy_BinaryPredicate0D *self, void *U } static PyGetSetDef BPy_BinaryPredicate0D_getseters[] = { - {"name", (getter)BinaryPredicate0D_name_get, (setter)NULL, BinaryPredicate0D_name_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {"name", + (getter)BinaryPredicate0D_name_get, + (setter) nullptr, + BinaryPredicate0D_name_doc, + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_BinaryPredicate0D type definition ------------------------------*/ PyTypeObject BinaryPredicate0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "BinaryPredicate0D", /* tp_name */ - sizeof(BPy_BinaryPredicate0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)BinaryPredicate0D___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)BinaryPredicate0D___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)BinaryPredicate0D___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - BinaryPredicate0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_BinaryPredicate0D_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)BinaryPredicate0D___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "BinaryPredicate0D", /* tp_name */ + sizeof(BPy_BinaryPredicate0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)BinaryPredicate0D___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)BinaryPredicate0D___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)BinaryPredicate0D___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + BinaryPredicate0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_BinaryPredicate0D_getseters, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)BinaryPredicate0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp index ed991695739..0120f325f7b 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp @@ -38,7 +38,7 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int BinaryPredicate1D_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -108,7 +108,7 @@ static char BinaryPredicate1D___doc__[] = static int BinaryPredicate1D___init__(BPy_BinaryPredicate1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -133,7 +133,7 @@ static PyObject *BinaryPredicate1D___call__(BPy_BinaryPredicate1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"inter1", "inter2", NULL}; + static const char *kwlist[] = {"inter1", "inter2", nullptr}; BPy_Interface1D *obj1, *obj2; if (!PyArg_ParseTupleAndKeywords(args, @@ -144,18 +144,18 @@ static PyObject *BinaryPredicate1D___call__(BPy_BinaryPredicate1D *self, &obj1, &Interface1D_Type, &obj2)) { - return NULL; + return nullptr; } if (typeid(*(self->bp1D)) == typeid(BinaryPredicate1D)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->bp1D->operator()(*(obj1->if1D), *(obj2->if1D)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return PyBool_from_bool(self->bp1D->result); } @@ -173,49 +173,53 @@ static PyObject *BinaryPredicate1D_name_get(BPy_BinaryPredicate1D *self, void *U } static PyGetSetDef BPy_BinaryPredicate1D_getseters[] = { - {"name", (getter)BinaryPredicate1D_name_get, (setter)NULL, BinaryPredicate1D_name_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {"name", + (getter)BinaryPredicate1D_name_get, + (setter) nullptr, + BinaryPredicate1D_name_doc, + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_BinaryPredicate1D type definition ------------------------------*/ PyTypeObject BinaryPredicate1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "BinaryPredicate1D", /* tp_name */ - sizeof(BPy_BinaryPredicate1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)BinaryPredicate1D___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)BinaryPredicate1D___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)BinaryPredicate1D___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - BinaryPredicate1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_BinaryPredicate1D_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)BinaryPredicate1D___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "BinaryPredicate1D", /* tp_name */ + sizeof(BPy_BinaryPredicate1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)BinaryPredicate1D___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)BinaryPredicate1D___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)BinaryPredicate1D___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + BinaryPredicate1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_BinaryPredicate1D_getseters, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)BinaryPredicate1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp index e838bade64a..e01d09bfe21 100644 --- a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp +++ b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp @@ -110,14 +110,14 @@ static char ContextFunctions_load_map___doc__[] = static PyObject *ContextFunctions_load_map(PyObject * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"file_name", "map_name", "num_levels", "sigma", NULL}; + static const char *kwlist[] = {"file_name", "map_name", "num_levels", "sigma", nullptr}; char *fileName, *mapName; unsigned nbLevels = 4; float sigma = 1.0; if (!PyArg_ParseTupleAndKeywords( args, kwds, "ss|If", (char **)kwlist, &fileName, &mapName, &nbLevels, &sigma)) { - return NULL; + return nullptr; } ContextFunctions::LoadMapCF(fileName, mapName, nbLevels, sigma); Py_RETURN_NONE; @@ -146,14 +146,14 @@ static PyObject *ContextFunctions_read_map_pixel(PyObject * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"map_name", "level", "x", "y", NULL}; + static const char *kwlist[] = {"map_name", "level", "x", "y", nullptr}; char *mapName; int level; unsigned x, y; if (!PyArg_ParseTupleAndKeywords( args, kwds, "siII", (char **)kwlist, &mapName, &level, &x, &y)) { - return NULL; + return nullptr; } return PyFloat_FromDouble(ContextFunctions::ReadMapPixelCF(mapName, level, x, y)); } @@ -179,12 +179,12 @@ static PyObject *ContextFunctions_read_complete_view_map_pixel(PyObject * /*self PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"level", "x", "y", NULL}; + static const char *kwlist[] = {"level", "x", "y", nullptr}; int level; unsigned x, y; if (!PyArg_ParseTupleAndKeywords(args, kwds, "iII", (char **)kwlist, &level, &x, &y)) { - return NULL; + return nullptr; } return PyFloat_FromDouble(ContextFunctions::ReadCompleteViewMapPixelCF(level, x, y)); } @@ -213,13 +213,13 @@ static PyObject *ContextFunctions_read_directional_view_map_pixel(PyObject * /*s PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"orientation", "level", "x", "y", NULL}; + static const char *kwlist[] = {"orientation", "level", "x", "y", nullptr}; int orientation, level; unsigned x, y; if (!PyArg_ParseTupleAndKeywords( args, kwds, "iiII", (char **)kwlist, &orientation, &level, &x, &y)) { - return NULL; + return nullptr; } return PyFloat_FromDouble( ContextFunctions::ReadDirectionalViewMapPixelCF(orientation, level, x, y)); @@ -285,7 +285,7 @@ static PyMethodDef module_functions[] = { (PyCFunction)ContextFunctions_get_selected_fedge, METH_NOARGS, ContextFunctions_get_selected_fedge___doc__}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*-----------------------ContextFunctions module definition--------------------------------*/ @@ -304,12 +304,12 @@ int ContextFunctions_Init(PyObject *module) { PyObject *m; - if (module == NULL) { + if (module == nullptr) { return -1; } m = PyModule_Create(&module_definition); - if (m == NULL) { + if (m == nullptr) { return -1; } Py_INCREF(m); diff --git a/source/blender/freestyle/intern/python/BPy_Convert.cpp b/source/blender/freestyle/intern/python/BPy_Convert.cpp index 03f9760344b..f1d7a242a93 100644 --- a/source/blender/freestyle/intern/python/BPy_Convert.cpp +++ b/source/blender/freestyle/intern/python/BPy_Convert.cpp @@ -77,7 +77,7 @@ PyObject *Vector_from_Vec2f(Vec2f &vec) float vec_data[2]; // because vec->_coord is protected vec_data[0] = vec.x(); vec_data[1] = vec.y(); - return Vector_CreatePyObject(vec_data, 2, NULL); + return Vector_CreatePyObject(vec_data, 2, nullptr); } PyObject *Vector_from_Vec3f(Vec3f &vec) @@ -86,7 +86,7 @@ PyObject *Vector_from_Vec3f(Vec3f &vec) vec_data[0] = vec.x(); vec_data[1] = vec.y(); vec_data[2] = vec.z(); - return Vector_CreatePyObject(vec_data, 3, NULL); + return Vector_CreatePyObject(vec_data, 3, nullptr); } PyObject *Vector_from_Vec3r(Vec3r &vec) @@ -95,12 +95,12 @@ PyObject *Vector_from_Vec3r(Vec3r &vec) vec_data[0] = vec.x(); vec_data[1] = vec.y(); vec_data[2] = vec.z(); - return Vector_CreatePyObject(vec_data, 3, NULL); + return Vector_CreatePyObject(vec_data, 3, nullptr); } PyObject *BPy_Id_from_Id(Id &id) { - PyObject *py_id = Id_Type.tp_new(&Id_Type, 0, 0); + PyObject *py_id = Id_Type.tp_new(&Id_Type, nullptr, nullptr); ((BPy_Id *)py_id)->id = new Id(id.getFirst(), id.getSecond()); return py_id; } @@ -130,7 +130,7 @@ PyObject *Any_BPy_Interface0D_from_Interface0D(Interface0D &if0D) } string msg("unexpected type: " + if0D.getExactTypeName()); PyErr_SetString(PyExc_TypeError, msg.c_str()); - return NULL; + return nullptr; } PyObject *Any_BPy_Interface1D_from_Interface1D(Interface1D &if1D) @@ -158,7 +158,7 @@ PyObject *Any_BPy_Interface1D_from_Interface1D(Interface1D &if1D) } string msg("unexpected type: " + if1D.getExactTypeName()); PyErr_SetString(PyExc_TypeError, msg.c_str()); - return NULL; + return nullptr; } PyObject *Any_BPy_FEdge_from_FEdge(FEdge &fe) @@ -174,7 +174,7 @@ PyObject *Any_BPy_FEdge_from_FEdge(FEdge &fe) } string msg("unexpected type: " + fe.getExactTypeName()); PyErr_SetString(PyExc_TypeError, msg.c_str()); - return NULL; + return nullptr; } PyObject *Any_BPy_ViewVertex_from_ViewVertex(ViewVertex &vv) @@ -190,12 +190,12 @@ PyObject *Any_BPy_ViewVertex_from_ViewVertex(ViewVertex &vv) } string msg("unexpected type: " + vv.getExactTypeName()); PyErr_SetString(PyExc_TypeError, msg.c_str()); - return NULL; + return nullptr; } PyObject *BPy_Interface0D_from_Interface0D(Interface0D &if0D) { - PyObject *py_if0D = Interface0D_Type.tp_new(&Interface0D_Type, 0, 0); + PyObject *py_if0D = Interface0D_Type.tp_new(&Interface0D_Type, nullptr, nullptr); ((BPy_Interface0D *)py_if0D)->if0D = &if0D; ((BPy_Interface0D *)py_if0D)->borrowed = true; return py_if0D; @@ -203,7 +203,7 @@ PyObject *BPy_Interface0D_from_Interface0D(Interface0D &if0D) PyObject *BPy_Interface1D_from_Interface1D(Interface1D &if1D) { - PyObject *py_if1D = Interface1D_Type.tp_new(&Interface1D_Type, 0, 0); + PyObject *py_if1D = Interface1D_Type.tp_new(&Interface1D_Type, nullptr, nullptr); ((BPy_Interface1D *)py_if1D)->if1D = &if1D; ((BPy_Interface1D *)py_if1D)->borrowed = true; return py_if1D; @@ -211,7 +211,7 @@ PyObject *BPy_Interface1D_from_Interface1D(Interface1D &if1D) PyObject *BPy_SVertex_from_SVertex(SVertex &sv) { - PyObject *py_sv = SVertex_Type.tp_new(&SVertex_Type, 0, 0); + PyObject *py_sv = SVertex_Type.tp_new(&SVertex_Type, nullptr, nullptr); ((BPy_SVertex *)py_sv)->sv = &sv; ((BPy_SVertex *)py_sv)->py_if0D.if0D = ((BPy_SVertex *)py_sv)->sv; ((BPy_SVertex *)py_sv)->py_if0D.borrowed = true; @@ -220,7 +220,7 @@ PyObject *BPy_SVertex_from_SVertex(SVertex &sv) PyObject *BPy_FEdgeSharp_from_FEdgeSharp(FEdgeSharp &fes) { - PyObject *py_fe = FEdgeSharp_Type.tp_new(&FEdgeSharp_Type, 0, 0); + PyObject *py_fe = FEdgeSharp_Type.tp_new(&FEdgeSharp_Type, nullptr, nullptr); ((BPy_FEdgeSharp *)py_fe)->fes = &fes; ((BPy_FEdgeSharp *)py_fe)->py_fe.fe = ((BPy_FEdgeSharp *)py_fe)->fes; ((BPy_FEdgeSharp *)py_fe)->py_fe.py_if1D.if1D = ((BPy_FEdgeSharp *)py_fe)->fes; @@ -230,7 +230,7 @@ PyObject *BPy_FEdgeSharp_from_FEdgeSharp(FEdgeSharp &fes) PyObject *BPy_FEdgeSmooth_from_FEdgeSmooth(FEdgeSmooth &fes) { - PyObject *py_fe = FEdgeSmooth_Type.tp_new(&FEdgeSmooth_Type, 0, 0); + PyObject *py_fe = FEdgeSmooth_Type.tp_new(&FEdgeSmooth_Type, nullptr, nullptr); ((BPy_FEdgeSmooth *)py_fe)->fes = &fes; ((BPy_FEdgeSmooth *)py_fe)->py_fe.fe = ((BPy_FEdgeSmooth *)py_fe)->fes; ((BPy_FEdgeSmooth *)py_fe)->py_fe.py_if1D.if1D = ((BPy_FEdgeSmooth *)py_fe)->fes; @@ -240,7 +240,7 @@ PyObject *BPy_FEdgeSmooth_from_FEdgeSmooth(FEdgeSmooth &fes) PyObject *BPy_FEdge_from_FEdge(FEdge &fe) { - PyObject *py_fe = FEdge_Type.tp_new(&FEdge_Type, 0, 0); + PyObject *py_fe = FEdge_Type.tp_new(&FEdge_Type, nullptr, nullptr); ((BPy_FEdge *)py_fe)->fe = &fe; ((BPy_FEdge *)py_fe)->py_if1D.if1D = ((BPy_FEdge *)py_fe)->fe; ((BPy_FEdge *)py_fe)->py_if1D.borrowed = true; @@ -251,14 +251,14 @@ PyObject *BPy_Nature_from_Nature(unsigned short n) { PyObject *args = PyTuple_New(1); PyTuple_SET_ITEM(args, 0, PyLong_FromLong(n)); - PyObject *py_n = Nature_Type.tp_new(&Nature_Type, args, NULL); + PyObject *py_n = Nature_Type.tp_new(&Nature_Type, args, nullptr); Py_DECREF(args); return py_n; } PyObject *BPy_Stroke_from_Stroke(Stroke &s) { - PyObject *py_s = Stroke_Type.tp_new(&Stroke_Type, 0, 0); + PyObject *py_s = Stroke_Type.tp_new(&Stroke_Type, nullptr, nullptr); ((BPy_Stroke *)py_s)->s = &s; ((BPy_Stroke *)py_s)->py_if1D.if1D = ((BPy_Stroke *)py_s)->s; ((BPy_Stroke *)py_s)->py_if1D.borrowed = true; @@ -267,7 +267,7 @@ PyObject *BPy_Stroke_from_Stroke(Stroke &s) PyObject *BPy_StrokeAttribute_from_StrokeAttribute(StrokeAttribute &sa) { - PyObject *py_sa = StrokeAttribute_Type.tp_new(&StrokeAttribute_Type, 0, 0); + PyObject *py_sa = StrokeAttribute_Type.tp_new(&StrokeAttribute_Type, nullptr, nullptr); ((BPy_StrokeAttribute *)py_sa)->sa = &sa; ((BPy_StrokeAttribute *)py_sa)->borrowed = true; return py_sa; @@ -277,14 +277,14 @@ PyObject *BPy_MediumType_from_MediumType(Stroke::MediumType n) { PyObject *args = PyTuple_New(1); PyTuple_SET_ITEM(args, 0, PyLong_FromLong(n)); - PyObject *py_mt = MediumType_Type.tp_new(&MediumType_Type, args, NULL); + PyObject *py_mt = MediumType_Type.tp_new(&MediumType_Type, args, nullptr); Py_DECREF(args); return py_mt; } PyObject *BPy_StrokeVertex_from_StrokeVertex(StrokeVertex &sv) { - PyObject *py_sv = StrokeVertex_Type.tp_new(&StrokeVertex_Type, 0, 0); + PyObject *py_sv = StrokeVertex_Type.tp_new(&StrokeVertex_Type, nullptr, nullptr); ((BPy_StrokeVertex *)py_sv)->sv = &sv; ((BPy_StrokeVertex *)py_sv)->py_cp.cp = ((BPy_StrokeVertex *)py_sv)->sv; ((BPy_StrokeVertex *)py_sv)->py_cp.py_if0D.if0D = ((BPy_StrokeVertex *)py_sv)->sv; @@ -294,7 +294,7 @@ PyObject *BPy_StrokeVertex_from_StrokeVertex(StrokeVertex &sv) PyObject *BPy_ViewVertex_from_ViewVertex(ViewVertex &vv) { - PyObject *py_vv = ViewVertex_Type.tp_new(&ViewVertex_Type, 0, 0); + PyObject *py_vv = ViewVertex_Type.tp_new(&ViewVertex_Type, nullptr, nullptr); ((BPy_ViewVertex *)py_vv)->vv = &vv; ((BPy_ViewVertex *)py_vv)->py_if0D.if0D = ((BPy_ViewVertex *)py_vv)->vv; ((BPy_ViewVertex *)py_vv)->py_if0D.borrowed = true; @@ -303,7 +303,7 @@ PyObject *BPy_ViewVertex_from_ViewVertex(ViewVertex &vv) PyObject *BPy_NonTVertex_from_NonTVertex(NonTVertex &ntv) { - PyObject *py_ntv = NonTVertex_Type.tp_new(&NonTVertex_Type, 0, 0); + PyObject *py_ntv = NonTVertex_Type.tp_new(&NonTVertex_Type, nullptr, nullptr); ((BPy_NonTVertex *)py_ntv)->ntv = &ntv; ((BPy_NonTVertex *)py_ntv)->py_vv.vv = ((BPy_NonTVertex *)py_ntv)->ntv; ((BPy_NonTVertex *)py_ntv)->py_vv.py_if0D.if0D = ((BPy_NonTVertex *)py_ntv)->ntv; @@ -313,7 +313,7 @@ PyObject *BPy_NonTVertex_from_NonTVertex(NonTVertex &ntv) PyObject *BPy_TVertex_from_TVertex(TVertex &tv) { - PyObject *py_tv = TVertex_Type.tp_new(&TVertex_Type, 0, 0); + PyObject *py_tv = TVertex_Type.tp_new(&TVertex_Type, nullptr, nullptr); ((BPy_TVertex *)py_tv)->tv = &tv; ((BPy_TVertex *)py_tv)->py_vv.vv = ((BPy_TVertex *)py_tv)->tv; ((BPy_TVertex *)py_tv)->py_vv.py_if0D.if0D = ((BPy_TVertex *)py_tv)->tv; @@ -323,14 +323,14 @@ PyObject *BPy_TVertex_from_TVertex(TVertex &tv) PyObject *BPy_BBox_from_BBox(const BBox<Vec3r> &bb) { - PyObject *py_bb = BBox_Type.tp_new(&BBox_Type, 0, 0); + PyObject *py_bb = BBox_Type.tp_new(&BBox_Type, nullptr, nullptr); ((BPy_BBox *)py_bb)->bb = new BBox<Vec3r>(bb); return py_bb; } PyObject *BPy_ViewEdge_from_ViewEdge(ViewEdge &ve) { - PyObject *py_ve = ViewEdge_Type.tp_new(&ViewEdge_Type, 0, 0); + PyObject *py_ve = ViewEdge_Type.tp_new(&ViewEdge_Type, nullptr, nullptr); ((BPy_ViewEdge *)py_ve)->ve = &ve; ((BPy_ViewEdge *)py_ve)->py_if1D.if1D = ((BPy_ViewEdge *)py_ve)->ve; ((BPy_ViewEdge *)py_ve)->py_if1D.borrowed = true; @@ -339,7 +339,7 @@ PyObject *BPy_ViewEdge_from_ViewEdge(ViewEdge &ve) PyObject *BPy_Chain_from_Chain(Chain &c) { - PyObject *py_c = Chain_Type.tp_new(&Chain_Type, 0, 0); + PyObject *py_c = Chain_Type.tp_new(&Chain_Type, nullptr, nullptr); ((BPy_Chain *)py_c)->c = &c; ((BPy_Chain *)py_c)->py_c.c = ((BPy_Chain *)py_c)->c; ((BPy_Chain *)py_c)->py_c.py_if1D.if1D = ((BPy_Chain *)py_c)->c; @@ -349,7 +349,7 @@ PyObject *BPy_Chain_from_Chain(Chain &c) PyObject *BPy_SShape_from_SShape(SShape &ss) { - PyObject *py_ss = SShape_Type.tp_new(&SShape_Type, 0, 0); + PyObject *py_ss = SShape_Type.tp_new(&SShape_Type, nullptr, nullptr); ((BPy_SShape *)py_ss)->ss = &ss; ((BPy_SShape *)py_ss)->borrowed = true; return py_ss; @@ -357,16 +357,16 @@ PyObject *BPy_SShape_from_SShape(SShape &ss) PyObject *BPy_ViewShape_from_ViewShape(ViewShape &vs) { - PyObject *py_vs = ViewShape_Type.tp_new(&ViewShape_Type, 0, 0); + PyObject *py_vs = ViewShape_Type.tp_new(&ViewShape_Type, nullptr, nullptr); ((BPy_ViewShape *)py_vs)->vs = &vs; ((BPy_ViewShape *)py_vs)->borrowed = true; - ((BPy_ViewShape *)py_vs)->py_ss = NULL; + ((BPy_ViewShape *)py_vs)->py_ss = nullptr; return py_vs; } PyObject *BPy_FrsMaterial_from_FrsMaterial(const FrsMaterial &m) { - PyObject *py_m = FrsMaterial_Type.tp_new(&FrsMaterial_Type, 0, 0); + PyObject *py_m = FrsMaterial_Type.tp_new(&FrsMaterial_Type, nullptr, nullptr); ((BPy_FrsMaterial *)py_m)->m = new FrsMaterial(m); return py_m; } @@ -375,14 +375,14 @@ PyObject *BPy_IntegrationType_from_IntegrationType(IntegrationType i) { PyObject *args = PyTuple_New(1); PyTuple_SET_ITEM(args, 0, PyLong_FromLong(i)); - PyObject *py_it = IntegrationType_Type.tp_new(&IntegrationType_Type, args, NULL); + PyObject *py_it = IntegrationType_Type.tp_new(&IntegrationType_Type, args, nullptr); Py_DECREF(args); return py_it; } PyObject *BPy_CurvePoint_from_CurvePoint(CurvePoint &cp) { - PyObject *py_cp = CurvePoint_Type.tp_new(&CurvePoint_Type, 0, 0); + PyObject *py_cp = CurvePoint_Type.tp_new(&CurvePoint_Type, nullptr, nullptr); // CurvePointIterator::operator*() returns a reference of a class data // member whose value is mutable upon iteration over different CurvePoints. // It is likely that such a mutable reference is passed to this function, @@ -408,7 +408,7 @@ PyObject *BPy_directedViewEdge_from_directedViewEdge(ViewVertex::directedViewEdg PyObject *BPy_AdjacencyIterator_from_AdjacencyIterator(AdjacencyIterator &a_it) { - PyObject *py_a_it = AdjacencyIterator_Type.tp_new(&AdjacencyIterator_Type, 0, 0); + PyObject *py_a_it = AdjacencyIterator_Type.tp_new(&AdjacencyIterator_Type, nullptr, nullptr); ((BPy_AdjacencyIterator *)py_a_it)->a_it = new AdjacencyIterator(a_it); ((BPy_AdjacencyIterator *)py_a_it)->py_it.it = ((BPy_AdjacencyIterator *)py_a_it)->a_it; ((BPy_AdjacencyIterator *)py_a_it)->at_start = true; @@ -418,7 +418,8 @@ PyObject *BPy_AdjacencyIterator_from_AdjacencyIterator(AdjacencyIterator &a_it) PyObject *BPy_Interface0DIterator_from_Interface0DIterator(Interface0DIterator &if0D_it, bool reversed) { - PyObject *py_if0D_it = Interface0DIterator_Type.tp_new(&Interface0DIterator_Type, 0, 0); + PyObject *py_if0D_it = Interface0DIterator_Type.tp_new( + &Interface0DIterator_Type, nullptr, nullptr); ((BPy_Interface0DIterator *)py_if0D_it)->if0D_it = new Interface0DIterator(if0D_it); ((BPy_Interface0DIterator *)py_if0D_it)->py_it.it = ((BPy_Interface0DIterator *)py_if0D_it)->if0D_it; @@ -429,7 +430,7 @@ PyObject *BPy_Interface0DIterator_from_Interface0DIterator(Interface0DIterator & PyObject *BPy_CurvePointIterator_from_CurvePointIterator(CurveInternal::CurvePointIterator &cp_it) { - PyObject *py_cp_it = CurvePointIterator_Type.tp_new(&CurvePointIterator_Type, 0, 0); + PyObject *py_cp_it = CurvePointIterator_Type.tp_new(&CurvePointIterator_Type, nullptr, nullptr); ((BPy_CurvePointIterator *)py_cp_it)->cp_it = new CurveInternal::CurvePointIterator(cp_it); ((BPy_CurvePointIterator *)py_cp_it)->py_it.it = ((BPy_CurvePointIterator *)py_cp_it)->cp_it; return py_cp_it; @@ -438,7 +439,8 @@ PyObject *BPy_CurvePointIterator_from_CurvePointIterator(CurveInternal::CurvePoi PyObject *BPy_StrokeVertexIterator_from_StrokeVertexIterator( StrokeInternal::StrokeVertexIterator &sv_it, bool reversed) { - PyObject *py_sv_it = StrokeVertexIterator_Type.tp_new(&StrokeVertexIterator_Type, 0, 0); + PyObject *py_sv_it = StrokeVertexIterator_Type.tp_new( + &StrokeVertexIterator_Type, nullptr, nullptr); ((BPy_StrokeVertexIterator *)py_sv_it)->sv_it = new StrokeInternal::StrokeVertexIterator(sv_it); ((BPy_StrokeVertexIterator *)py_sv_it)->py_it.it = ((BPy_StrokeVertexIterator *)py_sv_it)->sv_it; ((BPy_StrokeVertexIterator *)py_sv_it)->at_start = true; @@ -448,7 +450,7 @@ PyObject *BPy_StrokeVertexIterator_from_StrokeVertexIterator( PyObject *BPy_SVertexIterator_from_SVertexIterator(ViewEdgeInternal::SVertexIterator &sv_it) { - PyObject *py_sv_it = SVertexIterator_Type.tp_new(&SVertexIterator_Type, 0, 0); + PyObject *py_sv_it = SVertexIterator_Type.tp_new(&SVertexIterator_Type, nullptr, nullptr); ((BPy_SVertexIterator *)py_sv_it)->sv_it = new ViewEdgeInternal::SVertexIterator(sv_it); ((BPy_SVertexIterator *)py_sv_it)->py_it.it = ((BPy_SVertexIterator *)py_sv_it)->sv_it; return py_sv_it; @@ -457,7 +459,8 @@ PyObject *BPy_SVertexIterator_from_SVertexIterator(ViewEdgeInternal::SVertexIter PyObject *BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator( ViewVertexInternal::orientedViewEdgeIterator &ove_it, bool reversed) { - PyObject *py_ove_it = orientedViewEdgeIterator_Type.tp_new(&orientedViewEdgeIterator_Type, 0, 0); + PyObject *py_ove_it = orientedViewEdgeIterator_Type.tp_new( + &orientedViewEdgeIterator_Type, nullptr, nullptr); ((BPy_orientedViewEdgeIterator *)py_ove_it)->ove_it = new ViewVertexInternal::orientedViewEdgeIterator(ove_it); ((BPy_orientedViewEdgeIterator *)py_ove_it)->py_it.it = @@ -469,7 +472,7 @@ PyObject *BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator( PyObject *BPy_ViewEdgeIterator_from_ViewEdgeIterator(ViewEdgeInternal::ViewEdgeIterator &ve_it) { - PyObject *py_ve_it = ViewEdgeIterator_Type.tp_new(&ViewEdgeIterator_Type, 0, 0); + PyObject *py_ve_it = ViewEdgeIterator_Type.tp_new(&ViewEdgeIterator_Type, nullptr, nullptr); ((BPy_ViewEdgeIterator *)py_ve_it)->ve_it = new ViewEdgeInternal::ViewEdgeIterator(ve_it); ((BPy_ViewEdgeIterator *)py_ve_it)->py_it.it = ((BPy_ViewEdgeIterator *)py_ve_it)->ve_it; return py_ve_it; @@ -477,7 +480,7 @@ PyObject *BPy_ViewEdgeIterator_from_ViewEdgeIterator(ViewEdgeInternal::ViewEdgeI PyObject *BPy_ChainingIterator_from_ChainingIterator(ChainingIterator &c_it) { - PyObject *py_c_it = ChainingIterator_Type.tp_new(&ChainingIterator_Type, 0, 0); + PyObject *py_c_it = ChainingIterator_Type.tp_new(&ChainingIterator_Type, nullptr, nullptr); ((BPy_ChainingIterator *)py_c_it)->c_it = new ChainingIterator(c_it); ((BPy_ChainingIterator *)py_c_it)->py_ve_it.py_it.it = ((BPy_ChainingIterator *)py_c_it)->c_it; return py_c_it; @@ -485,7 +488,8 @@ PyObject *BPy_ChainingIterator_from_ChainingIterator(ChainingIterator &c_it) PyObject *BPy_ChainPredicateIterator_from_ChainPredicateIterator(ChainPredicateIterator &cp_it) { - PyObject *py_cp_it = ChainPredicateIterator_Type.tp_new(&ChainPredicateIterator_Type, 0, 0); + PyObject *py_cp_it = ChainPredicateIterator_Type.tp_new( + &ChainPredicateIterator_Type, nullptr, nullptr); ((BPy_ChainPredicateIterator *)py_cp_it)->cp_it = new ChainPredicateIterator(cp_it); ((BPy_ChainPredicateIterator *)py_cp_it)->py_c_it.py_ve_it.py_it.it = ((BPy_ChainPredicateIterator *)py_cp_it)->cp_it; @@ -494,7 +498,8 @@ PyObject *BPy_ChainPredicateIterator_from_ChainPredicateIterator(ChainPredicateI PyObject *BPy_ChainSilhouetteIterator_from_ChainSilhouetteIterator(ChainSilhouetteIterator &cs_it) { - PyObject *py_cs_it = ChainSilhouetteIterator_Type.tp_new(&ChainSilhouetteIterator_Type, 0, 0); + PyObject *py_cs_it = ChainSilhouetteIterator_Type.tp_new( + &ChainSilhouetteIterator_Type, nullptr, nullptr); ((BPy_ChainSilhouetteIterator *)py_cs_it)->cs_it = new ChainSilhouetteIterator(cs_it); ((BPy_ChainSilhouetteIterator *)py_cs_it)->py_c_it.py_ve_it.py_it.it = ((BPy_ChainSilhouetteIterator *)py_cs_it)->cs_it; @@ -648,10 +653,10 @@ static bool float_array_from_PyList(PyObject *obj, float *v, int n) v[i] = PyFloat_AsDouble(PyList_GET_ITEM(obj, i)); if (v[i] == -1.0f && PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "list elements must be a number"); - return 0; + return false; } } - return 1; + return true; } bool Vec2f_ptr_from_PyList(PyObject *obj, Vec2f &vec) @@ -707,10 +712,10 @@ static bool float_array_from_PyTuple(PyObject *obj, float *v, int n) v[i] = PyFloat_AsDouble(PyTuple_GET_ITEM(obj, i)); if (v[i] == -1.0f && PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "tuple elements must be a number"); - return 0; + return false; } } - return 1; + return true; } bool Vec2f_ptr_from_PyTuple(PyObject *obj, Vec2f &vec) @@ -766,21 +771,21 @@ bool float_array_from_PyObject(PyObject *obj, float *v, int n) { if (VectorObject_Check(obj) && ((VectorObject *)obj)->size == n) { if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1) { - return 0; + return false; } for (int i = 0; i < n; i++) { v[i] = ((VectorObject *)obj)->vec[i]; } - return 1; + return true; } if (ColorObject_Check(obj) && n == 3) { if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1) { - return 0; + return false; } for (int i = 0; i < n; i++) { v[i] = ((ColorObject *)obj)->col[i]; } - return 1; + return true; } if (PyList_Check(obj) && PyList_GET_SIZE(obj) == n) { return float_array_from_PyList(obj, v, n); @@ -788,7 +793,7 @@ bool float_array_from_PyObject(PyObject *obj, float *v, int n) if (PyTuple_Check(obj) && PyTuple_GET_SIZE(obj) == n) { return float_array_from_PyTuple(obj, v, n); } - return 0; + return false; } int convert_v4(PyObject *obj, void *v) diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp index 9796dcda964..db85292c6c0 100644 --- a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp +++ b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp @@ -72,7 +72,7 @@ static PyObject *Freestyle_getCurrentScene(PyObject * /*self*/) Scene *scene = g_freestyle.scene; if (!scene) { PyErr_SetString(PyExc_TypeError, "current scene not available"); - return NULL; + return nullptr; } PointerRNA ptr_scene; RNA_pointer_create(&scene->id, &RNA_Scene, scene, &ptr_scene); @@ -166,12 +166,12 @@ static PyObject *Freestyle_blendRamp(PyObject * /*self*/, PyObject *args) float a[3], fac, b[3]; if (!PyArg_ParseTuple(args, "sOfO", &s, &obj1, &fac, &obj2)) { - return NULL; + return nullptr; } type = ramp_blend_type(s); if (type < 0) { PyErr_SetString(PyExc_TypeError, "argument 1 is an unknown ramp blend type"); - return NULL; + return nullptr; } if (mathutils_array_parse(a, 3, @@ -179,7 +179,7 @@ static PyObject *Freestyle_blendRamp(PyObject * /*self*/, PyObject *args) obj1, "argument 2 must be a 3D vector " "(either a tuple/list of 3 elements or Vector)") == -1) { - return NULL; + return nullptr; } if (mathutils_array_parse(b, 3, @@ -187,10 +187,10 @@ static PyObject *Freestyle_blendRamp(PyObject * /*self*/, PyObject *args) obj2, "argument 4 must be a 3D vector " "(either a tuple/list of 3 elements or Vector)") == -1) { - return NULL; + return nullptr; } ramp_blend(type, a, fac, b); - return Vector_CreatePyObject(a, 3, NULL); + return Vector_CreatePyObject(a, 3, nullptr); } #include "BKE_colorband.h" /* BKE_colorband_evaluate() */ @@ -214,18 +214,18 @@ static PyObject *Freestyle_evaluateColorRamp(PyObject * /*self*/, PyObject *args float in, out[4]; if (!(PyArg_ParseTuple(args, "O!f", &pyrna_struct_Type, &py_srna, &in))) { - return NULL; + return nullptr; } if (!RNA_struct_is_a(py_srna->ptr.type, &RNA_ColorRamp)) { PyErr_SetString(PyExc_TypeError, "1st argument is not a ColorRamp object"); - return NULL; + return nullptr; } coba = (ColorBand *)py_srna->ptr.data; if (!BKE_colorband_evaluate(coba, in, out)) { PyErr_SetString(PyExc_ValueError, "failed to evaluate the color ramp"); - return NULL; + return nullptr; } - return Vector_CreatePyObject(out, 4, NULL); + return Vector_CreatePyObject(out, 4, nullptr); } #include "BKE_colortools.h" /* BKE_curvemapping_evaluateF() */ @@ -253,22 +253,22 @@ static PyObject *Freestyle_evaluateCurveMappingF(PyObject * /*self*/, PyObject * float value; if (!(PyArg_ParseTuple(args, "O!if", &pyrna_struct_Type, &py_srna, &cur, &value))) { - return NULL; + return nullptr; } if (!RNA_struct_is_a(py_srna->ptr.type, &RNA_CurveMapping)) { PyErr_SetString(PyExc_TypeError, "1st argument is not a CurveMapping object"); - return NULL; + return nullptr; } if (cur < 0 || cur > 3) { PyErr_SetString(PyExc_ValueError, "2nd argument is out of range"); - return NULL; + return nullptr; } cumap = (CurveMapping *)py_srna->ptr.data; BKE_curvemapping_init(cumap); /* disable extrapolation if enabled */ if ((cumap->flag & CUMA_EXTEND_EXTRAPOLATE)) { cumap->flag &= ~CUMA_EXTEND_EXTRAPOLATE; - BKE_curvemapping_changed(cumap, 0); + BKE_curvemapping_changed(cumap, false); } return PyFloat_FromDouble(BKE_curvemapping_evaluateF(cumap, cur, value)); } @@ -515,7 +515,7 @@ static PyMethodDef module_functions[] = { (PyCFunction)Freestyle_evaluateCurveMappingF, METH_VARARGS, Freestyle_evaluateCurveMappingF___doc__}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*-----------------------Freestyle module definition---------------------------*/ @@ -536,7 +536,7 @@ PyObject *Freestyle_Init(void) // initialize modules module = PyModule_Create(&module_definition); if (!module) { - return NULL; + return nullptr; } PyDict_SetItemString(PySys_GetObject("modules"), module_definition.m_name, module); diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp index 3efabbfbdf5..4df4031e7ce 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp @@ -33,7 +33,7 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int FrsMaterial_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -80,10 +80,10 @@ PyDoc_STRVAR( static int FrsMaterial_init(BPy_FrsMaterial *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_1[] = {"brother", nullptr}; static const char *kwlist_2[] = { - "line", "diffuse", "ambient", "specular", "emission", "shininess", "priority", NULL}; - PyObject *brother = 0; + "line", "diffuse", "ambient", "specular", "emission", "shininess", "priority", nullptr}; + PyObject *brother = nullptr; float line[4], diffuse[4], ambient[4], specular[4], emission[4], shininess; int priority; @@ -456,46 +456,46 @@ static PyGetSetDef BPy_FrsMaterial_getseters[] = { (getter)FrsMaterial_line_get, (setter)FrsMaterial_line_set, FrsMaterial_line_doc, - NULL}, + nullptr}, {"diffuse", (getter)FrsMaterial_diffuse_get, (setter)FrsMaterial_diffuse_set, FrsMaterial_diffuse_doc, - NULL}, + nullptr}, {"specular", (getter)FrsMaterial_specular_get, (setter)FrsMaterial_specular_set, FrsMaterial_specular_doc, - NULL}, + nullptr}, {"ambient", (getter)FrsMaterial_ambient_get, (setter)FrsMaterial_ambient_set, FrsMaterial_ambient_doc, - NULL}, + nullptr}, {"emission", (getter)FrsMaterial_emission_get, (setter)FrsMaterial_emission_set, FrsMaterial_emission_doc, - NULL}, + nullptr}, {"shininess", (getter)FrsMaterial_shininess_get, (setter)FrsMaterial_shininess_set, FrsMaterial_shininess_doc, - NULL}, + nullptr}, {"priority", (getter)FrsMaterial_priority_get, (setter)FrsMaterial_priority_set, FrsMaterial_priority_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; static PyObject *BPy_FrsMaterial_richcmpr(PyObject *objectA, PyObject *objectB, int comparison_type) { - const BPy_FrsMaterial *matA = NULL, *matB = NULL; - bool result = 0; + const BPy_FrsMaterial *matA = nullptr, *matB = nullptr; + bool result = false; if (!BPy_FrsMaterial_Check(objectA) || !BPy_FrsMaterial_Check(objectB)) { if (comparison_type == Py_NE) { @@ -517,7 +517,7 @@ static PyObject *BPy_FrsMaterial_richcmpr(PyObject *objectA, break; default: PyErr_SetString(PyExc_TypeError, "Material does not support this comparison type"); - return NULL; + return nullptr; } if (result == true) { @@ -534,43 +534,43 @@ static Py_hash_t FrsMaterial_hash(PyObject *self) /*-----------------------BPy_FrsMaterial type definition ------------------------------*/ PyTypeObject FrsMaterial_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Material", /* tp_name */ - sizeof(BPy_FrsMaterial), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)FrsMaterial_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)FrsMaterial_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)FrsMaterial_hash, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FrsMaterial_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)BPy_FrsMaterial_richcmpr, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_FrsMaterial_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FrsMaterial_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "Material", /* tp_name */ + sizeof(BPy_FrsMaterial), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)FrsMaterial_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)FrsMaterial_repr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + (hashfunc)FrsMaterial_hash, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FrsMaterial_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + (richcmpfunc)BPy_FrsMaterial_richcmpr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_FrsMaterial_getseters, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FrsMaterial_init, /* tp_init */ + nullptr, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp index 6bd4ae6b5fe..a62b5896164 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp @@ -34,7 +34,7 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int FrsNoise_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -63,7 +63,7 @@ PyDoc_STRVAR(FrsNoise_doc, static int FrsNoise_init(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"seed", NULL}; + static const char *kwlist[] = {"seed", nullptr}; long seed = -1; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|l", (char **)kwlist, &seed)) { @@ -104,11 +104,11 @@ PyDoc_STRVAR(FrsNoise_turbulence1_doc, static PyObject *FrsNoise_drand(BPy_FrsNoise * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"seed", NULL}; + static const char *kwlist[] = {"seed", nullptr}; long seed = 0; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|I", (char **)kwlist, &seed)) { PyErr_SetString(PyExc_TypeError, "optional argument 1 must be of type int"); - return NULL; + return nullptr; } if (seed) { RandGen::srand48(seed); @@ -118,25 +118,25 @@ static PyObject *FrsNoise_drand(BPy_FrsNoise * /*self*/, PyObject *args, PyObjec static PyObject *FrsNoise_turbulence_smooth(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"v", "oct", NULL}; + static const char *kwlist[] = {"v", "oct", nullptr}; double x; // note: this has to be a double (not float) unsigned nbOctaves = 8; if (!PyArg_ParseTupleAndKeywords(args, kwds, "d|I", (char **)kwlist, &x, &nbOctaves)) { - return NULL; + return nullptr; } return PyFloat_FromDouble(self->pn->turbulenceSmooth(x, nbOctaves)); } static PyObject *FrsNoise_turbulence1(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"v", "freq", "amp", "oct", NULL}; + static const char *kwlist[] = {"v", "freq", "amp", "oct", nullptr}; float f1, f2, f3; unsigned int i = 4; if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff|I", (char **)kwlist, &f1, &f2, &f3, &i)) { - return NULL; + return nullptr; } return PyFloat_FromDouble(self->n->turbulence1(f1, f2, f3, i)); } @@ -159,19 +159,19 @@ PyDoc_STRVAR(FrsNoise_turbulence2_doc, static PyObject *FrsNoise_turbulence2(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"v", "freq", "amp", "oct", NULL}; + static const char *kwlist[] = {"v", "freq", "amp", "oct", nullptr}; PyObject *obj1; float f2, f3; unsigned int i = 4; Vec2f vec; if (!PyArg_ParseTupleAndKeywords(args, kwds, "Off|I", (char **)kwlist, &obj1, &f2, &f3, &i)) { - return NULL; + return nullptr; } if (!Vec2f_ptr_from_PyObject(obj1, vec)) { PyErr_SetString(PyExc_TypeError, "argument 1 must be a 2D vector (either a list of 2 elements or Vector)"); - return NULL; + return nullptr; } float t = self->n->turbulence2(vec, f2, f3, i); return PyFloat_FromDouble(t); @@ -195,19 +195,19 @@ PyDoc_STRVAR(FrsNoise_turbulence3_doc, static PyObject *FrsNoise_turbulence3(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"v", "freq", "amp", "oct", NULL}; + static const char *kwlist[] = {"v", "freq", "amp", "oct", nullptr}; PyObject *obj1; float f2, f3; unsigned int i = 4; Vec3f vec; if (!PyArg_ParseTupleAndKeywords(args, kwds, "Off|I", (char **)kwlist, &obj1, &f2, &f3, &i)) { - return NULL; + return nullptr; } if (!Vec3f_ptr_from_PyObject(obj1, vec)) { PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)"); - return NULL; + return nullptr; } float t = self->n->turbulence3(vec, f2, f3, i); return PyFloat_FromDouble(t); @@ -225,11 +225,11 @@ PyDoc_STRVAR(FrsNoise_smoothNoise1_doc, static PyObject *FrsNoise_smoothNoise1(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"v", NULL}; + static const char *kwlist[] = {"v", nullptr}; float f; if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) { - return NULL; + return nullptr; } return PyFloat_FromDouble(self->n->smoothNoise1(f)); } @@ -246,17 +246,17 @@ PyDoc_STRVAR(FrsNoise_smoothNoise2_doc, static PyObject *FrsNoise_smoothNoise2(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"v", NULL}; + static const char *kwlist[] = {"v", nullptr}; PyObject *obj; Vec2f vec; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj)) { - return NULL; + return nullptr; } if (!Vec2f_ptr_from_PyObject(obj, vec)) { PyErr_SetString(PyExc_TypeError, "argument 1 must be a 2D vector (either a list of 2 elements or Vector)"); - return NULL; + return nullptr; } float t = self->n->smoothNoise2(vec); return PyFloat_FromDouble(t); @@ -274,17 +274,17 @@ PyDoc_STRVAR(FrsNoise_smoothNoise3_doc, static PyObject *FrsNoise_smoothNoise3(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"v", NULL}; + static const char *kwlist[] = {"v", nullptr}; PyObject *obj; Vec3f vec; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj)) { - return NULL; + return nullptr; } if (!Vec3f_ptr_from_PyObject(obj, vec)) { PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)"); - return NULL; + return nullptr; } float t = self->n->smoothNoise3(vec); return PyFloat_FromDouble(t); @@ -315,54 +315,54 @@ static PyMethodDef BPy_FrsNoise_methods[] = { (PyCFunction)FrsNoise_smoothNoise3, METH_VARARGS | METH_KEYWORDS, FrsNoise_smoothNoise3_doc}, - {"rand", (PyCFunction)FrsNoise_drand, METH_VARARGS | METH_KEYWORDS, NULL}, + {"rand", (PyCFunction)FrsNoise_drand, METH_VARARGS | METH_KEYWORDS, nullptr}, {"turbulence_smooth", (PyCFunction)FrsNoise_turbulence_smooth, METH_VARARGS | METH_KEYWORDS, - NULL}, - {NULL, NULL, 0, NULL}, + nullptr}, + {nullptr, nullptr, 0, nullptr}, }; /*-----------------------BPy_FrsNoise type definition ------------------------------*/ PyTypeObject FrsNoise_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Noise", /* tp_name */ - sizeof(BPy_FrsNoise), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)FrsNoise_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)FrsNoise_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FrsNoise_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_FrsNoise_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FrsNoise_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "Noise", /* tp_name */ + sizeof(BPy_FrsNoise), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)FrsNoise_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)FrsNoise_repr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FrsNoise_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_FrsNoise_methods, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FrsNoise_init, /* tp_init */ + nullptr, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_Id.cpp b/source/blender/freestyle/intern/python/BPy_Id.cpp index 8f61f7f3e14..a9baef10383 100644 --- a/source/blender/freestyle/intern/python/BPy_Id.cpp +++ b/source/blender/freestyle/intern/python/BPy_Id.cpp @@ -31,7 +31,7 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int Id_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -64,8 +64,8 @@ PyDoc_STRVAR( static int Id_init(BPy_Id *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"first", "second", NULL}; + static const char *kwlist_1[] = {"brother", nullptr}; + static const char *kwlist_2[] = {"first", "second", nullptr}; PyObject *brother; int first = 0, second = 0; @@ -159,50 +159,50 @@ static int Id_second_set(BPy_Id *self, PyObject *value, void *UNUSED(closure)) } static PyGetSetDef BPy_Id_getseters[] = { - {"first", (getter)Id_first_get, (setter)Id_first_set, Id_first_doc, NULL}, - {"second", (getter)Id_second_get, (setter)Id_second_set, Id_second_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {"first", (getter)Id_first_get, (setter)Id_first_set, Id_first_doc, nullptr}, + {"second", (getter)Id_second_get, (setter)Id_second_set, Id_second_doc, nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_Id type definition ------------------------------*/ PyTypeObject Id_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Id", /* tp_name */ + PyVarObject_HEAD_INIT(nullptr, 0) "Id", /* tp_name */ sizeof(BPy_Id), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)Id_dealloc, /* tp_dealloc */ 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ (reprfunc)Id_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ Id_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ (richcmpfunc)Id_RichCompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ BPy_Id_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)Id_init, /* tp_init */ - 0, /* tp_alloc */ + nullptr, /* tp_alloc */ PyType_GenericNew, /* tp_new */ }; diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp index 9c155db913c..ea3be83ba8d 100644 --- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp +++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp @@ -61,8 +61,8 @@ PyDoc_STRVAR(Integrator_integrate_doc, static PyObject *Integrator_integrate(PyObject * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"func", "it", "it_end", "integration_type", NULL}; - PyObject *obj1, *obj4 = 0; + static const char *kwlist[] = {"func", "it", "it_end", "integration_type", nullptr}; + PyObject *obj1, *obj4 = nullptr; BPy_Interface0DIterator *obj2, *obj3; if (!PyArg_ParseTupleAndKeywords(args, @@ -77,7 +77,7 @@ static PyObject *Integrator_integrate(PyObject * /*self*/, PyObject *args, PyObj &obj3, &IntegrationType_Type, &obj4)) { - return NULL; + return nullptr; } Interface0DIterator it(*(obj2->if0D_it)), it_end(*(obj3->if0D_it)); @@ -101,7 +101,7 @@ static PyObject *Integrator_integrate(PyObject * /*self*/, PyObject *args, PyObj string class_name(Py_TYPE(obj1)->tp_name); PyErr_SetString(PyExc_TypeError, ("unsupported function type: " + class_name).c_str()); - return NULL; + return nullptr; } /*-----------------------Integrator module docstring---------------------------------------*/ @@ -115,7 +115,7 @@ static PyMethodDef module_functions[] = { (PyCFunction)Integrator_integrate, METH_VARARGS | METH_KEYWORDS, Integrator_integrate_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*-----------------------Integrator module definition--------------------------------------*/ @@ -149,43 +149,43 @@ PyDoc_STRVAR(IntegrationType_doc, " last of the values obtained for the 0D elements."); PyTypeObject IntegrationType_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "IntegrationType", /* tp_name */ - sizeof(PyLongObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - IntegrationType_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &PyLong_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "IntegrationType", /* tp_name */ + sizeof(PyLongObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + IntegrationType_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &PyLong_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + nullptr, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /*-----------------------BPy_IntegrationType instance definitions -------------------------*/ @@ -210,7 +210,7 @@ int IntegrationType_Init(PyObject *module) { PyObject *m, *d, *f; - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -227,7 +227,7 @@ int IntegrationType_Init(PyObject *module) PyDict_SetItemString(IntegrationType_Type.tp_dict, "LAST", BPy_IntegrationType_LAST); m = PyModule_Create(&module_definition); - if (m == NULL) { + if (m == nullptr) { return -1; } Py_INCREF(m); diff --git a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp index 18e11c55bc4..3f55795ad75 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp @@ -39,7 +39,7 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int Interface0D_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -102,7 +102,7 @@ PyDoc_STRVAR(Interface0D_doc, static int Interface0D_init(BPy_Interface0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -139,16 +139,16 @@ PyDoc_STRVAR(Interface0D_get_fedge_doc, static PyObject *Interface0D_get_fedge(BPy_Interface0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; + static const char *kwlist[] = {"inter", nullptr}; PyObject *py_if0D; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist, &Interface0D_Type, &py_if0D)) { - return NULL; + return nullptr; } FEdge *fe = self->if0D->getFEdge(*(((BPy_Interface0D *)py_if0D)->if0D)); if (PyErr_Occurred()) { - return NULL; + return nullptr; } if (fe) { return Any_BPy_FEdge_from_FEdge(*fe); @@ -161,7 +161,7 @@ static PyMethodDef BPy_Interface0D_methods[] = { (PyCFunction)Interface0D_get_fedge, METH_VARARGS | METH_KEYWORDS, Interface0D_get_fedge_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*----------------------Interface1D get/setters ----------------------------*/ @@ -185,7 +185,7 @@ static PyObject *Interface0D_point_3d_get(BPy_Interface0D *self, void *UNUSED(cl { Vec3f p(self->if0D->getPoint3D()); if (PyErr_Occurred()) { - return NULL; + return nullptr; } return Vector_from_Vec3f(p); } @@ -199,7 +199,7 @@ static PyObject *Interface0D_projected_x_get(BPy_Interface0D *self, void *UNUSED { real x = self->if0D->getProjectedX(); if (PyErr_Occurred()) { - return NULL; + return nullptr; } return PyFloat_FromDouble(x); } @@ -213,7 +213,7 @@ static PyObject *Interface0D_projected_y_get(BPy_Interface0D *self, void *UNUSED { real y = self->if0D->getProjectedY(); if (PyErr_Occurred()) { - return NULL; + return nullptr; } return PyFloat_FromDouble(y); } @@ -227,7 +227,7 @@ static PyObject *Interface0D_projected_z_get(BPy_Interface0D *self, void *UNUSED { real z = self->if0D->getProjectedZ(); if (PyErr_Occurred()) { - return NULL; + return nullptr; } return PyFloat_FromDouble(z); } @@ -241,7 +241,7 @@ static PyObject *Interface0D_point_2d_get(BPy_Interface0D *self, void *UNUSED(cl { Vec2f p(self->if0D->getPoint2D()); if (PyErr_Occurred()) { - return NULL; + return nullptr; } return Vector_from_Vec2f(p); } @@ -255,7 +255,7 @@ static PyObject *Interface0D_id_get(BPy_Interface0D *self, void *UNUSED(closure) { Id id(self->if0D->getId()); if (PyErr_Occurred()) { - return NULL; + return nullptr; } return BPy_Id_from_Id(id); // return a copy } @@ -269,75 +269,83 @@ static PyObject *Interface0D_nature_get(BPy_Interface0D *self, void *UNUSED(clos { Nature::VertexNature nature = self->if0D->getNature(); if (PyErr_Occurred()) { - return NULL; + return nullptr; } return BPy_Nature_from_Nature(nature); } static PyGetSetDef BPy_Interface0D_getseters[] = { - {"name", (getter)Interface0D_name_get, (setter)NULL, Interface0D_name_doc, NULL}, - {"point_3d", (getter)Interface0D_point_3d_get, (setter)NULL, Interface0D_point_3d_doc, NULL}, + {"name", (getter)Interface0D_name_get, (setter) nullptr, Interface0D_name_doc, nullptr}, + {"point_3d", + (getter)Interface0D_point_3d_get, + (setter) nullptr, + Interface0D_point_3d_doc, + nullptr}, {"projected_x", (getter)Interface0D_projected_x_get, - (setter)NULL, + (setter) nullptr, Interface0D_projected_x_doc, - NULL}, + nullptr}, {"projected_y", (getter)Interface0D_projected_y_get, - (setter)NULL, + (setter) nullptr, Interface0D_projected_y_doc, - NULL}, + nullptr}, {"projected_z", (getter)Interface0D_projected_z_get, - (setter)NULL, + (setter) nullptr, Interface0D_projected_z_doc, - NULL}, - {"point_2d", (getter)Interface0D_point_2d_get, (setter)NULL, Interface0D_point_2d_doc, NULL}, - {"id", (getter)Interface0D_id_get, (setter)NULL, Interface0D_id_doc, NULL}, - {"nature", (getter)Interface0D_nature_get, (setter)NULL, Interface0D_nature_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {"point_2d", + (getter)Interface0D_point_2d_get, + (setter) nullptr, + Interface0D_point_2d_doc, + nullptr}, + {"id", (getter)Interface0D_id_get, (setter) nullptr, Interface0D_id_doc, nullptr}, + {"nature", (getter)Interface0D_nature_get, (setter) nullptr, Interface0D_nature_doc, nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_Interface0D type definition ------------------------------*/ PyTypeObject Interface0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Interface0D", /* tp_name */ - sizeof(BPy_Interface0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)Interface0D_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)Interface0D_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Interface0D_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Interface0D_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_Interface0D_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Interface0D_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "Interface0D", /* tp_name */ + sizeof(BPy_Interface0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)Interface0D_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)Interface0D_repr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Interface0D_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_Interface0D_methods, /* tp_methods */ + nullptr, /* tp_members */ + BPy_Interface0D_getseters, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Interface0D_init, /* tp_init */ + nullptr, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp index 423b97fe3cd..d34468d4e25 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp @@ -40,7 +40,7 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int Interface1D_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -113,7 +113,7 @@ PyDoc_STRVAR(Interface1D_doc, static int Interface1D_init(BPy_Interface1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -183,11 +183,11 @@ PyDoc_STRVAR(Interface1D_points_begin_doc, static PyObject *Interface1D_points_begin(BPy_Interface1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"t", NULL}; + static const char *kwlist[] = {"t", nullptr}; float f = 0.0f; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) { - return NULL; + return nullptr; } Interface0DIterator if0D_it(self->if1D->pointsBegin(f)); return BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, false); @@ -209,11 +209,11 @@ PyDoc_STRVAR(Interface1D_points_end_doc, static PyObject *Interface1D_points_end(BPy_Interface1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"t", NULL}; + static const char *kwlist[] = {"t", nullptr}; float f = 0.0f; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) { - return NULL; + return nullptr; } Interface0DIterator if0D_it(self->if1D->pointsEnd(f)); return BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, true); @@ -236,7 +236,7 @@ static PyMethodDef BPy_Interface1D_methods[] = { (PyCFunction)Interface1D_points_end, METH_VARARGS | METH_KEYWORDS, Interface1D_points_end_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*----------------------Interface1D get/setters ----------------------------*/ @@ -260,7 +260,7 @@ static PyObject *Interface1D_id_get(BPy_Interface1D *self, void *UNUSED(closure) { Id id(self->if1D->getId()); if (PyErr_Occurred()) { - return NULL; + return nullptr; } return BPy_Id_from_Id(id); // return a copy } @@ -274,7 +274,7 @@ static PyObject *Interface1D_nature_get(BPy_Interface1D *self, void *UNUSED(clos { Nature::VertexNature nature = self->if1D->getNature(); if (PyErr_Occurred()) { - return NULL; + return nullptr; } return BPy_Nature_from_Nature(nature); } @@ -288,7 +288,7 @@ static PyObject *Interface1D_length_2d_get(BPy_Interface1D *self, void *UNUSED(c { real length = self->if1D->getLength2D(); if (PyErr_Occurred()) { - return NULL; + return nullptr; } return PyFloat_FromDouble((double)length); } @@ -318,62 +318,62 @@ static int Interface1D_time_stamp_set(BPy_Interface1D *self, } static PyGetSetDef BPy_Interface1D_getseters[] = { - {"name", (getter)Interface1D_name_get, (setter)NULL, Interface1D_name_doc, NULL}, - {"id", (getter)Interface1D_id_get, (setter)NULL, Interface1D_id_doc, NULL}, - {"nature", (getter)Interface1D_nature_get, (setter)NULL, Interface1D_nature_doc, NULL}, + {"name", (getter)Interface1D_name_get, (setter) nullptr, Interface1D_name_doc, nullptr}, + {"id", (getter)Interface1D_id_get, (setter) nullptr, Interface1D_id_doc, nullptr}, + {"nature", (getter)Interface1D_nature_get, (setter) nullptr, Interface1D_nature_doc, nullptr}, {"length_2d", (getter)Interface1D_length_2d_get, - (setter)NULL, + (setter) nullptr, Interface1D_length_2d_doc, - NULL}, + nullptr}, {"time_stamp", (getter)Interface1D_time_stamp_get, (setter)Interface1D_time_stamp_set, Interface1D_time_stamp_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_Interface1D type definition ------------------------------*/ PyTypeObject Interface1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Interface1D", /* tp_name */ - sizeof(BPy_Interface1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)Interface1D_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)Interface1D_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Interface1D_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Interface1D_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_Interface1D_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Interface1D_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "Interface1D", /* tp_name */ + sizeof(BPy_Interface1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)Interface1D_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)Interface1D_repr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Interface1D_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_Interface1D_methods, /* tp_methods */ + nullptr, /* tp_members */ + BPy_Interface1D_getseters, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Interface1D_init, /* tp_init */ + nullptr, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_Iterator.cpp b/source/blender/freestyle/intern/python/BPy_Iterator.cpp index b8dedb6497a..e0645a19e61 100644 --- a/source/blender/freestyle/intern/python/BPy_Iterator.cpp +++ b/source/blender/freestyle/intern/python/BPy_Iterator.cpp @@ -41,7 +41,7 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int Iterator_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -126,7 +126,7 @@ PyDoc_STRVAR(Iterator_doc, static int Iterator_init(BPy_Iterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -155,7 +155,7 @@ static PyObject *Iterator_increment(BPy_Iterator *self) { if (self->it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "cannot increment any more"); - return NULL; + return nullptr; } self->it->increment(); Py_RETURN_NONE; @@ -170,7 +170,7 @@ static PyObject *Iterator_decrement(BPy_Iterator *self) { if (self->it->isBegin()) { PyErr_SetString(PyExc_RuntimeError, "cannot decrement any more"); - return NULL; + return nullptr; } self->it->decrement(); Py_RETURN_NONE; @@ -179,7 +179,7 @@ static PyObject *Iterator_decrement(BPy_Iterator *self) static PyMethodDef BPy_Iterator_methods[] = { {"increment", (PyCFunction)Iterator_increment, METH_NOARGS, Iterator_increment_doc}, {"decrement", (PyCFunction)Iterator_decrement, METH_NOARGS, Iterator_decrement_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*----------------------Iterator get/setters ----------------------------*/ @@ -215,52 +215,52 @@ static PyObject *Iterator_is_end_get(BPy_Iterator *self, void *UNUSED(closure)) } static PyGetSetDef BPy_Iterator_getseters[] = { - {"name", (getter)Iterator_name_get, (setter)NULL, Iterator_name_doc, NULL}, - {"is_begin", (getter)Iterator_is_begin_get, (setter)NULL, Iterator_is_begin_doc, NULL}, - {"is_end", (getter)Iterator_is_end_get, (setter)NULL, Iterator_is_end_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {"name", (getter)Iterator_name_get, (setter) nullptr, Iterator_name_doc, nullptr}, + {"is_begin", (getter)Iterator_is_begin_get, (setter) nullptr, Iterator_is_begin_doc, nullptr}, + {"is_end", (getter)Iterator_is_end_get, (setter) nullptr, Iterator_is_end_doc, nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_Iterator type definition ------------------------------*/ PyTypeObject Iterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Iterator", /* tp_name */ - sizeof(BPy_Iterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)Iterator_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)Iterator_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Iterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Iterator_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_Iterator_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Iterator_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "Iterator", /* tp_name */ + sizeof(BPy_Iterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)Iterator_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)Iterator_repr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Iterator_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_Iterator_methods, /* tp_methods */ + nullptr, /* tp_members */ + BPy_Iterator_getseters, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Iterator_init, /* tp_init */ + nullptr, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_MediumType.cpp b/source/blender/freestyle/intern/python/BPy_MediumType.cpp index 915f0c41a56..b00cbecb4b4 100644 --- a/source/blender/freestyle/intern/python/BPy_MediumType.cpp +++ b/source/blender/freestyle/intern/python/BPy_MediumType.cpp @@ -41,43 +41,43 @@ PyDoc_STRVAR(MediumType_doc, "* Stroke.OPAQUE_MEDIUM: To simulate an opaque medium (oil, spray...)."); PyTypeObject MediumType_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "MediumType", /* tp_name */ - sizeof(PyLongObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - MediumType_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &PyLong_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "MediumType", /* tp_name */ + sizeof(PyLongObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + MediumType_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &PyLong_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + nullptr, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /*-----------------------BPy_IntegrationType instance definitions -------------------------*/ @@ -96,7 +96,7 @@ PyLongObject _BPy_MediumType_OPAQUE_MEDIUM = { int MediumType_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } diff --git a/source/blender/freestyle/intern/python/BPy_Nature.cpp b/source/blender/freestyle/intern/python/BPy_Nature.cpp index 79fb154233e..af4d26586b4 100644 --- a/source/blender/freestyle/intern/python/BPy_Nature.cpp +++ b/source/blender/freestyle/intern/python/BPy_Nature.cpp @@ -35,40 +35,40 @@ static PyObject *BPy_Nature_or(PyObject *a, PyObject *b); /*-----------------------BPy_Nature number method definitions --------------------*/ static PyNumberMethods nature_as_number = { - 0, /* binaryfunc nb_add */ - 0, /* binaryfunc nb_subtract */ - 0, /* binaryfunc nb_multiply */ - 0, /* binaryfunc nb_remainder */ - 0, /* binaryfunc nb_divmod */ - 0, /* ternaryfunc nb_power */ - 0, /* unaryfunc nb_negative */ - 0, /* unaryfunc nb_positive */ - 0, /* unaryfunc nb_absolute */ - 0, /* inquiry nb_bool */ - 0, /* unaryfunc nb_invert */ - 0, /* binaryfunc nb_lshift */ - 0, /* binaryfunc nb_rshift */ + nullptr, /* binaryfunc nb_add */ + nullptr, /* binaryfunc nb_subtract */ + nullptr, /* binaryfunc nb_multiply */ + nullptr, /* binaryfunc nb_remainder */ + nullptr, /* binaryfunc nb_divmod */ + nullptr, /* ternaryfunc nb_power */ + nullptr, /* unaryfunc nb_negative */ + nullptr, /* unaryfunc nb_positive */ + nullptr, /* unaryfunc nb_absolute */ + nullptr, /* inquiry nb_bool */ + nullptr, /* unaryfunc nb_invert */ + nullptr, /* binaryfunc nb_lshift */ + nullptr, /* binaryfunc nb_rshift */ (binaryfunc)BPy_Nature_and, /* binaryfunc nb_and */ (binaryfunc)BPy_Nature_xor, /* binaryfunc nb_xor */ (binaryfunc)BPy_Nature_or, /* binaryfunc nb_or */ - 0, /* unaryfunc nb_int */ - 0, /* void *nb_reserved */ - 0, /* unaryfunc nb_float */ - 0, /* binaryfunc nb_inplace_add */ - 0, /* binaryfunc nb_inplace_subtract */ - 0, /* binaryfunc nb_inplace_multiply */ - 0, /* binaryfunc nb_inplace_remainder */ - 0, /* ternaryfunc nb_inplace_power */ - 0, /* binaryfunc nb_inplace_lshift */ - 0, /* binaryfunc nb_inplace_rshift */ - 0, /* binaryfunc nb_inplace_and */ - 0, /* binaryfunc nb_inplace_xor */ - 0, /* binaryfunc nb_inplace_or */ - 0, /* binaryfunc nb_floor_divide */ - 0, /* binaryfunc nb_true_divide */ - 0, /* binaryfunc nb_inplace_floor_divide */ - 0, /* binaryfunc nb_inplace_true_divide */ - 0, /* unaryfunc nb_index */ + nullptr, /* unaryfunc nb_int */ + nullptr, /* void *nb_reserved */ + nullptr, /* unaryfunc nb_float */ + nullptr, /* binaryfunc nb_inplace_add */ + nullptr, /* binaryfunc nb_inplace_subtract */ + nullptr, /* binaryfunc nb_inplace_multiply */ + nullptr, /* binaryfunc nb_inplace_remainder */ + nullptr, /* ternaryfunc nb_inplace_power */ + nullptr, /* binaryfunc nb_inplace_lshift */ + nullptr, /* binaryfunc nb_inplace_rshift */ + nullptr, /* binaryfunc nb_inplace_and */ + nullptr, /* binaryfunc nb_inplace_xor */ + nullptr, /* binaryfunc nb_inplace_or */ + nullptr, /* binaryfunc nb_floor_divide */ + nullptr, /* binaryfunc nb_true_divide */ + nullptr, /* binaryfunc nb_inplace_floor_divide */ + nullptr, /* binaryfunc nb_inplace_true_divide */ + nullptr, /* unaryfunc nb_index */ }; /*-----------------------BPy_Nature docstring ------------------------------------*/ @@ -103,43 +103,43 @@ PyDoc_STRVAR(Nature_doc, /*-----------------------BPy_Nature type definition ------------------------------*/ PyTypeObject Nature_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Nature", /* tp_name */ - sizeof(PyLongObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - &nature_as_number, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - Nature_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &PyLong_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "Nature", /* tp_name */ + sizeof(PyLongObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + &nature_as_number, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + Nature_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &PyLong_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + nullptr, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /*-----------------------BPy_Nature instance definitions ----------------------------------*/ @@ -186,7 +186,7 @@ static PyLongObject _Nature_EDGE_MARK = { //-------------------MODULE INITIALIZATION-------------------------------- int Nature_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -225,16 +225,16 @@ static PyObject *BPy_Nature_bitwise(PyObject *a, int op, PyObject *b) if (!BPy_Nature_Check(a) || !BPy_Nature_Check(b)) { PyErr_SetString(PyExc_TypeError, "operands must be a Nature object"); - return NULL; + return nullptr; } if ((op1 = PyLong_AsLong(a)) == -1 && PyErr_Occurred()) { PyErr_SetString(PyExc_ValueError, "operand 1: unexpected Nature value"); - return NULL; + return nullptr; } if ((op2 = PyLong_AsLong(b)) == -1 && PyErr_Occurred()) { PyErr_SetString(PyExc_ValueError, "operand 2: unexpected Nature value"); - return NULL; + return nullptr; } switch (op) { case '&': @@ -248,7 +248,7 @@ static PyObject *BPy_Nature_bitwise(PyObject *a, int op, PyObject *b) break; default: PyErr_BadArgument(); - return NULL; + return nullptr; } if (v == 0) { result = PyObject_NewVar(BPy_Nature, &Nature_Type, 0); diff --git a/source/blender/freestyle/intern/python/BPy_Operators.cpp b/source/blender/freestyle/intern/python/BPy_Operators.cpp index 1235786d5d3..2106842c0e9 100644 --- a/source/blender/freestyle/intern/python/BPy_Operators.cpp +++ b/source/blender/freestyle/intern/python/BPy_Operators.cpp @@ -41,7 +41,7 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int Operators_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -78,23 +78,23 @@ PyDoc_STRVAR(Operators_select_doc, static PyObject *Operators_select(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"pred", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"pred", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist, &UnaryPredicate1D_Type, &obj)) { - return NULL; + return nullptr; } if (!((BPy_UnaryPredicate1D *)obj)->up1D) { PyErr_SetString(PyExc_TypeError, "Operators.select(): 1st argument: invalid UnaryPredicate1D object"); - return NULL; + return nullptr; } if (Operators::select(*(((BPy_UnaryPredicate1D *)obj)->up1D)) < 0) { if (!PyErr_Occurred()) { PyErr_SetString(PyExc_RuntimeError, "Operators.select() failed"); } - return NULL; + return nullptr; } Py_RETURN_NONE; } @@ -123,8 +123,8 @@ PyDoc_STRVAR(Operators_chain_doc, static PyObject *Operators_chain(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"it", "pred", "modifier", NULL}; - PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0; + static const char *kwlist[] = {"it", "pred", "modifier", nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr, *obj3 = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, @@ -136,17 +136,17 @@ static PyObject *Operators_chain(BPy_Operators * /*self*/, PyObject *args, PyObj &obj2, &UnaryFunction1DVoid_Type, &obj3)) { - return NULL; + return nullptr; } if (!((BPy_ChainingIterator *)obj1)->c_it) { PyErr_SetString(PyExc_TypeError, "Operators.chain(): 1st argument: invalid ChainingIterator object"); - return NULL; + return nullptr; } if (!((BPy_UnaryPredicate1D *)obj2)->up1D) { PyErr_SetString(PyExc_TypeError, "Operators.chain(): 2nd argument: invalid UnaryPredicate1D object"); - return NULL; + return nullptr; } if (!obj3) { if (Operators::chain(*(((BPy_ChainingIterator *)obj1)->c_it), @@ -154,14 +154,14 @@ static PyObject *Operators_chain(BPy_Operators * /*self*/, PyObject *args, PyObj if (!PyErr_Occurred()) { PyErr_SetString(PyExc_RuntimeError, "Operators.chain() failed"); } - return NULL; + return nullptr; } } else { if (!((BPy_UnaryFunction1DVoid *)obj3)->uf1D_void) { PyErr_SetString(PyExc_TypeError, "Operators.chain(): 3rd argument: invalid UnaryFunction1DVoid object"); - return NULL; + return nullptr; } if (Operators::chain(*(((BPy_ChainingIterator *)obj1)->c_it), *(((BPy_UnaryPredicate1D *)obj2)->up1D), @@ -169,7 +169,7 @@ static PyObject *Operators_chain(BPy_Operators * /*self*/, PyObject *args, PyObj if (!PyErr_Occurred()) { PyErr_SetString(PyExc_RuntimeError, "Operators.chain() failed"); } - return NULL; + return nullptr; } } Py_RETURN_NONE; @@ -203,8 +203,8 @@ static PyObject *Operators_bidirectional_chain(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"it", "pred", NULL}; - PyObject *obj1 = 0, *obj2 = 0; + static const char *kwlist[] = {"it", "pred", nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, @@ -214,20 +214,20 @@ static PyObject *Operators_bidirectional_chain(BPy_Operators * /*self*/, &obj1, &UnaryPredicate1D_Type, &obj2)) { - return NULL; + return nullptr; } if (!((BPy_ChainingIterator *)obj1)->c_it) { PyErr_SetString( PyExc_TypeError, "Operators.bidirectional_chain(): 1st argument: invalid ChainingIterator object"); - return NULL; + return nullptr; } if (!obj2) { if (Operators::bidirectionalChain(*(((BPy_ChainingIterator *)obj1)->c_it)) < 0) { if (!PyErr_Occurred()) { PyErr_SetString(PyExc_RuntimeError, "Operators.bidirectional_chain() failed"); } - return NULL; + return nullptr; } } else { @@ -235,14 +235,14 @@ static PyObject *Operators_bidirectional_chain(BPy_Operators * /*self*/, PyErr_SetString( PyExc_TypeError, "Operators.bidirectional_chain(): 2nd argument: invalid UnaryPredicate1D object"); - return NULL; + return nullptr; } if (Operators::bidirectionalChain(*(((BPy_ChainingIterator *)obj1)->c_it), *(((BPy_UnaryPredicate1D *)obj2)->up1D)) < 0) { if (!PyErr_Occurred()) { PyErr_SetString(PyExc_RuntimeError, "Operators.bidirectional_chain() failed"); } - return NULL; + return nullptr; } } Py_RETURN_NONE; @@ -283,9 +283,9 @@ static PyObject *Operators_sequential_split(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"starting_pred", "stopping_pred", "sampling", NULL}; - static const char *kwlist_2[] = {"pred", "sampling", NULL}; - PyObject *obj1 = 0, *obj2 = 0; + static const char *kwlist_1[] = {"starting_pred", "stopping_pred", "sampling", nullptr}; + static const char *kwlist_2[] = {"pred", "sampling", nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr; float f = 0.0f; if (PyArg_ParseTupleAndKeywords(args, @@ -301,13 +301,13 @@ static PyObject *Operators_sequential_split(BPy_Operators * /*self*/, PyErr_SetString( PyExc_TypeError, "Operators.sequential_split(): 1st argument: invalid UnaryPredicate0D object"); - return NULL; + return nullptr; } if (!((BPy_UnaryPredicate0D *)obj2)->up0D) { PyErr_SetString( PyExc_TypeError, "Operators.sequential_split(): 2nd argument: invalid UnaryPredicate0D object"); - return NULL; + return nullptr; } if (Operators::sequentialSplit(*(((BPy_UnaryPredicate0D *)obj1)->up0D), *(((BPy_UnaryPredicate0D *)obj2)->up0D), @@ -315,7 +315,7 @@ static PyObject *Operators_sequential_split(BPy_Operators * /*self*/, if (!PyErr_Occurred()) { PyErr_SetString(PyExc_RuntimeError, "Operators.sequential_split() failed"); } - return NULL; + return nullptr; } } else if ((void)PyErr_Clear(), @@ -326,18 +326,18 @@ static PyObject *Operators_sequential_split(BPy_Operators * /*self*/, PyErr_SetString( PyExc_TypeError, "Operators.sequential_split(): 1st argument: invalid UnaryPredicate0D object"); - return NULL; + return nullptr; } if (Operators::sequentialSplit(*(((BPy_UnaryPredicate0D *)obj1)->up0D), f) < 0) { if (!PyErr_Occurred()) { PyErr_SetString(PyExc_RuntimeError, "Operators.sequential_split() failed"); } - return NULL; + return nullptr; } } else { PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return NULL; + return nullptr; } Py_RETURN_NONE; } @@ -382,9 +382,9 @@ static PyObject *Operators_recursive_split(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"func", "pred_1d", "sampling", NULL}; - static const char *kwlist_2[] = {"func", "pred_0d", "pred_1d", "sampling", NULL}; - PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0; + static const char *kwlist_1[] = {"func", "pred_1d", "sampling", nullptr}; + static const char *kwlist_2[] = {"func", "pred_0d", "pred_1d", "sampling", nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr, *obj3 = nullptr; float f = 0.0f; if (PyArg_ParseTupleAndKeywords(args, @@ -400,13 +400,13 @@ static PyObject *Operators_recursive_split(BPy_Operators * /*self*/, PyErr_SetString( PyExc_TypeError, "Operators.recursive_split(): 1st argument: invalid UnaryFunction0DDouble object"); - return NULL; + return nullptr; } if (!((BPy_UnaryPredicate1D *)obj2)->up1D) { PyErr_SetString( PyExc_TypeError, "Operators.recursive_split(): 2nd argument: invalid UnaryPredicate1D object"); - return NULL; + return nullptr; } if (Operators::recursiveSplit(*(((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double), *(((BPy_UnaryPredicate1D *)obj2)->up1D), @@ -414,7 +414,7 @@ static PyObject *Operators_recursive_split(BPy_Operators * /*self*/, if (!PyErr_Occurred()) { PyErr_SetString(PyExc_RuntimeError, "Operators.recursive_split() failed"); } - return NULL; + return nullptr; } } else if ((void)PyErr_Clear(), @@ -434,19 +434,19 @@ static PyObject *Operators_recursive_split(BPy_Operators * /*self*/, PyErr_SetString( PyExc_TypeError, "Operators.recursive_split(): 1st argument: invalid UnaryFunction0DDouble object"); - return NULL; + return nullptr; } if (!((BPy_UnaryPredicate0D *)obj2)->up0D) { PyErr_SetString( PyExc_TypeError, "Operators.recursive_split(): 2nd argument: invalid UnaryPredicate0D object"); - return NULL; + return nullptr; } if (!((BPy_UnaryPredicate1D *)obj3)->up1D) { PyErr_SetString( PyExc_TypeError, "Operators.recursive_split(): 3rd argument: invalid UnaryPredicate1D object"); - return NULL; + return nullptr; } if (Operators::recursiveSplit(*(((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double), *(((BPy_UnaryPredicate0D *)obj2)->up0D), @@ -455,12 +455,12 @@ static PyObject *Operators_recursive_split(BPy_Operators * /*self*/, if (!PyErr_Occurred()) { PyErr_SetString(PyExc_RuntimeError, "Operators.recursive_split() failed"); } - return NULL; + return nullptr; } } else { PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return NULL; + return nullptr; } Py_RETURN_NONE; } @@ -476,23 +476,23 @@ PyDoc_STRVAR(Operators_sort_doc, static PyObject *Operators_sort(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"pred", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"pred", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist, &BinaryPredicate1D_Type, &obj)) { - return NULL; + return nullptr; } if (!((BPy_BinaryPredicate1D *)obj)->bp1D) { PyErr_SetString(PyExc_TypeError, "Operators.sort(): 1st argument: invalid BinaryPredicate1D object"); - return NULL; + return nullptr; } if (Operators::sort(*(((BPy_BinaryPredicate1D *)obj)->bp1D)) < 0) { if (!PyErr_Occurred()) { PyErr_SetString(PyExc_RuntimeError, "Operators.sort() failed"); } - return NULL; + return nullptr; } Py_RETURN_NONE; } @@ -511,8 +511,8 @@ PyDoc_STRVAR(Operators_create_doc, static PyObject *Operators_create(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"pred", "shaders", NULL}; - PyObject *obj1 = 0, *obj2 = 0; + static const char *kwlist[] = {"pred", "shaders", nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, @@ -522,12 +522,12 @@ static PyObject *Operators_create(BPy_Operators * /*self*/, PyObject *args, PyOb &obj1, &PyList_Type, &obj2)) { - return NULL; + return nullptr; } if (!((BPy_UnaryPredicate1D *)obj1)->up1D) { PyErr_SetString(PyExc_TypeError, "Operators.create(): 1st argument: invalid UnaryPredicate1D object"); - return NULL; + return nullptr; } vector<StrokeShader *> shaders; shaders.reserve(PyList_Size(obj2)); @@ -536,7 +536,7 @@ static PyObject *Operators_create(BPy_Operators * /*self*/, PyObject *args, PyOb if (!BPy_StrokeShader_Check(py_ss)) { PyErr_SetString(PyExc_TypeError, "Operators.create(): 2nd argument must be a list of StrokeShader objects"); - return NULL; + return nullptr; } StrokeShader *shader = ((BPy_StrokeShader *)py_ss)->ss; if (!shader) { @@ -545,7 +545,7 @@ static PyObject *Operators_create(BPy_Operators * /*self*/, PyObject *args, PyOb << " of the shaders list is invalid likely due to missing call of " "StrokeShader.__init__()"; PyErr_SetString(PyExc_TypeError, ss.str().c_str()); - return NULL; + return nullptr; } shaders.push_back(shader); } @@ -553,7 +553,7 @@ static PyObject *Operators_create(BPy_Operators * /*self*/, PyObject *args, PyOb if (!PyErr_Occurred()) { PyErr_SetString(PyExc_RuntimeError, "Operators.create() failed"); } - return NULL; + return nullptr; } Py_RETURN_NONE; } @@ -569,15 +569,15 @@ PyDoc_STRVAR(Operators_reset_doc, static PyObject *Operators_reset(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"delete_strokes", NULL}; - PyObject *obj1 = 0; + static const char *kwlist[] = {"delete_strokes", nullptr}; + PyObject *obj1 = nullptr; if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &PyBool_Type, &obj1)) { // true is the default Operators::reset(obj1 ? bool_from_PyBool(obj1) : true); } else { PyErr_SetString(PyExc_RuntimeError, "Operators.reset() failed"); - return NULL; + return nullptr; } Py_RETURN_NONE; } @@ -596,15 +596,15 @@ static PyObject *Operators_get_viewedge_from_index(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"i", NULL}; + static const char *kwlist[] = {"i", nullptr}; unsigned int i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i)) { - return NULL; + return nullptr; } if (i >= Operators::getViewEdgesSize()) { PyErr_SetString(PyExc_IndexError, "index out of range"); - return NULL; + return nullptr; } return BPy_ViewEdge_from_ViewEdge(*(Operators::getViewEdgeFromIndex(i))); } @@ -623,15 +623,15 @@ static PyObject *Operators_get_chain_from_index(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"i", NULL}; + static const char *kwlist[] = {"i", nullptr}; unsigned int i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i)) { - return NULL; + return nullptr; } if (i >= Operators::getChainsSize()) { PyErr_SetString(PyExc_IndexError, "index out of range"); - return NULL; + return nullptr; } return BPy_Chain_from_Chain(*(Operators::getChainFromIndex(i))); } @@ -650,15 +650,15 @@ static PyObject *Operators_get_stroke_from_index(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"i", NULL}; + static const char *kwlist[] = {"i", nullptr}; unsigned int i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i)) { - return NULL; + return nullptr; } if (i >= Operators::getStrokesSize()) { PyErr_SetString(PyExc_IndexError, "index out of range"); - return NULL; + return nullptr; } return BPy_Stroke_from_Stroke(*(Operators::getStrokeFromIndex(i))); } @@ -760,49 +760,49 @@ static PyMethodDef BPy_Operators_methods[] = { (PyCFunction)Operators_get_strokes_size, METH_NOARGS | METH_STATIC, Operators_get_strokes_size_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*-----------------------BPy_Operators type definition ------------------------------*/ PyTypeObject Operators_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Operators", /* tp_name */ - sizeof(BPy_Operators), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)Operators_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - Operators_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Operators_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "Operators", /* tp_name */ + sizeof(BPy_Operators), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)Operators_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + Operators_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_Operators_methods, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + nullptr, /* tp_init */ + nullptr, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_SShape.cpp b/source/blender/freestyle/intern/python/BPy_SShape.cpp index b1d5f8f4aac..a4517ce5669 100644 --- a/source/blender/freestyle/intern/python/BPy_SShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_SShape.cpp @@ -35,7 +35,7 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int SShape_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -65,8 +65,8 @@ PyDoc_STRVAR( static int SShape_init(BPy_SShape *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"brother", NULL}; - PyObject *brother = 0; + static const char *kwlist[] = {"brother", nullptr}; + PyObject *brother = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &SShape_Type, &brother)) { return -1; @@ -104,11 +104,11 @@ static char SShape_add_edge_doc[] = static PyObject *SShape_add_edge(BPy_SShape *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"edge", NULL}; - PyObject *py_fe = 0; + static const char *kwlist[] = {"edge", nullptr}; + PyObject *py_fe = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &FEdge_Type, &py_fe)) { - return NULL; + return nullptr; } self->ss->AddEdge(((BPy_FEdge *)py_fe)->fe); Py_RETURN_NONE; @@ -125,11 +125,11 @@ PyDoc_STRVAR(SShape_add_vertex_doc, static PyObject *SShape_add_vertex(BPy_SShape *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"edge", NULL}; - PyObject *py_sv = 0; + static const char *kwlist[] = {"edge", nullptr}; + PyObject *py_sv = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &SVertex_Type, &py_sv)) { - return NULL; + return nullptr; } self->ss->AddNewVertex(((BPy_SVertex *)py_sv)->sv); Py_RETURN_NONE; @@ -157,7 +157,7 @@ static PyMethodDef BPy_SShape_methods[] = { METH_VARARGS | METH_KEYWORDS, SShape_add_vertex_doc}, {"compute_bbox", (PyCFunction)SShape_compute_bbox, METH_NOARGS, SShape_compute_bbox_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*----------------------SShape get/setters ----------------------------*/ @@ -266,54 +266,54 @@ static PyObject *SShape_edges_get(BPy_SShape *self, void *UNUSED(closure)) } static PyGetSetDef BPy_SShape_getseters[] = { - {"id", (getter)SShape_id_get, (setter)SShape_id_set, SShape_id_doc, NULL}, - {"name", (getter)SShape_name_get, (setter)SShape_name_set, SShape_name_doc, NULL}, - {"bbox", (getter)SShape_bbox_get, (setter)SShape_bbox_set, SShape_bbox_doc, NULL}, - {"edges", (getter)SShape_edges_get, (setter)NULL, SShape_edges_doc, NULL}, - {"vertices", (getter)SShape_vertices_get, (setter)NULL, SShape_vertices_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {"id", (getter)SShape_id_get, (setter)SShape_id_set, SShape_id_doc, nullptr}, + {"name", (getter)SShape_name_get, (setter)SShape_name_set, SShape_name_doc, nullptr}, + {"bbox", (getter)SShape_bbox_get, (setter)SShape_bbox_set, SShape_bbox_doc, nullptr}, + {"edges", (getter)SShape_edges_get, (setter) nullptr, SShape_edges_doc, nullptr}, + {"vertices", (getter)SShape_vertices_get, (setter) nullptr, SShape_vertices_doc, nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_SShape type definition ------------------------------*/ PyTypeObject SShape_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "SShape", /* tp_name */ - sizeof(BPy_SShape), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)SShape_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)SShape_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - SShape_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_SShape_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_SShape_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)SShape_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "SShape", /* tp_name */ + sizeof(BPy_SShape), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)SShape_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)SShape_repr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + SShape_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_SShape_methods, /* tp_methods */ + nullptr, /* tp_members */ + BPy_SShape_getseters, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SShape_init, /* tp_init */ + nullptr, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp index 3718fddcf20..cba9c778f34 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp @@ -31,7 +31,7 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int StrokeAttribute_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -84,11 +84,11 @@ PyDoc_STRVAR(StrokeAttribute_doc, static int StrokeAttribute_init(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"attribute1", "attribute2", "t", NULL}; + static const char *kwlist_1[] = {"brother", nullptr}; + static const char *kwlist_2[] = {"attribute1", "attribute2", "t", nullptr}; static const char *kwlist_3[] = { - "red", "green", "blue", "alpha", "thickness_right", "thickness_left", NULL}; - PyObject *obj1 = 0, *obj2 = 0; + "red", "green", "blue", "alpha", "thickness_right", "thickness_left", nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr; float red, green, blue, alpha, thickness_right, thickness_left, t; if (PyArg_ParseTupleAndKeywords( @@ -166,11 +166,11 @@ static PyObject *StrokeAttribute_get_attribute_real(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"name", NULL}; + static const char *kwlist[] = {"name", nullptr}; char *attr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) { - return NULL; + return nullptr; } double a = self->sa->getAttributeReal(attr); return PyFloat_FromDouble(a); @@ -190,11 +190,11 @@ static PyObject *StrokeAttribute_get_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"name", NULL}; + static const char *kwlist[] = {"name", nullptr}; char *attr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) { - return NULL; + return nullptr; } Vec2f a = self->sa->getAttributeVec2f(attr); return Vector_from_Vec2f(a); @@ -214,11 +214,11 @@ static PyObject *StrokeAttribute_get_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"name", NULL}; + static const char *kwlist[] = {"name", nullptr}; char *attr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) { - return NULL; + return nullptr; } Vec3f a = self->sa->getAttributeVec3f(attr); return Vector_from_Vec3f(a); @@ -238,11 +238,11 @@ static PyObject *StrokeAttribute_has_attribute_real(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"name", NULL}; + static const char *kwlist[] = {"name", nullptr}; char *attr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) { - return NULL; + return nullptr; } return PyBool_from_bool(self->sa->isAttributeAvailableReal(attr)); } @@ -262,11 +262,11 @@ static PyObject *StrokeAttribute_has_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"name", NULL}; + static const char *kwlist[] = {"name", nullptr}; char *attr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) { - return NULL; + return nullptr; } return PyBool_from_bool(self->sa->isAttributeAvailableVec2f(attr)); } @@ -286,11 +286,11 @@ static PyObject *StrokeAttribute_has_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"name", NULL}; + static const char *kwlist[] = {"name", nullptr}; char *attr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) { - return NULL; + return nullptr; } return PyBool_from_bool(self->sa->isAttributeAvailableVec3f(attr)); } @@ -311,12 +311,12 @@ static PyObject *StrokeAttribute_set_attribute_real(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"name", "value", NULL}; - char *s = 0; + static const char *kwlist[] = {"name", "value", nullptr}; + char *s = nullptr; double d = 0; if (!PyArg_ParseTupleAndKeywords(args, kwds, "sd", (char **)kwlist, &s, &d)) { - return NULL; + return nullptr; } self->sa->setAttributeReal(s, d); Py_RETURN_NONE; @@ -338,18 +338,18 @@ static PyObject *StrokeAttribute_set_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"name", "value", NULL}; + static const char *kwlist[] = {"name", "value", nullptr}; char *s; - PyObject *obj = 0; + PyObject *obj = nullptr; Vec2f vec; if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj)) { - return NULL; + return nullptr; } if (!Vec2f_ptr_from_PyObject(obj, vec)) { PyErr_SetString(PyExc_TypeError, "argument 2 must be a 2D vector (either a list of 2 elements or Vector)"); - return NULL; + return nullptr; } self->sa->setAttributeVec2f(s, vec); Py_RETURN_NONE; @@ -371,18 +371,18 @@ static PyObject *StrokeAttribute_set_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"name", "value", NULL}; + static const char *kwlist[] = {"name", "value", nullptr}; char *s; - PyObject *obj = 0; + PyObject *obj = nullptr; Vec3f vec; if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj)) { - return NULL; + return nullptr; } if (!Vec3f_ptr_from_PyObject(obj, vec)) { PyErr_SetString(PyExc_TypeError, "argument 2 must be a 3D vector (either a list of 3 elements or Vector)"); - return NULL; + return nullptr; } self->sa->setAttributeVec3f(s, vec); Py_RETURN_NONE; @@ -425,7 +425,7 @@ static PyMethodDef BPy_StrokeAttribute_methods[] = { (PyCFunction)StrokeAttribute_set_attribute_vec3, METH_VARARGS | METH_KEYWORDS, StrokeAttribute_set_attribute_vec3_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*----------------------mathutils callbacks ----------------------------*/ @@ -651,65 +651,65 @@ static PyGetSetDef BPy_StrokeAttribute_getseters[] = { (getter)StrokeAttribute_alpha_get, (setter)StrokeAttribute_alpha_set, StrokeAttribute_alpha_doc, - NULL}, + nullptr}, {"color", (getter)StrokeAttribute_color_get, (setter)StrokeAttribute_color_set, StrokeAttribute_color_doc, - NULL}, + nullptr}, {"thickness", (getter)StrokeAttribute_thickness_get, (setter)StrokeAttribute_thickness_set, StrokeAttribute_thickness_doc, - NULL}, + nullptr}, {"visible", (getter)StrokeAttribute_visible_get, (setter)StrokeAttribute_visible_set, StrokeAttribute_visible_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_StrokeAttribute type definition ------------------------------*/ PyTypeObject StrokeAttribute_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "StrokeAttribute", /* tp_name */ - sizeof(BPy_StrokeAttribute), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)StrokeAttribute_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)StrokeAttribute_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - StrokeAttribute_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_StrokeAttribute_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_StrokeAttribute_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)StrokeAttribute_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "StrokeAttribute", /* tp_name */ + sizeof(BPy_StrokeAttribute), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)StrokeAttribute_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)StrokeAttribute_repr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + StrokeAttribute_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_StrokeAttribute_methods, /* tp_methods */ + nullptr, /* tp_members */ + BPy_StrokeAttribute_getseters, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)StrokeAttribute_init, /* tp_init */ + nullptr, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp index 5e5685153af..4da327f32e4 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp @@ -51,7 +51,7 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int StrokeShader_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -198,7 +198,7 @@ static char StrokeShader___doc__[] = static int StrokeShader___init__(BPy_StrokeShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -229,23 +229,23 @@ static char StrokeShader_shade___doc__[] = static PyObject *StrokeShader_shade(BPy_StrokeShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"stroke", NULL}; - PyObject *py_s = 0; + static const char *kwlist[] = {"stroke", nullptr}; + PyObject *py_s = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Stroke_Type, &py_s)) { - return NULL; + return nullptr; } if (typeid(*(self->ss)) == typeid(StrokeShader)) { PyErr_SetString(PyExc_TypeError, "shade method not properly overridden"); - return NULL; + return nullptr; } if (self->ss->shade(*(((BPy_Stroke *)py_s)->s)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " shade method failed").c_str()); } - return NULL; + return nullptr; } Py_RETURN_NONE; } @@ -255,7 +255,7 @@ static PyMethodDef BPy_StrokeShader_methods[] = { (PyCFunction)StrokeShader_shade, METH_VARARGS | METH_KEYWORDS, StrokeShader_shade___doc__}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*----------------------StrokeShader get/setters ----------------------------*/ @@ -271,50 +271,50 @@ static PyObject *StrokeShader_name_get(BPy_StrokeShader *self, void *UNUSED(clos } static PyGetSetDef BPy_StrokeShader_getseters[] = { - {"name", (getter)StrokeShader_name_get, (setter)NULL, StrokeShader_name_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {"name", (getter)StrokeShader_name_get, (setter) nullptr, StrokeShader_name_doc, nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_StrokeShader type definition ------------------------------*/ PyTypeObject StrokeShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "StrokeShader", /* tp_name */ - sizeof(BPy_StrokeShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)StrokeShader___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)StrokeShader___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - StrokeShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_StrokeShader_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_StrokeShader_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)StrokeShader___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "StrokeShader", /* tp_name */ + sizeof(BPy_StrokeShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)StrokeShader___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)StrokeShader___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + StrokeShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_StrokeShader_methods, /* tp_methods */ + nullptr, /* tp_members */ + BPy_StrokeShader_getseters, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)StrokeShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp index 6214ea94f41..2d0c6f14452 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp @@ -40,7 +40,7 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction0D_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -109,50 +109,54 @@ static PyObject *UnaryFunction0D_name_get(BPy_UnaryFunction0D *self, void *UNUSE } static PyGetSetDef BPy_UnaryFunction0D_getseters[] = { - {"name", (getter)UnaryFunction0D_name_get, (setter)NULL, UnaryFunction0D_name_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {"name", + (getter)UnaryFunction0D_name_get, + (setter) nullptr, + UnaryFunction0D_name_doc, + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction0D type definition ------------------------------*/ PyTypeObject UnaryFunction0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0D", /* tp_name */ - sizeof(BPy_UnaryFunction0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0D___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0D___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction0D_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction0D", /* tp_name */ + sizeof(BPy_UnaryFunction0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0D___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction0D___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_UnaryFunction0D_getseters, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + nullptr, /* tp_init */ + nullptr, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp index 18d6479a498..9fe12559f23 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp @@ -38,7 +38,7 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction1D_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -103,50 +103,54 @@ static PyObject *UnaryFunction1D_name_get(BPy_UnaryFunction1D *self, void *UNUSE } static PyGetSetDef BPy_UnaryFunction1D_getseters[] = { - {"name", (getter)UnaryFunction1D_name_get, (setter)NULL, UnaryFunction1D_name_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {"name", + (getter)UnaryFunction1D_name_get, + (setter) nullptr, + UnaryFunction1D_name_doc, + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1D type definition ------------------------------*/ PyTypeObject UnaryFunction1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1D", /* tp_name */ - sizeof(BPy_UnaryFunction1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction1D___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction1D___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction1D_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction1D", /* tp_name */ + sizeof(BPy_UnaryFunction1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1D___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction1D___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_UnaryFunction1D_getseters, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + nullptr, /* tp_init */ + nullptr, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp index ddbb55fdb4d..63dbaa68095 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp @@ -34,7 +34,7 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int UnaryPredicate0D_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -85,7 +85,7 @@ static char UnaryPredicate0D___doc__[] = static int UnaryPredicate0D___init__(BPy_UnaryPredicate0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -110,12 +110,12 @@ static PyObject *UnaryPredicate0D___call__(BPy_UnaryPredicate0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; + static const char *kwlist[] = {"it", nullptr}; PyObject *py_if0D_it; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &py_if0D_it)) { - return NULL; + return nullptr; } Interface0DIterator *if0D_it = ((BPy_Interface0DIterator *)py_if0D_it)->if0D_it; @@ -123,18 +123,18 @@ static PyObject *UnaryPredicate0D___call__(BPy_UnaryPredicate0D *self, if (!if0D_it) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " has no Interface0DIterator").c_str()); - return NULL; + return nullptr; } if (typeid(*(self->up0D)) == typeid(UnaryPredicate0D)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->up0D->operator()(*if0D_it) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return PyBool_from_bool(self->up0D->result); } @@ -152,50 +152,54 @@ static PyObject *UnaryPredicate0D_name_get(BPy_UnaryPredicate0D *self, void *UNU } static PyGetSetDef BPy_UnaryPredicate0D_getseters[] = { - {"name", (getter)UnaryPredicate0D_name_get, (setter)NULL, UnaryPredicate0D_name_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {"name", + (getter)UnaryPredicate0D_name_get, + (setter) nullptr, + UnaryPredicate0D_name_doc, + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_UnaryPredicate0D type definition ------------------------------*/ PyTypeObject UnaryPredicate0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryPredicate0D", /* tp_name */ - sizeof(BPy_UnaryPredicate0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryPredicate0D___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryPredicate0D___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryPredicate0D___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryPredicate0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryPredicate0D_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryPredicate0D___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryPredicate0D", /* tp_name */ + sizeof(BPy_UnaryPredicate0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryPredicate0D___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryPredicate0D___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryPredicate0D___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryPredicate0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_UnaryPredicate0D_getseters, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryPredicate0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp index 11e77fa365a..cdc14cbaa86 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp @@ -43,7 +43,7 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int UnaryPredicate1D_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -143,7 +143,7 @@ static char UnaryPredicate1D___doc__[] = static int UnaryPredicate1D___init__(BPy_UnaryPredicate1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -168,12 +168,12 @@ static PyObject *UnaryPredicate1D___call__(BPy_UnaryPredicate1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; + static const char *kwlist[] = {"inter", nullptr}; PyObject *py_if1D; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &py_if1D)) { - return NULL; + return nullptr; } Interface1D *if1D = ((BPy_Interface1D *)py_if1D)->if1D; @@ -181,18 +181,18 @@ static PyObject *UnaryPredicate1D___call__(BPy_UnaryPredicate1D *self, if (!if1D) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " has no Interface1D").c_str()); - return NULL; + return nullptr; } if (typeid(*(self->up1D)) == typeid(UnaryPredicate1D)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->up1D->operator()(*if1D) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return PyBool_from_bool(self->up1D->result); } @@ -210,50 +210,54 @@ static PyObject *UnaryPredicate1D_name_get(BPy_UnaryPredicate1D *self, void *UNU } static PyGetSetDef BPy_UnaryPredicate1D_getseters[] = { - {"name", (getter)UnaryPredicate1D_name_get, (setter)NULL, UnaryPredicate1D_name_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {"name", + (getter)UnaryPredicate1D_name_get, + (setter) nullptr, + UnaryPredicate1D_name_doc, + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_UnaryPredicate1D type definition ------------------------------*/ PyTypeObject UnaryPredicate1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryPredicate1D", /* tp_name */ - sizeof(BPy_UnaryPredicate1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryPredicate1D___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryPredicate1D___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryPredicate1D___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryPredicate1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryPredicate1D_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryPredicate1D___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryPredicate1D", /* tp_name */ + sizeof(BPy_UnaryPredicate1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryPredicate1D___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryPredicate1D___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryPredicate1D___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryPredicate1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_UnaryPredicate1D_getseters, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryPredicate1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp index 67a4249ade8..f4a980bd095 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp @@ -34,7 +34,7 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int ViewMap_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -58,7 +58,7 @@ PyDoc_STRVAR(ViewMap_doc, static int ViewMap_init(BPy_ViewMap *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -92,11 +92,11 @@ PyDoc_STRVAR(ViewMap_get_closest_viewedge_doc, static PyObject *ViewMap_get_closest_viewedge(BPy_ViewMap *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"x", "y", NULL}; + static const char *kwlist[] = {"x", "y", nullptr}; double x, y; if (!PyArg_ParseTupleAndKeywords(args, kwds, "dd", (char **)kwlist, &x, &y)) { - return NULL; + return nullptr; } ViewEdge *ve = const_cast<ViewEdge *>(self->vm->getClosestViewEdge(x, y)); if (ve) { @@ -119,11 +119,11 @@ PyDoc_STRVAR(ViewMap_get_closest_fedge_doc, static PyObject *ViewMap_get_closest_fedge(BPy_ViewMap *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"x", "y", NULL}; + static const char *kwlist[] = {"x", "y", nullptr}; double x, y; if (!PyArg_ParseTupleAndKeywords(args, kwds, "dd", (char **)kwlist, &x, &y)) { - return NULL; + return nullptr; } FEdge *fe = const_cast<FEdge *>(self->vm->getClosestFEdge(x, y)); if (fe) { @@ -143,7 +143,7 @@ static PyMethodDef BPy_ViewMap_methods[] = { (PyCFunction)ViewMap_get_closest_fedge, METH_VARARGS | METH_KEYWORDS, ViewMap_get_closest_fedge_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*----------------------ViewMap get/setters ----------------------------*/ @@ -173,50 +173,50 @@ static PyGetSetDef BPy_ViewMap_getseters[] = { (getter)ViewMap_scene_bbox_get, (setter)ViewMap_scene_bbox_set, ViewMap_scene_bbox_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_ViewMap type definition ------------------------------*/ PyTypeObject ViewMap_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ViewMap", /* tp_name */ - sizeof(BPy_ViewMap), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)ViewMap_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)ViewMap_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ViewMap_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_ViewMap_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_ViewMap_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ViewMap_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ViewMap", /* tp_name */ + sizeof(BPy_ViewMap), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)ViewMap_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)ViewMap_repr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ViewMap_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_ViewMap_methods, /* tp_methods */ + nullptr, /* tp_members */ + BPy_ViewMap_getseters, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ViewMap_init, /* tp_init */ + nullptr, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp index 7d8b5ef6fa9..7eae62117be 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp @@ -35,7 +35,7 @@ extern "C" { int ViewShape_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -68,14 +68,14 @@ PyDoc_STRVAR(ViewShape_doc, static int ViewShape_init(BPy_ViewShape *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"sshape", NULL}; - PyObject *obj = 0; + static const char *kwlist_1[] = {"brother", nullptr}; + static const char *kwlist_2[] = {"sshape", nullptr}; + PyObject *obj = nullptr; if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &ViewShape_Type, &obj)) { if (!obj) { self->vs = new ViewShape(); - self->py_ss = NULL; + self->py_ss = nullptr; } else { self->vs = new ViewShape(*(((BPy_ViewShape *)obj)->vs)); @@ -86,7 +86,7 @@ static int ViewShape_init(BPy_ViewShape *self, PyObject *args, PyObject *kwds) PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_2, &SShape_Type, &obj)) { BPy_SShape *py_ss = (BPy_SShape *)obj; self->vs = new ViewShape(py_ss->ss); - self->py_ss = (!py_ss->borrowed) ? py_ss : NULL; + self->py_ss = (!py_ss->borrowed) ? py_ss : nullptr; } else { PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); @@ -100,7 +100,7 @@ static int ViewShape_init(BPy_ViewShape *self, PyObject *args, PyObject *kwds) static void ViewShape_dealloc(BPy_ViewShape *self) { if (self->py_ss) { - self->vs->setSShape((SShape *)NULL); + self->vs->setSShape((SShape *)nullptr); Py_DECREF(self->py_ss); } if (self->vs && !self->borrowed) { @@ -124,11 +124,11 @@ PyDoc_STRVAR(ViewShape_add_edge_doc, static PyObject *ViewShape_add_edge(BPy_ViewShape *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"edge", NULL}; - PyObject *py_ve = 0; + static const char *kwlist[] = {"edge", nullptr}; + PyObject *py_ve = nullptr; if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewEdge_Type, &py_ve)) { - return NULL; + return nullptr; } self->vs->AddEdge(((BPy_ViewEdge *)py_ve)->ve); Py_RETURN_NONE; @@ -144,11 +144,11 @@ PyDoc_STRVAR(ViewShape_add_vertex_doc, static PyObject *ViewShape_add_vertex(BPy_ViewShape *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"vertex", NULL}; - PyObject *py_vv = 0; + static const char *kwlist[] = {"vertex", nullptr}; + PyObject *py_vv = nullptr; if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewVertex_Type, &py_vv)) { - return NULL; + return nullptr; } self->vs->AddVertex(((BPy_ViewVertex *)py_vv)->vv); Py_RETURN_NONE; @@ -165,7 +165,7 @@ static PyMethodDef BPy_ViewShape_methods[] = { (PyCFunction)ViewShape_add_vertex, METH_VARARGS | METH_KEYWORDS, ViewShape_add_vertex_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*----------------------ViewShape get/setters ----------------------------*/ @@ -324,63 +324,67 @@ static PyGetSetDef BPy_ViewShape_getseters[] = { (getter)ViewShape_sshape_get, (setter)ViewShape_sshape_set, ViewShape_sshape_doc, - NULL}, + nullptr}, {"vertices", (getter)ViewShape_vertices_get, (setter)ViewShape_vertices_set, ViewShape_vertices_doc, - NULL}, - {"edges", (getter)ViewShape_edges_get, (setter)ViewShape_edges_set, ViewShape_edges_doc, NULL}, - {"name", (getter)ViewShape_name_get, (setter)NULL, ViewShape_name_doc, NULL}, + nullptr}, + {"edges", + (getter)ViewShape_edges_get, + (setter)ViewShape_edges_set, + ViewShape_edges_doc, + nullptr}, + {"name", (getter)ViewShape_name_get, (setter) nullptr, ViewShape_name_doc, nullptr}, {"library_path", (getter)ViewShape_library_path_get, - (setter)NULL, + (setter) nullptr, ViewShape_library_path_doc, - NULL}, - {"id", (getter)ViewShape_id_get, (setter)NULL, ViewShape_id_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {"id", (getter)ViewShape_id_get, (setter) nullptr, ViewShape_id_doc, nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_ViewShape type definition ------------------------------*/ PyTypeObject ViewShape_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ViewShape", /* tp_name */ - sizeof(BPy_ViewShape), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)ViewShape_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)ViewShape_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ViewShape_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_ViewShape_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_ViewShape_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ViewShape_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ViewShape", /* tp_name */ + sizeof(BPy_ViewShape), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)ViewShape_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)ViewShape_repr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ViewShape_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_ViewShape_methods, /* tp_methods */ + nullptr, /* tp_members */ + BPy_ViewShape_getseters, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ViewShape_init, /* tp_init */ + nullptr, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp index 65c7f063dcf..0c01f4c7349 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp @@ -44,7 +44,7 @@ static char FalseBP1D___doc__[] = static int FalseBP1D___init__(BPy_FalseBP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -55,43 +55,43 @@ static int FalseBP1D___init__(BPy_FalseBP1D *self, PyObject *args, PyObject *kwd /*-----------------------BPy_FalseBP1D type definition ------------------------------*/ PyTypeObject FalseBP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "FalseBP1D", /* tp_name */ - sizeof(BPy_FalseBP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FalseBP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &BinaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FalseBP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "FalseBP1D", /* tp_name */ + sizeof(BPy_FalseBP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FalseBP1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &BinaryPredicate1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FalseBP1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp index 59c3283ed35..661470d1956 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp @@ -45,7 +45,7 @@ static char Length2DBP1D___doc__[] = static int Length2DBP1D___init__(BPy_Length2DBP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -57,43 +57,43 @@ static int Length2DBP1D___init__(BPy_Length2DBP1D *self, PyObject *args, PyObjec /*-----------------------BPy_Length2DBP1D type definition ------------------------------*/ PyTypeObject Length2DBP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Length2DBP1D", /* tp_name */ - sizeof(BPy_Length2DBP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Length2DBP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &BinaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Length2DBP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "Length2DBP1D", /* tp_name */ + sizeof(BPy_Length2DBP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Length2DBP1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &BinaryPredicate1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Length2DBP1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp index 62bfbbcfad0..a1477f4ca49 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp @@ -44,7 +44,7 @@ static char SameShapeIdBP1D___doc__[] = static int SameShapeIdBP1D___init__(BPy_SameShapeIdBP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -56,43 +56,43 @@ static int SameShapeIdBP1D___init__(BPy_SameShapeIdBP1D *self, PyObject *args, P /*-----------------------BPy_SameShapeIdBP1D type definition ------------------------------*/ PyTypeObject SameShapeIdBP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "SameShapeIdBP1D", /* tp_name */ - sizeof(BPy_SameShapeIdBP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - SameShapeIdBP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &BinaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)SameShapeIdBP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "SameShapeIdBP1D", /* tp_name */ + sizeof(BPy_SameShapeIdBP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + SameShapeIdBP1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &BinaryPredicate1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SameShapeIdBP1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp index e169ffe7c75..089d72c11f8 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp @@ -44,7 +44,7 @@ static char TrueBP1D___doc__[] = static int TrueBP1D___init__(BPy_TrueBP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -56,43 +56,43 @@ static int TrueBP1D___init__(BPy_TrueBP1D *self, PyObject *args, PyObject *kwds) /*-----------------------BPy_TrueBP1D type definition ------------------------------*/ PyTypeObject TrueBP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "TrueBP1D", /* tp_name */ - sizeof(BPy_TrueBP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - TrueBP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &BinaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)TrueBP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "TrueBP1D", /* tp_name */ + sizeof(BPy_TrueBP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + TrueBP1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &BinaryPredicate1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)TrueBP1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp index ec660b7a7fe..21b9fcc2ef6 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp @@ -69,8 +69,8 @@ static int ViewMapGradientNormBP1D___init__(BPy_ViewMapGradientNormBP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"level", "integration_type", "sampling", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"level", "integration_type", "sampling", nullptr}; + PyObject *obj = nullptr; int i; float f = 2.0; @@ -86,43 +86,43 @@ static int ViewMapGradientNormBP1D___init__(BPy_ViewMapGradientNormBP1D *self, /*-----------------------BPy_ViewMapGradientNormBP1D type definition ----------------------------*/ PyTypeObject ViewMapGradientNormBP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ViewMapGradientNormBP1D", /* tp_name */ - sizeof(BPy_ViewMapGradientNormBP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ViewMapGradientNormBP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &BinaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ViewMapGradientNormBP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ViewMapGradientNormBP1D", /* tp_name */ + sizeof(BPy_ViewMapGradientNormBP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ViewMapGradientNormBP1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &BinaryPredicate1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ViewMapGradientNormBP1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Director.cpp b/source/blender/freestyle/intern/python/Director.cpp index 0769b30ebb7..ff1d63f5f58 100644 --- a/source/blender/freestyle/intern/python/Director.cpp +++ b/source/blender/freestyle/intern/python/Director.cpp @@ -195,7 +195,7 @@ int Director_BPy_ChainingIterator_init(ChainingIterator *c_it) PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_c_it) not initialized"); return -1; } - PyObject *result = PyObject_CallMethod((PyObject *)c_it->py_c_it, "init", NULL); + PyObject *result = PyObject_CallMethod((PyObject *)c_it->py_c_it, "init", nullptr); if (!result) { return -1; } @@ -222,7 +222,7 @@ int Director_BPy_ChainingIterator_traverse(ChainingIterator *c_it, AdjacencyIter c_it->result = ((BPy_ViewEdge *)result)->ve; } else if (result == Py_None) { - c_it->result = NULL; + c_it->result = nullptr; } else { PyErr_SetString(PyExc_RuntimeError, "traverse method returned a wrong value"); diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp index 7b3571c479f..8ae5bbb14fe 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp @@ -69,10 +69,10 @@ PyDoc_STRVAR(CurvePoint_doc, static int CurvePoint_init(BPy_CurvePoint *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"first_vertex", "second_vertex", "t2d", NULL}; - static const char *kwlist_3[] = {"first_point", "second_point", "t2d", NULL}; - PyObject *obj1 = 0, *obj2 = 0; + static const char *kwlist_1[] = {"brother", nullptr}; + static const char *kwlist_2[] = {"first_vertex", "second_vertex", "t2d", nullptr}; + static const char *kwlist_3[] = {"first_point", "second_point", "t2d", nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr; float t2d; if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &CurvePoint_Type, &obj1)) { @@ -107,11 +107,11 @@ static int CurvePoint_init(BPy_CurvePoint *self, PyObject *args, PyObject *kwds) &t2d)) { CurvePoint *cp1 = ((BPy_CurvePoint *)obj1)->cp; CurvePoint *cp2 = ((BPy_CurvePoint *)obj2)->cp; - if (!cp1 || cp1->A() == 0 || cp1->B() == 0) { + if (!cp1 || cp1->A() == nullptr || cp1->B() == nullptr) { PyErr_SetString(PyExc_TypeError, "argument 1 is an invalid CurvePoint object"); return -1; } - if (!cp2 || cp2->A() == 0 || cp2->B() == 0) { + if (!cp2 || cp2->A() == nullptr || cp2->B() == nullptr) { PyErr_SetString(PyExc_TypeError, "argument 2 is an invalid CurvePoint object"); return -1; } @@ -225,56 +225,56 @@ static PyGetSetDef BPy_CurvePoint_getseters[] = { (getter)CurvePoint_first_svertex_get, (setter)CurvePoint_first_svertex_set, CurvePoint_first_svertex_doc, - NULL}, + nullptr}, {"second_svertex", (getter)CurvePoint_second_svertex_get, (setter)CurvePoint_second_svertex_set, CurvePoint_second_svertex_doc, - NULL}, - {"fedge", (getter)CurvePoint_fedge_get, NULL, CurvePoint_fedge_doc, NULL}, - {"t2d", (getter)CurvePoint_t2d_get, (setter)CurvePoint_t2d_set, CurvePoint_t2d_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {"fedge", (getter)CurvePoint_fedge_get, nullptr, CurvePoint_fedge_doc, nullptr}, + {"t2d", (getter)CurvePoint_t2d_get, (setter)CurvePoint_t2d_set, CurvePoint_t2d_doc, nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_CurvePoint type definition ------------------------------*/ PyTypeObject CurvePoint_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "CurvePoint", /* tp_name */ - sizeof(BPy_CurvePoint), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - CurvePoint_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_CurvePoint_getseters, /* tp_getset */ - &Interface0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)CurvePoint_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "CurvePoint", /* tp_name */ + sizeof(BPy_CurvePoint), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + CurvePoint_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_CurvePoint_getseters, /* tp_getset */ + &Interface0D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)CurvePoint_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp index 63725c6b0e8..1931889df4c 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp @@ -54,9 +54,9 @@ PyDoc_STRVAR(SVertex_doc, static int SVertex_init(BPy_SVertex *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"point_3d", "id", NULL}; - PyObject *obj = 0; + static const char *kwlist_1[] = {"brother", nullptr}; + static const char *kwlist_2[] = {"point_3d", "id", nullptr}; + PyObject *obj = nullptr; float v[3]; if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &SVertex_Type, &obj)) { @@ -93,17 +93,17 @@ PyDoc_STRVAR(SVertex_add_normal_doc, static PyObject *SVertex_add_normal(BPy_SVertex *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"normal", NULL}; + static const char *kwlist[] = {"normal", nullptr}; PyObject *py_normal; Vec3r n; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &py_normal)) { - return NULL; + return nullptr; } if (!Vec3r_ptr_from_PyObject(py_normal, n)) { PyErr_SetString(PyExc_TypeError, "argument 1 must be a 3D vector (either a list of 3 elements or Vector)"); - return NULL; + return nullptr; } self->sv->AddNormal(n); Py_RETURN_NONE; @@ -119,11 +119,11 @@ PyDoc_STRVAR(SVertex_add_fedge_doc, static PyObject *SVertex_add_fedge(BPy_SVertex *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"fedge", NULL}; + static const char *kwlist[] = {"fedge", nullptr}; PyObject *py_fe; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &FEdge_Type, &py_fe)) { - return NULL; + return nullptr; } self->sv->AddFEdge(((BPy_FEdge *)py_fe)->fe); Py_RETURN_NONE; @@ -140,7 +140,7 @@ static PyMethodDef BPy_SVertex_methods[] = { (PyCFunction)SVertex_add_fedge, METH_VARARGS | METH_KEYWORDS, SVertex_add_fedge_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*----------------------mathutils callbacks ----------------------------*/ @@ -423,63 +423,71 @@ static PyGetSetDef BPy_SVertex_getseters[] = { (getter)SVertex_point_3d_get, (setter)SVertex_point_3d_set, SVertex_point_3d_doc, - NULL}, + nullptr}, {"point_2d", (getter)SVertex_point_2d_get, (setter)SVertex_point_2d_set, SVertex_point_2d_doc, - NULL}, - {"id", (getter)SVertex_id_get, (setter)SVertex_id_set, SVertex_id_doc, NULL}, - {"normals", (getter)SVertex_normals_get, (setter)NULL, SVertex_normals_doc, NULL}, + nullptr}, + {"id", (getter)SVertex_id_get, (setter)SVertex_id_set, SVertex_id_doc, nullptr}, + {"normals", (getter)SVertex_normals_get, (setter) nullptr, SVertex_normals_doc, nullptr}, {"normals_size", (getter)SVertex_normals_size_get, - (setter)NULL, + (setter) nullptr, SVertex_normals_size_doc, - NULL}, - {"viewvertex", (getter)SVertex_viewvertex_get, (setter)NULL, SVertex_viewvertex_doc, NULL}, - {"curvatures", (getter)SVertex_curvatures_get, (setter)NULL, SVertex_curvatures_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {"viewvertex", + (getter)SVertex_viewvertex_get, + (setter) nullptr, + SVertex_viewvertex_doc, + nullptr}, + {"curvatures", + (getter)SVertex_curvatures_get, + (setter) nullptr, + SVertex_curvatures_doc, + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_SVertex type definition ------------------------------*/ PyTypeObject SVertex_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "SVertex", /* tp_name */ - sizeof(BPy_SVertex), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - SVertex_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_SVertex_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_SVertex_getseters, /* tp_getset */ - &Interface0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)SVertex_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "SVertex", /* tp_name */ + sizeof(BPy_SVertex), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + SVertex_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_SVertex_methods, /* tp_methods */ + nullptr, /* tp_members */ + BPy_SVertex_getseters, /* tp_getset */ + &Interface0D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SVertex_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp index c947f37397b..c273cb6446a 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp @@ -85,7 +85,7 @@ static PyObject *ViewVertex_edges_end(BPy_ViewVertex * /*self*/) return BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator(ove_it, 1); #else PyErr_SetString(PyExc_NotImplementedError, "edges_end method currently disabled"); - return NULL; + return nullptr; #endif } @@ -102,11 +102,11 @@ PyDoc_STRVAR(ViewVertex_edges_iterator_doc, static PyObject *ViewVertex_edges_iterator(BPy_ViewVertex *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"edge", NULL}; + static const char *kwlist[] = {"edge", nullptr}; PyObject *py_ve; if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewEdge_Type, &py_ve)) { - return NULL; + return nullptr; } ViewEdge *ve = ((BPy_ViewEdge *)py_ve)->ve; ViewVertexInternal::orientedViewEdgeIterator ove_it(self->vv->edgesIterator(ve)); @@ -120,7 +120,7 @@ static PyMethodDef BPy_ViewVertex_methods[] = { (PyCFunction)ViewVertex_edges_iterator, METH_VARARGS | METH_KEYWORDS, ViewVertex_edges_iterator_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*----------------------ViewVertex get/setters ----------------------------*/ @@ -134,7 +134,7 @@ static PyObject *ViewVertex_nature_get(BPy_ViewVertex *self, void *UNUSED(closur { Nature::VertexNature nature = self->vv->getNature(); if (PyErr_Occurred()) { - return NULL; + return nullptr; } return BPy_Nature_from_Nature(nature); // return a copy } @@ -154,49 +154,49 @@ static PyGetSetDef BPy_ViewVertex_getseters[] = { (getter)ViewVertex_nature_get, (setter)ViewVertex_nature_set, ViewVertex_nature_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_ViewVertex type definition ------------------------------*/ PyTypeObject ViewVertex_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ViewVertex", /* tp_name */ - sizeof(BPy_ViewVertex), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ViewVertex_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_ViewVertex_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_ViewVertex_getseters, /* tp_getset */ - &Interface0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ViewVertex_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ViewVertex", /* tp_name */ + sizeof(BPy_ViewVertex), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ViewVertex_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_ViewVertex_methods, /* tp_methods */ + nullptr, /* tp_members */ + BPy_ViewVertex_getseters, /* tp_getset */ + &Interface0D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ViewVertex_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp index 5c1a8f8482f..805b6a933fa 100644 --- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp @@ -70,11 +70,11 @@ PyDoc_STRVAR( static int StrokeVertex_init(BPy_StrokeVertex *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"first_vertex", "second_vertex", "t3d", NULL}; - static const char *kwlist_3[] = {"point", NULL}; - static const char *kwlist_4[] = {"svertex", "attribute", NULL}; - PyObject *obj1 = 0, *obj2 = 0; + static const char *kwlist_1[] = {"brother", nullptr}; + static const char *kwlist_2[] = {"first_vertex", "second_vertex", "t3d", nullptr}; + static const char *kwlist_3[] = {"point", nullptr}; + static const char *kwlist_4[] = {"svertex", "attribute", nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr; float t3d; if (PyArg_ParseTupleAndKeywords( @@ -102,11 +102,11 @@ static int StrokeVertex_init(BPy_StrokeVertex *self, PyObject *args, PyObject *k &t3d)) { StrokeVertex *sv1 = ((BPy_StrokeVertex *)obj1)->sv; StrokeVertex *sv2 = ((BPy_StrokeVertex *)obj2)->sv; - if (!sv1 || (sv1->A() == 0 && sv1->B() == 0)) { + if (!sv1 || (sv1->A() == nullptr && sv1->B() == nullptr)) { PyErr_SetString(PyExc_TypeError, "argument 1 is an invalid StrokeVertex object"); return -1; } - if (!sv2 || (sv2->A() == 0 && sv2->B() == 0)) { + if (!sv2 || (sv2->A() == nullptr && sv2->B() == nullptr)) { PyErr_SetString(PyExc_TypeError, "argument 2 is an invalid StrokeVertex object"); return -1; } @@ -116,14 +116,14 @@ static int StrokeVertex_init(BPy_StrokeVertex *self, PyObject *args, PyObject *k PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist_3, &CurvePoint_Type, &obj1)) { CurvePoint *cp = ((BPy_CurvePoint *)obj1)->cp; - if (!cp || cp->A() == 0 || cp->B() == 0) { + if (!cp || cp->A() == nullptr || cp->B() == nullptr) { PyErr_SetString(PyExc_TypeError, "argument 1 is an invalid CurvePoint object"); return -1; } self->sv = new StrokeVertex(cp); } else if ((void)PyErr_Clear(), - (void)(obj2 = 0), + (void)(obj2 = nullptr), PyArg_ParseTupleAndKeywords(args, kwds, "O!|O!", @@ -335,65 +335,65 @@ static PyGetSetDef BPy_StrokeVertex_getseters[] = { (getter)StrokeVertex_attribute_get, (setter)StrokeVertex_attribute_set, StrokeVertex_attribute_doc, - NULL}, + nullptr}, {"curvilinear_abscissa", (getter)StrokeVertex_curvilinear_abscissa_get, (setter)StrokeVertex_curvilinear_abscissa_set, StrokeVertex_curvilinear_abscissa_doc, - NULL}, + nullptr}, {"point", (getter)StrokeVertex_point_get, (setter)StrokeVertex_point_set, StrokeVertex_point_doc, - NULL}, + nullptr}, {"stroke_length", (getter)StrokeVertex_stroke_length_get, (setter)StrokeVertex_stroke_length_set, StrokeVertex_stroke_length_doc, - NULL}, - {"u", (getter)StrokeVertex_u_get, (setter)NULL, StrokeVertex_u_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {"u", (getter)StrokeVertex_u_get, (setter) nullptr, StrokeVertex_u_doc, nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_StrokeVertex type definition ------------------------------*/ PyTypeObject StrokeVertex_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "StrokeVertex", /* tp_name */ - sizeof(BPy_StrokeVertex), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - StrokeVertex_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_StrokeVertex_getseters, /* tp_getset */ - &CurvePoint_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)StrokeVertex_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "StrokeVertex", /* tp_name */ + sizeof(BPy_StrokeVertex), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + StrokeVertex_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_StrokeVertex_getseters, /* tp_getset */ + &CurvePoint_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)StrokeVertex_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp index ff53f5bfcbe..6713106d323 100644 --- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp @@ -50,8 +50,8 @@ PyDoc_STRVAR( static int NonTVertex_init(BPy_NonTVertex *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"svertex", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"svertex", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &SVertex_Type, &obj)) { return -1; @@ -99,49 +99,49 @@ static PyGetSetDef BPy_NonTVertex_getseters[] = { (getter)NonTVertex_svertex_get, (setter)NonTVertex_svertex_set, NonTVertex_svertex_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_NonTVertex type definition ------------------------------*/ PyTypeObject NonTVertex_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "NonTVertex", /* tp_name */ - sizeof(BPy_NonTVertex), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NonTVertex_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_NonTVertex_getseters, /* tp_getset */ - &ViewVertex_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)NonTVertex_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "NonTVertex", /* tp_name */ + sizeof(BPy_NonTVertex), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + NonTVertex_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_NonTVertex_getseters, /* tp_getset */ + &ViewVertex_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)NonTVertex_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp index 61755b4bbd8..cc413b26fcd 100644 --- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp @@ -51,7 +51,7 @@ PyDoc_STRVAR(TVertex_doc, static int TVertex_init(BPy_TVertex *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -75,11 +75,11 @@ PyDoc_STRVAR(TVertex_get_svertex_doc, static PyObject *TVertex_get_svertex(BPy_TVertex *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"fedge", NULL}; + static const char *kwlist[] = {"fedge", nullptr}; PyObject *py_fe; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &FEdge_Type, &py_fe)) { - return NULL; + return nullptr; } SVertex *sv = self->tv->getSVertex(((BPy_FEdge *)py_fe)->fe); if (sv) { @@ -102,11 +102,11 @@ PyDoc_STRVAR(TVertex_get_mate_doc, static PyObject *TVertex_get_mate(BPy_TVertex *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"viewedge", NULL}; + static const char *kwlist[] = {"viewedge", nullptr}; PyObject *py_ve; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewEdge_Type, &py_ve)) { - return NULL; + return nullptr; } ViewEdge *ve = self->tv->mate(((BPy_ViewEdge *)py_ve)->ve); if (ve) { @@ -124,7 +124,7 @@ static PyMethodDef BPy_TVertex_methods[] = { (PyCFunction)TVertex_get_mate, METH_VARARGS | METH_KEYWORDS, TVertex_get_mate_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*----------------------TVertex get/setters ----------------------------*/ @@ -203,55 +203,55 @@ static PyGetSetDef BPy_TVertex_getseters[] = { (getter)TVertex_front_svertex_get, (setter)TVertex_front_svertex_set, TVertex_front_svertex_doc, - NULL}, + nullptr}, {"back_svertex", (getter)TVertex_back_svertex_get, (setter)TVertex_back_svertex_set, TVertex_back_svertex_doc, - NULL}, - {"id", (getter)TVertex_id_get, (setter)TVertex_id_set, TVertex_id_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {"id", (getter)TVertex_id_get, (setter)TVertex_id_set, TVertex_id_doc, nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_TVertex type definition ------------------------------*/ PyTypeObject TVertex_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "TVertex", /* tp_name */ - sizeof(BPy_TVertex), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - TVertex_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_TVertex_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_TVertex_getseters, /* tp_getset */ - &ViewVertex_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)TVertex_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "TVertex", /* tp_name */ + sizeof(BPy_TVertex), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + TVertex_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_TVertex_methods, /* tp_methods */ + nullptr, /* tp_members */ + BPy_TVertex_getseters, /* tp_getset */ + &ViewVertex_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)TVertex_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp index d337bf7f90e..9d16e88f305 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp @@ -62,9 +62,9 @@ PyDoc_STRVAR(FEdge_doc, static int FEdge_init(BPy_FEdge *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"first_vertex", "second_vertex", NULL}; - PyObject *obj1 = 0, *obj2 = 0; + static const char *kwlist_1[] = {"brother", nullptr}; + static const char *kwlist_2[] = {"first_vertex", "second_vertex", nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr; if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FEdge_Type, &obj1)) { if (!obj1) { @@ -114,20 +114,20 @@ static PyObject *FEdge_sq_item(BPy_FEdge *self, int keynum) Py_RETURN_NONE; } PyErr_Format(PyExc_IndexError, "FEdge[index]: index %d out of range", keynum); - return NULL; + return nullptr; } static PySequenceMethods BPy_FEdge_as_sequence = { (lenfunc)FEdge_sq_length, /* sq_length */ - NULL, /* sq_concat */ - NULL, /* sq_repeat */ + nullptr, /* sq_concat */ + nullptr, /* sq_repeat */ (ssizeargfunc)FEdge_sq_item, /* sq_item */ - NULL, /* sq_slice */ - NULL, /* sq_ass_item */ - NULL, /* *was* sq_ass_slice */ - NULL, /* sq_contains */ - NULL, /* sq_inplace_concat */ - NULL, /* sq_inplace_repeat */ + nullptr, /* sq_slice */ + nullptr, /* sq_ass_item */ + nullptr, /* *was* sq_ass_slice */ + nullptr, /* sq_contains */ + nullptr, /* sq_inplace_concat */ + nullptr, /* sq_inplace_repeat */ }; /*----------------------FEdge get/setters ----------------------------*/ @@ -320,73 +320,77 @@ static PyGetSetDef BPy_FEdge_getseters[] = { (getter)FEdge_first_svertex_get, (setter)FEdge_first_svertex_set, FEdge_first_svertex_doc, - NULL}, + nullptr}, {"second_svertex", (getter)FEdge_second_svertex_get, (setter)FEdge_second_svertex_set, FEdge_second_svertex_doc, - NULL}, + nullptr}, {"next_fedge", (getter)FEdge_next_fedge_get, (setter)FEdge_next_fedge_set, FEdge_next_fedge_doc, - NULL}, + nullptr}, {"previous_fedge", (getter)FEdge_previous_fedge_get, (setter)FEdge_previous_fedge_set, FEdge_previous_fedge_doc, - NULL}, - {"viewedge", (getter)FEdge_viewedge_get, (setter)FEdge_viewedge_set, FEdge_viewedge_doc, NULL}, + nullptr}, + {"viewedge", + (getter)FEdge_viewedge_get, + (setter)FEdge_viewedge_set, + FEdge_viewedge_doc, + nullptr}, {"is_smooth", (getter)FEdge_is_smooth_get, (setter)FEdge_is_smooth_set, FEdge_is_smooth_doc, - NULL}, - {"id", (getter)FEdge_id_get, (setter)FEdge_id_set, FEdge_id_doc, NULL}, - {"nature", (getter)FEdge_nature_get, (setter)FEdge_nature_set, FEdge_nature_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {"id", (getter)FEdge_id_get, (setter)FEdge_id_set, FEdge_id_doc, nullptr}, + {"nature", (getter)FEdge_nature_get, (setter)FEdge_nature_set, FEdge_nature_doc, nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_FEdge type definition ------------------------------*/ PyTypeObject FEdge_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "FEdge", /* tp_name */ - sizeof(BPy_FEdge), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - &BPy_FEdge_as_sequence, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FEdge_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_FEdge_getseters, /* tp_getset */ - &Interface1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FEdge_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "FEdge", /* tp_name */ + sizeof(BPy_FEdge), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + &BPy_FEdge_as_sequence, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FEdge_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_FEdge_getseters, /* tp_getset */ + &Interface1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FEdge_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp index 78c0ee051d6..4fedbcf1513 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp @@ -54,9 +54,9 @@ PyDoc_STRVAR(FrsCurve_doc, static int FrsCurve_init(BPy_FrsCurve *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"id", NULL}; - PyObject *obj = 0; + static const char *kwlist_1[] = {"brother", nullptr}; + static const char *kwlist_2[] = {"id", nullptr}; + PyObject *obj = nullptr; if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FrsCurve_Type, &obj)) { if (!obj) { @@ -89,11 +89,11 @@ PyDoc_STRVAR(FrsCurve_push_vertex_back_doc, static PyObject *FrsCurve_push_vertex_back(BPy_FrsCurve *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"vertex", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"vertex", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj)) { - return NULL; + return nullptr; } if (BPy_CurvePoint_Check(obj)) { @@ -104,7 +104,7 @@ static PyObject *FrsCurve_push_vertex_back(BPy_FrsCurve *self, PyObject *args, P } else { PyErr_SetString(PyExc_TypeError, "invalid argument"); - return NULL; + return nullptr; } Py_RETURN_NONE; } @@ -119,11 +119,11 @@ PyDoc_STRVAR(FrsCurve_push_vertex_front_doc, static PyObject *FrsCurve_push_vertex_front(BPy_FrsCurve *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"vertex", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"vertex", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj)) { - return NULL; + return nullptr; } if (BPy_CurvePoint_Check(obj)) { @@ -134,7 +134,7 @@ static PyObject *FrsCurve_push_vertex_front(BPy_FrsCurve *self, PyObject *args, } else { PyErr_SetString(PyExc_TypeError, "invalid argument"); - return NULL; + return nullptr; } Py_RETURN_NONE; } @@ -148,7 +148,7 @@ static PyMethodDef BPy_FrsCurve_methods[] = { (PyCFunction)FrsCurve_push_vertex_front, METH_VARARGS | METH_KEYWORDS, FrsCurve_push_vertex_front_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*----------------------CurvePoint get/setters ----------------------------*/ @@ -174,55 +174,55 @@ static PyObject *FrsCurve_segments_size_get(BPy_FrsCurve *self, void *UNUSED(clo } static PyGetSetDef BPy_FrsCurve_getseters[] = { - {"is_empty", (getter)FrsCurve_is_empty_get, (setter)NULL, FrsCurve_is_empty_doc, NULL}, + {"is_empty", (getter)FrsCurve_is_empty_get, (setter) nullptr, FrsCurve_is_empty_doc, nullptr}, {"segments_size", (getter)FrsCurve_segments_size_get, - (setter)NULL, + (setter) nullptr, FrsCurve_segments_size_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_FrsCurve type definition ------------------------------*/ PyTypeObject FrsCurve_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Curve", /* tp_name */ - sizeof(BPy_FrsCurve), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FrsCurve_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_FrsCurve_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_FrsCurve_getseters, /* tp_getset */ - &Interface1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FrsCurve_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "Curve", /* tp_name */ + sizeof(BPy_FrsCurve), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FrsCurve_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_FrsCurve_methods, /* tp_methods */ + nullptr, /* tp_members */ + BPy_FrsCurve_getseters, /* tp_getset */ + &Interface1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FrsCurve_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp index 910f9cdfa07..87d0899746e 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp @@ -56,8 +56,8 @@ PyDoc_STRVAR(Stroke_doc, static int Stroke_init(BPy_Stroke *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"brother", NULL}; - PyObject *brother = 0; + static const char *kwlist[] = {"brother", nullptr}; + PyObject *brother = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &Stroke_Type, &brother)) { return -1; @@ -91,7 +91,7 @@ static PyObject *Stroke_sq_item(BPy_Stroke *self, int keynum) } if (keynum < 0 || keynum >= Stroke_sq_length(self)) { PyErr_Format(PyExc_IndexError, "Stroke[index]: index %d out of range", keynum); - return NULL; + return nullptr; } return BPy_StrokeVertex_from_StrokeVertex(self->s->strokeVerticeAt(keynum)); } @@ -113,11 +113,11 @@ PyDoc_STRVAR(Stroke_compute_sampling_doc, static PyObject *Stroke_compute_sampling(BPy_Stroke *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"n", NULL}; + static const char *kwlist[] = {"n", nullptr}; int i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i)) { - return NULL; + return nullptr; } return PyFloat_FromDouble(self->s->ComputeSampling(i)); } @@ -140,27 +140,27 @@ PyDoc_STRVAR(Stroke_resample_doc, static PyObject *Stroke_resample(BPy_Stroke *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"n", NULL}; - static const char *kwlist_2[] = {"sampling", NULL}; + static const char *kwlist_1[] = {"n", nullptr}; + static const char *kwlist_2[] = {"sampling", nullptr}; int i; float f; if (PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist_1, &i)) { if (self->s->Resample(i) < 0) { PyErr_SetString(PyExc_RuntimeError, "Stroke resampling (by vertex count) failed"); - return NULL; + return nullptr; } } else if ((void)PyErr_Clear(), PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist_2, &f)) { if (self->s->Resample(f) < 0) { PyErr_SetString(PyExc_RuntimeError, "Stroke resampling (by vertex interval) failed"); - return NULL; + return nullptr; } } else { PyErr_SetString(PyExc_TypeError, "invalid argument"); - return NULL; + return nullptr; } Py_RETURN_NONE; } @@ -180,8 +180,8 @@ PyDoc_STRVAR(Stroke_insert_vertex_doc, static PyObject *Stroke_insert_vertex(BPy_Stroke *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"vertex", "next", NULL}; - PyObject *py_sv = 0, *py_sv_it = 0; + static const char *kwlist[] = {"vertex", "next", nullptr}; + PyObject *py_sv = nullptr, *py_sv_it = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, @@ -191,7 +191,7 @@ static PyObject *Stroke_insert_vertex(BPy_Stroke *self, PyObject *args, PyObject &py_sv, &StrokeVertexIterator_Type, &py_sv_it)) { - return NULL; + return nullptr; } /* Make the wrapped StrokeVertex internal. */ @@ -214,19 +214,19 @@ PyDoc_STRVAR(Stroke_remove_vertex_doc, static PyObject *Stroke_remove_vertex(BPy_Stroke *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"vertex", NULL}; - PyObject *py_sv = 0; + static const char *kwlist[] = {"vertex", nullptr}; + PyObject *py_sv = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist, &StrokeVertex_Type, &py_sv)) { - return NULL; + return nullptr; } if (((BPy_StrokeVertex *)py_sv)->sv) { self->s->RemoveVertex(((BPy_StrokeVertex *)py_sv)->sv); } else { PyErr_SetString(PyExc_TypeError, "invalid argument"); - return NULL; + return nullptr; } Py_RETURN_NONE; } @@ -268,11 +268,11 @@ PyDoc_STRVAR(Stroke_stroke_vertices_begin_doc, static PyObject *Stroke_stroke_vertices_begin(BPy_Stroke *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"t", NULL}; + static const char *kwlist[] = {"t", nullptr}; float f = 0.0f; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) { - return NULL; + return nullptr; } StrokeInternal::StrokeVertexIterator sv_it(self->s->strokeVerticesBegin(f)); return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, false); @@ -353,7 +353,7 @@ static PyMethodDef BPy_Stroke_methods[] = { (PyCFunction)Stroke_stroke_vertices_size, METH_NOARGS, Stroke_stroke_vertices_size_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*----------------------Stroke get/setters ----------------------------*/ @@ -465,75 +465,75 @@ static PyGetSetDef BPy_Stroke_getseters[] = { (getter)Stroke_medium_type_get, (setter)Stroke_medium_type_set, Stroke_medium_type_doc, - NULL}, + nullptr}, {"texture_id", (getter)Stroke_texture_id_get, (setter)Stroke_texture_id_set, Stroke_texture_id_doc, - NULL}, - {"tips", (getter)Stroke_tips_get, (setter)Stroke_tips_set, Stroke_tips_doc, NULL}, + nullptr}, + {"tips", (getter)Stroke_tips_get, (setter)Stroke_tips_set, Stroke_tips_doc, nullptr}, {"length_2d", (getter)Stroke_length_2d_get, (setter)Stroke_length_2d_set, Stroke_length_2d_doc, - NULL}, - {"id", (getter)Stroke_id_get, (setter)Stroke_id_set, Stroke_id_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {"id", (getter)Stroke_id_get, (setter)Stroke_id_set, Stroke_id_doc, nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_Stroke type definition ------------------------------*/ static PySequenceMethods BPy_Stroke_as_sequence = { (lenfunc)Stroke_sq_length, /* sq_length */ - NULL, /* sq_concat */ - NULL, /* sq_repeat */ + nullptr, /* sq_concat */ + nullptr, /* sq_repeat */ (ssizeargfunc)Stroke_sq_item, /* sq_item */ - NULL, /* sq_slice */ - NULL, /* sq_ass_item */ - NULL, /* *was* sq_ass_slice */ - NULL, /* sq_contains */ - NULL, /* sq_inplace_concat */ - NULL, /* sq_inplace_repeat */ + nullptr, /* sq_slice */ + nullptr, /* sq_ass_item */ + nullptr, /* *was* sq_ass_slice */ + nullptr, /* sq_contains */ + nullptr, /* sq_inplace_concat */ + nullptr, /* sq_inplace_repeat */ }; PyTypeObject Stroke_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Stroke", /* tp_name */ - sizeof(BPy_Stroke), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - &BPy_Stroke_as_sequence, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Stroke_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - (getiterfunc)Stroke_iter, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Stroke_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_Stroke_getseters, /* tp_getset */ - &Interface1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Stroke_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "Stroke", /* tp_name */ + sizeof(BPy_Stroke), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + &BPy_Stroke_as_sequence, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Stroke_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)Stroke_iter, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_Stroke_methods, /* tp_methods */ + nullptr, /* tp_members */ + BPy_Stroke_getseters, /* tp_getset */ + &Interface1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Stroke_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp index e9160d7a5c7..fbc65fb67b8 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp @@ -54,8 +54,8 @@ PyDoc_STRVAR( static int ViewEdge_init(BPy_ViewEdge *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"brother", NULL}; - PyObject *brother = 0; + static const char *kwlist[] = {"brother", nullptr}; + PyObject *brother = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &ViewEdge_Type, &brother)) { return -1; @@ -87,7 +87,7 @@ static PyMethodDef BPy_ViewEdge_methods[] = { (PyCFunction)ViewEdge_update_fedges, METH_NOARGS, ViewEdge_update_fedges_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*----------------------ViewEdge get/setters ----------------------------*/ @@ -333,88 +333,92 @@ static PyGetSetDef BPy_ViewEdge_getseters[] = { (getter)ViewEdge_first_viewvertex_get, (setter)ViewEdge_first_viewvertex_set, ViewEdge_first_viewvertex_doc, - NULL}, + nullptr}, {"last_viewvertex", (getter)ViewEdge_last_viewvertex_get, (setter)ViewEdge_last_viewvertex_set, ViewEdge_last_viewvertex_doc, - NULL}, + nullptr}, {"first_fedge", (getter)ViewEdge_first_fedge_get, (setter)ViewEdge_first_fedge_set, ViewEdge_first_fedge_doc, - NULL}, + nullptr}, {"last_fedge", (getter)ViewEdge_last_fedge_get, (setter)ViewEdge_last_fedge_set, ViewEdge_last_fedge_doc, - NULL}, + nullptr}, {"viewshape", (getter)ViewEdge_viewshape_get, (setter)ViewEdge_viewshape_set, ViewEdge_viewshape_doc, - NULL}, + nullptr}, {"occludee", (getter)ViewEdge_occludee_get, (setter)ViewEdge_occludee_set, ViewEdge_occludee_doc, - NULL}, - {"is_closed", (getter)ViewEdge_is_closed_get, (setter)NULL, ViewEdge_is_closed_doc, NULL}, - {"id", (getter)ViewEdge_id_get, (setter)ViewEdge_id_set, ViewEdge_id_doc, NULL}, + nullptr}, + {"is_closed", + (getter)ViewEdge_is_closed_get, + (setter) nullptr, + ViewEdge_is_closed_doc, + nullptr}, + {"id", (getter)ViewEdge_id_get, (setter)ViewEdge_id_set, ViewEdge_id_doc, nullptr}, {"nature", (getter)ViewEdge_nature_get, (setter)ViewEdge_nature_set, ViewEdge_nature_doc, - NULL}, - {"qi", (getter)ViewEdge_qi_get, (setter)ViewEdge_qi_set, ViewEdge_qi_doc, NULL}, + nullptr}, + {"qi", (getter)ViewEdge_qi_get, (setter)ViewEdge_qi_set, ViewEdge_qi_doc, nullptr}, {"chaining_time_stamp", (getter)ViewEdge_chaining_time_stamp_get, (setter)ViewEdge_chaining_time_stamp_set, ViewEdge_chaining_time_stamp_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_ViewEdge type definition ------------------------------*/ PyTypeObject ViewEdge_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ViewEdge", /* tp_name */ - sizeof(BPy_ViewEdge), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ViewEdge_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_ViewEdge_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_ViewEdge_getseters, /* tp_getset */ - &Interface1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ViewEdge_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ViewEdge", /* tp_name */ + sizeof(BPy_ViewEdge), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ViewEdge_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_ViewEdge_methods, /* tp_methods */ + nullptr, /* tp_members */ + BPy_ViewEdge_getseters, /* tp_getset */ + &Interface1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ViewEdge_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp index 028e36145b9..f932b13a232 100644 --- a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp @@ -53,9 +53,9 @@ PyDoc_STRVAR(Chain_doc, static int Chain_init(BPy_Chain *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"id", NULL}; - PyObject *obj = 0; + static const char *kwlist_1[] = {"brother", nullptr}; + static const char *kwlist_2[] = {"id", nullptr}; + PyObject *obj = nullptr; if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &Chain_Type, &obj)) { if (!obj) { @@ -92,12 +92,12 @@ PyDoc_STRVAR(Chain_push_viewedge_back_doc, static PyObject *Chain_push_viewedge_back(BPy_Chain *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"viewedge", "orientation", NULL}; - PyObject *obj1 = 0, *obj2 = 0; + static const char *kwlist[] = {"viewedge", "orientation", nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!O!", (char **)kwlist, &ViewEdge_Type, &obj1, &PyBool_Type, &obj2)) { - return NULL; + return nullptr; } ViewEdge *ve = ((BPy_ViewEdge *)obj1)->ve; bool orientation = bool_from_PyBool(obj2); @@ -118,12 +118,12 @@ PyDoc_STRVAR(Chain_push_viewedge_front_doc, static PyObject *Chain_push_viewedge_front(BPy_Chain *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"viewedge", "orientation", NULL}; - PyObject *obj1 = 0, *obj2 = 0; + static const char *kwlist[] = {"viewedge", "orientation", nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!O!", (char **)kwlist, &ViewEdge_Type, &obj1, &PyBool_Type, &obj2)) { - return NULL; + return nullptr; } ViewEdge *ve = ((BPy_ViewEdge *)obj1)->ve; bool orientation = bool_from_PyBool(obj2); @@ -140,49 +140,49 @@ static PyMethodDef BPy_Chain_methods[] = { (PyCFunction)Chain_push_viewedge_front, METH_VARARGS | METH_KEYWORDS, Chain_push_viewedge_front_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*-----------------------BPy_Chain type definition ------------------------------*/ PyTypeObject Chain_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Chain", /* tp_name */ - sizeof(BPy_Chain), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Chain_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Chain_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &FrsCurve_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Chain_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "Chain", /* tp_name */ + sizeof(BPy_Chain), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Chain_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_Chain_methods, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &FrsCurve_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Chain_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp index 018e0449552..df270da2791 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp @@ -57,9 +57,9 @@ PyDoc_STRVAR(FEdgeSharp_doc, static int FEdgeSharp_init(BPy_FEdgeSharp *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"first_vertex", "second_vertex", NULL}; - PyObject *obj1 = 0, *obj2 = 0; + static const char *kwlist_1[] = {"brother", nullptr}; + static const char *kwlist_2[] = {"first_vertex", "second_vertex", nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr; if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FEdgeSharp_Type, &obj1)) { if (!obj1) { @@ -362,85 +362,85 @@ static PyGetSetDef BPy_FEdgeSharp_getseters[] = { (getter)FEdgeSharp_normal_right_get, (setter)FEdgeSharp_normal_right_set, FEdgeSharp_normal_right_doc, - NULL}, + nullptr}, {"normal_left", (getter)FEdgeSharp_normal_left_get, (setter)FEdgeSharp_normal_left_set, FEdgeSharp_normal_left_doc, - NULL}, + nullptr}, {"material_index_right", (getter)FEdgeSharp_material_index_right_get, (setter)FEdgeSharp_material_index_right_set, FEdgeSharp_material_index_right_doc, - NULL}, + nullptr}, {"material_index_left", (getter)FEdgeSharp_material_index_left_get, (setter)FEdgeSharp_material_index_left_set, FEdgeSharp_material_index_left_doc, - NULL}, + nullptr}, {"material_right", (getter)FEdgeSharp_material_right_get, - (setter)NULL, + (setter) nullptr, FEdgeSharp_material_right_doc, - NULL}, + nullptr}, {"material_left", (getter)FEdgeSharp_material_left_get, - (setter)NULL, + (setter) nullptr, FEdgeSharp_material_left_doc, - NULL}, + nullptr}, {"face_mark_right", (getter)FEdgeSharp_face_mark_right_get, (setter)FEdgeSharp_face_mark_right_set, FEdgeSharp_face_mark_right_doc, - NULL}, + nullptr}, {"face_mark_left", (getter)FEdgeSharp_face_mark_left_get, (setter)FEdgeSharp_face_mark_left_set, FEdgeSharp_face_mark_left_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_FEdgeSharp type definition ------------------------------*/ PyTypeObject FEdgeSharp_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "FEdgeSharp", /* tp_name */ - sizeof(BPy_FEdgeSharp), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FEdgeSharp_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_FEdgeSharp_getseters, /* tp_getset */ - &FEdge_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FEdgeSharp_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "FEdgeSharp", /* tp_name */ + sizeof(BPy_FEdgeSharp), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FEdgeSharp_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_FEdgeSharp_getseters, /* tp_getset */ + &FEdge_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FEdgeSharp_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp index 014f0411356..f9144e3f15e 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp @@ -54,9 +54,9 @@ PyDoc_STRVAR(FEdgeSmooth_doc, static int FEdgeSmooth_init(BPy_FEdgeSmooth *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"first_vertex", "second_vertex", NULL}; - PyObject *obj1 = 0, *obj2 = 0; + static const char *kwlist_1[] = {"brother", nullptr}; + static const char *kwlist_2[] = {"first_vertex", "second_vertex", nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr; if (PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist_1, &FEdgeSmooth_Type, &obj1)) { @@ -227,61 +227,65 @@ static PyGetSetDef BPy_FEdgeSmooth_getseters[] = { (getter)FEdgeSmooth_normal_get, (setter)FEdgeSmooth_normal_set, FEdgeSmooth_normal_doc, - NULL}, + nullptr}, {"material_index", (getter)FEdgeSmooth_material_index_get, (setter)FEdgeSmooth_material_index_set, FEdgeSmooth_material_index_doc, - NULL}, - {"material", (getter)FEdgeSmooth_material_get, (setter)NULL, FEdgeSmooth_material_doc, NULL}, + nullptr}, + {"material", + (getter)FEdgeSmooth_material_get, + (setter) nullptr, + FEdgeSmooth_material_doc, + nullptr}, {"face_mark", (getter)FEdgeSmooth_face_mark_get, (setter)FEdgeSmooth_face_mark_set, FEdgeSmooth_face_mark_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_FEdgeSmooth type definition ------------------------------*/ PyTypeObject FEdgeSmooth_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "FEdgeSmooth", /* tp_name */ - sizeof(BPy_FEdgeSmooth), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FEdgeSmooth_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_FEdgeSmooth_getseters, /* tp_getset */ - &FEdge_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FEdgeSmooth_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "FEdgeSmooth", /* tp_name */ + sizeof(BPy_FEdgeSmooth), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FEdgeSmooth_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_FEdgeSmooth_getseters, /* tp_getset */ + &FEdge_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FEdgeSmooth_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp index dc32b73fda1..778129653fb 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp @@ -60,10 +60,10 @@ PyDoc_STRVAR( static int AdjacencyIterator_init(BPy_AdjacencyIterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_1[] = {"brother", nullptr}; static const char *kwlist_2[] = { - "vertex", "restrict_to_selection", "restrict_to_unvisited", NULL}; - PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0; + "vertex", "restrict_to_selection", "restrict_to_unvisited", nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr, *obj3 = nullptr; if (PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist_1, &AdjacencyIterator_Type, &obj1)) { @@ -77,7 +77,7 @@ static int AdjacencyIterator_init(BPy_AdjacencyIterator *self, PyObject *args, P } } else if ((void)PyErr_Clear(), - (void)(obj2 = obj3 = 0), + (void)(obj2 = obj3 = nullptr), PyArg_ParseTupleAndKeywords(args, kwds, "O!|O!O!", @@ -113,7 +113,7 @@ static PyObject *AdjacencyIterator_iternext(BPy_AdjacencyIterator *self) { if (self->a_it->isEnd()) { PyErr_SetNone(PyExc_StopIteration); - return NULL; + return nullptr; } if (self->at_start) { self->at_start = false; @@ -122,7 +122,7 @@ static PyObject *AdjacencyIterator_iternext(BPy_AdjacencyIterator *self) self->a_it->increment(); if (self->a_it->isEnd()) { PyErr_SetNone(PyExc_StopIteration); - return NULL; + return nullptr; } } ViewEdge *ve = self->a_it->operator->(); @@ -140,7 +140,7 @@ static PyObject *AdjacencyIterator_object_get(BPy_AdjacencyIterator *self, void { if (self->a_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); - return NULL; + return nullptr; } ViewEdge *ve = self->a_it->operator*(); if (ve) { @@ -160,7 +160,7 @@ static PyObject *AdjacencyIterator_is_incoming_get(BPy_AdjacencyIterator *self, { if (self->a_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); - return NULL; + return nullptr; } return PyBool_from_bool(self->a_it->isIncoming()); } @@ -168,57 +168,57 @@ static PyObject *AdjacencyIterator_is_incoming_get(BPy_AdjacencyIterator *self, static PyGetSetDef BPy_AdjacencyIterator_getseters[] = { {"is_incoming", (getter)AdjacencyIterator_is_incoming_get, - (setter)NULL, + (setter) nullptr, AdjacencyIterator_is_incoming_doc, - NULL}, + nullptr}, {"object", (getter)AdjacencyIterator_object_get, - (setter)NULL, + (setter) nullptr, AdjacencyIterator_object_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_AdjacencyIterator type definition ------------------------------*/ PyTypeObject AdjacencyIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "AdjacencyIterator", /* tp_name */ - sizeof(BPy_AdjacencyIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - AdjacencyIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - (getiterfunc)AdjacencyIterator_iter, /* tp_iter */ - (iternextfunc)AdjacencyIterator_iternext, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_AdjacencyIterator_getseters, /* tp_getset */ - &Iterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)AdjacencyIterator_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "AdjacencyIterator", /* tp_name */ + sizeof(BPy_AdjacencyIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + AdjacencyIterator_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)AdjacencyIterator_iter, /* tp_iter */ + (iternextfunc)AdjacencyIterator_iternext, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_AdjacencyIterator_getseters, /* tp_getset */ + &Iterator_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)AdjacencyIterator_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp index 9c534a3463c..18124567f7d 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp @@ -82,7 +82,7 @@ PyDoc_STRVAR( static int check_begin(PyObject *obj, void *v) { - if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj)) { + if (obj != nullptr && obj != Py_None && !BPy_ViewEdge_Check(obj)) { return 0; } *((PyObject **)v) = obj; @@ -93,15 +93,16 @@ static int ChainPredicateIterator_init(BPy_ChainPredicateIterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_1[] = {"brother", nullptr}; static const char *kwlist_2[] = {"upred", "bpred", "restrict_to_selection", "restrict_to_unvisited", "begin", "orientation", - NULL}; - PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0, *obj4 = 0, *obj5 = 0, *obj6 = 0; + nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr, *obj3 = nullptr, *obj4 = nullptr, *obj5 = nullptr, + *obj6 = nullptr; if (PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist_1, &ChainPredicateIterator_Type, &obj1)) { @@ -112,7 +113,7 @@ static int ChainPredicateIterator_init(BPy_ChainPredicateIterator *self, Py_INCREF(self->bpred); } else if ((void)PyErr_Clear(), - (void)(obj3 = obj4 = obj5 = obj6 = 0), + (void)(obj3 = obj4 = obj5 = obj6 = nullptr), PyArg_ParseTupleAndKeywords(args, kwds, "O!O!|O!O!O&O!", @@ -133,7 +134,7 @@ static int ChainPredicateIterator_init(BPy_ChainPredicateIterator *self, BinaryPredicate1D *bp1D = ((BPy_BinaryPredicate1D *)obj2)->bp1D; bool restrict_to_selection = (!obj3) ? true : bool_from_PyBool(obj3); bool restrict_to_unvisited = (!obj4) ? true : bool_from_PyBool(obj4); - ViewEdge *begin = (!obj5 || obj5 == Py_None) ? NULL : ((BPy_ViewEdge *)obj5)->ve; + ViewEdge *begin = (!obj5 || obj5 == Py_None) ? nullptr : ((BPy_ViewEdge *)obj5)->ve; bool orientation = (!obj6) ? true : bool_from_PyBool(obj6); self->cp_it = new ChainPredicateIterator( *up1D, *bp1D, restrict_to_selection, restrict_to_unvisited, begin, orientation); @@ -162,43 +163,43 @@ static void ChainPredicateIterator_dealloc(BPy_ChainPredicateIterator *self) /*-----------------------BPy_ChainPredicateIterator type definition ----------------------------*/ PyTypeObject ChainPredicateIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ChainPredicateIterator", /* tp_name */ - sizeof(BPy_ChainPredicateIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)ChainPredicateIterator_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ChainPredicateIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &ChainingIterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ChainPredicateIterator_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ChainPredicateIterator", /* tp_name */ + sizeof(BPy_ChainPredicateIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)ChainPredicateIterator_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ChainPredicateIterator_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &ChainingIterator_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ChainPredicateIterator_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp index 9fa84d5f6b8..8f7d6a6221d 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp @@ -68,7 +68,7 @@ PyDoc_STRVAR(ChainSilhouetteIterator_doc, static int check_begin(PyObject *obj, void *v) { - if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj)) { + if (obj != nullptr && obj != Py_None && !BPy_ViewEdge_Check(obj)) { return 0; } *((PyObject **)v) = obj; @@ -79,16 +79,16 @@ static int ChainSilhouetteIterator_init(BPy_ChainSilhouetteIterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"restrict_to_selection", "begin", "orientation", NULL}; - PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0; + static const char *kwlist_1[] = {"brother", nullptr}; + static const char *kwlist_2[] = {"restrict_to_selection", "begin", "orientation", nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr, *obj3 = nullptr; if (PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist_1, &ChainSilhouetteIterator_Type, &obj1)) { self->cs_it = new ChainSilhouetteIterator(*(((BPy_ChainSilhouetteIterator *)obj1)->cs_it)); } else if ((void)PyErr_Clear(), - (void)(obj1 = obj2 = obj3 = 0), + (void)(obj1 = obj2 = obj3 = nullptr), PyArg_ParseTupleAndKeywords(args, kwds, "|O!O&O!", @@ -100,7 +100,7 @@ static int ChainSilhouetteIterator_init(BPy_ChainSilhouetteIterator *self, &PyBool_Type, &obj3)) { bool restrict_to_selection = (!obj1) ? true : bool_from_PyBool(obj1); - ViewEdge *begin = (!obj2 || obj2 == Py_None) ? NULL : ((BPy_ViewEdge *)obj2)->ve; + ViewEdge *begin = (!obj2 || obj2 == Py_None) ? nullptr : ((BPy_ViewEdge *)obj2)->ve; bool orientation = (!obj3) ? true : bool_from_PyBool(obj3); self->cs_it = new ChainSilhouetteIterator(restrict_to_selection, begin, orientation); } @@ -117,43 +117,43 @@ static int ChainSilhouetteIterator_init(BPy_ChainSilhouetteIterator *self, /*-----------------------BPy_ChainSilhouetteIterator type definition ----------------------------*/ PyTypeObject ChainSilhouetteIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ChainSilhouetteIterator", /* tp_name */ - sizeof(BPy_ChainSilhouetteIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ChainSilhouetteIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &ChainingIterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ChainSilhouetteIterator_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ChainSilhouetteIterator", /* tp_name */ + sizeof(BPy_ChainSilhouetteIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ChainSilhouetteIterator_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &ChainingIterator_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ChainSilhouetteIterator_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp index d24e1dc527d..25cde7da48c 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp @@ -69,7 +69,7 @@ PyDoc_STRVAR( static int check_begin(PyObject *obj, void *v) { - if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj)) { + if (obj != nullptr && obj != Py_None && !BPy_ViewEdge_Check(obj)) { return 0; } *((PyObject **)v) = obj; @@ -78,17 +78,17 @@ static int check_begin(PyObject *obj, void *v) static int ChainingIterator___init__(BPy_ChainingIterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_1[] = {"brother", nullptr}; static const char *kwlist_2[] = { - "restrict_to_selection", "restrict_to_unvisited", "begin", "orientation", NULL}; - PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0, *obj4 = 0; + "restrict_to_selection", "restrict_to_unvisited", "begin", "orientation", nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr, *obj3 = nullptr, *obj4 = nullptr; if (PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist_1, &ChainingIterator_Type, &obj1)) { self->c_it = new ChainingIterator(*(((BPy_ChainingIterator *)obj1)->c_it)); } else if ((void)PyErr_Clear(), - (void)(obj1 = obj2 = obj3 = obj4 = 0), + (void)(obj1 = obj2 = obj3 = obj4 = nullptr), PyArg_ParseTupleAndKeywords(args, kwds, "|O!O!O&O!", @@ -103,7 +103,7 @@ static int ChainingIterator___init__(BPy_ChainingIterator *self, PyObject *args, &obj4)) { bool restrict_to_selection = (!obj1) ? true : bool_from_PyBool(obj1); bool restrict_to_unvisited = (!obj2) ? true : bool_from_PyBool(obj2); - ViewEdge *begin = (!obj3 || obj3 == Py_None) ? NULL : ((BPy_ViewEdge *)obj3)->ve; + ViewEdge *begin = (!obj3 || obj3 == Py_None) ? nullptr : ((BPy_ViewEdge *)obj3)->ve; bool orientation = (!obj4) ? true : bool_from_PyBool(obj4); self->c_it = new ChainingIterator( restrict_to_selection, restrict_to_unvisited, begin, orientation); @@ -131,7 +131,7 @@ static PyObject *ChainingIterator_init(BPy_ChainingIterator *self) { if (typeid(*(self->c_it)) == typeid(ChainingIterator)) { PyErr_SetString(PyExc_TypeError, "init() method not properly overridden"); - return NULL; + return nullptr; } self->c_it->init(); Py_RETURN_NONE; @@ -155,16 +155,16 @@ static PyObject *ChainingIterator_traverse(BPy_ChainingIterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; + static const char *kwlist[] = {"it", nullptr}; PyObject *py_a_it; if (typeid(*(self->c_it)) == typeid(ChainingIterator)) { PyErr_SetString(PyExc_TypeError, "traverse() method not properly overridden"); - return NULL; + return nullptr; } if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist, &AdjacencyIterator_Type, &py_a_it)) { - return NULL; + return nullptr; } if (((BPy_AdjacencyIterator *)py_a_it)->a_it) { self->c_it->traverse(*(((BPy_AdjacencyIterator *)py_a_it)->a_it)); @@ -178,7 +178,7 @@ static PyMethodDef BPy_ChainingIterator_methods[] = { (PyCFunction)ChainingIterator_traverse, METH_VARARGS | METH_KEYWORDS, ChainingIterator_traverse_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*----------------------ChainingIterator get/setters ----------------------------*/ @@ -192,7 +192,7 @@ static PyObject *ChainingIterator_object_get(BPy_ChainingIterator *self, void *U { if (self->c_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); - return NULL; + return nullptr; } ViewEdge *ve = self->c_it->operator*(); if (ve) { @@ -232,62 +232,62 @@ static PyObject *ChainingIterator_is_incrementing_get(BPy_ChainingIterator *self static PyGetSetDef BPy_ChainingIterator_getseters[] = { {"object", (getter)ChainingIterator_object_get, - (setter)NULL, + (setter) nullptr, ChainingIterator_object_doc, - NULL}, + nullptr}, {"next_vertex", (getter)ChainingIterator_next_vertex_get, - (setter)NULL, + (setter) nullptr, ChainingIterator_next_vertex_doc, - NULL}, + nullptr}, {"is_incrementing", (getter)ChainingIterator_is_incrementing_get, - (setter)NULL, + (setter) nullptr, ChainingIterator_is_incrementing_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_ChainingIterator type definition ------------------------------*/ PyTypeObject ChainingIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ChainingIterator", /* tp_name */ - sizeof(BPy_ChainingIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ChainingIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_ChainingIterator_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_ChainingIterator_getseters, /* tp_getset */ - &ViewEdgeIterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ChainingIterator___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ChainingIterator", /* tp_name */ + sizeof(BPy_ChainingIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ChainingIterator_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_ChainingIterator_methods, /* tp_methods */ + nullptr, /* tp_members */ + BPy_ChainingIterator_getseters, /* tp_getset */ + &ViewEdgeIterator_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ChainingIterator___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp index 8eac657316e..0f27b7f0a62 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp @@ -54,9 +54,9 @@ PyDoc_STRVAR(CurvePointIterator_doc, static int CurvePointIterator_init(BPy_CurvePointIterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"step", NULL}; - PyObject *brother = 0; + static const char *kwlist_1[] = {"brother", nullptr}; + static const char *kwlist_2[] = {"step", nullptr}; + PyObject *brother = nullptr; float step; if (PyArg_ParseTupleAndKeywords( @@ -92,7 +92,7 @@ static PyObject *CurvePointIterator_object_get(BPy_CurvePointIterator *self, voi { if (self->cp_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); - return NULL; + return nullptr; } return BPy_CurvePoint_from_CurvePoint(self->cp_it->operator*()); } @@ -120,54 +120,54 @@ static PyObject *CurvePointIterator_u_get(BPy_CurvePointIterator *self, void *UN static PyGetSetDef BPy_CurvePointIterator_getseters[] = { {"object", (getter)CurvePointIterator_object_get, - (setter)NULL, + (setter) nullptr, CurvePointIterator_object_doc, - NULL}, - {"t", (getter)CurvePointIterator_t_get, (setter)NULL, CurvePointIterator_t_doc, NULL}, - {"u", (getter)CurvePointIterator_u_get, (setter)NULL, CurvePointIterator_u_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {"t", (getter)CurvePointIterator_t_get, (setter) nullptr, CurvePointIterator_t_doc, nullptr}, + {"u", (getter)CurvePointIterator_u_get, (setter) nullptr, CurvePointIterator_u_doc, nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_CurvePointIterator type definition ------------------------------*/ PyTypeObject CurvePointIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "CurvePointIterator", /* tp_name */ - sizeof(BPy_CurvePointIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - CurvePointIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_CurvePointIterator_getseters, /* tp_getset */ - &Iterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)CurvePointIterator_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "CurvePointIterator", /* tp_name */ + sizeof(BPy_CurvePointIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + CurvePointIterator_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_CurvePointIterator_getseters, /* tp_getset */ + &Iterator_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)CurvePointIterator_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp index f7afc7695ae..d16f06bbbbb 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp @@ -65,9 +65,9 @@ static int convert_nested_it(PyObject *obj, void *v) static int Interface0DIterator_init(BPy_Interface0DIterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"it", NULL}; - static const char *kwlist_2[] = {"inter", NULL}; - static const char *kwlist_3[] = {"brother", NULL}; + static const char *kwlist_1[] = {"it", nullptr}; + static const char *kwlist_2[] = {"inter", nullptr}; + static const char *kwlist_3[] = {"brother", nullptr}; Interface0DIteratorNested *nested_it; PyObject *brother, *inter; @@ -111,21 +111,21 @@ static PyObject *Interface0DIterator_iternext(BPy_Interface0DIterator *self) if (self->reversed) { if (self->if0D_it->isBegin()) { PyErr_SetNone(PyExc_StopIteration); - return NULL; + return nullptr; } self->if0D_it->decrement(); } else { if (self->if0D_it->isEnd()) { PyErr_SetNone(PyExc_StopIteration); - return NULL; + return nullptr; } if (self->at_start) { self->at_start = false; } else if (self->if0D_it->atLast()) { PyErr_SetNone(PyExc_StopIteration); - return NULL; + return nullptr; } else { self->if0D_it->increment(); @@ -150,7 +150,7 @@ static PyObject *Interface0DIterator_object_get(BPy_Interface0DIterator *self, { if (self->if0D_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); - return NULL; + return nullptr; } return Any_BPy_Interface0D_from_Interface0D(self->if0D_it->operator*()); } @@ -190,59 +190,59 @@ static PyObject *Interface0DIterator_at_last_get(BPy_Interface0DIterator *self, static PyGetSetDef BPy_Interface0DIterator_getseters[] = { {"object", (getter)Interface0DIterator_object_get, - (setter)NULL, + (setter) nullptr, Interface0DIterator_object_doc, - NULL}, - {"t", (getter)Interface0DIterator_t_get, (setter)NULL, Interface0DIterator_t_doc, NULL}, - {"u", (getter)Interface0DIterator_u_get, (setter)NULL, Interface0DIterator_u_doc, NULL}, + nullptr}, + {"t", (getter)Interface0DIterator_t_get, (setter) nullptr, Interface0DIterator_t_doc, nullptr}, + {"u", (getter)Interface0DIterator_u_get, (setter) nullptr, Interface0DIterator_u_doc, nullptr}, {"at_last", (getter)Interface0DIterator_at_last_get, - (setter)NULL, + (setter) nullptr, Interface0DIterator_at_last_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_Interface0DIterator type definition ------------------------------*/ PyTypeObject Interface0DIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Interface0DIterator", /* tp_name */ - sizeof(BPy_Interface0DIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Interface0DIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - (getiterfunc)Interface0DIterator_iter, /* tp_iter */ - (iternextfunc)Interface0DIterator_iternext, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_Interface0DIterator_getseters, /* tp_getset */ - &Iterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Interface0DIterator_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "Interface0DIterator", /* tp_name */ + sizeof(BPy_Interface0DIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Interface0DIterator_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)Interface0DIterator_iter, /* tp_iter */ + (iternextfunc)Interface0DIterator_iternext, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_Interface0DIterator_getseters, /* tp_getset */ + &Iterator_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Interface0DIterator_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp index 83c504081c1..00dcafcbcbf 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp @@ -62,9 +62,9 @@ PyDoc_STRVAR( static int SVertexIterator_init(BPy_SVertexIterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"vertex", "begin", "previous_edge", "next_edge", "t", NULL}; - PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0, *obj4 = 0; + static const char *kwlist_1[] = {"brother", nullptr}; + static const char *kwlist_2[] = {"vertex", "begin", "previous_edge", "next_edge", "t", nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr, *obj3 = nullptr, *obj4 = nullptr; float t; if (PyArg_ParseTupleAndKeywords( @@ -115,7 +115,7 @@ static PyObject *SVertexIterator_object_get(BPy_SVertexIterator *self, void *UNU { if (self->sv_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); - return NULL; + return nullptr; } SVertex *sv = self->sv_it->operator->(); if (sv) { @@ -145,52 +145,56 @@ static PyObject *SVertexIterator_u_get(BPy_SVertexIterator *self, void *UNUSED(c } static PyGetSetDef BPy_SVertexIterator_getseters[] = { - {"object", (getter)SVertexIterator_object_get, (setter)NULL, SVertexIterator_object_doc, NULL}, - {"t", (getter)SVertexIterator_t_get, (setter)NULL, SVertexIterator_t_doc, NULL}, - {"u", (getter)SVertexIterator_u_get, (setter)NULL, SVertexIterator_u_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {"object", + (getter)SVertexIterator_object_get, + (setter) nullptr, + SVertexIterator_object_doc, + nullptr}, + {"t", (getter)SVertexIterator_t_get, (setter) nullptr, SVertexIterator_t_doc, nullptr}, + {"u", (getter)SVertexIterator_u_get, (setter) nullptr, SVertexIterator_u_doc, nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_SVertexIterator type definition ------------------------------*/ PyTypeObject SVertexIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "SVertexIterator", /* tp_name */ - sizeof(BPy_SVertexIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - SVertexIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_SVertexIterator_getseters, /* tp_getset */ - &Iterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)SVertexIterator_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "SVertexIterator", /* tp_name */ + sizeof(BPy_SVertexIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + SVertexIterator_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_SVertexIterator_getseters, /* tp_getset */ + &Iterator_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SVertexIterator_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp index e1b24e768e3..8bc95394725 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp @@ -60,9 +60,9 @@ static int StrokeVertexIterator_init(BPy_StrokeVertexIterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"stroke", NULL}; - PyObject *brother = 0, *stroke = 0; + static const char *kwlist_1[] = {"brother", nullptr}; + static const char *kwlist_2[] = {"stroke", nullptr}; + PyObject *brother = nullptr, *stroke = nullptr; if (PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist_1, &StrokeVertexIterator_Type, &brother)) { @@ -111,7 +111,7 @@ static PyObject *StrokeVertexIterator_iternext(BPy_StrokeVertexIterator *self) if (self->reversed) { if (self->sv_it->isBegin()) { PyErr_SetNone(PyExc_StopIteration); - return NULL; + return nullptr; } self->sv_it->decrement(); } @@ -119,7 +119,7 @@ static PyObject *StrokeVertexIterator_iternext(BPy_StrokeVertexIterator *self) /* If sv_it.isEnd() is true, the iterator can't be incremented. */ if (self->sv_it->isEnd()) { PyErr_SetNone(PyExc_StopIteration); - return NULL; + return nullptr; } /* If at the start of the iterator, only return the object * and don't increment, to keep for-loops in sync */ @@ -130,7 +130,7 @@ static PyObject *StrokeVertexIterator_iternext(BPy_StrokeVertexIterator *self) * Incrementing it further would lead to a state that the iterator can't be dereferenced. */ else if (self->sv_it->atLast()) { PyErr_SetNone(PyExc_StopIteration); - return NULL; + return nullptr; } else { self->sv_it->increment(); @@ -154,7 +154,7 @@ static PyObject *StrokeVertexIterator_incremented(BPy_StrokeVertexIterator *self { if (self->sv_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "cannot increment any more"); - return NULL; + return nullptr; } StrokeInternal::StrokeVertexIterator copy(*self->sv_it); copy.increment(); @@ -173,7 +173,7 @@ static PyObject *StrokeVertexIterator_decremented(BPy_StrokeVertexIterator *self { if (self->sv_it->isBegin()) { PyErr_SetString(PyExc_RuntimeError, "cannot decrement any more"); - return NULL; + return nullptr; } StrokeInternal::StrokeVertexIterator copy(*self->sv_it); copy.decrement(); @@ -207,7 +207,7 @@ static PyMethodDef BPy_StrokeVertexIterator_methods[] = { (PyCFunction)StrokeVertexIterator_reversed, METH_NOARGS, StrokeVertexIterator_reversed_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*----------------------StrokeVertexIterator get/setters ----------------------------*/ @@ -222,7 +222,7 @@ static PyObject *StrokeVertexIterator_object_get(BPy_StrokeVertexIterator *self, { if (self->sv_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); - return NULL; + return nullptr; } StrokeVertex *sv = self->sv_it->operator->(); if (sv) { @@ -265,59 +265,67 @@ static PyObject *StrokeVertexIterator_at_last_get(BPy_StrokeVertexIterator *self static PyGetSetDef BPy_StrokeVertexIterator_getseters[] = { {"object", (getter)StrokeVertexIterator_object_get, - (setter)NULL, + (setter) nullptr, StrokeVertexIterator_object_doc, - NULL}, - {"t", (getter)StrokeVertexIterator_t_get, (setter)NULL, StrokeVertexIterator_t_doc, NULL}, - {"u", (getter)StrokeVertexIterator_u_get, (setter)NULL, StrokeVertexIterator_u_doc, NULL}, + nullptr}, + {"t", + (getter)StrokeVertexIterator_t_get, + (setter) nullptr, + StrokeVertexIterator_t_doc, + nullptr}, + {"u", + (getter)StrokeVertexIterator_u_get, + (setter) nullptr, + StrokeVertexIterator_u_doc, + nullptr}, {"at_last", (getter)StrokeVertexIterator_at_last_get, - (setter)NULL, + (setter) nullptr, StrokeVertexIterator_at_last_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_StrokeVertexIterator type definition ------------------------------*/ PyTypeObject StrokeVertexIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "StrokeVertexIterator", /* tp_name */ - sizeof(BPy_StrokeVertexIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - StrokeVertexIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - (getiterfunc)StrokeVertexIterator_iter, /* tp_iter */ - (iternextfunc)StrokeVertexIterator_iternext, /* tp_iternext */ - BPy_StrokeVertexIterator_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_StrokeVertexIterator_getseters, /* tp_getset */ - &Iterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)StrokeVertexIterator_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "StrokeVertexIterator", /* tp_name */ + sizeof(BPy_StrokeVertexIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + StrokeVertexIterator_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)StrokeVertexIterator_iter, /* tp_iter */ + (iternextfunc)StrokeVertexIterator_iternext, /* tp_iternext */ + BPy_StrokeVertexIterator_methods, /* tp_methods */ + nullptr, /* tp_members */ + BPy_StrokeVertexIterator_getseters, /* tp_getset */ + &Iterator_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)StrokeVertexIterator_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp index 20134057864..e24314594a4 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp @@ -57,7 +57,7 @@ PyDoc_STRVAR(ViewEdgeIterator_doc, static int check_begin(PyObject *obj, void *v) { - if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj)) { + if (obj != nullptr && obj != Py_None && !BPy_ViewEdge_Check(obj)) { return 0; } *((PyObject **)v) = obj; @@ -66,19 +66,19 @@ static int check_begin(PyObject *obj, void *v) static int ViewEdgeIterator_init(BPy_ViewEdgeIterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"begin", "orientation", NULL}; - PyObject *obj1 = 0, *obj2 = 0; + static const char *kwlist_1[] = {"brother", nullptr}; + static const char *kwlist_2[] = {"begin", "orientation", nullptr}; + PyObject *obj1 = nullptr, *obj2 = nullptr; if (PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist_1, &ViewEdgeIterator_Type, &obj1)) { self->ve_it = new ViewEdgeInternal::ViewEdgeIterator(*(((BPy_ViewEdgeIterator *)obj1)->ve_it)); } else if ((void)PyErr_Clear(), - (void)(obj1 = obj2 = 0), + (void)(obj1 = obj2 = nullptr), PyArg_ParseTupleAndKeywords( args, kwds, "|O&O!", (char **)kwlist_2, check_begin, &obj1, &PyBool_Type, &obj2)) { - ViewEdge *begin = (!obj1 || obj1 == Py_None) ? NULL : ((BPy_ViewEdge *)obj1)->ve; + ViewEdge *begin = (!obj1 || obj1 == Py_None) ? nullptr : ((BPy_ViewEdge *)obj1)->ve; bool orientation = (!obj2) ? true : bool_from_PyBool(obj2); self->ve_it = new ViewEdgeInternal::ViewEdgeIterator(begin, orientation); } @@ -106,7 +106,7 @@ static PyMethodDef BPy_ViewEdgeIterator_methods[] = { (PyCFunction)ViewEdgeIterator_change_orientation, METH_NOARGS, ViewEdgeIterator_change_orientation_doc}, - {NULL, NULL, 0, NULL}, + {nullptr, nullptr, 0, nullptr}, }; /*----------------------ViewEdgeIterator get/setters ----------------------------*/ @@ -120,7 +120,7 @@ static PyObject *ViewEdgeIterator_object_get(BPy_ViewEdgeIterator *self, void *U { if (!self->ve_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); - return NULL; + return nullptr; } ViewEdge *ve = self->ve_it->operator*(); if (ve) { @@ -212,67 +212,67 @@ static int ViewEdgeIterator_begin_set(BPy_ViewEdgeIterator *self, static PyGetSetDef BPy_ViewEdgeIterator_getseters[] = { {"object", (getter)ViewEdgeIterator_object_get, - (setter)NULL, + (setter) nullptr, ViewEdgeIterator_object_doc, - NULL}, + nullptr}, {"current_edge", (getter)ViewEdgeIterator_current_edge_get, (setter)ViewEdgeIterator_current_edge_set, ViewEdgeIterator_current_edge_doc, - NULL}, + nullptr}, {"orientation", (getter)ViewEdgeIterator_orientation_get, (setter)ViewEdgeIterator_orientation_set, ViewEdgeIterator_orientation_doc, - NULL}, + nullptr}, {"begin", (getter)ViewEdgeIterator_begin_get, (setter)ViewEdgeIterator_begin_set, ViewEdgeIterator_begin_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_ViewEdgeIterator type definition ------------------------------*/ PyTypeObject ViewEdgeIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ViewEdgeIterator", /* tp_name */ - sizeof(BPy_ViewEdgeIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ViewEdgeIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_ViewEdgeIterator_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_ViewEdgeIterator_getseters, /* tp_getset */ - &Iterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ViewEdgeIterator_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ViewEdgeIterator", /* tp_name */ + sizeof(BPy_ViewEdgeIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ViewEdgeIterator_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + BPy_ViewEdgeIterator_methods, /* tp_methods */ + nullptr, /* tp_members */ + BPy_ViewEdgeIterator_getseters, /* tp_getset */ + &Iterator_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ViewEdgeIterator_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp index 30b7b3ccde5..70bea8a0d44 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp @@ -51,8 +51,8 @@ static int orientedViewEdgeIterator_init(BPy_orientedViewEdgeIterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"brother", NULL}; - PyObject *brother = 0; + static const char *kwlist[] = {"brother", nullptr}; + PyObject *brother = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &orientedViewEdgeIterator_Type, &brother)) { @@ -85,14 +85,14 @@ static PyObject *orientedViewEdgeIterator_iternext(BPy_orientedViewEdgeIterator if (self->reversed) { if (self->ove_it->isBegin()) { PyErr_SetNone(PyExc_StopIteration); - return NULL; + return nullptr; } self->ove_it->decrement(); } else { if (self->ove_it->isEnd()) { PyErr_SetNone(PyExc_StopIteration); - return NULL; + return nullptr; } if (self->at_start) { self->at_start = false; @@ -101,7 +101,7 @@ static PyObject *orientedViewEdgeIterator_iternext(BPy_orientedViewEdgeIterator self->ove_it->increment(); if (self->ove_it->isEnd()) { PyErr_SetNone(PyExc_StopIteration); - return NULL; + return nullptr; } } } @@ -123,7 +123,7 @@ static PyObject *orientedViewEdgeIterator_object_get(BPy_orientedViewEdgeIterato { if (self->ove_it->isEnd()) { PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); - return NULL; + return nullptr; } return BPy_directedViewEdge_from_directedViewEdge(self->ove_it->operator*()); } @@ -131,52 +131,52 @@ static PyObject *orientedViewEdgeIterator_object_get(BPy_orientedViewEdgeIterato static PyGetSetDef BPy_orientedViewEdgeIterator_getseters[] = { {"object", (getter)orientedViewEdgeIterator_object_get, - (setter)NULL, + (setter) nullptr, orientedViewEdgeIterator_object_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_orientedViewEdgeIterator type definition ---------------------------*/ PyTypeObject orientedViewEdgeIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "orientedViewEdgeIterator", /* tp_name */ - sizeof(BPy_orientedViewEdgeIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - orientedViewEdgeIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - (getiterfunc)orientedViewEdgeIterator_iter, /* tp_iter */ - (iternextfunc)orientedViewEdgeIterator_iternext, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_orientedViewEdgeIterator_getseters, /* tp_getset */ - &Iterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)orientedViewEdgeIterator_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "orientedViewEdgeIterator", /* tp_name */ + sizeof(BPy_orientedViewEdgeIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + orientedViewEdgeIterator_doc, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)orientedViewEdgeIterator_iter, /* tp_iter */ + (iternextfunc)orientedViewEdgeIterator_iternext, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_orientedViewEdgeIterator_getseters, /* tp_getset */ + &Iterator_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)orientedViewEdgeIterator_init, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp index efe96b72061..55dcafb187e 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp @@ -54,7 +54,7 @@ static int BackboneStretcherShader___init__(BPy_BackboneStretcherShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"amount", NULL}; + static const char *kwlist[] = {"amount", nullptr}; float f = 2.0; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) { @@ -67,43 +67,43 @@ static int BackboneStretcherShader___init__(BPy_BackboneStretcherShader *self, /*-----------------------BPy_BackboneStretcherShader type definition ----------------------------*/ PyTypeObject BackboneStretcherShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "BackboneStretcherShader", /* tp_name */ - sizeof(BPy_BackboneStretcherShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - BackboneStretcherShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)BackboneStretcherShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "BackboneStretcherShader", /* tp_name */ + sizeof(BPy_BackboneStretcherShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + BackboneStretcherShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)BackboneStretcherShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp index 2336b1ce902..94b7a32b6f2 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp @@ -54,7 +54,7 @@ static char BezierCurveShader___doc__[] = static int BezierCurveShader___init__(BPy_BezierCurveShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"error", NULL}; + static const char *kwlist[] = {"error", nullptr}; float f = 4.0; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) { @@ -67,43 +67,43 @@ static int BezierCurveShader___init__(BPy_BezierCurveShader *self, PyObject *arg /*-----------------------BPy_BezierCurveShader type definition ------------------------------*/ PyTypeObject BezierCurveShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "BezierCurveShader", /* tp_name */ - sizeof(BPy_BezierCurveShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - BezierCurveShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)BezierCurveShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "BezierCurveShader", /* tp_name */ + sizeof(BPy_BezierCurveShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + BezierCurveShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)BezierCurveShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp index eaed138f61a..525681d16ea 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp @@ -58,7 +58,7 @@ static int BlenderTextureShader___init__(BPy_BlenderTextureShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"texture", NULL}; + static const char *kwlist[] = {"texture", nullptr}; PyObject *obj; MTex *_mtex; bNodeTree *_nodetree; @@ -87,43 +87,43 @@ static int BlenderTextureShader___init__(BPy_BlenderTextureShader *self, /*-----------------------BPy_BlenderTextureShader type definition ------------------------------*/ PyTypeObject BlenderTextureShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "BlenderTextureShader", /* tp_name */ - sizeof(BPy_BlenderTextureShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - BlenderTextureShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)BlenderTextureShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "BlenderTextureShader", /* tp_name */ + sizeof(BPy_BlenderTextureShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + BlenderTextureShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)BlenderTextureShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp index 27af7207b97..79084843443 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp @@ -67,10 +67,11 @@ static int CalligraphicShader___init__(BPy_CalligraphicShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"thickness_min", "thickness_max", "orientation", "clamp", NULL}; + static const char *kwlist[] = { + "thickness_min", "thickness_max", "orientation", "clamp", nullptr}; double d1, d2; float f3[2]; - PyObject *obj4 = 0; + PyObject *obj4 = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "ddO&O!", (char **)kwlist, &d1, &d2, convert_v2, f3, &PyBool_Type, &obj4)) { @@ -84,43 +85,43 @@ static int CalligraphicShader___init__(BPy_CalligraphicShader *self, /*-----------------------BPy_CalligraphicShader type definition ------------------------------*/ PyTypeObject CalligraphicShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "CalligraphicShader", /* tp_name */ - sizeof(BPy_CalligraphicShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - CalligraphicShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)CalligraphicShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "CalligraphicShader", /* tp_name */ + sizeof(BPy_CalligraphicShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + CalligraphicShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)CalligraphicShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp index 81320e9b5a1..50af76a06b9 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp @@ -53,7 +53,7 @@ static char ColorNoiseShader___doc__[] = static int ColorNoiseShader___init__(BPy_ColorNoiseShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"amplitude", "period", NULL}; + static const char *kwlist[] = {"amplitude", "period", nullptr}; float f1, f2; if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff", (char **)kwlist, &f1, &f2)) { @@ -66,43 +66,43 @@ static int ColorNoiseShader___init__(BPy_ColorNoiseShader *self, PyObject *args, /*-----------------------BPy_ColorNoiseShader type definition ------------------------------*/ PyTypeObject ColorNoiseShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ColorNoiseShader", /* tp_name */ - sizeof(BPy_ColorNoiseShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ColorNoiseShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ColorNoiseShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ColorNoiseShader", /* tp_name */ + sizeof(BPy_ColorNoiseShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ColorNoiseShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ColorNoiseShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp index c5d65734aa5..7c6c4da80ec 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp @@ -59,7 +59,7 @@ static int ConstantColorShader___init__(BPy_ConstantColorShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"red", "green", "blue", "alpha", NULL}; + static const char *kwlist[] = {"red", "green", "blue", "alpha", nullptr}; float f1, f2, f3, f4 = 1.0; if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff|f", (char **)kwlist, &f1, &f2, &f3, &f4)) { @@ -72,43 +72,43 @@ static int ConstantColorShader___init__(BPy_ConstantColorShader *self, /*-----------------------BPy_ConstantColorShader type definition ------------------------------*/ PyTypeObject ConstantColorShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ConstantColorShader", /* tp_name */ - sizeof(BPy_ConstantColorShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ConstantColorShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ConstantColorShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ConstantColorShader", /* tp_name */ + sizeof(BPy_ConstantColorShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ConstantColorShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ConstantColorShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp index 00fbfe525c3..2db898f2e36 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp @@ -53,7 +53,7 @@ static int ConstantThicknessShader___init__(BPy_ConstantThicknessShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"thickness", NULL}; + static const char *kwlist[] = {"thickness", nullptr}; float f; if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) { @@ -66,43 +66,43 @@ static int ConstantThicknessShader___init__(BPy_ConstantThicknessShader *self, /*-----------------------BPy_ConstantThicknessShader type definition ----------------------------*/ PyTypeObject ConstantThicknessShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ConstantThicknessShader", /* tp_name */ - sizeof(BPy_ConstantThicknessShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ConstantThicknessShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ConstantThicknessShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ConstantThicknessShader", /* tp_name */ + sizeof(BPy_ConstantThicknessShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ConstantThicknessShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ConstantThicknessShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp index ebafe84fee0..8a6ccc61a1a 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp @@ -59,7 +59,7 @@ static char ConstrainedIncreasingThicknessShader___doc__[] = static int ConstrainedIncreasingThicknessShader___init__( BPy_ConstrainedIncreasingThicknessShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"thickness_min", "thickness_max", "ratio", NULL}; + static const char *kwlist[] = {"thickness_min", "thickness_max", "ratio", nullptr}; float f1, f2, f3; if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff", (char **)kwlist, &f1, &f2, &f3)) { @@ -72,43 +72,43 @@ static int ConstrainedIncreasingThicknessShader___init__( /*-----------------------BPy_ConstrainedIncreasingThicknessShader type definition ---------------*/ PyTypeObject ConstrainedIncreasingThicknessShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ConstrainedIncreasingThicknessShader", /* tp_name */ - sizeof(BPy_ConstrainedIncreasingThicknessShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ConstrainedIncreasingThicknessShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ConstrainedIncreasingThicknessShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ConstrainedIncreasingThicknessShader", /* tp_name */ + sizeof(BPy_ConstrainedIncreasingThicknessShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ConstrainedIncreasingThicknessShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ConstrainedIncreasingThicknessShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp index ff875fa98d3..0a5486aeb75 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp @@ -61,7 +61,7 @@ static int GuidingLinesShader___init__(BPy_GuidingLinesShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"offset", NULL}; + static const char *kwlist[] = {"offset", nullptr}; float f; if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) { @@ -74,43 +74,43 @@ static int GuidingLinesShader___init__(BPy_GuidingLinesShader *self, /*-----------------------BPy_GuidingLinesShader type definition ------------------------------*/ PyTypeObject GuidingLinesShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GuidingLinesShader", /* tp_name */ - sizeof(BPy_GuidingLinesShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GuidingLinesShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GuidingLinesShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GuidingLinesShader", /* tp_name */ + sizeof(BPy_GuidingLinesShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GuidingLinesShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GuidingLinesShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp index 3c7ba689b28..9f9dfd8c633 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp @@ -79,7 +79,7 @@ static int IncreasingColorShader___init__(BPy_IncreasingColorShader *self, "green_max", "blue_max", "alpha_max", - NULL, + nullptr, }; float f1, f2, f3, f4, f5, f6, f7, f8; @@ -94,43 +94,43 @@ static int IncreasingColorShader___init__(BPy_IncreasingColorShader *self, /*-----------------------BPy_IncreasingColorShader type definition ------------------------------*/ PyTypeObject IncreasingColorShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "IncreasingColorShader", /* tp_name */ - sizeof(BPy_IncreasingColorShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - IncreasingColorShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)IncreasingColorShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "IncreasingColorShader", /* tp_name */ + sizeof(BPy_IncreasingColorShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + IncreasingColorShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)IncreasingColorShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp index e04fa45be36..a807fd821bc 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp @@ -59,7 +59,7 @@ static int IncreasingThicknessShader___init__(BPy_IncreasingThicknessShader *sel PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"thickness_A", "thickness_B", NULL}; + static const char *kwlist[] = {"thickness_A", "thickness_B", nullptr}; float f1, f2; if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff", (char **)kwlist, &f1, &f2)) { @@ -72,43 +72,43 @@ static int IncreasingThicknessShader___init__(BPy_IncreasingThicknessShader *sel /*-----------------------BPy_IncreasingThicknessShader type definition --------------------------*/ PyTypeObject IncreasingThicknessShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "IncreasingThicknessShader", /* tp_name */ - sizeof(BPy_IncreasingThicknessShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - IncreasingThicknessShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)IncreasingThicknessShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "IncreasingThicknessShader", /* tp_name */ + sizeof(BPy_IncreasingThicknessShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + IncreasingThicknessShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)IncreasingThicknessShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp index 8128a6dd8ad..6e0b3614114 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp @@ -60,7 +60,7 @@ static int PolygonalizationShader___init__(BPy_PolygonalizationShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"error", NULL}; + static const char *kwlist[] = {"error", nullptr}; float f; if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) { @@ -73,43 +73,43 @@ static int PolygonalizationShader___init__(BPy_PolygonalizationShader *self, /*-----------------------BPy_PolygonalizationShader type definition -----------------------------*/ PyTypeObject PolygonalizationShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "PolygonalizationShader", /* tp_name */ - sizeof(BPy_PolygonalizationShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - PolygonalizationShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)PolygonalizationShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "PolygonalizationShader", /* tp_name */ + sizeof(BPy_PolygonalizationShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + PolygonalizationShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PolygonalizationShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp index ad8b8ef786b..3b976450464 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp @@ -51,7 +51,7 @@ static char SamplingShader___doc__[] = static int SamplingShader___init__(BPy_SamplingShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"sampling", NULL}; + static const char *kwlist[] = {"sampling", nullptr}; float f; if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) { @@ -64,43 +64,43 @@ static int SamplingShader___init__(BPy_SamplingShader *self, PyObject *args, PyO /*-----------------------BPy_SamplingShader type definition ------------------------------*/ PyTypeObject SamplingShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "SamplingShader", /* tp_name */ - sizeof(BPy_SamplingShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - SamplingShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)SamplingShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "SamplingShader", /* tp_name */ + sizeof(BPy_SamplingShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + SamplingShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SamplingShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp index 9e2726061c3..968abb9d75e 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp @@ -80,7 +80,7 @@ static int SmoothingShader___init__(BPy_SmoothingShader *self, PyObject *args, P "aniso_normal", "aniso_curvature", "carricature_factor", - NULL, + nullptr, }; int i1 = 100; double d2 = 0.1, d3 = 0.0, d4 = 0.2, d5 = 0.0, d6 = 0.0, d7 = 0.0, d8 = 1.0; @@ -96,43 +96,43 @@ static int SmoothingShader___init__(BPy_SmoothingShader *self, PyObject *args, P /*-----------------------BPy_SmoothingShader type definition ------------------------------*/ PyTypeObject SmoothingShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "SmoothingShader", /* tp_name */ - sizeof(BPy_SmoothingShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - SmoothingShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)SmoothingShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "SmoothingShader", /* tp_name */ + sizeof(BPy_SmoothingShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + SmoothingShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SmoothingShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp index f45d97047eb..bdff11f347c 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp @@ -63,10 +63,11 @@ static int SpatialNoiseShader___init__(BPy_SpatialNoiseShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"amount", "scale", "num_octaves", "smooth", "pure_random", NULL}; + static const char *kwlist[] = { + "amount", "scale", "num_octaves", "smooth", "pure_random", nullptr}; float f1, f2; int i3; - PyObject *obj4 = 0, *obj5 = 0; + PyObject *obj4 = nullptr, *obj5 = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, @@ -89,43 +90,43 @@ static int SpatialNoiseShader___init__(BPy_SpatialNoiseShader *self, /*-----------------------BPy_SpatialNoiseShader type definition ------------------------------*/ PyTypeObject SpatialNoiseShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "SpatialNoiseShader", /* tp_name */ - sizeof(BPy_SpatialNoiseShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - SpatialNoiseShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)SpatialNoiseShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "SpatialNoiseShader", /* tp_name */ + sizeof(BPy_SpatialNoiseShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + SpatialNoiseShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SpatialNoiseShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp index 93a14edd964..8f8ef76dc69 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp @@ -53,7 +53,7 @@ static int StrokeTextureStepShader___init__(BPy_StrokeTextureStepShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"step", NULL}; + static const char *kwlist[] = {"step", nullptr}; float step = 0.1; if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &step)) { @@ -66,43 +66,43 @@ static int StrokeTextureStepShader___init__(BPy_StrokeTextureStepShader *self, /*-----------------------BPy_StrokeTextureStepShader type definition ----------------------------*/ PyTypeObject StrokeTextureStepShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "StrokeTextureStepShader", /* tp_name */ - sizeof(BPy_StrokeTextureStepShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - StrokeTextureStepShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)StrokeTextureStepShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "StrokeTextureStepShader", /* tp_name */ + sizeof(BPy_StrokeTextureStepShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + StrokeTextureStepShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)StrokeTextureStepShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp index 966dc050985..e601028a1e2 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp @@ -55,7 +55,7 @@ static int ThicknessNoiseShader___init__(BPy_ThicknessNoiseShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"amplitude", "period", NULL}; + static const char *kwlist[] = {"amplitude", "period", nullptr}; float f1, f2; if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff", (char **)kwlist, &f1, &f2)) { @@ -68,43 +68,43 @@ static int ThicknessNoiseShader___init__(BPy_ThicknessNoiseShader *self, /*-----------------------BPy_ThicknessNoiseShader type definition ------------------------------*/ PyTypeObject ThicknessNoiseShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ThicknessNoiseShader", /* tp_name */ - sizeof(BPy_ThicknessNoiseShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ThicknessNoiseShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ThicknessNoiseShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ThicknessNoiseShader", /* tp_name */ + sizeof(BPy_ThicknessNoiseShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ThicknessNoiseShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ThicknessNoiseShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp index 001e6ce23ba..be563b641d7 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp @@ -52,7 +52,7 @@ static char TipRemoverShader___doc__[] = static int TipRemoverShader___init__(BPy_TipRemoverShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"tip_length", NULL}; + static const char *kwlist[] = {"tip_length", nullptr}; double d; if (!PyArg_ParseTupleAndKeywords(args, kwds, "d", (char **)kwlist, &d)) { @@ -65,43 +65,43 @@ static int TipRemoverShader___init__(BPy_TipRemoverShader *self, PyObject *args, /*-----------------------BPy_TipRemoverShader type definition ------------------------------*/ PyTypeObject TipRemoverShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "TipRemoverShader", /* tp_name */ - sizeof(BPy_TipRemoverShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - TipRemoverShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)TipRemoverShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "TipRemoverShader", /* tp_name */ + sizeof(BPy_TipRemoverShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + TipRemoverShader___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)TipRemoverShader___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp index 9ced91f6867..8507b525cfb 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp @@ -44,7 +44,7 @@ extern "C" { int UnaryFunction0DDouble_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -133,7 +133,7 @@ static int UnaryFunction0DDouble___init__(BPy_UnaryFunction0DDouble *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -158,24 +158,24 @@ static PyObject *UnaryFunction0DDouble___call__(BPy_UnaryFunction0DDouble *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; + static const char *kwlist[] = {"it", nullptr}; PyObject *obj; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) { - return NULL; + return nullptr; } if (typeid(*(self->uf0D_double)) == typeid(UnaryFunction0D<double>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->uf0D_double->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return PyFloat_FromDouble(self->uf0D_double->result); } @@ -183,43 +183,43 @@ static PyObject *UnaryFunction0DDouble___call__(BPy_UnaryFunction0DDouble *self, /*-----------------------BPy_UnaryFunction0DDouble type definition ------------------------------*/ PyTypeObject UnaryFunction0DDouble_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DDouble", /* tp_name */ - sizeof(BPy_UnaryFunction0DDouble), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DDouble___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DDouble___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DDouble___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DDouble___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DDouble___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction0DDouble", /* tp_name */ + sizeof(BPy_UnaryFunction0DDouble), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DDouble___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction0DDouble___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryFunction0DDouble___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DDouble___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DDouble___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp index 7520f647276..f48bc871855 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp @@ -35,7 +35,7 @@ extern "C" { int UnaryFunction0DEdgeNature_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -71,7 +71,7 @@ static int UnaryFunction0DEdgeNature___init__(BPy_UnaryFunction0DEdgeNature *sel PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -97,24 +97,24 @@ static PyObject *UnaryFunction0DEdgeNature___call__(BPy_UnaryFunction0DEdgeNatur PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; + static const char *kwlist[] = {"it", nullptr}; PyObject *obj; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) { - return NULL; + return nullptr; } if (typeid(*(self->uf0D_edgenature)) == typeid(UnaryFunction0D<Nature::EdgeNature>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->uf0D_edgenature->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return BPy_Nature_from_Nature(self->uf0D_edgenature->result); } @@ -122,43 +122,43 @@ static PyObject *UnaryFunction0DEdgeNature___call__(BPy_UnaryFunction0DEdgeNatur /*-----------------------BPy_UnaryFunction0DEdgeNature type definition --------------------------*/ PyTypeObject UnaryFunction0DEdgeNature_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DEdgeNature", /* tp_name */ - sizeof(BPy_UnaryFunction0DEdgeNature), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DEdgeNature___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DEdgeNature___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DEdgeNature___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DEdgeNature___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DEdgeNature___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction0DEdgeNature", /* tp_name */ + sizeof(BPy_UnaryFunction0DEdgeNature), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DEdgeNature___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction0DEdgeNature___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryFunction0DEdgeNature___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DEdgeNature___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DEdgeNature___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp index 7ee0d9bd71d..6bf545d217d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp @@ -40,7 +40,7 @@ extern "C" { int UnaryFunction0DFloat_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -109,7 +109,7 @@ static int UnaryFunction0DFloat___init__(BPy_UnaryFunction0DFloat *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -134,24 +134,24 @@ static PyObject *UnaryFunction0DFloat___call__(BPy_UnaryFunction0DFloat *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; + static const char *kwlist[] = {"it", nullptr}; PyObject *obj; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) { - return NULL; + return nullptr; } if (typeid(*(self->uf0D_float)) == typeid(UnaryFunction0D<float>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->uf0D_float->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return PyFloat_FromDouble(self->uf0D_float->result); } @@ -159,43 +159,43 @@ static PyObject *UnaryFunction0DFloat___call__(BPy_UnaryFunction0DFloat *self, /*-----------------------BPy_UnaryFunction0DFloat type definition ------------------------------*/ PyTypeObject UnaryFunction0DFloat_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DFloat", /* tp_name */ - sizeof(BPy_UnaryFunction0DFloat), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DFloat___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DFloat___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DFloat___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DFloat___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DFloat___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction0DFloat", /* tp_name */ + sizeof(BPy_UnaryFunction0DFloat), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DFloat___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction0DFloat___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryFunction0DFloat___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DFloat___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DFloat___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp index 9c0f833d8fa..39c73e2545c 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp @@ -35,7 +35,7 @@ extern "C" { int UnaryFunction0DId_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -68,7 +68,7 @@ static char UnaryFunction0DId___doc__[] = static int UnaryFunction0DId___init__(BPy_UnaryFunction0DId *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -93,24 +93,24 @@ static PyObject *UnaryFunction0DId___call__(BPy_UnaryFunction0DId *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; + static const char *kwlist[] = {"it", nullptr}; PyObject *obj; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) { - return NULL; + return nullptr; } if (typeid(*(self->uf0D_id)) == typeid(UnaryFunction0D<Id>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->uf0D_id->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return BPy_Id_from_Id(self->uf0D_id->result); } @@ -118,43 +118,43 @@ static PyObject *UnaryFunction0DId___call__(BPy_UnaryFunction0DId *self, /*-----------------------BPy_UnaryFunction0DId type definition ------------------------------*/ PyTypeObject UnaryFunction0DId_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DId", /* tp_name */ - sizeof(BPy_UnaryFunction0DId), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DId___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DId___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DId___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DId___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DId___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction0DId", /* tp_name */ + sizeof(BPy_UnaryFunction0DId), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DId___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction0DId___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryFunction0DId___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DId___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DId___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp index 95cdc1522ac..dcebed1ec9f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp @@ -35,7 +35,7 @@ extern "C" { int UnaryFunction0DMaterial_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -70,7 +70,7 @@ static int UnaryFunction0DMaterial___init__(BPy_UnaryFunction0DMaterial *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -96,24 +96,24 @@ static PyObject *UnaryFunction0DMaterial___call__(BPy_UnaryFunction0DMaterial *s PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; + static const char *kwlist[] = {"it", nullptr}; PyObject *obj; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) { - return NULL; + return nullptr; } if (typeid(*(self->uf0D_material)) == typeid(UnaryFunction0D<FrsMaterial>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->uf0D_material->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return BPy_FrsMaterial_from_FrsMaterial(self->uf0D_material->result); } @@ -121,43 +121,43 @@ static PyObject *UnaryFunction0DMaterial___call__(BPy_UnaryFunction0DMaterial *s /*-----------------------BPy_UnaryFunction0DMaterial type definition ----------------------------*/ PyTypeObject UnaryFunction0DMaterial_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DMaterial", /* tp_name */ - sizeof(BPy_UnaryFunction0DMaterial), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DMaterial___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DMaterial___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DMaterial___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DMaterial___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DMaterial___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction0DMaterial", /* tp_name */ + sizeof(BPy_UnaryFunction0DMaterial), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DMaterial___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction0DMaterial___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryFunction0DMaterial___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DMaterial___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DMaterial___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp index 17ddd9773d2..f93eeb0fc88 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp @@ -35,7 +35,7 @@ extern "C" { int UnaryFunction0DUnsigned_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -71,7 +71,7 @@ static int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -97,24 +97,24 @@ static PyObject *UnaryFunction0DUnsigned___call__(BPy_UnaryFunction0DUnsigned *s PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; + static const char *kwlist[] = {"it", nullptr}; PyObject *obj; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) { - return NULL; + return nullptr; } if (typeid(*(self->uf0D_unsigned)) == typeid(UnaryFunction0D<unsigned int>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->uf0D_unsigned->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return PyLong_FromLong(self->uf0D_unsigned->result); } @@ -122,43 +122,43 @@ static PyObject *UnaryFunction0DUnsigned___call__(BPy_UnaryFunction0DUnsigned *s /*-----------------------BPy_UnaryFunction0DUnsigned type definition ----------------------------*/ PyTypeObject UnaryFunction0DUnsigned_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DUnsigned", /* tp_name */ - sizeof(BPy_UnaryFunction0DUnsigned), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DUnsigned___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DUnsigned___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DUnsigned___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DUnsigned___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DUnsigned___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction0DUnsigned", /* tp_name */ + sizeof(BPy_UnaryFunction0DUnsigned), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DUnsigned___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction0DUnsigned___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryFunction0DUnsigned___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DUnsigned___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DUnsigned___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp index 3ff73dca832..6ba95a3f080 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp @@ -36,7 +36,7 @@ extern "C" { int UnaryFunction0DVec2f_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -77,7 +77,7 @@ static int UnaryFunction0DVec2f___init__(BPy_UnaryFunction0DVec2f *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -102,24 +102,24 @@ static PyObject *UnaryFunction0DVec2f___call__(BPy_UnaryFunction0DVec2f *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; + static const char *kwlist[] = {"it", nullptr}; PyObject *obj; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) { - return NULL; + return nullptr; } if (typeid(*(self->uf0D_vec2f)) == typeid(UnaryFunction0D<Vec2f>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->uf0D_vec2f->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return Vector_from_Vec2f(self->uf0D_vec2f->result); } @@ -127,43 +127,43 @@ static PyObject *UnaryFunction0DVec2f___call__(BPy_UnaryFunction0DVec2f *self, /*-----------------------BPy_UnaryFunction0DVec2f type definition ------------------------------*/ PyTypeObject UnaryFunction0DVec2f_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DVec2f", /* tp_name */ - sizeof(BPy_UnaryFunction0DVec2f), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DVec2f___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DVec2f___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DVec2f___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DVec2f___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DVec2f___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction0DVec2f", /* tp_name */ + sizeof(BPy_UnaryFunction0DVec2f), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DVec2f___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction0DVec2f___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryFunction0DVec2f___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DVec2f___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DVec2f___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp index afbd25df122..f6e4f281f34 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp @@ -35,7 +35,7 @@ extern "C" { int UnaryFunction0DVec3f_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -70,7 +70,7 @@ static int UnaryFunction0DVec3f___init__(BPy_UnaryFunction0DVec3f *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -95,24 +95,24 @@ static PyObject *UnaryFunction0DVec3f___call__(BPy_UnaryFunction0DVec3f *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; + static const char *kwlist[] = {"it", nullptr}; PyObject *obj; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) { - return NULL; + return nullptr; } if (typeid(*(self->uf0D_vec3f)) == typeid(UnaryFunction0D<Vec3f>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->uf0D_vec3f->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return Vector_from_Vec3f(self->uf0D_vec3f->result); } @@ -120,43 +120,43 @@ static PyObject *UnaryFunction0DVec3f___call__(BPy_UnaryFunction0DVec3f *self, /*-----------------------BPy_UnaryFunction0DVec3f type definition ------------------------------*/ PyTypeObject UnaryFunction0DVec3f_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DVec3f", /* tp_name */ - sizeof(BPy_UnaryFunction0DVec3f), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DVec3f___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DVec3f___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DVec3f___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DVec3f___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DVec3f___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction0DVec3f", /* tp_name */ + sizeof(BPy_UnaryFunction0DVec3f), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DVec3f___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction0DVec3f___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryFunction0DVec3f___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DVec3f___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DVec3f___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp index 4fd6d949974..53a838e8d42 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp @@ -35,7 +35,7 @@ extern "C" { int UnaryFunction0DVectorViewShape_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -72,7 +72,7 @@ static int UnaryFunction0DVectorViewShape___init__(BPy_UnaryFunction0DVectorView PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -98,24 +98,24 @@ static PyObject *UnaryFunction0DVectorViewShape___call__(BPy_UnaryFunction0DVect PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; + static const char *kwlist[] = {"it", nullptr}; PyObject *obj; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) { - return NULL; + return nullptr; } if (typeid(*(self->uf0D_vectorviewshape)) == typeid(UnaryFunction0D<std::vector<ViewShape *>>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->uf0D_vectorviewshape->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } const unsigned int list_len = self->uf0D_vectorviewshape->result.size(); @@ -131,43 +131,43 @@ static PyObject *UnaryFunction0DVectorViewShape___call__(BPy_UnaryFunction0DVect /*-----------------------BPy_UnaryFunction0DVectorViewShape type definition ---------------------*/ PyTypeObject UnaryFunction0DVectorViewShape_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DVectorViewShape", /* tp_name */ - sizeof(BPy_UnaryFunction0DVectorViewShape), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DVectorViewShape___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DVectorViewShape___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DVectorViewShape___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DVectorViewShape___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DVectorViewShape___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction0DVectorViewShape", /* tp_name */ + sizeof(BPy_UnaryFunction0DVectorViewShape), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DVectorViewShape___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction0DVectorViewShape___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryFunction0DVectorViewShape___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DVectorViewShape___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DVectorViewShape___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp index 0f623b0e765..9ad621da7c5 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp @@ -36,7 +36,7 @@ extern "C" { int UnaryFunction0DViewShape_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -78,7 +78,7 @@ static int UnaryFunction0DViewShape___init__(BPy_UnaryFunction0DViewShape *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -104,24 +104,24 @@ static PyObject *UnaryFunction0DViewShape___call__(BPy_UnaryFunction0DViewShape PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; + static const char *kwlist[] = {"it", nullptr}; PyObject *obj; if (!PyArg_ParseTupleAndKeywords( args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) { - return NULL; + return nullptr; } if (typeid(*(self->uf0D_viewshape)) == typeid(UnaryFunction0D<ViewShape *>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->uf0D_viewshape->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return BPy_ViewShape_from_ViewShape(*(self->uf0D_viewshape->result)); } @@ -129,43 +129,43 @@ static PyObject *UnaryFunction0DViewShape___call__(BPy_UnaryFunction0DViewShape /*-----------------------BPy_UnaryFunction0DViewShape type definition ---------------------------*/ PyTypeObject UnaryFunction0DViewShape_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DViewShape", /* tp_name */ - sizeof(BPy_UnaryFunction0DViewShape), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DViewShape___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DViewShape___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DViewShape___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DViewShape___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DViewShape___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction0DViewShape", /* tp_name */ + sizeof(BPy_UnaryFunction0DViewShape), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DViewShape___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction0DViewShape___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryFunction0DViewShape___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DViewShape___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DViewShape___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp index 6d4406b17a7..066ce2a8da4 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp @@ -57,7 +57,7 @@ static char ShapeIdF0D___doc__[] = static int ShapeIdF0D___init__(BPy_ShapeIdF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -70,43 +70,43 @@ static int ShapeIdF0D___init__(BPy_ShapeIdF0D *self, PyObject *args, PyObject *k /*-----------------------BPy_ShapeIdF0D type definition ------------------------------*/ PyTypeObject ShapeIdF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ShapeIdF0D", /* tp_name */ - sizeof(BPy_ShapeIdF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ShapeIdF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DId_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ShapeIdF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ShapeIdF0D", /* tp_name */ + sizeof(BPy_ShapeIdF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ShapeIdF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DId_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ShapeIdF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp index a9050c4594e..a9a4a897b29 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp @@ -60,7 +60,7 @@ static char MaterialF0D___doc__[] = static int MaterialF0D___init__(BPy_MaterialF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -73,43 +73,43 @@ static int MaterialF0D___init__(BPy_MaterialF0D *self, PyObject *args, PyObject /*-----------------------BPy_MaterialF0D type definition ------------------------------*/ PyTypeObject MaterialF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "MaterialF0D", /* tp_name */ - sizeof(BPy_MaterialF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - MaterialF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DMaterial_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)MaterialF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "MaterialF0D", /* tp_name */ + sizeof(BPy_MaterialF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + MaterialF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DMaterial_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)MaterialF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp index 1173b2434d6..bf57da163e8 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp @@ -51,7 +51,7 @@ static char CurveNatureF0D___doc__[] = static int CurveNatureF0D___init__(BPy_CurveNatureF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -64,43 +64,43 @@ static int CurveNatureF0D___init__(BPy_CurveNatureF0D *self, PyObject *args, PyO /*-----------------------BPy_CurveNatureF0D type definition ------------------------------*/ PyTypeObject CurveNatureF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "CurveNatureF0D", /* tp_name */ - sizeof(BPy_CurveNatureF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - CurveNatureF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DEdgeNature_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)CurveNatureF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "CurveNatureF0D", /* tp_name */ + sizeof(BPy_CurveNatureF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + CurveNatureF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DEdgeNature_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)CurveNatureF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp index 673522a055e..eadf190c6ea 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp @@ -53,7 +53,7 @@ static char Normal2DF0D___doc__[] = static int Normal2DF0D___init__(BPy_Normal2DF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -66,43 +66,43 @@ static int Normal2DF0D___init__(BPy_Normal2DF0D *self, PyObject *args, PyObject /*-----------------------BPy_Normal2DF0D type definition ------------------------------*/ PyTypeObject Normal2DF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Normal2DF0D", /* tp_name */ - sizeof(BPy_Normal2DF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Normal2DF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DVec2f_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Normal2DF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "Normal2DF0D", /* tp_name */ + sizeof(BPy_Normal2DF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Normal2DF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DVec2f_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Normal2DF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp index 5ec616c90c1..54621c3b5d8 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp @@ -55,7 +55,7 @@ static int VertexOrientation2DF0D___init__(BPy_VertexOrientation2DF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -68,43 +68,43 @@ static int VertexOrientation2DF0D___init__(BPy_VertexOrientation2DF0D *self, /*-----------------------BPy_VertexOrientation2DF0D type definition -----------------------------*/ PyTypeObject VertexOrientation2DF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "VertexOrientation2DF0D", /* tp_name */ - sizeof(BPy_VertexOrientation2DF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - VertexOrientation2DF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DVec2f_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)VertexOrientation2DF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "VertexOrientation2DF0D", /* tp_name */ + sizeof(BPy_VertexOrientation2DF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + VertexOrientation2DF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DVec2f_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)VertexOrientation2DF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp index 6db4c9317e2..1a1143a561f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp @@ -55,7 +55,7 @@ static int VertexOrientation3DF0D___init__(BPy_VertexOrientation3DF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -68,43 +68,43 @@ static int VertexOrientation3DF0D___init__(BPy_VertexOrientation3DF0D *self, /*-----------------------BPy_VertexOrientation3DF0D type definition -----------------------------*/ PyTypeObject VertexOrientation3DF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "VertexOrientation3DF0D", /* tp_name */ - sizeof(BPy_VertexOrientation3DF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - VertexOrientation3DF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DVec3f_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)VertexOrientation3DF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "VertexOrientation3DF0D", /* tp_name */ + sizeof(BPy_VertexOrientation3DF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + VertexOrientation3DF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DVec3f_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)VertexOrientation3DF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp index 827c089aa1a..6220ac22a59 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp @@ -50,7 +50,7 @@ static char GetOccludeeF0D___doc__[] = static int GetOccludeeF0D___init__(BPy_GetOccludeeF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -63,43 +63,43 @@ static int GetOccludeeF0D___init__(BPy_GetOccludeeF0D *self, PyObject *args, PyO /*-----------------------BPy_GetOccludeeF0D type definition ------------------------------*/ PyTypeObject GetOccludeeF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetOccludeeF0D", /* tp_name */ - sizeof(BPy_GetOccludeeF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetOccludeeF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DViewShape_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetOccludeeF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetOccludeeF0D", /* tp_name */ + sizeof(BPy_GetOccludeeF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetOccludeeF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DViewShape_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetOccludeeF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp index 31b36dbf855..98c5bc1936f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp @@ -50,7 +50,7 @@ static char GetShapeF0D___doc__[] = static int GetShapeF0D___init__(BPy_GetShapeF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -63,43 +63,43 @@ static int GetShapeF0D___init__(BPy_GetShapeF0D *self, PyObject *args, PyObject /*-----------------------BPy_GetShapeF0D type definition ------------------------------*/ PyTypeObject GetShapeF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetShapeF0D", /* tp_name */ - sizeof(BPy_GetShapeF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetShapeF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DViewShape_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetShapeF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetShapeF0D", /* tp_name */ + sizeof(BPy_GetShapeF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetShapeF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DViewShape_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetShapeF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp index 5f1d123c8d3..fd14c6475e1 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp @@ -55,7 +55,7 @@ static int Curvature2DAngleF0D___init__(BPy_Curvature2DAngleF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -68,43 +68,43 @@ static int Curvature2DAngleF0D___init__(BPy_Curvature2DAngleF0D *self, /*-----------------------BPy_Curvature2DAngleF0D type definition ------------------------------*/ PyTypeObject Curvature2DAngleF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Curvature2DAngleF0D", /* tp_name */ - sizeof(BPy_Curvature2DAngleF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Curvature2DAngleF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Curvature2DAngleF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "Curvature2DAngleF0D", /* tp_name */ + sizeof(BPy_Curvature2DAngleF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Curvature2DAngleF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Curvature2DAngleF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp index 736afca7fae..8a77e417ab9 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp @@ -59,7 +59,7 @@ static char DensityF0D___doc__[] = static int DensityF0D___init__(BPy_DensityF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"sigma", NULL}; + static const char *kwlist[] = {"sigma", nullptr}; double d = 2; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|d", (char **)kwlist, &d)) { @@ -73,43 +73,43 @@ static int DensityF0D___init__(BPy_DensityF0D *self, PyObject *args, PyObject *k /*-----------------------BPy_DensityF0D type definition ------------------------------*/ PyTypeObject DensityF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "DensityF0D", /* tp_name */ - sizeof(BPy_DensityF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - DensityF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)DensityF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "DensityF0D", /* tp_name */ + sizeof(BPy_DensityF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + DensityF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)DensityF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp index d3cd14a1aba..8d981cabe0d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp @@ -50,7 +50,7 @@ static char GetProjectedXF0D___doc__[] = static int GetProjectedXF0D___init__(BPy_GetProjectedXF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -63,43 +63,43 @@ static int GetProjectedXF0D___init__(BPy_GetProjectedXF0D *self, PyObject *args, /*-----------------------BPy_GetProjectedXF0D type definition ------------------------------*/ PyTypeObject GetProjectedXF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetProjectedXF0D", /* tp_name */ - sizeof(BPy_GetProjectedXF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetProjectedXF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetProjectedXF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetProjectedXF0D", /* tp_name */ + sizeof(BPy_GetProjectedXF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetProjectedXF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetProjectedXF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp index 92d5a1e4216..4bbb9c0a547 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp @@ -50,7 +50,7 @@ static char GetProjectedYF0D___doc__[] = static int GetProjectedYF0D___init__(BPy_GetProjectedYF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -63,43 +63,43 @@ static int GetProjectedYF0D___init__(BPy_GetProjectedYF0D *self, PyObject *args, /*-----------------------BPy_GetProjectedYF0D type definition ------------------------------*/ PyTypeObject GetProjectedYF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetProjectedYF0D", /* tp_name */ - sizeof(BPy_GetProjectedYF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetProjectedYF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetProjectedYF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetProjectedYF0D", /* tp_name */ + sizeof(BPy_GetProjectedYF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetProjectedYF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetProjectedYF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp index cb2a5e3a102..9b1182f3b94 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp @@ -50,7 +50,7 @@ static char GetProjectedZF0D___doc__[] = static int GetProjectedZF0D___init__(BPy_GetProjectedZF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -63,43 +63,43 @@ static int GetProjectedZF0D___init__(BPy_GetProjectedZF0D *self, PyObject *args, /*-----------------------BPy_GetProjectedZF0D type definition ------------------------------*/ PyTypeObject GetProjectedZF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetProjectedZF0D", /* tp_name */ - sizeof(BPy_GetProjectedZF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetProjectedZF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetProjectedZF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetProjectedZF0D", /* tp_name */ + sizeof(BPy_GetProjectedZF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetProjectedZF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetProjectedZF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp index dd75001f3bd..ec9bc953786 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp @@ -50,7 +50,7 @@ static char GetXF0D___doc__[] = static int GetXF0D___init__(BPy_GetXF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -63,43 +63,43 @@ static int GetXF0D___init__(BPy_GetXF0D *self, PyObject *args, PyObject *kwds) /*-----------------------BPy_GetXF0D type definition ------------------------------*/ PyTypeObject GetXF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetXF0D", /* tp_name */ - sizeof(BPy_GetXF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetXF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetXF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetXF0D", /* tp_name */ + sizeof(BPy_GetXF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetXF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetXF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp index 09e2a84e29f..3d194d5465a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp @@ -50,7 +50,7 @@ static char GetYF0D___doc__[] = static int GetYF0D___init__(BPy_GetYF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -63,43 +63,43 @@ static int GetYF0D___init__(BPy_GetYF0D *self, PyObject *args, PyObject *kwds) /*-----------------------BPy_GetYF0D type definition ------------------------------*/ PyTypeObject GetYF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetYF0D", /* tp_name */ - sizeof(BPy_GetYF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetYF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetYF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetYF0D", /* tp_name */ + sizeof(BPy_GetYF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetYF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetYF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp index 920432530ed..3b72e1beb39 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp @@ -50,7 +50,7 @@ static char GetZF0D___doc__[] = static int GetZF0D___init__(BPy_GetZF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -63,43 +63,43 @@ static int GetZF0D___init__(BPy_GetZF0D *self, PyObject *args, PyObject *kwds) /*-----------------------BPy_GetZF0D type definition ------------------------------*/ PyTypeObject GetZF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetZF0D", /* tp_name */ - sizeof(BPy_GetZF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetZF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetZF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetZF0D", /* tp_name */ + sizeof(BPy_GetZF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetZF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetZF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp index 58e5a1a498a..df2bf54354e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp @@ -57,7 +57,7 @@ static int LocalAverageDepthF0D___init__(BPy_LocalAverageDepthF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"mask_size", NULL}; + static const char *kwlist[] = {"mask_size", nullptr}; double d = 5.0; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|d", (char **)kwlist, &d)) { @@ -71,43 +71,43 @@ static int LocalAverageDepthF0D___init__(BPy_LocalAverageDepthF0D *self, /*-----------------------BPy_LocalAverageDepthF0D type definition ------------------------------*/ PyTypeObject LocalAverageDepthF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "LocalAverageDepthF0D", /* tp_name */ - sizeof(BPy_LocalAverageDepthF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - LocalAverageDepthF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)LocalAverageDepthF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "LocalAverageDepthF0D", /* tp_name */ + sizeof(BPy_LocalAverageDepthF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + LocalAverageDepthF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)LocalAverageDepthF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp index 0d1b55f0a00..f4c95cdc765 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp @@ -55,7 +55,7 @@ static char ZDiscontinuityF0D___doc__[] = static int ZDiscontinuityF0D___init__(BPy_ZDiscontinuityF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -68,43 +68,43 @@ static int ZDiscontinuityF0D___init__(BPy_ZDiscontinuityF0D *self, PyObject *arg /*-----------------------BPy_ZDiscontinuityF0D type definition ------------------------------*/ PyTypeObject ZDiscontinuityF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ZDiscontinuityF0D", /* tp_name */ - sizeof(BPy_ZDiscontinuityF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ZDiscontinuityF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ZDiscontinuityF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ZDiscontinuityF0D", /* tp_name */ + sizeof(BPy_ZDiscontinuityF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ZDiscontinuityF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ZDiscontinuityF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp index a00d4204d69..71353f8772e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp @@ -53,7 +53,7 @@ static int GetCurvilinearAbscissaF0D___init__(BPy_GetCurvilinearAbscissaF0D *sel PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -66,43 +66,43 @@ static int GetCurvilinearAbscissaF0D___init__(BPy_GetCurvilinearAbscissaF0D *sel /*-----------------------BPy_GetCurvilinearAbscissaF0D type definition --------------------------*/ PyTypeObject GetCurvilinearAbscissaF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetCurvilinearAbscissaF0D", /* tp_name */ - sizeof(BPy_GetCurvilinearAbscissaF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetCurvilinearAbscissaF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DFloat_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetCurvilinearAbscissaF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetCurvilinearAbscissaF0D", /* tp_name */ + sizeof(BPy_GetCurvilinearAbscissaF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetCurvilinearAbscissaF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DFloat_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetCurvilinearAbscissaF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp index b4310685969..d8bb89a3d1c 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp @@ -50,7 +50,7 @@ static char GetParameterF0D___doc__[] = static int GetParameterF0D___init__(BPy_GetParameterF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -61,45 +61,44 @@ static int GetParameterF0D___init__(BPy_GetParameterF0D *self, PyObject *args, P } /*-----------------------BPy_GetParameterF0D type definition ------------------------------*/ - PyTypeObject GetParameterF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetParameterF0D", /* tp_name */ - sizeof(BPy_GetParameterF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetParameterF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DFloat_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetParameterF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetParameterF0D", /* tp_name */ + sizeof(BPy_GetParameterF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetParameterF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DFloat_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetParameterF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp index ad744918e00..c08cdd544f8 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp @@ -57,7 +57,7 @@ static int GetViewMapGradientNormF0D___init__(BPy_GetViewMapGradientNormF0D *sel PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"level", NULL}; + static const char *kwlist[] = {"level", nullptr}; int i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i)) { @@ -71,43 +71,43 @@ static int GetViewMapGradientNormF0D___init__(BPy_GetViewMapGradientNormF0D *sel /*-----------------------BPy_GetViewMapGradientNormF0D type definition --------------------------*/ PyTypeObject GetViewMapGradientNormF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetViewMapGradientNormF0D", /* tp_name */ - sizeof(BPy_GetViewMapGradientNormF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetViewMapGradientNormF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DFloat_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetViewMapGradientNormF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetViewMapGradientNormF0D", /* tp_name */ + sizeof(BPy_GetViewMapGradientNormF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetViewMapGradientNormF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DFloat_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetViewMapGradientNormF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp index 685701152f4..fa4a7f997fd 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp @@ -55,7 +55,7 @@ static int ReadCompleteViewMapPixelF0D___init__(BPy_ReadCompleteViewMapPixelF0D PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"level", NULL}; + static const char *kwlist[] = {"level", nullptr}; int i; if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i)) { @@ -69,43 +69,43 @@ static int ReadCompleteViewMapPixelF0D___init__(BPy_ReadCompleteViewMapPixelF0D /*-----------------------BPy_ReadCompleteViewMapPixelF0D type definition ------------------------*/ PyTypeObject ReadCompleteViewMapPixelF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ReadCompleteViewMapPixelF0D", /* tp_name */ - sizeof(BPy_ReadCompleteViewMapPixelF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ReadCompleteViewMapPixelF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DFloat_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ReadCompleteViewMapPixelF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ReadCompleteViewMapPixelF0D", /* tp_name */ + sizeof(BPy_ReadCompleteViewMapPixelF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ReadCompleteViewMapPixelF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DFloat_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ReadCompleteViewMapPixelF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp index b74ee3b33c6..4a7617a2f4e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp @@ -55,7 +55,7 @@ static char ReadMapPixelF0D___doc__[] = static int ReadMapPixelF0D___init__(BPy_ReadMapPixelF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"map_name", "level", NULL}; + static const char *kwlist[] = {"map_name", "level", nullptr}; const char *s; int i; @@ -70,43 +70,43 @@ static int ReadMapPixelF0D___init__(BPy_ReadMapPixelF0D *self, PyObject *args, P /*-----------------------BPy_ReadMapPixelF0D type definition ------------------------------*/ PyTypeObject ReadMapPixelF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ReadMapPixelF0D", /* tp_name */ - sizeof(BPy_ReadMapPixelF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ReadMapPixelF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DFloat_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ReadMapPixelF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ReadMapPixelF0D", /* tp_name */ + sizeof(BPy_ReadMapPixelF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ReadMapPixelF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DFloat_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ReadMapPixelF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp index a878db99e06..980d5d20d69 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp @@ -58,7 +58,7 @@ static int ReadSteerableViewMapPixelF0D___init__(BPy_ReadSteerableViewMapPixelF0 PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"orientation", "level", NULL}; + static const char *kwlist[] = {"orientation", "level", nullptr}; unsigned int u; int i; @@ -73,43 +73,43 @@ static int ReadSteerableViewMapPixelF0D___init__(BPy_ReadSteerableViewMapPixelF0 /*-----------------------BPy_ReadSteerableViewMapPixelF0D type definition -----------------------*/ PyTypeObject ReadSteerableViewMapPixelF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ReadSteerableViewMapPixelF0D", /* tp_name */ - sizeof(BPy_ReadSteerableViewMapPixelF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ReadSteerableViewMapPixelF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DFloat_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ReadSteerableViewMapPixelF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ReadSteerableViewMapPixelF0D", /* tp_name */ + sizeof(BPy_ReadSteerableViewMapPixelF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ReadSteerableViewMapPixelF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DFloat_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ReadSteerableViewMapPixelF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp index 57605e42186..4741bdaa1ad 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp @@ -58,7 +58,7 @@ static int QuantitativeInvisibilityF0D___init__(BPy_QuantitativeInvisibilityF0D PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -71,43 +71,43 @@ static int QuantitativeInvisibilityF0D___init__(BPy_QuantitativeInvisibilityF0D /*-----------------------BPy_QuantitativeInvisibilityF0D type definition ------------------------*/ PyTypeObject QuantitativeInvisibilityF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "QuantitativeInvisibilityF0D", /* tp_name */ - sizeof(BPy_QuantitativeInvisibilityF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - QuantitativeInvisibilityF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DUnsigned_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)QuantitativeInvisibilityF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "QuantitativeInvisibilityF0D", /* tp_name */ + sizeof(BPy_QuantitativeInvisibilityF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + QuantitativeInvisibilityF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DUnsigned_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)QuantitativeInvisibilityF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp index e56460601e5..7f07b70fc1b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp @@ -51,7 +51,7 @@ static char GetOccludersF0D___doc__[] = static int GetOccludersF0D___init__(BPy_GetOccludersF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -64,43 +64,43 @@ static int GetOccludersF0D___init__(BPy_GetOccludersF0D *self, PyObject *args, P /*-----------------------BPy_GetOccludersF0D type definition ------------------------------*/ PyTypeObject GetOccludersF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetOccludersF0D", /* tp_name */ - sizeof(BPy_GetOccludersF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetOccludersF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DVectorViewShape_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetOccludersF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetOccludersF0D", /* tp_name */ + sizeof(BPy_GetOccludersF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetOccludersF0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction0DVectorViewShape_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetOccludersF0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp index b59e27dcea9..eb7e36ba42c 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp @@ -49,7 +49,7 @@ extern "C" { int UnaryFunction1DDouble_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -172,8 +172,8 @@ static int UnaryFunction1DDouble___init__(BPy_UnaryFunction1DDouble *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -207,23 +207,23 @@ static PyObject *UnaryFunction1DDouble___call__(BPy_UnaryFunction1DDouble *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"inter", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) { - return NULL; + return nullptr; } if (typeid(*(self->uf1D_double)) == typeid(UnaryFunction1D<double>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->uf1D_double->operator()(*(((BPy_Interface1D *)obj)->if1D)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return PyFloat_FromDouble(self->uf1D_double->result); } @@ -257,50 +257,50 @@ static PyGetSetDef BPy_UnaryFunction1DDouble_getseters[] = { (getter)integration_type_get, (setter)integration_type_set, integration_type_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DDouble type definition ------------------------------*/ PyTypeObject UnaryFunction1DDouble_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DDouble", /* tp_name */ - sizeof(BPy_UnaryFunction1DDouble), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction1DDouble___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction1DDouble___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction1DDouble___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction1DDouble___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction1DDouble_getseters, /* tp_getset */ - &UnaryFunction1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction1DDouble___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction1DDouble", /* tp_name */ + sizeof(BPy_UnaryFunction1DDouble), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DDouble___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction1DDouble___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryFunction1DDouble___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DDouble___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_UnaryFunction1DDouble_getseters, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DDouble___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp index 2f5a59f9c7a..7f9285f0a96 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp @@ -36,7 +36,7 @@ extern "C" { int UnaryFunction1DEdgeNature_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -77,8 +77,8 @@ static int UnaryFunction1DEdgeNature___init__(BPy_UnaryFunction1DEdgeNature *sel PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -114,23 +114,23 @@ static PyObject *UnaryFunction1DEdgeNature___call__(BPy_UnaryFunction1DEdgeNatur PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"inter", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) { - return NULL; + return nullptr; } if (typeid(*(self->uf1D_edgenature)) == typeid(UnaryFunction1D<Nature::EdgeNature>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->uf1D_edgenature->operator()(*(((BPy_Interface1D *)obj)->if1D)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return BPy_Nature_from_Nature(self->uf1D_edgenature->result); } @@ -164,50 +164,50 @@ static PyGetSetDef BPy_UnaryFunction1DEdgeNature_getseters[] = { (getter)integration_type_get, (setter)integration_type_set, integration_type_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DEdgeNature type definition --------------------------*/ PyTypeObject UnaryFunction1DEdgeNature_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DEdgeNature", /* tp_name */ - sizeof(BPy_UnaryFunction1DEdgeNature), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction1DEdgeNature___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction1DEdgeNature___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction1DEdgeNature___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction1DEdgeNature___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction1DEdgeNature_getseters, /* tp_getset */ - &UnaryFunction1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction1DEdgeNature___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction1DEdgeNature", /* tp_name */ + sizeof(BPy_UnaryFunction1DEdgeNature), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DEdgeNature___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction1DEdgeNature___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryFunction1DEdgeNature___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DEdgeNature___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_UnaryFunction1DEdgeNature_getseters, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DEdgeNature___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp index e11d21b6c8e..e547aec8922 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp @@ -34,7 +34,7 @@ extern "C" { int UnaryFunction1DFloat_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -68,8 +68,8 @@ static int UnaryFunction1DFloat___init__(BPy_UnaryFunction1DFloat *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -103,23 +103,23 @@ static PyObject *UnaryFunction1DFloat___call__(BPy_UnaryFunction1DFloat *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"inter", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) { - return NULL; + return nullptr; } if (typeid(*(self->uf1D_float)) == typeid(UnaryFunction1D<float>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->uf1D_float->operator()(*(((BPy_Interface1D *)obj)->if1D)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return PyFloat_FromDouble(self->uf1D_float->result); } @@ -153,50 +153,50 @@ static PyGetSetDef BPy_UnaryFunction1DFloat_getseters[] = { (getter)integration_type_get, (setter)integration_type_set, integration_type_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DFloat type definition ------------------------------*/ PyTypeObject UnaryFunction1DFloat_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DFloat", /* tp_name */ - sizeof(BPy_UnaryFunction1DFloat), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction1DFloat___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction1DFloat___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction1DFloat___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction1DFloat___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction1DFloat_getseters, /* tp_getset */ - &UnaryFunction1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction1DFloat___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction1DFloat", /* tp_name */ + sizeof(BPy_UnaryFunction1DFloat), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DFloat___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction1DFloat___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryFunction1DFloat___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DFloat___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_UnaryFunction1DFloat_getseters, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DFloat___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp index e04a5b9d7f4..911659bbd5c 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp @@ -36,7 +36,7 @@ extern "C" { int UnaryFunction1DUnsigned_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -77,8 +77,8 @@ static int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -114,23 +114,23 @@ static PyObject *UnaryFunction1DUnsigned___call__(BPy_UnaryFunction1DUnsigned *s PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"inter", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) { - return NULL; + return nullptr; } if (typeid(*(self->uf1D_unsigned)) == typeid(UnaryFunction1D<unsigned int>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->uf1D_unsigned->operator()(*(((BPy_Interface1D *)obj)->if1D)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return PyLong_FromLong(self->uf1D_unsigned->result); } @@ -164,50 +164,50 @@ static PyGetSetDef BPy_UnaryFunction1DUnsigned_getseters[] = { (getter)integration_type_get, (setter)integration_type_set, integration_type_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DUnsigned type definition ----------------------------*/ PyTypeObject UnaryFunction1DUnsigned_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DUnsigned", /* tp_name */ - sizeof(BPy_UnaryFunction1DUnsigned), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction1DUnsigned___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction1DUnsigned___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction1DUnsigned___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction1DUnsigned___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction1DUnsigned_getseters, /* tp_getset */ - &UnaryFunction1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction1DUnsigned___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction1DUnsigned", /* tp_name */ + sizeof(BPy_UnaryFunction1DUnsigned), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DUnsigned___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction1DUnsigned___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryFunction1DUnsigned___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DUnsigned___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_UnaryFunction1DUnsigned_getseters, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DUnsigned___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp index f8d75640811..11139df39d1 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp @@ -37,7 +37,7 @@ extern "C" { int UnaryFunction1DVec2f_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -83,8 +83,8 @@ static int UnaryFunction1DVec2f___init__(BPy_UnaryFunction1DVec2f *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -118,23 +118,23 @@ static PyObject *UnaryFunction1DVec2f___call__(BPy_UnaryFunction1DVec2f *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"inter", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) { - return NULL; + return nullptr; } if (typeid(*(self->uf1D_vec2f)) == typeid(UnaryFunction1D<Vec2f>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->uf1D_vec2f->operator()(*(((BPy_Interface1D *)obj)->if1D)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return Vector_from_Vec2f(self->uf1D_vec2f->result); } @@ -168,50 +168,50 @@ static PyGetSetDef BPy_UnaryFunction1DVec2f_getseters[] = { (getter)integration_type_get, (setter)integration_type_set, integration_type_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DVec2f type definition ------------------------------*/ PyTypeObject UnaryFunction1DVec2f_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DVec2f", /* tp_name */ - sizeof(BPy_UnaryFunction1DVec2f), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction1DVec2f___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction1DVec2f___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction1DVec2f___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction1DVec2f___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction1DVec2f_getseters, /* tp_getset */ - &UnaryFunction1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction1DVec2f___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction1DVec2f", /* tp_name */ + sizeof(BPy_UnaryFunction1DVec2f), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DVec2f___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction1DVec2f___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryFunction1DVec2f___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DVec2f___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_UnaryFunction1DVec2f_getseters, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DVec2f___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp index 9f71fb3840b..7ae93b8301f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp @@ -36,7 +36,7 @@ extern "C" { int UnaryFunction1DVec3f_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -76,8 +76,8 @@ static int UnaryFunction1DVec3f___init__(BPy_UnaryFunction1DVec3f *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -111,23 +111,23 @@ static PyObject *UnaryFunction1DVec3f___call__(BPy_UnaryFunction1DVec3f *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"inter", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) { - return NULL; + return nullptr; } if (typeid(*(self->uf1D_vec3f)) == typeid(UnaryFunction1D<Vec3f>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->uf1D_vec3f->operator()(*(((BPy_Interface1D *)obj)->if1D)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } return Vector_from_Vec3f(self->uf1D_vec3f->result); } @@ -161,50 +161,50 @@ static PyGetSetDef BPy_UnaryFunction1DVec3f_getseters[] = { (getter)integration_type_get, (setter)integration_type_set, integration_type_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DVec3f type definition ------------------------------*/ PyTypeObject UnaryFunction1DVec3f_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DVec3f", /* tp_name */ - sizeof(BPy_UnaryFunction1DVec3f), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction1DVec3f___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction1DVec3f___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction1DVec3f___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction1DVec3f___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction1DVec3f_getseters, /* tp_getset */ - &UnaryFunction1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction1DVec3f___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction1DVec3f", /* tp_name */ + sizeof(BPy_UnaryFunction1DVec3f), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DVec3f___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction1DVec3f___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryFunction1DVec3f___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DVec3f___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_UnaryFunction1DVec3f_getseters, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DVec3f___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp index cb4982f4532..4d7fe673066 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp @@ -38,7 +38,7 @@ extern "C" { int UnaryFunction1DVectorViewShape_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -92,8 +92,8 @@ static int UnaryFunction1DVectorViewShape___init__(BPy_UnaryFunction1DVectorView PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -129,23 +129,23 @@ static PyObject *UnaryFunction1DVectorViewShape___call__(BPy_UnaryFunction1DVect PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"inter", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) { - return NULL; + return nullptr; } if (typeid(*(self->uf1D_vectorviewshape)) == typeid(UnaryFunction1D<std::vector<ViewShape *>>)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->uf1D_vectorviewshape->operator()(*(((BPy_Interface1D *)obj)->if1D)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } const unsigned int list_len = self->uf1D_vectorviewshape->result.size(); @@ -189,50 +189,50 @@ static PyGetSetDef BPy_UnaryFunction1DVectorViewShape_getseters[] = { (getter)integration_type_get, (setter)integration_type_set, integration_type_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DVectorViewShape type definition ---------------------*/ PyTypeObject UnaryFunction1DVectorViewShape_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DVectorViewShape", /* tp_name */ - sizeof(BPy_UnaryFunction1DVectorViewShape), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction1DVectorViewShape___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction1DVectorViewShape___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction1DVectorViewShape___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction1DVectorViewShape___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction1DVectorViewShape_getseters, /* tp_getset */ - &UnaryFunction1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction1DVectorViewShape___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction1DVectorViewShape", /* tp_name */ + sizeof(BPy_UnaryFunction1DVectorViewShape), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DVectorViewShape___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction1DVectorViewShape___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryFunction1DVectorViewShape___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DVectorViewShape___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_UnaryFunction1DVectorViewShape_getseters, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DVectorViewShape___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp index 46564cdaeca..6c16226881a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp @@ -38,7 +38,7 @@ extern "C" { int UnaryFunction1DVoid_Init(PyObject *module) { - if (module == NULL) { + if (module == nullptr) { return -1; } @@ -91,8 +91,8 @@ static int UnaryFunction1DVoid___init__(BPy_UnaryFunction1DVoid *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -126,23 +126,23 @@ static PyObject *UnaryFunction1DVoid___call__(BPy_UnaryFunction1DVoid *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"inter", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) { - return NULL; + return nullptr; } if (typeid(*(self->uf1D_void)) == typeid(UnaryFunction1D_void)) { PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; + return nullptr; } if (self->uf1D_void->operator()(*(((BPy_Interface1D *)obj)->if1D)) < 0) { if (!PyErr_Occurred()) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); } - return NULL; + return nullptr; } Py_RETURN_NONE; } @@ -176,50 +176,50 @@ static PyGetSetDef BPy_UnaryFunction1DVoid_getseters[] = { (getter)integration_type_get, (setter)integration_type_set, integration_type_doc, - NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DVoid type definition ------------------------------*/ PyTypeObject UnaryFunction1DVoid_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DVoid", /* tp_name */ - sizeof(BPy_UnaryFunction1DVoid), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction1DVoid___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction1DVoid___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction1DVoid___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction1DVoid___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction1DVoid_getseters, /* tp_getset */ - &UnaryFunction1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction1DVoid___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "UnaryFunction1DVoid", /* tp_name */ + sizeof(BPy_UnaryFunction1DVoid), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DVoid___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + (reprfunc)UnaryFunction1DVoid___repr__, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + (ternaryfunc)UnaryFunction1DVoid___call__, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DVoid___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + BPy_UnaryFunction1DVoid_getseters, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DVoid___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp index 2504a09016c..483dbc09ff7 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp @@ -61,8 +61,8 @@ static char CurveNatureF1D___doc__[] = static int CurveNatureF1D___init__(BPy_CurveNatureF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -76,43 +76,43 @@ static int CurveNatureF1D___init__(BPy_CurveNatureF1D *self, PyObject *args, PyO /*-----------------------BPy_CurveNatureF1D type definition ------------------------------*/ PyTypeObject CurveNatureF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "CurveNatureF1D", /* tp_name */ - sizeof(BPy_CurveNatureF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - CurveNatureF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DEdgeNature_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)CurveNatureF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "CurveNatureF1D", /* tp_name */ + sizeof(BPy_CurveNatureF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + CurveNatureF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DEdgeNature_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)CurveNatureF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp index f1cdd6a0cb8..1f4a7c9b143 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp @@ -55,8 +55,8 @@ static char Normal2DF1D___doc__[] = static int Normal2DF1D___init__(BPy_Normal2DF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -70,43 +70,43 @@ static int Normal2DF1D___init__(BPy_Normal2DF1D *self, PyObject *args, PyObject /*-----------------------BPy_Normal2DF1D type definition ------------------------------*/ PyTypeObject Normal2DF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Normal2DF1D", /* tp_name */ - sizeof(BPy_Normal2DF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Normal2DF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DVec2f_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Normal2DF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "Normal2DF1D", /* tp_name */ + sizeof(BPy_Normal2DF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Normal2DF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DVec2f_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Normal2DF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp index 27d6c509348..43f2aee965b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp @@ -55,8 +55,8 @@ static char Orientation2DF1D___doc__[] = static int Orientation2DF1D___init__(BPy_Orientation2DF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -70,43 +70,43 @@ static int Orientation2DF1D___init__(BPy_Orientation2DF1D *self, PyObject *args, /*-----------------------BPy_Orientation2DF1D type definition ------------------------------*/ PyTypeObject Orientation2DF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Orientation2DF1D", /* tp_name */ - sizeof(BPy_Orientation2DF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Orientation2DF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DVec2f_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Orientation2DF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "Orientation2DF1D", /* tp_name */ + sizeof(BPy_Orientation2DF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Orientation2DF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DVec2f_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Orientation2DF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp index 1a2d9c5e745..439b1eeb230 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp @@ -55,8 +55,8 @@ static char Orientation3DF1D___doc__[] = static int Orientation3DF1D___init__(BPy_Orientation3DF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -70,43 +70,43 @@ static int Orientation3DF1D___init__(BPy_Orientation3DF1D *self, PyObject *args, /*-----------------------BPy_Orientation3DF1D type definition ------------------------------*/ PyTypeObject Orientation3DF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Orientation3DF1D", /* tp_name */ - sizeof(BPy_Orientation3DF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Orientation3DF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DVec3f_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Orientation3DF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "Orientation3DF1D", /* tp_name */ + sizeof(BPy_Orientation3DF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Orientation3DF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DVec3f_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Orientation3DF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp index 4d0e1a66f56..8c5cdb83fa5 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp @@ -57,8 +57,8 @@ static int Curvature2DAngleF1D___init__(BPy_Curvature2DAngleF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -71,43 +71,43 @@ static int Curvature2DAngleF1D___init__(BPy_Curvature2DAngleF1D *self, /*-----------------------BPy_Curvature2DAngleF1D type definition ------------------------------*/ PyTypeObject Curvature2DAngleF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "Curvature2DAngleF1D", /* tp_name */ - sizeof(BPy_Curvature2DAngleF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Curvature2DAngleF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Curvature2DAngleF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "Curvature2DAngleF1D", /* tp_name */ + sizeof(BPy_Curvature2DAngleF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Curvature2DAngleF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Curvature2DAngleF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp index b96406de066..5b428c7f70d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp @@ -67,8 +67,8 @@ static char DensityF1D___doc__[] = static int DensityF1D___init__(BPy_DensityF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"sigma", "integration_type", "sampling", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"sigma", "integration_type", "sampling", nullptr}; + PyObject *obj = nullptr; double d = 2.0; float f = 2.0; @@ -84,43 +84,43 @@ static int DensityF1D___init__(BPy_DensityF1D *self, PyObject *args, PyObject *k /*-----------------------BPy_DensityF1D type definition ------------------------------*/ PyTypeObject DensityF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "DensityF1D", /* tp_name */ - sizeof(BPy_DensityF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - DensityF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)DensityF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "DensityF1D", /* tp_name */ + sizeof(BPy_DensityF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + DensityF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)DensityF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp index 9f16f53e833..b9fb654b582 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp @@ -71,8 +71,8 @@ static int GetCompleteViewMapDensityF1D___init__(BPy_GetCompleteViewMapDensityF1 PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"level", "integration_type", "sampling", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"level", "integration_type", "sampling", nullptr}; + PyObject *obj = nullptr; int i; float f = 2.0; @@ -88,43 +88,43 @@ static int GetCompleteViewMapDensityF1D___init__(BPy_GetCompleteViewMapDensityF1 /*-----------------------BPy_GetCompleteViewMapDensityF1D type definition -----------------------*/ PyTypeObject GetCompleteViewMapDensityF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetCompleteViewMapDensityF1D", /* tp_name */ - sizeof(BPy_GetCompleteViewMapDensityF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetCompleteViewMapDensityF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetCompleteViewMapDensityF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetCompleteViewMapDensityF1D", /* tp_name */ + sizeof(BPy_GetCompleteViewMapDensityF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetCompleteViewMapDensityF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetCompleteViewMapDensityF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp index 8cea26338df..287015da8b8 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp @@ -77,8 +77,8 @@ static int GetDirectionalViewMapDensityF1D___init__(BPy_GetDirectionalViewMapDen PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"orientation", "level", "integration_type", "sampling", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"orientation", "level", "integration_type", "sampling", nullptr}; + PyObject *obj = nullptr; unsigned int u1, u2; float f = 2.0; @@ -95,43 +95,43 @@ static int GetDirectionalViewMapDensityF1D___init__(BPy_GetDirectionalViewMapDen /*-----------------------BPy_GetDirectionalViewMapDensityF1D type definition --------------------*/ PyTypeObject GetDirectionalViewMapDensityF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetDirectionalViewMapDensityF1D", /* tp_name */ - sizeof(BPy_GetDirectionalViewMapDensityF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetDirectionalViewMapDensityF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetDirectionalViewMapDensityF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetDirectionalViewMapDensityF1D", /* tp_name */ + sizeof(BPy_GetDirectionalViewMapDensityF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetDirectionalViewMapDensityF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetDirectionalViewMapDensityF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp index 5f47fb03f8b..8183c73ddde 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp @@ -55,8 +55,8 @@ static char GetProjectedXF1D___doc__[] = static int GetProjectedXF1D___init__(BPy_GetProjectedXF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -70,43 +70,43 @@ static int GetProjectedXF1D___init__(BPy_GetProjectedXF1D *self, PyObject *args, /*-----------------------BPy_GetProjectedXF1D type definition ------------------------------*/ PyTypeObject GetProjectedXF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetProjectedXF1D", /* tp_name */ - sizeof(BPy_GetProjectedXF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetProjectedXF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetProjectedXF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetProjectedXF1D", /* tp_name */ + sizeof(BPy_GetProjectedXF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetProjectedXF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetProjectedXF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp index b6e1c2d336e..41b72616140 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp @@ -55,8 +55,8 @@ static char GetProjectedYF1D___doc__[] = static int GetProjectedYF1D___init__(BPy_GetProjectedYF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -70,43 +70,43 @@ static int GetProjectedYF1D___init__(BPy_GetProjectedYF1D *self, PyObject *args, /*-----------------------BPy_GetProjectedYF1D type definition ------------------------------*/ PyTypeObject GetProjectedYF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetProjectedYF1D", /* tp_name */ - sizeof(BPy_GetProjectedYF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetProjectedYF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetProjectedYF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetProjectedYF1D", /* tp_name */ + sizeof(BPy_GetProjectedYF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetProjectedYF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetProjectedYF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp index dfe7cd82710..cc1a4f82a18 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp @@ -55,8 +55,8 @@ static char GetProjectedZF1D___doc__[] = static int GetProjectedZF1D___init__(BPy_GetProjectedZF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -70,43 +70,43 @@ static int GetProjectedZF1D___init__(BPy_GetProjectedZF1D *self, PyObject *args, /*-----------------------BPy_GetProjectedZF1D type definition ------------------------------*/ PyTypeObject GetProjectedZF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetProjectedZF1D", /* tp_name */ - sizeof(BPy_GetProjectedZF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetProjectedZF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetProjectedZF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetProjectedZF1D", /* tp_name */ + sizeof(BPy_GetProjectedZF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetProjectedZF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetProjectedZF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp index a1ed9d15d5e..ee258bc5a88 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp @@ -68,8 +68,8 @@ static int GetSteerableViewMapDensityF1D___init__(BPy_GetSteerableViewMapDensity PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"level", "integration_type", "sampling", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"level", "integration_type", "sampling", nullptr}; + PyObject *obj = nullptr; int i; float f = 2.0; @@ -85,43 +85,43 @@ static int GetSteerableViewMapDensityF1D___init__(BPy_GetSteerableViewMapDensity /*-----------------------BPy_GetSteerableViewMapDensityF1D type definition ----------------------*/ PyTypeObject GetSteerableViewMapDensityF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetSteerableViewMapDensityF1D", /* tp_name */ - sizeof(BPy_GetSteerableViewMapDensityF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetSteerableViewMapDensityF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetSteerableViewMapDensityF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetSteerableViewMapDensityF1D", /* tp_name */ + sizeof(BPy_GetSteerableViewMapDensityF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetSteerableViewMapDensityF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetSteerableViewMapDensityF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp index 268d140749d..2c2b07ef45b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp @@ -68,8 +68,8 @@ static int GetViewMapGradientNormF1D___init__(BPy_GetViewMapGradientNormF1D *sel PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"level", "integration_type", "sampling", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"level", "integration_type", "sampling", nullptr}; + PyObject *obj = nullptr; int i; float f = 2.0; @@ -85,43 +85,43 @@ static int GetViewMapGradientNormF1D___init__(BPy_GetViewMapGradientNormF1D *sel /*-----------------------BPy_GetViewMapGradientNormF1D type definition --------------------------*/ PyTypeObject GetViewMapGradientNormF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetViewMapGradientNormF1D", /* tp_name */ - sizeof(BPy_GetViewMapGradientNormF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetViewMapGradientNormF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetViewMapGradientNormF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetViewMapGradientNormF1D", /* tp_name */ + sizeof(BPy_GetViewMapGradientNormF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetViewMapGradientNormF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetViewMapGradientNormF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp index 5a0b7d6aa55..3e7ead21171 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp @@ -55,8 +55,8 @@ static char GetXF1D___doc__[] = static int GetXF1D___init__(BPy_GetXF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -70,43 +70,43 @@ static int GetXF1D___init__(BPy_GetXF1D *self, PyObject *args, PyObject *kwds) /*-----------------------BPy_GetXF1D type definition ------------------------------*/ PyTypeObject GetXF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetXF1D", /* tp_name */ - sizeof(BPy_GetXF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetXF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetXF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetXF1D", /* tp_name */ + sizeof(BPy_GetXF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetXF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetXF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp index 9b523126841..26192555156 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp @@ -55,8 +55,8 @@ static char GetYF1D___doc__[] = static int GetYF1D___init__(BPy_GetYF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -69,43 +69,43 @@ static int GetYF1D___init__(BPy_GetYF1D *self, PyObject *args, PyObject *kwds) /*-----------------------BPy_GetYF1D type definition ------------------------------*/ PyTypeObject GetYF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetYF1D", /* tp_name */ - sizeof(BPy_GetYF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetYF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetYF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetYF1D", /* tp_name */ + sizeof(BPy_GetYF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetYF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetYF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp index 73407affd8d..8426a067dff 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp @@ -55,8 +55,8 @@ static char GetZF1D___doc__[] = static int GetZF1D___init__(BPy_GetZF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -70,43 +70,43 @@ static int GetZF1D___init__(BPy_GetZF1D *self, PyObject *args, PyObject *kwds) /*-----------------------BPy_GetZF1D type definition ------------------------------*/ PyTypeObject GetZF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetZF1D", /* tp_name */ - sizeof(BPy_GetZF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetZF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetZF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetZF1D", /* tp_name */ + sizeof(BPy_GetZF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetZF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetZF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp index aef67aab928..6e31d2828f5 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp @@ -64,8 +64,8 @@ static int LocalAverageDepthF1D___init__(BPy_LocalAverageDepthF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"sigma", "integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"sigma", "integration_type", nullptr}; + PyObject *obj = nullptr; double d; if (!PyArg_ParseTupleAndKeywords( @@ -80,43 +80,43 @@ static int LocalAverageDepthF1D___init__(BPy_LocalAverageDepthF1D *self, /*-----------------------BPy_LocalAverageDepthF1D type definition ------------------------------*/ PyTypeObject LocalAverageDepthF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "LocalAverageDepthF1D", /* tp_name */ - sizeof(BPy_LocalAverageDepthF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - LocalAverageDepthF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)LocalAverageDepthF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "LocalAverageDepthF1D", /* tp_name */ + sizeof(BPy_LocalAverageDepthF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + LocalAverageDepthF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)LocalAverageDepthF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp index cf2162c30ad..f30641f1134 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp @@ -59,8 +59,8 @@ static char ZDiscontinuityF1D___doc__[] = static int ZDiscontinuityF1D___init__(BPy_ZDiscontinuityF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -74,43 +74,43 @@ static int ZDiscontinuityF1D___init__(BPy_ZDiscontinuityF1D *self, PyObject *arg /*-----------------------BPy_ZDiscontinuityF1D type definition ------------------------------*/ PyTypeObject ZDiscontinuityF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ZDiscontinuityF1D", /* tp_name */ - sizeof(BPy_ZDiscontinuityF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ZDiscontinuityF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ZDiscontinuityF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ZDiscontinuityF1D", /* tp_name */ + sizeof(BPy_ZDiscontinuityF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ZDiscontinuityF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ZDiscontinuityF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp index f843ff52d06..ae079b7a955 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp @@ -61,8 +61,8 @@ static int QuantitativeInvisibilityF1D___init__(BPy_QuantitativeInvisibilityF1D PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", nullptr}; + PyObject *obj = nullptr; if (!PyArg_ParseTupleAndKeywords( args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) { @@ -76,43 +76,43 @@ static int QuantitativeInvisibilityF1D___init__(BPy_QuantitativeInvisibilityF1D /*-----------------------BPy_QuantitativeInvisibilityF1D type definition ------------------------*/ PyTypeObject QuantitativeInvisibilityF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "QuantitativeInvisibilityF1D", /* tp_name */ - sizeof(BPy_QuantitativeInvisibilityF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - QuantitativeInvisibilityF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DUnsigned_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)QuantitativeInvisibilityF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "QuantitativeInvisibilityF1D", /* tp_name */ + sizeof(BPy_QuantitativeInvisibilityF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + QuantitativeInvisibilityF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DUnsigned_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)QuantitativeInvisibilityF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp index f56d89c469a..af7b658db5a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp @@ -51,7 +51,7 @@ static char GetOccludeeF1D___doc__[] = static int GetOccludeeF1D___init__(BPy_GetOccludeeF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -63,43 +63,43 @@ static int GetOccludeeF1D___init__(BPy_GetOccludeeF1D *self, PyObject *args, PyO /*-----------------------BPy_GetOccludeeF1D type definition ------------------------------*/ PyTypeObject GetOccludeeF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetOccludeeF1D", /* tp_name */ - sizeof(BPy_GetOccludeeF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetOccludeeF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DVectorViewShape_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetOccludeeF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetOccludeeF1D", /* tp_name */ + sizeof(BPy_GetOccludeeF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetOccludeeF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DVectorViewShape_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetOccludeeF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp index 3ff4d36bc19..2f38dda2533 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp @@ -51,7 +51,7 @@ static char GetOccludersF1D___doc__[] = static int GetOccludersF1D___init__(BPy_GetOccludersF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -63,43 +63,43 @@ static int GetOccludersF1D___init__(BPy_GetOccludersF1D *self, PyObject *args, P /*-----------------------BPy_GetOccludersF1D type definition ------------------------------*/ PyTypeObject GetOccludersF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetOccludersF1D", /* tp_name */ - sizeof(BPy_GetOccludersF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetOccludersF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DVectorViewShape_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetOccludersF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetOccludersF1D", /* tp_name */ + sizeof(BPy_GetOccludersF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetOccludersF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DVectorViewShape_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetOccludersF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp index 08122b76385..8d53edbb6cc 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp @@ -51,7 +51,7 @@ static char GetShapeF1D___doc__[] = static int GetShapeF1D___init__(BPy_GetShapeF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -63,43 +63,43 @@ static int GetShapeF1D___init__(BPy_GetShapeF1D *self, PyObject *args, PyObject /*-----------------------BPy_GetShapeF1D type definition ------------------------------*/ PyTypeObject GetShapeF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "GetShapeF1D", /* tp_name */ - sizeof(BPy_GetShapeF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetShapeF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DVectorViewShape_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetShapeF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "GetShapeF1D", /* tp_name */ + sizeof(BPy_GetShapeF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetShapeF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DVectorViewShape_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetShapeF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp index 4be8f239fd6..43f20a66841 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp @@ -51,7 +51,7 @@ static int ChainingTimeStampF1D___init__(BPy_ChainingTimeStampF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -63,43 +63,43 @@ static int ChainingTimeStampF1D___init__(BPy_ChainingTimeStampF1D *self, /*-----------------------BPy_ChainingTimeStampF1D type definition ------------------------------*/ PyTypeObject ChainingTimeStampF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ChainingTimeStampF1D", /* tp_name */ - sizeof(BPy_ChainingTimeStampF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ChainingTimeStampF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DVoid_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ChainingTimeStampF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ChainingTimeStampF1D", /* tp_name */ + sizeof(BPy_ChainingTimeStampF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ChainingTimeStampF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DVoid_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ChainingTimeStampF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp index bca4ebb4236..e607166d7f7 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp @@ -51,7 +51,7 @@ static int IncrementChainingTimeStampF1D___init__(BPy_IncrementChainingTimeStamp PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -63,43 +63,43 @@ static int IncrementChainingTimeStampF1D___init__(BPy_IncrementChainingTimeStamp /*-----------------------BPy_IncrementChainingTimeStampF1D type definition ----------------------*/ PyTypeObject IncrementChainingTimeStampF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "IncrementChainingTimeStampF1D", /* tp_name */ - sizeof(BPy_IncrementChainingTimeStampF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - IncrementChainingTimeStampF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DVoid_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)IncrementChainingTimeStampF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "IncrementChainingTimeStampF1D", /* tp_name */ + sizeof(BPy_IncrementChainingTimeStampF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + IncrementChainingTimeStampF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DVoid_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)IncrementChainingTimeStampF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp index e2d0c7d1308..6ec5de9f6b1 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp @@ -49,7 +49,7 @@ static char TimeStampF1D___doc__[] = static int TimeStampF1D___init__(BPy_TimeStampF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -61,43 +61,43 @@ static int TimeStampF1D___init__(BPy_TimeStampF1D *self, PyObject *args, PyObjec /*-----------------------BPy_TimeStampF1D type definition ------------------------------*/ PyTypeObject TimeStampF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "TimeStampF1D", /* tp_name */ - sizeof(BPy_TimeStampF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - TimeStampF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DVoid_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)TimeStampF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "TimeStampF1D", /* tp_name */ + sizeof(BPy_TimeStampF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + TimeStampF1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryFunction1DVoid_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)TimeStampF1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp index 1e8aab3b086..eef09cdf0c7 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp @@ -42,7 +42,7 @@ static char FalseUP0D___doc__[] = static int FalseUP0D___init__(BPy_FalseUP0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -54,43 +54,43 @@ static int FalseUP0D___init__(BPy_FalseUP0D *self, PyObject *args, PyObject *kwd /*-----------------------BPy_FalseUP0D type definition ------------------------------*/ PyTypeObject FalseUP0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "FalseUP0D", /* tp_name */ - sizeof(BPy_FalseUP0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FalseUP0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FalseUP0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "FalseUP0D", /* tp_name */ + sizeof(BPy_FalseUP0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FalseUP0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryPredicate0D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FalseUP0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp index ca6c7a5b344..c1db96b4ecf 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp @@ -42,7 +42,7 @@ static char TrueUP0D___doc__[] = static int TrueUP0D___init__(BPy_TrueUP0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -54,43 +54,43 @@ static int TrueUP0D___init__(BPy_TrueUP0D *self, PyObject *args, PyObject *kwds) /*-----------------------BPy_TrueUP0D type definition ------------------------------*/ PyTypeObject TrueUP0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "TrueUP0D", /* tp_name */ - sizeof(BPy_TrueUP0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - TrueUP0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)TrueUP0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "TrueUP0D", /* tp_name */ + sizeof(BPy_TrueUP0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + TrueUP0D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryPredicate0D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)TrueUP0D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp index 734aa5a0e84..6552a165a1c 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp @@ -43,7 +43,7 @@ static char ContourUP1D___doc__[] = static int ContourUP1D___init__(BPy_ContourUP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -55,43 +55,43 @@ static int ContourUP1D___init__(BPy_ContourUP1D *self, PyObject *args, PyObject /*-----------------------BPy_ContourUP1D type definition ------------------------------*/ PyTypeObject ContourUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ContourUP1D", /* tp_name */ - sizeof(BPy_ContourUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ContourUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ContourUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ContourUP1D", /* tp_name */ + sizeof(BPy_ContourUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ContourUP1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ContourUP1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp index 2044d663e77..b76c3c670ed 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp @@ -58,7 +58,7 @@ static int DensityLowerThanUP1D___init__(BPy_DensityLowerThanUP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"threshold", "sigma", NULL}; + static const char *kwlist[] = {"threshold", "sigma", nullptr}; double d1, d2 = 2.0; if (!PyArg_ParseTupleAndKeywords(args, kwds, "d|d", (char **)kwlist, &d1, &d2)) { @@ -71,43 +71,43 @@ static int DensityLowerThanUP1D___init__(BPy_DensityLowerThanUP1D *self, /*-----------------------BPy_DensityLowerThanUP1D type definition ------------------------------*/ PyTypeObject DensityLowerThanUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "DensityLowerThanUP1D", /* tp_name */ - sizeof(BPy_DensityLowerThanUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - DensityLowerThanUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)DensityLowerThanUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "DensityLowerThanUP1D", /* tp_name */ + sizeof(BPy_DensityLowerThanUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + DensityLowerThanUP1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)DensityLowerThanUP1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp index c5feec45844..0200c52b70c 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp @@ -53,7 +53,7 @@ static int EqualToChainingTimeStampUP1D___init__(BPy_EqualToChainingTimeStampUP1 PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"ts", NULL}; + static const char *kwlist[] = {"ts", nullptr}; unsigned u; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u)) { @@ -66,43 +66,43 @@ static int EqualToChainingTimeStampUP1D___init__(BPy_EqualToChainingTimeStampUP1 /*-----------------------BPy_EqualToChainingTimeStampUP1D type definition -----------------------*/ PyTypeObject EqualToChainingTimeStampUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "EqualToChainingTimeStampUP1D", /* tp_name */ - sizeof(BPy_EqualToChainingTimeStampUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - EqualToChainingTimeStampUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)EqualToChainingTimeStampUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "EqualToChainingTimeStampUP1D", /* tp_name */ + sizeof(BPy_EqualToChainingTimeStampUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + EqualToChainingTimeStampUP1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)EqualToChainingTimeStampUP1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp index fd68878dc45..b7d0f0d8221 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp @@ -52,7 +52,7 @@ static int EqualToTimeStampUP1D___init__(BPy_EqualToTimeStampUP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"ts", NULL}; + static const char *kwlist[] = {"ts", nullptr}; unsigned u; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u)) { @@ -65,43 +65,43 @@ static int EqualToTimeStampUP1D___init__(BPy_EqualToTimeStampUP1D *self, /*-----------------------BPy_EqualToTimeStampUP1D type definition ------------------------------*/ PyTypeObject EqualToTimeStampUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "EqualToTimeStampUP1D", /* tp_name */ - sizeof(BPy_EqualToTimeStampUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - EqualToTimeStampUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)EqualToTimeStampUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "EqualToTimeStampUP1D", /* tp_name */ + sizeof(BPy_EqualToTimeStampUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + EqualToTimeStampUP1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)EqualToTimeStampUP1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp index 3ddadcf2d4f..d5d79fefe7c 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp @@ -47,7 +47,7 @@ static int ExternalContourUP1D___init__(BPy_ExternalContourUP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -59,43 +59,43 @@ static int ExternalContourUP1D___init__(BPy_ExternalContourUP1D *self, /*-----------------------BPy_ExternalContourUP1D type definition ------------------------------*/ PyTypeObject ExternalContourUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ExternalContourUP1D", /* tp_name */ - sizeof(BPy_ExternalContourUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ExternalContourUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ExternalContourUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ExternalContourUP1D", /* tp_name */ + sizeof(BPy_ExternalContourUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ExternalContourUP1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ExternalContourUP1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp index a93ce638f33..11dafb7bd0f 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp @@ -42,7 +42,7 @@ static char FalseUP1D___doc__[] = static int FalseUP1D___init__(BPy_FalseUP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -54,43 +54,43 @@ static int FalseUP1D___init__(BPy_FalseUP1D *self, PyObject *args, PyObject *kwd /*-----------------------BPy_FalseUP1D type definition ------------------------------*/ PyTypeObject FalseUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "FalseUP1D", /* tp_name */ - sizeof(BPy_FalseUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FalseUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FalseUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "FalseUP1D", /* tp_name */ + sizeof(BPy_FalseUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FalseUP1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FalseUP1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp index 153fbf56ba8..335df44ff5f 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp @@ -57,7 +57,7 @@ static int QuantitativeInvisibilityUP1D___init__(BPy_QuantitativeInvisibilityUP1 PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"qi", NULL}; + static const char *kwlist[] = {"qi", nullptr}; int i = 0; if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i", (char **)kwlist, &i)) { @@ -70,43 +70,43 @@ static int QuantitativeInvisibilityUP1D___init__(BPy_QuantitativeInvisibilityUP1 /*-----------------------BPy_QuantitativeInvisibilityUP1D type definition -----------------------*/ PyTypeObject QuantitativeInvisibilityUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "QuantitativeInvisibilityUP1D", /* tp_name */ - sizeof(BPy_QuantitativeInvisibilityUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - QuantitativeInvisibilityUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)QuantitativeInvisibilityUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "QuantitativeInvisibilityUP1D", /* tp_name */ + sizeof(BPy_QuantitativeInvisibilityUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + QuantitativeInvisibilityUP1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)QuantitativeInvisibilityUP1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp index 8a57b3173e5..13ffba9924b 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp @@ -53,7 +53,7 @@ static char ShapeUP1D___doc__[] = static int ShapeUP1D___init__(BPy_ShapeUP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"first", "second", NULL}; + static const char *kwlist[] = {"first", "second", nullptr}; unsigned u1, u2 = 0; if (!PyArg_ParseTupleAndKeywords(args, kwds, "I|I", (char **)kwlist, &u1, &u2)) { @@ -66,43 +66,43 @@ static int ShapeUP1D___init__(BPy_ShapeUP1D *self, PyObject *args, PyObject *kwd /*-----------------------BPy_ShapeUP1D type definition ------------------------------*/ PyTypeObject ShapeUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "ShapeUP1D", /* tp_name */ - sizeof(BPy_ShapeUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ShapeUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ShapeUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "ShapeUP1D", /* tp_name */ + sizeof(BPy_ShapeUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ShapeUP1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ShapeUP1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp index 9c1bf4ecd18..9388edf4d74 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp @@ -42,7 +42,7 @@ static char TrueUP1D___doc__[] = static int TrueUP1D___init__(BPy_TrueUP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {nullptr}; if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) { return -1; @@ -54,43 +54,43 @@ static int TrueUP1D___init__(BPy_TrueUP1D *self, PyObject *args, PyObject *kwds) /*-----------------------BPy_TrueUP1D type definition ------------------------------*/ PyTypeObject TrueUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "TrueUP1D", /* tp_name */ - sizeof(BPy_TrueUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - TrueUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)TrueUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "TrueUP1D", /* tp_name */ + sizeof(BPy_TrueUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + TrueUP1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)TrueUP1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp index 4fb486f1366..84da1f2e280 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp @@ -53,7 +53,7 @@ static int WithinImageBoundaryUP1D___init__(BPy_WithinImageBoundaryUP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"xmin", "ymin", "xmax", "ymax", NULL}; + static const char *kwlist[] = {"xmin", "ymin", "xmax", "ymax", nullptr}; double xmin, ymin, xmax, ymax; if (!PyArg_ParseTupleAndKeywords( @@ -67,43 +67,43 @@ static int WithinImageBoundaryUP1D___init__(BPy_WithinImageBoundaryUP1D *self, /*-----------------------BPy_TrueUP1D type definition ------------------------------*/ PyTypeObject WithinImageBoundaryUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) "WithinImageBoundaryUP1D", /* tp_name */ - sizeof(BPy_WithinImageBoundaryUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - WithinImageBoundaryUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)WithinImageBoundaryUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(nullptr, 0) "WithinImageBoundaryUP1D", /* tp_name */ + sizeof(BPy_WithinImageBoundaryUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + nullptr, /* tp_dealloc */ + 0, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + nullptr, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + nullptr, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + WithinImageBoundaryUP1D___doc__, /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + nullptr, /* tp_methods */ + nullptr, /* tp_members */ + nullptr, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)WithinImageBoundaryUP1D___init__, /* tp_init */ + nullptr, /* tp_alloc */ + nullptr, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp index 89c4bedd676..cc29bc77595 100644 --- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp +++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp @@ -25,25 +25,25 @@ namespace Freestyle { IndexedFaceSet::IndexedFaceSet() { - _Vertices = NULL; - _Normals = NULL; - _FrsMaterials = 0; - _TexCoords = NULL; - _FaceEdgeMarks = 0; + _Vertices = nullptr; + _Normals = nullptr; + _FrsMaterials = nullptr; + _TexCoords = nullptr; + _FaceEdgeMarks = nullptr; _VSize = 0; _NSize = 0; _MSize = 0; _TSize = 0; _NumFaces = 0; - _NumVertexPerFace = NULL; - _FaceStyle = NULL; - _VIndices = NULL; + _NumVertexPerFace = nullptr; + _FaceStyle = nullptr; + _VIndices = nullptr; _VISize = 0; - _NIndices = NULL; + _NIndices = nullptr; _NISize = 0; - _MIndices = NULL; + _MIndices = nullptr; _MISize = 0; - _TIndices = NULL; + _TIndices = nullptr; _TISize = 0; } @@ -79,7 +79,7 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices, memcpy(_Normals, iNormals, iNSize * sizeof(float)); _MSize = iMSize; - _FrsMaterials = 0; + _FrsMaterials = nullptr; if (iMaterials) { _FrsMaterials = new FrsMaterial *[_MSize]; for (unsigned int i = 0; i < _MSize; ++i) { @@ -87,7 +87,7 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices, } } _TSize = iTSize; - _TexCoords = 0; + _TexCoords = nullptr; if (_TSize) { _TexCoords = new float[_TSize]; memcpy(_TexCoords, iTexCoords, iTSize * sizeof(float)); @@ -112,13 +112,13 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices, memcpy(_NIndices, iNIndices, _NISize * sizeof(unsigned)); _MISize = iMISize; - _MIndices = 0; + _MIndices = nullptr; if (iMIndices) { _MIndices = new unsigned[_MISize]; memcpy(_MIndices, iMIndices, _MISize * sizeof(unsigned)); } _TISize = iTISize; - _TIndices = 0; + _TIndices = nullptr; if (_TISize) { _TIndices = new unsigned[_TISize]; memcpy(_TIndices, iTIndices, _TISize * sizeof(unsigned)); @@ -132,7 +132,7 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices, _Normals = iNormals; _MSize = iMSize; - _FrsMaterials = 0; + _FrsMaterials = nullptr; if (iMaterials) { _FrsMaterials = iMaterials; } @@ -152,7 +152,7 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices, _NIndices = iNIndices; _MISize = iMISize; - _MIndices = 0; + _MIndices = nullptr; if (iMISize) { _MIndices = iMIndices; } @@ -180,11 +180,11 @@ IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet &iBrother) : Rep(iBrother) } } else { - _FrsMaterials = 0; + _FrsMaterials = nullptr; } _TSize = iBrother.tsize(); - _TexCoords = 0; + _TexCoords = nullptr; if (_TSize) { _TexCoords = new float[_TSize]; memcpy(_TexCoords, iBrother.texCoords(), _TSize * sizeof(float)); @@ -214,11 +214,11 @@ IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet &iBrother) : Rep(iBrother) memcpy(_MIndices, iBrother.mindices(), _MISize * sizeof(unsigned)); } else { - _MIndices = 0; + _MIndices = nullptr; } _TISize = iBrother.tisize(); - _TIndices = 0; + _TIndices = nullptr; if (_TISize) { _TIndices = new unsigned[_TISize]; memcpy(_TIndices, iBrother.tindices(), _TISize * sizeof(unsigned)); @@ -227,61 +227,61 @@ IndexedFaceSet::IndexedFaceSet(const IndexedFaceSet &iBrother) : Rep(iBrother) IndexedFaceSet::~IndexedFaceSet() { - if (NULL != _Vertices) { + if (nullptr != _Vertices) { delete[] _Vertices; - _Vertices = NULL; + _Vertices = nullptr; } - if (NULL != _Normals) { + if (nullptr != _Normals) { delete[] _Normals; - _Normals = NULL; + _Normals = nullptr; } - if (NULL != _FrsMaterials) { + if (nullptr != _FrsMaterials) { for (unsigned int i = 0; i < _MSize; ++i) { delete _FrsMaterials[i]; } delete[] _FrsMaterials; - _FrsMaterials = NULL; + _FrsMaterials = nullptr; } - if (NULL != _TexCoords) { + if (nullptr != _TexCoords) { delete[] _TexCoords; - _TexCoords = NULL; + _TexCoords = nullptr; } - if (NULL != _NumVertexPerFace) { + if (nullptr != _NumVertexPerFace) { delete[] _NumVertexPerFace; - _NumVertexPerFace = NULL; + _NumVertexPerFace = nullptr; } - if (NULL != _FaceStyle) { + if (nullptr != _FaceStyle) { delete[] _FaceStyle; - _FaceStyle = NULL; + _FaceStyle = nullptr; } - if (NULL != _FaceEdgeMarks) { + if (nullptr != _FaceEdgeMarks) { delete[] _FaceEdgeMarks; - _FaceEdgeMarks = NULL; + _FaceEdgeMarks = nullptr; } - if (NULL != _VIndices) { + if (nullptr != _VIndices) { delete[] _VIndices; - _VIndices = NULL; + _VIndices = nullptr; } - if (NULL != _NIndices) { + if (nullptr != _NIndices) { delete[] _NIndices; - _NIndices = NULL; + _NIndices = nullptr; } - if (NULL != _MIndices) { + if (nullptr != _MIndices) { delete[] _MIndices; - _MIndices = NULL; + _MIndices = nullptr; } - if (NULL != _TIndices) { + if (nullptr != _TIndices) { delete[] _TIndices; - _TIndices = NULL; + _TIndices = nullptr; } } diff --git a/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp b/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp index 4bbb4a6c58a..69c33ea02a1 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp +++ b/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp @@ -27,7 +27,7 @@ namespace Freestyle { void NodeGroup::AddChild(Node *iChild) { - if (NULL == iChild) { + if (nullptr == iChild) { return; } diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp index 95d4735ddc4..4e0253c88e9 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp @@ -25,9 +25,7 @@ #include "../view_map/Functions0D.h" #include "../view_map/SteerableViewMap.h" -namespace Freestyle { - -namespace Functions0D { +namespace Freestyle::Functions0D { int DensityF0D::operator()(Interface0DIterator &iter) { @@ -114,6 +112,4 @@ int GetViewMapGradientNormF0D::operator()(Interface0DIterator &iter) return 0; } -} // end of namespace Functions0D - -} /* namespace Freestyle */ +} // namespace Freestyle::Functions0D diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp index ef151365fa0..7a516470e6b 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp @@ -24,10 +24,7 @@ #include "../view_map/SteerableViewMap.h" -namespace Freestyle { - -// FIXME -namespace Functions1D { +namespace Freestyle::Functions1D { int GetSteerableViewMapDensityF1D::operator()(Interface1D &inter) { @@ -43,7 +40,7 @@ int GetSteerableViewMapDensityF1D::operator()(Interface1D &inter) Interface0D &i0D = (*it); Interface0D &i0Dnext = (*itnext); fe = i0D.getFEdge(i0Dnext); - if (fe == 0) { + if (fe == nullptr) { cerr << "GetSteerableViewMapDensityF1D warning: no FEdge between " << i0D.getId() << " and " << i0Dnext.getId() << endl; // compute the direction between these two ??? @@ -127,6 +124,4 @@ int GetViewMapGradientNormF1D::operator()(Interface1D &inter) return 0; } -} // namespace Functions1D - -} /* namespace Freestyle */ +} // namespace Freestyle::Functions1D diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp index 0d4f21d9b11..335bfdffe90 100644 --- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp @@ -40,9 +40,7 @@ #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" -namespace Freestyle { - -namespace StrokeShaders { +namespace Freestyle::StrokeShaders { // // Thickness modifiers @@ -384,13 +382,13 @@ int BezierCurveShader::shade(Stroke &stroke) const // Build the Bezier curve from this set of data points: vector<Vec2d> data; StrokeInternal::StrokeVertexIterator v = stroke.strokeVerticesBegin(), vend; - data.push_back(Vec2d(v->x(), v->y())); // first one + data.emplace_back(v->x(), v->y()); // first one StrokeInternal::StrokeVertexIterator previous = v; ++v; for (vend = stroke.strokeVerticesEnd(); v != vend; ++v) { if (!((fabs(v->x() - (previous)->x()) < M_EPSILON) && ((fabs(v->y() - (previous)->y()) < M_EPSILON)))) { - data.push_back(Vec2d(v->x(), v->y())); + data.emplace_back(v->x(), v->y()); } previous = v; } @@ -697,6 +695,4 @@ int TipRemoverShader::shade(Stroke &stroke) const return 0; } -} // end of namespace StrokeShaders - -} /* namespace Freestyle */ +} // namespace Freestyle::StrokeShaders diff --git a/source/blender/freestyle/intern/stroke/Canvas.cpp b/source/blender/freestyle/intern/stroke/Canvas.cpp index 14c74c0f127..dc1a6fac4a9 100644 --- a/source/blender/freestyle/intern/stroke/Canvas.cpp +++ b/source/blender/freestyle/intern/stroke/Canvas.cpp @@ -48,17 +48,17 @@ using namespace std; namespace Freestyle { -Canvas *Canvas::_pInstance = 0; +Canvas *Canvas::_pInstance = nullptr; -const char *Canvas::_MapsPath = 0; +const char *Canvas::_MapsPath = nullptr; Canvas::Canvas() { - _SelectedFEdge = 0; + _SelectedFEdge = nullptr; _pInstance = this; PseudoNoise::init(42); - _Renderer = 0; - _current_sm = NULL; + _Renderer = nullptr; + _current_sm = nullptr; _steerableViewMap = new SteerableViewMap(NB_STEERABLE_VIEWMAP - 1); _basic = false; } @@ -76,12 +76,12 @@ Canvas::Canvas(const Canvas &iBrother) Canvas::~Canvas() { - _pInstance = 0; + _pInstance = nullptr; Clear(); if (_Renderer) { delete _Renderer; - _Renderer = 0; + _Renderer = nullptr; } // FIXME: think about an easy control for the maps memory management... if (!_maps.empty()) { @@ -347,8 +347,8 @@ void Canvas::loadMap(const char *iFileName, qimg = &newMap; #endif /* OCIO_TODO: support different input color space */ - ImBuf *qimg = IMB_loadiffname(filePath.c_str(), 0, NULL); - if (qimg == 0) { + ImBuf *qimg = IMB_loadiffname(filePath.c_str(), 0, nullptr); + if (qimg == nullptr) { cerr << "Could not load image file " << filePath << endl; return; } diff --git a/source/blender/freestyle/intern/stroke/ChainingIterators.cpp b/source/blender/freestyle/intern/stroke/ChainingIterators.cpp index 2b2ab0dc14a..51c04c8346e 100644 --- a/source/blender/freestyle/intern/stroke/ChainingIterators.cpp +++ b/source/blender/freestyle/intern/stroke/ChainingIterators.cpp @@ -76,19 +76,19 @@ int ChainingIterator::increment() _increment = true; ViewVertex *vertex = getVertex(); if (!vertex) { - _edge = 0; + _edge = nullptr; return 0; } AdjacencyIterator it = AdjacencyIterator(vertex, _restrictToSelection, _restrictToUnvisited); if (it.isEnd()) { - _edge = 0; + _edge = nullptr; return 0; } if (traverse(it) < 0) { return -1; } _edge = result; - if (_edge == 0) { + if (_edge == nullptr) { return 0; } if (_edge->A() == vertex) { @@ -105,19 +105,19 @@ int ChainingIterator::decrement() _increment = false; ViewVertex *vertex = getVertex(); if (!vertex) { - _edge = 0; + _edge = nullptr; return 0; } AdjacencyIterator it = AdjacencyIterator(vertex, _restrictToSelection, _restrictToUnvisited); if (it.isEnd()) { - _edge = 0; + _edge = nullptr; return 0; } if (traverse(it) < 0) { return -1; } _edge = result; - if (_edge == 0) { + if (_edge == nullptr) { return 0; } if (_edge->B() == vertex) { @@ -150,12 +150,12 @@ int ChainSilhouetteIterator::traverse(const AdjacencyIterator &ait) } ++it; } - result = 0; + result = nullptr; return 0; } if (nextVertex->getNature() & Nature::NON_T_VERTEX) { // soc NonTVertex *nontvertex = (NonTVertex*)nextVertex; - ViewEdge *newEdge(0); + ViewEdge *newEdge(nullptr); // we'll try to chain the edges by keeping the same nature... // the preseance order is : SILHOUETTE, BORDER, CREASE, MATERIAL_BOUNDARY, EDGE_MARK, // SUGGESTIVE, VALLEY, RIDGE @@ -185,13 +185,13 @@ int ChainSilhouetteIterator::traverse(const AdjacencyIterator &ait) result = newEdge; } else { - result = 0; + result = nullptr; } return 0; } } } - result = 0; + result = nullptr; return 0; } @@ -218,7 +218,7 @@ int ChainPredicateIterator::traverse(const AdjacencyIterator &ait) } ++it; } - result = 0; + result = nullptr; return 0; } diff --git a/source/blender/freestyle/intern/stroke/ContextFunctions.cpp b/source/blender/freestyle/intern/stroke/ContextFunctions.cpp index 5609013a417..c6140f463ab 100644 --- a/source/blender/freestyle/intern/stroke/ContextFunctions.cpp +++ b/source/blender/freestyle/intern/stroke/ContextFunctions.cpp @@ -26,9 +26,7 @@ #include "../system/TimeStamp.h" -namespace Freestyle { - -namespace ContextFunctions { +namespace Freestyle::ContextFunctions { unsigned GetTimeStampCF() { @@ -78,6 +76,4 @@ FEdge *GetSelectedFEdgeCF() return Canvas::getInstance()->selectedFEdge(); } -} // namespace ContextFunctions - -} /* namespace Freestyle */ +} // namespace Freestyle::ContextFunctions diff --git a/source/blender/freestyle/intern/stroke/Curve.cpp b/source/blender/freestyle/intern/stroke/Curve.cpp index 7129a35ffdb..c3dac81477d 100644 --- a/source/blender/freestyle/intern/stroke/Curve.cpp +++ b/source/blender/freestyle/intern/stroke/Curve.cpp @@ -40,8 +40,8 @@ namespace Freestyle { CurvePoint::CurvePoint() { - __A = 0; - __B = 0; + __A = nullptr; + __B = nullptr; _t2d = 0; } @@ -50,11 +50,11 @@ CurvePoint::CurvePoint(SVertex *iA, SVertex *iB, float t) __A = iA; __B = iB; _t2d = t; - if ((iA == 0) && (t == 1.0f)) { + if ((iA == nullptr) && (t == 1.0f)) { _Point2d = __B->point2d(); _Point3d = __B->point3d(); } - else if ((iB == 0) && (t == 0.0f)) { + else if ((iB == nullptr) && (t == 0.0f)) { _Point2d = __A->point2d(); _Point3d = __A->point3d(); } @@ -66,17 +66,17 @@ CurvePoint::CurvePoint(SVertex *iA, SVertex *iB, float t) CurvePoint::CurvePoint(CurvePoint *iA, CurvePoint *iB, float t3) { - __A = 0; - __B = 0; + __A = nullptr; + __B = nullptr; float t1 = iA->t2d(); float t2 = iB->t2d(); - if ((iA->A() == iB->A()) && (iA->B() == iB->B()) && (iA->A() != 0) && (iA->B() != 0) && - (iB->A() != 0) && (iB->B() != 0)) { + if ((iA->A() == iB->A()) && (iA->B() == iB->B()) && (iA->A() != nullptr) && + (iA->B() != nullptr) && (iB->A() != nullptr) && (iB->B() != nullptr)) { __A = iA->A(); __B = iB->B(); _t2d = t1 + t2 * t3 - t1 * t3; } - else if ((iA->B() == 0) && (iB->B() == 0)) { + else if ((iA->B() == nullptr) && (iB->B() == nullptr)) { __A = iA->A(); __B = iB->A(); _t2d = t3; @@ -133,15 +133,15 @@ CurvePoint::CurvePoint(CurvePoint *iA, CurvePoint *iB, float t3) _t2d = t2 * t3; } } - else if (iA->A() != 0 && iB->A() != 0 && + else if (iA->A() != nullptr && iB->A() != nullptr && (iA->A()->point3d() - iB->A()->point3d()).norm() < 1.0e-6) { goto iA_A_eq_iB_A; } - else if (iA->B() != 0 && iB->B() != 0 && + else if (iA->B() != nullptr && iB->B() != nullptr && (iA->B()->point3d() - iB->B()->point3d()).norm() < 1.0e-6) { goto iA_B_eq_iB_B; } - else if (iA->B() != 0 && iB->A() != 0 && + else if (iA->B() != nullptr && iB->A() != nullptr && (iA->B()->point3d() - iB->A()->point3d()).norm() < 1.0e-6) { goto iA_B_eq_iB_A; } @@ -162,7 +162,7 @@ CurvePoint::CurvePoint(CurvePoint *iA, CurvePoint *iB, float t3) cerr << "Fatal error in CurvePoint::CurvePoint(CurvePoint *iA, CurvePoint *iB, float t3)" << endl; } - BLI_assert(__A != 0 && __B != 0); + BLI_assert(__A != nullptr && __B != nullptr); #if 0 _Point2d = __A->point2d() + _t2d * (__B->point2d() - __A->point2d()); @@ -195,7 +195,7 @@ CurvePoint &CurvePoint::operator=(const CurvePoint &iBrother) FEdge *CurvePoint::fedge() { if (getNature() & Nature::T_VERTEX) { - return 0; + return nullptr; } return __A->fedge(); } @@ -206,14 +206,14 @@ FEdge *CurvePoint::getFEdge(Interface0D &inter) if (!iVertexB) { cerr << "Warning: CurvePoint::getFEdge() failed to cast the given 0D element to CurvePoint." << endl; - return 0; + return nullptr; } if (((__A == iVertexB->__A) && (__B == iVertexB->__B)) || ((__A == iVertexB->__B) && (__B == iVertexB->__A))) { return __A->getFEdge(*__B); } - if (__B == 0) { - if (iVertexB->__B == 0) { + if (__B == nullptr) { + if (iVertexB->__B == nullptr) { return __A->getFEdge(*(iVertexB->__A)); } if (iVertexB->__A == __A) { @@ -223,7 +223,7 @@ FEdge *CurvePoint::getFEdge(Interface0D &inter) return __A->getFEdge(*(iVertexB->__A)); } } - if (iVertexB->__B == 0) { + if (iVertexB->__B == nullptr) { if (iVertexB->__A == __A) { return __B->getFEdge(*(iVertexB->__A)); } @@ -284,15 +284,15 @@ FEdge *CurvePoint::getFEdge(Interface0D &inter) #endif cerr << "Warning: CurvePoint::getFEdge() failed." << endl; - return NULL; + return nullptr; } Vec3r CurvePoint::normal() const { - if (__B == 0) { + if (__B == nullptr) { return __A->normal(); } - if (__A == 0) { + if (__A == nullptr) { return __B->normal(); } Vec3r Na = __A->normal(); @@ -328,7 +328,7 @@ Id CurvePoint::shape_id() const const SShape *CurvePoint::shape() const { - if (__A == 0) { + if (__A == nullptr) { return __B->shape(); } return __A->shape(); @@ -357,10 +357,10 @@ const unsigned CurvePoint::qi() const occluder_container::const_iterator CurvePoint::occluders_begin() const { - if (__A == 0) { + if (__A == nullptr) { return __B->occluders_begin(); } - if (__B == 0) { + if (__B == nullptr) { return __A->occluders_begin(); } return __A->getFEdge(*__B)->occluders_begin(); @@ -368,10 +368,10 @@ occluder_container::const_iterator CurvePoint::occluders_begin() const occluder_container::const_iterator CurvePoint::occluders_end() const { - if (__A == 0) { + if (__A == nullptr) { return __B->occluders_end(); } - if (__B == 0) { + if (__B == nullptr) { return __A->occluders_end(); } return __A->getFEdge(*__B)->occluders_end(); @@ -379,10 +379,10 @@ occluder_container::const_iterator CurvePoint::occluders_end() const bool CurvePoint::occluders_empty() const { - if (__A == 0) { + if (__A == nullptr) { return __B->occluders_empty(); } - if (__B == 0) { + if (__B == nullptr) { return __A->occluders_empty(); } return __A->getFEdge(*__B)->occluders_empty(); @@ -390,10 +390,10 @@ bool CurvePoint::occluders_empty() const int CurvePoint::occluders_size() const { - if (__A == 0) { + if (__A == nullptr) { return __B->occluders_size(); } - if (__B == 0) { + if (__B == nullptr) { return __A->occluders_size(); } return __A->getFEdge(*__B)->occluders_size(); @@ -401,10 +401,10 @@ int CurvePoint::occluders_size() const const SShape *CurvePoint::occluded_shape() const { - if (__A == 0) { + if (__A == nullptr) { return __B->occluded_shape(); } - if (__B == 0) { + if (__B == nullptr) { return __A->occluded_shape(); } return __A->getFEdge(*__B)->occluded_shape(); @@ -412,10 +412,10 @@ const SShape *CurvePoint::occluded_shape() const const Polygon3r &CurvePoint::occludee() const { - if (__A == 0) { + if (__A == nullptr) { return __B->occludee(); } - if (__B == 0) { + if (__B == nullptr) { return __A->occludee(); } return __A->getFEdge(*__B)->occludee(); @@ -423,10 +423,10 @@ const Polygon3r &CurvePoint::occludee() const bool CurvePoint::occludee_empty() const { - if (__A == 0) { + if (__A == nullptr) { return __B->occludee_empty(); } - if (__B == 0) { + if (__B == nullptr) { return __A->occludee_empty(); } return __A->getFEdge(*__B)->occludee_empty(); @@ -434,13 +434,13 @@ bool CurvePoint::occludee_empty() const real CurvePoint::z_discontinuity() const { - if (__A == 0) { + if (__A == nullptr) { return __B->z_discontinuity(); } - if (__B == 0) { + if (__B == nullptr) { return __A->z_discontinuity(); } - if (__A->getFEdge(*__B) == 0) { + if (__A->getFEdge(*__B) == nullptr) { return 0.0; } diff --git a/source/blender/freestyle/intern/stroke/Operators.cpp b/source/blender/freestyle/intern/stroke/Operators.cpp index 307122833e4..c73bb739e47 100644 --- a/source/blender/freestyle/intern/stroke/Operators.cpp +++ b/source/blender/freestyle/intern/stroke/Operators.cpp @@ -34,7 +34,7 @@ namespace Freestyle { Operators::I1DContainer Operators::_current_view_edges_set; Operators::I1DContainer Operators::_current_chains_set; -Operators::I1DContainer *Operators::_current_set = NULL; +Operators::I1DContainer *Operators::_current_set = nullptr; Operators::StrokesContainer Operators::_current_strokes_set; int Operators::select(UnaryPredicate1D &pred) @@ -738,7 +738,7 @@ static int __recursiveSplit(Chain *_curve, // retrieves the current splitting id Id *newId = _curve->getSplittingId(); - if (newId == 0) { + if (newId == nullptr) { newId = new Id(_curve->getId()); _curve->setSplittingId(newId); } @@ -810,7 +810,7 @@ int Operators::recursiveSplit(UnaryFunction0D<double> &func, return 0; } - Chain *currentChain = 0; + Chain *currentChain = nullptr; I1DContainer splitted_chains; I1DContainer newChains; I1DContainer::iterator cit = _current_chains_set.begin(), citend = _current_chains_set.end(); @@ -921,7 +921,7 @@ static int __recursiveSplit(Chain *_curve, // retrieves the current splitting id Id *newId = _curve->getSplittingId(); - if (newId == NULL) { + if (newId == nullptr) { newId = new Id(_curve->getId()); _curve->setSplittingId(newId); } @@ -994,7 +994,7 @@ int Operators::recursiveSplit(UnaryFunction0D<double> &func, return 0; } - Chain *currentChain = 0; + Chain *currentChain = nullptr; I1DContainer splitted_chains; I1DContainer newChains; I1DContainer::iterator cit = _current_chains_set.begin(), citend = _current_chains_set.end(); @@ -1095,7 +1095,7 @@ static Stroke *createStroke(Interface1D &inter) Vec2r previous = current; SVertex *sv; CurvePoint *cp; - StrokeVertex *stroke_vertex = NULL; + StrokeVertex *stroke_vertex = nullptr; bool hasSingularity = false; do { @@ -1152,7 +1152,7 @@ static Stroke *createStroke(Interface1D &inter) // Discard the stroke if the number of stroke vertices is less than two if (stroke->strokeVerticesSize() < 2) { delete stroke; - return NULL; + return nullptr; } stroke->setLength(currentCurvilignAbscissa); if (hasSingularity) { @@ -1198,7 +1198,7 @@ static Stroke *createStroke(Interface1D &inter) else { // Discard the stroke because all stroke vertices are overlapping delete stroke; - return NULL; + return nullptr; } current = overlapping_vertices.front()->getPoint(); Vec2r dir(target - current); diff --git a/source/blender/freestyle/intern/stroke/Stroke.cpp b/source/blender/freestyle/intern/stroke/Stroke.cpp index 3e1463e8631..79eb37ae870 100644 --- a/source/blender/freestyle/intern/stroke/Stroke.cpp +++ b/source/blender/freestyle/intern/stroke/Stroke.cpp @@ -47,9 +47,9 @@ StrokeAttribute::StrokeAttribute() _color[i] = 0.2f; } _color[0] = 0.8f; - _userAttributesReal = NULL; - _userAttributesVec2f = NULL; - _userAttributesVec3f = NULL; + _userAttributesReal = nullptr; + _userAttributesVec2f = nullptr; + _userAttributesVec3f = nullptr; _visible = true; } @@ -66,19 +66,19 @@ StrokeAttribute::StrokeAttribute(const StrokeAttribute &iBrother) _userAttributesReal = new realMap(*iBrother._userAttributesReal); } else { - _userAttributesReal = NULL; + _userAttributesReal = nullptr; } if (iBrother._userAttributesVec2f) { _userAttributesVec2f = new Vec2fMap(*iBrother._userAttributesVec2f); } else { - _userAttributesVec2f = NULL; + _userAttributesVec2f = nullptr; } if (iBrother._userAttributesVec3f) { _userAttributesVec3f = new Vec3fMap(*iBrother._userAttributesVec3f); } else { - _userAttributesVec3f = NULL; + _userAttributesVec3f = nullptr; } } @@ -100,9 +100,9 @@ StrokeAttribute::StrokeAttribute(float iRColor, _visible = true; - _userAttributesReal = NULL; - _userAttributesVec2f = NULL; - _userAttributesVec3f = NULL; + _userAttributesReal = nullptr; + _userAttributesVec2f = nullptr; + _userAttributesVec3f = nullptr; } StrokeAttribute::StrokeAttribute(const StrokeAttribute &a1, const StrokeAttribute &a2, float t) @@ -129,7 +129,7 @@ StrokeAttribute::StrokeAttribute(const StrokeAttribute &a1, const StrokeAttribut } } else { - _userAttributesReal = NULL; + _userAttributesReal = nullptr; } if ((a1._userAttributesVec2f) && (a2._userAttributesVec2f)) { if (a1._userAttributesVec2f->size() == a2._userAttributesVec2f->size()) { @@ -143,7 +143,7 @@ StrokeAttribute::StrokeAttribute(const StrokeAttribute &a1, const StrokeAttribut } } else { - _userAttributesVec2f = NULL; + _userAttributesVec2f = nullptr; } if ((a1._userAttributesVec3f) && (a2._userAttributesVec3f)) { if (a1._userAttributesVec3f->size() == a2._userAttributesVec3f->size()) { @@ -157,7 +157,7 @@ StrokeAttribute::StrokeAttribute(const StrokeAttribute &a1, const StrokeAttribut } } else { - _userAttributesVec3f = NULL; + _userAttributesVec3f = nullptr; } } @@ -194,7 +194,7 @@ StrokeAttribute &StrokeAttribute::operator=(const StrokeAttribute &iBrother) _userAttributesReal = new realMap(*(iBrother._userAttributesReal)); } else { - _userAttributesReal = NULL; + _userAttributesReal = nullptr; } if (iBrother._userAttributesVec2f) { if (!_userAttributesVec2f) { @@ -203,7 +203,7 @@ StrokeAttribute &StrokeAttribute::operator=(const StrokeAttribute &iBrother) _userAttributesVec2f = new Vec2fMap(*(iBrother._userAttributesVec2f)); } else { - _userAttributesVec2f = NULL; + _userAttributesVec2f = nullptr; } if (iBrother._userAttributesVec3f) { if (!_userAttributesVec3f) { @@ -212,7 +212,7 @@ StrokeAttribute &StrokeAttribute::operator=(const StrokeAttribute &iBrother) _userAttributesVec3f = new Vec3fMap(*(iBrother._userAttributesVec3f)); } else { - _userAttributesVec3f = NULL; + _userAttributesVec3f = nullptr; } return *this; } @@ -355,7 +355,7 @@ StrokeVertex::StrokeVertex(const StrokeVertex &iBrother) : CurvePoint(iBrother) _StrokeLength = 0.0f; } -StrokeVertex::StrokeVertex(SVertex *iSVertex) : CurvePoint(iSVertex, 0, 0.0f) +StrokeVertex::StrokeVertex(SVertex *iSVertex) : CurvePoint(iSVertex, nullptr, 0.0f) { _CurvilignAbscissa = 0.0f; _StrokeLength = 0.0f; @@ -376,7 +376,7 @@ StrokeVertex::StrokeVertex(StrokeVertex *iA, StrokeVertex *iB, float t3) : Curve } StrokeVertex::StrokeVertex(SVertex *iSVertex, const StrokeAttribute &iAttribute) - : CurvePoint(iSVertex, 0, 0.0f) + : CurvePoint(iSVertex, nullptr, 0.0f) { _Attribute = iAttribute; _CurvilignAbscissa = 0.0f; @@ -416,11 +416,11 @@ Stroke::Stroke() _textureId = 0; _textureStep = 1.0; for (int a = 0; a < MAX_MTEX; a++) { - _mtex[a] = NULL; + _mtex[a] = nullptr; } - _nodeTree = NULL; + _nodeTree = nullptr; _tips = false; - _rep = NULL; + _rep = nullptr; } Stroke::Stroke(const Stroke &iBrother) : Interface1D(iBrother) @@ -447,7 +447,7 @@ Stroke::Stroke(const Stroke &iBrother) : Interface1D(iBrother) _rep = new StrokeRep(*(iBrother._rep)); } else { - _rep = NULL; + _rep = nullptr; } } @@ -464,7 +464,7 @@ Stroke::~Stroke() _ViewEdges.clear(); if (_rep) { delete _rep; - _rep = NULL; + _rep = nullptr; } } @@ -489,7 +489,7 @@ Stroke &Stroke::operator=(const Stroke &iBrother) _rep = new StrokeRep(*(iBrother._rep)); } else { - _rep = NULL; + _rep = nullptr; } return *this; } @@ -550,7 +550,7 @@ int Stroke::Resample(int iNPoints) vertex_container newVertices; real t = 0.0f; - StrokeVertex *newVertex = NULL; + StrokeVertex *newVertex = nullptr; vector<StrokeSegment> strokeSegments; int N = 0; float meanlength = 0; @@ -562,7 +562,7 @@ int Stroke::Resample(int iNPoints) real norm_var = vec_tmp.norm(); int numberOfPointsToAdd = (int)floor(NPointsToAdd * norm_var / _Length); float csampling = norm_var / (float)(numberOfPointsToAdd + 1); - strokeSegments.push_back(StrokeSegment(it, next, norm_var, numberOfPointsToAdd, csampling)); + strokeSegments.emplace_back(it, next, norm_var, numberOfPointsToAdd, csampling); N += numberOfPointsToAdd; meanlength += norm_var; ++nsegments; @@ -661,7 +661,7 @@ int Stroke::Resample(float iSampling) vertex_container newVertices; real t = 0.0f; const real limit = 0.99; - StrokeVertex *newVertex = NULL; + StrokeVertex *newVertex = nullptr; StrokeInternal::StrokeVertexIterator it = strokeVerticesBegin(); StrokeInternal::StrokeVertexIterator next = it; ++next; diff --git a/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp b/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp index 5b2beb8f068..a4268e43a56 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp @@ -35,7 +35,7 @@ namespace Freestyle { /* */ /**********************************/ -TextureManager *StrokeRenderer::_textureManager = 0; +TextureManager *StrokeRenderer::_textureManager = nullptr; StrokeRenderer::StrokeRenderer() { @@ -59,7 +59,7 @@ bool StrokeRenderer::loadTextures() /* */ /**********************************/ -TextureManager *TextureManager::_pInstance = 0; +TextureManager *TextureManager::_pInstance = nullptr; string TextureManager::_patterns_path; @@ -77,7 +77,7 @@ TextureManager::~TextureManager() if (!_brushesMap.empty()) { _brushesMap.clear(); } - _pInstance = 0; + _pInstance = nullptr; } void TextureManager::load() diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.cpp b/source/blender/freestyle/intern/stroke/StrokeRep.cpp index 3678461253c..aadc42beb4b 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRep.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeRep.cpp @@ -563,8 +563,8 @@ void Strip::computeTexCoordWithTips(const vector<StrokeVertex *> &iStrokeVertice float texStep) { vector<StrokeVertex *>::const_iterator v, vend; - StrokeVertex *sv = NULL; - StrokeVertexRep *tvRep[2] = {NULL}; + StrokeVertex *sv = nullptr; + StrokeVertexRep *tvRep[2] = {nullptr}; float l, fact, t; float u = 0, uPrev = 0; @@ -750,13 +750,13 @@ void Strip::computeTexCoordWithTips(const vector<StrokeVertex *> &iStrokeVertice StrokeRep::StrokeRep() { - _stroke = 0; + _stroke = nullptr; _strokeType = Stroke::OPAQUE_MEDIUM; - _nodeTree = NULL; + _nodeTree = nullptr; _hasTex = false; _textureStep = 1.0; for (int a = 0; a < MAX_MTEX; a++) { - _mtex[a] = NULL; + _mtex[a] = nullptr; } TextureManager *ptm = TextureManager::getInstance(); if (ptm) { @@ -786,7 +786,7 @@ StrokeRep::StrokeRep(Stroke *iStroke) _mtex[a] = iStroke->getMTex(a); } else { - _mtex[a] = NULL; + _mtex[a] = nullptr; } } if (_textureId == 0) { @@ -822,7 +822,7 @@ StrokeRep::StrokeRep(const StrokeRep &iBrother) _mtex[a] = iBrother._mtex[a]; } else { - _mtex[a] = NULL; + _mtex[a] = nullptr; } } for (vector<Strip *>::const_iterator s = iBrother._strips.begin(), send = iBrother._strips.end(); diff --git a/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp b/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp index e9a50067d4d..d4ebaac2459 100644 --- a/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp @@ -30,8 +30,8 @@ namespace Freestyle { LineRep *StrokeTesselator::Tesselate(Stroke *iStroke) { - if (0 == iStroke) { - return 0; + if (nullptr == iStroke) { + return nullptr; } LineRep *line; diff --git a/source/blender/freestyle/intern/system/StringUtils.cpp b/source/blender/freestyle/intern/system/StringUtils.cpp index 90210f33a25..b488987dd41 100644 --- a/source/blender/freestyle/intern/system/StringUtils.cpp +++ b/source/blender/freestyle/intern/system/StringUtils.cpp @@ -24,9 +24,7 @@ #include "StringUtils.h" #include "FreestyleConfig.h" -namespace Freestyle { - -namespace StringUtils { +namespace Freestyle::StringUtils { void getPathName(const string &path, const string &base, vector<string> &pathnames) { @@ -46,7 +44,7 @@ void getPathName(const string &path, const string &base, vector<string> &pathnam dir = path.substr(pos, sep - pos); BLI_strncpy(cleaned, dir.c_str(), FILE_MAX); - BLI_path_normalize(NULL, cleaned); + BLI_path_normalize(nullptr, cleaned); res = string(cleaned); if (!base.empty()) { @@ -57,6 +55,4 @@ void getPathName(const string &path, const string &base, vector<string> &pathnam } } -} // end of namespace StringUtils - -} /* namespace Freestyle */ +} // namespace Freestyle::StringUtils diff --git a/source/blender/freestyle/intern/view_map/AutoPtrHelper.h b/source/blender/freestyle/intern/view_map/AutoPtrHelper.h index 94fd80bc0fb..cfcfa5e651b 100644 --- a/source/blender/freestyle/intern/view_map/AutoPtrHelper.h +++ b/source/blender/freestyle/intern/view_map/AutoPtrHelper.h @@ -27,6 +27,8 @@ namespace Freestyle { template<typename T> class AutoPtr : public std::unique_ptr<T> { public: + using std::unique_ptr<T>::unique_ptr; + AutoPtr() : std::unique_ptr<T>() { } @@ -42,6 +44,8 @@ template<typename T> class AutoPtr : public std::unique_ptr<T> { other.release(); } + using std::unique_ptr<T>::operator=; + template<typename X> AutoPtr &operator=(AutoPtr<X> &other) = delete; }; diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.cpp b/source/blender/freestyle/intern/view_map/BoxGrid.cpp index aea54afc0f5..e81291c94bc 100644 --- a/source/blender/freestyle/intern/view_map/BoxGrid.cpp +++ b/source/blender/freestyle/intern/view_map/BoxGrid.cpp @@ -157,7 +157,7 @@ void BoxGrid::assignCells(OccluderSource & /*source*/, Vec3r point = transform((*f)->center3d()); unsigned int i, j; getCellCoordinates(point, i, j); - if (_cells[i * _cellsY + j] == NULL) { + if (_cells[i * _cellsY + j] == nullptr) { // This is an uninitialized cell real x, y, width, height; @@ -181,7 +181,7 @@ void BoxGrid::distributePolygons(OccluderSource &source) unsigned long nKeptFaces = 0; for (source.begin(); source.isValid(); source.next()) { - OccluderData *occluder = NULL; + OccluderData *occluder = nullptr; try { if (insertOccluder(source, occluder)) { diff --git a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp index b53771ad2c2..a6781bfc8d1 100644 --- a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp +++ b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp @@ -146,7 +146,7 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe // For each feature edge, while bestOccluderTarget not found and view edge not visible bool bestOccluderTargetFound = false; - FEdge *bestOccluderTarget = NULL; + FEdge *bestOccluderTarget = nullptr; real bestOccluderDistance = 0.0; FEdge *festart = (*ve)->fedgeA(); FEdge *fe = festart; @@ -173,7 +173,7 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe else { real d = distance2D(fe->center2d(), prosceniumOrigin); // If center point is closer to viewport origin than current target - if (bestOccluderTarget == NULL || d < bestOccluderDistance) { + if (bestOccluderTarget == nullptr || d < bestOccluderDistance) { // Then store as bestOccluderTarget bestOccluderDistance = d; bestOccluderTarget = fe; @@ -187,7 +187,7 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe (*ve)->setIsInImage(true); } fe = fe->nextEdge(); - } while (fe != NULL && fe != festart && !(bestOccluderTargetFound && (*ve)->isInImage())); + } while (fe != nullptr && fe != festart && !(bestOccluderTargetFound && (*ve)->isInImage())); // Either we have run out of FEdges, or we already have the one edge we need to determine // visibility Cull all remaining edges. @@ -198,7 +198,7 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe // If bestOccluderTarget was not found inside the occluder proscenium, // we need to expand the occluder proscenium to include it. - if ((*ve)->isInImage() && bestOccluderTarget != NULL && !bestOccluderTargetFound) { + if ((*ve)->isInImage() && bestOccluderTarget != nullptr && !bestOccluderTargetFound) { // Expand occluder proscenium to enclose bestOccluderTarget Vec3r point = bestOccluderTarget->center2d(); if (point[0] < occluderProscenium[0]) { diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp index 3788b5e3545..7e8937bfe80 100644 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp @@ -39,7 +39,7 @@ void FEdgeXDetector::processShapes(WingedEdge &we) vector<WShape *> wshapes = we.getWShapes(); WXShape *wxs; - if (_pProgressBar != NULL) { + if (_pProgressBar != nullptr) { _pProgressBar->reset(); _pProgressBar->setLabelText("Detecting feature lines"); _pProgressBar->setTotalSteps(wshapes.size() * 3); @@ -228,7 +228,7 @@ void FEdgeXDetector::computeCurvatures(WXVertex *vertex) } // view dependent C = vertex->curvatures(); - if (C == 0) { + if (C == nullptr) { return; } @@ -370,7 +370,7 @@ void FEdgeXDetector::ProcessBorderEdge(WXEdge *iEdge) { // first check whether it is a border edge: BORDER ? //--------- - if (iEdge->GetaFace() == 0) { + if (iEdge->GetaFace() == nullptr) { // it is a border edge iEdge->AddNature(Nature::BORDER); } diff --git a/source/blender/freestyle/intern/view_map/Functions0D.cpp b/source/blender/freestyle/intern/view_map/Functions0D.cpp index 892b9b33b4b..4ea163c47cf 100644 --- a/source/blender/freestyle/intern/view_map/Functions0D.cpp +++ b/source/blender/freestyle/intern/view_map/Functions0D.cpp @@ -26,9 +26,7 @@ using namespace std; -namespace Freestyle { - -namespace Functions0D { +namespace Freestyle::Functions0D { // Internal function FEdge *getFEdge(Interface0D &it1, Interface0D &it2) @@ -47,7 +45,7 @@ void getFEdges(Interface0DIterator &it, FEdge *&fe1, FEdge *&fe2) } if (count < 3) { // if we only have 2 vertices - FEdge *fe = 0; + FEdge *fe = nullptr; Interface0DIterator tmp = it; if (it.isBegin()) { ++tmp; @@ -58,7 +56,7 @@ void getFEdges(Interface0DIterator &it, FEdge *&fe1, FEdge *&fe2) fe = it->getFEdge(*tmp); } fe1 = fe; - fe2 = NULL; + fe2 = nullptr; } else { // we have more than 2 vertices @@ -77,11 +75,11 @@ void getFEdges(Interface0DIterator &it, FEdge *&fe1, FEdge *&fe2) } if (begin) { fe1 = it->getFEdge(*next); - fe2 = NULL; + fe2 = nullptr; } else if (last) { fe1 = previous->getFEdge(*it); - fe2 = NULL; + fe2 = nullptr; } else { fe1 = previous->getFEdge(*it); @@ -95,14 +93,14 @@ void getViewEdges(Interface0DIterator &it, ViewEdge *&ve1, ViewEdge *&ve2) FEdge *fe1, *fe2; getFEdges(it, fe1, fe2); ve1 = fe1->viewedge(); - if (fe2 != NULL) { + if (fe2 != nullptr) { ve2 = fe2->viewedge(); if (ve2 == ve1) { - ve2 = NULL; + ve2 = nullptr; } } else { - ve2 = NULL; + ve2 = nullptr; } } @@ -124,7 +122,7 @@ void getOccludersF0D(Interface0DIterator &it, set<ViewShape *> &oOccluders) oOccluders.insert((*oit)); } - if (ve2 != NULL) { + if (ve2 != nullptr) { oit = ve2->occluders_begin(); oitend = ve2->occluders_end(); for (; oit != oitend; ++oit) { @@ -280,7 +278,7 @@ int ZDiscontinuityF0D::operator()(Interface0DIterator &iter) FEdge *fe1, *fe2; getFEdges(iter, fe1, fe2); result = fe1->z_discontinuity(); - if (fe2 != NULL) { + if (fe2 != nullptr) { result += fe2->z_discontinuity(); result /= 2.0f; } @@ -294,7 +292,7 @@ int Normal2DF0D::operator()(Interface0DIterator &iter) Vec3f e1(fe1->orientation2d()); Vec2f n1(e1[1], -e1[0]); Vec2f n(n1); - if (fe2 != NULL) { + if (fe2 != nullptr) { Vec3f e2(fe2->orientation2d()); Vec2f n2(e2[1], -e2[0]); n += n2; @@ -308,7 +306,7 @@ int MaterialF0D::operator()(Interface0DIterator &iter) { FEdge *fe1, *fe2; getFEdges(iter, fe1, fe2); - if (fe1 == NULL) { + if (fe1 == nullptr) { return -1; } if (fe1->isSmooth()) { @@ -337,7 +335,7 @@ int QuantitativeInvisibilityF0D::operator()(Interface0DIterator &iter) getViewEdges(iter, ve1, ve2); unsigned int qi1, qi2; qi1 = ve1->qi(); - if (ve2 != NULL) { + if (ve2 != nullptr) { qi2 = ve2->qi(); if (qi2 != qi1) { if (G.debug & G_DEBUG_FREESTYLE) { @@ -356,7 +354,7 @@ int CurveNatureF0D::operator()(Interface0DIterator &iter) ViewEdge *ve1, *ve2; getViewEdges(iter, ve1, ve2); nat |= ve1->getNature(); - if (ve2 != NULL) { + if (ve2 != nullptr) { nat |= ve2->getNature(); } result = nat; @@ -388,6 +386,4 @@ int GetOccludeeF0D::operator()(Interface0DIterator &iter) return 0; } -} // end of namespace Functions0D - -} /* namespace Freestyle */ +} // namespace Freestyle::Functions0D diff --git a/source/blender/freestyle/intern/view_map/Functions1D.cpp b/source/blender/freestyle/intern/view_map/Functions1D.cpp index a0a320a6e6d..999d7f6e753 100644 --- a/source/blender/freestyle/intern/view_map/Functions1D.cpp +++ b/source/blender/freestyle/intern/view_map/Functions1D.cpp @@ -23,9 +23,7 @@ using namespace std; -namespace Freestyle { - -namespace Functions1D { +namespace Freestyle::Functions1D { int GetXF1D::operator()(Interface1D &inter) { @@ -219,8 +217,8 @@ void getOccludeeF1D(Interface1D &inter, set<ViewShape *> &oShapes) ViewEdge *ve = dynamic_cast<ViewEdge *>(&inter); if (ve) { ViewShape *aShape = ve->aShape(); - if (aShape == 0) { - oShapes.insert((ViewShape *)0); + if (aShape == nullptr) { + oShapes.insert((ViewShape *)nullptr); return; } oShapes.insert(aShape); @@ -266,6 +264,4 @@ void getShapeF1D(Interface1D &inter, set<ViewShape *> &oShapes) } } -} // end of namespace Functions1D - -} /* namespace Freestyle */ +} // namespace Freestyle::Functions1D diff --git a/source/blender/freestyle/intern/view_map/Interface0D.cpp b/source/blender/freestyle/intern/view_map/Interface0D.cpp index 2961b0f58e5..907b21ad5cf 100644 --- a/source/blender/freestyle/intern/view_map/Interface0D.cpp +++ b/source/blender/freestyle/intern/view_map/Interface0D.cpp @@ -79,7 +79,7 @@ Geometry::Vec2r Interface0D::getPoint2D() const FEdge *Interface0D::getFEdge(Interface0D &UNUSED(element)) { PyErr_SetString(PyExc_TypeError, "method getFEdge() not properly overridden"); - return 0; + return nullptr; } Id Interface0D::getId() const @@ -97,25 +97,25 @@ Nature::VertexNature Interface0D::getNature() const SVertex *Interface0D::castToSVertex() { PyErr_SetString(PyExc_TypeError, "method castToSVertex() not properly overridden"); - return 0; + return nullptr; } ViewVertex *Interface0D::castToViewVertex() { PyErr_SetString(PyExc_TypeError, "method castToViewVertex() not properly overridden"); - return 0; + return nullptr; } NonTVertex *Interface0D::castToNonTVertex() { PyErr_SetString(PyExc_TypeError, "method castToNonTVertex() not properly overridden"); - return 0; + return nullptr; } TVertex *Interface0D::castToTVertex() { PyErr_SetString(PyExc_TypeError, "method castToTVertex() not properly overridden"); - return 0; + return nullptr; } } /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/view_map/OccluderSource.cpp b/source/blender/freestyle/intern/view_map/OccluderSource.cpp index e75856edc35..618fa781fa7 100644 --- a/source/blender/freestyle/intern/view_map/OccluderSource.cpp +++ b/source/blender/freestyle/intern/view_map/OccluderSource.cpp @@ -97,7 +97,7 @@ bool OccluderSource::isValid() WFace *OccluderSource::getWFace() { - return valid ? *currentFace : NULL; + return valid ? *currentFace : nullptr; } Polygon3r OccluderSource::getCameraSpacePolygon() diff --git a/source/blender/freestyle/intern/view_map/Silhouette.cpp b/source/blender/freestyle/intern/view_map/Silhouette.cpp index 3280e56ea7e..0f9d1f166b2 100644 --- a/source/blender/freestyle/intern/view_map/Silhouette.cpp +++ b/source/blender/freestyle/intern/view_map/Silhouette.cpp @@ -158,14 +158,14 @@ real SVertex::z_discontinuity() const FEdge *SVertex::fedge() { if (getNature() & Nature::T_VERTEX) { - return NULL; + return nullptr; } return _FEdges[0]; } FEdge *SVertex::getFEdge(Interface0D &inter) { - FEdge *result = NULL; + FEdge *result = nullptr; SVertex *iVertexB = dynamic_cast<SVertex *>(&inter); if (!iVertexB) { return result; @@ -177,7 +177,7 @@ FEdge *SVertex::getFEdge(Interface0D &inter) result = (*fe); } } - if ((result == 0) && (getNature() & Nature::T_VERTEX)) { + if ((result == nullptr) && (getNature() & Nature::T_VERTEX)) { SVertex *brother; ViewVertex *vvertex = viewvertex(); TVertex *tvertex = dynamic_cast<TVertex *>(vvertex); @@ -195,7 +195,7 @@ FEdge *SVertex::getFEdge(Interface0D &inter) } } } - if ((result == 0) && (iVertexB->getNature() & Nature::T_VERTEX)) { + if ((result == nullptr) && (iVertexB->getNature() & Nature::T_VERTEX)) { SVertex *brother; ViewVertex *vvertex = iVertexB->viewvertex(); TVertex *tvertex = dynamic_cast<TVertex *>(vvertex); @@ -239,8 +239,8 @@ float FEdge::viewedge_length() const const SShape *FEdge::occluded_shape() const { ViewShape *aShape = _ViewEdge->aShape(); - if (aShape == 0) { - return 0; + if (aShape == nullptr) { + return nullptr; } return aShape->sshape(); } diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp index 2624c70c988..21b0827a660 100644 --- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp +++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp @@ -73,7 +73,7 @@ real SilhouetteGeomEngine::_znear = 0.0; real SilhouetteGeomEngine::_zfar = 100.0; bool SilhouetteGeomEngine::_isOrthographicProjection = false; -SilhouetteGeomEngine *SilhouetteGeomEngine::_pInstance = NULL; +SilhouetteGeomEngine *SilhouetteGeomEngine::_pInstance = nullptr; void SilhouetteGeomEngine::setTransform(const real iModelViewMatrix[4][4], const real iProjectionMatrix[4][4], diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp index 1399ac396b0..db567d6b5ef 100644 --- a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp +++ b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp @@ -154,7 +154,7 @@ void SphericalGrid::assignCells(OccluderSource & /*source*/, Vec3r point = SphericalGrid::Transform::sphericalProjection((*f)->center3d()); unsigned i, j; getCellCoordinates(point, i, j); - if (_cells[i * _cellsY + j] == NULL) { + if (_cells[i * _cellsY + j] == nullptr) { // This is an uninitialized cell real x, y, width, height; @@ -178,7 +178,7 @@ void SphericalGrid::distributePolygons(OccluderSource &source) unsigned long nKeptFaces = 0; for (source.begin(); source.isValid(); source.next()) { - OccluderData *occluder = NULL; + OccluderData *occluder = nullptr; try { if (insertOccluder(source, occluder)) { diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp index 7790dd64cf5..d8a1e597a1d 100644 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp @@ -45,8 +45,8 @@ SteerableViewMap::SteerableViewMap(unsigned int nbOrientations) _nbOrientations = nbOrientations; _bound = cos(M_PI / (float)_nbOrientations); for (unsigned int i = 0; i < _nbOrientations; ++i) { - _directions.push_back(Vec2d(cos((float)i * M_PI / (float)_nbOrientations), - sin((float)i * M_PI / (float)_nbOrientations))); + _directions.emplace_back(cos((float)i * M_PI / (float)_nbOrientations), + sin((float)i * M_PI / (float)_nbOrientations)); } Build(); } @@ -88,7 +88,7 @@ void SteerableViewMap::Clear() } } delete[] _imagesPyramids; - _imagesPyramids = 0; + _imagesPyramids = nullptr; } if (!_mapping.empty()) { for (map<unsigned int, double *>::iterator m = _mapping.begin(), mend = _mapping.end(); @@ -240,7 +240,7 @@ unsigned int SteerableViewMap::getNumberOfPyramidLevels() const void SteerableViewMap::saveSteerableViewMap() const { for (unsigned int i = 0; i <= _nbOrientations; ++i) { - if (_imagesPyramids[i] == 0) { + if (_imagesPyramids[i] == nullptr) { cerr << "SteerableViewMap warning: orientation " << i << " of steerable View Map whas not been computed yet" << endl; continue; diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp index 8866ec2e267..8d5955fc0ae 100644 --- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp @@ -33,13 +33,13 @@ namespace Freestyle { void ViewEdgeXBuilder::Init(ViewShape *oVShape) { - if (NULL == oVShape) { + if (nullptr == oVShape) { return; } // for design convenience, we store the current SShape. _pCurrentSShape = oVShape->sshape(); - if (0 == _pCurrentSShape) { + if (nullptr == _pCurrentSShape) { return; } @@ -164,7 +164,7 @@ ViewEdge *ViewEdgeXBuilder::BuildSmoothViewEdge(const OWXFaceLayer &iFaceLayer) if (iFaceLayer.fl->nature() & Nature::RIDGE) { if (size < 4) { - return 0; + return nullptr; } } @@ -176,9 +176,9 @@ ViewEdge *ViewEdgeXBuilder::BuildSmoothViewEdge(const OWXFaceLayer &iFaceLayer) _pCurrentVShape->AddEdge(newVEdge); // build FEdges - FEdge *feprevious = NULL; - FEdge *fefirst = NULL; - FEdge *fe = NULL; + FEdge *feprevious = nullptr; + FEdge *fefirst = nullptr; + FEdge *fe = nullptr; for (list<OWXFaceLayer>::iterator fl = facesChain.begin(), flend = facesChain.end(); fl != flend; ++fl) { fe = BuildSmoothFEdge(feprevious, (*fl)); @@ -201,8 +201,8 @@ ViewEdge *ViewEdgeXBuilder::BuildSmoothViewEdge(const OWXFaceLayer &iFaceLayer) if ((first == end) && (size != 1)) { fefirst->setPreviousEdge(fe); fe->setNextEdge(fefirst); - newVEdge->setA(0); - newVEdge->setB(0); + newVEdge->setA(nullptr); + newVEdge->setB(nullptr); } else { ViewVertex *vva = MakeViewVertex(fefirst->vertexA()); @@ -262,9 +262,9 @@ ViewEdge *ViewEdgeXBuilder::BuildSharpViewEdge(const OWXEdge &iWEdge) firstWEdge = edgesChain.front(); // build FEdges - FEdge *feprevious = NULL; - FEdge *fefirst = NULL; - FEdge *fe = NULL; + FEdge *feprevious = nullptr; + FEdge *fefirst = nullptr; + FEdge *fe = nullptr; for (list<OWXEdge>::iterator we = edgesChain.begin(), weend = edgesChain.end(); we != weend; ++we) { fe = BuildSharpFEdge(feprevious, (*we)); @@ -284,8 +284,8 @@ ViewEdge *ViewEdgeXBuilder::BuildSharpViewEdge(const OWXEdge &iWEdge) if ((firstWEdge == endWEdge) && (size != 1)) { fefirst->setPreviousEdge(fe); fe->setNextEdge(fefirst); - newVEdge->setA(0); - newVEdge->setB(0); + newVEdge->setA(nullptr); + newVEdge->setB(nullptr); } else { ViewVertex *vva = MakeViewVertex(fefirst->vertexA()); @@ -303,7 +303,7 @@ ViewEdge *ViewEdgeXBuilder::BuildSharpViewEdge(const OWXEdge &iWEdge) OWXFaceLayer ViewEdgeXBuilder::FindNextFaceLayer(const OWXFaceLayer &iFaceLayer) { - WXFace *nextFace = NULL; + WXFace *nextFace = nullptr; WOEdge *woeend; real tend; if (iFaceLayer.order) { @@ -324,14 +324,14 @@ OWXFaceLayer ViewEdgeXBuilder::FindNextFaceLayer(const OWXFaceLayer &iFaceLayer) nextVertex = woeend->GetbVertex(); } if (nextVertex->isBoundary()) { // if it's a non-manifold vertex -> ignore - return OWXFaceLayer(0, true); + return OWXFaceLayer(nullptr, true); } bool found = false; WVertex::face_iterator f = nextVertex->faces_begin(); WVertex::face_iterator fend = nextVertex->faces_end(); while ((!found) && (f != fend)) { nextFace = dynamic_cast<WXFace *>(*f); - if ((0 != nextFace) && (nextFace != iFaceLayer.fl->getFace())) { + if ((nullptr != nextFace) && (nextFace != iFaceLayer.fl->getFace())) { vector<WXFaceLayer *> sameNatureLayers; nextFace->retrieveSmoothEdgesLayers(iFaceLayer.fl->nature(), sameNatureLayers); // don't know... Maybe should test whether this face has also a vertex_edge configuration. @@ -339,7 +339,7 @@ OWXFaceLayer ViewEdgeXBuilder::FindNextFaceLayer(const OWXFaceLayer &iFaceLayer) WXFaceLayer *winner = sameNatureLayers[0]; // check face mark continuity if (winner->getFace()->GetMark() != iFaceLayer.fl->getFace()->GetMark()) { - return OWXFaceLayer(NULL, true); + return OWXFaceLayer(nullptr, true); } if (woeend == winner->getSmoothEdge()->woea()->twin()) { return OWXFaceLayer(winner, true); @@ -354,24 +354,24 @@ OWXFaceLayer ViewEdgeXBuilder::FindNextFaceLayer(const OWXFaceLayer &iFaceLayer) else { nextFace = dynamic_cast<WXFace *>(iFaceLayer.fl->getFace()->GetBordingFace(woeend)); if (!nextFace) { - return OWXFaceLayer(NULL, true); + return OWXFaceLayer(nullptr, true); } // if the next face layer has either no smooth edge or no smooth edge of same nature, no next // face if (!nextFace->hasSmoothEdges()) { - return OWXFaceLayer(NULL, true); + return OWXFaceLayer(nullptr, true); } vector<WXFaceLayer *> sameNatureLayers; nextFace->retrieveSmoothEdgesLayers(iFaceLayer.fl->nature(), sameNatureLayers); // don't know how to deal with several edges of same nature on a single face if ((sameNatureLayers.empty()) || (sameNatureLayers.size() != 1)) { - return OWXFaceLayer(NULL, true); + return OWXFaceLayer(nullptr, true); } WXFaceLayer *winner = sameNatureLayers[0]; // check face mark continuity if (winner->getFace()->GetMark() != iFaceLayer.fl->getFace()->GetMark()) { - return OWXFaceLayer(NULL, true); + return OWXFaceLayer(nullptr, true); } if (woeend == winner->getSmoothEdge()->woea()->twin()) { return OWXFaceLayer(winner, true); @@ -379,12 +379,12 @@ OWXFaceLayer ViewEdgeXBuilder::FindNextFaceLayer(const OWXFaceLayer &iFaceLayer) return OWXFaceLayer(winner, false); } - return OWXFaceLayer(NULL, true); + return OWXFaceLayer(nullptr, true); } OWXFaceLayer ViewEdgeXBuilder::FindPreviousFaceLayer(const OWXFaceLayer &iFaceLayer) { - WXFace *previousFace = NULL; + WXFace *previousFace = nullptr; WOEdge *woebegin; real tend; if (iFaceLayer.order) { @@ -406,14 +406,14 @@ OWXFaceLayer ViewEdgeXBuilder::FindPreviousFaceLayer(const OWXFaceLayer &iFaceLa previousVertex = woebegin->GetbVertex(); } if (previousVertex->isBoundary()) { // if it's a non-manifold vertex -> ignore - return OWXFaceLayer(NULL, true); + return OWXFaceLayer(nullptr, true); } bool found = false; WVertex::face_iterator f = previousVertex->faces_begin(); WVertex::face_iterator fend = previousVertex->faces_end(); for (; (!found) && (f != fend); ++f) { previousFace = dynamic_cast<WXFace *>(*f); - if ((0 != previousFace) && (previousFace != iFaceLayer.fl->getFace())) { + if ((nullptr != previousFace) && (previousFace != iFaceLayer.fl->getFace())) { vector<WXFaceLayer *> sameNatureLayers; previousFace->retrieveSmoothEdgesLayers(iFaceLayer.fl->nature(), sameNatureLayers); // don't know... Maybe should test whether this face has also a vertex_edge configuration @@ -421,7 +421,7 @@ OWXFaceLayer ViewEdgeXBuilder::FindPreviousFaceLayer(const OWXFaceLayer &iFaceLa WXFaceLayer *winner = sameNatureLayers[0]; // check face mark continuity if (winner->getFace()->GetMark() != iFaceLayer.fl->getFace()->GetMark()) { - return OWXFaceLayer(NULL, true); + return OWXFaceLayer(nullptr, true); } if (woebegin == winner->getSmoothEdge()->woeb()->twin()) { return OWXFaceLayer(winner, true); @@ -434,25 +434,25 @@ OWXFaceLayer ViewEdgeXBuilder::FindPreviousFaceLayer(const OWXFaceLayer &iFaceLa } else { previousFace = dynamic_cast<WXFace *>(iFaceLayer.fl->getFace()->GetBordingFace(woebegin)); - if (0 == previousFace) { - return OWXFaceLayer(NULL, true); + if (nullptr == previousFace) { + return OWXFaceLayer(nullptr, true); } // if the next face layer has either no smooth edge or no smooth edge of same nature, no next // face if (!previousFace->hasSmoothEdges()) { - return OWXFaceLayer(NULL, true); + return OWXFaceLayer(nullptr, true); } vector<WXFaceLayer *> sameNatureLayers; previousFace->retrieveSmoothEdgesLayers(iFaceLayer.fl->nature(), sameNatureLayers); // don't know how to deal with several edges of same nature on a single face if ((sameNatureLayers.empty()) || (sameNatureLayers.size() != 1)) { - return OWXFaceLayer(NULL, true); + return OWXFaceLayer(nullptr, true); } WXFaceLayer *winner = sameNatureLayers[0]; // check face mark continuity if (winner->getFace()->GetMark() != iFaceLayer.fl->getFace()->GetMark()) { - return OWXFaceLayer(NULL, true); + return OWXFaceLayer(nullptr, true); } if (woebegin == winner->getSmoothEdge()->woeb()->twin()) { return OWXFaceLayer(winner, true); @@ -460,7 +460,7 @@ OWXFaceLayer ViewEdgeXBuilder::FindPreviousFaceLayer(const OWXFaceLayer &iFaceLa return OWXFaceLayer(winner, false); } - return OWXFaceLayer(NULL, true); + return OWXFaceLayer(nullptr, true); } FEdge *ViewEdgeXBuilder::BuildSmoothFEdge(FEdge *feprevious, const OWXFaceLayer &ifl) @@ -487,7 +487,8 @@ FEdge *ViewEdgeXBuilder::BuildSmoothFEdge(FEdge *feprevious, const OWXFaceLayer Vec3r normal; // Make the 2 Svertices - if (feprevious == 0) { // that means that we don't have any vertex already built for that face + if (feprevious == + nullptr) { // that means that we don't have any vertex already built for that face Vec3r A1(woea->GetaVertex()->GetVertex()); Vec3r A2(woea->GetbVertex()->GetVertex()); Vec3r A(A1 + ta * (A2 - A1)); @@ -543,7 +544,7 @@ FEdge *ViewEdgeXBuilder::BuildSmoothFEdge(FEdge *feprevious, const OWXFaceLayer fe->setFrsMaterialIndex(ifl.fl->getFace()->frs_materialIndex()); fe->setFace(ifl.fl->getFace()); fe->setFaceMark(ifl.fl->getFace()->GetMark()); - if (feprevious == 0) { + if (feprevious == nullptr) { normal.normalize(); } fe->setNormal(normal); @@ -562,10 +563,10 @@ FEdge *ViewEdgeXBuilder::BuildSmoothFEdge(FEdge *feprevious, const OWXFaceLayer bool ViewEdgeXBuilder::stopSmoothViewEdge(WXFaceLayer *iFaceLayer) { - if (NULL == iFaceLayer) { + if (nullptr == iFaceLayer) { return true; } - if (iFaceLayer->userdata == 0) { + if (iFaceLayer->userdata == nullptr) { return false; } return true; @@ -588,7 +589,7 @@ int ViewEdgeXBuilder::retrieveFaceMarks(WXEdge *iEdge) OWXEdge ViewEdgeXBuilder::FindNextWEdge(const OWXEdge &iEdge) { if (Nature::NO_FEATURE == iEdge.e->nature()) { - return OWXEdge(NULL, true); + return OWXEdge(nullptr, true); } WVertex *v; @@ -600,7 +601,7 @@ OWXEdge ViewEdgeXBuilder::FindNextWEdge(const OWXEdge &iEdge) } if (((WXVertex *)v)->isFeature()) { - return 0; /* XXX eeek? NULL? OWXEdge(NULL, true/false)?*/ + return nullptr; /* XXX eeek? NULL? OWXEdge(NULL, true/false)?*/ } int faceMarks = retrieveFaceMarks(iEdge.e); @@ -631,13 +632,13 @@ OWXEdge ViewEdgeXBuilder::FindNextWEdge(const OWXEdge &iEdge) return OWXEdge(wxe, false); } // we did not find: - return OWXEdge(NULL, true); + return OWXEdge(nullptr, true); } OWXEdge ViewEdgeXBuilder::FindPreviousWEdge(const OWXEdge &iEdge) { if (Nature::NO_FEATURE == iEdge.e->nature()) { - return OWXEdge(NULL, true); + return OWXEdge(nullptr, true); } WVertex *v; @@ -649,7 +650,7 @@ OWXEdge ViewEdgeXBuilder::FindPreviousWEdge(const OWXEdge &iEdge) } if (((WXVertex *)v)->isFeature()) { - return 0; + return nullptr; } int faceMarks = retrieveFaceMarks(iEdge.e); @@ -676,7 +677,7 @@ OWXEdge ViewEdgeXBuilder::FindPreviousWEdge(const OWXEdge &iEdge) return OWXEdge(wxe, false); } // we did not find: - return OWXEdge(NULL, true); + return OWXEdge(nullptr, true); } FEdge *ViewEdgeXBuilder::BuildSharpFEdge(FEdge *feprevious, const OWXEdge &iwe) @@ -750,10 +751,10 @@ FEdge *ViewEdgeXBuilder::BuildSharpFEdge(FEdge *feprevious, const OWXEdge &iwe) bool ViewEdgeXBuilder::stopSharpViewEdge(WXEdge *iEdge) { - if (NULL == iEdge) { + if (nullptr == iEdge) { return true; } - if (iEdge->userdata == 0) { + if (iEdge->userdata == nullptr) { return false; } return true; diff --git a/source/blender/freestyle/intern/view_map/ViewMap.cpp b/source/blender/freestyle/intern/view_map/ViewMap.cpp index b4faee7946b..60d0e45b9fb 100644 --- a/source/blender/freestyle/intern/view_map/ViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMap.cpp @@ -37,7 +37,7 @@ namespace Freestyle { /* */ /**********************************/ -ViewMap *ViewMap::_pInstance = NULL; +ViewMap *ViewMap::_pInstance = nullptr; ViewMap::~ViewMap() { @@ -103,7 +103,7 @@ const FEdge *ViewMap::getClosestFEdge(real x, real y) const { // find the closest of this candidates: real minDist = DBL_MAX; - FEdge *winner = NULL; + FEdge *winner = nullptr; for (fedges_container::const_iterator fe = _FEdges.begin(), feend = _FEdges.end(); fe != feend; fe++) { Vec2d A((*fe)->vertexA()->point2D()[0], (*fe)->vertexA()->point2D()[1]); @@ -122,7 +122,7 @@ const ViewEdge *ViewMap::getClosestViewEdge(real x, real y) const { // find the closest of this candidates: real minDist = DBL_MAX; - FEdge *winner = NULL; + FEdge *winner = nullptr; for (fedges_container::const_iterator fe = _FEdges.begin(), feend = _FEdges.end(); fe != feend; fe++) { Vec2d A((*fe)->vertexA()->point2D()[0], (*fe)->vertexA()->point2D()[1]); @@ -134,7 +134,7 @@ const ViewEdge *ViewMap::getClosestViewEdge(real x, real y) const } } if (!winner) { - return NULL; + return nullptr; } return winner->viewedge(); @@ -194,9 +194,9 @@ ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge *> &newV const vector<FEdge *> &fedges = iVertex->fedges(); if (fedges.size() != 2) { cerr << "ViewMap warning: Can't split the ViewEdge" << endl; - return NULL; + return nullptr; } - FEdge *fend(NULL), *fbegin(NULL); + FEdge *fend(nullptr), *fbegin(nullptr); for (vector<FEdge *>::const_iterator fe = fedges.begin(), feend = fedges.end(); fe != feend; ++fe) { if ((*fe)->vertexB() == iVertex) { @@ -205,7 +205,7 @@ ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge *> &newV if ((*fe)->vertexA() == iVertex) { fbegin = (*fe); } - if ((fbegin != NULL) && (fend != NULL)) { + if ((fbegin != nullptr) && (fend != nullptr)) { break; } } @@ -213,7 +213,7 @@ ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge *> &newV ViewShape *vshape = ioEdge->viewShape(); vva = new NonTVertex(iVertex); // if the ViewEdge is a closed loop, we don't create a new VEdge - if (ioEdge->A() == 0) { + if (ioEdge->A() == nullptr) { // closed loop ioEdge->setA(vva); ioEdge->setB(vva); @@ -225,8 +225,8 @@ ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge *> &newV ioEdge->setFEdgeB(fend); // Update FEdges - fend->setNextEdge(NULL); - fbegin->setPreviousEdge(NULL); + fend->setNextEdge(nullptr); + fbegin->setPreviousEdge(nullptr); // update new View Vertex: vva->AddOutgoingViewEdge(ioEdge); @@ -246,8 +246,8 @@ ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge *> &newV ioEdge->setFEdgeB(fend); // Update FEdges - fend->setNextEdge(NULL); - fbegin->setPreviousEdge(NULL); + fend->setNextEdge(nullptr); + fbegin->setPreviousEdge(nullptr); // update new View Vertex: vva->AddOutgoingViewEdge(newVEdge); @@ -711,56 +711,56 @@ ViewEdge::const_fedge_iterator ViewEdge::fedge_iterator_last() const ViewEdge::fedge_iterator ViewEdge::fedge_iterator_end() { - return fedge_iterator(0, this->_FEdgeB); + return fedge_iterator(nullptr, this->_FEdgeB); } ViewEdge::const_fedge_iterator ViewEdge::fedge_iterator_end() const { - return const_fedge_iterator(0, this->_FEdgeB); + return const_fedge_iterator(nullptr, this->_FEdgeB); } //! embedding vertex iterator ViewEdge::const_vertex_iterator ViewEdge::vertices_begin() const { - return const_vertex_iterator(this->_FEdgeA->vertexA(), 0, _FEdgeA); + return const_vertex_iterator(this->_FEdgeA->vertexA(), nullptr, _FEdgeA); } ViewEdge::vertex_iterator ViewEdge::vertices_begin() { - return vertex_iterator(this->_FEdgeA->vertexA(), 0, _FEdgeA); + return vertex_iterator(this->_FEdgeA->vertexA(), nullptr, _FEdgeA); } ViewEdge::const_vertex_iterator ViewEdge::vertices_last() const { - return const_vertex_iterator(this->_FEdgeB->vertexB(), _FEdgeB, 0); + return const_vertex_iterator(this->_FEdgeB->vertexB(), _FEdgeB, nullptr); } ViewEdge::vertex_iterator ViewEdge::vertices_last() { - return vertex_iterator(this->_FEdgeB->vertexB(), _FEdgeB, 0); + return vertex_iterator(this->_FEdgeB->vertexB(), _FEdgeB, nullptr); } ViewEdge::const_vertex_iterator ViewEdge::vertices_end() const { - return const_vertex_iterator(0, _FEdgeB, 0); + return const_vertex_iterator(nullptr, _FEdgeB, nullptr); } ViewEdge::vertex_iterator ViewEdge::vertices_end() { - return vertex_iterator(0, _FEdgeB, 0); + return vertex_iterator(nullptr, _FEdgeB, nullptr); } Interface0DIterator ViewEdge::verticesBegin() { Interface0DIterator ret(new ViewEdgeInternal::SVertexIterator( - this->_FEdgeA->vertexA(), this->_FEdgeA->vertexA(), NULL, _FEdgeA, 0.0f)); + this->_FEdgeA->vertexA(), this->_FEdgeA->vertexA(), nullptr, _FEdgeA, 0.0f)); return ret; } Interface0DIterator ViewEdge::verticesEnd() { Interface0DIterator ret(new ViewEdgeInternal::SVertexIterator( - NULL, this->_FEdgeA->vertexA(), _FEdgeB, NULL, getLength2D())); + nullptr, this->_FEdgeA->vertexA(), _FEdgeB, nullptr, getLength2D())); return ret; } @@ -795,7 +795,7 @@ ViewShape::~ViewShape() if (_SShape) { delete _SShape; - _SShape = NULL; + _SShape = nullptr; } } diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp index 2ef01ce0874..de30ee0460a 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp @@ -61,7 +61,7 @@ static void findOccludee(FEdge *fe, Vec3r &edgeDir, vector<WVertex *> &faceVertices) { - WFace *face = NULL; + WFace *face = nullptr; if (fe->isSmooth()) { FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth *>(fe); face = (WFace *)fes->face(); @@ -71,7 +71,7 @@ static void findOccludee(FEdge *fe, WVertex::incoming_edge_iterator ie; - *oaWFace = NULL; + *oaWFace = nullptr; if (((fe)->getNature() & Nature::SILHOUETTE) || ((fe)->getNature() & Nature::BORDER)) { // we cast a ray from A in the same direction but looking behind Vec3r v(-u[0], -u[1], -u[2]); @@ -90,7 +90,7 @@ static void findOccludee(FEdge *fe, real d = -((p->getVertices())[0] * p->getNormal()); real t, t_u, t_v; - if (0 != face) { + if (nullptr != face) { skipFace = false; if (face == oface) { @@ -110,7 +110,7 @@ static void findOccludee(FEdge *fe, WVertex::incoming_edge_iterator iebegin = (*fv)->incoming_edges_begin(); WVertex::incoming_edge_iterator ieend = (*fv)->incoming_edges_end(); for (ie = iebegin; ie != ieend; ++ie) { - if ((*ie) == 0) { + if ((*ie) == nullptr) { continue; } @@ -172,7 +172,7 @@ static void findOccludee(FEdge *fe, } if (noIntersection) { - *oaWFace = NULL; + *oaWFace = nullptr; } } } @@ -198,7 +198,7 @@ static void findOccludee(FEdge *fe, G &grid, real epsilon, ViewEdge * /*ve*/, WF vector<WVertex *> faceVertices; - WFace *face = NULL; + WFace *face = nullptr; if (fe->isSmooth()) { FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth *>(fe); face = (WFace *)fes->face(); @@ -245,7 +245,7 @@ static int computeVisibility(ViewMap *viewMap, real raylength = u.norm(); u.normalize(); - WFace *face = NULL; + WFace *face = nullptr; if (fe->isSmooth()) { FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth *>(fe); face = (WFace *)fes->face(); @@ -330,7 +330,7 @@ static int computeVisibility(ViewMap *viewMap, WVertex::incoming_edge_iterator iebegin = (*fv)->incoming_edges_begin(); WVertex::incoming_edge_iterator ieend = (*fv)->incoming_edges_end(); for (ie = iebegin; ie != ieend; ++ie) { - if ((*ie) == 0) { + if ((*ie) == nullptr) { continue; } @@ -400,7 +400,7 @@ static int computeVisibility(ViewMap *viewMap, cout << "\t\tIs occluder" << endl; } #endif - if (foundOccluders != NULL) { + if (foundOccluders != nullptr) { ViewShape *vshape = viewMap->viewShape(oface->GetVertex(0)->shape()->GetId()); foundOccluders->insert(vshape); } @@ -443,7 +443,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, FEdge *fe, *festart; int nSamples = 0; vector<WFace *> wFaces; - WFace *wFace = NULL; + WFace *wFace = nullptr; unsigned cnt = 0; unsigned cntStep = (unsigned)ceil(0.01f * vedges.size()); unsigned tmpQI = 0; @@ -472,7 +472,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, if (!(*ve)->isInImage()) { // This view edge has been proscenium culled (*ve)->setQI(255); - (*ve)->setaShape(0); + (*ve)->setaShape(nullptr); #if LOGGING if (_global.debug & G_DEBUG_FREESTYLE) { cout << "\tCulled." << endl; @@ -486,7 +486,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, fe = (*ve)->fedgeA(); qiMajority = 0; do { - if (fe != NULL && fe->isInImage()) { + if (fe != nullptr && fe->isInImage()) { qiMajority++; } fe = fe->nextEdge(); @@ -501,7 +501,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, // We can recover from this error: // Treat this edge as fully visible with no occludee (*ve)->setQI(0); - (*ve)->setaShape(0); + (*ve)->setaShape(nullptr); continue; } @@ -566,7 +566,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, if (wFace) { vector<Vec3r> vertices; for (int i = 0, numEdges = wFace->numberOfEdges(); i < numEdges; ++i) { - vertices.push_back(Vec3r(wFace->GetVertex(i)->GetVertex())); + vertices.emplace_back(wFace->GetVertex(i)->GetVertex()); } Polygon3r poly(vertices, wFace->GetNormal()); poly.userdata = (void *)wFace; @@ -622,7 +622,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, // occludee -- if (!wFaces.empty()) { if (wFaces.size() <= (float)nSamples / 2.0f) { - (*ve)->setaShape(0); + (*ve)->setaShape(nullptr); } else { ViewShape *vshape = ioViewMap->viewShape( @@ -652,7 +652,7 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, FEdge *fe, *festart; int nSamples = 0; vector<WFace *> wFaces; - WFace *wFace = NULL; + WFace *wFace = nullptr; unsigned tmpQI = 0; unsigned qiClasses[256]; unsigned maxIndex, maxCard; @@ -670,7 +670,7 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, if (!(*ve)->isInImage()) { // This view edge has been proscenium culled (*ve)->setQI(255); - (*ve)->setaShape(0); + (*ve)->setaShape(nullptr); #if LOGGING if (_global.debug & G_DEBUG_FREESTYLE) { cout << "\tCulled." << endl; @@ -684,7 +684,7 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, fe = (*ve)->fedgeA(); qiMajority = 0; do { - if (fe != NULL && fe->isInImage()) { + if (fe != nullptr && fe->isInImage()) { qiMajority++; } fe = fe->nextEdge(); @@ -699,7 +699,7 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, // We can recover from this error: // Treat this edge as fully visible with no occludee (*ve)->setQI(0); - (*ve)->setaShape(0); + (*ve)->setaShape(nullptr); continue; } @@ -721,7 +721,7 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, fe = (*ve)->fedgeA(); do { - if (fe == NULL || !fe->isInImage()) { + if (fe == nullptr || !fe->isInImage()) { fe = fe->nextEdge(); continue; } @@ -764,7 +764,7 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, if (wFace) { vector<Vec3r> vertices; for (int i = 0, numEdges = wFace->numberOfEdges(); i < numEdges; ++i) { - vertices.push_back(Vec3r(wFace->GetVertex(i)->GetVertex())); + vertices.emplace_back(wFace->GetVertex(i)->GetVertex()); } Polygon3r poly(vertices, wFace->GetNormal()); poly.userdata = (void *)wFace; @@ -811,7 +811,7 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, // occludee -- if (!wFaces.empty()) { if (wFaces.size() <= (float)nSamples / 2.0f) { - (*ve)->setaShape(0); + (*ve)->setaShape(nullptr); } else { ViewShape *vshape = ioViewMap->viewShape( @@ -832,7 +832,7 @@ static void computeFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) FEdge *fe, *festart; unsigned nSamples = 0; vector<WFace *> wFaces; - WFace *wFace = NULL; + WFace *wFace = nullptr; unsigned tmpQI = 0; unsigned qiClasses[256]; unsigned maxIndex, maxCard; @@ -843,7 +843,7 @@ static void computeFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) if (!(*ve)->isInImage()) { // This view edge has been proscenium culled (*ve)->setQI(255); - (*ve)->setaShape(0); + (*ve)->setaShape(nullptr); continue; } @@ -870,7 +870,7 @@ static void computeFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) // We can recover from this error: // Treat this edge as fully visible with no occludee (*ve)->setQI(0); - (*ve)->setaShape(0); + (*ve)->setaShape(nullptr); continue; } @@ -918,7 +918,7 @@ static void computeFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) if (wFace) { vector<Vec3r> vertices; for (int i = 0, numEdges = wFace->numberOfEdges(); i < numEdges; ++i) { - vertices.push_back(Vec3r(wFace->GetVertex(i)->GetVertex())); + vertices.emplace_back(wFace->GetVertex(i)->GetVertex()); } Polygon3r poly(vertices, wFace->GetNormal()); poly.userdata = (void *)wFace; @@ -945,7 +945,7 @@ static void computeFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) // occludee -- if (!wFaces.empty()) { if (wFaces.size() < nSamples / 2) { - (*ve)->setaShape(0); + (*ve)->setaShape(nullptr); } else { ViewShape *vshape = ioViewMap->viewShape( @@ -965,14 +965,14 @@ static void computeVeryFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) FEdge *fe; unsigned qi = 0; - WFace *wFace = 0; + WFace *wFace = nullptr; for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { // Find an edge to test if (!(*ve)->isInImage()) { // This view edge has been proscenium culled (*ve)->setQI(255); - (*ve)->setaShape(0); + (*ve)->setaShape(nullptr); continue; } fe = (*ve)->fedgeA(); @@ -992,7 +992,7 @@ static void computeVeryFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) // We can recover from this error: // Treat this edge as fully visible with no occludee qi = 0; - wFace = NULL; + wFace = nullptr; } else { qi = computeVisibility<G, I>(ioViewMap, fe, grid, epsilon, *ve, &wFace, NULL); @@ -1002,7 +1002,7 @@ static void computeVeryFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) if (wFace) { vector<Vec3r> vertices; for (int i = 0, numEdges = wFace->numberOfEdges(); i < numEdges; ++i) { - vertices.push_back(Vec3r(wFace->GetVertex(i)->GetVertex())); + vertices.emplace_back(wFace->GetVertex(i)->GetVertex()); } Polygon3r poly(vertices, wFace->GetNormal()); poly.userdata = (void *)wFace; @@ -1011,7 +1011,7 @@ static void computeVeryFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) (*ve)->setaShape(vshape); } else { - (*ve)->setaShape(0); + (*ve)->setaShape(nullptr); } (*ve)->setQI(qi); } @@ -1138,7 +1138,7 @@ void ViewMapBuilder::CullViewEdges(ViewMap *ioViewMap, // For each feature edge, while bestOccluderTarget not found and view edge not visible bool bestOccluderTargetFound = false; - FEdge *bestOccluderTarget = NULL; + FEdge *bestOccluderTarget = nullptr; real bestOccluderDistance = 0.0; FEdge *festart = (*ve)->fedgeA(); FEdge *fe = festart; @@ -1164,7 +1164,7 @@ void ViewMapBuilder::CullViewEdges(ViewMap *ioViewMap, else { real d = distance2D(fe->center2d(), prosceniumOrigin); // If center point is closer to viewport origin than current target - if (bestOccluderTarget == NULL || d < bestOccluderDistance) { + if (bestOccluderTarget == nullptr || d < bestOccluderDistance) { // Then store as bestOccluderTarget bestOccluderDistance = d; bestOccluderTarget = fe; @@ -1189,7 +1189,7 @@ void ViewMapBuilder::CullViewEdges(ViewMap *ioViewMap, // If bestOccluderTarget was not found inside the occluder proscenium, we need to expand the // occluder proscenium to include it. - if ((*ve)->isInImage() && bestOccluderTarget != NULL && !bestOccluderTargetFound) { + if ((*ve)->isInImage() && bestOccluderTarget != nullptr && !bestOccluderTargetFound) { // Expand occluder proscenium to enclose bestOccluderTarget Vec3r point = bestOccluderTarget->center2d(); if (point[0] < occluderProscenium[0]) { @@ -1337,7 +1337,7 @@ void ViewMapBuilder::computeCusps(ViewMap *ioViewMap) first = false; } // If we're in a positive part, we need a stronger negative value to change - NonTVertex *cusp = NULL; + NonTVertex *cusp = nullptr; if (positive) { if (((crossP) * (viewvector)) < -0.1) { // state changes @@ -1381,17 +1381,17 @@ void ViewMapBuilder::ComputeCumulativeVisibility(ViewMap *ioViewMap, AutoPtr<OccluderSource> source; if (_orthographicProjection) { - transform.reset(new BoxGrid::Transform); + transform = std::make_unique<BoxGrid::Transform>(); } else { - transform.reset(new SphericalGrid::Transform); + transform = std::make_unique<SphericalGrid::Transform>(); } if (cull) { - source.reset(new CulledOccluderSource(*transform, we, *ioViewMap, true)); + source = std::make_unique<CulledOccluderSource>(*transform, we, *ioViewMap, true); } else { - source.reset(new OccluderSource(*transform, we)); + source = std::make_unique<OccluderSource>(*transform, we); } AutoPtr<GridDensityProvider> density(factory.newGridDensityProvider(*source, bbox, *transform)); @@ -1419,17 +1419,17 @@ void ViewMapBuilder::ComputeDetailedVisibility(ViewMap *ioViewMap, AutoPtr<OccluderSource> source; if (_orthographicProjection) { - transform.reset(new BoxGrid::Transform); + transform = std::make_unique<BoxGrid::Transform>(); } else { - transform.reset(new SphericalGrid::Transform); + transform = std::make_unique<SphericalGrid::Transform>(); } if (cull) { - source.reset(new CulledOccluderSource(*transform, we, *ioViewMap, true)); + source = std::make_unique<CulledOccluderSource>(*transform, we, *ioViewMap, true); } else { - source.reset(new OccluderSource(*transform, we)); + source = std::make_unique<OccluderSource>(*transform, we); } AutoPtr<GridDensityProvider> density(factory.newGridDensityProvider(*source, bbox, *transform)); @@ -1556,7 +1556,7 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo unsigned vEdgesSize = vedges.size(); unsigned fEdgesSize = ioViewMap->FEdges().size(); - if (_pProgressBar != NULL && fEdgesSize > gProgressBarMinSize) { + if (_pProgressBar != nullptr && fEdgesSize > gProgressBarMinSize) { unsigned progressBarSteps = min(gProgressBarMaxSteps, vEdgesSize); progressBarStep = vEdgesSize / progressBarSteps; _pProgressBar->reset(); @@ -1570,7 +1570,7 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo FEdge *fe, *festart; int nSamples = 0; vector<Polygon3r *> aFaces; - Polygon3r *aFace = NULL; + Polygon3r *aFace = nullptr; unsigned tmpQI = 0; unsigned qiClasses[256]; unsigned maxIndex, maxCard; @@ -1683,7 +1683,7 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo // occludee -- if (!aFaces.empty()) { if (aFaces.size() <= (float)nSamples / 2.0f) { - (*ve)->setaShape(0); + (*ve)->setaShape(nullptr); } else { vector<Polygon3r *>::iterator p = aFaces.begin(); @@ -1713,7 +1713,7 @@ void ViewMapBuilder::ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real ep unsigned vEdgesSize = vedges.size(); unsigned fEdgesSize = ioViewMap->FEdges().size(); - if (_pProgressBar != NULL && fEdgesSize > gProgressBarMinSize) { + if (_pProgressBar != nullptr && fEdgesSize > gProgressBarMinSize) { unsigned progressBarSteps = min(gProgressBarMaxSteps, vEdgesSize); progressBarStep = vEdgesSize / progressBarSteps; _pProgressBar->reset(); @@ -1727,7 +1727,7 @@ void ViewMapBuilder::ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real ep FEdge *fe, *festart; unsigned nSamples = 0; vector<Polygon3r *> aFaces; - Polygon3r *aFace = NULL; + Polygon3r *aFace = nullptr; unsigned tmpQI = 0; unsigned qiClasses[256]; unsigned maxIndex, maxCard; @@ -1801,7 +1801,7 @@ void ViewMapBuilder::ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real ep if (!aFaces.empty()) { if (aFaces.size() < nSamples / 2) { - (*ve)->setaShape(0); + (*ve)->setaShape(nullptr); } else { vector<Polygon3r *>::iterator p = aFaces.begin(); @@ -1846,7 +1846,7 @@ void ViewMapBuilder::ComputeVeryFastRayCastingVisibility(ViewMap *ioViewMap, rea unsigned vEdgesSize = vedges.size(); unsigned fEdgesSize = ioViewMap->FEdges().size(); - if (_pProgressBar != NULL && fEdgesSize > gProgressBarMinSize) { + if (_pProgressBar != nullptr && fEdgesSize > gProgressBarMinSize) { unsigned progressBarSteps = min(gProgressBarMaxSteps, vEdgesSize); progressBarStep = vEdgesSize / progressBarSteps; _pProgressBar->reset(); @@ -1859,7 +1859,7 @@ void ViewMapBuilder::ComputeVeryFastRayCastingVisibility(ViewMap *ioViewMap, rea unsigned counter = progressBarStep; FEdge *fe; unsigned qi = 0; - Polygon3r *aFace = NULL; + Polygon3r *aFace = nullptr; static unsigned timestamp = 1; for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { if (_pRenderMonitor && _pRenderMonitor->testBreak()) { @@ -1877,7 +1877,7 @@ void ViewMapBuilder::ComputeVeryFastRayCastingVisibility(ViewMap *ioViewMap, rea (*ve)->setaShape(vshape); } else { - (*ve)->setaShape(0); + (*ve)->setaShape(nullptr); } (*ve)->setQI(qi); @@ -1903,7 +1903,7 @@ void ViewMapBuilder::FindOccludee(FEdge *fe, Vec3r &edgeDir, vector<WVertex *> &faceVertices) { - WFace *face = NULL; + WFace *face = nullptr; if (fe->isSmooth()) { FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth *>(fe); face = (WFace *)fes->face(); @@ -1915,7 +1915,7 @@ void ViewMapBuilder::FindOccludee(FEdge *fe, WVertex::incoming_edge_iterator ie; OccludersSet::iterator p, pend; - *oaPolygon = NULL; + *oaPolygon = nullptr; if (((fe)->getNature() & Nature::SILHOUETTE) || ((fe)->getNature() & Nature::BORDER)) { occluders.clear(); // we cast a ray from A in the same direction but looking behind @@ -1955,7 +1955,7 @@ void ViewMapBuilder::FindOccludee(FEdge *fe, WVertex::incoming_edge_iterator iebegin = (*fv)->incoming_edges_begin(); WVertex::incoming_edge_iterator ieend = (*fv)->incoming_edges_end(); for (ie = iebegin; ie != ieend; ++ie) { - if ((*ie) == 0) { + if ((*ie) == nullptr) { continue; } @@ -1994,7 +1994,7 @@ void ViewMapBuilder::FindOccludee(FEdge *fe, } if (noIntersection) { - *oaPolygon = NULL; + *oaPolygon = nullptr; } } } @@ -2026,7 +2026,7 @@ void ViewMapBuilder::FindOccludee( vector<WVertex *> faceVertices; - WFace *face = NULL; + WFace *face = nullptr; if (fe->isSmooth()) { FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth *>(fe); face = (WFace *)fes->face(); @@ -2101,7 +2101,7 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, iGrid->castRay(center, vp, occluders, timestamp); - WFace *face = NULL; + WFace *face = nullptr; if (fe->isSmooth()) { FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth *>(fe); face = (WFace *)fes->face(); @@ -2168,7 +2168,7 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, WVertex::incoming_edge_iterator iebegin = (*fv)->incoming_edges_begin(); WVertex::incoming_edge_iterator ieend = (*fv)->incoming_edges_end(); for (ie = iebegin; ie != ieend; ++ie) { - if ((*ie) == 0) { + if ((*ie) == nullptr) { continue; } @@ -2358,7 +2358,7 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi #endif unsigned progressBarStep = 0; - if (_pProgressBar != NULL && fEdgesSize > gProgressBarMinSize) { + if (_pProgressBar != nullptr && fEdgesSize > gProgressBarMinSize) { unsigned progressBarSteps = min(gProgressBarMaxSteps, sVerticesSize); progressBarStep = sVerticesSize / progressBarSteps; _pProgressBar->reset(); @@ -2428,7 +2428,7 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi // reset userdata: for (fe = ioEdges.begin(), fend = ioEdges.end(); fe != fend; fe++) { - (*fe)->userdata = NULL; + (*fe)->userdata = nullptr; } // list containing the new edges resulting from splitting operations. @@ -2561,7 +2561,7 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi // reset userdata: for (fe = ioEdges.begin(), fend = ioEdges.end(); fe != fend; fe++) { - (*fe)->userdata = NULL; + (*fe)->userdata = nullptr; } // delete segments diff --git a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp index 3cbf42ed388..aed5d6b5adc 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp @@ -50,9 +50,7 @@ } \ (void)0 -namespace Freestyle { - -namespace ViewMapIO { +namespace Freestyle::ViewMapIO { namespace Internal { @@ -228,8 +226,8 @@ static int load(istream &in, FEdge *fe) bool b; - FEdgeSmooth *fesmooth = NULL; - FEdgeSharp *fesharp = NULL; + FEdgeSmooth *fesmooth = nullptr; + FEdgeSharp *fesharp = nullptr; if (fe->isSmooth()) { fesmooth = dynamic_cast<FEdgeSmooth *>(fe); } @@ -1239,25 +1237,25 @@ int save(ostream &out, ViewMap *vm, ProgressBar *pb) for (vector<ViewShape *>::const_iterator j0 = vm->ViewShapes().begin(); j0 != vm->ViewShapes().end(); j0++) { - (*j0)->userdata = NULL; - (*j0)->sshape()->userdata = NULL; + (*j0)->userdata = nullptr; + (*j0)->sshape()->userdata = nullptr; } for (vector<FEdge *>::const_iterator j1 = vm->FEdges().begin(); j1 != vm->FEdges().end(); j1++) { - (*j1)->userdata = NULL; + (*j1)->userdata = nullptr; } for (vector<SVertex *>::const_iterator j2 = vm->SVertices().begin(); j2 != vm->SVertices().end(); j2++) { - (*j2)->userdata = NULL; + (*j2)->userdata = nullptr; } for (vector<ViewEdge *>::const_iterator j3 = vm->ViewEdges().begin(); j3 != vm->ViewEdges().end(); j3++) { - (*j3)->userdata = NULL; + (*j3)->userdata = nullptr; } for (vector<ViewVertex *>::const_iterator j4 = vm->ViewVertices().begin(); j4 != vm->ViewVertices().end(); j4++) { - (*j4)->userdata = NULL; + (*j4)->userdata = nullptr; } SET_PROGRESS(6); @@ -1307,6 +1305,4 @@ string getModelsPath() } // namespace Options -} // End of namespace ViewMapIO - -} /* namespace Freestyle */ +} // namespace Freestyle::ViewMapIO diff --git a/source/blender/freestyle/intern/view_map/ViewMapTesselator.cpp b/source/blender/freestyle/intern/view_map/ViewMapTesselator.cpp index a1f76c120fb..9b87bf762fa 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapTesselator.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapTesselator.cpp @@ -26,7 +26,7 @@ namespace Freestyle { NodeGroup *ViewMapTesselator::Tesselate(ViewMap *iViewMap) { if (iViewMap->ViewEdges().empty()) { - return NULL; + return nullptr; } const vector<ViewEdge *> &viewedges = iViewMap->ViewEdges(); @@ -35,7 +35,7 @@ NodeGroup *ViewMapTesselator::Tesselate(ViewMap *iViewMap) NodeGroup *ViewMapTesselator::Tesselate(WShape *UNUSED(iWShape)) { - return NULL; + return nullptr; } } /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.cpp b/source/blender/freestyle/intern/winged_edge/WEdge.cpp index c8805c144e3..0811fe336b7 100644 --- a/source/blender/freestyle/intern/winged_edge/WEdge.cpp +++ b/source/blender/freestyle/intern/winged_edge/WEdge.cpp @@ -63,7 +63,7 @@ WVertex::WVertex(WVertex &iBrother) _Shape = iBrother._Shape; _Smooth = iBrother._Smooth; _Border = iBrother._Border; - userdata = NULL; + userdata = nullptr; iBrother.userdata = new vertexdata; ((vertexdata *)(iBrother.userdata))->_copy = this; } @@ -84,12 +84,12 @@ void WVertex::incoming_edge_iterator::increment() WOEdge *twin = _current->twin(); if (!twin) { // we reached a hole - _current = 0; + _current = nullptr; return; } WOEdge *next = twin->getPrevOnFace(); if (next == _begin) { - next = NULL; + next = nullptr; } _current = next; } @@ -98,7 +98,7 @@ WFace *WVertex::face_iterator::operator*() { WOEdge *woedge = *_edge_it; if (!woedge) { - return NULL; + return nullptr; } return (woedge)->GetbFace(); } @@ -163,7 +163,7 @@ WVertex::incoming_edge_iterator WVertex::incoming_edges_end() else { begin = _EdgeList.front()->GetbOEdge(); } - return incoming_edge_iterator(this, begin, 0); + return incoming_edge_iterator(this, begin, nullptr); } #if 0 WOEdge **WVertex::incoming_edge_iterator::operator->() @@ -194,7 +194,7 @@ WOEdge::WOEdge(WOEdge &iBrother) _paFace = iBrother.GetaFace(); _pbFace = iBrother.GetbFace(); _pOwner = iBrother.GetOwner(); - userdata = NULL; + userdata = nullptr; iBrother.userdata = new oedgedata; ((oedgedata *)(iBrother.userdata))->_copy = this; @@ -228,11 +228,11 @@ WOEdge *WOEdge::getPrevOnFace() WEdge::WEdge(WEdge &iBrother) { - _paOEdge = NULL; - _pbOEdge = NULL; + _paOEdge = nullptr; + _pbOEdge = nullptr; WOEdge *aoedge = iBrother.GetaOEdge(); WOEdge *boedge = iBrother.GetbOEdge(); - userdata = NULL; + userdata = nullptr; if (aoedge) { //_paOEdge = new WOEdge(*aoedge); @@ -272,7 +272,7 @@ WFace::WFace(WFace &iBrother) _Id = iBrother.GetId(); _FrsMaterialIndex = iBrother._FrsMaterialIndex; _Mark = iBrother._Mark; - userdata = NULL; + userdata = nullptr; iBrother.userdata = new facedata; ((facedata *)(iBrother.userdata))->_copy = this; } @@ -332,7 +332,7 @@ WOEdge *WFace::MakeEdge(WVertex *v1, WVertex *v2) // checks whether this edge already exists or not // If it exists, it points outward v2 bool exist = false; - WOEdge *pInvertEdge = NULL; // The inverted edge if it exists + WOEdge *pInvertEdge = nullptr; // The inverted edge if it exists vector<WEdge *> &v2Edges = v2->GetEdges(); vector<WEdge *>::iterator it; for (it = v2Edges.begin(); it != v2Edges.end(); it++) { @@ -394,7 +394,7 @@ bool WFace::getOppositeEdge(const WVertex *v, WOEdge *&e) } vector<WOEdge *>::iterator it; - e = NULL; + e = nullptr; for (it = _OEdgeList.begin(); it != _OEdgeList.end(); it++) { if ((*it)->GetaVertex() == v) { e = *it; @@ -403,7 +403,7 @@ bool WFace::getOppositeEdge(const WVertex *v, WOEdge *&e) if (!e) { return false; } - e = NULL; + e = nullptr; for (it = _OEdgeList.begin(); it != _OEdgeList.end(); it++) { if (((*it)->GetaVertex() != v) && ((*it)->GetbVertex() != v)) { e = *it; @@ -449,7 +449,7 @@ WOEdge *WFace::GetPrevOEdge(WOEdge *iOEdge) return prev; } - return NULL; + return nullptr; } WShape *WFace::getShape() @@ -570,22 +570,22 @@ WShape::WShape(WShape &iBrother) vend = iBrother.getVertexList().end(); for (v = iBrother.getVertexList().begin(); v != vend; ++v) { delete (vertexdata *)((*v)->userdata); - (*v)->userdata = NULL; + (*v)->userdata = nullptr; } // Edges and OEdges: eend = iBrother.getEdgeList().end(); for (e = iBrother.getEdgeList().begin(); e != eend; ++e) { delete (edgedata *)((*e)->userdata); - (*e)->userdata = NULL; + (*e)->userdata = nullptr; // OEdge a: delete (oedgedata *)((*e)->GetaOEdge()->userdata); - (*e)->GetaOEdge()->userdata = NULL; + (*e)->GetaOEdge()->userdata = nullptr; // OEdge b: WOEdge *oedgeb = (*e)->GetbOEdge(); if (oedgeb) { delete (oedgedata *)(oedgeb->userdata); - oedgeb->userdata = NULL; + oedgeb->userdata = nullptr; } } @@ -593,7 +593,7 @@ WShape::WShape(WShape &iBrother) fend = iBrother.GetFaceList().end(); for (f = iBrother.GetFaceList().begin(); f != fend; ++f) { delete (facedata *)((*f)->userdata); - (*f)->userdata = NULL; + (*f)->userdata = nullptr; } } @@ -621,7 +621,7 @@ WFace *WShape::MakeFace(vector<WVertex *> &iVertexList, WFace *face = MakeFace(iVertexList, iFaceEdgeMarksList, iMaterial); if (!face) { - return NULL; + return nullptr; } // set the list of per-vertex normals @@ -649,7 +649,7 @@ WFace *WShape::MakeFace(vector<WVertex *> &iVertexList, if ((iVertexList[0] == iVertexList[1]) || (iVertexList[0] == iVertexList[2]) || (iVertexList[2] == iVertexList[1])) { cerr << "Warning: degenerated triangle detected, correcting" << endl; - return NULL; + return nullptr; } } @@ -695,7 +695,7 @@ WFace *WShape::MakeFace(vector<WVertex *> &iVertexList, } if (!oedge) { - return NULL; + return nullptr; } WEdge *edge = oedge->GetOwner(); diff --git a/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp b/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp index f54b54f5a3a..9898255aaa7 100644 --- a/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp +++ b/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp @@ -42,7 +42,7 @@ void WFillGrid::fillGrid() (*f)->RetrieveVertexList(fvertices); for (vector<WVertex *>::const_iterator wv = fvertices.begin(); wv != fvertices.end(); ++wv) { - vectors.push_back(Vec3r((*wv)->GetVertex())); + vectors.emplace_back((*wv)->GetVertex()); } // occluder will be deleted by the grid diff --git a/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp b/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp index e1cb1c29f63..3ca021ec2c6 100644 --- a/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp +++ b/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp @@ -42,7 +42,7 @@ void WSFillGrid::fillGrid() (*f)->RetrieveVertexList(fvertices); for (vector<WVertex *>::const_iterator wv = fvertices.begin(); wv != fvertices.end(); ++wv) { - vectors.push_back(Vec3r((*wv)->GetVertex())); + vectors.emplace_back((*wv)->GetVertex()); } // occluder will be deleted by the grid diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp index 57eca876913..bedf4192d64 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp +++ b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp @@ -74,13 +74,13 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge() return _pSmoothEdge; } float ta, tb; - WOEdge *woea(0), *woeb(0); + WOEdge *woea(nullptr), *woeb(nullptr); bool ok = false; vector<int> cuspEdgesIndices; int indexStart, indexEnd; unsigned nedges = _pWXFace->numberOfEdges(); if (_nNullDotP == nedges) { - _pSmoothEdge = NULL; + _pSmoothEdge = nullptr; return _pSmoothEdge; } if ((_nPosDotP != 0) && (_nPosDotP != _DotP.size()) && (_nNullDotP == 0)) { @@ -89,7 +89,7 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge() // We retrieve the 2 edges for which we have opposite signs for each extremity RetrieveCuspEdgesIndices(cuspEdgesIndices); if (cuspEdgesIndices.size() != 2) { // we necessarly have 2 cusp edges - return 0; + return nullptr; } // let us determine which cusp edge corresponds to the starting: @@ -120,7 +120,7 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge() // that means that we have exactly one of the 2 extremities of our silhouette edge is a vertex // of the mesh if (ELEM(_nPosDotP, 2, 0)) { - _pSmoothEdge = NULL; + _pSmoothEdge = nullptr; return _pSmoothEdge; } RetrieveCuspEdgesIndices(cuspEdgesIndices); @@ -129,8 +129,8 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge() if (G.debug & G_DEBUG_FREESTYLE) { cout << "Warning in BuildSmoothEdge: weird WXFace configuration" << endl; } - _pSmoothEdge = NULL; - return NULL; + _pSmoothEdge = nullptr; + return nullptr; } unsigned index0 = Get0VertexIndex(); // retrieve the 0 vertex index unsigned nedges = _pWXFace->numberOfEdges(); @@ -275,7 +275,7 @@ WFace *WXShape::MakeFace(vector<WVertex *> &iVertexList, { WFace *face = WShape::MakeFace(iVertexList, iFaceEdgeMarksList, iMaterialIndex); if (!face) { - return NULL; + return nullptr; } Vec3f center; diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp index c989d77a730..d9d6a6675c2 100644 --- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp +++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp @@ -69,7 +69,7 @@ void WingedEdgeBuilder::visitNodeTransformAfter(NodeTransform &UNUSED(transform) delete _current_matrix; if (_matrices_stack.empty()) { - _current_matrix = NULL; + _current_matrix = nullptr; return; } @@ -133,12 +133,12 @@ bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs) const unsigned int *vindices = ifs.vindices(); const unsigned int *nindices = ifs.nindices(); - const unsigned int *tindices = NULL; + const unsigned int *tindices = nullptr; if (ifs.tsize()) { tindices = ifs.tindices(); } - const unsigned int *mindices = NULL; + const unsigned int *mindices = nullptr; if (ifs.msize()) { mindices = ifs.mindices(); } @@ -282,23 +282,23 @@ void WingedEdgeBuilder::buildTriangleStrip(const float * /*vertices*/, triangleVertices.push_back(currentShape->getVertexList()[vindices[nTriangle + 1] / 3]); triangleVertices.push_back(currentShape->getVertexList()[vindices[nTriangle + 2] / 3]); - triangleNormals.push_back(Vec3f(normals[nindices[nTriangle]], - normals[nindices[nTriangle] + 1], - normals[nindices[nTriangle] + 2])); - triangleNormals.push_back(Vec3f(normals[nindices[nTriangle + 1]], - normals[nindices[nTriangle + 1] + 1], - normals[nindices[nTriangle + 1] + 2])); - triangleNormals.push_back(Vec3f(normals[nindices[nTriangle + 2]], - normals[nindices[nTriangle + 2] + 1], - normals[nindices[nTriangle + 2] + 2])); + triangleNormals.emplace_back(normals[nindices[nTriangle]], + normals[nindices[nTriangle] + 1], + normals[nindices[nTriangle] + 2]); + triangleNormals.emplace_back(normals[nindices[nTriangle + 1]], + normals[nindices[nTriangle + 1] + 1], + normals[nindices[nTriangle + 1] + 2]); + triangleNormals.emplace_back(normals[nindices[nTriangle + 2]], + normals[nindices[nTriangle + 2] + 1], + normals[nindices[nTriangle + 2] + 2]); if (texCoords) { - triangleTexCoords.push_back( - Vec2f(texCoords[tindices[nTriangle]], texCoords[tindices[nTriangle] + 1])); - triangleTexCoords.push_back( - Vec2f(texCoords[tindices[nTriangle + 1]], texCoords[tindices[nTriangle + 1] + 1])); - triangleTexCoords.push_back( - Vec2f(texCoords[tindices[nTriangle + 2]], texCoords[tindices[nTriangle + 2] + 1])); + triangleTexCoords.emplace_back(texCoords[tindices[nTriangle]], + texCoords[tindices[nTriangle] + 1]); + triangleTexCoords.emplace_back(texCoords[tindices[nTriangle + 1]], + texCoords[tindices[nTriangle + 1] + 1]); + triangleTexCoords.emplace_back(texCoords[tindices[nTriangle + 2]], + texCoords[tindices[nTriangle + 2] + 1]); } } else { // if nTriangle is odd @@ -306,23 +306,23 @@ void WingedEdgeBuilder::buildTriangleStrip(const float * /*vertices*/, triangleVertices.push_back(currentShape->getVertexList()[vindices[nTriangle + 2] / 3]); triangleVertices.push_back(currentShape->getVertexList()[vindices[nTriangle + 1] / 3]); - triangleNormals.push_back(Vec3f(normals[nindices[nTriangle]], - normals[nindices[nTriangle] + 1], - normals[nindices[nTriangle] + 2])); - triangleNormals.push_back(Vec3f(normals[nindices[nTriangle + 2]], - normals[nindices[nTriangle + 2] + 1], - normals[nindices[nTriangle + 2] + 2])); - triangleNormals.push_back(Vec3f(normals[nindices[nTriangle + 1]], - normals[nindices[nTriangle + 1] + 1], - normals[nindices[nTriangle + 1] + 2])); + triangleNormals.emplace_back(normals[nindices[nTriangle]], + normals[nindices[nTriangle] + 1], + normals[nindices[nTriangle] + 2]); + triangleNormals.emplace_back(normals[nindices[nTriangle + 2]], + normals[nindices[nTriangle + 2] + 1], + normals[nindices[nTriangle + 2] + 2]); + triangleNormals.emplace_back(normals[nindices[nTriangle + 1]], + normals[nindices[nTriangle + 1] + 1], + normals[nindices[nTriangle + 1] + 2]); if (texCoords) { - triangleTexCoords.push_back( - Vec2f(texCoords[tindices[nTriangle]], texCoords[tindices[nTriangle] + 1])); - triangleTexCoords.push_back( - Vec2f(texCoords[tindices[nTriangle + 2]], texCoords[tindices[nTriangle + 2] + 1])); - triangleTexCoords.push_back( - Vec2f(texCoords[tindices[nTriangle + 1]], texCoords[tindices[nTriangle + 1] + 1])); + triangleTexCoords.emplace_back(texCoords[tindices[nTriangle]], + texCoords[tindices[nTriangle] + 1]); + triangleTexCoords.emplace_back(texCoords[tindices[nTriangle + 2]], + texCoords[tindices[nTriangle + 2] + 1]); + triangleTexCoords.emplace_back(texCoords[tindices[nTriangle + 1]], + texCoords[tindices[nTriangle + 1] + 1]); } } triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[nTriangle / 3] & IndexedFaceSet::FACE_MARK) != @@ -386,22 +386,21 @@ void WingedEdgeBuilder::buildTriangles(const float * /*vertices*/, triangleVertices.push_back(currentShape->getVertexList()[vindices[3 * i + 1] / 3]); triangleVertices.push_back(currentShape->getVertexList()[vindices[3 * i + 2] / 3]); - triangleNormals.push_back(Vec3f( - normals[nindices[3 * i]], normals[nindices[3 * i] + 1], normals[nindices[3 * i] + 2])); - triangleNormals.push_back(Vec3f(normals[nindices[3 * i + 1]], - normals[nindices[3 * i + 1] + 1], - normals[nindices[3 * i + 1] + 2])); - triangleNormals.push_back(Vec3f(normals[nindices[3 * i + 2]], - normals[nindices[3 * i + 2] + 1], - normals[nindices[3 * i + 2] + 2])); + triangleNormals.emplace_back( + normals[nindices[3 * i]], normals[nindices[3 * i] + 1], normals[nindices[3 * i] + 2]); + triangleNormals.emplace_back(normals[nindices[3 * i + 1]], + normals[nindices[3 * i + 1] + 1], + normals[nindices[3 * i + 1] + 2]); + triangleNormals.emplace_back(normals[nindices[3 * i + 2]], + normals[nindices[3 * i + 2] + 1], + normals[nindices[3 * i + 2] + 2]); if (texCoords) { - triangleTexCoords.push_back( - Vec2f(texCoords[tindices[3 * i]], texCoords[tindices[3 * i] + 1])); - triangleTexCoords.push_back( - Vec2f(texCoords[tindices[3 * i + 1]], texCoords[tindices[3 * i + 1] + 1])); - triangleTexCoords.push_back( - Vec2f(texCoords[tindices[3 * i + 2]], texCoords[tindices[3 * i + 2] + 1])); + triangleTexCoords.emplace_back(texCoords[tindices[3 * i]], texCoords[tindices[3 * i] + 1]); + triangleTexCoords.emplace_back(texCoords[tindices[3 * i + 1]], + texCoords[tindices[3 * i + 1] + 1]); + triangleTexCoords.emplace_back(texCoords[tindices[3 * i + 2]], + texCoords[tindices[3 * i + 2] + 1]); } triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[i] & IndexedFaceSet::FACE_MARK) != 0); diff --git a/source/blender/gpencil_modifiers/CMakeLists.txt b/source/blender/gpencil_modifiers/CMakeLists.txt index cb4d74559a4..9f1484b47c0 100644 --- a/source/blender/gpencil_modifiers/CMakeLists.txt +++ b/source/blender/gpencil_modifiers/CMakeLists.txt @@ -31,7 +31,7 @@ set(INC ../editors/include ../makesdna ../makesrna - ../render/extern/include + ../render ../windowmanager ../../../intern/eigen ../../../intern/guardedalloc diff --git a/source/blender/gpu/intern/gpu_batch.cc b/source/blender/gpu/intern/gpu_batch.cc index 511ddd210af..3bf1233c000 100644 --- a/source/blender/gpu/intern/gpu_batch.cc +++ b/source/blender/gpu/intern/gpu_batch.cc @@ -73,21 +73,21 @@ void GPU_batch_init_ex(GPUBatch *batch, GPUIndexBuf *elem, eGPUBatchFlag owns_flag) { - BLI_assert(verts != NULL); + BLI_assert(verts != nullptr); /* Do not pass any other flag */ BLI_assert((owns_flag & ~(GPU_BATCH_OWNS_VBO | GPU_BATCH_OWNS_INDEX)) == 0); batch->verts[0] = verts; for (int v = 1; v < GPU_BATCH_VBO_MAX_LEN; v++) { - batch->verts[v] = NULL; + batch->verts[v] = nullptr; } for (int v = 0; v < GPU_BATCH_INST_VBO_MAX_LEN; v++) { - batch->inst[v] = NULL; + batch->inst[v] = nullptr; } batch->elem = elem; batch->prim_type = prim_type; batch->flag = owns_flag | GPU_BATCH_INIT | GPU_BATCH_DIRTY; - batch->shader = NULL; + batch->shader = nullptr; } /* This will share the VBOs with the new batch. */ @@ -171,7 +171,7 @@ int GPU_batch_instbuf_add_ex(GPUBatch *batch, GPUVertBuf *insts, bool own_vbo) batch->flag |= GPU_BATCH_DIRTY; for (uint v = 0; v < GPU_BATCH_INST_VBO_MAX_LEN; v++) { - if (batch->inst[v] == NULL) { + if (batch->inst[v] == nullptr) { /* for now all VertexBuffers must have same vertex_len */ if (batch->inst[0]) { /* Allow for different size of vertex buffer (will choose the smallest number of verts). */ @@ -195,9 +195,9 @@ int GPU_batch_vertbuf_add_ex(GPUBatch *batch, GPUVertBuf *verts, bool own_vbo) batch->flag |= GPU_BATCH_DIRTY; for (uint v = 0; v < GPU_BATCH_VBO_MAX_LEN; v++) { - if (batch->verts[v] == NULL) { + if (batch->verts[v] == nullptr) { /* for now all VertexBuffers must have same vertex_len */ - if (batch->verts[0] != NULL) { + if (batch->verts[0] != nullptr) { /* This is an issue for the HACK inside DRW_vbo_request(). */ // BLI_assert(verts->vertex_len == batch->verts[0]->vertex_len); } @@ -246,7 +246,7 @@ void GPU_batch_draw_range(GPUBatch *batch, int v_first, int v_count) /* Draw multiple instance of a batch without having any instance attributes. */ void GPU_batch_draw_instanced(GPUBatch *batch, int i_count) { - BLI_assert(batch->inst[0] == NULL); + BLI_assert(batch->inst[0] == nullptr); GPU_shader_bind(batch->shader); GPU_batch_draw_advanced(batch, 0, 0, 0, i_count); @@ -255,7 +255,7 @@ void GPU_batch_draw_instanced(GPUBatch *batch, int i_count) void GPU_batch_draw_advanced( GPUBatch *gpu_batch, int v_first, int v_count, int i_first, int i_count) { - BLI_assert(Context::get()->shader != NULL); + BLI_assert(Context::get()->shader != nullptr); Batch *batch = static_cast<Batch *>(gpu_batch); if (v_count == 0) { @@ -269,7 +269,7 @@ void GPU_batch_draw_advanced( if (i_count == 0) { i_count = (batch->inst[0]) ? batch->inst_(0)->vertex_len : 1; /* Meh. This is to be able to use different numbers of verts in instance vbos. */ - if (batch->inst[1] != NULL) { + if (batch->inst[1] != nullptr) { i_count = min_ii(i_count, batch->inst_(1)->vertex_len); } } diff --git a/source/blender/gpu/intern/gpu_context.cc b/source/blender/gpu/intern/gpu_context.cc index 119c1ef9c55..a9d32dcf297 100644 --- a/source/blender/gpu/intern/gpu_context.cc +++ b/source/blender/gpu/intern/gpu_context.cc @@ -54,7 +54,7 @@ using namespace blender::gpu; -static thread_local Context *active_ctx = NULL; +static thread_local Context *active_ctx = nullptr; /* -------------------------------------------------------------------- */ /** \name gpu::Context methods @@ -80,12 +80,12 @@ Context::~Context() delete imm; } -bool Context::is_active_on_thread(void) +bool Context::is_active_on_thread() { return (this == active_ctx) && pthread_equal(pthread_self(), thread_); } -Context *Context::get(void) +Context *Context::get() { return active_ctx; } @@ -98,7 +98,7 @@ Context *Context::get(void) GPUContext *GPU_context_create(void *ghost_window) { - if (GPUBackend::get() == NULL) { + if (GPUBackend::get() == nullptr) { /* TODO move where it make sense. */ GPU_backend_init(GPU_BACKEND_OPENGL); } @@ -114,7 +114,7 @@ void GPU_context_discard(GPUContext *ctx_) { Context *ctx = unwrap(ctx_); delete ctx; - active_ctx = NULL; + active_ctx = nullptr; } /* ctx can be NULL */ @@ -166,7 +166,7 @@ static GPUBackend *g_backend; void GPU_backend_init(eGPUBackendType backend_type) { - BLI_assert(g_backend == NULL); + BLI_assert(g_backend == nullptr); switch (backend_type) { #if WITH_OPENGL_BACKEND @@ -185,10 +185,10 @@ void GPU_backend_exit(void) /* TODO assert no resource left. Currently UI textures are still not freed in their context * correctly. */ delete g_backend; - g_backend = NULL; + g_backend = nullptr; } -GPUBackend *GPUBackend::get(void) +GPUBackend *GPUBackend::get() { return g_backend; } diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc index 8d9a1301be0..f11f1cea753 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.cc +++ b/source/blender/gpu/intern/gpu_framebuffer.cc @@ -58,7 +58,7 @@ FrameBuffer::FrameBuffer(const char *name) dirty_state_ = true; for (int i = 0; i < ARRAY_SIZE(attachments_); i++) { - attachments_[i].tex = NULL; + attachments_[i].tex = nullptr; attachments_[i].mip = -1; attachments_[i].layer = -1; } @@ -67,7 +67,7 @@ FrameBuffer::FrameBuffer(const char *name) FrameBuffer::~FrameBuffer() { for (int i = 0; i < ARRAY_SIZE(attachments_); i++) { - if (attachments_[i].tex != NULL) { + if (attachments_[i].tex != nullptr) { reinterpret_cast<Texture *>(attachments_[i].tex)->detach_from(this); } } @@ -150,7 +150,7 @@ void FrameBuffer::recursive_downsample(int max_lvl, /* Replace attached mip-level for each attachment. */ for (int att = 0; att < ARRAY_SIZE(attachments_); att++) { Texture *tex = reinterpret_cast<Texture *>(attachments_[att].tex); - if (tex != NULL) { + if (tex != nullptr) { /* Some Intel HDXXX have issue with rendering to a mipmap that is below * the texture GL_TEXTURE_MAX_LEVEL. So even if it not correct, in this case * we allow GL_TEXTURE_MAX_LEVEL to be one level lower. In practice it does work! */ @@ -169,7 +169,7 @@ void FrameBuffer::recursive_downsample(int max_lvl, } for (int att = 0; att < ARRAY_SIZE(attachments_); att++) { - if (attachments_[att].tex != NULL) { + if (attachments_[att].tex != nullptr) { /* Reset mipmap level range. */ reinterpret_cast<Texture *>(attachments_[att].tex)->mip_range_set(0, max_lvl); /* Reset base level. NOTE: might not be the one bound at the start of this function. */ @@ -242,14 +242,14 @@ void GPU_framebuffer_restore(void) GPUFrameBuffer *GPU_framebuffer_active_get(void) { Context *ctx = Context::get(); - return wrap(ctx ? ctx->active_fb : NULL); + return wrap(ctx ? ctx->active_fb : nullptr); } /* Returns the default frame-buffer. Will always exists even if it's just a dummy. */ GPUFrameBuffer *GPU_framebuffer_back_get(void) { Context *ctx = Context::get(); - return wrap(ctx ? ctx->back_left : NULL); + return wrap(ctx ? ctx->back_left : nullptr); } bool GPU_framebuffer_bound(GPUFrameBuffer *gpu_fb) @@ -314,7 +314,7 @@ void GPU_framebuffer_config_array(GPUFrameBuffer *gpu_fb, if (depth_attachment.mip == -1) { /* GPU_ATTACHMENT_LEAVE */ } - else if (depth_attachment.tex == NULL) { + else if (depth_attachment.tex == nullptr) { /* GPU_ATTACHMENT_NONE: Need to clear both targets. */ fb->attachment_set(GPU_FB_DEPTH_STENCIL_ATTACHMENT, depth_attachment); fb->attachment_set(GPU_FB_DEPTH_ATTACHMENT, depth_attachment); @@ -487,7 +487,7 @@ void GPU_framebuffer_recursive_downsample(GPUFrameBuffer *gpu_fb, static struct { GPUFrameBuffer *framebuffers[FRAMEBUFFER_STACK_DEPTH]; uint top; -} FrameBufferStack = {{0}}; +} FrameBufferStack = {{nullptr}}; static void gpuPushFrameBuffer(GPUFrameBuffer *fb) { @@ -496,7 +496,7 @@ static void gpuPushFrameBuffer(GPUFrameBuffer *fb) FrameBufferStack.top++; } -static GPUFrameBuffer *gpuPopFrameBuffer(void) +static GPUFrameBuffer *gpuPopFrameBuffer() { BLI_assert(FrameBufferStack.top > 0); FrameBufferStack.top--; @@ -526,7 +526,7 @@ static GPUFrameBuffer *gpu_offscreen_fb_get(GPUOffScreen *ofs) BLI_assert(ctx); for (int i = 0; i < MAX_CTX_FB_LEN; i++) { - if (ofs->framebuffers[i].fb == NULL) { + if (ofs->framebuffers[i].fb == nullptr) { ofs->framebuffers[i].ctx = ctx; GPU_framebuffer_ensure_config(&ofs->framebuffers[i].fb, { @@ -552,7 +552,7 @@ static GPUFrameBuffer *gpu_offscreen_fb_get(GPUOffScreen *ofs) for (int i = 0; i < MAX_CTX_FB_LEN; i++) { GPU_framebuffer_free(ofs->framebuffers[i].fb); - ofs->framebuffers[i].fb = NULL; + ofs->framebuffers[i].fb = nullptr; } return gpu_offscreen_fb_get(ofs); @@ -569,16 +569,17 @@ GPUOffScreen *GPU_offscreen_create( width = max_ii(1, width); ofs->color = GPU_texture_create_2d( - "ofs_color", width, height, 1, (high_bitdepth) ? GPU_RGBA16F : GPU_RGBA8, NULL); + "ofs_color", width, height, 1, (high_bitdepth) ? GPU_RGBA16F : GPU_RGBA8, nullptr); if (depth) { - ofs->depth = GPU_texture_create_2d("ofs_depth", width, height, 1, GPU_DEPTH24_STENCIL8, NULL); + ofs->depth = GPU_texture_create_2d( + "ofs_depth", width, height, 1, GPU_DEPTH24_STENCIL8, nullptr); } if ((depth && !ofs->depth) || !ofs->color) { BLI_snprintf(err_out, 256, "GPUTexture: Texture allocation failed."); GPU_offscreen_free(ofs); - return NULL; + return nullptr; } GPUFrameBuffer *fb = gpu_offscreen_fb_get(ofs); @@ -586,7 +587,7 @@ GPUOffScreen *GPU_offscreen_create( /* check validity at the very end! */ if (!GPU_framebuffer_check_valid(fb, err_out)) { GPU_offscreen_free(ofs); - return NULL; + return nullptr; } GPU_framebuffer_restore(); return ofs; @@ -620,7 +621,7 @@ void GPU_offscreen_bind(GPUOffScreen *ofs, bool save) void GPU_offscreen_unbind(GPUOffScreen *UNUSED(ofs), bool restore) { - GPUFrameBuffer *fb = NULL; + GPUFrameBuffer *fb = nullptr; if (restore) { fb = gpuPopFrameBuffer(); } diff --git a/source/blender/gpu/intern/gpu_immediate.cc b/source/blender/gpu/intern/gpu_immediate.cc index 44c6cac02ca..110774640f1 100644 --- a/source/blender/gpu/intern/gpu_immediate.cc +++ b/source/blender/gpu/intern/gpu_immediate.cc @@ -39,19 +39,19 @@ using namespace blender::gpu; -static thread_local Immediate *imm = NULL; +static thread_local Immediate *imm = nullptr; -void immActivate(void) +void immActivate() { imm = Context::get()->imm; } -void immDeactivate(void) +void immDeactivate() { - imm = NULL; + imm = nullptr; } -GPUVertFormat *immVertexFormat(void) +GPUVertFormat *immVertexFormat() { GPU_vertformat_clear(&imm->vertex_format); return &imm->vertex_format; @@ -59,7 +59,7 @@ GPUVertFormat *immVertexFormat(void) void immBindShader(GPUShader *shader) { - BLI_assert(imm->shader == NULL); + BLI_assert(imm->shader == nullptr); imm->shader = shader; imm->builtin_shader_bound = GPU_SHADER_TEXT; /* Default value. */ @@ -81,16 +81,16 @@ void immBindBuiltinProgram(eGPUBuiltinShader shader_id) imm->builtin_shader_bound = shader_id; } -void immUnbindProgram(void) +void immUnbindProgram() { - BLI_assert(imm->shader != NULL); + BLI_assert(imm->shader != nullptr); GPU_shader_unbind(); - imm->shader = NULL; + imm->shader = nullptr; } /* XXX do not use it. Special hack to use OCIO with batch API. */ -GPUShader *immGetShader(void) +GPUShader *immGetShader() { return imm->shader; } @@ -187,13 +187,13 @@ static void wide_line_workaround_start(GPUPrimType prim_type) } } -static void wide_line_workaround_end(void) +static void wide_line_workaround_end() { if (imm->prev_shader) { immUnbindProgram(); immBindShader(imm->prev_shader); - imm->prev_shader = NULL; + imm->prev_shader = nullptr; } } @@ -236,7 +236,7 @@ GPUBatch *immBeginBatch(GPUPrimType prim_type, uint vertex_len) imm->vertex_data = (uchar *)GPU_vertbuf_get_data(verts); - imm->batch = GPU_batch_create_ex(prim_type, verts, NULL, GPU_BATCH_OWNS_VBO); + imm->batch = GPU_batch_create_ex(prim_type, verts, nullptr, GPU_BATCH_OWNS_VBO); imm->batch->flag |= GPU_BATCH_BUILDING; return imm->batch; @@ -249,7 +249,7 @@ GPUBatch *immBeginBatchAtMost(GPUPrimType prim_type, uint vertex_len) return immBeginBatch(prim_type, vertex_len); } -void immEnd(void) +void immEnd() { BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* Make sure we're between a Begin/End pair. */ BLI_assert(imm->vertex_data || imm->batch); @@ -270,7 +270,7 @@ void immEnd(void) } GPU_batch_set_shader(imm->batch, imm->shader); imm->batch->flag &= ~GPU_BATCH_BUILDING; - imm->batch = NULL; /* don't free, batch belongs to caller */ + imm->batch = nullptr; /* don't free, batch belongs to caller */ } else { imm->end(); @@ -279,7 +279,7 @@ void immEnd(void) /* Prepare for next immBegin. */ imm->prim_type = GPU_PRIM_NONE; imm->strict_vertex_len = true; - imm->vertex_data = NULL; + imm->vertex_data = nullptr; wide_line_workaround_end(); } @@ -480,7 +480,7 @@ void immAttrSkip(uint attr_id) setAttrValueBit(attr_id); } -static void immEndVertex(void) /* and move on to the next vertex */ +static void immEndVertex() /* and move on to the next vertex */ { BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */ BLI_assert(imm->vertex_idx < imm->vertex_len); diff --git a/source/blender/gpu/intern/gpu_index_buffer.cc b/source/blender/gpu/intern/gpu_index_buffer.cc index 36f18f2da49..65932d2dbf4 100644 --- a/source/blender/gpu/intern/gpu_index_buffer.cc +++ b/source/blender/gpu/intern/gpu_index_buffer.cc @@ -69,7 +69,7 @@ void GPU_indexbuf_init(GPUIndexBufBuilder *builder, void GPU_indexbuf_add_generic_vert(GPUIndexBufBuilder *builder, uint v) { #if TRUST_NO_ONE - assert(builder->data != NULL); + assert(builder->data != nullptr); assert(builder->index_len < builder->max_index_len); assert(v <= builder->max_allowed_index); #endif @@ -79,7 +79,7 @@ void GPU_indexbuf_add_generic_vert(GPUIndexBufBuilder *builder, uint v) void GPU_indexbuf_add_primitive_restart(GPUIndexBufBuilder *builder) { #if TRUST_NO_ONE - assert(builder->data != NULL); + assert(builder->data != nullptr); assert(builder->index_len < builder->max_index_len); #endif builder->data[builder->index_len++] = RESTART_INDEX; @@ -336,7 +336,7 @@ GPUIndexBuf *GPU_indexbuf_create_subrange(GPUIndexBuf *elem_src, uint start, uin void GPU_indexbuf_build_in_place(GPUIndexBufBuilder *builder, GPUIndexBuf *elem) { - BLI_assert(builder->data != NULL); + BLI_assert(builder->data != nullptr); /* Transfer data ownership to GPUIndexBuf. * It will be uploaded upon first use. */ unwrap(elem)->init(builder->index_len, builder->data); diff --git a/source/blender/gpu/intern/gpu_matrix.cc b/source/blender/gpu/intern/gpu_matrix.cc index 0274966d4b9..dae56e39db6 100644 --- a/source/blender/gpu/intern/gpu_matrix.cc +++ b/source/blender/gpu/intern/gpu_matrix.cc @@ -606,7 +606,7 @@ const float (*GPU_matrix_projection_get(float m[4][4]))[4] const float (*GPU_matrix_model_view_projection_get(float m[4][4]))[4] { - if (m == NULL) { + if (m == nullptr) { static Mat4 temp; m = temp; } @@ -617,12 +617,12 @@ const float (*GPU_matrix_model_view_projection_get(float m[4][4]))[4] const float (*GPU_matrix_normal_get(float m[3][3]))[3] { - if (m == NULL) { + if (m == nullptr) { static Mat3 temp3; m = temp3; } - copy_m3_m4(m, (const float(*)[4])GPU_matrix_model_view_get(NULL)); + copy_m3_m4(m, (const float(*)[4])GPU_matrix_model_view_get(nullptr)); invert_m3(m); transpose_m3(m); @@ -632,7 +632,7 @@ const float (*GPU_matrix_normal_get(float m[3][3]))[3] const float (*GPU_matrix_normal_inverse_get(float m[3][3]))[3] { - if (m == NULL) { + if (m == nullptr) { static Mat3 temp3; m = temp3; } @@ -658,17 +658,18 @@ void GPU_matrix_bind(GPUShader *shader) int32_t P_inv = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_PROJECTION_INV); if (MV != -1) { - GPU_shader_uniform_vector(shader, MV, 16, 1, (const float *)GPU_matrix_model_view_get(NULL)); + GPU_shader_uniform_vector( + shader, MV, 16, 1, (const float *)GPU_matrix_model_view_get(nullptr)); } if (P != -1) { - GPU_shader_uniform_vector(shader, P, 16, 1, (const float *)GPU_matrix_projection_get(NULL)); + GPU_shader_uniform_vector(shader, P, 16, 1, (const float *)GPU_matrix_projection_get(nullptr)); } if (MVP != -1) { GPU_shader_uniform_vector( - shader, MVP, 16, 1, (const float *)GPU_matrix_model_view_projection_get(NULL)); + shader, MVP, 16, 1, (const float *)GPU_matrix_model_view_projection_get(nullptr)); } if (N != -1) { - GPU_shader_uniform_vector(shader, N, 9, 1, (const float *)GPU_matrix_normal_get(NULL)); + GPU_shader_uniform_vector(shader, N, 9, 1, (const float *)GPU_matrix_normal_get(nullptr)); } if (MV_inv != -1) { Mat4 m; diff --git a/source/blender/gpu/intern/gpu_platform.cc b/source/blender/gpu/intern/gpu_platform.cc index ad7142878e7..6b9878f2ba4 100644 --- a/source/blender/gpu/intern/gpu_platform.cc +++ b/source/blender/gpu/intern/gpu_platform.cc @@ -77,7 +77,7 @@ void GPUPlatformGlobal::create_gpu_name(const char *vendor, BLI_str_replace_char(gpu_name, '\r', ' '); } -void GPUPlatformGlobal::clear(void) +void GPUPlatformGlobal::clear() { MEM_SAFE_FREE(GPG.support_key); MEM_SAFE_FREE(GPG.gpu_name); @@ -94,12 +94,12 @@ void GPUPlatformGlobal::clear(void) using namespace blender::gpu; -eGPUSupportLevel GPU_platform_support_level(void) +eGPUSupportLevel GPU_platform_support_level() { return GPG.support_level; } -const char *GPU_platform_support_level_key(void) +const char *GPU_platform_support_level_key() { return GPG.support_key; } diff --git a/source/blender/gpu/intern/gpu_select_sample_query.cc b/source/blender/gpu/intern/gpu_select_sample_query.cc index 5bbf3bd05d3..6ca811895a5 100644 --- a/source/blender/gpu/intern/gpu_select_sample_query.cc +++ b/source/blender/gpu/intern/gpu_select_sample_query.cc @@ -70,7 +70,7 @@ typedef struct GPUSelectQueryState { eGPUDepthTest depth_test; } GPUSelectQueryState; -static GPUSelectQueryState g_query_state = {0}; +static GPUSelectQueryState g_query_state = {false}; void gpu_select_query_begin( uint (*buffer)[4], uint bufsize, const rcti *input, char mode, int oldhits) diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc index c13321ed205..49f96cb652c 100644 --- a/source/blender/gpu/intern/gpu_shader.cc +++ b/source/blender/gpu/intern/gpu_shader.cc @@ -291,7 +291,7 @@ GPUShader *GPU_shader_create_ex(const char *vertcode, const char *shname) { /* At least a vertex shader and a fragment shader are required. */ - BLI_assert((fragcode != NULL) && (vertcode != NULL)); + BLI_assert((fragcode != nullptr) && (vertcode != nullptr)); Shader *shader = GPUBackend::get()->shader_alloc(shname); @@ -342,14 +342,14 @@ GPUShader *GPU_shader_create_ex(const char *vertcode, shader->geometry_shader_from_glsl(sources); } - if (tf_names != NULL && tf_count > 0) { + if (tf_names != nullptr && tf_count > 0) { BLI_assert(tf_type != GPU_SHADER_TFB_NONE); shader->transform_feedback_names_set(Span<const char *>(tf_names, tf_count), tf_type); } if (!shader->finalize()) { delete shader; - return NULL; + return nullptr; }; return wrap(shader); @@ -374,7 +374,7 @@ GPUShader *GPU_shader_create(const char *vertcode, const char *shname) { return GPU_shader_create_ex( - vertcode, fragcode, geomcode, libcode, defines, GPU_SHADER_TFB_NONE, NULL, 0, shname); + vertcode, fragcode, geomcode, libcode, defines, GPU_SHADER_TFB_NONE, nullptr, 0, shname); } GPUShader *GPU_shader_create_from_python(const char *vertcode, @@ -383,17 +383,24 @@ GPUShader *GPU_shader_create_from_python(const char *vertcode, const char *libcode, const char *defines) { - char *libcodecat = NULL; + char *libcodecat = nullptr; - if (libcode == NULL) { + if (libcode == nullptr) { libcode = datatoc_gpu_shader_colorspace_lib_glsl; } else { libcode = libcodecat = BLI_strdupcat(libcode, datatoc_gpu_shader_colorspace_lib_glsl); } - GPUShader *sh = GPU_shader_create_ex( - vertcode, fragcode, geomcode, libcode, defines, GPU_SHADER_TFB_NONE, NULL, 0, "pyGPUShader"); + GPUShader *sh = GPU_shader_create_ex(vertcode, + fragcode, + geomcode, + libcode, + defines, + GPU_SHADER_TFB_NONE, + nullptr, + 0, + "pyGPUShader"); MEM_SAFE_FREE(libcodecat); return sh; @@ -402,9 +409,9 @@ GPUShader *GPU_shader_create_from_python(const char *vertcode, static const char *string_join_array_maybe_alloc(const char **str_arr, bool *r_is_alloc) { bool is_alloc = false; - if (str_arr == NULL) { + if (str_arr == nullptr) { *r_is_alloc = false; - return NULL; + return nullptr; } /* Skip empty strings (avoid alloc if we can). */ while (str_arr[0] && str_arr[0][0] == '\0') { @@ -450,7 +457,7 @@ struct GPUShader *GPU_shader_create_from_arrays_impl( struct { const char *str; bool is_alloc; - } str_dst[4] = {{0}}; + } str_dst[4] = {{nullptr}}; const char **str_src[4] = {params->vert, params->frag, params->geom, params->defs}; for (int i = 0; i < ARRAY_SIZE(str_src); i++) { @@ -461,7 +468,7 @@ struct GPUShader *GPU_shader_create_from_arrays_impl( BLI_snprintf(name, sizeof(name), "%s_%d", func, line); GPUShader *sh = GPU_shader_create( - str_dst[0].str, str_dst[1].str, str_dst[2].str, NULL, str_dst[3].str, name); + str_dst[0].str, str_dst[1].str, str_dst[2].str, nullptr, str_dst[3].str, name); for (int i = 0; i < ARRAY_SIZE(str_dst); i++) { if (str_dst[i].is_alloc) { @@ -502,7 +509,7 @@ void GPU_shader_unbind(void) if (ctx->shader) { ctx->shader->unbind(); } - ctx->shader = NULL; + ctx->shader = nullptr; #endif } diff --git a/source/blender/gpu/intern/gpu_shader_interface.cc b/source/blender/gpu/intern/gpu_shader_interface.cc index e5fb8025e7f..81c1e013877 100644 --- a/source/blender/gpu/intern/gpu_shader_interface.cc +++ b/source/blender/gpu/intern/gpu_shader_interface.cc @@ -32,12 +32,12 @@ namespace blender::gpu { -ShaderInterface::ShaderInterface(void) +ShaderInterface::ShaderInterface() { /* TODO(fclem): add unique ID for debugging. */ } -ShaderInterface::~ShaderInterface(void) +ShaderInterface::~ShaderInterface() { /* Free memory used by name_buffer. */ MEM_freeN(name_buffer_); @@ -70,14 +70,14 @@ static void sort_input_list(MutableSpan<ShaderInput> dst) /* Sorts all inputs inside their respective array. * This is to allow fast hash collision detection. * See ShaderInterface::input_lookup for more details. */ -void ShaderInterface::sort_inputs(void) +void ShaderInterface::sort_inputs() { sort_input_list(MutableSpan<ShaderInput>(inputs_, attr_len_)); sort_input_list(MutableSpan<ShaderInput>(inputs_ + attr_len_, ubo_len_)); sort_input_list(MutableSpan<ShaderInput>(inputs_ + attr_len_ + ubo_len_, uniform_len_)); } -void ShaderInterface::debug_print(void) +void ShaderInterface::debug_print() { Span<ShaderInput> attrs = Span<ShaderInput>(inputs_, attr_len_); Span<ShaderInput> ubos = Span<ShaderInput>(inputs_ + attr_len_, ubo_len_); diff --git a/source/blender/gpu/intern/gpu_state.cc b/source/blender/gpu/intern/gpu_state.cc index 0b2e4989a33..407a8dd6e2b 100644 --- a/source/blender/gpu/intern/gpu_state.cc +++ b/source/blender/gpu/intern/gpu_state.cc @@ -260,7 +260,7 @@ eGPUStencilTest GPU_stencil_test_get() } /* NOTE: Already premultiplied by U.pixelsize. */ -float GPU_line_width_get(void) +float GPU_line_width_get() { GPUStateMutable &state = Context::get()->state_manager->mutable_state; return state.line_width; @@ -285,13 +285,13 @@ void GPU_viewport_size_get_i(int coords[4]) Context::get()->active_fb->viewport_get(coords); } -bool GPU_depth_mask_get(void) +bool GPU_depth_mask_get() { GPUState &state = Context::get()->state_manager->state; return (state.write_mask & GPU_WRITE_DEPTH) != 0; } -bool GPU_mipmap_enabled(void) +bool GPU_mipmap_enabled() { /* TODO(fclem): this used to be a userdef option. */ return true; @@ -303,17 +303,17 @@ bool GPU_mipmap_enabled(void) /** \name Context Utils * \{ */ -void GPU_flush(void) +void GPU_flush() { Context::get()->flush(); } -void GPU_finish(void) +void GPU_finish() { Context::get()->finish(); } -void GPU_apply_state(void) +void GPU_apply_state() { Context::get()->state_manager->apply_state(); } @@ -328,7 +328,7 @@ void GPU_apply_state(void) * bgl functions. * \{ */ -void GPU_bgl_start(void) +void GPU_bgl_start() { Context *ctx = Context::get(); if (!(ctx && ctx->state_manager)) { @@ -345,7 +345,7 @@ void GPU_bgl_start(void) } /* Just turn off the bgl safeguard system. Can be called even without GPU_bgl_start. */ -void GPU_bgl_end(void) +void GPU_bgl_end() { Context *ctx = Context::get(); if (!(ctx && ctx->state_manager)) { @@ -359,7 +359,7 @@ void GPU_bgl_end(void) } } -bool GPU_bgl_get(void) +bool GPU_bgl_get() { return Context::get()->state_manager->use_bgl; } @@ -381,7 +381,7 @@ void GPU_memory_barrier(eGPUBarrier barrier) /** \name Default State * \{ */ -StateManager::StateManager(void) +StateManager::StateManager() { /* Set default state. */ state.write_mask = GPU_WRITE_COLOR; diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc index 99d286c3abd..d134d718cbe 100644 --- a/source/blender/gpu/intern/gpu_texture.cc +++ b/source/blender/gpu/intern/gpu_texture.cc @@ -49,14 +49,14 @@ Texture::Texture(const char *name) } for (int i = 0; i < ARRAY_SIZE(fb_); i++) { - fb_[i] = NULL; + fb_[i] = nullptr; } } Texture::~Texture() { for (int i = 0; i < ARRAY_SIZE(fb_); i++) { - if (fb_[i] != NULL) { + if (fb_[i] != nullptr) { fb_[i]->attachment_remove(fb_attachment_[i]); } } @@ -142,7 +142,7 @@ bool Texture::init_buffer(GPUVertBuf *vbo, eGPUTextureFormat format) void Texture::attach_to(FrameBuffer *fb, GPUAttachmentType type) { for (int i = 0; i < ARRAY_SIZE(fb_); i++) { - if (fb_[i] == NULL) { + if (fb_[i] == nullptr) { fb_attachment_[i] = type; fb_[i] = fb; return; @@ -156,7 +156,7 @@ void Texture::detach_from(FrameBuffer *fb) for (int i = 0; i < ARRAY_SIZE(fb_); i++) { if (fb_[i] == fb) { fb_[i]->attachment_remove(fb_attachment_[i]); - fb_[i] = NULL; + fb_[i] = nullptr; return; } } @@ -226,7 +226,7 @@ static inline GPUTexture *gpu_texture_create(const char *name, if (!success) { delete tex; - return NULL; + return nullptr; } if (pixels) { tex->update(data_format, pixels); @@ -295,7 +295,7 @@ GPUTexture *GPU_texture_create_compressed_2d( if (!success) { delete tex; - return NULL; + return nullptr; } if (data) { size_t ofs = 0; @@ -320,7 +320,7 @@ GPUTexture *GPU_texture_create_from_vertbuf(const char *name, GPUVertBuf *vert) bool success = tex->init_buffer(vert, tex_format); if (!success) { delete tex; - return NULL; + return nullptr; } return reinterpret_cast<GPUTexture *>(tex); } @@ -383,7 +383,7 @@ void *GPU_texture_read(GPUTexture *tex_, eGPUDataFormat data_format, int miplvl) */ void GPU_texture_clear(GPUTexture *tex, eGPUDataFormat data_format, const void *data) { - BLI_assert(data != NULL); /* Do not accept NULL as parameter. */ + BLI_assert(data != nullptr); /* Do not accept NULL as parameter. */ reinterpret_cast<Texture *>(tex)->clear(data_format, data); } diff --git a/source/blender/gpu/intern/gpu_uniform_buffer.cc b/source/blender/gpu/intern/gpu_uniform_buffer.cc index 2dea98f03ca..89c70c47e4a 100644 --- a/source/blender/gpu/intern/gpu_uniform_buffer.cc +++ b/source/blender/gpu/intern/gpu_uniform_buffer.cc @@ -73,7 +73,7 @@ static eGPUType get_padded_gpu_type(LinkData *link) GPUInput *input = (GPUInput *)link->data; eGPUType gputype = input->type; /* Unless the vec3 is followed by a float we need to treat it as a vec4. */ - if (gputype == GPU_VEC3 && (link->next != NULL) && + if (gputype == GPU_VEC3 && (link->next != nullptr) && (((GPUInput *)link->next->data)->type != GPU_FLOAT)) { gputype = GPU_VEC4; } @@ -106,7 +106,7 @@ static void buffer_from_list_inputs_sort(ListBase *inputs) BLI_listbase_sort(inputs, inputs_cmp); /* Creates a lookup table for the different types; */ - LinkData *inputs_lookup[MAX_UBO_GPU_TYPE + 1] = {NULL}; + LinkData *inputs_lookup[MAX_UBO_GPU_TYPE + 1] = {nullptr}; eGPUType cur_type = static_cast<eGPUType>(MAX_UBO_GPU_TYPE + 1); LISTBASE_FOREACH (LinkData *, link, inputs) { @@ -131,21 +131,21 @@ static void buffer_from_list_inputs_sort(ListBase *inputs) } /* If there is no GPU_VEC3 there is no need for alignment. */ - if (inputs_lookup[GPU_VEC3] == NULL) { + if (inputs_lookup[GPU_VEC3] == nullptr) { return; } LinkData *link = inputs_lookup[GPU_VEC3]; - while (link != NULL && ((GPUInput *)link->data)->type == GPU_VEC3) { + while (link != nullptr && ((GPUInput *)link->data)->type == GPU_VEC3) { LinkData *link_next = link->next; /* If GPU_VEC3 is followed by nothing or a GPU_FLOAT, no need for alignment. */ - if ((link_next == NULL) || ((GPUInput *)link_next->data)->type == GPU_FLOAT) { + if ((link_next == nullptr) || ((GPUInput *)link_next->data)->type == GPU_FLOAT) { break; } /* If there is a float, move it next to current vec3. */ - if (inputs_lookup[GPU_FLOAT] != NULL) { + if (inputs_lookup[GPU_FLOAT] != nullptr) { LinkData *float_input = inputs_lookup[GPU_FLOAT]; inputs_lookup[GPU_FLOAT] = float_input->next; @@ -195,7 +195,7 @@ GPUUniformBuf *GPU_uniformbuf_create_ex(size_t size, const void *data, const cha { UniformBuf *ubo = GPUBackend::get()->uniformbuf_alloc(size, name); /* Direct init. */ - if (data != NULL) { + if (data != nullptr) { ubo->update(data); } return wrap(ubo); @@ -211,7 +211,7 @@ GPUUniformBuf *GPU_uniformbuf_create_from_list(ListBase *inputs, const char *nam { /* There is no point on creating an UBO if there is no arguments. */ if (BLI_listbase_is_empty(inputs)) { - return NULL; + return nullptr; } buffer_from_list_inputs_sort(inputs); diff --git a/source/blender/gpu/intern/gpu_vertex_buffer.cc b/source/blender/gpu/intern/gpu_vertex_buffer.cc index 29fa8a89d27..09b9eba9f95 100644 --- a/source/blender/gpu/intern/gpu_vertex_buffer.cc +++ b/source/blender/gpu/intern/gpu_vertex_buffer.cc @@ -66,13 +66,13 @@ void VertBuf::init(const GPUVertFormat *format, GPUUsageType usage) flag |= GPU_VERTBUF_INIT; } -void VertBuf::clear(void) +void VertBuf::clear() { this->release_data(); flag = GPU_VERTBUF_INVALID; } -VertBuf *VertBuf::duplicate(void) +VertBuf *VertBuf::duplicate() { VertBuf *dst = GPUBackend::get()->vertbuf_alloc(); /* Full copy. */ @@ -107,7 +107,7 @@ void VertBuf::resize(uint vert_len) flag |= GPU_VERTBUF_DATA_DIRTY; } -void VertBuf::upload(void) +void VertBuf::upload() { this->upload_data(); } @@ -125,7 +125,7 @@ using namespace blender::gpu; /* -------- Creation & deletion -------- */ -GPUVertBuf *GPU_vertbuf_calloc(void) +GPUVertBuf *GPU_vertbuf_calloc() { return wrap(GPUBackend::get()->vertbuf_alloc()); } @@ -191,7 +191,7 @@ void GPU_vertbuf_data_resize(GPUVertBuf *verts, uint v_len) void GPU_vertbuf_data_len_set(GPUVertBuf *verts_, uint v_len) { VertBuf *verts = unwrap(verts_); - BLI_assert(verts->data != NULL); /* Only for dynamic data. */ + BLI_assert(verts->data != nullptr); /* Only for dynamic data. */ BLI_assert(v_len <= verts->vertex_alloc); verts->vertex_len = v_len; } @@ -203,7 +203,7 @@ void GPU_vertbuf_attr_set(GPUVertBuf *verts_, uint a_idx, uint v_idx, const void const GPUVertAttr *a = &format->attrs[a_idx]; BLI_assert(v_idx < verts->vertex_alloc); BLI_assert(a_idx < format->attr_len); - BLI_assert(verts->data != NULL); + BLI_assert(verts->data != nullptr); verts->flag |= GPU_VERTBUF_DATA_DIRTY; memcpy(verts->data + a->offset + v_idx * format->stride, data, a->sz); } @@ -225,7 +225,7 @@ void GPU_vertbuf_vert_set(GPUVertBuf *verts_, uint v_idx, const void *data) VertBuf *verts = unwrap(verts_); const GPUVertFormat *format = &verts->format; BLI_assert(v_idx < verts->vertex_alloc); - BLI_assert(verts->data != NULL); + BLI_assert(verts->data != nullptr); verts->flag |= GPU_VERTBUF_DATA_DIRTY; memcpy(verts->data + v_idx * format->stride, data, format->stride); } @@ -236,7 +236,7 @@ void GPU_vertbuf_attr_fill_stride(GPUVertBuf *verts_, uint a_idx, uint stride, c const GPUVertFormat *format = &verts->format; const GPUVertAttr *a = &format->attrs[a_idx]; BLI_assert(a_idx < format->attr_len); - BLI_assert(verts->data != NULL); + BLI_assert(verts->data != nullptr); verts->flag |= GPU_VERTBUF_DATA_DIRTY; const uint vertex_len = verts->vertex_len; @@ -259,7 +259,7 @@ void GPU_vertbuf_attr_get_raw_data(GPUVertBuf *verts_, uint a_idx, GPUVertBufRaw const GPUVertFormat *format = &verts->format; const GPUVertAttr *a = &format->attrs[a_idx]; BLI_assert(a_idx < format->attr_len); - BLI_assert(verts->data != NULL); + BLI_assert(verts->data != nullptr); verts->flag |= GPU_VERTBUF_DATA_DIRTY; verts->flag &= ~GPU_VERTBUF_DATA_UPLOADED; @@ -313,7 +313,7 @@ GPUVertBufStatus GPU_vertbuf_get_status(const GPUVertBuf *verts) return unwrap(verts)->flag; } -uint GPU_vertbuf_get_memory_usage(void) +uint GPU_vertbuf_get_memory_usage() { return VertBuf::memory_usage; } diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc index 46e048d7f7c..b444bd1859d 100644 --- a/source/blender/gpu/opengl/gl_backend.cc +++ b/source/blender/gpu/opengl/gl_backend.cc @@ -38,7 +38,7 @@ namespace blender::gpu { /** \name Platform * \{ */ -void GLBackend::platform_init(void) +void GLBackend::platform_init() { BLI_assert(!GPG.initialized); GPG.initialized = true; @@ -135,7 +135,7 @@ void GLBackend::platform_init(void) GPG.create_gpu_name(vendor, renderer, version); } -void GLBackend::platform_exit(void) +void GLBackend::platform_exit() { BLI_assert(GPG.initialized); GPG.clear(); @@ -147,7 +147,7 @@ void GLBackend::platform_exit(void) /** \name Capabilities * \{ */ -static bool detect_mip_render_workaround(void) +static bool detect_mip_render_workaround() { int cube_size = 2; float clear_color[4] = {1.0f, 0.5f, 0.0f, 0.0f}; @@ -192,7 +192,7 @@ static bool detect_mip_render_workaround(void) return enable_workaround; } -static void detect_workarounds(void) +static void detect_workarounds() { const char *vendor = (const char *)glGetString(GL_VENDOR); const char *renderer = (const char *)glGetString(GL_RENDERER); @@ -376,7 +376,7 @@ bool GLContext::debug_layer_workaround = false; bool GLContext::unused_fb_slot_workaround = false; float GLContext::derivative_signs[2] = {1.0f, 1.0f}; -void GLBackend::capabilities_init(void) +void GLBackend::capabilities_init() { BLI_assert(GLEW_VERSION_3_3); /* Common Capabilities. */ diff --git a/source/blender/gpu/opengl/gl_batch.cc b/source/blender/gpu/opengl/gl_batch.cc index 6f36f128d18..89486b73b05 100644 --- a/source/blender/gpu/opengl/gl_batch.cc +++ b/source/blender/gpu/opengl/gl_batch.cc @@ -50,7 +50,7 @@ using namespace blender::gpu; * TODO(fclem): Could be revisited to avoid so much cross references. * \{ */ -GLVaoCache::GLVaoCache(void) +GLVaoCache::GLVaoCache() { init(); } @@ -60,13 +60,13 @@ GLVaoCache::~GLVaoCache() this->clear(); } -void GLVaoCache::init(void) +void GLVaoCache::init() { - context_ = NULL; - interface_ = NULL; + context_ = nullptr; + interface_ = nullptr; is_dynamic_vao_count = false; for (int i = 0; i < GPU_VAO_STATIC_LEN; i++) { - static_vaos.interfaces[i] = NULL; + static_vaos.interfaces[i] = nullptr; static_vaos.vao_ids[i] = 0; } vao_base_instance_ = 0; @@ -93,7 +93,7 @@ void GLVaoCache::insert(const GLShaderInterface *interface, GLuint vao) else { /* Erase previous entries, they will be added back if drawn again. */ for (int i = 0; i < GPU_VAO_STATIC_LEN; i++) { - if (static_vaos.interfaces[i] != NULL) { + if (static_vaos.interfaces[i] != nullptr) { const_cast<GLShaderInterface *>(static_vaos.interfaces[i])->ref_remove(this); context_->vao_free(static_vaos.vao_ids[i]); } @@ -143,13 +143,13 @@ void GLVaoCache::remove(const GLShaderInterface *interface) if (interfaces[i] == interface) { context_->vao_free(vaos[i]); vaos[i] = 0; - interfaces[i] = NULL; + interfaces[i] = nullptr; break; /* cannot have duplicates */ } } } -void GLVaoCache::clear(void) +void GLVaoCache::clear() { GLContext *ctx = GLContext::get(); const int count = (is_dynamic_vao_count) ? dynamic_vaos.count : GPU_VAO_STATIC_LEN; @@ -157,7 +157,7 @@ void GLVaoCache::clear(void) const GLShaderInterface **interfaces = (is_dynamic_vao_count) ? dynamic_vaos.interfaces : static_vaos.interfaces; /* Early out, nothing to free. */ - if (context_ == NULL) { + if (context_ == nullptr) { return; } @@ -174,7 +174,7 @@ void GLVaoCache::clear(void) } for (int i = 0; i < count; i++) { - if (interfaces[i] != NULL) { + if (interfaces[i] != nullptr) { const_cast<GLShaderInterface *>(interfaces[i])->ref_remove(this); } } @@ -207,13 +207,13 @@ GLuint GLVaoCache::lookup(const GLShaderInterface *interface) /* The GLVaoCache object is only valid for one GLContext. * Reset the cache if trying to draw in another context; */ -void GLVaoCache::context_check(void) +void GLVaoCache::context_check() { GLContext *ctx = GLContext::get(); BLI_assert(ctx); if (context_ != ctx) { - if (context_ != NULL) { + if (context_ != nullptr) { /* IMPORTANT: Trying to draw a batch in multiple different context will trash the VAO cache. * This has major performance impact and should be avoided in most cases. */ context_->vao_cache_unregister(this); @@ -282,7 +282,7 @@ GLuint GLVaoCache::vao_get(GPUBatch *batch) /** \name Creation & Deletion * \{ */ -GLBatch::GLBatch(void) +GLBatch::GLBatch() { } @@ -307,7 +307,7 @@ void GLBatch::bind(int i_first) #if GPU_TRACK_INDEX_RANGE /* Can be removed if GL 4.3 is required. */ - if (!GLContext::fixed_restart_index_support && (elem != NULL)) { + if (!GLContext::fixed_restart_index_support && (elem != nullptr)) { glPrimitiveRestartIndex(this->elem_()->restart_index()); } #endif diff --git a/source/blender/gpu/opengl/gl_context.cc b/source/blender/gpu/opengl/gl_context.cc index 9c98953f469..d766e6f0828 100644 --- a/source/blender/gpu/opengl/gl_context.cc +++ b/source/blender/gpu/opengl/gl_context.cc @@ -121,7 +121,7 @@ GLContext::~GLContext() /** \name Activate / Deactivate context * \{ */ -void GLContext::activate(void) +void GLContext::activate() { /* Make sure no other context is already bound to this thread. */ BLI_assert(is_active_ == false); @@ -160,7 +160,7 @@ void GLContext::activate(void) immActivate(); } -void GLContext::deactivate(void) +void GLContext::deactivate() { immDeactivate(); is_active_ = false; @@ -172,12 +172,12 @@ void GLContext::deactivate(void) /** \name Flush, Finish & sync * \{ */ -void GLContext::flush(void) +void GLContext::flush() { glFlush(); } -void GLContext::finish(void) +void GLContext::finish() { glFinish(); } @@ -191,7 +191,7 @@ void GLContext::finish(void) * In this case we delay the deletion until the context is bound again. * \{ */ -void GLSharedOrphanLists::orphans_clear(void) +void GLSharedOrphanLists::orphans_clear() { /* Check if any context is active on this thread! */ BLI_assert(GLContext::get()); @@ -208,7 +208,7 @@ void GLSharedOrphanLists::orphans_clear(void) lists_mutex.unlock(); }; -void GLContext::orphans_clear(void) +void GLContext::orphans_clear() { /* Check if context has been activated by another thread! */ BLI_assert(this->is_active_on_thread()); diff --git a/source/blender/gpu/opengl/gl_debug.cc b/source/blender/gpu/opengl/gl_debug.cc index 5564cbbabae..4e45ff11fc7 100644 --- a/source/blender/gpu/opengl/gl_debug.cc +++ b/source/blender/gpu/opengl/gl_debug.cc @@ -141,7 +141,7 @@ static void APIENTRY debug_callback(GLenum UNUSED(source), #undef APIENTRY /* This function needs to be called once per context. */ -void init_gl_callbacks(void) +void init_gl_callbacks() { CLOG_ENSURE(&LOG); @@ -152,8 +152,8 @@ void init_gl_callbacks(void) SNPRINTF(msg, format, GLEW_VERSION_4_3 ? "OpenGL 4.3" : "KHR_debug extension"); glEnable(GL_DEBUG_OUTPUT); glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); - glDebugMessageCallback((GLDEBUGPROC)debug_callback, NULL); - glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE); + glDebugMessageCallback((GLDEBUGPROC)debug_callback, nullptr); + glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, GL_TRUE); glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 0, @@ -164,8 +164,8 @@ void init_gl_callbacks(void) else if (GLEW_ARB_debug_output) { SNPRINTF(msg, format, "ARB_debug_output"); glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); - glDebugMessageCallbackARB((GLDEBUGPROCARB)debug_callback, NULL); - glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE); + glDebugMessageCallbackARB((GLDEBUGPROCARB)debug_callback, nullptr); + glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, GL_TRUE); glDebugMessageInsertARB(GL_DEBUG_SOURCE_APPLICATION_ARB, GL_DEBUG_TYPE_OTHER_ARB, 0, @@ -213,7 +213,7 @@ void check_gl_error(const char *info) default: char msg[256]; SNPRINTF(msg, "Unknown GL error: %x : %s", error, info); - debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, msg, NULL); + debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, msg, nullptr); break; } } @@ -250,7 +250,7 @@ void check_gl_resources(const char *info) const char *sh_name = ctx->shader->name_get(); char msg[256]; SNPRINTF(msg, "Missing UBO bind at slot %d : %s > %s : %s", i, sh_name, ubo_name, info); - debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, msg, NULL); + debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, msg, nullptr); } } @@ -262,7 +262,7 @@ void check_gl_resources(const char *info) const char *sh_name = ctx->shader->name_get(); char msg[256]; SNPRINTF(msg, "Missing Texture bind at slot %d : %s > %s : %s", i, sh_name, tex_name, info); - debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, msg, NULL); + debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, msg, nullptr); } } @@ -274,14 +274,14 @@ void check_gl_resources(const char *info) const char *sh_name = ctx->shader->name_get(); char msg[256]; SNPRINTF(msg, "Missing Image bind at slot %d : %s > %s : %s", i, sh_name, tex_name, info); - debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, msg, NULL); + debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, msg, nullptr); } } } void raise_gl_error(const char *info) { - debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, info, NULL); + debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, info, nullptr); } /** \} */ @@ -369,7 +369,7 @@ void GLContext::debug_group_begin(const char *name, int index) } } -void GLContext::debug_group_end(void) +void GLContext::debug_group_end() { if ((G.debug & G_DEBUG_GPU) && (GLEW_VERSION_4_3 || GLEW_KHR_debug)) { glPopDebugGroup(); diff --git a/source/blender/gpu/opengl/gl_debug_layer.cc b/source/blender/gpu/opengl/gl_debug_layer.cc index a4dc4679b7e..188083b0f50 100644 --- a/source/blender/gpu/opengl/gl_debug_layer.cc +++ b/source/blender/gpu/opengl/gl_debug_layer.cc @@ -108,7 +108,7 @@ DEBUG_FUNC_DECLARE(PFNGLUSEPROGRAMPROC, void, glUseProgram, GLuint, program); /* Init a fallback layer (to KHR_debug) that covers only some functions. * We override the functions pointers by our own implementation that just checks glGetError. * Some additional functions (not overridable) are covered inside the header using wrappers. */ -void init_debug_layer(void) +void init_debug_layer() { #define DEBUG_WRAP(function) \ do { \ diff --git a/source/blender/gpu/opengl/gl_drawlist.cc b/source/blender/gpu/opengl/gl_drawlist.cc index 990e1a8014b..aecadc4d14a 100644 --- a/source/blender/gpu/opengl/gl_drawlist.cc +++ b/source/blender/gpu/opengl/gl_drawlist.cc @@ -65,13 +65,13 @@ typedef struct GLDrawCommandIndexed { GLDrawList::GLDrawList(int length) { BLI_assert(length > 0); - batch_ = NULL; + batch_ = nullptr; buffer_id_ = 0; command_len_ = 0; command_offset_ = 0; data_offset_ = 0; data_size_ = 0; - data_ = NULL; + data_ = nullptr; if (GLContext::multi_draw_indirect_support) { /* Alloc the biggest possible command list, which is indexed. */ @@ -88,12 +88,12 @@ GLDrawList::~GLDrawList() GLContext::buf_free(buffer_id_); } -void GLDrawList::init(void) +void GLDrawList::init() { BLI_assert(GLContext::get()); BLI_assert(MDI_ENABLED); - BLI_assert(data_ == NULL); - batch_ = NULL; + BLI_assert(data_ == nullptr); + batch_ = nullptr; command_len_ = 0; if (buffer_id_ == 0) { @@ -105,7 +105,7 @@ void GLDrawList::init(void) glBindBuffer(GL_DRAW_INDIRECT_BUFFER, buffer_id_); /* If buffer is full, orphan buffer data and start fresh. */ // if (command_offset_ >= data_size_) { - glBufferData(GL_DRAW_INDIRECT_BUFFER, buffer_size_, NULL, GL_DYNAMIC_DRAW); + glBufferData(GL_DRAW_INDIRECT_BUFFER, buffer_size_, nullptr, GL_DYNAMIC_DRAW); data_offset_ = 0; // } /* Map the remaining range. */ @@ -123,7 +123,7 @@ void GLDrawList::append(GPUBatch *gpu_batch, int i_first, int i_count) return; } - if (data_ == NULL) { + if (data_ == nullptr) { this->init(); } @@ -169,7 +169,7 @@ void GLDrawList::append(GPUBatch *gpu_batch, int i_first, int i_count) } } -void GLDrawList::submit(void) +void GLDrawList::submit() { if (command_len_ == 0) { return; @@ -177,7 +177,7 @@ void GLDrawList::submit(void) /* Something's wrong if we get here without MDI support. */ BLI_assert(MDI_ENABLED); BLI_assert(data_); - BLI_assert(GLContext::get()->shader != NULL); + BLI_assert(GLContext::get()->shader != nullptr); /* Only do multi-draw indirect if doing more than 2 drawcall. This avoids the overhead of * buffer mapping if scene is not very instance friendly. BUT we also need to take into @@ -190,7 +190,7 @@ void GLDrawList::submit(void) glBindBuffer(GL_DRAW_INDIRECT_BUFFER, buffer_id_); glFlushMappedBufferRange(GL_DRAW_INDIRECT_BUFFER, 0, command_offset_); glUnmapBuffer(GL_DRAW_INDIRECT_BUFFER); - data_ = NULL; /* Unmapped */ + data_ = nullptr; /* Unmapped */ data_offset_ += command_offset_; batch_->bind(0); @@ -227,7 +227,7 @@ void GLDrawList::submit(void) /* Do not submit this buffer again. */ command_len_ = 0; /* Avoid keeping reference to the batch. */ - batch_ = NULL; + batch_ = nullptr; } /** \} */ diff --git a/source/blender/gpu/opengl/gl_framebuffer.cc b/source/blender/gpu/opengl/gl_framebuffer.cc index a180aa270b0..cbb332388dc 100644 --- a/source/blender/gpu/opengl/gl_framebuffer.cc +++ b/source/blender/gpu/opengl/gl_framebuffer.cc @@ -72,7 +72,7 @@ GLFrameBuffer::GLFrameBuffer( GLFrameBuffer::~GLFrameBuffer() { - if (context_ == NULL) { + if (context_ == nullptr) { return; } @@ -92,7 +92,7 @@ GLFrameBuffer::~GLFrameBuffer() } } -void GLFrameBuffer::init(void) +void GLFrameBuffer::init() { context_ = GLContext::get(); state_manager_ = static_cast<GLStateManager *>(context_->state_manager); @@ -154,7 +154,7 @@ bool GLFrameBuffer::check(char err_out[256]) return false; } -void GLFrameBuffer::update_attachments(void) +void GLFrameBuffer::update_attachments() { /* Default frame-buffers cannot have attachments. */ BLI_assert(immutable_ == false); @@ -176,7 +176,7 @@ void GLFrameBuffer::update_attachments(void) first_attachment = (attach.tex) ? type : first_attachment; } - if (attach.tex == NULL) { + if (attach.tex == nullptr) { glFramebufferTexture(GL_FRAMEBUFFER, gl_attachment, 0, 0); continue; } @@ -208,7 +208,7 @@ void GLFrameBuffer::update_attachments(void) for (int i = ARRAY_SIZE(gl_attachments_) - 1; i >= 0; --i) { GPUAttachmentType type = GPU_FB_COLOR_ATTACHMENT0 + i; GPUAttachment &attach = attachments_[type]; - if (attach.tex != NULL) { + if (attach.tex != nullptr) { gl_tex = static_cast<GLTexture *>(unwrap(attach.tex))->tex_id_; } else if (gl_tex != 0) { @@ -232,11 +232,11 @@ void GLFrameBuffer::update_attachments(void) glDrawBuffers(ARRAY_SIZE(gl_attachments_), gl_attachments_); if (G.debug & G_DEBUG_GPU) { - BLI_assert(this->check(NULL)); + BLI_assert(this->check(nullptr)); } } -void GLFrameBuffer::apply_state(void) +void GLFrameBuffer::apply_state() { if (dirty_state_ == false) { return; @@ -410,7 +410,7 @@ void GLFrameBuffer::clear_multi(const float (*clear_cols)[4]) * TODO(fclem): fix this insecurity? */ int type = GPU_FB_COLOR_ATTACHMENT0; for (int i = 0; type < GPU_FB_MAX_ATTACHMENT; i++, type++) { - if (attachments_[type].tex != NULL) { + if (attachments_[type].tex != nullptr) { this->clear_attachment(GPU_FB_COLOR_ATTACHMENT0 + i, GPU_DATA_FLOAT, clear_cols[i]); } } diff --git a/source/blender/gpu/opengl/gl_immediate.cc b/source/blender/gpu/opengl/gl_immediate.cc index b71f8766dbb..63e3162944d 100644 --- a/source/blender/gpu/opengl/gl_immediate.cc +++ b/source/blender/gpu/opengl/gl_immediate.cc @@ -50,12 +50,12 @@ GLImmediate::GLImmediate() buffer.buffer_size = DEFAULT_INTERNAL_BUFFER_SIZE; glGenBuffers(1, &buffer.vbo_id); glBindBuffer(GL_ARRAY_BUFFER, buffer.vbo_id); - glBufferData(GL_ARRAY_BUFFER, buffer.buffer_size, NULL, GL_DYNAMIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, buffer.buffer_size, nullptr, GL_DYNAMIC_DRAW); buffer_strict.buffer_size = DEFAULT_INTERNAL_BUFFER_SIZE; glGenBuffers(1, &buffer_strict.vbo_id); glBindBuffer(GL_ARRAY_BUFFER, buffer_strict.vbo_id); - glBufferData(GL_ARRAY_BUFFER, buffer_strict.buffer_size, NULL, GL_DYNAMIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, buffer_strict.buffer_size, nullptr, GL_DYNAMIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); @@ -112,7 +112,7 @@ uchar *GLImmediate::begin() } else { /* orphan this buffer & start with a fresh one */ - glBufferData(GL_ARRAY_BUFFER, buffer_size(), NULL, GL_DYNAMIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, buffer_size(), nullptr, GL_DYNAMIC_DRAW); buffer_offset() = 0; } @@ -129,13 +129,13 @@ uchar *GLImmediate::begin() access |= GL_MAP_FLUSH_EXPLICIT_BIT; } void *data = glMapBufferRange(GL_ARRAY_BUFFER, buffer_offset(), bytes_needed, access); - BLI_assert(data != NULL); + BLI_assert(data != nullptr); bytes_mapped_ = bytes_needed; return (uchar *)data; } -void GLImmediate::end(void) +void GLImmediate::end() { BLI_assert(prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */ diff --git a/source/blender/gpu/opengl/gl_index_buffer.cc b/source/blender/gpu/opengl/gl_index_buffer.cc index 0096a9a500f..e2c18c5d0b9 100644 --- a/source/blender/gpu/opengl/gl_index_buffer.cc +++ b/source/blender/gpu/opengl/gl_index_buffer.cc @@ -33,7 +33,7 @@ GLIndexBuf::~GLIndexBuf() GLContext::buf_free(ibo_id_); } -void GLIndexBuf::bind(void) +void GLIndexBuf::bind() { if (is_subrange_) { static_cast<GLIndexBuf *>(src_)->bind(); diff --git a/source/blender/gpu/opengl/gl_query.cc b/source/blender/gpu/opengl/gl_query.cc index 6da5cacfcb2..8a42719c665 100644 --- a/source/blender/gpu/opengl/gl_query.cc +++ b/source/blender/gpu/opengl/gl_query.cc @@ -48,7 +48,7 @@ void GLQueryPool::reset(GPUQueryType type) } #endif -void GLQueryPool::begin_query(void) +void GLQueryPool::begin_query() { /* TODO add assert about expected usage. */ while (query_issued_ >= query_ids_.size()) { @@ -59,7 +59,7 @@ void GLQueryPool::begin_query(void) glBeginQuery(gl_type_, query_ids_[query_issued_++]); } -void GLQueryPool::end_query(void) +void GLQueryPool::end_query() { /* TODO add assert about expected usage. */ glEndQuery(gl_type_); diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc index 193e4ee8a70..cc5f83228d6 100644 --- a/source/blender/gpu/opengl/gl_shader.cc +++ b/source/blender/gpu/opengl/gl_shader.cc @@ -53,7 +53,7 @@ GLShader::GLShader(const char *name) : Shader(name) debug::object_label(GL_PROGRAM, shader_program_, name); } -GLShader::~GLShader(void) +GLShader::~GLShader() { #if 0 /* Would be nice to have, but for now the Deferred compilation \ * does not have a GPUContext. */ @@ -72,7 +72,7 @@ GLShader::~GLShader(void) /** \name Shader stage creation * \{ */ -char *GLShader::glsl_patch_get(void) +char *GLShader::glsl_patch_get() { /** Used for shader patching. Init once. */ static char patch[512] = "\0"; @@ -123,14 +123,14 @@ GLuint GLShader::create_shader_stage(GLenum gl_stage, MutableSpan<const char *> /* Patch the shader code using the first source slot. */ sources[0] = glsl_patch_get(); - glShaderSource(shader, sources.size(), sources.data(), NULL); + glShaderSource(shader, sources.size(), sources.data(), nullptr); glCompileShader(shader); GLint status; glGetShaderiv(shader, GL_COMPILE_STATUS, &status); if (!status || (G.debug & G_DEBUG_GPU)) { char log[5000] = ""; - glGetShaderInfoLog(shader, sizeof(log), NULL, log); + glGetShaderInfoLog(shader, sizeof(log), nullptr, log); if (log[0] != '\0') { switch (gl_stage) { case GL_VERTEX_SHADER: @@ -172,7 +172,7 @@ void GLShader::fragment_shader_from_glsl(MutableSpan<const char *> sources) frag_shader_ = this->create_shader_stage(GL_FRAGMENT_SHADER, sources); } -bool GLShader::finalize(void) +bool GLShader::finalize() { if (compilation_failed_) { return false; @@ -184,7 +184,7 @@ bool GLShader::finalize(void) glGetProgramiv(shader_program_, GL_LINK_STATUS, &status); if (!status) { char log[5000]; - glGetProgramInfoLog(shader_program_, sizeof(log), NULL, log); + glGetProgramInfoLog(shader_program_, sizeof(log), nullptr, log); Span<const char *> sources; this->print_log(sources, log, "Linking", true); return false; @@ -201,13 +201,13 @@ bool GLShader::finalize(void) /** \name Binding * \{ */ -void GLShader::bind(void) +void GLShader::bind() { BLI_assert(shader_program_ != 0); glUseProgram(shader_program_); } -void GLShader::unbind(void) +void GLShader::unbind() { #ifndef NDEBUG glUseProgram(0); @@ -259,7 +259,7 @@ bool GLShader::transform_feedback_enable(GPUVertBuf *buf_) return true; } -void GLShader::transform_feedback_disable(void) +void GLShader::transform_feedback_disable() { glEndTransformFeedback(); } @@ -409,7 +409,7 @@ void GLShader::vertformat_from_shader(GPUVertFormat *format) const char name[256]; GLenum gl_type; GLint size; - glGetActiveAttrib(shader_program_, i, sizeof(name), NULL, &size, &gl_type, name); + glGetActiveAttrib(shader_program_, i, sizeof(name), nullptr, &size, &gl_type, name); /* Ignore OpenGL names like `gl_BaseInstanceARB`, `gl_InstanceID` and `gl_VertexID`. */ if (glGetAttribLocation(shader_program_, name) == -1) { diff --git a/source/blender/gpu/opengl/gl_shader_interface.cc b/source/blender/gpu/opengl/gl_shader_interface.cc index 2d55c222e9c..9533639b133 100644 --- a/source/blender/gpu/opengl/gl_shader_interface.cc +++ b/source/blender/gpu/opengl/gl_shader_interface.cc @@ -267,7 +267,7 @@ GLShaderInterface::GLShaderInterface(GLuint program) for (int32_t u_int = 0; u_int < GPU_NUM_UNIFORM_BLOCKS; u_int++) { GPUUniformBlockBuiltin u = static_cast<GPUUniformBlockBuiltin>(u_int); const ShaderInput *block = this->ubo_get(builtin_uniform_block_name(u)); - builtin_blocks_[u] = (block != NULL) ? block->binding : -1; + builtin_blocks_[u] = (block != nullptr) ? block->binding : -1; } MEM_freeN(uniforms_from_blocks); @@ -285,7 +285,7 @@ GLShaderInterface::GLShaderInterface(GLuint program) GLShaderInterface::~GLShaderInterface() { for (auto *ref : refs_) { - if (ref != NULL) { + if (ref != nullptr) { ref->remove(this); } } diff --git a/source/blender/gpu/opengl/gl_state.cc b/source/blender/gpu/opengl/gl_state.cc index 8f2e0e2a72d..c5b5dd3efd2 100644 --- a/source/blender/gpu/opengl/gl_state.cc +++ b/source/blender/gpu/opengl/gl_state.cc @@ -42,7 +42,7 @@ namespace blender::gpu { /** \name GLStateManager * \{ */ -GLStateManager::GLStateManager(void) +GLStateManager::GLStateManager() { /* Set other states that never change. */ glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); @@ -71,7 +71,7 @@ GLStateManager::GLStateManager(void) set_mutable_state(mutable_state); } -void GLStateManager::apply_state(void) +void GLStateManager::apply_state() { if (!this->use_bgl) { this->set_state(this->state); @@ -84,7 +84,7 @@ void GLStateManager::apply_state(void) }; /* Will set all the states regardless of the current ones. */ -void GLStateManager::force_state(void) +void GLStateManager::force_state() { /* Little exception for clip distances since they need to keep the old count correct. */ uint32_t clip_distances = current_.clip_distances; @@ -511,7 +511,7 @@ void GLStateManager::texture_unbind(Texture *tex_) tex->is_bound_ = false; } -void GLStateManager::texture_unbind_all(void) +void GLStateManager::texture_unbind_all() { for (int i = 0; i < ARRAY_SIZE(textures_); i++) { if (textures_[i] != 0) { @@ -523,7 +523,7 @@ void GLStateManager::texture_unbind_all(void) this->texture_bind_apply(); } -void GLStateManager::texture_bind_apply(void) +void GLStateManager::texture_bind_apply() { if (dirty_texture_binds_ == 0) { return; @@ -555,7 +555,7 @@ void GLStateManager::texture_unpack_row_length_set(uint len) glPixelStorei(GL_UNPACK_ROW_LENGTH, len); } -uint64_t GLStateManager::bound_texture_slots(void) +uint64_t GLStateManager::bound_texture_slots() { uint64_t bound_slots = 0; for (int i = 0; i < ARRAY_SIZE(textures_); i++) { @@ -603,7 +603,7 @@ void GLStateManager::image_unbind(Texture *tex_) tex->is_bound_ = false; } -void GLStateManager::image_unbind_all(void) +void GLStateManager::image_unbind_all() { for (int i = 0; i < ARRAY_SIZE(images_); i++) { if (images_[i] != 0) { @@ -614,7 +614,7 @@ void GLStateManager::image_unbind_all(void) this->image_bind_apply(); } -void GLStateManager::image_bind_apply(void) +void GLStateManager::image_bind_apply() { if (dirty_image_binds_ == 0) { return; @@ -638,7 +638,7 @@ void GLStateManager::image_bind_apply(void) } } -uint8_t GLStateManager::bound_image_slots(void) +uint8_t GLStateManager::bound_image_slots() { uint8_t bound_slots = 0; for (int i = 0; i < ARRAY_SIZE(images_); i++) { diff --git a/source/blender/gpu/opengl/gl_texture.cc b/source/blender/gpu/opengl/gl_texture.cc index 070a86509ff..4f990b77bd0 100644 --- a/source/blender/gpu/opengl/gl_texture.cc +++ b/source/blender/gpu/opengl/gl_texture.cc @@ -44,7 +44,7 @@ namespace blender::gpu { GLTexture::GLTexture(const char *name) : Texture(name) { - BLI_assert(GLContext::get() != NULL); + BLI_assert(GLContext::get() != nullptr); glGenTextures(1, &tex_id_); } @@ -55,7 +55,7 @@ GLTexture::~GLTexture() GPU_framebuffer_free(framebuffer_); } GLContext *ctx = GLContext::get(); - if (ctx != NULL && is_bound_) { + if (ctx != nullptr && is_bound_) { /* This avoid errors when the texture is still inside the bound texture array. */ ctx->state_manager->texture_unbind(this); } @@ -63,7 +63,7 @@ GLTexture::~GLTexture() } /* Return true on success. */ -bool GLTexture::init_internal(void) +bool GLTexture::init_internal() { if ((format_ == GPU_DEPTH24_STENCIL8) && GPU_depth_blitting_workaround()) { /* MacOS + Radeon Pro fails to blit depth on GPU_DEPTH24_STENCIL8 @@ -148,7 +148,7 @@ void GLTexture::ensure_mipmaps(int miplvl) if (type_ == GPU_TEXTURE_CUBE) { for (int i = 0; i < d; i++) { GLenum target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + i; - glTexImage2D(target, mip, internal_format, w, h, 0, gl_format, gl_type, NULL); + glTexImage2D(target, mip, internal_format, w, h, 0, gl_format, gl_type, nullptr); } } else if (format_flag_ & GPU_FORMAT_COMPRESSED) { @@ -156,13 +156,13 @@ void GLTexture::ensure_mipmaps(int miplvl) switch (dimensions) { default: case 1: - glCompressedTexImage1D(target_, mip, internal_format, w, 0, size, NULL); + glCompressedTexImage1D(target_, mip, internal_format, w, 0, size, nullptr); break; case 2: - glCompressedTexImage2D(target_, mip, internal_format, w, h, 0, size, NULL); + glCompressedTexImage2D(target_, mip, internal_format, w, h, 0, size, nullptr); break; case 3: - glCompressedTexImage3D(target_, mip, internal_format, w, h, d, 0, size, NULL); + glCompressedTexImage3D(target_, mip, internal_format, w, h, d, 0, size, nullptr); break; } } @@ -170,13 +170,13 @@ void GLTexture::ensure_mipmaps(int miplvl) switch (dimensions) { default: case 1: - glTexImage1D(target_, mip, internal_format, w, 0, gl_format, gl_type, NULL); + glTexImage1D(target_, mip, internal_format, w, 0, gl_format, gl_type, nullptr); break; case 2: - glTexImage2D(target_, mip, internal_format, w, h, 0, gl_format, gl_type, NULL); + glTexImage2D(target_, mip, internal_format, w, h, 0, gl_format, gl_type, nullptr); break; case 3: - glTexImage3D(target_, mip, internal_format, w, h, d, 0, gl_format, gl_type, NULL); + glTexImage3D(target_, mip, internal_format, w, h, d, 0, gl_format, gl_type, nullptr); break; } } @@ -231,7 +231,7 @@ void GLTexture::update_sub( int mip, int offset[3], int extent[3], eGPUDataFormat type, const void *data) { BLI_assert(validate_data_format(format_, type)); - BLI_assert(data != NULL); + BLI_assert(data != nullptr); this->ensure_mipmaps(mip); @@ -294,7 +294,7 @@ void GLTexture::update_sub( * WARNING: Depth textures are not populated but they have their mips correctly defined. * WARNING: This resets the mipmap range. */ -void GLTexture::generate_mipmap(void) +void GLTexture::generate_mipmap() { this->ensure_mipmaps(9999); /* Some drivers have bugs when using glGenerateMipmap with depth textures (see T56789). @@ -440,7 +440,7 @@ void GLTexture::mip_range_set(int min, int max) } } -struct GPUFrameBuffer *GLTexture::framebuffer_get(void) +struct GPUFrameBuffer *GLTexture::framebuffer_get() { if (framebuffer_) { return framebuffer_; @@ -461,7 +461,7 @@ struct GPUFrameBuffer *GLTexture::framebuffer_get(void) GLuint GLTexture::samplers_[GPU_SAMPLER_MAX] = {0}; -void GLTexture::samplers_init(void) +void GLTexture::samplers_init() { glGenSamplers(GPU_SAMPLER_MAX, samplers_); for (int i = 0; i <= GPU_SAMPLER_ICON - 1; i++) { @@ -517,7 +517,7 @@ void GLTexture::samplers_init(void) debug::object_label(GL_SAMPLER, icon_sampler, "icons"); } -void GLTexture::samplers_update(void) +void GLTexture::samplers_update() { if (!GLContext::texture_filter_anisotropic_support) { return; @@ -536,7 +536,7 @@ void GLTexture::samplers_update(void) } } -void GLTexture::samplers_free(void) +void GLTexture::samplers_free() { glDeleteSamplers(GPU_SAMPLER_MAX, samplers_); } @@ -617,13 +617,13 @@ bool GLTexture::proxy_check(int mip) switch (dimensions) { default: case 1: - glCompressedTexImage1D(gl_proxy, mip, size[0], 0, gl_format, img_size, NULL); + glCompressedTexImage1D(gl_proxy, mip, size[0], 0, gl_format, img_size, nullptr); break; case 2: - glCompressedTexImage2D(gl_proxy, mip, UNPACK2(size), 0, gl_format, img_size, NULL); + glCompressedTexImage2D(gl_proxy, mip, UNPACK2(size), 0, gl_format, img_size, nullptr); break; case 3: - glCompressedTexImage3D(gl_proxy, mip, UNPACK3(size), 0, gl_format, img_size, NULL); + glCompressedTexImage3D(gl_proxy, mip, UNPACK3(size), 0, gl_format, img_size, nullptr); break; } } @@ -631,13 +631,15 @@ bool GLTexture::proxy_check(int mip) switch (dimensions) { default: case 1: - glTexImage1D(gl_proxy, mip, internal_format, size[0], 0, gl_format, gl_type, NULL); + glTexImage1D(gl_proxy, mip, internal_format, size[0], 0, gl_format, gl_type, nullptr); break; case 2: - glTexImage2D(gl_proxy, mip, internal_format, UNPACK2(size), 0, gl_format, gl_type, NULL); + glTexImage2D( + gl_proxy, mip, internal_format, UNPACK2(size), 0, gl_format, gl_type, nullptr); break; case 3: - glTexImage3D(gl_proxy, mip, internal_format, UNPACK3(size), 0, gl_format, gl_type, NULL); + glTexImage3D( + gl_proxy, mip, internal_format, UNPACK3(size), 0, gl_format, gl_type, nullptr); break; } } @@ -649,7 +651,7 @@ bool GLTexture::proxy_check(int mip) /** \} */ -void GLTexture::check_feedback_loop(void) +void GLTexture::check_feedback_loop() { /* Recursive down sample workaround break this check. * See #recursive_downsample() for more information. */ @@ -679,7 +681,7 @@ void GLTexture::check_feedback_loop(void) } /* TODO(fclem): Legacy. Should be removed at some point. */ -uint GLTexture::gl_bindcode_get(void) const +uint GLTexture::gl_bindcode_get() const { return tex_id_; } diff --git a/source/blender/gpu/opengl/gl_uniform_buffer.cc b/source/blender/gpu/opengl/gl_uniform_buffer.cc index e6aaddf75d3..ecb233f2e5a 100644 --- a/source/blender/gpu/opengl/gl_uniform_buffer.cc +++ b/source/blender/gpu/opengl/gl_uniform_buffer.cc @@ -55,13 +55,13 @@ GLUniformBuf::~GLUniformBuf() /** \name Data upload / update * \{ */ -void GLUniformBuf::init(void) +void GLUniformBuf::init() { BLI_assert(GLContext::get()); glGenBuffers(1, &ubo_id_); glBindBuffer(GL_UNIFORM_BUFFER, ubo_id_); - glBufferData(GL_UNIFORM_BUFFER, size_in_bytes_, NULL, GL_DYNAMIC_DRAW); + glBufferData(GL_UNIFORM_BUFFER, size_in_bytes_, nullptr, GL_DYNAMIC_DRAW); debug::object_label(GL_UNIFORM_BUFFER, ubo_id_, name_); } @@ -97,7 +97,7 @@ void GLUniformBuf::bind(int slot) this->init(); } - if (data_ != NULL) { + if (data_ != nullptr) { this->update(data_); MEM_SAFE_FREE(data_); } @@ -111,7 +111,7 @@ void GLUniformBuf::bind(int slot) #endif } -void GLUniformBuf::unbind(void) +void GLUniformBuf::unbind() { #ifdef DEBUG /* NOTE: This only unbinds the last bound slot. */ diff --git a/source/blender/gpu/opengl/gl_vertex_array.cc b/source/blender/gpu/opengl/gl_vertex_array.cc index 7585a327b3b..ea2770f099d 100644 --- a/source/blender/gpu/opengl/gl_vertex_array.cc +++ b/source/blender/gpu/opengl/gl_vertex_array.cc @@ -70,7 +70,7 @@ static uint16_t vbo_bind(const ShaderInterface *interface, const char *name = GPU_vertformat_attr_name_get(format, a, n_idx); const ShaderInput *input = interface->attr_get(name); - if (input == NULL) { + if (input == nullptr) { continue; } diff --git a/source/blender/gpu/opengl/gl_vertex_buffer.cc b/source/blender/gpu/opengl/gl_vertex_buffer.cc index c6efe577e15..a56d5269fde 100644 --- a/source/blender/gpu/opengl/gl_vertex_buffer.cc +++ b/source/blender/gpu/opengl/gl_vertex_buffer.cc @@ -27,19 +27,19 @@ namespace blender::gpu { -void GLVertBuf::acquire_data(void) +void GLVertBuf::acquire_data() { /* Discard previous data if any. */ MEM_SAFE_FREE(data); data = (uchar *)MEM_mallocN(sizeof(uchar) * this->size_alloc_get(), __func__); } -void GLVertBuf::resize_data(void) +void GLVertBuf::resize_data() { data = (uchar *)MEM_reallocN(data, sizeof(uchar) * this->size_alloc_get()); } -void GLVertBuf::release_data(void) +void GLVertBuf::release_data() { if (vbo_id_ != 0) { GLContext::buf_free(vbo_id_); @@ -52,7 +52,7 @@ void GLVertBuf::release_data(void) void GLVertBuf::duplicate_data(VertBuf *dst_) { - BLI_assert(GLContext::get() != NULL); + BLI_assert(GLContext::get() != nullptr); GLVertBuf *src = this; GLVertBuf *dst = static_cast<GLVertBuf *>(dst_); @@ -61,7 +61,7 @@ void GLVertBuf::duplicate_data(VertBuf *dst_) glGenBuffers(1, &dst->vbo_id_); glBindBuffer(GL_COPY_WRITE_BUFFER, dst->vbo_id_); - glBufferData(GL_COPY_WRITE_BUFFER, dst->vbo_size_, NULL, to_gl(dst->usage_)); + glBufferData(GL_COPY_WRITE_BUFFER, dst->vbo_size_, nullptr, to_gl(dst->usage_)); glBindBuffer(GL_COPY_READ_BUFFER, src->vbo_id_); @@ -75,14 +75,14 @@ void GLVertBuf::duplicate_data(VertBuf *dst_) } } -void GLVertBuf::upload_data(void) +void GLVertBuf::upload_data() { this->bind(); } -void GLVertBuf::bind(void) +void GLVertBuf::bind() { - BLI_assert(GLContext::get() != NULL); + BLI_assert(GLContext::get() != nullptr); if (vbo_id_ == 0) { glGenBuffers(1, &vbo_id_); @@ -93,7 +93,7 @@ void GLVertBuf::bind(void) if (flag & GPU_VERTBUF_DATA_DIRTY) { vbo_size_ = this->size_used_get(); /* Orphan the vbo to avoid sync then upload data. */ - glBufferData(GL_ARRAY_BUFFER, vbo_size_, NULL, to_gl(usage_)); + glBufferData(GL_ARRAY_BUFFER, vbo_size_, nullptr, to_gl(usage_)); glBufferSubData(GL_ARRAY_BUFFER, 0, vbo_size_, data); memory_usage += vbo_size_; diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index 3efb78fe1ca..61f2153cf6c 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -101,13 +101,13 @@ struct IK_Target { IK_Target() { - bldepsgraph = NULL; - blscene = NULL; - target = NULL; - constraint = NULL; - blenderConstraint = NULL; - rootChannel = NULL; - owner = NULL; + bldepsgraph = nullptr; + blscene = nullptr; + target = nullptr; + constraint = nullptr; + blenderConstraint = nullptr; + rootChannel = nullptr; + owner = nullptr; controlType = 0; channel = 0; ee = 0; @@ -138,12 +138,12 @@ struct IK_Channel { IK_Channel() { - pchan = NULL; + pchan = nullptr; parent = -1; jointType = 0; ndof = 0; jointValid = 0; - owner = NULL; + owner = nullptr; jointValue[0] = 0.0; jointValue[1] = 0.0; jointValue[2] = 0.0; @@ -174,20 +174,20 @@ struct IK_Scene { IK_Scene() { - bldepsgraph = NULL; - blscene = NULL; - next = NULL; - channels = NULL; - armature = NULL; - cache = NULL; - scene = NULL; - base = NULL; - solver = NULL; + bldepsgraph = nullptr; + blscene = nullptr; + next = nullptr; + channels = nullptr; + armature = nullptr; + cache = nullptr; + scene = nullptr; + base = nullptr; + solver = nullptr; blScale = blInvScale = 1.0f; - blArmature = NULL; + blArmature = nullptr; numchan = 0; numjoint = 0; - polarConstraint = NULL; + polarConstraint = nullptr; } ~IK_Scene() @@ -228,7 +228,7 @@ enum IK_SegmentAxis { static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *con) { - bPoseChannel *curchan, *pchan_root = NULL, *chanlist[256], **oldchan; + bPoseChannel *curchan, *pchan_root = nullptr, *chanlist[256], **oldchan; PoseTree *tree; PoseTarget *target; bKinematicConstraint *data; @@ -290,7 +290,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co * and each channel can be part of at most one tree. */ tree = (PoseTree *)pchan_root->iktree.first; - if (tree == NULL) { + if (tree == nullptr) { /* make new tree */ tree = (PoseTree *)MEM_callocN(sizeof(PoseTree), "posetree"); @@ -398,7 +398,7 @@ static bool constraint_valid(bConstraint *con) } if (is_cartesian_constraint(con)) { /* cartesian space constraint */ - if (data->tar == NULL) { + if (data->tar == nullptr) { return false; } if (data->tar->type == OB_ARMATURE && data->subtarget[0] == 0) { @@ -956,7 +956,7 @@ static int convert_channels(struct Depsgraph *depsgraph, * this is because some of the pose data (e.g. pose head) don't have corresponding * joint angles and can't be applied to the iTaSC armature dynamically */ if (!(pchan->flag & POSE_DONE)) { - BKE_pose_where_is_bone(depsgraph, ikscene->blscene, ikscene->blArmature, pchan, ctime, 1); + BKE_pose_where_is_bone(depsgraph, ikscene->blscene, ikscene->blArmature, pchan, ctime, true); } /* tell blender that this channel was controlled by IK, * it's cleared on each BKE_pose_where_is() */ @@ -1163,7 +1163,7 @@ static IK_Scene *convert_tree( float start[3]; if (tree->totchannel == 0) { - return NULL; + return nullptr; } ikscene = new IK_Scene; @@ -1196,7 +1196,7 @@ static IK_Scene *convert_tree( break; default: delete ikscene; - return NULL; + return nullptr; } ikscene->blArmature = ob; /* assume uniform scaling and take Y scale as general scale for the armature */ @@ -1438,10 +1438,10 @@ static IK_Scene *convert_tree( } if (!ret) { delete ikscene; - return NULL; + return nullptr; } /* for each target, we need to add an end effector in the armature */ - for (numtarget = 0, polarcon = NULL, ret = true, target = (PoseTarget *)tree->targets.first; + for (numtarget = 0, polarcon = nullptr, ret = true, target = (PoseTarget *)tree->targets.first; target; target = (PoseTarget *)target->next) { condata = (bKinematicConstraint *)target->con->data; @@ -1496,7 +1496,7 @@ static IK_Scene *convert_tree( } if (!ret) { delete ikscene; - return NULL; + return nullptr; } /* set the weight */ e_matrix &Wq = arm->getWq(); @@ -1638,7 +1638,7 @@ static IK_Scene *convert_tree( if (!ret || !scene->addCache(ikscene->cache) || !scene->addSolver(ikscene->solver) || !scene->initialize()) { delete ikscene; - ikscene = NULL; + ikscene = nullptr; } return ikscene; } @@ -1688,7 +1688,7 @@ static int init_scene(Object *ob) IK_Scene *scene; if (ob->pose->ikdata) { - for (scene = ((IK_Data *)ob->pose->ikdata)->first; scene != NULL; scene = scene->next) { + for (scene = ((IK_Data *)ob->pose->ikdata)->first; scene != nullptr; scene = scene->next) { if (fabs(scene->blScale - scale) > KDL::epsilon) { return 1; } @@ -1720,7 +1720,8 @@ static void execute_scene(struct Depsgraph *depsgraph, /* in animation mode, we must get the bone position from action and constraints */ for (i = 0, ikchan = ikscene->channels; i < ikscene->numchan; i++, ikchan++) { if (!(ikchan->pchan->flag & POSE_DONE)) { - BKE_pose_where_is_bone(depsgraph, blscene, ikscene->blArmature, ikchan->pchan, ctime, 1); + BKE_pose_where_is_bone( + depsgraph, blscene, ikscene->blArmature, ikchan->pchan, ctime, true); } /* tell blender that this channel was controlled by IK, * it's cleared on each BKE_pose_where_is() */ @@ -1767,7 +1768,7 @@ static void execute_scene(struct Depsgraph *depsgraph, if (ikscene->cache && !reiterate && simulation) { iTaSC::CacheTS sts, cts; sts = cts = (iTaSC::CacheTS)std::round(timestamp * 1000.0); - if (ikscene->cache->getPreviousCacheItem(ikscene->armature, 0, &cts) == NULL || cts == 0) { + if (ikscene->cache->getPreviousCacheItem(ikscene->armature, 0, &cts) == nullptr || cts == 0) { /* the cache is empty before this time, reiterate */ if (ikparam->flag & ITASC_INITIAL_REITERATION) { reiterate = true; @@ -1886,7 +1887,7 @@ void itasc_initialize_tree(struct Depsgraph *depsgraph, bPoseChannel *pchan; int count = 0; - if (ob->pose->ikdata != NULL && !(ob->pose->flag & POSE_WAS_REBUILT)) { + if (ob->pose->ikdata != nullptr && !(ob->pose->flag & POSE_WAS_REBUILT)) { if (!init_scene(ob)) { return; } @@ -1949,7 +1950,7 @@ void itasc_clear_data(struct bPose *pose) delete scene; } MEM_freeN(ikdata); - pose->ikdata = NULL; + pose->ikdata = nullptr; } } @@ -1960,7 +1961,7 @@ void itasc_clear_cache(struct bPose *pose) for (IK_Scene *scene = ikdata->first; scene; scene = scene->next) { if (scene->cache) { /* clear all cache but leaving the timestamp 0 (=rest pose) */ - scene->cache->clearCacheFrom(NULL, 1); + scene->cache->clearCacheFrom(nullptr, 1); } } } @@ -2000,7 +2001,7 @@ void itasc_test_constraint(struct Object *ob, struct bConstraint *cons) struct bKinematicConstraint *data = (struct bKinematicConstraint *)cons->data; /* only for IK constraint */ - if (cons->type != CONSTRAINT_TYPE_KINEMATIC || data == NULL) { + if (cons->type != CONSTRAINT_TYPE_KINEMATIC || data == nullptr) { return; } diff --git a/source/blender/imbuf/intern/IMB_filetype.h b/source/blender/imbuf/intern/IMB_filetype.h index 93a3a98c3d1..53d9a1a2919 100644 --- a/source/blender/imbuf/intern/IMB_filetype.h +++ b/source/blender/imbuf/intern/IMB_filetype.h @@ -119,7 +119,7 @@ struct ImBuf *imb_bmp_decode(const unsigned char *mem, int imb_savebmp(struct ImBuf *ibuf, const char *filepath, int flags); /* cineon */ -int imb_is_cineon(const unsigned char *buf); +int imb_is_a_cineon(const unsigned char *buf); int imb_save_cineon(struct ImBuf *buf, const char *filepath, int flags); struct ImBuf *imb_load_cineon(const unsigned char *mem, size_t size, @@ -127,7 +127,7 @@ struct ImBuf *imb_load_cineon(const unsigned char *mem, char colorspace[IM_MAX_SPACE]); /* dpx */ -int imb_is_dpx(const unsigned char *buf); +int imb_is_a_dpx(const unsigned char *buf); int imb_save_dpx(struct ImBuf *buf, const char *filepath, int flags); struct ImBuf *imb_load_dpx(const unsigned char *mem, size_t size, diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c index eeccadf56c1..98082a97e0f 100644 --- a/source/blender/imbuf/intern/cineon/cineon_dpx.c +++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c @@ -188,7 +188,7 @@ int imb_save_cineon(struct ImBuf *buf, const char *filepath, int flags) return imb_save_dpx_cineon(buf, filepath, 1, flags); } -int imb_is_cineon(const unsigned char *buf) +int imb_is_a_cineon(const unsigned char *buf) { return logImageIsCineon(buf); } @@ -198,7 +198,7 @@ ImBuf *imb_load_cineon(const unsigned char *mem, int flags, char colorspace[IM_MAX_SPACE]) { - if (imb_is_cineon(mem)) { + if (imb_is_a_cineon(mem)) { return imb_load_dpx_cineon(mem, size, 1, flags, colorspace); } return NULL; @@ -209,7 +209,7 @@ int imb_save_dpx(struct ImBuf *buf, const char *filepath, int flags) return imb_save_dpx_cineon(buf, filepath, 0, flags); } -int imb_is_dpx(const unsigned char *buf) +int imb_is_a_dpx(const unsigned char *buf) { return logImageIsDpx(buf); } @@ -219,7 +219,7 @@ ImBuf *imb_load_dpx(const unsigned char *mem, int flags, char colorspace[IM_MAX_SPACE]) { - if (imb_is_dpx(mem)) { + if (imb_is_a_dpx(mem)) { return imb_load_dpx_cineon(mem, size, 0, flags, colorspace); } return NULL; diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp index 3e459934db7..37e30d30e2c 100644 --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp @@ -1130,7 +1130,7 @@ void *DirectDrawSurface::readData(uint &rsize) if (stream.failed) { free(data); - data = NULL; + data = nullptr; rsize = 0; } diff --git a/source/blender/imbuf/intern/dds/Image.cpp b/source/blender/imbuf/intern/dds/Image.cpp index 4cfd7178f29..7958a586c7d 100644 --- a/source/blender/imbuf/intern/dds/Image.cpp +++ b/source/blender/imbuf/intern/dds/Image.cpp @@ -32,7 +32,7 @@ #include <stdio.h> /* printf */ -Image::Image() : m_width(0), m_height(0), m_format(Format_RGB), m_data(NULL) +Image::Image() : m_width(0), m_height(0), m_format(Format_RGB), m_data(nullptr) { } @@ -52,7 +52,7 @@ void Image::allocate(uint w, uint h) void Image::free() { delete[] m_data; - m_data = NULL; + m_data = nullptr; } uint Image::width() const diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp index 1d29dd4a26b..e620c968f1c 100644 --- a/source/blender/imbuf/intern/dds/dds_api.cpp +++ b/source/blender/imbuf/intern/dds/dds_api.cpp @@ -47,10 +47,10 @@ int imb_save_dds(struct ImBuf *ibuf, const char *name, int /*flags*/) return 0; /* todo: finish this function */ /* check image buffer */ - if (ibuf == 0) { + if (ibuf == nullptr) { return 0; } - if (ibuf->rect == 0) { + if (ibuf->rect == nullptr) { return 0; } @@ -91,7 +91,7 @@ struct ImBuf *imb_load_dds(const unsigned char *mem, int flags, char colorspace[IM_MAX_SPACE]) { - struct ImBuf *ibuf = NULL; + struct ImBuf *ibuf = nullptr; DirectDrawSurface dds((unsigned char *)mem, size); /* reads header */ unsigned char bits_per_pixel; unsigned int *rect; @@ -100,7 +100,7 @@ struct ImBuf *imb_load_dds(const unsigned char *mem, int col; unsigned char *cp = (unsigned char *)&col; Color32 pixel; - Color32 *pixels = 0; + Color32 *pixels = nullptr; /* OCIO_TODO: never was able to save DDS, so can't test loading * but profile used to be set to sRGB and can't see rect_float here, so @@ -109,27 +109,27 @@ struct ImBuf *imb_load_dds(const unsigned char *mem, colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_BYTE); if (!imb_is_a_dds(mem)) { - return 0; + return nullptr; } /* check if DDS is valid and supported */ if (!dds.isValid()) { /* no need to print error here, just testing if it is a DDS */ if (flags & IB_test) { - return 0; + return nullptr; } printf("DDS: not valid; header follows\n"); dds.printInfo(); - return 0; + return nullptr; } if (!dds.isSupported()) { printf("DDS: format not supported\n"); - return 0; + return nullptr; } if ((dds.width() > 65535) || (dds.height() > 65535)) { printf("DDS: dimensions too large\n"); - return 0; + return nullptr; } /* convert DDS into ImBuf */ @@ -148,8 +148,8 @@ struct ImBuf *imb_load_dds(const unsigned char *mem, } } ibuf = IMB_allocImBuf(dds.width(), dds.height(), bits_per_pixel, 0); - if (ibuf == 0) { - return 0; /* memory allocation failed */ + if (ibuf == nullptr) { + return nullptr; /* memory allocation failed */ } ibuf->ftype = IMB_FTYPE_DDS; @@ -160,7 +160,7 @@ struct ImBuf *imb_load_dds(const unsigned char *mem, if (!imb_addrectImBuf(ibuf)) { return ibuf; } - if (ibuf->rect == 0) { + if (ibuf->rect == nullptr) { return ibuf; } @@ -188,7 +188,7 @@ struct ImBuf *imb_load_dds(const unsigned char *mem, } } else { - ibuf->dds_data.data = NULL; + ibuf->dds_data.data = nullptr; ibuf->dds_data.size = 0; } diff --git a/source/blender/imbuf/intern/filetype.c b/source/blender/imbuf/intern/filetype.c index 5aa588da36d..667027ebfeb 100644 --- a/source/blender/imbuf/intern/filetype.c +++ b/source/blender/imbuf/intern/filetype.c @@ -114,7 +114,7 @@ const ImFileType IMB_FILE_TYPES[] = { #ifdef WITH_CINEON {NULL, NULL, - imb_is_dpx, + imb_is_a_dpx, NULL, imb_ftype_default, imb_load_dpx, @@ -126,7 +126,7 @@ const ImFileType IMB_FILE_TYPES[] = { COLOR_ROLE_DEFAULT_FLOAT}, {NULL, NULL, - imb_is_cineon, + imb_is_a_cineon, NULL, imb_ftype_default, imb_load_cineon, @@ -211,7 +211,7 @@ const ImFileType IMB_FILE_TYPES[] = { {NULL, NULL, NULL, - imb_is_a_photoshop, + imb_is_a_filepath_photoshop, imb_ftype_default, NULL, imb_load_photoshop, diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.cpp b/source/blender/imbuf/intern/oiio/openimageio_api.cpp index 71774b335d7..9d8c5d50a89 100644 --- a/source/blender/imbuf/intern/oiio/openimageio_api.cpp +++ b/source/blender/imbuf/intern/oiio/openimageio_api.cpp @@ -101,7 +101,7 @@ static ImBuf *imb_oiio_load_image( IMB_freeImBuf(ibuf); } - return NULL; + return nullptr; } } catch (const std::exception &exc) { @@ -110,7 +110,7 @@ static ImBuf *imb_oiio_load_image( IMB_freeImBuf(ibuf); } - return NULL; + return nullptr; } /* ImBuf always needs 4 channels */ @@ -141,7 +141,7 @@ static ImBuf *imb_oiio_load_image_float( IMB_freeImBuf(ibuf); } - return NULL; + return nullptr; } } catch (const std::exception &exc) { @@ -150,7 +150,7 @@ static ImBuf *imb_oiio_load_image_float( IMB_freeImBuf(ibuf); } - return NULL; + return nullptr; } /* ImBuf always needs 4 channels */ @@ -163,13 +163,13 @@ static ImBuf *imb_oiio_load_image_float( extern "C" { -int imb_is_a_photoshop(const char *filename) +int imb_is_a_filepath_photoshop(const char *filename) { const char *photoshop_extension[] = { ".psd", ".pdd", ".psb", - NULL, + nullptr, }; return BLI_path_extension_check_array(filename, photoshop_extension); @@ -190,7 +190,7 @@ int imb_save_photoshop(struct ImBuf *ibuf, const char * /*name*/, int flags) struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspace[IM_MAX_SPACE]) { - struct ImBuf *ibuf = NULL; + struct ImBuf *ibuf = nullptr; int width, height, components; bool is_float, is_alpha, is_half; int basesize; @@ -198,8 +198,8 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac const bool is_colorspace_manually_set = (colorspace[0] != '\0'); /* load image from file through OIIO */ - if (imb_is_a_photoshop(filename) == 0) { - return NULL; + if (imb_is_a_filepath_photoshop(filename) == 0) { + return nullptr; } colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_BYTE); @@ -208,7 +208,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac if (!in) { std::cerr << __func__ << ": ImageInput::create() failed:" << std::endl << OIIO_NAMESPACE::geterror() << std::endl; - return NULL; + return nullptr; } ImageSpec spec, config; @@ -217,7 +217,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac if (!in->open(filename, spec, config)) { std::cerr << __func__ << ": ImageInput::open() failed:" << std::endl << in->geterror() << std::endl; - return NULL; + return nullptr; } if (!is_colorspace_manually_set) { @@ -248,7 +248,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac if (in) { in->close(); } - return NULL; + return nullptr; } if (is_float) { @@ -263,7 +263,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac } if (!ibuf) { - return NULL; + return nullptr; } /* ImBuf always needs 4 channels */ @@ -281,7 +281,7 @@ struct ImBuf *imb_load_photoshop(const char *filename, int flags, char colorspac IMB_freeImBuf(ibuf); } - return NULL; + return nullptr; } } diff --git a/source/blender/imbuf/intern/oiio/openimageio_api.h b/source/blender/imbuf/intern/oiio/openimageio_api.h index 3f5f234099c..135e3521f71 100644 --- a/source/blender/imbuf/intern/oiio/openimageio_api.h +++ b/source/blender/imbuf/intern/oiio/openimageio_api.h @@ -31,7 +31,7 @@ extern "C" { struct ImBuf; -int imb_is_a_photoshop(const char *name); +int imb_is_a_filepath_photoshop(const char *name); int imb_save_photoshop(struct ImBuf *ibuf, const char *name, int flags); diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 08577f767e7..40a502a14db 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -407,10 +407,10 @@ static bool imb_save_openexr_half(ImBuf *ibuf, const char *name, const int flags { const int channels = ibuf->channels; const bool is_alpha = (channels >= 4) && (ibuf->planes == 32); - const bool is_zbuf = (flags & IB_zbuffloat) && ibuf->zbuf_float != NULL; /* summarize */ + const bool is_zbuf = (flags & IB_zbuffloat) && ibuf->zbuf_float != nullptr; /* summarize */ const int width = ibuf->x; const int height = ibuf->y; - OStream *file_stream = NULL; + OStream *file_stream = nullptr; try { Header header(width, height); @@ -514,10 +514,10 @@ static bool imb_save_openexr_float(ImBuf *ibuf, const char *name, const int flag { const int channels = ibuf->channels; const bool is_alpha = (channels >= 4) && (ibuf->planes == 32); - const bool is_zbuf = (flags & IB_zbuffloat) && ibuf->zbuf_float != NULL; /* summarize */ + const bool is_zbuf = (flags & IB_zbuffloat) && ibuf->zbuf_float != nullptr; /* summarize */ const int width = ibuf->x; const int height = ibuf->y; - OStream *file_stream = NULL; + OStream *file_stream = nullptr; try { Header header(width, height); @@ -551,7 +551,7 @@ static bool imb_save_openexr_float(ImBuf *ibuf, const char *name, const int flag int ystride = -xstride * width; /* last scanline, stride negative */ - float *rect[4] = {NULL, NULL, NULL, NULL}; + float *rect[4] = {nullptr, nullptr, nullptr, nullptr}; rect[0] = ibuf->rect_float + channels * (height - 1) * width; rect[1] = (channels >= 2) ? rect[0] + 1 : rect[0]; rect[2] = (channels >= 3) ? rect[0] + 2 : rect[0]; @@ -598,7 +598,7 @@ int imb_save_openexr(struct ImBuf *ibuf, const char *name, int flags) } /* when no float rect, we save as half (16 bits is sufficient) */ - if (ibuf->rect_float == NULL) { + if (ibuf->rect_float == nullptr) { return (int)imb_save_openexr_half(ibuf, name, flags); } @@ -614,7 +614,7 @@ int imb_save_openexr(struct ImBuf *ibuf, const char *name, int flags) * - separated with a dot: the Layer name (like "Light1" or "Walls" or "Characters") */ -static ListBase exrhandles = {NULL, NULL}; +static ListBase exrhandles = {nullptr, nullptr}; typedef struct ExrHandle { struct ExrHandle *next, *prev; @@ -691,7 +691,7 @@ void *IMB_exr_get_handle_name(const char *name) { ExrHandle *data = (ExrHandle *)BLI_rfindstring(&exrhandles, name, offsetof(ExrHandle, name)); - if (data == NULL) { + if (data == nullptr) { data = (ExrHandle *)IMB_exr_get_handle(); BLI_strncpy(data->name, name, strlen(name) + 1); } @@ -754,8 +754,8 @@ static void imb_exr_insert_view_name(char *name_full, const char *passname, cons { BLI_assert(!ELEM(name_full, passname, viewname)); - if (viewname == NULL || viewname[0] == '\0') { - BLI_strncpy(name_full, passname, sizeof(((ExrChannel *)NULL)->name)); + if (viewname == nullptr || viewname[0] == '\0') { + BLI_strncpy(name_full, passname, sizeof(((ExrChannel *)nullptr)->name)); return; } @@ -882,11 +882,11 @@ int IMB_exr_begin_write(void *handle, delete data->ofile; delete data->ofile_stream; - data->ofile = NULL; - data->ofile_stream = NULL; + data->ofile = nullptr; + data->ofile_stream = nullptr; } - return (data->ofile != NULL); + return (data->ofile != nullptr); } /* only used for writing temp. render results (not image files) @@ -951,8 +951,8 @@ void IMB_exrtile_begin_write( delete data->mpofile; delete data->ofile_stream; - data->mpofile = NULL; - data->ofile_stream = NULL; + data->mpofile = nullptr; + data->ofile_stream = nullptr; } } @@ -973,8 +973,8 @@ int IMB_exr_begin_read(void *handle, const char *filename, int *width, int *heig delete data->ifile; delete data->ifile_stream; - data->ifile = NULL; - data->ifile_stream = NULL; + data->ifile = nullptr; + data->ifile_stream = nullptr; } if (data->ifile) { @@ -988,8 +988,14 @@ int IMB_exr_begin_read(void *handle, const char *filename, int *width, int *heig GetChannelsInMultiPartFile(*data->ifile, channels); for (size_t i = 0; i < channels.size(); i++) { - IMB_exr_add_channel( - data, NULL, channels[i].name.c_str(), channels[i].view.c_str(), 0, 0, NULL, false); + IMB_exr_add_channel(data, + nullptr, + channels[i].name.c_str(), + channels[i].view.c_str(), + 0, + 0, + nullptr, + false); echan = (ExrChannel *)data->channels.last; echan->m->name = channels[i].name; @@ -1074,7 +1080,7 @@ float *IMB_exr_channel_rect(void *handle, return echan->rect; } - return NULL; + return nullptr; } void IMB_exr_clear_channels(void *handle) @@ -1097,7 +1103,7 @@ void IMB_exr_write_channels(void *handle) if (data->channels.first) { const size_t num_pixels = ((size_t)data->width) * data->height; - half *rect_half = NULL, *current_rect_half = NULL; + half *rect_half = nullptr, *current_rect_half = nullptr; /* We allocate teporary storage for half pixels for all the channels at once. */ if (data->num_half_channels != 0) { @@ -1138,7 +1144,7 @@ void IMB_exr_write_channels(void *handle) std::cerr << "OpenEXR-writePixels: ERROR: " << exc.what() << std::endl; } /* Free temporary buffers. */ - if (rect_half != NULL) { + if (rect_half != nullptr) { MEM_freeN(rect_half); } } @@ -1323,7 +1329,7 @@ void IMB_exr_multilayer_convert(void *handle, pass->totchan, pass->chan_id, pass->view); - pass->rect = NULL; + pass->rect = nullptr; } } } @@ -1343,11 +1349,11 @@ void IMB_exr_close(void *handle) delete data->ofile_stream; delete data->multiView; - data->ifile = NULL; - data->ifile_stream = NULL; - data->ofile = NULL; - data->mpofile = NULL; - data->ofile_stream = NULL; + data->ifile = nullptr; + data->ifile_stream = nullptr; + data->ofile = nullptr; + data->mpofile = nullptr; + data->ofile_stream = nullptr; for (chan = (ExrChannel *)data->channels.first; chan; chan = chan->next) { delete chan->m; @@ -1491,7 +1497,7 @@ static ExrLayer *imb_exr_get_layer(ListBase *lb, char *layname) { ExrLayer *lay = (ExrLayer *)BLI_findstring(lb, layname, offsetof(ExrLayer, name)); - if (lay == NULL) { + if (lay == nullptr) { lay = (ExrLayer *)MEM_callocN(sizeof(ExrLayer), "exr layer"); BLI_addtail(lb, lay); BLI_strncpy(lay->name, layname, EXR_LAY_MAXNAME); @@ -1504,7 +1510,7 @@ static ExrPass *imb_exr_get_pass(ListBase *lb, char *passname) { ExrPass *pass = (ExrPass *)BLI_findstring(lb, passname, offsetof(ExrPass, name)); - if (pass == NULL) { + if (pass == nullptr) { pass = (ExrPass *)MEM_callocN(sizeof(ExrPass), "exr pass"); if (STREQ(passname, "Combined")) { @@ -1546,7 +1552,7 @@ static ExrHandle *imb_exr_begin_read_mem(IStream &file_stream, for (size_t i = 0; i < channels.size(); i++) { IMB_exr_add_channel( - data, NULL, channels[i].name.c_str(), channels[i].view.c_str(), 0, 0, NULL, false); + data, nullptr, channels[i].name.c_str(), channels[i].view.c_str(), 0, 0, nullptr, false); echan = (ExrChannel *)data->channels.last; echan->m->name = channels[i].name; @@ -1588,7 +1594,7 @@ static ExrHandle *imb_exr_begin_read_mem(IStream &file_stream, if (echan) { printf("error, too many channels in one pass: %s\n", echan->m->name.c_str()); IMB_exr_close(data); - return NULL; + return nullptr; } /* with some heuristics, try to merge the channels in buffers */ @@ -1723,7 +1729,7 @@ static int exr_has_rgb(MultiPartInputFile &file, const char *rgb_channels[3]) { /* Common names for RGB-like channels in order. */ static const char *channel_names[] = { - "R", "Red", "G", "Green", "B", "Blue", "AR", "RA", "AG", "GA", "AB", "BA", NULL}; + "R", "Red", "G", "Green", "B", "Blue", "AR", "RA", "AG", "GA", "AB", "BA", nullptr}; const Header &header = file.header(0); int num_channels = 0; @@ -1746,26 +1752,26 @@ static bool exr_has_luma(MultiPartInputFile &file) * optionally it could be also channels for chromas called BY and RY. */ const Header &header = file.header(0); - return header.channels().findChannel("Y") != NULL; + return header.channels().findChannel("Y") != nullptr; } static bool exr_has_chroma(MultiPartInputFile &file) { const Header &header = file.header(0); - return header.channels().findChannel("BY") != NULL && - header.channels().findChannel("RY") != NULL; + return header.channels().findChannel("BY") != nullptr && + header.channels().findChannel("RY") != nullptr; } static bool exr_has_zbuffer(MultiPartInputFile &file) { const Header &header = file.header(0); - return !(header.channels().findChannel("Z") == NULL); + return !(header.channels().findChannel("Z") == nullptr); } static bool exr_has_alpha(MultiPartInputFile &file) { const Header &header = file.header(0); - return !(header.channels().findChannel("A") == NULL); + return !(header.channels().findChannel("A") == nullptr); } static bool exr_is_half_float(MultiPartInputFile &file) @@ -1895,12 +1901,12 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem, int flags, char colorspace[IM_MAX_SPACE]) { - struct ImBuf *ibuf = NULL; - IMemStream *membuf = NULL; - MultiPartInputFile *file = NULL; + struct ImBuf *ibuf = nullptr; + IMemStream *membuf = nullptr; + MultiPartInputFile *file = nullptr; if (imb_is_a_openexr(mem) == 0) { - return NULL; + return nullptr; } colorspace_set_default_role(colorspace, IM_MAX_SPACE, COLOR_ROLE_DEFAULT_FLOAT); @@ -1918,7 +1924,7 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem, // printf("OpenEXR-load: image data window %d %d %d %d\n", // dw.min.x, dw.min.y, dw.max.x, dw.max.y); - if (0) { /* debug */ + if (false) { /* debug */ exr_print_filecontents(*file); } @@ -2084,7 +2090,7 @@ struct ImBuf *imb_load_openexr(const unsigned char *mem, delete file; delete membuf; - return 0; + return nullptr; } } diff --git a/source/blender/io/alembic/exporter/abc_export_capi.cc b/source/blender/io/alembic/exporter/abc_export_capi.cc index 7663d1790b6..5b8998a0b1a 100644 --- a/source/blender/io/alembic/exporter/abc_export_capi.cc +++ b/source/blender/io/alembic/exporter/abc_export_capi.cc @@ -227,8 +227,8 @@ bool ABC_export(Scene *scene, WM_jobs_timer(wm_job, 0.1, NC_SCENE | ND_FRAME, NC_SCENE | ND_FRAME); WM_jobs_callbacks(wm_job, blender::io::alembic::export_startjob, - NULL, - NULL, + nullptr, + nullptr, blender::io::alembic::export_endjob); WM_jobs_start(CTX_wm_manager(C), wm_job); diff --git a/source/blender/io/alembic/exporter/abc_writer_curves.cc b/source/blender/io/alembic/exporter/abc_writer_curves.cc index b57af345a3c..5e01609f930 100644 --- a/source/blender/io/alembic/exporter/abc_writer_curves.cc +++ b/source/blender/io/alembic/exporter/abc_writer_curves.cc @@ -135,7 +135,7 @@ void ABCCurveWriter::do_write(HierarchyContext &context) } } - if (nurbs->knotsu != NULL) { + if (nurbs->knotsu != nullptr) { const size_t num_knots = KNOTSU(nurbs); /* Add an extra knot at the beginning and end of the array since most apps @@ -189,7 +189,7 @@ ABCCurveMeshWriter::ABCCurveMeshWriter(const ABCWriterConstructorArgs &args) Mesh *ABCCurveMeshWriter::get_export_mesh(Object *object_eval, bool &r_needsfree) { Mesh *mesh_eval = BKE_object_get_evaluated_mesh(object_eval); - if (mesh_eval != NULL) { + if (mesh_eval != nullptr) { /* Mesh_eval only exists when generative modifiers are in use. */ r_needsfree = false; return mesh_eval; diff --git a/source/blender/io/alembic/exporter/abc_writer_hair.cc b/source/blender/io/alembic/exporter/abc_writer_hair.cc index 072feb2a90a..f8d610a3659 100644 --- a/source/blender/io/alembic/exporter/abc_writer_hair.cc +++ b/source/blender/io/alembic/exporter/abc_writer_hair.cc @@ -163,16 +163,17 @@ void ABCHairWriter::write_hair_sample(const HierarchyContext &context, if (num < mesh->totface) { /* TODO(Sybren): check whether the NULL check here and if(mface) are actually required */ - MFace *face = mface == NULL ? NULL : &mface[num]; + MFace *face = mface == nullptr ? nullptr : &mface[num]; MTFace *tface = mtface + num; if (mface) { float r_uv[2], mapfw[4], vec[3]; psys_interpolate_uvs(tface, face->v4, pa->fuv, r_uv); - uv_values.push_back(Imath::V2f(r_uv[0], r_uv[1])); + uv_values.emplace_back(r_uv[0], r_uv[1]); - psys_interpolate_face(mverts, face, tface, NULL, mapfw, vec, normal, NULL, NULL, NULL); + psys_interpolate_face( + mverts, face, tface, nullptr, mapfw, vec, normal, nullptr, nullptr, nullptr); copy_yup_from_zup(tmp_nor.getValue(), normal); norm_values.push_back(tmp_nor); @@ -203,7 +204,7 @@ void ABCHairWriter::write_hair_sample(const HierarchyContext &context, } if (vtx[o] == num) { - uv_values.push_back(Imath::V2f(tface->uv[o][0], tface->uv[o][1])); + uv_values.emplace_back(tface->uv[o][0], tface->uv[o][1]); MVert *mv = mverts + vtx[o]; @@ -230,7 +231,7 @@ void ABCHairWriter::write_hair_sample(const HierarchyContext &context, mul_m4_v3(inv_mat, vert); /* Convert Z-up to Y-up. */ - verts.push_back(Imath::V3f(vert[0], vert[2], -vert[1])); + verts.emplace_back(vert[0], vert[2], -vert[1]); } } } @@ -277,12 +278,13 @@ void ABCHairWriter::write_hair_child_sample(const HierarchyContext &context, float r_uv[2], tmpnor[3], mapfw[4], vec[3]; psys_interpolate_uvs(tface, face->v4, pc->fuv, r_uv); - uv_values.push_back(Imath::V2f(r_uv[0], r_uv[1])); + uv_values.emplace_back(r_uv[0], r_uv[1]); - psys_interpolate_face(mverts, face, tface, NULL, mapfw, vec, tmpnor, NULL, NULL, NULL); + psys_interpolate_face( + mverts, face, tface, nullptr, mapfw, vec, tmpnor, nullptr, nullptr, nullptr); /* Convert Z-up to Y-up. */ - norm_values.push_back(Imath::V3f(tmpnor[0], tmpnor[2], -tmpnor[1])); + norm_values.emplace_back(tmpnor[0], tmpnor[2], -tmpnor[1]); } else { if (!uv_values.empty()) { @@ -302,7 +304,7 @@ void ABCHairWriter::write_hair_child_sample(const HierarchyContext &context, mul_m4_v3(inv_mat, vert); /* Convert Z-up to Y-up. */ - verts.push_back(Imath::V3f(vert[0], vert[2], -vert[1])); + verts.emplace_back(vert[0], vert[2], -vert[1]); path++; } diff --git a/source/blender/io/alembic/exporter/abc_writer_nurbs.cc b/source/blender/io/alembic/exporter/abc_writer_nurbs.cc index 7595a0eba63..ce451eb1428 100644 --- a/source/blender/io/alembic/exporter/abc_writer_nurbs.cc +++ b/source/blender/io/alembic/exporter/abc_writer_nurbs.cc @@ -93,7 +93,7 @@ bool ABCNurbsWriter::check_is_animated(const HierarchyContext &context) const { /* Check if object has shape keys. */ Curve *cu = static_cast<Curve *>(context.object->data); - return (cu->key != NULL); + return (cu->key != nullptr); } bool ABCNurbsWriter::is_supported(const HierarchyContext *context) const @@ -126,7 +126,7 @@ void ABCNurbsWriter::do_write(HierarchyContext &context) Curve *curve = static_cast<Curve *>(context.object->data); ListBase *nulb; - if (context.object->runtime.curve_cache->deformed_nurbs.first != NULL) { + if (context.object->runtime.curve_cache->deformed_nurbs.first != nullptr) { nulb = &context.object->runtime.curve_cache->deformed_nurbs; } else { diff --git a/source/blender/io/alembic/exporter/abc_writer_points.cc b/source/blender/io/alembic/exporter/abc_writer_points.cc index 557f580e8aa..70608fdbe92 100644 --- a/source/blender/io/alembic/exporter/abc_writer_points.cc +++ b/source/blender/io/alembic/exporter/abc_writer_points.cc @@ -123,15 +123,15 @@ void ABCPointsWriter::do_write(HierarchyContext &context) sub_v3_v3v3(vel, state.co, psys->particles[p].prev_state.co); /* Convert Z-up to Y-up. */ - points.push_back(Imath::V3f(pos[0], pos[2], -pos[1])); - velocities.push_back(Imath::V3f(vel[0], vel[2], -vel[1])); + points.emplace_back(pos[0], pos[2], -pos[1]); + velocities.emplace_back(vel[0], vel[2], -vel[1]); widths.push_back(psys->particles[p].size); ids.push_back(index++); } if (psys->lattice_deform_data) { BKE_lattice_deform_data_destroy(psys->lattice_deform_data); - psys->lattice_deform_data = NULL; + psys->lattice_deform_data = nullptr; } Alembic::Abc::P3fArraySample psample(points); diff --git a/source/blender/io/alembic/exporter/abc_writer_transform.cc b/source/blender/io/alembic/exporter/abc_writer_transform.cc index 7b1fa87de64..7fe9fd933c5 100644 --- a/source/blender/io/alembic/exporter/abc_writer_transform.cc +++ b/source/blender/io/alembic/exporter/abc_writer_transform.cc @@ -112,7 +112,7 @@ OObject ABCTransformWriter::get_alembic_object() const bool ABCTransformWriter::check_is_animated(const HierarchyContext &context) const { - if (context.duplicator != NULL) { + if (context.duplicator != nullptr) { /* This object is being duplicated, so could be emitted by a particle system and thus * influenced by forces. TODO(Sybren): Make this more strict. Probably better to get from the * depsgraph whether this object instance has a time source. */ diff --git a/source/blender/io/alembic/intern/abc_reader_curves.cc b/source/blender/io/alembic/intern/abc_reader_curves.cc index e29b6eda6fc..8d6605d6973 100644 --- a/source/blender/io/alembic/intern/abc_reader_curves.cc +++ b/source/blender/io/alembic/intern/abc_reader_curves.cc @@ -101,7 +101,7 @@ void AbcCurveReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSele ICompoundProperty user_props = m_curves_schema.getUserProperties(); if (user_props) { const PropertyHeader *header = user_props.getPropertyHeader(ABC_CURVE_RESOLUTION_U_PROPNAME); - if (header != NULL && header->isScalar() && IInt16Property::matches(*header)) { + if (header != nullptr && header->isScalar() && IInt16Property::matches(*header)) { IInt16Property resolu(user_props, header->getName()); cu->resolu = resolu.getValue(sample_sel); } @@ -218,10 +218,10 @@ void AbcCurveReader::read_curve_sample(Curve *cu, nu->pntsu -= overlap; } - const bool do_weights = (weights != NULL) && (weights->size() > 1); + const bool do_weights = (weights != nullptr) && (weights->size() > 1); float weight = 1.0f; - const bool do_radius = (radiuses != NULL) && (radiuses->size() > 1); + const bool do_radius = (radiuses != nullptr) && (radiuses->size() > 1); float radius = (radiuses && radiuses->size() == 1) ? (*radiuses)[0] : 1.0f; nu->type = CU_NURBS; diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc index 28e42b1f70f..14c3d756d56 100644 --- a/source/blender/io/alembic/intern/abc_reader_mesh.cc +++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc @@ -33,6 +33,7 @@ #include "DNA_object_types.h" #include "BLI_compiler_compat.h" +#include "BLI_listbase.h" #include "BLI_math_geom.h" #include "BKE_main.h" @@ -70,55 +71,44 @@ namespace blender::io::alembic { /* Some helpers for mesh generation */ namespace utils { -static void build_mat_map(const Main *bmain, std::map<std::string, Material *> &mat_map) +static std::map<std::string, Material *> build_material_map(const Main *bmain) { - Material *material = static_cast<Material *>(bmain->materials.first); - - for (; material; material = static_cast<Material *>(material->id.next)) { + std::map<std::string, Material *> mat_map; + LISTBASE_FOREACH (Material *, material, &bmain->materials) { mat_map[material->id.name + 2] = material; } + return mat_map; } static void assign_materials(Main *bmain, Object *ob, const std::map<std::string, int> &mat_index_map) { - bool can_assign = true; - std::map<std::string, int>::const_iterator it = mat_index_map.begin(); - - int matcount = 0; - for (; it != mat_index_map.end(); ++it, matcount++) { + std::map<std::string, int>::const_iterator it; + for (it = mat_index_map.begin(); it != mat_index_map.end(); ++it) { if (!BKE_object_material_slot_add(bmain, ob)) { - can_assign = false; - break; + return; } } - /* TODO(kevin): use global map? */ - std::map<std::string, Material *> mat_map; - build_mat_map(bmain, mat_map); - + std::map<std::string, Material *> matname_to_material = build_material_map(bmain); std::map<std::string, Material *>::iterator mat_iter; - if (can_assign) { - it = mat_index_map.begin(); - - for (; it != mat_index_map.end(); ++it) { - std::string mat_name = it->first; - mat_iter = mat_map.find(mat_name); + for (it = mat_index_map.begin(); it != mat_index_map.end(); ++it) { + const std::string mat_name = it->first; + const int mat_index = it->second; - Material *assigned_mat; - - if (mat_iter == mat_map.end()) { - assigned_mat = BKE_material_add(bmain, mat_name.c_str()); - mat_map[mat_name] = assigned_mat; - } - else { - assigned_mat = mat_iter->second; - } - - BKE_object_material_assign(bmain, ob, assigned_mat, it->second, BKE_MAT_ASSIGN_OBDATA); + Material *assigned_mat; + mat_iter = matname_to_material.find(mat_name); + if (mat_iter == matname_to_material.end()) { + assigned_mat = BKE_material_add(bmain, mat_name.c_str()); + matname_to_material[mat_name] = assigned_mat; + } + else { + assigned_mat = mat_iter->second; } + + BKE_object_material_assign(bmain, ob, assigned_mat, mat_index, BKE_MAT_ASSIGN_OBDATA); } } @@ -159,7 +149,8 @@ static void read_mverts(CDStreamConfig &config, const AbcMeshData &mesh_data) const P3fArraySamplePtr &positions = mesh_data.positions; if (config.use_vertex_interpolation && config.weight != 0.0f && - mesh_data.ceil_positions != NULL && mesh_data.ceil_positions->size() == positions->size()) { + mesh_data.ceil_positions != nullptr && + mesh_data.ceil_positions->size() == positions->size()) { read_mverts_interp(mverts, positions, mesh_data.ceil_positions, config.weight); return; } @@ -393,19 +384,19 @@ static void *add_customdata_cb(Mesh *mesh, const char *name, int data_type) /* unsupported custom data type -- don't do anything. */ if (!ELEM(cd_data_type, CD_MLOOPUV, CD_MLOOPCOL)) { - return NULL; + return nullptr; } loopdata = &mesh->ldata; cd_ptr = CustomData_get_layer_named(loopdata, cd_data_type, name); - if (cd_ptr != NULL) { + if (cd_ptr != nullptr) { /* layer already exists, so just return it. */ return cd_ptr; } /* Create a new layer. */ numloops = mesh->totloop; - cd_ptr = CustomData_add_layer_named(loopdata, cd_data_type, CD_DEFAULT, NULL, numloops, name); + cd_ptr = CustomData_add_layer_named(loopdata, cd_data_type, CD_DEFAULT, nullptr, numloops, name); return cd_ptr; } @@ -562,7 +553,7 @@ void AbcMeshReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelec m_object = BKE_object_add_only_object(bmain, OB_MESH, m_object_name.c_str()); m_object->data = mesh; - Mesh *read_mesh = this->read_mesh(mesh, sample_sel, MOD_MESHSEQ_READ_ALL, NULL); + Mesh *read_mesh = this->read_mesh(mesh, sample_sel, MOD_MESHSEQ_READ_ALL, nullptr); if (read_mesh != mesh) { /* XXX fixme after 2.80; mesh->flag isn't copied by BKE_mesh_nomain_to_mesh() */ /* read_mesh can be freed by BKE_mesh_nomain_to_mesh(), so get the flag before that happens. */ @@ -667,7 +658,7 @@ Mesh *AbcMeshReader::read_mesh(Mesh *existing_mesh, return existing_mesh; } - Mesh *new_mesh = NULL; + Mesh *new_mesh = nullptr; /* Only read point data when streaming meshes, unless we need to create new ones. */ ImportSettings settings; @@ -737,7 +728,7 @@ void AbcMeshReader::assign_facesets_to_mpoly(const ISampleSelector &sample_sel, const std::string &grp_name = face_sets[i]; if (r_mat_map.find(grp_name) == r_mat_map.end()) { - r_mat_map[grp_name] = 1 + current_mat++; + r_mat_map[grp_name] = ++current_mat; } const int assigned_mat = r_mat_map[grp_name]; @@ -787,7 +778,7 @@ BLI_INLINE MEdge *find_edge(MEdge *edges, int totedge, int v1, int v2) } } - return NULL; + return nullptr; } static void read_subd_sample(const std::string &iobject_full_name, @@ -877,7 +868,7 @@ void AbcSubDReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelec m_object = BKE_object_add_only_object(bmain, OB_MESH, m_object_name.c_str()); m_object->data = mesh; - Mesh *read_mesh = this->read_mesh(mesh, sample_sel, MOD_MESHSEQ_READ_ALL, NULL); + Mesh *read_mesh = this->read_mesh(mesh, sample_sel, MOD_MESHSEQ_READ_ALL, nullptr); if (read_mesh != mesh) { BKE_mesh_nomain_to_mesh(read_mesh, mesh, m_object, &CD_MASK_MESH, true); } @@ -913,7 +904,7 @@ void AbcSubDReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelec } MEdge *edge = find_edge(edges, totedge, v1, v2); - if (edge == NULL) { + if (edge == nullptr) { edge = find_edge(edges, totedge, v2, v1); } @@ -959,7 +950,7 @@ Mesh *AbcSubDReader::read_mesh(Mesh *existing_mesh, const Alembic::Abc::Int32ArraySamplePtr &face_indices = sample.getFaceIndices(); const Alembic::Abc::Int32ArraySamplePtr &face_counts = sample.getFaceCounts(); - Mesh *new_mesh = NULL; + Mesh *new_mesh = nullptr; ImportSettings settings; settings.read_flag |= read_flag; diff --git a/source/blender/io/alembic/intern/abc_reader_nurbs.cc b/source/blender/io/alembic/intern/abc_reader_nurbs.cc index 27d4ec44a27..2a5f4ecb787 100644 --- a/source/blender/io/alembic/intern/abc_reader_nurbs.cc +++ b/source/blender/io/alembic/intern/abc_reader_nurbs.cc @@ -197,7 +197,7 @@ void AbcNurbsReader::getNurbsPatches(const IObject &obj) if (num_children == 0) { INuPatch abc_nurb(obj, kWrapExisting); INuPatchSchema schem = abc_nurb.getSchema(); - m_schemas.push_back(std::pair<INuPatchSchema, IObject>(schem, obj)); + m_schemas.emplace_back(schem, obj); return; } @@ -218,7 +218,7 @@ void AbcNurbsReader::getNurbsPatches(const IObject &obj) if (INuPatch::matches(md) && ok) { INuPatch abc_nurb(child, kWrapExisting); INuPatchSchema schem = abc_nurb.getSchema(); - m_schemas.push_back(std::pair<INuPatchSchema, IObject>(schem, child)); + m_schemas.emplace_back(schem, child); } getNurbsPatches(child); diff --git a/source/blender/io/alembic/intern/abc_reader_object.cc b/source/blender/io/alembic/intern/abc_reader_object.cc index 707241ca17f..5ca7022bb36 100644 --- a/source/blender/io/alembic/intern/abc_reader_object.cc +++ b/source/blender/io/alembic/intern/abc_reader_object.cc @@ -44,13 +44,13 @@ using Alembic::AbcGeom::IXformSchema; namespace blender::io::alembic { AbcObjectReader::AbcObjectReader(const IObject &object, ImportSettings &settings) - : m_object(NULL), + : m_object(nullptr), m_iobject(object), m_settings(&settings), m_min_time(std::numeric_limits<chrono_t>::max()), m_max_time(std::numeric_limits<chrono_t>::min()), m_refcount(0), - parent_reader(NULL) + parent_reader(nullptr) { m_name = object.getFullName(); std::vector<std::string> parts; @@ -203,7 +203,7 @@ void AbcObjectReader::setupObjectTransform(const float time) if (!is_constant) { bConstraint *con = BKE_constraint_add_for_object( - m_object, NULL, CONSTRAINT_TYPE_TRANSFORM_CACHE); + m_object, nullptr, CONSTRAINT_TYPE_TRANSFORM_CACHE); bTransformCacheConstraint *data = static_cast<bTransformCacheConstraint *>(con->data); BLI_strncpy(data->object_path, m_iobject.getFullName().c_str(), FILE_MAX); diff --git a/source/blender/io/alembic/intern/abc_reader_points.cc b/source/blender/io/alembic/intern/abc_reader_points.cc index 88b5088805f..f7dcba7a0de 100644 --- a/source/blender/io/alembic/intern/abc_reader_points.cc +++ b/source/blender/io/alembic/intern/abc_reader_points.cc @@ -82,7 +82,7 @@ bool AbcPointsReader::accepts_object_type( void AbcPointsReader::readObjectData(Main *bmain, const Alembic::Abc::ISampleSelector &sample_sel) { Mesh *mesh = BKE_mesh_add(bmain, m_data_name.c_str()); - Mesh *read_mesh = this->read_mesh(mesh, sample_sel, 0, NULL); + Mesh *read_mesh = this->read_mesh(mesh, sample_sel, 0, nullptr); if (read_mesh != mesh) { BKE_mesh_nomain_to_mesh(read_mesh, mesh, m_object, &CD_MASK_MESH, true); @@ -145,7 +145,7 @@ struct Mesh *AbcPointsReader::read_mesh(struct Mesh *existing_mesh, const P3fArraySamplePtr &positions = sample.getPositions(); - Mesh *new_mesh = NULL; + Mesh *new_mesh = nullptr; if (existing_mesh->totvert != positions->size()) { new_mesh = BKE_mesh_new_nomain(positions->size(), 0, 0, 0, 0); diff --git a/source/blender/io/alembic/intern/abc_reader_transform.cc b/source/blender/io/alembic/intern/abc_reader_transform.cc index 3aab2f2d339..625cd255dba 100644 --- a/source/blender/io/alembic/intern/abc_reader_transform.cc +++ b/source/blender/io/alembic/intern/abc_reader_transform.cc @@ -72,7 +72,7 @@ bool AbcEmptyReader::accepts_object_type( void AbcEmptyReader::readObjectData(Main *bmain, const ISampleSelector &UNUSED(sample_sel)) { m_object = BKE_object_add_only_object(bmain, OB_EMPTY, m_object_name.c_str()); - m_object->data = NULL; + m_object->data = nullptr; } } // namespace blender::io::alembic diff --git a/source/blender/io/alembic/intern/abc_util.cc b/source/blender/io/alembic/intern/abc_util.cc index edb20da89a5..aa7beb37dc5 100644 --- a/source/blender/io/alembic/intern/abc_util.cc +++ b/source/blender/io/alembic/intern/abc_util.cc @@ -132,7 +132,7 @@ bool has_property(const Alembic::Abc::ICompoundProperty &prop, const std::string return false; } - return prop.getPropertyHeader(name) != NULL; + return prop.getPropertyHeader(name) != nullptr; } typedef std::pair<Alembic::AbcCoreAbstract::index_t, float> index_time_pair_t; @@ -173,7 +173,7 @@ float get_weight_and_index(float time, AbcObjectReader *create_reader(const Alembic::AbcGeom::IObject &object, ImportSettings &settings) { - AbcObjectReader *reader = NULL; + AbcObjectReader *reader = nullptr; const Alembic::AbcGeom::MetaData &md = object.getMetaData(); diff --git a/source/blender/io/alembic/intern/alembic_capi.cc b/source/blender/io/alembic/intern/alembic_capi.cc index 026a11ca25e..c9eefbf9039 100644 --- a/source/blender/io/alembic/intern/alembic_capi.cc +++ b/source/blender/io/alembic/intern/alembic_capi.cc @@ -167,7 +167,7 @@ AbcArchiveHandle *ABC_create_handle(struct Main *bmain, if (!archive->valid()) { delete archive; - return NULL; + return nullptr; } if (object_paths) { @@ -239,7 +239,7 @@ static std::pair<bool, AbcObjectReader *> visit_object( if (!object.valid()) { std::cerr << " - " << full_name << ": object is invalid, skipping it and all its children.\n"; - return std::make_pair(false, static_cast<AbcObjectReader *>(NULL)); + return std::make_pair(false, static_cast<AbcObjectReader *>(nullptr)); } /* The interpretation of data by the children determine the role of this @@ -261,7 +261,7 @@ static std::pair<bool, AbcObjectReader *> visit_object( bool child_claims_this_object = child_result.first; AbcObjectReader *child_reader = child_result.second; - if (child_reader == NULL) { + if (child_reader == nullptr) { BLI_assert(!child_claims_this_object); } else { @@ -277,7 +277,7 @@ static std::pair<bool, AbcObjectReader *> visit_object( } BLI_assert(children_claiming_this_object == claiming_child_readers.size()); - AbcObjectReader *reader = NULL; + AbcObjectReader *reader = nullptr; const MetaData &md = object.getMetaData(); bool parent_is_part_of_this_object = false; @@ -544,8 +544,8 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa const AbcObjectReader *parent_reader = reader->parent_reader; Object *ob = reader->object(); - if (parent_reader == NULL || !reader->inherits_xform()) { - ob->parent = NULL; + if (parent_reader == nullptr || !reader->inherits_xform()) { + ob->parent = nullptr; } else { ob->parent = parent_reader->object(); @@ -583,7 +583,7 @@ static void import_endjob(void *user_data) /* It's possible that cancellation occurred between the creation of * the reader and the creation of the Blender object. */ - if (ob == NULL) { + if (ob == nullptr) { continue; } @@ -685,7 +685,7 @@ bool ABC_import(bContext *C, job->settings.validate_meshes = validate_meshes; job->error_code = ABC_NO_ERROR; job->was_cancelled = false; - job->archive = NULL; + job->archive = nullptr; job->is_background_job = as_background_job; G.is_break = false; @@ -702,7 +702,7 @@ bool ABC_import(bContext *C, /* setup job */ WM_jobs_customdata_set(wm_job, job, import_freejob); WM_jobs_timer(wm_job, 0.1, NC_SCENE | ND_FRAME, NC_SCENE | ND_FRAME); - WM_jobs_callbacks(wm_job, import_startjob, NULL, NULL, import_endjob); + WM_jobs_callbacks(wm_job, import_startjob, nullptr, nullptr, import_endjob); WM_jobs_start(CTX_wm_manager(C), wm_job); } @@ -762,13 +762,13 @@ static AbcObjectReader *get_abc_reader(CacheReader *reader, Object *ob, const ch if (!iobject.valid()) { *err_str = "Invalid object: verify object path"; - return NULL; + return nullptr; } const ObjectHeader &header = iobject.getHeader(); if (!abc_reader->accepts_object_type(header, ob, err_str)) { /* err_str is set by acceptsObjectType() */ - return NULL; + return nullptr; } return abc_reader; @@ -789,8 +789,8 @@ Mesh *ABC_read_mesh(CacheReader *reader, int read_flag) { AbcObjectReader *abc_reader = get_abc_reader(reader, ob, err_str); - if (abc_reader == NULL) { - return NULL; + if (abc_reader == nullptr) { + return nullptr; } ISampleSelector sample_sel = sample_selector_for_time(time); @@ -801,7 +801,7 @@ bool ABC_mesh_topology_changed( CacheReader *reader, Object *ob, Mesh *existing_mesh, const float time, const char **err_str) { AbcObjectReader *abc_reader = get_abc_reader(reader, ob, err_str); - if (abc_reader == NULL) { + if (abc_reader == nullptr) { return false; } @@ -851,9 +851,9 @@ CacheReader *CacheReader_open_alembic_object(AbcArchiveHandle *handle, ImportSettings settings; AbcObjectReader *abc_reader = create_reader(iobject, settings); - if (abc_reader == NULL) { + if (abc_reader == nullptr) { /* This object is not supported */ - return NULL; + return nullptr; } abc_reader->object(object); abc_reader->incref(); diff --git a/source/blender/io/collada/AnimationExporter.cpp b/source/blender/io/collada/AnimationExporter.cpp index 9ecb890b649..73952b06bc9 100644 --- a/source/blender/io/collada/AnimationExporter.cpp +++ b/source/blender/io/collada/AnimationExporter.cpp @@ -228,7 +228,7 @@ void AnimationExporter::export_matrix_animation(Object *ob, BCAnimationSampler & if (keep_flat_curves || is_animated) { bAction *action = bc_getSceneObjectAction(ob); std::string name = encode_xml(id_name(ob)); - std::string action_name = (action == NULL) ? name + "-action" : id_name(action); + std::string action_name = (action == nullptr) ? name + "-action" : id_name(action); std::string channel_type = "transform"; std::string axis; std::string id = bc_get_action_id(action_name, name, channel_type, axis); @@ -290,7 +290,7 @@ BCAnimationCurve *AnimationExporter::get_modified_export_curve(Object *ob, BCAnimationCurveMap &curves) { std::string channel_type = curve.get_channel_type(); - BCAnimationCurve *mcurve = NULL; + BCAnimationCurve *mcurve = nullptr; if (channel_type == "lens") { /* Create an xfov curve */ @@ -302,7 +302,7 @@ BCAnimationCurve *AnimationExporter::get_modified_export_curve(Object *ob, BCValueMap lens_values; curve.get_value_map(lens_values); - BCAnimationCurve *sensor_curve = NULL; + BCAnimationCurve *sensor_curve = nullptr; BCCurveKey sensor_key(BC_ANIMATION_TYPE_CAMERA, "sensor_width", 0); BCAnimationCurveMap::iterator cit = curves.find(sensor_key); if (cit != curves.end()) { diff --git a/source/blender/io/collada/AnimationImporter.cpp b/source/blender/io/collada/AnimationImporter.cpp index 645a821b463..2e7977d89bb 100644 --- a/source/blender/io/collada/AnimationImporter.cpp +++ b/source/blender/io/collada/AnimationImporter.cpp @@ -228,7 +228,7 @@ void AnimationImporter::add_fcurves_to_object(Main *bmain, } if (ob->type == OB_ARMATURE) { - bActionGroup *grp = NULL; + bActionGroup *grp = nullptr; const char *bone_name = bc_get_joint_name(animated->node); if (bone_name) { @@ -236,7 +236,7 @@ void AnimationImporter::add_fcurves_to_object(Main *bmain, grp = BKE_action_group_find_name(act, bone_name); /* no matching groups, so add one */ - if (grp == NULL) { + if (grp == nullptr) { /* Add a new group, and make it active */ grp = (bActionGroup *)MEM_callocN(sizeof(bActionGroup), "bActionGroup"); @@ -355,7 +355,7 @@ void AnimationImporter::read_node_transform(COLLADAFW::Node *node, Object *ob) TransformReader::get_node_mat(mat, node, &uid_animated_map, ob); if (ob) { copy_m4_m4(ob->obmat, mat); - BKE_object_apply_mat4(ob, ob->obmat, 0, 0); + BKE_object_apply_mat4(ob, ob->obmat, false, false); } } @@ -662,7 +662,7 @@ void AnimationImporter::Assign_color_animations(const COLLADAFW::UniqueId &listi BLI_strncpy(rna_path, anim_type, sizeof(rna_path)); const COLLADAFW::AnimationList *animlist = animlist_map[listid]; - if (animlist == NULL) { + if (animlist == nullptr) { fprintf(stderr, "Collada: No animlist found for ID: %s of type %s\n", listid.toAscii().c_str(), @@ -818,7 +818,7 @@ void AnimationImporter::apply_matrix_curves(Object *ob, COLLADAFW::Transformation *tm) { bool is_joint = node->getType() == COLLADAFW::Node::JOINT; - const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL; + const char *bone_name = is_joint ? bc_get_joint_name(node) : nullptr; char joint_path[200]; if (is_joint) { armature_importer->get_rna_path_for_joint(node, joint_path, sizeof(joint_path)); @@ -847,7 +847,7 @@ void AnimationImporter::apply_matrix_curves(Object *ob, /* new curves to assign matrix transform animation */ FCurve *newcu[10]; /* if tm_type is matrix, then create 10 curves: 4 rot, 3 loc, 3 scale */ unsigned int totcu = 10; - const char *tm_str = NULL; + const char *tm_str = nullptr; char rna_path[200]; for (int i = 0; i < totcu; i++) { @@ -910,7 +910,7 @@ void AnimationImporter::apply_matrix_curves(Object *ob, float temp[4][4], par[4][4]; /* calc M */ - calc_joint_parent_mat_rest(par, NULL, root, node); + calc_joint_parent_mat_rest(par, nullptr, root, node); mul_m4_m4m4(temp, par, matfra); #if 0 @@ -1218,7 +1218,7 @@ void AnimationImporter::translate_Animations( for (unsigned int j = 0; j < matBinds.getCount(); j++) { const COLLADAFW::UniqueId &matuid = matBinds[j].getReferencedMaterial(); const COLLADAFW::Effect *ef = (COLLADAFW::Effect *)(FW_object_map[matuid]); - if (ef != NULL) { /* can be NULL T28909. */ + if (ef != nullptr) { /* can be NULL T28909. */ Material *ma = uid_material_map[matuid]; if (!ma) { fprintf(stderr, @@ -1303,7 +1303,7 @@ void AnimationImporter::add_bone_animation_sampled(Object *ob, /* new curves to assign matrix transform animation */ FCurve *newcu[10]; /* if tm_type is matrix, then create 10 curves: 4 rot, 3 loc, 3 scale. */ unsigned int totcu = 10; - const char *tm_str = NULL; + const char *tm_str = nullptr; char rna_path[200]; for (int i = 0; i < totcu; i++) { @@ -1358,7 +1358,7 @@ void AnimationImporter::add_bone_animation_sampled(Object *ob, Matrix temp, par; /* calc M */ - calc_joint_parent_mat_rest(par, NULL, root, node); + calc_joint_parent_mat_rest(par, nullptr, root, node); mul_m4_m4m4(temp, par, matfra); /* evaluate_joint_world_transform_at_frame(temp, NULL, node, fra); */ @@ -1442,7 +1442,7 @@ AnimationImporter::AnimMix *AnimationImporter::get_animation_type( for (unsigned int i = 0; i < nodeCameras.getCount(); i++) { const COLLADAFW::Camera *camera = (COLLADAFW::Camera *) FW_object_map[nodeCameras[i]->getInstanciatedObjectId()]; - if (camera == NULL) { + if (camera == nullptr) { /* Can happen if the node refers to an unknown camera. */ continue; } @@ -1476,7 +1476,7 @@ AnimationImporter::AnimMix *AnimationImporter::get_animation_type( for (unsigned int j = 0; j < matBinds.getCount(); j++) { const COLLADAFW::UniqueId &matuid = matBinds[j].getReferencedMaterial(); const COLLADAFW::Effect *ef = (COLLADAFW::Effect *)(FW_object_map[matuid]); - if (ef != NULL) { /* can be NULL T28909. */ + if (ef != nullptr) { /* can be NULL T28909. */ const COLLADAFW::CommonEffectPointerArray &commonEffects = ef->getCommonEffects(); if (!commonEffects.empty()) { COLLADAFW::EffectCommon *efc = commonEffects[0]; @@ -1597,10 +1597,10 @@ Object *AnimationImporter::translate_animation_OLD( root_map[node->getUniqueId()]; Object *ob = is_joint ? armature_importer->get_armature_for_joint(node) : object_map[node->getUniqueId()]; - const char *bone_name = is_joint ? bc_get_joint_name(node) : NULL; + const char *bone_name = is_joint ? bc_get_joint_name(node) : nullptr; if (!ob) { fprintf(stderr, "cannot find Object for Node with id=\"%s\"\n", node->getOriginalId().c_str()); - return NULL; + return nullptr; } /* frames at which to sample */ @@ -1620,7 +1620,7 @@ Object *AnimationImporter::translate_animation_OLD( Bone *bone = BKE_armature_find_bone_name((bArmature *)ob->data, bone_name); if (!bone) { fprintf(stderr, "cannot find bone \"%s\"\n", bone_name); - return NULL; + return nullptr; } unit_m4(rest); @@ -1628,7 +1628,7 @@ Object *AnimationImporter::translate_animation_OLD( invert_m4_m4(irest, rest); } - Object *job = NULL; + Object *job = nullptr; #ifdef ARMATURE_TEST FCurve *job_curves[10]; @@ -1641,7 +1641,7 @@ Object *AnimationImporter::translate_animation_OLD( std::sort(frames.begin(), frames.end()); - const char *tm_str = NULL; + const char *tm_str = nullptr; switch (tm_type) { case COLLADAFW::Transformation::ROTATE: tm_str = "rotation_quaternion"; @@ -1726,7 +1726,7 @@ Object *AnimationImporter::translate_animation_OLD( float temp[4][4], par[4][4]; /* calc M */ - calc_joint_parent_mat_rest(par, NULL, root, node); + calc_joint_parent_mat_rest(par, nullptr, root, node); mul_m4_m4m4(temp, par, matfra); /* evaluate_joint_world_transform_at_frame(temp, NULL, node, fra); */ @@ -2071,8 +2071,8 @@ void AnimationImporter::get_joint_rest_mat(float mat[4][4], if (!armature_importer->get_joint_bind_mat(mat, node)) { float par[4][4], m[4][4]; - calc_joint_parent_mat_rest(par, NULL, root, node); - get_node_mat(m, node, NULL, NULL); + calc_joint_parent_mat_rest(par, nullptr, root, node); + get_node_mat(m, node, nullptr, nullptr); mul_m4_m4m4(mat, par, m); } } @@ -2094,11 +2094,11 @@ bool AnimationImporter::calc_joint_parent_mat_rest(float mat[4][4], if (!armature_importer->get_joint_bind_mat(m, node)) { if (par) { float temp[4][4]; - get_node_mat(temp, node, NULL, NULL); + get_node_mat(temp, node, nullptr, nullptr); mul_m4_m4m4(m, par, temp); } else { - get_node_mat(m, node, NULL, NULL); + get_node_mat(m, node, nullptr, nullptr); } } @@ -2202,7 +2202,7 @@ void AnimationImporter::add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurv bActionGroup *grp = BKE_action_group_find_name(act, bone_name); /* no matching groups, so add one */ - if (grp == NULL) { + if (grp == nullptr) { /* Add a new group, and make it active */ grp = (bActionGroup *)MEM_callocN(sizeof(bActionGroup), "bActionGroup"); diff --git a/source/blender/io/collada/ArmatureExporter.cpp b/source/blender/io/collada/ArmatureExporter.cpp index 6aeffd22bbd..9bf1a4ae830 100644 --- a/source/blender/io/collada/ArmatureExporter.cpp +++ b/source/blender/io/collada/ArmatureExporter.cpp @@ -50,7 +50,7 @@ void ArmatureExporter::add_armature_bones(Object *ob_arm, /* write bone nodes */ bArmature *armature = (bArmature *)ob_arm->data; - bool is_edited = armature->edbo != NULL; + bool is_edited = armature->edbo != nullptr; if (!is_edited) { ED_armature_to_edit(armature); @@ -315,7 +315,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW: BCMatrix::sanitize(mat, LIMITTED_PRECISION); } - TransformWriter::add_joint_transform(node, mat, NULL, this->export_settings, has_restmat); + TransformWriter::add_joint_transform(node, mat, nullptr, this->export_settings, has_restmat); } std::string ArmatureExporter::get_controller_id(Object *ob_arm, Object *ob) diff --git a/source/blender/io/collada/ArmatureImporter.cpp b/source/blender/io/collada/ArmatureImporter.cpp index af6558da3b4..9533ca322f9 100644 --- a/source/blender/io/collada/ArmatureImporter.cpp +++ b/source/blender/io/collada/ArmatureImporter.cpp @@ -56,7 +56,7 @@ ArmatureImporter::ArmatureImporter(UnitConverter *conv, view_layer(view_layer), unit_converter(conv), import_settings(import_settings), - empty(NULL), + empty(nullptr), mesh_importer(mesh) { } @@ -139,7 +139,7 @@ int ArmatureImporter::create_bone(SkinInfo *skin, /* create a bone even if there's no joint data for it (i.e. it has no influence) */ if (!bone_is_skinned) { - get_node_mat(mat, node, NULL, NULL, parent_mat); + get_node_mat(mat, node, nullptr, nullptr, parent_mat); } if (parent) { @@ -174,14 +174,14 @@ int ArmatureImporter::create_bone(SkinInfo *skin, else { float angle; mat4_to_loc_rot_size(loc, rot, size, mat); - mat3_to_vec_roll(rot, NULL, &angle); + mat3_to_vec_roll(rot, nullptr, &angle); bone->roll = angle; } copy_v3_v3(bone->head, mat[3]); if (bone_is_skinned && this->import_settings->keep_bind_info) { float rest_mat[4][4]; - get_node_mat(rest_mat, node, NULL, NULL, NULL); + get_node_mat(rest_mat, node, nullptr, nullptr, nullptr); bc_set_IDPropertyMatrix(bone, "bind_mat", joint_bind_mat); bc_set_IDPropertyMatrix(bone, "rest_mat", rest_mat); } @@ -230,7 +230,7 @@ void ArmatureImporter::fix_leaf_bone_hierarchy(bArmature *armature, Bone *bone, bool fix_orientation) { - if (bone == NULL) { + if (bone == nullptr) { return; } @@ -251,14 +251,14 @@ void ArmatureImporter::fix_leaf_bone(bArmature *armature, BoneExtended *be, bool fix_orientation) { - if (be == NULL || !be->has_tail()) { + if (be == nullptr || !be->has_tail()) { /* 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; float vec[3]; - if (fix_orientation && ebone->parent != NULL) { + if (fix_orientation && ebone->parent != nullptr) { EditBone *parent = ebone->parent; sub_v3_v3v3(vec, ebone->head, parent->head); if (len_squared_v3(vec) < MINIMUM_BONE_LENGTH) { @@ -279,7 +279,7 @@ void ArmatureImporter::fix_leaf_bone(bArmature *armature, void ArmatureImporter::fix_parent_connect(bArmature *armature, Bone *bone) { /* armature has no bones */ - if (bone == NULL) { + if (bone == nullptr) { return; } @@ -297,18 +297,18 @@ void ArmatureImporter::connect_bone_chains(bArmature *armature, int max_chain_length) { BoneExtensionMap &extended_bones = bone_extension_manager.getExtensionMap(armature); - BoneExtended *dominant_child = NULL; + BoneExtended *dominant_child = nullptr; int maxlen = 0; - if (parentbone == NULL) { + if (parentbone == nullptr) { return; } Bone *child = (Bone *)parentbone->childbase.first; - if (child && (import_settings->find_chains || child->next == NULL)) { + if (child && (import_settings->find_chains || child->next == nullptr)) { for (; child; child = child->next) { BoneExtended *be = extended_bones[child->name]; - if (be != NULL) { + if (be != nullptr) { int chain_len = be->get_chain_length(); if (chain_len <= max_chain_length) { if (chain_len > maxlen) { @@ -316,7 +316,7 @@ void ArmatureImporter::connect_bone_chains(bArmature *armature, maxlen = chain_len; } else if (chain_len == maxlen) { - dominant_child = NULL; + dominant_child = nullptr; } } } @@ -324,7 +324,7 @@ void ArmatureImporter::connect_bone_chains(bArmature *armature, } BoneExtended *pbe = extended_bones[parentbone->name]; - if (dominant_child != NULL) { + if (dominant_child != nullptr) { /* Found a valid chain. Now connect current bone with that chain.*/ EditBone *pebone = bc_get_edit_bone(armature, parentbone->name); EditBone *cebone = bc_get_edit_bone(armature, dominant_child->get_name()); @@ -429,7 +429,7 @@ Object *ArmatureImporter::get_empty_for_leaves() return empty; } - empty = bc_add_object(m_bmain, scene, view_layer, OB_EMPTY, NULL); + empty = bc_add_object(m_bmain, scene, view_layer, OB_EMPTY, nullptr); empty->empty_drawtype = OB_EMPTY_SPHERE; return empty; @@ -480,7 +480,7 @@ void ArmatureImporter::create_armature_bones(Main *bmain, std::vector<Object *> /* if there is an armature created for root_joint next root_joint */ for (ri = root_joints.begin(); ri != root_joints.end(); ri++) { COLLADAFW::Node *node = *ri; - if (get_armature_for_joint(node) != NULL) { + if (get_armature_for_joint(node) != nullptr) { continue; } @@ -506,7 +506,8 @@ void ArmatureImporter::create_armature_bones(Main *bmain, std::vector<Object *> ED_armature_to_edit(armature); armature->layer = 0; /* layer is set according to imported bone set in create_bone() */ - create_bone(NULL, node, NULL, node->getChildNodes().getCount(), NULL, armature, layer_labels); + create_bone( + nullptr, node, nullptr, node->getChildNodes().getCount(), nullptr, armature, layer_labels); if (this->import_settings->find_chains) { connect_bone_chains(armature, (Bone *)armature->bonebase.first, UNLIMITED_CHAIN_MAX); } @@ -543,7 +544,7 @@ Object *ArmatureImporter::create_armature_bones(Main *bmain, SkinInfo &skin) * - exit edit mode * - set a sphere shape to leaf bones */ - Object *ob_arm = NULL; + Object *ob_arm = nullptr; /* * find if there's another skin sharing at least one bone with this skin @@ -579,14 +580,14 @@ Object *ArmatureImporter::create_armature_bones(Main *bmain, SkinInfo &skin) */ SkinInfo *a = &skin; - Object *shared = NULL; + Object *shared = nullptr; std::vector<COLLADAFW::Node *> skin_root_joints; std::vector<std::string> layer_labels; std::map<COLLADAFW::UniqueId, SkinInfo>::iterator it; for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) { SkinInfo *b = &it->second; - if (b == a || b->BKE_armature_from_object() == NULL) { + if (b == a || b->BKE_armature_from_object() == nullptr) { continue; } @@ -603,7 +604,7 @@ Object *ArmatureImporter::create_armature_bones(Main *bmain, SkinInfo &skin) } } - if (shared != NULL) { + if (shared != nullptr) { break; } } @@ -651,7 +652,7 @@ Object *ArmatureImporter::create_armature_bones(Main *bmain, SkinInfo &skin) if (skin.uses_joint_or_descendant(node)) { create_bone( - &skin, node, NULL, node->getChildNodes().getCount(), NULL, armature, layer_labels); + &skin, node, nullptr, node->getChildNodes().getCount(), nullptr, armature, layer_labels); if (joint_parent_map.find(node->getUniqueId()) != joint_parent_map.end() && !skin.get_parent()) { @@ -707,7 +708,7 @@ void ArmatureImporter::set_pose(Object *ob_arm, float obmat[4][4]; /* object-space */ - get_node_mat(obmat, root_node, NULL, NULL); + get_node_mat(obmat, root_node, nullptr, nullptr); bool is_decomposed = node_is_decomposed(root_node); // if (*edbone) @@ -804,7 +805,7 @@ void ArmatureImporter::make_armatures(bContext *C, std::vector<Object *> &object /* link armature with a mesh object */ const COLLADAFW::UniqueId &uid = skin.get_controller_uid(); const COLLADAFW::UniqueId *guid = get_geometry_uid(uid); - if (guid != NULL) { + if (guid != nullptr) { Object *ob = mesh_importer->get_object_by_geom_uid(*guid); if (ob) { skin.link_armature(C, ob, joint_by_uid, this); @@ -1001,7 +1002,7 @@ void ArmatureImporter::make_shape_keys(bContext *C) COLLADAFW::UniqueId *ArmatureImporter::get_geometry_uid(const COLLADAFW::UniqueId &controller_uid) { if (geom_uid_by_controller_uid.find(controller_uid) == geom_uid_by_controller_uid.end()) { - return NULL; + return nullptr; } return &geom_uid_by_controller_uid[controller_uid]; @@ -1024,7 +1025,7 @@ Object *ArmatureImporter::get_armature_for_joint(COLLADAFW::Node *node) return arm->second; } } - return NULL; + return nullptr; } void ArmatureImporter::set_tags_map(TagsMap &tags_map) @@ -1065,7 +1066,7 @@ BoneExtended &ArmatureImporter::add_bone_extended(EditBone *bone, extended_bones[bone->name] = be; TagsMap::iterator etit; - ExtraTags *et = 0; + ExtraTags *et = nullptr; etit = uid_tags_map.find(node->getUniqueId().toAscii()); bool has_connect = false; diff --git a/source/blender/io/collada/BCAnimationCurve.cpp b/source/blender/io/collada/BCAnimationCurve.cpp index 46439bb3556..33eaf3376cd 100644 --- a/source/blender/io/collada/BCAnimationCurve.cpp +++ b/source/blender/io/collada/BCAnimationCurve.cpp @@ -22,7 +22,7 @@ BCAnimationCurve::BCAnimationCurve() { this->curve_key.set_object_type(BC_ANIMATION_TYPE_OBJECT); - this->fcurve = NULL; + this->fcurve = nullptr; this->curve_is_local_copy = false; } @@ -53,7 +53,7 @@ BCAnimationCurve::BCAnimationCurve(BCCurveKey key, Object *ob, FCurve *fcu) BCAnimationCurve::BCAnimationCurve(const BCCurveKey &key, Object *ob) { this->curve_key = key; - this->fcurve = NULL; + this->fcurve = nullptr; this->curve_is_local_copy = false; init_pointer_rna(ob); } @@ -120,7 +120,7 @@ BCAnimationCurve::~BCAnimationCurve() if (curve_is_local_copy && fcurve) { // fprintf(stderr, "removed fcurve %s\n", fcurve->rna_path); delete_fcurve(fcurve); - this->fcurve = NULL; + this->fcurve = nullptr; } } @@ -169,7 +169,7 @@ std::string BCAnimationCurve::get_animation_name(Object *ob) const } break; case BC_ANIMATION_TYPE_BONE: { - if (fcurve == NULL || fcurve->rna_path == NULL) { + if (fcurve == nullptr || fcurve->rna_path == nullptr) { name = ""; } else { @@ -218,7 +218,7 @@ std::string BCAnimationCurve::get_rna_path() const int BCAnimationCurve::sample_count() const { - if (fcurve == NULL) { + if (fcurve == nullptr) { return 0; } return fcurve->totvert; @@ -226,7 +226,7 @@ int BCAnimationCurve::sample_count() const int BCAnimationCurve::closest_index_above(const float sample_frame, const int start_at) const { - if (fcurve == NULL) { + if (fcurve == nullptr) { return -1; } @@ -240,7 +240,7 @@ int BCAnimationCurve::closest_index_above(const float sample_frame, const int st int BCAnimationCurve::closest_index_below(const float sample_frame) const { - if (fcurve == NULL) { + if (fcurve == nullptr) { return -1; } @@ -304,14 +304,14 @@ FCurve *BCAnimationCurve::get_edit_fcurve() void BCAnimationCurve::clean_handles() { - if (fcurve == NULL) { + if (fcurve == nullptr) { fcurve = get_edit_fcurve(); } /* Keep old bezt data for copy)*/ BezTriple *old_bezts = fcurve->bezt; int totvert = fcurve->totvert; - fcurve->bezt = NULL; + fcurve->bezt = nullptr; fcurve->totvert = 0; for (int i = 0; i < totvert; i++) { @@ -492,7 +492,7 @@ bool BCAnimationCurve::add_value_from_rna(const int frame_index) void BCAnimationCurve::get_value_map(BCValueMap &value_map) { value_map.clear(); - if (fcurve == NULL) { + if (fcurve == nullptr) { return; } @@ -533,7 +533,7 @@ bool BCAnimationCurve::is_animated() bool BCAnimationCurve::is_keyframe(int frame) { - if (this->fcurve == NULL) { + if (this->fcurve == nullptr) { return false; } diff --git a/source/blender/io/collada/BCAnimationSampler.cpp b/source/blender/io/collada/BCAnimationSampler.cpp index 6bada9950b9..abc770ceef5 100644 --- a/source/blender/io/collada/BCAnimationSampler.cpp +++ b/source/blender/io/collada/BCAnimationSampler.cpp @@ -116,7 +116,7 @@ static bool is_object_keyframe(Object *ob, int frame_index) static void add_keyframes_from(bAction *action, BCFrameSet &frameset) { if (action) { - FCurve *fcu = NULL; + FCurve *fcu = nullptr; for (fcu = (FCurve *)action->curves.first; fcu; fcu = fcu->next) { BezTriple *bezt = fcu->bezt; for (int i = 0; i < fcu->totvert; bezt++, i++) { @@ -237,7 +237,7 @@ bool BCAnimationSampler::is_animated_by_constraint(Object *ob, { bConstraint *con; for (con = (bConstraint *)conlist->first; con; con = con->next) { - ListBase targets = {NULL, NULL}; + ListBase targets = {nullptr, nullptr}; const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); @@ -468,7 +468,7 @@ void BCAnimationSampler::initialize_curves(BCAnimationCurveMap &curves, Object * } /* Add curves on Object->data actions */ - action = NULL; + action = nullptr; if (ob->type == OB_CAMERA) { action = bc_getSceneCameraAction(ob); object_type = BC_ANIMATION_TYPE_CAMERA; @@ -520,7 +520,7 @@ const BCSample *BCSampleFrame::get_sample(Object *ob) const { BCSampleMap::const_iterator it = sampleMap.find(ob); if (it == sampleMap.end()) { - return NULL; + return nullptr; } return it->second; } @@ -529,7 +529,7 @@ const BCMatrix *BCSampleFrame::get_sample_matrix(Object *ob) const { BCSampleMap::const_iterator it = sampleMap.find(ob); if (it == sampleMap.end()) { - return NULL; + return nullptr; } BCSample *sample = it->second; return &sample->get_matrix(); @@ -540,7 +540,7 @@ const BCMatrix *BCSampleFrame::get_sample_matrix(Object *ob, Bone *bone) const { BCSampleMap::const_iterator it = sampleMap.find(ob); if (it == sampleMap.end()) { - return NULL; + return nullptr; } BCSample *sample = it->second; @@ -577,7 +577,7 @@ BCSample &BCSampleFrameContainer::add(Object *ob, int frame_index) BCSampleFrame *BCSampleFrameContainer::get_frame(int frame_index) { BCSampleFrameMap::iterator it = sample_frames.find(frame_index); - BCSampleFrame *frame = (it == sample_frames.end()) ? NULL : &it->second; + BCSampleFrame *frame = (it == sample_frames.end()) ? nullptr : &it->second; return frame; } diff --git a/source/blender/io/collada/BCSampleData.cpp b/source/blender/io/collada/BCSampleData.cpp index f099e250565..339dc829742 100644 --- a/source/blender/io/collada/BCSampleData.cpp +++ b/source/blender/io/collada/BCSampleData.cpp @@ -86,7 +86,7 @@ const BCMatrix *BCSample::get_matrix(Bone *bone) const { BCBoneMatrixMap::const_iterator it = bonemats.find(bone); if (it == bonemats.end()) { - return NULL; + return nullptr; } return it->second; } diff --git a/source/blender/io/collada/ControllerExporter.cpp b/source/blender/io/collada/ControllerExporter.cpp index 1d8d0f2b389..52d4bbf122e 100644 --- a/source/blender/io/collada/ControllerExporter.cpp +++ b/source/blender/io/collada/ControllerExporter.cpp @@ -47,7 +47,7 @@ bool ControllerExporter::is_skinned_mesh(Object *ob) { - return bc_get_assigned_armature(ob) != NULL; + return bc_get_assigned_armature(ob) != nullptr; } void ControllerExporter::write_bone_URLs(COLLADASW::InstanceController &ins, @@ -175,7 +175,7 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm) bool use_instantiation = this->export_settings.get_use_object_instantiation(); Mesh *me; - if (((Mesh *)ob->data)->dvert == NULL) { + if (((Mesh *)ob->data)->dvert == nullptr) { return; } @@ -272,7 +272,7 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm) add_joints_element(&ob->defbase, joints_source_id, inv_bind_mat_source_id); add_vertex_weights_element(weights_source_id, joints_source_id, vcounts, joints); - BKE_id_free(NULL, me); + BKE_id_free(nullptr, me); closeSkin(); closeController(); @@ -312,7 +312,7 @@ void ControllerExporter::export_morph_controller(Object *ob, Key *key) COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, morph_weights_id))); targets.add(); - BKE_id_free(NULL, me); + BKE_id_free(nullptr, me); /* support for animations * can also try the base element and param alternative */ @@ -530,7 +530,7 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm, float loc[3]; float rot[3] = {0, 0, 0}; float scale[3]; - bc_decompose(bind_mat, loc, NULL, NULL, scale); + bc_decompose(bind_mat, loc, nullptr, nullptr, scale); /* Only translations, no rotation vs armature */ loc_eulO_size_to_mat4(bind_mat, loc, rot, scale, 6); @@ -571,12 +571,12 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm, Bone *ControllerExporter::get_bone_from_defgroup(Object *ob_arm, bDeformGroup *def) { bPoseChannel *pchan = BKE_pose_channel_find_name(ob_arm->pose, def->name); - return pchan ? pchan->bone : NULL; + return pchan ? pchan->bone : nullptr; } bool ControllerExporter::is_bone_defgroup(Object *ob_arm, bDeformGroup *def) { - return get_bone_from_defgroup(ob_arm, def) != NULL; + return get_bone_from_defgroup(ob_arm, def) != nullptr; } std::string ControllerExporter::add_weights_source(Mesh *me, diff --git a/source/blender/io/collada/DocumentExporter.cpp b/source/blender/io/collada/DocumentExporter.cpp index 65c71b0edef..241afbd4034 100644 --- a/source/blender/io/collada/DocumentExporter.cpp +++ b/source/blender/io/collada/DocumentExporter.cpp @@ -127,7 +127,7 @@ char *bc_CustomData_get_layer_name(const struct CustomData *data, int type, int { int layer_index = CustomData_get_layer_index(data, type); if (layer_index < 0) { - return NULL; + return nullptr; } return data->layers[layer_index + n].name; @@ -138,7 +138,7 @@ char *bc_CustomData_get_active_layer_name(const CustomData *data, int type) /* get the layer index of the active layer of type */ int layer_index = CustomData_get_active_layer_index(data, type); if (layer_index < 0) { - return NULL; + return nullptr; } return data->layers[layer_index].name; @@ -155,7 +155,7 @@ static COLLADABU::NativeString make_temp_filepath(const char *name, const char * { char tempfile[FILE_MAX]; - if (name == NULL) { + if (name == nullptr) { name = "untitled"; } @@ -184,7 +184,7 @@ int DocumentExporter::exportCurrentScene() clear_global_id_map(); - COLLADABU::NativeString native_filename = make_temp_filepath(NULL, ".dae"); + COLLADABU::NativeString native_filename = make_temp_filepath(nullptr, ".dae"); COLLADASW::StreamWriter *writer = new COLLADASW::StreamWriter(native_filename); /* open <collada> */ diff --git a/source/blender/io/collada/DocumentImporter.cpp b/source/blender/io/collada/DocumentImporter.cpp index b9f132d04dd..b85a96d89de 100644 --- a/source/blender/io/collada/DocumentImporter.cpp +++ b/source/blender/io/collada/DocumentImporter.cpp @@ -224,7 +224,7 @@ void DocumentImporter::finish() fprintf(stderr, "+-- Import Scene --------\n"); const COLLADAFW::NodePointerArray &roots = (*sit)->getRootNodes(); for (unsigned int i = 0; i < roots.getCount(); i++) { - std::vector<Object *> *objects_done = write_node(roots[i], NULL, sce, NULL, false); + std::vector<Object *> *objects_done = write_node(roots[i], nullptr, sce, nullptr, false); objects_to_scale->insert( objects_to_scale->end(), objects_done->begin(), objects_done->end()); delete objects_done; @@ -247,7 +247,7 @@ void DocumentImporter::finish() const COLLADAFW::NodePointerArray &roots = (*vsit)->getRootNodes(); for (unsigned int i = 0; i < roots.getCount(); i++) { - translate_anim_recursive(roots[i], NULL, NULL); + translate_anim_recursive(roots[i], nullptr, nullptr); } } @@ -270,12 +270,12 @@ void DocumentImporter::finish() /* update scene */ DEG_id_tag_update(&sce->id, ID_RECALC_COPY_ON_WRITE); DEG_relations_tag_update(bmain); - WM_event_add_notifier(mContext, NC_OBJECT | ND_TRANSFORM, NULL); + WM_event_add_notifier(mContext, NC_OBJECT | ND_TRANSFORM, nullptr); } void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, - COLLADAFW::Node *par = NULL, - Object *parob = NULL) + COLLADAFW::Node *par = nullptr, + Object *parob = nullptr) { /* The split in T29246, rootmap must point at actual root when * calculating bones in apply_curves_as_matrix. - actual root is the root node. @@ -306,7 +306,7 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, #endif unsigned int i; - if (node->getType() == COLLADAFW::Node::JOINT && par == NULL) { + if (node->getType() == COLLADAFW::Node::JOINT && par == nullptr) { /* For Skeletons without root node we have to simulate the * root node here and recursively enter the same function * XXX: maybe this can be made more elegant. */ @@ -317,7 +317,7 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, node, root_map, object_map, FW_object_map, uid_material_map); COLLADAFW::NodePointerArray &children = node->getChildNodes(); for (i = 0; i < children.getCount(); i++) { - translate_anim_recursive(children[i], node, NULL); + translate_anim_recursive(children[i], node, nullptr); } } } @@ -375,11 +375,11 @@ Object *DocumentImporter::create_camera_object(COLLADAFW::InstanceCamera *camera const COLLADAFW::UniqueId &cam_uid = camera->getInstanciatedObjectId(); if (uid_camera_map.find(cam_uid) == uid_camera_map.end()) { // fprintf(stderr, "Couldn't find camera by UID.\n"); - return NULL; + return nullptr; } Main *bmain = CTX_data_main(mContext); - Object *ob = bc_add_object(bmain, sce, view_layer, OB_CAMERA, NULL); + Object *ob = bc_add_object(bmain, sce, view_layer, OB_CAMERA, nullptr); Camera *cam = uid_camera_map[cam_uid]; Camera *old_cam = (Camera *)ob->data; ob->data = cam; @@ -392,11 +392,11 @@ Object *DocumentImporter::create_light_object(COLLADAFW::InstanceLight *lamp, Sc const COLLADAFW::UniqueId &lamp_uid = lamp->getInstanciatedObjectId(); if (uid_light_map.find(lamp_uid) == uid_light_map.end()) { fprintf(stderr, "Couldn't find light by UID.\n"); - return NULL; + return nullptr; } Main *bmain = CTX_data_main(mContext); - Object *ob = bc_add_object(bmain, sce, view_layer, OB_LAMP, NULL); + Object *ob = bc_add_object(bmain, sce, view_layer, OB_LAMP, nullptr); Light *la = uid_light_map[lamp_uid]; Light *old_light = (Light *)ob->data; ob->data = la; @@ -438,7 +438,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, } /* calc new matrix and apply */ mul_m4_m4m4(obn->obmat, obn->obmat, mat); - BKE_object_apply_mat4(obn, obn->obmat, 0, 0); + BKE_object_apply_mat4(obn, obn->obmat, false, false); } } else { @@ -456,7 +456,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, continue; } COLLADAFW::InstanceNodePointerArray &inodes = child_node->getInstanceNodes(); - Object *new_child = NULL; + Object *new_child = nullptr; if (inodes.getCount()) { /* \todo loop through instance nodes */ const COLLADAFW::UniqueId &id = inodes[0]->getInstanciatedObjectId(); fprintf(stderr, "Doing %d child nodes\n", (int)node_map.count(id)); @@ -465,7 +465,7 @@ Object *DocumentImporter::create_instance_node(Object *source_ob, } else { new_child = create_instance_node( - object_map.find(child_id)->second, child_node, NULL, sce, is_library_node); + object_map.find(child_id)->second, child_node, nullptr, sce, is_library_node); } bc_set_parent(new_child, obn, mContext, true); @@ -509,7 +509,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, bool is_library_node) { Main *bmain = CTX_data_main(mContext); - Object *ob = NULL; + Object *ob = nullptr; bool is_joint = node->getType() == COLLADAFW::Node::JOINT; bool read_transform = true; std::string id = node->getOriginalId(); @@ -525,7 +525,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, stderr, "| %s id='%s', name='%s'\n", is_joint ? "JOINT" : "NODE ", id.c_str(), name.c_str()); if (is_joint) { - if (parent_node == NULL && !is_library_node) { + if (parent_node == nullptr && !is_library_node) { /* A Joint on root level is a skeleton without root node. * Here we add the armature "on the fly": */ par = bc_add_object(bmain, sce, view_layer, OB_ARMATURE, std::string("Armature").c_str()); @@ -534,11 +534,11 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, object_map.insert(std::pair<COLLADAFW::UniqueId, Object *>(node->getUniqueId(), par)); node_map[node->getUniqueId()] = node; } - if (parent_node == NULL || parent_node->getType() != COLLADAFW::Node::JOINT) { + if (parent_node == nullptr || parent_node->getType() != COLLADAFW::Node::JOINT) { armature_importer.add_root_joint(node, par); } - if (parent_node == NULL) { + if (parent_node == nullptr) { /* for skeletons without root node all has been done above. * Skeletons with root node are handled further down. */ goto finally; @@ -561,12 +561,12 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, * sure... <instance_geometry> */ while (geom_done < geom.getCount()) { ob = mesh_importer.create_mesh_object(node, geom[geom_done], false, uid_material_map); - if (ob == NULL) { + if (ob == nullptr) { report_unknown_reference(*node, "instance_mesh"); } else { objects_done->push_back(ob); - if (parent_node == NULL) { + if (parent_node == nullptr) { root_objects->push_back(ob); } } @@ -574,12 +574,12 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, } while (camera_done < camera.getCount()) { ob = create_camera_object(camera[camera_done], sce); - if (ob == NULL) { + if (ob == nullptr) { report_unknown_reference(*node, "instance_camera"); } else { objects_done->push_back(ob); - if (parent_node == NULL) { + if (parent_node == nullptr) { root_objects->push_back(ob); } } @@ -587,12 +587,12 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, } while (lamp_done < lamp.getCount()) { ob = create_light_object(lamp[lamp_done], sce); - if (ob == NULL) { + if (ob == nullptr) { report_unknown_reference(*node, "instance_light"); } else { objects_done->push_back(ob); - if (parent_node == NULL) { + if (parent_node == nullptr) { root_objects->push_back(ob); } } @@ -602,12 +602,12 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLADAFW::InstanceGeometry *geometry = (COLLADAFW::InstanceGeometry *) controller[controller_done]; ob = mesh_importer.create_mesh_object(node, geometry, true, uid_material_map); - if (ob == NULL) { + if (ob == nullptr) { report_unknown_reference(*node, "instance_controller"); } else { objects_done->push_back(ob); - if (parent_node == NULL) { + if (parent_node == nullptr) { root_objects->push_back(ob); } } @@ -620,7 +620,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, fprintf(stderr, "Cannot find object for node referenced by <instance_node name=\"%s\">.\n", inst_node[inst_done]->getName().c_str()); - ob = NULL; + ob = nullptr; } else { std::pair<std::multimap<COLLADAFW::UniqueId, Object *>::iterator, @@ -633,7 +633,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, 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) { + if (parent_node == nullptr) { root_objects->push_back(ob); } } @@ -651,10 +651,10 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, ob = bc_add_object(bmain, sce, view_layer, OB_ARMATURE, name.c_str()); } else { - ob = bc_add_object(bmain, sce, view_layer, OB_EMPTY, NULL); + ob = bc_add_object(bmain, sce, view_layer, OB_EMPTY, nullptr); } objects_done->push_back(ob); - if (parent_node == NULL) { + if (parent_node == nullptr) { root_objects->push_back(ob); } } @@ -701,7 +701,7 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, } if (objects_done->empty()) { - ob = NULL; + ob = nullptr; } else { ob = *objects_done->begin(); @@ -763,7 +763,7 @@ bool DocumentImporter::writeLibraryNodes(const COLLADAFW::LibraryNodes *libraryN fprintf(stderr, "+-- Read Library nodes ----------\n"); for (unsigned int i = 0; i < nodes.getCount(); i++) { std::vector<Object *> *child_objects; - child_objects = write_node(nodes[i], NULL, sce, NULL, true); + child_objects = write_node(nodes[i], nullptr, sce, nullptr, true); delete child_objects; } return true; @@ -876,7 +876,7 @@ bool DocumentImporter::writeCamera(const COLLADAFW::Camera *camera) } Main *bmain = CTX_data_main(mContext); - Camera *cam = NULL; + Camera *cam = nullptr; std::string cam_id, cam_name; ExtraTags *et = getExtraTags(camera->getUniqueId()); @@ -1029,7 +1029,7 @@ bool DocumentImporter::writeLight(const COLLADAFW::Light *light) } Main *bmain = CTX_data_main(mContext); - Light *lamp = NULL; + Light *lamp = nullptr; std::string la_id, la_name; ExtraTags *et = getExtraTags(light->getUniqueId()); @@ -1237,7 +1237,7 @@ bool DocumentImporter::writeKinematicsScene(const COLLADAFW::KinematicsScene *ki ExtraTags *DocumentImporter::getExtraTags(const COLLADAFW::UniqueId &uid) { if (uid_tags_map.find(uid.toAscii()) == uid_tags_map.end()) { - return NULL; + return nullptr; } return uid_tags_map[uid.toAscii()]; } diff --git a/source/blender/io/collada/ExtraHandler.cpp b/source/blender/io/collada/ExtraHandler.cpp index acfa74f34af..8aefb321dd6 100644 --- a/source/blender/io/collada/ExtraHandler.cpp +++ b/source/blender/io/collada/ExtraHandler.cpp @@ -23,7 +23,8 @@ #include "ExtraHandler.h" -ExtraHandler::ExtraHandler(DocumentImporter *dimp, AnimationImporter *aimp) : currentExtraTags(0) +ExtraHandler::ExtraHandler(DocumentImporter *dimp, AnimationImporter *aimp) + : currentExtraTags(nullptr) { this->dimp = dimp; this->aimp = aimp; @@ -50,7 +51,7 @@ bool ExtraHandler::textData(const char *text, size_t textLength) { char buf[1024]; - if (currentElement.length() == 0 || currentExtraTags == 0) { + if (currentElement.length() == 0 || currentExtraTags == nullptr) { return false; } @@ -64,7 +65,7 @@ bool ExtraHandler::parseElement(const char *profileName, const COLLADAFW::UniqueId &uniqueId) { /* implement for backwards compatibility, new version added object parameter */ - return parseElement(profileName, elementHash, uniqueId, NULL); + return parseElement(profileName, elementHash, uniqueId, nullptr); } bool ExtraHandler::parseElement(const char *profileName, diff --git a/source/blender/io/collada/GeometryExporter.cpp b/source/blender/io/collada/GeometryExporter.cpp index 332390845c7..def7caabf32 100644 --- a/source/blender/io/collada/GeometryExporter.cpp +++ b/source/blender/io/collada/GeometryExporter.cpp @@ -140,7 +140,7 @@ void GeometryExporter::operator()(Object *ob) } } - BKE_id_free(NULL, me); + BKE_id_free(nullptr, me); } void GeometryExporter::export_key_mesh(Object *ob, Mesh *me, KeyBlock *kb) @@ -350,7 +350,7 @@ void GeometryExporter::create_mesh_primitive_list(short material_index, return; } - Material *ma = ob->totcol ? BKE_object_material_get(ob, material_index + 1) : NULL; + Material *ma = ob->totcol ? BKE_object_material_get(ob, material_index + 1) : nullptr; COLLADASW::PrimitivesBase *primitive_list = create_primitive_list(is_triangulated, mSW); /* sets count attribute in <polylist> */ @@ -636,7 +636,7 @@ void GeometryExporter::create_normals(std::vector<Normal> &normals, MVert *verts = me->mvert; MLoop *mloops = me->mloop; - float(*lnors)[3] = NULL; + float(*lnors)[3] = nullptr; bool use_custom_normals = false; BKE_mesh_calc_normals_split(me); diff --git a/source/blender/io/collada/ImageExporter.cpp b/source/blender/io/collada/ImageExporter.cpp index 51d753db03f..bb7b3bf0631 100644 --- a/source/blender/io/collada/ImageExporter.cpp +++ b/source/blender/io/collada/ImageExporter.cpp @@ -53,7 +53,7 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies) std::string name(id_name(image)); std::string translated_name(translate_id(name)); - ImBuf *imbuf = BKE_image_acquire_ibuf(image, NULL, NULL); + ImBuf *imbuf = BKE_image_acquire_ibuf(image, nullptr, nullptr); if (!imbuf) { fprintf(stderr, "Collada export: image does not exist:\n%s\n", image->filepath); return; @@ -106,7 +106,7 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies) /* make absolute source path */ BLI_strncpy(source_path, image->filepath, sizeof(source_path)); BLI_path_abs(source_path, ID_BLEND_PATH_FROM_GLOBAL(&image->id)); - BLI_path_normalize(NULL, source_path); + BLI_path_normalize(nullptr, source_path); if (use_copies) { @@ -145,7 +145,7 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies) img.add(mSW); fprintf(stdout, "Collada export: Added image: %s\n", export_file); - BKE_image_release_ibuf(image, imbuf, NULL); + BKE_image_release_ibuf(image, imbuf, nullptr); } void ImagesExporter::exportImages(Scene *sce) diff --git a/source/blender/io/collada/Materials.cpp b/source/blender/io/collada/Materials.cpp index a97b7dfcfd6..644ecc18e9b 100644 --- a/source/blender/io/collada/Materials.cpp +++ b/source/blender/io/collada/Materials.cpp @@ -96,10 +96,10 @@ bNodeTree *MaterialNode::prepare_material_nodetree() { if (material->nodetree) { ntree = material->nodetree; - return NULL; + return nullptr; } - material->nodetree = ntreeAddTree(NULL, "Shader Nodetree", "ShaderNodeTree"); + material->nodetree = ntreeAddTree(nullptr, "Shader Nodetree", "ShaderNodeTree"); material->use_nodes = true; ntree = material->nodetree; return ntree; @@ -225,7 +225,7 @@ void MaterialNode::set_diffuse(COLLADAFW::ColorOrTexture &cot) } else if (cot.isTexture()) { bNode *texture_node = add_texture_node(cot, -300, locy, "Base Color"); - if (texture_node != NULL) { + if (texture_node != nullptr) { add_link(texture_node, 0, shader_node, 0); } } @@ -320,7 +320,7 @@ void MaterialNode::set_emission(COLLADAFW::ColorOrTexture &cot) // texture else if (cot.isTexture()) { bNode *texture_node = add_texture_node(cot, -300, locy, "Emission"); - if (texture_node != NULL) { + if (texture_node != nullptr) { add_link(texture_node, 0, shader_node, 0); } } @@ -392,7 +392,7 @@ bNode *MaterialNode::add_texture_node(COLLADAFW::ColorOrTexture &cot, if (image_map.find(ima_uid) == image_map.end()) { fprintf(stderr, "Couldn't find an image by UID.\n"); - return NULL; + return nullptr; } Image *ima = image_map[ima_uid]; diff --git a/source/blender/io/collada/MeshImporter.cpp b/source/blender/io/collada/MeshImporter.cpp index 72a265db287..bb2aabb0598 100644 --- a/source/blender/io/collada/MeshImporter.cpp +++ b/source/blender/io/collada/MeshImporter.cpp @@ -346,7 +346,7 @@ void MeshImporter::read_vertices(COLLADAFW::Mesh *mesh, Mesh *me) } me->totvert = pos.getFloatValues()->getCount() / stride; - me->mvert = (MVert *)CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, me->totvert); + me->mvert = (MVert *)CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, nullptr, me->totvert); MVert *mvert; int i; @@ -469,8 +469,10 @@ void MeshImporter::allocate_poly_data(COLLADAFW::Mesh *collada_mesh, Mesh *me) if (total_poly_count > 0) { me->totpoly = total_poly_count; me->totloop = total_loop_count; - me->mpoly = (MPoly *)CustomData_add_layer(&me->pdata, CD_MPOLY, CD_CALLOC, NULL, me->totpoly); - me->mloop = (MLoop *)CustomData_add_layer(&me->ldata, CD_MLOOP, CD_CALLOC, NULL, me->totloop); + me->mpoly = (MPoly *)CustomData_add_layer( + &me->pdata, CD_MPOLY, CD_CALLOC, nullptr, me->totpoly); + me->mloop = (MLoop *)CustomData_add_layer( + &me->ldata, CD_MLOOP, CD_CALLOC, nullptr, me->totloop); unsigned int totuvset = collada_mesh->getUVCoords().getInputInfosArray().getCount(); for (int i = 0; i < totuvset; i++) { @@ -487,7 +489,7 @@ void MeshImporter::allocate_poly_data(COLLADAFW::Mesh *collada_mesh, Mesh *me) COLLADAFW::String &uvname = info->mName; /* Allocate space for UV_data */ CustomData_add_layer_named( - &me->ldata, CD_MLOOPUV, CD_DEFAULT, NULL, me->totloop, uvname.c_str()); + &me->ldata, CD_MLOOPUV, CD_DEFAULT, nullptr, me->totloop, uvname.c_str()); } /* activate the first uv map */ me->mloopuv = (MLoopUV *)CustomData_get_layer_n(&me->ldata, CD_MLOOPUV, 0); @@ -500,7 +502,7 @@ void MeshImporter::allocate_poly_data(COLLADAFW::Mesh *collada_mesh, Mesh *me) collada_mesh->getColors().getInputInfosArray()[i]; COLLADAFW::String colname = extract_vcolname(info->mName); CustomData_add_layer_named( - &me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop, colname.c_str()); + &me->ldata, CD_MLOOPCOL, CD_DEFAULT, nullptr, me->totloop, colname.c_str()); } me->mloopcol = (MLoopCol *)CustomData_get_layer_n(&me->ldata, CD_MLOOPCOL, 0); } @@ -576,7 +578,7 @@ void MeshImporter::mesh_add_edges(Mesh *mesh, int len) CustomData_copy_data(&mesh->edata, &edata, 0, 0, mesh->totedge); if (!CustomData_has_layer(&edata, CD_MEDGE)) { - CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, NULL, totedge); + CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, nullptr, totedge); } CustomData_free(&mesh->edata, mesh->totedge); @@ -744,7 +746,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me) COLLADAFW::IndexList &index_list = *index_list_array_uvcoord[uvset_index]; MLoopUV *mloopuv = (MLoopUV *)CustomData_get_layer_named( &me->ldata, CD_MLOOPUV, index_list.getName().c_str()); - if (mloopuv == NULL) { + if (mloopuv == nullptr) { fprintf(stderr, "Collada import: Mesh [%s] : Unknown reference to TEXCOORD [#%s].\n", me->id.name, @@ -774,7 +776,7 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh, Mesh *me) COLLADAFW::String colname = extract_vcolname(color_index_list.getName()); MLoopCol *mloopcol = (MLoopCol *)CustomData_get_layer_named( &me->ldata, CD_MLOOPCOL, colname.c_str()); - if (mloopcol == NULL) { + if (mloopcol == nullptr) { fprintf(stderr, "Collada import: Mesh [%s] : Unknown reference to VCOLOR [#%s].\n", me->id.name, @@ -888,7 +890,7 @@ Object *MeshImporter::get_object_by_geom_uid(const COLLADAFW::UniqueId &geom_uid if (uid_object_map.find(geom_uid) != uid_object_map.end()) { return uid_object_map[geom_uid]; } - return NULL; + return nullptr; } Mesh *MeshImporter::get_mesh_by_geom_uid(const COLLADAFW::UniqueId &geom_uid) @@ -896,7 +898,7 @@ Mesh *MeshImporter::get_mesh_by_geom_uid(const COLLADAFW::UniqueId &geom_uid) if (uid_mesh_map.find(geom_uid) != uid_mesh_map.end()) { return uid_mesh_map[geom_uid]; } - return NULL; + return nullptr; } std::string *MeshImporter::get_geometry_name(const std::string &mesh_name) @@ -904,7 +906,7 @@ std::string *MeshImporter::get_geometry_name(const std::string &mesh_name) if (this->mesh_geom_map.find(mesh_name) != this->mesh_geom_map.end()) { return &this->mesh_geom_map[mesh_name]; } - return NULL; + return nullptr; } /** @@ -959,7 +961,7 @@ static void bc_remove_materials_from_object(Object *ob, Mesh *me) { for (int index = 0; index < ob->totcol; index++) { ob->matbits[index] = 0; - ob->mat[index] = NULL; + ob->mat[index] = nullptr; } } @@ -1109,7 +1111,7 @@ Object *MeshImporter::create_mesh_object( if (!geom_uid) { fprintf(stderr, "Couldn't find a mesh UID by controller's UID.\n"); - return NULL; + return nullptr; } } else { @@ -1118,16 +1120,16 @@ Object *MeshImporter::create_mesh_object( /* this could happen if a mesh was not created * (e.g. if it contains unsupported geometry) */ fprintf(stderr, "Couldn't find a mesh by UID.\n"); - return NULL; + return nullptr; } } if (!uid_mesh_map[*geom_uid]) { - return NULL; + return nullptr; } /* name Object */ const std::string &id = node->getName().empty() ? node->getOriginalId() : node->getName(); - const char *name = (id.length()) ? id.c_str() : NULL; + const char *name = (id.length()) ? id.c_str() : nullptr; /* add object */ Object *ob = bc_add_object(m_bmain, scene, view_layer, OB_MESH, name); diff --git a/source/blender/io/collada/SceneExporter.cpp b/source/blender/io/collada/SceneExporter.cpp index 1b3bc1b66ea..01c270518e9 100644 --- a/source/blender/io/collada/SceneExporter.cpp +++ b/source/blender/io/collada/SceneExporter.cpp @@ -107,7 +107,7 @@ void SceneExporter::writeNode(Object *ob) bool armature_exported = false; Object *ob_arm = bc_get_assigned_armature(ob); - if (ob_arm != NULL) { + if (ob_arm != nullptr) { armature_exported = bc_is_in_Export_set( this->export_settings.get_export_set(), ob_arm, view_layer); if (armature_exported && bc_is_marked(ob_arm)) { @@ -207,7 +207,7 @@ void SceneExporter::writeNode(Object *ob) * No real mapping in the .dae * Need support for multiple target objects also. */ const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); - ListBase targets = {NULL, NULL}; + ListBase targets = {nullptr, nullptr}; if (cti && cti->get_constraint_targets) { bConstraintTarget *ct; @@ -222,7 +222,7 @@ void SceneExporter::writeNode(Object *ob) } if (cti->flush_constraint_targets) { - cti->flush_constraint_targets(con, &targets, 1); + cti->flush_constraint_targets(con, &targets, true); } } diff --git a/source/blender/io/collada/SkinInfo.cpp b/source/blender/io/collada/SkinInfo.cpp index eef45a5be90..19a4a4f61c2 100644 --- a/source/blender/io/collada/SkinInfo.cpp +++ b/source/blender/io/collada/SkinInfo.cpp @@ -75,7 +75,7 @@ SkinInfo::SkinInfo(const SkinInfo &skin) transfer_int_array_data_const(skin.joint_indices, joint_indices); } -SkinInfo::SkinInfo(UnitConverter *conv) : unit_converter(conv), ob_arm(NULL), parent(NULL) +SkinInfo::SkinInfo(UnitConverter *conv) : unit_converter(conv), ob_arm(nullptr), parent(nullptr) { } @@ -157,7 +157,7 @@ void SkinInfo::set_controller(const COLLADAFW::SkinController *co) /* called from write_controller */ Object *SkinInfo::create_armature(Main *bmain, Scene *scene, ViewLayer *view_layer) { - ob_arm = bc_add_object(bmain, scene, view_layer, OB_ARMATURE, NULL); + ob_arm = bc_add_object(bmain, scene, view_layer, OB_ARMATURE, nullptr); return ob_arm; } @@ -228,7 +228,8 @@ void SkinInfo::link_armature(bContext *C, Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - ModifierData *md = ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Armature); + ModifierData *md = ED_object_modifier_add( + nullptr, bmain, scene, ob, nullptr, eModifierType_Armature); ArmatureModifierData *amd = (ArmatureModifierData *)md; amd->object = ob_arm; @@ -248,7 +249,7 @@ void SkinInfo::link_armature(bContext *C, DEG_id_tag_update(&obn->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); #endif copy_m4_m4(ob->obmat, bind_shape_matrix); - BKE_object_apply_mat4(ob, ob->obmat, 0, 0); + BKE_object_apply_mat4(ob, ob->obmat, false, false); amd->deformflag = ARM_DEF_VGROUP; diff --git a/source/blender/io/collada/TransformReader.cpp b/source/blender/io/collada/TransformReader.cpp index 393393be65b..81b0ffc340a 100644 --- a/source/blender/io/collada/TransformReader.cpp +++ b/source/blender/io/collada/TransformReader.cpp @@ -33,7 +33,7 @@ void TransformReader::get_node_mat(float mat[4][4], std::map<COLLADAFW::UniqueId, Animation> *animation_map, Object *ob) { - get_node_mat(mat, node, animation_map, ob, NULL); + get_node_mat(mat, node, animation_map, ob, nullptr); } void TransformReader::get_node_mat(float mat[4][4], diff --git a/source/blender/io/collada/TransformWriter.cpp b/source/blender/io/collada/TransformWriter.cpp index 7c9d26e4fde..c22631e7bd3 100644 --- a/source/blender/io/collada/TransformWriter.cpp +++ b/source/blender/io/collada/TransformWriter.cpp @@ -54,7 +54,7 @@ void TransformWriter::add_joint_transform(COLLADASW::Node &node, } else { float loc[3], rot[3], scale[3]; - bc_decompose(local, loc, rot, NULL, scale); + bc_decompose(local, loc, rot, nullptr, scale); add_transform(node, loc, rot, scale); } } @@ -90,7 +90,7 @@ void TransformWriter::add_node_transform_ob(COLLADASW::Node &node, } case BC_TRANSFORMATION_TYPE_DECOMPOSED: { float loc[3], rot[3], scale[3]; - bc_decompose(f_obmat, loc, rot, NULL, scale); + bc_decompose(f_obmat, loc, rot, nullptr, scale); if (limit_precision) { bc_sanitize_v3(loc, LIMITTED_PRECISION); bc_sanitize_v3(rot, LIMITTED_PRECISION); diff --git a/source/blender/io/collada/collada.cpp b/source/blender/io/collada/collada.cpp index bf1ebbfa669..f3c69c7d3d0 100644 --- a/source/blender/io/collada/collada.cpp +++ b/source/blender/io/collada/collada.cpp @@ -109,7 +109,7 @@ int collada_export(bContext *C, ExportSettings *export_settings) DocumentExporter exporter(blender_context, export_settings); int status = exporter.exportCurrentScene(); - BLI_linklist_free(export_settings->export_set, NULL); + BLI_linklist_free(export_settings->export_set, nullptr); return (status) ? -1 : export_count; } diff --git a/source/blender/io/collada/collada_utils.cpp b/source/blender/io/collada/collada_utils.cpp index 30c77c0a7df..c57952afcc8 100644 --- a/source/blender/io/collada/collada_utils.cpp +++ b/source/blender/io/collada/collada_utils.cpp @@ -97,7 +97,7 @@ int bc_test_parent_loop(Object *par, Object *ob) { /* test if 'ob' is a parent somewhere in par's parents */ - if (par == NULL) { + if (par == nullptr) { return 0; } if (ob == par) { @@ -112,7 +112,7 @@ bool bc_validateConstraints(bConstraint *con) const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); /* these we can skip completely (invalid constraints...) */ - if (cti == NULL) { + if (cti == nullptr) { return false; } if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) { @@ -120,7 +120,7 @@ bool bc_validateConstraints(bConstraint *con) } /* these constraints can't be evaluated anyway */ - if (cti->evaluate_constraint == NULL) { + if (cti->evaluate_constraint == nullptr) { return false; } @@ -144,7 +144,8 @@ bool bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space) mul_m4_m4m4(ob->obmat, par->obmat, ob->obmat); } - bool ok = ED_object_parent_set(NULL, C, scene, ob, par, partype, xmirror, keep_transform, NULL); + bool ok = ED_object_parent_set( + nullptr, C, scene, ob, par, partype, xmirror, keep_transform, nullptr); return ok; } @@ -222,7 +223,7 @@ Mesh *bc_get_mesh_copy(BlenderContext &blender_context, bool triangulate) { CustomData_MeshMasks mask = CD_MASK_MESH; - Mesh *tmpmesh = NULL; + Mesh *tmpmesh = nullptr; if (apply_modifiers) { #if 0 /* Not supported by new system currently... */ switch (export_mesh_type) { @@ -246,7 +247,7 @@ Mesh *bc_get_mesh_copy(BlenderContext &blender_context, tmpmesh = (Mesh *)ob->data; } - tmpmesh = (Mesh *)BKE_id_copy_ex(NULL, &tmpmesh->id, NULL, LIB_ID_COPY_LOCALIZE); + tmpmesh = (Mesh *)BKE_id_copy_ex(nullptr, &tmpmesh->id, nullptr, LIB_ID_COPY_LOCALIZE); if (triangulate) { bc_triangulate_mesh(tmpmesh); @@ -257,7 +258,7 @@ Mesh *bc_get_mesh_copy(BlenderContext &blender_context, Object *bc_get_assigned_armature(Object *ob) { - Object *ob_arm = NULL; + Object *ob_arm = nullptr; if (ob->parent && ob->partype == PARSKEL && ob->parent->type == OB_ARMATURE) { ob_arm = ob->parent; @@ -319,7 +320,7 @@ void bc_bubble_sort_by_Object_name(LinkNode *export_set) bool bc_is_root_bone(Bone *aBone, bool deform_bones_only) { if (deform_bones_only) { - Bone *root = NULL; + Bone *root = nullptr; Bone *bone = aBone; while (bone) { if (!(bone->flag & BONE_NO_DEFORM)) { @@ -371,7 +372,7 @@ void bc_match_scale(Object *ob, UnitConverter &bc_unit, bool scale_to_scene) mul_m4_m4m4(ob->obmat, bc_unit.get_scale(), ob->obmat); } mul_m4_m4m4(ob->obmat, bc_unit.get_rotation(), ob->obmat); - BKE_object_apply_mat4(ob, ob->obmat, 0, 0); + BKE_object_apply_mat4(ob, ob->obmat, false, false); } void bc_match_scale(std::vector<Object *> *objects_done, @@ -381,7 +382,7 @@ void bc_match_scale(std::vector<Object *> *objects_done, for (std::vector<Object *>::iterator it = objects_done->begin(); it != objects_done->end(); ++it) { Object *ob = *it; - if (ob->parent == NULL) { + if (ob->parent == nullptr) { bc_match_scale(*it, bc_unit, scale_to_scene); } } @@ -450,11 +451,11 @@ void bc_triangulate_mesh(Mesh *me) BMeshFromMeshParams bm_from_me_params = {0}; bm_from_me_params.calc_face_normal = true; BM_mesh_bm_from_me(bm, me, &bm_from_me_params); - BM_mesh_triangulate(bm, quad_method, use_beauty, 4, tag_only, NULL, NULL, NULL); + BM_mesh_triangulate(bm, quad_method, use_beauty, 4, tag_only, nullptr, nullptr, nullptr); BMeshToMeshParams bm_to_me_params = {0}; bm_to_me_params.calc_object_remap = false; - BM_mesh_bm_to_me(NULL, bm, me, &bm_to_me_params); + BM_mesh_bm_to_me(nullptr, bm, me, &bm_to_me_params); BM_mesh_free(bm); } @@ -481,7 +482,7 @@ EditBone *bc_get_edit_bone(bArmature *armature, char *name) } } - return NULL; + return nullptr; } int bc_set_layer(int bitfield, int layer) { @@ -511,7 +512,7 @@ BoneExtensionMap &BoneExtensionManager::getExtensionMap(bArmature *armature) { std::string key = armature->id.name; BoneExtensionMap *result = extended_bone_maps[key]; - if (result == NULL) { + if (result == nullptr) { result = new BoneExtensionMap(); extended_bone_maps[key] = result; } @@ -706,7 +707,7 @@ int BoneExtended::get_use_connect() void bc_set_IDPropertyMatrix(EditBone *ebone, const char *key, float mat[4][4]) { IDProperty *idgroup = (IDProperty *)ebone->prop; - if (idgroup == NULL) { + if (idgroup == nullptr) { IDPropertyTemplate val = {0}; idgroup = IDP_New(IDP_GROUP, &val, "RNA_EditBone ID properties"); ebone->prop = idgroup; @@ -754,7 +755,7 @@ static void bc_set_IDProperty(EditBone *ebone, const char *key, float value) */ IDProperty *bc_get_IDProperty(Bone *bone, std::string key) { - return (bone->prop == NULL) ? NULL : IDP_GetPropertyFromGroup(bone->prop, key.c_str()); + return (bone->prop == nullptr) ? nullptr : IDP_GetPropertyFromGroup(bone->prop, key.c_str()); } /** @@ -895,7 +896,7 @@ bool bc_bone_matrix_local_get(Object *ob, Bone *bone, Matrix &mat, bool for_open mul_m4_m4m4(mat, temp, mat); } } - bc_enable_fcurves(action, NULL); + bc_enable_fcurves(action, nullptr); return true; } @@ -908,11 +909,11 @@ bool bc_is_animated(BCMatrixSampleMap &values) } BCMatrixSampleMap::iterator it; - const BCMatrix *refmat = NULL; + const BCMatrix *refmat = nullptr; for (it = values.begin(); it != values.end(); ++it) { const BCMatrix *matrix = it->second; - if (refmat == NULL) { + if (refmat == nullptr) { refmat = matrix; continue; } @@ -1040,7 +1041,7 @@ void bc_create_restpose_mat(BCExportSettings &export_settings, return; } - bc_decompose(from_mat, loc, rot, NULL, scale); + bc_decompose(from_mat, loc, rot, nullptr, scale); loc_eulO_size_to_mat4(to_mat, loc, rot, scale, 6); if (export_settings.get_keep_bind_info()) { @@ -1192,8 +1193,8 @@ std::string bc_find_bonename_in_path(std::string path, std::string probe) static bNodeTree *prepare_material_nodetree(Material *ma) { - if (ma->nodetree == NULL) { - ma->nodetree = ntreeAddTree(NULL, "Shader Nodetree", "ShaderNodeTree"); + if (ma->nodetree == nullptr) { + ma->nodetree = ntreeAddTree(nullptr, "Shader Nodetree", "ShaderNodeTree"); ma->use_nodes = true; } return ma->nodetree; @@ -1450,7 +1451,7 @@ bNode *bc_get_master_shader(Material *ma) } } } - return NULL; + return nullptr; } COLLADASW::ColorOrTexture bc_get_cot(float r, float g, float b, float a) diff --git a/source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc b/source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc index 6e4509afd30..ad0d6820e2b 100644 --- a/source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc +++ b/source/blender/io/common/intern/abstract_hierarchy_iterator_test.cc @@ -272,7 +272,7 @@ TEST_F(AbstractHierarchyIteratorTest, ExportSubsetTest) /* Even when only asking an export of transforms, on the first frame everything should be * exported. */ { - ExportSubset export_subset = {0}; + ExportSubset export_subset = {false}; export_subset.transforms = true; export_subset.shapes = false; iterator->set_export_subset(export_subset); @@ -296,7 +296,7 @@ TEST_F(AbstractHierarchyIteratorTest, ExportSubsetTest) /* Third iteration, should only write data now. */ { - ExportSubset export_subset = {0}; + ExportSubset export_subset = {false}; export_subset.transforms = false; export_subset.shapes = true; iterator->set_export_subset(export_subset); @@ -311,7 +311,7 @@ TEST_F(AbstractHierarchyIteratorTest, ExportSubsetTest) /* Fourth iteration, should export everything now. */ { - ExportSubset export_subset = {0}; + ExportSubset export_subset = {false}; export_subset.transforms = true; export_subset.shapes = true; iterator->set_export_subset(export_subset); diff --git a/source/blender/io/common/intern/hierarchy_context_order_test.cc b/source/blender/io/common/intern/hierarchy_context_order_test.cc index f4e2b81b39b..3f2e348a8ee 100644 --- a/source/blender/io/common/intern/hierarchy_context_order_test.cc +++ b/source/blender/io/common/intern/hierarchy_context_order_test.cc @@ -38,11 +38,11 @@ class HierarchyContextOrderTest : public testing::Test { TEST_F(HierarchyContextOrderTest, ObjectPointerTest) { - HierarchyContext ctx_a = {0}; + HierarchyContext ctx_a = {nullptr}; ctx_a.object = fake_pointer(1); ctx_a.duplicator = nullptr; - HierarchyContext ctx_b = {0}; + HierarchyContext ctx_b = {nullptr}; ctx_b.object = fake_pointer(2); ctx_b.duplicator = nullptr; @@ -53,12 +53,12 @@ TEST_F(HierarchyContextOrderTest, ObjectPointerTest) TEST_F(HierarchyContextOrderTest, DuplicatorPointerTest) { - HierarchyContext ctx_a = {0}; + HierarchyContext ctx_a = {nullptr}; ctx_a.object = fake_pointer(1); ctx_a.duplicator = fake_pointer(1); ctx_a.export_name = "A"; - HierarchyContext ctx_b = {0}; + HierarchyContext ctx_b = {nullptr}; ctx_b.object = fake_pointer(1); ctx_b.duplicator = fake_pointer(1); ctx_b.export_name = "B"; @@ -70,11 +70,11 @@ TEST_F(HierarchyContextOrderTest, DuplicatorPointerTest) TEST_F(HierarchyContextOrderTest, ExportParentTest) { - HierarchyContext ctx_a = {0}; + HierarchyContext ctx_a = {nullptr}; ctx_a.object = fake_pointer(1); ctx_a.export_parent = fake_pointer(1); - HierarchyContext ctx_b = {0}; + HierarchyContext ctx_b = {nullptr}; ctx_b.object = fake_pointer(1); ctx_b.export_parent = fake_pointer(2); @@ -85,25 +85,25 @@ TEST_F(HierarchyContextOrderTest, ExportParentTest) TEST_F(HierarchyContextOrderTest, TransitiveTest) { - HierarchyContext ctx_a = {0}; + HierarchyContext ctx_a = {nullptr}; ctx_a.object = fake_pointer(1); ctx_a.export_parent = fake_pointer(1); ctx_a.duplicator = nullptr; ctx_a.export_name = "A"; - HierarchyContext ctx_b = {0}; + HierarchyContext ctx_b = {nullptr}; ctx_b.object = fake_pointer(2); ctx_b.export_parent = nullptr; ctx_b.duplicator = fake_pointer(1); ctx_b.export_name = "B"; - HierarchyContext ctx_c = {0}; + HierarchyContext ctx_c = {nullptr}; ctx_c.object = fake_pointer(2); ctx_c.export_parent = fake_pointer(2); ctx_c.duplicator = fake_pointer(1); ctx_c.export_name = "C"; - HierarchyContext ctx_d = {0}; + HierarchyContext ctx_d = {nullptr}; ctx_d.object = fake_pointer(2); ctx_d.export_parent = fake_pointer(3); ctx_d.duplicator = nullptr; diff --git a/source/blender/io/usd/intern/usd_capi.cc b/source/blender/io/usd/intern/usd_capi.cc index 12fc04e2142..dc2b46e5cea 100644 --- a/source/blender/io/usd/intern/usd_capi.cc +++ b/source/blender/io/usd/intern/usd_capi.cc @@ -59,7 +59,7 @@ struct ExportJobData { bool export_ok; }; -static void ensure_usd_plugin_path_registered(void) +static void ensure_usd_plugin_path_registered() { static bool plugin_path_registered = false; if (plugin_path_registered) { diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index ac6160b28e4..790a7a36288 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -857,7 +857,7 @@ typedef enum eSAction_Flag { /* show pose-markers (local to action) in Action Editor mode */ SACTION_POSEMARKERS_SHOW = (1 << 6), /* don't draw action channels using group colors (where applicable) */ - SACTION_NODRAWGCOLORS = (1 << 7), + /* SACTION_NODRAWGCOLORS = (1 << 7), DEPRECATED */ /* SACTION_NODRAWCFRANUM = (1 << 8), DEPRECATED */ /* don't perform realtime updates */ SACTION_NOREALTIMEUPDATES = (1 << 10), diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 2449608be4c..ca42e2b1cba 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -28,6 +28,10 @@ /* XXX, temp feature - campbell */ #define DURIAN_CAMERA_SWITCH +/* check for cyclic set-scene, + * libs can cause this case which is normally prevented, see (T#####) */ +#define USE_SETSCENE_CHECK + #include "DNA_ID.h" #include "DNA_collection_types.h" #include "DNA_color_types.h" /* color management */ diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 1847fbfa986..e21f3e1e706 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -341,17 +341,19 @@ typedef struct TextVars { VFont *text_font; int text_blf_id; int text_size; - float color[4], shadow_color[4]; + float color[4], shadow_color[4], box_color[4]; float loc[2]; float wrap_width; + float box_margin; char flag; char align, align_y; - char _pad[1]; + char _pad[5]; } TextVars; /* TextVars.flag */ enum { SEQ_TEXT_SHADOW = (1 << 0), + SEQ_TEXT_BOX = (1 << 1), }; /* TextVars.align */ diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 1b7ec3889bc..80703782f18 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -465,7 +465,7 @@ typedef enum eGraphEdit_Flag { /* don't draw curves with AA ("beauty-draw") for performance */ SIPO_BEAUTYDRAW_OFF = (1 << 12), /* draw grouped channels with colors set in group */ - SIPO_NODRAWGCOLORS = (1 << 13), + /* SIPO_NODRAWGCOLORS = (1 << 13), DEPRECATED */ /* normalize curves on display */ SIPO_NORMALIZE = (1 << 14), SIPO_NORMALIZE_FREEZE = (1 << 15), diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index ed232d4ad89..a9bd915ba48 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -826,13 +826,13 @@ typedef struct UserDef { short autokey_mode; /** Flags for autokeying. */ short autokey_flag; + /** Flags for animation. */ + short animation_flag; /** Options for text rendering. */ char text_render; char navigation_mode; - char _pad9[2]; - /** Turn-table rotation amount per-pixel in radians. Scaled with DPI. */ float view_rotate_sensitivity_turntable; /** Track-ball rotation scale. */ @@ -1147,6 +1147,15 @@ typedef enum eAutokey_Flag { ANIMRECORD_FLAG_WITHNLA = (1 << 10), } eAutokey_Flag; +/** + * Animation flags + * #UserDef.animation_flag, used for animation flags that aren't covered by more specific flags + * (like eAutokey_Flag). + */ +typedef enum eUserpref_Anim_Flags { + USER_ANIM_SHOW_CHANNEL_GROUP_COLORS = (1 << 0), +} eUserpref_Anim_Flags; + /** #UserDef.transopts */ typedef enum eUserpref_Translation_Flags { USER_TR_TOOLTIPS = (1 << 0), diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 4de560c5d4b..3ebbb98934e 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -379,7 +379,7 @@ blender_include_dirs( ../../simulation ../../windowmanager ../../editors/include - ../../render/extern/include + ../../render ../../../../intern/cycles/blender ../../../../intern/atomic ../../../../intern/glew-mx diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 5aa684539af..8b861d20e4e 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -256,10 +256,10 @@ static const char *rna_safe_id(const char *id) if (STREQ(id, "operator")) { return "operator_value"; } - else if (STREQ(id, "new")) { + if (STREQ(id, "new")) { return "create"; } - else if (STREQ(id, "co_return")) { + if (STREQ(id, "co_return")) { /* MSVC2015, C++ uses for coroutines */ return "coord_return"; } diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index e71bbc6bcaf..8405a6e2667 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -425,9 +425,7 @@ static int rna_ensure_property_array_length(PointerRNA *ptr, PropertyRNA *prop) if (idprop->type == IDP_ARRAY) { return idprop->len; } - else { - return 0; - } + return 0; } static bool rna_ensure_property_array_check(PropertyRNA *prop) @@ -1268,7 +1266,7 @@ char RNA_property_array_item_char(PropertyRNA *prop, int index) PROP_COORDS)) { return vectoritem[index]; } - else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) { + if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) { return coloritem[index]; } @@ -1533,9 +1531,7 @@ int RNA_property_float_clamp(PointerRNA *ptr, PropertyRNA *prop, float *value) *value = max; return 1; } - else { - return 0; - } + return 0; } int RNA_property_int_clamp(PointerRNA *ptr, PropertyRNA *prop, int *value) @@ -1552,9 +1548,7 @@ int RNA_property_int_clamp(PointerRNA *ptr, PropertyRNA *prop, int *value) *value = max; return 1; } - else { - return 0; - } + return 0; } /* this is the max length including \0 terminator. @@ -1668,7 +1662,7 @@ void RNA_property_enum_items(bContext *C, #ifdef WITH_INTERNATIONAL static void property_enum_translate(PropertyRNA *prop, EnumPropertyItem **r_item, - int *r_totitem, + const int *totitem, bool *r_free) { if (!(prop->flag & PROP_ENUM_NO_TRANSLATE)) { @@ -1690,8 +1684,8 @@ static void property_enum_translate(PropertyRNA *prop, const EnumPropertyItem *item = *r_item; int tot; - if (r_totitem) { - tot = *r_totitem; + if (totitem) { + tot = *totitem; } else { /* count */ @@ -2614,12 +2608,10 @@ int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop) if (iprop->get) { return iprop->get(ptr); } - else if (iprop->get_ex) { + if (iprop->get_ex) { return iprop->get_ex(ptr, prop); } - else { - return iprop->defaultvalue; - } + return iprop->defaultvalue; } void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value) @@ -2950,15 +2942,13 @@ float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop) } return (float)IDP_Double(idprop); } - else if (fprop->get) { + if (fprop->get) { return fprop->get(ptr); } - else if (fprop->get_ex) { + if (fprop->get_ex) { return fprop->get_ex(ptr, prop); } - else { - return fprop->defaultvalue; - } + return fprop->defaultvalue; } void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value) @@ -3389,15 +3379,13 @@ int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop) #endif return idprop->len - 1; } - else if (sprop->length) { + if (sprop->length) { return sprop->length(ptr); } - else if (sprop->length_ex) { + if (sprop->length_ex) { return sprop->length_ex(ptr, prop); } - else { - return strlen(sprop->defaultvalue); - } + return strlen(sprop->defaultvalue); } void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value) @@ -3555,12 +3543,10 @@ int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop) if (eprop->get) { return eprop->get(ptr); } - else if (eprop->get_ex) { + if (eprop->get_ex) { return eprop->get_ex(ptr, prop); } - else { - return eprop->defaultvalue; - } + return eprop->defaultvalue; } void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value) @@ -3671,18 +3657,16 @@ PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop) } return rna_pointer_inherit_refine(ptr, pprop->type, idprop); } - else if (pprop->get) { + if (pprop->get) { return pprop->get(ptr); } - else if (prop->flag & PROP_IDPROPERTY) { + if (prop->flag & PROP_IDPROPERTY) { /* XXX temporary hack to add it automatically, reading should * never do any write ops, to ensure thread safety etc .. */ RNA_property_pointer_add(ptr, prop); return RNA_property_pointer_get(ptr, prop); } - else { - return PointerRNA_NULL; - } + return PointerRNA_NULL; } void RNA_property_pointer_set(PointerRNA *ptr, @@ -3924,18 +3908,16 @@ int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop) if (cprop->length) { return cprop->length(ptr); } - else { - CollectionPropertyIterator iter; - int length = 0; - - RNA_property_collection_begin(ptr, prop, &iter); - for (; iter.valid; RNA_property_collection_next(&iter)) { - length++; - } - RNA_property_collection_end(&iter); + CollectionPropertyIterator iter; + int length = 0; - return length; + RNA_property_collection_begin(ptr, prop, &iter); + for (; iter.valid; RNA_property_collection_next(&iter)) { + length++; } + RNA_property_collection_end(&iter); + + return length; } /* This helper checks whether given collection property itself is editable (we only currently @@ -5775,21 +5757,19 @@ static char *rna_idp_path(PointerRNA *ptr, path = rna_idp_path_create(&link); break; } - else { - int j; - link.name = iter->name; - for (j = 0; j < iter->len; j++, array++) { - PointerRNA child_ptr; - if (RNA_property_collection_lookup_int(ptr, prop, j, &child_ptr)) { - link.index = j; - if ((path = rna_idp_path(&child_ptr, array, needle, &link))) { - break; - } + int j; + link.name = iter->name; + for (j = 0; j < iter->len; j++, array++) { + PointerRNA child_ptr; + if (RNA_property_collection_lookup_int(ptr, prop, j, &child_ptr)) { + link.index = j; + if ((path = rna_idp_path(&child_ptr, array, needle, &link))) { + break; } } - if (path) { - break; - } + } + if (path) { + break; } } } @@ -6788,9 +6768,7 @@ static char *rna_pointer_as_string__bldata(Main *bmain, PointerRNA *ptr) if (RNA_struct_is_ID(ptr->type)) { return RNA_path_full_ID_py(bmain, ptr->owner_id); } - else { - return RNA_path_full_struct_py(bmain, ptr); - } + return RNA_path_full_struct_py(bmain, ptr); } char *RNA_pointer_as_string(bContext *C, @@ -6805,9 +6783,7 @@ char *RNA_pointer_as_string(bContext *C, if ((prop = rna_idproperty_check(&prop_ptr, ptr)) && prop->type != IDP_ID) { return RNA_pointer_as_string_id(C, ptr_prop); } - else { - return rna_pointer_as_string__bldata(CTX_data_main(C), ptr_prop); - } + return rna_pointer_as_string__bldata(CTX_data_main(C), ptr_prop); } /* context can be NULL */ diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c index d367bc663f1..4bbbf5f01da 100644 --- a/source/blender/makesrna/intern/rna_access_compare_override.c +++ b/source/blender/makesrna/intern/rna_access_compare_override.c @@ -211,7 +211,7 @@ bool RNA_struct_equals(Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b, eRNACo if (ptr_a == NULL || ptr_b == NULL) { return false; } - else if (ptr_a->type != ptr_b->type) { + if (ptr_a->type != ptr_b->type) { return false; } diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index b298d49fad5..b437e60ecf9 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -513,7 +513,7 @@ static int rna_find_sdna_member(SDNA *sdna, return 1; } - else if (cmp == 3) { + if (cmp == 3) { smember->type = ""; smember->name = dnaname; smember->offset = *offset; @@ -2199,15 +2199,13 @@ static PropertyDefRNA *rna_def_property_sdna(PropertyRNA *prop, dp->dnaoffset = smember.offset; return dp; } - else { - CLOG_ERROR(&LOG, - "\"%s.%s\" (identifier \"%s\") not found. Struct must be in DNA.", - structname, - propname, - prop->identifier); - DefRNA.error = true; - return NULL; - } + CLOG_ERROR(&LOG, + "\"%s.%s\" (identifier \"%s\") not found. Struct must be in DNA.", + structname, + propname, + prop->identifier); + DefRNA.error = true; + return NULL; } if (smember.arraylength > 1) { @@ -4363,9 +4361,8 @@ int rna_parameter_size(PropertyRNA *parm) } return sizeof(PointerRNA *); } - else { - return sizeof(void *); - } + return sizeof(void *); + #endif } case PROP_COLLECTION: diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 1882fce3f54..2ffb9612486 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -956,8 +956,7 @@ static void rna_SequenceProxy_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Scene *scene = (Scene *)ptr->owner_id; Editing *ed = BKE_sequencer_editing_get(scene, false); Sequence *seq = sequence_get_by_proxy(ed, ptr->data); - - BKE_sequence_invalidate_cache_raw(scene, seq); + BKE_sequence_invalidate_cache_preprocessed(scene, seq); } /* do_versions? */ @@ -1513,12 +1512,14 @@ static void rna_def_strip_proxy(BlenderRNA *brna) prop = RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "storage", SEQ_STORAGE_PROXY_CUSTOM_DIR); RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Use a custom directory to store data"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); + RNA_def_property_update( + prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_preprocessed_update"); prop = RNA_def_property(srna, "use_proxy_custom_file", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "storage", SEQ_STORAGE_PROXY_CUSTOM_FILE); RNA_def_property_ui_text(prop, "Proxy Custom File", "Use a custom file to read proxy data from"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); + RNA_def_property_update( + prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_preprocessed_update"); } static void rna_def_color_balance(BlenderRNA *brna) @@ -2182,7 +2183,8 @@ static void rna_def_proxy(StructRNA *srna) RNA_def_property_ui_text( prop, "Use Proxy / Timecode", "Use a preview proxy and/or time-code index for this strip"); RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_proxy_set"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); + RNA_def_property_update( + prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_preprocessed_update"); prop = RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "strip->proxy"); @@ -2865,6 +2867,11 @@ static void rna_def_text(StructRNA *srna) RNA_def_property_ui_text(prop, "Shadow Color", ""); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); + prop = RNA_def_property(srna, "box_color", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "box_color"); + RNA_def_property_ui_text(prop, "Box Color", ""); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); + prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "loc"); RNA_def_property_ui_text(prop, "Location", "Location of the text"); @@ -2879,6 +2886,14 @@ static void rna_def_text(StructRNA *srna) RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); + prop = RNA_def_property(srna, "box_margin", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "box_margin"); + RNA_def_property_ui_text(prop, "Box Margin", "Box margin as factor of image width"); + RNA_def_property_range(prop, 0, 1.0); + RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1); + RNA_def_property_float_default(prop, 0.01f); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); + prop = RNA_def_property(srna, "align_x", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "align"); RNA_def_property_enum_items(prop, text_align_x_items); @@ -2901,6 +2916,11 @@ static void rna_def_text(StructRNA *srna) RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_TEXT_SHADOW); RNA_def_property_ui_text(prop, "Shadow", "Display shadow behind text"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); + + prop = RNA_def_property(srna, "use_box", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_TEXT_BOX); + RNA_def_property_ui_text(prop, "Shadow", "Display colored box behind text"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_invalidate_raw_update"); } static void rna_def_color_mix(StructRNA *srna) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index a32a2658723..2b6dc7fdf7f 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -5140,15 +5140,6 @@ static void rna_def_space_dopesheet(BlenderRNA *brna) "(Action and Shape Key Editors only)"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL); - prop = RNA_def_property(srna, "show_group_colors", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NODRAWGCOLORS); - RNA_def_property_ui_text( - prop, - "Show Group Colors", - "Display groups and channels with colors matching their corresponding groups " - "(pose bones only currently)"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL); - prop = RNA_def_property(srna, "show_interpolation", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_SHOW_INTERPOLATION); RNA_def_property_ui_text(prop, @@ -5316,14 +5307,6 @@ static void rna_def_space_graph(BlenderRNA *brna) "(disable for better performance)"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL); - prop = RNA_def_property(srna, "show_group_colors", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NODRAWGCOLORS); - RNA_def_property_ui_text( - prop, - "Show Group Colors", - "Display groups and channels with colors matching their corresponding groups"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL); - prop = RNA_def_property(srna, "show_markers", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SHOW_MARKERS); RNA_def_property_ui_text( diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 932aa260bd5..2ae084d5a5d 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -409,6 +409,15 @@ static void rna_userdef_autokeymode_set(PointerRNA *ptr, int value) } } +static void rna_userdef_anim_update(Main *UNUSED(bmain), + Scene *UNUSED(scene), + PointerRNA *UNUSED(ptr)) +{ + WM_main_add_notifier(NC_SPACE | ND_SPACE_GRAPH, NULL); + WM_main_add_notifier(NC_SPACE | ND_SPACE_DOPESHEET, NULL); + USERDEF_TAG_DIRTY; +} + static void rna_userdef_tablet_api_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) @@ -4994,6 +5003,15 @@ static void rna_def_userdef_edit(BlenderRNA *brna) "Color for newly added transformation F-Curves (Location, Rotation, Scale) " "and also Color is based on the transform axis"); + prop = RNA_def_property(srna, "use_anim_channel_group_colors", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "animation_flag", USER_ANIM_SHOW_CHANNEL_GROUP_COLORS); + RNA_def_property_ui_text( + prop, + "Channel Group Colors", + "Use animation channel group colors; generally this is used to show bone group colors"); + RNA_def_property_boolean_default(prop, true); + RNA_def_property_update(prop, 0, "rna_userdef_anim_update"); + prop = RNA_def_property(srna, "fcurve_new_auto_smoothing", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, rna_enum_fcurve_auto_smoothing_items); RNA_def_property_enum_sdna(prop, NULL, "auto_smoothing_new"); diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index ea4041c9c3c..34713392afb 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -33,7 +33,7 @@ set(INC ../makesdna ../makesrna ../nodes - ../render/extern/include + ../render ../windowmanager ../../../intern/eigen ../../../intern/guardedalloc diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 1cf57669eb1..7fea06ba955 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -380,7 +380,8 @@ static void BMD_mesh_intersection(BMesh *bm, #endif if (use_exact) { - BM_mesh_boolean(bm, looptris, tottri, bm_face_isect_pair, NULL, 2, use_self, bmd->operation); + BM_mesh_boolean( + bm, looptris, tottri, bm_face_isect_pair, NULL, 2, use_self, false, bmd->operation); } else { BM_mesh_intersect(bm, @@ -543,7 +544,7 @@ static Mesh *collection_boolean_exact(BooleanModifierData *bmd, BM_mesh_elem_index_ensure(bm, BM_FACE); BM_mesh_boolean( - bm, looptris, tottri, bm_face_isect_nary, shape, num_shapes, true, bmd->operation); + bm, looptris, tottri, bm_face_isect_nary, shape, num_shapes, true, false, bmd->operation); result = BKE_mesh_from_bmesh_for_eval_nomain(bm, NULL, mesh); BM_mesh_free(bm); diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index 0a311bc8e5f..185c21af7ad 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -512,7 +512,7 @@ static void deformVertsEM(ModifierData *md, } if (mesh && mesh->runtime.wrapper_type == ME_WRAPPER_TYPE_MDATA) { - BLI_assert(mesh_src->totvert == numVerts); + BLI_assert(mesh->totvert == numVerts); } /* TODO(Campbell): use edit-mode data only (remove this line). */ diff --git a/source/blender/modifiers/intern/MOD_mask.cc b/source/blender/modifiers/intern/MOD_mask.cc index 78d44179ca1..92ee5a84df9 100644 --- a/source/blender/modifiers/intern/MOD_mask.cc +++ b/source/blender/modifiers/intern/MOD_mask.cc @@ -322,7 +322,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * /* Return empty or input mesh when there are no vertex groups. */ MDeformVert *dvert = (MDeformVert *)CustomData_get_layer(&mesh->vdata, CD_MDEFORMVERT); - if (dvert == NULL) { + if (dvert == nullptr) { return invert_mask ? mesh : BKE_mesh_new_nomain_from_template(mesh, 0, 0, 0, 0, 0); } @@ -418,13 +418,13 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) int mode = RNA_enum_get(ptr, "mode"); - uiItemR(layout, ptr, "mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(layout, ptr, "mode", UI_ITEM_R_EXPAND, nullptr, ICON_NONE); uiLayoutSetPropSep(layout, true); if (mode == MOD_MASK_MODE_ARM) { row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "armature", 0, NULL, ICON_NONE); + uiItemR(row, ptr, "armature", 0, nullptr, ICON_NONE); sub = uiLayoutRow(row, true); uiLayoutSetPropDecorate(sub, false); uiItemR(sub, ptr, "invert_vertex_group", 0, "", ICON_ARROW_LEFTRIGHT); @@ -433,7 +433,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) modifier_vgroup_ui(layout, ptr, &ob_ptr, "vertex_group", "invert_vertex_group", nullptr); } - uiItemR(layout, ptr, "threshold", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "threshold", 0, nullptr, ICON_NONE); modifier_panel_end(layout, ptr); } @@ -456,26 +456,26 @@ ModifierTypeInfo modifierType_Mask = { /* copyData */ BKE_modifier_copydata_generic, - /* deformVerts */ NULL, - /* deformMatrices */ NULL, - /* deformVertsEM */ NULL, - /* deformMatricesEM */ NULL, + /* deformVerts */ nullptr, + /* deformMatrices */ nullptr, + /* deformVertsEM */ nullptr, + /* deformMatricesEM */ nullptr, /* modifyMesh */ modifyMesh, - /* modifyHair */ NULL, - /* modifyPointCloud */ NULL, - /* modifyVolume */ NULL, + /* modifyHair */ nullptr, + /* modifyPointCloud */ nullptr, + /* modifyVolume */ nullptr, /* initData */ initData, /* requiredDataMask */ requiredDataMask, - /* freeData */ NULL, + /* freeData */ nullptr, /* isDisabled */ isDisabled, /* updateDepsgraph */ updateDepsgraph, - /* dependsOnTime */ NULL, - /* dependsOnNormals */ NULL, + /* dependsOnTime */ nullptr, + /* dependsOnNormals */ nullptr, /* foreachIDLink */ foreachIDLink, - /* foreachTexLink */ NULL, - /* freeRuntimeData */ NULL, + /* foreachTexLink */ nullptr, + /* freeRuntimeData */ nullptr, /* panelRegister */ panelRegister, - /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendWrite */ nullptr, + /* blendRead */ nullptr, }; diff --git a/source/blender/modifiers/intern/MOD_mesh_to_volume.cc b/source/blender/modifiers/intern/MOD_mesh_to_volume.cc index 426bba05d76..61d556a64af 100644 --- a/source/blender/modifiers/intern/MOD_mesh_to_volume.cc +++ b/source/blender/modifiers/intern/MOD_mesh_to_volume.cc @@ -107,7 +107,7 @@ class OpenVDBMeshAdapter { static void initData(ModifierData *md) { MeshToVolumeModifierData *mvmd = reinterpret_cast<MeshToVolumeModifierData *>(md); - mvmd->object = NULL; + mvmd->object = nullptr; mvmd->resolution_mode = MESH_TO_VOLUME_RESOLUTION_MODE_VOXEL_AMOUNT; mvmd->voxel_size = 0.1f; mvmd->voxel_amount = 32; @@ -139,32 +139,32 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) { uiLayout *layout = panel->layout; - PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL); + PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr); MeshToVolumeModifierData *mvmd = static_cast<MeshToVolumeModifierData *>(ptr->data); uiLayoutSetPropSep(layout, true); uiLayoutSetPropDecorate(layout, false); - uiItemR(layout, ptr, "object", 0, NULL, ICON_NONE); - uiItemR(layout, ptr, "density", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "object", 0, nullptr, ICON_NONE); + uiItemR(layout, ptr, "density", 0, nullptr, ICON_NONE); { uiLayout *col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "use_fill_volume", 0, NULL, ICON_NONE); - uiItemR(col, ptr, "exterior_band_width", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "use_fill_volume", 0, nullptr, ICON_NONE); + uiItemR(col, ptr, "exterior_band_width", 0, nullptr, ICON_NONE); uiLayout *subcol = uiLayoutColumn(col, false); uiLayoutSetActive(subcol, !mvmd->fill_volume); - uiItemR(subcol, ptr, "interior_band_width", 0, NULL, ICON_NONE); + uiItemR(subcol, ptr, "interior_band_width", 0, nullptr, ICON_NONE); } { uiLayout *col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "resolution_mode", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "resolution_mode", 0, nullptr, ICON_NONE); if (mvmd->resolution_mode == MESH_TO_VOLUME_RESOLUTION_MODE_VOXEL_AMOUNT) { - uiItemR(col, ptr, "voxel_amount", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "voxel_amount", 0, nullptr, ICON_NONE); } else { - uiItemR(col, ptr, "voxel_size", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "voxel_size", 0, nullptr, ICON_NONE); } } @@ -213,11 +213,11 @@ static Volume *modifyVolume(ModifierData *md, const ModifierEvalContext *ctx, Vo MeshToVolumeModifierData *mvmd = reinterpret_cast<MeshToVolumeModifierData *>(md); Object *object_to_convert = mvmd->object; - if (object_to_convert == NULL) { + if (object_to_convert == nullptr) { return input_volume; } Mesh *mesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(object_to_convert, false); - if (mesh == NULL) { + if (mesh == nullptr) { return input_volume; } BKE_mesh_wrapper_ensure_mdata(mesh); @@ -290,26 +290,26 @@ ModifierTypeInfo modifierType_MeshToVolume = { /* copyData */ BKE_modifier_copydata_generic, - /* deformVerts */ NULL, - /* deformMatrices */ NULL, - /* deformVertsEM */ NULL, - /* deformMatricesEM */ NULL, - /* modifyMesh */ NULL, - /* modifyHair */ NULL, - /* modifyPointCloud */ NULL, + /* deformVerts */ nullptr, + /* deformMatrices */ nullptr, + /* deformVertsEM */ nullptr, + /* deformMatricesEM */ nullptr, + /* modifyMesh */ nullptr, + /* modifyHair */ nullptr, + /* modifyPointCloud */ nullptr, /* modifyVolume */ modifyVolume, /* initData */ initData, - /* requiredDataMask */ NULL, - /* freeData */ NULL, - /* isDisabled */ NULL, + /* requiredDataMask */ nullptr, + /* freeData */ nullptr, + /* isDisabled */ nullptr, /* updateDepsgraph */ updateDepsgraph, - /* dependsOnTime */ NULL, - /* dependsOnNormals */ NULL, + /* dependsOnTime */ nullptr, + /* dependsOnNormals */ nullptr, /* foreachIDLink */ foreachIDLink, - /* foreachTexLink */ NULL, - /* freeRuntimeData */ NULL, + /* foreachTexLink */ nullptr, + /* freeRuntimeData */ nullptr, /* panelRegister */ panelRegister, - /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendWrite */ nullptr, + /* blendRead */ nullptr, }; diff --git a/source/blender/modifiers/intern/MOD_volume_displace.cc b/source/blender/modifiers/intern/MOD_volume_displace.cc index 7293945312a..1b1d4187899 100644 --- a/source/blender/modifiers/intern/MOD_volume_displace.cc +++ b/source/blender/modifiers/intern/MOD_volume_displace.cc @@ -62,7 +62,7 @@ static void initData(ModifierData *md) { VolumeDisplaceModifierData *vdmd = reinterpret_cast<VolumeDisplaceModifierData *>(md); - vdmd->texture = NULL; + vdmd->texture = nullptr; vdmd->strength = 0.5f; copy_v3_fl(vdmd->texture_mid_level, 0.5f); vdmd->texture_sample_radius = 1.0f; @@ -71,11 +71,11 @@ static void initData(ModifierData *md) static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx) { VolumeDisplaceModifierData *vdmd = reinterpret_cast<VolumeDisplaceModifierData *>(md); - if (vdmd->texture != NULL) { + if (vdmd->texture != nullptr) { DEG_add_generic_id_relation(ctx->node, &vdmd->texture->id, "Volume Displace Modifier"); } if (vdmd->texture_map_mode == MOD_VOLUME_DISPLACE_MAP_OBJECT) { - if (vdmd->texture_map_object != NULL) { + if (vdmd->texture_map_object != nullptr) { DEG_add_object_relation( ctx->node, vdmd->texture_map_object, DEG_OB_COMP_TRANSFORM, "Volume Displace Modifier"); } @@ -114,14 +114,14 @@ static void panel_draw(const bContext *C, Panel *panel) uiLayoutSetPropSep(layout, true); uiLayoutSetPropDecorate(layout, false); - uiTemplateID(layout, C, ptr, "texture", "texture.new", NULL, NULL, 0, ICON_NONE, NULL); + uiTemplateID(layout, C, ptr, "texture", "texture.new", nullptr, nullptr, 0, ICON_NONE, nullptr); uiItemR(layout, ptr, "texture_map_mode", 0, "Texture Mapping", ICON_NONE); if (vdmd->texture_map_mode == MOD_VOLUME_DISPLACE_MAP_OBJECT) { uiItemR(layout, ptr, "texture_map_object", 0, "Object", ICON_NONE); } - uiItemR(layout, ptr, "strength", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "strength", 0, nullptr, ICON_NONE); uiItemR(layout, ptr, "texture_sample_radius", 0, "Sample Radius", ICON_NONE); uiItemR(layout, ptr, "texture_mid_level", 0, "Mid Level", ICON_NONE); @@ -166,7 +166,7 @@ template<typename GridType> struct DisplaceOp { openvdb::Vec3d compute_displace_vector(const openvdb::Coord &coord) const { - if (this->texture != NULL) { + if (this->texture != nullptr) { const openvdb::Vec3f texture_pos = coord.asVec3s() * this->index_to_texture; const openvdb::Vec3d texture_value = this->evaluate_texture(texture_pos); const openvdb::Vec3d displacement = (texture_value - this->texture_mid_level) * @@ -180,7 +180,7 @@ template<typename GridType> struct DisplaceOp { { TexResult texture_result = {0}; BKE_texture_get_value( - NULL, this->texture, const_cast<float *>(pos.asV()), &texture_result, false); + nullptr, this->texture, const_cast<float *>(pos.asV()), &texture_result, false); return {texture_result.tr, texture_result.tg, texture_result.tb}; } }; @@ -270,7 +270,7 @@ struct DisplaceGridOp { return index_to_object * object_to_world; } case MOD_VOLUME_DISPLACE_MAP_OBJECT: { - if (vdmd.texture_map_object == NULL) { + if (vdmd.texture_map_object == nullptr) { return index_to_object; } const openvdb::Mat4s object_to_world = matrix_to_openvdb(ctx.object->obmat); @@ -295,7 +295,7 @@ static Volume *modifyVolume(ModifierData *md, const ModifierEvalContext *ctx, Vo const int grid_amount = BKE_volume_num_grids(volume); for (int grid_index = 0; grid_index < grid_amount; grid_index++) { VolumeGrid *volume_grid = BKE_volume_grid_get(volume, grid_index); - BLI_assert(volume_grid != NULL); + BLI_assert(volume_grid != nullptr); openvdb::GridBase::Ptr grid = BKE_volume_grid_openvdb_for_write(volume, volume_grid, false); VolumeGridType grid_type = BKE_volume_grid_type(volume_grid); @@ -323,26 +323,26 @@ ModifierTypeInfo modifierType_VolumeDisplace = { /* copyData */ BKE_modifier_copydata_generic, - /* deformVerts */ NULL, - /* deformMatrices */ NULL, - /* deformVertsEM */ NULL, - /* deformMatricesEM */ NULL, - /* modifyMesh */ NULL, - /* modifyHair */ NULL, - /* modifyPointCloud */ NULL, + /* deformVerts */ nullptr, + /* deformMatrices */ nullptr, + /* deformVertsEM */ nullptr, + /* deformMatricesEM */ nullptr, + /* modifyMesh */ nullptr, + /* modifyHair */ nullptr, + /* modifyPointCloud */ nullptr, /* modifyVolume */ modifyVolume, /* initData */ initData, - /* requiredDataMask */ NULL, - /* freeData */ NULL, - /* isDisabled */ NULL, + /* requiredDataMask */ nullptr, + /* freeData */ nullptr, + /* isDisabled */ nullptr, /* updateDepsgraph */ updateDepsgraph, /* dependsOnTime */ dependsOnTime, - /* dependsOnNormals */ NULL, + /* dependsOnNormals */ nullptr, /* foreachIDLink */ foreachIDLink, /* foreachTexLink */ foreachTexLink, - /* freeRuntimeData */ NULL, + /* freeRuntimeData */ nullptr, /* panelRegister */ panelRegister, - /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendWrite */ nullptr, + /* blendRead */ nullptr, }; diff --git a/source/blender/modifiers/intern/MOD_volume_to_mesh.cc b/source/blender/modifiers/intern/MOD_volume_to_mesh.cc index 8556271bf87..e008dc3f140 100644 --- a/source/blender/modifiers/intern/MOD_volume_to_mesh.cc +++ b/source/blender/modifiers/intern/MOD_volume_to_mesh.cc @@ -59,7 +59,7 @@ using blender::Span; static void initData(ModifierData *md) { VolumeToMeshModifierData *vmmd = reinterpret_cast<VolumeToMeshModifierData *>(md); - vmmd->object = NULL; + vmmd->object = nullptr; vmmd->threshold = 0.1f; strncpy(vmmd->grid_name, "density", MAX_NAME); vmmd->adaptivity = 0.0f; @@ -91,7 +91,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) { uiLayout *layout = panel->layout; - PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL); + PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr); VolumeToMeshModifierData *vmmd = static_cast<VolumeToMeshModifierData *>(ptr->data); uiLayoutSetPropSep(layout, true); @@ -99,26 +99,26 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) { uiLayout *col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "object", 0, NULL, ICON_NONE); - uiItemR(col, ptr, "grid_name", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "object", 0, nullptr, ICON_NONE); + uiItemR(col, ptr, "grid_name", 0, nullptr, ICON_NONE); } { uiLayout *col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "resolution_mode", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "resolution_mode", 0, nullptr, ICON_NONE); if (vmmd->resolution_mode == VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_AMOUNT) { - uiItemR(col, ptr, "voxel_amount", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "voxel_amount", 0, nullptr, ICON_NONE); } else if (vmmd->resolution_mode == VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_SIZE) { - uiItemR(col, ptr, "voxel_size", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "voxel_size", 0, nullptr, ICON_NONE); } } { uiLayout *col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "threshold", 0, NULL, ICON_NONE); - uiItemR(col, ptr, "adaptivity", 0, NULL, ICON_NONE); - uiItemR(col, ptr, "use_smooth_shade", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "threshold", 0, nullptr, ICON_NONE); + uiItemR(col, ptr, "adaptivity", 0, nullptr, ICON_NONE); + uiItemR(col, ptr, "use_smooth_shade", 0, nullptr, ICON_NONE); } modifier_panel_end(layout, ptr); @@ -330,26 +330,26 @@ ModifierTypeInfo modifierType_VolumeToMesh = { /* copyData */ BKE_modifier_copydata_generic, - /* deformVerts */ NULL, - /* deformMatrices */ NULL, - /* deformVertsEM */ NULL, - /* deformMatricesEM */ NULL, + /* deformVerts */ nullptr, + /* deformMatrices */ nullptr, + /* deformVertsEM */ nullptr, + /* deformMatricesEM */ nullptr, /* modifyMesh */ modifyMesh, - /* modifyHair */ NULL, - /* modifyPointCloud */ NULL, - /* modifyVolume */ NULL, + /* modifyHair */ nullptr, + /* modifyPointCloud */ nullptr, + /* modifyVolume */ nullptr, /* initData */ initData, - /* requiredDataMask */ NULL, - /* freeData */ NULL, - /* isDisabled */ NULL, + /* requiredDataMask */ nullptr, + /* freeData */ nullptr, + /* isDisabled */ nullptr, /* updateDepsgraph */ updateDepsgraph, - /* dependsOnTime */ NULL, - /* dependsOnNormals */ NULL, + /* dependsOnTime */ nullptr, + /* dependsOnNormals */ nullptr, /* foreachIDLink */ foreachIDLink, - /* foreachTexLink */ NULL, - /* freeRuntimeData */ NULL, + /* foreachTexLink */ nullptr, + /* freeRuntimeData */ nullptr, /* panelRegister */ panelRegister, - /* blendWrite */ NULL, - /* blendRead */ NULL, + /* blendWrite */ nullptr, + /* blendRead */ nullptr, }; diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index 9b9af437e4b..bf3c259539b 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -36,7 +36,7 @@ set(INC ../imbuf ../makesdna ../makesrna - ../render/extern/include + ../render ../../../intern/glew-mx ../../../intern/guardedalloc ../../../intern/sky/include diff --git a/source/blender/nodes/geometry/nodes/node_geo_common.cc b/source/blender/nodes/geometry/nodes/node_geo_common.cc index ee3045b9b35..8adc3962698 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_common.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_common.cc @@ -33,10 +33,10 @@ void register_node_type_geo_group(void) ntype.insert_link = node_insert_link_default; ntype.update_internal_links = node_update_internal_links_default; ntype.rna_ext.srna = RNA_struct_find("GeometryNodeGroup"); - BLI_assert(ntype.rna_ext.srna != NULL); + BLI_assert(ntype.rna_ext.srna != nullptr); RNA_struct_blender_type_set(ntype.rna_ext.srna, &ntype); - node_type_socket_templates(&ntype, NULL, NULL); + node_type_socket_templates(&ntype, nullptr, nullptr); node_type_size(&ntype, 140, 60, 400); node_type_label(&ntype, node_group_label); node_type_group_update(&ntype, node_group_update); diff --git a/source/blender/nodes/intern/node_socket.cc b/source/blender/nodes/intern/node_socket.cc index b2874a0fdbb..1a86bb4b2f9 100644 --- a/source/blender/nodes/intern/node_socket.cc +++ b/source/blender/nodes/intern/node_socket.cc @@ -136,7 +136,7 @@ static void verify_socket_template_list(bNodeTree *ntree, bNodeSocketTemplate *stemp; /* no inputs anymore? */ - if (stemp_first == NULL) { + if (stemp_first == nullptr) { for (sock = (bNodeSocket *)socklist->first; sock; sock = nextsock) { nextsock = sock->next; nodeRemoveSocket(ntree, node, sock); @@ -267,7 +267,7 @@ void node_socket_init_default_value(bNodeSocket *sock) case SOCK_OBJECT: { bNodeSocketValueObject *dval = (bNodeSocketValueObject *)MEM_callocN( sizeof(bNodeSocketValueObject), "node socket value object"); - dval->value = NULL; + dval->value = nullptr; sock->default_value = dval; break; @@ -275,7 +275,7 @@ void node_socket_init_default_value(bNodeSocket *sock) case SOCK_IMAGE: { bNodeSocketValueImage *dval = (bNodeSocketValueImage *)MEM_callocN( sizeof(bNodeSocketValueImage), "node socket value image"); - dval->value = NULL; + dval->value = nullptr; sock->default_value = dval; break; @@ -491,13 +491,13 @@ static bNodeSocketType *make_standard_socket_type(int type, int subtype) /* set the RNA type * uses the exact same identifier as the socket type idname */ srna = stype->ext_socket.srna = RNA_struct_find(socket_idname); - BLI_assert(srna != NULL); + BLI_assert(srna != nullptr); /* associate the RNA type with the socket type */ RNA_struct_blender_type_set(srna, stype); /* set the interface RNA type */ srna = stype->ext_interface.srna = RNA_struct_find(interface_idname); - BLI_assert(srna != NULL); + BLI_assert(srna != nullptr); /* associate the RNA type with the socket type */ RNA_struct_blender_type_set(srna, stype); @@ -521,7 +521,7 @@ static bNodeSocketType *make_standard_socket_type(int type, int subtype) extern "C" void ED_init_node_socket_type_virtual(bNodeSocketType *); -static bNodeSocketType *make_socket_type_virtual(void) +static bNodeSocketType *make_socket_type_virtual() { const char *socket_idname = "NodeSocketVirtual"; bNodeSocketType *stype; @@ -534,7 +534,7 @@ static bNodeSocketType *make_socket_type_virtual(void) /* set the RNA type * uses the exact same identifier as the socket type idname */ srna = stype->ext_socket.srna = RNA_struct_find(socket_idname); - BLI_assert(srna != NULL); + BLI_assert(srna != nullptr); /* associate the RNA type with the socket type */ RNA_struct_blender_type_set(srna, stype); diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.cc b/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.cc index c1543f791f1..59b89c46fc7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcombRGB.cc @@ -101,7 +101,7 @@ void register_node_type_sh_seprgb(void) sh_fn_node_type_base(&ntype, SH_NODE_SEPRGB, "Separate RGB", NODE_CLASS_CONVERTOR, 0); node_type_socket_templates(&ntype, sh_node_seprgb_in, sh_node_seprgb_out); - node_type_exec(&ntype, NULL, NULL, node_shader_exec_seprgb); + node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_seprgb); node_type_gpu(&ntype, gpu_shader_seprgb); ntype.expand_in_mf_network = sh_node_seprgb_expand_in_mf_network; @@ -159,7 +159,7 @@ void register_node_type_sh_combrgb(void) sh_fn_node_type_base(&ntype, SH_NODE_COMBRGB, "Combine RGB", NODE_CLASS_CONVERTOR, 0); node_type_socket_templates(&ntype, sh_node_combrgb_in, sh_node_combrgb_out); - node_type_exec(&ntype, NULL, NULL, node_shader_exec_combrgb); + node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_combrgb); node_type_gpu(&ntype, gpu_shader_combrgb); ntype.expand_in_mf_network = sh_node_combrgb_expand_in_mf_network; diff --git a/source/blender/nodes/shader/nodes/node_shader_valToRgb.cc b/source/blender/nodes/shader/nodes/node_shader_valToRgb.cc index becc4623e9a..a86a8bb8935 100644 --- a/source/blender/nodes/shader/nodes/node_shader_valToRgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_valToRgb.cc @@ -172,7 +172,7 @@ void register_node_type_sh_valtorgb(void) node_type_init(&ntype, node_shader_init_valtorgb); node_type_size_preset(&ntype, NODE_SIZE_LARGE); node_type_storage(&ntype, "ColorBand", node_free_standard_storage, node_copy_standard_storage); - node_type_exec(&ntype, NULL, NULL, node_shader_exec_valtorgb); + node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_valtorgb); node_type_gpu(&ntype, gpu_shader_valtorgb); ntype.expand_in_mf_network = sh_node_valtorgb_expand_in_mf_network; @@ -215,7 +215,7 @@ void register_node_type_sh_rgbtobw(void) sh_node_type_base(&ntype, SH_NODE_RGBTOBW, "RGB to BW", NODE_CLASS_CONVERTOR, 0); node_type_socket_templates(&ntype, sh_node_rgbtobw_in, sh_node_rgbtobw_out); - node_type_exec(&ntype, NULL, NULL, node_shader_exec_rgbtobw); + node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_rgbtobw); node_type_gpu(&ntype, gpu_shader_rgbtobw); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_value.cc b/source/blender/nodes/shader/nodes/node_shader_value.cc index 1a1382fa8af..5a8a1b847cc 100644 --- a/source/blender/nodes/shader/nodes/node_shader_value.cc +++ b/source/blender/nodes/shader/nodes/node_shader_value.cc @@ -51,7 +51,7 @@ void register_node_type_sh_value(void) static bNodeType ntype; sh_fn_node_type_base(&ntype, SH_NODE_VALUE, "Value", NODE_CLASS_INPUT, 0); - node_type_socket_templates(&ntype, NULL, sh_node_value_out); + node_type_socket_templates(&ntype, nullptr, sh_node_value_out); node_type_gpu(&ntype, gpu_shader_value); ntype.expand_in_mf_network = sh_node_value_expand_in_mf_network; diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index ad5f1a486b4..77ced169dab 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -1062,6 +1062,20 @@ static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObje return Vector_CreatePyObject(pt_dst, 3, NULL); } +struct PointsInPlanes_UserData { + PyObject *py_verts; + char *planes_used; +}; + +static void points_in_planes_fn(const float co[3], int i, int j, int k, void *user_data_p) +{ + struct PointsInPlanes_UserData *user_data = user_data_p; + PyList_APPEND(user_data->py_verts, Vector_CreatePyObject(co, 3, NULL)); + user_data->planes_used[i] = true; + user_data->planes_used[j] = true; + user_data->planes_used[k] = true; +} + PyDoc_STRVAR(M_Geometry_points_in_planes_doc, ".. function:: points_in_planes(planes)\n" "\n" @@ -1073,7 +1087,6 @@ PyDoc_STRVAR(M_Geometry_points_in_planes_doc, " :return: two lists, once containing the vertices inside the planes, another " "containing the plane indices used\n" " :rtype: pair of lists\n"); -/* note: this function could be optimized by some spatial structure */ static PyObject *M_Geometry_points_in_planes(PyObject *UNUSED(self), PyObject *args) { PyObject *py_planes; @@ -1090,81 +1103,37 @@ static PyObject *M_Geometry_points_in_planes(PyObject *UNUSED(self), PyObject *a } /* note, this could be refactored into plain C easy - py bits are noted */ - const float eps = 0.0001f; - const uint len = (uint)planes_len; - uint i, j, k, l; - float n1n2[3], n2n3[3], n3n1[3]; - float potentialVertex[3]; - char *planes_used = PyMem_Malloc(sizeof(char) * len); + struct PointsInPlanes_UserData user_data = { + .py_verts = PyList_New(0), + .planes_used = PyMem_Malloc(sizeof(char) * planes_len), + }; /* python */ - PyObject *py_verts = PyList_New(0); PyObject *py_plane_index = PyList_New(0); - memset(planes_used, 0, sizeof(char) * len); + memset(user_data.planes_used, 0, sizeof(char) * planes_len); - for (i = 0; i < len; i++) { - const float *N1 = planes[i]; - for (j = i + 1; j < len; j++) { - const float *N2 = planes[j]; - cross_v3_v3v3(n1n2, N1, N2); - if (len_squared_v3(n1n2) > eps) { - for (k = j + 1; k < len; k++) { - const float *N3 = planes[k]; - cross_v3_v3v3(n2n3, N2, N3); - if (len_squared_v3(n2n3) > eps) { - cross_v3_v3v3(n3n1, N3, N1); - if (len_squared_v3(n3n1) > eps) { - const float quotient = dot_v3v3(N1, n2n3); - if (fabsf(quotient) > eps) { - /** - * <pre> - * potentialVertex = ( - * (n2n3 * N1[3] + n3n1 * N2[3] + n1n2 * N3[3]) * - * (-1.0 / quotient)); - * </pre> - */ - const float quotient_ninv = -1.0f / quotient; - potentialVertex[0] = ((n2n3[0] * N1[3]) + (n3n1[0] * N2[3]) + (n1n2[0] * N3[3])) * - quotient_ninv; - potentialVertex[1] = ((n2n3[1] * N1[3]) + (n3n1[1] * N2[3]) + (n1n2[1] * N3[3])) * - quotient_ninv; - potentialVertex[2] = ((n2n3[2] * N1[3]) + (n3n1[2] * N2[3]) + (n1n2[2] * N3[3])) * - quotient_ninv; - for (l = 0; l < len; l++) { - const float *NP = planes[l]; - if ((dot_v3v3(NP, potentialVertex) + NP[3]) > 0.000001f) { - break; - } - } - - if (l == len) { /* ok */ - /* python */ - PyList_APPEND(py_verts, Vector_CreatePyObject(potentialVertex, 3, NULL)); - planes_used[i] = planes_used[j] = planes_used[k] = true; - } - } - } - } - } - } - } - } + const float eps_coplanar = 1e-4f; + const float eps_isect = 1e-6f; + const bool has_isect = isect_planes_v3_fn( + planes, planes_len, eps_coplanar, eps_isect, points_in_planes_fn, &user_data); PyMem_Free(planes); - /* now make a list of used planes */ - for (i = 0; i < len; i++) { - if (planes_used[i]) { - PyList_APPEND(py_plane_index, PyLong_FromLong(i)); + /* Now make user_data list of used planes. */ + if (has_isect) { + for (int i = 0; i < planes_len; i++) { + if (user_data.planes_used[i]) { + PyList_APPEND(py_plane_index, PyLong_FromLong(i)); + } } } - PyMem_Free(planes_used); + PyMem_Free(user_data.planes_used); { PyObject *ret = PyTuple_New(2); - PyTuple_SET_ITEMS(ret, py_verts, py_plane_index); + PyTuple_SET_ITEMS(ret, user_data.py_verts, py_plane_index); return ret; } } diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt index 41caee1a39c..6e229fd25b7 100644 --- a/source/blender/render/CMakeLists.txt +++ b/source/blender/render/CMakeLists.txt @@ -20,8 +20,8 @@ set(INC - extern/include - intern/include + . + intern ../blenkernel ../blenlib ../blentranslation @@ -42,29 +42,30 @@ set(INC set(SRC - intern/source/bake_api.c - intern/source/external_engine.c - intern/source/imagetexture.c - intern/source/initrender.c - intern/source/multires_bake.c - intern/source/pipeline.c - intern/source/pointdensity.c - intern/source/render_result.c - intern/source/render_texture.c - intern/source/zbuf.c + intern/bake_api.c + intern/external_engine.c + intern/initrender.c + intern/multires_bake.c + intern/pipeline.c + intern/render_result.c + intern/texture_image.c + intern/texture_pointdensity.c + intern/texture_procedural.c + intern/zbuf.c - extern/include/RE_bake.h - extern/include/RE_engine.h - extern/include/RE_multires_bake.h - extern/include/RE_pipeline.h - extern/include/RE_render_ext.h - extern/include/RE_shader_ext.h - intern/include/initrender.h - intern/include/render_result.h - intern/include/render_types.h - intern/include/renderpipeline.h - intern/include/texture.h - intern/include/zbuf.h + RE_bake.h + RE_engine.h + RE_multires_bake.h + RE_pipeline.h + RE_render_ext.h + RE_shader_ext.h + + intern/initrender.h + intern/render_result.h + intern/render_types.h + intern/pipeline.h + intern/texture_common.h + intern/zbuf.h ) set(LIB diff --git a/source/blender/render/extern/include/RE_bake.h b/source/blender/render/RE_bake.h index 3ed41ede006..3ed41ede006 100644 --- a/source/blender/render/extern/include/RE_bake.h +++ b/source/blender/render/RE_bake.h diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/RE_engine.h index e53f33eacff..e53f33eacff 100644 --- a/source/blender/render/extern/include/RE_engine.h +++ b/source/blender/render/RE_engine.h diff --git a/source/blender/render/extern/include/RE_multires_bake.h b/source/blender/render/RE_multires_bake.h index fd200e85719..fd200e85719 100644 --- a/source/blender/render/extern/include/RE_multires_bake.h +++ b/source/blender/render/RE_multires_bake.h diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/RE_pipeline.h index 4dd2b300700..4dd2b300700 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/RE_pipeline.h diff --git a/source/blender/render/extern/include/RE_render_ext.h b/source/blender/render/RE_render_ext.h index 76812840c91..28a22399892 100644 --- a/source/blender/render/extern/include/RE_render_ext.h +++ b/source/blender/render/RE_render_ext.h @@ -35,7 +35,7 @@ struct MTex; extern "C" { #endif -/* render_texture.c */ +/* texture_procedural.c */ bool RE_texture_evaluate(const struct MTex *mtex, const float vec[3], const int thread, @@ -53,10 +53,10 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen void RE_texture_rng_init(void); void RE_texture_rng_exit(void); -/* imagetexture.c */ +/* texture_image.c */ void ibuf_sample(struct ImBuf *ibuf, float fx, float fy, float dx, float dy, float result[4]); -/* pointdensity.c */ +/* texture_pointdensity.c */ struct PointDensity; void RE_point_density_cache(struct Depsgraph *depsgraph, struct PointDensity *pd); diff --git a/source/blender/render/extern/include/RE_shader_ext.h b/source/blender/render/RE_shader_ext.h index d9d5a924949..d9d5a924949 100644 --- a/source/blender/render/extern/include/RE_shader_ext.h +++ b/source/blender/render/RE_shader_ext.h diff --git a/source/blender/render/intern/source/bake_api.c b/source/blender/render/intern/bake_api.c index 6f5db4986f2..6f5db4986f2 100644 --- a/source/blender/render/intern/source/bake_api.c +++ b/source/blender/render/intern/bake_api.c diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/external_engine.c index b2121816932..9a3dc0d000c 100644 --- a/source/blender/render/intern/source/external_engine.c +++ b/source/blender/render/intern/external_engine.c @@ -63,9 +63,9 @@ #include "DRW_engine.h" #include "initrender.h" +#include "pipeline.h" #include "render_result.h" #include "render_types.h" -#include "renderpipeline.h" /* Render Engine Types */ diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/initrender.c index 7eeef79e527..fb7f7270c13 100644 --- a/source/blender/render/intern/source/initrender.c +++ b/source/blender/render/intern/initrender.c @@ -40,8 +40,8 @@ #include "BKE_camera.h" /* this module */ +#include "pipeline.h" #include "render_types.h" -#include "renderpipeline.h" /* Own includes */ #include "initrender.h" diff --git a/source/blender/render/intern/include/initrender.h b/source/blender/render/intern/initrender.h index f5ac352752f..f5ac352752f 100644 --- a/source/blender/render/intern/include/initrender.h +++ b/source/blender/render/intern/initrender.h diff --git a/source/blender/render/intern/source/multires_bake.c b/source/blender/render/intern/multires_bake.c index ea18f151e1e..ea18f151e1e 100644 --- a/source/blender/render/intern/source/multires_bake.c +++ b/source/blender/render/intern/multires_bake.c diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/pipeline.c index edf627c4e54..1bc6a056cda 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/pipeline.c @@ -90,8 +90,8 @@ #include "SEQ_sequencer.h" -#include "../../../windowmanager/WM_api.h" /* XXX */ -#include "../../../windowmanager/wm_window.h" /* XXX */ +#include "../../windowmanager/WM_api.h" /* XXX */ +#include "../../windowmanager/wm_window.h" /* XXX */ #include "GPU_context.h" #ifdef WITH_FREESTYLE @@ -102,9 +102,9 @@ /* internal */ #include "initrender.h" +#include "pipeline.h" #include "render_result.h" #include "render_types.h" -#include "renderpipeline.h" /* render flow * diff --git a/source/blender/render/intern/include/renderpipeline.h b/source/blender/render/intern/pipeline.h index 062df59bfd3..062df59bfd3 100644 --- a/source/blender/render/intern/include/renderpipeline.h +++ b/source/blender/render/intern/pipeline.h diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/render_result.c index 990373bafa0..990373bafa0 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/render_result.c diff --git a/source/blender/render/intern/include/render_result.h b/source/blender/render/intern/render_result.h index 5c487223e94..5c487223e94 100644 --- a/source/blender/render/intern/include/render_result.h +++ b/source/blender/render/intern/render_result.h diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/render_types.h index 6be5fb4792c..6be5fb4792c 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/render_types.h diff --git a/source/blender/render/intern/include/texture.h b/source/blender/render/intern/texture_common.h index 44ad508fe33..b3a976c3fe0 100644 --- a/source/blender/render/intern/include/texture.h +++ b/source/blender/render/intern/texture_common.h @@ -79,7 +79,7 @@ struct ImagePool; struct Tex; struct TexResult; -/* imagetexture.h */ +/* texture_image.c */ int imagewraposa(struct Tex *tex, struct Image *ima, diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/texture_image.c index 31c169f621b..26d9f12c91e 100644 --- a/source/blender/render/intern/source/imagetexture.c +++ b/source/blender/render/intern/texture_image.c @@ -50,7 +50,7 @@ #include "RE_shader_ext.h" #include "render_types.h" -#include "texture.h" +#include "texture_common.h" static void boxsample(ImBuf *ibuf, float minx, diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/texture_pointdensity.c index e730aeb263d..0e62eea5b11 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/texture_pointdensity.c @@ -54,7 +54,7 @@ #include "DEG_depsgraph_query.h" #include "render_types.h" -#include "texture.h" +#include "texture_common.h" #include "RE_render_ext.h" #include "RE_shader_ext.h" diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/texture_procedural.c index ff9c462f603..7f93addb76d 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/texture_procedural.c @@ -55,7 +55,7 @@ #include "MEM_guardedalloc.h" #include "render_types.h" -#include "texture.h" +#include "texture_common.h" #include "RE_render_ext.h" #include "RE_shader_ext.h" diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/zbuf.c index d74ab330dc2..d74ab330dc2 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/zbuf.c diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/zbuf.h index 41fa15c594f..41fa15c594f 100644 --- a/source/blender/render/intern/include/zbuf.h +++ b/source/blender/render/intern/zbuf.h diff --git a/source/blender/sequencer/CMakeLists.txt b/source/blender/sequencer/CMakeLists.txt index 3841a6e6414..9efe23dd8c4 100644 --- a/source/blender/sequencer/CMakeLists.txt +++ b/source/blender/sequencer/CMakeLists.txt @@ -23,16 +23,20 @@ set(INC intern ../blenkernel ../blenlib + ../blenloader ../blentranslation ../depsgraph ../imbuf ../makesdna ../makesrna - ../render/extern/include + ../render ../blenfont ../windowmanager ../../../intern/atomic ../../../intern/guardedalloc + + # dna_type_offsets.h + ${CMAKE_CURRENT_BINARY_DIR}/../makesdna/intern ) set(INC_SYS @@ -72,3 +76,6 @@ if(WITH_AUDASPACE) endif() blender_add_lib(bf_sequencer "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") + +# Needed so we can use dna_type_offsets.h. +add_dependencies(bf_sequencer bf_dna) diff --git a/source/blender/sequencer/SEQ_sequencer.h b/source/blender/sequencer/SEQ_sequencer.h index d969b43bd50..d9e2d32db0b 100644 --- a/source/blender/sequencer/SEQ_sequencer.h +++ b/source/blender/sequencer/SEQ_sequencer.h @@ -44,6 +44,9 @@ struct StripElem; struct TextVars; struct bContext; struct bSound; +struct BlendWriter; +struct BlendDataReader; +struct BlendLibReader; /* Wipe effect */ enum { @@ -142,9 +145,11 @@ typedef struct SeqRenderData { // bool gpu_full_samples; } SeqRenderData; -struct ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float cfra, int chanshown); +struct ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, + float timeline_frame, + int chanshown); struct ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData *context, - float cfra, + float timeline_frame, struct Sequence *seq); void SEQ_render_init_colorspace(struct Sequence *seq); void SEQ_render_new_render_data(struct Main *bmain, @@ -155,8 +160,8 @@ void SEQ_render_new_render_data(struct Main *bmain, int preview_render_size, int for_render, SeqRenderData *r_context); -int SEQ_render_evaluate_frame(struct Scene *scene, int cfra); -struct StripElem *SEQ_render_give_stripelem(struct Sequence *seq, int cfra); +int SEQ_render_evaluate_frame(struct Scene *scene, int timeline_frame); +struct StripElem *SEQ_render_give_stripelem(struct Sequence *seq, int timeline_frame); /* ********************************************************************** * render.c @@ -193,7 +198,7 @@ int BKE_sequencer_recursive_apply(struct Sequence *seq, void *arg); float BKE_sequence_get_fps(struct Scene *scene, struct Sequence *seq); int BKE_sequencer_find_next_prev_edit(struct Scene *scene, - int cfra, + int timeline_frame, const short side, const bool do_skip_mute, const bool do_center, @@ -352,7 +357,7 @@ void BKE_sequence_invalidate_cache_in_range(struct Scene *scene, struct Sequence *seq, struct Sequence *range_mask, int invalidate_types); -void BKE_sequencer_all_free_anim_ibufs(struct Scene *scene, int cfra); +void BKE_sequencer_all_free_anim_ibufs(struct Scene *scene, int timeline_frame); /* ********************************************************************** * sequencer.c @@ -400,7 +405,7 @@ typedef struct SeqLoadInfo { /* use as an api function */ typedef struct Sequence *(*SeqLoadFn)(struct bContext *, ListBase *, struct SeqLoadInfo *); -struct Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine, int type); +struct Sequence *BKE_sequence_alloc(ListBase *lb, int timeline_frame, int machine, int type); struct Sequence *BKE_sequencer_add_image_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load); @@ -457,10 +462,16 @@ struct SequenceModifierData *BKE_sequence_modifier_find_by_name(struct Sequence struct ImBuf *BKE_sequence_modifier_apply_stack(const SeqRenderData *context, struct Sequence *seq, struct ImBuf *ibuf, - int cfra); + int timeline_frame); void BKE_sequence_modifier_list_copy(struct Sequence *seqn, struct Sequence *seq); int BKE_sequence_supports_modifiers(struct Sequence *seq); +void BKE_sequence_modifier_blend_write(struct BlendWriter *writer, struct ListBase *modbase); +void BKE_sequence_modifier_blend_read_data(struct BlendDataReader *reader, struct ListBase *lb); +void BKE_sequence_modifier_blend_read_lib(struct BlendLibReader *reader, + struct Scene *scene, + struct ListBase *lb); + /* ********************************************************************** * seqeffects.c * @@ -500,7 +511,7 @@ struct SeqEffectHandle { void (*store_icu_yrange)(struct Sequence *seq, short adrcode, float *ymin, float *ymax); /* stores the default facf0 and facf1 if no IPO is present */ - void (*get_default_fac)(struct Sequence *seq, float cfra, float *facf0, float *facf1); + void (*get_default_fac)(struct Sequence *seq, float timeline_frame, float *facf0, float *facf1); /* execute the effect * sequence effects are only required to either support @@ -509,7 +520,7 @@ struct SeqEffectHandle { struct ImBuf *(*execute)(const SeqRenderData *context, struct Sequence *seq, - float cfra, + float timeline_frame, float facf0, float facf1, struct ImBuf *ibuf1, @@ -523,7 +534,7 @@ struct SeqEffectHandle { void (*execute_slice)(const SeqRenderData *context, struct Sequence *seq, - float cfra, + float timeline_frame, float facf0, float facf1, struct ImBuf *ibuf1, diff --git a/source/blender/sequencer/intern/effects.c b/source/blender/sequencer/intern/effects.c index 039c18bf51d..5412914e0f6 100644 --- a/source/blender/sequencer/intern/effects.c +++ b/source/blender/sequencer/intern/effects.c @@ -354,7 +354,7 @@ static void do_alphaover_effect_float( static void do_alphaover_effect(const SeqRenderData *context, Sequence *UNUSED(seq), - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -561,7 +561,7 @@ static void do_alphaunder_effect_float( static void do_alphaunder_effect(const SeqRenderData *context, Sequence *UNUSED(seq), - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -696,7 +696,7 @@ static void do_cross_effect_float( static void do_cross_effect(const SeqRenderData *context, Sequence *UNUSED(seq), - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -994,7 +994,7 @@ static struct ImBuf *gammacross_init_execution(const SeqRenderData *context, static void do_gammacross_effect(const SeqRenderData *context, Sequence *UNUSED(seq), - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -1129,7 +1129,7 @@ static void do_add_effect_float( static void do_add_effect(const SeqRenderData *context, Sequence *UNUSED(seq), - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -1264,7 +1264,7 @@ static void do_sub_effect_float( static void do_sub_effect(const SeqRenderData *context, Sequence *UNUSED(seq), - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -1515,7 +1515,7 @@ static void do_mul_effect_float( static void do_mul_effect(const SeqRenderData *context, Sequence *UNUSED(seq), - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -1805,7 +1805,7 @@ static void do_blend_effect_byte(float facf0, static void do_blend_mode_effect(const SeqRenderData *context, Sequence *seq, - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -1846,7 +1846,7 @@ static void init_colormix_effect(Sequence *seq) static void do_colormix_effect(const SeqRenderData *context, Sequence *seq, - float UNUSED(cfra), + float UNUSED(timeline_frame), float UNUSED(facf0), float UNUSED(facf1), ImBuf *ibuf1, @@ -2311,7 +2311,7 @@ static void do_wipe_effect_float(Sequence *seq, static ImBuf *do_wipe_effect(const SeqRenderData *context, Sequence *seq, - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -2442,7 +2442,7 @@ static void transform_image(int x, static void do_transform_effect(const SeqRenderData *context, Sequence *seq, - float UNUSED(cfra), + float UNUSED(timeline_frame), float UNUSED(facf0), float UNUSED(facf1), ImBuf *ibuf1, @@ -2789,7 +2789,7 @@ static void do_glow_effect_float(Sequence *seq, static ImBuf *do_glow_effect(const SeqRenderData *context, Sequence *seq, - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -2868,7 +2868,7 @@ static int early_out_color(Sequence *UNUSED(seq), float UNUSED(facf0), float UNU static ImBuf *do_solid_color(const SeqRenderData *context, Sequence *seq, - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -2966,7 +2966,7 @@ static int early_out_multicam(Sequence *UNUSED(seq), float UNUSED(facf0), float static ImBuf *do_multicam(const SeqRenderData *context, Sequence *seq, - float cfra, + float timeline_frame, float UNUSED(facf0), float UNUSED(facf1), ImBuf *UNUSED(ibuf1), @@ -2990,7 +2990,7 @@ static ImBuf *do_multicam(const SeqRenderData *context, return NULL; } - out = seq_render_give_ibuf_seqbase(context, cfra, seq->multicam_source, seqbasep); + out = seq_render_give_ibuf_seqbase(context, timeline_frame, seq->multicam_source, seqbasep); return out; } @@ -3008,7 +3008,7 @@ static int early_out_adjustment(Sequence *UNUSED(seq), float UNUSED(facf0), floa return EARLY_NO_INPUT; } -static ImBuf *do_adjustment_impl(const SeqRenderData *context, Sequence *seq, float cfra) +static ImBuf *do_adjustment_impl(const SeqRenderData *context, Sequence *seq, float timeline_frame) { Editing *ed; ListBase *seqbasep; @@ -3019,7 +3019,7 @@ static ImBuf *do_adjustment_impl(const SeqRenderData *context, Sequence *seq, fl seqbasep = BKE_sequence_seqbase(&ed->seqbase, seq); if (seq->machine > 1) { - i = seq_render_give_ibuf_seqbase(context, cfra, seq->machine - 1, seqbasep); + i = seq_render_give_ibuf_seqbase(context, timeline_frame, seq->machine - 1, seqbasep); } /* found nothing? so let's work the way up the metastrip stack, so @@ -3033,7 +3033,7 @@ static ImBuf *do_adjustment_impl(const SeqRenderData *context, Sequence *seq, fl meta = BKE_sequence_metastrip(&ed->seqbase, NULL, seq); if (meta) { - i = do_adjustment_impl(context, meta, cfra); + i = do_adjustment_impl(context, meta, timeline_frame); } } @@ -3042,7 +3042,7 @@ static ImBuf *do_adjustment_impl(const SeqRenderData *context, Sequence *seq, fl static ImBuf *do_adjustment(const SeqRenderData *context, Sequence *seq, - float cfra, + float timeline_frame, float UNUSED(facf0), float UNUSED(facf1), ImBuf *UNUSED(ibuf1), @@ -3058,7 +3058,7 @@ static ImBuf *do_adjustment(const SeqRenderData *context, return NULL; } - out = do_adjustment_impl(context, seq, cfra); + out = do_adjustment_impl(context, seq, timeline_frame); return out; } @@ -3146,7 +3146,7 @@ static void store_icu_yrange_speed(Sequence *seq, short UNUSED(adrcode), float * void BKE_sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, bool force) { - int cfra; + int timeline_frame; float fallback_fac = 1.0f; SpeedControlVars *v = (SpeedControlVars *)seq->effectdata; FCurve *fcu = NULL; @@ -3199,9 +3199,9 @@ void BKE_sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, bool for v->frameMap[0] = 0; v->lastValidFrame = 0; - for (cfra = 1; cfra < v->length; cfra++) { + for (timeline_frame = 1; timeline_frame < v->length; timeline_frame++) { if (fcu) { - facf = evaluate_fcurve(fcu, seq->startdisp + cfra); + facf = evaluate_fcurve(fcu, seq->startdisp + timeline_frame); } else { facf = fallback_fac; @@ -3211,11 +3211,11 @@ void BKE_sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, bool for cursor += facf; if (cursor >= seq->seq1->len) { - v->frameMap[cfra] = seq->seq1->len - 1; + v->frameMap[timeline_frame] = seq->seq1->len - 1; } else { - v->frameMap[cfra] = cursor; - v->lastValidFrame = cfra; + v->frameMap[timeline_frame] = cursor; + v->lastValidFrame = timeline_frame; } } } @@ -3223,10 +3223,10 @@ void BKE_sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, bool for float facf; v->lastValidFrame = 0; - for (cfra = 0; cfra < v->length; cfra++) { + for (timeline_frame = 0; timeline_frame < v->length; timeline_frame++) { if (fcu) { - facf = evaluate_fcurve(fcu, seq->startdisp + cfra); + facf = evaluate_fcurve(fcu, seq->startdisp + timeline_frame); } else { facf = fallback_fac; @@ -3241,45 +3241,47 @@ void BKE_sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, bool for facf = seq->seq1->len - 1; } else { - v->lastValidFrame = cfra; + v->lastValidFrame = timeline_frame; } - v->frameMap[cfra] = facf; + v->frameMap[timeline_frame] = facf; } } } -/* Override cfra when rendering speed effect input. */ +/* Override timeline_frame when rendering speed effect input. */ float BKE_sequencer_speed_effect_target_frame_get(const SeqRenderData *context, Sequence *seq, - float cfra, + float timeline_frame, int input) { - int nr = seq_give_stripelem_index(seq, cfra); + int frame_index = seq_give_frame_index(seq, timeline_frame); SpeedControlVars *s = (SpeedControlVars *)seq->effectdata; BKE_sequence_effect_speed_rebuild_map(context->scene, seq, false); /* No interpolation. */ if ((s->flags & SEQ_SPEED_USE_INTERPOLATION) == 0) { - return seq->start + s->frameMap[nr]; + return seq->start + s->frameMap[frame_index]; } /* We need to provide current and next image for interpolation. */ if (input == 0) { /* Current frame. */ - return floor(seq->start + s->frameMap[nr]); + return floor(seq->start + s->frameMap[frame_index]); } /* Next frame. */ - return ceil(seq->start + s->frameMap[nr]); + return ceil(seq->start + s->frameMap[frame_index]); } -static float speed_effect_interpolation_ratio_get(SpeedControlVars *s, Sequence *seq, float cfra) +static float speed_effect_interpolation_ratio_get(SpeedControlVars *s, + Sequence *seq, + float timeline_frame) { - int nr = seq_give_stripelem_index(seq, cfra); - return s->frameMap[nr] - floor(s->frameMap[nr]); + int frame_index = seq_give_frame_index(seq, timeline_frame); + return s->frameMap[frame_index] - floor(s->frameMap[frame_index]); } static ImBuf *do_speed_effect(const SeqRenderData *context, Sequence *seq, - float cfra, + float timeline_frame, float facf0, float facf1, ImBuf *ibuf1, @@ -3292,10 +3294,10 @@ static ImBuf *do_speed_effect(const SeqRenderData *context, if (s->flags & SEQ_SPEED_USE_INTERPOLATION) { out = prepare_effect_imbufs(context, ibuf1, ibuf2, ibuf3); - facf0 = facf1 = speed_effect_interpolation_ratio_get(s, seq, cfra); + facf0 = facf1 = speed_effect_interpolation_ratio_get(s, seq, timeline_frame); /* Current frame is ibuf1, next frame is ibuf2. */ out = seq_render_effect_execute_threaded( - &cross_effect, context, NULL, cfra, facf0, facf1, ibuf1, ibuf2, ibuf3); + &cross_effect, context, NULL, timeline_frame, facf0, facf1, ibuf1, ibuf2, ibuf3); return out; } @@ -3307,7 +3309,7 @@ static ImBuf *do_speed_effect(const SeqRenderData *context, static void do_overdrop_effect(const SeqRenderData *context, Sequence *UNUSED(seq), - float UNUSED(cfra), + float UNUSED(timeline_frame), float facf0, float facf1, ImBuf *ibuf1, @@ -3731,7 +3733,7 @@ static void *render_effect_execute_do_y_thread(void *thread_data_v) static ImBuf *do_gaussian_blur_effect(const SeqRenderData *context, Sequence *seq, - float UNUSED(cfra), + float UNUSED(timeline_frame), float UNUSED(facf0), float UNUSED(facf1), ImBuf *ibuf1, @@ -3786,6 +3788,11 @@ static void init_text_effect(Sequence *seq) copy_v4_fl(data->color, 1.0f); data->shadow_color[3] = 1.0f; + data->box_color[0] = 0.5f; + data->box_color[1] = 0.5f; + data->box_color[2] = 0.5f; + data->box_color[3] = 1.0f; + data->box_margin = 0.01f; BLI_strncpy(data->text, "Text", sizeof(data->text)); @@ -3870,7 +3877,7 @@ static int early_out_text(Sequence *seq, float UNUSED(facf0), float UNUSED(facf1 static ImBuf *do_text_effect(const SeqRenderData *context, Sequence *seq, - float UNUSED(cfra), + float UNUSED(timeline_frame), float UNUSED(facf0), float UNUSED(facf1), ImBuf *ibuf1, @@ -3927,18 +3934,18 @@ static ImBuf *do_text_effect(const SeqRenderData *context, x = (data->loc[0] * width); y = (data->loc[1] * height) + y_ofs; + /* vars for calculating wordwrap and optional box */ + struct { + struct ResultBLF info; + rctf rect; + } wrap; + + BLF_boundbox_ex(font, data->text, sizeof(data->text), &wrap.rect, &wrap.info); + if ((data->align == SEQ_TEXT_ALIGN_X_LEFT) && (data->align_y == SEQ_TEXT_ALIGN_Y_TOP)) { y -= line_height; } else { - /* vars for calculating wordwrap */ - struct { - struct ResultBLF info; - rctf rect; - } wrap; - - BLF_boundbox_ex(font, data->text, sizeof(data->text), &wrap.rect, &wrap.info); - if (data->align == SEQ_TEXT_ALIGN_X_RIGHT) { x -= BLI_rctf_size_x(&wrap.rect); } @@ -3957,8 +3964,34 @@ static ImBuf *do_text_effect(const SeqRenderData *context, } } + if (data->flag & SEQ_TEXT_BOX) { + if (out->rect) { + const int margin = data->box_margin * width; + const int minx = x + wrap.rect.xmin - margin; + const int maxx = x + wrap.rect.xmax + margin; + const int miny = y + wrap.rect.ymin - margin; + const int maxy = y + wrap.rect.ymax + margin; + + if (data->flag & SEQ_TEXT_SHADOW) { + /* draw a shadow behind the box */ + int shadow_offset = 0.005f * width; + + if (shadow_offset == 0) { + shadow_offset = 1; + } + + IMB_rectfill_area_replace(out, + data->shadow_color, + minx + shadow_offset, + miny - shadow_offset, + maxx + shadow_offset, + maxy - shadow_offset); + } + IMB_rectfill_area_replace(out, data->box_color, minx, miny, maxx, maxy); + } + } /* BLF_SHADOW won't work with buffers, instead use cheap shadow trick */ - if (data->flag & SEQ_TEXT_SHADOW) { + else if (data->flag & SEQ_TEXT_SHADOW) { int fontx, fonty; fontx = BLF_width_max(font); fonty = line_height; @@ -4044,16 +4077,16 @@ static void store_icu_yrange_noop(Sequence *UNUSED(seq), } static void get_default_fac_noop(Sequence *UNUSED(seq), - float UNUSED(cfra), + float UNUSED(timeline_frame), float *facf0, float *facf1) { *facf0 = *facf1 = 1.0; } -static void get_default_fac_fade(Sequence *seq, float cfra, float *facf0, float *facf1) +static void get_default_fac_fade(Sequence *seq, float timeline_frame, float *facf0, float *facf1) { - *facf0 = (float)(cfra - seq->startdisp); + *facf0 = (float)(timeline_frame - seq->startdisp); *facf1 = (float)(*facf0 + 0.5f); *facf0 /= seq->len; *facf1 /= seq->len; @@ -4286,10 +4319,3 @@ int BKE_sequence_effect_get_num_inputs(int seq_type) } return 0; } - -int BKE_sequence_effect_get_supports_mask(int seq_type) -{ - struct SeqEffectHandle rval = get_sequence_effect_impl(seq_type); - - return rval.supports_mask; -} diff --git a/source/blender/sequencer/intern/image_cache.c b/source/blender/sequencer/intern/image_cache.c index 4bbf1838b4e..be6a640dd3f 100644 --- a/source/blender/sequencer/intern/image_cache.c +++ b/source/blender/sequencer/intern/image_cache.c @@ -740,7 +740,7 @@ static float seq_cache_timeline_frame_to_frame_index(Sequence *seq, float timeli * images or extended frame range of movies will only generate one cache entry. No special * treatment in converting frame index to timeline_frame is needed. */ if (type == SEQ_CACHE_STORE_RAW) { - return seq_give_stripelem_index(seq, timeline_frame); + return seq_give_frame_index(seq, timeline_frame); } return timeline_frame - seq->start; diff --git a/source/blender/sequencer/intern/modifier.c b/source/blender/sequencer/intern/modifier.c index cb15028cc23..ae5aae4f412 100644 --- a/source/blender/sequencer/intern/modifier.c +++ b/source/blender/sequencer/intern/modifier.c @@ -46,6 +46,8 @@ #include "SEQ_sequencer.h" +#include "BLO_read_write.h" + #include "render.h" #include "sequencer.h" @@ -84,13 +86,13 @@ typedef struct ModifierThread { } ModifierThread; /** - * \a cfra is offset by \a fra_offset only in case we are using a real mask. + * \a timeline_frame is offset by \a fra_offset only in case we are using a real mask. */ static ImBuf *modifier_render_mask_input(const SeqRenderData *context, int mask_input_type, Sequence *mask_sequence, Mask *mask_id, - int cfra, + int timeline_frame, int fra_offset, bool make_float) { @@ -101,7 +103,7 @@ static ImBuf *modifier_render_mask_input(const SeqRenderData *context, SeqRenderState state; seq_render_state_init(&state); - mask_input = seq_render_strip(context, &state, mask_sequence, cfra); + mask_input = seq_render_strip(context, &state, mask_sequence, timeline_frame); if (make_float) { if (!mask_input->rect_float) { @@ -116,7 +118,7 @@ static ImBuf *modifier_render_mask_input(const SeqRenderData *context, } } else if (mask_input_type == SEQUENCE_MASK_INPUT_ID) { - mask_input = seq_render_mask(context, mask_id, cfra - fra_offset, make_float); + mask_input = seq_render_mask(context, mask_id, timeline_frame - fra_offset, make_float); } return mask_input; @@ -124,7 +126,7 @@ static ImBuf *modifier_render_mask_input(const SeqRenderData *context, static ImBuf *modifier_mask_get(SequenceModifierData *smd, const SeqRenderData *context, - int cfra, + int timeline_frame, int fra_offset, bool make_float) { @@ -132,7 +134,7 @@ static ImBuf *modifier_mask_get(SequenceModifierData *smd, smd->mask_input_type, smd->mask_sequence, smd->mask_id, - cfra, + timeline_frame, fra_offset, make_float); } @@ -1408,7 +1410,7 @@ SequenceModifierData *BKE_sequence_modifier_find_by_name(Sequence *seq, const ch ImBuf *BKE_sequence_modifier_apply_stack(const SeqRenderData *context, Sequence *seq, ImBuf *ibuf, - int cfra) + int timeline_frame) { SequenceModifierData *smd; ImBuf *processed_ibuf = ibuf; @@ -1440,7 +1442,8 @@ ImBuf *BKE_sequence_modifier_apply_stack(const SeqRenderData *context, frame_offset = smd->mask_id ? ((Mask *)smd->mask_id)->sfra : 0; } - ImBuf *mask = modifier_mask_get(smd, context, cfra, frame_offset, ibuf->rect_float != NULL); + ImBuf *mask = modifier_mask_get( + smd, context, timeline_frame, frame_offset, ibuf->rect_float != NULL); if (processed_ibuf == ibuf) { processed_ibuf = IMB_dupImBuf(ibuf); @@ -1486,3 +1489,65 @@ int BKE_sequence_supports_modifiers(Sequence *seq) } /** \} */ + +/* -------------------------------------------------------------------- */ +/** \name .blend File I/O + * \{ */ + +void BKE_sequence_modifier_blend_write(BlendWriter *writer, ListBase *modbase) +{ + LISTBASE_FOREACH (SequenceModifierData *, smd, modbase) { + const SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(smd->type); + + if (smti) { + BLO_write_struct_by_name(writer, smti->struct_name, smd); + + if (smd->type == seqModifierType_Curves) { + CurvesModifierData *cmd = (CurvesModifierData *)smd; + + BKE_curvemapping_blend_write(writer, &cmd->curve_mapping); + } + else if (smd->type == seqModifierType_HueCorrect) { + HueCorrectModifierData *hcmd = (HueCorrectModifierData *)smd; + + BKE_curvemapping_blend_write(writer, &hcmd->curve_mapping); + } + } + else { + BLO_write_struct(writer, SequenceModifierData, smd); + } + } +} + +void BKE_sequence_modifier_blend_read_data(BlendDataReader *reader, ListBase *lb) +{ + BLO_read_list(reader, lb); + + LISTBASE_FOREACH (SequenceModifierData *, smd, lb) { + if (smd->mask_sequence) { + BLO_read_data_address(reader, &smd->mask_sequence); + } + + if (smd->type == seqModifierType_Curves) { + CurvesModifierData *cmd = (CurvesModifierData *)smd; + + BKE_curvemapping_blend_read(reader, &cmd->curve_mapping); + } + else if (smd->type == seqModifierType_HueCorrect) { + HueCorrectModifierData *hcmd = (HueCorrectModifierData *)smd; + + BKE_curvemapping_blend_read(reader, &hcmd->curve_mapping); + } + } +} + +void BKE_sequence_modifier_blend_read_lib(BlendLibReader *reader, Scene *scene, ListBase *lb) +{ + LISTBASE_FOREACH (SequenceModifierData *, smd, lb) { + if (smd->mask_id) { + BLO_read_id_address(reader, scene->id.lib, &smd->mask_id); + } + } +} + +/** \} */ diff --git a/source/blender/sequencer/intern/prefetch.c b/source/blender/sequencer/intern/prefetch.c index 6eac15dec52..694feb5e952 100644 --- a/source/blender/sequencer/intern/prefetch.c +++ b/source/blender/sequencer/intern/prefetch.c @@ -527,7 +527,7 @@ static PrefetchJob *seq_prefetch_start(const SeqRenderData *context, float cfra) } /* Start or resume prefetching*/ -void BKE_sequencer_prefetch_start(const SeqRenderData *context, float cfra, float cost) +void BKE_sequencer_prefetch_start(const SeqRenderData *context, float timeline_frame, float cost) { Scene *scene = context->scene; Editing *ed = scene->ed; @@ -547,7 +547,7 @@ void BKE_sequencer_prefetch_start(const SeqRenderData *context, float cfra, floa !(playing && cost > 0.9) && ed->cache_flag & SEQ_CACHE_ALL_TYPES && has_strips && !G.is_rendering && !G.moving) { - seq_prefetch_start(context, cfra); + seq_prefetch_start(context, timeline_frame); } } } diff --git a/source/blender/sequencer/intern/proxy.c b/source/blender/sequencer/intern/proxy.c index 94d5f5b701d..83231a00f91 100644 --- a/source/blender/sequencer/intern/proxy.c +++ b/source/blender/sequencer/intern/proxy.c @@ -132,7 +132,7 @@ bool seq_proxy_get_custom_file_fname(Sequence *seq, char *name, const int view_i static bool seq_proxy_get_fname(Editing *ed, Sequence *seq, - int cfra, + int timeline_frame, eSpaceSeq_Proxy_RenderSize render_size, char *name, const int view_id) @@ -186,7 +186,7 @@ static bool seq_proxy_get_fname(Editing *ed, "%s/images/%d/%s_proxy%s", dir, proxy_size_number, - SEQ_render_give_stripelem(seq, cfra)->name, + SEQ_render_give_stripelem(seq, timeline_frame)->name, suffix); BLI_path_abs(name, BKE_main_blendfile_path_from_global()); strcat(name, ".jpg"); @@ -203,7 +203,7 @@ bool SEQ_can_use_proxy(Sequence *seq, int psize) return (seq->flag & SEQ_USE_PROXY) != 0 && psize != IMB_PROXY_NONE && (size_flags & psize) != 0; } -ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int cfra) +ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int timeline_frame) { char name[PROXY_MAXFILE]; StripProxy *proxy = seq->strip->proxy; @@ -217,9 +217,9 @@ ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int cfra) } if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) { - int frameno = (int)seq_give_stripelem_index(seq, cfra) + seq->anim_startofs; + int frameno = (int)seq_give_frame_index(seq, timeline_frame) + seq->anim_startofs; if (proxy->anim == NULL) { - if (seq_proxy_get_fname(ed, seq, cfra, psize, name, context->view_id) == 0) { + if (seq_proxy_get_fname(ed, seq, timeline_frame, psize, name, context->view_id) == 0) { return NULL; } @@ -238,7 +238,7 @@ ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int cfra) return IMB_anim_absolute(proxy->anim, frameno, IMB_TC_NONE, IMB_PROXY_NONE); } - if (seq_proxy_get_fname(ed, seq, cfra, psize, name, context->view_id) == 0) { + if (seq_proxy_get_fname(ed, seq, timeline_frame, psize, name, context->view_id) == 0) { return NULL; } @@ -258,7 +258,7 @@ ImBuf *seq_proxy_fetch(const SeqRenderData *context, Sequence *seq, int cfra) static void seq_proxy_build_frame(const SeqRenderData *context, SeqRenderState *state, Sequence *seq, - int cfra, + int timeline_frame, int proxy_render_size, const bool overwrite) { @@ -269,7 +269,7 @@ static void seq_proxy_build_frame(const SeqRenderData *context, ImBuf *ibuf_tmp, *ibuf; Editing *ed = context->scene->ed; - if (!seq_proxy_get_fname(ed, seq, cfra, proxy_render_size, name, context->view_id)) { + if (!seq_proxy_get_fname(ed, seq, timeline_frame, proxy_render_size, name, context->view_id)) { return; } @@ -277,7 +277,7 @@ static void seq_proxy_build_frame(const SeqRenderData *context, return; } - ibuf_tmp = seq_render_strip(context, state, seq, cfra); + ibuf_tmp = seq_render_strip(context, state, seq, timeline_frame); rectx = (proxy_render_size * ibuf_tmp->x) / 100; recty = (proxy_render_size * ibuf_tmp->y) / 100; @@ -471,7 +471,7 @@ void SEQ_proxy_rebuild(SeqIndexBuildContext *context, Sequence *seq = context->seq; Scene *scene = context->scene; Main *bmain = context->bmain; - int cfra; + int timeline_frame; if (seq->type == SEQ_TYPE_MOVIE) { if (context->index_context) { @@ -508,21 +508,23 @@ void SEQ_proxy_rebuild(SeqIndexBuildContext *context, SeqRenderState state; seq_render_state_init(&state); - for (cfra = seq->startdisp + seq->startstill; cfra < seq->enddisp - seq->endstill; cfra++) { + for (timeline_frame = seq->startdisp + seq->startstill; + timeline_frame < seq->enddisp - seq->endstill; + timeline_frame++) { if (context->size_flags & IMB_PROXY_25) { - seq_proxy_build_frame(&render_context, &state, seq, cfra, 25, overwrite); + seq_proxy_build_frame(&render_context, &state, seq, timeline_frame, 25, overwrite); } if (context->size_flags & IMB_PROXY_50) { - seq_proxy_build_frame(&render_context, &state, seq, cfra, 50, overwrite); + seq_proxy_build_frame(&render_context, &state, seq, timeline_frame, 50, overwrite); } if (context->size_flags & IMB_PROXY_75) { - seq_proxy_build_frame(&render_context, &state, seq, cfra, 75, overwrite); + seq_proxy_build_frame(&render_context, &state, seq, timeline_frame, 75, overwrite); } if (context->size_flags & IMB_PROXY_100) { - seq_proxy_build_frame(&render_context, &state, seq, cfra, 100, overwrite); + seq_proxy_build_frame(&render_context, &state, seq, timeline_frame, 100, overwrite); } - *progress = (float)(cfra - seq->startdisp - seq->startstill) / + *progress = (float)(timeline_frame - seq->startdisp - seq->startstill) / (seq->enddisp - seq->endstill - seq->startdisp - seq->startstill); *do_update = true; diff --git a/source/blender/sequencer/intern/proxy.h b/source/blender/sequencer/intern/proxy.h index 3777cea9317..a2a94f036b1 100644 --- a/source/blender/sequencer/intern/proxy.h +++ b/source/blender/sequencer/intern/proxy.h @@ -32,7 +32,9 @@ struct SeqRenderData; struct Sequence; #define PROXY_MAXFILE (2 * FILE_MAXDIR + FILE_MAXFILE) -struct ImBuf *seq_proxy_fetch(const struct SeqRenderData *context, struct Sequence *seq, int cfra); +struct ImBuf *seq_proxy_fetch(const struct SeqRenderData *context, + struct Sequence *seq, + int timeline_frame); bool seq_proxy_get_custom_file_fname(struct Sequence *seq, char *name, const int view_id); #ifdef __cplusplus diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c index c2e04ebeff8..f6d80602f4c 100644 --- a/source/blender/sequencer/intern/render.c +++ b/source/blender/sequencer/intern/render.c @@ -73,7 +73,7 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, SeqRenderState *state, ListBase *seqbasep, - float cfra, + float timeline_frame, int chanshown); static ThreadMutex seq_render_mutex = BLI_MUTEX_INITIALIZER; @@ -257,9 +257,9 @@ void seq_render_state_init(SeqRenderState *state) state->scene_parents = NULL; } -float seq_give_stripelem_index(Sequence *seq, float cfra) +float seq_give_frame_index(Sequence *seq, float timeline_frame) { - float nr; + float frame_index; int sta = seq->start; int end = seq->start + seq->len - 1; @@ -273,25 +273,25 @@ float seq_give_stripelem_index(Sequence *seq, float cfra) if (seq->flag & SEQ_REVERSE_FRAMES) { /*reverse frame in this sequence */ - if (cfra <= sta) { - nr = end - sta; + if (timeline_frame <= sta) { + frame_index = end - sta; } - else if (cfra >= end) { - nr = 0; + else if (timeline_frame >= end) { + frame_index = 0; } else { - nr = end - cfra; + frame_index = end - timeline_frame; } } else { - if (cfra <= sta) { - nr = 0; + if (timeline_frame <= sta) { + frame_index = 0; } - else if (cfra >= end) { - nr = end - sta; + else if (timeline_frame >= end) { + frame_index = end - sta; } else { - nr = cfra - sta; + frame_index = timeline_frame - sta; } } @@ -300,13 +300,13 @@ float seq_give_stripelem_index(Sequence *seq, float cfra) } if (seq->strobe > 1.0f) { - nr -= fmodf((double)nr, (double)seq->strobe); + frame_index -= fmodf((double)frame_index, (double)seq->strobe); } - return nr; + return frame_index; } -StripElem *SEQ_render_give_stripelem(Sequence *seq, int cfra) +StripElem *SEQ_render_give_stripelem(Sequence *seq, int timeline_frame) { StripElem *se = seq->strip->stripdata; @@ -315,18 +315,21 @@ StripElem *SEQ_render_give_stripelem(Sequence *seq, int cfra) * all other strips don't use this... */ - int nr = (int)seq_give_stripelem_index(seq, cfra); + int frame_index = (int)seq_give_frame_index(seq, timeline_frame); - if (nr == -1 || se == NULL) { + if (frame_index == -1 || se == NULL) { return NULL; } - se += nr + seq->anim_startofs; + se += frame_index + seq->anim_startofs; } return se; } -static int evaluate_seq_frame_gen(Sequence **seq_arr, ListBase *seqbase, int cfra, int chanshown) +static int evaluate_seq_frame_gen(Sequence **seq_arr, + ListBase *seqbase, + int timeline_frame, + int chanshown) { /* Use arbitrary sized linked list, the size could be over MAXSEQ. */ LinkNodePair effect_inputs = {NULL, NULL}; @@ -335,7 +338,7 @@ static int evaluate_seq_frame_gen(Sequence **seq_arr, ListBase *seqbase, int cfr memset(seq_arr, 0, sizeof(Sequence *) * (MAXSEQ + 1)); LISTBASE_FOREACH (Sequence *, seq, seqbase) { - if ((seq->startdisp <= cfra) && (seq->enddisp > cfra)) { + if ((seq->startdisp <= timeline_frame) && (seq->enddisp > timeline_frame)) { if ((seq->type & SEQ_TYPE_EFFECT) && !(seq->flag & SEQ_MUTE)) { if (seq->seq1) { @@ -378,7 +381,7 @@ static int evaluate_seq_frame_gen(Sequence **seq_arr, ListBase *seqbase, int cfr return totseq; } -int SEQ_render_evaluate_frame(Scene *scene, int cfra) +int SEQ_render_evaluate_frame(Scene *scene, int timeline_frame) { Editing *ed = BKE_sequencer_editing_get(scene, false); Sequence *seq_arr[MAXSEQ + 1]; @@ -387,7 +390,7 @@ int SEQ_render_evaluate_frame(Scene *scene, int cfra) return 0; } - return evaluate_seq_frame_gen(seq_arr, ed->seqbasep, cfra, 0); + return evaluate_seq_frame_gen(seq_arr, ed->seqbasep, timeline_frame, 0); } static bool video_seq_is_rendered(Sequence *seq) @@ -395,7 +398,10 @@ static bool video_seq_is_rendered(Sequence *seq) return (seq && !(seq->flag & SEQ_MUTE) && seq->type != SEQ_TYPE_SOUND_RAM); } -int seq_get_shown_sequences(ListBase *seqbasep, int cfra, int chanshown, Sequence **seq_arr_out) +int seq_get_shown_sequences(ListBase *seqbasep, + int timeline_frame, + int chanshown, + Sequence **seq_arr_out) { Sequence *seq_arr[MAXSEQ + 1]; int b = chanshown; @@ -405,7 +411,7 @@ int seq_get_shown_sequences(ListBase *seqbasep, int cfra, int chanshown, Sequenc return 0; } - if (evaluate_seq_frame_gen(seq_arr, seqbasep, cfra, chanshown)) { + if (evaluate_seq_frame_gen(seq_arr, seqbasep, timeline_frame, chanshown)) { if (b == 0) { b = MAXSEQ; } @@ -500,7 +506,7 @@ static bool sequencer_use_crop(const Sequence *seq) static bool BKE_sequencer_input_have_to_preprocess(const SeqRenderData *context, Sequence *seq, - float UNUSED(cfra)) + float UNUSED(timeline_frame)) { float mul; @@ -648,9 +654,8 @@ static void multibuf(ImBuf *ibuf, const float fmul) static ImBuf *input_preprocess(const SeqRenderData *context, Sequence *seq, - float cfra, - ImBuf *ibuf, - const bool UNUSED(is_proxy_image)) + float timeline_frame, + ImBuf *ibuf) { Scene *scene = context->scene; ImBuf *preprocessed_ibuf = NULL; @@ -761,7 +766,8 @@ static ImBuf *input_preprocess(const SeqRenderData *context, } if (seq->modifiers.first) { - ImBuf *ibuf_new = BKE_sequence_modifier_apply_stack(context, seq, preprocessed_ibuf, cfra); + ImBuf *ibuf_new = BKE_sequence_modifier_apply_stack( + context, seq, preprocessed_ibuf, timeline_frame); if (ibuf_new != preprocessed_ibuf) { IMB_metadata_copy(ibuf_new, preprocessed_ibuf); @@ -776,7 +782,7 @@ static ImBuf *input_preprocess(const SeqRenderData *context, static ImBuf *seq_render_preprocess_ibuf(const SeqRenderData *context, Sequence *seq, ImBuf *ibuf, - float cfra, + float timeline_frame, clock_t begin, bool use_preprocess, const bool is_proxy_image) @@ -789,20 +795,20 @@ static ImBuf *seq_render_preprocess_ibuf(const SeqRenderData *context, if (use_preprocess) { float cost = seq_estimate_render_cost_end(context->scene, begin); - /* TODO(Richard): It should be possible to store in cache if image is proxy, - * but it adds quite a bit of complexity. Since proxies are fast to read, I would - * rather simplify existing code a bit. */ + /* Proxies are not stored in cache. */ if (!is_proxy_image) { - BKE_sequencer_cache_put(context, seq, cfra, SEQ_CACHE_STORE_RAW, ibuf, cost, false); + BKE_sequencer_cache_put( + context, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibuf, cost, false); } /* Reset timer so we can get partial render time. */ begin = seq_estimate_render_cost_begin(); - ibuf = input_preprocess(context, seq, cfra, ibuf, is_proxy_image); + ibuf = input_preprocess(context, seq, timeline_frame, ibuf); } float cost = seq_estimate_render_cost_end(context->scene, begin); - BKE_sequencer_cache_put(context, seq, cfra, SEQ_CACHE_STORE_PREPROCESSED, ibuf, cost, false); + BKE_sequencer_cache_put( + context, seq, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED, ibuf, cost, false); return ibuf; } @@ -810,7 +816,7 @@ typedef struct RenderEffectInitData { struct SeqEffectHandle *sh; const SeqRenderData *context; Sequence *seq; - float cfra, facf0, facf1; + float timeline_frame, facf0, facf1; ImBuf *ibuf1, *ibuf2, *ibuf3; ImBuf *out; @@ -820,7 +826,7 @@ typedef struct RenderEffectThread { struct SeqEffectHandle *sh; const SeqRenderData *context; Sequence *seq; - float cfra, facf0, facf1; + float timeline_frame, facf0, facf1; ImBuf *ibuf1, *ibuf2, *ibuf3; ImBuf *out; @@ -838,7 +844,7 @@ static void render_effect_execute_init_handle(void *handle_v, handle->sh = init_data->sh; handle->context = init_data->context; handle->seq = init_data->seq; - handle->cfra = init_data->cfra; + handle->timeline_frame = init_data->timeline_frame; handle->facf0 = init_data->facf0; handle->facf1 = init_data->facf1; handle->ibuf1 = init_data->ibuf1; @@ -856,7 +862,7 @@ static void *render_effect_execute_do_thread(void *thread_data_v) thread_data->sh->execute_slice(thread_data->context, thread_data->seq, - thread_data->cfra, + thread_data->timeline_frame, thread_data->facf0, thread_data->facf1, thread_data->ibuf1, @@ -872,7 +878,7 @@ static void *render_effect_execute_do_thread(void *thread_data_v) ImBuf *seq_render_effect_execute_threaded(struct SeqEffectHandle *sh, const SeqRenderData *context, Sequence *seq, - float cfra, + float timeline_frame, float facf0, float facf1, ImBuf *ibuf1, @@ -885,7 +891,7 @@ ImBuf *seq_render_effect_execute_threaded(struct SeqEffectHandle *sh, init_data.sh = sh; init_data.context = context; init_data.seq = seq; - init_data.cfra = cfra; + init_data.timeline_frame = timeline_frame; init_data.facf0 = facf0; init_data.facf1 = facf1; init_data.ibuf1 = ibuf1; @@ -905,7 +911,7 @@ ImBuf *seq_render_effect_execute_threaded(struct SeqEffectHandle *sh, static ImBuf *seq_render_effect_strip_impl(const SeqRenderData *context, SeqRenderState *state, Sequence *seq, - float cfra) + float timeline_frame) { Scene *scene = context->scene; float fac, facf; @@ -930,13 +936,13 @@ static ImBuf *seq_render_effect_strip_impl(const SeqRenderData *context, } if (seq->flag & SEQ_USE_EFFECT_DEFAULT_FADE) { - sh.get_default_fac(seq, cfra, &fac, &facf); + sh.get_default_fac(seq, timeline_frame, &fac, &facf); facf = fac; } else { fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "effect_fader", 0, NULL); if (fcu) { - fac = facf = evaluate_fcurve(fcu, cfra); + fac = facf = evaluate_fcurve(fcu, timeline_frame); } else { fac = facf = seq->effect_fader; @@ -947,18 +953,19 @@ static ImBuf *seq_render_effect_strip_impl(const SeqRenderData *context, switch (early_out) { case EARLY_NO_INPUT: - out = sh.execute(context, seq, cfra, fac, facf, NULL, NULL, NULL); + out = sh.execute(context, seq, timeline_frame, fac, facf, NULL, NULL, NULL); break; case EARLY_DO_EFFECT: for (i = 0; i < 3; i++) { - /* Speed effect requires time remapping of `cfra` for input(s). */ + /* Speed effect requires time remapping of `timeline_frame` for input(s). */ if (input[0] && seq->type == SEQ_TYPE_SPEED) { - float target_frame = BKE_sequencer_speed_effect_target_frame_get(context, seq, cfra, i); + float target_frame = BKE_sequencer_speed_effect_target_frame_get( + context, seq, timeline_frame, i); ibuf[i] = seq_render_strip(context, state, input[0], target_frame); } else { /* Other effects. */ if (input[i]) { - ibuf[i] = seq_render_strip(context, state, input[i], cfra); + ibuf[i] = seq_render_strip(context, state, input[i], timeline_frame); } } } @@ -966,21 +973,21 @@ static ImBuf *seq_render_effect_strip_impl(const SeqRenderData *context, if (ibuf[0] && (ibuf[1] || BKE_sequence_effect_get_num_inputs(seq->type) == 1)) { if (sh.multithreaded) { out = seq_render_effect_execute_threaded( - &sh, context, seq, cfra, fac, facf, ibuf[0], ibuf[1], ibuf[2]); + &sh, context, seq, timeline_frame, fac, facf, ibuf[0], ibuf[1], ibuf[2]); } else { - out = sh.execute(context, seq, cfra, fac, facf, ibuf[0], ibuf[1], ibuf[2]); + out = sh.execute(context, seq, timeline_frame, fac, facf, ibuf[0], ibuf[1], ibuf[2]); } } break; case EARLY_USE_INPUT_1: if (input[0]) { - out = seq_render_strip(context, state, input[0], cfra); + out = seq_render_strip(context, state, input[0], timeline_frame); } break; case EARLY_USE_INPUT_2: if (input[1]) { - out = seq_render_strip(context, state, input[1], cfra); + out = seq_render_strip(context, state, input[1], timeline_frame); } break; } @@ -1061,8 +1068,8 @@ static bool seq_image_strip_is_multiview_render( static ImBuf *seq_render_image_strip(const SeqRenderData *context, Sequence *seq, - float UNUSED(nr), - float cfra, + float UNUSED(frame_index), + float timeline_frame, bool *r_is_proxy_image) { char name[FILE_MAX]; @@ -1070,7 +1077,7 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, char prefix[FILE_MAX]; ImBuf *ibuf = NULL; - StripElem *s_elem = SEQ_render_give_stripelem(seq, cfra); + StripElem *s_elem = SEQ_render_give_stripelem(seq, timeline_frame); if (s_elem == NULL) { return NULL; } @@ -1079,7 +1086,7 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, BLI_path_abs(name, BKE_main_blendfile_path_from_global()); /* Try to get a proxy image. */ - ibuf = seq_proxy_fetch(context, seq, cfra); + ibuf = seq_proxy_fetch(context, seq, timeline_frame); if (ibuf != NULL) { s_elem->orig_width = ibuf->x; s_elem->orig_height = ibuf->y; @@ -1114,7 +1121,7 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, if (view_id != context->view_id) { ibufs_arr[view_id] = seq_render_preprocess_ibuf( - &localcontext, seq, ibufs_arr[view_id], cfra, clock(), true, false); + &localcontext, seq, ibufs_arr[view_id], timeline_frame, clock(), true, false); } } @@ -1146,7 +1153,7 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, static ImBuf *seq_render_movie_strip_custom_file_proxy(const SeqRenderData *context, Sequence *seq, - int cfra) + int timeline_frame) { char name[PROXY_MAXFILE]; StripProxy *proxy = seq->strip->proxy; @@ -1160,7 +1167,7 @@ static ImBuf *seq_render_movie_strip_custom_file_proxy(const SeqRenderData *cont } } - int frameno = (int)seq_give_stripelem_index(seq, cfra) + seq->anim_startofs; + int frameno = (int)seq_give_frame_index(seq, timeline_frame) + seq->anim_startofs; return IMB_anim_absolute(proxy->anim, frameno, IMB_TC_NONE, IMB_PROXY_NONE); } @@ -1169,8 +1176,8 @@ static ImBuf *seq_render_movie_strip_custom_file_proxy(const SeqRenderData *cont */ static ImBuf *seq_render_movie_strip_view(const SeqRenderData *context, Sequence *seq, - float nr, - float cfra, + float frame_index, + float timeline_frame, StripAnim *sanim, bool *r_is_proxy_image) { @@ -1184,11 +1191,11 @@ static ImBuf *seq_render_movie_strip_view(const SeqRenderData *context, * Movie proxies are handled by ImBuf module with exception of `custom file` setting. */ if (context->scene->ed->proxy_storage != SEQ_EDIT_PROXY_DIR_STORAGE && seq->strip->proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) { - ibuf = seq_render_movie_strip_custom_file_proxy(context, seq, cfra); + ibuf = seq_render_movie_strip_custom_file_proxy(context, seq, timeline_frame); } else { ibuf = IMB_anim_absolute(sanim->anim, - nr + seq->anim_startofs, + frame_index + seq->anim_startofs, seq->strip->proxy ? seq->strip->proxy->tc : IMB_TC_RECORD_RUN, psize); } @@ -1201,7 +1208,7 @@ static ImBuf *seq_render_movie_strip_view(const SeqRenderData *context, /* Fetching for requested proxy size failed, try fetching the original instead. */ if (ibuf == NULL) { ibuf = IMB_anim_absolute(sanim->anim, - nr + seq->anim_startofs, + frame_index + seq->anim_startofs, seq->strip->proxy ? seq->strip->proxy->tc : IMB_TC_RECORD_RUN, IMB_PROXY_NONE); } @@ -1219,8 +1226,11 @@ static ImBuf *seq_render_movie_strip_view(const SeqRenderData *context, return ibuf; } -static ImBuf *seq_render_movie_strip( - const SeqRenderData *context, Sequence *seq, float nr, float cfra, bool *r_is_proxy_image) +static ImBuf *seq_render_movie_strip(const SeqRenderData *context, + Sequence *seq, + float frame_index, + float timeline_frame, + bool *r_is_proxy_image) { /* Load all the videos. */ seq_open_anim_file(context->scene, seq, false); @@ -1241,7 +1251,7 @@ static ImBuf *seq_render_movie_strip( for (ibuf_view_id = 0, sanim = seq->anims.first; sanim; sanim = sanim->next, ibuf_view_id++) { if (sanim->anim) { ibuf_arr[ibuf_view_id] = seq_render_movie_strip_view( - context, seq, nr, cfra, sanim, r_is_proxy_image); + context, seq, frame_index, timeline_frame, sanim, r_is_proxy_image); } } @@ -1261,7 +1271,7 @@ static ImBuf *seq_render_movie_strip( if (view_id != context->view_id) { ibuf_arr[view_id] = seq_render_preprocess_ibuf( - &localcontext, seq, ibuf_arr[view_id], cfra, clock(), true, false); + &localcontext, seq, ibuf_arr[view_id], timeline_frame, clock(), true, false); } } @@ -1278,7 +1288,8 @@ static ImBuf *seq_render_movie_strip( MEM_freeN(ibuf_arr); } else { - ibuf = seq_render_movie_strip_view(context, seq, nr, cfra, sanim, r_is_proxy_image); + ibuf = seq_render_movie_strip_view( + context, seq, frame_index, timeline_frame, sanim, r_is_proxy_image); } if (ibuf == NULL) { @@ -1306,7 +1317,7 @@ static ImBuf *seq_get_movieclip_ibuf(Sequence *seq, MovieClipUser user) static ImBuf *seq_render_movieclip_strip(const SeqRenderData *context, Sequence *seq, - float nr, + float frame_index, bool *r_is_proxy_image) { ImBuf *ibuf = NULL; @@ -1319,7 +1330,7 @@ static ImBuf *seq_render_movieclip_strip(const SeqRenderData *context, memset(&user, 0, sizeof(MovieClipUser)); - BKE_movieclip_user_set_frame(&user, nr + seq->anim_startofs + seq->clip->start_frame); + BKE_movieclip_user_set_frame(&user, frame_index + seq->anim_startofs + seq->clip->start_frame); user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL; switch (psize) { @@ -1360,7 +1371,10 @@ static ImBuf *seq_render_movieclip_strip(const SeqRenderData *context, return ibuf; } -ImBuf *seq_render_mask(const SeqRenderData *context, Mask *mask, float nr, bool make_float) +ImBuf *seq_render_mask(const SeqRenderData *context, + Mask *mask, + float frame_index, + bool make_float) { /* TODO - add option to rasterize to alpha imbuf? */ ImBuf *ibuf = NULL; @@ -1378,12 +1392,12 @@ ImBuf *seq_render_mask(const SeqRenderData *context, Mask *mask, float nr, bool mask_temp = (Mask *)BKE_id_copy_ex( NULL, &mask->id, NULL, LIB_ID_COPY_LOCALIZE | LIB_ID_COPY_NO_ANIMDATA); - BKE_mask_evaluate(mask_temp, mask->sfra + nr, true); + BKE_mask_evaluate(mask_temp, mask->sfra + frame_index, true); /* anim-data */ adt = BKE_animdata_from_id(&mask->id); const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct( - context->depsgraph, mask->sfra + nr); + context->depsgraph, mask->sfra + frame_index); BKE_animsys_evaluate_animdata(&mask_temp->id, adt, &anim_eval_context, ADT_RECALC_ANIM, false); maskbuf = MEM_mallocN(sizeof(float) * context->rectx * context->recty, __func__); @@ -1441,17 +1455,17 @@ ImBuf *seq_render_mask(const SeqRenderData *context, Mask *mask, float nr, bool return ibuf; } -static ImBuf *seq_render_mask_strip(const SeqRenderData *context, Sequence *seq, float nr) +static ImBuf *seq_render_mask_strip(const SeqRenderData *context, Sequence *seq, float frame_index) { bool make_float = (seq->flag & SEQ_MAKE_FLOAT) != 0; - return seq_render_mask(context, seq->mask, nr, make_float); + return seq_render_mask(context, seq->mask, frame_index, make_float); } static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq, - float nr, - float cfra) + float frame_index, + float timeline_frame) { ImBuf *ibuf = NULL; double frame; @@ -1459,7 +1473,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, struct { int scemode; - int cfra; + int timeline_frame; float subframe; #ifdef DURIAN_CAMERA_SWITCH @@ -1519,7 +1533,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, } scene = seq->scene; - frame = (double)scene->r.sfra + (double)nr + (double)seq->anim_startofs; + frame = (double)scene->r.sfra + (double)frame_index + (double)seq->anim_startofs; #if 0 /* UNUSED */ have_seq = (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first); @@ -1532,7 +1546,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Depsgraph *depsgraph = NULL; orig_data.scemode = scene->r.scemode; - orig_data.cfra = scene->r.cfra; + orig_data.timeline_frame = scene->r.cfra; orig_data.subframe = scene->r.subframe; #ifdef DURIAN_CAMERA_SWITCH orig_data.mode = scene->r.mode; @@ -1564,7 +1578,8 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, scene->r.mode |= R_NO_CAMERA_SWITCH; #endif - is_frame_update = (orig_data.cfra != scene->r.cfra) || (orig_data.subframe != scene->r.subframe); + is_frame_update = (orig_data.timeline_frame != scene->r.cfra) || + (orig_data.subframe != scene->r.subframe); if ((sequencer_view3d_fn && do_seq_gl && camera) && is_thread_main) { char err_out[256] = "unknown"; @@ -1663,7 +1678,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, if (view_id != context->view_id) { BKE_sequencer_cache_put( - &localcontext, seq, cfra, SEQ_CACHE_STORE_RAW, ibufs_arr[view_id], 0, false); + &localcontext, seq, timeline_frame, SEQ_CACHE_STORE_RAW, ibufs_arr[view_id], 0, false); } RE_ReleaseResultImage(re); @@ -1684,7 +1699,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, finally: /* restore */ scene->r.scemode = orig_data.scemode; - scene->r.cfra = orig_data.cfra; + scene->r.cfra = orig_data.timeline_frame; scene->r.subframe = orig_data.subframe; if (is_frame_update && (depsgraph != NULL)) { @@ -1705,7 +1720,7 @@ finally: static ImBuf *do_render_strip_seqbase(const SeqRenderData *context, SeqRenderState *state, Sequence *seq, - float nr) + float frame_index) { ImBuf *ibuf = NULL; ListBase *seqbase = NULL; @@ -1716,14 +1731,14 @@ static ImBuf *do_render_strip_seqbase(const SeqRenderData *context, if (seqbase && !BLI_listbase_is_empty(seqbase)) { if (seq->flag & SEQ_SCENE_STRIPS && seq->scene) { - BKE_animsys_evaluate_all_animation(context->bmain, context->depsgraph, nr + offset); + BKE_animsys_evaluate_all_animation(context->bmain, context->depsgraph, frame_index + offset); } ibuf = seq_render_strip_stack(context, state, seqbase, /* scene strips don't have their start taken into account */ - nr + offset, + frame_index + offset, 0); } @@ -1737,15 +1752,15 @@ static ImBuf *do_render_strip_seqbase(const SeqRenderData *context, static ImBuf *do_render_strip_uncached(const SeqRenderData *context, SeqRenderState *state, Sequence *seq, - float cfra, + float timeline_frame, bool *r_is_proxy_image) { ImBuf *ibuf = NULL; - float nr = seq_give_stripelem_index(seq, cfra); + float frame_index = seq_give_frame_index(seq, timeline_frame); int type = (seq->type & SEQ_TYPE_EFFECT) ? SEQ_TYPE_EFFECT : seq->type; switch (type) { case SEQ_TYPE_META: { - ibuf = do_render_strip_seqbase(context, state, seq, nr); + ibuf = do_render_strip_seqbase(context, state, seq, frame_index); break; } @@ -1770,7 +1785,7 @@ static ImBuf *do_render_strip_uncached(const SeqRenderData *context, local_context.scene = seq->scene; local_context.skip_cache = true; - ibuf = do_render_strip_seqbase(&local_context, state, seq, nr); + ibuf = do_render_strip_seqbase(&local_context, state, seq, frame_index); /* step back in the list */ state->scene_parents = state->scene_parents->next; @@ -1778,29 +1793,29 @@ static ImBuf *do_render_strip_uncached(const SeqRenderData *context, } else { /* scene can be NULL after deletions */ - ibuf = seq_render_scene_strip(context, seq, nr, cfra); + ibuf = seq_render_scene_strip(context, seq, frame_index, timeline_frame); } break; } case SEQ_TYPE_EFFECT: { - ibuf = seq_render_effect_strip_impl(context, state, seq, cfra); + ibuf = seq_render_effect_strip_impl(context, state, seq, timeline_frame); break; } case SEQ_TYPE_IMAGE: { - ibuf = seq_render_image_strip(context, seq, nr, cfra, r_is_proxy_image); + ibuf = seq_render_image_strip(context, seq, frame_index, timeline_frame, r_is_proxy_image); break; } case SEQ_TYPE_MOVIE: { - ibuf = seq_render_movie_strip(context, seq, nr, cfra, r_is_proxy_image); + ibuf = seq_render_movie_strip(context, seq, frame_index, timeline_frame, r_is_proxy_image); break; } case SEQ_TYPE_MOVIECLIP: { - ibuf = seq_render_movieclip_strip(context, seq, nr, r_is_proxy_image); + ibuf = seq_render_movieclip_strip(context, seq, frame_index, r_is_proxy_image); if (ibuf) { /* duplicate frame so movie cache wouldn't be confused by sequencer's stuff */ @@ -1818,7 +1833,7 @@ static ImBuf *do_render_strip_uncached(const SeqRenderData *context, case SEQ_TYPE_MASK: { /* ibuf is always new */ - ibuf = seq_render_mask_strip(context, seq, nr); + ibuf = seq_render_mask_strip(context, seq, frame_index); break; } } @@ -1833,7 +1848,7 @@ static ImBuf *do_render_strip_uncached(const SeqRenderData *context, ImBuf *seq_render_strip(const SeqRenderData *context, SeqRenderState *state, Sequence *seq, - float cfra) + float timeline_frame) { ImBuf *ibuf = NULL; bool use_preprocess = false; @@ -1841,20 +1856,25 @@ ImBuf *seq_render_strip(const SeqRenderData *context, clock_t begin = seq_estimate_render_cost_begin(); - ibuf = BKE_sequencer_cache_get(context, seq, cfra, SEQ_CACHE_STORE_PREPROCESSED, false); + ibuf = BKE_sequencer_cache_get( + context, seq, timeline_frame, SEQ_CACHE_STORE_PREPROCESSED, false); if (ibuf != NULL) { return ibuf; } - ibuf = BKE_sequencer_cache_get(context, seq, cfra, SEQ_CACHE_STORE_RAW, false); + /* Proxies are not stored in cache. */ + if (!SEQ_can_use_proxy(seq, SEQ_rendersize_to_proxysize(context->preview_render_size))) { + ibuf = BKE_sequencer_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_RAW, false); + } + if (ibuf == NULL) { - ibuf = do_render_strip_uncached(context, state, seq, cfra, &is_proxy_image); + ibuf = do_render_strip_uncached(context, state, seq, timeline_frame, &is_proxy_image); } if (ibuf) { - use_preprocess = BKE_sequencer_input_have_to_preprocess(context, seq, cfra); + use_preprocess = BKE_sequencer_input_have_to_preprocess(context, seq, timeline_frame); ibuf = seq_render_preprocess_ibuf( - context, seq, ibuf, cfra, begin, use_preprocess, is_proxy_image); + context, seq, ibuf, timeline_frame, begin, use_preprocess, is_proxy_image); } if (ibuf == NULL) { @@ -1901,7 +1921,7 @@ static int seq_get_early_out_for_blend_mode(Sequence *seq) } static ImBuf *seq_render_strip_stack_apply_effect( - const SeqRenderData *context, Sequence *seq, float cfra, ImBuf *ibuf1, ImBuf *ibuf2) + const SeqRenderData *context, Sequence *seq, float timeline_frame, ImBuf *ibuf1, ImBuf *ibuf2) { ImBuf *out; struct SeqEffectHandle sh = BKE_sequence_get_blend(seq); @@ -1911,19 +1931,19 @@ static ImBuf *seq_render_strip_stack_apply_effect( if (swap_input) { if (sh.multithreaded) { out = seq_render_effect_execute_threaded( - &sh, context, seq, cfra, facf, facf, ibuf2, ibuf1, NULL); + &sh, context, seq, timeline_frame, facf, facf, ibuf2, ibuf1, NULL); } else { - out = sh.execute(context, seq, cfra, facf, facf, ibuf2, ibuf1, NULL); + out = sh.execute(context, seq, timeline_frame, facf, facf, ibuf2, ibuf1, NULL); } } else { if (sh.multithreaded) { out = seq_render_effect_execute_threaded( - &sh, context, seq, cfra, facf, facf, ibuf1, ibuf2, NULL); + &sh, context, seq, timeline_frame, facf, facf, ibuf1, ibuf2, NULL); } else { - out = sh.execute(context, seq, cfra, facf, facf, ibuf1, ibuf2, NULL); + out = sh.execute(context, seq, timeline_frame, facf, facf, ibuf1, ibuf2, NULL); } } @@ -1933,7 +1953,7 @@ static ImBuf *seq_render_strip_stack_apply_effect( static ImBuf *seq_render_strip_stack(const SeqRenderData *context, SeqRenderState *state, ListBase *seqbasep, - float cfra, + float timeline_frame, int chanshown) { Sequence *seq_arr[MAXSEQ + 1]; @@ -1942,7 +1962,7 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, ImBuf *out = NULL; clock_t begin; - count = seq_get_shown_sequences(seqbasep, cfra, chanshown, (Sequence **)&seq_arr); + count = seq_get_shown_sequences(seqbasep, timeline_frame, chanshown, (Sequence **)&seq_arr); if (count == 0) { return NULL; @@ -1952,13 +1972,13 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, int early_out; Sequence *seq = seq_arr[i]; - out = BKE_sequencer_cache_get(context, seq, cfra, SEQ_CACHE_STORE_COMPOSITE, false); + out = BKE_sequencer_cache_get(context, seq, timeline_frame, SEQ_CACHE_STORE_COMPOSITE, false); if (out) { break; } if (seq->blend_mode == SEQ_BLEND_REPLACE) { - out = seq_render_strip(context, state, seq, cfra); + out = seq_render_strip(context, state, seq, timeline_frame); break; } @@ -1967,7 +1987,7 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, switch (early_out) { case EARLY_NO_INPUT: case EARLY_USE_INPUT_2: - out = seq_render_strip(context, state, seq, cfra); + out = seq_render_strip(context, state, seq, timeline_frame); break; case EARLY_USE_INPUT_1: if (i == 0) { @@ -1979,13 +1999,13 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, begin = seq_estimate_render_cost_begin(); ImBuf *ibuf1 = IMB_allocImBuf(context->rectx, context->recty, 32, IB_rect); - ImBuf *ibuf2 = seq_render_strip(context, state, seq, cfra); + ImBuf *ibuf2 = seq_render_strip(context, state, seq, timeline_frame); - out = seq_render_strip_stack_apply_effect(context, seq, cfra, ibuf1, ibuf2); + out = seq_render_strip_stack_apply_effect(context, seq, timeline_frame, ibuf1, ibuf2); float cost = seq_estimate_render_cost_end(context->scene, begin); BKE_sequencer_cache_put( - context, seq_arr[i], cfra, SEQ_CACHE_STORE_COMPOSITE, out, cost, false); + context, seq_arr[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out, cost, false); IMB_freeImBuf(ibuf1); IMB_freeImBuf(ibuf2); @@ -2004,9 +2024,9 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, if (seq_get_early_out_for_blend_mode(seq) == EARLY_DO_EFFECT) { ImBuf *ibuf1 = out; - ImBuf *ibuf2 = seq_render_strip(context, state, seq, cfra); + ImBuf *ibuf2 = seq_render_strip(context, state, seq, timeline_frame); - out = seq_render_strip_stack_apply_effect(context, seq, cfra, ibuf1, ibuf2); + out = seq_render_strip_stack_apply_effect(context, seq, timeline_frame, ibuf1, ibuf2); IMB_freeImBuf(ibuf1); IMB_freeImBuf(ibuf2); @@ -2014,7 +2034,7 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, float cost = seq_estimate_render_cost_end(context->scene, begin); BKE_sequencer_cache_put( - context, seq_arr[i], cfra, SEQ_CACHE_STORE_COMPOSITE, out, cost, false); + context, seq_arr[i], timeline_frame, SEQ_CACHE_STORE_COMPOSITE, out, cost, false); } return out; @@ -2025,7 +2045,7 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context, * you have to free after usage! */ -ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float cfra, int chanshown) +ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float timeline_frame, int chanshown) { Scene *scene = context->scene; Editing *ed = BKE_sequencer_editing_get(scene, false); @@ -2050,56 +2070,68 @@ ImBuf *SEQ_render_give_ibuf(const SeqRenderData *context, float cfra, int chansh Sequence *seq_arr[MAXSEQ + 1]; int count; - count = seq_get_shown_sequences(seqbasep, cfra, chanshown, seq_arr); + count = seq_get_shown_sequences(seqbasep, timeline_frame, chanshown, seq_arr); if (count) { out = BKE_sequencer_cache_get( - context, seq_arr[count - 1], cfra, SEQ_CACHE_STORE_FINAL_OUT, false); + context, seq_arr[count - 1], timeline_frame, SEQ_CACHE_STORE_FINAL_OUT, false); } - BKE_sequencer_cache_free_temp_cache(context->scene, context->task_id, cfra); + BKE_sequencer_cache_free_temp_cache(context->scene, context->task_id, timeline_frame); clock_t begin = seq_estimate_render_cost_begin(); float cost = 0; if (count && !out) { BLI_mutex_lock(&seq_render_mutex); - out = seq_render_strip_stack(context, &state, seqbasep, cfra, chanshown); + out = seq_render_strip_stack(context, &state, seqbasep, timeline_frame, chanshown); cost = seq_estimate_render_cost_end(context->scene, begin); if (context->is_prefetch_render) { - BKE_sequencer_cache_put( - context, seq_arr[count - 1], cfra, SEQ_CACHE_STORE_FINAL_OUT, out, cost, false); + BKE_sequencer_cache_put(context, + seq_arr[count - 1], + timeline_frame, + SEQ_CACHE_STORE_FINAL_OUT, + out, + cost, + false); } else { - BKE_sequencer_cache_put_if_possible( - context, seq_arr[count - 1], cfra, SEQ_CACHE_STORE_FINAL_OUT, out, cost, false); + BKE_sequencer_cache_put_if_possible(context, + seq_arr[count - 1], + timeline_frame, + SEQ_CACHE_STORE_FINAL_OUT, + out, + cost, + false); } BLI_mutex_unlock(&seq_render_mutex); } - BKE_sequencer_prefetch_start(context, cfra, cost); + BKE_sequencer_prefetch_start(context, timeline_frame, cost); return out; } ImBuf *seq_render_give_ibuf_seqbase(const SeqRenderData *context, - float cfra, + float timeline_frame, int chan_shown, ListBase *seqbasep) { SeqRenderState state; seq_render_state_init(&state); - return seq_render_strip_stack(context, &state, seqbasep, cfra, chan_shown); + return seq_render_strip_stack(context, &state, seqbasep, timeline_frame, chan_shown); } -ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData *context, float cfra, Sequence *seq) +ImBuf *SEQ_render_give_ibuf_direct(const SeqRenderData *context, + float timeline_frame, + Sequence *seq) { SeqRenderState state; seq_render_state_init(&state); - ImBuf *ibuf = seq_render_strip(context, &state, seq, cfra); + ImBuf *ibuf = seq_render_strip(context, &state, seq, timeline_frame); return ibuf; } diff --git a/source/blender/sequencer/intern/render.h b/source/blender/sequencer/intern/render.h index 83214934e05..2d0365d74e9 100644 --- a/source/blender/sequencer/intern/render.h +++ b/source/blender/sequencer/intern/render.h @@ -42,31 +42,31 @@ typedef struct SeqRenderState { void seq_render_state_init(SeqRenderState *state); struct ImBuf *seq_render_give_ibuf_seqbase(const struct SeqRenderData *context, - float cfra, + float timeline_frame, int chan_shown, struct ListBase *seqbasep); struct ImBuf *seq_render_effect_execute_threaded(struct SeqEffectHandle *sh, const SeqRenderData *context, struct Sequence *seq, - float cfra, + float timeline_frame, float facf0, float facf1, struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3); void seq_imbuf_to_sequencer_space(struct Scene *scene, struct ImBuf *ibuf, bool make_float); -float seq_give_stripelem_index(struct Sequence *seq, float cfra); +float seq_give_frame_index(struct Sequence *seq, float timeline_frame); int seq_get_shown_sequences(struct ListBase *seqbasep, - int cfra, + int timeline_frame, int chanshown, struct Sequence **seq_arr_out); struct ImBuf *seq_render_strip(const struct SeqRenderData *context, struct SeqRenderState *state, struct Sequence *seq, - float cfra); + float timeline_frame); struct ImBuf *seq_render_mask(const struct SeqRenderData *context, struct Mask *mask, - float nr, + float frame_index, bool make_float); void seq_imbuf_assign_spaces(struct Scene *scene, struct ImBuf *ibuf); diff --git a/source/blender/sequencer/intern/sequencer.c b/source/blender/sequencer/intern/sequencer.c index 89709c54942..67b3b9f5fbd 100644 --- a/source/blender/sequencer/intern/sequencer.c +++ b/source/blender/sequencer/intern/sequencer.c @@ -111,30 +111,6 @@ static void seq_anim_add_suffix(Scene *scene, struct anim *anim, const int view_ ListBase seqbase_clipboard; int seqbase_clipboard_frame; -#if 0 /* unused function */ -static void printf_strip(Sequence *seq) -{ - fprintf(stderr, - "name: '%s', len:%d, start:%d, (startofs:%d, endofs:%d), " - "(startstill:%d, endstill:%d), machine:%d, (startdisp:%d, enddisp:%d)\n", - seq->name, - seq->len, - seq->start, - seq->startofs, - seq->endofs, - seq->startstill, - seq->endstill, - seq->machine, - seq->startdisp, - seq->enddisp); - - fprintf(stderr, - "\tseq_tx_set_final_left: %d %d\n\n", - seq_tx_get_final_left(seq, 0), - seq_tx_get_final_right(seq, 0)); -} -#endif - int BKE_sequencer_base_recursive_apply(ListBase *seqbase, int (*apply_fn)(Sequence *seq, void *), void *arg) @@ -1040,27 +1016,6 @@ int BKE_sequencer_cmp_time_startdisp(const void *a, const void *b) return (seq_a->startdisp > seq_b->startdisp); } -static int clear_scene_in_allseqs_fn(Sequence *seq, void *arg_pt) -{ - if (seq->scene == (Scene *)arg_pt) { - seq->scene = NULL; - } - return 1; -} - -void BKE_sequencer_clear_scene_in_allseqs(Main *bmain, Scene *scene) -{ - Scene *scene_iter; - - /* when a scene is deleted: test all seqs */ - for (scene_iter = bmain->scenes.first; scene_iter; scene_iter = scene_iter->id.next) { - if (scene_iter != scene && scene_iter->ed) { - BKE_sequencer_base_recursive_apply( - &scene_iter->ed->seqbase, clear_scene_in_allseqs_fn, scene); - } - } -} - typedef struct SeqUniqueInfo { Sequence *seq; char name_src[SEQ_NAME_MAXSTR]; @@ -1376,7 +1331,7 @@ void seq_open_anim_file(Scene *scene, Sequence *seq, bool openfile) } /* check whether sequence cur depends on seq */ -bool BKE_sequence_check_depend(Sequence *seq, Sequence *cur) +static bool BKE_sequence_check_depend(Sequence *seq, Sequence *cur) { if (cur->seq1 == seq || cur->seq2 == seq || cur->seq3 == seq) { return true; @@ -2562,7 +2517,7 @@ static Strip *seq_strip_alloc(int type) return strip; } -Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine, int type) +Sequence *BKE_sequence_alloc(ListBase *lb, int timeline_frame, int machine, int type) { Sequence *seq; @@ -2573,7 +2528,7 @@ Sequence *BKE_sequence_alloc(ListBase *lb, int cfra, int machine, int type) seq->name[2] = 0; seq->flag = SELECT; - seq->start = cfra; + seq->start = timeline_frame; seq->machine = machine; seq->sat = 1.0; seq->mul = 1.0; @@ -3109,7 +3064,7 @@ bool BKE_sequence_is_valid_check(Sequence *seq) } int BKE_sequencer_find_next_prev_edit(Scene *scene, - int cfra, + int timeline_frame, const short side, const bool do_skip_mute, const bool do_center, @@ -3118,7 +3073,7 @@ int BKE_sequencer_find_next_prev_edit(Scene *scene, Editing *ed = BKE_sequencer_editing_get(scene, false); Sequence *seq; - int dist, best_dist, best_frame = cfra; + int dist, best_dist, best_frame = timeline_frame; int seq_frames[2], seq_frames_tot; /* In case where both is passed, @@ -3127,7 +3082,7 @@ int BKE_sequencer_find_next_prev_edit(Scene *scene, best_dist = MAXFRAME * 2; if (ed == NULL) { - return cfra; + return timeline_frame; } for (seq = ed->seqbasep->first; seq; seq = seq->next) { @@ -3159,17 +3114,17 @@ int BKE_sequencer_find_next_prev_edit(Scene *scene, switch (side) { case SEQ_SIDE_LEFT: - if (seq_frame < cfra) { - dist = cfra - seq_frame; + if (seq_frame < timeline_frame) { + dist = timeline_frame - seq_frame; } break; case SEQ_SIDE_RIGHT: - if (seq_frame > cfra) { - dist = seq_frame - cfra; + if (seq_frame > timeline_frame) { + dist = seq_frame - timeline_frame; } break; case SEQ_SIDE_BOTH: - dist = abs(seq_frame - cfra); + dist = abs(seq_frame - timeline_frame); break; } @@ -3183,25 +3138,25 @@ int BKE_sequencer_find_next_prev_edit(Scene *scene, return best_frame; } -static void sequencer_all_free_anim_ibufs(ListBase *seqbase, int cfra) +static void sequencer_all_free_anim_ibufs(ListBase *seqbase, int timeline_frame) { for (Sequence *seq = seqbase->first; seq != NULL; seq = seq->next) { - if (seq->enddisp < cfra || seq->startdisp > cfra) { + if (seq->enddisp < timeline_frame || seq->startdisp > timeline_frame) { BKE_sequence_free_anim(seq); } if (seq->type == SEQ_TYPE_META) { - sequencer_all_free_anim_ibufs(&seq->seqbase, cfra); + sequencer_all_free_anim_ibufs(&seq->seqbase, timeline_frame); } } } -void BKE_sequencer_all_free_anim_ibufs(Scene *scene, int cfra) +void BKE_sequencer_all_free_anim_ibufs(Scene *scene, int timeline_frame) { Editing *ed = BKE_sequencer_editing_get(scene, false); if (ed == NULL) { return; } - sequencer_all_free_anim_ibufs(&ed->seqbase, cfra); + sequencer_all_free_anim_ibufs(&ed->seqbase, timeline_frame); BKE_sequencer_cache_cleanup(scene); } diff --git a/source/blender/sequencer/intern/sequencer.h b/source/blender/sequencer/intern/sequencer.h index a7217e45ddf..9033d522e9b 100644 --- a/source/blender/sequencer/intern/sequencer.h +++ b/source/blender/sequencer/intern/sequencer.h @@ -68,7 +68,7 @@ void BKE_sequencer_cache_put(const SeqRenderData *context, bool skip_disk_cache); bool BKE_sequencer_cache_put_if_possible(const SeqRenderData *context, struct Sequence *seq, - float cfra, + float timeline_frame, int type, struct ImBuf *nval, float cost, @@ -90,7 +90,7 @@ bool BKE_sequencer_cache_is_full(struct Scene *scene); * Sequencer frame prefetching * ********************************************************************** */ -void BKE_sequencer_prefetch_start(const SeqRenderData *context, float cfra, float cost); +void BKE_sequencer_prefetch_start(const SeqRenderData *context, float timeline_frame, float cost); void BKE_sequencer_prefetch_free(struct Scene *scene); bool BKE_sequencer_prefetch_job_is_running(struct Scene *scene); void BKE_sequencer_prefetch_get_time_range(struct Scene *scene, int *start, int *end); @@ -109,7 +109,7 @@ struct SeqEffectHandle BKE_sequence_get_blend(struct Sequence *seq); void BKE_sequence_effect_speed_rebuild_map(struct Scene *scene, struct Sequence *seq, bool force); float BKE_sequencer_speed_effect_target_frame_get(const SeqRenderData *context, struct Sequence *seq, - float cfra, + float timeline_frame, int input); /* ********************************************************************** @@ -134,16 +134,6 @@ int seq_num_files(struct Scene *scene, char views_format, const bool is_multivie void seq_open_anim_file(struct Scene *scene, struct Sequence *seq, bool openfile); void seq_proxy_index_dir_set(struct anim *anim, const char *base_dir); -/* ********************************************************************** - * sequencer.c - * - * Unused - * ********************************************************************** - */ -bool BKE_sequence_check_depend(struct Sequence *seq, struct Sequence *cur); -void BKE_sequencer_clear_scene_in_allseqs(struct Main *bmain, struct Scene *sce); -int BKE_sequence_effect_get_supports_mask(int seq_type); - #ifdef __cplusplus } #endif diff --git a/source/blender/shader_fx/CMakeLists.txt b/source/blender/shader_fx/CMakeLists.txt index a68b343d416..0167591c3ba 100644 --- a/source/blender/shader_fx/CMakeLists.txt +++ b/source/blender/shader_fx/CMakeLists.txt @@ -31,7 +31,7 @@ set(INC ../editors/include ../makesdna ../makesrna - ../render/extern/include + ../render ../windowmanager ../../../intern/eigen ../../../intern/guardedalloc diff --git a/source/blender/simulation/intern/SIM_mass_spring.cpp b/source/blender/simulation/intern/SIM_mass_spring.cpp index 57276be469c..ce626498e8e 100644 --- a/source/blender/simulation/intern/SIM_mass_spring.cpp +++ b/source/blender/simulation/intern/SIM_mass_spring.cpp @@ -219,7 +219,7 @@ void SIM_cloth_solver_free(ClothModifierData *clmd) if (cloth->implicit) { SIM_mass_spring_solver_free(cloth->implicit); - cloth->implicit = NULL; + cloth->implicit = nullptr; } } @@ -568,7 +568,7 @@ static void hair_get_boundbox(ClothModifierData *clmd, float gmin[3], float gmax INIT_MINMAX(gmin, gmax); for (i = 0; i < mvert_num; i++) { float x[3]; - SIM_mass_spring_get_motion_state(data, i, x, NULL); + SIM_mass_spring_get_motion_state(data, i, x, nullptr); DO_MINMAX(x, gmin, gmax); } } @@ -624,7 +624,7 @@ static void cloth_calc_force( SIM_mass_spring_force_drag(data, drag); #endif /* handle pressure forces (making sure that this never gets computed for hair). */ - if ((parms->flags & CLOTH_SIMSETTINGS_FLAG_PRESSURE) && (clmd->hairdata == NULL)) { + if ((parms->flags & CLOTH_SIMSETTINGS_FLAG_PRESSURE) && (clmd->hairdata == nullptr)) { /* The difference in pressure between the inside and outside of the mesh.*/ float pressure_difference = 0.0f; float volume_factor = 1.0f; @@ -658,7 +658,7 @@ static void cloth_calc_force( /* Compute the hydrostatic pressure gradient if enabled. */ float fluid_density = clmd->sim_parms->fluid_density * 1000; /* kg/l -> kg/m3 */ - float *hydrostatic_pressure = NULL; + float *hydrostatic_pressure = nullptr; if (fabs(fluid_density) > 1e-6f) { float hydrostatic_vector[3]; @@ -711,7 +711,7 @@ static void cloth_calc_force( /* handle external forces like wind */ if (effectors) { - bool is_not_hair = (clmd->hairdata == NULL) && (cloth->primitive_num > 0); + bool is_not_hair = (clmd->hairdata == nullptr) && (cloth->primitive_num > 0); bool has_wind = false, has_force = false; /* cache per-vertex forces to avoid redundant calculation */ @@ -726,12 +726,12 @@ static void cloth_calc_force( SIM_mass_spring_get_motion_state(data, i, x, v); pd_point_from_loc(scene, x, v, i, &epoint); BKE_effectors_apply(effectors, - NULL, + nullptr, clmd->sim_parms->effector_weights, &epoint, forcevec[i], winvec[i], - NULL); + nullptr); has_wind = has_wind || !is_zero_v3(winvec[i]); has_force = has_force || !is_zero_v3(forcevec[i]); @@ -823,7 +823,7 @@ BLI_INLINE LinkNode *hair_spring_next(LinkNode *spring_link) return next; } } - return NULL; + return nullptr; } /* XXX this is nasty: cloth meshes do not explicitly store @@ -840,15 +840,15 @@ static LinkNode *cloth_continuum_add_hair_segments(HairGrid *grid, LinkNode *spring_link) { Implicit_Data *data = cloth->implicit; - LinkNode *next_spring_link = NULL; /* return value */ + LinkNode *next_spring_link = nullptr; /* return value */ ClothSpring *spring1, *spring2, *spring3; // ClothVertex *verts = cloth->verts; // ClothVertex *vert3, *vert4; float x1[3], v1[3], x2[3], v2[3], x3[3], v3[3], x4[3], v4[3]; float dir1[3], dir2[3], dir3[3]; - spring1 = NULL; - spring2 = NULL; + spring1 = nullptr; + spring2 = nullptr; spring3 = (ClothSpring *)spring_link->link; zero_v3(x1); @@ -894,15 +894,25 @@ static LinkNode *cloth_continuum_add_hair_segments(HairGrid *grid, normalize_v3(dir3); } else { - spring3 = NULL; + spring3 = nullptr; // vert4 = NULL; zero_v3(x4); zero_v3(v4); zero_v3(dir3); } - SIM_hair_volume_add_segment( - grid, x1, v1, x2, v2, x3, v3, x4, v4, spring1 ? dir1 : NULL, dir2, spring3 ? dir3 : NULL); + SIM_hair_volume_add_segment(grid, + x1, + v1, + x2, + v2, + x3, + v3, + x4, + v4, + spring1 ? dir1 : nullptr, + dir2, + spring3 ? dir3 : nullptr); } return next_spring_link; @@ -929,7 +939,7 @@ static void cloth_continuum_fill_grid(HairGrid *grid, Cloth *cloth) /* scale and offset for transforming vertex locations into grid space * (cell size is 0..1, gmin becomes origin) */ - SIM_hair_volume_grid_geometry(grid, &cellsize, NULL, gmin, NULL); + SIM_hair_volume_grid_geometry(grid, &cellsize, nullptr, gmin, nullptr); cell_scale = cellsize > 0.0f ? 1.0f / cellsize : 0.0f; mul_v3_v3fl(cell_offset, gmin, cell_scale); negate_v3(cell_offset); @@ -1255,7 +1265,7 @@ int SIM_cloth_solve( * Bad design, TODO */ Scene *scene = DEG_get_evaluated_scene(depsgraph); - const bool is_hair = (clmd->hairdata != NULL); + const bool is_hair = (clmd->hairdata != nullptr); unsigned int i = 0; float step = 0.0f, tf = clmd->sim_parms->timescale; @@ -1338,7 +1348,7 @@ int SIM_cloth_solve( } } - SIM_mass_spring_get_motion_state(id, i, verts[i].txold, NULL); + SIM_mass_spring_get_motion_state(id, i, verts[i].txold, nullptr); } step += dt; diff --git a/source/blender/simulation/intern/hair_volume.cpp b/source/blender/simulation/intern/hair_volume.cpp index 49868296295..123b91edaac 100644 --- a/source/blender/simulation/intern/hair_volume.cpp +++ b/source/blender/simulation/intern/hair_volume.cpp @@ -224,7 +224,7 @@ void SIM_hair_volume_vertex_grid_forces(HairGrid *grid, x, &gdensity, gvelocity, - NULL, + nullptr, ggrad, gvelgrad); diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 07e962aaf89..6de36acb343 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -36,13 +36,16 @@ set(INC ../makesdna ../makesrna ../nodes - ../render/extern/include + ../render ../sequencer ../../../intern/clog ../../../intern/ghost ../../../intern/glew-mx ../../../intern/guardedalloc ../../../intern/memutil + + # for writefile.c: dna_type_offsets.h + ${CMAKE_BINARY_DIR}/source/blender/makesdna/intern ) set(INC_SYS @@ -206,3 +209,6 @@ if(WITH_XR_OPENXR) endif() blender_add_lib_nolist(bf_windowmanager "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") + +# Needed so we can use dna_type_offsets.h for defaults initialization. +add_dependencies(bf_windowmanager bf_dna) diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 68547323761..a10284e9740 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -25,6 +25,9 @@ * Also Blender's main event loop (WM_main). */ +/* Allow using deprecated functionality for .blend file I/O. */ +#define DNA_DEPRECATED_ALLOW + #include <stddef.h> #include <string.h> @@ -69,6 +72,8 @@ # include "BPY_extern_run.h" #endif +#include "BLO_read_write.h" + /* ****************************************************** */ static void window_manager_free_data(ID *id) @@ -98,6 +103,158 @@ static void window_manager_foreach_id(ID *id, LibraryForeachIDData *data) } } +static void write_wm_xr_data(BlendWriter *writer, wmXrData *xr_data) +{ + BKE_screen_view3d_shading_blend_write(writer, &xr_data->session_settings.shading); +} + +static void window_manager_blend_write(BlendWriter *writer, ID *id, const void *id_address) +{ + wmWindowManager *wm = (wmWindowManager *)id; + + BLO_write_id_struct(writer, wmWindowManager, id_address, &wm->id); + BKE_id_blend_write(writer, &wm->id); + write_wm_xr_data(writer, &wm->xr); + + LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { + /* update deprecated screen member (for so loading in 2.7x uses the correct screen) */ + win->screen = BKE_workspace_active_screen_get(win->workspace_hook); + + BLO_write_struct(writer, wmWindow, win); + BLO_write_struct(writer, WorkSpaceInstanceHook, win->workspace_hook); + BLO_write_struct(writer, Stereo3dFormat, win->stereo3d_format); + + BKE_screen_area_map_blend_write(writer, &win->global_areas); + + /* data is written, clear deprecated data again */ + win->screen = NULL; + } +} + +static void direct_link_wm_xr_data(BlendDataReader *reader, wmXrData *xr_data) +{ + BKE_screen_view3d_shading_blend_read_data(reader, &xr_data->session_settings.shading); +} + +static void window_manager_blend_read_data(BlendDataReader *reader, ID *id) +{ + wmWindowManager *wm = (wmWindowManager *)id; + + id_us_ensure_real(&wm->id); + BLO_read_list(reader, &wm->windows); + + LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { + BLO_read_data_address(reader, &win->parent); + + WorkSpaceInstanceHook *hook = win->workspace_hook; + BLO_read_data_address(reader, &win->workspace_hook); + + /* This will be NULL for any pre-2.80 blend file. */ + if (win->workspace_hook != NULL) { + /* We need to restore a pointer to this later when reading workspaces, + * so store in global oldnew-map. + * Note that this is only needed for versioning of older .blend files now.. */ + BLO_read_data_globmap_add(reader, hook, win->workspace_hook); + /* Cleanup pointers to data outside of this data-block scope. */ + win->workspace_hook->act_layout = NULL; + win->workspace_hook->temp_workspace_store = NULL; + win->workspace_hook->temp_layout_store = NULL; + } + + BKE_screen_area_map_blend_read_data(reader, &win->global_areas); + + win->ghostwin = NULL; + win->gpuctx = NULL; + win->eventstate = NULL; + win->cursor_keymap_status = NULL; + win->tweak = NULL; +#ifdef WIN32 + win->ime_data = NULL; +#endif + + BLI_listbase_clear(&win->queue); + BLI_listbase_clear(&win->handlers); + BLI_listbase_clear(&win->modalhandlers); + BLI_listbase_clear(&win->gesture); + + win->active = 0; + + win->cursor = 0; + win->lastcursor = 0; + win->modalcursor = 0; + win->grabcursor = 0; + win->addmousemove = true; + BLO_read_data_address(reader, &win->stereo3d_format); + + /* Multi-view always fallback to anaglyph at file opening + * otherwise quad-buffer saved files can break Blender. */ + if (win->stereo3d_format) { + win->stereo3d_format->display_mode = S3D_DISPLAY_ANAGLYPH; + } + } + + direct_link_wm_xr_data(reader, &wm->xr); + + BLI_listbase_clear(&wm->timers); + BLI_listbase_clear(&wm->operators); + BLI_listbase_clear(&wm->paintcursors); + BLI_listbase_clear(&wm->queue); + BKE_reports_init(&wm->reports, RPT_STORE); + + BLI_listbase_clear(&wm->keyconfigs); + wm->defaultconf = NULL; + wm->addonconf = NULL; + wm->userconf = NULL; + wm->undo_stack = NULL; + + wm->message_bus = NULL; + + wm->xr.runtime = NULL; + + BLI_listbase_clear(&wm->jobs); + BLI_listbase_clear(&wm->drags); + + wm->windrawable = NULL; + wm->winactive = NULL; + wm->initialized = 0; + wm->op_undo_depth = 0; + wm->is_interface_locked = 0; +} + +static void lib_link_wm_xr_data(BlendLibReader *reader, ID *parent_id, wmXrData *xr_data) +{ + BLO_read_id_address(reader, parent_id->lib, &xr_data->session_settings.base_pose_object); +} + +static void lib_link_workspace_instance_hook(BlendLibReader *reader, + WorkSpaceInstanceHook *hook, + ID *id) +{ + WorkSpace *workspace = BKE_workspace_active_get(hook); + BLO_read_id_address(reader, id->lib, &workspace); + BKE_workspace_active_set(hook, workspace); +} + +static void window_manager_blend_read_lib(BlendLibReader *reader, ID *id) +{ + wmWindowManager *wm = (wmWindowManager *)id; + + LISTBASE_FOREACH (wmWindow *, win, &wm->windows) { + if (win->workspace_hook) { /* NULL for old files */ + lib_link_workspace_instance_hook(reader, win->workspace_hook, &wm->id); + } + BLO_read_id_address(reader, wm->id.lib, &win->scene); + /* deprecated, but needed for versioning (will be NULL'ed then) */ + BLO_read_id_address(reader, NULL, &win->screen); + + LISTBASE_FOREACH (ScrArea *, area, &win->global_areas.areabase) { + BKE_screen_area_blend_read_lib(reader, &wm->id, area); + } + + lib_link_wm_xr_data(reader, &wm->id, &wm->xr); + } +} + IDTypeInfo IDType_ID_WM = { .id_code = ID_WM, .id_filter = 0, @@ -116,9 +273,9 @@ IDTypeInfo IDType_ID_WM = { .foreach_id = window_manager_foreach_id, .foreach_cache = NULL, - .blend_write = NULL, - .blend_read_data = NULL, - .blend_read_lib = NULL, + .blend_write = window_manager_blend_write, + .blend_read_data = window_manager_blend_read_data, + .blend_read_lib = window_manager_blend_read_lib, .blend_read_expand = NULL, .blend_read_undo_preserve = NULL, diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 7f4f8d47688..b48f4bdd4b9 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -31,7 +31,7 @@ blender_include_dirs( ../blender/editors/include ../blender/imbuf ../blender/makesrna - ../blender/render/extern/include + ../blender/render ../blender/gpu ../blender/makesdna ../blender/windowmanager diff --git a/source/creator/creator.c b/source/creator/creator.c index 3365dad75d1..fee97e5090f 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -293,7 +293,7 @@ int main(int argc, MEM_use_guarded_allocator(); break; } - else if (STREQ(argv[i], "--")) { + if (STREQ(argv[i], "--")) { break; } } diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index 077eb4e6821..c6a1c565350 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -119,15 +119,13 @@ static bool parse_int_relative(const char *str, *r_err_msg = msg; return false; } - else if ((errno == ERANGE) || ((value < INT_MIN || value > INT_MAX))) { + if ((errno == ERANGE) || ((value < INT_MIN || value > INT_MAX))) { static const char *msg = "exceeds range"; *r_err_msg = msg; return false; } - else { - *r_value = (int)value; - return true; - } + *r_value = (int)value; + return true; } static const char *parse_int_range_sep_search(const char *str, const char *str_end_test) @@ -166,9 +164,7 @@ static bool parse_int_range_relative(const char *str, str_end_range + 2, str_end_test, pos, neg, &r_value_range[1], r_err_msg)) { return true; } - else { - return false; - } + return false; } static bool parse_int_relative_clamp(const char *str, @@ -184,9 +180,7 @@ static bool parse_int_relative_clamp(const char *str, CLAMP(*r_value, min, max); return true; } - else { - return false; - } + return false; } static bool parse_int_range_relative_clamp(const char *str, @@ -205,9 +199,7 @@ static bool parse_int_range_relative_clamp(const char *str, CLAMP(r_value_range[1], min, max); return true; } - else { - return false; - } + return false; } /** @@ -231,15 +223,13 @@ static bool parse_int_strict_range(const char *str, *r_err_msg = msg; return false; } - else if ((errno == ERANGE) || ((value < min || value > max))) { + if ((errno == ERANGE) || ((value < min || value > max))) { static const char *msg = "exceeds range"; *r_err_msg = msg; return false; } - else { - *r_value = (int)value; - return true; - } + *r_value = (int)value; + return true; } static bool parse_int(const char *str, @@ -261,9 +251,7 @@ static bool parse_int_clamp(const char *str, CLAMP(*r_value, min, max); return true; } - else { - return false; - } + return false; } # if 0 @@ -802,10 +790,8 @@ static int arg_handle_log_level_set(int argc, const char **argv, void *UNUSED(da } return 1; } - else { - printf("\nError: '%s' no args given.\n", arg_id); - return 0; - } + printf("\nError: '%s' no args given.\n", arg_id); + return 0; } static const char arg_handle_log_show_basename_set_doc[] = @@ -865,10 +851,8 @@ static int arg_handle_log_file_set(int argc, const char **argv, void *UNUSED(dat } return 1; } - else { - printf("\nError: '%s' no args given.\n", arg_id); - return 0; - } + printf("\nError: '%s' no args given.\n", arg_id); + return 0; } static const char arg_handle_log_set_doc[] = @@ -908,10 +892,8 @@ static int arg_handle_log_set(int argc, const char **argv, void *UNUSED(data)) } return 1; } - else { - printf("\nError: '%s' no args given.\n", arg_id); - return 0; - } + printf("\nError: '%s' no args given.\n", arg_id); + return 0; } static const char arg_handle_debug_mode_set_doc[] = @@ -1094,10 +1076,8 @@ static int arg_handle_debug_value_set(int argc, const char **argv, void *UNUSED( return 1; } - else { - printf("\nError: you must specify debug value to set.\n"); - return 0; - } + printf("\nError: you must specify debug value to set.\n"); + return 0; } static const char arg_handle_debug_fpe_set_doc[] = @@ -1121,10 +1101,8 @@ static int arg_handle_app_template(int argc, const char **argv, void *UNUSED(dat WM_init_state_app_template_set(app_template); return 1; } - else { - printf("\nError: App template must follow '--app-template'.\n"); - return 0; - } + printf("\nError: App template must follow '--app-template'.\n"); + return 0; } static const char arg_handle_factory_startup_set_doc[] = @@ -1382,10 +1360,8 @@ static int arg_handle_output_set(int argc, const char **argv, void *data) } return 1; } - else { - printf("\nError: you must specify a path after '-o / --render-output'.\n"); - return 0; - } + printf("\nError: you must specify a path after '-o / --render-output'.\n"); + return 0; } static const char arg_handle_engine_set_doc[] = @@ -1425,10 +1401,8 @@ static int arg_handle_engine_set(int argc, const char **argv, void *data) return 1; } - else { - printf("\nEngine not specified, give 'help' for a list of available engines.\n"); - return 0; - } + printf("\nEngine not specified, give 'help' for a list of available engines.\n"); + return 0; } static const char arg_handle_image_type_set_doc[] = @@ -1465,10 +1439,8 @@ static int arg_handle_image_type_set(int argc, const char **argv, void *data) } return 1; } - else { - printf("\nError: you must specify a format after '-F / --render-format'.\n"); - return 0; - } + printf("\nError: you must specify a format after '-F / --render-format'.\n"); + return 0; } static const char arg_handle_threads_set_doc[] = @@ -1495,10 +1467,8 @@ static int arg_handle_threads_set(int argc, const char **argv, void *UNUSED(data BLI_system_num_threads_override_set(threads); return 1; } - else { - printf("\nError: you must specify a number of threads in [%d..%d] '%s'.\n", min, max, arg_id); - return 0; - } + printf("\nError: you must specify a number of threads in [%d..%d] '%s'.\n", min, max, arg_id); + return 0; } static const char arg_handle_verbosity_set_doc[] = @@ -1524,10 +1494,8 @@ static int arg_handle_verbosity_set(int argc, const char **argv, void *UNUSED(da return 1; } - else { - printf("\nError: you must specify a verbosity level.\n"); - return 0; - } + printf("\nError: you must specify a verbosity level.\n"); + return 0; } static const char arg_handle_extension_set_doc[] = @@ -1558,10 +1526,8 @@ static int arg_handle_extension_set(int argc, const char **argv, void *data) } return 1; } - else { - printf("\nError: you must specify a path after '- '.\n"); - return 0; - } + printf("\nError: you must specify a path after '- '.\n"); + return 0; } static const char arg_handle_render_frame_doc[] = @@ -1616,15 +1582,11 @@ static int arg_handle_render_frame(int argc, const char **argv, void *data) MEM_freeN(frame_range_arr); return 1; } - else { - printf("\nError: frame number must follow '%s'.\n", arg_id); - return 0; - } - } - else { - printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id); + printf("\nError: frame number must follow '%s'.\n", arg_id); return 0; } + printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id); + return 0; } static const char arg_handle_render_animation_doc[] = @@ -1673,10 +1635,8 @@ static int arg_handle_scene_set(int argc, const char **argv, void *data) } return 1; } - else { - printf("\nError: Scene name must follow '-S / --scene'.\n"); - return 0; - } + printf("\nError: Scene name must follow '-S / --scene'.\n"); + return 0; } static const char arg_handle_frame_start_set_doc[] = @@ -1705,15 +1665,11 @@ static int arg_handle_frame_start_set(int argc, const char **argv, void *data) } return 1; } - else { - printf("\nError: frame number must follow '%s'.\n", arg_id); - return 0; - } - } - else { - printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id); + printf("\nError: frame number must follow '%s'.\n", arg_id); return 0; } + printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id); + return 0; } static const char arg_handle_frame_end_set_doc[] = @@ -1742,15 +1698,11 @@ static int arg_handle_frame_end_set(int argc, const char **argv, void *data) } return 1; } - else { - printf("\nError: frame number must follow '%s'.\n", arg_id); - return 0; - } - } - else { - printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id); + printf("\nError: frame number must follow '%s'.\n", arg_id); return 0; } + printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id); + return 0; } static const char arg_handle_frame_skip_set_doc[] = @@ -1772,15 +1724,11 @@ static int arg_handle_frame_skip_set(int argc, const char **argv, void *data) } return 1; } - else { - printf("\nError: number of frames to step must follow '%s'.\n", arg_id); - return 0; - } - } - else { - printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id); + printf("\nError: number of frames to step must follow '%s'.\n", arg_id); return 0; } + printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id); + return 0; } static const char arg_handle_python_file_run_doc[] = @@ -1807,10 +1755,9 @@ static int arg_handle_python_file_run(int argc, const char **argv, void *data) } return 1; } - else { - printf("\nError: you must specify a filepath after '%s'.\n", argv[0]); - return 0; - } + printf("\nError: you must specify a filepath after '%s'.\n", argv[0]); + return 0; + # else UNUSED_VARS(argc, argv, data); printf("This Blender was built without Python support\n"); @@ -1849,10 +1796,9 @@ static int arg_handle_python_text_run(int argc, const char **argv, void *data) return 1; } - else { - printf("\nError: you must specify a text block after '%s'.\n", argv[0]); - return 0; - } + printf("\nError: you must specify a text block after '%s'.\n", argv[0]); + return 0; + # else UNUSED_VARS(argc, argv, data); printf("This Blender was built without Python support\n"); @@ -1879,10 +1825,9 @@ static int arg_handle_python_expr_run(int argc, const char **argv, void *data) } return 1; } - else { - printf("\nError: you must specify a Python expression after '%s'.\n", argv[0]); - return 0; - } + printf("\nError: you must specify a Python expression after '%s'.\n", argv[0]); + return 0; + # else UNUSED_VARS(argc, argv, data); printf("This Blender was built without Python support\n"); @@ -1932,10 +1877,8 @@ static int arg_handle_python_exit_code_set(int argc, const char **argv, void *UN app_state.exit_code_on_error.python = (unsigned char)exit_code; return 1; } - else { - printf("\nError: you must specify an exit code number '%s'.\n", arg_id); - return 0; - } + printf("\nError: you must specify an exit code number '%s'.\n", arg_id); + return 0; } static const char arg_handle_python_use_system_env_set_doc[] = @@ -1978,10 +1921,8 @@ static int arg_handle_addons_set(int argc, const char **argv, void *data) # endif /* WITH_PYTHON */ return 1; } - else { - printf("\nError: you must specify a comma separated list after '--addons'.\n"); - return 0; - } + printf("\nError: you must specify a comma separated list after '--addons'.\n"); + return 0; } static int arg_handle_load_file(int UNUSED(argc), const char **argv, void *data) |