BasicOperations/FindObjectsWithWildcard.py
18 SEARCH_MODELS_ONLY =
False
21 """ This function creates dummy datas with namespace"""
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"]
32 c.Translation =
FBVector3d(random.random()*50, random.random()*50, random.random()*50)
35 t.LongName =
"my text ns:texture of doom"
38 t.LongName =
"my text ns:texture doesn't end with be"
41 m.LongName =
"special ns:material"
44 def FindWithWildcard(pattern, byShortName):
45 """ This function finds an object (not just a model)
46 with a particular pattern in its name.
61 print len(cl),
"objects found matching ShortName pattern: \"" + pattern +
"\""
63 print len(cl),
"objects found matching LongName pattern: \"" + pattern +
"\""
77 FindWithWildcard(
"*", BY_SHORT_NAME )
80 FindWithWildcard(
"ns*", BY_SHORT_NAME )
83 FindWithWildcard(
"*be", BY_SHORT_NAME )
86 FindWithWildcard(
"*Cube*", BY_SHORT_NAME )
89 FindWithWildcard(
"*Cube*be*", BY_SHORT_NAME )
94 FindWithWildcard(
"ns*", BY_SHORT_NAME )
97 FindWithWildcard(
"*ns", BY_SHORT_NAME )
100 FindWithWildcard(
"*n*ns*s1", BY_SHORT_NAME )