ci-platforms / windows amd64 smoke (push) Skipped
ci / release (push) Successful in 8m58s
ci-platforms / darwin amd64 smoke (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
ci / checks (push) Successful in 4m46s
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 13m28s
22 lines
662 B
Go
22 lines
662 B
Go
package document
|
|
|
|
import (
|
|
"aego/core/ids"
|
|
"aego/render/material"
|
|
"aego/scene/mutate"
|
|
)
|
|
|
|
// ApplyMaterialMutation edits the Inspector/code panel's shared buffer and history using the caller's current checked shader schema, never the loader's shared runtime material.
|
|
func ApplyMaterialMutation(d *ScriptDocument, resolve func(ids.AssetID) (*material.Shader, bool), tx mutate.Tx, continuing bool) (*mutate.Result, error) {
|
|
m, err := mutate.LoadMaterial(d.Code.Bytes(), d.Path, resolve)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
result, err := m.Apply(tx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
d.Code.ReplaceSnapshot(m.Bytes(), continuing)
|
|
return result, nil
|
|
}
|