1717// //////////////////////////////////////////////////////////////////
1818
1919#include " fltToEggLevelState.h"
20+ #include " fltToEggConverter.h"
2021#include " fltTransformTranslate.h"
2122#include " fltTransformRotateAboutPoint.h"
2223#include " fltTransformRotateAboutEdge.h"
@@ -134,7 +135,7 @@ get_synthetic_group(const string &name,
134135
135136// //////////////////////////////////////////////////////////////////
136137// Function: FltToEggLevelState::set_transform
137- // Access: Public, Static
138+ // Access: Public
138139// Description: Sets up the group to reflect the transform indicated
139140// by the given record, if any.
140141// //////////////////////////////////////////////////////////////////
@@ -144,7 +145,7 @@ set_transform(const FltBead *flt_bead, EggGroup *egg_group) {
144145 egg_group->set_group_type (EggGroup::GT_instance);
145146
146147 int num_steps = flt_bead->get_num_transform_steps ();
147- bool componentwise_ok = true ;
148+ bool componentwise_ok = !_converter-> _compose_transforms ;
148149
149150 if (num_steps == 0 ) {
150151 componentwise_ok = false ;
@@ -154,8 +155,7 @@ set_transform(const FltBead *flt_bead, EggGroup *egg_group) {
154155 // don't know how to interpret, just store the whole transform
155156 // matrix in the egg file.
156157 egg_group->clear_transform ();
157-
158- for (int i = 0 ; i < num_steps && componentwise_ok; i++) {
158+ for (int i = num_steps -1 ; i >= 0 && componentwise_ok; i--) {
159159 const FltTransformRecord *step = flt_bead->get_transform_step (i);
160160 if (step->is_exact_type (FltTransformTranslate::get_class_type ())) {
161161 const FltTransformTranslate *trans;
@@ -166,7 +166,7 @@ set_transform(const FltBead *flt_bead, EggGroup *egg_group) {
166166
167167 } else if (step->is_exact_type (FltTransformRotateAboutPoint::get_class_type ())) {
168168 const FltTransformRotateAboutPoint *rap;
169- DCAST_INTO_V (rap, step);
169+ DCAST_INTO_V (rap, step);
170170 if (!IS_NEARLY_ZERO (rap->get_angle ())) {
171171 if (!rap->get_center ().almost_equal (LVector3d::zero ())) {
172172 egg_group->add_translate (-rap->get_center ());
0 commit comments