forked from blender/blender
Cleanup: Reduce use and scope of templates in vertex paint #2
@ -27,7 +27,7 @@ ccl_device void spot_light_uv(const float3 ray,
|
|||||||
ccl_private float *u,
|
ccl_private float *u,
|
||||||
ccl_private float *v)
|
ccl_private float *v)
|
||||||
{
|
{
|
||||||
/* Ensures that the spot light projects the full image regarless of the spot angle. */
|
/* Ensures that the spot light projects the full image regardless of the spot angle. */
|
||||||
const float factor = half_cot_half_spot_angle / ray.z;
|
const float factor = half_cot_half_spot_angle / ray.z;
|
||||||
|
|
||||||
/* NOTE: Return barycentric coordinates in the same notation as Embree and OptiX. */
|
/* NOTE: Return barycentric coordinates in the same notation as Embree and OptiX. */
|
||||||
|
@ -151,10 +151,10 @@ ccl_device_inline void sample_uniform_cone_concentric(const float3 N,
|
|||||||
* hemisphere doesn't change the radius. For the latter, r_cone(rand) =
|
* hemisphere doesn't change the radius. For the latter, r_cone(rand) =
|
||||||
* sin_from_cos(mix(cos_angle, 1, rand)).
|
* sin_from_cos(mix(cos_angle, 1, rand)).
|
||||||
*
|
*
|
||||||
* So, to remap, we just invert r_disk (-> rand(r_disk) = r_disk^2) and insert it into r_cone:
|
* So, to remap, we just invert r_disk `(-> rand(r_disk) = r_disk^2)` and insert it into
|
||||||
* r_cone(r_disk) = r_cone(rand(r_disk)) = sin_from_cos(mix(cos_angle, 1, r_disk^2)). In
|
* r_cone: `r_cone(r_disk) = r_cone(rand(r_disk)) = sin_from_cos(mix(cos_angle, 1, r_disk^2))`.
|
||||||
* practise, we need to replace `rand` with `1 - rand` to preserve the stratification, but
|
* In practice, we need to replace `rand` with `1 - rand` to preserve the stratification,
|
||||||
* since it's uniform, that's fine. */
|
* but since it's uniform, that's fine. */
|
||||||
float2 xy = concentric_sample_disk(rand);
|
float2 xy = concentric_sample_disk(rand);
|
||||||
const float r2 = len_squared(xy);
|
const float r2 = len_squared(xy);
|
||||||
|
|
||||||
|
@ -6097,8 +6097,8 @@ static GHOST_TSuccess getCursorPositionClientRelative_impl(
|
|||||||
y = wl_fixed_to_int(win->wl_fixed_to_window(xy_wrap[1]));
|
y = wl_fixed_to_int(win->wl_fixed_to_window(xy_wrap[1]));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
x = win->wl_fixed_to_window(seat_state_pointer->xy[0]);
|
x = wl_fixed_to_int(win->wl_fixed_to_window(seat_state_pointer->xy[0]));
|
||||||
y = win->wl_fixed_to_window(seat_state_pointer->xy[1]);
|
y = wl_fixed_to_int(win->wl_fixed_to_window(seat_state_pointer->xy[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
|
@ -40,8 +40,9 @@ struct bAction *BKE_action_add(struct Main *bmain, const char name[]);
|
|||||||
|
|
||||||
/* Action API ----------------- */
|
/* Action API ----------------- */
|
||||||
|
|
||||||
/* types of transforms applied to the given item
|
/**
|
||||||
* - these are the return flags for action_get_item_transforms()
|
* Types of transforms applied to the given item:
|
||||||
|
* - these are the return flags for #BKE_action_get_item_transform_flags()
|
||||||
*/
|
*/
|
||||||
typedef enum eAction_TransformFlags {
|
typedef enum eAction_TransformFlags {
|
||||||
/* location */
|
/* location */
|
||||||
@ -69,7 +70,7 @@ typedef enum eAction_TransformFlags {
|
|||||||
* - if 'curves' is provided, a list of links to these curves are also returned
|
* - if 'curves' is provided, a list of links to these curves are also returned
|
||||||
* whose nodes WILL NEED FREEING.
|
* whose nodes WILL NEED FREEING.
|
||||||
*/
|
*/
|
||||||
short action_get_item_transforms(struct bAction *act,
|
eAction_TransformFlags BKE_action_get_item_transform_flags(struct bAction *act,
|
||||||
struct Object *ob,
|
struct Object *ob,
|
||||||
struct bPoseChannel *pchan,
|
struct bPoseChannel *pchan,
|
||||||
ListBase *curves);
|
ListBase *curves);
|
||||||
@ -77,16 +78,21 @@ short action_get_item_transforms(struct bAction *act,
|
|||||||
/**
|
/**
|
||||||
* Calculate the extents of given action.
|
* Calculate the extents of given action.
|
||||||
*/
|
*/
|
||||||
void calc_action_range(const struct bAction *act, float *start, float *end, short incl_modifiers);
|
void BKE_action_frame_range_calc(const struct bAction *act,
|
||||||
|
bool include_modifiers,
|
||||||
|
float *r_start,
|
||||||
|
float *r_end);
|
||||||
|
|
||||||
/* Retrieve the intended playback frame range, using the manually set range if available,
|
/**
|
||||||
* or falling back to scanning F-Curves for their first & last frames otherwise. */
|
* Retrieve the intended playback frame range, using the manually set range if available,
|
||||||
void BKE_action_get_frame_range(const struct bAction *act, float *r_start, float *r_end);
|
* or falling back to scanning F-Curves for their first & last frames otherwise.
|
||||||
|
*/
|
||||||
|
void BKE_action_frame_range_get(const struct bAction *act, float *r_start, float *r_end);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the given action has any keyframes.
|
* Check if the given action has any keyframes.
|
||||||
*/
|
*/
|
||||||
bool action_has_motion(const struct bAction *act);
|
bool BKE_action_has_motion(const struct bAction *act);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the action configured as cyclic.
|
* Is the action configured as cyclic.
|
||||||
|
@ -818,7 +818,9 @@ void node_type_storage(struct bNodeType *ntype,
|
|||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
|
||||||
/* ************** COMMON NODES *************** */
|
/* -------------------------------------------------------------------- */
|
||||||
|
/** \name Common Node Types
|
||||||
|
* \{ */
|
||||||
|
|
||||||
#define NODE_UNDEFINED -2 /* node type is not registered */
|
#define NODE_UNDEFINED -2 /* node type is not registered */
|
||||||
#define NODE_CUSTOM -1 /* for dynamically registered custom types */
|
#define NODE_CUSTOM -1 /* for dynamically registered custom types */
|
||||||
@ -845,7 +847,7 @@ void node_type_storage(struct bNodeType *ntype,
|
|||||||
*
|
*
|
||||||
* - nodetree:
|
* - nodetree:
|
||||||
* The actual bNodeTree data block.
|
* The actual bNodeTree data block.
|
||||||
* Check nodetree->idname or nodetree->typeinfo to use only specific types.
|
* Check `nodetree->idname` or `nodetree->typeinfo` to use only specific types.
|
||||||
*
|
*
|
||||||
* - id:
|
* - id:
|
||||||
* The owner of the bNodeTree data block.
|
* The owner of the bNodeTree data block.
|
||||||
|
@ -108,7 +108,7 @@ static void action_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src,
|
|||||||
for (fcurve_src = action_src->curves.first; fcurve_src; fcurve_src = fcurve_src->next) {
|
for (fcurve_src = action_src->curves.first; fcurve_src; fcurve_src = fcurve_src->next) {
|
||||||
/* Duplicate F-Curve. */
|
/* Duplicate F-Curve. */
|
||||||
|
|
||||||
/* XXX TODO: pass subdata flag?
|
/* XXX TODO: pass sub-data flag?
|
||||||
* But surprisingly does not seem to be doing any ID reference-counting. */
|
* But surprisingly does not seem to be doing any ID reference-counting. */
|
||||||
fcurve_dst = BKE_fcurve_copy(fcurve_src);
|
fcurve_dst = BKE_fcurve_copy(fcurve_src);
|
||||||
|
|
||||||
@ -1334,7 +1334,7 @@ void BKE_pose_remove_group_index(bPose *pose, const int index)
|
|||||||
|
|
||||||
/* ************** F-Curve Utilities for Actions ****************** */
|
/* ************** F-Curve Utilities for Actions ****************** */
|
||||||
|
|
||||||
bool action_has_motion(const bAction *act)
|
bool BKE_action_has_motion(const bAction *act)
|
||||||
{
|
{
|
||||||
FCurve *fcu;
|
FCurve *fcu;
|
||||||
|
|
||||||
@ -1392,7 +1392,10 @@ bool BKE_action_has_single_frame(const bAction *act)
|
|||||||
return found_key;
|
return found_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
void calc_action_range(const bAction *act, float *start, float *end, short incl_modifiers)
|
void BKE_action_frame_range_calc(const bAction *act,
|
||||||
|
bool include_modifiers,
|
||||||
|
float *r_start,
|
||||||
|
float *r_end)
|
||||||
{
|
{
|
||||||
FCurve *fcu;
|
FCurve *fcu;
|
||||||
float min = 999999999.0f, max = -999999999.0f;
|
float min = 999999999.0f, max = -999999999.0f;
|
||||||
@ -1419,10 +1422,10 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
|
|||||||
foundvert = 1;
|
foundvert = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if incl_modifiers is enabled, need to consider modifiers too
|
/* if include_modifiers is enabled, need to consider modifiers too
|
||||||
* - only really care about the last modifier
|
* - only really care about the last modifier
|
||||||
*/
|
*/
|
||||||
if ((incl_modifiers) && (fcu->modifiers.last)) {
|
if ((include_modifiers) && (fcu->modifiers.last)) {
|
||||||
FModifier *fcm = fcu->modifiers.last;
|
FModifier *fcm = fcu->modifiers.last;
|
||||||
|
|
||||||
/* only use the maximum sensible limits of the modifiers if they are more extreme */
|
/* only use the maximum sensible limits of the modifiers if they are more extreme */
|
||||||
@ -1470,23 +1473,23 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
|
|||||||
max += 1.0f;
|
max += 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
*start = max_ff(min, MINAFRAMEF);
|
*r_start = max_ff(min, MINAFRAMEF);
|
||||||
*end = min_ff(max, MAXFRAMEF);
|
*r_end = min_ff(max, MAXFRAMEF);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*start = 0.0f;
|
*r_start = 0.0f;
|
||||||
*end = 1.0f;
|
*r_end = 1.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BKE_action_get_frame_range(const bAction *act, float *r_start, float *r_end)
|
void BKE_action_frame_range_get(const bAction *act, float *r_start, float *r_end)
|
||||||
{
|
{
|
||||||
if (act && (act->flag & ACT_FRAME_RANGE)) {
|
if (act && (act->flag & ACT_FRAME_RANGE)) {
|
||||||
*r_start = act->frame_start;
|
*r_start = act->frame_start;
|
||||||
*r_end = act->frame_end;
|
*r_end = act->frame_end;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
calc_action_range(act, r_start, r_end, false);
|
BKE_action_frame_range_calc(act, r_start, r_end, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure that action is at least 1 frame long (for NLA strips to have a valid length). */
|
/* Ensure that action is at least 1 frame long (for NLA strips to have a valid length). */
|
||||||
@ -1500,7 +1503,10 @@ bool BKE_action_is_cyclic(const bAction *act)
|
|||||||
return act && (act->flag & ACT_FRAME_RANGE) && (act->flag & ACT_CYCLIC);
|
return act && (act->flag & ACT_FRAME_RANGE) && (act->flag & ACT_CYCLIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan, ListBase *curves)
|
eAction_TransformFlags BKE_action_get_item_transform_flags(bAction *act,
|
||||||
|
Object *ob,
|
||||||
|
bPoseChannel *pchan,
|
||||||
|
ListBase *curves)
|
||||||
{
|
{
|
||||||
PointerRNA ptr;
|
PointerRNA ptr;
|
||||||
FCurve *fcu;
|
FCurve *fcu;
|
||||||
|
@ -1352,7 +1352,7 @@ void BKE_animdata_fix_paths_rename_all_ex(Main *bmain,
|
|||||||
} \
|
} \
|
||||||
(void)0
|
(void)0
|
||||||
|
|
||||||
/* another version of this macro for nodetrees */
|
/* Another version of this macro for node-trees. */
|
||||||
#define RENAMEFIX_ANIM_NODETREE_IDS(first, NtId_Type) \
|
#define RENAMEFIX_ANIM_NODETREE_IDS(first, NtId_Type) \
|
||||||
for (id = first; id; id = id->next) { \
|
for (id = first; id; id = id->next) { \
|
||||||
AnimData *adt = BKE_animdata_from_id(id); \
|
AnimData *adt = BKE_animdata_from_id(id); \
|
||||||
|
@ -3237,7 +3237,8 @@ static void animsys_create_action_track_strip(const AnimData *adt,
|
|||||||
|
|
||||||
/* Action range is calculated taking F-Modifiers into account
|
/* Action range is calculated taking F-Modifiers into account
|
||||||
* (which making new strips doesn't do due to the troublesome nature of that). */
|
* (which making new strips doesn't do due to the troublesome nature of that). */
|
||||||
calc_action_range(r_action_strip->act, &r_action_strip->actstart, &r_action_strip->actend, 1);
|
BKE_action_frame_range_calc(
|
||||||
|
r_action_strip->act, true, &r_action_strip->actstart, &r_action_strip->actend);
|
||||||
r_action_strip->start = r_action_strip->actstart;
|
r_action_strip->start = r_action_strip->actstart;
|
||||||
r_action_strip->end = IS_EQF(r_action_strip->actstart, r_action_strip->actend) ?
|
r_action_strip->end = IS_EQF(r_action_strip->actstart, r_action_strip->actend) ?
|
||||||
(r_action_strip->actstart + 1.0f) :
|
(r_action_strip->actstart + 1.0f) :
|
||||||
@ -4002,11 +4003,11 @@ void BKE_animsys_evaluate_all_animation(Main *main, Depsgraph *depsgraph, float
|
|||||||
} \
|
} \
|
||||||
(void)0
|
(void)0
|
||||||
|
|
||||||
/* another macro for the "embedded" nodetree cases
|
/* Another macro for the "embedded" node-tree cases
|
||||||
* - this is like EVAL_ANIM_IDS, but this handles the case "embedded nodetrees"
|
* - This is like #EVAL_ANIM_IDS, but this handles the case "embedded node-trees"
|
||||||
* (i.e. scene/material/texture->nodetree) which we need a special exception
|
* (i.e. `scene/material/texture->nodetree`) which we need a special exception
|
||||||
* for, otherwise they'd get skipped
|
* for, otherwise they'd get skipped.
|
||||||
* - 'ntp' stands for "node tree parent" = data-block where node tree stuff resides
|
* - `ntp` stands for "node tree parent" = data-block where node tree stuff resides.
|
||||||
*/
|
*/
|
||||||
#define EVAL_ANIM_NODETREE_IDS(first, NtId_Type, aflag) \
|
#define EVAL_ANIM_NODETREE_IDS(first, NtId_Type, aflag) \
|
||||||
for (id = first; id; id = id->next) { \
|
for (id = first; id; id = id->next) { \
|
||||||
|
@ -1029,31 +1029,31 @@ void BKE_curveprofile_evaluate_length_portion(const CurveProfile *profile,
|
|||||||
|
|
||||||
/* Find the last point along the path with a lower length portion than the input. */
|
/* Find the last point along the path with a lower length portion than the input. */
|
||||||
int i = 0;
|
int i = 0;
|
||||||
float length_travelled = 0.0f;
|
float length_traveled = 0.0f;
|
||||||
while (length_travelled < requested_length) {
|
while (length_traveled < requested_length) {
|
||||||
/* Check if we reached the last point before the final one. */
|
/* Check if we reached the last point before the final one. */
|
||||||
if (i == BKE_curveprofile_table_size(profile) - 2) {
|
if (i == BKE_curveprofile_table_size(profile) - 2) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
float new_length = curveprofile_distance_to_next_table_point(profile, i);
|
float new_length = curveprofile_distance_to_next_table_point(profile, i);
|
||||||
if (length_travelled + new_length >= requested_length) {
|
if (length_traveled + new_length >= requested_length) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
length_travelled += new_length;
|
length_traveled += new_length;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now travel the remaining distance of length portion down the path to the next point and
|
/* Now travel the remaining distance of length portion down the path to the next point and
|
||||||
* find the location where we stop. */
|
* find the location where we stop. */
|
||||||
float distance_to_next_point = curveprofile_distance_to_next_table_point(profile, i);
|
float distance_to_next_point = curveprofile_distance_to_next_table_point(profile, i);
|
||||||
float lerp_factor = (requested_length - length_travelled) / distance_to_next_point;
|
float lerp_factor = (requested_length - length_traveled) / distance_to_next_point;
|
||||||
|
|
||||||
#ifdef DEBUG_CURVEPROFILE_EVALUATE
|
#ifdef DEBUG_CURVEPROFILE_EVALUATE
|
||||||
printf("CURVEPROFILE EVALUATE\n");
|
printf("CURVEPROFILE EVALUATE\n");
|
||||||
printf(" length portion input: %f\n", double(length_portion));
|
printf(" length portion input: %f\n", double(length_portion));
|
||||||
printf(" requested path length: %f\n", double(requested_length));
|
printf(" requested path length: %f\n", double(requested_length));
|
||||||
printf(" distance to next point: %f\n", double(distance_to_next_point));
|
printf(" distance to next point: %f\n", double(distance_to_next_point));
|
||||||
printf(" length travelled: %f\n", double(length_travelled));
|
printf(" length traveled: %f\n", double(length_traveled));
|
||||||
printf(" lerp-factor: %f\n", double(lerp_factor));
|
printf(" lerp-factor: %f\n", double(lerp_factor));
|
||||||
printf(" ith point (%f, %f)\n", double(profile->path[i].x), double(profile->path[i].y));
|
printf(" ith point (%f, %f)\n", double(profile->path[i].x), double(profile->path[i].y));
|
||||||
printf(" next point(%f, %f)\n", double(profile->path[i + 1].x), double(profile->path[i + 1].y));
|
printf(" next point(%f, %f)\n", double(profile->path[i + 1].x), double(profile->path[i + 1].y));
|
||||||
|
@ -60,8 +60,8 @@ CurvesGeometry::CurvesGeometry(const int point_num, const int curve_num)
|
|||||||
CustomData_reset(&this->point_data);
|
CustomData_reset(&this->point_data);
|
||||||
CustomData_reset(&this->curve_data);
|
CustomData_reset(&this->curve_data);
|
||||||
|
|
||||||
CustomData_add_layer_named(
|
this->attributes_for_write().add<float3>(
|
||||||
&this->point_data, CD_PROP_FLOAT3, CD_CONSTRUCT, this->point_num, ATTR_POSITION.c_str());
|
"position", ATTR_DOMAIN_POINT, AttributeInitConstruct());
|
||||||
|
|
||||||
this->runtime = MEM_new<CurvesGeometryRuntime>(__func__);
|
this->runtime = MEM_new<CurvesGeometryRuntime>(__func__);
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ bool CustomData_MeshMasks_are_matching(const CustomData_MeshMasks *mask_ref,
|
|||||||
/** \} */
|
/** \} */
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/** \name Layer Type Information
|
/** \name Layer Type Information Struct
|
||||||
* \{ */
|
* \{ */
|
||||||
|
|
||||||
struct LayerTypeInfo {
|
struct LayerTypeInfo {
|
||||||
@ -1557,6 +1557,10 @@ static void layerDefault_propquaternion(void *data, const int count)
|
|||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------- */
|
||||||
|
/** \name Layer Type Information (#LAYERTYPEINFO)
|
||||||
|
* \{ */
|
||||||
|
|
||||||
static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
|
static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
|
||||||
/* 0: CD_MVERT */ /* DEPRECATED */
|
/* 0: CD_MVERT */ /* DEPRECATED */
|
||||||
{sizeof(MVert), "MVert", 1, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr},
|
{sizeof(MVert), "MVert", 1, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr},
|
||||||
|
@ -28,12 +28,12 @@
|
|||||||
|
|
||||||
#include "MEM_guardedalloc.h"
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
|
namespace blender::bke {
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/** \name Geometry Component
|
/** \name Geometry Component
|
||||||
* \{ */
|
* \{ */
|
||||||
|
|
||||||
namespace blender::bke {
|
|
||||||
|
|
||||||
GeometryComponent::GeometryComponent(Type type) : type_(type) {}
|
GeometryComponent::GeometryComponent(Type type) : type_(type) {}
|
||||||
|
|
||||||
GeometryComponentPtr GeometryComponent::create(Type component_type)
|
GeometryComponentPtr GeometryComponent::create(Type component_type)
|
||||||
@ -717,6 +717,6 @@ bool object_has_geometry_set_instances(const Object &object)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace blender::bke
|
|
||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
|
||||||
|
} // namespace blender::bke
|
||||||
|
@ -466,7 +466,7 @@ void BKE_idtype_id_foreach_cache(ID *id,
|
|||||||
type_info = BKE_idtype_get_info_from_id(&nodetree->id);
|
type_info = BKE_idtype_get_info_from_id(&nodetree->id);
|
||||||
if (type_info == NULL) {
|
if (type_info == NULL) {
|
||||||
/* Very old .blend file seem to have empty names for their embedded node trees, see
|
/* Very old .blend file seem to have empty names for their embedded node trees, see
|
||||||
* `blo_do_versions_250()`. Assume those are nodetrees then. */
|
* `blo_do_versions_250()`. Assume those are node-trees then. */
|
||||||
type_info = BKE_idtype_get_info_from_idcode(ID_NT);
|
type_info = BKE_idtype_get_info_from_idcode(ID_NT);
|
||||||
}
|
}
|
||||||
if (type_info->foreach_cache != NULL) {
|
if (type_info->foreach_cache != NULL) {
|
||||||
|
@ -593,7 +593,7 @@ static int id_copy_libmanagement_cb(LibraryIDLinkCallbackData *cb_data)
|
|||||||
|
|
||||||
/* Remap self-references to new copied ID. */
|
/* Remap self-references to new copied ID. */
|
||||||
if (id == data->id_src) {
|
if (id == data->id_src) {
|
||||||
/* We cannot use self_id here, it is not *always* id_dst (thanks to $£!+@#&/? nodetrees). */
|
/* We cannot use self_id here, it is not *always* id_dst (thanks to confounded node-trees!). */
|
||||||
id = *id_pointer = data->id_dst;
|
id = *id_pointer = data->id_dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -713,15 +713,15 @@ ID *BKE_id_copy_for_duplicate(Main *bmain,
|
|||||||
ID_NEW_SET(key, key_new);
|
ID_NEW_SET(key, key_new);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NOTE: embedded data (root nodetrees and master collections) should never be referenced by
|
/* NOTE: embedded data (root node-trees and master collections) should never be referenced by
|
||||||
* anything else, so we do not need to set their newid pointer and flag. */
|
* anything else, so we do not need to set their newid pointer and flag. */
|
||||||
|
|
||||||
BKE_animdata_duplicate_id_action(bmain, id_new, duplicate_flags);
|
BKE_animdata_duplicate_id_action(bmain, id_new, duplicate_flags);
|
||||||
if (key_new != NULL) {
|
if (key_new != NULL) {
|
||||||
BKE_animdata_duplicate_id_action(bmain, key_new, duplicate_flags);
|
BKE_animdata_duplicate_id_action(bmain, key_new, duplicate_flags);
|
||||||
}
|
}
|
||||||
/* Note that actions of embedded data (root nodetrees and master collections) are handled
|
/* Note that actions of embedded data (root node-trees and master collections) are handled
|
||||||
* by `BKE_animdata_duplicate_id_action` as well. */
|
* by #BKE_animdata_duplicate_id_action as well. */
|
||||||
}
|
}
|
||||||
return id->newid;
|
return id->newid;
|
||||||
}
|
}
|
||||||
@ -1436,7 +1436,7 @@ void BKE_libblock_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int ori
|
|||||||
|
|
||||||
/* the duplicate should get a copy of the animdata */
|
/* the duplicate should get a copy of the animdata */
|
||||||
if ((flag & LIB_ID_COPY_NO_ANIMDATA) == 0) {
|
if ((flag & LIB_ID_COPY_NO_ANIMDATA) == 0) {
|
||||||
/* Note that even though horrors like root nodetrees are not in bmain, the actions they use
|
/* Note that even though horrors like root node-trees are not in bmain, the actions they use
|
||||||
* in their anim data *are* in bmain... super-mega-hooray. */
|
* in their anim data *are* in bmain... super-mega-hooray. */
|
||||||
BLI_assert((copy_data_flag & LIB_ID_COPY_ACTIONS) == 0 ||
|
BLI_assert((copy_data_flag & LIB_ID_COPY_ACTIONS) == 0 ||
|
||||||
(copy_data_flag & LIB_ID_CREATE_NO_MAIN) == 0);
|
(copy_data_flag & LIB_ID_CREATE_NO_MAIN) == 0);
|
||||||
@ -1837,7 +1837,7 @@ void BKE_library_make_local(Main *bmain,
|
|||||||
BLI_linklist_prepend_arena(&todo_ids, id, linklist_mem);
|
BLI_linklist_prepend_arena(&todo_ids, id, linklist_mem);
|
||||||
id->tag |= LIB_TAG_DOIT;
|
id->tag |= LIB_TAG_DOIT;
|
||||||
|
|
||||||
/* Tag those nasty non-ID nodetrees,
|
/* Tag those nasty non-ID node-trees,
|
||||||
* but do not add them to todo list, making them local is handled by 'owner' ID.
|
* but do not add them to todo list, making them local is handled by 'owner' ID.
|
||||||
* This is needed for library_make_local_copying_check() to work OK at step 2. */
|
* This is needed for library_make_local_copying_check() to work OK at step 2. */
|
||||||
if (ntree != NULL) {
|
if (ntree != NULL) {
|
||||||
|
@ -160,7 +160,7 @@ static void material_free_data(ID *id)
|
|||||||
static void material_foreach_id(ID *id, LibraryForeachIDData *data)
|
static void material_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||||
{
|
{
|
||||||
Material *material = (Material *)id;
|
Material *material = (Material *)id;
|
||||||
/* Nodetrees **are owned by IDs**, treat them as mere sub-data and not real ID! */
|
/* Node-trees **are owned by IDs**, treat them as mere sub-data and not real ID! */
|
||||||
BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(
|
BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(
|
||||||
data, BKE_library_foreach_ID_embedded(data, (ID **)&material->nodetree));
|
data, BKE_library_foreach_ID_embedded(data, (ID **)&material->nodetree));
|
||||||
if (material->texpaintslot != nullptr) {
|
if (material->texpaintslot != nullptr) {
|
||||||
|
@ -205,10 +205,8 @@ void BKE_mesh_calc_edges(Mesh *mesh, bool keep_existing_edges, const bool select
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Create new edges. */
|
/* Create new edges. */
|
||||||
if (!CustomData_has_layer_named(&mesh->ldata, CD_PROP_INT32, ".corner_edge")) {
|
MutableAttributeAccessor attributes = mesh->attributes_for_write();
|
||||||
CustomData_add_layer_named(
|
attributes.add<int>(".corner_edge", ATTR_DOMAIN_CORNER, AttributeInitConstruct());
|
||||||
&mesh->ldata, CD_PROP_INT32, CD_CONSTRUCT, mesh->totloop, ".corner_edge");
|
|
||||||
}
|
|
||||||
MutableSpan<int2> new_edges{
|
MutableSpan<int2> new_edges{
|
||||||
static_cast<int2 *>(MEM_calloc_arrayN(new_totedge, sizeof(int2), __func__)), new_totedge};
|
static_cast<int2 *>(MEM_calloc_arrayN(new_totedge, sizeof(int2), __func__)), new_totedge};
|
||||||
calc_edges::serialize_and_initialize_deduplicated_edges(edge_maps, new_edges);
|
calc_edges::serialize_and_initialize_deduplicated_edges(edge_maps, new_edges);
|
||||||
@ -221,9 +219,8 @@ void BKE_mesh_calc_edges(Mesh *mesh, bool keep_existing_edges, const bool select
|
|||||||
/* Free old CustomData and assign new one. */
|
/* Free old CustomData and assign new one. */
|
||||||
CustomData_free(&mesh->edata, mesh->totedge);
|
CustomData_free(&mesh->edata, mesh->totedge);
|
||||||
CustomData_reset(&mesh->edata);
|
CustomData_reset(&mesh->edata);
|
||||||
CustomData_add_layer_named_with_data(
|
|
||||||
&mesh->edata, CD_PROP_INT32_2D, new_edges.data(), new_totedge, ".edge_verts", nullptr);
|
|
||||||
mesh->totedge = new_totedge;
|
mesh->totedge = new_totedge;
|
||||||
|
attributes.add<int2>(".edge_verts", ATTR_DOMAIN_EDGE, AttributeInitMoveArray(new_edges.data()));
|
||||||
|
|
||||||
if (select_new_edges) {
|
if (select_new_edges) {
|
||||||
MutableAttributeAccessor attributes = mesh->attributes_for_write();
|
MutableAttributeAccessor attributes = mesh->attributes_for_write();
|
||||||
|
@ -69,6 +69,7 @@ static CLG_LogRef LOG = {"bke.mesh_convert"};
|
|||||||
|
|
||||||
static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispbase)
|
static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispbase)
|
||||||
{
|
{
|
||||||
|
using namespace blender;
|
||||||
using namespace blender::bke;
|
using namespace blender::bke;
|
||||||
int a, b, ofs;
|
int a, b, ofs;
|
||||||
const bool conv_polys = (
|
const bool conv_polys = (
|
||||||
@ -127,9 +128,9 @@ static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispba
|
|||||||
"material_index", ATTR_DOMAIN_FACE);
|
"material_index", ATTR_DOMAIN_FACE);
|
||||||
SpanAttributeWriter<bool> sharp_faces = attributes.lookup_or_add_for_write_span<bool>(
|
SpanAttributeWriter<bool> sharp_faces = attributes.lookup_or_add_for_write_span<bool>(
|
||||||
"sharp_face", ATTR_DOMAIN_FACE);
|
"sharp_face", ATTR_DOMAIN_FACE);
|
||||||
|
SpanAttributeWriter<float2> uv_attribute = attributes.lookup_or_add_for_write_span<float2>(
|
||||||
blender::float2 *mloopuv = static_cast<blender::float2 *>(CustomData_add_layer_named(
|
DATA_("UVMap"), ATTR_DOMAIN_CORNER);
|
||||||
&mesh->ldata, CD_PROP_FLOAT2, CD_SET_DEFAULT, mesh->totloop, DATA_("UVMap")));
|
MutableSpan<float2> uv_map = uv_attribute.span;
|
||||||
|
|
||||||
int dst_vert = 0;
|
int dst_vert = 0;
|
||||||
int dst_edge = 0;
|
int dst_edge = 0;
|
||||||
@ -203,11 +204,9 @@ static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispba
|
|||||||
poly_offsets[dst_poly] = dst_loop;
|
poly_offsets[dst_poly] = dst_loop;
|
||||||
material_indices.span[dst_poly] = dl->col;
|
material_indices.span[dst_poly] = dl->col;
|
||||||
|
|
||||||
if (mloopuv) {
|
for (int i = 0; i < 3; i++) {
|
||||||
for (int i = 0; i < 3; i++, mloopuv++) {
|
uv_map[dst_loop + i][0] = (corner_verts[dst_loop + i] - startvert) / float(dl->nr - 1);
|
||||||
(*mloopuv)[0] = (corner_verts[dst_loop + i] - startvert) / float(dl->nr - 1);
|
uv_map[dst_loop + i][1] = 0.0f;
|
||||||
(*mloopuv)[1] = 0.0f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sharp_faces.span[dst_poly] = !is_smooth;
|
sharp_faces.span[dst_poly] = !is_smooth;
|
||||||
@ -260,7 +259,6 @@ static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispba
|
|||||||
poly_offsets[dst_poly] = dst_loop;
|
poly_offsets[dst_poly] = dst_loop;
|
||||||
material_indices.span[dst_poly] = dl->col;
|
material_indices.span[dst_poly] = dl->col;
|
||||||
|
|
||||||
if (mloopuv) {
|
|
||||||
int orco_sizeu = dl->nr - 1;
|
int orco_sizeu = dl->nr - 1;
|
||||||
int orco_sizev = dl->parts - 1;
|
int orco_sizev = dl->parts - 1;
|
||||||
|
|
||||||
@ -275,20 +273,19 @@ static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispba
|
|||||||
orco_sizev++;
|
orco_sizev++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++, mloopuv++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
/* find uv based on vertex index into grid array */
|
/* find uv based on vertex index into grid array */
|
||||||
int v = corner_verts[dst_loop + i] - startvert;
|
int v = corner_verts[dst_loop + i] - startvert;
|
||||||
|
|
||||||
(*mloopuv)[0] = (v / dl->nr) / float(orco_sizev);
|
uv_map[dst_loop + i][0] = (v / dl->nr) / float(orco_sizev);
|
||||||
(*mloopuv)[1] = (v % dl->nr) / float(orco_sizeu);
|
uv_map[dst_loop + i][1] = (v % dl->nr) / float(orco_sizeu);
|
||||||
|
|
||||||
/* cyclic correction */
|
/* cyclic correction */
|
||||||
if (ELEM(i, 1, 2) && (*mloopuv)[0] == 0.0f) {
|
if (ELEM(i, 1, 2) && uv_map[dst_loop + i][0] == 0.0f) {
|
||||||
(*mloopuv)[0] = 1.0f;
|
uv_map[dst_loop + i][0] = 1.0f;
|
||||||
}
|
|
||||||
if (ELEM(i, 0, 1) && (*mloopuv)[1] == 0.0f) {
|
|
||||||
(*mloopuv)[1] = 1.0f;
|
|
||||||
}
|
}
|
||||||
|
if (ELEM(i, 0, 1) && uv_map[dst_loop + i][1] == 0.0f) {
|
||||||
|
uv_map[dst_loop + i][1] = 1.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,6 +308,7 @@ static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispba
|
|||||||
|
|
||||||
material_indices.finish();
|
material_indices.finish();
|
||||||
sharp_faces.finish();
|
sharp_faces.finish();
|
||||||
|
uv_attribute.finish();
|
||||||
|
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
|
@ -481,7 +481,7 @@ NlaStrip *BKE_nlastrip_new(bAction *act)
|
|||||||
/* determine initial range
|
/* determine initial range
|
||||||
* - strip length cannot be 0... ever...
|
* - strip length cannot be 0... ever...
|
||||||
*/
|
*/
|
||||||
BKE_action_get_frame_range(strip->act, &strip->actstart, &strip->actend);
|
BKE_action_frame_range_get(strip->act, &strip->actstart, &strip->actend);
|
||||||
|
|
||||||
strip->start = strip->actstart;
|
strip->start = strip->actstart;
|
||||||
strip->end = IS_EQF(strip->actstart, strip->actend) ? (strip->actstart + 1.0f) : strip->actend;
|
strip->end = IS_EQF(strip->actstart, strip->actend) ? (strip->actstart + 1.0f) : strip->actend;
|
||||||
@ -1580,7 +1580,7 @@ void BKE_nlastrip_recalculate_bounds_sync_action(NlaStrip *strip)
|
|||||||
|
|
||||||
prev_actstart = strip->actstart;
|
prev_actstart = strip->actstart;
|
||||||
|
|
||||||
BKE_action_get_frame_range(strip->act, &strip->actstart, &strip->actend);
|
BKE_action_frame_range_get(strip->act, &strip->actstart, &strip->actend);
|
||||||
|
|
||||||
/* Set start such that key's do not visually move, to preserve the overall animation result. */
|
/* Set start such that key's do not visually move, to preserve the overall animation result. */
|
||||||
strip->start += (strip->actstart - prev_actstart) * strip->scale;
|
strip->start += (strip->actstart - prev_actstart) * strip->scale;
|
||||||
@ -2113,7 +2113,7 @@ void BKE_nla_action_pushdown(AnimData *adt, const bool is_liboverride)
|
|||||||
* as that will cause us grief down the track
|
* as that will cause us grief down the track
|
||||||
*/
|
*/
|
||||||
/* TODO: what about modifiers? */
|
/* TODO: what about modifiers? */
|
||||||
if (action_has_motion(adt->action) == 0) {
|
if (BKE_action_has_motion(adt->action) == 0) {
|
||||||
CLOG_ERROR(&LOG, "action has no data");
|
CLOG_ERROR(&LOG, "action has no data");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -64,11 +64,8 @@ static void pointcloud_init_data(ID *id)
|
|||||||
MEMCPY_STRUCT_AFTER(pointcloud, DNA_struct_default_get(PointCloud), id);
|
MEMCPY_STRUCT_AFTER(pointcloud, DNA_struct_default_get(PointCloud), id);
|
||||||
|
|
||||||
CustomData_reset(&pointcloud->pdata);
|
CustomData_reset(&pointcloud->pdata);
|
||||||
CustomData_add_layer_named(&pointcloud->pdata,
|
pointcloud->attributes_for_write().add<float3>(
|
||||||
CD_PROP_FLOAT3,
|
"position", ATTR_DOMAIN_POINT, blender::bke::AttributeInitConstruct());
|
||||||
CD_CONSTRUCT,
|
|
||||||
pointcloud->totpoint,
|
|
||||||
POINTCLOUD_ATTR_POSITION);
|
|
||||||
|
|
||||||
pointcloud->runtime = new blender::bke::PointCloudRuntime();
|
pointcloud->runtime = new blender::bke::PointCloudRuntime();
|
||||||
}
|
}
|
||||||
|
@ -749,8 +749,6 @@ typedef struct VFontCursor_Params {
|
|||||||
int r_string_offset;
|
int r_string_offset;
|
||||||
} VFontCursor_Params;
|
} VFontCursor_Params;
|
||||||
|
|
||||||
/** \} */
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
VFONT_TO_CURVE_INIT = 0,
|
VFONT_TO_CURVE_INIT = 0,
|
||||||
VFONT_TO_CURVE_BISECT,
|
VFONT_TO_CURVE_BISECT,
|
||||||
|
@ -122,6 +122,8 @@ size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, const
|
|||||||
return srclen;
|
return srclen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** \} */
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/** \name String Append
|
/** \name String Append
|
||||||
* \{ */
|
* \{ */
|
||||||
|
@ -1063,7 +1063,7 @@ template<typename T> void twoface2_test()
|
|||||||
EXPECT_EQ(out.edge.size(), 18);
|
EXPECT_EQ(out.edge.size(), 18);
|
||||||
EXPECT_EQ(out.face.size(), 9);
|
EXPECT_EQ(out.face.size(), 9);
|
||||||
if (out.vert.size() == 10 && out.edge.size() == 18 && out.face.size() == 9) {
|
if (out.vert.size() == 10 && out.edge.size() == 18 && out.face.size() == 9) {
|
||||||
/* Input verts have no dups, so expect output ones match input ones. */
|
/* Input verts have no duplicates, so expect output ones match input ones. */
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
EXPECT_EQ(get_orig_index(out.vert_orig, i), i);
|
EXPECT_EQ(get_orig_index(out.vert_orig, i), i);
|
||||||
}
|
}
|
||||||
|
@ -1754,7 +1754,7 @@ if (!MAIN_VERSION_ATLEAST(bmain, 266, 3)) {
|
|||||||
{
|
{
|
||||||
/* Fix for a very old issue:
|
/* Fix for a very old issue:
|
||||||
* Node names were nominally made unique in r24478 (2.50.8), but the do_versions check
|
* Node names were nominally made unique in r24478 (2.50.8), but the do_versions check
|
||||||
* to update existing node names only applied to bmain->nodetree (i.e. group nodes).
|
* to update existing node names only applied to `bmain->nodetree` (i.e. group nodes).
|
||||||
* Uniqueness is now required for proper preview mapping,
|
* Uniqueness is now required for proper preview mapping,
|
||||||
* so do this now to ensure old files don't break.
|
* so do this now to ensure old files don't break.
|
||||||
*/
|
*/
|
||||||
|
@ -45,7 +45,7 @@ void eval_runtime_data(const ::Depsgraph *depsgraph, Object &object_eval)
|
|||||||
|
|
||||||
} // namespace blender::deg::light_linking
|
} // namespace blender::deg::light_linking
|
||||||
|
|
||||||
/* \} */
|
/** \} */
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/** \name Internal builder API
|
/** \name Internal builder API
|
||||||
@ -504,4 +504,4 @@ void Cache::eval_runtime_data(Object &object_eval) const
|
|||||||
|
|
||||||
} // namespace blender::deg::light_linking
|
} // namespace blender::deg::light_linking
|
||||||
|
|
||||||
/* \} */
|
/** \} */
|
||||||
|
@ -68,7 +68,7 @@ const char *nodeTypeAsString(NodeType type)
|
|||||||
return "OBJECT_FROM_LAYER";
|
return "OBJECT_FROM_LAYER";
|
||||||
case NodeType::HIERARCHY:
|
case NodeType::HIERARCHY:
|
||||||
return "HIERARCHY";
|
return "HIERARCHY";
|
||||||
/* **** Evaluation-Related Outer Types (with Subdata) **** */
|
/* **** Evaluation-Related Outer Types (with Sub-data) **** */
|
||||||
case NodeType::EVAL_POSE:
|
case NodeType::EVAL_POSE:
|
||||||
return "EVAL_POSE";
|
return "EVAL_POSE";
|
||||||
case NodeType::BONE:
|
case NodeType::BONE:
|
||||||
|
@ -103,7 +103,7 @@ enum class NodeType {
|
|||||||
* properly evaluated. Example of this is custom shapes for bones. */
|
* properly evaluated. Example of this is custom shapes for bones. */
|
||||||
VISIBILITY,
|
VISIBILITY,
|
||||||
|
|
||||||
/* **** Evaluation-Related Outer Types (with Subdata) **** */
|
/* **** Evaluation-Related Outer Types (with Sub-data) **** */
|
||||||
|
|
||||||
/* Pose Component - Owner/Container of Bones Eval */
|
/* Pose Component - Owner/Container of Bones Eval */
|
||||||
EVAL_POSE,
|
EVAL_POSE,
|
||||||
|
@ -134,7 +134,7 @@ class ReflectionProbeModule {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove reflection probe data from the module.
|
* Remove reflection probe data from the module.
|
||||||
* Ensures that data_buf is sequential and cubemaps are relinked to its corresponding data.
|
* Ensures that data_buf is sequential and cube-maps are relinked to its corresponding data.
|
||||||
*/
|
*/
|
||||||
void remove_reflection_probe_data(int reflection_probe_data_index);
|
void remove_reflection_probe_data(int reflection_probe_data_index);
|
||||||
|
|
||||||
|
@ -20,9 +20,9 @@ class Instance;
|
|||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/** \name Default World Node-Tree
|
/** \name Default World Node-Tree
|
||||||
*
|
*
|
||||||
* In order to support worlds without nodetree we reuse and configure a standalone nodetree that
|
* In order to support worlds without node-tree we reuse and configure a standalone node-tree that
|
||||||
* we pass for shader generation. The GPUMaterial is still stored inside the World even if
|
* we pass for shader generation. The GPUMaterial is still stored inside the World even if
|
||||||
* it does not use a nodetree.
|
* it does not use a node-tree.
|
||||||
* \{ */
|
* \{ */
|
||||||
|
|
||||||
class DefaultWorldNodeTree {
|
class DefaultWorldNodeTree {
|
||||||
|
@ -41,9 +41,9 @@ void main()
|
|||||||
velocity_local_pos_get(pos, vert_idx, prv, nxt);
|
velocity_local_pos_get(pos, vert_idx, prv, nxt);
|
||||||
/* FIXME(fclem): Evaluating before displacement avoid displacement being treated as motion but
|
/* FIXME(fclem): Evaluating before displacement avoid displacement being treated as motion but
|
||||||
* ignores motion from animated displacement. Supporting animated displacement motion vectors
|
* ignores motion from animated displacement. Supporting animated displacement motion vectors
|
||||||
* would require evaluating the nodetree multiple time with different nodetree UBOs evaluated at
|
* would require evaluating the node-tree multiple time with different node-tree UBOs evaluated
|
||||||
* different times, but also with different attributes (maybe we could assume static attribute at
|
* at different times, but also with different attributes (maybe we could assume static attribute
|
||||||
* least). */
|
* at least). */
|
||||||
velocity_vertex(prv, pos, nxt, motion.prev, motion.next);
|
velocity_vertex(prv, pos, nxt, motion.prev, motion.next);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -38,9 +38,9 @@ void main()
|
|||||||
vec3 lP_curr = transform_point(ModelMatrixInverse, interp.P);
|
vec3 lP_curr = transform_point(ModelMatrixInverse, interp.P);
|
||||||
/* FIXME(fclem): Evaluating before displacement avoid displacement being treated as motion but
|
/* FIXME(fclem): Evaluating before displacement avoid displacement being treated as motion but
|
||||||
* ignores motion from animated displacement. Supporting animated displacement motion vectors
|
* ignores motion from animated displacement. Supporting animated displacement motion vectors
|
||||||
* would require evaluating the nodetree multiple time with different nodetree UBOs evaluated at
|
* would require evaluating the node-tree multiple time with different node-tree UBOs evaluated
|
||||||
* different times, but also with different attributes (maybe we could assume static attribute at
|
* at different times, but also with different attributes (maybe we could assume static attribute
|
||||||
* least). */
|
* at least). */
|
||||||
velocity_vertex(lP_curr, lP_curr, lP_curr, motion.prev, motion.next);
|
velocity_vertex(lP_curr, lP_curr, lP_curr, motion.prev, motion.next);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -80,9 +80,9 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
|
|||||||
* which isn't so clear with option 2.
|
* which isn't so clear with option 2.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* For structname:
|
/* For struct-name:
|
||||||
* - As base, we use a custom name from the structs if one is available
|
* - As base, we use a custom name from the structs if one is available
|
||||||
* - However, if we're showing subdata of bones
|
* - However, if we're showing sub-data of bones
|
||||||
* (probably there will be other exceptions later).
|
* (probably there will be other exceptions later).
|
||||||
* need to include that info too since it gets confusing otherwise.
|
* need to include that info too since it gets confusing otherwise.
|
||||||
* - If a pointer just refers to the ID-block, then don't repeat this info
|
* - If a pointer just refers to the ID-block, then don't repeat this info
|
||||||
|
@ -361,7 +361,7 @@ TimeMarker *ED_markers_get_first_selected(ListBase *markers)
|
|||||||
|
|
||||||
void debug_markers_print_list(ListBase *markers)
|
void debug_markers_print_list(ListBase *markers)
|
||||||
{
|
{
|
||||||
/* NOTE: do NOT make static or put in if-defs as "unused code".
|
/* NOTE: do NOT make static or use `ifdef`'s as "unused code".
|
||||||
* That's too much trouble when we need to use for quick debugging! */
|
* That's too much trouble when we need to use for quick debugging! */
|
||||||
|
|
||||||
TimeMarker *marker;
|
TimeMarker *marker;
|
||||||
@ -780,7 +780,7 @@ static void MARKER_OT_add(wmOperatorType *ot)
|
|||||||
* \{ */
|
* \{ */
|
||||||
|
|
||||||
/* operator state vars used:
|
/* operator state vars used:
|
||||||
* frs: delta movement
|
* frames: delta movement
|
||||||
*
|
*
|
||||||
* functions:
|
* functions:
|
||||||
*
|
*
|
||||||
@ -957,7 +957,7 @@ static int ed_marker_move_invoke(bContext *C, wmOperator *op, const wmEvent *eve
|
|||||||
/* add temp handler */
|
/* add temp handler */
|
||||||
WM_event_add_modal_handler(C, op);
|
WM_event_add_modal_handler(C, op);
|
||||||
|
|
||||||
/* reset frs delta */
|
/* Reset frames delta. */
|
||||||
RNA_int_set(op->ptr, "frames", 0);
|
RNA_int_set(op->ptr, "frames", 0);
|
||||||
|
|
||||||
ed_marker_move_update_header(C, op);
|
ed_marker_move_update_header(C, op);
|
||||||
@ -1144,7 +1144,7 @@ static void MARKER_OT_move(wmOperatorType *ot)
|
|||||||
* \{ */
|
* \{ */
|
||||||
|
|
||||||
/* operator state vars used:
|
/* operator state vars used:
|
||||||
* frs: delta movement
|
* frames: delta movement
|
||||||
*
|
*
|
||||||
* functions:
|
* functions:
|
||||||
*
|
*
|
||||||
@ -1201,7 +1201,7 @@ static void ed_marker_duplicate_apply(bContext *C)
|
|||||||
static int ed_marker_duplicate_exec(bContext *C, wmOperator *op)
|
static int ed_marker_duplicate_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
ed_marker_duplicate_apply(C);
|
ed_marker_duplicate_apply(C);
|
||||||
ed_marker_move_exec(C, op); /* assumes frs delta set */
|
ed_marker_move_exec(C, op); /* Assumes frame delta set. */
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
@ -1054,7 +1054,7 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *op)
|
|||||||
ebone->bbone_next = ebone_iter->bbone_next->temp.ebone;
|
ebone->bbone_next = ebone_iter->bbone_next->temp.ebone;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lets try to fix any constraint subtargets that might have been duplicated. */
|
/* Lets try to fix any constraint sub-targets that might have been duplicated. */
|
||||||
updateDuplicateSubtarget(ebone, arm->edbo, ob, false);
|
updateDuplicateSubtarget(ebone, arm->edbo, ob, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,8 +236,9 @@ static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, const wmEven
|
|||||||
return WM_operator_props_dialog_popup(C, op, 270);
|
return WM_operator_props_dialog_popup(C, op, 270);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For the object with pose/action: create path curves for selected bones
|
/**
|
||||||
* This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range
|
* For the object with pose/action: create path curves for selected bones
|
||||||
|
* This recalculates the WHOLE path within the `pchan->pathsf` and `pchan->pathef` range.
|
||||||
*/
|
*/
|
||||||
static int pose_calculate_paths_exec(bContext *C, wmOperator *op)
|
static int pose_calculate_paths_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
@ -272,7 +273,7 @@ static int pose_calculate_paths_exec(bContext *C, wmOperator *op)
|
|||||||
TIMEIT_START(recalc_pose_paths);
|
TIMEIT_START(recalc_pose_paths);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Calculate the bones that now have motionpaths. */
|
/* Calculate the bones that now have motion-paths. */
|
||||||
/* TODO: only make for the selected bones? */
|
/* TODO: only make for the selected bones? */
|
||||||
ED_pose_recalculate_paths(C, scene, ob, POSE_PATH_CALC_RANGE_FULL);
|
ED_pose_recalculate_paths(C, scene, ob, POSE_PATH_CALC_RANGE_FULL);
|
||||||
|
|
||||||
|
@ -56,7 +56,8 @@ static void fcurves_to_pchan_links_get(ListBase *pfLinks,
|
|||||||
bPoseChannel *pchan)
|
bPoseChannel *pchan)
|
||||||
{
|
{
|
||||||
ListBase curves = {nullptr, nullptr};
|
ListBase curves = {nullptr, nullptr};
|
||||||
int transFlags = action_get_item_transforms(act, ob, pchan, &curves);
|
const eAction_TransformFlags transFlags = BKE_action_get_item_transform_flags(
|
||||||
|
act, ob, pchan, &curves);
|
||||||
|
|
||||||
pchan->flag &= ~(POSE_LOC | POSE_ROT | POSE_SIZE | POSE_BBONE_SHAPE);
|
pchan->flag &= ~(POSE_LOC | POSE_ROT | POSE_SIZE | POSE_BBONE_SHAPE);
|
||||||
|
|
||||||
|
@ -41,6 +41,8 @@ void ED_keymap_grease_pencil(struct wmKeyConfig *keyconf);
|
|||||||
*/
|
*/
|
||||||
eAttrDomain ED_grease_pencil_selection_domain_get(struct bContext *C);
|
eAttrDomain ED_grease_pencil_selection_domain_get(struct bContext *C);
|
||||||
|
|
||||||
|
/** \} */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -75,7 +75,7 @@ static void make_prim_finish(bContext *C,
|
|||||||
* to push this up to edges & faces. */
|
* to push this up to edges & faces. */
|
||||||
EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX);
|
EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX);
|
||||||
|
|
||||||
/* only recalc editmode tessface if we are staying in editmode */
|
/* Only recalculate edit-mode tessellation if we are staying in edit-mode. */
|
||||||
EDBMUpdate_Params params{};
|
EDBMUpdate_Params params{};
|
||||||
params.calc_looptri = !exit_editmode;
|
params.calc_looptri = !exit_editmode;
|
||||||
params.calc_normals = false;
|
params.calc_normals = false;
|
||||||
|
@ -374,8 +374,8 @@ static bool edbm_bevel_calc(wmOperator *op)
|
|||||||
BMO_op_exec(em->bm, &bmop);
|
BMO_op_exec(em->bm, &bmop);
|
||||||
|
|
||||||
if (offset != 0.0f) {
|
if (offset != 0.0f) {
|
||||||
/* not essential, but we may have some loose geometry that
|
/* Not essential, but we may have some loose geometry that
|
||||||
* won't get bevel'd and better not leave it selected */
|
* won't get beveled and better not leave it selected. */
|
||||||
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
|
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
|
||||||
BMO_slot_buffer_hflag_enable(
|
BMO_slot_buffer_hflag_enable(
|
||||||
em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true);
|
em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true);
|
||||||
|
@ -354,7 +354,7 @@ void MESH_OT_extrude_repeat(wmOperatorType *ot)
|
|||||||
/** \name Extrude Operator
|
/** \name Extrude Operator
|
||||||
* \{ */
|
* \{ */
|
||||||
|
|
||||||
/* generic extern called extruder */
|
/** Implement generic externally called extrude function. */
|
||||||
static bool edbm_extrude_mesh(Object *obedit, BMEditMesh *em, wmOperator *op)
|
static bool edbm_extrude_mesh(Object *obedit, BMEditMesh *em, wmOperator *op)
|
||||||
{
|
{
|
||||||
const bool use_normal_flip = RNA_boolean_get(op->ptr, "use_normal_flip");
|
const bool use_normal_flip = RNA_boolean_get(op->ptr, "use_normal_flip");
|
||||||
|
@ -195,7 +195,7 @@ static void ringsel_finish(bContext *C, wmOperator *op)
|
|||||||
use_only_quads,
|
use_only_quads,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
/* when used in a macro the tessfaces will be recalculated anyway,
|
/* When used in a macro the tessellation will be recalculated anyway,
|
||||||
* this is needed here because modifiers depend on updated tessellation, see #45920 */
|
* this is needed here because modifiers depend on updated tessellation, see #45920 */
|
||||||
EDBMUpdate_Params params{};
|
EDBMUpdate_Params params{};
|
||||||
params.calc_looptri = true;
|
params.calc_looptri = true;
|
||||||
|
@ -35,6 +35,10 @@
|
|||||||
|
|
||||||
#include "mesh_intern.h" /* own include */
|
#include "mesh_intern.h" /* own include */
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------- */
|
||||||
|
/** \name Local Utilities
|
||||||
|
* \{ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* helper to find edge for edge_rip,
|
* helper to find edge for edge_rip,
|
||||||
*
|
*
|
||||||
@ -147,10 +151,14 @@ static float edbm_rip_edge_side_measure(
|
|||||||
return -score;
|
return -score;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* - Advanced selection handling 'ripsel' functions ----- */
|
/** \} */
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------- */
|
||||||
|
/** \name Rip Selection Handling (advanced rip-select `ripsel` functions)
|
||||||
|
* \{ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How rip selection works
|
* How rip selection works:
|
||||||
*
|
*
|
||||||
* Firstly - rip is basically edge split with side-selection & grab.
|
* Firstly - rip is basically edge split with side-selection & grab.
|
||||||
* Things would be much more simple if we didn't have to worry about side selection
|
* Things would be much more simple if we didn't have to worry about side selection
|
||||||
@ -308,7 +316,11 @@ printf("%s: found contiguous edge loop of (%d)\n", __func__, uid_end - uid_start
|
|||||||
return eloop_pairs;
|
return eloop_pairs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* - De-Select the worst rip-edge side -------------------------------- */
|
/** \} */
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------- */
|
||||||
|
/** \name Rip Far-Side De-Select
|
||||||
|
* \{ */
|
||||||
|
|
||||||
static BMEdge *edbm_ripsel_edge_uid_step(BMEdge *e_orig, BMVert **v_prev)
|
static BMEdge *edbm_ripsel_edge_uid_step(BMEdge *e_orig, BMVert **v_prev)
|
||||||
{
|
{
|
||||||
@ -366,9 +378,13 @@ static void edbm_ripsel_deselect_helper(BMesh *bm,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* --- end 'ripsel' selection handling code --- */
|
|
||||||
|
|
||||||
/* --- face-fill code --- */
|
/** \} */
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------- */
|
||||||
|
/** \name Rip Face-Fill code
|
||||||
|
* \{ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return an un-ordered array of loop pairs
|
* return an un-ordered array of loop pairs
|
||||||
* use for rebuilding face-fill
|
* use for rebuilding face-fill
|
||||||
@ -496,7 +512,11 @@ static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, UnorderedLoopPair *u
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --- end 'face-fill' code --- */
|
/** \} */
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------- */
|
||||||
|
/** \name Rip Vertex Implementation
|
||||||
|
* \{ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the main vert ripping function (rip when one vertex is selected)
|
* This is the main vert ripping function (rip when one vertex is selected)
|
||||||
@ -857,6 +877,12 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed
|
|||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** \} */
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------- */
|
||||||
|
/** \name Rip Edge Implementation
|
||||||
|
* \{ */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the main edge ripping function
|
* This is the main edge ripping function
|
||||||
*/
|
*/
|
||||||
@ -989,6 +1015,12 @@ static int edbm_rip_invoke__edge(bContext *C, const wmEvent *event, Object *obed
|
|||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** \} */
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------- */
|
||||||
|
/** \name Rip Operator
|
||||||
|
* \{ */
|
||||||
|
|
||||||
/* based on mouse cursor position, it defines how is being ripped */
|
/* based on mouse cursor position, it defines how is being ripped */
|
||||||
static int edbm_rip_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
static int edbm_rip_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||||
{
|
{
|
||||||
@ -1122,3 +1154,5 @@ void MESH_OT_rip(wmOperatorType *ot)
|
|||||||
prop = RNA_def_boolean(ot->srna, "use_fill", false, "Fill", "Fill the ripped region");
|
prop = RNA_def_boolean(ot->srna, "use_fill", false, "Fill", "Fill the ripped region");
|
||||||
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MESH);
|
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MESH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** \} */
|
||||||
|
@ -213,7 +213,7 @@ bool ED_scene_view_layer_delete(Main *bmain, Scene *scene, ViewLayer *layer, Rep
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We need to unset nodetrees before removing the layer, otherwise its index will be -1. */
|
/* We need to unset node-trees before removing the layer, otherwise its index will be -1. */
|
||||||
view_layer_remove_unset_nodetrees(bmain, scene, layer);
|
view_layer_remove_unset_nodetrees(bmain, scene, layer);
|
||||||
|
|
||||||
BLI_remlink(&scene->view_layers, layer);
|
BLI_remlink(&scene->view_layers, layer);
|
||||||
|
@ -6925,18 +6925,6 @@ void PAINT_OT_add_texture_paint_slot(wmOperatorType *ot)
|
|||||||
{0, nullptr, 0, nullptr, nullptr},
|
{0, nullptr, 0, nullptr, nullptr},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const EnumPropertyItem domain_items[3] = {
|
|
||||||
{ATTR_DOMAIN_POINT, "POINT", 0, "Vertex", ""},
|
|
||||||
{ATTR_DOMAIN_CORNER, "CORNER", 0, "Face Corner", ""},
|
|
||||||
{0, nullptr, 0, nullptr, nullptr},
|
|
||||||
};
|
|
||||||
|
|
||||||
static const EnumPropertyItem attribute_type_items[3] = {
|
|
||||||
{CD_PROP_COLOR, "COLOR", 0, "Color", ""},
|
|
||||||
{CD_PROP_BYTE_COLOR, "BYTE_COLOR", 0, "Byte Color", ""},
|
|
||||||
{0, nullptr, 0, nullptr, nullptr},
|
|
||||||
};
|
|
||||||
|
|
||||||
/* identifiers */
|
/* identifiers */
|
||||||
ot->name = "Add Paint Slot";
|
ot->name = "Add Paint Slot";
|
||||||
ot->description = "Add a paint slot";
|
ot->description = "Add a paint slot";
|
||||||
@ -6997,14 +6985,14 @@ void PAINT_OT_add_texture_paint_slot(wmOperatorType *ot)
|
|||||||
/* Color Attribute Properties */
|
/* Color Attribute Properties */
|
||||||
RNA_def_enum(ot->srna,
|
RNA_def_enum(ot->srna,
|
||||||
"domain",
|
"domain",
|
||||||
domain_items,
|
rna_enum_color_attribute_domain_items,
|
||||||
ATTR_DOMAIN_POINT,
|
ATTR_DOMAIN_POINT,
|
||||||
"Domain",
|
"Domain",
|
||||||
"Type of element that attribute is stored on");
|
"Type of element that attribute is stored on");
|
||||||
|
|
||||||
RNA_def_enum(ot->srna,
|
RNA_def_enum(ot->srna,
|
||||||
"data_type",
|
"data_type",
|
||||||
attribute_type_items,
|
rna_enum_color_attribute_type_items,
|
||||||
CD_PROP_COLOR,
|
CD_PROP_COLOR,
|
||||||
"Data Type",
|
"Data Type",
|
||||||
"Type of data stored in attribute");
|
"Type of data stored in attribute");
|
||||||
|
@ -1840,8 +1840,7 @@ static void sculpt_undo_set_active_layer(bContext *C, SculptAttrRef *attr)
|
|||||||
SculptAttrRef existing;
|
SculptAttrRef existing;
|
||||||
sculpt_save_active_attribute(ob, &existing);
|
sculpt_save_active_attribute(ob, &existing);
|
||||||
|
|
||||||
CustomDataLayer *layer;
|
CustomDataLayer *layer = BKE_id_attribute_find(&me->id, attr->name, attr->type, attr->domain);
|
||||||
layer = BKE_id_attribute_find(&me->id, attr->name, attr->type, attr->domain);
|
|
||||||
|
|
||||||
/* Temporary fix for #97408. This is a fundamental
|
/* Temporary fix for #97408. This is a fundamental
|
||||||
* bug in the undo stack; the operator code needs to push
|
* bug in the undo stack; the operator code needs to push
|
||||||
@ -1864,11 +1863,8 @@ static void sculpt_undo_set_active_layer(bContext *C, SculptAttrRef *attr)
|
|||||||
|
|
||||||
if (!layer) {
|
if (!layer) {
|
||||||
/* Memfile undo killed the layer; re-create it. */
|
/* Memfile undo killed the layer; re-create it. */
|
||||||
CustomData *cdata = attr->domain == ATTR_DOMAIN_POINT ? &me->vdata : &me->ldata;
|
me->attributes_for_write().add(
|
||||||
int totelem = attr->domain == ATTR_DOMAIN_POINT ? me->totvert : me->totloop;
|
attr->name, attr->domain, attr->type, blender::bke::AttributeInitDefaultValue());
|
||||||
|
|
||||||
CustomData_add_layer_named(
|
|
||||||
cdata, eCustomDataType(attr->type), CD_SET_DEFAULT, totelem, attr->name);
|
|
||||||
layer = BKE_id_attribute_find(&me->id, attr->name, attr->type, attr->domain);
|
layer = BKE_id_attribute_find(&me->id, attr->name, attr->type, attr->domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ static int action_pushdown_exec(bContext *C, wmOperator *op)
|
|||||||
if (adt) {
|
if (adt) {
|
||||||
/* Perform the push-down operation
|
/* Perform the push-down operation
|
||||||
* - This will deal with all the AnimData-side user-counts. */
|
* - This will deal with all the AnimData-side user-counts. */
|
||||||
if (action_has_motion(adt->action) == 0) {
|
if (BKE_action_has_motion(adt->action) == 0) {
|
||||||
/* action may not be suitable... */
|
/* action may not be suitable... */
|
||||||
BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
|
BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
@ -398,7 +398,7 @@ static int action_stash_exec(bContext *C, wmOperator *op)
|
|||||||
/* Perform stashing operation */
|
/* Perform stashing operation */
|
||||||
if (adt) {
|
if (adt) {
|
||||||
/* don't do anything if this action is empty... */
|
/* don't do anything if this action is empty... */
|
||||||
if (action_has_motion(adt->action) == 0) {
|
if (BKE_action_has_motion(adt->action) == 0) {
|
||||||
/* action may not be suitable... */
|
/* action may not be suitable... */
|
||||||
BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
|
BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
@ -506,7 +506,7 @@ static int action_stash_create_exec(bContext *C, wmOperator *op)
|
|||||||
}
|
}
|
||||||
else if (adt) {
|
else if (adt) {
|
||||||
/* Perform stashing operation */
|
/* Perform stashing operation */
|
||||||
if (action_has_motion(adt->action) == 0) {
|
if (BKE_action_has_motion(adt->action) == 0) {
|
||||||
/* don't do anything if this action is empty... */
|
/* don't do anything if this action is empty... */
|
||||||
BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
|
BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
@ -888,7 +888,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *region)
|
|||||||
case NLASTRIP_EXTEND_HOLD_FORWARD: {
|
case NLASTRIP_EXTEND_HOLD_FORWARD: {
|
||||||
float r_start;
|
float r_start;
|
||||||
float r_end;
|
float r_end;
|
||||||
BKE_action_get_frame_range(static_cast<bAction *>(ale->data), &r_start, &r_end);
|
BKE_action_frame_range_get(static_cast<bAction *>(ale->data), &r_start, &r_end);
|
||||||
|
|
||||||
immRectf(pos, r_end, ymin + NLACHANNEL_SKIP, v2d->cur.xmax, ymax - NLACHANNEL_SKIP);
|
immRectf(pos, r_end, ymin + NLACHANNEL_SKIP, v2d->cur.xmax, ymax - NLACHANNEL_SKIP);
|
||||||
break;
|
break;
|
||||||
|
@ -1199,7 +1199,7 @@ void animrecord_check_state(TransInfo *t, ID *id)
|
|||||||
float astart, aend;
|
float astart, aend;
|
||||||
|
|
||||||
/* only push down if action is more than 1-2 frames long */
|
/* only push down if action is more than 1-2 frames long */
|
||||||
calc_action_range(adt->action, &astart, &aend, 1);
|
BKE_action_frame_range_calc(adt->action, true, &astart, &aend);
|
||||||
if (aend > astart + 2.0f) {
|
if (aend > astart + 2.0f) {
|
||||||
NlaStrip *strip = BKE_nlastack_add_strip(adt, adt->action, ID_IS_OVERRIDE_LIBRARY(id));
|
NlaStrip *strip = BKE_nlastack_add_strip(adt, adt->action, ID_IS_OVERRIDE_LIBRARY(id));
|
||||||
|
|
||||||
|
@ -389,6 +389,8 @@ static bool raycastEditMesh(SnapCache_EditMesh *em_cache,
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** \} */
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
/** \name Surface Snap Functions
|
/** \name Surface Snap Functions
|
||||||
* \{ */
|
* \{ */
|
||||||
|
@ -372,7 +372,7 @@ static void slider_draw(const bContext *UNUSED(C), ARegion *region, void *arg)
|
|||||||
|
|
||||||
static void slider_update_factor(tSlider *slider, const wmEvent *event)
|
static void slider_update_factor(tSlider *slider, const wmEvent *event)
|
||||||
{
|
{
|
||||||
/* Normalize so no matter the factor bounds, the mouse distance travelled from min to max is
|
/* Normalize so no matter the factor bounds, the mouse distance traveled from min to max is
|
||||||
* constant. */
|
* constant. */
|
||||||
const float slider_range = slider->factor_bounds[1] - slider->factor_bounds[0];
|
const float slider_range = slider->factor_bounds[1] - slider->factor_bounds[0];
|
||||||
const float factor_delta = (event->xy[0] - slider->last_cursor[0]) /
|
const float factor_delta = (event->xy[0] - slider->last_cursor[0]) /
|
||||||
|
@ -49,12 +49,8 @@ struct CDStreamConfig {
|
|||||||
Mesh *mesh;
|
Mesh *mesh;
|
||||||
void *(*add_customdata_cb)(Mesh *mesh, const char *name, int data_type);
|
void *(*add_customdata_cb)(Mesh *mesh, const char *name, int data_type);
|
||||||
|
|
||||||
double weight;
|
|
||||||
Alembic::Abc::chrono_t time;
|
Alembic::Abc::chrono_t time;
|
||||||
int timesample_index;
|
int timesample_index;
|
||||||
bool use_vertex_interpolation;
|
|
||||||
Alembic::AbcGeom::index_t index;
|
|
||||||
Alembic::AbcGeom::index_t ceil_index;
|
|
||||||
|
|
||||||
const char **modifier_error_message;
|
const char **modifier_error_message;
|
||||||
|
|
||||||
@ -80,10 +76,7 @@ struct CDStreamConfig {
|
|||||||
pack_uvs(false),
|
pack_uvs(false),
|
||||||
mesh(NULL),
|
mesh(NULL),
|
||||||
add_customdata_cb(NULL),
|
add_customdata_cb(NULL),
|
||||||
weight(0.0),
|
|
||||||
time(0.0),
|
time(0.0),
|
||||||
index(0),
|
|
||||||
ceil_index(0),
|
|
||||||
modifier_error_message(NULL)
|
modifier_error_message(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -118,6 +118,9 @@ struct AbcMeshData {
|
|||||||
Int32ArraySamplePtr face_indices;
|
Int32ArraySamplePtr face_indices;
|
||||||
Int32ArraySamplePtr face_counts;
|
Int32ArraySamplePtr face_counts;
|
||||||
|
|
||||||
|
/* Optional settings for reading interpolated vertices. If present, `ceil_positions` has to be
|
||||||
|
* valid. */
|
||||||
|
std::optional<SampleInterpolationSettings> interpolation_settings;
|
||||||
P3fArraySamplePtr positions;
|
P3fArraySamplePtr positions;
|
||||||
P3fArraySamplePtr ceil_positions;
|
P3fArraySamplePtr ceil_positions;
|
||||||
|
|
||||||
@ -146,10 +149,13 @@ static void read_mverts(CDStreamConfig &config, const AbcMeshData &mesh_data)
|
|||||||
float3 *vert_positions = config.positions;
|
float3 *vert_positions = config.positions;
|
||||||
const P3fArraySamplePtr &positions = mesh_data.positions;
|
const P3fArraySamplePtr &positions = mesh_data.positions;
|
||||||
|
|
||||||
if (config.use_vertex_interpolation && config.weight != 0.0f &&
|
if (mesh_data.interpolation_settings.has_value()) {
|
||||||
mesh_data.ceil_positions != nullptr && mesh_data.ceil_positions->size() == positions->size())
|
BLI_assert_msg(
|
||||||
{
|
mesh_data.ceil_positions != nullptr,
|
||||||
read_mverts_interp(vert_positions, positions, mesh_data.ceil_positions, config.weight);
|
"AbcMeshData does not have ceil positions although it has some interpolation settings.");
|
||||||
|
|
||||||
|
const double weight = mesh_data.interpolation_settings->weight;
|
||||||
|
read_mverts_interp(vert_positions, positions, mesh_data.ceil_positions, weight);
|
||||||
BKE_mesh_tag_positions_changed(config.mesh);
|
BKE_mesh_tag_positions_changed(config.mesh);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -398,18 +404,6 @@ static void *add_customdata_cb(Mesh *mesh, const char *name, int data_type)
|
|||||||
return cd_ptr;
|
return cd_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_weight_and_index(CDStreamConfig &config,
|
|
||||||
Alembic::AbcCoreAbstract::TimeSamplingPtr time_sampling,
|
|
||||||
size_t samples_number)
|
|
||||||
{
|
|
||||||
Alembic::AbcGeom::index_t i0, i1;
|
|
||||||
|
|
||||||
config.weight = get_weight_and_index(config.time, time_sampling, samples_number, i0, i1);
|
|
||||||
|
|
||||||
config.index = i0;
|
|
||||||
config.ceil_index = i1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static V3fArraySamplePtr get_velocity_prop(const ICompoundProperty &schema,
|
static V3fArraySamplePtr get_velocity_prop(const ICompoundProperty &schema,
|
||||||
const ISampleSelector &selector,
|
const ISampleSelector &selector,
|
||||||
const std::string &name)
|
const std::string &name)
|
||||||
@ -513,14 +507,18 @@ static void read_mesh_sample(const std::string &iobject_full_name,
|
|||||||
abc_mesh_data.face_indices = sample.getFaceIndices();
|
abc_mesh_data.face_indices = sample.getFaceIndices();
|
||||||
abc_mesh_data.positions = sample.getPositions();
|
abc_mesh_data.positions = sample.getPositions();
|
||||||
|
|
||||||
get_weight_and_index(config, schema.getTimeSampling(), schema.getNumSamples());
|
const std::optional<SampleInterpolationSettings> interpolation_settings =
|
||||||
|
get_sample_interpolation_settings(
|
||||||
|
selector, schema.getTimeSampling(), schema.getNumSamples());
|
||||||
|
|
||||||
if (config.weight != 0.0f) {
|
const bool use_vertex_interpolation = settings->read_flag & MOD_MESHSEQ_INTERPOLATE_VERTICES;
|
||||||
|
if (use_vertex_interpolation && interpolation_settings.has_value()) {
|
||||||
Alembic::AbcGeom::IPolyMeshSchema::Sample ceil_sample;
|
Alembic::AbcGeom::IPolyMeshSchema::Sample ceil_sample;
|
||||||
schema.get(ceil_sample, Alembic::Abc::ISampleSelector(config.ceil_index));
|
schema.get(ceil_sample, Alembic::Abc::ISampleSelector(interpolation_settings->ceil_index));
|
||||||
if (samples_have_same_topology(sample, ceil_sample)) {
|
if (samples_have_same_topology(sample, ceil_sample)) {
|
||||||
/* Only set interpolation data if the samples are compatible. */
|
/* Only set interpolation data if the samples are compatible. */
|
||||||
abc_mesh_data.ceil_positions = ceil_sample.getPositions();
|
abc_mesh_data.ceil_positions = ceil_sample.getPositions();
|
||||||
|
abc_mesh_data.interpolation_settings = interpolation_settings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,7 +548,7 @@ static void read_mesh_sample(const std::string &iobject_full_name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CDStreamConfig get_config(Mesh *mesh, const bool use_vertex_interpolation)
|
CDStreamConfig get_config(Mesh *mesh)
|
||||||
{
|
{
|
||||||
CDStreamConfig config;
|
CDStreamConfig config;
|
||||||
config.mesh = mesh;
|
config.mesh = mesh;
|
||||||
@ -562,7 +560,6 @@ CDStreamConfig get_config(Mesh *mesh, const bool use_vertex_interpolation)
|
|||||||
config.totpoly = mesh->totpoly;
|
config.totpoly = mesh->totpoly;
|
||||||
config.loopdata = &mesh->ldata;
|
config.loopdata = &mesh->ldata;
|
||||||
config.add_customdata_cb = add_customdata_cb;
|
config.add_customdata_cb = add_customdata_cb;
|
||||||
config.use_vertex_interpolation = use_vertex_interpolation;
|
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
@ -823,8 +820,7 @@ Mesh *AbcMeshReader::read_mesh(Mesh *existing_mesh,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Mesh *mesh_to_export = new_mesh ? new_mesh : existing_mesh;
|
Mesh *mesh_to_export = new_mesh ? new_mesh : existing_mesh;
|
||||||
const bool use_vertex_interpolation = read_flag & MOD_MESHSEQ_INTERPOLATE_VERTICES;
|
CDStreamConfig config = get_config(mesh_to_export);
|
||||||
CDStreamConfig config = get_config(mesh_to_export, use_vertex_interpolation);
|
|
||||||
config.time = sample_sel.getRequestedTime();
|
config.time = sample_sel.getRequestedTime();
|
||||||
config.modifier_error_message = err_str;
|
config.modifier_error_message = err_str;
|
||||||
|
|
||||||
@ -921,14 +917,18 @@ static void read_subd_sample(const std::string &iobject_full_name,
|
|||||||
abc_mesh_data.face_indices = sample.getFaceIndices();
|
abc_mesh_data.face_indices = sample.getFaceIndices();
|
||||||
abc_mesh_data.positions = sample.getPositions();
|
abc_mesh_data.positions = sample.getPositions();
|
||||||
|
|
||||||
get_weight_and_index(config, schema.getTimeSampling(), schema.getNumSamples());
|
const std::optional<SampleInterpolationSettings> interpolation_settings =
|
||||||
|
get_sample_interpolation_settings(
|
||||||
|
selector, schema.getTimeSampling(), schema.getNumSamples());
|
||||||
|
|
||||||
if (config.weight != 0.0f) {
|
const bool use_vertex_interpolation = settings->read_flag & MOD_MESHSEQ_INTERPOLATE_VERTICES;
|
||||||
|
if (use_vertex_interpolation && interpolation_settings.has_value()) {
|
||||||
Alembic::AbcGeom::ISubDSchema::Sample ceil_sample;
|
Alembic::AbcGeom::ISubDSchema::Sample ceil_sample;
|
||||||
schema.get(ceil_sample, Alembic::Abc::ISampleSelector(config.ceil_index));
|
schema.get(ceil_sample, Alembic::Abc::ISampleSelector(interpolation_settings->ceil_index));
|
||||||
if (samples_have_same_topology(sample, ceil_sample)) {
|
if (samples_have_same_topology(sample, ceil_sample)) {
|
||||||
/* Only set interpolation data if the samples are compatible. */
|
/* Only set interpolation data if the samples are compatible. */
|
||||||
abc_mesh_data.ceil_positions = ceil_sample.getPositions();
|
abc_mesh_data.ceil_positions = ceil_sample.getPositions();
|
||||||
|
abc_mesh_data.interpolation_settings = interpolation_settings;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1161,8 +1161,7 @@ Mesh *AbcSubDReader::read_mesh(Mesh *existing_mesh,
|
|||||||
|
|
||||||
/* Only read point data when streaming meshes, unless we need to create new ones. */
|
/* Only read point data when streaming meshes, unless we need to create new ones. */
|
||||||
Mesh *mesh_to_export = new_mesh ? new_mesh : existing_mesh;
|
Mesh *mesh_to_export = new_mesh ? new_mesh : existing_mesh;
|
||||||
const bool use_vertex_interpolation = read_flag & MOD_MESHSEQ_INTERPOLATE_VERTICES;
|
CDStreamConfig config = get_config(mesh_to_export);
|
||||||
CDStreamConfig config = get_config(mesh_to_export, use_vertex_interpolation);
|
|
||||||
config.time = sample_sel.getRequestedTime();
|
config.time = sample_sel.getRequestedTime();
|
||||||
config.modifier_error_message = err_str;
|
config.modifier_error_message = err_str;
|
||||||
read_subd_sample(m_iobject.getFullName(), &settings, m_schema, sample_sel, config);
|
read_subd_sample(m_iobject.getFullName(), &settings, m_schema, sample_sel, config);
|
||||||
|
@ -70,6 +70,6 @@ void read_mverts(Mesh &mesh,
|
|||||||
const Alembic::AbcGeom::P3fArraySamplePtr positions,
|
const Alembic::AbcGeom::P3fArraySamplePtr positions,
|
||||||
const Alembic::AbcGeom::N3fArraySamplePtr normals);
|
const Alembic::AbcGeom::N3fArraySamplePtr normals);
|
||||||
|
|
||||||
CDStreamConfig get_config(struct Mesh *mesh, bool use_vertex_interpolation);
|
CDStreamConfig get_config(struct Mesh *mesh);
|
||||||
|
|
||||||
} // namespace blender::io::alembic
|
} // namespace blender::io::alembic
|
||||||
|
@ -119,20 +119,23 @@ static Imath::M44d blend_matrices(const Imath::M44d &m0,
|
|||||||
|
|
||||||
Imath::M44d get_matrix(const IXformSchema &schema, const chrono_t time)
|
Imath::M44d get_matrix(const IXformSchema &schema, const chrono_t time)
|
||||||
{
|
{
|
||||||
Alembic::AbcGeom::index_t i0, i1;
|
Alembic::AbcGeom::ISampleSelector selector(time);
|
||||||
Alembic::AbcGeom::XformSample s0, s1;
|
|
||||||
|
|
||||||
const double weight = get_weight_and_index(
|
const std::optional<SampleInterpolationSettings> interpolation_settings =
|
||||||
time, schema.getTimeSampling(), schema.getNumSamples(), i0, i1);
|
get_sample_interpolation_settings(
|
||||||
|
selector, schema.getTimeSampling(), schema.getNumSamples());
|
||||||
|
|
||||||
schema.get(s0, Alembic::AbcGeom::ISampleSelector(i0));
|
if (!interpolation_settings.has_value()) {
|
||||||
|
/* No interpolation, just read the current time. */
|
||||||
if (i0 != i1) {
|
Alembic::AbcGeom::XformSample s0;
|
||||||
schema.get(s1, Alembic::AbcGeom::ISampleSelector(i1));
|
schema.get(s0, selector);
|
||||||
return blend_matrices(s0.getMatrix(), s1.getMatrix(), weight);
|
return s0.getMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
return s0.getMatrix();
|
Alembic::AbcGeom::XformSample s0, s1;
|
||||||
|
schema.get(s0, Alembic::AbcGeom::ISampleSelector(interpolation_settings->index));
|
||||||
|
schema.get(s1, Alembic::AbcGeom::ISampleSelector(interpolation_settings->ceil_index));
|
||||||
|
return blend_matrices(s0.getMatrix(), s1.getMatrix(), interpolation_settings->weight);
|
||||||
}
|
}
|
||||||
|
|
||||||
Mesh *AbcObjectReader::read_mesh(Mesh *existing_mesh,
|
Mesh *AbcObjectReader::read_mesh(Mesh *existing_mesh,
|
||||||
|
@ -113,7 +113,7 @@ void read_points_sample(const IPointsSchema &schema,
|
|||||||
|
|
||||||
Mesh *AbcPointsReader::read_mesh(Mesh *existing_mesh,
|
Mesh *AbcPointsReader::read_mesh(Mesh *existing_mesh,
|
||||||
const ISampleSelector &sample_sel,
|
const ISampleSelector &sample_sel,
|
||||||
int read_flag,
|
int /*read_flag*/,
|
||||||
const char * /*velocity_name*/,
|
const char * /*velocity_name*/,
|
||||||
const float /*velocity_scale*/,
|
const float /*velocity_scale*/,
|
||||||
const char **err_str)
|
const char **err_str)
|
||||||
@ -141,8 +141,7 @@ Mesh *AbcPointsReader::read_mesh(Mesh *existing_mesh,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Mesh *mesh_to_export = new_mesh ? new_mesh : existing_mesh;
|
Mesh *mesh_to_export = new_mesh ? new_mesh : existing_mesh;
|
||||||
const bool use_vertex_interpolation = read_flag & MOD_MESHSEQ_INTERPOLATE_VERTICES;
|
CDStreamConfig config = get_config(mesh_to_export);
|
||||||
CDStreamConfig config = get_config(mesh_to_export, use_vertex_interpolation);
|
|
||||||
read_points_sample(m_schema, sample_sel, config);
|
read_points_sample(m_schema, sample_sel, config);
|
||||||
|
|
||||||
return mesh_to_export;
|
return mesh_to_export;
|
||||||
|
@ -116,36 +116,35 @@ bool has_property(const Alembic::Abc::ICompoundProperty &prop, const std::string
|
|||||||
|
|
||||||
using index_time_pair_t = std::pair<Alembic::AbcCoreAbstract::index_t, Alembic::AbcGeom::chrono_t>;
|
using index_time_pair_t = std::pair<Alembic::AbcCoreAbstract::index_t, Alembic::AbcGeom::chrono_t>;
|
||||||
|
|
||||||
double get_weight_and_index(Alembic::AbcGeom::chrono_t time,
|
std::optional<SampleInterpolationSettings> get_sample_interpolation_settings(
|
||||||
|
const Alembic::AbcGeom::ISampleSelector &selector,
|
||||||
const Alembic::AbcCoreAbstract::TimeSamplingPtr &time_sampling,
|
const Alembic::AbcCoreAbstract::TimeSamplingPtr &time_sampling,
|
||||||
int samples_number,
|
size_t samples_number)
|
||||||
Alembic::AbcGeom::index_t &i0,
|
|
||||||
Alembic::AbcGeom::index_t &i1)
|
|
||||||
{
|
{
|
||||||
samples_number = std::max(samples_number, 1);
|
const chrono_t time = selector.getRequestedTime();
|
||||||
|
samples_number = std::max(samples_number, size_t(1));
|
||||||
|
|
||||||
index_time_pair_t t0 = time_sampling->getFloorIndex(time, samples_number);
|
index_time_pair_t t0 = time_sampling->getFloorIndex(time, samples_number);
|
||||||
i0 = i1 = t0.first;
|
Alembic::AbcCoreAbstract::index_t i0 = t0.first;
|
||||||
|
|
||||||
if (samples_number == 1 || (fabs(time - t0.second) < 0.0001)) {
|
if (samples_number == 1 || (fabs(time - t0.second) < 0.0001)) {
|
||||||
return 0.0;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
index_time_pair_t t1 = time_sampling->getCeilIndex(time, samples_number);
|
index_time_pair_t t1 = time_sampling->getCeilIndex(time, samples_number);
|
||||||
i1 = t1.first;
|
Alembic::AbcCoreAbstract::index_t i1 = t1.first;
|
||||||
|
|
||||||
if (i0 == i1) {
|
if (i0 == i1) {
|
||||||
return 0.0;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const double bias = (time - t0.second) / (t1.second - t0.second);
|
const double bias = (time - t0.second) / (t1.second - t0.second);
|
||||||
|
|
||||||
if (fabs(1.0 - bias) < 0.0001) {
|
if (fabs(1.0 - bias) < 0.0001) {
|
||||||
i0 = i1;
|
return {};
|
||||||
return 0.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return bias;
|
return SampleInterpolationSettings{i0, i1, bias};
|
||||||
}
|
}
|
||||||
|
|
||||||
//#define USE_NURBS
|
//#define USE_NURBS
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#include <Alembic/Abc/All.h>
|
#include <Alembic/Abc/All.h>
|
||||||
#include <Alembic/AbcGeom/All.h>
|
#include <Alembic/AbcGeom/All.h>
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
using Alembic::Abc::chrono_t;
|
using Alembic::Abc::chrono_t;
|
||||||
|
|
||||||
struct ID;
|
struct ID;
|
||||||
@ -81,11 +83,27 @@ void get_min_max_time(const Alembic::AbcGeom::IObject &object,
|
|||||||
|
|
||||||
bool has_property(const Alembic::Abc::ICompoundProperty &prop, const std::string &name);
|
bool has_property(const Alembic::Abc::ICompoundProperty &prop, const std::string &name);
|
||||||
|
|
||||||
double get_weight_and_index(Alembic::AbcCoreAbstract::chrono_t time,
|
/**
|
||||||
|
* The SampleInterpolationSettings struct holds information for interpolating data between two
|
||||||
|
* samples.
|
||||||
|
*/
|
||||||
|
struct SampleInterpolationSettings {
|
||||||
|
/* Index of the first ("floor") sample. */
|
||||||
|
Alembic::AbcGeom::index_t index;
|
||||||
|
/* Index of the second ("ceil") sample. */
|
||||||
|
Alembic::AbcGeom::index_t ceil_index;
|
||||||
|
/* Factor to interpolate between the `index` and `ceil_index`. */
|
||||||
|
double weight;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Check whether the requested time from the \a selector falls between two sampling time from the
|
||||||
|
* \a time_sampling. If so, returns a #SampleInterpolationSettings with the required data to
|
||||||
|
* interpolate. If not, returns nothing and we can assume that the requested time falls on a
|
||||||
|
* specific sampling time of \a time_sampling and no interpolation is necessary. */
|
||||||
|
std::optional<SampleInterpolationSettings> get_sample_interpolation_settings(
|
||||||
|
const Alembic::AbcGeom::ISampleSelector &selector,
|
||||||
const Alembic::AbcCoreAbstract::TimeSamplingPtr &time_sampling,
|
const Alembic::AbcCoreAbstract::TimeSamplingPtr &time_sampling,
|
||||||
int samples_number,
|
size_t samples_number);
|
||||||
Alembic::AbcGeom::index_t &i0,
|
|
||||||
Alembic::AbcGeom::index_t &i1);
|
|
||||||
|
|
||||||
AbcObjectReader *create_reader(const Alembic::AbcGeom::IObject &object, ImportSettings &settings);
|
AbcObjectReader *create_reader(const Alembic::AbcGeom::IObject &object, ImportSettings &settings);
|
||||||
|
|
||||||
|
@ -25,6 +25,4 @@
|
|||||||
|
|
||||||
/** \} */
|
/** \} */
|
||||||
|
|
||||||
/* clang-format off */
|
/* clang-format on */
|
||||||
|
|
||||||
/** \} */
|
|
||||||
|
@ -242,7 +242,7 @@ static void rna_Action_active_pose_marker_index_range(
|
|||||||
|
|
||||||
static void rna_Action_frame_range_get(PointerRNA *ptr, float *r_values)
|
static void rna_Action_frame_range_get(PointerRNA *ptr, float *r_values)
|
||||||
{
|
{
|
||||||
BKE_action_get_frame_range((bAction *)ptr->owner_id, &r_values[0], &r_values[1]);
|
BKE_action_frame_range_get((bAction *)ptr->owner_id, &r_values[0], &r_values[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Action_frame_range_set(PointerRNA *ptr, const float *values)
|
static void rna_Action_frame_range_set(PointerRNA *ptr, const float *values)
|
||||||
@ -258,7 +258,7 @@ static void rna_Action_frame_range_set(PointerRNA *ptr, const float *values)
|
|||||||
static void rna_Action_curve_frame_range_get(PointerRNA *ptr, float *values)
|
static void rna_Action_curve_frame_range_get(PointerRNA *ptr, float *values)
|
||||||
{ /* don't include modifiers because they too easily can have very large
|
{ /* don't include modifiers because they too easily can have very large
|
||||||
* ranges: MINAFRAMEF to MAXFRAMEF. */
|
* ranges: MINAFRAMEF to MAXFRAMEF. */
|
||||||
calc_action_range((bAction *)ptr->owner_id, values, values + 1, false);
|
BKE_action_frame_range_calc((bAction *)ptr->owner_id, false, values, values + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Action_use_frame_range_set(PointerRNA *ptr, bool value)
|
static void rna_Action_use_frame_range_set(PointerRNA *ptr, bool value)
|
||||||
@ -268,7 +268,7 @@ static void rna_Action_use_frame_range_set(PointerRNA *ptr, bool value)
|
|||||||
if (value) {
|
if (value) {
|
||||||
/* If the frame range is blank, initialize it by scanning F-Curves. */
|
/* If the frame range is blank, initialize it by scanning F-Curves. */
|
||||||
if ((data->frame_start == data->frame_end) && (data->frame_start == 0)) {
|
if ((data->frame_start == data->frame_end) && (data->frame_start == 0)) {
|
||||||
calc_action_range(data, &data->frame_start, &data->frame_end, false);
|
BKE_action_frame_range_calc(data, false, &data->frame_start, &data->frame_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
data->flag |= ACT_FRAME_RANGE;
|
data->flag |= ACT_FRAME_RANGE;
|
||||||
|
@ -3402,7 +3402,7 @@ static IDFilterEnumPropertyItem rna_enum_space_file_id_filter_categories[] = {
|
|||||||
"category_shading",
|
"category_shading",
|
||||||
ICON_MATERIAL_DATA,
|
ICON_MATERIAL_DATA,
|
||||||
"Shading",
|
"Shading",
|
||||||
"Show materials, nodetrees, textures and Freestyle's linestyles"},
|
"Show materials, node-trees, textures and Freestyle's line-styles"},
|
||||||
{FILTER_ID_IM | FILTER_ID_MC | FILTER_ID_MSK | FILTER_ID_SO,
|
{FILTER_ID_IM | FILTER_ID_MC | FILTER_ID_MSK | FILTER_ID_SO,
|
||||||
"category_image",
|
"category_image",
|
||||||
ICON_IMAGE_DATA,
|
ICON_IMAGE_DATA,
|
||||||
|
@ -279,8 +279,8 @@ static void BMD_mesh_intersection(BMesh *bm,
|
|||||||
|
|
||||||
BooleanModifierData *bmd = (BooleanModifierData *)md;
|
BooleanModifierData *bmd = (BooleanModifierData *)md;
|
||||||
|
|
||||||
/* main bmesh intersection setup */
|
/* Main BMesh intersection setup. */
|
||||||
/* create tessface & intersect */
|
/* Create tessellation & intersect. */
|
||||||
const int looptris_tot = poly_to_tri_count(bm->totface, bm->totloop);
|
const int looptris_tot = poly_to_tri_count(bm->totface, bm->totloop);
|
||||||
BMLoop *(*looptris)[3] = (BMLoop * (*)[3])
|
BMLoop *(*looptris)[3] = (BMLoop * (*)[3])
|
||||||
MEM_malloc_arrayN(looptris_tot, sizeof(*looptris), __func__);
|
MEM_malloc_arrayN(looptris_tot, sizeof(*looptris), __func__);
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "DNA_object_types.h"
|
#include "DNA_object_types.h"
|
||||||
#include "DNA_screen_types.h"
|
#include "DNA_screen_types.h"
|
||||||
|
|
||||||
|
#include "BKE_attribute.hh"
|
||||||
#include "BKE_camera.h"
|
#include "BKE_camera.h"
|
||||||
#include "BKE_context.h"
|
#include "BKE_context.h"
|
||||||
#include "BKE_lib_query.h"
|
#include "BKE_lib_query.h"
|
||||||
@ -119,10 +120,8 @@ static Mesh *uvprojectModifier_do(UVProjectModifierData *umd,
|
|||||||
|
|
||||||
/* Create a new layer if no UV Maps are available
|
/* Create a new layer if no UV Maps are available
|
||||||
* (e.g. if a preceding modifier could not preserve it). */
|
* (e.g. if a preceding modifier could not preserve it). */
|
||||||
if (!CustomData_has_layer(&mesh->ldata, CD_PROP_FLOAT2)) {
|
mesh->attributes_for_write().add<float2>(
|
||||||
CustomData_add_layer_named(
|
umd->uvlayer_name, ATTR_DOMAIN_CORNER, bke::AttributeInitDefaultValue());
|
||||||
&mesh->ldata, CD_PROP_FLOAT2, CD_SET_DEFAULT, mesh->totloop, umd->uvlayer_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* make sure we're using an existing layer */
|
/* make sure we're using an existing layer */
|
||||||
CustomData_validate_layer_name(&mesh->ldata, CD_PROP_FLOAT2, umd->uvlayer_name, uvname);
|
CustomData_validate_layer_name(&mesh->ldata, CD_PROP_FLOAT2, umd->uvlayer_name, uvname);
|
||||||
|
@ -714,7 +714,7 @@ static bool node_composit_poll_rlayers(const bNodeType * /*ntype*/,
|
|||||||
Scene *scene;
|
Scene *scene;
|
||||||
|
|
||||||
/* XXX ugly: check if ntree is a local scene node tree.
|
/* XXX ugly: check if ntree is a local scene node tree.
|
||||||
* Render layers node can only be used in local scene->nodetree,
|
* Render layers node can only be used in local `scene->nodetree`,
|
||||||
* since it directly links to the scene.
|
* since it directly links to the scene.
|
||||||
*/
|
*/
|
||||||
for (scene = (Scene *)G.main->scenes.first; scene; scene = (Scene *)scene->id.next) {
|
for (scene = (Scene *)G.main->scenes.first; scene; scene = (Scene *)scene->id.next) {
|
||||||
|
@ -46,7 +46,7 @@ wmGesture *WM_gesture_new(wmWindow *window, const ARegion *region, const wmEvent
|
|||||||
gesture->event_modifier = event->modifier;
|
gesture->event_modifier = event->modifier;
|
||||||
gesture->event_keymodifier = event->keymodifier;
|
gesture->event_keymodifier = event->keymodifier;
|
||||||
gesture->winrct = region->winrct;
|
gesture->winrct = region->winrct;
|
||||||
gesture->user_data.use_free = true; /* Free if userdata is set. */
|
gesture->user_data.use_free = true; /* Free if user-data is set. */
|
||||||
gesture->modal_state = GESTURE_MODAL_NOP;
|
gesture->modal_state = GESTURE_MODAL_NOP;
|
||||||
gesture->move = false;
|
gesture->move = false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user