Mesh: Replace MLoop struct with generic attributes #104424

Merged
Hans Goudey merged 261 commits from refactor-mesh-corners-generic into main 2023-03-20 15:55:25 +01:00
33 changed files with 133 additions and 281 deletions
Showing only changes of commit 3b6819a2bc - Show all commits

View File

@ -331,7 +331,6 @@ option(WITH_MOD_REMESH "Enable Remesh Modifier" ON)
option(WITH_MOD_OCEANSIM "Enable Ocean Modifier" ON)
# Image format support
option(WITH_OPENIMAGEIO "Enable OpenImageIO Support (http://www.openimageio.org)" ON)
option(WITH_IMAGE_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ON)
option(WITH_IMAGE_OPENJPEG "Enable OpenJpeg Support (http://www.openjpeg.org)" ON)
option(WITH_IMAGE_TIFF "Enable LibTIFF Support" ON)
@ -892,8 +891,6 @@ set_and_warn_dependency(WITH_IMAGE_TIFF WITH_HARU OFF)
# auto enable openimageio for cycles
if(WITH_CYCLES)
set(WITH_OPENIMAGEIO ON)
# auto enable llvm for cycles_osl
if(WITH_CYCLES_OSL)
set(WITH_LLVM ON CACHE BOOL "" FORCE)
@ -1085,13 +1082,6 @@ if(NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM)
endif()
if(WITH_CYCLES)
if(NOT WITH_OPENIMAGEIO)
message(
FATAL_ERROR
"Cycles requires WITH_OPENIMAGEIO, the library may not have been found. "
"Configure OIIO or disable WITH_CYCLES"
)
endif()
if(WITH_CYCLES_OSL)
if(NOT WITH_LLVM)
message(
@ -1942,8 +1932,7 @@ if(FIRST_RUN)
info_cfg_option(WITH_IMAGE_OPENEXR)
info_cfg_option(WITH_IMAGE_OPENJPEG)
info_cfg_option(WITH_IMAGE_TIFF)
info_cfg_option(WITH_OPENIMAGEIO)
info_cfg_text("Audio:")
info_cfg_option(WITH_CODEC_AVI)
info_cfg_option(WITH_CODEC_FFMPEG)

View File

@ -6615,11 +6615,9 @@ print_info() {
fi
if [ -d $INST/oiio ]; then
_1="-D WITH_OPENIMAGEIO=ON"
_2="-D OPENIMAGEIO_ROOT_DIR=$INST/oiio"
_1="-D OPENIMAGEIO_ROOT_DIR=$INST/oiio"
PRINT " $_1"
PRINT " $_2"
_buildargs="$_buildargs $_1 $_2"
_buildargs="$_buildargs $_1"
fi
if [ "$OSL_SKIP" = false ]; then

View File

@ -52,7 +52,6 @@ set(WITH_OPENAL OFF CACHE BOOL "" FORCE)
set(WITH_OPENCOLLADA OFF CACHE BOOL "" FORCE)
set(WITH_OPENCOLORIO OFF CACHE BOOL "" FORCE)
set(WITH_OPENIMAGEDENOISE OFF CACHE BOOL "" FORCE)
set(WITH_OPENIMAGEIO OFF CACHE BOOL "" FORCE)
set(WITH_OPENMP OFF CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
set(WITH_OPENVDB OFF CACHE BOOL "" FORCE)

View File

@ -270,19 +270,7 @@ if(WITH_PUGIXML)
find_package(PugiXML REQUIRED)
endif()
if(WITH_OPENIMAGEIO)
find_package(OpenImageIO)
list(APPEND OPENIMAGEIO_LIBRARIES
${PNG_LIBRARIES}
${JPEG_LIBRARIES}
${TIFF_LIBRARY}
${OPENEXR_LIBRARIES}
${OPENJPEG_LIBRARIES}
${ZLIB_LIBRARIES}
)
set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
set(OPENIMAGEIO_IDIFF "${LIBDIR}/openimageio/bin/idiff")
endif()
find_package(OpenImageIO REQUIRED)
add_bundled_libraries(openimageio/lib)
if(WITH_OPENCOLORIO)

View File

@ -438,32 +438,7 @@ if(WITH_IMAGE_WEBP)
set_and_warn_library_found("WebP" WEBP_FOUND WITH_IMAGE_WEBP)
endif()
if(WITH_OPENIMAGEIO)
find_package_wrapper(OpenImageIO)
set(OPENIMAGEIO_LIBRARIES
${OPENIMAGEIO_LIBRARIES}
${PNG_LIBRARIES}
${JPEG_LIBRARIES}
${ZLIB_LIBRARIES}
)
set(OPENIMAGEIO_DEFINITIONS "")
if(WITH_BOOST)
list(APPEND OPENIMAGEIO_LIBRARIES "${BOOST_LIBRARIES}")
endif()
if(WITH_IMAGE_TIFF)
list(APPEND OPENIMAGEIO_LIBRARIES "${TIFF_LIBRARY}")
endif()
if(WITH_IMAGE_OPENEXR)
list(APPEND OPENIMAGEIO_LIBRARIES "${OPENEXR_LIBRARIES}")
endif()
if(WITH_IMAGE_WEBP)
list(APPEND OPENIMAGEIO_LIBRARIES "${WEBP_LIBRARIES}")
endif()
set_and_warn_library_found("OPENIMAGEIO" OPENIMAGEIO_FOUND WITH_OPENIMAGEIO)
endif()
find_package_wrapper(OpenImageIO REQUIRED)
add_bundled_libraries(openimageio/lib)
if(WITH_OPENCOLORIO)

View File

@ -602,25 +602,18 @@ if(WITH_BOOST)
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
endif()
if(WITH_OPENIMAGEIO)
windows_find_package(OpenImageIO)
if(NOT OpenImageIO_FOUND)
set(OPENIMAGEIO ${LIBDIR}/OpenImageIO)
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
set(OPENIMAGEIO_INCLUDE_DIR ${OPENIMAGEIO}/include)
set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO_INCLUDE_DIR})
set(OIIO_OPTIMIZED optimized ${OPENIMAGEIO_LIBPATH}/OpenImageIO.lib optimized ${OPENIMAGEIO_LIBPATH}/OpenImageIO_Util.lib)
set(OIIO_DEBUG debug ${OPENIMAGEIO_LIBPATH}/OpenImageIO_d.lib debug ${OPENIMAGEIO_LIBPATH}/OpenImageIO_Util_d.lib)
set(OPENIMAGEIO_LIBRARIES ${OIIO_OPTIMIZED} ${OIIO_DEBUG})
endif()
set(OPENIMAGEIO_DEFINITIONS "-DUSE_TBB=0")
windows_find_package(OpenImageIO)
if(NOT OpenImageIO_FOUND)
set(OPENIMAGEIO ${LIBDIR}/OpenImageIO)
set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
set(OPENIMAGEIO_INCLUDE_DIR ${OPENIMAGEIO}/include)
set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO_INCLUDE_DIR})
set(OIIO_OPTIMIZED optimized ${OPENIMAGEIO_LIBPATH}/OpenImageIO.lib optimized ${OPENIMAGEIO_LIBPATH}/OpenImageIO_Util.lib)
set(OIIO_DEBUG debug ${OPENIMAGEIO_LIBPATH}/OpenImageIO_d.lib debug ${OPENIMAGEIO_LIBPATH}/OpenImageIO_Util_d.lib)
set(OPENIMAGEIO_LIBRARIES ${OIIO_OPTIMIZED} ${OIIO_DEBUG})
set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
# If the .dll does not exist, assume it is a static OIIO
if(NOT EXISTS ${OPENIMAGEIO}/bin/OpenImageIO.dll)
add_definitions(-DOIIO_STATIC_DEFINE)
endif()
add_definitions(-DOIIO_NO_SSE=1)
endif()
add_definitions(-DOIIO_NO_SSE=1)
if(WITH_LLVM)
set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")

