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);
132 if (geom->
is_light() &&
static_cast<const Light *
>(geom)->get_is_portal()) {
133 world_use_portal =
true;
142 else if (geom->get_used_shaders() != used_shaders) {
148 bool attribute_recalc =
false;
150 for (Node *node : geom->get_used_shaders()) {
153 attribute_recalc =
true;
157 if (!attribute_recalc) {
163 geometry_synced.insert(geom);
168 geom->set_used_shaders(used_shaders);
170 auto sync_func = [
this, geom_type, b_ob_info, geom]()
mutable {
171 if (progress.get_cancel()) {
175 progress.set_sync_status(
"Synchronizing object", b_ob_info.real_object.name());
179 sync_light(b_ob_info, light);
182 Hair *hair =
static_cast<Hair *
>(geom);
183 sync_hair(b_ob_info, hair);
187 sync_volume(b_ob_info, volume);
191 sync_pointcloud(pointcloud, b_ob_info);
194 Mesh *mesh =
static_cast<Mesh *
>(geom);
195 sync_mesh(b_ob_info, mesh);
210void BlenderSync::sync_geometry_motion(
BObjectInfo &b_ob_info,
212 const float motion_time,
213 bool use_particle_hair,
217 Geometry *geom =
object->get_geometry();
219 if (geometry_motion_synced.find(geom) != geometry_motion_synced.end() ||
220 geometry_motion_attribute_synced.find(geom) != geometry_motion_attribute_synced.end())
225 geometry_motion_synced.insert(geom);
229 if (geometry_synced.find(geom) == geometry_synced.end()) {
249 geom->set_motion_steps(object->get_motion().size());
253 const int motion_step = geom->
motion_step(motion_time);
254 if (motion_step < 0) {
258 auto sync_func = [
this, b_ob_info, use_particle_hair, motion_step, geom]()
mutable {
259 if (progress.get_cancel()) {
263 if (b_ob_info.
object_data.is_a(&RNA_Curves) || use_particle_hair) {
264 Hair *hair =
static_cast<Hair *
>(geom);
265 sync_hair_motion(b_ob_info, hair, motion_step);
267 else if (b_ob_info.
object_data.is_a(&RNA_Volume) ||
272 else if (b_ob_info.
object_data.is_a(&RNA_PointCloud)) {
274 sync_pointcloud_motion(pointcloud, b_ob_info, motion_step);
277 Mesh *mesh =
static_cast<Mesh *
>(geom);
278 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)