- 2019-10-03 at 1:05 pm #19783
How can i access Verge3D functions from the parent doc outside the Verge3D iFrame?
I thought I could do:123456var myWebGL = document.getElementById("iFrame");var win = myWebGL.contentWindow;var object = win.app.scene.getObjectByName("Box01");
This doesn’t work though.
Thanks for any help.
2019-10-03 at 1:19 pm #19786Yuri KovelenovDeveloper2019-10-03 at 1:27 pm #19788
- This topic was modified 1 year ago by D3Pixel.
Brill, thanks so much for the quick answer Yuri!
2019-10-03 at 2:09 pm #19795
Object now works but object.material is undefined.123456var object = win.v3d.apps.scene.getObjectByName("Load Cell Main Body FULL");var mat = object.material;// var index = mat.nodeRGBMap['RGB'];// mat.nodeRGB[index] = new v3d.Vector4(1, 0, 0, 1);// mat.needsUpdate = true;
I have R.G.B. values from HTML and just want to change the color node “RGB” of a Principled material whenever my color picker event fires.
Or I could call a visual_logic.js function from outside the iFrame somehow? as that contains function
setMaterialColor(matName, colName, r, g, b)
Sorry to ask these questions, next time I will start with a code template and go from there.
2019-10-03 at 2:33 pm #19799Alexander KovelenovDeveloper
- This reply was modified 1 year ago by D3Pixel.
is the object “Load Cell Main Body FULL” contains multiple materials? If so, you need to check the object’s children to get yours.
With regard to the Puzzles functions, I have good news for you. Starting from Verge3D 2.15 you can execute any Puzzles procedures right from the v3d namespace:
or if it contains spaces:
win.v3d.puzzles.procedures["YOUR FUNCTION NAME"]()
2019-10-03 at 2:45 pm #19804
- This reply was modified 1 year ago by Alexander Kovelenov.
Ah, yes, it contains 3 materials. I will look at how to get the one I want.
I also tried calling the new puzzle function (assuming you mean one in visual_logic.js)
and that gave:
Uncaught TypeError: win.v3d.puzzles.procedures.setMaterialColor is not a function
I am using: Verge3D 2.15.0 (WebGL 2.0)2019-10-03 at 2:57 pm #19805
var mat = object.children.material;
Not sure how to call visual_logic puzzle functions as you mentioned though.2019-10-03 at 3:18 pm #198062019-10-04 at 6:23 am #19820
- You must be logged in to reply to this topic.