[Bf-blender-cvs] [331f721725] master: Depsgraph: Remove owner argument from relations builder as well
Sergey Sharybin
noreply at git.blender.org
Thu Jan 26 16:36:55 CET 2017
Commit: 331f7217258eb74c31ef766a3c2fff7d34c6511f
Author: Sergey Sharybin
Date: Thu Jan 26 16:35:23 2017 +0100
Branches: master
https://developer.blender.org/rB331f7217258eb74c31ef766a3c2fff7d34c6511f
Depsgraph: Remove owner argument from relations builder as well
The idea was to link something to a parent, but the point is:
we must not pass owner deep and then have any parent-type-related
logic implemented in the "children".
===================================================================
M source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M source/blender/depsgraph/intern/builder/deg_builder_relations.h
M source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc
===================================================================
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 644f74e006..67eb243f82 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -505,7 +505,7 @@ void DepsgraphRelationBuilder::build_object(Main *bmain, Scene *scene, Object *o
/* grease pencil */
if (ob->gpd) {
- build_gpencil(&ob->id, ob->gpd);
+ build_gpencil(ob->gpd);
}
}
@@ -1078,10 +1078,10 @@ void DepsgraphRelationBuilder::build_world(World *world)
/* TODO: other settings? */
/* textures */
- build_texture_stack(world_id, world->mtex);
+ build_texture_stack(world->mtex);
/* world's nodetree */
- build_nodetree(world_id, world->nodetree);
+ build_nodetree(world->nodetree);
}
void DepsgraphRelationBuilder::build_rigidbody(Scene *scene)
@@ -1419,13 +1419,11 @@ void DepsgraphRelationBuilder::build_obdata_geom(Main *bmain, Scene *scene, Obje
/* materials */
if (ob->totcol) {
- int a;
-
- for (a = 1; a <= ob->totcol; a++) {
+ for (int a = 1; a <= ob->totcol; a++) {
Material *ma = give_current_material(ob, a);
-
- if (ma)
- build_material(&ob->id, ma);
+ if (ma != NULL) {
+ build_material(ma);
+ }
}
}
@@ -1584,17 +1582,17 @@ void DepsgraphRelationBuilder::build_lamp(Object *ob)
/* lamp's nodetree */
if (la->nodetree) {
- build_nodetree(lamp_id, la->nodetree);
+ build_nodetree(la->nodetree);
ComponentKey nodetree_key(&la->nodetree->id, DEPSNODE_TYPE_PARAMETERS);
add_relation(nodetree_key, parameters_key,
DEPSREL_TYPE_COMPONENT_ORDER, "NTree->Lamp Parameters");
}
/* textures */
- build_texture_stack(lamp_id, la->mtex);
+ build_texture_stack(la->mtex);
}
-void DepsgraphRelationBuilder::build_nodetree(ID *owner, bNodeTree *ntree)
+void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree)
{
if (!ntree)
return;
@@ -1612,15 +1610,15 @@ void DepsgraphRelationBuilder::build_nodetree(ID *owner, bNodeTree *ntree)
LINKLIST_FOREACH (bNode *, bnode, &ntree->nodes) {
if (bnode->id) {
if (GS(bnode->id->name) == ID_MA) {
- build_material(owner, (Material *)bnode->id);
+ build_material((Material *)bnode->id);
}
else if (bnode->type == ID_TE) {
- build_texture(owner, (Tex *)bnode->id);
+ build_texture((Tex *)bnode->id);
}
else if (bnode->type == NODE_GROUP) {
bNodeTree *group_ntree = (bNodeTree *)bnode->id;
if ((group_ntree->id.tag & LIB_TAG_DOIT) == 0) {
- build_nodetree(owner, group_ntree);
+ build_nodetree(group_ntree);
group_ntree->id.tag |= LIB_TAG_DOIT;
}
OperationKey group_parameters_key(&group_ntree->id,
@@ -1638,12 +1636,10 @@ void DepsgraphRelationBuilder::build_nodetree(ID *owner, bNodeTree *ntree)
add_relation(animation_key, parameters_key,
DEPSREL_TYPE_COMPONENT_ORDER, "NTree Parameters");
}
-
- // TODO: link from nodetree to owner_component?
}
/* Recursively build graph for material */
-void DepsgraphRelationBuilder::build_material(ID *owner, Material *ma)
+void DepsgraphRelationBuilder::build_material(Material *ma)
{
ID *ma_id = &ma->id;
if (ma_id->tag & LIB_TAG_DOIT) {
@@ -1655,14 +1651,14 @@ void DepsgraphRelationBuilder::build_material(ID *owner, Material *ma)
build_animdata(ma_id);
/* textures */
- build_texture_stack(owner, ma->mtex);
+ build_texture_stack(ma->mtex);
/* material's nodetree */
- build_nodetree(owner, ma->nodetree);
+ build_nodetree(ma->nodetree);
}
/* Recursively build graph for texture */
-void DepsgraphRelationBuilder::build_texture(ID *owner, Tex *tex)
+void DepsgraphRelationBuilder::build_texture(Tex *tex)
{
ID *tex_id = &tex->id;
if (tex_id->tag & LIB_TAG_DOIT) {
@@ -1674,11 +1670,11 @@ void DepsgraphRelationBuilder::build_texture(ID *owner, Tex *tex)
build_animdata(tex_id);
/* texture's nodetree */
- build_nodetree(owner, tex->nodetree);
+ build_nodetree(tex->nodetree);
}
/* Texture-stack attached to some shading datablock */
-void DepsgraphRelationBuilder::build_texture_stack(ID *owner, MTex **texture_stack)
+void DepsgraphRelationBuilder::build_texture_stack(MTex **texture_stack)
{
int i;
@@ -1686,17 +1682,17 @@ void DepsgraphRelationBuilder::build_texture_stack(ID *owner, MTex **texture_sta
for (i = 0; i < MAX_MTEX; i++) {
MTex *mtex = texture_stack[i];
if (mtex && mtex->tex)
- build_texture(owner, mtex->tex);
+ build_texture(mtex->tex);
}
}
void DepsgraphRelationBuilder::build_compositor(Scene *scene)
{
/* For now, just a plain wrapper? */
- build_nodetree(&scene->id, scene->nodetree);
+ build_nodetree(scene->nodetree);
}
-void DepsgraphRelationBuilder::build_gpencil(ID *UNUSED(owner), bGPdata *gpd)
+void DepsgraphRelationBuilder::build_gpencil(bGPdata *gpd)
{
/* animation */
build_animdata(&gpd->id);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index 7595a4488b..054e410329 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -219,12 +219,12 @@ struct DepsgraphRelationBuilder
void build_obdata_geom(Main *bmain, Scene *scene, Object *ob);
void build_camera(Object *ob);
void build_lamp(Object *ob);
- void build_nodetree(ID *owner, bNodeTree *ntree);
- void build_material(ID *owner, Material *ma);
- void build_texture(ID *owner, Tex *tex);
- void build_texture_stack(ID *owner, MTex **texture_stack);
+ void build_nodetree(bNodeTree *ntree);
+ void build_material(Material *ma);
+ void build_texture(Tex *tex);
+ void build_texture_stack(MTex **texture_stack);
void build_compositor(Scene *scene);
- void build_gpencil(ID *owner, bGPdata *gpd);
+ void build_gpencil(bGPdata *gpd);
void build_cachefile(CacheFile *cache_file);
void build_mask(Mask *mask);
void build_movieclip(MovieClip *clip);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc
index af9eda1b5c..8a3476cff4 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc
@@ -120,7 +120,7 @@ void DepsgraphRelationBuilder::build_scene(Main *bmain, Scene *scene)
/* grease pencil */
if (scene->gpd) {
- build_gpencil(&scene->id, scene->gpd);
+ build_gpencil(scene->gpd);
}
/* Masks. */
More information about the Bf-blender-cvs
mailing list