Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Dropboxing 3D objects

pacpac
edited January 12 in Questions Posts: 208

Please help I can’t get my 3D files to come in to codea.

please put step buy step instructions. I am using sketch 3Dand I do have drop box

Please help Pac

Tagged:
«134

Comments

  • dave1707dave1707 Mod
    Posts: 7,604

    Where are you getting the 3D files from.

  • edited December 2018 Posts: 1,226
    @pac - what 3D file types are you trying to load? Are they partially loading? What are the paths you are using? Are you on Codea 127?

    Sorry lot of questions, but all these things can affect the success/failure of loading. Oh one more thing - how many vertices are involved?

    A small piece of code with your loading details in and your Craft setup could help.
  • @pac copy to applications/Codea in dropbox. do a synch from the codea assets. should appear in the asset picker list in craft.models(). blend, stl, obj formats might work.

  • edited December 2018 Posts: 1,226

    @pac - I have my models in directories on my Dropbox storage. I use mainly .obj with .mtl and the relevant texture - all in the same folder. Then I load the model using (for example)

    MyEntity.model = craft.model(“Dropbox:FolderName/ModelName”) — note no filetype

    As @piinthesky mentioned, after you have set up your files on Dropbox, you need to sync them from the Assets/Dropbox folder accessed from your project window. I don’t know if it’s necessary but after a sync I always close and restart Codea. Remember you need to set up your Craft environment in setup - you have several examples of that.

    Edit: as always text case needs to be correct in the file path and the files.

  • pacpac
    Posts: 208

    Okay I will try that but where in the drop box folder do they show up. Like shaders or sprites

  • pacpac
    Posts: 208

    So I have some .obj files in my Dropbox but when I sync it it says no assets.

    What am I doing wrong?

    Do I need to do something special in Dropbox. Like make a special folder or something?

    Thanks @pac

  • dave1707dave1707 Mod
    edited December 2018 Posts: 7,604

    They will show up in the Codea Dropbox folder “models” with a picture of the model.

  • pacpac
    Posts: 208

    Thanks. When I went back to Dropbox all of a sudden a new folder appears that is called apps and it has codea in there. Am I supposed to use that folder or not?

  • dave1707dave1707 Mod
    Posts: 7,604

    I just saved a 3D obj file in the Dropbox apps folder “Codea”. I synced with the Codea Dropbox folder and the file showed up in “models” with a picture of the model.

  • pacpac
    Posts: 208

    Yes I have it syncing now but It keeps coming up as a zip. What do I do?

  • pacpac
    Posts: 208

    My app I was using was sending all as .objs like I wanted before but now ever thing comes as a zip.

    Any suggestions?

  • dave1707dave1707 Mod
    edited December 2018 Posts: 7,604

    I don’t know what app you’re using or why it was sending obj files but now it’s sending zips. Is there an option that says what kind of file you want to send. Are they zip files in the Dropbox app or obj.

  • pacpac
    Posts: 208

    I am using sketch 3D and yes I tell it each time to send as .obj.

    I have figured it out that before I was having Dropbox get the files now I am sending it to Dropbox. I would do what I had been doing before but I can’t transfer files to the codea folder.

    So what would you do?

  • dave1707dave1707 Mod
    Posts: 7,604

    If you have the files in the Dropbox app Codea folder, then from the Codea Dropbox folder, you tap on sync and Codea gets the file from the Dropbox app folder.

  • pacpac
    Posts: 208

    I know and I have done that now but the problem is that they still come in as zips.

    I have an idea be right back.

  • pacpac
    Posts: 208

    Do you know how you move files around between the folders in drop box?

  • dave1707dave1707 Mod
    Posts: 7,604

    Please specify the Dropbox app folders or the Codea Dropbox folders. I don’t know which one you’re talking about.

  • edited December 2018 Posts: 1,226
    @pac - when you say they - you have multiple files. Do you mean multiple models or obj mtl and png texture files for 1 model?

    Are you trying to put a download zip file into your Dropbox folder?

    Does sketch 3D export the 3 relevant files as a zip?

    I think the Dropbox assets on Codea will only show models if they are in the Dropbox root directory. So if you put them in folders you won't see them in the assets list although you can still address them in the folders.

    You need to put the obj mtl and png files in the main Dropbox folder if you want to see them in the Dropbox assets viewer.

    On the remote Dropbox storage the path is
    Dropbox:Apps/Codea/..... But you address that as Dropbox:.....

    Took me a while to get used to it. Could be a good thing to add to the wiki.
  • pacpac
    Posts: 208

    It’s okay I have found my own way to move the files around. I just use the files app on my iPad and I can take the files from the 3D Sketch and put them directly into the Dropbox assets of Codea.

  • edited December 2018 Posts: 1,226
    @pac - you can move files around with the Apple File app. I also use File Explorer Pro. I find it to be very messy - that is to move/transfer/copy on the iPad, seems to be a few different ways which can be confusing.
  • pacpac
    Posts: 208

    Thanks @Bri_G I will try that out.

  • pacpac
    Posts: 208

    Okay do you guys use sketch 3D?

    If you do could you tell me how to bet the colors to come out right. My colors come out all messed up.

    Please help if you can.

  • Posts: 1,226
    @pac - installed but found it hard to use.
  • dave1707dave1707 Mod
    Posts: 7,604

    I tried sketch 3D and found it hard to use also. It’s not very intuitive and takes a long time to figure out how to do simple things. I played with it for a couple of days and gave up on it.

  • pacpac
    Posts: 208

    That’s okay because I have decided that I am going to make a blocky game. And I think the best way to build to stuff I need to build would be to use the volex editor in codea but I don’t know how to get the volex format to load into my program. If you could show me that would be very helpful.

    Thanks @Pac

  • dave1707dave1707 Mod
    Posts: 7,604

    @pac I assume you mean the Voxel editor. With the editor running, if you tap the > in the upper left corner you get more options. There’s a load and save option that saves a file in Documents with a cvox extension. If you write your own code, you can read that file using the Voxel commands. I’ve never tried that so I can’t help now.

  • pacpac
    Posts: 208

    Okay thanks @dave1707 but I have already tried to get that to work and I don’t know how to get it to load and the Volex’s code is so complicated.

  • dave1707dave1707 Mod
    Posts: 7,604

    @pac The Voxel code is complicated, but like everything else, the more you use it the easier it gets. If you’re after a block type game, here’s some simple code to make a block type object and move it around. Just add more blocks to create what you want.

    displayMode(FULLSCREEN)
    
    function setup()
        assert(craft, "Please include Craft as a dependency")
        assert(OrbitViewer, "Please include Cameras (not Camera) as a dependency")
        scene = craft.scene()
        skyMaterial=scene.sky.material
        skyMaterial.sky=color(0, 62, 255, 255)
        skyMaterial.horizon=color(204, 223, 138, 255)
    
        scene.sun.rotation=quat.eulerAngles(0,0,-30)
        viewer = scene.camera:add(OrbitViewer, vec3(0,0,0), 20, 0, 600)
    
        tab={}
        table.insert(tab,create(0,0,0))
        table.insert(tab,create(1,0,0))
        table.insert(tab,create(2,0,0))
        table.insert(tab,create(1,1,0))
        table.insert(tab,create(1,-1,0))
    end
    
    function update(dt)
        scene:update(dt)
    end
    
    function draw()
        update(DeltaTime)
        scene:draw()    
        for z=1,#tab do
            tab[z].position=tab[z].position+vec3(.01,.01,.01)
        end
    end
    
    function create(x,y,z)
        local b=scene:entity()
        b.position=vec3(x,y,z)
        b.model=craft.model.cube(vec3(1,1,1))
        b.material=craft.material("Materials:Standard")
        b.material.map ="Blocks:Glass Frame"
        return b
    end
    
  • dave1707dave1707 Mod
    edited January 2 Posts: 7,604

    @pac Here’s something to use when you create something in the Voxel editor. Create something using the Voxel editor then save it. To save it, tap the > in the upper left corner of the screen. Key in a name and press Save. It will be saved in the Documents folder, but you won’t be able to see the name there, so write done the name you use. Then use this code to Load it. You can use this code in whatever code you write. Use the parameter sliders to move the object here.

    function setup()
        assert(craft, "Please include Craft as a dependency")
        assert(OrbitViewer, "Please include Cameras (not Camera) as a dependency")
    
        parameter.text("Filename", 
            function(t) 
                saveProjectData("filename", Filename) 
            end)
    
        parameter.action("Load", 
            function()
                volume:load("Documents:"..Filename)
                sx,sy,sz=volume:size()
                viewer.target = vec3(sx/2, 0, 0)
            end)
    
        parameter.integer("vx",-10,10,0)
        parameter.integer("vy",-10,10,0)
        parameter.integer("vz",-60,60,0)
    
        scene = craft.scene()
        scene.ambientColor = color(77, 77, 77, 255)
        scene.sun.rotation = quat.eulerAngles(25, 125, 0) 
    
        volumeEntity = scene:entity()
        volume = volumeEntity:add(craft.volume, 0,0,0)
    
        viewer = scene.camera:add(OrbitViewer, vec3(0,0,0), 50, 0, 100)
    end
    
    function update(dt) 
        scene:update(dt)
        volumeEntity.x=vx
        volumeEntity.y=vy
        volumeEntity.z=vz
    end
    
    function draw()
        update(DeltaTime)   
        scene:draw()
    end
    
  • edited January 2 Posts: 1,226

    @dave1707, @Simeon - just tried to run VoxelEditor on my system and it came up with an error in the editor. Pic attached. Cameras included as dependency.

    Edit: similar error with Voxel Terrain and Voxel Player.

  • dave1707dave1707 Mod
    edited January 2 Posts: 7,604

    @Bri_G Try checking UI, Touches, Block Library, and Cameras as dependencies and see if that works. I’m on the latest version and not having trouble with just Block Library checked for the Voxel editor. The other ones need more things checked.

  • pacpac
    Posts: 208

    Thanks Dave you are a game saver.

    Thanks

  • pacpac
    Posts: 208

    Okay Dave in the program were it loads in the info from the volex editor you may want to change your code you have it looking for it in the dropbox file but I saw it so thank-you for writing your comment correctly.

    Thanks @dave1707

  • dave1707dave1707 Mod
    edited January 2 Posts: 7,604

    @pac Thanks for noticing that, I thought I changed it. I had Dropbox in both my code and the Voxel Editor because you can’t see/delete it from the Documents folder. At least when I use the Codea Dropbox folder and sync it with the Dropbox app, I can see and delete it in Dropbox which will delete it from the Codea Dropbox folder when I do a sync.

    @Simeon Are changes ever going to be made so we can see every file in the Documents and Dropbox folders.

  • SimeonSimeon Admin Mod
    Posts: 4,958

    @dave1707 the plan is to remove the Dropbox folder and instead allow files to be referenced or copied from anywhere using the document picker

    But you're right that we should just show all file types when viewing assets. I'll look into that soon.

  • Posts: 1,226

    @dave1707 - no, sorry but it doesn’t work on my iPad Pro, latest iOS and 2.6.3 (136). Most of the dependencies were already set, I set UI. But I noticed in Voxel Editor there is a UI tab and a ‘ui’ class. Could there be a clash there?

  • pacpac
    Posts: 208

    Okay @dave1707 one more thing is that I need to have custom textures for the blocks so do you know how to make it so I can change the textures.

    Thanks

    If you can’t don’t worry about it.

  • dave1707dave1707 Mod
    Posts: 7,604

    @Bri_G Have you tried pressing “Restore All Examples” and see if that helps. If that doesn’t work for you, let me know and I’ll load the latest code on my iPad Pro and try it.

  • dave1707dave1707 Mod
    Posts: 7,604

    @pac At this point I don’t know, but I’ll look into it.

  • pacpac
    Posts: 208

    No Dave don’t.

    Could some just please tell me how to scale down the 3D objects.

    But if you do work out how to put on custom texture that will work to. But I would prefer this to know how to scale the objects down.

    Thanks

  • pacpac
    Posts: 208

    Sorry stupid me I went and looked at my code and found how to scale things. So I got it now.

  • dave1707dave1707 Mod
    edited January 3 Posts: 7,604

    @pac If you’re referring to my code above, add this line at the end of setup(). Change the 5 to whatever value you need.

        volumeEntity.scale=vec3(1,1,1)/5
    
  • edited January 3 Posts: 1,226

    @dave1707 - tried restoring examples and still gives the error. Down to line 3 in the UI tab.

    Update: Closed Codea after latest test and re-ran then tried the examples that threw out the error and they all work. Can’t explain this!!!! One thing I noticed the UI tab after restoring the examples was much bigger than it was before. Also UI throughout that tab in upper case not lower case. Really weird.

  • pacpac
    Posts: 208

    Okay so I have a function that needs to call the your function that loads stuff in but it has it so that every time I have it load a new object the last one disappears.
    Can you tell me how to have it so that I can load a group of objects and have them all stay on the screen.

    Thanks pac

  • dave1707dave1707 Mod
    Posts: 7,604

    @pac Try looking thru the Froggy example. That project uses a lot of different multiple objects. I’ll look thru it also when I have more time. I’ll learn how it’s done too.

  • dave1707dave1707 Mod
    edited January 6 Posts: 7,604

    @pac Try this code. You’ll have to add your names where I have the load from Documents in the 2 classes. You can create a class for each of your objects then you can create multiple objects using the classes.

    function setup()
        assert(craft, "Please include Craft as a dependency")
        assert(OrbitViewer, "Please include Cameras (not Camera) as a dependency")
    
        scene = craft.scene()
        scene.ambientColor = color(77, 77, 77, 255)
        scene.sun.rotation = quat.eulerAngles(25, 125, 0) 
    
        viewer = scene.camera:add(OrbitViewer, vec3(0,0,0), 50, 0, 100)
    
        ob1=obj1(0,0,0)
        ob2=obj2(5,5,5)
        ob3=obj1(-10,-5,-5)   
    end
    
    function update(dt) 
        scene:update(dt)
        ob1:move()
        ob2:move()
        ob3:move()
    end
    
    function draw()
        update(DeltaTime)   
        scene:draw()
    end
    
    obj1=class()
    
    function obj1:init(x,y,z)
        self.entity=scene:entity()
        self.volume=self.entity:add(craft.volume,0,0,0)
        self.volume:load("Documents:obj1")
        self.entity.x=x
        self.entity.y=y
        self.entity.z=z
    end
    
    function obj1:move()
        self.entity.x=self.entity.x+.01
        self.entity.y=self.entity.y+.01
        self.entity.z=self.entity.z+.01
    end
    
    obj2=class()
    
    function obj2:init(x,y,z)
        self.entity=scene:entity()
        self.volume=self.entity:add(craft.volume,0,0,0)
        self.volume:load("Documents:obj2")
        self.entity.x=x
        self.entity.y=y
        self.entity.z=z
    end
    
    function obj2:move()
        self.entity.x=self.entity.x-.01
        self.entity.y=self.entity.y-.01
        self.entity.z=self.entity.z-.01
    end
    
  • pacpac
    Posts: 208

    Okay thanks I will try that code. And just to say I can’t look through froggy something is wrong with it and it crashes if I try to load the project.

  • pacpac
    Posts: 208

    Okay I put in my code and changed the names and it worked at first the object3 throw me off because there were two of the same objects but after that it is working fine now.

  • pacpac
    Posts: 208

    Thanks Pac

  • dave1707dave1707 Mod
    Posts: 7,604

    @pac There shouldn’t be any reason for Froggy to crash just because you load the code. If you think something is wrong with the code you can restore it. Start Codea and press the gear icon in the upper right of the screen. Scroll to the bottom and there’s a button that says Restore All Examples. Press that and all the examples will be reloaded.

Sign In or Register to comment.