Compare commits

...

34 Commits

Author SHA1 Message Date
0b41497c3c remove "Access" from name 2020-05-04 12:36:11 +02:00
dc1c562f63 Merge branch 'master' into simulation-access-modifier 2020-05-04 12:29:39 +02:00
10fad7c88d add ifdefs 2020-05-04 12:28:58 +02:00
9adb81f584 Modifiers: Rename Simulate category to Physics
While the name "Simulate" might be more accurate, there is
a naming collision with the new modifier added in D7549.
Therefore, we decided to rename the category for now.
2020-05-04 12:24:12 +02:00
9eb46d6c29 Cleanup: rename mcords to mcoords
- 'coords' is an abbreviation for coordinates, not 'cords'.
- Rename 'moves' to 'coords_len'.
2020-05-04 19:50:06 +10:00
2addc868de Cleanup: pass ARegion, View2D as const 2020-05-04 19:32:59 +10:00
411c5238a2 UV: support edge-selection for box/circle/lasso select 2020-05-04 19:20:08 +10:00
88b9505b84 BLI: simplify memory management in OpenAddressingArray 2020-05-04 11:11:46 +02:00
fdebdfa320 Cleanup: rename uv_sel_co_from_eve, pass in UV layer offset 2020-05-04 17:08:57 +10:00
a9ef6d5ad7 Cleanup: replace UV_SELECT_ISLAND_LIMIT macro with a function
Also make return argument last for uvedit_pixel_to_float.
2020-05-04 17:00:11 +10:00
b048272825 Cleanup: split selection operations into uvedit_select.c 2020-05-04 16:59:35 +10:00
b84c380aaa Merge branch 'blender-v2.83-release' 2020-05-04 08:24:08 +02:00
000fdd8a6e GPencil: Fix Chisel Brush pressure
In previous commit the pressure was disabled by error.
2020-05-04 08:23:27 +02:00
7b9d6ef2b6 Cleanup: use ELEM macro 2020-05-04 14:03:41 +10:00
33bdd91fb8 Windows: Move tbb to being dynamic library
Static tbb has always been frowned upon [1] sofar it has worked for us but
given our reliance on tbb is about to increase (D7475), I'd like to move the library
to more supported configuration. Which means moving it to be a dynamic library

The libs part of this change is in rBL62416

Reviewed By: Brecht

Differential Revision: https://developer.blender.org/D7570
2020-05-03 16:25:56 -06:00
70fe988dc4 Fluid: Cleanup use of std in MANTA wrapper
Moved std namespace to beginning of class.
2020-05-03 21:10:52 +02:00
82f9ed9305 Fluid: Cleanup in main MANTA wrapper
Use shorter variable names.
2020-05-03 21:10:52 +02:00
99ee1de094 Fluid: Refactored 'Modifier Data to Python' value transfer function
This function needed a bigger cleanup, especially after the problem from T76276.
2020-05-03 21:10:51 +02:00
57cfa8e2d0 Merge branch 'blender-v2.83-release' 2020-05-03 20:42:37 +02:00
331bf04fad GPencil: Hide Canvas Grid when Surface or Stroke mode is enabled
This was introduced by error during refactor. The grid must not be visible in these modes.
2020-05-03 20:42:18 +02:00
bbfae8f184 Merge branch 'blender-v2.83-release' 2020-05-03 20:35:30 +02:00
a577291b03 Fix T76364: GPencil grid is not located in the right place
During the refactor, the location of the grid was broken. Now, the grid is in Object origin or 3D cursor origin as it was in 2.82.
2020-05-03 20:34:48 +02:00
ff8288ad1e Windows: Replace BLI_File* calls with system calls in system_win32.c
Using BLI calls in this file triggered a condition where
poorly modelled dependencies in cmake (ie bf_blenlib using
zlib headers but not linking the libraries) leading to
linker error in debug builds of some of the tests.

This diff sidesteps the dependencies issue by using native
calls rather than BLI calls to check if a file exists and
what its size is. Effectively sweeping the issue right back
under the rug where I found it.

The best solution would be to audit all libraries and ensure
they have proper link requirements set, but that requires
significantly more time than I have available right now.
(zlib in blenlib was one of them and would have been easy
to fix, but there were others that required more work)

The alternative is tests that fail to build which worse.

I'll revisit this and fix it properly but for now this will
have to do.
2020-05-03 12:07:22 -06:00
fe891d581d Audaspace: update from upstream
- Changing API for time values from float to double for better precision.
- Fixing minor mistakes in the documentation.
- Fixing minor unnecessary large memory allocation.
2020-05-03 15:30:35 +02:00
7b0676f102 remove prints 2020-04-28 11:18:48 +02:00
11ffa05354 remove unnecessary branch 2020-04-28 11:17:54 +02:00
c413a150bc Merge branch 'master' into simulation-access-modifier 2020-04-28 11:11:54 +02:00
8ec2fde411 Merge branch 'master' into simulation-access-modifier 2020-04-28 11:05:39 +02:00
9973f752b4 quiet warning 2020-04-27 13:35:15 +02:00
1cb2f3a1c1 add BKE_simulation_data_update function 2020-04-27 13:34:48 +02:00
2341ed9d72 Merge branch 'master' into simulation-access-modifier 2020-04-27 13:23:04 +02:00
20f935ab5c separate node type 2020-04-22 16:25:40 +02:00
6b47b22a33 proper operation type 2020-04-22 16:04:30 +02:00
0ba4bf7ec5 initial simulation access modifier 2020-04-22 15:52:15 +02:00
131 changed files with 5015 additions and 4704 deletions

View File

@@ -21,7 +21,7 @@ set(OIDN_EXTRA_ARGS
-DWITH_EXAMPLE=OFF
-DWITH_TEST=OFF
-DTBB_ROOT=${LIBDIR}/tbb
-DTBB_STATIC_LIB=ON
-DTBB_STATIC_LIB=${TBB_STATIC_LIBRARY}
-DOIDN_STATIC_LIB=ON
)

View File

@@ -36,7 +36,7 @@ if(WIN32)
set(OPENSUBDIV_EXTRA_ARGS
${OPENSUBDIV_EXTRA_ARGS}
-DTBB_INCLUDE_DIR=${LIBDIR}/tbb/include
-DTBB_LIBRARIES=${LIBDIR}/tbb/lib/tbb_static.lib
-DTBB_LIBRARIES=${LIBDIR}/tbb/lib/tbb.lib
-DCLEW_INCLUDE_DIR=${LIBDIR}/clew/include/CL
-DCLEW_LIBRARY=${LIBDIR}/clew/lib/clew${LIBEXT}
-DCUEW_INCLUDE_DIR=${LIBDIR}/cuew/include

View File

@@ -20,8 +20,10 @@ if(WIN32)
-DTBB_BUILD_SHARED=On
-DTBB_BUILD_TBBMALLOC=On
-DTBB_BUILD_TBBMALLOC_PROXY=On
-DTBB_BUILD_STATIC=On
)
-DTBB_BUILD_STATIC=Off
)
set(TBB_LIBRARY tbb)
set(TBB_STATIC_LIBRARY Off)
else()
set(TBB_EXTRA_ARGS
-DTBB_BUILD_SHARED=Off
@@ -29,6 +31,8 @@ else()
-DTBB_BUILD_TBBMALLOC_PROXY=Off
-DTBB_BUILD_STATIC=On
)
set(TBB_LIBRARY tbb_static)
set(TBB_STATIC_LIBRARY On)
endif()
# CMake script for TBB from https://github.com/wjakob/tbb/blob/master/CMakeLists.txt
@@ -46,7 +50,8 @@ ExternalProject_Add(external_tbb
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_tbb after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_static.lib ${HARVEST_TARGET}/tbb/lib/tbb.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.lib ${HARVEST_TARGET}/tbb/lib/tbb.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb.dll ${HARVEST_TARGET}/tbb/lib/tbb.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.dll ${HARVEST_TARGET}/tbb/lib/tbbmalloc.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy.lib
@@ -57,7 +62,12 @@ if(WIN32)
endif()
if(BUILD_MODE STREQUAL Debug)
ExternalProject_Add_Step(external_tbb after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_static.lib ${HARVEST_TARGET}/tbb/lib/tbb_debug.lib
# findtbb.cmake in some deps *NEEDS* to find tbb.lib even if they are not going to use it
# to make that test pass, we place a copy with the right name in the lib folder.
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_debug.lib ${LIBDIR}/tbb/lib/tbb.lib
# Normal collection of build artifacts
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_debug.lib ${HARVEST_TARGET}/tbb/lib/debug/tbb_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_debug.dll ${HARVEST_TARGET}/tbb/lib/debug/tbb_debug.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.lib ${HARVEST_TARGET}/tbb/lib/tbbmalloc_proxy_debug.lib
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc.dll ${HARVEST_TARGET}/tbb/lib/debug/tbbmalloc.dll
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbbmalloc_proxy.dll ${HARVEST_TARGET}/tbb/lib/debug/tbbmalloc_proxy.dll

View File

@@ -23,8 +23,8 @@ set(USD_EXTRA_ARGS
-DBoost_USE_STATIC_RUNTIME=OFF
-DBOOST_ROOT=${LIBDIR}/boost
-DTBB_INCLUDE_DIRS=${LIBDIR}/tbb/include
-DTBB_LIBRARIES=${LIBDIR}/tbb/lib/${LIBPREFIX}tbb_static${LIBEXT}
-DTbb_TBB_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}tbb_static${LIBEXT}
-DTBB_LIBRARIES=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
-DTbb_TBB_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}${TBB_LIBRARY}${LIBEXT}
# This is a preventative measure that avoids possible conflicts when add-ons
# try to load another USD library into the same process space.

View File

@@ -109,6 +109,9 @@ if (WIN32)
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/${ARCH_PREFIX}-tbbmalloc-export.def
COMMENT "Preprocessing tbbmalloc.def"
)
list(APPEND tbb_src ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/tbb_resource.rc)
list(APPEND tbbmalloc_src ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/tbbmalloc.rc)
list(APPEND tbbmalloc_proxy_src ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/tbbmalloc.rc)
else()
add_custom_command(OUTPUT tbb.def
COMMAND ${CMAKE_CXX_COMPILER} -xc++ -E ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include -o tbb.def
@@ -145,8 +148,12 @@ if (TBB_BUILD_SHARED)
set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "-Wl,-version-script,${CMAKE_CURRENT_BINARY_DIR}/tbb.def")
elseif(WIN32)
set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "/DEF:${CMAKE_CURRENT_BINARY_DIR}/tbb.def")
endif()
install(TARGETS tbb DESTINATION lib)
if(WIN32)
set_target_properties(tbb PROPERTIES OUTPUT_NAME "tbb$<$<CONFIG:Debug>:_debug>")
endif()
endif()
if(CMAKE_COMPILER_IS_GNUCC)
@@ -196,7 +203,7 @@ if(TBB_BUILD_TBBMALLOC_PROXY)
add_library(tbbmalloc_proxy SHARED ${tbbmalloc_proxy_src})
set_property(TARGET tbbmalloc_proxy APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1")
set_property(TARGET tbbmalloc_proxy APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI})
link_libraries(tbbmalloc_proxy tbbmalloc)
target_link_libraries(tbbmalloc_proxy tbbmalloc)
install(TARGETS tbbmalloc_proxy DESTINATION lib)
endif()
endif()

