Merge branch 'blender-v2.82-release'

This commit is contained in:
Sergey Sharybin 2020-01-24 12:49:49 +01:00
commit 11df5443e5
Notes: blender-bot 2023-02-14 03:59:42 +01:00
Referenced by issue #73364, Crash when calling particle_sytem.co_hair() on disabled particles
Referenced by issue #72679, Vertex Color on the Viewport Shading causes crash
6 changed files with 120 additions and 76 deletions

View File

@ -83,6 +83,8 @@ void IDP_FreeString(struct IDProperty *prop) ATTR_NONNULL();
typedef void (*IDPWalkFunc)(void *userData, IDProperty *idp);
void IDP_AssignID(IDProperty *prop, ID *id, const int flag);
/*-------- Group Functions -------*/
/** Sync values from one group to another, only where they match */

View File

@ -461,6 +461,21 @@ static IDProperty *IDP_CopyID(const IDProperty *prop, const int flag)
return newp;
}
void IDP_AssignID(IDProperty *prop, ID *id, const int flag)
{
BLI_assert(prop->type == IDP_ID);
if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0 && IDP_Id(prop) != NULL) {
id_us_min(IDP_Id(prop));
}
prop->data.pointer = id;
if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) {
id_us_plus(IDP_Id(prop));
}
}
/** \} */
/* -------------------------------------------------------------------- */

View File

