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(svg_to_pptx): preserve semantic group animations

hugohe3b72aae75108b
diff --git a/skills/ppt-master/scripts/pptx_animations.py b/skills/ppt-master/scripts/pptx_animations.py
index 15d3be7a..1b519e5e 100644
--- a/skills/ppt-master/scripts/pptx_animations.py
+++ b/skills/ppt-master/scripts/pptx_animations.py
@@ -368,9 +368,9 @@ def create_sequence_timing_xml(
all_steps = '\n '.join(steps)
else:
# with-previous / after-previous: wrap the entire cascade in ONE
- # auto-firing par so the sequence has a real trigger anchor under
- # mainSeq. Inside that wrapper, each element is a sibling par
- # whose cTn carries nodeType=withEffect or afterEffect.
+ # par so the sequence has a real trigger anchor under mainSeq.
+ # Inside that wrapper, each element is a sibling par whose cTn
+ # carries nodeType=withEffect or afterEffect.
outer_id = next_id
next_id += 1
inner_steps = []
@@ -407,9 +407,19 @@ def create_sequence_timing_xml(
</p:par>''')
inner_xml = '\n '.join(inner_steps)
+ if trigger == 'with-previous':
+ # Match PowerPoint's native "Start: With Previous" export:
+ # the wrapper waits for mainSeq to begin, while all child
+ # withEffect nodes start at delay=0 under that same anchor.
+ outer_start_conditions = (
+ '<p:cond delay="indefinite"/>'
+ '<p:cond evt="onBegin" delay="0"><p:tn val="2"/></p:cond>'
+ )
+ else:
+ outer_start_conditions = '<p:cond delay="0"/>'
all_steps = f'''<p:par>
<p:cTn id="{outer_id}" fill="hold">
- <p:stCondLst><p:cond delay="0"/></p:stCondLst>
+ <p:stCondLst>{outer_start_conditions}</p:stCondLst>
<p:childTnLst>
{inner_xml}
</p:childTnLst>
diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.py
index 72998204..767c051f 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.py
@@ -113,11 +113,17 @@ def convert_g(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:
if not child_results:
return None
- # Single child: flatten
- if len(child_results) == 1:
+ elem_id = elem.get('id')
+ should_animate_group = ctx.depth == 0 and elem_id and not _is_chrome_id(elem_id)
+
+ # Single-child non-semantic groups are flattened to reduce nesting. Top-level
+ # semantic groups are preserved so animations target the group, not its
+ # individual child shapes.
+ if len(child_results) == 1 and not should_animate_group:
return child_results[0]
- # Multiple children: wrap in <p:grpSp>
+ # Multiple children, or a top-level semantic one-child group: wrap in
+ # <p:grpSp> so PowerPoint can animate the group as one unit.
min_x = min_y = float('inf')
max_x = max_y = float('-inf')
@@ -146,8 +152,7 @@ def convert_g(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:
# multi-child wrapper qualifies — flattened single-child groups have no
# <p:grpSp> to anchor a timing target on, and nested groups are
# ignored to keep the animation budget at ~per-section granularity.
- elem_id = elem.get('id')
- if ctx.depth == 0 and elem_id and not _is_chrome_id(elem_id):
+ if should_animate_group:
ctx.anim_targets.append((group_id, elem_id))
group_effect = ''