Upload files to 'studio'
This commit is contained in:
parent
b4d3524b07
commit
928576702f
2 changed files with 135 additions and 22 deletions
|
@ -4,8 +4,10 @@
|
||||||
import os
|
import os
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
#from studio import checklist
|
from studio import checklist
|
||||||
import checklist
|
from studio import story
|
||||||
|
#import checklist
|
||||||
|
#import story
|
||||||
|
|
||||||
def get_legacy(project_location):
|
def get_legacy(project_location):
|
||||||
|
|
||||||
|
@ -219,7 +221,7 @@ def get_legacy(project_location):
|
||||||
# For the next step I need to have the story parsed and read. But it's going
|
# For the next step I need to have the story parsed and read. But it's going
|
||||||
# to be so hard. That I will need to write a separate function for it.
|
# to be so hard. That I will need to write a separate function for it.
|
||||||
|
|
||||||
data["rnd"] = 0.0
|
data["rnd"] = story.get_legacy(project_location)["fraction"]
|
||||||
|
|
||||||
# After all of it we need to get the final project percentage.
|
# After all of it we need to get the final project percentage.
|
||||||
multiply = data["rnd_factor"]
|
multiply = data["rnd_factor"]
|
||||||
|
@ -239,6 +241,3 @@ def get_legacy(project_location):
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
this = get_legacy("/home/vcs/Projects/Films/Shorts/MoriasRace")
|
|
||||||
for i in this:
|
|
||||||
print(i, " : " ,this[i])
|
|
||||||
|
|
146
studio/story.py
146
studio/story.py
|
@ -4,8 +4,8 @@
|
||||||
import os
|
import os
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
#from studio import checklist
|
from studio import checklist
|
||||||
import checklist
|
#import checklist
|
||||||
|
|
||||||
def get_legacy(project_location):
|
def get_legacy(project_location):
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ def get_legacy(project_location):
|
||||||
"camera" : [0,0], # The position of where the user left
|
"camera" : [0,0], # The position of where the user left
|
||||||
"scenes" : {}, # List of scenes.
|
"scenes" : {}, # List of scenes.
|
||||||
"arrows" : [], # List of connections. (A LIST. NOT DICT.)
|
"arrows" : [], # List of connections. (A LIST. NOT DICT.)
|
||||||
"files" : {}, # List of links to files.
|
"links" : [], # List of links to files or assets.
|
||||||
"markers": {}, # List of markers.
|
"markers": {}, # List of markers.
|
||||||
"events" : {} # List of frame like containers. (It will have similar)
|
"events" : {} # List of frame like containers. (It will have similar)
|
||||||
} # function as events. But will have no text data with in
|
} # function as events. But will have no text data with in
|
||||||
|
@ -142,6 +142,7 @@ def get_legacy(project_location):
|
||||||
for scene in eventtext.split("</scene>")[:-1]:
|
for scene in eventtext.split("</scene>")[:-1]:
|
||||||
|
|
||||||
scenename = scene[scene.find('"')+1:scene.replace('"'," ",1).find('"')]
|
scenename = scene[scene.find('"')+1:scene.replace('"'," ",1).find('"')]
|
||||||
|
scenename = scenename.replace(" ", "_")
|
||||||
scenetext = scene[scene.replace('"', " ", 1).find('"')+1:-1]
|
scenetext = scene[scene.replace('"', " ", 1).find('"')+1:-1]
|
||||||
|
|
||||||
data["scenes"][scenename] = {
|
data["scenes"][scenename] = {
|
||||||
|
@ -442,18 +443,131 @@ def get_legacy(project_location):
|
||||||
# easy rest of it. Untill we will get to calculating the project. Because
|
# easy rest of it. Untill we will get to calculating the project. Because
|
||||||
# we need to filter out all scenes that are not in the main chain.
|
# we need to filter out all scenes that are not in the main chain.
|
||||||
|
|
||||||
|
# Let's start with hard thing first. So to feel good when having to do the
|
||||||
|
# easy stuff in the end. ARROWS. (connections between scenes)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# To make it work. We need to fisrt of all earase all the stuff before
|
||||||
|
# the first arrow. Because <arrow> could be mentioned in the script it
|
||||||
|
# self. Similarly <image> is too. So it's good to complitelly clear bos
|
||||||
|
# out of anything that came before.
|
||||||
|
|
||||||
|
bos = bos[bos.rfind("</event>"):]
|
||||||
|
|
||||||
|
# From here everything is PER LINE BASED... YEAH!!!!
|
||||||
|
|
||||||
|
bos = bos.split("\n")
|
||||||
|
|
||||||
|
for line in bos:
|
||||||
|
|
||||||
|
# This is arrows...
|
||||||
|
|
||||||
|
if line.startswith("<arrow>"):
|
||||||
|
|
||||||
|
arrow = line[line.find("<")+7:line.rfind("</")].split(" --> ")
|
||||||
|
newarrow = []
|
||||||
|
for i in arrow:
|
||||||
|
i = i.split(",")
|
||||||
|
if i[0] != "-1":
|
||||||
|
newarrow.append([
|
||||||
|
"scene", i[1][1:-1]
|
||||||
|
])
|
||||||
|
else:
|
||||||
|
newarrow.append(
|
||||||
|
i[1][1:-1]
|
||||||
|
)
|
||||||
|
data["arrows"].append(newarrow)
|
||||||
|
|
||||||
|
# And this is links. Formerly known as Images. Initially the idea was to
|
||||||
|
# just store images. But later. I started adding assets like this as well.
|
||||||
|
|
||||||
|
elif line.startswith("<image>"):
|
||||||
|
stuff = line.split(",")
|
||||||
|
link = stuff[3][1:-1]
|
||||||
|
coordinates = []
|
||||||
|
try:
|
||||||
|
coordinates.append(float(stuff[0].replace("<image>", "")))
|
||||||
|
except:
|
||||||
|
coordinates.append(0.0)
|
||||||
|
|
||||||
|
try:
|
||||||
|
coordinates.append(float(stuff[1]))
|
||||||
|
except:
|
||||||
|
coordinates.append(0.0)
|
||||||
|
|
||||||
|
# Lately the primary reason to use <image> was linking assets directly
|
||||||
|
# into story editor's space. But it was a hack. Basically I was
|
||||||
|
# linking a preview image. Preview.png or Preview.jpg from the
|
||||||
|
# renders of the asset. And the drawer of the images in the story-
|
||||||
|
# editor already knew to redirect the clicks to a different function.
|
||||||
|
# But for VCStudio I want to link to asset or a file.
|
||||||
|
|
||||||
|
linktype = "file"
|
||||||
|
|
||||||
|
if "/renders/Preview." in link:
|
||||||
|
linktype = "asset"
|
||||||
|
link = link[:link.rfind("/renders/Preview.")].replace("/dev", "")
|
||||||
|
|
||||||
|
data["links"].append([
|
||||||
|
linktype, link, coordinates
|
||||||
|
])
|
||||||
|
|
||||||
|
# Markers. I nearly forgot about the markers. In the Story-Editor of
|
||||||
|
# Blender-Orgaznier they were something like markers in VSE in Blender.
|
||||||
|
# Vertical lines visible on every altitude.
|
||||||
|
|
||||||
|
elif line.startswith("<marker>"):
|
||||||
|
marker = line.replace("<marker>", "").replace("</marker>", "").split(",")
|
||||||
|
|
||||||
|
try:
|
||||||
|
markloc = float(marker[0])
|
||||||
|
except:
|
||||||
|
markloc = 0.0
|
||||||
|
|
||||||
|
markstring = marker[1].replace('"', "")
|
||||||
|
|
||||||
|
# I do want to do something quite interesting with markers in the
|
||||||
|
# VCStudio tho. I want them to be like little nodes with text while
|
||||||
|
# in the frame. And be like directional guides. Sticking to the
|
||||||
|
# edges of the screen when outside the screen. Something like items
|
||||||
|
# that are outside of the map in the videogames. So you can see
|
||||||
|
# which direction are they. For this markers will need to have
|
||||||
|
# both X and Y coordinates.
|
||||||
|
|
||||||
|
data["markers"][markstring] = [markloc, 0.0]
|
||||||
|
|
||||||
|
# For now the Y is 0. Because we are reading from the old version.
|
||||||
|
|
||||||
|
|
||||||
|
# Okay we've got the Arrows data. Pretty much all the data. Now we just
|
||||||
|
# need to calculate the scenes fraction. For that we need to recreate the
|
||||||
|
# train of scenes. From START till END.
|
||||||
|
|
||||||
|
fractions = []
|
||||||
|
lastarrow = 'start'
|
||||||
|
|
||||||
|
|
||||||
|
for i in data["arrows"]:
|
||||||
|
if lastarrow == "end":
|
||||||
|
break
|
||||||
|
for arrow in data["arrows"]:
|
||||||
|
if arrow[0] == lastarrow:
|
||||||
|
lastarrow = arrow[1]
|
||||||
|
if arrow[1] != "end":
|
||||||
|
fractions.append(
|
||||||
|
data["scenes"][arrow[1][1]]["fraction"]
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
|
# FINAL STUFF...
|
||||||
|
|
||||||
|
try:
|
||||||
|
data["fraction"] = sum(fractions) / len(fractions)
|
||||||
|
except:
|
||||||
|
data["fraction"] = 0.0
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
this = get_legacy("/home/vcs/Projects/Films/Shorts/MoriasRace")
|
|
||||||
for i in this:
|
|
||||||
if i == "scenes":
|
|
||||||
print("scenes {")
|
|
||||||
for b in this[i]:
|
|
||||||
print(" ", b, " { ")
|
|
||||||
for c in this[i][b]:
|
|
||||||
print(" ", c ," : ", this[i][b][c])
|
|
||||||
print("}")
|
|
||||||
else:
|
|
||||||
print(i, " : " ,this[i])
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue