[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58647] branches/soc-2013-cycles_mblur/ intern/cycles: This commit is a big step toward full export.
Gavin Howard
gavin.d.howard at gmail.com
Sat Jul 27 06:30:17 CEST 2013
Revision: 58647
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58647
Author: gdh
Date: 2013-07-27 04:30:15 +0000 (Sat, 27 Jul 2013)
Log Message:
-----------
This commit is a big step toward full export.
There are a lot of changes in this commit. First of all, I got rid of
code that I wrote but isn't needed. Second, I (more or less) finished
sync_motion(). Third, I (more or less) finished sync_mesh_motion().
WARNING: This commit causes an infinite loop in starting viewport render
IN GPU MODE ONLY! I can't figure out what the problem is. Stuart and
Brecht, do you have any ideas?
Modified Paths:
--------------
branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_mesh.cpp
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/attribute.cpp
branches/soc-2013-cycles_mblur/intern/cycles/render/attribute.h
Modified: branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_mesh.cpp
===================================================================
--- branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_mesh.cpp 2013-07-27 03:12:03 UTC (rev 58646)
+++ branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_mesh.cpp 2013-07-27 04:30:15 UTC (rev 58647)
@@ -555,17 +555,12 @@
if(b_mesh) {
BL::Mesh::vertices_iterator v;
AttributeStandard std = ATTR_STD_DMOTION;
- Attribute *attr_M = mesh->attributes.add(std);
- float3 *M = attr_M->data_float3(), *cur_M;
+ Attribute *attr_M = mesh->attributes.find(std);
size_t i = 0;
- for(b_mesh.vertices.begin(v), cur_M = M; v != b_mesh.vertices.end() && i < size; ++v, cur_M++, i++)
- *cur_M = get_float3(v->co());
+ for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end() && i < size; ++v, i++)
+ attr_M->add(get_float3(v->co()));
- /* if number of vertices changed, or if coordinates stayed the same, drop it */
- if(i != size || memcmp(M, &mesh->verts[0], sizeof(float3)*size) == 0)
- mesh->attributes.remove(std);
-
/* free derived mesh */
b_data.meshes.remove(b_mesh);
}
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-27 03:12:03 UTC (rev 58646)
+++ branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_object.cpp 2013-07-27 04:30:15 UTC (rev 58647)
@@ -263,14 +263,14 @@
/* 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)
+ Transform& tfm, uint layer_flag, float export_time, bool motion, 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 == 0.0f && !((layer_flag & render_layer.holdout_layer) && (layer_flag & render_layer.exclude_layer)))
+ if(!motion && !((layer_flag & render_layer.holdout_layer) && (layer_flag & render_layer.exclude_layer)))
sync_light(b_parent, persistent_id, b_ob, tfm);
return NULL;
@@ -285,12 +285,12 @@
Object *object;
/* motion vector case */
- if(export_time != 0.0f) {
+ if(motion) {
object = object_map.find(key);
if(object) {
if(tfm != object->tfm) {
- if(export_time < 0.0f)
+ if(export_time < b_scene.frame_current())
object->motion.pre = tfm;
else
object->motion.post = tfm;
@@ -491,12 +491,12 @@
/* Object Loop */
-void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, std::set<float> *export_times, float export_time)
+void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, std::set<float> *export_times, float export_time, bool motion)
{
/* layer data */
uint scene_layer = render_layer.scene_layer;
- if(export_time == 0.0f) {
+ if(!motion) {
/* prepare for sync */
light_map.pre_sync();
mesh_map.pre_sync();
@@ -543,10 +543,10 @@
/* 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);
+ ob_layer, export_time, motion, hide_tris);
/* Make sure the object exists (I was getting null objects). */
- if (object) {
+ if (object && !motion) {
/* Add this object's export times to the set. */
std::set<float>::iterator time;
@@ -557,7 +557,7 @@
/* sync possible particle data, note particle_id
* starts counting at 1, first is dummy particle */
- if(export_time == 0.0f && object && sync_dupli_particle(*b_ob, *b_dup, object)) {
+ if(!motion && 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);
@@ -578,10 +578,11 @@
if(!object_render_hide(*b_ob, true, true, hide_tris)) {
/* object itself */
Transform tfm = get_transform(b_ob->matrix_world());
- Object *object = sync_object(*b_ob, NULL, PointerRNA_NULL, tfm, ob_layer, export_time, hide_tris);
+ Object *object = sync_object(*b_ob, NULL, PointerRNA_NULL, tfm,
+ ob_layer, export_time, motion, hide_tris);
/* Make sure the object exists (I was getting null objects). */
- if (object) {
+ if (object && !motion) {
/* Add this object's export times to the set. */
std::set<float>::iterator time;
@@ -637,24 +638,16 @@
sync_camera_motion(b_cam, 1);
}
- BL::Scene b_sce = b_scene;
- BL::Scene::objects_iterator b_ob;
set<float>::iterator i;
- bool cancel = false;
int frame;
float subframe;
for(i = export_times->begin(); i != export_times->end(); i++) {
-
+
/*Get the frame and subframe. */
frame = static_cast<int>(*i);
subframe = *i - frame;
- 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) {
-
-
- cancel = progress.get_cancel();
- }
- }
+ b_scene.frame_set(frame, subframe);
+ sync_objects(b_v3d, NULL, *i, true);
}
// for(int motion = -1; motion <= 1; motion += 2) {
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-27 03:12:03 UTC (rev 58646)
+++ branches/soc-2013-cycles_mblur/intern/cycles/blender/blender_sync.h 2013-07-27 04:30:15 UTC (rev 58647)
@@ -73,7 +73,7 @@
/* sync */
void sync_lamps(bool update_all);
void sync_materials(bool update_all);
- void sync_objects(BL::SpaceView3D b_v3d, std::set<float> *export_times, float export_time = 0.0f);
+ void sync_objects(BL::SpaceView3D b_v3d, std::set<float> *export_times, float export_time = 0.0f, bool motion = false);
void sync_motion(BL::SpaceView3D b_v3d, BL::Object b_override, std::set<float> *export_times);
void sync_film();
void sync_view();
@@ -85,7 +85,7 @@
Mesh *sync_mesh(BL::Object b_ob, bool object_updated, bool hide_tris, uint mblur_steps);
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_ob,
- Transform& tfm, uint layer_flag, float export_time, bool hide_tris);
+ Transform& tfm, uint layer_flag, float export_time, bool motion, 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);
Modified: branches/soc-2013-cycles_mblur/intern/cycles/render/attribute.cpp
===================================================================
--- branches/soc-2013-cycles_mblur/intern/cycles/render/attribute.cpp 2013-07-27 03:12:03 UTC (rev 58646)
+++ branches/soc-2013-cycles_mblur/intern/cycles/render/attribute.cpp 2013-07-27 04:30:15 UTC (rev 58647)
@@ -62,15 +62,6 @@
buffer.push_back(data[i]);
}
-void Attribute::add(const float3& f, uint numverts)
-{
- char *data = (char*)&f;
- size_t size = sizeof(f) * numverts;
-
- for (size_t i = 0; i < size; i++)
- buffer.push_back(data[i]);
-}
-
size_t Attribute::data_sizeof() const
{
if(type == TypeDesc::TypeFloat)
Modified: branches/soc-2013-cycles_mblur/intern/cycles/render/attribute.h
===================================================================
--- branches/soc-2013-cycles_mblur/intern/cycles/render/attribute.h 2013-07-27 03:12:03 UTC (rev 58646)
+++ branches/soc-2013-cycles_mblur/intern/cycles/render/attribute.h 2013-07-27 04:30:15 UTC (rev 58647)
@@ -66,7 +66,6 @@
void add(const float& f);
void add(const float3& f);
- void add(const float3& f, uint numverts);
static bool same_storage(TypeDesc a, TypeDesc b);
static const char *standard_name(AttributeStandard std);
More information about the Bf-blender-cvs
mailing list