View File

@@ -18,17 +18,6 @@ diff --git a/mkl-dnn/cmake/TBB.cmake b/mkl-dnn/cmake/TBB.cmake
index 0711e699..c14210b6 100644
--- a/mkl-dnn/cmake/TBB.cmake
+++ b/mkl-dnn/cmake/TBB.cmake
@@ -90,8 +90,8 @@ if(WIN32)
NO_DEFAULT_PATH
)
set(TBB_LIB_DIR ${TBB_ROOT}/lib/${TBB_ARCH}/${TBB_VCVER})
- find_library(TBB_LIBRARY tbb PATHS ${TBB_LIB_DIR} ${TBB_ROOT}/lib NO_DEFAULT_PATH)
- find_library(TBB_LIBRARY_MALLOC tbbmalloc PATHS ${TBB_LIB_DIR} ${TBB_ROOT}/lib NO_DEFAULT_PATH)
+ find_library(TBB_LIBRARY tbb_static PATHS ${TBB_LIB_DIR} ${TBB_ROOT}/lib NO_DEFAULT_PATH)
+ find_library(TBB_LIBRARY_MALLOC tbbmalloc_static PATHS ${TBB_LIB_DIR} ${TBB_ROOT}/lib NO_DEFAULT_PATH)
endif()
else()
@@ -138,13 +138,13 @@ else()
set(TBB_LIBRARY_MALLOC TBB_LIBRARY_MALLOC-NOTFOUND)
if(APPLE)

View File

@@ -596,7 +596,7 @@ if(WITH_SYSTEM_AUDASPACE)
endif()
if(WITH_TBB)
set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/tbb_debug.lib)
set(TBB_LIBRARIES optimized ${LIBDIR}/tbb/lib/tbb.lib debug ${LIBDIR}/tbb/lib/debug/tbb_debug.lib)
set(TBB_INCLUDE_DIR ${LIBDIR}/tbb/include)
set(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR})
if(WITH_TBB_MALLOC_PROXY)

View File

@@ -290,14 +290,14 @@ AUD_API AUD_Device* AUD_Device_getCurrent()
return new AUD_Device(device);
}
AUD_API void AUD_seekSynchronizer(AUD_Handle* handle, float time)
AUD_API void AUD_seekSynchronizer(AUD_Handle* handle, double time)
{
auto synchronizer = DeviceManager::getDevice()->getSynchronizer();
if(synchronizer)
synchronizer->seek(*reinterpret_cast<std::shared_ptr<IHandle>*>(handle), time);
}
AUD_API float AUD_getSynchronizerPosition(AUD_Handle* handle)
AUD_API double AUD_getSynchronizerPosition(AUD_Handle* handle)
{
auto synchronizer = DeviceManager::getDevice()->getSynchronizer();
if(synchronizer)

View File

@@ -221,14 +221,14 @@ extern AUD_API AUD_Device* AUD_Device_getCurrent();
* \param handle Playback handle.
* \param time Time in seconds to seek to.
*/
extern AUD_API void AUD_seekSynchronizer(AUD_Handle* handle, float time);
extern AUD_API void AUD_seekSynchronizer(AUD_Handle* handle, double time);
/**
* Returns the current sound scene playback time.
* \param handle Playback handle.
* \return The playback time in seconds.
*/
extern AUD_API float AUD_getSynchronizerPosition(AUD_Handle* handle);
extern AUD_API double AUD_getSynchronizerPosition(AUD_Handle* handle);
/**
* Starts the playback of jack transport if possible.

View File

@@ -101,14 +101,14 @@ AUD_API int AUD_DynamicMusic_pause(AUD_DynamicMusic* player)
return (*player)->pause();
}
AUD_API int AUD_DynamicMusic_seek(AUD_DynamicMusic* player, float position)
AUD_API int AUD_DynamicMusic_seek(AUD_DynamicMusic* player, double position)
{
assert(player);
return (*player)->seek(position);
}
AUD_API float AUD_DynamicMusic_getPosition(AUD_DynamicMusic* player)
AUD_API double AUD_DynamicMusic_getPosition(AUD_DynamicMusic* player)
{
assert(player);
@@ -141,4 +141,4 @@ AUD_API int AUD_DynamicMusic_stop(AUD_DynamicMusic* player)
assert(player);
return (*player)->stop();
}
}

View File

@@ -103,14 +103,14 @@ extern AUD_API int AUD_DynamicMusic_pause(AUD_DynamicMusic* player);
* \param position The new position from which to play back, in seconds.
* \return 0 if the seeking wasn't possible.
*/
extern AUD_API int AUD_DynamicMusic_seek(AUD_DynamicMusic* player, float position);
extern AUD_API int AUD_DynamicMusic_seek(AUD_DynamicMusic* player, double position);
/**
* Retrieves the position of the current scene of a dynamic music player.
* \param player The DynamicMusic object.
* \return The position of the current playing scene.
*/
extern AUD_API float AUD_DynamicMusic_getPosition(AUD_DynamicMusic* player);
extern AUD_API double AUD_DynamicMusic_getPosition(AUD_DynamicMusic* player);
/**
* Retrieves the volume of the current scene of a dynamic music player.
@@ -142,4 +142,4 @@ extern AUD_API int AUD_DynamicMusic_stop(AUD_DynamicMusic* player);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -259,13 +259,13 @@ AUD_API int AUD_Handle_setPitch(AUD_Handle* handle, float value)
return (*handle)->setPitch(value);
}
AUD_API float AUD_Handle_getPosition(AUD_Handle* handle)
AUD_API double AUD_Handle_getPosition(AUD_Handle* handle)
{
assert(handle);
return (*handle)->getPosition();
}
AUD_API int AUD_Handle_setPosition(AUD_Handle* handle, float value)
AUD_API int AUD_Handle_setPosition(AUD_Handle* handle, double value)
{
assert(handle);
return (*handle)->seek(value);

View File

@@ -211,14 +211,14 @@ extern AUD_API int AUD_Handle_setPitch(AUD_Handle* handle, float value);
* param handle The handle to get the position from.
* return The position of the handle.
*/
extern AUD_API float AUD_Handle_getPosition(AUD_Handle* handle);
extern AUD_API double AUD_Handle_getPosition(AUD_Handle* handle);
/**
* Sets the position of a handle.
* param handle The handle to set the position from.
* param value The new position to set.
*/
extern AUD_API int AUD_Handle_setPosition(AUD_Handle* handle, float value);
extern AUD_API int AUD_Handle_setPosition(AUD_Handle* handle, double value);
/**
* Retrieves the relative of a handle.

View File

@@ -41,7 +41,7 @@ AUD_API void AUD_Sequence_free(AUD_Sound* sequence)
delete sequence;
}
AUD_API AUD_SequenceEntry* AUD_Sequence_add(AUD_Sound* sequence, AUD_Sound* sound, float begin, float end, float skip)
AUD_API AUD_SequenceEntry* AUD_Sequence_add(AUD_Sound* sequence, AUD_Sound* sound, double begin, double end, double skip)
{
if(!sound)
return new AUD_SequenceEntry(((Sequence *)sequence->get())->add(AUD_Sound(), begin, end, skip));
@@ -160,7 +160,7 @@ AUD_API void AUD_Sequence_setSpeedOfSound(AUD_Sound* sequence, float value)
AUD_API void AUD_SequenceEntry_move(AUD_SequenceEntry* entry, float begin, float end, float skip)
AUD_API void AUD_SequenceEntry_move(AUD_SequenceEntry* entry, double begin, double end, double skip)
{
(*entry)->move(begin, end, skip);
}

View File

@@ -55,7 +55,7 @@ extern AUD_API void AUD_Sequence_free(AUD_Sound* sequence);
* \param skip How much seconds should be skipped at the beginning.
* \return The entry added.
*/
extern AUD_API AUD_SequenceEntry* AUD_Sequence_add(AUD_Sound* sequence, AUD_Sound* sound, float begin, float end, float skip);
extern AUD_API AUD_SequenceEntry* AUD_Sequence_add(AUD_Sound* sequence, AUD_Sound* sound, double begin, double end, double skip);
/**
* Removes an entry from the scene.
@@ -167,7 +167,7 @@ extern AUD_API void AUD_Sequence_setSpeedOfSound(AUD_Sound* sequence, float valu
* \param end The new end time or a negative value if unknown.
* \param skip How many seconds to skip at the beginning.
*/
extern AUD_API void AUD_SequenceEntry_move(AUD_SequenceEntry* entry, float begin, float end, float skip);
extern AUD_API void AUD_SequenceEntry_move(AUD_SequenceEntry* entry, double begin, double end, double skip);
/**
* Writes animation data to a sequenced entry.

View File

@@ -175,7 +175,7 @@ static void pauseSound(AUD_Handle* handle)
(*handle)->pause();
}
AUD_API AUD_Handle* AUD_pauseAfter(AUD_Handle* handle, float seconds)
AUD_API AUD_Handle* AUD_pauseAfter(AUD_Handle* handle, double seconds)
{
auto device = DeviceManager::getDevice();
@@ -336,7 +336,7 @@ AUD_API const char* AUD_mixdown_per_channel(AUD_Sound* sound, unsigned int start
}
}
AUD_API AUD_Device* AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound* sequencer, float volume, float start)
AUD_API AUD_Device* AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound* sequencer, float volume, double start)
{
try
{

View File

@@ -45,7 +45,7 @@ extern AUD_API float* AUD_readSoundBuffer(const char* filename, float low, float
* \param seconds The time in seconds.
* \return The silence handle.
*/
extern AUD_API AUD_Handle* AUD_pauseAfter(AUD_Handle* handle, float seconds);
extern AUD_API AUD_Handle* AUD_pauseAfter(AUD_Handle* handle, double seconds);
/**
* Reads a sound into a buffer for drawing at a specific sampling rate.
@@ -101,7 +101,7 @@ extern AUD_API const char* AUD_mixdown_per_channel(AUD_Sound* sound, unsigned in
* \param start The start time of the mixdown in the sound scene.
* \return The read device for the mixdown.
*/
extern AUD_API AUD_Device* AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound* sequencer, float volume, float start);
extern AUD_API AUD_Device* AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound* sequencer, float volume, double start);
/**
* Initializes audio routines (FFMPEG/JACK if it is enabled).

View File

@@ -4,4 +4,5 @@ Device
.. currentmodule:: aud
.. autoclass:: Device
:members:
:noindex:

View File

@@ -4,4 +4,5 @@ Handle
.. currentmodule:: aud
.. autoclass:: Handle
:members:
:noindex:

View File

@@ -7,6 +7,7 @@ Welcome to audaspace's documentation!
=====================================
.. automodule:: aud
:no-members:
This documentation is valid for both the Python and C bindings of audaspace. If you are looking for installation instructions check the `C++ API documentation <../index.html>`_. As C is not an object oriented language everything is accessible via functions where the first paramter is always the object. For methods these are named as ``AUD_ClassName_method()`` and properties are accessed via ``AUD_ClassName_property_get/set()``. Python users simply ``import aud`` to access the library.
@@ -18,7 +19,7 @@ This documentation is valid for both the Python and C bindings of audaspace. If
Classes:
.. toctree::
:maxdepth: 2
:maxdepth: 1
device
sound

View File

@@ -4,4 +4,5 @@ Sequence
.. currentmodule:: aud
.. autoclass:: Sequence
:members:
:noindex:

View File

@@ -4,4 +4,5 @@ Sequence Entry
.. currentmodule:: aud
.. autoclass:: SequenceEntry
:members:
:noindex:

View File

@@ -4,4 +4,5 @@ Sound
.. currentmodule:: aud
.. autoclass:: Sound
:members:
:noindex:

View File

@@ -40,7 +40,7 @@ and create a :func:`aud.Sound.sine` signal with a frequency of 440 Hz.
sine = aud.Sound.sine(440)
.. note:: At this point nothing is playing back yet,
:class:`aud.Sound` objects are just descriptions of sounds.
:class:`aud.Sound` objects are just descriptions of sounds.
However instead of a sine wave, we would like to have a square wave
to produce a more retro gaming sound. We could of course use the

View File

@@ -228,9 +228,9 @@ PyDoc_STRVAR(M_aud_DynamicMusic_position_doc,
static int
DynamicMusic_set_position(DynamicMusicP* self, PyObject* args, void* nothing)
{
float position;
double position;
if(!PyArg_Parse(args, "f:position", &position))
if(!PyArg_Parse(args, "d:position", &position))
return -1;
try
@@ -252,7 +252,7 @@ DynamicMusic_get_position(DynamicMusicP* self, void* nothing)
{
try
{
return Py_BuildValue("f", (*reinterpret_cast<std::shared_ptr<aud::DynamicMusic>*>(self->dynamicMusic))->getPosition());
return Py_BuildValue("d", (*reinterpret_cast<std::shared_ptr<aud::DynamicMusic>*>(self->dynamicMusic))->getPosition());
}
catch(aud::Exception& e)
{

View File

@@ -696,7 +696,7 @@ Handle_get_position(Handle* self, void* nothing)
{
try
{
return Py_BuildValue("f", (*reinterpret_cast<std::shared_ptr<IHandle>*>(self->handle))->getPosition());
return Py_BuildValue("d", (*reinterpret_cast<std::shared_ptr<IHandle>*>(self->handle))->getPosition());
}
catch(Exception& e)
{
@@ -708,9 +708,9 @@ Handle_get_position(Handle* self, void* nothing)
static int
Handle_set_position(Handle* self, PyObject* args, void* nothing)
{
float position;
double position;
if(!PyArg_Parse(args, "f:position", &position))
if(!PyArg_Parse(args, "d:position", &position))
return -1;
try

View File

@@ -104,11 +104,11 @@ PyDoc_STRVAR(M_aud_Sequence_add_doc,
" :arg sound: The sound this entry should play.\n"
" :type sound: :class:`Sound`\n"
" :arg begin: The start time.\n"
" :type begin: float\n"
" :type begin: double\n"
" :arg end: The end time or a negative value if determined by the sound.\n"
" :type end: float\n"
" :type end: double\n"
" :arg skip: How much seconds should be skipped at the beginning.\n"
" :type skip: float\n"
" :type skip: double\n"
" :return: The entry added.\n"
" :rtype: :class:`SequenceEntry`");
@@ -116,13 +116,13 @@ static PyObject *
Sequence_add(Sequence* self, PyObject* args, PyObject* kwds)
{
PyObject* object;
float begin;
float end = -1.0f;
float skip = 0.0f;
double begin;
double end = -1.0;
double skip = 0.0;
static const char* kwlist[] = {"sound", "begin", "end", "skip", nullptr};
if(!PyArg_ParseTupleAndKeywords(args, kwds, "Of|ff:add", const_cast<char**>(kwlist), &object, &begin, &end, &skip))
if(!PyArg_ParseTupleAndKeywords(args, kwds, "Od|dd:add", const_cast<char**>(kwlist), &object, &begin, &end, &skip))
return nullptr;
Sound* sound = checkSound(object);

View File

@@ -46,18 +46,18 @@ PyDoc_STRVAR(M_aud_SequenceEntry_move_doc,
".. classmethod:: move()\n\n"
" Moves the entry.\n\n"
" :arg begin: The new start time.\n"
" :type begin: float\n"
" :type begin: double\n"
" :arg end: The new end time or a negative value if unknown.\n"
" :type end: float\n"
" :type end: double\n"
" :arg skip: How many seconds to skip at the beginning.\n"
" :type skip: float\n");
" :type skip: double\n");
static PyObject *
SequenceEntry_move(SequenceEntry* self, PyObject* args)
{
float begin, end, skip;
double begin, end, skip;
if(!PyArg_ParseTuple(args, "fff:move", &begin, &end, &skip))
if(!PyArg_ParseTuple(args, "ddd:move", &begin, &end, &skip))
return nullptr;
try

View File

@@ -1394,7 +1394,7 @@ PyDoc_STRVAR(M_aud_Sound_threshold_doc,
" with a amplitude >= threshold to 1, all <= -threshold to -1 and\n"
" all between to 0.\n\n"
" :arg threshold: Threshold value over which an amplitude counts\n"
" non-zero.\n"
" non-zero.\n\n"
":type threshold: float\n"
":return: The created :class:`Sound` object.\n"
":rtype: :class:`Sound`");
@@ -1434,7 +1434,8 @@ PyDoc_STRVAR(M_aud_Sound_volume_doc,
" :type volume: float\n"
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`\n\n"
" .. note:: Should be in the range [0, 1] to avoid clipping.\n\n"
" .. note::\n\n"
" Should be in the range [0, 1] to avoid clipping.\n\n"
" .. note::\n\n"
" This is a filter function, you might consider using\n"
" :attr:`Handle.volume` instead.");
@@ -1475,8 +1476,8 @@ PyDoc_STRVAR(M_aud_Sound_join_doc,
" :return: The created :class:`Sound` object.\n"
" :rtype: :class:`Sound`\n\n"
" .. note::\n\n"
" The two factories have to have the same specifications\n"
" (channels and samplerate).");
" The two factories have to have the same specifications\n"
" (channels and samplerate).");
static PyObject *
Sound_join(Sound* self, PyObject* object)

View File

@@ -33,8 +33,8 @@ AUD_NAMESPACE_BEGIN
class AUD_API DefaultSynchronizer : public ISynchronizer
{
public:
virtual void seek(std::shared_ptr<IHandle> handle, float time);
virtual float getPosition(std::shared_ptr<IHandle> handle);
virtual void seek(std::shared_ptr<IHandle> handle, double time);
virtual double getPosition(std::shared_ptr<IHandle> handle);
virtual void play();
virtual void stop();
virtual void setSyncCallback(syncFunction function, void* data);

View File

@@ -35,6 +35,9 @@ AUD_NAMESPACE_BEGIN
class AUD_API IDeviceFactory
{
public:
/**
* Destroys the device factory.
*/
virtual ~IDeviceFactory() {}
/**

View File

@@ -105,14 +105,14 @@ public:
* - false if the handle is invalid.
* \warning Whether the seek works or not depends on the sound source.
*/
virtual bool seek(float position)=0;
virtual bool seek(double position)=0;
/**
* Retrieves the current playback position of a sound.
* \return The playback position in seconds, or 0.0 if the handle is
* invalid.
*/
virtual float getPosition()=0;
virtual double getPosition()=0;
/**
* Returns the status of a played back sound.

View File

@@ -56,14 +56,14 @@ public:
* @param handle The handle that should be synchronized/seeked.
* @param time The absolute time to synchronize to.
*/
virtual void seek(std::shared_ptr<IHandle> handle, float time) = 0;
virtual void seek(std::shared_ptr<IHandle> handle, double time) = 0;
/**
* Retrieves the position of the synchronizer.
* @param handle The handle which is synchronized.
* @return The position in seconds.
*/
virtual float getPosition(std::shared_ptr<IHandle> handle) = 0;
virtual double getPosition(std::shared_ptr<IHandle> handle) = 0;
/**
* Starts the synchronizer playback.

View File

@@ -53,8 +53,8 @@ private:
virtual bool stop();
virtual bool getKeep();
virtual bool setKeep(bool keep);
virtual bool seek(float position);
virtual float getPosition();
virtual bool seek(double position);
virtual double getPosition();
virtual Status getStatus();
virtual float getVolume();
virtual bool setVolume(float volume);

View File

@@ -180,8 +180,8 @@ protected:
virtual bool stop();
virtual bool getKeep();
virtual bool setKeep(bool keep);
virtual bool seek(float position);
virtual float getPosition();
virtual bool seek(double position);
virtual double getPosition();
virtual Status getStatus();
virtual float getVolume();
virtual bool setVolume(float volume);

View File

@@ -40,7 +40,10 @@ class Buffer;
class AUD_API IFileInput
{
public:
virtual ~IFileInput() {};
/**
* Destroys the file input.
*/
virtual ~IFileInput() {}
/**
* Creates a reader for a file to be read.

View File

@@ -35,7 +35,7 @@ private:
/**
* The delay in samples.
*/
const float m_delay;
const double m_delay;
// delete copy constructor and operator=
Delay(const Delay&) = delete;
@@ -47,12 +47,12 @@ public:
* \param sound The input sound.
* \param delay The desired delay in seconds.
*/
Delay(std::shared_ptr<ISound> sound, float delay = 0);
Delay(std::shared_ptr<ISound> sound, double delay = 0);
/**
* Returns the delay in seconds.
*/
float getDelay() const;
double getDelay() const;
virtual std::shared_ptr<IReader> createReader();
};

View File

@@ -52,7 +52,7 @@ public:
* \param reader The reader to read from.
* \param delay The delay in seconds.
*/
DelayReader(std::shared_ptr<IReader> reader, float delay);
DelayReader(std::shared_ptr<IReader> reader, double delay);
virtual void seek(int position);
virtual int getLength() const;

View File

@@ -55,7 +55,7 @@ private:
/**
* Length of the crossfade transition in seconds, used when no custom transition has been set.
*/
float m_fadeTime;
double m_fadeTime;
/**
* Handle to the playback of the current scene.
@@ -145,13 +145,13 @@ public:
* Sets the length of the crossfade transition (default 1 second).
* \param seconds The time in seconds.
*/
void setFadeTime(float seconds);
void setFadeTime(double seconds);
/**
* Gets the length of the crossfade transition (default 1 second).
* \return The length of the cressfade transition in seconds.
*/
float getFadeTime();
double getFadeTime();
/**
* Resumes a paused sound.
@@ -177,14 +177,14 @@ public:
* - false if the handle is invalid.
* \warning Whether the seek works or not depends on the sound source.
*/
bool seek(float position);
bool seek(double position);
/**
* Retrieves the current playback position of a sound.
* \return The playback position in seconds, or 0.0 if the handle is
* invalid.
*/
float getPosition();
double getPosition();
/**
* Retrieves the volume of the scenes.

View File

@@ -43,12 +43,12 @@ private:
/**
* The fading start.
*/
const float m_start;
const double m_start;
/**
* The fading length.
*/
const float m_length;
const double m_length;
// delete copy constructor and operator=
Fader(const Fader&) = delete;
@@ -64,7 +64,7 @@ public:
*/
Fader(std::shared_ptr<ISound> sound,
FadeType type = FADE_IN,
float start = 0.0f, float length = 1.0f);
double start = 0, double length = 1);
/**
* Returns the fading type.
@@ -74,12 +74,12 @@ public:
/**
* Returns the fading start.
*/
float getStart() const;
double getStart() const;
/**
* Returns the fading length.
*/
float getLength() const;
double getLength() const;
virtual std::shared_ptr<IReader> createReader();
};

