mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 21:53:41 +00:00
logic
a
This commit is contained in:
parent
3737632e13
commit
df58466ce7
4 changed files with 16 additions and 3 deletions
|
@ -1355,7 +1355,7 @@ jerry_value_t LottieExpressions::evaluate(float frameNo, LottieExpression* exp)
|
||||||
//evaluate the code
|
//evaluate the code
|
||||||
auto eval = jerry_eval((jerry_char_t *) exp->code, strlen(exp->code), JERRY_PARSE_NO_OPTS);
|
auto eval = jerry_eval((jerry_char_t *) exp->code, strlen(exp->code), JERRY_PARSE_NO_OPTS);
|
||||||
|
|
||||||
if (jerry_value_is_exception(eval) || jerry_value_is_undefined(eval)) {
|
if (jerry_value_is_exception(eval)) {
|
||||||
TVGERR("LOTTIE", "Failed to dispatch the expressions!");
|
TVGERR("LOTTIE", "Failed to dispatch the expressions!");
|
||||||
exp->disabled = true;
|
exp->disabled = true;
|
||||||
return jerry_undefined();
|
return jerry_undefined();
|
||||||
|
|
|
@ -934,6 +934,9 @@ struct LottieSlot
|
||||||
Array<Pair> pairs;
|
Array<Pair> pairs;
|
||||||
LottieProperty::Type type;
|
LottieProperty::Type type;
|
||||||
bool overridden = false;
|
bool overridden = false;
|
||||||
|
|
||||||
|
// used for expression
|
||||||
|
LottieLayer* layer = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -466,7 +466,10 @@ void LottieParser::registerSlot(LottieObject* obj, const char* sid)
|
||||||
(*p)->pairs.push({obj});
|
(*p)->pairs.push({obj});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
comp->slots.push(new LottieSlot(strdup(sid), obj, type));
|
|
||||||
|
auto slot = new LottieSlot(strdup(sid), obj, type);
|
||||||
|
slot->layer = context.layer;
|
||||||
|
comp->slots.push(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1497,6 +1500,7 @@ bool LottieParser::apply(LottieSlot* slot, bool byDefault)
|
||||||
|
|
||||||
//OPTIMIZE: we can create the property directly, without object
|
//OPTIMIZE: we can create the property directly, without object
|
||||||
LottieObject* obj = nullptr; //slot object
|
LottieObject* obj = nullptr; //slot object
|
||||||
|
context.layer = slot->layer;
|
||||||
|
|
||||||
switch (slot->type) {
|
switch (slot->type) {
|
||||||
case LottieProperty::Type::Position: {
|
case LottieProperty::Type::Position: {
|
||||||
|
@ -1562,7 +1566,7 @@ bool LottieParser::apply(LottieSlot* slot, bool byDefault)
|
||||||
|
|
||||||
slot->assign(obj, byDefault);
|
slot->assign(obj, byDefault);
|
||||||
|
|
||||||
delete(obj);
|
// delete(obj); // 여기서 expression을 위한 property가 free 됨 (수정필요)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -365,6 +365,12 @@ struct LottieGenericProperty : LottieProperty
|
||||||
*frames = *rhs.frames;
|
*frames = *rhs.frames;
|
||||||
}
|
}
|
||||||
} else value = rhs.value;
|
} else value = rhs.value;
|
||||||
|
|
||||||
|
// TODO: 슬롯 데이터 이전 로직에 expression에 대한 정보 추가 필요
|
||||||
|
if (rhs.exp) {
|
||||||
|
exp = rhs.exp;
|
||||||
|
const_cast<LottieGenericProperty<Frame, Value, Scalar>&>(rhs).exp = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float angle(float frameNo)
|
float angle(float frameNo)
|
||||||
|
|
Loading…
Add table
Reference in a new issue