1
2
3
4
5
6
7
8
9
10
11
12
13from pyfbsdk import *
14
15import random
16
17
18SEARCH_MODELS_ONLY = False
19
20def CreateDatas():
21 """ This function creates dummy datas with namespace"""
22
24
25 cubenames = ["ns:Cube", "ns:Cube is a troubled cube", "ns:ns1:My Cube of Doom", "ns:this is a ns:ns1:Cube", "Cube ends with be"]
26
27 for n in cubenames:
29 c.LongName = n
30 c.Visible = True
31 c.Show = True
32 c.Translation = FBVector3d(random.random()*50, random.random()*50, random.random()*50)
33
35 t.LongName = "my text ns:texture of doom"
36
38 t.LongName = "my text ns:texture doesn't end with be"
39
41 m.LongName = "special ns:material"
42
43
44def FindWithWildcard(pattern, byShortName):
45 """ This function finds an object (not just a model)
46 with a particular pattern in its name.
47 """
48
49 cl = FBComponentList()
50 if byShortName:
51
52
53
54
56 else:
57
59
60 if byShortName:
61 print(len(cl), "objects found matching ShortName pattern: \"" + pattern + "\"")
62 else:
63 print(len(cl), "objects found matching LongName pattern: \"" + pattern + "\"")
64
65 for o in cl:
66 print(" ", o.FullName)
67
68CreateDatas()
69
70
71
72
73
74
75BY_SHORT_NAME = True
76
77FindWithWildcard( "*", BY_SHORT_NAME )
78
79
80FindWithWildcard( "ns*", BY_SHORT_NAME )
81
82
83FindWithWildcard( "*be", BY_SHORT_NAME )
84
85
86FindWithWildcard( "*Cube*", BY_SHORT_NAME )
87
88
89FindWithWildcard( "*Cube*be*", BY_SHORT_NAME )
90
91BY_SHORT_NAME = False
92
93
94FindWithWildcard( "ns*", BY_SHORT_NAME )
95
96
97FindWithWildcard( "*ns", BY_SHORT_NAME )
98
99
100FindWithWildcard( "*n*ns*s1", BY_SHORT_NAME )
FBApplication is used mainly to manage files.
Definition: pyfbsdk_generated.h:801
Material class.
Definition: pyfbsdk_generated.h:10458
Cube model class.
Definition: pyfbsdk_generated.h:11337
See samples: HUDElements.py, MaterialAndTexture.py, TextureAnimation.py, VideoInput....
Definition: pyfbsdk_generated.h:19477
FBFindObjectsByName(str pNamePattern, FBComponentList pList, bool pIncludeNamespace=True, bool pModelsOnly=False)
FBFindObjectsByName.