View File

@@ -49,12 +49,12 @@ private:
/**
* The fading start.
*/
const float m_start;
const double m_start;
/**
* The fading length.
*/
const float m_length;
const double m_length;
// delete copy constructor and operator=
FaderReader(const FaderReader&) = delete;
@@ -69,7 +69,7 @@ public:
* \param length How long fading should last in seconds.
*/
FaderReader(std::shared_ptr<IReader> reader, FadeType type,
float start,float length);
double start,double length);
virtual void read(int& length, bool& eos, sample_t* buffer);
};

View File

@@ -35,12 +35,12 @@ private:
/**
* The start time.
*/
const float m_start;
const double m_start;
/**
* The end time.
*/
const float m_end;
const double m_end;
// delete copy constructor and operator=
Limiter(const Limiter&) = delete;
@@ -55,17 +55,17 @@ public:
* play to the end.
*/
Limiter(std::shared_ptr<ISound> sound,
float start = 0, float end = -1);
double start = 0, double end = -1);
/**
* Returns the start time.
*/
float getStart() const;
double getStart() const;
/**
* Returns the end time.
*/
float getEnd() const;
double getEnd() const;
virtual std::shared_ptr<IReader> createReader();
};

View File

@@ -35,12 +35,12 @@ private:
/**
* The start sample: inclusive.
*/
const float m_start;
const double m_start;
/**
* The end sample: exlusive.
*/
const float m_end;
const double m_end;
// delete copy constructor and operator=
LimiterReader(const LimiterReader&) = delete;
@@ -54,7 +54,7 @@ public:
* \param end The desired end time (sample exklusive), a negative value
* signals that it should play to the end.
*/
LimiterReader(std::shared_ptr<IReader> reader, float start = 0, float end = -1);
LimiterReader(std::shared_ptr<IReader> reader, double start = 0, double end = -1);
virtual void seek(int position);
virtual int getLength() const;

View File

@@ -151,7 +151,7 @@ public:
* \param skip How much seconds should be skipped at the beginning.
* \return The entry added.
*/
std::shared_ptr<SequenceEntry> add(std::shared_ptr<ISound> sound, float begin, float end, float skip);
std::shared_ptr<SequenceEntry> add(std::shared_ptr<ISound> sound, double begin, double end, double skip);
/**
* Removes an entry from the scene.

View File

@@ -203,7 +203,7 @@ public:
* \param skip How much seconds should be skipped at the beginning.
* \return The entry added.
*/
std::shared_ptr<SequenceEntry> add(std::shared_ptr<ISound> sound, float begin, float end, float skip);
std::shared_ptr<SequenceEntry> add(std::shared_ptr<ISound> sound, double begin, double end, double skip);
/**
* Removes an entry from the scene.

View File

@@ -55,13 +55,13 @@ private:
std::shared_ptr<ISound> m_sound;
/// The begin time.
float m_begin;
double m_begin;
/// The end time.
float m_end;
double m_end;
/// How many seconds are skipped at the beginning.
float m_skip;
double m_skip;
/// Whether the entry is muted.
bool m_muted;
@@ -124,7 +124,7 @@ public:
* \param skip How much seconds should be skipped at the beginning.
* \param id The ID of the entry.
*/
SequenceEntry(std::shared_ptr<ISound> sound, float begin, float end, float skip, int id);
SequenceEntry(std::shared_ptr<ISound> sound, double begin, double end, double skip, int id);
virtual ~SequenceEntry();
/**
@@ -155,7 +155,7 @@ public:
* \param end The new end time or a negative value if unknown.
* \param skip How many seconds to skip at the beginning.
*/
void move(float begin, float end, float skip);
void move(double begin, double end, double skip);
/**
* Retrieves the muting state of the entry.

View File

@@ -292,7 +292,7 @@ void JackDevice::stopPlayback()
m_nextState = JackTransportStopped;
}
void JackDevice::seekPlayback(float time)
void JackDevice::seekPlayback(double time)
{
if(time >= 0.0f)
AUD_jack_transport_locate(m_client, time * m_specs.rate);
@@ -304,11 +304,11 @@ void JackDevice::setSyncCallback(ISynchronizer::syncFunction sync, void* data)
m_syncFuncData = data;
}
float JackDevice::getPlaybackPosition()
double JackDevice::getPlaybackPosition()
{
jack_position_t position;
AUD_jack_transport_query(m_client, &position);
return position.frame / (float) m_specs.rate;
return position.frame / (double) m_specs.rate;
}
bool JackDevice::doesPlayback()

View File

@@ -174,7 +174,7 @@ public:
* Seeks jack transport playback.
* \param time The time to seek to.
*/
void seekPlayback(float time);
void seekPlayback(double time);
/**
* Sets the sync callback for jack transport playback.
@@ -187,7 +187,7 @@ public:
* Retrieves the jack transport playback time.
* \return The current time position.
*/
float getPlaybackPosition();
double getPlaybackPosition();
/**
* Returns whether jack transport plays back.

View File

@@ -25,12 +25,12 @@ JackSynchronizer::JackSynchronizer(JackDevice* device) :
{
}
void JackSynchronizer::seek(std::shared_ptr<IHandle> handle, float time)
void JackSynchronizer::seek(std::shared_ptr<IHandle> handle, double time)
{
m_device->seekPlayback(time);
}
float JackSynchronizer::getPosition(std::shared_ptr<IHandle> handle)
double JackSynchronizer::getPosition(std::shared_ptr<IHandle> handle)
{
return m_device->getPlaybackPosition();
}

View File

@@ -48,8 +48,8 @@ public:
*/
JackSynchronizer(JackDevice* device);
virtual void seek(std::shared_ptr<IHandle> handle, float time);
virtual float getPosition(std::shared_ptr<IHandle> handle);
virtual void seek(std::shared_ptr<IHandle> handle, double time);
virtual double getPosition(std::shared_ptr<IHandle> handle);
virtual void play();
virtual void stop();
virtual void setSyncCallback(syncFunction function, void* data);

View File

@@ -269,7 +269,7 @@ bool OpenALDevice::OpenALHandle::setKeep(bool keep)
return true;
}
bool OpenALDevice::OpenALHandle::seek(float position)
bool OpenALDevice::OpenALHandle::seek(double position)
{
if(!m_status)
return false;
@@ -335,7 +335,7 @@ bool OpenALDevice::OpenALHandle::seek(float position)
return true;
}
float OpenALDevice::OpenALHandle::getPosition()
double OpenALDevice::OpenALHandle::getPosition()
{
if(!m_status)
return false;

View File

@@ -126,8 +126,8 @@ private:
virtual bool stop();
virtual bool getKeep();
virtual bool setKeep(bool keep);
virtual bool seek(float position);
virtual float getPosition();
virtual bool seek(double position);
virtual double getPosition();
virtual Status getStatus();
virtual float getVolume();
virtual bool setVolume(float volume);

View File

@@ -19,12 +19,12 @@
AUD_NAMESPACE_BEGIN
void DefaultSynchronizer::seek(std::shared_ptr<IHandle> handle, float time)
void DefaultSynchronizer::seek(std::shared_ptr<IHandle> handle, double time)
{
handle->seek(time);
}
float DefaultSynchronizer::getPosition(std::shared_ptr<IHandle> handle)
double DefaultSynchronizer::getPosition(std::shared_ptr<IHandle> handle)
{
return handle->getPosition();
}

View File

@@ -52,12 +52,12 @@ bool NULLDevice::NULLHandle::setKeep(bool keep)
return false;
}
bool NULLDevice::NULLHandle::seek(float position)
bool NULLDevice::NULLHandle::seek(double position)
{
return false;
}
float NULLDevice::NULLHandle::getPosition()
double NULLDevice::NULLHandle::getPosition()
{
return std::numeric_limits<float>::quiet_NaN();
}

View File

@@ -347,7 +347,7 @@ bool SoftwareDevice::SoftwareHandle::setKeep(bool keep)
return true;
}
bool SoftwareDevice::SoftwareHandle::seek(float position)
bool SoftwareDevice::SoftwareHandle::seek(double position)
{
if(!m_status)
return false;
@@ -366,7 +366,7 @@ bool SoftwareDevice::SoftwareHandle::seek(float position)
return true;
}
float SoftwareDevice::SoftwareHandle::getPosition()
double SoftwareDevice::SoftwareHandle::getPosition()
{
if(!m_status)
return false;
@@ -376,7 +376,7 @@ float SoftwareDevice::SoftwareHandle::getPosition()
if(!m_status)
return 0.0f;
float position = m_reader->getPosition() / (float)m_device->m_specs.rate;
double position = m_reader->getPosition() / (double)m_device->m_specs.rate;
return position;
}

View File

@@ -19,13 +19,13 @@
AUD_NAMESPACE_BEGIN
Delay::Delay(std::shared_ptr<ISound> sound, float delay) :
Delay::Delay(std::shared_ptr<ISound> sound, double delay) :
Effect(sound),
m_delay(delay)
{
}
float Delay::getDelay() const
double Delay::getDelay() const
{
return m_delay;
}

View File

@@ -20,7 +20,7 @@
AUD_NAMESPACE_BEGIN
DelayReader::DelayReader(std::shared_ptr<IReader> reader, float delay) :
DelayReader::DelayReader(std::shared_ptr<IReader> reader, double delay) :
EffectReader(reader),
m_delay(int((SampleRate)delay * reader->getSpecs().rate)),
m_remdelay(int((SampleRate)delay * reader->getSpecs().rate))

View File

@@ -133,14 +133,14 @@ bool DynamicMusic::addTransition(int init, int end, std::shared_ptr<ISound> soun
return false;
}
void DynamicMusic::setFadeTime(float seconds)
void DynamicMusic::setFadeTime(double seconds)
{
m_device->lock();
m_fadeTime = seconds;
m_device->unlock();
}
float DynamicMusic::getFadeTime()
double DynamicMusic::getFadeTime()
{
return m_fadeTime;
}
@@ -169,7 +169,7 @@ bool DynamicMusic::pause()
return result || resultTrans;
}
bool DynamicMusic::seek(float position)
bool DynamicMusic::seek(double position)
{
bool result = false;
@@ -183,9 +183,9 @@ bool DynamicMusic::seek(float position)
return result;
}
float DynamicMusic::getPosition()
double DynamicMusic::getPosition()
{
float result = 0.0f;
double result = 0.0f;
if(m_currentHandle != nullptr)
result = m_currentHandle->getPosition();

View File

@@ -18,7 +18,7 @@
AUD_NAMESPACE_BEGIN
Fader::Fader(std::shared_ptr<ISound> sound, FadeType type, float start, float length) :
Fader::Fader(std::shared_ptr<ISound> sound, FadeType type, double start, double length) :
Effect(sound),
m_type(type),
m_start(start),
@@ -31,12 +31,12 @@ FadeType Fader::getType() const
return m_type;
}
float Fader::getStart() const
double Fader::getStart() const
{
return m_start;
}
float Fader::getLength() const
double Fader::getLength() const
{
return m_length;
}

