+ self.layout.prop(mat, "array_layer")
+ if mat.render_mode!='EXTERNAL':
+ self.layout.prop(mat, "material_atlas")
+ if mat.render_mode=='CUSTOM':
+ self.layout.separator()
+ self.layout.label(text="Uniform values")
+ self.layout.template_list("MATERIAL_UL_mspgl_uniforms", "", mat, "uniforms", mat, "active_uniform_index")
+ row = self.layout.row()
+ row.operator("material.add_uniform")
+ row.operator("material.remove_uniform")
+
+ if mat.active_uniform_index<len(mat.uniforms):
+ uniform = mat.uniforms[mat.active_uniform_index]
+ self.layout.prop(uniform, "name")
+ self.layout.prop(uniform, "size")
+ row = self.layout.row(align=True)
+ row.label(text="Values")
+ for i in range(uniform.size):
+ row.prop(uniform, "values", text="", index=i)
+
+class MspGLTextureNodeProperties(bpy.types.Panel):
+ bl_idname = "NODE_PT_mspgl_properties"
+ bl_label = "MspGL properties"
+ bl_space_type = "NODE_EDITOR"
+ bl_region_type = "UI"
+ bl_category = "Item"
+
+ @classmethod
+ def poll(cls, context):
+ node = context.active_node
+ return node and node.type=='TEX_IMAGE'
+
+ def draw(self, context):
+ node = context.active_node
+ if not node:
+ return
+
+ self.layout.prop(node, "use_mipmap")
+ self.layout.prop(node, "max_anisotropy")
+
+class MspGLLightProperties(bpy.types.Panel):
+ bl_idname = "LIGHT_PT_mspgl_properties"
+ bl_label = "MspGL properties"
+ bl_space_type = "PROPERTIES"
+ bl_region_type = "WINDOW"
+ bl_context = "data"
+
+ @classmethod
+ def poll(cls, context):
+ return context.active_object.type=="LIGHT"
+
+ def draw(self, context):
+ light = context.active_object.data
+
+ if light.use_shadow:
+ self.layout.prop(light, "shadow_map_size")
+
+class MspGLRenderProperties(bpy.types.Panel):
+ bl_idname = "RENDER_PT_mspgl_properties"
+ bl_label = "MspGL properties"
+ bl_space_type = "PROPERTIES"
+ bl_region_type = "WINDOW"
+ bl_context = "render"
+
+ def draw(self, context):
+ scene = context.scene
+ self.layout.prop(scene, "use_hdr")
+ if scene.eevee.use_gtao:
+ self.layout.prop(scene, "ao_samples")
+
+class MspGLRenderMethod(bpy.types.PropertyGroup):
+ tag: bpy.props.StringProperty(name="Tag", description="Tag of the render method")
+ shader: bpy.props.StringProperty(name="Shader", description="Shader to use")
+ use_material: bpy.props.BoolProperty(name="Use material", description="Use material properties in this render method")
+
+class MspGLRenderMethodList(bpy.types.UIList):
+ bl_idname = "MATERIAL_UL_mspgl_render_methods"
+
+ def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
+ method = item
+ if self.layout_type=="GRID":
+ layout.label(text="", icon_value=icon)
+ else:
+ layout.prop(method, "tag", text="", emboss=False, icon_value=icon)
+ layout.label(text=(method.shader or "(no shader)"))
+
+class MspGLUniform(bpy.types.PropertyGroup):
+ name: bpy.props.StringProperty(name="Name", description="Name of the uniform variable")
+ size: bpy.props.IntProperty(name="Size", description="Number of elements in the uniform", min=1, max=4, default=4)
+ values: bpy.props.FloatVectorProperty(name="Values", description="Values stored in the uniform", size=4)
+
+class MspGLUniformList(bpy.types.UIList):
+ bl_idname = "MATERIAL_UL_mspgl_uniforms"
+
+ def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
+ uniform = item
+ if self.layout_type=="GRID":
+ layout.label(text="", icon_value=icon)
+ else:
+ layout.prop(uniform, "name", text="", emboss=False, icon_value=icon)
+ layout.label(text="({})".format(", ".join("{:.3f}".format(v) for v in uniform.values[:uniform.size])))
+
+classes = [MspGLSceneProperties, MspGLWorldProperties, MspGLMeshProperties, MspGLObjectProperties, MspGLMaterialProperties,
+ MspGLTextureNodeProperties, MspGLLightProperties, MspGLRenderProperties, MspGLRenderMethod,
+ MspGLRenderMethodList, MspGLUniform, MspGLUniformList]