import bpy from bpy import data as D from bpy import context as C from mathutils import * from math import * def addColorSphere( size,location,color): bpy.ops.mesh.primitive_ico_sphere_add(size=0.1, location=location )
if len(D.materials)==0: mat=bpy.ops.material.new() mat=D.materials[-1] bpy.ops.object.material_slot_add() C.object.material_slots[0].material=mat bpy.context.object.active_material.use_object_color = True bpy.context.object.color = color if __name__=='__main__': sizexx=0.1 locationxx=(0, 0, 0) colorxx = (1, .5, 0, 1) addColorSphere( sizexx,locationxx,colorxx)
location