View File

@@ -20,7 +20,7 @@
AUD_NAMESPACE_BEGIN
FaderReader::FaderReader(std::shared_ptr<IReader> reader, FadeType type, float start,float length) :
FaderReader::FaderReader(std::shared_ptr<IReader> reader, FadeType type, double start, double length) :
EffectReader(reader),
m_type(type),
m_start(start),
@@ -36,14 +36,14 @@ void FaderReader::read(int& length, bool& eos, sample_t* buffer)
m_reader->read(length, eos, buffer);
if((position + length) / (float)specs.rate <= m_start)
if((position + length) / specs.rate <= m_start)
{
if(m_type != FADE_OUT)
{
std::memset(buffer, 0, length * samplesize);
}
}
else if(position / (float)specs.rate >= m_start+m_length)
else if(position / specs.rate >= m_start+m_length)
{
if(m_type == FADE_OUT)
{
@@ -58,7 +58,7 @@ void FaderReader::read(int& length, bool& eos, sample_t* buffer)
{
if(i % specs.channels == 0)
{
volume = (((position+i)/(float)specs.rate)-m_start) / m_length;
volume = float((((position + i) / specs.rate) - m_start) / m_length);
if(volume > 1.0f)
volume = 1.0f;
else if(volume < 0.0f)

View File

@@ -20,19 +20,19 @@
AUD_NAMESPACE_BEGIN
Limiter::Limiter(std::shared_ptr<ISound> sound,
float start, float end) :
double start, double end) :
Effect(sound),
m_start(start),
m_end(end)
{
}
float Limiter::getStart() const
double Limiter::getStart() const
{
return m_start;
}
float Limiter::getEnd() const
double Limiter::getEnd() const
{
return m_end;
}

View File

@@ -21,7 +21,7 @@
AUD_NAMESPACE_BEGIN
LimiterReader::LimiterReader(std::shared_ptr<IReader> reader, float start, float end) :
LimiterReader::LimiterReader(std::shared_ptr<IReader> reader, double start, double end) :
EffectReader(reader),
m_start(start),
m_end(end)

View File

@@ -16,9 +16,9 @@
#include "respec/ChannelMapperReader.h"
#include <algorithm>
#include <cmath>
#include <limits>
#include <algorithm>
AUD_NAMESPACE_BEGIN

View File

@@ -66,11 +66,11 @@ void Mixer::setSpecs(Specs specs)
void Mixer::clear(int length)
{
m_buffer.assureSize(length * m_specs.channels * AUD_SAMPLE_SIZE(m_specs));
m_buffer.assureSize(length * AUD_SAMPLE_SIZE(m_specs));
m_length = length;
std::memset(m_buffer.getBuffer(), 0, length * m_specs.channels * AUD_SAMPLE_SIZE(m_specs));
std::memset(m_buffer.getBuffer(), 0, length * AUD_SAMPLE_SIZE(m_specs));
}
void Mixer::mix(sample_t* buffer, int start, int length, float volume)

View File

@@ -90,7 +90,7 @@ AnimateableProperty* Sequence::getAnimProperty(AnimateablePropertyType type)
return m_sequence->getAnimProperty(type);
}
std::shared_ptr<SequenceEntry> Sequence::add(std::shared_ptr<ISound> sound, float begin, float end, float skip)
std::shared_ptr<SequenceEntry> Sequence::add(std::shared_ptr<ISound> sound, double begin, double end, double skip)
{
return m_sequence->add(sound, begin, end, skip);
}

View File

@@ -149,7 +149,7 @@ AnimateableProperty* SequenceData::getAnimProperty(AnimateablePropertyType type)
}
}
std::shared_ptr<SequenceEntry> SequenceData::add(std::shared_ptr<ISound> sound, float begin, float end, float skip)
std::shared_ptr<SequenceEntry> SequenceData::add(std::shared_ptr<ISound> sound, double begin, double end, double skip)
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);

View File

@@ -22,7 +22,7 @@
AUD_NAMESPACE_BEGIN
SequenceEntry::SequenceEntry(std::shared_ptr<ISound> sound, float begin, float end, float skip, int id) :
SequenceEntry::SequenceEntry(std::shared_ptr<ISound> sound, double begin, double end, double skip, int id) :
m_status(0),
m_pos_status(1),
m_sound_status(0),
@@ -84,7 +84,7 @@ void SequenceEntry::setSound(std::shared_ptr<ISound> sound)
}
}
void SequenceEntry::move(float begin, float end, float skip)
void SequenceEntry::move(double begin, double end, double skip)
{
std::lock_guard<std::recursive_mutex> lock(m_mutex);

View File

@@ -57,7 +57,7 @@ void SequenceHandle::start()
m_valid = m_handle.get();
}
bool SequenceHandle::updatePosition(float position)
bool SequenceHandle::updatePosition(double position)
{
std::lock_guard<ILockable> lock(*m_entry);
@@ -140,7 +140,7 @@ void SequenceHandle::stop()
m_3dhandle = nullptr;
}
void SequenceHandle::update(float position, float frame, float fps)
void SequenceHandle::update(double position, float frame, float fps)
{
if(m_sound_status != m_entry->m_sound_status)
{
@@ -229,7 +229,7 @@ void SequenceHandle::update(float position, float frame, float fps)
m_handle->setVolume(0);
}
bool SequenceHandle::seek(float position)
bool SequenceHandle::seek(double position)
{
if(!m_valid)
// sound not valid, aborting
@@ -240,7 +240,7 @@ bool SequenceHandle::seek(float position)
return false;
std::lock_guard<ILockable> lock(*m_entry);
float seekpos = position - m_entry->m_begin;
double seekpos = position - m_entry->m_begin;
if(seekpos < 0)
seekpos = 0;
seekpos += m_entry->m_skip;

View File

@@ -71,7 +71,7 @@ private:
* \param position Current playback position in seconds.
* \return Whether the handle is valid.
*/
bool updatePosition(float position);
bool updatePosition(double position);
public:
/**
@@ -104,14 +104,14 @@ public:
* \param frame The current frame during playback.
* \param fps The animation frames per second.
*/
void update(float position, float frame, float fps);
void update(double position, float frame, float fps);
/**
* Seeks the handle to a specific time position.
* \param position The time to seek to.
* \return Whether the handle is valid.
*/
bool seek(float position);
bool seek(double position);
};
AUD_NAMESPACE_END

View File

@@ -49,7 +49,7 @@ void SequenceReader::seek(int position)
for(auto& handle : m_handles)
{
handle->seek(position / m_sequence->m_specs.rate);
handle->seek(position / (double)m_sequence->m_specs.rate);
}
}
@@ -150,13 +150,12 @@ void SequenceReader::read(int& length, bool& eos, sample_t* buffer)
Specs specs = m_sequence->m_specs;
int pos = 0;
float time = float(m_position) / float(specs.rate);
double time = double(m_position) / double(specs.rate);
float volume, frame;
int len, cfra;
Vector3 v, v2;
Quaternion q;
while(pos < length)
{
frame = time * m_sequence->m_fps;
@@ -187,7 +186,7 @@ void SequenceReader::read(int& length, bool& eos, sample_t* buffer)
m_device.read(reinterpret_cast<data_t*>(buffer + specs.channels * pos), len);
pos += len;
time += float(len) / float(specs.rate);
time += double(len) / double(specs.rate);
}
m_position += length;

File diff suppressed because it is too large Load Diff

View File

