Jump to content

Export/Import Babylon file


Nastro
 Share

Recommended Posts

Hi !

I tried to import a babylon file in the Babylon JS SandBox but when i try he tell me "Uncaught SyntaxError: Unexpected token ."

I crete the file with this code :

    serializedMesh = BABYLON.SceneSerializer.Serialize(scene);
    strMesh = JSON.stringify(serializedMesh);

Unfortunatly i can't join you my file but if i generate it with your Serialize method i can't have problems ?

I can visualise my scene in my project but no in Sandbox ...

Any ideas ?

I work on 2.4 release.

 

Link to comment
Share on other sites

@Wingnut : With the JSON validator i have this error : 

Error: Parse error on line 581:
...4.87901823733, 3, 61...32564, 32566, 325
-----------------------^
Expecting 'EOF', '}', ',', ']', got 'undefined'

and the line is : 

"vertexData": [{
			"id": "c513a21b-8c02-4afe-b186-ce2b57404da2",
			"positions": [77805.97020113468, 0, 619805.7291471511, 77801.43272793293, 0, 619799.8913261443, 77801.43272793293, 3, 619799.8913261443, 77805.97020113468, 3, 619805.7291471511, 77806.28602206707, 3, 619805.4836738557, 77801.74854886532, 3, 619799.6458528489, 77801.74854886532, 0, 619799.6458528489, 77806.28602206707, 0, 619805.4836738557, 77806.28602206707, 3, 619805.4836738557, 77806.28602206707, 0, 619805.4836738557, 77805.97020113468, 0, 619805.7291471511, 77805.97020113468, 3, 619805.7291471511, 77801.43272793293, 3, 619799.8913261443, 77801.43272793293, 0, 619799.8913261443, 77801.74854886532, 0, 619799.6458528489, 77801.74854886532, 3, 619799.6458528489, 77801.43272793293, 3, 619799.8913261443, 77801.74854886532, 3, 619799.6458528489, 77806.28602206707, 3, 619805.4836738557, 77805.97020113468, 3, 619805.7291471511, 77805.97020113468, 0, 619805.7291471511, 77806.28602206707, 0, 619805.4836738557, 77801.74854886532, 0, 619799.6458528489, 77801.43272793293, 0, 619799.8913261443, 77801.81000839174, 0, 619800.2114592642, 77790.20779071748, 0, 619794.7757583707, 77790.20779071748, 3, 619794.7757583707, 77801.81000839174, 3, 619800.2114592642, 77801.97970928252, 3, 619799.8492416292, 77790.37749160826, 3, 619794.4135407358, 77790.37749160826, 0, 619794.4135407358, 77801.97970928252, 0, 619799.8492416292, 77801.97970928252, 3, 619799.8492416292, 77801.97970928252, 0, 619799.8492416292, 77801.81000839174, 0, 619800.2114592642, 77801.81000839174, 3, 619800.2114592642, 77790.20779071748, 3, 619794.7757583707, 77790.20779071748, 0, 619794.7757583707, 77790.37749160826, 0, 619794.4135407358, 77790.37749160826, 3, 619794.4135407358, 77790.20779071748, 3, 619794.7757583707, 77790.37749160826, 3, 619794.4135407358, 77801.97970928252, 3, 619799.8492416292, 77801.81000839174, 3, 619800.2114592642, 77801.81000839174, 0, 619800.2114592642, 77801.97970928252, 0, 619799.8492416292, 77790.37749160826, 0, 619794.4135407358, 77790.20779071748, 0, 619794.7757583707, 77790.68420903478, 0, 619774.0051467061, 77790.66891585197, 0, 619794.8701464772, 77790.66891585197, 3, 619794.8701464772, 77790.68420903478, 3, 619774.0051467061, 77790.28420914802, 3, 619774.0048535227, 77790.26891596522, 3, 619794.8698532939, 77790.26891596522, 0, 619794.8698532939, 77790.28420914802, 0, 619774.0048535227, 77790.28420914802, 3, 619774.0048535227, 77790.28420914802, 0, 619774.0048535227, 77790.68420903478, 0, 619774.0051467061, 77790.68420903478, 3, 619774.0051467061, 77790.66891585197, 3, 619794.8701464772, 77790.66891585197, 0, 619794.8701464772, 77790.26891596522, 0, 619794.8698532939, 77790.26891596522, 3, 619794.8698532939, 77790.66891585197, 3, 619794.8701464772, 77790.26891596522, 3, 619794.8698532939, 77790.28420914802, 3, 619774.0048535227, 77790.68420903478, 3, 619774.0051467061, 77790.68420903478, 0, 619774.0051467061, 77790.28420914802, 0, 619774.0048535227, 77790.26891596522, 0, 619794.8698532939, 77790.66891585197, 0, 619794.8701464772, 77790.35144414007, 0, 619774.4712431841, 77788.63975693285, 0, 619768.6414440088, 77788.63975693285, 3, 619768.6414440088, 77790.35144414007, 3, 619774.4712431841, 77790.73524306714, 3, 619774.3585559912, 77789.02355585992, 3, 619768.5287568159, 77789.02355585992, 0, 619768.5287568159, 77790.73524306714, 0, 619774.3585559912, 77790.73524306714, 3, 619774.3585559912, 77790.73524306714, 0, 619774.3585559912, 77790.35144414007, 0, 619774.4712431841, 77790.35144414007, 3, 619774.4712431841, 77788.63975693285, 3, 619768.6414440088, 77788.63975693285, 0, 619768.6414440088, 77789.02355585992, 0, 619768.5287568159, 77789.02355585992, 3, 619768.5287568159, 77788.63975693285, 3, 619768.6414440088, 77789.02355585992, 3, 619768.5287568159, 77790.73524306714, 3, 619774.3585559912, 77790.35144414007, 3, 619774.4712431841, 77790.35144414007, 0, 619774.4712431841, 77790.73524306714, 0, 619774.3585559912, 77789.02355585992, 0, 619768.5287568159, 77788.63975693285, 0, 619768.6414440088, 77789.08973176266, 0, 619768.9771462772, 77714.87872559811, 0, 619768.9228536393, 77714.87872559811, 3, 619768.9228536393, 77789.08973176266, 3, 619768.9771462772, 77789.09002440188, 3, 619768.5771463606, 77714.87901823733, 3, 61...32564, 32566, 32567, 32568, 32569, 32570, 32568, 32570, 32571, 32572, 32573, 32574, 32572, 32574, 32575, 32576, 32577, 32578, 32576, 32578, 32579, 32580, 32581, 32582, 32580, 32582, 32583, 32584, 32585, 32586, 32584, 32586, 32587, 32588, 32589, 32590, 32588, 32590, 32591, 32592, 32593, 32594, 32592, 32594, 32595, 32596, 32597, 32598, 32596, 32598, 32599, 32600, 32601, 32602, 32600, 32602, 32603, 32604, 32605, 32606, 32604, 32606, 32607, 32608, 32609, 32610, 32608, 32610, 32611, 32612, 32613, 32614, 32612, 32614, 32615, 32616, 32617, 32618, 32616, 32618, 32619, 32620, 32621, 32622, 32620, 32622, 32623, 32624, 32625, 32626, 32624, 32626, 32627, 32628, 32629, 32630, 32628, 32630, 32631, 32632, 32633, 32634, 32632, 32634, 32635, 32636, 32637, 32638, 32636, 32638, 32639, 32640, 32641, 32642, 32640, 32642, 32643, 32644, 32645, 32646, 32644, 32646, 32647, 32648, 32649, 32650, 32648, 32650, 32651, 32652, 32653, 32654, 32652, 32654, 32655, 32656, 32657, 32658, 32656, 32658, 32659, 32660, 32661, 32662, 32660, 32662, 32663, 32664, 32665, 32666, 32664, 32666, 32667, 32668, 32669, 32670, 32668, 32670, 32671, 32672, 32673, 32674, 32672, 32674, 32675, 32676, 32677, 32678, 32676, 32678, 32679, 32680, 32681, 32682, 32680, 32682, 32683, 32684, 32685, 32686, 32684, 32686, 32687, 32688, 32689, 32690, 32688, 32690, 32691, 32692, 32693, 32694, 32692, 32694, 32695, 32696, 32697, 32698, 32696, 32698, 32699, 32700, 32701, 32702, 32700, 32702, 32703, 32704, 32705, 32706, 32704, 32706, 32707, 32708, 32709, 32710, 32708, 32710, 32711, 32712, 32713, 32714, 32712, 32714, 32715, 32716, 32717, 32718, 32716, 32718, 32719, 32720, 32721, 32722, 32720, 32722, 32723, 32724, 32725, 32726, 32724, 32726, 32727, 32728, 32729, 32730, 32728, 32730, 32731, 32732, 32733, 32734, 32732, 32734, 32735, 32736, 32737, 32738, 32736, 32738, 32739, 32740, 32741, 32742, 32740, 32742, 32743, 32744, 32745, 32746, 32744, 32746, 32747, 32748, 32749, 32750, 32748, 32750, 32751, 32752, 32753, 32754, 32752, 32754, 32755, 32756, 32757, 32758, 32756, 32758, 32759, 32760, 32761, 32762, 32760, 32762, 32763, 32764, 32765, 32766, 32764, 32766, 32767, 32768, 32769, 32770, 32768, 32770, 32771, 32772, 32773, 32774, 32772, 32774, 32775, 32776, 32777, 32778, 32776, 32778, 32779, 32780, 32781, 32782, 32780, 32782, 32783, 32784, 32785, 32786, 32784, 32786, 32787, 32788, 32789, 32790, 32788, 32790, 32791, 32792, 32793, 32794, 32792, 32794, 32795, 32796, 32797, 32798, 32796, 32798, 32799, 32800, 32801, 32802, 32800, 32802, 32803, 32804, 32805, 32806, 32804, 32806, 32807, 32808, 32809, 32810, 32808, 32810, 32811, 32812, 32813, 32814, 32812, 32814, 32815, 32816, 32817, 32818, 32816, 32818, 32819, 32820, 32821, 32822, 32820, 32822, 32823, 32824, 32825, 32826, 32824, 32826, 32827, 32828, 32829, 32830, 32828, 32830, 32831, 32832, 32833, 32834, 32832, 32834, 32835, 32836, 32837, 32838, 32836, 32838, 32839, 32840, 32841, 32842, 32840, 32842, 32843, 32844, 32845, 32846, 32844, 32846, 32847, 32848, 32849, 32850, 32848, 32850, 32851, 32852, 32853, 32854, 32852, 32854, 32855, 32856, 32857, 32858, 32856, 32858, 32859, 32860, 32861, 32862, 32860, 32862, 32863, 32864, 32865, 32866, 32864, 32866, 32867, 32868, 32869, 32870, 32868, 32870, 32871, 32872, 32873, 32874, 32872, 32874, 32875, 32876, 32877, 32878, 32876, 32878, 32879, 32880, 32881, 32882, 32880, 32882, 32883, 32884, 32885, 32886, 32884, 32886, 32887, 32888, 32889, 32890, 32888, 32890, 32891, 32892, 32893, 32894, 32892, 32894, 32895, 32896, 32897, 32898, 32896, 32898, 32899, 32900, 32901, 32902, 32900, 32902, 32903, 32904, 32905, 32906, 32904, 32906, 32907, 32908, 32909, 32910, 32908, 32910, 32911, 32912, 32913, 32914, 32912, 32914, 32915, 32916, 32917, 32918, 32916, 32918, 32919, 32920, 32921, 32922, 32920, 32922, 32923, 32924, 32925, 32926, 32924, 32926, 32927, 32928, 32929, 32930, 32928, 32930, 32931, 32932, 32933, 32934, 32932, 32934, 32935, 32936, 32937, 32938, 32936, 32938, 32939, 32940, 32941, 32942, 32940, 32942, 32943, 32944, 32945, 32946, 32944, 32946, 32947, 32948, 32949, 32950, 32948, 32950, 32951, 32952, 32953, 32954, 32952, 32954, 32955, 32956, 32957, 32958, 32956, 32958, 32959, 32960, 32961, 32962, 32960, 32962, 32963, 32964, 32965, 32966, 32964, 32966, 32967, 32968, 32969, 32970, 32968, 32970, 32971, 32972, 32973, 32974, 32972, 32974, 32975, 32976, 32977, 32978, 32976, 32978, 32979, 32980, 32981, 32982, 32980, 32982, 32983, 32984, 32985, 32986, 32984, 32986, 32987, 32988, 32989, 32990, 32988, 32990, 32991, 32992, 32993, 32994, 32992, 32994, 32995, 32996, 32997, 32998, 32996, 32998, 32999, 33000, 33001, 33002, 33000, 33002, 33003, 33004, 33005, 33006, 33004, 33006, 33007, 33008, 33009, 33010, 33008, 33010, 33011, 33012, 33013, 33014, 33012, 33014, 33015, 33016, 33017, 33018, 33016, 33018, 33019, 33020, 33021, 33022, 33020, 33022, 33023, 33024, 33025, 33026, 33024, 33026, 33027, 33028, 33029, 33030, 33028, 33030, 33031, 33032, 33033, 33034, 33032, 33034, 33035, 33036, 33037, 33038, 33036, 33038, 33039, 33040, 33041, 33042, 33040, 33042, 33043, 33044, 33045, 33046, 33044, 33046, 33047, 33048, 33049, 33050, 33048, 33050, 33051, 33052, 33053, 33054, 33052, 33054, 33055, 33056, 33057, 33058, 33056, 33058, 33059, 33060, 33061, 33062, 33060, 33062, 33063, 33064, 33065, 33066, 33064, 33066, 33067, 33068, 33069, 33070, 33068, 33070, 33071, 33072, 33073, 33074, 33072, 33074, 33075, 33076, 33077, 33078, 33076, 33078, 33079, 33080, 33081, 33082, 33080, 33082, 33083, 33084, 33085, 33086, 33084, 33086, 33087, 33088, 33089, 33090, 33088, 33090, 33091, 33092, 33093, 33094, 33092, 33094, 33095, 33096, 33097, 33098, 33096, 33098, 33099, 33100, 33101, 33102, 33100, 33102, 33103, 33104, 33105, 33106, 33104, 33106, 33107, 33108, 33109, 33110, 33108, 33110, 33111, 33112, 33113, 33114, 33112, 33114, 33115, 33116, 33117, 33118, 33116, 33118, 33119, 33120, 33121, 33122, 33120, 33122, 33123, 33124, 33125, 33126, 33124, 33126, 33127, 33128, 33129, 33130, 33128, 33130, 33131, 33132, 33133, 33134, 33132, 33134, 33135, 33136, 33137, 33138, 33136, 33138, 33139, 33140, 33141, 33142, 33140, 33142, 33143, 33144, 33145, 33146, 33144, 33146, 33147, 33148, 33149, 33150, 33148, 33150, 33151, 33152, 33153, 33154, 33152, 33154, 33155, 33156, 33157, 33158, 33156, 33158, 33159, 33160, 33161, 33162, 33160, 33162, 33163, 33164, 33165, 33166, 33164, 33166, 33167, 33168, 33169, 33170, 33168, 33170, 33171, 33172, 33173, 33174, 33172, 33174, 33175, 33176, 33177, 33178, 33176, 33178, 33179, 33180, 33181, 33182, 33180, 33182, 33183, 33184, 33185, 33186, 33184, 33186, 33187, 33188, 33189, 33190, 33188, 33190, 33191, 33192, 33193, 33194, 33192, 33194, 33195, 33196, 33197, 33198, 33196, 33198, 33199, 33200, 33201, 33202, 33200, 33202, 33203, 33204, 33205, 33206, 33204, 33206, 33207, 33208, 33209, 33210, 33208, 33210, 33211, 33212, 33213, 33214, 33212, 33214, 33215, 33216, 33217, 33218, 33216, 33218, 33219, 33220, 33221, 33222, 33220, 33222, 33223, 33224, 33225, 33226, 33224, 33226, 33227, 33228, 33229, 33230, 33228, 33230, 33231, 33232, 33233, 33234, 33232, 33234, 33235, 33236, 33237, 33238, 33236, 33238, 33239, 33240, 33241, 33242, 33240, 33242, 33243, 33244, 33245, 33246, 33244, 33246, 33247, 33248, 33249, 33250, 33248, 33250, 33251, 33252, 33253, 33254, 33252, 33254, 33255, 33256, 33257, 33258, 33256, 33258, 33259, 33260, 33261, 33262, 33260, 33262, 33263, 33264, 33265, 33266, 33264, 33266, 33267, 33268, 33269, 33270, 33268, 33270, 33271, 33272, 33273, 33274, 33272, 33274, 33275, 33276, 33277, 33278, 33276, 33278, 33279, 33280, 33281, 33282, 33280, 33282, 33283, 33284, 33285, 33286, 33284, 33286, 33287]
		},

I have an error on a point but i don't know why :/

@Deltakosh The error message on Sandbox is :  Uncaught SyntaxError: Unexpected token

 

Link to comment
Share on other sites

:)  Those 3 periods...

