3D-Demo/jsm/node-editor/accessors/UVEditor.js

26 lines
521 B
JavaScript
Raw Normal View History

2022-10-14 16:50:42 +08:00
import { SelectInput, LabelElement } from '../../libs/flow.module.js';
import { BaseNode } from '../core/BaseNode.js';
import { UVNode } from 'three-nodes/Nodes.js';
export class UVEditor extends BaseNode {
constructor() {
const node = new UVNode();
super( 'UV', 2, node, 200 );
const optionsField = new SelectInput( [ '1', '2' ], 0 ).onChange( () => {
node.index = Number( optionsField.getValue() );
this.invalidate();
} );
this.add( new LabelElement( 'Channel' ).add( optionsField ) );
}
}