+ self.layout.prop(obj, "compound")
+ self.layout.prop(obj, "lod_for_parent")
+ if obj.lod_for_parent:
+ self.layout.prop(obj, "lod_index")
+
+class MspGLMaterialProperties(bpy.types.Panel):
+ bl_idname = "MATERIAL_PT_mspgl_properties"
+ bl_label = "MspGL properties"
+ bl_space_type = "PROPERTIES"
+ bl_region_type = "WINDOW"
+ bl_context = "material"
+
+ @classmethod
+ def poll(cls, context):
+ return context.active_object.active_material is not None
+
+ def draw(self, context):
+ mat = context.active_object.active_material
+ if not mat:
+ return
+
+ self.layout.prop(mat, "render_mode")
+ if mat.render_mode=='CUSTOM':
+ self.layout.label(text="Render methods")
+ self.layout.template_list("MATERIAL_UL_mspgl_render_methods", "", mat, "render_methods", mat, "active_render_method_index")
+ row = self.layout.row()
+ row.operator("material.add_render_method")
+ row.operator("material.remove_render_method")
+
+ if mat.active_render_method_index<len(mat.render_methods):
+ method = mat.render_methods[mat.active_render_method_index]
+ self.layout.prop(method, "tag")
+ self.layout.prop(method, "shader")
+ self.layout.prop(method, "use_material")
+
+ self.layout.separator()
+ elif mat.render_mode=='EXTERNAL':
+ self.layout.prop(mat, "technique")
+ if mat.render_mode=='BUILTIN':
+ self.layout.prop(mat, "receive_shadows")
+ self.layout.prop(mat, "image_based_lighting")
+ self.layout.prop(mat, "array_atlas")
+ if mat.array_atlas:
+ 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 MspGLRenderProperties(bpy.types.Panel):
+ bl_idname = "WORLD_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, MspGLMeshProperties, MspGLObjectProperties, MspGLMaterialProperties,
+ MspGLTextureNodeProperties, MspGLLightProperties, MspGLRenderProperties, MspGLRenderMethod,
+ MspGLRenderMethodList, MspGLUniform, MspGLUniformList]