@ -183,44 +183,42 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr,
node_identifier.operation_name = "";
node_identifier.operation_name_tag = -1;
/* Handling of commonly known scenarios. */
if (ptr->type == &RNA_PoseBone) {
if (prop != NULL && RNA_property_is_idprop(prop)) {
node_identifier.type = NodeType::PARAMETERS;
node_identifier.operation_code = OperationCode::ID_PROPERTY;
node_identifier.operation_name = RNA_property_identifier(
reinterpret_cast<const PropertyRNA *>(prop));
return node_identifier;
}
else if (ptr->type == &RNA_PoseBone) {
const bPoseChannel *pchan = static_cast<const bPoseChannel *>(ptr->data);
if (prop != NULL && RNA_property_is_idprop(prop)) {
node_identifier.type = NodeType::PARAMETERS;
node_identifier.operation_code = OperationCode::ID_PROPERTY;
node_identifier.operation_name = RNA_property_identifier(
reinterpret_cast<const PropertyRNA *>(prop));
node_identifier.operation_name_tag = -1;
}
else {
/* Bone - generally, we just want the bone component. */
node_identifier.type = NodeType::BONE;
node_identifier.component_name = pchan->name;
/* However check property name for special handling. */
if (prop != NULL) {
Object *object = reinterpret_cast<Object *>(node_identifier.id);
const char *prop_name = RNA_property_identifier(prop);
/* B-Bone properties should connect to the final operation. */
if (STRPREFIX(prop_name, "bbone_")) {
if (builder_->check_pchan_has_bbone_segments(object, pchan)) {
node_identifier.operation_code = OperationCode::BONE_SEGMENTS;
}
else {
node_identifier.operation_code = OperationCode::BONE_DONE;
}
/* Bone - generally, we just want the bone component. */
node_identifier.type = NodeType::BONE;
node_identifier.component_name = pchan->name;
/* However check property name for special handling. */
if (prop != NULL) {
Object *object = reinterpret_cast<Object *>(node_identifier.id);
const char *prop_name = RNA_property_identifier(prop);
/* B-Bone properties should connect to the final operation. */
if (STRPREFIX(prop_name, "bbone_")) {
if (builder_->check_pchan_has_bbone_segments(object, pchan)) {
node_identifier.operation_code = OperationCode::BONE_SEGMENTS;
}
/* Final transform properties go to the Done node for the exit. */
else if (STREQ(prop_name, "head") || STREQ(prop_name, "tail") ||
STREQ(prop_name, "length") || STRPREFIX(prop_name, "matrix")) {
if (source == RNAPointerSource::EXIT) {
node_identifier.operation_code = OperationCode::BONE_DONE;
}
}
/* And other properties can always go to the entry operation. */
else {
node_identifier.operation_code = OperationCode::BONE_LOCAL;
node_identifier.operation_code = OperationCode::BONE_DONE;
}
}
/* Final transform properties go to the Done node for the exit. */
else if (STREQ(prop_name, "head") || STREQ(prop_name, "tail") ||
STREQ(prop_name, "length") || STRPREFIX(prop_name, "matrix")) {
if (source == RNAPointerSource::EXIT) {
node_identifier.operation_code = OperationCode::BONE_DONE;
}
}
/* And other properties can always go to the entry operation. */
else {
node_identifier.operation_code = OperationCode::BONE_LOCAL;
}
}
return node_identifier;
}
@ -374,18 +372,10 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr,
}
if (prop != NULL) {
/* All unknown data effectively falls under "parameter evaluation". */
if (RNA_property_is_idprop(prop)) {
node_identifier.type = NodeType::PARAMETERS;
node_identifier.operation_code = OperationCode::ID_PROPERTY;
node_identifier.operation_name = RNA_property_identifier((PropertyRNA *)prop);
node_identifier.operation_name_tag = -1;
}
else {
node_identifier.type = NodeType::PARAMETERS;
node_identifier.operation_code = OperationCode::PARAMETERS_EVAL;
node_identifier.operation_name = "";
node_identifier.operation_name_tag = -1;
}
node_identifier.type = NodeType::PARAMETERS;
node_identifier.operation_code = OperationCode::PARAMETERS_EVAL;
node_identifier.operation_name = "";
node_identifier.operation_name_tag = -1;
return node_identifier;
}
return node_identifier;

View File

@ -3762,25 +3762,59 @@ void RNA_property_pointer_set(PointerRNA *ptr,
ReportList *reports)
{
PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
IDProperty *idprop = rna_idproperty_check(&prop, ptr);
BLI_assert(RNA_property_type(prop) == PROP_POINTER);
/* Check types */
if (ptr_value.type != NULL && !RNA_struct_is_a(ptr_value.type, pprop->type)) {
BKE_reportf(reports,
RPT_ERROR,
"%s: expected %s type, not %s.\n",
__func__,
pprop->type->identifier,
ptr_value.type->identifier);
return;
/* Check types. */
if (pprop->set != NULL) {
/* Assigning to a real RNA property. */
if (ptr_value.type != NULL && !RNA_struct_is_a(ptr_value.type, pprop->type)) {
BKE_reportf(reports,
RPT_ERROR,
"%s: expected %s type, not %s.\n",
__func__,
pprop->type->identifier,
ptr_value.type->identifier);
return;
}
}
else {
/* Assigning to an IDProperty desguised as RNA one. */
if (ptr_value.type != NULL && !RNA_struct_is_a(ptr_value.type, &RNA_ID)) {
BKE_reportf(reports,
RPT_ERROR,
"%s: expected ID type, not %s.\n",
__func__,
ptr_value.type->identifier);
return;
}
}
/* RNA */
if (pprop->set && !((prop->flag & PROP_NEVER_NULL) && ptr_value.data == NULL) &&
!((prop->flag & PROP_ID_SELF_CHECK) && ptr->owner_id == ptr_value.owner_id)) {
/* We got an existing IDProperty. */
if (idprop != NULL) {
/* Not-yet-defined ID IDProps have an IDP_GROUP type, not an IDP_ID one - because of reasons?
* XXX This has to be investigated fully - there might be a good reason for it, but off hands
* this seems really weird... */
if (idprop->type == IDP_ID) {
IDP_AssignID(idprop, ptr_value.data, 0);
rna_idproperty_touch(idprop);
}
else {
BLI_assert(idprop->type == IDP_GROUP);
IDPropertyTemplate val = {.id = ptr_value.data};
IDProperty *group = RNA_struct_idprops(ptr, true);
BLI_assert(group != NULL);
IDP_ReplaceInGroup_ex(group, IDP_New(IDP_ID, &val, idprop->name), idprop);
}
}
/* RNA property. */
else if (pprop->set && !((prop->flag & PROP_NEVER_NULL) && ptr_value.data == NULL) &&
!((prop->flag & PROP_ID_SELF_CHECK) && ptr->owner_id == ptr_value.owner_id)) {
pprop->set(ptr, ptr_value, reports);
}
/* IDProperty */
/* IDProperty desguised as RNA property (and not yet defined in ptr). */
else if (prop->flag & PROP_EDITABLE) {
IDPropertyTemplate val = {0};
IDProperty *group;

View File

@ -78,29 +78,11 @@ set(LIB
bf_blenlib
)
# Source: https://github.com/PixarAnimationStudios/USD/blob/master/BUILDING.md#linking-whole-archives
if(WIN32)
list(APPEND LIB
${USD_LIBRARIES}
)
elseif(CMAKE_COMPILER_IS_GNUCXX)
list(APPEND LIB
-Wl,--whole-archive ${USD_LIBRARIES} -Wl,--no-whole-archive
)
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
list(APPEND LIB
-Wl,-force_load ${USD_LIBRARIES}
)
else()
message(FATAL_ERROR "Unknown how to link USD with your compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
list(APPEND LIB
${BOOST_LIBRARIES}
)
list(APPEND LIB
${TBB_LIBRARIES}
)
blender_add_lib(bf_usd "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
@ -111,3 +93,16 @@ if(WIN32)
set_property(TARGET bf_usd APPEND_STRING PROPERTY LINK_FLAGS_RELWITHDEBINFO " /WHOLEARCHIVE:${USD_RELEASE_LIB}")
set_property(TARGET bf_usd APPEND_STRING PROPERTY LINK_FLAGS_MINSIZEREL " /WHOLEARCHIVE:${USD_RELEASE_LIB}")
endif()
# Source: https://github.com/PixarAnimationStudios/USD/blob/master/BUILDING.md#linking-whole-archives
if(WIN32)
target_link_libraries(bf_usd ${USD_LIBRARIES})
elseif(CMAKE_COMPILER_IS_GNUCXX)
target_link_libraries(bf_usd "-Wl,--whole-archive ${USD_LIBRARIES} -Wl,--no-whole-archive ${TBB_LIBRARIES}")
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
target_link_libraries(bf_usd -Wl,-force_load ${USD_LIBRARIES})
else()
message(FATAL_ERROR "Unknown how to link USD with your compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
target_link_libraries(bf_usd ${TBB_LIBRARIES})

View File

@ -38,6 +38,14 @@ blender_include_dirs(
)
set(LIB
# This forces TBB libraries to be in front of MKL (which is a part of OpenImageDenoise).
#
# The need of this comes to need to ensure static libraries initialization order, making it
# so TBB is initialized prior to MKL (or any other dpeendnecy).
#
# This isn't fully robust but seems to work.
${TBB_LIBRARIES}
bf_windowmanager
)