#315: Front / Bevel / Side / Back Color for extruded shapes and text
Problem: In Advanced 3D, an extruded shape or text layer was one mesh in its paint colour. After Effects colours the front, bevel, side and back of an extrusion separately (shape Contents ▸ Add ▸ Front/Bevel/Side/Back, text Animate ▸ Front/Bevel/Side/Back), and EffectCraft had none of it. Fix: The extruder can split its mesh by surface (front cap, bevel rings, walls, back cap). Shape layers get Front / Bevel / Side / Back contents items (layer.addShapeItem kinds frontColor…backColor, one item per group, colouring every paint of the group and its nested groups; the innermost wins). Text animators get Front / Bevel / Side / Back Color, blended over the character's fill or stroke by the selection. Paints with a surface colour render as one mesh per surface. Menus, the Contents Add: pop-up and the menu translations list them. The other surface material properties (Ambient, Diffuse, Specular, Metal, Reflection, ...) remain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9a7d3e7699
commit
fb5a5e9ac0
@@ -58,9 +58,21 @@ pub struct CharXf {
|
||||
/// Variable Font Axes offsets (axis tag, user units), the first `n_axes` used.
|
||||
pub axes: [([u8; 4], f64); 4],
|
||||
pub n_axes: u8,
|
||||
/// Front / Bevel / Side / Back Color of the extruded character (Advanced 3D), by
|
||||
/// `effectcraft_model::extrude::Surface` index, and the selection each was set with.
|
||||
pub surface: [Option<[f32; 4]>; 4],
|
||||
pub surface_k: [f32; 4],
|
||||
}
|
||||
|
||||
impl CharXf {
|
||||
/// The surface colours of an extrusion painted `base` (the character's fill or stroke):
|
||||
/// each animated surface colour blended over `base` by its selection.
|
||||
pub fn surface_colors(&self, base: [f32; 4]) -> crate::shapes::SurfaceColors {
|
||||
std::array::from_fn(|i| {
|
||||
let (c, k) = (self.surface.get(i).copied().flatten()?, self.surface_k.get(i).copied().unwrap_or(0.0));
|
||||
Some(std::array::from_fn(|d| base[d] + (c[d] - base[d]) * k))
|
||||
})
|
||||
}
|
||||
/// The variable-font axis offsets that move the outline.
|
||||
pub fn axis_deltas(&self) -> Vec<(String, f32)> {
|
||||
self.axes[..self.n_axes as usize]
|
||||
@@ -79,6 +91,10 @@ impl CharXf {
|
||||
}
|
||||
}
|
||||
|
||||
/// Animator property match ids of Front / Bevel / Side / Back Color, in
|
||||
/// `effectcraft_model::extrude::Surface::ALL` order.
|
||||
pub const SURFACE_ANIM_PROPS: [&str; 4] = ["frontColor", "bevelColor", "sideColor", "backColor"];
|
||||
|
||||
/// Animator property match id of a Variable Font Axes property (`axis_wght`).
|
||||
pub const AXIS_PREFIX: &str = "axis_";
|
||||
|
||||
@@ -115,6 +131,8 @@ impl Default for CharXf {
|
||||
blur: [0.0; 2],
|
||||
axes: [([0; 4], 0.0); 4],
|
||||
n_axes: 0,
|
||||
surface: [None; 4],
|
||||
surface_k: [0.0; 4],
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -274,6 +292,7 @@ pub fn char_transforms(ctx: &EvalCtx, layer: &Layer, text: &PropGroup, lay: &Tex
|
||||
let char_range = props.get("characterRange").map(|p| ctx.value(layer, p).as_enum());
|
||||
let char_align = props.get("characterAlignment").map(|p| ctx.value(layer, p).as_enum());
|
||||
let blur = props.get("blur").map(|p| ctx.value(layer, p).as_vec2());
|
||||
let surface = SURFACE_ANIM_PROPS.map(|m| props.get(m).map(|p| ctx.value(layer, p).as_color()));
|
||||
let axes: Vec<([u8; 4], f64)> = props
|
||||
.props()
|
||||
.filter_map(|p| {
|
||||
@@ -385,6 +404,12 @@ pub fn char_transforms(ctx: &EvalCtx, layer: &Layer, text: &PropGroup, lay: &Tex
|
||||
for (tag, v) in &axes {
|
||||
c.add_axis(*tag, v * k);
|
||||
}
|
||||
for ((s, sk), v) in c.surface.iter_mut().zip(&mut c.surface_k).zip(surface) {
|
||||
if let Some(v) = v {
|
||||
*s = Some(v);
|
||||
*sk = (*sk + k as f32).clamp(0.0, 1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
|
||||
Reference in New Issue
Block a user