Hello, there. I am looking to write a blender addon. I’ve only done game engine scripting but I thought I would get into this as well. I have no experience in the bpy module, nor with anything other than game logic. If someone were to be so kind as to either write this addon under my supervision, or mentor me in the ways of bpy, it would be appreciated.
Here is my current code, taken from a template (terrible).
import bpy
class ObjectTypePanel(bpy.types.Panel):
"""Creates a Panel in the Object properties window"""
bl_label = "Object Types"
bl_idname = "OBJECT_PT_hello"
bl_space_type = 'LOGIC_EDITOR'
bl_region_type = 'UI'
bl_context = "Tools"
This can be rewritten. Here is the structure of the completed addon that I want:
Each boolean (Tool, Item, Etc) would add certain logic to the selected object, including properties and python scripts. The Name field would influence the properties of some of the logic bricks, and Create Property Handler (which should be named Create Logic) would create an object (unless it exists already) that has certain logic with certain properties, that would be further edited by further use of the addon, and the button would also add necessary logic to the object itself.
If someone would guide me though this or write it completely, I would be very happy.
Spot on, khalibloo! A ‘hander’ is just an object that stores properties. It’s normally on a hidden layer, an overlay scene, or always off screen. In this case, it would add the handler just behind the camera… that’s possible, right?
All right new problem. And yes, I googled it before I asked here. I need to add a game property to the active camera, using python tooltips I have this code:
#adds property to camera
cam = bpy.context.scene.camera
bpy.ops.object.game_property_new(type="STRING", name ="TEST")
This adds the TEST property to the active object. How can I make it so that it adds it to whatever object the ‘cam’ variable references?