Xxxx hidden paths runtime render fixes solos

This PR adds support for soloing individual paths and nested shapes. It also aligns editor and runtime behavior.

Diffs=
ee674a819 Xxxx hidden paths runtime render fixes solos (#6252)
a0f076e31 tendon crash fix (#6258)
fdad66136 Disable d3d blend state during PLS flush (#6254)
e717ed98a add clipResult enum and render clips to copy the editor behavior (#6218)
faba3ff51 Unity (#6173)
18ae32102 Delete assets after artboards to fix race condition with FileAssetReferencers. (#6223)
252100f48 Fix validation for listeners to validate with nested inputs (#6220)
f21ebc98c compute parameters when cubic values change (#6207)

Co-authored-by: hernan <hernan@rive.app>
This commit is contained in:
bodymovin
2023-11-22 20:18:16 +00:00
parent 511205fa21
commit a04ede704e
4 changed files with 35 additions and 3 deletions

View File

@ -1 +1 @@
da903372b918a5ad3f86439a944b9dddb8c5a785
ee674a819b3e4af245cb5b33bc60bab2741079ce

View File

@ -309,6 +309,15 @@ abstract class Path extends PathBase {
void pathFlagsChanged(int from, int to) => markPathDirty();
bool get isHidden => (pathFlags & ComponentFlags.hidden) != 0;
@override
bool propagateCollapse(bool collapse) {
bool changed = super.propagateCollapse(collapse);
if (changed && shape != null) {
shape!.pathCollapseChanged();
}
return changed;
}
}
enum _PathCommand { moveTo, lineTo, cubicTo, close }

View File

@ -37,7 +37,7 @@ class PathComposer extends Component {
Mat2D inverseWorld = Mat2D();
if (Mat2D.invert(inverseWorld, world)) {
for (final path in shape.paths) {
if (path.isHidden) {
if (path.isHidden || path.isCollapsed) {
continue;
}
localPath.addPath(path.uiPath, ui.Offset.zero,
@ -56,7 +56,7 @@ class PathComposer extends Component {
if (buildWorldPath) {
worldPath.reset();
for (final path in shape.paths) {
if (path.isHidden) {
if (path.isHidden || path.isCollapsed) {
continue;
}
worldPath.addPath(path.uiPath, ui.Offset.zero,
@ -99,4 +99,19 @@ class PathComposer extends Component {
onDirty(dirt);
artboard?.onComponentDirty(this);
}
// Instead of adding dirt and rely on the recursive behavior of the addDirt method,
// we need to explicitly add dirt to the dependents. The reason is that a collapsed
// shape will not clear its dirty path flag in the current frame since it is collapsed.
// So in a future frame if it is uncollapsed, we mark its path flag as dirty again,
// but since it was already dirty, the recursive part will not kick in and the dependents
// won't update.
// This scenario is not common, but it can happen when a solo toggles between an empty
// group and a path for example.
void pathCollapseChanged() {
addDirt(ComponentDirt.path);
for (final d in dependents) {
d.addDirt(ComponentDirt.path, recurse: true);
}
}
}

View File

@ -72,6 +72,8 @@ class Shape extends ShapeBase with ShapePaintContainer {
void pathChanged(Path path) => _markComposerDirty();
void pathCollapseChanged() => pathComposer.pathCollapseChanged();
void paintChanged() {
addDirt(ComponentDirt.path);
_markBlendModeDirty();
@ -314,4 +316,10 @@ class Shape extends ShapeBase with ShapePaintContainer {
path.buildPath(hitTester);
}
}
@override
bool propagateCollapse(bool collapse) {
propagateCollapseToChildren(collapse);
return super.propagateCollapse(collapse);
}
}