void EditorSceneImporterFBXConv::_detect_bones_in_nodes(State& state,const Array& p_nodes) {


	for(int i=0;i<p_nodes.size();i++) {

		Dictionary d = p_nodes[i];
		if (d.has("isBone") && bool(d["isBone"])) {

			String bone_name=_id(d["id"]);
			print_line("IS BONE: "+bone_name);
			if (!state.bones.has(bone_name)) {
				state.bones.insert(bone_name,BoneInfo());
			}

			if (!state.bones[bone_name].has_rest) {
				state.bones[bone_name].rest=_get_transform(d).affine_inverse();
			}

			state.bones[bone_name].node=d;

			//state.bones[name].rest=_get_transform(b);
		}

		if (d.has("parts")) {

			Array parts=d["parts"];
			for(int j=0;j<parts.size();j++) {

				Dictionary p=parts[j];
				if (p.has("bones")) {
					Array bones=p["bones"];
					//omfg
					for(int k=0;k<bones.size();k++) {

						Dictionary b = bones[k];
						if (b.has("node")) {

							String name = _id(b["node"]);
							if (!state.bones.has(name)) {
								state.bones.insert(name,BoneInfo());
							}

							state.bones[name].rest=_get_transform(b);
							state.bones[name].has_rest=true;
						}
					}
				}

			}
		}

		if (d.has("children")) {

			_detect_bones_in_nodes(state,d["children"]);
		}
	}

}
Esempio n. 2
0
	CacheListener(WorkSpace *ws, Problem& prob, int set, Identifier<typename P::Domain *>& id)
	: _prob(prob), _set(set), _id(id) {
		const CFGCollection *col = INVOLVED_CFGS(ws);
		for(int i = 0; i < col->count();  i++)
			for (CFG::BBIterator bb(col->get(i)); bb; bb++)
				prob.init(_id(bb)[_set], prob.bottom());
	}
Esempio n. 3
0
/*
 * spec_archive() - Archive a spec onto the given XDR stream.
 */
bool_t
spec_archive( char *id, char *path, int verbosity, XDR *xdrs, Tt_status *err )
{
	_Tt_string	_path( path );
	_Tt_string	_id( id );

	*err = TT_OK;
	if (xdrs->x_op == XDR_ENCODE) {
		Lstar_spec spec( _id, _path );

		*err = spec.read_self();
		if (IS_TT_ERR(*err)) {
			return FALSE;
		}
		if (! spec.xdr(xdrs)) {
			return FALSE;
		}
		if (verbosity > 1) {
			spec.print( stderr );
		}
	} else {
		return FALSE;
	}
	return TRUE;

} /* spec_archive() */
void EditorSceneImporterFBXConv::_parse_skeletons(const String& p_name,State& state, const Array &p_nodes, Skeleton *p_skeleton,int p_parent) {



	for(int i=0;i<p_nodes.size();i++) {


		Dictionary d = p_nodes[i];
		int bone_idx=-1;
		String id;
		Skeleton* skeleton=p_skeleton;
		if (d.has("id")) {

			id=_id(d["id"]);
			if (state.bones.has(id)) {
				//BONER
				if (!skeleton) {
					skeleton=memnew( Skeleton );
					state.skeletons[id]=skeleton;
				}
				bone_idx = skeleton->get_bone_count();
				skeleton->add_bone(id);
				skeleton->set_bone_parent(bone_idx,p_parent);
				skeleton->set_bone_rest(bone_idx,state.bones[id].rest);
				state.bones[id].skeleton=skeleton;
			}
		}

		if (d.has("children")) {

			_parse_skeletons(id,state,d["children"],skeleton,bone_idx);
		}
	}

}
Esempio n. 5
0
void
Test::runGetQartersTM(O_Stock& stock){
    LOG_INFO << "\n --- Testing retreval of latest quarters in test mode for " << stock._ticker()
             << "  ---\n";

    // Ensure we switched to test DB
    bool rok(false);
    rok = db_setup();
    if(!rok)
    {
        LOG_ERROR << "Something wrong with TEST(probably with TEST DB setup)."
                  << "EXITING";
        cout << "An error uccored. exiting";
        exit(-1);
    }
    //bool repFail(true);
    TestResults testRes;
    string testName(stock._ticker() + ": ");
    testRes.setTestName(testName);

    EdgarData edgar;
    edgar.updateFinancials(stock);


    // delete added quarters from test DB

    T_Ep te;
    vector<DMMM::O_Ep> eps_copy = stock._eps();
    for(auto it = eps_copy.begin(); it != eps_copy.end();++it)
        if (it->_quarter() < 5)
            te.erase( te._id() ==  it->_id() );

}
Esempio n. 6
0
    QString List::generateId() const {
      QString _id("0");

      for (size_t i = 0; i <= numberOfChildren(); ++i) {
        _id = QString("%1").arg(i);

        if (getInput(_id) == nullptr)
        {
          return _id;
        }
      }
      return _id;
    }
