[Bf-blender-cvs] [410e50a9043] cycles_procedural_api: alembic, cleanup, use the socket API to set the current frame and check for precreated data
Kévin Dietrich
noreply at git.blender.org
Wed Sep 9 01:08:22 CEST 2020
Commit: 410e50a9043cded31c2264693513fd9262e52645
Author: Kévin Dietrich
Date: Tue Sep 8 11:07:19 2020 +0200
Branches: cycles_procedural_api
https://developer.blender.org/rB410e50a9043cded31c2264693513fd9262e52645
alembic, cleanup, use the socket API to set the current frame and check
for precreated data
===================================================================
M intern/cycles/blender/blender_object.cpp
M intern/cycles/render/alembic.cpp
M intern/cycles/render/alembic.h
===================================================================
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index 112662e7632..ebd055aef7a 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -357,10 +357,17 @@ void BlenderSync::sync_procedural(BL::Object &b_ob,
procedural_map.used(p);
}
- p->set_current_frame(scene, static_cast<float>(frame_current));
+ p->set_frame(static_cast<float>(frame_current));
+ if (p->frame_is_modified()) {
+ scene->procedural_manager->need_update = true;
+ }
+
+ auto absolute_path = blender_absolute_path(b_data, b_ob, b_mesh_cache.cache_file().filepath());
+
+ p->set_filepath(ustring(absolute_path));
- // check if it was already created (for synchronisation during interactive rendering)
- if (p->objects.size()) {
+ /* if the filepath was not modified, then we have already created the objects */
+ if (!p->filepath_is_modified()) {
return;
}
@@ -379,17 +386,11 @@ void BlenderSync::sync_procedural(BL::Object &b_ob,
used_shaders.push_back_slow(default_shader);
}
- auto absolute_path = blender_absolute_path(b_data, b_ob, b_mesh_cache.cache_file().filepath());
-
- if (p->filepath != absolute_path) {
- p->filepath = absolute_path;
+ AlembicObject *abc_object = scene->create_node<AlembicObject>();
+ abc_object->set_path(ustring(b_mesh_cache.object_path()));
+ abc_object->set_used_shaders(used_shaders);
- AlembicObject *abc_object = scene->create_node<AlembicObject>();
- abc_object->set_path(ustring(b_mesh_cache.object_path()));
- abc_object->set_used_shaders(used_shaders);
-
- p->objects.push_back_slow(abc_object);
- }
+ p->objects.push_back_slow(abc_object);
}
void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
diff --git a/intern/cycles/render/alembic.cpp b/intern/cycles/render/alembic.cpp
index 93cf863290c..ee053d7709b 100644
--- a/intern/cycles/render/alembic.cpp
+++ b/intern/cycles/render/alembic.cpp
@@ -262,7 +262,7 @@ AlembicProcedural::~AlembicProcedural()
void AlembicProcedural::generate(Scene *scene)
{
- if (!need_update && !need_update_for_frame_change) {
+ if (!is_modified()) {
return;
}
@@ -290,7 +290,6 @@ void AlembicProcedural::generate(Scene *scene)
objstack.pop();
string path = obj.first.getFullName();
- vector<pathShaderType>::const_iterator it;
Transform currmatrix = obj.second;
AlembicObject *object = NULL;
@@ -320,17 +319,7 @@ void AlembicProcedural::generate(Scene *scene)
objstack.push(std::pair<IObject, Transform>(obj.first.getChild(i), currmatrix));
}
- need_update = false;
- need_update_for_frame_change = false;
-}
-
-void AlembicProcedural::set_current_frame(ccl::Scene *scene, float frame_)
-{
- if (frame != frame_) {
- frame = frame_;
- need_update_for_frame_change = true;
- scene->procedural_manager->need_update = true;
- }
+ clear_modified();
}
void AlembicProcedural::read_mesh(Scene *scene,
diff --git a/intern/cycles/render/alembic.h b/intern/cycles/render/alembic.h
index 29e385d3ba9..0f55fe4348b 100644
--- a/intern/cycles/render/alembic.h
+++ b/intern/cycles/render/alembic.h
@@ -75,35 +75,19 @@ class AlembicObject : public Node {
};
class AlembicProcedural : public Procedural {
- bool need_update = true;
- bool need_update_for_frame_change = true;
-
public:
NODE_DECLARE
- typedef std::pair<const ustring, Shader *> pathShaderType;
-
AlembicProcedural();
~AlembicProcedural();
void generate(Scene *scene);
- bool use_motion_blur;
- ustring filepath;
- float frame;
- float frame_rate;
- array<AlembicObject *> objects;
-
- void tag_update()
- {
- need_update = true;
- }
+ NODE_PUBLIC_API(bool, use_motion_blur)
+ NODE_PUBLIC_API(ustring, filepath)
+ NODE_PUBLIC_API(float, frame)
+ NODE_PUBLIC_API(float, frame_rate)
- bool should_remove(const Node * /*node*/) const
- {
- return false;
- }
-
- void set_current_frame(Scene *scene, float frame_);
+ array<AlembicObject *> objects; // todo : Node::set
private:
void read_mesh(Scene *scene,
@@ -111,6 +95,7 @@ class AlembicProcedural : public Procedural {
Transform xform,
IPolyMesh &mesh,
Abc::chrono_t frame_time);
+
void read_curves(Scene *scene,
AlembicObject *abc_object,
Transform xform,
More information about the Bf-blender-cvs
mailing list