29 switch (b_light.
type) {
56 object_fluid_gas_domain_find(*b_ob_info.
real_object)))
71 blender::id_cast<const blender::PointCloud *>(b_ob.
data)->type ==
82 array<Node *> used_shaders;
85 find_shader(
static_cast<blender::ID *
>(b_ob.
data), used_shaders, scene->default_light);
93 if (material_override) {
94 find_shader(&material_override->id, used_shaders, default_shader);
98 find_shader(
reinterpret_cast<blender::ID *
>(b_material), used_shaders, default_shader);
102 if (used_shaders.
size() == 0) {
103 if (material_override) {
104 find_shader(&material_override->id, used_shaders, default_shader);
116 bool use_particle_hair,
125 const GeometryKey key(b_key_id, geom_type);
128 array<Node *> used_shaders = find_used_shaders(*b_ob_info.
iter_object);
131 Geometry *geom = geometry_map.find(key);
133 if (geometry_synced.contains(geom)) {
140 if (geom ==
nullptr) {
143 geom = scene->create_light_node<PointLight>();
146 geom = scene->create_light_node<SpotLight>();
149 geom = scene->create_light_node<SunLight>();
152 geom = scene->create_light_node<AreaLight>();
155 geom = scene->create_node<Hair>();
158 geom = scene->create_node<Volume>();
165 geom = scene->create_node<
Mesh>();
167 geometry_map.add(key, geom);
171 sync = geometry_map.update(geom, b_key_id);
181 else if (geom->get_used_shaders() != used_shaders) {
187 bool attribute_recalc =
false;
189 for (Node *
node : geom->get_used_shaders()) {
192 attribute_recalc =
true;
196 if (!attribute_recalc) {
202 geometry_synced.insert(geom);
207 geom->set_used_shaders(used_shaders);
209 auto sync_func = [
this, geom_type, b_ob_info, geom]()
mutable {
210 if (progress.get_cancel()) {
214 progress.set_sync_status(
"Synchronizing object",
BKE_id_name(b_ob_info.real_object->id));
217 Light *light =
static_cast<Light *
>(geom);
218 sync_light(b_ob_info, light);
221 Hair *hair =
static_cast<Hair *
>(geom);
222 sync_hair(b_ob_info, hair);
225 Volume *volume =
static_cast<Volume *
>(geom);
226 sync_volume(b_ob_info, volume);
230 sync_pointcloud(pointcloud, b_ob_info);
233 Mesh *mesh =
static_cast<Mesh *
>(geom);
234 sync_mesh(b_ob_info, mesh);
240 task_pool->
push(sync_func);
249void BlenderSync::sync_geometry_motion(
BObjectInfo &b_ob_info,
251 const float motion_time,
252 bool use_particle_hair,
256 Geometry *geom =
object->get_geometry();
258 if (geometry_motion_synced.contains(geom) || geometry_motion_attribute_synced.contains(geom)) {
262 geometry_motion_synced.insert(geom);
266 if (!geometry_synced.contains(geom)) {
286 geom->set_motion_steps(object->get_motion().size());
290 const int motion_step = geom->
motion_step(motion_time);
291 if (motion_step < 0) {
295 auto sync_func = [
this, b_ob_info, use_particle_hair, motion_step, geom]()
mutable {
296 if (progress.get_cancel()) {
301 Hair *hair =
static_cast<Hair *
>(geom);
302 sync_hair_motion(b_ob_info, hair, motion_step);
305 object_fluid_gas_domain_find(*b_ob_info.
real_object))
311 sync_pointcloud_motion(pointcloud, b_ob_info, motion_step);
314 Mesh *mesh =
static_cast<Mesh *
>(geom);
315 sync_mesh_motion(b_ob_info, mesh, motion_step);
321 task_pool->
push(sync_func);
General operations, lookup, etc. for materials.
static Shader * get_default_shader(const Scene *scene, const blender::Object &b_ob)
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(TaskRunFunction &&task)
void push_back_slow(const T &t)
#define CCL_NAMESPACE_END
#define assert(assertion)
int BKE_object_material_count_eval(const Object *ob)
Material * BKE_object_material_get(Object *ob, short act)
const char * BKE_id_name(const ID &id)
bool use_adaptive_subdivision
blender::Object * iter_object
bool is_real_object_data() const
blender::ID * object_data
blender::Object * real_object