本文整理汇总了Python中WorldEditor.createChunkItem方法的典型用法代码示例。如果您正苦于以下问题:Python WorldEditor.createChunkItem方法的具体用法?Python WorldEditor.createChunkItem怎么用?Python WorldEditor.createChunkItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldEditor
的用法示例。
在下文中一共展示了WorldEditor.createChunkItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addChunkModel
# 需要导入模块: import WorldEditor [as 别名]
# 或者: from WorldEditor import createChunkItem [as 别名]
def addChunkModel( self ):
#If we are adding a model file, then simply
#add the resource name to the chunk at the locator.
bp = self.objInfo.getBrowsePath()
if len(bp)>6 and bp[-6:] == ".model":
d = ResMgr.DataSection( "model" )
d.writeString( "resource", bp )
group = WorldEditor.createChunkItem( d, self.mouseLocator.subLocator, 2 )
if ( group != None ):
self.chunkItemAdded( d.name );
if len(bp)>4 and bp[-4:] == ".spt":
d = ResMgr.DataSection( "speedtree" )
d.writeString( "spt", bp )
d.writeInt( "seed", 1 )
group = WorldEditor.createChunkItem( d, self.mouseLocator.subLocator, 2 )
if ( group != None ):
self.chunkItemAdded( d.name );
# if it's a .xml file in the particles directory, add a ChunkParticles chunk item
if bp.find("particles/") != -1 and (len(bp)>4 and bp[-4:] == ".xml"):
d = ResMgr.DataSection( "particles" )
d.writeString( "resource", bp )
group = WorldEditor.createChunkItem( d, self.mouseLocator.subLocator, 2 )
if ( group != None ):
self.chunkItemAdded( d.name );
#XML files represent completely generic additions to the chunk,
#and so all the information must be deep-copied and added
#to the chunk.
elif len(bp)>4 and bp[-4:] == ".xml":
s = ResMgr.openSection( bp ).values()[0]
if ( s != None ):
d = ResMgr.DataSection( s.name )
deepCopy( d, s )
group = WorldEditor.createChunkItem( d, self.mouseLocator.subLocator )
if ( group != None ):
self.chunkItemAdded( d.name );
# If it's a .py file, add an entity with the same name
elif len(bp)>3 and bp[-3:] == ".py":
d = ResMgr.DataSection( "entity" )
d.writeString( "type", bp[ bp.rfind("/")+1 : -3 ] )
group = WorldEditor.createChunkItem( d, self.mouseLocator.subLocator )
if ( group != None ):
self.chunkItemAdded( d.name );
# If it's a .def file, add an entity with the same name
elif len(bp)>4 and bp[-4:] == ".def":
if bp.find("user_data_object") == -1:
d = ResMgr.DataSection( "entity" )
d.writeString( "type", bp[ bp.rfind("/")+1 : -4 ] )
else:
d = ResMgr.DataSection( "UserDataObject" )
d.writeString( "type", bp[ bp.rfind("/")+1 : -4 ] )
group = WorldEditor.createChunkItem( d, self.mouseLocator.subLocator )
if ( group != None ):
self.chunkItemAdded( d.name );