Skip to content

Commit f6020d4

Browse files
committed
File variable fix, node rename
1 parent 09a92fb commit f6020d4

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

generator/variable/file.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@ func (tv *FileVariable) ApplyMessage(msg []byte) (bool, error) {
5656
}
5757

5858
func (tv *FileVariable) applyProfile(profile json.RawMessage) error {
59+
data := make([]byte, 0)
60+
err := json.Unmarshal(profile, &data)
61+
if err != nil {
62+
return err
63+
}
5964
tv.version++
60-
tv.value = profile
65+
tv.value = data
6166
return nil
6267
}
6368

math/sequence/nodes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
func init() {
1010
factory := &refutil.TypeFactory{}
1111

12-
refutil.RegisterType[nodes.Struct[UniformNode]](factory)
12+
refutil.RegisterType[nodes.Struct[LinearNode]](factory)
1313

1414
generator.RegisterTypes(factory)
1515
}

math/sequence/uniform.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ package sequence
22

33
import "github.com/EliCDavis/polyform/nodes"
44

5-
type UniformNode struct {
5+
type LinearNode struct {
66
Start nodes.Output[float64]
77
End nodes.Output[float64]
88
Samples nodes.Output[int]
99
}
1010

11-
func (snd UniformNode) Out(out *nodes.StructOutput[[]float64]) {
11+
func (snd LinearNode) Out(out *nodes.StructOutput[[]float64]) {
1212
start := nodes.TryGetOutputValue(out, snd.Start, 0.)
1313
end := nodes.TryGetOutputValue(out, snd.End, 1.)
1414
samples := max(nodes.TryGetOutputValue(out, snd.Samples, 0), 0)

0 commit comments

Comments
 (0)