I am dumbfounded, completely impressed, and a little scared
I thought I’d ask ChatGPT this:
write a custom panel in python for Blender that includes a button to duplicate an object, a button to deselect all objects, and a button to select the scene’s active camera
It’s verbatim immediate response:
Here is an example of a custom panel in Blender that includes buttons to duplicate an object, deselect all objects, and select the scene’s active camera:
import bpy class CustomPanel(bpy.types.Panel): """A custom panel in the Object properties window""" bl_label = "Custom Panel" bl_idname = "OBJECT_PT_custom_panel" bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' bl_context = "object" def draw(self, context): layout = self.layout obj = context.object row = layout.row() row.label(text="Active object is: " + obj.name) row = layout.row() row.operator("object.duplicate_move") row = layout.row() row.operator("object.select_all", text="Deselect All").action = 'DESELECT' row = layout.row() row.operator("object.select_camera") def register(): bpy.utils.register_class(CustomPanel) def unregister(): bpy.utils.unregister_class(CustomPanel) if __name__ == "__main__": register()
And the result when I ran in Blender (no errors and all buttons work):
This is crazy, and of course some of the prompts I gave resulted in scripts with some errors, but for the most part this one is flawless. And it even gives a readout of the selected object as a label, which I didn’t ask for, but with the buttons here, this is contextually appropriate in my opinion.
I even tried some prompts for UPGBE with some success. When I pushed it to “create a grappling hook mechanic for a first-person game using UPBGE python”. I got more errors, but insane that it could even theorize how to do this, and the result helped me get on the right direction.
I’ve seen a lot of this online for C# coding, but not much for blender, and I have not seen anyone create a panel with it yet.
Thoughts? Scared yet?