Merge branch 'master' into blender2.8

This commit is contained in:
Sergey Sharybin 2018-04-04 09:54:50 +02:00
commit eaf8608ba5
9 changed files with 91 additions and 54 deletions

@ -633,7 +633,7 @@ bool OpenCLInfo::device_supported(const string& platform_name,
}
const char *blacklist[] = {
/* GCN 1 */
"Tahiti", "Pitcairn", "Capeverde", "Oland",
"Tahiti", "Pitcairn", "Capeverde", "Oland", "Hainan",
NULL
};
for(int i = 0; blacklist[i] != NULL; i++) {

@ -204,7 +204,9 @@ public:
src = dest;
}
patch_table->ComputeLocalPointValues(&verts[0], &verts[num_refiner_verts]);
if(num_refiner_verts) {
patch_table->ComputeLocalPointValues(&verts[0], &verts[num_refiner_verts]);
}
/* create patch map */
patch_map = new Far::PatchMap(*patch_table);
@ -236,13 +238,15 @@ public:
src = dest;
}
if(attr.same_storage(attr.type, TypeDesc::TypeFloat)) {
patch_table->ComputeLocalPointValues((OsdValue<float>*)&attr.buffer[0],
(OsdValue<float>*)&attr.buffer[num_refiner_verts * attr.data_sizeof()]);
}
else {
patch_table->ComputeLocalPointValues((OsdValue<float4>*)&attr.buffer[0],
(OsdValue<float4>*)&attr.buffer[num_refiner_verts * attr.data_sizeof()]);
if(num_refiner_verts) {
if(attr.same_storage(attr.type, TypeDesc::TypeFloat)) {
patch_table->ComputeLocalPointValues((OsdValue<float>*)&attr.buffer[0],
(OsdValue<float>*)&attr.buffer[num_refiner_verts * attr.data_sizeof()]);
}
else {
patch_table->ComputeLocalPointValues((OsdValue<float4>*)&attr.buffer[0],
(OsdValue<float4>*)&attr.buffer[num_refiner_verts * attr.data_sizeof()]);
}
}
}
else if(attr.element == ATTR_ELEMENT_CORNER || attr.element == ATTR_ELEMENT_CORNER_BYTE) {

@ -113,7 +113,7 @@ def elems_depth_search(ele_init, depths, other_edges_over_cb, results_init=None)
else:
test_ele = {
v for v, depth in vert_depths.items()
if depth >= depth_min for e in v.link_edges if not e.is_wire}
if depth >= depth_min}
result_ele = set()

@ -171,41 +171,39 @@ void BKE_splineik_execute_tree(
void BKE_pose_eval_init(const struct EvaluationContext *eval_ctx,
struct Scene *scene,
struct Object *ob,
struct bPose *pose);
struct Object *ob);
void BKE_pose_eval_init_ik(const struct EvaluationContext *eval_ctx,
struct Scene *scene,
struct Object *ob,
struct bPose *pose);
struct Object *ob);
void BKE_pose_eval_bone(const struct EvaluationContext *eval_ctx,
struct Scene *scene,
struct Object *ob,
struct bPoseChannel *pchan);
int pchan_index);
void BKE_pose_constraints_evaluate(const struct EvaluationContext *eval_ctx,
struct Scene *scene,
struct Object *ob,
struct bPoseChannel *pchan);
int pchan_index);
void BKE_pose_bone_done(const struct EvaluationContext *eval_ctx,
struct bPoseChannel *pchan);
struct Object *ob,
int pchan_index);
void BKE_pose_iktree_evaluate(const struct EvaluationContext *eval_ctx,
struct Scene *scene,
struct Object *ob,
struct bPoseChannel *rootchan);
int rootchan_index);
void BKE_pose_splineik_evaluate(const struct EvaluationContext *eval_ctx,
struct Scene *scene,
struct Object *ob,
struct bPoseChannel *rootchan);
int rootchan_index);
void BKE_pose_eval_flush(const struct EvaluationContext *eval_ctx,
struct Scene *scene,
struct Object *ob,
struct bPose *pose);
struct Object *ob);
void BKE_pose_eval_proxy_copy(const struct EvaluationContext *eval_ctx,
struct Object *ob);

