Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
1292be2
Add class Layer to some modules; Will be extending it furthur
AnishGG Jul 19, 2019
bd4367a
Some more modules ported to Layer class
AnishGG Jul 19, 2019
ac39833
More progress on class Layer
AnishGG Jul 20, 2019
a3579ef
Development of class Layer in common modules
AnishGG Jul 20, 2019
8a6b29d
Add canvas class for supporting defs and :use
AnishGG Jul 21, 2019
c5b30e2
Add support for skew parameter in group and switch group layer
AnishGG Jul 22, 2019
7c21694
Shifting more modules to class Layer
AnishGG Jul 23, 2019
1d9f573
Add class 'Param'
AnishGG Jul 23, 2019
79e77d0
Some more additions in class Layer and Param
AnishGG Jul 23, 2019
28ce214
Region Layer ported to new classes; Outline and Polygon won't work fo…
AnishGG Jul 23, 2019
a0d6e24
Outline and Polygon layers shifted to the new classes
AnishGG Jul 23, 2019
f611025
Animation and path generation of parameters shifted to class Param
AnishGG Jul 24, 2019
44202ff
Path generation for a parameter shifted inside the parameter class
AnishGG Jul 24, 2019
66f0107
value_at_frame calculation shifted inside param class
AnishGG Jul 24, 2019
034bbe3
MOre progress on class Param and Layer
AnishGG Jul 24, 2019
0f157ec
More progress on classes and internal calculation of vector's
AnishGG Jul 25, 2019
ee3906d
Support ADD convert method for non group layers
AnishGG Jul 25, 2019
d734436
Changes in group layer links
AnishGG Jul 25, 2019
8be2061
Addoffset() method changed entirely for group layers; group, switch, …
AnishGG Jul 26, 2019
7df218d
Try to support convert method ADD with group layers
AnishGG Jul 26, 2019
a18b24d
Add missed Makefile changes
AnishGG Jul 26, 2019
8c04b66
One more shot at group layers
AnishGG Jul 27, 2019
4cb700a
Group layers working with ADD convert method
AnishGG Jul 27, 2019
5528776
Rotate and scale layers now working
AnishGG Jul 27, 2019
d4c500e
Major changes in axis conversion between lottie/Synfig; Rectangle and…
AnishGG Jul 27, 2019
0ad5b9e
Rectangle layer now working
AnishGG Jul 27, 2019
87d9cef
Import image layer now working
AnishGG Jul 28, 2019
43db572
Add support for average convert method
AnishGG Jul 28, 2019
a57a9b6
Clear subparameters before recalculating
AnishGG Jul 28, 2019
4ccde7e
Add support for 'composite' convert method
AnishGG Jul 28, 2019
d419481
Minor correction in composite convert method
AnishGG Jul 28, 2019
d6b9100
Missed correction in previous commit
AnishGG Jul 28, 2019
4a51e1d
Add minus sign to composite expression
AnishGG Jul 28, 2019
8dad6d3
Add support for linear convert method
AnishGG Jul 29, 2019
ebda326
Add support for 'radial_composite' convert method
AnishGG Jul 29, 2019
b7a7859
Add support for 'scale' convert method
AnishGG Jul 29, 2019
529b22c
Add support for 'subtract' convert method
AnishGG Jul 29, 2019
0b69a93
Add support for 'switch' convert method; animated bool won't work wit…
AnishGG Jul 30, 2019
381a4a4
Switch convert type now working with animated bool
AnishGG Jul 30, 2019
0e631f7
Add support for weighted_average convert method
AnishGG Jul 31, 2019
4d10ef2
Exported value nodes working with export in the current canvas
AnishGG Jul 31, 2019
d0cfda3
Remove a minor bug
AnishGG Jul 31, 2019
23c0431
Add missed file in Makefile
AnishGG Aug 3, 2019
00bf1f4
Extracting bones in the canvas
AnishGG Aug 3, 2019
cae7d39
Png images now working
AnishGG Aug 5, 2019
570b803
Some progress on skeleton layer
AnishGG Aug 7, 2019
bf330cb
Errors from bone convert methods removed; time window updation to be …
AnishGG Aug 7, 2019
2bc12ce
update_frame_window() shifted to class 'Param'
AnishGG Aug 8, 2019
0c6863d
Shift to internal function of class: Param -> update_frame_window()
AnishGG Aug 8, 2019
61dc262
Basic bone convert methods working
AnishGG Aug 8, 2019
a73b38c
Bones working with angles! Hurray!
AnishGG Aug 10, 2019
dbcfc70
Recursively find the bones using guid till the top most canvas
AnishGG Aug 10, 2019
717e6da
Bones now working with group layers
AnishGG Aug 10, 2019
eeac6fd
Add a path when two vectors are equal on adjacent time frames
AnishGG Aug 11, 2019
e7fed1d
Update time_update when bone-angle is animated
AnishGG Aug 11, 2019
394aeea
Add support for base value in bones
AnishGG Aug 12, 2019
e0e80a1
Add support for local length scale in bones
AnishGG Aug 14, 2019
7cadfbf
Add skeleton layer template
AnishGG Aug 15, 2019
90a4e1b
Try to support recursive scale length in bones
AnishGG Aug 19, 2019
2fe865b
Removed rls from the exporter until debugged
AnishGG Aug 19, 2019
fcce712
Fix: #926
AnishGG Aug 19, 2019
d298820
Fix: #918
AnishGG Aug 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions synfig-studio/plugins/lottie-exporter/common/Bline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
"""
Bline.py
Will store the Parameters class for Bline
"""

