Forum Replies Created
-
AuthorPosts
-
2020-06-07 at 9:15 pm in reply to: replace texture with external file, based on element content in parent doc #28499
swatchyb
CustomerHi Ivan and Yuri,
This was working well, but unfortunately the compexity and diversity of items I need to configure made setting session vars (20-30 simultaneous) and putting them in text inputs, clumsy. To really make things dynamic, I am trying to use a query/table of fields in the parent, that dynamically change the id, name and value on loading, with v3d listening for those id’s. On the DOM/html side, this seems to be working.for example:
id name value
inp_mat1 mat1 ../../assets/media/MAT/CreamBasic.jpg
inp_mat2 mat2 ../../assets/media/MAT/StoneLace.jpg
inp_mat3 mat3 ../../assets/media/MAT/TanLace.jpg
inp_mat4 mat4 ../../assets/media/MAT/BlueLace.jpgThe problem is that now we are back to v3d only reacting when a space is manually added to a field after load or change despite using the dispatchEvent that you offered and that worked when everything was static (names and id’s).
<input dmx-bind:id=”Dyn_MAT_id”
dmx-bind:name=”Dyn_MAT_name”
type=”text” class=”form-control”
dmx-bind:value=”MAT_repeat_url”
onupdated=”Dyn_MAT_id.dispatchEvent(new Event(‘input’));”>My coding “coach” gave a try adding a script to help, and diagnose, but with no luck.
<script>
function updateInput(elString) {
console.log(elString);
var el = document.getElementById(elString);
console.log(el);
el.dispatchEvent(new Event(‘input’));
}
</script>I thought it might be a sequence of events thing – that the html had to load before v3d, so that the id’s would be in place, but it also does not see them in an unload/load to replace (gltf’s) scenario, so not sure that is it.
As well, sometimes the dynamically/externally referenced gftl’s load on initial launch, and other times they do not. Attached is an example of a console message if that helps.
Any suggestions very appreciated. /sb
2020-05-29 at 5:06 pm in reply to: replace texture with external file, based on element content in parent doc #28172swatchyb
CustomerMAGIC!
thank you Ivan – this is so cool. that little bit of js opened the gate to the rest of the exciting project.
thanks again!2020-05-28 at 2:19 pm in reply to: replace texture with external file, based on element content in parent doc #28136swatchyb
CustomerHi again. continuing on the above…
SO close to this working beautifully, but have one snag.
In the parent doc, when a fabric/ material is selected it sets a session variable which in turn populates (dynamic attr) an input (mat1) with the url of the new texture. However, Verge does not respond to that input unless I manually place the cursor in the input and add a space (which seems) to wake up the listener in a way that just programmatically setting the value does not.
Any suggestions on how to give it a kick?
Thanks very much again!(ps had put the input in a form and submit, which works, but of course refreshes iframe too :-/
also, everything works on manual entry – the console shows it is listening as I type a value)2020-05-23 at 11:18 pm in reply to: replace texture with external file, based on element content in parent doc #27943swatchyb
Customernever mind, think I got it using with – get attr value from elem “inp_mat1” in parent.
I am sure there will be other questions…2020-03-11 at 1:42 pm in reply to: ability to replace objects and materials/ textures using parent doc elements? #24562swatchyb
Customerand so it does…great, thanks Yuri!
-
AuthorPosts