@@ -27,8 +27,14 @@
#include <atomic>
#include <cassert>
#include <string>
#include <unordered_map>
#include <vector>
using std::atomic;
using std::string;
using std::unordered_map;
using std::vector;
struct MANTA {
public:
MANTA(int *res, struct FluidModifierData *mmd);
@@ -58,20 +64,20 @@ struct MANTA {
void step(struct FluidModifierData *mmd, int startFrame);
// Grid initialization functions
void initHeat(struct FluidModifierData *mmd);
void initFire(struct FluidModifierData *mmd);
void initColors(struct FluidModifierData *mmd);
void initFireHigh(struct FluidModifierData *mmd);
void initColorsHigh(struct FluidModifierData *mmd);
void initLiquid(FluidModifierData *mmd);
void initLiquidMesh(FluidModifierData *mmd);
void initObstacle(FluidModifierData *mmd);
void initGuiding(FluidModifierData *mmd);
void initFractions(FluidModifierData *mmd);
void initInVelocity(FluidModifierData *mmd);
void initOutflow(FluidModifierData *mmd);
void initSndParts(FluidModifierData *mmd);
void initLiquidSndParts(FluidModifierData *mmd);
void initHeat(struct FluidModifierData *mmd = NULL);
void initFire(struct FluidModifierData *mmd = NULL);
void initColors(struct FluidModifierData *mmd = NULL);
void initFireHigh(struct FluidModifierData *mmd = NULL);
void initColorsHigh(struct FluidModifierData *mmd = NULL);
void initLiquid(FluidModifierData *mmd = NULL);
void initLiquidMesh(FluidModifierData *mmd = NULL);
void initObstacle(FluidModifierData *mmd = NULL);
void initGuiding(FluidModifierData *mmd = NULL);
void initFractions(FluidModifierData *mmd = NULL);
void initInVelocity(FluidModifierData *mmd = NULL);
void initOutflow(FluidModifierData *mmd = NULL);
void initSndParts(FluidModifierData *mmd = NULL);
void initLiquidSndParts(FluidModifierData *mmd = NULL);
// Pointer transfer: Mantaflow -> Blender
void updatePointers();
@@ -414,7 +420,7 @@ struct MANTA {
return mPhi;
}
static std::atomic<int> solverID;
static atomic<int> solverID;
static int with_debug; // on or off (1 or 0), also sets manta debug level
// Mesh getters
@@ -741,6 +747,8 @@ struct MANTA {
size_t mTotalCellsMesh;
size_t mTotalCellsParticles;
unordered_map<string, string> mRNAMap;
int mCurrentID;
bool mUsingHeat;
@@ -852,45 +860,46 @@ struct MANTA {
float *mPhi;
// Mesh fields
std::vector<Node> *mMeshNodes;
std::vector<Triangle> *mMeshTriangles;
std::vector<pVel> *mMeshVelocities;
vector<Node> *mMeshNodes;
vector<Triangle> *mMeshTriangles;
vector<pVel> *mMeshVelocities;
// Particle fields
std::vector<pData> *mFlipParticleData;
std::vector<pVel> *mFlipParticleVelocity;
vector<pData> *mFlipParticleData;
vector<pVel> *mFlipParticleVelocity;
std::vector<pData> *mSndParticleData;
std::vector<pVel> *mSndParticleVelocity;
std::vector<float> *mSndParticleLife;
vector<pData> *mSndParticleData;
vector<pVel> *mSndParticleVelocity;
vector<float> *mSndParticleLife;
void initDomain(struct FluidModifierData *mmd);
void initNoise(struct FluidModifierData *mmd);
void initMesh(struct FluidModifierData *mmd);
void initSmoke(struct FluidModifierData *mmd);
void initSmokeNoise(struct FluidModifierData *mmd);
void initializeRNAMap(struct FluidModifierData *mmd = NULL);
void initDomain(struct FluidModifierData *mmd = NULL);
void initNoise(struct FluidModifierData *mmd = NULL);
void initMesh(struct FluidModifierData *mmd = NULL);
void initSmoke(struct FluidModifierData *mmd = NULL);
void initSmokeNoise(struct FluidModifierData *mmd = NULL);
void initializeMantaflow();
void terminateMantaflow();
bool runPythonString(std::vector<std::string> commands);
std::string getRealValue(const std::string &varName, FluidModifierData *mmd);
std::string parseLine(const std::string &line, FluidModifierData *mmd);
std::string parseScript(const std::string &setup_string, FluidModifierData *mmd = NULL);
bool updateMeshFromBobj(std::string filename);
bool updateMeshFromObj(std::string filename);
bool updateMeshFromUni(std::string filename);
bool updateParticlesFromUni(std::string filename, bool isSecondarySys, bool isVelData);
bool updateGridFromUni(std::string filename, float *grid, bool isNoise);
bool updateGridFromVDB(std::string filename, float *grid, bool isNoise);
bool updateGridFromRaw(std::string filename, float *grid, bool isNoise);
bool updateMeshFromFile(std::string filename);
bool updateParticlesFromFile(std::string filename, bool isSecondarySys, bool isVelData);
bool updateGridFromFile(std::string filename, float *grid, bool isNoise);
std::string getDirectory(struct FluidModifierData *mmd, std::string subdirectory);
std::string getFile(struct FluidModifierData *mmd,
std::string subdirectory,
std::string fname,
std::string extension,
int framenr);
bool runPythonString(vector<string> commands);
string getRealValue(const string &varName);
string parseLine(const string &line);
string parseScript(const string &setup_string, FluidModifierData *mmd = NULL);
bool updateMeshFromBobj(string filename);
bool updateMeshFromObj(string filename);
bool updateMeshFromUni(string filename);
bool updateParticlesFromUni(string filename, bool isSecondarySys, bool isVelData);
bool updateGridFromUni(string filename, float *grid, bool isNoise);
bool updateGridFromVDB(string filename, float *grid, bool isNoise);
bool updateGridFromRaw(string filename, float *grid, bool isNoise);
bool updateMeshFromFile(string filename);
bool updateParticlesFromFile(string filename, bool isSecondarySys, bool isVelData);
bool updateGridFromFile(string filename, float *grid, bool isNoise);
string getDirectory(struct FluidModifierData *mmd, string subdirectory);
string getFile(struct FluidModifierData *mmd,
string subdirectory,
string fname,
string extension,
int framenr);
};
#endif

View File

@@ -1821,6 +1821,10 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col.prop(md, "thresh", text="Threshold")
col.prop(md, "face_influence")
def SIMULATION(self, layout, ob, md):
layout.prop(md, "simulation")
layout.prop(md, "data_path")
class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
bl_label = "Modifiers"

View File

@@ -23,9 +23,12 @@ extern "C" {
struct Main;
struct Simulation;
struct Depsgraph;
void *BKE_simulation_add(struct Main *bmain, const char *name);
void BKE_simulation_data_update(struct Depsgraph *depsgraph, struct Scene *scene);
#ifdef __cplusplus
}
#endif

View File

@@ -164,7 +164,7 @@ void BKE_sound_stop_scene(struct Scene *scene);
void BKE_sound_seek_scene(struct Main *bmain, struct Scene *scene);
float BKE_sound_sync_scene(struct Scene *scene);
double BKE_sound_sync_scene(struct Scene *scene);
int BKE_sound_scene_playing(struct Scene *scene);
@@ -180,10 +180,10 @@ float BKE_sound_get_length(struct Main *bmain, struct bSound *sound);
char **BKE_sound_get_device_names(void);
typedef void (*SoundJackSyncCallback)(struct Main *bmain, int mode, float time);
typedef void (*SoundJackSyncCallback)(struct Main *bmain, int mode, double time);
void BKE_sound_jack_sync_callback_set(SoundJackSyncCallback callback);
void BKE_sound_jack_scene_update(struct Scene *scene, int mode, float time);
void BKE_sound_jack_scene_update(struct Scene *scene, int mode, double time);
/* Dependency graph evaluation. */

View File

@@ -597,7 +597,7 @@ void BKE_gpencil_brush_preset_set(Main *bmain, Brush *brush, const short type)
}
case GP_BRUSH_PRESET_MARKER_CHISEL: {
brush->size = 150.0f;
brush->gpencil_settings->flag &= ~GP_BRUSH_USE_PRESSURE;
brush->gpencil_settings->flag |= GP_BRUSH_USE_PRESSURE;
brush->gpencil_settings->draw_strength = 1.0f;

View File

@@ -22,6 +22,7 @@
#include "DNA_ID.h"
#include "DNA_defaults.h"
#include "DNA_scene_types.h"
#include "DNA_simulation_types.h"
#include "BLI_compiler_compat.h"
@@ -44,6 +45,8 @@
#include "BLT_translation.h"
#include "DEG_depsgraph.h"
static void simulation_init_data(ID *id)
{
Simulation *simulation = (Simulation *)id;
@@ -108,3 +111,7 @@ IDTypeInfo IDType_ID_SIM = {
/* free_data */ simulation_free_data,
/* make_local */ nullptr,
};
void BKE_simulation_data_update(Depsgraph *UNUSED(depsgraph), Scene *UNUSED(scene))
{
}

View File

@@ -751,12 +751,12 @@ static void sound_start_play_scene(Scene *scene)
}
}
static float get_cur_time(Scene *scene)
static double get_cur_time(Scene *scene)
{
/* We divide by the current framelen to take into account time remapping.
* Otherwise we will get the wrong starting time which will break A/V sync.
* See T74111 for further details. */
return FRA2TIME((CFRA + SUBFRA) / scene->r.framelen);
return FRA2TIME((CFRA + SUBFRA) / (double)scene->r.framelen);
}
void BKE_sound_play_scene(Scene *scene)
@@ -764,7 +764,7 @@ void BKE_sound_play_scene(Scene *scene)
sound_verify_evaluated_id(&scene->id);
AUD_Status status;
const float cur_time = get_cur_time(scene);
const double cur_time = get_cur_time(scene);
AUD_Device_lock(sound_device);
@@ -811,8 +811,8 @@ void BKE_sound_seek_scene(Main *bmain, Scene *scene)
bScreen *screen;
int animation_playing;
const float one_frame = (float)(1.0 / FPS);
const float cur_time = FRA2TIME(CFRA);
const double one_frame = 1.0 / FPS;
const double cur_time = FRA2TIME(CFRA);
AUD_Device_lock(sound_device);
@@ -869,7 +869,7 @@ void BKE_sound_seek_scene(Main *bmain, Scene *scene)
AUD_Device_unlock(sound_device);
}
float BKE_sound_sync_scene(Scene *scene)
double BKE_sound_sync_scene(Scene *scene)
{
sound_verify_evaluated_id(&scene->id);
@@ -1230,7 +1230,7 @@ void BKE_sound_stop_scene(Scene *UNUSED(scene))
void BKE_sound_seek_scene(Main *UNUSED(bmain), Scene *UNUSED(scene))
{
}
float BKE_sound_sync_scene(Scene *UNUSED(scene))
double BKE_sound_sync_scene(Scene *UNUSED(scene))
{
return NAN_FLT;
}
@@ -1341,7 +1341,7 @@ void BKE_sound_jack_sync_callback_set(SoundJackSyncCallback callback)
#endif
}
void BKE_sound_jack_scene_update(Scene *scene, int mode, float time)
void BKE_sound_jack_scene_update(Scene *scene, int mode, double time)
{
sound_verify_evaluated_id(&scene->id);

View File

@@ -80,7 +80,7 @@ class Array {
m_allocator = other.m_allocator;
m_data = this->get_buffer_for_size(other.size());
copy_n(other.begin(), m_size, m_data);
uninitialized_copy_n(other.begin(), m_size, m_data);
}
Array(Array &&other) noexcept
@@ -202,6 +202,11 @@ class Array {
return IndexRange(m_size);
}
Allocator &allocator()
{
return m_allocator;
}
private:
T *get_buffer_for_size(uint size)
{

View File

@@ -30,14 +30,14 @@ extern "C" {
struct rcti;
void BLI_lasso_boundbox(struct rcti *rect, const int mcords[][2], const unsigned int moves);
bool BLI_lasso_is_point_inside(const int mcords[][2],
const unsigned int moves,
void BLI_lasso_boundbox(struct rcti *rect, const int mcoords[][2], const unsigned int mcoords_len);
bool BLI_lasso_is_point_inside(const int mcoords[][2],
const unsigned int mcoords_len,
const int sx,
const int sy,
const int error_value);
bool BLI_lasso_is_edge_inside(const int mcords[][2],
const unsigned int moves,
bool BLI_lasso_is_edge_inside(const int mcoords[][2],
const unsigned int mcoords_len,
int x0,
int y0,
int x1,

View File

@@ -34,6 +34,7 @@
#include <cmath>
#include "BLI_allocator.hh"
#include "BLI_array.hh"
#include "BLI_math_base.h"
#include "BLI_memory_utils.hh"
#include "BLI_utildefines.h"
@@ -114,8 +115,6 @@ class OpenAddressingArray {
* m_slots_set_or_dummy < m_slots_total
*/
/* Array containing the actual hash table. Might be a pointer to the inlined storage. */
Item *m_items;
/* Number of items in the hash table. Must be a power of two. */
uint32_t m_item_amount;
/* Exponent of the current item amount. */
@@ -130,9 +129,8 @@ class OpenAddressingArray {
uint32_t m_slots_usable;
/* Can be used to map a hash value into the range of valid slot indices. */
uint32_t m_slot_mask;
Allocator m_allocator;
AlignedBuffer<(uint)sizeof(Item) * s_items_in_small_storage, (uint)alignof(Item)>
m_local_storage;
Array<Item, s_items_in_small_storage, Allocator> m_items;
public:
explicit OpenAddressingArray(uint8_t item_exponent = s_small_storage_item_exponent)
@@ -147,51 +145,12 @@ class OpenAddressingArray {
(uint64_t)s_max_load_factor_numerator,
(uint64_t)s_max_load_factor_denominator);
if (m_item_amount <= s_items_in_small_storage) {
m_items = this->small_storage();
}
else {
m_items = (Item *)m_allocator.allocate_aligned(
(uint32_t)sizeof(Item) * m_item_amount, std::alignment_of<Item>::value, __func__);
}
for (uint32_t i = 0; i < m_item_amount; i++) {
new (m_items + i) Item();
}
m_items = Array<Item, s_items_in_small_storage, Allocator>(m_item_amount);
}
~OpenAddressingArray()
{
if (m_items != nullptr) {
for (uint32_t i = 0; i < m_item_amount; i++) {
m_items[i].~Item();
}
if (!this->is_in_small_storage()) {
m_allocator.deallocate((void *)m_items);
}
}
}
~OpenAddressingArray() = default;
OpenAddressingArray(const OpenAddressingArray &other)
{
m_slots_total = other.m_slots_total;
m_slots_set_or_dummy = other.m_slots_set_or_dummy;
m_slots_dummy = other.m_slots_dummy;
m_slots_usable = other.m_slots_usable;
m_slot_mask = other.m_slot_mask;
m_item_amount = other.m_item_amount;
m_item_exponent = other.m_item_exponent;
if (m_item_amount <= s_items_in_small_storage) {
m_items = this->small_storage();
}
else {
m_items = (Item *)m_allocator.allocate_aligned(
sizeof(Item) * m_item_amount, std::alignment_of<Item>::value, __func__);
}
uninitialized_copy_n(other.m_items, m_item_amount, m_items);
}
OpenAddressingArray(const OpenAddressingArray &other) = default;
OpenAddressingArray(OpenAddressingArray &&other) noexcept
{
@@ -202,15 +161,8 @@ class OpenAddressingArray {
m_slot_mask = other.m_slot_mask;
m_item_amount = other.m_item_amount;
m_item_exponent = other.m_item_exponent;
if (other.is_in_small_storage()) {
m_items = this->small_storage();
uninitialized_relocate_n(other.m_items, m_item_amount, m_items);
}
else {
m_items = other.m_items;
}
m_items = std::move(other.m_items);
other.m_items = nullptr;
other.~OpenAddressingArray();
new (&other) OpenAddressingArray();
}
@@ -237,7 +189,7 @@ class OpenAddressingArray {
Allocator &allocator()
{
return m_allocator;
return m_items.allocator();
}
/* Prepare a new array that can hold a minimum of min_usable_slots elements. All entries are
@@ -340,33 +292,22 @@ class OpenAddressingArray {
Item *begin()
{
return m_items;
return m_items.begin();
}
Item *end()
{
return m_items + m_item_amount;
return m_items.end();
}
const Item *begin() const
{
return m_items;
return m_items.begin();
}
const Item *end() const
{
return m_items + m_item_amount;
}
private:
Item *small_storage() const
{
return reinterpret_cast<Item *>((char *)m_local_storage.ptr());
}
bool is_in_small_storage() const
{
return m_items == this->small_storage();
return m_items.end();
}
};

View File

@@ -28,47 +28,47 @@
#include "BLI_lasso_2d.h" /* own include */
void BLI_lasso_boundbox(rcti *rect, const int mcords[][2], const unsigned int moves)
void BLI_lasso_boundbox(rcti *rect, const int mcoords[][2], const unsigned int mcoords_len)
{
unsigned int a;
rect->xmin = rect->xmax = mcords[0][0];
rect->ymin = rect->ymax = mcords[0][1];
rect->xmin = rect->xmax = mcoords[0][0];
rect->ymin = rect->ymax = mcoords[0][1];
for (a = 1; a < moves; a++) {
if (mcords[a][0] < rect->xmin) {
rect->xmin = mcords[a][0];
for (a = 1; a < mcoords_len; a++) {
if (mcoords[a][0] < rect->xmin) {
rect->xmin = mcoords[a][0];
}
else if (mcords[a][0] > rect->xmax) {
rect->xmax = mcords[a][0];
else if (mcoords[a][0] > rect->xmax) {
rect->xmax = mcoords[a][0];
}
if (mcords[a][1] < rect->ymin) {
rect->ymin = mcords[a][1];
if (mcoords[a][1] < rect->ymin) {
rect->ymin = mcoords[a][1];
}
else if (mcords[a][1] > rect->ymax) {
rect->ymax = mcords[a][1];
else if (mcoords[a][1] > rect->ymax) {
rect->ymax = mcoords[a][1];
}
}
}
bool BLI_lasso_is_point_inside(const int mcords[][2],
const unsigned int moves,
bool BLI_lasso_is_point_inside(const int mcoords[][2],
const unsigned int mcoords_len,
const int sx,
const int sy,
const int error_value)
{
if (sx == error_value || moves == 0) {
if (sx == error_value || mcoords_len == 0) {
return false;
}
else {
int pt[2] = {sx, sy};
return isect_point_poly_v2_int(pt, mcords, moves, true);
return isect_point_poly_v2_int(pt, mcoords, mcoords_len, true);
}
}
/* edge version for lasso select. we assume boundbox check was done */
bool BLI_lasso_is_edge_inside(const int mcords[][2],
const unsigned int moves,
bool BLI_lasso_is_edge_inside(const int mcoords[][2],
const unsigned int mcoords_len,
int x0,
int y0,
int x1,
@@ -76,27 +76,27 @@ bool BLI_lasso_is_edge_inside(const int mcords[][2],
const int error_value)
{
if (x0 == error_value || x1 == error_value || moves == 0) {
if (x0 == error_value || x1 == error_value || mcoords_len == 0) {
return false;
}
const int v1[2] = {x0, y0}, v2[2] = {x1, y1};
/* check points in lasso */
if (BLI_lasso_is_point_inside(mcords, moves, v1[0], v1[1], error_value)) {
if (BLI_lasso_is_point_inside(mcoords, mcoords_len, v1[0], v1[1], error_value)) {
return true;
}
if (BLI_lasso_is_point_inside(mcords, moves, v2[0], v2[1], error_value)) {
if (BLI_lasso_is_point_inside(mcoords, mcoords_len, v2[0], v2[1], error_value)) {
return true;
}
/* no points in lasso, so we have to intersect with lasso edge */
if (isect_seg_seg_v2_int(mcords[0], mcords[moves - 1], v1, v2) > 0) {
if (isect_seg_seg_v2_int(mcoords[0], mcoords[mcoords_len - 1], v1, v2) > 0) {
return true;
}
for (unsigned int a = 0; a < moves - 1; a++) {
if (isect_seg_seg_v2_int(mcords[a], mcords[a + 1], v1, v2) > 0) {
for (unsigned int a = 0; a < mcoords_len - 1; a++) {
if (isect_seg_seg_v2_int(mcoords[a], mcoords[a + 1], v1, v2) > 0) {
return true;
}
}

View File

@@ -24,8 +24,6 @@
#include <shlwapi.h>
#include <tlhelp32.h>
#include "BLI_fileops.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "MEM_guardedalloc.h"
@@ -319,24 +317,29 @@ static void bli_load_symbols()
PathRemoveFileSpecA(pdb_file);
/* append blender.pdb */
PathAppendA(pdb_file, "blender.pdb");
if (BLI_exists(pdb_file)) {
if (PathFileExistsA(pdb_file)) {
HMODULE mod = GetModuleHandle(NULL);
if (mod) {
size_t size = BLI_file_size(pdb_file);
WIN32_FILE_ATTRIBUTE_DATA file_data;
if (GetFileAttributesExA(pdb_file, GetFileExInfoStandard, &file_data)) {
/* SymInitialize will try to load symbols on its own, so we first must unload whatever it
* did trying to help */
SymUnloadModule64(GetCurrentProcess(), (DWORD64)mod);
/* SymInitialize will try to load symbols on its own, so we first must unload whatever it
* did trying to help */
SymUnloadModule64(GetCurrentProcess(), (DWORD64)mod);
DWORD64 module_base = SymLoadModule(
GetCurrentProcess(), NULL, pdb_file, NULL, (DWORD64)mod, (DWORD)size);
if (module_base == 0) {
fprintf(stderr,
"Error loading symbols %s\n\terror:0x%.8x\n\tsize = %zi\n\tbase=0x%p\n",
pdb_file,
GetLastError(),
size,
(LPVOID)mod);
DWORD64 module_base = SymLoadModule(GetCurrentProcess(),
NULL,
pdb_file,
NULL,
(DWORD64)mod,
(DWORD)file_data.nFileSizeLow);
if (module_base == 0) {
fprintf(stderr,
"Error loading symbols %s\n\terror:0x%.8x\n\tsize = %d\n\tbase=0x%p\n",
pdb_file,
GetLastError(),
file_data.nFileSizeLow,
(LPVOID)mod);
}
}
}
}

View File

@@ -39,6 +39,7 @@ struct ID;
struct Main;
struct Object;
struct Scene;
struct Simulation;
struct ViewLayer;
struct bNodeTree;
@@ -153,6 +154,9 @@ void DEG_add_object_relation(struct DepsNodeHandle *node_handle,
struct Object *object,
eDepsObjectComponentType component,
const char *description);
void DEG_add_simulation_relation(struct DepsNodeHandle *node_handle,
struct Simulation *simulation,
const char *description);
void DEG_add_bone_relation(struct DepsNodeHandle *handle,
struct Object *object,
const char *bone_name,

View File

@@ -98,6 +98,7 @@ extern "C" {
#include "BKE_scene.h"
#include "BKE_sequencer.h"
#include "BKE_shader_fx.h"
#include "BKE_simulation.h"
#include "BKE_sound.h"
#include "BKE_tracking.h"
#include "BKE_volume.h"
@@ -1755,6 +1756,11 @@ void DepsgraphNodeBuilder::build_simulation(Simulation *simulation)
add_id_node(&simulation->id);
build_animdata(&simulation->id);
build_parameters(&simulation->id);
add_operation_node(&simulation->id,
NodeType::SIMULATION,
OperationCode::SIMULATION_EVAL,
function_bind(BKE_simulation_data_update, _1, get_cow_datablock(scene_)));
}
void DepsgraphNodeBuilder::build_scene_sequencer(Scene *scene)

View File

@@ -2573,6 +2573,11 @@ void DepsgraphRelationBuilder::build_simulation(Simulation *simulation)
}
build_animdata(&simulation->id);
build_parameters(&simulation->id);
OperationKey simulation_update_key(
&simulation->id, NodeType::SIMULATION, OperationCode::SIMULATION_EVAL);
TimeSourceKey time_src_key;
add_relation(time_src_key, simulation_update_key, "TimeSrc -> Simulation");
}
void DepsgraphRelationBuilder::build_scene_sequencer(Scene *scene)

View File

@@ -441,7 +441,8 @@ static void deg_debug_graphviz_node(const DebugContext &ctx, const Node *node)
case NodeType::SYNCHRONIZATION:
case NodeType::AUDIO:
case NodeType::ARMATURE:
case NodeType::GENERIC_DATABLOCK: {
case NodeType::GENERIC_DATABLOCK:
case NodeType::SIMULATION: {
ComponentNode *comp_node = (ComponentNode *)node;
if (!comp_node->operations.empty()) {
deg_debug_graphviz_node_cluster_begin(ctx, node);

View File

@@ -35,6 +35,7 @@ extern "C" {
#include "DNA_cachefile_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_simulation_types.h"
#include "BKE_main.h"
#include "BKE_scene.h"
@@ -105,6 +106,16 @@ void DEG_add_object_relation(DepsNodeHandle *node_handle,
deg_node_handle->builder->add_node_handle_relation(comp_key, deg_node_handle, description);
}
void DEG_add_simulation_relation(DepsNodeHandle *node_handle,
Simulation *simulation,
const char *description)
{
DEG::OperationKey operation_key(
&simulation->id, DEG::NodeType::SIMULATION, DEG::OperationCode::SIMULATION_EVAL);
DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
deg_node_handle->builder->add_node_handle_relation(operation_key, deg_node_handle, description);
}
void DEG_add_object_cache_relation(DepsNodeHandle *node_handle,
CacheFile *cache_file,
eDepsObjectComponentType component,

View File

@@ -114,6 +114,8 @@ const char *nodeTypeAsString(NodeType type)
return "ARMATURE";
case NodeType::GENERIC_DATABLOCK:
return "GENERIC_DATABLOCK";
case NodeType::SIMULATION:
return "SIMULATION";
/* Total number of meaningful node types. */
case NodeType::NUM_TYPES:
@@ -172,6 +174,7 @@ eDepsSceneComponentType nodeTypeToSceneComponent(NodeType type)
case NodeType::SHADING:
case NodeType::CACHE:
case NodeType::PROXY:
case NodeType::SIMULATION:
return DEG_SCENE_COMP_PARAMETERS;
}
BLI_assert(!"Unhandled node type, not suppsed to happen.");
@@ -245,6 +248,7 @@ eDepsObjectComponentType nodeTypeToObjectComponent(NodeType type)
case NodeType::BATCH_CACHE:
case NodeType::DUPLI:
case NodeType::SYNCHRONIZATION:
case NodeType::SIMULATION:
case NodeType::UNDEFINED:
case NodeType::NUM_TYPES:
return DEG_OB_COMP_PARAMETERS;

View File

@@ -127,6 +127,8 @@ enum class NodeType {
DUPLI,
/* Synchronization back to original datablock. */
SYNCHRONIZATION,
/* Simulation component. */
SIMULATION,
/* Total number of meaningful node types. */
NUM_TYPES,

View File

@@ -335,6 +335,7 @@ DEG_COMPONENT_NODE_DEFINE(Synchronization, SYNCHRONIZATION, 0);
DEG_COMPONENT_NODE_DEFINE(Audio, AUDIO, 0);
DEG_COMPONENT_NODE_DEFINE(Armature, ARMATURE, 0);
DEG_COMPONENT_NODE_DEFINE(GenericDatablock, GENERIC_DATABLOCK, 0);
DEG_COMPONENT_NODE_DEFINE(Simulation, SIMULATION, 0);
/* Node Types Register =================================== */
@@ -364,6 +365,7 @@ void deg_register_component_depsnodes()
register_node_typeinfo(&DNTI_AUDIO);
register_node_typeinfo(&DNTI_ARMATURE);
register_node_typeinfo(&DNTI_GENERIC_DATABLOCK);
register_node_typeinfo(&DNTI_SIMULATION);
}
} // namespace DEG

View File

@@ -191,6 +191,7 @@ DEG_COMPONENT_NODE_DECLARE_GENERIC(Synchronization);
DEG_COMPONENT_NODE_DECLARE_GENERIC(Audio);
DEG_COMPONENT_NODE_DECLARE_GENERIC(Armature);
DEG_COMPONENT_NODE_DECLARE_GENERIC(GenericDatablock);
DEG_COMPONENT_NODE_DECLARE_GENERIC(Simulation);
/* Bone Component */
struct BoneComponentNode : public ComponentNode {

View File

@@ -194,6 +194,8 @@ const char *operationCodeAsString(OperationCode opcode)
/* instancing/duplication. */
case OperationCode::DUPLI:
return "DUPLI";
case OperationCode::SIMULATION_EVAL:
return "SIMULATION_EVAL";
}
BLI_assert(!"Unhandled operation code, should never happen.");
return "UNKNOWN";

View File

@@ -198,6 +198,9 @@ enum class OperationCode {
/* Duplication/instancing system. --------------------------------------- */
DUPLI,
/* Simulation. ---------------------------------------------------------- */
SIMULATION_EVAL,
};
const char *operationCodeAsString(OperationCode opcode);

View File

@@ -201,7 +201,9 @@ void OVERLAY_gpencil_cache_init(OVERLAY_Data *vedata)
}
const bool show_overlays = (v3d->flag2 & V3D_HIDE_OVERLAYS) == 0;
const bool show_grid = (v3d->gp_flag & V3D_GP_SHOW_GRID) != 0;
const bool show_grid = (v3d->gp_flag & V3D_GP_SHOW_GRID) != 0 &&
((ts->gpencil_v3d_align &
(GP_PROJECT_DEPTH_VIEW | GP_PROJECT_DEPTH_STROKE)) == 0);
if (show_grid && show_overlays) {
const char *grid_unit = NULL;
@@ -238,6 +240,15 @@ void OVERLAY_gpencil_cache_init(OVERLAY_Data *vedata)
break;
}
/* Move the grid to the right location depending of the align type.
* This is required only for 3D Cursor or Origin. */
if (ts->gpencil_v3d_align & GP_PROJECT_CURSOR) {
copy_v3_v3(mat[3], cursor->location);
}
else if (ts->gpencil_v3d_align & GP_PROJECT_VIEWSPACE) {
copy_v3_v3(mat[3], ob->obmat[3]);
}
translate_m4(mat, gpd->grid.offset[0], gpd->grid.offset[1], 0.0f);
mul_v2_v2fl(size, gpd->grid.scale, 2.0f * ED_scene_grid_scale(scene, &grid_unit));
rescale_m4(mat, (float[3]){size[0], size[1], 0.0f});

View File

@@ -633,7 +633,7 @@ bool keyframe_region_lasso_test(const KeyframeEdit_LassoData *data_lasso, const
BLI_rctf_transform_pt_v(data_lasso->rectf_view, data_lasso->rectf_scaled, xy_view, xy);
if (BLI_lasso_is_point_inside(
data_lasso->mcords, data_lasso->mcords_tot, xy_view[0], xy_view[1], INT_MAX)) {
data_lasso->mcoords, data_lasso->mcoords_len, xy_view[0], xy_view[1], INT_MAX)) {
return true;
}
}

View File

@@ -4547,8 +4547,8 @@ void GPENCIL_OT_stroke_smooth(wmOperatorType *ot)
/* smart stroke cutter for trimming stroke ends */
struct GP_SelectLassoUserData {
rcti rect;
const int (*mcords)[2];
int mcords_len;
const int (*mcoords)[2];
int mcoords_len;
};
static bool gpencil_test_lasso(bGPDstroke *gps,
@@ -4564,7 +4564,7 @@ static bool gpencil_test_lasso(bGPDstroke *gps,
gp_point_to_xy(gsc, gps, &pt2, &x0, &y0);
/* test if in lasso */
return ((!ELEM(V2D_IS_CLIPPED, x0, y0)) && BLI_rcti_isect_pt(&data->rect, x0, y0) &&
BLI_lasso_is_point_inside(data->mcords, data->mcords_len, x0, y0, INT_MAX));
BLI_lasso_is_point_inside(data->mcoords, data->mcoords_len, x0, y0, INT_MAX));
}
typedef bool (*GPencilTestFn)(bGPDstroke *gps,
@@ -4742,19 +4742,19 @@ static int gpencil_cutter_exec(bContext *C, wmOperator *op)
}
struct GP_SelectLassoUserData data = {0};
data.mcords = WM_gesture_lasso_path_to_array(C, op, &data.mcords_len);
data.mcoords = WM_gesture_lasso_path_to_array(C, op, &data.mcoords_len);
/* Sanity check. */
if (data.mcords == NULL) {
if (data.mcoords == NULL) {
return OPERATOR_PASS_THROUGH;
}
/* Compute boundbox of lasso (for faster testing later). */
BLI_lasso_boundbox(&data.rect, data.mcords, data.mcords_len);
BLI_lasso_boundbox(&data.rect, data.mcoords, data.mcoords_len);
gpencil_cutter_lasso_select(C, op, gpencil_test_lasso, &data);
MEM_freeN((void *)data.mcords);
MEM_freeN((void *)data.mcoords);
return OPERATOR_FINISHED;
}

View File

@@ -1327,8 +1327,8 @@ void GPENCIL_OT_select_box(wmOperatorType *ot)
struct GP_SelectLassoUserData {
rcti rect;
const int (*mcords)[2];
int mcords_len;
const int (*mcoords)[2];
int mcoords_len;
};
static bool gpencil_test_lasso(bGPDstroke *gps,
@@ -1344,25 +1344,25 @@ static bool gpencil_test_lasso(bGPDstroke *gps,
gp_point_to_xy(gsc, gps, &pt2, &x0, &y0);
/* test if in lasso boundbox + within the lasso noose */
return ((!ELEM(V2D_IS_CLIPPED, x0, y0)) && BLI_rcti_isect_pt(&data->rect, x0, y0) &&
BLI_lasso_is_point_inside(data->mcords, data->mcords_len, x0, y0, INT_MAX));
BLI_lasso_is_point_inside(data->mcoords, data->mcoords_len, x0, y0, INT_MAX));
}
static int gpencil_lasso_select_exec(bContext *C, wmOperator *op)
{
struct GP_SelectLassoUserData data = {0};
data.mcords = WM_gesture_lasso_path_to_array(C, op, &data.mcords_len);
data.mcoords = WM_gesture_lasso_path_to_array(C, op, &data.mcoords_len);
/* Sanity check. */
if (data.mcords == NULL) {
if (data.mcoords == NULL) {
return OPERATOR_PASS_THROUGH;
}
/* Compute boundbox of lasso (for faster testing later). */
BLI_lasso_boundbox(&data.rect, data.mcords, data.mcords_len);
BLI_lasso_boundbox(&data.rect, data.mcoords, data.mcoords_len);
int ret = gpencil_generic_select_exec(C, op, gpencil_test_lasso, &data);
MEM_freeN((void *)data.mcords);
MEM_freeN((void *)data.mcoords);
return ret;
}

View File

@@ -69,7 +69,7 @@ void ED_space_image_get_size(struct SpaceImage *sima, int *r_width, int *r_heigh
void ED_space_image_get_size_fl(struct SpaceImage *sima, float r_size[2]);
void ED_space_image_get_aspect(struct SpaceImage *sima, float *r_aspx, float *r_aspy);
void ED_space_image_get_zoom(struct SpaceImage *sima,
struct ARegion *region,
const struct ARegion *region,
float *r_zoomx,
float *r_zoomy);
void ED_space_image_get_uv_aspect(struct SpaceImage *sima, float *r_aspx, float *r_aspy);
@@ -88,14 +88,18 @@ void ED_image_get_uv_aspect(struct Image *ima,
float *r_aspx,
float *r_aspy);
void ED_image_mouse_pos(struct SpaceImage *sima,
struct ARegion *region,
const struct ARegion *region,
const int mval[2],
float co[2]);
void ED_image_view_center_to_point(struct SpaceImage *sima, float x, float y);
void ED_image_point_pos(
struct SpaceImage *sima, struct ARegion *region, float x, float y, float *r_x, float *r_y);
void ED_image_point_pos(struct SpaceImage *sima,
const struct ARegion *region,
float x,
float y,
float *r_x,
float *r_y);
void ED_image_point_pos__reverse(struct SpaceImage *sima,
struct ARegion *region,
const struct ARegion *region,
const float co[2],
float r_co[2]);
bool ED_image_slot_cycle(struct Image *image, int direction);

View File

@@ -106,8 +106,8 @@ typedef enum eEditKeyframes_Mirror {
typedef struct KeyframeEdit_LassoData {
rctf *rectf_scaled;
const rctf *rectf_view;
const int (*mcords)[2];
int mcords_tot;
const int (*mcoords)[2];
int mcoords_len;
} KeyframeEdit_LassoData;
/* use with BEZT_OK_REGION_CIRCLE */

Some files were not shown because too many files have changed in this diff Show More