Ignore:
Timestamp:
09/11/09 05:40:45 (3 years ago)
Author:
james
Message:

Add revmixin and nomixin options to %VAR, to allow the gender-mixin stuff to be controlled

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/abstract.tcl

    r1026 r1031  
    6666# fileformat is simply one per line. 
    6767 
     68# default = mixin own gender 
     69# reverse = mixin opposite gender 
     70# none = don't mixin at all 
     71set BMOTION_MIXIN_DEFAULT 0 
     72set BMOTION_MIXIN_REVERSE 1 
     73set BMOTION_MIXIN_NONE 2 
     74 
    6875if { [bMotion_setting_get "abstractMaxAge"] != "" } { 
    6976  set bMotion_abstract_max_age [bMotion_setting_get "abstractMaxAge"] 
     
    340347 
    341348        set contents [bMotion_abstract_all $abstract] 
    342         putlog $contents 
    343349 
    344350        if {[llength $contents] == 0} { 
     
    366372} 
    367373 
    368 proc bMotion_abstract_get { abstract } { 
    369         bMotion_putloglev 5 * "bMotion_abstract_get ($abstract)" 
     374proc bMotion_abstract_get { abstract { mixin_type 0 } } { 
     375        bMotion_putloglev 5 * "bMotion_abstract_get ($abstract $mixin_type)" 
    370376  global bMotion_abstract_contents bMotion_abstract_timestamps bMotion_abstract_max_age bMotion_abstract_last_get bMotionInfo 
    371377 
     
    388394 
    389395        # look for male and female versions, and merge in if needed 
    390         if [bMotion_abstract_exists "${abstract}_$bMotionInfo(gender)"] { 
    391                 # mix-in the gender one with the vanilla one 
    392                 bMotion_putloglev 1 * "mixing in $bMotionInfo(gender) version of $abstract" 
    393                 set final_version [concat [bMotion_abstract_all $abstract] [bMotion_abstract_all "${abstract}_$bMotionInfo(gender)"]] 
    394         } else { 
    395                 set final_version [bMotion_abstract_all $abstract] 
    396         } 
    397  
     396        set final_version [bMotion_abstract_all $abstract] 
     397        switch $mixin_type { 
     398                0 { 
     399                        if [bMotion_abstract_exists "${abstract}_$bMotionInfo(gender)"] { 
     400                        # mix-in the gender one with the vanilla one 
     401                                bMotion_putloglev 1 * "mixing in $bMotionInfo(gender) version of $abstract" 
     402                                set final_version $final_version [bMotion_abstract_all "${abstract}_$bMotionInfo(gender)"]] 
     403                        } else { 
     404                                set final_version [bMotion_abstract_all $abstract] 
     405                        } 
     406                } 
     407                1 { 
     408                        if {[bMotion_setting_get "gender"] == "male"} { 
     409                                set gender "female" 
     410                        } else { 
     411                                set gender "male" 
     412                        } 
     413                        if [bMotion_abstract_exists "${abstract}_$gender"] { 
     414                        # mix-in the gender one with the vanilla one 
     415                                bMotion_putloglev 1 * "mixing in $gender version of $abstract" 
     416                                set final_version [concat $final_version [bMotion_abstract_all "${abstract}_$gender"]] 
     417                        } else { 
     418                                set final_version [bMotion_abstract_all $abstract] 
     419                        } 
     420                } 
     421                2 { 
     422                        # noop, we did it already before the switch 
     423                } 
     424                default { 
     425                        putlog "bMotion ERROR: unknown mixin type $mixin_type for abstract $abstract" 
     426                } 
     427        } 
    398428 
    399429        if {[llength $final_version] == 0} { 
     
    634664bMotion_abstract_revive_language 
    635665 
     666 
    636667bMotion_putloglev d * "abstract module loaded" 
Note: See TracChangeset for help on using the changeset viewer.