本文整理汇总了Python中Scene.Scene.set_params方法的典型用法代码示例。如果您正苦于以下问题:Python Scene.set_params方法的具体用法?Python Scene.set_params怎么用?Python Scene.set_params使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scene.Scene
的用法示例。
在下文中一共展示了Scene.set_params方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: format
# 需要导入模块: from Scene import Scene [as 别名]
# 或者: from Scene.Scene import set_params [as 别名]
#.........这里部分代码省略.........
return int(value)
elif var_type is np.ndarray:
return np.array(map(float, str(value).split()))
else: # return as string
return value
def create_params(self, attribs):
params = dict()
for key in attribs.keys():
var_type = self.__var_datatypes.get(key, str)
params[key] = self.convert_attribute_value(attribs[key].value, var_type)
return params
def create_params_from_child(self, node, params):
for e in node.childNodes:
val = self.parse(e)
if val is not None:
key = str(val.__class__.__name__).lower()
if params.has_key(key):
print('key ' + key + ' already exists')
if type(params[key]) is list:
print('appending')
params[key].append(val)
else: #if the key already exists but is not a list
print('creating list and appending')
cval = params[key]
params[key] = [cval, val]
else:
params[key] = val
return params
def process_scene(self, node):
params = self.create_params(node.attributes)
self.scene.set_params(params)
#self.NodeStack.append(SceneNode()) # root scene node
for e in node.childNodes:
self.parse(e)
#self.scene.surfaces.append(self.NodeStack.pop())
def process_light(self, node):
''' <light name="myLight" color="1 1 1" from="0 0 0 " power="1.0" type="point" /> '''
self.scene.lights.append(Light(self.create_params(node.attributes)))
def process_material(self, node):
'''<material name="blue" diffuse="0 0 1" specular="0 0 0" hardness="0" />'''
params = self.create_params(node.attributes)
if params.has_key('ref'):
if not self.Materials.has_key(params['ref']):
print('Warning: Material ' + params['ref'] + ' not found')
return self.Materials.get(params['ref'])
else:
print('adding Material ' + params['name'])
material = Material(params)
self.Materials[params.get('name')] = material
return material
def process_material2(self, node):
return self.process_material(node)
def process_node(self, node):
'''Nodes can refer to other nodes '''
print('start process_node')
#self.scene.start_node()
params = self.create_params(node.attributes)
#TODO: remove this comment block (currently kept for reference)