-
Notifications
You must be signed in to change notification settings - Fork 0
/
mbtools.py
54 lines (42 loc) · 1.5 KB
/
mbtools.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
from pickle import TRUE
from pyfbsdk import*
def getTargetModel(target):
result = []
for i in FBSystem().Scene.RootModel.Children:
if i.Name == target:
result.append(i)
return result[0]
def containActor(name:str) ->FBActor:
for actor in FBSystem().Scene.Actors:
if actor.Name == name:
return True
return False
def getActor(name:str) -> FBActor:
result = []
for actor in FBSystem().Scene.Actors:
if actor.Name == name:
result.append(actor)
return result[0]
def createActor() -> FBActor:
actorName = "NewActor"
actor = FBActor(actorName)
return actor
def createMarkerSet() -> FBMarkerSet:
markerSetName = "NewMarkerSet"
markerSet = FBMarkerSet(markerSetName)
return markerSet
# マーカセットに追加する
def AddTracker(markerSet : FBMarkerSet, tracker : FBModel, nodeId : FBSkeletonNodeId):
trackers = [tracker]
for child in tracker.Children:
if child.Name.startswith("Marker1") or child.Name.startswith("Marker2") or child.Name.startswith("Marker3"):
trackers.append(child)
for t in trackers:
markerSet.SetReferenceModel(t)
markerSet.AddMarker(nodeId, t, False)
# Modelの子オブジェクトにあるオブジェクトを返す
def find(model : FBModel, name : str):
names = [ i.Name for i in model.Children]
index = names.index(name)
tracker = model.Children[index]
return tracker