X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Fscene.h;h=32b3203410305dba14ae627122eee048eaa07459;hb=c0763f1f26189bdc2ee487e38ccb7e8fe77fac25;hp=83346647236eb0ecda7aa512ec1fead4172940bf;hpb=e4ebe67b6523038484df30d1d5fafc6055398acc;p=nageru diff --git a/nageru/scene.h b/nageru/scene.h index 8334664..32b3203 100644 --- a/nageru/scene.h +++ b/nageru/scene.h @@ -78,7 +78,7 @@ struct Block { size_t cardinality_base = 0; // Find the chosen alternative for this block in a given instance. - size_t chosen_alternative(size_t chain_idx) const { + int chosen_alternative(size_t chain_idx) const { if (chain_idx == size_t(-1)) { return currently_chosen_alternative; } else { @@ -88,7 +88,12 @@ struct Block { std::vector alternatives; // Must all have the same amount of inputs. Pointers to make things easier for Lua. std::vector inputs; // One for each input of alternatives[0] (ie., typically 0 or 1, occasionally 2). + std::vector disablers; // If any of these are disabled (IdentityEffect chosen), so should this one. int currently_chosen_alternative = 0; + // What alternative to use if the block is disabled. + // Points to an alternative with IDENTITY_EFFECT if it exists + // (to disable as much as possible), otherwise 0. + int canonical_alternative = 0; bool is_input = false; // For LIVE_INPUT* only. We can't just always populate signal_to_connect, @@ -117,6 +122,7 @@ int Block_choose(lua_State* L); int Block_enable(lua_State *L); int Block_enable_if(lua_State *L); int Block_disable(lua_State *L); +int Block_always_disable_if_disabled(lua_State *L); int Block_set_int(lua_State *L); int Block_set_float(lua_State *L); int Block_set_vec3(lua_State *L); @@ -152,7 +158,7 @@ private: std::bitset<256> find_disabled_blocks(size_t chain_idx) const; void find_disabled_blocks(size_t chain_idx, size_t block_idx, bool currently_disabled, std::bitset<256> *disabled) const; - // If a block is disabled, it should always have alternative 0 chosen, + // If a block is disabled, it should always have canonical_alternative chosen, // so that we don't instantiate a bunch of irrelevant duplicates that // differ only in disabled blocks. You can check this property with // is_noncanonical_chain() and then avoid instantiating the ones where