-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbaseobj.js
52 lines (45 loc) · 1.46 KB
/
baseobj.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// gui - объект с гуями, p - объект с js-свойствами
export function addBaseGui( gui, p ) {
var sr = gui.addSlider( "radius", 2, 0.1, 20, 0.1, function(v) {
p.radius = v;
});
var sc = gui.addColor( "color", p.color, function(v) {
// console.log("ccc=",v);
p.color = v;
});
var so = gui.addSlider( "opacity", 100,0,100,1,function(v) {
p.opacity = v / 100.0;
});
// p.radiusChanged.connect...
return gui;
}
export default function setup( m, vis ) {
vis.addQml3d = function( qmlfile, parent, name, opts ) {
var p = m.addQml( qmlfile, Object.assign( {parent:parent, name: name}, opts || {} ) );
/*
if (!parent) {
parent = qmlEngine.rootObject;
}
var p = m.create_qml( qmlfile );
m.create_obj( p, {name: name,parent:parent} );
*/
vis.addBaseGui( p,p );
return p;
}
m.addQml = function( qmlfile, opts ) {
var isparentqml = opts && opts.parent && opts.parent.$tidyupList ? true : false;
var p = m.create_qml( qmlfile, isparentqml ? opts.parent : qmlEngine.rootObject,function(newobj) {
newobj.vz = m; // pass viewzavr system to created objects.
} );
if (!p) {
//console.error("addQml: failed to create QML from file",qmlfile)
console.error("addQml: returning just blank object");
return m.createObj( opts );
}
m.create_obj( p, opts );
// m.chain("remove",function() {
// });
return p;
}
vis.addBaseGui = addBaseGui;
}