We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Read Multiple Files from a folder

Home Forums Puzzles Read Multiple Files from a folder

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #9375
    Alby90
    Participant

    Good evening!
    I’m experimenting with Verge3D and i want to ask some questions:
    is there a way to add items to a folder (some textures, for example) and then, when starting the program, store them in an Array in order to be used in runtime?
    I give an example: in a folder I have 3 textures. I want to save them in an Array for loading when needed. If then I need to add another texture I just have to add it to the folder to be able to apply it to my material at the next use of the program.
    I saw that there is a “load file” puzzle that can be used for this purpose, am i right?
    Thanks in advance

    #9383

    Hi!

    You can possibly use the replace texture puzzle that loads images on demand. We did so in our newest Scooter demo and this allowed us to halve the overall file size.

    Chief 3D Verger | LinkedIn | Twitter

    #9445
    Alby90
    Participant

    Yeah, i have already used this puzzle and it is very usefull for getting the texture, but if i want to make a system like the one i have described previously i need to know how many files i have in a folder. Is that possible in some way using the puzzle?
    Thanks in advance

    #9446

    I see. I’m afraid the web browser is too restricted to directly read the contents of a folder on the server. You can, however, create a manifest file in which you can list all the images. This file then can be loaded with the load file puzzle. Finally you can use some Text puzzles to retrieve those file paths and load your textures.

    You can also automate the updating of the manifest file by writing some server side script which will be looking in your folder and retrieve all the files from it.

    Chief 3D Verger | LinkedIn | Twitter

    #9464
    HoboCat
    Customer

    Hello,
    First off all I wanted to thank the creators for such a great app! it gives huge opportunities for developers!
    I wanted to ask a bit simmilar thing to this topic.
    How about if I want to change images dynamicaly with new names?
    My planned scenario: user uploads a file to a server, then jQuery returns a path to uploaded file and then Verge3d uses “replace texture” puzzle to change an existing texture in model to the new one.
    So the question would be: what would be the workflow of giving the path to file from html to “replace_texture input” and also what would be the method to initiate “replace_texture” from html click?

    #9466

    Hi!

    So the question would be: what would be the workflow of giving the path to file from html to “replace_texture input” and also what would be the method to initiate “replace_texture” from html click?

    You can use when called from JS puzzle for that – see the description and an example here: https://www.soft8soft.com/docs/manual/en/introduction/Puzzles.html#when_called_from_JS

    Chief 3D Verger | LinkedIn | Twitter

    #9485
    HoboCat
    Customer

    Thank you!

    #9502

    Sure! :)

    Chief 3D Verger | LinkedIn | Twitter

    #10163
    HoboCat
    Customer

    Hello again,
    just wanted to ask, if there is a possibility to make verge3d load an image not from server but from user input: for example user add an image file to html “upload”, then javascript loads that image> then verge3d loads that image and then “replace_texture” uses loaded image to replace the old texture? if yes what would be the way to make verge3d to load the image from javascript?

    #10170

    Please take a loot at this post. Is it what you’re looking for?

    Chief 3D Verger | LinkedIn | Twitter

    #10245
    HoboCat
    Customer

    Yep, thank you! just gonna need to get some javascript knowledge to understand the mechanism.

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.