当前位置: 首页>>代码示例>>Python>>正文


Python WorldEditor.createChunkItem方法代码示例

本文整理汇总了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 );
开发者ID:siredblood,项目名称:tree-bumpkin-project,代码行数:60,代码来源:WorldEditorDirector.py


注:本文中的WorldEditor.createChunkItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。