Forum Replies Created
-
AuthorPosts
-
David Duperron
CustomerI think I found a solution myself…
I simply removed the listener associated to the scene by adding the following:beforeDestroy: function () { eventBus.$off(); },
It seems to work fine!
David Duperron
CustomerOk, I finally found out where was the problem in the logic.js file. For some reason, the VARS object is only defined once (in the first procedure, acting on the triggerAnim group Objects). see below:
registerOnClick(getObjectsFrom(['GROUP', 'triggerAnim'], 'ALL'), function () { setHTMLElemStyle('cursor', 'default', ['BODY'], false); console.log(['Trigger ', _pGlob.pickedObject, ' has been clicked'].join('')); pickedObject = _pGlob.pickedObject; var VARS = Object.defineProperties({}, { "animObject": { get: function () { return animObject; }, set: function (val) { animObject = val; } }, "animObjectState": { get: function () { return animObjectState; }, set: function (val) { animObjectState = val; } }, "hoveredObject": { get: function () { return hoveredObject; }, set: function (val) { hoveredObject = val; } }, "pickedObject": { get: function () { return pickedObject; }, set: function (val) { pickedObject = val; } }, }); Function('app', 'v3d', 'VARS', 'PROC', (('// Built-in variables: app, v3d, VARS, PROC' + '\n' + 'v3d.PL._vueEventBus.$emit(\'Object-clicked\', { id: VARS[\'pickedObject\']});')))(appInstance, v3d, VARS, PROC); }, function () { }); registerOnClick(getObjectsFrom(['GROUP', 'modules'], 'ALL'), function () { setHTMLElemStyle('cursor', 'default', ['BODY'], false); console.log(['Module ', _pGlob.pickedObject, ' has been clicked'].join('')); pickedObject = _pGlob.pickedObject; Function('app', 'v3d', 'VARS', 'PROC', (('// Built-in variables: app, v3d, VARS, PROC' + '\n' + 'v3d.PL._vueEventBus.$emit(\'Object-clicked\', { id: VARS[\'pickedObject\']});')))(appInstance, v3d, VARS, PROC); }, function () { });
if I simply copy/paste the VARS definition in the second “registerOnClick” (acting on the Modules group objects) it works… the problem is that I will have to do it again each time I regenerate the js fil from my puzzles… is it a bug??
registerOnClick(getObjectsFrom(['GROUP', 'triggerAnim'], 'ALL'), function () { setHTMLElemStyle('cursor', 'default', ['BODY'], false); console.log(['Trigger ', _pGlob.pickedObject, ' has been clicked'].join('')); pickedObject = _pGlob.pickedObject; var VARS = Object.defineProperties({}, { "animObject": { get: function () { return animObject; }, set: function (val) { animObject = val; } }, "animObjectState": { get: function () { return animObjectState; }, set: function (val) { animObjectState = val; } }, "hoveredObject": { get: function () { return hoveredObject; }, set: function (val) { hoveredObject = val; } }, "pickedObject": { get: function () { return pickedObject; }, set: function (val) { pickedObject = val; } }, }); Function('app', 'v3d', 'VARS', 'PROC', (('// Built-in variables: app, v3d, VARS, PROC' + '\n' + 'v3d.PL._vueEventBus.$emit(\'Object-clicked\', { id: VARS[\'pickedObject\']});')))(appInstance, v3d, VARS, PROC); }, function () { }); registerOnClick(getObjectsFrom(['GROUP', 'modules'], 'ALL'), function () { setHTMLElemStyle('cursor', 'default', ['BODY'], false); console.log(['Module ', _pGlob.pickedObject, ' has been clicked'].join('')); pickedObject = _pGlob.pickedObject; var VARS = Object.defineProperties({}, { "animObject": { get: function () { return animObject; }, set: function (val) { animObject = val; } }, "animObjectState": { get: function () { return animObjectState; }, set: function (val) { animObjectState = val; } }, "hoveredObject": { get: function () { return hoveredObject; }, set: function (val) { hoveredObject = val; } }, "pickedObject": { get: function () { return pickedObject; }, set: function (val) { pickedObject = val; } }, }); Function('app', 'v3d', 'VARS', 'PROC', (('// Built-in variables: app, v3d, VARS, PROC' + '\n' + 'v3d.PL._vueEventBus.$emit(\'Object-clicked\', { id: VARS[\'pickedObject\']});')))(appInstance, v3d, VARS, PROC); }, function () { });
David Duperron
CustomerHi!
I continue to work on this subject. As you suggested Ivan I started to call v3d procedures directly from the Quasar/Vue interface and it works like a charm.
However, I encounter a strange behaviour… I don’t know if it’s a bug or a mistake somewhere, but as soon as I have two active “exec script” blocks in my puzzles, I have an error popping:
Uncaught ReferenceError: VARS is not defined
It’s like I can use the VARS[‘myVar’] only once…
Any idea how to solve this??
David Duperron
CustomerHi Ivan! Simple as that… :) I will try it ASAP!
Thank you very muchAnd Thanks GlifTek! In fact I discovered this framework on one of your posts here! ;) As you said the fact that you can deploy to any platform with one single code is just perfect… The other things is the great number of built-in components and functions, that look just great out of the box and are so easy to integrate in your app!!
I’ll keep my Github updated as I progress with this exercise, and try to document it… do not hesitate to clone it and come discuss it here!
CheersDavid
David Duperron
CustomerMade a little progress. Now I can trigger events that pass on the clicked object, which is just what I needed.
Next step, set-up the same kind of communication the other way around: from the Vue page script to the V3D app script, to trigger animations for example. If you have a few minutes to guide me in the right direction?? ;)
CheersDavid
David Duperron
CustomerHope this helps!
Indeed it helps a lot!! :)
Now I have a starting point to customize the event and the “listener” to trigger different behaviors depending on which object is clicked.
I will continue to implement this on the Github project.
Thanks a lot!David
David Duperron
CustomerThanks Ivan!
I already saw your post, but I must confess that I am far from an expert in Vue.js and actually I have troubles loading the visual_logic.js resource file… I don’t know how to import, or declare or whatever in the .vue or template files to load it properly… I suspect I need to properly import the visual_logic.js resource inside the <script> section of the V3DApp.vue file (similarly to what is done with the app.js file), but I don’t know how…EDIT: I managed to get the file loaded by adding the following line to the V3DApp.vue file:
import * as LOGIC from '../v3dApp/visual_logic.js';
But now I get a message saying that createApp is not a function… So it’s another issue. I probably need to add something else in the “export” section?EDIT2: Ok I just found that there is no createApp function in the app.js file when using the puzzles version… I then called V3DApp; instead of V3DApp.createApp(); once mounted, and got rid of the error… But this is just to go one more step! Now the scene does not load. Must be something to do with path…?
David Duperron
CustomerHi Yuri!
Thanks for your reply! That’s the guide I followed to get the sample project working inside the Quasar framework. Now as I said I would like to integrate a more complex V3D project, which uses puzzles and therefore its own visual_logic.js file… I will try harder on my own, but if there is a quick help somewhere it’s always welcome! :p
CheersDavid
David Duperron
CustomerHi there!
I was playing with Electron framework, and then discovered Quasar, which seams really powerful!
I managed to run a simple Quasar application by following the tutorial here without any issue (https://www.soft8soft.com/docs/manual/en/introduction/Using-JavaScript.html).
Now I would like to run a “custom” project instead of the simple V3D cube, i.e. a web app that I would set up using V3D puzzles and js to interact with the rest of the user interface.
Could any of you guys give me a hand or point me in the right direction?? (like how to set-up the index.vue and/or V3DApp.vue to correctly import the visual_logic.js file…).
Any help would be greatly appreciated!
CheersDavid
David Duperron
CustomerBasically seeing this demo:
https://cdn.soft8soft.com/demo/examples/index.html?q=svg#webgl_loader_svg
I thought it was possible to load a SVG file in the 3D scene, and benefit from its SVG crispness to display complicated schematics (electrical, networks, …) and eventually also interact with the SVG itself like what is possible in HTML (active links, change properties, colors…).
It seems that it is a little more complicated than expected!
Ans as I’m far from expert in Javascript and coding, it’s a little bit out of my league I’m afraid…David Duperron
CustomerOk but it looks like a “custom” box mapping where you separate X,Y and Z and then project the same wood texture differently along each of the axis with a “flat” mapping… Am I right?
There is no direct box mapping as far as I could see!?
RegardsDavid
David Duperron
CustomerThanks for your answer! But…
I’ve had a look, but unless I’m wrong the textures use a “flat” projection… I could not find any with the “box” projection (wood, wall, etc…). From version 2.15 it is said that “We supported all available projection modes”. Can you indicate me which material uses this projection mode?
Thanks very much!David
David Duperron
CustomerThanks for your answer! but I cannot make it work… I tried unloading the current scene and loading the new one… Just sent you an email!
David Duperron
CustomerOk, and doing so, I can force the refreshing of the objects included in a specific collection upon the scene loading completion?
David Duperron
CustomerEDIT:
I found a solution with a CSS selector that looks for a specific substring inside the “id”, which works perfectly….v3d-annotation[id*="-MM-"] { background-color: blue; }
will style all my annotations with “-MM-” in the id name with a blue background. I did not need anything more! :)
-
AuthorPosts