Esempio n. 7
0
int show_menu(long *font)
{
	char ch;
	int k=1;
	show_font(*font);
	puts("f)change font s)change size a)change alignment");
	puts("b)toggle bold i)toggle italic u)toggle underline");
	puts("q)quit");

	ch=getchar();

	switch(ch)
	{
		case 'f':_id(font);break;
		case 's':_size(font);break;
		case 'a':_alignment(font);break;
		case 'b':_bold(font);break;
		case 'i':_italic(font);break;
		case 'u':_underline(font);break;
		case 'q':k=0;
	}
	eatline();
	return k;
}
Esempio n. 8
0
 std::vector<O_Issue> 
 _issue_id(const T_Issue::Condition& c) const
 {
     T_Issue table(c);
     return table.select(table._issue_id() == _id());   
 }
Esempio n. 9
0
 std::vector<O_Issue> _issues() const
 {
     T_Issue table;
     return table.select(table._issue_id() == _id());   
 }
Esempio n. 10
0
 std::vector<O_Page> 
 _page_class_id(const T_Page::Condition& c) const
 {
     T_Page table(c);
     return table.select(table._page_class_id() == _id());   
 }
Esempio n. 11
0
 std::vector<O_Page> _pages() const
 {
     T_Page table;
     return table.select(table._page_class_id() == _id());   
 }