View File

@ -144,6 +144,7 @@ add_subdirectory(simulation)
add_subdirectory(geometry)
add_subdirectory(gpu)
add_subdirectory(imbuf)
add_subdirectory(imbuf/intern/oiio)
add_subdirectory(nodes)
add_subdirectory(modifiers)
add_subdirectory(gpencil_modifiers)
@ -164,10 +165,6 @@ if(WITH_IMAGE_OPENEXR)
add_subdirectory(imbuf/intern/openexr)
endif()
if(WITH_OPENIMAGEIO)
add_subdirectory(imbuf/intern/oiio)
endif()
if(WITH_IMAGE_DDS)
add_subdirectory(imbuf/intern/dds)
endif()

View File

@ -443,15 +443,6 @@ void BKE_mesh_calc_normals_poly_and_vertex(const float (*vert_positions)[3],
float (*r_poly_normals)[3],
float (*r_vert_normals)[3]);
/**
* Calculate vertex and face normals, storing the result in custom data layers on the mesh.
*
* \note It is usually preferable to calculate normals lazily with
* #BKE_mesh_vert_normals_ensure, but some areas (perhaps unnecessarily)
* can also calculate them eagerly.
*/
void BKE_mesh_calc_normals(struct Mesh *me);
/**
* Called after calculating all modifiers.
*/

View File

