Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

fix(roundtrip): dogfood fixes for transitions, naming, and font advisories

hugohe35d783e699b67
diff --git a/skills/ppt-master/scripts/docs/svg-pipeline.md b/skills/ppt-master/scripts/docs/svg-pipeline.md
index ee239590..cd7cb180 100644
--- a/skills/ppt-master/scripts/docs/svg-pipeline.md
+++ b/skills/ppt-master/scripts/docs/svg-pipeline.md
@@ -182,6 +182,7 @@ Successful round-trip export prints one deck receipt:
cloned_passthrough=C patched=M rebuilt=R`. `patched` keeps the source visible
Slide XML and applies only notes or motion overlays; `rebuilt` means the page's
visible authoring changed.
+Without `-o`, round-trip export names the deck `<workspace-directory-name>_<timestamp>[<flavor-suffix>].pptx` under `exports/`.
Before export, run `python3 scripts/svg_quality_checker.py <workspace> --roundtrip`
as the round-trip text-capacity gate. It resolves the output roster from
diff --git a/skills/ppt-master/scripts/svg_quality/checker.py b/skills/ppt-master/scripts/svg_quality/checker.py
index 28ecbb58..4567ed3d 100644
--- a/skills/ppt-master/scripts/svg_quality/checker.py
+++ b/skills/ppt-master/scripts/svg_quality/checker.py
@@ -1554,8 +1554,19 @@ class SVGQualityChecker:
root,
included_text_ids,
)
+ changed_font_families = (
+ self._roundtrip_changed_font_families(
+ root,
+ baseline_root,
+ included_text_ids,
+ )
+ )
svg_contracts.check_font_size_values(scoped_content, result)
- self._check_fonts(scoped_content, result)
+ self._check_fonts(
+ scoped_content,
+ result,
+ font_families=changed_font_families,
+ )
self._check_text_output_geometry(
root,
result,
@@ -1692,6 +1703,156 @@ class SVGQualityChecker:
return ''
return ET.tostring(scoped_root, encoding='unicode')
+ @staticmethod
+ def _roundtrip_resolved_font_family(
+ element: ET.Element,
+ parent_by_id: Dict[int, ET.Element],
+ ) -> str | None:
+ """Resolve inherited SVG font-family at one text carrier."""
+ current: ET.Element | None = element
+ while current is not None:
+ style_values = (
+ _parse_inline_style(current.get('style'))
+ if _parse_inline_style is not None
+ else {}
+ )
+ value = style_values.get('font-family')
+ if value is None:
+ value = current.get('font-family')
+ if isinstance(value, str) and value.strip():
+ normalized = value.strip()
+ if normalized.casefold() not in {'inherit', 'unset'}:
+ return normalized
+ current = parent_by_id.get(id(current))
+ return None
+
+ @staticmethod
+ def _roundtrip_relative_path(
+ element: ET.Element,
+ ancestor: ET.Element,
+ parent_by_id: Dict[int, ET.Element],
+ ) -> tuple[int, ...] | None:
+ """Return child indices from one source-ref owner to a descendant."""
+ reverse_path: List[int] = []
+ current = element
+ while current is not ancestor:
+ parent = parent_by_id.get(id(current))
+ if parent is None:
+ return None
+ reverse_path.append(
+ next(
+ index
+ for index, child in enumerate(list(parent))
+ if child is current
+ )
+ )
+ current = parent
+ return tuple(reversed(reverse_path))
+
+ @staticmethod
+ def _roundtrip_baseline_context(
+ current_owner: ET.Element,
+ baseline_owner: ET.Element,
+ path: tuple[int, ...],
+ ) -> ET.Element:
+ """Follow a matching relative path, stopping at the closest context."""
+ current = current_owner
+ baseline = baseline_owner
+ for index in path:
+ current_children = list(current)
+ baseline_children = list(baseline)
+ if index >= len(current_children) or index >= len(baseline_children):
+ break
+ current_child = current_children[index]
+ baseline_child = baseline_children[index]
+ if _local_name(current_child) != _local_name(baseline_child):
+ break
+ current = current_child
+ baseline = baseline_child
+ return baseline
+
+ @classmethod
+ def _roundtrip_changed_font_families(
+ cls,
+ root: ET.Element,
+ baseline_root: ET.Element,
+ included_text_ids: set[int],
+ ) -> List[str]:
+ """Return resolved edited fonts that differ from the source baseline."""
+ from svg_authoring_view import SOURCE_REF_ATTRIBUTE
+
+ parent_by_id = {
+ id(child): parent
+ for parent in root.iter()
+ for child in list(parent)
+ }
+ baseline_parent_by_id = {
+ id(child): parent
+ for parent in baseline_root.iter()
+ for child in list(parent)
+ }
+ baseline_by_ref = {
+ source_ref: element
+ for element in baseline_root.iter()
+ if (source_ref := element.get(SOURCE_REF_ATTRIBUTE))
+ }
+ changed: List[str] = []
+ seen: set[str] = set()
+ for text_element in root.iter(f'{{{SVG_NS}}}text'):
+ if id(text_element) not in included_text_ids:
+ continue
+ current_owner: ET.Element | None = text_element
+ source_ref: str | None = None
+ while current_owner is not None:
+ source_ref = current_owner.get(SOURCE_REF_ATTRIBUTE)
+ if source_ref:
+ break
+ current_owner = parent_by_id.get(id(current_owner))
+ baseline_owner = (
+ baseline_by_ref.get(source_ref)
+ if source_ref is not None
+ else None
+ )
+ for carrier in text_element.iter():
+ if _local_name(carrier) not in {'text', 'tspan'}:
+ continue
+ if not re.sub(r'\s+', ' ', ''.join(carrier.itertext())).strip():
+ continue
+ current_family = cls._roundtrip_resolved_font_family(
+ carrier,
+ parent_by_id,
+ )
+ if current_family is None:
+ continue
+ baseline_context = baseline_root
+ if current_owner is not None and baseline_owner is not None:
+ relative_path = cls._roundtrip_relative_path(
+ carrier,
+ current_owner,
+ parent_by_id,
+ )
+ if relative_path is not None:
+ baseline_context = cls._roundtrip_baseline_context(
+ current_owner,
+ baseline_owner,
+ relative_path,
+ )
+ baseline_family = cls._roundtrip_resolved_font_family(
+ baseline_context,
+ baseline_parent_by_id,
+ )
+ normalized = cls._normalize_font_stack(current_family)
+ if (
+ baseline_family is not None
+ and normalized
+ == cls._normalize_font_stack(baseline_family)
+ ):
+ continue
+ if normalized and normalized not in seen:
+ changed.append(current_family)
+ seen.add(normalized)
+ return changed
+
def _check_roundtrip_text_frames(
self,
root: ET.Element,
@@ -2261,14 +2422,24 @@ class SVGQualityChecker:
'max_frame_share': round(max(frame_shares), 4) if frame_shares else 0.0,
}
- def _check_fonts(self, content: str, result: Dict):
+ def _check_fonts(
+ self,
+ content: str,
+ result: Dict,
+ *,
+ font_families: List[str] | None = None,
+ ):
"""Check font usage.
PPTX stores concrete typefaces per run with no CSS fallback. The
converter resolves each SVG font stack to exported latin / EA typefaces;
validate those exported values rather than the visual-preview tail.
"""
- font_matches = self._font_family_values(content)
+ font_matches = (
+ self._font_family_values(content)
+ if font_families is None
+ else font_families
+ )
if not font_matches:
return
diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py
index c30f0b73..2be15990 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py
@@ -36,6 +36,7 @@ from pptx_embedded_fonts import (
)
from pptx_transitions import (
AdvanceUpdate,
+ DEFAULT_TRANSITION_DURATION,
EnterUpdate,
MorphPairExpectation,
NATIVE_TRANSITIONS,
@@ -44,6 +45,7 @@ from pptx_transitions import (
normalize_transition_effect_request,
serialize_source_xml,
set_directory_use_timings,
+ transition_carriers,
validate_generated_transition_xml,
validate_pptx_morph_pairs,
validate_pptx_transition_package,
@@ -222,6 +224,9 @@ class RoundtripSlidePatch:
deleted_ref_ids: frozenset[str]
visual_changed: bool
motion_changed: bool
+ transition_changed: bool
+ transition_replaced: bool
+ animation_changed: bool
notes_changed: bool
@@ -977,19 +982,25 @@ def _merge_roundtrip_relationships(
def _replace_roundtrip_motion(
source_root: ET.Element,
generated_root: ET.Element,
+ *,
+ transition_changed: bool,
+ transition_replaced: bool,
+ animation_changed: bool,
) -> None:
- """Replace source transition/timing nodes with the generated request."""
- for local_name in ("transition", "timing"):
- tag = f"{{{PML_NS}}}{local_name}"
- existing = source_root.find(tag)
- generated = generated_root.find(tag)
- if existing is not None:
- source_root.remove(existing)
- if generated is None:
- continue
- clone = ET.fromstring(ET.tostring(generated, encoding="utf-8"))
- children = list(source_root)
- if local_name == "transition":
+ """Replace only explicitly changed transition and animation state."""
+ if transition_changed and transition_replaced:
+ generated_carriers = transition_carriers(generated_root)
+ if len(generated_carriers) > 1:
+ raise TemplateStructureError(
+ "Generated round-trip slide has multiple transition carriers"
+ )
+ for carrier in transition_carriers(source_root):
+ source_root.remove(carrier)
+ if generated_carriers:
+ clone = ET.fromstring(
+ ET.tostring(generated_carriers[0], encoding="utf-8")
+ )
+ children = list(source_root)
insert_at = next(
(
index
@@ -1001,16 +1012,205 @@ def _replace_roundtrip_motion(
),
len(children),
)
- else:
+ source_root.insert(insert_at, clone)
+ elif transition_changed:
+ _replace_roundtrip_transition_advance(source_root, generated_root)
+
+ if animation_changed:
+ timing_tag = f"{{{PML_NS}}}timing"
+ existing_timing = source_root.find(timing_tag)
+ generated_timing = generated_root.find(timing_tag)
+ if existing_timing is not None:
+ source_root.remove(existing_timing)
+ if generated_timing is None:
+ return
+ clone = ET.fromstring(ET.tostring(generated_timing, encoding="utf-8"))
+ children = list(source_root)
+ insert_at = next(
+ (
+ index
+ for index, child in enumerate(children)
+ if child.tag == f"{{{PML_NS}}}extLst"
+ ),
+ len(children),
+ )
+ source_root.insert(insert_at, clone)
+
+
+def _replace_roundtrip_transition_advance(
+ source_root: ET.Element,
+ generated_root: ET.Element,
+) -> None:
+ """Copy only advance attributes while preserving the source visual effect."""
+ source_carriers = transition_carriers(source_root)
+ generated_carriers = transition_carriers(generated_root)
+ if len(source_carriers) > 1 or len(generated_carriers) > 1:
+ raise TemplateStructureError(
+ "Round-trip transition advance patch requires at most one carrier"
+ )
+
+ transition_tag = f"{{{PML_NS}}}transition"
+
+ def _elements(carrier: ET.Element) -> list[ET.Element]:
+ if carrier.tag == transition_tag:
+ return [carrier]
+ return list(carrier.iter(transition_tag))
+
+ generated_transitions = (
+ _elements(generated_carriers[0]) if generated_carriers else []
+ )
+ advance_values = {
+ (transition.get("advClick"), transition.get("advTm"))
+ for transition in generated_transitions
+ }
+ if len(advance_values) > 1:
+ raise TemplateStructureError(
+ "Generated transition branches disagree on advance attributes"
+ )
+ advance_click, advance_after = (
+ next(iter(advance_values)) if advance_values else (None, None)
+ )
+
+ if not source_carriers:
+ if generated_carriers:
+ clone = ET.fromstring(
+ ET.tostring(generated_carriers[0], encoding="utf-8")
+ )
+ children = list(source_root)
insert_at = next(
(
index
for index, child in enumerate(children)
- if child.tag == f"{{{PML_NS}}}extLst"
+ if child.tag in {
+ f"{{{PML_NS}}}timing",
+ f"{{{PML_NS}}}extLst",
+ }
),
len(children),
)
- source_root.insert(insert_at, clone)
+ source_root.insert(insert_at, clone)
+ return
+
+ source_transitions = _elements(source_carriers[0])
+ if not source_transitions:
+ raise TemplateStructureError(
+ "Source logical transition carrier contains no p:transition"
+ )
+ for transition in source_transitions:
+ for attribute, value in (
+ ("advClick", advance_click),
+ ("advTm", advance_after),
+ ):
+ if value is None:
+ transition.attrib.pop(attribute, None)
+ else:
+ transition.set(attribute, value)
+
+
+_RAW_ALTERNATE_CONTENT_RE = re.compile(
+ rb"<mc:AlternateContent\b[^>]*>.*?</mc:AlternateContent\s*>",
+ re.DOTALL,
+)
+_RAW_DIRECT_TRANSITION_RE = re.compile(
+ rb"<p:transition\b(?:[^>]*/>|[^>]*>.*?</p:transition\s*>)",
+ re.DOTALL,
+)
+_RAW_TIMING_RE = re.compile(
+ rb"<p:timing\b(?:[^>]*/>|[^>]*>.*?</p:timing\s*>)",
+ re.DOTALL,
+)
+
+
+def _raw_transition_carrier_span(xml_data: bytes) -> tuple[int, int] | None:
+ """Locate one raw root transition carrier in PowerPoint slide XML."""
+ alternate_spans = [
+ match.span()
+ for match in _RAW_ALTERNATE_CONTENT_RE.finditer(xml_data)
+ ]
+ carriers = [
+ span
+ for span in alternate_spans
+ if _RAW_DIRECT_TRANSITION_RE.search(xml_data[span[0]:span[1]])
+ ]
+ for match in _RAW_DIRECT_TRANSITION_RE.finditer(xml_data):
+ if any(start <= match.start() < end for start, end in alternate_spans):
+ continue
+ carriers.append(match.span())
+ if len(carriers) > 1:
+ raise TemplateStructureError(
+ "Round-trip slide has multiple raw transition carriers"
+ )
+ return carriers[0] if carriers else None
+
+
+def _preserve_roundtrip_transition_markup(
+ serialized_slide: bytes,
+ source_slide: bytes,
+) -> bytes:
+ """Restore an unchanged source transition carrier byte-for-byte."""
+ source_span = _raw_transition_carrier_span(source_slide)
+ serialized_span = _raw_transition_carrier_span(serialized_slide)
+ if source_span is None:
+ if serialized_span is not None:
+ raise TemplateStructureError(
+ "Round-trip serialization introduced a transition carrier"
+ )
+ return serialized_slide
+ if serialized_span is None:
+ raise TemplateStructureError(
+ "Round-trip serialization removed the preserved transition carrier"
+ )
+ return (
+ serialized_slide[:serialized_span[0]]
+ + source_slide[source_span[0]:source_span[1]]
+ + serialized_slide[serialized_span[1]:]
+ )
+
+
+def _raw_timing_span(xml_data: bytes) -> tuple[int, int] | None:
+ """Locate one raw logical object-animation timing carrier in slide XML."""
+ alternate_spans = [
+ match.span()
+ for match in _RAW_ALTERNATE_CONTENT_RE.finditer(xml_data)
+ ]
+ timings = [
+ span
+ for span in alternate_spans
+ if _RAW_TIMING_RE.search(xml_data[span[0]:span[1]])
+ ]
+ for match in _RAW_TIMING_RE.finditer(xml_data):
+ if any(start <= match.start() < end for start, end in alternate_spans):
+ continue
+ timings.append(match.span())
+ if len(timings) > 1:
+ raise TemplateStructureError(
+ "Round-trip slide has multiple raw object-animation timing carriers"
+ )
+ return timings[0] if timings else None
+
+
+def _preserve_roundtrip_timing_markup(
+ serialized_slide: bytes,
+ source_slide: bytes,
+) -> bytes:
+ """Restore unchanged source object-animation timing byte-for-byte."""
+ source_span = _raw_timing_span(source_slide)
+ serialized_span = _raw_timing_span(serialized_slide)
+ if source_span is None:
+ if serialized_span is not None:
+ raise TemplateStructureError(
+ "Round-trip serialization introduced object-animation timing"
+ )
+ return serialized_slide
+ if serialized_span is None:
+ raise TemplateStructureError(
+ "Round-trip serialization removed preserved object-animation timing"
+ )
+ return (
+ serialized_slide[:serialized_span[0]]
+ + source_slide[source_span[0]:source_span[1]]
+ + serialized_slide[serialized_span[1]:]
+ )
def _apply_roundtrip_transition_overlay(
@@ -1020,20 +1220,27 @@ def _apply_roundtrip_transition_overlay(
effect_options: dict[str, object],
duration: float,
auto_advance: float | None,
+ replace_transition: bool,
) -> bool:
"""Patch only transition/advance state while preserving source timing."""
- source_xml = slide_path.read_text(encoding="utf-8")
+ source_bytes = slide_path.read_bytes()
+ source_xml = source_bytes.decode("utf-8")
source_animation = object_animation_fingerprint(source_xml)
- enter = (
- EnterUpdate(policy="none", effect=None, duration=duration)
- if effect is None
- else EnterUpdate(
+ if not replace_transition:
+ enter = EnterUpdate(policy="preserve", duration=duration)
+ elif effect is None:
+ enter = EnterUpdate(
+ policy="none",
+ effect=None,
+ duration=(duration or DEFAULT_TRANSITION_DURATION),
+ )
+ else:
+ enter = EnterUpdate(
policy="replace",
effect=effect,
duration=duration,
effect_options=effect_options,
)
- )
advance = (
AdvanceUpdate(mode="click")
if auto_advance is None
@@ -1048,15 +1255,21 @@ def _apply_roundtrip_transition_overlay(
raise RuntimeError(
"Round-trip transition overlay changed source object animations"
)
- validate_generated_transition_xml(
- updated_xml,
- effect=effect,
- effect_options=effect_options,
- duration=duration,
- advance_on_click=True,
- advance_after=auto_advance,
+ if replace_transition:
+ validate_generated_transition_xml(
+ updated_xml,
+ effect=effect,
+ effect_options=effect_options,
+ duration=duration,
+ advance_on_click=True,
+ advance_after=auto_advance,
+ )
+ slide_path.write_bytes(
+ _preserve_roundtrip_timing_markup(
+ updated_xml.encode("utf-8"),
+ source_bytes,
+ )
)
- slide_path.write_text(updated_xml, encoding="utf-8")
return uses_timings
@@ -1326,28 +1539,38 @@ def _apply_roundtrip_slide_overlay(
for element in generated_nodes
for relationship_id in _relationship_ids_in_shape(element)
}
- if patch.motion_changed:
- for local_name in ("transition", "timing"):
- motion_node = generated_root.find(f"{{{PML_NS}}}{local_name}")
- if motion_node is not None:
- required_generated_relationship_ids.update(
- _relationship_ids_in_shape(motion_node)
- )
+ if patch.transition_changed:
+ for carrier in transition_carriers(generated_root):
+ required_generated_relationship_ids.update(
+ _relationship_ids_in_shape(carrier)
+ )
+ if patch.animation_changed:
+ motion_node = generated_root.find(f"{{{PML_NS}}}timing")
+ if motion_node is not None:
+ required_generated_relationship_ids.update(
+ _relationship_ids_in_shape(motion_node)
+ )
_merge_roundtrip_relationships(
source_rels,
generated_rels_path,
generated_root,
required_generated_relationship_ids,
)
- if patch.motion_changed:
- _replace_roundtrip_motion(source_root, generated_root)
+ if patch.transition_changed or patch.animation_changed:
+ _replace_roundtrip_motion(
+ source_root,
+ generated_root,
+ transition_changed=patch.transition_changed,
+ transition_replaced=patch.transition_replaced,
+ animation_changed=patch.animation_changed,
+ )
restored_shape_id_map = {
generated_top_id: source_id
for generated_top_id, source_id in source_id_by_generated_top_id.items()
if source_id not in affected_top_ids
and generated_top_id != source_id
}
- if patch.motion_changed:
+ if patch.animation_changed:
_rewrite_roundtrip_timing_shape_ids(
source_root,
restored_shape_id_map,
@@ -1356,7 +1579,7 @@ def _apply_roundtrip_slide_overlay(
generated_nodes,
retained_source_nodes,
source_root,
- rewrite_timing=patch.motion_changed,
+ rewrite_timing=patch.animation_changed,
)
for child in list(source_tree):
@@ -1369,7 +1592,7 @@ def _apply_roundtrip_slide_overlay(
for element in source_tree
for value in _shape_ids_in_element(element)
}
- if not patch.motion_changed:
+ if not patch.animation_changed:
missing_timing_targets = _timing_shape_ids(source_root) - visible_shape_ids
if missing_timing_targets:
raise TemplateStructureError(
@@ -1377,9 +1600,18 @@ def _apply_roundtrip_slide_overlay(
"animations.json explicitly: "
+ ", ".join(sorted(missing_timing_targets, key=int))
)
- generated_slide_path.write_bytes(
- serialize_source_xml(source_root, source_slide)
- )
+ serialized_slide = serialize_source_xml(source_root, source_slide)
+ if not patch.transition_changed:
+ serialized_slide = _preserve_roundtrip_transition_markup(
+ serialized_slide,
+ source_slide,
+ )
+ if not patch.animation_changed:
+ serialized_slide = _preserve_roundtrip_timing_markup(
+ serialized_slide,
+ source_slide,
+ )
+ generated_slide_path.write_bytes(serialized_slide)
combined_id_map = {
**restored_shape_id_map,
**renumbered_shape_id_map,
@@ -5897,7 +6129,7 @@ def create_pptx_with_native_svg(
source_motion_slides = passthrough_slides | {
index
for index, patch in slide_patches.items()
- if not patch.motion_changed
+ if not patch.animation_changed
}
invalid_passthrough = sorted(
index
@@ -6465,6 +6697,7 @@ def create_pptx_with_native_svg(
effect_options=overlay_transition_options,
duration=overlay_transition_duration,
auto_advance=overlay_auto_advance,
+ replace_transition=slide_patch.transition_replaced,
):
package_uses_timings = True
if slide_patch.notes_changed:
@@ -7094,12 +7327,16 @@ def create_pptx_with_native_svg(
narration_slides_created.add(slide_num)
final_slide_xml = slide_xml_path.read_text(encoding='utf-8')
- preserved_source_motion = (
- slide_patch is not None and not slide_patch.motion_changed
+ preserved_source_transition = (
+ slide_patch is not None
+ and not slide_patch.transition_replaced
+ )
+ preserved_source_animation = (
+ slide_patch is not None and not slide_patch.animation_changed
)
resolved_motion = None
resolved_animation = None
- if not preserved_source_motion:
+ if not preserved_source_transition:
try:
resolved_motion = validate_generated_transition_xml(
final_slide_xml,
@@ -7114,6 +7351,7 @@ def create_pptx_with_native_svg(
raise RuntimeError(
f'Slide {slide_num} transition validation failed: {exc}'
) from exc
+ if not preserved_source_animation:
try:
resolved_animation = validate_generated_animation_xml(
final_slide_xml,
diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py
index 3dbda44a..07726cda 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py
@@ -454,6 +454,9 @@ def _roundtrip_slide_patches(
*,
force_visual_changed: bool,
force_motion_changed: bool,
+ force_transition_changed: bool,
+ force_transition_replaced: bool,
+ force_animation_changed: bool,
force_notes_changed: bool,
) -> dict[int, RoundtripSlidePatch]:
"""Build strict source-overlay metadata for edited authoring slides."""
@@ -528,13 +531,33 @@ def _roundtrip_slide_patches(
f"Round-trip manifest slide {page.source_slide} lacks "
"animationSha256"
)
- motion_changed = force_motion_changed or (
+ sidecar_changed = (
slide_animation_config_sha256(
animation_config,
page.svg_stem,
)
!= expected_animation
)
+ motion_changed = force_motion_changed or sidecar_changed
+ slide_config = _as_dict(
+ _as_dict(animation_config.get("slides")).get(page.svg_stem)
+ )
+ transition_changed = force_transition_changed or (
+ sidecar_changed and "transition" in slide_config
+ )
+ slide_transition_config = _as_dict(slide_config.get("transition"))
+ transition_replaced = force_transition_replaced or (
+ sidecar_changed
+ and "transition" in slide_config
+ and any(
+ key in slide_transition_config
+ for key in ("effect", "effect_options", "duration", "sound")
+ )
+ )
+ animation_changed = force_animation_changed or (
+ sidecar_changed
+ and any(key in slide_config for key in ("animation", "groups"))
+ )
def _ref_set(field: str) -> frozenset[str]:
value = raw.get(field)
@@ -558,6 +581,9 @@ def _roundtrip_slide_patches(
or raw.get("defs_changed") is True
),
motion_changed=motion_changed,
+ transition_changed=transition_changed,
+ transition_replaced=transition_replaced,
+ animation_changed=animation_changed,
notes_changed=(
force_notes_changed
or _roundtrip_note_changed(project_path, row, page)
@@ -2208,11 +2234,14 @@ Recorded narration:
print("Error: --image-quality must be between 1 and 100", file=sys.stderr)
return 1
- try:
- project_info = get_project_info(str(project_path))
- project_name = project_info.get('name', project_path.name)
- except Exception:
- project_name = project_path.name
+ if args.roundtrip:
+ project_name = project_path.resolve().name
+ else:
+ try:
+ project_info = get_project_info(str(project_path))
+ project_name = project_info.get('name', project_path.name)
+ except Exception:
+ project_name = project_path.name
canvas_format = args.format
expected_viewbox = (
@@ -2447,6 +2476,31 @@ Recorded narration:
args.use_narration_timings,
args.inherit_motion_from is not None,
))
+ roundtrip_transition_overridden = any((
+ args.no_animations,
+ args.transition is not None,
+ args.transition_duration is not None,
+ args.auto_advance is not None,
+ args.recorded_narration is not None,
+ args.narration_audio_dir is not None,
+ args.use_narration_timings,
+ args.inherit_motion_from is not None,
+ ))
+ roundtrip_transition_replaced = any((
+ args.no_animations,
+ args.transition is not None,
+ args.transition_duration is not None,
+ args.inherit_motion_from is not None,
+ ))
+ roundtrip_animation_overridden = any((
+ args.no_animations,
+ args.animation is not None,
+ args.animation_duration is not None,
+ args.animation_stagger is not None,
+ args.animation_trigger is not None,
+ args.animation_config is not None,
+ args.inherit_motion_from is not None,
+ ))
try:
roundtrip_slide_patches = _roundtrip_slide_patches(
project_path.resolve(),
@@ -2458,6 +2512,9 @@ Recorded narration:
or args.text_flow != TEXT_FLOW_PRESERVE
),
force_motion_changed=roundtrip_motion_overridden,
+ force_transition_changed=roundtrip_transition_overridden,
+ force_transition_replaced=roundtrip_transition_replaced,
+ force_animation_changed=roundtrip_animation_overridden,
force_notes_changed=args.no_notes,
)
except RuntimeError as exc:
diff --git a/skills/ppt-master/workflows/edit-native-pptx.md b/skills/ppt-master/workflows/edit-native-pptx.md
index abf174ab..eaf8d195 100644
--- a/skills/ppt-master/workflows/edit-native-pptx.md
+++ b/skills/ppt-master/workflows/edit-native-pptx.md
@@ -205,6 +205,8 @@ Skip this section when no module in §4.2 is enabled beyond preserving source no
**Motion**: Load [`animations.md`](../references/animations.md) when transitions or object animations are requested. `animations.json` rows are keyed by output SVG stem; a copied page inherits its source row unless it has its own.
+**Hard rule — rebuilt animation targets**: Rebuilding an object that a source animation targets (for example a chart whose data you edited) leaves that animation without a target, and export stops with `Edited slide removed source animation target(s)`. Give that page its own row so its motion becomes explicit — `"<stem>": {"animation": {"effect": "none"}}` drops the source build, or author the page's animation in the row — then export again.
+
---
## 7. Export and Validate