4 hours ago, Nastro said:

Error: Parse error on line 581: ...4.87901823733, 3, 61...32564, 32566,

...look really unhealthy.  I cannot think of a reason why BABYLON.SceneSerializer would cause those.  @Dad72... do you think var strMesh = encodeURIComponent(str_Mesh); line... could cause those 3 dots?

@Nastro and I think about the same thing at the same time.  :)

Link to comment
Share on other sites

This error appear without "encodeURIComponent()".

With encode i have looks like : (code is not complete)

%7B%22autoClear%22%3Atrue%2C%22clearColor%22%3A%5B0.2%2C0.2%2C0.3%5D%2C%22ambientColor%22%3A%5B0%2C0%2C0%5D%2C%22gravity%22%3A%5B0%2C-0.9%2C0%5D%2C%22collisionsEnabled%22%3Atrue%2C%22workerCollisions%22%3Afalse%2C%22lights%22%3A%5B%7B%22tags%22%3Anull%2C%22name%22%3A%22Omni1%22%2C%22id%22%3A%22Omni1%22%2C%22uniqueId%22%3A7005%2C%22state%22%3A%22%22%2C%22diffuse%22%3A%5B1%2C1%2C1%5D%2C%22specular%22%3A%5B1%2C1%2C1%5D%2C%22intensity%22%3A0.3%2C%22range%22%3A1.7976931348623157e%2B308%2C%22includeOnlyWithLayerMask%22%3A0%2C%22excludeWithLayerMask%22%3A0%2C%22radius%22%3A0.00001%2C%22position%22%3A%5B-1%2C10%2C-1%5D%2C%22direction%22%3A%5B1%2C-10%2C1%5D%2C%22shadowOrthoScale%22%3A0.5%2C%22autoUpdateExtends%22%3Atrue%2C%22type%22%3A1%2C%22animations%22%3A%5B%5D%2C%22ranges%22%3A%5B%5D%7D%2C%7B%22tags%22%3Anull%2C%22name%22%3A%22pt0%22%2C%22id%22%3A%22pt0%22%2C%22uniqueId%22%3A7006%2C%22state%22%3A%22%22%2C%22diffuse%22%3A%5B1%2C1%2C1%5D%2C%22specular%22%3A%5B1%2C1%2C1%5D%2C%22intensity%22%3A1%2C%22range%22%3A1.7976931348623157e%2B308%2C%22includeOnlyWithLayerMask%22%3A0%2C%22excludeWithLayerMask%22%3A0%2C%22radius%22%3A0.00001%2C%22position%22%3A%5B77559.6373141706%2C10%2C619668.4119997993%5D%2C%22type%22%3A0%2C%22animations%22%3A%5B%5D%2C%22ranges%22%3A%5B%5D%7D%2C%7B%22tags%22%3Anull%2C%22nam

En the error i have is : 

Error: Parse error on line 1:
% 7 B % 22 autoClear
^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'
Link to comment
Share on other sites

hmm.  Let's look at the sequence.

619768.9228536393, 77714.87872559811, 3, 619768.9228536393, 77789.08973176266, 3, 619768.9771462772, 77789.09002440188, 3, 619768.5771463606, 77714.87901823733, 3, 61...32564, 32566, 32567, 32568, 32569, 32570, 32568, 32570, 32571, 32572, 32573, 32574, 32572, etc

We see repeated 619768 values... following a pattern... and then... in the middle of the (possibly final...) 619768... it goes to hell... after the '61'.

And... the pattern/values do a DRASTIC change.

See it?  Sure ya do.  We all do.  What the heck happened there?  And what are those 3256X numbers?  They don't look much like vec3 values.  They look... like indices.  Why would indices be put in the same array ... as positions data?  (in the .babylon file).

Something went ka-boom, @ triple period.  A fuse popped right there, or something.   hmm.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...