@ -757,7 +757,6 @@ void nodeInternalRelink(struct bNodeTree *ntree, struct bNode *node);
void nodeToView(const struct bNode *node, float x, float y, float *rx, float *ry);
void nodeFromView(const struct bNode *node, float x, float y, float *rx, float *ry);
bool nodeAttachNodeCheck(const struct bNode *node, const struct bNode *parent);
void nodeAttachNode(struct bNodeTree *ntree, struct bNode *node, struct bNode *parent);
void nodeDetachNode(struct bNodeTree *ntree, struct bNode *node);
@ -790,11 +789,7 @@ void nodeFindNode(struct bNodeTree *ntree,
*/
struct bNode *nodeFindRootParent(bNode *node);
/**
* \returns true if \a child has \a parent as a parent/grandparent/... etc.
* \note Recursive
*/
bool nodeIsChildOf(const bNode *parent, const bNode *child);
bool nodeIsParentAndChild(const bNode *parent, const bNode *child);
/**
* Iterate over a chain of nodes, starting with \a node_start, executing

View File

@ -593,10 +593,6 @@ if(WITH_IMAGE_TIFF)
add_definitions(-DWITH_TIFF)
endif()
if(WITH_OPENIMAGEIO)
add_definitions(-DWITH_OPENIMAGEIO)
endif()
if(WITH_IMAGE_OPENJPEG)
add_definitions(-DWITH_OPENJPEG)
endif()

View File

@ -464,13 +464,11 @@ static bool do_add_image_extension(char *string,
}
}
#endif
#ifdef WITH_OPENIMAGEIO
else if (imtype == R_IMF_IMTYPE_PSD) {
if (!BLI_path_extension_check(string, extension_test = ".psd")) {
extension = extension_test;
}
}
#endif
#ifdef WITH_OPENEXR
else if (ELEM(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
if (!BLI_path_extension_check(string, extension_test = ".exr")) {

View File

@ -476,14 +476,6 @@ void BKE_mesh_ensure_normals_for_display(Mesh *mesh)
}
}
void BKE_mesh_calc_normals(Mesh *mesh)
{
#ifdef DEBUG_TIME
SCOPED_TIMER_AVERAGED(__func__);
#endif
BKE_mesh_vert_normals_ensure(mesh);
}
void BKE_lnor_spacearr_init(MLoopNorSpaceArray *lnors_spacearr,
const int numLoops,
const char data_type)

View File

@ -2059,13 +2059,13 @@ bNode *nodeFindRootParent(bNode *node)
return node->type == NODE_FRAME ? node : nullptr;
}
bool nodeIsChildOf(const bNode *parent, const bNode *child)
bool nodeIsParentAndChild(const bNode *parent, const bNode *child)
{
if (parent == child) {
return true;
}
if (child->parent) {
return nodeIsChildOf(parent, child->parent);
return nodeIsParentAndChild(parent, child->parent);
}
return false;
}
@ -2573,21 +2573,10 @@ void nodeFromView(const bNode *node, const float x, const float y, float *rx, fl
}
}
bool nodeAttachNodeCheck(const bNode *node, const bNode *parent)
{
for (const bNode *parent_iter = node; parent_iter; parent_iter = parent_iter->parent) {
if (parent_iter == parent) {
return true;
}
}
return false;
}
void nodeAttachNode(bNodeTree *ntree, bNode *node, bNode *parent)
{
BLI_assert(parent->type == NODE_FRAME);
BLI_assert(nodeAttachNodeCheck(parent, node) == false);
BLI_assert(!nodeIsParentAndChild(parent, node));
float locx, locy;
nodeToView(node, 0.0f, 0.0f, &locx, &locy);

View File

@ -66,10 +66,6 @@ if(WITH_IMAGE_OPENEXR)
add_definitions(-DWITH_OPENEXR)
endif()
if(WITH_OPENIMAGEIO)
add_definitions(-DWITH_OPENIMAGEIO)
endif()
if(WITH_IMAGE_TIFF)
add_definitions(-DWITH_TIFF)
endif()

View File

@ -46,10 +46,6 @@ set(LIB
bf_editor_uvedit
)
if(WITH_OPENIMAGEIO)
add_definitions(-DWITH_OPENIMAGEIO)
endif()
if(WITH_IMAGE_OPENJPEG)
add_definitions(-DWITH_OPENJPEG)
endif()

View File

@ -1890,30 +1890,24 @@ static int node_attach_invoke(bContext *C, wmOperator * /*op*/, const wmEvent *e
continue;
}
if (node->parent == nullptr) {
/* Disallow moving a parent into its child. */
if (nodeAttachNodeCheck(frame, node) == false) {
/* Attach all unparented nodes. */
nodeAttachNode(&ntree, node, frame);
}
/* Disallow moving a parent into its child. */
if (node->is_frame() && nodeIsParentAndChild(node, frame)) {
continue;
}
else {
/* Attach nodes which share parent with the frame. */
bNode *parent;
for (parent = frame->parent; parent; parent = parent->parent) {
if (parent == node->parent) {
break;
}
}
if (parent) {
/* Disallow moving a parent into its child. */
if (nodeAttachNodeCheck(frame, node) == false) {
nodeDetachNode(&ntree, node);
nodeAttachNode(&ntree, node, frame);
}
}
if (node->parent == nullptr) {
nodeAttachNode(&ntree, node, frame);
continue;
}
/* Attach nodes which share parent with the frame. */
const bool share_parent = nodeIsParentAndChild(node->parent, frame);
if (!share_parent) {
continue;
}
nodeDetachNode(&ntree, node);
nodeAttachNode(&ntree, node, frame);
}
node_sort(ntree);
@ -2305,7 +2299,7 @@ static void node_parent_offset_apply(NodeInsertOfsData *data, bNode *parent, con
/* Flag all children as offset to prevent them from being offset
* separately (they've already moved with the parent). */
for (bNode *node : data->ntree->all_nodes()) {
if (nodeIsChildOf(parent, node)) {
if (nodeIsParentAndChild(parent, node)) {
/* NODE_TEST is used to flag nodes that shouldn't be offset (again) */
node->flag |= NODE_TEST;
}
@ -2345,7 +2339,7 @@ static void node_link_insert_offset_frame_chains(bNodeTree *ntree,
const bool reversed)
{
for (bNode *node : ntree->all_nodes()) {
if (nodeIsChildOf(parent, node)) {
if (nodeIsParentAndChild(parent, node)) {
nodeChainIter(ntree, node, node_link_insert_offset_frame_chain_cb, data, reversed);
}
}
@ -2372,7 +2366,7 @@ static bool node_link_insert_offset_chain_cb(bNode *fromnode,
node_offset_apply(*ofs_node, data->offset_x);
}
if (nodeIsChildOf(data->insert_parent, ofs_node) == false) {
if (!nodeIsParentAndChild(data->insert_parent, ofs_node)) {
data->insert_parent = nullptr;
}
}
@ -2472,7 +2466,7 @@ static void node_link_insert_offset_ntree(NodeInsertOfsData *iofsd,
if (needs_alignment) {
bNode *offs_node = right_alignment ? next : prev;
if (!offs_node->parent || offs_node->parent == insert.parent ||
nodeIsChildOf(offs_node->parent, &insert)) {
nodeIsParentAndChild(offs_node->parent, &insert)) {
node_offset_apply(*offs_node, addval);
}
else if (!insert.parent && offs_node->parent) {

View File

@ -65,16 +65,17 @@ static float strip_y_rescale(const Sequence *seq, const float y_value)
return (y_value * y_range) + seq->machine + SEQ_STRIP_OFSBOTTOM;
}
static float handle_x_get(const Sequence *seq, const SeqRetimingHandle *handle)
static float handle_x_get(const Scene *scene, const Sequence *seq, const SeqRetimingHandle *handle)
{
const SeqRetimingHandle *last_handle = SEQ_retiming_last_handle_get(seq);
const bool is_last_handle = (handle == last_handle);
return SEQ_time_start_frame_get(seq) + handle->strip_frame_index + (is_last_handle ? 1 : 0);
return SEQ_retiming_handle_timeline_frame_get(scene, seq, handle) + (is_last_handle ? 1 : 0);
}
static const SeqRetimingHandle *mouse_over_handle_get(const Sequence *seq,
static const SeqRetimingHandle *mouse_over_handle_get(const Scene *scene,
const Sequence *seq,
const View2D *v2d,
const int mval[2])
{
@ -84,7 +85,7 @@ static const SeqRetimingHandle *mouse_over_handle_get(const Sequence *seq,
MutableSpan handles = SEQ_retiming_handles_get(seq);
for (const SeqRetimingHandle &handle : handles) {
int distance = round_fl_to_int(
fabsf(UI_view2d_view_to_region_x(v2d, handle_x_get(seq, &handle)) - mval[0]));
fabsf(UI_view2d_view_to_region_x(v2d, handle_x_get(scene, seq, &handle)) - mval[0]));
if (distance < RETIME_HANDLE_MOUSEOVER_THRESHOLD && distance < best_distance) {
best_distance = distance;
@ -316,7 +317,7 @@ static void retime_handle_draw(const bContext *C,
const SeqRetimingHandle *handle)
{
const Scene *scene = CTX_data_scene(C);
const float handle_x = handle_x_get(seq, handle);
const float handle_x = handle_x_get(scene, seq, handle);
if (handle_x == SEQ_time_left_handle_frame_get(scene, seq)) {
return;
@ -371,7 +372,8 @@ static void retime_speed_text_draw(const bContext *C,
int next_handle_index = SEQ_retiming_handle_index_get(seq, handle) + 1;
const SeqRetimingHandle *next_handle = &SEQ_retiming_handles_get(seq)[next_handle_index];
if (handle_x_get(seq, next_handle) < start_frame || handle_x_get(seq, handle) > end_frame) {
if (handle_x_get(scene, seq, next_handle) < start_frame ||
handle_x_get(scene, seq, handle) > end_frame) {
return; /* Label out of strip bounds. */
}
@ -383,9 +385,10 @@ static void retime_speed_text_draw(const bContext *C,
const float width = pixels_to_view_width(C, BLF_width(BLF_default(), label_str, label_len));
const float xmin = max_ff(SEQ_time_left_handle_frame_get(scene, seq), handle_x_get(seq, handle));
const float xmin = max_ff(SEQ_time_left_handle_frame_get(scene, seq),
handle_x_get(scene, seq, handle));
const float xmax = min_ff(SEQ_time_right_handle_frame_get(scene, seq),
handle_x_get(seq, next_handle));
handle_x_get(scene, seq, next_handle));
const float text_x = (xmin + xmax - width) / 2;
const float text_y = strip_y_rescale(seq, 0) + pixels_to_view_height(C, 5);
@ -437,14 +440,15 @@ static int gizmo_retime_handle_test_select(bContext *C, wmGizmo *gz, const int m
Sequence *seq = active_seq_from_context(C);
SEQ_retiming_data_ensure(CTX_data_scene(C), seq);
const SeqRetimingHandle *handle = mouse_over_handle_get(seq, UI_view2d_fromcontext(C), mval);
const SeqRetimingHandle *handle = mouse_over_handle_get(
scene, seq, UI_view2d_fromcontext(C), mval);
const int handle_index = SEQ_retiming_handle_index_get(seq, handle);
if (handle == nullptr) {
return -1;
}
if (handle_x_get(seq, handle) == SEQ_time_left_handle_frame_get(scene, seq) ||
if (handle_x_get(scene, seq, handle) == SEQ_time_left_handle_frame_get(scene, seq) ||
handle_index == 0) {
return -1;
}
@ -456,7 +460,7 @@ static int gizmo_retime_handle_test_select(bContext *C, wmGizmo *gz, const int m
}
gizmo->mouse_over_seq = seq;
gizmo->mouse_over_handle_x = handle_x_get(seq, handle);
gizmo->mouse_over_handle_x = handle_x_get(scene, seq, handle);
wmGizmoOpElem *op_elem = WM_gizmo_operator_get(gz, 0);
RNA_int_set(&op_elem->ptr, "handle_index", handle_index);
@ -511,14 +515,15 @@ static int gizmo_retime_remove_test_select(bContext *C, wmGizmo *gz, const int m
Sequence *seq = active_seq_from_context(C);
SEQ_retiming_data_ensure(CTX_data_scene(C), seq);
const SeqRetimingHandle *handle = mouse_over_handle_get(seq, UI_view2d_fromcontext(C), mval);
const SeqRetimingHandle *handle = mouse_over_handle_get(
scene, seq, UI_view2d_fromcontext(C), mval);
const int handle_index = SEQ_retiming_handle_index_get(seq, handle);
if (handle == nullptr) {
return -1;
}
if (handle_x_get(seq, handle) == SEQ_time_left_handle_frame_get(scene, seq) ||
if (handle_x_get(scene, seq, handle) == SEQ_time_left_handle_frame_get(scene, seq) ||
handle_index == 0) {
return -1; /* Ignore first handle. */
}

View File

@ -111,6 +111,7 @@ static SeqRetimingHandle *closest_retiming_handle_get(const bContext *C,
const float mouse_x)
{
const View2D *v2d = UI_view2d_fromcontext(C);
const Scene *scene = CTX_data_scene(C);
int best_distance = INT_MAX;
SeqRetimingHandle *closest_handle = nullptr;
@ -119,7 +120,8 @@ static SeqRetimingHandle *closest_retiming_handle_get(const bContext *C,
for (int i = 0; i < SEQ_retiming_handles_count(seq); i++) {
SeqRetimingHandle *handle = seq->retiming_handles + i;
const int distance = round_fl_to_int(fabsf(handle->strip_frame_index - mouse_x_view));
const int distance = round_fl_to_int(
fabsf(SEQ_retiming_handle_timeline_frame_get(scene, seq, handle) - mouse_x_view));
if (distance < distance_threshold && distance < best_distance) {
best_distance = distance;
@ -143,7 +145,7 @@ static int sequencer_retiming_handle_move_invoke(bContext *C, wmOperator *op, co
/* Ensure retiming handle at left handle position. This way user gets more predictable result
* when strips have offsets. */
const int left_handle_frame = SEQ_time_left_handle_frame_get(scene, seq);
if (SEQ_retiming_add_handle(seq, left_handle_frame) != nullptr) {
if (SEQ_retiming_add_handle(scene, seq, left_handle_frame) != nullptr) {
handle_index++; /* Advance index, because new handle was created. */
}
@ -184,9 +186,9 @@ static int sequencer_retiming_handle_move_modal(bContext *C, wmOperator *op, con
SeqRetimingHandle *handle_prev = handle - 1;
/* Limit retiming handle movement. */
int xmin = SEQ_time_start_frame_get(seq) + handle_prev->strip_frame_index + 1;
int xmin = SEQ_retiming_handle_timeline_frame_get(scene, seq, handle_prev) + 1;
mouse_x = max_ff(xmin, mouse_x);
offset = mouse_x - (SEQ_time_start_frame_get(seq) + handle->strip_frame_index);
offset = mouse_x - SEQ_retiming_handle_timeline_frame_get(scene, seq, handle);
SEQ_retiming_offset_handle(scene, seq, handle, offset);
@ -261,7 +263,7 @@ static int sequesequencer_retiming_handle_add_exec(bContext *C, wmOperator *op)
bool inserted = false;
const float end_frame = seq->start + SEQ_time_strip_length_get(scene, seq);
if (seq->start < timeline_frame && end_frame > timeline_frame) {
SEQ_retiming_add_handle(seq, timeline_frame);
SEQ_retiming_add_handle(scene, seq, timeline_frame);
inserted = true;
}

View File

@ -74,6 +74,7 @@ set(LIB
bf_blenkernel
bf_blenlib
bf_blenloader
bf_imbuf_openimageio
bf_intern_guardedalloc
bf_intern_memutil
bf_intern_opencolorio
@ -106,14 +107,6 @@ if(WITH_IMAGE_TIFF)
add_definitions(-DWITH_TIFF)
endif()
if(WITH_OPENIMAGEIO)
list(APPEND LIB
bf_imbuf_openimageio
)
add_definitions(-DWITH_OPENIMAGEIO)
endif()
if(WITH_IMAGE_OPENJPEG)
list(APPEND INC_SYS
${OPENJPEG_INCLUDE_DIRS}

View File

@ -59,9 +59,7 @@ enum eImbFileType {
IMB_FTYPE_BMP = 4,
IMB_FTYPE_OPENEXR = 5,
IMB_FTYPE_IMAGIC = 6,
#ifdef WITH_OPENIMAGEIO
IMB_FTYPE_PSD = 7,
#endif
#ifdef WITH_OPENJPEG
IMB_FTYPE_JP2 = 8,
#endif

View File

@ -14,9 +14,7 @@
#include "IMB_colormanagement.h"
#ifdef WITH_OPENIMAGEIO
# include "oiio/openimageio_api.h"
#endif
#include "oiio/openimageio_api.h"
#ifdef WITH_OPENEXR
# include "openexr/openexr_api.h"
@ -183,7 +181,6 @@ const ImFileType IMB_FILE_TYPES[] = {
.default_save_role = COLOR_ROLE_DEFAULT_BYTE,
},
#endif
#ifdef WITH_OPENIMAGEIO
{
.init = NULL,
.exit = NULL,
@ -196,7 +193,6 @@ const ImFileType IMB_FILE_TYPES[] = {
.filetype = IMB_FTYPE_PSD,
.default_save_role = COLOR_ROLE_DEFAULT_FLOAT,
},
#endif
#ifdef WITH_WEBP
{
.init = NULL,

View File

@ -13,7 +13,7 @@ set(INC
)
set(INC_SYS
${OPENIMAGEIO_INCLUDE_DIRS}
)
set(SRC
@ -23,37 +23,17 @@ set(SRC
)
set(LIB
${OPENIMAGEIO_LIBRARIES}
${PUGIXML_LIBRARIES}
)
if(WITH_OPENIMAGEIO)
if(WITH_IMAGE_OPENEXR)
list(APPEND INC_SYS
${OPENIMAGEIO_INCLUDE_DIRS}
${OPENEXR_INCLUDE_DIRS}
)
if(WITH_BOOST)
list(APPEND INC_SYS
${BOOST_INCLUDE_DIR}
)
endif()
list(APPEND LIB
${OPENIMAGEIO_LIBRARIES}
${PUGIXML_LIBRARIES}
${OPENEXR_LIBRARIES}
)
if(WITH_IMAGE_OPENEXR)
list(APPEND INC_SYS
${OPENEXR_INCLUDE_DIRS}
)
list(APPEND LIB
${OPENEXR_LIBRARIES}
)
endif()
if(WITH_BOOST)
list(APPEND LIB
${BOOST_LIBRARIES}
)
endif()
add_definitions(-DWITH_OPENIMAGEIO)
endif()
blender_add_lib(bf_imbuf_openimageio "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View File

@ -60,9 +60,7 @@ const char *imb_ext_image[] = {
#ifdef WITH_OPENEXR
".exr",
#endif
#ifdef WITH_OPENIMAGEIO
".psd", ".pdd", ".psb",
#endif
#ifdef WITH_WEBP
".webp",
#endif
@ -70,11 +68,9 @@ const char *imb_ext_image[] = {
};
const char *imb_ext_image_filepath_only[] = {
#ifdef WITH_OPENIMAGEIO
".psd",
".pdd",
".psb",
#endif
NULL,
};

View File

@ -242,10 +242,6 @@ if(WITH_IMAGE_OPENEXR)
add_definitions(-DWITH_OPENEXR)
endif()
if(WITH_OPENIMAGEIO)
add_definitions(-DWITH_OPENIMAGEIO)
endif()
if(WITH_IMAGE_TIFF)
add_definitions(-DWITH_TIFF)
endif()

View File

@ -179,6 +179,10 @@ static void rna_Mesh_flip_normals(Mesh *mesh)
DEG_id_tag_update(&mesh->id, 0);
}
static void rna_Mesh_calc_normals(Mesh *UNUSED(mesh))
{
}
static void rna_Mesh_split_faces(Mesh *mesh, bool UNUSED(free_loop_normals))
{
ED_mesh_split_faces(mesh);
@ -224,8 +228,9 @@ void RNA_api_mesh(StructRNA *srna)
"Invert winding of all polygons "
"(clears tessellation, does not handle custom normals)");
func = RNA_def_function(srna, "calc_normals", "BKE_mesh_calc_normals");
RNA_def_function_ui_description(func, "Calculate vertex normals");
func = RNA_def_function(srna, "calc_normals", "rna_Mesh_calc_normals");
RNA_def_function_ui_description(
func, "Deprecated. Has no effect. Normals are calculated upon retrieval");
func = RNA_def_function(srna, "create_normals_split", "rna_Mesh_create_normals_split");
RNA_def_function_ui_description(func, "Empty split vertex normals");

View File

@ -2384,24 +2384,24 @@ static void rna_Node_parent_set(PointerRNA *ptr,
bNode *parent = value.data;
bNodeTree *ntree = (bNodeTree *)ptr->owner_id;
if (parent) {
/* XXX only Frame node allowed for now,
* in the future should have a poll function or so to test possible attachment.
*/
if (parent->type != NODE_FRAME) {
return;
}
if (!parent) {
nodeDetachNode(ntree, node);
return;
}
/* make sure parent is not attached to the node */
if (nodeAttachNodeCheck(parent, node)) {
return;
}
/* XXX only Frame node allowed for now,
* in the future should have a poll function or so to test possible attachment.
*/
if (parent->type != NODE_FRAME) {
return;
}
if (nodeIsParentAndChild(node, parent)) {
return;
}
nodeDetachNode(ntree, node);
if (parent) {
nodeAttachNode(ntree, node, parent);
}
nodeAttachNode(ntree, node, parent);
}
static void rna_Node_internal_links_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
@ -2425,8 +2425,7 @@ static bool rna_Node_parent_poll(PointerRNA *ptr, PointerRNA value)
return false;
}
/* make sure parent is not attached to the node */
if (nodeAttachNodeCheck(parent, node)) {
if (node->type == NODE_FRAME && nodeIsParentAndChild(node, parent)) {
return false;
}

View File

@ -644,7 +644,7 @@ static SeqRetimingHandle *rna_Sequence_retiming_handles_add(ID *id,
{
Scene *scene = (Scene *)id;
SeqRetimingHandle *handle = SEQ_retiming_add_handle(seq, timeline_frame);
SeqRetimingHandle *handle = SEQ_retiming_add_handle(scene, seq, timeline_frame);
SEQ_relations_invalidate_cache_raw(scene, seq);
WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);

View File

@ -11,6 +11,7 @@ set(INC
../../editors/include
../../gpu
../../imbuf
../../imbuf/intern/oiio
../../makesdna
../../makesrna
../../windowmanager
@ -219,10 +220,6 @@ if(WITH_IMAGE_OPENEXR)
add_definitions(-DWITH_OPENEXR)
endif()
if(WITH_OPENIMAGEIO)
add_definitions(-DWITH_OPENIMAGEIO)
endif()
if(WITH_IMAGE_OPENJPEG)
add_definitions(-DWITH_OPENJPEG)
endif()
@ -351,13 +348,6 @@ if(WITH_USD)
)
endif()
if(WITH_OPENIMAGEIO)
add_definitions(-DWITH_OPENIMAGEIO)
list(APPEND INC
../../imbuf/intern/oiio
)
endif()
if(WITH_OPENSUBDIV)
add_definitions(-DWITH_OPENSUBDIV)
list(APPEND INC

View File

@ -11,9 +11,7 @@
#include "../generic/py_capi_utils.h"
#ifdef WITH_OPENIMAGEIO
# include "openimageio_api.h"
#endif
#include "openimageio_api.h"
static PyTypeObject BlenderAppOIIOType;
@ -36,32 +34,20 @@ static PyObject *make_oiio_info(void)
PyObject *oiio_info;
int pos = 0;
#ifdef WITH_OPENIMAGEIO
int curversion;
#endif
oiio_info = PyStructSequence_New(&BlenderAppOIIOType);
if (oiio_info == NULL) {
return NULL;
}
#ifndef WITH_OPENIMAGEIO
# define SetStrItem(str) PyStructSequence_SET_ITEM(oiio_info, pos++, PyUnicode_FromString(str))
#endif
#define SetObjItem(obj) PyStructSequence_SET_ITEM(oiio_info, pos++, obj)
#ifdef WITH_OPENIMAGEIO
curversion = OIIO_getVersionHex();
SetObjItem(PyBool_FromLong(1));
SetObjItem(PyC_Tuple_Pack_I32(curversion / 10000, (curversion / 100) % 100, curversion % 100));
SetObjItem(PyUnicode_FromFormat(
"%2d, %2d, %2d", curversion / 10000, (curversion / 100) % 100, curversion % 100));
#else
SetObjItem(PyBool_FromLong(0));
SetObjItem(PyC_Tuple_Pack_I32(0, 0, 0));
SetStrItem("Unknown");
#endif
if (UNLIKELY(PyErr_Occurred())) {
Py_DECREF(oiio_info);

View File

@ -26,7 +26,9 @@ bool SEQ_retiming_is_allowed(const struct Sequence *seq);
* This function always reallocates memory, so when function is used all stored pointers will
* become invalid.
*/
struct SeqRetimingHandle *SEQ_retiming_add_handle(struct Sequence *seq, const int timeline_frame);
struct SeqRetimingHandle *SEQ_retiming_add_handle(struct Scene *scene,
struct Sequence *seq,
const int timeline_frame);
struct SeqRetimingHandle *SEQ_retiming_last_handle_get(const struct Sequence *seq);
void SEQ_retiming_remove_handle(struct Sequence *seq, struct SeqRetimingHandle *handle);
void SEQ_retiming_offset_handle(const struct Scene *scene,
@ -38,6 +40,9 @@ float SEQ_retiming_handle_speed_get(const struct Scene *scene,
const struct SeqRetimingHandle *handle);
int SEQ_retiming_handle_index_get(const struct Sequence *seq,
const struct SeqRetimingHandle *handle);
float SEQ_retiming_handle_timeline_frame_get(const struct Scene *scene,
const struct Sequence *seq,
const struct SeqRetimingHandle *handle);
#ifdef __cplusplus
}
#endif

View File

@ -126,7 +126,7 @@ bool SEQ_retiming_is_allowed(const Sequence *seq)
SEQ_TYPE_MASK);
}
float seq_retiming_evaluate(const Sequence *seq, const int frame_index)
float seq_retiming_evaluate(const Scene *scene, const Sequence *seq, const int frame_index)
{
const SeqRetimingHandle *previous_handle = retiming_find_segment_start_handle(seq, frame_index);
const SeqRetimingHandle *next_handle = previous_handle + 1;
@ -147,10 +147,11 @@ float seq_retiming_evaluate(const Sequence *seq, const int frame_index)
return previous_handle->retiming_factor + (target_diff * segment_fac);
}
SeqRetimingHandle *SEQ_retiming_add_handle(Sequence *seq, const int timeline_frame)
SeqRetimingHandle *SEQ_retiming_add_handle(Scene *scene, Sequence *seq, const int timeline_frame)
{
float frame_index = timeline_frame - SEQ_time_start_frame_get(seq);
float value = seq_retiming_evaluate(seq, frame_index);
float frame_index = (timeline_frame - SEQ_time_start_frame_get(seq)) *
seq_time_media_playback_rate_factor_get(scene, seq);
float value = seq_retiming_evaluate(scene, seq, frame_index);
const SeqRetimingHandle *closest_handle = retiming_find_segment_start_handle(seq, frame_index);
if (closest_handle->strip_frame_index == frame_index) {
@ -195,7 +196,7 @@ void SEQ_retiming_offset_handle(const Scene *scene,
MutableSpan handles = SEQ_retiming_handles_get(seq);
for (; handle < handles.end(); handle++) {
handle->strip_frame_index += offset;
handle->strip_frame_index += offset * seq_time_media_playback_rate_factor_get(scene, seq);
}
SEQ_time_update_meta_strip_range(scene, seq_sequence_lookup_meta_by_seq(scene, seq));
@ -245,3 +246,11 @@ float SEQ_retiming_handle_speed_get(const Scene *scene,
const float speed = float(fragment_length_retimed) / float(fragment_length_original);
return speed;
}
float SEQ_retiming_handle_timeline_frame_get(const Scene *scene,
const Sequence *seq,
const SeqRetimingHandle *handle)
{
return SEQ_time_start_frame_get(seq) +
handle->strip_frame_index / seq_time_media_playback_rate_factor_get(scene, seq);
}

View File

@ -59,7 +59,7 @@ int seq_time_strip_original_content_length_get(const Scene *scene, const Sequenc
return seq->len;
}
return seq->len / seq_time_media_playback_rate_factor_get(scene, seq);
return seq->len;
}
float seq_give_frame_index(const Scene *scene, Sequence *seq, float timeline_frame)
@ -84,15 +84,17 @@ float seq_give_frame_index(const Scene *scene, Sequence *seq, float timeline_fra
frame_index = timeline_frame - sta;
}
frame_index = max_ff(frame_index, 0);
frame_index *= seq_time_media_playback_rate_factor_get(scene, seq);
if (SEQ_retiming_is_active(seq)) {
const float retiming_factor = seq_retiming_evaluate(seq, frame_index);
const float retiming_factor = seq_retiming_evaluate(scene, seq, frame_index);
frame_index = retiming_factor * (length - 1);
}
else {
frame_index *= seq_time_media_playback_rate_factor_get(scene, seq);
/* Clamp frame index to strip frame range. */
frame_index = clamp_f(frame_index, 0, end - sta);
}
/* Clamp frame index to strip content frame range. */
frame_index = clamp_f(frame_index, 0, length);
if (seq->strobe < 1.0f) {
seq->strobe = 1.0f;
@ -507,10 +509,12 @@ int SEQ_time_strip_length_get(const Scene *scene, const Sequence *seq)
if (SEQ_retiming_is_active(seq)) {
SeqRetimingHandle *handle_start = seq->retiming_handles;
SeqRetimingHandle *handle_end = seq->retiming_handles + (SEQ_retiming_handles_count(seq) - 1);
return handle_end->strip_frame_index - handle_start->strip_frame_index + 1;
return handle_end->strip_frame_index / seq_time_media_playback_rate_factor_get(scene, seq) -
(handle_start->strip_frame_index + 1) /
seq_time_media_playback_rate_factor_get(scene, seq);
}
return seq_time_strip_original_content_length_get(scene, seq);
return seq->len / seq_time_media_playback_rate_factor_get(scene, seq);
}
float SEQ_time_start_frame_get(const Sequence *seq)

View File

@ -45,7 +45,9 @@ float seq_time_media_playback_rate_factor_get(const struct Scene *scene,
const struct Sequence *seq);
int seq_time_strip_original_content_length_get(const struct Scene *scene,
const struct Sequence *seq);
float seq_retiming_evaluate(const struct Sequence *seq, const int frame_index);
float seq_retiming_evaluate(const struct Scene *scene,
const struct Sequence *seq,
const int frame_index);
#ifdef __cplusplus
}