@ -560,10 +560,10 @@ void BKE_splineik_execute_tree(
void BKE_pose_eval_init(const struct EvaluationContext *UNUSED(eval_ctx),
Scene *UNUSED(scene),
Object *ob,
bPose *pose)
Object *ob)
{
bPoseChannel *pchan;
bPose *pose = ob->pose;
BLI_assert(pose != NULL);
DEG_debug_print_eval(__func__, ob->id.name, ob);
@ -576,16 +576,21 @@ void BKE_pose_eval_init(const struct EvaluationContext *UNUSED(eval_ctx),
/* imat is needed for solvers. */
invert_m4_m4(ob->imat, ob->obmat);
/* 1. clear flags */
for (pchan = pose->chanbase.first; pchan != NULL; pchan = pchan->next) {
const int num_channels = BLI_listbase_count(&pose->chanbase);
pose->chan_array = MEM_malloc_arrayN(
num_channels, sizeof(bPoseChannel*), "pose->chan_array");
/* clear flags */
int pchan_index = 0;
for (bPoseChannel *pchan = pose->chanbase.first; pchan != NULL; pchan = pchan->next) {
pchan->flag &= ~(POSE_DONE | POSE_CHAIN | POSE_IKTREE | POSE_IKSPLINE);
pose->chan_array[pchan_index++] = pchan;
}
}
void BKE_pose_eval_init_ik(const struct EvaluationContext *eval_ctx,
Scene *scene,
Object *ob,
bPose *UNUSED(pose))
Object *ob)
{
DEG_debug_print_eval(__func__, ob->id.name, ob);
BLI_assert(ob->type == OB_ARMATURE);
@ -594,11 +599,11 @@ void BKE_pose_eval_init_ik(const struct EvaluationContext *eval_ctx,
if (arm->flag & ARM_RESTPOS) {
return;
}
/* 2a. construct the IK tree (standard IK) */
/* construct the IK tree (standard IK) */
BIK_initialize_tree(eval_ctx, scene, ob, ctime);
/* 2b. construct the Spline IK trees
/* construct the Spline IK trees
* - this is not integrated as an IK plugin, since it should be able
* to function in conjunction with standard IK
* to function in conjunction with standard IK
*/
BKE_pose_splineik_init_tree(scene, ob, ctime);
}
@ -606,8 +611,10 @@ void BKE_pose_eval_init_ik(const struct EvaluationContext *eval_ctx,
void BKE_pose_eval_bone(const struct EvaluationContext *eval_ctx,
Scene *scene,
Object *ob,
bPoseChannel *pchan)
int pchan_index)
{
BLI_assert(ob->pose != NULL);
bPoseChannel *pchan = ob->pose->chan_array[pchan_index];
DEG_debug_print_eval_subdata(
__func__, ob->id.name, ob, "pchan", pchan->name, pchan);
BLI_assert(ob->type == OB_ARMATURE);
@ -642,8 +649,10 @@ void BKE_pose_eval_bone(const struct EvaluationContext *eval_ctx,
void BKE_pose_constraints_evaluate(const struct EvaluationContext *eval_ctx,
Scene *scene,
Object *ob,
bPoseChannel *pchan)
int pchan_index)
{
BLI_assert(ob->pose != NULL);
bPoseChannel *pchan = ob->pose->chan_array[pchan_index];
DEG_debug_print_eval_subdata(
__func__, ob->id.name, ob, "pchan", pchan->name, pchan);
bArmature *arm = (bArmature *)ob->data;
@ -662,8 +671,11 @@ void BKE_pose_constraints_evaluate(const struct EvaluationContext *eval_ctx,
}
void BKE_pose_bone_done(const struct EvaluationContext *UNUSED(eval_ctx),
bPoseChannel *pchan)
struct Object *ob,
int pchan_index)
{
BLI_assert(ob->pose != NULL);
bPoseChannel *pchan = ob->pose->chan_array[pchan_index];
float imat[4][4];
DEG_debug_print_eval(__func__, pchan->name, pchan);
if (pchan->bone) {
@ -675,8 +687,10 @@ void BKE_pose_bone_done(const struct EvaluationContext *UNUSED(eval_ctx),
void BKE_pose_iktree_evaluate(const struct EvaluationContext *eval_ctx,
Scene *scene,
Object *ob,
bPoseChannel *rootchan)
int rootchan_index)
{
BLI_assert(ob->pose != NULL);
bPoseChannel *rootchan = ob->pose->chan_array[rootchan_index];
DEG_debug_print_eval_subdata(
__func__, ob->id.name, ob, "rootchan", rootchan->name, rootchan);
BLI_assert(ob->type == OB_ARMATURE);
@ -691,9 +705,11 @@ void BKE_pose_iktree_evaluate(const struct EvaluationContext *eval_ctx,
void BKE_pose_splineik_evaluate(const struct EvaluationContext *eval_ctx,
Scene *scene,
Object *ob,
bPoseChannel *rootchan)
int rootchan_index)
{
BLI_assert(ob->pose != NULL);
bPoseChannel *rootchan = ob->pose->chan_array[rootchan_index];
DEG_debug_print_eval_subdata(
__func__, ob->id.name, ob, "rootchan", rootchan->name, rootchan);
BLI_assert(ob->type == OB_ARMATURE);
@ -707,15 +723,21 @@ void BKE_pose_splineik_evaluate(const struct EvaluationContext *eval_ctx,
void BKE_pose_eval_flush(const struct EvaluationContext *UNUSED(eval_ctx),
Scene *scene,
Object *ob,
bPose *UNUSED(pose))
Object *ob)
{
bPose *pose = ob->pose;
BLI_assert(pose != NULL);
float ctime = BKE_scene_frame_get(scene); /* not accurate... */
DEG_debug_print_eval(__func__, ob->id.name, ob);
BLI_assert(ob->type == OB_ARMATURE);
/* 6. release the IK tree */
/* release the IK tree */
BIK_release_tree(scene, ob, ctime);
BLI_assert(pose->chan_array != NULL);
MEM_freeN(pose->chan_array);
pose->chan_array = NULL;
}
void BKE_pose_eval_proxy_copy(const struct EvaluationContext *UNUSED(eval_ctx), Object *ob)

@ -5181,6 +5181,7 @@ static void direct_link_pose(FileData *fd, bPose *pose)
link_list(fd, &pose->agroups);
pose->chanhash = NULL;
pose->chan_array = NULL;
for (pchan = pose->chanbase.first; pchan; pchan=pchan->next) {
pchan->bone = NULL;

@ -180,7 +180,7 @@ struct DepsgraphNodeBuilder {
void build_object_data(Object *object);
void build_object_transform(Object *object);
void build_object_constraints(Object *object);
void build_pose_constraints(Object *object, bPoseChannel *pchan);
void build_pose_constraints(Object *object, bPoseChannel *pchan, int pchan_index);
void build_rigidbody(Scene *scene);
void build_particles(Object *object);
void build_particle_settings(ParticleSettings *part);

@ -67,7 +67,8 @@ extern "C" {
namespace DEG {
void DepsgraphNodeBuilder::build_pose_constraints(Object *object,
bPoseChannel *pchan)
bPoseChannel *pchan,
int pchan_index)
{
/* create node for constraint stack */
add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name,
@ -75,7 +76,7 @@ void DepsgraphNodeBuilder::build_pose_constraints(Object *object,
_1,
get_cow_datablock(scene_),
get_cow_datablock(object),
pchan),
pchan_index),
DEG_OPCODE_BONE_CONSTRAINTS);
}
@ -98,13 +99,14 @@ void DepsgraphNodeBuilder::build_ik_pose(Object *object,
return;
}
int rootchan_index = BLI_findindex(&object->pose->chanbase, rootchan);
/* Operation node for evaluating/running IK Solver. */
add_operation_node(&object->id, DEG_NODE_TYPE_EVAL_POSE, rootchan->name,
function_bind(BKE_pose_iktree_evaluate,
_1,
get_cow_datablock(scene_),
get_cow_datablock(object),
rootchan),
rootchan_index),
DEG_OPCODE_POSE_IK_SOLVER);
}
@ -122,12 +124,13 @@ void DepsgraphNodeBuilder::build_splineik_pose(Object *object,
* Store the "root bone" of this chain in the solver, so it knows where to
* start.
*/
int rootchan_index = BLI_findindex(&object->pose->chanbase, rootchan);
add_operation_node(&object->id, DEG_NODE_TYPE_EVAL_POSE, rootchan->name,
function_bind(BKE_pose_splineik_evaluate,
_1,
get_cow_datablock(scene_),
get_cow_datablock(object),
rootchan),
rootchan_index),
DEG_OPCODE_POSE_SPLINE_IK_SOLVER);
}
@ -220,8 +223,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object)
function_bind(BKE_pose_eval_init,
_1,
scene_cow,
object_cow,
object_cow->pose),
object_cow),
DEG_OPCODE_POSE_INIT);
op_node->set_as_entry();
@ -230,8 +232,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object)
function_bind(BKE_pose_eval_init_ik,
_1,
scene_cow,
object_cow,
object_cow->pose),
object_cow),
DEG_OPCODE_POSE_INIT_IK);
op_node = add_operation_node(&object->id,
@ -239,12 +240,12 @@ void DepsgraphNodeBuilder::build_rig(Object *object)
function_bind(BKE_pose_eval_flush,
_1,
scene_cow,
object_cow,
object_cow->pose),
object_cow),
DEG_OPCODE_POSE_DONE);
op_node->set_as_exit();
/* bones */
int pchan_index = 0;
LISTBASE_FOREACH (bPoseChannel *, pchan, &object_cow->pose->chanbase) {
/* Node for bone evaluation. */
op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name, NULL,
@ -255,7 +256,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object)
function_bind(BKE_pose_eval_bone, _1,
scene_cow,
object_cow,
pchan),
pchan_index),
DEG_OPCODE_BONE_POSE_PARENT);
/* NOTE: Dedicated noop for easier relationship construction. */
@ -264,7 +265,10 @@ void DepsgraphNodeBuilder::build_rig(Object *object)
DEG_OPCODE_BONE_READY);
op_node = add_operation_node(&object->id, DEG_NODE_TYPE_BONE, pchan->name,
function_bind(BKE_pose_bone_done, _1, pchan),
function_bind(BKE_pose_bone_done,
_1,
object,
pchan_index),
DEG_OPCODE_BONE_DONE);
op_node->set_as_exit();
/* Custom properties. */
@ -277,7 +281,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object)
}
/* Build constraints. */
if (pchan->constraints.first != NULL) {
build_pose_constraints(object, pchan);
build_pose_constraints(object, pchan, pchan_index);
}
/**
* IK Solvers.
@ -305,6 +309,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object)
break;
}
}
/* Custom shape. */
/* NOTE: Custom shape datablock is already remapped to CoW version. */
if (pchan->custom != NULL) {
@ -312,6 +317,8 @@ void DepsgraphNodeBuilder::build_rig(Object *object)
get_orig_datablock(pchan->custom),
DEG_ID_LINKED_INDIRECTLY);
}
pchan_index++;
}
}

@ -393,7 +393,12 @@ typedef enum eRotationModes {
typedef struct bPose {
ListBase chanbase; /* list of pose channels, PoseBones in RNA */
struct GHash *chanhash; /* ghash for quicker string lookups */
/* Flat array of pose channels. It references pointers from
* chanbase. Used for quick pose channel lookup from an index.
*/
bPoseChannel **chan_array;
short flag, pad;
unsigned int proxy_layer; /* proxy layer: copy from armature, gets synced */
int pad1;