-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtool_window.py
98 lines (80 loc) · 2.94 KB
/
tool_window.py
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# *- coding: utf-8 -*-
from pyfbsdk import*
from pyfbsdk_additions import*
from mbtools import*
from snap_tracker import setMarkerSet
##############################################
### ここ変えてね
##############################################
bodyTrackerName = "BodyTracker"
# オフセット
offset_x = 0
offset_y = -30
offset_z = -20
##############################################
### 実装
##############################################
def addTargetUI():
editUI.Text = "RecordTarget"
x = FBAddRegionParam(50, FBAttachType.kFBAttachNone, "")
y = FBAddRegionParam(20, FBAttachType.kFBAttachNone, "")
w = FBAddRegionParam(100,FBAttachType.kFBAttachNone,"")
h = FBAddRegionParam(30,FBAttachType.kFBAttachNone,"")
window.AddRegion("TargetUI","TargetUI", x, y, w, h)
window.SetControl("TargetUI",editUI)
return editUI
def onCreateActorBtnClick(control,event):
actor = createActor()
model = getTargetModel(editUI.Text)
tracker = find(model, bodyTrackerName)
# Actorのポジションを移動
pos = FBVector3d()
tracker.GetVector(pos)
pos += FBVector3d(offset_x, offset_y, offset_z)
# scale = FBVector3d(0.1, 0.1, 0.1)
# actor.SetDefinitionScaleVector(FBSkeletonNodeId.kFBSkeletonHipsIndex, scale)
actor.SetActorTranslation(pos)
FBMessageBox("Create Actor",control.Caption,"OK")
def onMarkerSetBtnClick(control,event):
app = FBApplication()
if not app.CurrentActor is None:
name = app.CurrentActor.Name
isSet = setMarkerSet(editUI.Text, name)
if isSet:
FBMessageBox("Create MarkerSet",control.Caption,"OK")
#####################
### Actor
#####################
def addActorUI():
x = FBAddRegionParam(50, FBAttachType.kFBAttachNone, "")
y = FBAddRegionParam(60, FBAttachType.kFBAttachNone, "")
w = FBAddRegionParam(100,FBAttachType.kFBAttachNone,"")
h = FBAddRegionParam(30,FBAttachType.kFBAttachNone,"")
window.AddRegion("BtnLyt1","BtnLyt1", x, y, w, h)
caBtn=FBButton()
caBtn.Caption="Create Actor"
window.SetControl("BtnLyt1",caBtn)
caBtn.OnClick.Add(onCreateActorBtnClick)
#####################
### MarkerSet
#####################
def addMarkerSetUI():
x = FBAddRegionParam(50, FBAttachType.kFBAttachNone, "")
y = FBAddRegionParam(100, FBAttachType.kFBAttachNone, "")
w = FBAddRegionParam(100,FBAttachType.kFBAttachNone,"")
h = FBAddRegionParam(30,FBAttachType.kFBAttachNone,"")
window.AddRegion("BtnLyt2","BtnLyt2", x, y, w, h)
msBtn=FBButton()
msBtn.Caption="Create MarkerSet"
window.SetControl("BtnLyt2",msBtn)
# イベントの設定
msBtn.OnClick.Add(onMarkerSetBtnClick)
editUI = FBEdit()
window=FBCreateUniqueTool("Tool Window")
addTargetUI()
addActorUI()
addMarkerSetUI()
# ウィンドウサイズの指定
window.StartSizeX = 200
window.StartSizeY = 200
ShowTool(window)