@@ -21,7 +21,6 @@ pub(crate) fn py_to_shader_value(value: &Bound<'_, PyAny>) -> PyResult<shader_va
2121 return Ok ( shader_value:: ShaderValue :: Int ( v) ) ;
2222 }
2323
24- // Accept PyVec types
2524 if let Ok ( v) = value. extract :: < PyRef < PyVec4 > > ( ) {
2625 return Ok ( shader_value:: ShaderValue :: Float4 ( v. 0 . to_array ( ) ) ) ;
2726 }
@@ -36,7 +35,6 @@ pub(crate) fn py_to_shader_value(value: &Bound<'_, PyAny>) -> PyResult<shader_va
3635 return Ok ( shader_value:: ShaderValue :: Buffer ( buf. entity ) ) ;
3736 }
3837
39- // Fall back to raw arrays
4038 if let Ok ( v) = value. extract :: < [ f32 ; 4 ] > ( ) {
4139 return Ok ( shader_value:: ShaderValue :: Float4 ( v) ) ;
4240 }
@@ -53,9 +51,8 @@ pub(crate) fn py_to_shader_value(value: &Bound<'_, PyAny>) -> PyResult<shader_va
5351 ) ) )
5452}
5553
56- /// Apply an `albedo` value to a material, dispatching by Python type. The
57- /// material's backing asset is swapped between plain-PBR and field-buffer
58- /// variants as needed; all other `StandardMaterial` state survives the swap.
54+ /// Dispatch `albedo=` by Python type to the matching Rust setter. May swap
55+ /// the backing asset; all other StandardMaterial state survives.
5956fn apply_albedo ( entity : Entity , value : & Bound < ' _ , PyAny > ) -> PyResult < ( ) > {
6057 if let Ok ( buf) = value. extract :: < PyRef < Buffer > > ( ) {
6158 return material_set_albedo_buffer ( entity, buf. entity )
@@ -95,9 +92,8 @@ fn apply_kwargs(entity: Entity, kwargs: &Bound<'_, PyDict>) -> PyResult<()> {
9592
9693#[ pymethods]
9794impl Material {
98- /// Construct a material. With no args, returns a default PBR. With a
99- /// `shader` arg, returns a custom material. Any kwargs (`albedo=...`,
100- /// `roughness=...`, etc.) are applied after construction.
95+ /// No args: default PBR. With `shader`: custom material. Kwargs are
96+ /// applied via `set` after construction.
10197 #[ new]
10298 #[ pyo3( signature = ( shader=None , * * kwargs) ) ]
10399 pub fn new ( shader : Option < & Shader > , kwargs : Option < & Bound < ' _ , PyDict > > ) -> PyResult < Self > {
@@ -114,8 +110,8 @@ impl Material {
114110 Ok ( Self { entity } )
115111 }
116112
117- /// PBR-lit material. `albedo` accepts a `Color` (solid) or a `Buffer`
118- /// ( per-particle, indexed by per-instance tag — used with `Field`s ).
113+ /// PBR-lit material. `albedo` accepts a `Color` or a `Buffer` (the latter
114+ /// being per-particle, used with `Particles` ).
119115 #[ staticmethod]
120116 #[ pyo3( signature = ( * * kwargs) ) ]
121117 pub fn pbr ( kwargs : Option < & Bound < ' _ , PyDict > > ) -> PyResult < Self > {
@@ -126,8 +122,7 @@ impl Material {
126122 Ok ( Self { entity } )
127123 }
128124
129- /// Unlit material — same shape as `pbr` but skips lighting calculations
130- /// (the per-particle / solid color is the final output).
125+ /// Like `pbr` but skips lighting; albedo is the final output color.
131126 #[ staticmethod]
132127 #[ pyo3( signature = ( * * kwargs) ) ]
133128 pub fn unlit ( kwargs : Option < & Bound < ' _ , PyDict > > ) -> PyResult < Self > {
@@ -140,10 +135,8 @@ impl Material {
140135 Ok ( Self { entity } )
141136 }
142137
143- /// Patch one or more material properties. `albedo` is special-cased and
144- /// may swap the backing asset type between solid-color and buffer-color
145- /// variants — all other `StandardMaterial` state (roughness, metallic,
146- /// emissive, alpha_mode, unlit, etc.) is preserved across the swap.
138+ /// Patch material properties. `albedo` may swap the backing asset between
139+ /// color and buffer variants; other StandardMaterial fields are preserved.
147140 #[ pyo3( signature = ( * * kwargs) ) ]
148141 pub fn set ( & self , kwargs : Option < & Bound < ' _ , PyDict > > ) -> PyResult < ( ) > {
149142 let Some ( kwargs) = kwargs else {
0 commit comments