Baker fixes

This commit is contained in:
Juan Linietsky 2018-10-07 11:18:27 -03:00
parent 5676632a3b
commit e0871b0f52
6 changed files with 29 additions and 21 deletions

View file

@ -321,7 +321,7 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) {
} else {
//mesh since nothing else
node = memnew(MeshInstance);
Object::cast_to<MeshInstance>(node)->set_flag(GeometryInstance::FLAG_USE_BAKED_LIGHT, true);
//Object::cast_to<MeshInstance>(node)->set_flag(GeometryInstance::FLAG_USE_BAKED_LIGHT, true);
}
} break;
case Collada::Node::TYPE_SKELETON: {

View file

@ -365,29 +365,37 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Array
return p_node;
MeshInstance *mi = Object::cast_to<MeshInstance>(p_node);
if (mi) {
Node *col;
Node *col = NULL;
if (_teststr(name, "colonly")) {
col = mi->create_trimesh_collision_node();
ERR_FAIL_COND_V(!col, NULL);
if (col == NULL) {
ERR_PRINTS("Error generating collision for mesh: " + name);
} else {
col->set_name(_fixstr(name, "colonly"));
col->set_name(_fixstr(name, "colonly"));
}
} else {
col = mi->create_convex_collision_node();
ERR_FAIL_COND_V(!col, NULL);
if (col == NULL) {
ERR_PRINTS("Error generating collision for mesh: " + name);
} else {
col->set_name(_fixstr(name, "convcolonly"));
col->set_name(_fixstr(name, "convcolonly"));
}
}
Object::cast_to<Spatial>(col)->set_transform(mi->get_transform());
p_node->replace_by(col);
memdelete(p_node);
p_node = col;
if (col) {
Object::cast_to<Spatial>(col)->set_transform(mi->get_transform());
p_node->replace_by(col);
memdelete(p_node);
p_node = col;
StaticBody *sb = Object::cast_to<StaticBody>(col);
CollisionShape *colshape = Object::cast_to<CollisionShape>(sb->get_child(0));
colshape->set_name("shape");
colshape->set_owner(p_node->get_owner());
StaticBody *sb = Object::cast_to<StaticBody>(col);
CollisionShape *colshape = Object::cast_to<CollisionShape>(sb->get_child(0));
colshape->set_name("shape");
colshape->set_owner(p_node->get_owner());
}
} else if (p_node->has_meta("empty_draw_type")) {
String empty_draw_type = String(p_node->get_meta("empty_draw_type"));
StaticBody *sb = memnew(StaticBody);

View file

@ -116,7 +116,7 @@ class ResourceImporterScene : public ResourceImporter {
enum LightBakeMode {
LIGHT_BAKE_DISABLED,
LIGHT_BAKE_ENABLE,
//LIGHT_BAKE_LIGHTMAPS
LIGHT_BAKE_LIGHTMAPS
};
void _replace_owner(Node *p_node, Node *p_scene, Node *p_new_owner);