test.tcl 1.22 KB
Newer Older
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
# set ID [mol new]

graphics $ID delete all

# set ch [open /home/cmaffeo2/Downloads/bunny.ma]
set ch [open /home/cmaffeo2/Downloads/ball.ma]

set helixCount 0

proc getNextVector {ch} {
    gets $ch line
    set line [split $line]
    lrange $line 5 7
}
proc eulerToRot {euler} {
    lassign $euler x y z
    transmult  [transaxis z $z] [transaxis y $y] [transaxis x $x] 
}


while {[gets $ch line] >= 0} {
    set args [lassign [split $line] cmd obj]
    if {$cmd == "createNode"} {
	if {$obj == "HelixBase" && $drawBase} {
	    set drawBase 1
	    # set v [vecscale 10 [getNextVector $ch]] 
	    set v [coordtrans $R [vecscale 10 [getNextVector $ch]]]
	    # set v [coordtrans [transmult [trans_from_offset [vecscale 10 [getNextVector $ch]] $R ] {0 0 0}]]
	    graphics $ID sphere $v radius 2
	} elseif {$obj == "vHelix"} {
	    set drawBase 1
	    # createNode vHelix -n "helix_1";
	    # setAttr ".t" -type "double3" -16.9433 11.8494 25.2659 ;
	    # setAttr ".r" -type "double3" 42.338094401101131 222.16004220698011 5.8192508587610412 ;
	    # setAttr ".dh" yes;
		
	    set v [vecscale 10 [getNextVector $ch]] 
	    set r [getNextVector $ch]
	    set R [eulerToRot $r]	    
	    set R [transmult [trans_from_offset $v] $R ]

	}
    }    
}