[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58525] branches/soc-2013-cycles_mblur/ intern/cycles: More work toward getting deformation export working.
Gavin Howard
gavin.d.howard at gmail.com
Tue Jul 23 06:52:58 CEST 2013
Revision: 58525
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58525
Author: gdh
Date: 2013-07-23 04:52:57 +0000 (Tue, 23 Jul 2013)
Log Message:
-----------
More work toward getting deformation export working.
This is a pretty large commit, but it is not complete yet. My problem is
that I need one of Cycles' cameras because it has the shuttertime, and I
have to take that into account when creating the list of export times
for each object. The problem is that the camera is synced after all of
the data, which means that objects are already synced by the time the
camera is updated.
Question: can this be changed?
Modified Paths:
--------------
branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_object.cpp
branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_sync.h
branches/soc-2013-cycles_mblur/intern/cycles/render/object.h
Modified: branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_object.cpp
===================================================================
--- branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_object.cpp 2013-07-23 00:56:38 UTC (rev 58524)
+++ branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_object.cpp 2013-07-23 04:52:57 UTC (rev 58525)
@@ -262,14 +262,16 @@
/* Object */
-Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_ob, Transform& tfm, uint layer_flag, float export_time, bool hide_tris)
+Object *BlenderSync::sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE],
+ BL::DupliObject b_dupli_ob, Transform& tfm, uint layer_flag,
+ std::set<float> *object_export, float export_time, bool hide_tris)
{
BL::Object b_ob = (b_dupli_ob ? b_dupli_ob.object() : b_parent);
/* light is handled separately */
if(object_is_light(b_ob)) {
/* don't use lamps for excluded layers used as mask layer */
- if(!export_time && !((layer_flag & render_layer.holdout_layer) && (layer_flag & render_layer.exclude_layer)))
+ if(export_time == 0.0f && !((layer_flag & render_layer.holdout_layer) && (layer_flag & render_layer.exclude_layer)))
sync_light(b_parent, persistent_id, b_ob, tfm);
return NULL;
@@ -309,23 +311,37 @@
if(object_map.sync(&object, b_ob, b_parent, key))
object_updated = true;
- /* Get whether motion is enabled, the number of export steps,
- * and whether the object will use deform blur. */
+ /* Get whether motion is enabled, and whether
+ * the object will use deform blur. */
bool use_mblur = object_use_mblur(b_ob);
bool use_deform_mblur = object_use_deform_mblur(b_ob);
- uint mblur_steps = object_mblur_steps(b_ob);
/* Force update if necessary. */
if (use_mblur != object->use_motion ||
- mblur_steps != object->mblur_steps ||
use_deform_mblur != object->use_deform_mblur)
{
object->use_motion = use_mblur;
object->use_deform_mblur = use_deform_mblur;
+ scene->object_manager->tag_update(scene);
+ object_updated = true;
+ }
+
+ /* Get the number of motion blur steps. */
+ uint mblur_steps = object_mblur_steps(b_ob);
+
+ /* Force update if necessary. */
+ if (mblur_steps != object->mblur_steps)
+ {
object->mblur_steps = mblur_steps;
object->mesh->mblur_steps = mblur_steps;
scene->object_manager->tag_update(scene);
object_updated = true;
+
+ /* Get the new export times. */
+
+
+ /* Add the new export times to the object. */
+ object->export_times = object_export;
}
bool use_holdout = (layer_flag & render_layer.holdout_layer) != 0;
@@ -453,7 +469,7 @@
/* layer data */
uint scene_layer = render_layer.scene_layer;
- if(!export_time) {
+ if(export_time == 0.0f) {
/* prepare for sync */
light_map.pre_sync();
mesh_map.pre_sync();
@@ -470,6 +486,9 @@
int particle_id = 1;
bool cancel = false;
+
+ /* Create a set to hold each object's export times. */
+ std::set<float> object_export;
for(; b_sce && !cancel; b_sce = b_sce.background_set()) {
for(b_sce.objects.begin(b_ob); b_ob != b_sce.objects.end() && !cancel; ++b_ob) {
@@ -499,11 +518,17 @@
BL::Array<int, OBJECT_PERSISTENT_ID_SIZE> persistent_id = b_dup->persistent_id();
/* sync object and mesh or light data */
- Object *object = sync_object(*b_ob, persistent_id.data, *b_dup, tfm, ob_layer, export_time, hide_tris);
+ Object *object = sync_object(*b_ob, persistent_id.data, *b_dup, tfm,
+ ob_layer, &object_export, export_time, hide_tris);
+
+ /* Add this object's export times to the set. */
+ for (int i = 0; i < object_export.size(); ++i) {
+ export_times->insert(object_export[i]);
+ }
/* sync possible particle data, note particle_id
* starts counting at 1, first is dummy particle */
- if(!export_time && object && sync_dupli_particle(*b_ob, *b_dup, object)) {
+ if(export_time == 0.0f && object && sync_dupli_particle(*b_ob, *b_dup, object)) {
if(particle_id != object->particle_id) {
object->particle_id = particle_id;
scene->object_manager->tag_update(scene);
@@ -524,11 +549,19 @@
if(!object_render_hide(*b_ob, true, true, hide_tris)) {
/* object itself */
Transform tfm = get_transform(b_ob->matrix_world());
- sync_object(*b_ob, NULL, PointerRNA_NULL, tfm, ob_layer, export_time, hide_tris);
+ sync_object(*b_ob, NULL, PointerRNA_NULL, tfm, ob_layer, &object_export, export_time, hide_tris);
+
+ /* Add this object's export times to the set. */
+ for (int i = 0; i < object_export.size(); ++i) {
+ export_times->insert(object_export[i]);
+ }
}
}
cancel = progress.get_cancel();
+
+ /* clear the object set */
+ object_export.clear();
}
}
Modified: branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_sync.h
===================================================================
--- branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_sync.h 2013-07-23 00:56:38 UTC (rev 58524)
+++ branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_sync.h 2013-07-23 04:52:57 UTC (rev 58525)
@@ -84,7 +84,9 @@
void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree);
Mesh *sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tris);
void sync_curves(Mesh *mesh, BL::Mesh b_mesh, BL::Object b_ob, bool object_updated);
- Object *sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::DupliObject b_dupli_object, Transform& tfm, uint layer_flag, float export_time, bool hide_tris);
+ Object *sync_object(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE],
+ BL::DupliObject b_dupli_object, Transform& tfm, uint layer_flag,
+ std::set<float> *object_export, float export_time, bool hide_tris);
void sync_light(BL::Object b_parent, int persistent_id[OBJECT_PERSISTENT_ID_SIZE], BL::Object b_ob, Transform& tfm);
void sync_background_light();
void sync_mesh_motion(BL::Object b_ob, Mesh *mesh, int motion);
Modified: branches/soc-2013-cycles_mblur/intern/cycles/render/object.h
===================================================================
--- branches/soc-2013-cycles_mblur/intern/cycles/render/object.h 2013-07-23 00:56:38 UTC (rev 58524)
+++ branches/soc-2013-cycles_mblur/intern/cycles/render/object.h 2013-07-23 04:52:57 UTC (rev 58525)
@@ -61,7 +61,7 @@
* This one is only used during syncing.
* It should be set to NULL right afterward.
*/
- std::set<float> *export_times;
+ std::set<float> export_times;
Object();
~Object();
More information about the Bf-blender-cvs
mailing list