Beispiel #1
0
 def create_surfaceshader(self, geo, color=(0.5, 0.5, 0.5)):
     """
     Create base lamber shader
     :param geo: list of geo to apply shader
     :param color: es: (0,1,0)
     :return: none
     """
     name = 'flexiPlane_surface_material'
     my_shader = shader_base.build_surfaceshader(shaderType='surfaceShader',
                                                 shaderName=name,
                                                 color=color)
     shader_base.assign_shader(geo, my_shader)
Beispiel #2
0
 def create_lambret(self,
                    geo,
                    color=(0.5, 0.5, 0.5),
                    transparency=(0.0, 0.0, 0.0)):
     """
     Create base lamber shader
     :param geo: list of geo to apply shader
     :param color: es: (0,1,0)
     :param transparency: es: (0,1,0)
     :return: none
     """
     name = 'flexiPlane_lambert_material'
     my_shader = shader_base.build_lambert(shaderType='lambert',
                                           shaderName=name,
                                           color=color,
                                           transparency=transparency)
     shader_base.assign_shader(geo, my_shader)
Beispiel #3
0
def add_ctrl_shader(ctrl_list):
    ctrl_list = pm.ls(ctrl_list)
    sweep_geo_list = ctrl_paintEffect(ctrl_list)

    for cv in ctrl_list:
        cv_shape_list = cv.getShapes()
        for cv_shape in cv_shape_list:
            stroke = pm.listConnections(cv_shape.worldSpace)[-1]
            ctrl_geo = pm.listConnections(stroke.worldMainMesh)[-1]

            try:
                rgb_color = pm.colorIndex(cv.overrideColor.get(), q=True)
            except:
                if cv.getShape().overrideEnabled.get() == 0:
                    cv.getShape().overrideEnabled.set(1)
                    cv.getShape().ovc.set(1)
                    
                rgb_color = pm.colorIndex(cv.getShape().overrideColor.get(), q=True)

            shader_name = str(ctrl_geo.name()).replace('geo', 'mat')
            surface_shader = shader_base.build_surfaceshader(shaderName=shader_name,
                                                             color=(rgb_color[0], rgb_color[1], rgb_color[2]))
            shader_base.assign_shader(ctrl_geo, surface_shader)