change all frame properties disallows root/nulls in some cases
This commit is contained in:
+12
-9
@@ -126,7 +126,7 @@ namespace anm2ed::anm2
|
||||
return frame;
|
||||
}
|
||||
|
||||
void Item::frames_change(FrameChange change, ChangeType type, std::set<int>& selection)
|
||||
void Item::frames_change(FrameChange change, anm2::Type itemType, ChangeType changeType, std::set<int>& selection)
|
||||
{
|
||||
const auto clamp_identity = [](auto value) { return value; };
|
||||
const auto clamp01 = [](auto value) { return glm::clamp(value, 0.0f, 1.0f); };
|
||||
@@ -139,7 +139,7 @@ namespace anm2ed::anm2
|
||||
if (!optionalValue) return;
|
||||
auto value = *optionalValue;
|
||||
|
||||
switch (type)
|
||||
switch (changeType)
|
||||
{
|
||||
case ADJUST:
|
||||
target = clampFunc(value);
|
||||
@@ -176,18 +176,21 @@ namespace anm2ed::anm2
|
||||
apply_scalar(frame.rotation, change.rotation);
|
||||
apply_scalar_with_clamp(frame.duration, change.duration, clamp_duration);
|
||||
|
||||
apply_scalar(frame.crop.x, change.cropX);
|
||||
apply_scalar(frame.crop.y, change.cropY);
|
||||
if (itemType == LAYER)
|
||||
{
|
||||
apply_scalar(frame.crop.x, change.cropX);
|
||||
apply_scalar(frame.crop.y, change.cropY);
|
||||
|
||||
apply_scalar(frame.pivot.x, change.pivotX);
|
||||
apply_scalar(frame.pivot.y, change.pivotY);
|
||||
apply_scalar(frame.pivot.x, change.pivotX);
|
||||
apply_scalar(frame.pivot.y, change.pivotY);
|
||||
|
||||
apply_scalar(frame.size.x, change.sizeX);
|
||||
apply_scalar(frame.size.y, change.sizeY);
|
||||
}
|
||||
|
||||
apply_scalar(frame.position.x, change.positionX);
|
||||
apply_scalar(frame.position.y, change.positionY);
|
||||
|
||||
apply_scalar(frame.size.x, change.sizeX);
|
||||
apply_scalar(frame.size.y, change.sizeY);
|
||||
|
||||
apply_scalar(frame.scale.x, change.scaleX);
|
||||
apply_scalar(frame.scale.y, change.scaleY);
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ namespace anm2ed::anm2
|
||||
std::string to_string(Type, int = -1);
|
||||
int length(Type);
|
||||
Frame frame_generate(float, Type);
|
||||
void frames_change(FrameChange, ChangeType, std::set<int>&);
|
||||
void frames_change(FrameChange, anm2::Type, ChangeType, std::set<int>&);
|
||||
bool frames_deserialize(const std::string&, Type, int, std::set<int>&, std::string*);
|
||||
void frames_bake(int, int, bool, bool);
|
||||
void frames_generate_from_grid(glm::ivec2, glm::ivec2, glm::ivec2, int, int, int);
|
||||
|
||||
Reference in New Issue
Block a user