Error EditorSceneImporterFBXConv::_parse_animations(State& state) {

	AnimationPlayer *ap = memnew( AnimationPlayer );

	state.scene->add_child(ap);
	ap->set_owner(state.scene);

	for(int i=0;i<state.animations.size();i++) {

		Dictionary anim = state.animations[i];
		ERR_CONTINUE(!anim.has("id"));
		Ref<Animation> an = memnew( Animation );
		an->set_name(_id(anim["id"]));


		if (anim.has("bones")) {

			Array bone_tracks = anim["bones"];
			for(int j=0;j<bone_tracks.size();j++) {
				Dictionary bone_track=bone_tracks[j];
				String bone = bone_track["boneId"];
				if (!bone_track.has("keyframes"))
					continue;
				if (!state.bones.has(bone))
					continue;

				Skeleton *sk = state.bones[bone].skeleton;

				if (!sk)
					continue;
				int bone_idx=sk->find_bone(bone);
				if (bone_idx==-1)
					continue;



				String path = state.scene->get_path_to(sk);
				path+=":"+bone;
				an->add_track(Animation::TYPE_TRANSFORM);
				int tidx = an->get_track_count()-1;
				an->track_set_path(tidx,path);


				Dictionary parent_xform_dict;
				Dictionary xform_dict;

				if (state.bones.has(bone)) {
					xform_dict=state.bones[bone].node;
				}


				Array parent_keyframes;
				if (sk->get_bone_parent(bone_idx)!=-1) {
					String parent_name = sk->get_bone_name(sk->get_bone_parent(bone_idx));
					if (state.bones.has(parent_name)) {
						parent_xform_dict=state.bones[parent_name].node;
					}

					print_line("parent for "+bone+"? "+parent_name+" XFD: "+String(Variant(parent_xform_dict)));
					for(int k=0;k<bone_tracks.size();k++) {
						Dictionary d = bone_tracks[k];
						if (d["boneId"]==parent_name) {
							parent_keyframes=d["keyframes"];
							print_line("found keyframes");
							break;
						}
					}


				}

				print_line("BONE XFD "+String(Variant(xform_dict)));

				Array keyframes=bone_track["keyframes"];

				for(int k=0;k<keyframes.size();k++) {

					Dictionary key=keyframes[k];
					Transform xform=_get_transform_mixed(key,xform_dict);
					float time = key["keytime"];
					time=time/1000.0;
#if 0
					if (parent_keyframes.size()) {
						//localize
						print_line(itos(k)+" localizate for: "+bone);

						float prev_kt=-1;
						float kt;
						int idx=0;

						for(int l=0;l<parent_keyframes.size();l++) {

							Dictionary d=parent_keyframes[l];
							kt=d["keytime"];
							kt=kt/1000.0;
							if (kt>time)
								break;
							prev_kt=kt;
							idx++;

						}

						Transform t;
						if (idx==0) {
							t=_get_transform_mixed(parent_keyframes[0],parent_xform_dict);
						} else if (idx==parent_keyframes.size()){
							t=_get_transform_mixed(parent_keyframes[idx-1],parent_xform_dict);
						} else {
							t=_get_transform_mixed(parent_keyframes[idx-1],parent_xform_dict);
							float d = (time-prev_kt)/(kt-prev_kt);
							if (d>0) {
								Transform t2=_get_transform_mixed(parent_keyframes[idx],parent_xform_dict);
								t=t.interpolate_with(t2,d);
							} else {
								print_line("exact: "+rtos(kt));
							}
						}

						xform = t.affine_inverse() * xform; //localize
					} else if (!parent_xform_dict.empty()) {
						Transform t = _get_transform(parent_xform_dict);
						xform = t.affine_inverse() * xform; //localize
					}
#endif

					xform = sk->get_bone_rest(bone_idx).affine_inverse() * xform;


					Quat q = xform.basis;
					q.normalize();
					Vector3 s = xform.basis.get_scale();
					Vector3 l = xform.origin;



					an->transform_track_insert_key(tidx,time,l,q,s);

				}

			}


		}


		ap->add_animation(_id(anim["id"]),an);

	}

	return OK;
}
void EditorSceneImporterFBXConv::_parse_surfaces(State& state) {

	for(int i=0;i<state.meshes.size();i++)	 {

		Dictionary mesh = state.meshes[i];

		ERR_CONTINUE(!mesh.has("attributes"));
		ERR_CONTINUE(!mesh.has("vertices"));
		ERR_CONTINUE(!mesh.has("parts"));

		print_line("MESH #"+itos(i));

		Array attrlist=mesh["attributes"];
		Array vertices=mesh["vertices"];
		bool exists[Mesh::ARRAY_MAX];
		int ofs[Mesh::ARRAY_MAX];
		int weight_max=0;
		int binormal_ofs=-1;
		int weight_ofs[4];

		for(int j=0;j<Mesh::ARRAY_MAX;j++) {
			exists[j]=false;
			ofs[j]=0;
		}
		exists[Mesh::ARRAY_INDEX]=true;
		float stride=0;

		for(int j=0;j<attrlist.size();j++) {

			String attr=attrlist[j];
			if (attr=="POSITION") {
				exists[Mesh::ARRAY_VERTEX]=true;
				ofs[Mesh::ARRAY_VERTEX]=stride;
				stride+=3;
			} else if (attr=="NORMAL") {
				exists[Mesh::ARRAY_NORMAL]=true;
				ofs[Mesh::ARRAY_NORMAL]=stride;
				stride+=3;
			} else if (attr=="COLOR") {
				exists[Mesh::ARRAY_COLOR]=true;
				ofs[Mesh::ARRAY_COLOR]=stride;
				stride+=4;
			} else if (attr==TTR("COLORPACKED")) {
				stride+=1; //ignore
			} else if (attr==TTR("TANGENT")) {
				exists[Mesh::ARRAY_TANGENT]=true;
				ofs[Mesh::ARRAY_TANGENT]=stride;
				stride+=3;
			} else if (attr==TTR("BINORMAL")) {
				binormal_ofs=stride;
				stride+=3;
			} else if (attr=="TEXCOORD0") {
				exists[Mesh::ARRAY_TEX_UV]=true;
				ofs[Mesh::ARRAY_TEX_UV]=stride;
				stride+=2;
			} else if (attr=="TEXCOORD1") {
				exists[Mesh::ARRAY_TEX_UV2]=true;
				ofs[Mesh::ARRAY_TEX_UV2]=stride;
				stride+=2;
			} else if (attr.begins_with(TTR("TEXCOORD"))) {
				stride+=2;
			} else if (attr.begins_with(TTR("BLENDWEIGHT"))) {
				int idx=attr.replace(TTR("BLENDWEIGHT"),"").to_int();
				if (idx==0) {
					exists[Mesh::ARRAY_BONES]=true;
					ofs[Mesh::ARRAY_BONES]=stride;
					exists[Mesh::ARRAY_WEIGHTS]=true;
					ofs[Mesh::ARRAY_WEIGHTS]=stride+1;
				} if (idx<4) {
					weight_ofs[idx]=stride;
					weight_max=MAX(weight_max,idx+1);
				}

				stride+=2;
			}

			print_line("ATTR "+attr+" OFS: "+itos(stride));

		}

		Array parts=mesh["parts"];

		for(int j=0;j<parts.size();j++) {



			Dictionary part=parts[j];
			ERR_CONTINUE(!part.has("indices"));
			ERR_CONTINUE(!part.has("id"));

			print_line("PART: "+String(part["id"]));
			Array indices=part["indices"];
			Map<int,int> iarray;
			Map<int,int> array;

			for(int k=0;k<indices.size();k++) {

				int idx = indices[k];
				if (!iarray.has(idx)) {
					int map_to=array.size();
					iarray[idx]=map_to;
					array[map_to]=idx;
				}
			}

			print_line("indices total "+itos(indices.size())+" vertices used: "+itos(array.size()));

			Array arrays;
			arrays.resize(Mesh::ARRAY_MAX);



			for(int k=0;k<Mesh::ARRAY_MAX;k++) {


				if (!exists[k])
					continue;
				print_line("exists: "+itos(k));
				int lofs = ofs[k];
				switch(k) {

					case Mesh::ARRAY_VERTEX:
					case Mesh::ARRAY_NORMAL: {

						DVector<Vector3> vtx;
						vtx.resize(array.size());
						{
							int len=array.size();
							DVector<Vector3>::Write w = vtx.write();
							for(int l=0;l<len;l++) {

								int pos = array[l];
								w[l].x=vertices[pos*stride+lofs+0];
								w[l].y=vertices[pos*stride+lofs+1];
								w[l].z=vertices[pos*stride+lofs+2];
							}
						}
						arrays[k]=vtx;

					} break;
					case Mesh::ARRAY_TANGENT: {

						if (binormal_ofs<0)
							break;

						DVector<float> tangents;
						tangents.resize(array.size()*4);
						{
							int len=array.size();

							DVector<float>::Write w = tangents.write();
							for(int l=0;l<len;l++) {

								int pos = array[l];
								Vector3 n;
								n.x=vertices[pos*stride+ofs[Mesh::ARRAY_NORMAL]+0];
								n.y=vertices[pos*stride+ofs[Mesh::ARRAY_NORMAL]+1];
								n.z=vertices[pos*stride+ofs[Mesh::ARRAY_NORMAL]+2];
								Vector3 t;
								t.x=vertices[pos*stride+lofs+0];
								t.y=vertices[pos*stride+lofs+1];
								t.z=vertices[pos*stride+lofs+2];
								Vector3 bi;
								bi.x=vertices[pos*stride+binormal_ofs+0];
								bi.y=vertices[pos*stride+binormal_ofs+1];
								bi.z=vertices[pos*stride+binormal_ofs+2];
								float d = bi.dot(n.cross(t));

								w[l*4+0]=t.x;
								w[l*4+1]=t.y;
								w[l*4+2]=t.z;
								w[l*4+3]=d;

							}
						}
						arrays[k]=tangents;

					} break;
					case Mesh::ARRAY_COLOR: {

						DVector<Color> cols;
						cols.resize(array.size());
						{
							int len=array.size();
							DVector<Color>::Write w = cols.write();
							for(int l=0;l<len;l++) {

								int pos = array[l];
								w[l].r=vertices[pos*stride+lofs+0];
								w[l].g=vertices[pos*stride+lofs+1];
								w[l].b=vertices[pos*stride+lofs+2];
								w[l].a=vertices[pos*stride+lofs+3];
							}
						}
						arrays[k]=cols;

					} break;
					case Mesh::ARRAY_TEX_UV:
					case Mesh::ARRAY_TEX_UV2: {

						DVector<Vector2> uvs;
						uvs.resize(array.size());
						{
							int len=array.size();
							DVector<Vector2>::Write w = uvs.write();
							for(int l=0;l<len;l++) {

								int pos = array[l];
								w[l].x=vertices[pos*stride+lofs+0];
								w[l].y=vertices[pos*stride+lofs+1];
								w[l].y=1.0-w[l].y;
							}
						}
						arrays[k]=uvs;

					} break;
					case Mesh::ARRAY_BONES:
					case Mesh::ARRAY_WEIGHTS: {

						DVector<float> arr;
						arr.resize(array.size()*4);
						int po=k==Mesh::ARRAY_WEIGHTS?1:0;
						lofs=ofs[Mesh::ARRAY_BONES];
						{
							int len=array.size();

							DVector<float>::Write w = arr.write();
							for(int l=0;l<len;l++) {

								int pos = array[l];

								for(int m=0;m<4;m++) {

									float val=0;
									if (m<=weight_max)
										val=vertices[pos*stride+lofs+m*2+po];
									w[l*4+m]=val;
								}
							}
						}

						arrays[k]=arr;
					} break;
					case Mesh::ARRAY_INDEX: {

						DVector<int> arr;
						arr.resize(indices.size());
						{
							int len=indices.size();

							DVector<int>::Write w = arr.write();
							for(int l=0;l<len;l++) {

								w[l]=iarray[ indices[l] ];
							}
						}

						arrays[k]=arr;

					} break;


				}


			}

			Mesh::PrimitiveType pt=Mesh::PRIMITIVE_TRIANGLES;

			if (part.has("type")) {
				String type=part["type"];
				if (type==TTR("LINES"))
					pt=Mesh::PRIMITIVE_LINES;
				else if (type==TTR("POINTS"))
					pt=Mesh::PRIMITIVE_POINTS;
				else if (type==TTR("TRIANGLE_STRIP"))
					pt=Mesh::PRIMITIVE_TRIANGLE_STRIP;
				else if (type==TTR("LINE_STRIP"))
					pt=Mesh::PRIMITIVE_LINE_STRIP;
			}

			if (pt==Mesh::PRIMITIVE_TRIANGLES) {
				DVector<int> ia=arrays[Mesh::ARRAY_INDEX];
				int len=ia.size();
				{
					DVector<int>::Write w=ia.write();
					for(int l=0;l<len;l+=3) {
						SWAP(w[l+1],w[l+2]);
					}
				}
				arrays[Mesh::ARRAY_INDEX]=ia;


			}
			SurfaceInfo si;
			si.array=arrays;
			si.primitive=pt;
			state.surface_cache[_id(part["id"])]=si;

		}
	}
}
void EditorSceneImporterFBXConv::_parse_materials(State& state) {

	for(int i=0;i<state.materials.size();i++)	 {

		Dictionary material = state.materials[i];

		ERR_CONTINUE(!material.has("id"));
		String id = _id(material["id"]);

		Ref<FixedMaterial> mat = memnew( FixedMaterial );

		if (material.has("diffuse")) {
			mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,_get_color(material["diffuse"]));
		}

		if (material.has("specular")) {
			mat->set_parameter(FixedMaterial::PARAM_SPECULAR,_get_color(material["specular"]));
		}

		if (material.has("emissive")) {
			mat->set_parameter(FixedMaterial::PARAM_EMISSION,_get_color(material["emissive"]));
		}

		if (material.has("shininess")) {
			float exp = material["shininess"];
			mat->set_parameter(FixedMaterial::PARAM_SPECULAR_EXP,exp);
		}

		if (material.has("opacity")) {
			Color c = mat->get_parameter(FixedMaterial::PARAM_DIFFUSE);
			c.a=material["opacity"];
			mat->set_parameter(FixedMaterial::PARAM_DIFFUSE,c);
		}


		if (material.has("textures")) {

			Array textures = material["textures"];
			for(int j=0;j<textures.size();j++) {

				Dictionary texture=textures[j];
				Ref<Texture> tex;
				if (texture.has("filename")) {


					String filename=texture["filename"];
					String path=state.base_path+"/"+filename.replace("\\","/");
					if (state.texture_cache.has(path)) {
						tex=state.texture_cache[path];
					} else {
						tex = ResourceLoader::load(path,"ImageTexture");
						if (tex.is_null()) {
							if (state.missing_deps)
								state.missing_deps->push_back(path);
						}
						state.texture_cache[path]=tex; //add anyway
					}
				}

				if (tex.is_valid() && texture.has("type")) {

					String type=texture["type"];
					if (type==TTR("DIFFUSE"))
						mat->set_texture(FixedMaterial::PARAM_DIFFUSE,tex);
					else if (type==TTR("SPECULAR"))
						mat->set_texture(FixedMaterial::PARAM_SPECULAR,tex);
					else if (type==TTR("SHININESS"))
						mat->set_texture(FixedMaterial::PARAM_SPECULAR_EXP,tex);
					else if (type=="NORMAL")
						mat->set_texture(FixedMaterial::PARAM_NORMAL,tex);
					else if (type==TTR("EMISSIVE"))
						mat->set_texture(FixedMaterial::PARAM_EMISSION,tex);
				}

			}
		}

		state.material_cache[id]=mat;

	}

}
Error EditorSceneImporterFBXConv::_parse_nodes(State& state,const Array &p_nodes,Node* p_base) {

	for(int i=0;i<p_nodes.size();i++) {

		Dictionary n = p_nodes[i];
		Spatial *node=NULL;
		bool skip=false;

		String id;
		if (n.has("id")) {
			id=_id(n["id"]);
		}

		print_line("ID: "+id);

		if (state.skeletons.has(id)) {

			Skeleton *skeleton = state.skeletons[id];
			node=skeleton;
			skeleton->localize_rests();
			print_line("IS SKELETON! ");
		} else if (state.bones.has(id)) {
			if (p_base)
				node=p_base->cast_to<Spatial>();
			if (!state.bones[id].has_anim_chan) {
				print_line("no has anim "+id);
			}
			skip=true;
		} else if (n.has("parts")) {
			//is a mesh
			MeshInstance *mesh = memnew( MeshInstance );
			node=mesh;

			Array parts=n["parts"];
			String long_identifier;
			for(int j=0;j<parts.size();j++) {

				Dictionary part=parts[j];
				if (part.has("meshpartid")) {
					String partid=part["meshpartid"];
					long_identifier+=partid;
				}
			}

			Ref<Mesh> m;

			if (state.mesh_cache.has(long_identifier)) {
				m=state.mesh_cache[long_identifier];
			} else {
				m = Ref<Mesh>( memnew( Mesh ) );

				//and parts are surfaces
				for(int j=0;j<parts.size();j++) {

					Dictionary part=parts[j];
					if (part.has("meshpartid")) {
						_add_surface(state,m,part);
					}
				}


				state.mesh_cache[long_identifier]=m;
			}

			mesh->set_mesh(m);
		}

		if (!skip) {

			if (!node) {
				node = memnew( Spatial );
			}

			node->set_name(id);
			node->set_transform(_get_transform(n));
			p_base->add_child(node);
			node->set_owner(state.scene);
		}


		if (n.has("children")) {
			Error err = _parse_nodes(state,n["children"],node);
			if (err)
				return err;
		}
	}

	return OK;
}
void EditorSceneImporterFBXConv::_add_surface(State& state,Ref<Mesh>& m,const Dictionary &part) {

	if (part.has("meshpartid")) {

		String id = part["meshpartid"];
		ERR_FAIL_COND(!state.surface_cache.has(id));


		Ref<Material> mat;
		if (part.has("materialid")) {
			String matid=part["materialid"];
			if (state.material_cache.has(matid)) {
				mat=state.material_cache[matid];
			}
		}
		int idx = m->get_surface_count();

		Array array = state.surface_cache[id].array;
		DVector<float> indices = array[Mesh::ARRAY_BONES];
		if (indices.size() && part.has("bones")) {


			Map<int,int> index_map;

			Array bones=part["bones"];

			for(int i=0;i<bones.size();i++) {

				Dictionary bone=bones[i];
				String name=_id(bone["node"]);

				if (state.bones.has(name)) {
					int idx=state.bones[name].skeleton->find_bone(name);
					if (idx==-1)
						idx=0;
					index_map[i]=idx;
				}
			}



			int ilen=indices.size();
			{
				DVector<float>::Write iw=indices.write();
				for(int j=0;j<ilen;j++) {
					int b = iw[j];
					ERR_CONTINUE(!index_map.has(b));
					b=index_map[b];
					iw[j]=b;
				}
			}

			array[Mesh::ARRAY_BONES]=indices;


		}

		m->add_surface(state.surface_cache[id].primitive,array);
		m->surface_set_material(idx,mat);
		m->surface_set_name(idx,id);
	}

}