26 if (b_ob_info.
object_data.is_a(&RNA_Curves) || use_particle_hair) {
47 array<Node *> used_shaders;
49 if (b_ob.type() == BL::Object::type_LIGHT) {
50 find_shader(b_ob.data(), used_shaders, scene->default_light);
54 BL::Material material_override = view_layer.material_override;
55 Shader *default_shader = (b_ob.type() == BL::Object::type_VOLUME) ? scene->default_volume :
56 scene->default_surface;
58 for (BL::MaterialSlot &b_slot : b_ob.material_slots) {
59 if (material_override) {
60 find_shader(material_override, used_shaders, default_shader);
63 BL::ID b_material(b_slot.material());
64 find_shader(b_material, used_shaders, default_shader);
68 if (used_shaders.
size() == 0) {
69 if (material_override) {
70 find_shader(material_override, used_shaders, default_shader);
82 bool use_particle_hair,
91 const GeometryKey key(b_key_id.ptr.data, geom_type);
94 array<Node *> used_shaders = find_used_shaders(b_ob_info.
iter_object);
97 Geometry *geom = geometry_map.find(key);
99 if (geometry_synced.find(geom) != geometry_synced.end()) {
106 if (geom ==
nullptr) {
109 geom = scene->create_node<
Light>();
112 geom = scene->create_node<Hair>();
115 geom = scene->create_node<
Volume>();
121 geom = scene->create_node<
Mesh>();
123 geometry_map.add(key, geom);
127 sync = geometry_map.update(geom, b_key_id);
137 else if (geom->get_used_shaders() != used_shaders) {
143 bool attribute_recalc =
false;
145 for (Node *node : geom->get_used_shaders()) {
148 attribute_recalc =
true;
152 if (!attribute_recalc) {
158 geometry_synced.insert(geom);
163 geom->set_used_shaders(used_shaders);
165 auto sync_func = [
this, geom_type, b_ob_info, geom]()
mutable {
166 if (progress.get_cancel()) {
170 progress.set_sync_status(
"Synchronizing object", b_ob_info.real_object.name());
174 sync_light(b_ob_info, light);
177 Hair *hair =
static_cast<Hair *
>(geom);
178 sync_hair(b_ob_info, hair);
182 sync_volume(b_ob_info, volume);
186 sync_pointcloud(pointcloud, b_ob_info);
189 Mesh *mesh =
static_cast<Mesh *
>(geom);
190 sync_mesh(b_ob_info, mesh);
205void BlenderSync::sync_geometry_motion(
BObjectInfo &b_ob_info,
207 const float motion_time,
208 bool use_particle_hair,
212 Geometry *geom =
object->get_geometry();
214 if (geometry_motion_synced.find(geom) != geometry_motion_synced.end() ||
215 geometry_motion_attribute_synced.find(geom) != geometry_motion_attribute_synced.end())
220 geometry_motion_synced.insert(geom);
224 if (geometry_synced.find(geom) == geometry_synced.end()) {
244 geom->set_motion_steps(object->get_motion().size());
248 const int motion_step = geom->
motion_step(motion_time);
249 if (motion_step < 0) {
253 auto sync_func = [
this, b_ob_info, use_particle_hair, motion_step, geom]()
mutable {
254 if (progress.get_cancel()) {
258 if (b_ob_info.
object_data.is_a(&RNA_Curves) || use_particle_hair) {
259 Hair *hair =
static_cast<Hair *
>(geom);
260 sync_hair_motion(b_ob_info, hair, motion_step);
262 else if (b_ob_info.
object_data.is_a(&RNA_Volume) ||
267 else if (b_ob_info.
object_data.is_a(&RNA_PointCloud)) {
269 sync_pointcloud_motion(pointcloud, b_ob_info, motion_step);
272 Mesh *mesh =
static_cast<Mesh *
>(geom);
273 sync_mesh_motion(b_ob_info, mesh, motion_step);
struct PointCloud PointCloud
static CCL_NAMESPACE_BEGIN Geometry::Type determine_geom_type(BObjectInfo &b_ob_info, bool use_particle_hair)
int motion_step(const float time) const
virtual bool has_motion_blur() const
bool need_update_geometry() const
void push_back_slow(const T &t)
static BL::FluidDomainSettings object_fluid_gas_domain_find(BL::Object &b_ob)
static CCL_NAMESPACE_BEGIN BL::ID object_get_data(const BL::Object &b_ob, const bool use_adaptive_subdivision)
#define CCL_NAMESPACE_END
static PyObject * sync_func(PyObject *, PyObject *args)
bool use_adaptive_subdivision
bool is_real_object_data() const
void push(TaskRunFunction &&task)