Howdy, Stranger!

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

Codea Craft 2.5 (84) Beta - Updated 8/9/2017

13

Comments

  • dave1707dave1707 Mod
    Posts: 8,387

    @CamelCoder @piinthesky What were each of you doing that caused the tabs to be deleted. Are they deleted while you're editing the code, when you first open a project, after the project is executed, etc. If you can describe what you were doing when the tabs got deleted, maybe that will help them to track down the error and fix it. I don't use a lot of tabs, so I've never had that problem which is why I'm asking what each of you were doing. I guess I could create a project and keep adding tabs, but maybe I'll wait to hear your causes before trying to duplicate the problem.

  • Posts: 237

    @dave1707 it's random at best. When you open a project, you just realize that some tabs are gone. It only happens for me with projects with at least 20-some tabs. It happens to the last tabs.

  • dave1707dave1707 Mod
    Posts: 8,387

    @CamelCoder Thanks. That means the problem could be when the project is opening (reading) or when it's being closed (saving). I have a test project with 50 tabs/classes that I'm trying anything with. No problems so far. Maybe I'll add more tabs/classes.

  • SimeonSimeon Admin Mod
    Posts: 5,362

    @CamelCoder @piinthesky I'm trying to get this one fixed today. What devices are you using?

  • Posts: 237

    @dave1707 if you just add a ton of empty classes, I don't think it would work, just add like 1000 lines of lorum ipsum on each tab in the form of a string, and then keep running it. Again, its very random, it may not even happen for you, and it also doesn't happen very often

  • SimeonSimeon Admin Mod
    Posts: 5,362

    @CamelCoder I'm trying to replicate by duplicating the Cargo-Bot project and rapidly opening / closing it, editing it, closing it, and so on. So far I have not been able to reproduce. Does this trigger it for you?

  • JohnJohn Admin Mod
    edited June 2017 Posts: 616

    @piinthesky @CamelCoder have you tried archiving and looking at the project folder on a computer to see if its the tabs that are missing or just the tab info that is corrupted / missing in the Info.plist file? In the beta version you can also grab the project straight out of iTunes using File Sharing.

  • Posts: 237

    @Simeon I don't know what triggered it for me to be honest. I was just working on my game Mazoo - The Ultimate 3D Maze and it had a lot of tabs and a lot of code on each of the files. Then, I would open it, and like once in a while (every 100 times or so), it would crash.

    @John I haven't really been using my iPad lately because my iPad's screen is getting fixed, so I'm sorry, can't really test it

  • Posts: 529

    @john i exported the affected project to my mac....the missing tabs are not listed in the 'buffer order' and are not listed in the .codea directory. So as far as i can tell there is no obvious 'corruption'.

    I have managed to regenerate the code which disappeared, so feeling better now!
    I will be more disciplined with my backups from now on and will start putting multiple classes in a single tab!

    Keep up the excellent work with wonderful Codea.

  • dave1707dave1707 Mod
    Posts: 8,387

    @piinthesky @CamelCoder Do you remember if you had a lot of other apps loaded or just Codea. Just trying to think of anything that might be a cause.

  • Posts: 175

    @Simeon @John @dave1707 @piinthesky @CamelCoder Not sure whether this will be any help because the affected project had under 10 tabs but I think I may have seen this once when I tried to run a project after renaming a tab I found another tab had mysteriously vanished.

    At the time I thought nothing of it and just restored it from Working Copy assuming that I had deleted it by accident whilst prodding for the rename button. Except I remember that something odd happened before it that could be related.

    I had left my iPad idle for a while, perhaps 15-30mins, maybe more with another app focused. Then when I switched back to Codea it froze and then crashed(?) back to the projects screen so I had to reopen the project.

    I don't know whether the tab was lost immediately after reopening the project, upon renaming the tab or I really did just delete it by mistake :D. It hasn't happened since although I still see the freezing back to projects screen thing happening sometimes, generally after coming back from putting my iPad down for a bit.

  • Posts: 529

    @dave1707, yes normally i have lots of other apps loaded

  • Posts: 237

    @dave1707 I literally keep constant on swiping up all my apps, except Codea. Codea is always the only app loaded for me. Besides maybe sometimes Clash Royale, but not often, and probably not when it happened

  • dave1707dave1707 Mod
    Posts: 8,387

    @Simeon @John When does a tab get saved. If the contents of a tab is changed, does the tab get saved when switching to another tab, or does everything get saved only once when exiting Codea. Trying to get as much info as possible on a cause.

  • dave1707dave1707 Mod
    Posts: 8,387

    @Simeon @John I've been trying different things to get the tabs to delete themselves, but I ran into something interesting that might help. I created a project and ran the code below. It would print Main as the tab name, and then show the code in Main. When I created a class/tab Z1 and ran the code, it printed Main as the tab name and listed the Main code, printed Z1 as the tab name but then printed an error message. It was as if the class code was being shown in the editor, but wasn't saved anywhere to be read. When I closed the editor and then opened the code again and ran it, it printed both tabs OK. I created another class/tab and ran the code. It printed Main and the first tab OK, but then it printed the new class/tab name and then an error message when it tried to print the new class code. I was able to do that several times with other new class/tabs. I tried to get more specific trying other things, but then I couldn't get it to happen anymore. I should have saved what the error message was, but I didn't think it would stop happening since it did it right away and kept happening. Basically the error was that there wasn't anything to read for the class/tab I just created. I'll keep playing around with this to see if I can get it to happen again. There wasn't anything special I did before this happened. I just thought I'd try doing this and was surprised when I got the error.

    function setup()
        tab=listProjectTabs()
        for a,b in pairs(tab) do
            print(a,b)
            print(readProjectTab(b))
        end
    end
    
  • dave1707dave1707 Mod
    Posts: 8,387

    @Simeon @John Here's something else I ran into when trying to duplicate tabs disappearing. Try this; create a project called B1 (note upper case B). Replace the code with the code below (note the lower case b) in listProjectTabs. Add a new class/tab to the project with any name you want. Run the code and it will print the code shown below without showing the added class/tab code. Change the lower case b to B and run the code again. It shows the code below and the class/tab code. I expected when the code is run with the lower case b to not show any code because there isn't any project called b1. But if I add a comment to the Main code and run it as b1, it shows the comment that was added, but without the class/tab code. So I'm not sure what's going on with updating the code and why a lower case b shows the Main code without the tab code, but the upper case B shows all the code.

    function setup()
        tab=listProjectTabs("b1")
        for a,b in pairs(tab) do
            print(a,b)
            print(readProjectTab(b))
        end
    end
    
  • Posts: 69
    I tested mapping a planet surface texture around a sphere using craft, and it worked pretty well! However there is one small bug wich i know how to fix. Here is a small example video:


    Also now I wonder, can I save a mesh I created using Craft as a .obj file?
  • Posts: 69
    What is the default coordinate plane and the default rotation in craft?
  • edited June 2017 Posts: 69
    @John or @Simeon
    When creating a custom mesh, I always get a error when resizeing the indicescount:
    ~~~
    function setup()

    mesh = craft.mesh()
    mesh:resizeIndices(300)

    end
    ~~~

    Btw I have craft selected in the dependencies, and I wrote this code from scratch(I didnt copy the code from my Ipad, but On there I am pretty sure its correct and the same thing as above. Is this a bug or something?

    Edit: So I found out its a bug in Codea, and the actual method name is resizeIndicies()
    I am not sure tough about the resizeVertices(), it doesnt work either. Please @John fix this for the next update.
  • Posts: 11

    Would anybody mind giving me an example of how I might go about creating a flat plane custom mesh?

  • Posts: 237

    @KidKoder Are you talking about making it with or without the craft module? Either way, there are examples on this thread (Just go to page 1), and on other places in the forums

  • JohnJohn Admin Mod
    Posts: 616

    @XanDDemoX
    I tried running your sample code that is supposed to trigger a crash but I couldn't get it to happen. I'll keep trying though.

    The same thing occurred with assertions not stopping the update function immediately.

    As for the raycast issue. This is because when moving entity references from c++ to lua they are wrapped in a special reference object. I need to make some kind of cache in the registry for this so that the same lua object will be returned each time allowing for it to be used as a table key.

  • JohnJohn Admin Mod
    Posts: 616

    @GR00G0 This is a bug. The method should be called resizeIndices() as you said. resizeVertices() was renamed to resize()for potential future compatibility with mesh. For now I'll probably allow both variations. Proper documentation for the new mesh class is coming along and should be in the next update.

  • Posts: 11

    @CamelCoder sorry, I could gave been more clear earlier. Yes, I'd like to create a flat plane mesh in CC specifically. The goal is to create a grid of many vertices that I can manually adjust the height of to create terrain. I haven't seen this yet on this thread (even on page 1)

  • Posts: 69
    I created an empty mesh, added positions to it( yes everything does divide by three) added it with the craft.renderer to a entity, but for some reason it doesnt render at all. I tried everything now, I added correct slightly higher normals, colors, and it just doemst show up. So I wonder now what does a mesh need to be rendered?
  • edited June 2017 Posts: 113

    When I run an example on iPad, it is ok, but when I run it from aircode, it returns error:

    E1:3: attempt to index a nil value(global 'craft')
    stack traceback:
    E1:3: in function 'setup'

    below is the example:

    function setup()
        -- create a new entity
        myEntity = craft.entity()
    
        local r = myEntity:add(craft.renderer, craft.mesh.cube(vec3(1,1,1)))
        r.material = craft.material("Materials:Standard")
        r.material.map = readImage("Blocks:Brick Red")
    
        myEntity.position = vec3(10,10,10)
        myEntity.rotation = quat.eulerAngles(45,45,45)
        myEntity.scale = vec3(0.5, 0.5, 0.5)
    
        myEntity:add(craft.rigidbody, DYNAMIC, 0.5)
        myEntity:add(craft.shape.box, vec3(1,1,1), vec3(0,0,0))
    
        childEntity = craft.entity()
        childEntity.parent = myEntityCopy
    
        -- 
        craft.scene.camera.position = vec3(0,0,5)
        craft.scene.camera.rotation = quat.eulerAngles(0,0,180)
    end
    
    
    function update()
    
    end
    
    function draw()
    
    end
    

    And @John or @Simeon I have a suggestion: Do we have a bug list to show the status of the known bugs?

    Another bug: in build-in example Voxel Editor, if I do something and save it with the name wolf, my voxel model will cover the wolf model, then I select restore example, the old wolf can not restore.

  • Posts: 69
    @John can you give me a small example of how I can renderer an empty Mesh, to wich I added all the positions? It just doesnt work for me for some reason
  • Posts: 175

    @GR00G0 I'm not sure that we can create a custom craft.mesh programmatically yet. Looking at craft.mesh.___class there doesn't appear to be a way to set vertex indices yet. Although addElement seems to be a good candidate, calling it with some vertex indexes doesn't seem to have any effect.

    Compare mesh.indexCount and mesh.vertexCount for a craft.mesh.cube to your mesh. I think you'll see why it's not being displayed.

  • Posts: 69
    @XanDDemoX They are both the same. And whhat about position(i,v)?
  • Posts: 71

    Does anyone know how to find the bounds of a rigidbody? I'm thinking like the example "Models" bounds function, but instead of outlining the bounds of a mesh, outlining the bounds of a dynamic or static body. The reason I'm asking is because this (video) is happening. All suggestions are much appreciated! :smile: https://dropbox.com/s/9iy14un5pihvuw0/Problem.MP4?dl=0

  • JohnJohn Admin Mod
    Posts: 616

    @GR00G0 The next beta release will have some major updates and fixes for mesh giving you all those features as well as documentation for it and at least one example.

    @Attila717 That doesn't exist yet but I can add it

  • JohnJohn Admin Mod
    Posts: 616

    @binaryblues We haven't got craft working with Aircode just yet.

  • Posts: 175

    @GR00G0 You are correct, I forgot to test for a second parameter for index and position. I overlooked those functions a little from seeing explicit get and set functions in craft.mesh.___class.

    It looks like we're missing something because even copying the geometry etc directly from a craft.mesh.cube doesn't display anything.

        e = craft.entity()
        m = craft.mesh()
        cube = craft.mesh.cube(vec3(1,1,1))
        m:resize(cube.vertexCount)
        m:resizeIndicies(cube.indexCount)
        for i=0, cube.vertexCount-1 do
            local pos = vec3(cube:position(i))
            m:position(i, pos )
        end
        for i=0, cube.indexCount-1 do
            m:index(i,cube:index(i))
        end
        for i=0,cube.vertexCount-1 do
            local n = vec3(cube:normal(i))
            m:normal(i,n)
            m:color(i,color(cube:color(i)))
            m:uv(i,vec2(cube:uv(i)))
        end
    
        local renderer = e:add(craft.renderer,m)
        renderer.material = craft.material("Materials:Standard")
        renderer.material.map = readImage("Blocks:Brick Red")
        e.position = vec3(0,0,0)
    
        craft.scene.camera.rotation = quat.eulerAngles(0,180,0)
        craft.scene.camera.position = vec3(0,0,-10)
    
  • Posts: 71

    @John Thanks, that'd be an amazing debugging tool!

  • Posts: 69
    @XanDDemoX I guess we'll wait for the next beta, and if it doesnt work then, we can report it to the devs.
  • Posts: 69
    @XanDDemoX Ok. I when you first create a cube or icosphere, resize everything and add the geometry you want it does actually render. So I think this is a bug
  • JohnJohn Admin Mod
    Posts: 616

    Build 80 is now available. If you find any issues with the examples or want to submit a pull request the examples are now available on github:
    https://github.com/JohnTM/Craft-Examples

    BETA NOTES
    - After installing a new version you should be prompted to restore examples, please make sure to press the restore button
    - For feedback / questions please visit codea.io/talk (PM simeon or john for access to the beta thread)
    
    NEW FEATURES - Craft
    - A new advanced feature-set with support for 3D environments, lighting, physics, voxels and more!
    - OBJ model loading (support for other formats coming in future updates)
    - Directional, point and spot lights
    - Advanced material system with support for physically based rendering
    - Voxel rendering and collisions with support for fully custom block types and scripting
    - Advanced noise system for terrain generation and other procedural content
    - 3D physics, with support for spheres, boxes, capsules and mesh shapes
    New Examples
    New Assets
    
    CHANGE LOG
    
    18/06/2017
    Examples
    - Added new examples: Craft Template, Lights & Planet Generator
    - Updated all examples to keep up to date with API changes
    Assets
    - Fixed some naming convention problems with Block asset pack
    Runtime
    - craft.scene 
        - Automatic scene management has been removed in favor of manual scene management
        - All existing craft projects will be affected by this and must be updated
        - See Craft Template for an example of a minimal project that demonstrates this
    - craft.entity
        - Must now be created using scene:entity() istead of craft.entity()
    - craft.light
        - intensity property now works
        - multiple lights now work correctly
        - color property now takes a color() object instead of a vec3() object
        - penumbra and angle properties now work correctly for spot lights
    - craft.cubeTexture
        - constructor now takes 6 image() objects directly (instead of asset strings)
        - order is: +X, -X, +Y, -Y, +Z, -Z
        - future versions may be altered again
    - rendering
        - shaders are now optimised before being compiled, this should improve loading and rendering speed in general
    
  • Posts: 113

    [Build 80]

    Crashed: Open the built-in reference, click craft.entity, Codea will crash.

  • edited June 2017 Posts: 505

    @binaryblues @John Same here.

    IMG_0173.PNG 661.3K
  • edited June 2017 Posts: 69
    Does anyone have an example of a non voxel world?
    And how does the setWithNoise method work?
  • JohnJohn Admin Mod
    Posts: 616

    Thank @binaryblues @se24vad this will will be fixed in the next release.

  • JohnJohn Admin Mod
    edited June 2017 Posts: 616

    @GR00G0 Craft does not support smooth terrain at this time (as a feature). You can generate terrain using mesh and noise functions though. See the Planet Generation example (make sure to reset examples) for some of the ground work.

  • Posts: 113

    I have 2 questions:

    1. How to import Model files( obj + mtl )? I have seen the example of load models, but these model files were already in Codea, I wish to use my own model files.

    2. How to create a skybox? Wish to provide an example.

    Who know the solution? thanks!

  • dave1707dave1707 Mod
    Posts: 8,387

    @Simeon @John Running the latest version of the Codea Beta, it deleted 25 of my projects and everything in my Dropbox folder. I figured I'd just sync the Codea Dropbox folder with the Dropbox app folder to get the Codea Dropbox folder back. Wrong. Since the files in the Codea Dropbox folder were deleted, the files in the Dropbox app folder were deleted when synced. No big deal there because I also have the Dropbox app files copied in a Dropbox app backup folder. Another good thing I did was a Codea export a while back. I had to drop the Codea Beta back to the previous Codea regular version and update it to the version that allowed the import. I was able to import my deleted projects, but when I tried to import the files in the Dropbox folder, it said the folder already existed and wanted me to enter another name. So is there a problem there. Can the Codea Dropbox folder be deleted and a new one restored, or should it have just restored the exported files into the existing Dropbox folder. Getting back to the original problem, I don't know why Codea deleted all that stuff. I was playing around with creating a project in a collection when I noticed my missing projects. I know they were there before I started. I wasn't doing anything with deleteProject, so that wasn't involved. The projects that were deleted began with a . (period) or a number, and I don't know why the Dropbox folder was affected. I also haven't looked thru all of my projects to see if anything else was deleted. I'll eventually get everything back so it's no big deal. I wonder if this could be related to the deleted tab problem.

  • Posts: 69
    Does anyone know what I am doing wrong with custom meshes? Even when I copy all detail from a icosphere or cube it just dooesn't render anything?
  • dave1707dave1707 Mod
    Posts: 8,387

    It's hard to say what you're doing wrong if we can't see what you're doing. Post an example. Maybe one reason it's not working is because Craft isn't complete yet.

  • edited July 2017 Posts: 69
    @dave1707

    Here's what I did:

    ~~~
    e = scene:entity()
    m = craft.mesh()
    cube = craft.mesh.cube(vec3(1,1,1))
    m:resize(cube.vertexCount)
    m:resizeIndicies(cube.indexCount)
    for i=0, cube.vertexCount-1 do
    local pos = vec3(cube:position(i))
    m:position(i, pos )
    end
    for i=0, cube.indexCount-1 do
    m:index(i,cube:index(i))
    end
    for i=0,cube.vertexCount-1 do
    local n = vec3(cube:normal(i))
    m:normal(i,n)
    m:color(i,color(cube:color(i)))
    m:uv(i,vec2(cube:uv(i)))
    end

    local renderer = e:add(craft.renderer,m)
    renderer.material = craft.material("Materials:Standard")
    renderer.material.map = readImage("Blocks:Brick Red")
    e.position = vec3(0,0,0)

    craft.scene.camera.rotation = quat.eulerAngles(0,180,0)
    craft.scene.camera.position = vec3(0,0,-10)
    ~~~
  • dave1707dave1707 Mod
    edited July 2017 Posts: 8,387

    @GR00G0 I'm not exactly sure of everything your trying to do, but here's some code I have. I added the Blocks:Brick Red map you show to my code. You can compare this to what you're trying to do.

    function setup()
        parameter.integer("x",-180,180,45)
        parameter.integer("y",-180,180,30)
        parameter.integer("z",-180,180,60)
    
        scene=craft.scene()
        cube=scene:entity()
        cube.z=10
    
        r=cube:add(craft.renderer,craft.mesh.cube(vec3(1,1,1)))
        r.material=craft.material("Materials:Standard")
        r.material.map = readImage("Blocks:Brick Red")
        r.material.diffuse=color(255,0,0)
    end
    
    function update(d)
        cube.rotation = quat.eulerAngles(x,y,z)
    end
    
    function draw()
        update(DeltaTime)
        scene:draw()    
    end
    
  • Posts: 69
    @dave1707 That's the point. Creating the mesh with the craft.mesh.cube function works for me. But try to make a simple cube using an empty mesh. Please send me your results if you get any.
  • dave1707dave1707 Mod
    Posts: 8,387

    @GR00G0 I don't understand what you mean by using an empty mesh. What are you trying to accomplish with the empty mesh. I haven't played around with Craft that much because there's not enough documentation and it's still not complete.

Sign In or Register to comment.