https://openbrush.app/ logo
Plugin Guide API inconsistent with both documentat...
# open-brush-bugs
a
message has been deleted
w
The Guides available from the UI are Plane, Sphere, Cube, Ellipse, and Capsule. The Guides listed in the [documentation](https://icosa.gitbook.io/open-brush-plugin-scripting-docs/readme/guide) are - Guide:NewCube(transform) - Guide:NewSphere(transform) - Guide:NewCapsule(transform) - Guide:NewCone(transform) - Guide:NewEllipsoid(transform) - Guide:NewCustom(transform, model) I use the following plugin to test all but Custom. I include Plane despite it not being listed in the documentation, since it is in the UI. The result is that Cube, Sphere, Capsule, and Ellipsoid all work, but Cone and Plane do not, so the Guide API seems to be inconsistent with both the documentation and the options available to the user directly. I believe Cone and Plane both cause
Main()
to terminate(it not progressing through the values forced me to increment at the top of the function instead of the bottom) though I am not 100% sure of this. Looking at the "Info" on the back side of my controller, I see that
Guide:NewPlane
gives `cannot access field`(suggesting that the documentation is correct) while Cone seems to fail silently.
Copy code
lua
Settings = {
    description = "Places one guide at the brush each time the trigger is pressed."
}

local nextGuide = 1

function Main()
    if not Brush.triggerPressedThisFrame then
        return
    end

    local t = Transform:New(Brush.position)

    currentGuide = nextGuide
    nextGuide = nextGuide+1

    if nextGuide > 6 then
        nextGuide = 1
    end

    if currentGuide == 1 then
        Guide:NewCube(t)
    elseif currentGuide == 2 then
        Guide:NewSphere(t)
    elseif currentGuide == 3 then
        Guide:NewCapsule(t)
    elseif currentGuide == 4 then
        Guide:NewEllipsoid(t)
    elseif currentGuide == 5 then
        Guide:NewCone(t) -- listed in docs, should work
    elseif currentGuide == 6 then
        Guide:NewPlane(t) -- not listed in docs, would be expected to exist
    end

end
Running the latest beta on SteamVR(build ID 24060468)
Updated Plugin with print statements confirms that Main is ending prematurely(for working Guides, I get "trying" immediately followed by "tried". For both Plane and Cone, I only get "trying" - and the error in case of Plane.)
Copy code
lua
Settings = {
    description = "Places one guide at the brush each time the trigger is pressed."
}

local nextGuide = 1

function Main()
    if not Brush.triggerPressedThisFrame then
        return
    end

    local t = Transform:New(Brush.position)

    currentGuide = nextGuide
    nextGuide = nextGuide+1

    if nextGuide > 6 then
        nextGuide = 1
    end

    if currentGuide == 1 then
        print("trying Cube")
        Guide:NewCube(t)
        print("tried Cube")
    elseif currentGuide == 2 then
        print("trying Sphere")
        Guide:NewSphere(t)
        print("tried Sphere")
    elseif currentGuide == 3 then
        print("trying Capsule")
        Guide:NewCapsule(t)
        print("tried Capsule")
    elseif currentGuide == 4 then
        print("Trying Ellipsoid")
        Guide:NewEllipsoid(t)
        print("Tried Ellipsoid")
    elseif currentGuide == 5 then
        print("trying cone")
        Guide:NewCone(t) -- listed in docs, should work
        print("tried cone")
    elseif currentGuide == 6 then
        print("trying plane")
        Guide:NewPlane(t) -- not listed in docs, would be expected to exist
        print("tried plane")
    end

end
a
Thanks for the report! I'll investigate and get back to you once I've cleaned this up.
w
Any update? Is there anything I can do to help?
a
Reminding me was a good one. I totally forgot about this! 😳
w
So did I until the plugin discussion in #783806589991780415
a
this should be fixed in the beta now