Open SelaOAL opened 7 years ago
I don't understand what you mean. What do you exactly test ? Care to come on the chat to explain it ?
I replied there, in case you didn't see:
Check out the camera object there, type: _viewer.navigation.getCamera(); in the console, when I try to run JSON.prune() on it, it doesn't stringy the full object
@Canop Any updates?
Could you build another test case (the page you linked to doesn't have the _viewer property anymore) ?
I see that object there with: _viewer.getCamera()
or _viewer.navigation.getCamera();
.
I don't: http://i.imgur.com/AseHbyS.png
Does the viewer work on the page for you? Does the explode feature work for example?
If not maybe there's an ad blocker that blocks it.
Anyway, here's another link: You need to first go here to initialize the viewer: http://viewernavigation.herokuapp.com/forge/initialsetup And then here: https://viewernavigation.herokuapp.com/
Here the object is named viewer3D
instead of _viewer
.
So use viewer3D.navigation.getCamera()
or viewer3D.getCamera()
.
Hi @SelaOAL, Not sure there have been change since then but I was not able to reproduce your issue: JSON.prune worked as intended. here is a screenshot here is the actuall string I got:
"{"uuid":"82364A68-CE96-430C-A6F5-B7596ED79BC6","name":"","type":"Camera","children":[{"uuid":"00FEF896-02D0-464E-9605-C75D82C4665C","name":"","type":"DirectionalLight","parent":"-pruned-","children":[],"up":{"x":0,"y":1,"z":0},"position":{"x":-0.5,"y":0.2,"z":0.06},"rotation":{"_x":0,"_y":0,"_z":0,"_order":"XYZ"},"quaternion":{"_x":0,"_y":0,"_z":0,"_w":1},"scale":{"x":1,"y":1,"z":1},"rotationAutoUpdate":true,"matrix":{"elements":{"0":1,"1":0,"2":0,"3":0,"4":0,"5":1,"6":0,"7":0,"8":0,"9":0,"10":1,"11":0,"12":-0.5,"13":0.20000000298023224,"14":0.05999999865889549,"15":1}},"matrixWorld":{"elements":{"0":0.9998222589492798,"1":0.01885426789522171,"2":-5.353323340173688e-10,"3":0,"4":-0.004420076962560415,"5":0.23439210653305054,"6":0.9721320867538452,"7":0,"8":0.018328839913010597,"9":-0.9719592928886414,"10":0.23443378508090973,"11":0,"12":-43.5804557800293,"13":-146.7716827392578,"14":27.008098602294922,"15":1}},"matrixAutoUpdate":true,"matrixWorldNeedsUpdate":false,"visible":true,"castShadow":false,"receiveShadow":false,"frustumCulled":true,"renderOrder":0,"userData":{},"color":{"r":0.5,"g":0.5,"b":0.5},"target":{"uuid":"845D61D9-DB93-4E28-8F5E-6C5858C69999","name":"","type":"Object3D","parent":"-pruned-","children":[],"up":{"x":0,"y":1,"z":0},"position":{"x":0,"y":0,"z":0},"rotation":{"_x":0,"_y":0,"_z":0,"_order":"XYZ"},"quaternion":{"_x":0,"_y":0,"_z":0,"_w":1},"scale":{"x":1,"y":1,"z":1},"rotationAutoUpdate":true,"matrix":{"elements":{"0":1,"1":0,"2":0,"3":0,"4":0,"5":1,"6":0,"7":0,"8":0,"9":0,"10":1,"11":0,"12":0,"13":0,"14":0,"15":1}},"matrixWorld":{"elements":{"0":0.9998222589492798,"1":0.01885426789522171,"2":-5.353323340173688e-10,"3":0,"4":-0.004420076962560415,"5":0.23439210653305054,"6":0.9721320867538452,"7":0,"8":0.018328839913010597,"9":-0.9719592928886414,"10":0.23443378508090973,"11":0,"12":-43.08076095581055,"13":-146.75082397460938,"14":26.799606323242188,"15":1}},"matrixAutoUpdate":true,"matrixWorldNeedsUpdate":false,"visible":true,"castShadow":false,"receiveShadow":false,"frustumCulled":true,"renderOrder":0,"userData":{}},"intensity":0,"onlyShadow":false,"shadowCameraNear":50,"shadowCameraFar":5000,"shadowCameraLeft":-500,"shadowCameraRight":500,"shadowCameraTop":500,"shadowCameraBottom":-500,"shadowCameraVisible":false,"shadowBias":0,"shadowDarkness":0.5,"shadowMapWidth":512,"shadowMapHeight":512,"shadowCascade":false,"shadowCascadeOffset":{"x":0,"y":0,"z":-1000},"shadowCascadeCount":2,"shadowCascadeBias":[0,0,0],"shadowCascadeWidth":[512,512,512],"shadowCascadeHeight":[512,512,512],"shadowCascadeNearZ":[-1,0.99,0.998],"shadowCascadeFarZ":[0.99,0.998,1],"shadowCascadeArray":[],"shadowMap":null,"shadowMapSize":null,"shadowCamera":null,"shadowMatrix":null},"-pruned-"],"up":{"x":-0.004420077503198906,"y":0.2343921137857054,"z":0.9721320897439478},"position":{"x":-43.08076013598924,"y":-146.7508217762266,"z":26.799606759562053},"rotation":{"_x":1.3341197298421035,"_y":0.018329866319399705,"_z":0.004420833931197809,"_order":"XYZ"},"quaternion":{"_x":0.6186671851049008,"_y":0.005832777159531409,"_z":0.007406582765189825,"_w":0.7855966125441288},"scale":{"x":1,"y":1,"z":1},"rotationAutoUpdate":true,"matrix":{"elements":{"0":0.9998222589492798,"1":0.01885426789522171,"2":-5.353323340173688e-10,"3":0,"4":-0.004420076962560415,"5":0.23439210653305054,"6":0.9721320867538452,"7":0,"8":0.018328839913010597,"9":-0.9719592928886414,"10":0.23443378508090973,"11":0,"12":-43.08076095581055,"13":-146.75082397460938,"14":26.799606323242188,"15":1}},"matrixWorld":{"elements":{"0":0.9998222589492798,"1":0.01885426789522171,"2":-5.353323340173688e-10,"3":0,"4":-0.004420076962560415,"5":0.23439210653305054,"6":0.9721320867538452,"7":0,"8":0.018328839913010597,"9":-0.9719592928886414,"10":0.23443378508090973,"11":0,"12":-43.08076095581055,"13":-146.75082397460938,"14":26.799606323242188,"15":1}},"matrixAutoUpdate":true,"matrixWorldNeedsUpdate":false,"visible":true,"castShadow":false,"receiveShadow":false,"frustumCulled":true,"renderOrder":0,"userData":{},"matrixWorldInverse":{"elements":{"0":0.999822199344635,"1":-0.004420076962560415,"2":0.018328838050365448,"3":0,"4":0.01885426789522171,"5":0.23439210653305054,"6":-0.9719592332839966,"7":0,"8":-5.184740414776456e-10,"9":0.9721320271492004,"10":0.23443377017974854,"11":0,"12":45.83998107910156,"13":8.154058456420898,"14":-148.12893676757812,"15":0.9999999403953552}},"projectionMatrix":{"elements":{"0":0.0173032283782959,"1":0,"2":0,"3":0,"4":0,"5":0.03227309510111809,"6":0,"7":0,"8":0,"9":0,"10":-0.0032685629557818174,"11":0,"12":0,"13":0,"14":-0.48416873812675476,"15":1}},"fov":53.13010235415598,"near":-157.81591435913788,"far":454.0737874471472,"aspect":1.8651488616462346,"left":-57.79268624109196,"right":57.79268624109196,"top":30.985562294519728,"bottom":-30.985562294519728,"clientWidth":1065,"clientHeight":571,"target":{"x":-44.216618916418504,"y":-86.51741177058969,"z":12.271481389989658},"worldup":{"x":0,"y":0,"z":1},"orthographicCamera":{"uuid":"31A02FAD-AB81-4277-835D-D7DC5C614EE1","name":"","type":"OrthographicCamera","children":[],"up":{"x":0,"y":1,"z":0},"position":{"x":0,"y":0,"z":0},"rotation":{"_x":0,"_y":0,"_z":0,"_order":"XYZ"},"quaternion":{"_x":0,"_y":0,"_z":0,"_w":1},"scale":{"x":1,"y":1,"z":1},"rotationAutoUpdate":true,"matrix":{"elements":{"0":1,"1":0,"2":0,"3":0,"4":0,"5":1,"6":0,"7":0,"8":0,"9":0,"10":1,"11":0,"12":0,"13":0,"14":0,"15":1}},"matrixWorld":{"elements":{"0":1,"1":0,"2":0,"3":0,"4":0,"5":1,"6":0,"7":0,"8":0,"9":0,"10":1,"11":0,"12":0,"13":0,"14":0,"15":1}},"matrixAutoUpdate":true,"matrixWorldNeedsUpdate":false,"visible":true,"castShadow":false,"receiveShadow":false,"frustumCulled":true,"renderOrder":0,"userData":{},"matrixWorldInverse":{"elements":{"0":1,"1":0,"2":0,"3":0,"4":0,"5":1,"6":0,"7":0,"8":0,"9":0,"10":1,"11":0,"12":0,"13":0,"14":0,"15":1}},"projectionMatrix":"-pruned-","zoom":1,"left":-57.79268624109196,"right":57.79268624109196,"top":30.985562294519728,"bottom":-30.985562294519728,"near":-157.81591435913788,"far":454.0737874471472},"perspectiveCamera":{"uuid":"429613E5-03B7-42D6-B0D7-17FF5AC07AD0","name":"","type":"PerspectiveCamera","children":[],"up":{"x":0,"y":1,"z":0},"position":{"x":0,"y":0,"z":0},"rotation":{"_x":0,"_y":0,"_z":0,"_order":"XYZ"},"quaternion":{"_x":0,"_y":0,"_z":0,"_w":1},"scale":{"x":1,"y":1,"z":1},"rotationAutoUpdate":true,"matrix":{"elements":{"0":1,"1":0,"2":0,"3":0,"4":0,"5":1,"6":0,"7":0,"8":0,"9":0,"10":1,"11":0,"12":0,"13":0,"14":0,"15":1}},"matrixWorld":{"elements":{"0":1,"1":0,"2":0,"3":0,"4":0,"5":1,"6":0,"7":0,"8":0,"9":0,"10":1,"11":0,"12":0,"13":0,"14":0,"15":1}},"matrixAutoUpdate":true,"matrixWorldNeedsUpdate":false,"visible":true,"castShadow":false,"receiveShadow":false,"frustumCulled":true,"renderOrder":0,"userData":{},"matrixWorldInverse":{"elements":{"0":1,"1":0,"2":0,"3":0,"4":0,"5":1,"6":0,"7":0,"8":0,"9":0,"10":1,"11":0,"12":0,"13":0,"14":0,"15":1}},"projectionMatrix":{"elements":{"0":1.2943811416625977,"1":0,"2":0,"3":0,"4":0,"5":2.4142136573791504,"6":0,"7":0,"8":0,"9":0,"10":-1.0000020265579224,"11":-1,"12":0,"13":0,"14":-0.20000019669532776,"15":0}},"zoom":1,"fov":45,"aspect":1.8651488616462346,"near":0.1,"far":100000},"zoom":1,"isPerspective":false,"pivot":{"x":0,"y":0,"z":0},"dirty":false,"saveFov":0,"orthoScale":61.971124589039455,"worldUpTransform":{"elements":{"0":1,"1":0,"2":0,"3":0,"4":0,"5":6.123234262925839e-17,"6":-1,"7":0,"8":0,"9":1,"10":6.123234262925839e-17,"11":0,"12":0,"13":0,"14":0,"15":1}}}"
It doesn't work on a complex object. Check out the object: _viewer.navigation.getCamera(); in the page: http://developer-autodesk.github.io/viewer-javascript-debugger.tool/ The output will be the same as using JSON.stringify but it shouldn't be.