The function used to calculate the size of the future image (P.S. PyTom, could it be replaced with renpy.image_size, it is much faster?):
Code: Select all
Def get_size(displayable):
return (int(renpy.render(renpy.easy.displayable(displayable), 0, 0, 0, 0).get_size()[0]),
int(renpy.render(renpy.easy.displayable(displayable), 0, 0, 0, 0).get_size()[1]))
Code: Select all
def PersonDynamic(st, at, data, *args):
images = []
data = data.mItems.values()
data.sort( key = lambda item: item.zorder )
for element in data:
if element.mIsVisible == True:
images.append(element.position)
images.append(element.image) #the image of the layer
image = im.Composite(get_size(data[0].image),*images)
return image, 0
Code: Select all
class Person(store.object, ADVCharacter):
def __init__(self, name, caption, charData = None, defVals = None, constVals = None, viewVals = None):
self.name = name
self.caption = caption
self.charData = charData
self.stats = {}
self.image = DynamicDisplayable(PersonDynamic, data = self.charData)
renpy.start_predict(self.image)
self.char = Character(caption, color="cdaa85", window_right_padding = 440, window_left_padding = 440, screen = "person_say")
…
Code: Select all
def Visibility(self, talkingView="", isTalking=True, transition=None):
self._talkingView = talkingView
if (isTalking and ('head' in self._talkingView)) or ('head+' in self._talkingView):
renpy.show(self.name+"_image_head", what = At(self.image, Transform(pos = self.posH, anchor = (0.0, 0.0))), zorder=8)
Code: Select all
def Face(self, s):
self.__temp=s.split(" ")
for i in range(4):
self.data.setStyleKey( ['brows', 'eyes', 'blush', 'mouth'][i], ['brows', 'eyes', 'blush', 'mouth'][i]+"_"+self.__temp[i] )# setStyreKey changes the current image of the layer/layers
return
Code: Select all
label start:
"..."
$markus.Visibility('body')
$markus.Face("b04g e03 c00 m03")
with Dissolve(0.3, alpha = True)# Image displays properly with the transition, works fine so far
markus "First show"
$markus.Face("b00g e07 c00 m01")# Here is where the transition suppose to happen, but the following string should also start at the same moment.
markus "Emotion 1"
$markus.Face("b00g e22 c00 m02")
markus "Emotion 2"
$markus.Visibility()
with Dissolve(0.3, alpha = True)# Image disappears with the transition, this part also works.
markus "i m hide"
I expect it to be quite a difficult thing to achieve (maybe even impossible in RenPy).
Things that were tried, but not sure whether it is the right way to do it.
Use DynamicImage(element.image), instead of im.Composite use LiveComposite.
Also tried to get the old image and change it through the At with trasnforamtion.
Code: Select all
transform same_transform(old, new):
parallel:
old
alpha 1.0
linear 0.3 alpha 0.0
parallel:
new
alpha 0.0
linear 0.3 alpha 1.0
So to sum it all up:
There should be one — and preferably only one — obvious way to do it.
I would prefer to do it properly, but sadly, for the moment, I lack the skills needed. So here my summons PyTom and other RenPy gurus and even pythons, at this point any help is welcomed…
P.S. If any person can explain to me, in Russian, how interaction and renpy.restrart_interaction work, I would be very greatfull, I think that the solution can be achieved through these functions, the real question is when to use them.