import sys
import settings
import common
sys.path.append("..")


class Bline:
"""
Class to store Synfig format bline
"""
def __init__(self, bline, parent):
"""
This parent should be parameter
"""
self.parent = parent
self.bline = bline
self.type = bline.attrib["type"]
self.entry_list = []
self.extract_entries(self.entry_list)

def get(self):
"""
Returns the original param
"""
return self.bline

def __getitem__(self, itr):
"""
Returns the child corresponding to itr
"""
return self.entry_list[itr]

def __setitem__(self, itr, val):
"""
Sets the value of child corresponding to itr
"""
self.entry_list[itr] = val

def get_layer_type(self):
"""
Recursively go till the top until layer is not reached
"""
if isinstance(self.parent, common.Layer.Layer):
return self.parent.get_type()
return self.parent.get_layer_type()

def get_layer(self):
"""
Recursively find the layer of this bline
"""
if isinstance(self.parent, common.Layer.Layer):
return self.parent
return self.parent

def get_type(self):
"""
Returns the type of bline
"""
return self.type

def get_loop(self):
"""
Returns whether the bline is looped or not
"""
loop = False
if "loop" in self.bline.keys():
v = self.bline.attrib["loop"]
if v == "true":
loop = True
return loop

def extract_entries(self, entry_list):
"""
Stores the entries in a list
"""
for entry in self.bline:
# Assuming it's child is always composite for now
entry_list.append({})
if entry[0].tag == "composite":
element = entry[0]
else:
element = entry
for param in element:
tag = param.tag
if tag == "animated": # For dynamic list
tag = param.attrib["type"]
entry_list[-1][tag] = common.Param.Param(param, element)
if entry[0].tag == "composite":
entry_list[-1]["composite"] = element

def get_entry_list(self):
"""
Returns the entry list
"""
return self.entry_list

def get_len(self):
"""
Returns the number of entries
"""
return len(self.entry_list)

def set_entry(self, itr, entry, tag="vector"):
"""
Sets the entry at itr to val
"""
for param in entry:
self.entry_list[itr][tag] = common.Param.Param(param, entry)
127 changes: 127 additions & 0 deletions synfig-studio/plugins/lottie-exporter/common/Canvas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
"""
Canvas.py
Will store the Canvas class required for Synfig canvases
"""

import sys
import settings
from common.Layer import Layer
from common.Param import Param
sys.path.append("..")


class Canvas:
"""
Class to keep Canvas for Synfig
"""
def __init__(self, canvas):
"""
"""
if isinstance(canvas, Param):
self.canvas = canvas.get()[0]
# If canvas is derived from a parameter store that parameter also
self.parent_param = canvas
else:
self.canvas = canvas
self.defs = {}
self.extract_defs(self.defs)
self.layers = []
self.extract_layers(self.layers)
self.bones = {}
self.extract_bones(self.bones)
self.set_name()

def set_name(self):
"""
Sets the name of the canvas
"""
found = False
for child in self.canvas:
if child.tag == "name":
self.name = child.text
found = True
if not found:
self.name = settings.CANVAS_NAME + str(settings.canvas_count.inc())

def get_canvas(self):
"""
This won't be required once the canvas class is fully embedded in the
code
Returns the address of original canvas
"""
return self.canvas

def getparent_param(self):
"""
This will return the parent parameter of the canvas
Only when a canvas is present in a group or switch group layer
"""
return self.parent_param

def extract_defs(self, defs_dict):
"""
Will store all the defs with there id's as there keys
"""
for child in self.canvas:
if child.tag == "defs":
defs = child

for child in defs:
key = child.attrib["id"]
defs_dict[key] = child

def get_def(self, key):
"""
Given a key, returns the corresponding child definded in the canvas
"""
if key in self.defs.keys():
return self.defs[key]
return None
#raise KeyError("No defs %s in Canvas %s", key, self.name)

def extract_layers(self, layer_list):
"""
Will store all the layers in a list
"""
for child in self.canvas:
if child.tag == "layer":
layer_list.append(Layer(child, self))

def extract_bones(self, bones_dict):
"""
Will store all the bones in a dictionary
"""
for chld in self.canvas:
if chld.tag == "bones":
bones = chld

for child in bones:
key = child.attrib["guid"]
bones_dict[key] = Param(child, Param(bones, self))

def get_bone(self, key):
"""
Given a guid, returns the corresponding bone from the canvas
"""
if key in self.bones.keys():
return self.bones[key]
return None
#raise KeyError("No bone guid: %s in Canvas %s", key, self.name)

def __getitem__(self, itr):
"""
Returns the layer at itr
"""
return self.layers[itr]

def get_num_layers(self):
"""
Returns the number of layers in the canvas
"""
return len(self.layers)

def get_layer_list(self):
"""
Returns the list of layers in the canvas
"""
return self.layers
Loading