Codea 3.10 Beta - New Beta Link

Not sure if it’s still the case, but with Block Library the hanging used to be from the sheer number of warnings about the deprecated asset format. I went into the relevant projects (it took more than one) and corrected every asset reference I could (iirc some Craft block-creation functions don’t support the new asset system), and then I could run them.

1 Like

Good find! Just a note that you can do viewer.showWarnings = false to stop these as well. Would you be able to share your corrections? It would be great to update the project instead

Sorry—I looked back and I actually fixed the modifications of those projects that I did for my texture pack. I don’t have a usable project file for this purpose.

1 Like

Thanks for the tap anywhere to close the menus !!! :grinning: :vulcan_salute:

2 Likes

@sim @John - version 436 Voxel Player locks out on me in 436. Couldn’t pull out the parameter window but that could be due to locking of screen. Eventually crashed on me when I closed Codea - reported via crash system.

Edit: Voxel Editor and Voxel terrain seemed to work OK as did AR and Voxel Editor AR but Block library had same freezing and crashing. Also, in Voxel terrain a lot of messages for deprecated asset strings produced. One single asset error message in Voxel Editor.

In Voxel Editor the block bar at the top seems slow to respond and sometimes takes ages to change block types. Suggest a bar at the bottom of the screen may be better with larger icons, possibly even a scrolling palette of them.

Weird, Voxel Terrain and Voxel Player should be fixed if you Restore All Examples. Not sure why they are not updating automatically

@sim - ooops, yes forgot to re-install demos. Did that but still getting issues as follows:

Crashes and other issues in Craft Demos

Asset strings project solid in Voxel Editor

Asset strings (“Project:Solid”) are deprecated. Please use static assets, e.g., asset. instead.

Block library still hangs up

Voxel terrain now giving following error

Craft/Voxel Terrain/Main.lua:81: attempt to index a nil value (global ‘viewer’)
stack traceback:
Craft/Voxel Terrain/Main.lua:81: in function <Craft/Voxel Terrain/Main.lua:54>

Voxel Player fine

Voxel Editor AR runs but is a little hit and miss with adding cubes also fires up an error

supportedOrientations is no longer supported

Asset strings (“Project:Solid”) are deprecated. Please use static assets, e.g., asset. instead.

Is there any way to add a flag to Codea updates that, if set, also automatically updates the demos and Craft ?

@sim funny bug….when editing two different Codea projects in split window mode, scrolling and inserting the cursor in one project can affect which part of the other project is visible in the other window!

By the way, i still see every now and then (less often than before) that selecting text by clicking on the line number will have a missing cut option.

A request…in the ‘enter code’ text box in the sidebar would it possible recall the previously entered text using the ‘up arrow’, which could then be used to repeat the previous command or allow it to be edited.

1 Like

Codea crashed on me twice whilst I was trying to load an old project. Added the code to the folder in the Codea root but then tried to add all the old assets into an assets folder in the root. Trying to access them caused an issue and crashed Codea after trying to run and after renaming the project folder to game.assets.

1 Like

@jfperusse - looking at the latest beta, trying to use require but not throwing up any error messages. I tried to use require in global space and the only response I obtained was a red triangle in the menu bar.

What is the accepted syntax for ‘require’ here.

I tried to use require in the setup, which did generate a response and threw up a list of errors which didn’t make a lot of sense.

I was trying to set up four separate projects to display menus which showed a different menu for each option.

Do you need to specify each required project as ‘project’.Codea or just as ‘project’ ?

Hi @Bri_G,

The new require() can be used with Asset Keys (e.g. asset.Documents.MyOtherProject), and I would recommend doing this in the global scope like you would do in other programming languages (#import, #include, using, etc.), but if you want to conditionnaly require some projects or files, this should work in other places as well.

The next beta, 3.10, which we’ll be making available soon, will include a picker in Codea that will make it easier to pick an Asset Key for require().

If you still have issues, please share sample code and the exact error message and I will investigate.

Thank you!

@jfperusse - thanks for the feedback, modified my code to include asset addressing and no issues there. Moving on to try out functionality.

That asset picker, if it’s what I think it is, would be very useful. It would save me building rectangles and ellipses to get coordinates etc and would be a good shortcut in development.

What I called the picker is the small window you get when tapping on an asset key, for example with sprite() to select the sprite to use.

The new picker is simply the same window, but adapted for require() specifically, with new “Import All” buttons to automatically fill require() with the asset key corresponding to the selected project.

Here’s a preview:

@jfperusse - Ahhh, I thought you meant something else with your asset picker. That will make things easier.
Ran into a problem with a simple trial. Posted code below for two Codea projects Master and Slave. Latter heavily edited to take out possible confusion. Could you tell me where Inam going wrong ?


-- Master
require(asset.documents.Slave)

viewer.mode = FULLSCREEN
function setup()
    --
    recFill = 1
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(40, 40, 50)
    for lpy = 400, 800, 400 do
        for lpx = 300, 600, 300 do
            ellipser(lpx, lpy, 200, 200, col[recFill])
        end
    end
    for lpy = 400, 800, 400 do
        for lpx = 300, 600, 300 do
            ellipser(lpx, lpy, 150, 150, col[recFill])
        end
    end
end

function rectAngle(rx, ry, rw, rh, col)
    --
    pushStyle()
        rectMode(CENTER)
        stroke(235, 236, 67)
        strokeWidth(4)
        fill(col)
        rect(rx, ry, rw, rh )
    popStyle()
end


col = {
        color(225, 124, 135),
        color(166, 223, 149),
        color(141, 151, 224),
        color(224, 136, 210)
        }

And


-- Slave

--[[
viewer.mode = FULLSCREEN
function setup()
    --
    recFill = 1
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(40, 40, 50)
    for lpy = 400, 800, 400 do
        for lpx = 300, 600, 300 do
            rectAngle(lpx, lpy, 200, 200, col[recFill])
        end
    end
    
end
]]

function ellipser(ex, ey, ew, eh, col)
    --
    pushStyle()
        rectMode(CENTER)
        stroke(235, 236, 67)
        strokeWidth(4)
        fill(col)
        rect(rx, ry, rw, rh )
    popStyle()
end


--[[
col = {
        color(225, 124, 135),
        color(166, 223, 149),
        color(141, 151, 224),
        color(224, 136, 210)
}   
]]

Error as follows

Hi @Bri_G ,

Like with dependencies, require will not include Main.lua when you specify another project as it would otherwise overwrite your setup and draw methods.

Please try moving what you want to share in separate files/tabs under Slave and let me know if this works.

Thank you!

@jfperusse - I’m having some odd crashes and problems with this version. Probably down to my way of re- installing some of my saved projects from my network. Lost all my files in the installation. But re-installed the current beta.

One thing that gave me a problem was trying to instal a 3D model coding in the form of model_obj, for file model.obj, has the file loading code changed ?

Funnily enough Codea recognised the 3D object as file.obj and displayed it as file_obj in the line picker above the keyboard. But, when run Codea hung up didn’t respond to touch and eventually crashed after dragging it off screen.

All,
Playing with some old files on my iPad with new beta keep getting an error as follows:

Main.lua:64: class(cubeTexture) expected, got class<assets.key>

I know @John was playing around with cube textures a few versions ago and explained, at the time, how to convert the typical t-shape file into a newer format. Has that new format been formalised and included into Codea ? and, is the current version of Codea firing out an error if you are trying to link to a standard png/jpg file ?

Edit: please note replaced the greater than and less than symbols with brackets, in the above error message, as they must be used in this forum to hide information.

Edit2: Forget the query - found the answer : I was just trying to load an image for the cube map but found the actual call for it as follows:

scene.sky.material.envMap = craft.cubeTexture(PNG/jpg file)

Was what was needed.

1 Like

@jfperusse - pulled back from my complicated require trial and tried something very simple… Two files included. I was trying to require a function in global space and call it from within the main Codea functions but it throws up errors. Are required functions in global space inaccessible?

The main file I call required


-- Requirer
require(asset.documents.PicShow)

-- Use this function to perform your initial setup
function setup()
    --
    pic = asset.documents.FloodpadAssets.bckgndtv
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(40, 40, 50)
    showPic(pic)

end

And the required file I call PicShow


-- ShowPics

function showPic(img)
    -- This loads a background image 
    spriteMode(CENTER)
    sprite(img, WIDTH//2, HEIGHT/2, WIDTH, HEIGHT)
end

P.s I tried putting the required address string in inverted commas but it gave no response other than a red triangle in the menu bar, no error message.

Hi @Bri_G,

asset.documents.PicShow corresponds to a Codea project called PicShow, not a file. Where is the file PicShow located?

Let’s say you have two Codea projects.

ProjectA
Main
SomeFileA1
SomeFileA2

ProjectB
Main
SomeFileB1
SomeFileB2

If you are in ProjectA, you can import all files (except Main) of ProjectB using require(asset.documents.ProjectB). This is like a project dependency.

If you are in ProjectA, you can also import SomeFileB2 only using require(asset.documents.ProjectB.SomeFileB2).

If you still have issues, please let me know under which projects those files are located so I can better understand the issue.

Thank you!

@jfperusse - thanks for the reply, I found my error. I had placed a function on the main file so it didn’t work. When I moved the function to a new blank file it worked properly. Yes, I was trying to duplicate the dependencies capability using require. I didn’t appreciate that all of the functions within the main file of the required project were inaccessible.
Thanks again.

1 Like