Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-02-02 14:21:24 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-02-02 14:21:24 +0300
commit26dff781b3c13ad21010d595d38baa5b8b6e06a5 (patch)
treebee08064424f2c1efce4fbb8f17ce8ce5b086a79 /source
parentc3eb22e2ab0f4f96d64d1de7969966efd5d45066 (diff)
parent37beac8eb823bd81b411426bfc8718639577b179 (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/armature_update.c26
-rw-r--r--source/blender/collada/DocumentExporter.cpp3
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.cc24
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc94
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.h7
5 files changed, 103 insertions, 51 deletions
diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c
index 1b8bf3feb10..de0dfe2530d 100644
--- a/source/blender/blenkernel/intern/armature_update.c
+++ b/source/blender/blenkernel/intern/armature_update.c
@@ -588,13 +588,15 @@ void BKE_pose_eval_init_ik(const struct EvaluationContext *eval_ctx,
Object *ob,
bPose *UNUSED(pose))
{
- float ctime = BKE_scene_frame_get(scene); /* not accurate... */
-
DEBUG_PRINT("%s on %s\n", __func__, ob->id.name);
-
+ BLI_assert(ob->type == OB_ARMATURE);
+ const float ctime = BKE_scene_frame_get(scene); /* not accurate... */
+ bArmature *arm = (bArmature *)ob->data;
+ if (arm->flag & ARM_RESTPOS) {
+ return;
+ }
/* 2a. construct the IK tree (standard IK) */
BIK_initialize_tree(eval_ctx, scene, ob, ctime);
-
/* 2b. 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
@@ -607,9 +609,9 @@ void BKE_pose_eval_bone(const struct EvaluationContext *eval_ctx,
Object *ob,
bPoseChannel *pchan)
{
- bArmature *arm = (bArmature *)ob->data;
DEBUG_PRINT("%s on %s pchan %s\n", __func__, ob->id.name, pchan->name);
BLI_assert(ob->type == OB_ARMATURE);
+ bArmature *arm = (bArmature *)ob->data;
if (arm->edbo || (arm->flag & ARM_RESTPOS)) {
Bone *bone = pchan->bone;
if (bone) {
@@ -674,8 +676,13 @@ void BKE_pose_iktree_evaluate(const struct EvaluationContext *eval_ctx,
Object *ob,
bPoseChannel *rootchan)
{
- float ctime = BKE_scene_frame_get(scene); /* not accurate... */
DEBUG_PRINT("%s on %s pchan %s\n", __func__, ob->id.name, rootchan->name);
+ BLI_assert(ob->type == OB_ARMATURE);
+ const float ctime = BKE_scene_frame_get(scene); /* not accurate... */
+ bArmature *arm = (bArmature *)ob->data;
+ if (arm->flag & ARM_RESTPOS) {
+ return;
+ }
BIK_execute_tree(eval_ctx, scene, ob, rootchan, ctime);
}
@@ -684,8 +691,13 @@ void BKE_pose_splineik_evaluate(const struct EvaluationContext *eval_ctx,
Object *ob,
bPoseChannel *rootchan)
{
- float ctime = BKE_scene_frame_get(scene); /* not accurate... */
DEBUG_PRINT("%s on %s pchan %s\n", __func__, ob->id.name, rootchan->name);
+ BLI_assert(ob->type == OB_ARMATURE);
+ const float ctime = BKE_scene_frame_get(scene); /* not accurate... */
+ bArmature *arm = (bArmature *)ob->data;
+ if (arm->flag & ARM_RESTPOS) {
+ return;
+ }
BKE_splineik_execute_tree(eval_ctx, scene, ob, rootchan, ctime);
}
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index 6e84c3baccb..179644db9b3 100644
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@ -302,9 +302,9 @@ int DocumentExporter::exportCurrentScene(const EvaluationContext *eval_ctx, Scen
// <library_animations>
AnimationExporter ae(writer, this->export_settings);
- bool has_animations = ae.exportAnimations(eval_ctx, sce);
#if 0
+ bool has_animations = ae.exportAnimations(eval_ctx, sce);
/* The following code seems to be an obsolete workaround
Comment out until it proofs correct that we no longer need it.
*/
@@ -320,6 +320,7 @@ int DocumentExporter::exportCurrentScene(const EvaluationContext *eval_ctx, Scen
se.setExportTransformationType(this->export_settings->export_transformation_type);
}
#else
+ ae.exportAnimations(sce);
se.setExportTransformationType(this->export_settings->export_transformation_type);
#endif
se.exportScene(eval_ctx, sce);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index ddae761cea0..7de3c169737 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -853,8 +853,7 @@ void DepsgraphNodeBuilder::build_particles(Object *object)
* blackbox evaluation step for one particle system referenced by
* the particle systems stack. All dependencies link to this operation.
*/
-
- /* component for all particle systems */
+ /* Component for all particle systems. */
ComponentDepsNode *psys_comp =
add_component_node(&object->id, DEG_NODE_TYPE_EVAL_PARTICLES);
@@ -868,17 +867,14 @@ void DepsgraphNodeBuilder::build_particles(Object *object)
scene_cow,
ob_cow),
DEG_OPCODE_PARTICLE_SYSTEM_EVAL_INIT);
-
- /* particle systems */
+ /* Build all particle systems. */
BLI_LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) {
ParticleSettings *part = psys->part;
-
/* Build particle settings operations.
*
* NOTE: The call itself ensures settings are only build once.
*/
build_particle_settings(part);
-
/* Update on particle settings change. */
add_operation_node(psys_comp,
function_bind(BKE_particle_system_settings_eval,
@@ -886,12 +882,26 @@ void DepsgraphNodeBuilder::build_particles(Object *object)
psys),
DEG_OPCODE_PARTICLE_SETTINGS_EVAL,
psys->name);
-
/* Particle system evaluation. */
add_operation_node(psys_comp,
NULL,
DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
psys->name);
+ /* Visualization of particle system. */
+ switch (part->ren_as) {
+ case PART_DRAW_OB:
+ if (part->dup_ob != NULL) {
+ build_object(NULL,
+ part->dup_ob,
+ DEG_ID_LINKED_INDIRECTLY);
+ }
+ break;
+ case PART_DRAW_GR:
+ if (part->dup_group != NULL) {
+ build_group(part->dup_group);
+ }
+ break;
+ }
}
/* TODO(sergey): Do we need a point cache operations here? */
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 281e58cf38a..8afb23f08fa 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -194,6 +194,7 @@ static bool particle_system_depends_on_time(ParticleSystem *psys)
static bool object_particles_depends_on_time(Object *object)
{
+ return true;
BLI_LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) {
if (particle_system_depends_on_time(psys)) {
return true;
@@ -423,20 +424,20 @@ void DepsgraphRelationBuilder::build_group(Object *object, Group *group)
{
ID *group_id = &group->id;
bool group_done = (group_id->tag & LIB_TAG_DOIT) != 0;
- OperationKey object_local_transform_key(&object->id,
+ OperationKey object_local_transform_key(object != NULL ? &object->id : NULL,
DEG_NODE_TYPE_TRANSFORM,
DEG_OPCODE_TRANSFORM_LOCAL);
-
if (!group_done) {
BLI_LISTBASE_FOREACH (Base *, base, &group->view_layer->object_bases) {
build_object(NULL, base->object);
}
group_id->tag |= LIB_TAG_DOIT;
}
-
- BLI_LISTBASE_FOREACH (Base *, base, &group->view_layer->object_bases) {
- ComponentKey dupli_transform_key(&base->object->id, DEG_NODE_TYPE_TRANSFORM);
- add_relation(dupli_transform_key, object_local_transform_key, "Dupligroup");
+ if (object != NULL) {
+ BLI_LISTBASE_FOREACH (Base *, base, &group->view_layer->object_bases) {
+ ComponentKey dupli_transform_key(&base->object->id, DEG_NODE_TYPE_TRANSFORM);
+ add_relation(dupli_transform_key, object_local_transform_key, "Dupligroup");
+ }
}
}
@@ -1413,7 +1414,7 @@ void DepsgraphRelationBuilder::build_particles(Object *object)
DEG_NODE_TYPE_EVAL_PARTICLES,
DEG_OPCODE_PARTICLE_SYSTEM_EVAL_INIT);
- /* particle systems */
+ /* Particle systems. */
BLI_LISTBASE_FOREACH (ParticleSystem *, psys, &object->particlesystem) {
ParticleSettings *part = psys->part;
@@ -1446,20 +1447,13 @@ void DepsgraphRelationBuilder::build_particles(Object *object)
add_relation(psys_key,
particle_settings_recalc_clear_key,
"Particle Settings Recalc Clear");
-
- /* XXX: if particle system is later re-enabled, we must do full rebuild? */
- if (!psys_check_enabled(object, psys, G.is_rendering))
- continue;
-
add_relation(eval_init_key, psys_key, "Init -> PSys");
-
/* TODO(sergey): Currently particle update is just a placeholder,
* hook it to the ubereval node so particle system is getting updated
* on playback.
*/
add_relation(psys_key, obdata_ubereval_key, "PSys -> UberEval");
-
- /* collisions */
+ /* Collisions */
if (part->type != PART_HAIR) {
add_collision_relations(psys_key,
scene_,
@@ -1479,8 +1473,7 @@ void DepsgraphRelationBuilder::build_particles(Object *object)
true,
"Hair Collision");
}
-
- /* effectors */
+ /* Effectors. */
add_forcefield_relations(psys_key,
scene_,
object,
@@ -1488,35 +1481,46 @@ void DepsgraphRelationBuilder::build_particles(Object *object)
part->effector_weights,
part->type == PART_HAIR,
"Particle Field");
-
- /* boids */
+ /* Boids .*/
if (part->boids) {
BLI_LISTBASE_FOREACH (BoidState *, state, &part->boids->states) {
BLI_LISTBASE_FOREACH (BoidRule *, rule, &state->rules) {
Object *ruleob = NULL;
- if (rule->type == eBoidRuleType_Avoid)
+ if (rule->type == eBoidRuleType_Avoid) {
ruleob = ((BoidRuleGoalAvoid *)rule)->ob;
- else if (rule->type == eBoidRuleType_FollowLeader)
+ }
+ else if (rule->type == eBoidRuleType_FollowLeader) {
ruleob = ((BoidRuleFollowLeader *)rule)->ob;
-
+ }
if (ruleob) {
- ComponentKey ruleob_key(&ruleob->id, DEG_NODE_TYPE_TRANSFORM);
+ ComponentKey ruleob_key(&ruleob->id,
+ DEG_NODE_TYPE_TRANSFORM);
add_relation(ruleob_key, psys_key, "Boid Rule");
}
}
}
}
-
- if (part->ren_as == PART_DRAW_OB && part->dup_ob) {
- ComponentKey dup_ob_key(&part->dup_ob->id, DEG_NODE_TYPE_TRANSFORM);
- add_relation(dup_ob_key, psys_key, "Particle Object Visualization");
- if (part->dup_ob->type == OB_MBALL) {
- ComponentKey dup_geometry_key(&part->dup_ob->id,
- DEG_NODE_TYPE_GEOMETRY);
- add_relation(obdata_ubereval_key,
- dup_geometry_key,
- "Particle MBall Visualization");
- }
+ switch (part->ren_as) {
+ case PART_DRAW_OB:
+ if (part->dup_ob != NULL) {
+ /* Make sure object's relations are all built. */
+ build_object(NULL, part->dup_ob);
+ /* Build relation for the particle visualization. */
+ build_particles_visualization_object(object,
+ psys,
+ part->dup_ob);
+ }
+ break;
+ case PART_DRAW_GR:
+ if (part->dup_group != NULL) {
+ build_group(NULL, part->dup_group);
+ BLI_LISTBASE_FOREACH (GroupObject *, go, &part->dup_group->gobject) {
+ build_particles_visualization_object(object,
+ psys,
+ go->ob);
+ }
+ }
+ break;
}
}
@@ -1552,6 +1556,28 @@ void DepsgraphRelationBuilder::build_particle_settings(ParticleSettings *part)
add_relation(eval_key, recalc_clear_key, "Particle Settings Clear Recalc");
}
+void DepsgraphRelationBuilder::build_particles_visualization_object(
+ Object *object,
+ ParticleSystem *psys,
+ Object *draw_object)
+{
+ OperationKey psys_key(&object->id,
+ DEG_NODE_TYPE_EVAL_PARTICLES,
+ DEG_OPCODE_PARTICLE_SYSTEM_EVAL,
+ psys->name);
+ OperationKey obdata_ubereval_key(&object->id,
+ DEG_NODE_TYPE_GEOMETRY,
+ DEG_OPCODE_GEOMETRY_UBEREVAL);
+ ComponentKey dup_ob_key(&draw_object->id, DEG_NODE_TYPE_TRANSFORM);
+ add_relation(dup_ob_key, psys_key, "Particle Object Visualization");
+ if (draw_object->type == OB_MBALL) {
+ ComponentKey dup_geometry_key(&draw_object->id, DEG_NODE_TYPE_GEOMETRY);
+ add_relation(obdata_ubereval_key,
+ dup_geometry_key,
+ "Particle MBall Visualization");
+ }
+}
+
void DepsgraphRelationBuilder::build_cloth(Object *object,
ModifierData * /*md*/)
{
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index 4fcb2acc5f3..ea7e23eca79 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -67,13 +67,13 @@ struct bNodeTree;
struct Object;
struct bPoseChannel;
struct bConstraint;
+struct ParticleSystem;
+struct ParticleSettings;
struct Scene;
struct ViewLayer;
struct Tex;
struct World;
struct EffectorWeights;
-struct ParticleSystem;
-struct ParticleSettings;
struct PropertyRNA;
@@ -221,6 +221,9 @@ struct DepsgraphRelationBuilder
void build_rigidbody(Scene *scene);
void build_particles(Object *object);
void build_particle_settings(ParticleSettings *part);
+ void build_particles_visualization_object(Object *object,
+ ParticleSystem *psys,
+ Object *draw_object);
void build_cloth(Object *object, ModifierData *md);
void build_ik_pose(Object *object,
bPoseChannel *pchan,