]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/operators.py
Support creating fully custom techniques in Blender
[libs/gl.git] / blender / io_mspgl / operators.py
index 8d214eacf4d0f83af2ecc740fc60db5c9224ece5..a6fc592307fd5a549e57f6035271d8b2054e5d3b 100644 (file)
@@ -138,6 +138,30 @@ class ExportMspGLProject(bpy.types.Operator):
                exporter.export_to_directory(context, self.directory)
                return {'FINISHED'}
 
+class AddRenderMethod(bpy.types.Operator):
+       bl_idname = "material.add_render_method"
+       bl_label = "Add Render Method"
+       bl_description = "Add a new render method to the material"
+
+       def execute(self, context):
+               mat = context.active_object.active_material
+               mat.render_methods.add()
+               mat.active_render_method_index = len(mat.uniforms)-1
+
+               return {"FINISHED"}
+
+class RemoveRenderMethod(bpy.types.Operator):
+       bl_idname = "material.remove_render_method"
+       bl_label = "Remove Render Method"
+       bl_description = "Remove the selected render method from the material"
+
+       def execute(self, context):
+               mat = context.active_object.active_material
+               mat.render_methods.remove(mat.active_render_method_index)
+               mat.active_render_method_index = min(mat.active_render_method_index, len(mat.render_methods)-1)
+
+               return {"FINISHED"}
+
 class AddUniform(bpy.types.Operator):
        bl_idname = "material.add_uniform"
        bl_label = "Add Uniform"
@@ -162,7 +186,8 @@ class RemoveUniform(bpy.types.Operator):
 
                return {"FINISHED"}
 
-classes = [ExportMspGLData, ExportMspGLAnimation, ExportMspGLScene, ExportMspGLProject, AddUniform, RemoveUniform]
+classes = [ExportMspGLData, ExportMspGLAnimation, ExportMspGLScene, ExportMspGLProject, AddRenderMethod,
+       RemoveRenderMethod, AddUniform, RemoveUniform]
 
 def register_operators():
        for c in classes: