forked from SilverStudioGames/WTS
Color Picker
* Rewritten and re-implemented color picker in shading language * Vastly improved performance * Added live preview back * Overhauled interface * Code Cleanup * Reduced import overhead
This commit is contained in:
parent
1ff8217434
commit
822f35c08c
@ -196,19 +196,43 @@ init python:
|
||||
def set_color(self, n):
|
||||
"""Takes int layer number for manual color picking or a list to replace the cloth color in its entirety."""
|
||||
if isinstance(n, int):
|
||||
# Transarency slider boolean
|
||||
is_cheating = config.developer or cheat_wardrobe_alpha
|
||||
is_blacklisted = self.type.startswith(tuple(self.blacklist_unequip))
|
||||
is_allowed = self.type.startswith(("makeup", "tattoo"))
|
||||
col = Color(tuple(self.color[n]))
|
||||
dcol = Color(tuple(self.color_default[n]))
|
||||
|
||||
transparency = not is_blacklisted and (is_allowed or is_cheating)
|
||||
cp.live_replace(col)
|
||||
cp.start_replace(col)
|
||||
cp.default_replace(dcol)
|
||||
|
||||
self.color[n] = color_picker(self.color[n], transparency, "Colour channel {}".format(n+1), pos_xy=(40, 85), color_default=self.color_default[n])
|
||||
self.char.override, self.override = False, False
|
||||
renpy.show_screen("colorpickerscreen", self)
|
||||
|
||||
while True:
|
||||
action, value = ui.interact()
|
||||
|
||||
if action == "layer":
|
||||
n = value
|
||||
col = Color(tuple(self.color[value]))
|
||||
dcol = Color(tuple(self.color_default[n]))
|
||||
|
||||
cp.live_replace(col)
|
||||
cp.start_replace(col)
|
||||
cp.default_replace(dcol)
|
||||
elif action == "released":
|
||||
self.color[n] = [int(255*x) for x in value.rgba]
|
||||
self.rebuild_image()
|
||||
self.char.rebuild_image()
|
||||
elif action == "replace":
|
||||
self.color[n] = [int(255*x) for x in value.rgba]
|
||||
cp.live_replace(value)
|
||||
self.rebuild_image()
|
||||
self.char.rebuild_image()
|
||||
elif action == "finish":
|
||||
break
|
||||
|
||||
renpy.hide_screen("colorpickerscreen")
|
||||
elif isinstance(n, list):
|
||||
self.color = [x[:] for x in n]
|
||||
self.rebuild_image()
|
||||
self.char.rebuild_image()
|
||||
self.rebuild_image()
|
||||
self.char.rebuild_image()
|
||||
self.rebuild_icon()
|
||||
|
||||
def reset_color(self, n=None):
|
||||
|
@ -85,47 +85,6 @@ screen preferences_general():
|
||||
Function(renpy.transition, trans),
|
||||
Function(renpy.restart_interaction)
|
||||
]
|
||||
|
||||
# Broken.
|
||||
#
|
||||
# vbox:
|
||||
# style_prefix gui.theme("pref")
|
||||
|
||||
# $ text_color_day = settings.get("text_color_day")
|
||||
# $ text_color_night = settings.get("text_color_night")
|
||||
|
||||
# label _("Text Colour")
|
||||
# default color_square = "{font=[gui.glyph_font]}❖{/font}"
|
||||
|
||||
# hbox:
|
||||
# textbutton "Day" size_group "text_color" action [
|
||||
# Function(renpy.invoke_in_new_context, pick_color_setting, "text_color_day", "Day text colour"),
|
||||
# Function(renpy.transition, trans),
|
||||
# Function(gui.rebuild_styles)
|
||||
# ]
|
||||
# textbutton "{color=[text_color_day]}[color_square!i]{/color}" yalign 0.5 style "empty" background "#d1a261"
|
||||
# textbutton "Reset" text_size 14 yalign 0.5 padding (0, 0) action [
|
||||
# settings.Reset("text_color_day"),
|
||||
# Function(renpy.transition, trans),
|
||||
# Function(gui.rebuild_styles)
|
||||
# ]
|
||||
|
||||
# hbox:
|
||||
# textbutton "Night" size_group "text_color" action [
|
||||
# Function(renpy.invoke_in_new_context, pick_color_setting, "text_color_night", "Night text colour"),
|
||||
# Function(renpy.transition, trans),
|
||||
# Function(gui.rebuild_styles)
|
||||
# ]
|
||||
# textbutton "{color=[text_color_night]}[color_square!i]{/color}" yalign 0.5 style "empty" background "#5b4f4f"
|
||||
# textbutton "Reset" text_size 14 yalign 0.5 padding (0, 0) action [
|
||||
# settings.Reset("text_color_night"),
|
||||
# Function(renpy.transition, trans),
|
||||
# Function(gui.rebuild_styles)
|
||||
# ]
|
||||
|
||||
# hbox:
|
||||
# textbutton "Outline" size_group "text_color" action Function(print, "text_shadow")
|
||||
|
||||
vbox:
|
||||
style_prefix gui.theme("check")
|
||||
label _("Skipping")
|
||||
@ -349,13 +308,6 @@ init python:
|
||||
for fn in renpy.list_saved_games(fast=True):
|
||||
renpy.unlink_save(fn)
|
||||
|
||||
def pick_color_setting(setting_name, title):
|
||||
renpy.show_screen("preferences")
|
||||
color = settings.get(setting_name)
|
||||
r, g, b, _ = color_picker(get_rgb_list(color), False, title)
|
||||
color = get_hex_string(r/255.0, g/255.0, b/255.0)
|
||||
settings.set(setting_name, color)
|
||||
|
||||
def set_renderer(s):
|
||||
preferences.renderer = s if s in ("gl2", "angle2") else "auto"
|
||||
renpy.quit(relaunch=True)
|
||||
|
@ -245,6 +245,7 @@ init -1 python:
|
||||
start_color = list(color) # Keep a copy
|
||||
|
||||
renpy.show_screen("color_picker", tuple(color), alpha, title, pos_xy, color_default)
|
||||
|
||||
while True:
|
||||
_return = ui.interact()
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
init python:
|
||||
import binascii
|
||||
from binascii import unhexlify
|
||||
import requests
|
||||
|
||||
UPDATE_URL = binascii.unhexlify("687474703a2f2f3135332e39322e3232312e3234362f757064617465732e6a736f6e")
|
||||
UPDATE_URL = unhexlify("687474703a2f2f3135332e39322e3232312e3234362f757064617465732e6a736f6e")
|
||||
UPDATE_VER = ""
|
||||
|
||||
@renpy.pure
|
||||
|
528
game/scripts/wardrobe/color_picker.rpy
Normal file
528
game/scripts/wardrobe/color_picker.rpy
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user