summaryrefslogtreecommitdiff
path: root/tools/collada
diff options
context:
space:
mode:
authorPawel Kowal <pkowal1982@gmail.com>2016-06-05 20:59:21 +0200
committerPawel Kowal <pkowal1982@gmail.com>2016-06-05 20:59:21 +0200
commit494847f0d106968e4f527eec088aeb84ab39b112 (patch)
tree4ae620df7d4871630c6ecabc757a37b827d9c952 /tools/collada
parenta0ac4293c17d08ca985a54247c73aa6cd183fe0f (diff)
Improved Blender/Collada -colonly import creating collision shapes for empties
Diffstat (limited to 'tools/collada')
-rw-r--r--tools/collada/collada.cpp25
-rw-r--r--tools/collada/collada.h2
2 files changed, 26 insertions, 1 deletions
diff --git a/tools/collada/collada.cpp b/tools/collada/collada.cpp
index 8f40ec1469..f0fde20dfc 100644
--- a/tools/collada/collada.cpp
+++ b/tools/collada/collada.cpp
@@ -482,6 +482,24 @@ Transform Collada::_read_transform(XMLParser& parser) {
return _read_transform_from_array(array);
}
+String Collada::_read_empty_draw_type(XMLParser& parser) {
+
+ String empty_draw_type = "";
+
+ if (parser.is_empty())
+ return empty_draw_type;
+
+ while (parser.read()==OK) {
+ if (parser.get_node_type() == XMLParser::NODE_TEXT) {
+ empty_draw_type = parser.get_node_data();
+ }
+ else
+ if (parser.get_node_type() == XMLParser::NODE_ELEMENT_END)
+ break; // end parsing text
+ }
+ return empty_draw_type;
+}
+
Variant Collada::_parse_param(XMLParser& parser) {
if (parser.is_empty())
@@ -1664,6 +1682,8 @@ Collada::Node* Collada::_parse_visual_scene_node(XMLParser& parser) {
Vector<Node::XForm> xform_list;
Vector<Node*> children;
+
+ String empty_draw_type="";
Node *node=NULL;
@@ -1771,7 +1791,9 @@ Collada::Node* Collada::_parse_visual_scene_node(XMLParser& parser) {
xform_list.push_back(xf);
- } else if (section=="technique" || section=="extra") {
+ } else if (section=="empty_draw_type") {
+ empty_draw_type = _read_empty_draw_type(parser);
+ } else if (section == "technique" || section=="extra") {
} else if (section!="node") {
//usually what defines the type of node
@@ -1817,6 +1839,7 @@ Collada::Node* Collada::_parse_visual_scene_node(XMLParser& parser) {
node->name=name;
node->id=id;
+ node->empty_draw_type=empty_draw_type;
if (node->children.size()==1) {
if (node->children[0]->noname && !node->noname) {
diff --git a/tools/collada/collada.h b/tools/collada/collada.h
index 8983b8faf0..01934a1e76 100644
--- a/tools/collada/collada.h
+++ b/tools/collada/collada.h
@@ -403,6 +403,7 @@ public:
String name;
String id;
+ String empty_draw_type;
bool noname;
Vector<XForm> xform_list;
Transform default_transform;
@@ -635,6 +636,7 @@ private: // private stuff
Vector<float> _read_float_array(XMLParser& parser);
Vector<String> _read_string_array(XMLParser& parser);
Transform _read_transform(XMLParser& parser);
+ String _read_empty_draw_type(XMLParser& parser);
void _joint_set_owner(Collada::Node *p_node, NodeSkeleton *p_owner);
void _create_skeletons(Collada::Node **p_node, NodeSkeleton *p_skeleton=NULL);