dynamic texture menus
This commit is contained in:
@@ -6,6 +6,7 @@ menuitem (_ [Mapmodels...]) [ showmenu Mapmodels ]
|
||||
menuitem (_ [Lighting...]) [ showmenu Lighting ]
|
||||
menuitem (_ [Entities...]) [ showmenu Entities ]
|
||||
menuitem (_ [Pickups...]) [ showmenu Pickups ]
|
||||
menuitem (_ [Textures...]) [ showmenu textures ]
|
||||
menuitem (_ [Skymaps...]) [ showmenu skymaps ]
|
||||
menuitem (_ [Ambient sounds...]) [ showmenu [Ambient sounds] ]
|
||||
menuitem (_ [Arches and slopes...]) [ showmenu Arches ]
|
||||
@@ -168,6 +169,8 @@ newmenu [Map config operations]
|
||||
|
||||
menuitem [Edit mapmodel slot...] [ showmenu [Edit mapmodel slots] ]
|
||||
menuitem [Delete unused mapmodel slot...] [ showmenu [Delete unused mapmodel slot] ]
|
||||
menuitem "" -1
|
||||
menuitem [Edit texture slot...] [ showmenu [Edit texture slots] ]
|
||||
|
||||
menuitem "" -1
|
||||
menuitem [Delete ALL unused mapmodel slots] [loop ii 256 [ push i (- 255 $ii) ; if (&& (strlen (mapmodelslotname $i)) (strcmp "" (mapmodelslotusage $i))) [deletemapmodelslot $i] ; pop i]]
|
||||
@@ -223,6 +226,158 @@ menuinit [
|
||||
newmenu [Delete unused mapmodel slot]
|
||||
menuinit __rebuildmapmodelmenus
|
||||
|
||||
tempalias __lastwatchedtexture ""
|
||||
tempalias __texslot ""
|
||||
|
||||
// Edit texture slots
|
||||
newmenu [Edit texture slots]
|
||||
menuinit [
|
||||
delmenu (curmenu)
|
||||
newmenu (curmenu)
|
||||
menurenderoffset -20 0
|
||||
if $editing [
|
||||
push ecurmenu (escape (curmenu))
|
||||
push i 0
|
||||
push info ""
|
||||
looplist (textureslotusagelist) cnt [
|
||||
info = (edittextureslot $i)
|
||||
if (|| $cnt (strlen $info)) [
|
||||
if (! (strlen $info)) [ info = " \fs\f3<unassigned>\fr" ]
|
||||
menuitem (concatword "edit texture slot #" $i ": " $info " (" $cnt " uses)") (concat alias __texslot $i "; showmenu [Edit texture slot]") (concat chmenutexture $ecurmenu (at $info 1))
|
||||
]
|
||||
+= i 1
|
||||
]
|
||||
pop i info ecurmenu
|
||||
] [
|
||||
menuitem "menu only available in edit mode" -1
|
||||
]
|
||||
]
|
||||
|
||||
// Edit texture slot
|
||||
newmenu [Edit texture slot]
|
||||
menuinit [
|
||||
delmenu (curmenu)
|
||||
newmenu (curmenu)
|
||||
if (strlen $__texslot) [
|
||||
push info (edittextureslot $__texslot) // "<scale> <path>"
|
||||
chmenutexture (curmenu) (at $info 1)
|
||||
menurenderoffset -20 0
|
||||
menuheader "" (concatword "edit texture slot #" $__texslot ":\n" (at $info 1))
|
||||
menuitemtextinput "Scaling factor [0..4] " (at $info 0) [edittextureslot $__texslot $arg1]
|
||||
menuitem "\f4factor 0 means default (1.0)" -1
|
||||
menuitem "" -1
|
||||
menuitem (concat "Distribution:" (gettextureorigin (at $info 1))) -1
|
||||
menuitem "" -1
|
||||
menuitemtextinput "Texture path " (concat result (at $info 1)) [edittextureslot $__texslot "" $arg1] "" 250
|
||||
if (&& (strlen $__lastwatchedtexture) (! (strcmp $__lastwatchedtexture (at $info 1)))) [
|
||||
menuitem (concat " change to" (escape $__lastwatchedtexture)) [edittextureslot $__texslot "" $__lastwatchedtexture]
|
||||
]
|
||||
menuitem "" -1
|
||||
menuitem "use as next (upper-)wall texture" [edittexturestack wall $__texslot]
|
||||
menuitem "use as next floor texture" [edittexturestack floor $__texslot]
|
||||
menuitem "use as next ceiling texture" [edittexturestack ceiling $__texslot]
|
||||
push __usage (textureslotusage $__texslot)
|
||||
if (&& $__texslot (listlen $__usage)) [
|
||||
menuitem "" -1 (concat gotoposition (gotoposition))
|
||||
looplist $__usage ii [
|
||||
menuitem (concatword "slot used by map entity #" $ii) (concat gotoentity $ii) (concat gotoentity $ii)
|
||||
]
|
||||
menuitem "" -1 (concat gotoposition (gotoposition))
|
||||
]
|
||||
if (strlen (pop __usage)) [
|
||||
if (> (listlen (textureslotbyname (at $info 1))) 1) [
|
||||
menuitem "" -1
|
||||
menuitem "Merge multiple slots using same texture" [showmenu "Texture slot merge"]
|
||||
]
|
||||
pop slots
|
||||
] [
|
||||
menuitem "" -1
|
||||
menuitem "\f3Delete unused slot" (concat deletetextureslot $__texslot)
|
||||
]
|
||||
pop info
|
||||
][
|
||||
menuitem "no slot selected" -1
|
||||
]
|
||||
]
|
||||
|
||||
tempalias __tex_joined ""
|
||||
tempalias __tex_togo ""
|
||||
|
||||
newmenu "Texture slot merge"
|
||||
menuinit [
|
||||
delmenu (curmenu)
|
||||
newmenu (curmenu)
|
||||
if (strlen $__texslot) [
|
||||
push info (edittextureslot $__texslot) // "<scale> <path>"
|
||||
chmenutexture (curmenu) (at $info 1)
|
||||
menurenderoffset -20 0
|
||||
menuheader "" (concatword "merge texture slots using\n" (at $info 1))
|
||||
menuitem (concat "Slots using texture" (at $info 1)) -1
|
||||
push slots (textureslotbyname (at $info 1))
|
||||
push usemap (textureslotusagelist)
|
||||
menuitem "" -1
|
||||
push last (- (listlen $slots) 1)
|
||||
__tex_togo = (at $slots 0)
|
||||
__tex_joined = (at $slots $last)
|
||||
looplist $slots ii [
|
||||
menuitem (concatword " #" $ii ": " (edittextureslot $ii) " (" (at $usemap $ii) " uses)") (concat alias __texslot $ii "; showmenu [Edit texture slot]")
|
||||
]
|
||||
menuitem "" -1
|
||||
menuitem "Merge" -1
|
||||
menuitemslider " slot #" 0 $last 0 1 $slots (concat "__tex_togo = (at" (escape $slots) "$arg1)")
|
||||
menuitem "into" -1
|
||||
menuitemslider " slot #" 0 $last $last 1 $slots (concat "__tex_joined = (at" (escape $slots) "$arg1)")
|
||||
menuitem " \f0[OK]" [if (!= $__tex_joined $__tex_togo) [deletetextureslot $__tex_togo purge $__tex_joined]]
|
||||
pop info slots usemap last
|
||||
][
|
||||
menuitem "no slot selected" -1
|
||||
]
|
||||
]
|
||||
|
||||
// Texture browsing menus
|
||||
newmenu textures
|
||||
menuitem "Browse official textures" [ showmenu "Official textures" ]
|
||||
menuitem "Browse custom/downloaded textures" [ showmenu "Custom textures" ]
|
||||
menuitem "Edit texture slots of current map" [ showmenu "Edit texture slots" ]
|
||||
|
||||
newmenu "Official textures"
|
||||
menuinit __rebuildtexturemenus
|
||||
|
||||
newmenu "Custom textures"
|
||||
menuinit __rebuildtexturemenus
|
||||
|
||||
newmenu "Pick texture"
|
||||
menuinit [
|
||||
delmenu (curmenu)
|
||||
newmenu (curmenu)
|
||||
if (strlen $__lastwatchedtexture) [
|
||||
chmenutexture (curmenu) $__lastwatchedtexture
|
||||
push usedslots (textureslotbyname $__lastwatchedtexture)
|
||||
menuitem (concat "Texture:" $__lastwatchedtexture) -1
|
||||
menuitem (concat "Distribution:" (gettextureorigin $__lastwatchedtexture)) -1
|
||||
menuitem "" -1
|
||||
if (strlen $usedslots) [
|
||||
menuitem "Texture is already used in:" -1
|
||||
looplist $usedslots i [
|
||||
menuitem (concatword " slot #" $i " (scale " (at (edittextureslot $i) 0) ")") (concat "__texslot =" $i "; showmenu [Edit texture slot]")
|
||||
]
|
||||
menuitem "" -1
|
||||
usedslots = "once more"
|
||||
]
|
||||
if (! (strlen (edittextureslot 255))) [
|
||||
menuitem (concat "Add to map config" $usedslots) (concat texture 0 $__lastwatchedtexture)
|
||||
menuitem "Add to map config and use as next wall texture" (concat "edittexturestack wall (texture 0" $__lastwatchedtexture ")")
|
||||
menuitem "Add to map config and use as next floor texture" (concat "edittexturestack floor (texture 0" $__lastwatchedtexture ")")
|
||||
menuitem "Add to map config and use as next ceiling texture" (concat "edittexturestack ceiling (texture 0" $__lastwatchedtexture ")")
|
||||
] [
|
||||
menuitem "\f4(no free texture slots available)" -1
|
||||
]
|
||||
pop usedslots
|
||||
][
|
||||
menuitem "no texture selected" -1
|
||||
]
|
||||
]
|
||||
|
||||
// "closestenttype" slider...
|
||||
_closestentslider = [ closestenttype (at ["" light playerstart pistol ammobox grenades health armour akimbo mapmodel ladder ctf-flag sound clip helmet plclip] $arg1); _closestenttypestatus = $arg1 ]
|
||||
|
||||
@@ -440,4 +595,31 @@ tempalias __rebuildmapmodelmenus [
|
||||
]
|
||||
]
|
||||
|
||||
tempalias __rebuildtexturemenus [
|
||||
if $rereadtexturelists [
|
||||
delmenu "Official textures"
|
||||
delmenu "Custom textures"
|
||||
push fullname ""
|
||||
looplist (gettexturelist "" "kurt skymaps map_editor" "") [tpath tname] [
|
||||
fullname = (concatword $tpath "/" $tname)
|
||||
if (strcmp official (gettextureorigin $fullname)) [
|
||||
newmenu "Official textures"
|
||||
] [
|
||||
newmenu "Custom textures"
|
||||
]
|
||||
menuitem $fullname (concat _texmenu_exec (escape $fullname)) (concat _texmenu_hover (escape $fullname) (escape (curmenu)))
|
||||
menurenderoffset -20 0
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
tempalias _texmenu_exec [
|
||||
__lastwatchedtexture = $arg1
|
||||
if $editing [ showmenu "Pick texture" ]
|
||||
]
|
||||
|
||||
tempalias _texmenu_hover [
|
||||
__lastwatchedtexture = $arg1
|
||||
chmenutexture $arg2 $arg1
|
||||
]
|
||||
persistidents 1
|
||||
|
||||
Reference in New Issue
Block a user