Is there a script that reset all edge weights/crease and apply location/rotati~/scale

Is there a script that reset all edge weights/crease and apply location/rotaton/scale to an object ?
Also know as “Reset X-Form” (Basically clean out junks from a mesh) in 3DS Max ?

Essentially you need these 2 operators in a single operator

1.) Alt + C > Convert to mesh
https://farm5.staticflickr.com/4795/39785262645_feed232f75_o.png
https://farm5.staticflickr.com/4796/26809315208_ec023a1822_o.png

2.) Ctrl + A > Apply All
https://farm5.staticflickr.com/4786/38870013200_6477eb7e0e_o.png
https://farm5.staticflickr.com/4774/39970460224_cdfe42093b_o.png

Should be straightforward to create a simple addon with 1 operator with these steps

I don’t really imagine much use for it to be honest, but it would go something like this:


import bpy

for every_edge in bpy.context.active_object.data.edges:
    every_edge.bevel_weight = 0
    every_edge.crease = 0
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)

You could put it into an operator and make it an addon. You can find code samples for that in the Templates menu in the header of the Text Editor panel.

@renderhjs Are you under the impression that converting to Mesh removes edge data? Because on a test mesh (in 2.79), it doesn’t for me. Bevel weights, sharp edges, seams and edge creases remain…

How do I make this into a button on the toolbar ? This will be AMAZING! The ultimate one button “Clean your shxt up” mesh setting, might as well implement the “w”->“remove double” command within it too.

It’s one of those super convenient thing that once exist, you wonder why it didn’t in the first place.

check out operator template.

https://s14.postimg.org/ihcbfex41/Capture.png
You can see a list of actions performed in the info panel and copy any sequence of them into a script quite easily. It’s just a little bit more tricky to put it on the UI, but not too complicated as well. You would need to search for a tutorial on youtube how to do that and see the templates. I would recommend considering just using Python as you work as well. It’s very easy to write any specific script for any specific situation like this just copying and pasting stuff so it can be a very powerful tool without any additional buttons on the UI. You can use text editor or Python console to do many things while working without worrying about putting buttons on the interface or making addons.

Here, I made it available under Object > Apply menu. Save as a py file and add to startup folder or remove the “#” signs to enable as addon and place in addons folder.


#bl_info = {
#"name": "Reset X-Form", 
#"version": (1, 0, 0),
#"blender": (2, 79, 0),
#"location": "3D View > Object > Apply" ,
#"description": "Resets all edge weights/ crease and applies location/ rotaton/ scale.",
#"category": "3D View"}


import bpy


class ResetXform(bpy.types.Operator):
    """Resets all edge weights/ crease and applies location/ rotaton/ scale"""
    bl_idname = "object.reset_x_form"
    bl_label = "Reset X-Form"

    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    def execute(self, context):
        
        for every_edge in bpy.context.active_object.data.edges:
            every_edge.bevel_weight = 0
            every_edge.crease = 0
        bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
        
        return {'FINISHED'}


def ResetXform_Menu(self, context):
    self.layout.operator(ResetXform.bl_idname)


def register():
    bpy.utils.register_class(ResetXform)
    bpy.types.VIEW3D_MT_object_apply.append(ResetXform_Menu)


def unregister():
    bpy.utils.unregister_class(ResetXform)
    bpy.types.VIEW3D_MT_object_apply.remove(ResetXform_Menu)
    

if __name__ == "__main__":
    register()

Talk about teaching a man how to Fish !
Love you all !