| 140 | } |
| 141 | |
| 142 | void Group::InitRelMats() { |
| 143 | for (auto& i : children) { |
| 144 | Object* obj = i.direct_ptr; |
| 145 | if (obj && (obj->GetType() == _group || obj->GetType() == _prefab) && !obj->Selected()) { |
| 146 | Group* child_group = (Group*)obj; |
| 147 | child_group->InitRelMats(); |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | // Get child transforms relative to group transform |
| 152 | for (auto& i : children) { |
| 153 | Child& child = i; |
| 154 | Object* obj = i.direct_ptr; |
| 155 | if (obj) { |
| 156 | child.rel_rotation = invert(GetRotation()) * obj->GetRotation(); |
| 157 | child.rel_translation = (invert(GetRotation()) * ((obj->GetTranslation() - translation_)) / scale_); |
| 158 | child.rel_scale = child.rel_rotation * (obj->GetScale() / scale_); |
| 159 | } |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | void Group::InitShape() { |
| 164 | if (children.empty()) { |
no test coverage detected