]> git.sesse.net Git - nageru/commitdiff
Allow calling disable() on everything that has an IdentityEffect as alternative.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 15 Jun 2019 22:02:56 +0000 (00:02 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 15 Jun 2019 22:02:56 +0000 (00:02 +0200)
nageru/scene.cpp
nageru/theme.lua

index a3d3c6a20f172496f58b1509b82c59eccb0050e8..bebaa56d1af3b71b86f7868d9f4b345860267f3b 100644 (file)
@@ -537,11 +537,10 @@ int Block_disable(lua_State *L)
        assert(lua_gettop(L) == 1);
        Block *block = *(Block **)luaL_checkudata(L, 1, "Block");
 
-       if (block->alternatives.size() != 2 ||
-           block->alternatives[1]->effect_type != IDENTITY_EFFECT) {
-               luaL_error(L, "disable() called on something that wasn't added with add_optional_effect()");
-       }
        block->currently_chosen_alternative = find_index_of(block, IDENTITY_EFFECT);
+       if (block->currently_chosen_alternative == -1) {
+               luaL_error(L, "disable() called on something that didn't have an IdentityEffect fallback (try add_optional_effect())");
+       }
        assert(block->currently_chosen_alternative != -1);
        return 0;
 }
index e117e62949f4472e736fe03574fbfaf5fc50e8ea..596108d5f0db710ebfd911d572d008becb56c5d3 100644 (file)
@@ -408,7 +408,7 @@ function setup_simple_input(state, signals, signal_num, width, height, hq)
                simple_scene.resample_effect:set_int("width", width)
                simple_scene.resample_effect:set_int("height", height)
        else
-               simple_scene.resample_effect:choose_alternative(2)  -- No scaling.
+               simple_scene.resample_effect:disable()  -- No scaling.
        end
        set_neutral_color_from_signal(state, simple_scene.wb_effect, signal_num)
 end