def update_shader_texture_flakenoise(self, context): material = _material_utils.get_material_from_context(context) if material: _material_utils.update_texture_slots( material, self.shader_texture_flakenoise, 'flakenoise')
def update_shininess(self, context): material = _material_utils.get_material_from_context(context) if material: # material.specular_intensity = self.shader_attribute_shininess material.specular_hardness = self.shader_attribute_shininess
def update_value(self, context): material = _material_utils.get_material_from_context(context) if material: tex_slot = _material_utils.get_texture_slot( material, self.texture_type) # if texture slot exists set "uv_layer" property to reflect choosen uv from our settings to viewport if tex_slot: tex_slot.uv_layer = self.value # synchronize all scs textures mappings that uses the same tex_coord field in current material if "scs_shader_attributes" in material and "textures" in material[ "scs_shader_attributes"]: for tex_entry in material["scs_shader_attributes"][ "textures"].values(): if "Tag" in tex_entry: curr_tex_type = tex_entry["Tag"].split(":")[1][8:] if curr_tex_type != self.texture_type: # if different texture from current texture_mappings = getattr( material.scs_props, "shader_texture_" + curr_tex_type + "_uv") if texture_mappings and len( texture_mappings) > 0: for tex_mapping in texture_mappings: # if tex_coord props are the same and uv mapping differs then set current uv mapping value to it if self.tex_coord != -1 and tex_mapping.tex_coord == self.tex_coord and tex_mapping.value != self.value: tex_mapping.value = self.value
def update_specular(self, context): material = _material_utils.get_material_from_context(context) if material: material.specular_color = self.shader_attribute_specular material.specular_intensity = self.shader_attribute_specular.v
def update_shader_texture_reflection(self, context): material = _material_utils.get_material_from_context(context) if material: _material_utils.update_texture_slots( material, self.shader_texture_reflection, 'reflection')
def update_value(self, context): __update_look__(self, context) material = _material_utils.get_material_from_context(context) if material: _shader.set_attribute(material, self.aux_type, getattr(material.scs_props, "shader_attribute_" + self.aux_type, None))
def update_shader_texture_lightmap(self, context): material = _material_utils.get_material_from_context(context) if material: _material_utils.update_texture_slots(material, self.shader_texture_lightmap, 'lightmap')
def update_shader_texture_paintjob(self, context): material = _material_utils.get_material_from_context(context) if material: _material_utils.update_texture_slots(material, self.shader_texture_paintjob, 'paintjob')
def update_shader_texture_mult(self, context): material = _material_utils.get_material_from_context(context) if material: _material_utils.update_texture_slots(material, self.shader_texture_mult, 'mult')
def update_shader_texture_iamod(self, context): material = _material_utils.get_material_from_context(context) if material: _material_utils.update_texture_slots(material, self.shader_texture_iamod, 'iamod')
def update_shader_texture_oclu(self, context): material = _material_utils.get_material_from_context(context) if material: _material_utils.update_texture_slots(material, self.shader_texture_oclu, 'oclu')
def update_diffuse(self, context): material = _material_utils.get_material_from_context(context) if material: material.diffuse_color = self.shader_attribute_diffuse texture_slot = _material_utils.get_texture_slot(material, 'base') if texture_slot: _material_utils.set_diffuse(texture_slot, material, self.shader_attribute_diffuse)
def update_reflection(self, context): material = _material_utils.get_material_from_context(context) if material: material.raytrace_mirror.reflect_factor = self.shader_attribute_reflection if self.shader_attribute_reflection == 0: material.raytrace_mirror.use = False else: material.raytrace_mirror.use = True
def update_env_factor(self, context): material = _material_utils.get_material_from_context(context) if material: texture_slot = _material_utils.get_texture_slot( material, 'reflection') # print('deBug --- texture_slot: %r' % str(texture_slot.name)) if texture_slot: # print('deBug --- TEXTURE SLOT %r SET [update_env_factor()]' % str(texture_slot.name)) _material_utils.set_env_factor( texture_slot, self.shader_attribute_env_factor)
def __update_shader_attribute__(self, context, attr_type): """Hookup function for updating shader attributes in Blender. :param context: Blender context :type context: bpy.types.Context :param attr_type: type of attribute to update in shader :type attr_type: str """ __update_look__(self, context) material = _material_utils.get_material_from_context(context) if material: _shader.set_attribute(material, attr_type, getattr(self, "shader_attribute_" + attr_type, None))
def update_value(self, context): __update_look__(self, context) material = _material_utils.get_material_from_context(context) if material: _shader.set_uv(material, self.texture_type, self.value) # synchronize all scs textures mappings that uses the same tex_coord field in current material if "scs_shader_attributes" in material and "textures" in material["scs_shader_attributes"]: for tex_entry in material["scs_shader_attributes"]["textures"].values(): if "Tag" in tex_entry: curr_tex_type = tex_entry["Tag"].split(":")[1][8:] if curr_tex_type != self.texture_type: # if different texture from current texture_mappings = getattr(material.scs_props, "shader_texture_" + curr_tex_type + "_uv") if texture_mappings and len(texture_mappings) > 0: for tex_mapping in texture_mappings: # if tex_coord props are the same and uv mapping differs then set current uv mapping value to it if self.tex_coord != -1 and tex_mapping.tex_coord == self.tex_coord and tex_mapping.value != self.value: tex_mapping.value = self.value
def __update_shader_texture__(self, context, tex_type): """Hookup function for update of shader texture of any texture type. :param context: Blender context :type context: bpy.types.Context :param tex_type: string representing texture type :type tex_type: str """ __update_look__((), context) material = _material_utils.get_material_from_context(context) if material: shader_texture_str = "shader_texture_" + tex_type shader_texture_filepath = getattr(self, shader_texture_str) # create texture and use it on shader texture = _material_utils.get_texture(shader_texture_filepath, tex_type) _shader.set_texture(material, tex_type, texture) # reload TOBJ settings _material_utils.reload_tobj_settings(material, tex_type)
def update_add_ambient(self, context): material = _material_utils.get_material_from_context(context) if material: material.ambient = self.shader_attribute_add_ambient
def update_shadow_bias(self, context): material = _material_utils.get_material_from_context(context) if material: material.shadow_buffer_bias = self.shader_attribute_shadow_bias