I have a 3D obj model that I want to include in my project’s .zip, but I can’t move it directly from the documents folder to my project.
How do I get a custom obj into my project?
I’m sorry to be redundant; I know there’s a forum post on this already, because I searched it and found it before—but for the life of me I can’t remember the search terms I used, and now nothing seems to bring up the same article.
Did the ability to do this easily get removed, or is my mind playing tricks on me and we never had it?
I think there used to be an option to move something from the documents/dropbox folder to the project folder. You used to select what you wanted to move, then select Edit, then AddTo, then the Project folder.
@UberGoober Here’s how I do it now. Put the 3 lines in the setup function below into the setup function of the project you want the object to be in. Change the names that you want to read and save. Run the code. It will do the read and save then error out on the stop() function call. What you want should be in the project folder now. Remove the three lines from your code.
-- copy images from Documents/Dropbox folder to local folder
I don’t think it was ever possible for obj/mtl. Did request it a long time ago.
This appears to only work for images? Have you had it work with OBJ models?
@UberGoober - I’d move your assets into a 3D.assets folder on your iPad in the Codea room folder. You also need to add a png icon for that folder (copy one from another assets folder) and a plist text file (again copy from another assets folder). You should then be able to directly load them from the assets windows in Codea.
@UberGoober Instead of readImage and saveImage, try using readText and saveText.
I don’t need a way to access the obj files myself, I need a way to include them in my project so that the project is self-contained and runs for other people without them having to download anything else. Like it would need to be for WebRepo, for example. I don’t have trouble accessing them so I can use them, I have trouble moving them so other people can use them.
I know getting obj files into a project is possible because I have projects from WebRepo that do it.
@dave1707 I’ve tried a lot of variations of reading and saving images and projectData and like that, haven’t found any that worked. Here’s what I just did based on your suggestion:
- This did create an ANT asset in my projects folder, visible in the autocomplete after I type ‘asset.’
- Unfortunately, the asset is not recognized as a model by either the asset browser or the command
@UberGoober Try putting an extension on the file name .obj .
I’ve tried that already, no luck. Is this something you’ve used yourself for obj files?
@UberGoober I don’t remember. I use the readImage/saveImage code a lot and I found some old projects that used readText/saveText on obj and mtl files for something else, so I thought readText/saveText would work. I’ve never tried moving obj or mtl files to the project folder, just sprites.
Hi, @UberGoober-- sorry I’ve been off the forum for a while.
I’m still on the App Store version of Codea, are you? I’m not sure if it’s been remedied on Codea beta versions, but I’ve always found it hard to get .obj or other model files into a project to zip directly from the Codea app. The problem is that when you click on the “assets” tab inside of your Codea project, it lets you pick something from your document folder (such as an .obj model) but then doesn’t let you “add to” the proper storage container in the asset folder of that project (i.e. it only lets you pick storing that .obj model back into your Codea documents folder on your device or dropbox).
Thus, as a workaround, for some time now I’ve used one of the other forum member’s suggestions: I purchased the Textastic app. It is a bit pricey, but I think it is worth it as the best IDE to code multiple type of projects on your iOS mobile device. In terms of Codea, what it lets you do is link to a folder on your device (e.g. I link Textastic to my Codea “documents” folder which contains both my Codea projects and all the assets I might want to put in any of the project). Then you just use the Textastic app to select the asset you want in your Documents folder (e.g. your .obj model) and “copy to” your Codea project in Textastic. When you’ve done that, you’ll see the model appropriately stored in your Codea project’s asset folder and ready to zip up. Please see the attached screenshots where I illustrate those steps.
I hope that helps! Maybe the process has gotten (or will get) easier in future Codea iterations.
Hi @SugarRay , I was hoping you’d speak up, as your projects are the ones I was referencing that I saw contained obj files of their own. Hope all is going well with you, and is that crab thing just a demo or a real project? In either case it looks cool!
@SugarRay — your method gave me an idea, and it worked!
Working Copy can import files directly into Codea projects!
So, to all concerned: if you use the Working Copy app for versioning—and I think it’s great for that—keep in mind it’s a quick and easy way to import things into your projects.
That’s great to hear, @UberGoober, that another app like Working Copy can also import files into Codea projects
And, yes, things are going okay-- thanks for asking. The crab was an old project. Built some skills up in Love2D, and @Steppers new JS project and subsequent WebR project attracted me back as it seems to have more potential than the R-lua bridge I was using in Love2d.