~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/blender/collada/collada_internal.cpp

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-02-19 11:24:23 UTC
  • mfrom: (14.2.23 sid)
  • Revision ID: package-import@ubuntu.com-20140219112423-rkmaz2m7ha06d4tk
Tags: 2.69-3ubuntu1
* Merge with Debian; remaining changes:
  - Configure without OpenImageIO on armhf, as it is not available on
    Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
/* COLLADABU_ASSERT, may be able to remove later */
29
29
#include "COLLADABUPlatform.h"
30
 
#include "collada_internal.h"
 
30
#include "collada_utils.h"
31
31
 
32
32
#include "BLI_linklist.h"
33
33
 
40
40
        rotate_m4(y_up_mat4, 'X', 0.5 * M_PI);
41
41
 
42
42
        unit_m4(z_up_mat4);
43
 
 
 
43
        unit_m4(scale_mat4);
44
44
}
45
45
 
46
46
void UnitConverter::read_asset(const COLLADAFW::FileInfo *asset)
124
124
        }
125
125
}
126
126
 
 
127
 
 
128
float(&UnitConverter::get_scale())[4][4]
 
129
{
 
130
        return scale_mat4;
 
131
}
 
132
 
 
133
void UnitConverter::calculate_scale(Scene &sce)
 
134
{
 
135
        PointerRNA scene_ptr, unit_settings;
 
136
        PropertyRNA *system_ptr, *scale_ptr;
 
137
        RNA_id_pointer_create(&sce.id, &scene_ptr);
 
138
 
 
139
        unit_settings = RNA_pointer_get(&scene_ptr, "unit_settings");
 
140
        system_ptr    = RNA_struct_find_property(&unit_settings, "system");
 
141
        scale_ptr     = RNA_struct_find_property(&unit_settings, "scale_length");
 
142
 
 
143
        int   type    = RNA_property_enum_get(&unit_settings, system_ptr);
 
144
 
 
145
        float bl_scale;
 
146
 
 
147
        switch (type) {
 
148
                case USER_UNIT_NONE:
 
149
                        bl_scale = 1.0; // map 1 Blender unit to 1 Meter
 
150
                        break;
 
151
 
 
152
                case USER_UNIT_METRIC:
 
153
                        bl_scale = RNA_property_float_get(&unit_settings, scale_ptr);
 
154
                        break;
 
155
 
 
156
                default :
 
157
                        bl_scale = RNA_property_float_get(&unit_settings, scale_ptr);
 
158
                        // it looks like the conversion to Imperial is done implicitly.
 
159
                        // So nothing to do here.
 
160
                        break;
 
161
        }
 
162
 
 
163
        float rescale[3];
 
164
        rescale[0] = rescale[1] = rescale[2] = getLinearMeter() / bl_scale;
 
165
 
 
166
        size_to_mat4(scale_mat4, rescale);
 
167
}
 
168
 
127
169
void TransformBase::decompose(float mat[4][4], float *loc, float eul[3], float quat[4], float *size)
128
170
{
129
171
        mat4_to_size(size, mat);