UPBGE 0.5x & Blender 5.2.0 Alpha Python API Logo

Documentation

  • Quickstart
  • API Overview
  • API Reference Usage
  • Best Practice
  • Tips and Tricks
  • Gotchas
  • Advanced
  • Change Log
  • Contribute Documentation

Application Modules

  • Context Access (bpy.context)
  • Data Access (bpy.data)
  • Message Bus (bpy.msgbus)
  • Operators (bpy.ops)
  • Types (bpy.types)
    • bpy_struct
      • AOV(bpy_struct)
      • AOVs(bpy_prop_collection)
      • ActionChannelbag(bpy_struct)
      • ActionChannelbagFCurves(bpy_prop_collection)
      • ActionChannelbagGroups(bpy_prop_collection)
      • ActionChannelbags(bpy_prop_collection)
      • ActionGroup(bpy_struct)
      • ActionLayer(bpy_struct)
      • ActionLayers(bpy_prop_collection)
      • ActionPoseMarkers(bpy_prop_collection)
      • ActionSlot(bpy_struct)
      • ActionSlots(bpy_prop_collection)
      • ActionStrip(bpy_struct)
      • ActionStrips(bpy_prop_collection)
      • Actuator(bpy_struct)
      • Addon(bpy_struct)
      • AddonPreferences(bpy_struct)
      • Addons(bpy_prop_collection)
      • AnimData(bpy_struct)
      • AnimDataDrivers(bpy_prop_collection)
      • AnimViz(bpy_struct)
      • AnimVizMotionPaths(bpy_struct)
      • AnnotationFrame(bpy_struct)
      • AnnotationFrames(bpy_prop_collection)
      • AnnotationLayer(bpy_struct)
      • AnnotationLayers(bpy_prop_collection)
      • AnnotationStroke(bpy_struct)
      • AnnotationStrokePoint(bpy_struct)
      • AnnotationStrokePoints(bpy_prop_collection)
      • AnnotationStrokes(bpy_prop_collection)
      • AnyType(bpy_struct)
      • Area(bpy_struct)
      • AreaSpaces(bpy_prop_collection)
      • ArmatureBones(bpy_prop_collection)
      • ArmatureConstraintTargets(bpy_prop_collection)
      • ArmatureEditBones(bpy_prop_collection)
      • AssetLibraryCollection(bpy_prop_collection)
      • AssetLibraryReference(bpy_struct)
      • AssetMetaData(bpy_struct)
      • AssetRepresentation(bpy_struct)
      • AssetShelf(bpy_struct)
      • AssetTag(bpy_struct)
      • AssetTags(bpy_prop_collection)
      • AssetWeakReference(bpy_struct)
      • Attribute(bpy_struct)
      • AttributeGroupCurves(bpy_prop_collection)
      • AttributeGroupGreasePencil(bpy_prop_collection)
      • AttributeGroupGreasePencilDrawing(bpy_prop_collection)
      • AttributeGroupMesh(bpy_prop_collection)
      • AttributeGroupPointCloud(bpy_prop_collection)
      • BakeSettings(bpy_struct)
      • BezierSplinePoint(bpy_struct)
      • BlendData(bpy_struct)
      • BlendDataActions(bpy_prop_collection)
      • BlendDataAnnotations(bpy_prop_collection)
      • BlendDataArmatures(bpy_prop_collection)
      • BlendDataBrushes(bpy_prop_collection)
      • BlendDataCacheFiles(bpy_prop_collection)
      • BlendDataCameras(bpy_prop_collection)
      • BlendDataCollections(bpy_prop_collection)
      • BlendDataCurves(bpy_prop_collection)
      • BlendDataFonts(bpy_prop_collection)
      • BlendDataGreasePencilsV3(bpy_prop_collection)
      • BlendDataHairCurves(bpy_prop_collection)
      • BlendDataImages(bpy_prop_collection)
      • BlendDataLattices(bpy_prop_collection)
      • BlendDataLibraries(bpy_prop_collection)
      • BlendDataLights(bpy_prop_collection)
      • BlendDataLineStyles(bpy_prop_collection)
      • BlendDataMasks(bpy_prop_collection)
      • BlendDataMaterials(bpy_prop_collection)
      • BlendDataMeshes(bpy_prop_collection)
      • BlendDataMetaBalls(bpy_prop_collection)
      • BlendDataMovieClips(bpy_prop_collection)
      • BlendDataNodeTrees(bpy_prop_collection)
      • BlendDataObjects(bpy_prop_collection)
      • BlendDataPaintCurves(bpy_prop_collection)
      • BlendDataPalettes(bpy_prop_collection)
      • BlendDataParticles(bpy_prop_collection)
      • BlendDataPointClouds(bpy_prop_collection)
      • BlendDataProbes(bpy_prop_collection)
      • BlendDataScenes(bpy_prop_collection)
      • BlendDataScreens(bpy_prop_collection)
      • BlendDataSounds(bpy_prop_collection)
      • BlendDataSpeakers(bpy_prop_collection)
      • BlendDataTexts(bpy_prop_collection)
      • BlendDataTextures(bpy_prop_collection)
      • BlendDataVolumes(bpy_prop_collection)
      • BlendDataWindowManagers(bpy_prop_collection)
      • BlendDataWorkSpaces(bpy_prop_collection)
      • BlendDataWorlds(bpy_prop_collection)
      • BlendFileColorspace(bpy_struct)
      • BlendImportContext(bpy_struct)
      • BlendImportContextItem(bpy_struct)
      • BlendImportContextItems(bpy_prop_collection)
      • BlendImportContextLibraries(bpy_prop_collection)
      • BlendImportContextLibrary(bpy_struct)
      • BlenderRNA(bpy_struct)
      • BoidRule(bpy_struct)
      • BoidSettings(bpy_struct)
      • BoidState(bpy_struct)
      • Bone(bpy_struct)
      • BoneCollection(bpy_struct)
      • BoneCollectionMemberships(bpy_prop_collection)
      • BoneCollections(bpy_prop_collection)
      • BoneColor(bpy_struct)
      • BoolAttributeValue(bpy_struct)
      • BrushCapabilities(bpy_struct)
      • BrushCapabilitiesImagePaint(bpy_struct)
      • BrushCapabilitiesSculpt(bpy_struct)
      • BrushCapabilitiesVertexPaint(bpy_struct)
      • BrushCapabilitiesWeightPaint(bpy_struct)
      • BrushCurvesSculptSettings(bpy_struct)
      • BrushGpencilSettings(bpy_struct)
      • ByteColorAttributeValue(bpy_struct)
      • ByteIntAttributeValue(bpy_struct)
      • CacheFileLayer(bpy_struct)
      • CacheFileLayers(bpy_prop_collection)
      • CacheObjectPath(bpy_struct)
      • CacheObjectPaths(bpy_prop_collection)
      • CameraBackgroundImage(bpy_struct)
      • CameraBackgroundImages(bpy_prop_collection)
      • CameraDOFSettings(bpy_struct)
      • CameraStereoData(bpy_struct)
      • ChannelDriverVariables(bpy_prop_collection)
      • ChildParticle(bpy_struct)
      • ClothCollisionSettings(bpy_struct)
      • ClothSettings(bpy_struct)
      • ClothSolverResult(bpy_struct)
      • CollectionChild(bpy_struct)
      • CollectionChildren(bpy_prop_collection)
      • CollectionExport(bpy_struct)
      • CollectionExports(bpy_prop_collection)
      • CollectionImport(bpy_struct)
      • CollectionLightLinking(bpy_struct)
      • CollectionObject(bpy_struct)
      • CollectionObjects(bpy_prop_collection)
      • CollisionSettings(bpy_struct)
      • ColorManagedDisplaySettings(bpy_struct)
      • ColorManagedInputColorspaceSettings(bpy_struct)
      • ColorManagedSequencerColorspaceSettings(bpy_struct)
      • ColorManagedViewSettings(bpy_struct)
      • ColorMapping(bpy_struct)
      • ColorRamp(bpy_struct)
      • ColorRampElement(bpy_struct)
      • ColorRampElements(bpy_prop_collection)
      • ConsoleLine(bpy_struct)
      • Constraint(bpy_struct)
      • ConstraintTarget(bpy_struct)
      • ConstraintTargetBone(bpy_struct)
      • Context(bpy_struct)
      • Controller(bpy_struct)
      • CryptomatteEntry(bpy_struct)
      • CurveMap(bpy_struct)
      • CurveMapPoint(bpy_struct)
      • CurveMapPoints(bpy_prop_collection)
      • CurveMapping(bpy_struct)
      • CurvePaintSettings(bpy_struct)
      • CurvePoint(bpy_struct)
      • CurveProfile(bpy_struct)
      • CurveProfilePoint(bpy_struct)
      • CurveProfilePoints(bpy_prop_collection)
      • CurveSlice(bpy_struct)
      • CurveSplines(bpy_prop_collection)
      • Depsgraph(bpy_struct)
      • DepsgraphObjectInstance(bpy_struct)
      • DepsgraphUpdate(bpy_struct)
      • DisplaySafeAreas(bpy_struct)
      • DopeSheet(bpy_struct)
      • Driver(bpy_struct)
      • DriverTarget(bpy_struct)
      • DriverVariable(bpy_struct)
      • DynamicPaintBrushSettings(bpy_struct)
      • DynamicPaintCanvasSettings(bpy_struct)
      • DynamicPaintSurface(bpy_struct)
      • DynamicPaintSurfaces(bpy_prop_collection)
      • EQCurveMappingData(bpy_struct)
      • EditBone(bpy_struct)
      • EffectorWeights(bpy_struct)
      • EnumPropertyItem(bpy_struct)
      • Event(bpy_struct)
      • FCurve(bpy_struct)
      • FCurveKeyframePoints(bpy_prop_collection)
      • FCurveModifiers(bpy_prop_collection)
      • FCurveSample(bpy_struct)
      • FFmpegSettings(bpy_struct)
      • FModifier(bpy_struct)
      • FModifierEnvelopeControlPoint(bpy_struct)
      • FModifierEnvelopeControlPoints(bpy_prop_collection)
      • FieldSettings(bpy_struct)
      • FileAssetSelectIDFilter(bpy_struct)
      • FileBrowserFSMenuEntry(bpy_struct)
      • FileHandler(bpy_struct)
      • FileSelectEntry(bpy_struct)
      • FileSelectIDFilter(bpy_struct)
      • FileSelectParams(bpy_struct)
      • Float2AttributeValue(bpy_struct)
      • Float4AttributeValue(bpy_struct)
      • Float4x4AttributeValue(bpy_struct)
      • FloatAttributeValue(bpy_struct)
      • FloatColorAttributeValue(bpy_struct)
      • FloatVectorAttributeValue(bpy_struct)
      • FloatVectorValueReadOnly(bpy_struct)
      • FluidDomainSettings(bpy_struct)
      • FluidEffectorSettings(bpy_struct)
      • FluidFlowSettings(bpy_struct)
      • ForeachGeometryElementGenerationItem(bpy_struct)
      • ForeachGeometryElementInputItem(bpy_struct)
      • ForeachGeometryElementMainItem(bpy_struct)
      • FreestyleLineSet(bpy_struct)
      • FreestyleModuleSettings(bpy_struct)
      • FreestyleModules(bpy_prop_collection)
      • FreestyleSettings(bpy_struct)
      • Function(bpy_struct)
      • GPencilInterpolateSettings(bpy_struct)
      • GPencilSculptGuide(bpy_struct)
      • GPencilSculptSettings(bpy_struct)
      • GameObjectSettings(bpy_struct)
      • GameProperty(bpy_struct)
      • GameSoftBodySettings(bpy_struct)
      • GeometryNodeClosureToListItem(bpy_struct)
      • GeometryNodeClosureToListItems(bpy_prop_collection)
      • GeometryNodeFieldToGridItem(bpy_struct)
      • GeometryNodeFieldToGridItems(bpy_prop_collection)
      • GeometryNodeFieldToListItem(bpy_struct)
      • GeometryNodeFieldToListItems(bpy_prop_collection)
      • Gizmo(bpy_struct)
      • GizmoGroup(bpy_struct)
      • GizmoGroupProperties(bpy_struct)
      • GizmoProperties(bpy_struct)
      • Gizmos(bpy_prop_collection)
      • GreasePencilDashModifierSegment(bpy_struct)
      • GreasePencilDrawing(bpy_struct)
      • GreasePencilFrame(bpy_struct)
      • GreasePencilFrames(bpy_prop_collection)
      • GreasePencilLayerMask(bpy_struct)
      • GreasePencilLayerMasks(bpy_prop_collection)
      • GreasePencilTimeModifierSegment(bpy_struct)
      • GreasePencilTreeNode(bpy_struct)
      • GreasePencilv3LayerGroup(bpy_prop_collection)
      • GreasePencilv3Layers(bpy_prop_collection)
      • Header(bpy_struct)
      • Histogram(bpy_struct)
      • ID(bpy_struct)
      • IDMaterials(bpy_prop_collection)
      • IDOverrideLibrary(bpy_struct)
      • IDOverrideLibraryProperties(bpy_prop_collection)
      • IDOverrideLibraryProperty(bpy_struct)
      • IDOverrideLibraryPropertyOperation(bpy_struct)
      • IDOverrideLibraryPropertyOperations(bpy_prop_collection)
      • IDPropertyWrapPtr(bpy_struct)
      • IKParam(bpy_struct)
      • ImageFormatSettings(bpy_struct)
      • ImagePackedFile(bpy_struct)
      • ImagePreview(bpy_struct)
      • ImageUser(bpy_struct)
      • IndexSwitchItem(bpy_struct)
      • Int2AttributeValue(bpy_struct)
      • IntAttributeValue(bpy_struct)
      • KeyConfig(bpy_struct)
      • KeyConfigPreferences(bpy_struct)
      • KeyConfigurations(bpy_prop_collection)
      • KeyMap(bpy_struct)
      • KeyMapItem(bpy_struct)
      • KeyMapItems(bpy_prop_collection)
      • KeyMaps(bpy_prop_collection)
      • Keyframe(bpy_struct)
      • KeyingSet(bpy_struct)
      • KeyingSetInfo(bpy_struct)
      • KeyingSetPath(bpy_struct)
      • KeyingSetPaths(bpy_prop_collection)
      • KeyingSets(bpy_prop_collection)
      • KeyingSetsAll(bpy_prop_collection)
      • LatticePoint(bpy_struct)
      • LayerCollection(bpy_struct)
      • LayerObjects(bpy_prop_collection)
      • LayoutPanelState(bpy_struct)
      • LibraryWeakReference(bpy_struct)
      • Lightgroup(bpy_struct)
      • Lightgroups(bpy_prop_collection)
      • LineStyleAlphaModifiers(bpy_prop_collection)
      • LineStyleColorModifiers(bpy_prop_collection)
      • LineStyleGeometryModifiers(bpy_prop_collection)
      • LineStyleModifier(bpy_struct)
      • LineStyleTextureSlots(bpy_prop_collection)
      • LineStyleThicknessModifiers(bpy_prop_collection)
      • Linesets(bpy_prop_collection)
      • LodLevel(bpy_struct)
      • LoopColors(bpy_prop_collection)
      • Macro(bpy_struct)
      • MaskLayer(bpy_struct)
      • MaskLayers(bpy_prop_collection)
      • MaskParent(bpy_struct)
      • MaskSpline(bpy_struct)
      • MaskSplinePoint(bpy_struct)
      • MaskSplinePointUW(bpy_struct)
      • MaskSplinePoints(bpy_prop_collection)
      • MaskSplines(bpy_prop_collection)
      • MaterialGPencilStyle(bpy_struct)
      • MaterialLineArt(bpy_struct)
      • MaterialSlot(bpy_struct)
      • Menu(bpy_struct)
        • Basic Menu Example
        • Submenus
        • Extending Menus
        • Preset Menus
        • Extending the Button Context Menu
          • Menu
            • Menu.bl_description
            • Menu.bl_idname
            • Menu.bl_label
            • Menu.bl_options
            • Menu.bl_owner_id
            • Menu.bl_translation_context
            • Menu.layout
            • Menu.poll()
            • Menu.draw()
            • Menu.append()
            • Menu.draw_collapsible()
            • Menu.draw_preset()
            • Menu.is_extended()
            • Menu.path_menu()
            • Menu.prepend()
            • Menu.remove()
            • Menu.bl_rna_get_subclass()
            • Menu.bl_rna_get_subclass_py()
          • Inherited Properties
          • Inherited Functions
      • MeshAutomaskingSettings(bpy_struct)
      • MeshEdge(bpy_struct)
      • MeshEdges(bpy_prop_collection)
      • MeshLoop(bpy_struct)
      • MeshLoopColor(bpy_struct)
      • MeshLoopColorLayer(bpy_struct)
      • MeshLoopTriangle(bpy_struct)
      • MeshLoopTriangles(bpy_prop_collection)
      • MeshLoops(bpy_prop_collection)
      • MeshNormalValue(bpy_struct)
      • MeshPolygon(bpy_struct)
      • MeshPolygons(bpy_prop_collection)
      • MeshSkinVertex(bpy_struct)
      • MeshSkinVertexLayer(bpy_struct)
      • MeshStatVis(bpy_struct)
      • MeshUVLoop(bpy_struct)
      • MeshUVLoopLayer(bpy_struct)
      • MeshVertex(bpy_struct)
      • MeshVertices(bpy_prop_collection)
      • MetaBallElements(bpy_prop_collection)
      • MetaElement(bpy_struct)
      • Modifier(bpy_struct)
      • MotionPath(bpy_struct)
      • MotionPathVert(bpy_struct)
      • MovieClipProxy(bpy_struct)
      • MovieClipScopes(bpy_struct)
      • MovieClipUser(bpy_struct)
      • MovieReconstructedCamera(bpy_struct)
      • MovieTracking(bpy_struct)
      • MovieTrackingCamera(bpy_struct)
      • MovieTrackingDopesheet(bpy_struct)
      • MovieTrackingMarker(bpy_struct)
      • MovieTrackingMarkers(bpy_prop_collection)
      • MovieTrackingObject(bpy_struct)
      • MovieTrackingObjectPlaneTracks(bpy_prop_collection)
      • MovieTrackingObjectTracks(bpy_prop_collection)
      • MovieTrackingObjects(bpy_prop_collection)
      • MovieTrackingPlaneMarker(bpy_struct)
      • MovieTrackingPlaneMarkers(bpy_prop_collection)
      • MovieTrackingPlaneTrack(bpy_struct)
      • MovieTrackingPlaneTracks(bpy_prop_collection)
      • MovieTrackingReconstructedCameras(bpy_prop_collection)
      • MovieTrackingReconstruction(bpy_struct)
      • MovieTrackingSettings(bpy_struct)
      • MovieTrackingStabilization(bpy_struct)
      • MovieTrackingTrack(bpy_struct)
      • MovieTrackingTracks(bpy_prop_collection)
      • NDOFMotionEventData(bpy_struct)
      • NlaStrip(bpy_struct)
      • NlaStripFCurves(bpy_prop_collection)
      • NlaStrips(bpy_prop_collection)
      • NlaTrack(bpy_struct)
      • NlaTracks(bpy_prop_collection)
      • Node(bpy_struct)
      • NodeClosureInputItem(bpy_struct)
      • NodeClosureInputItems(bpy_prop_collection)
      • NodeClosureOutputItem(bpy_struct)
      • NodeClosureOutputItems(bpy_prop_collection)
      • NodeCombineBundleItem(bpy_struct)
      • NodeCombineBundleItems(bpy_prop_collection)
      • NodeCompositorFileOutputItem(bpy_struct)
      • NodeCompositorFileOutputItems(bpy_prop_collection)
      • NodeEnumItem(bpy_struct)
      • NodeEvaluateClosureInputItem(bpy_struct)
      • NodeEvaluateClosureInputItems(bpy_prop_collection)
      • NodeEvaluateClosureOutputItem(bpy_struct)
      • NodeEvaluateClosureOutputItems(bpy_prop_collection)
      • NodeFunctionFormatStringItem(bpy_struct)
      • NodeFunctionFormatStringItems(bpy_prop_collection)
      • NodeGeometryBakeItem(bpy_struct)
      • NodeGeometryBakeItems(bpy_prop_collection)
      • NodeGeometryCaptureAttributeItem(bpy_struct)
      • NodeGeometryCaptureAttributeItems(bpy_prop_collection)
      • NodeGeometryForeachGeometryElementGenerationItems(bpy_prop_collection)
      • NodeGeometryForeachGeometryElementInputItems(bpy_prop_collection)
      • NodeGeometryForeachGeometryElementMainItems(bpy_prop_collection)
      • NodeGeometryRepeatOutputItems(bpy_prop_collection)
      • NodeGeometrySimulationOutputItems(bpy_prop_collection)
      • NodeGeometryViewerItem(bpy_struct)
      • NodeGeometryViewerItems(bpy_prop_collection)
      • NodeIndexSwitchItems(bpy_prop_collection)
      • NodeInputs(bpy_prop_collection)
      • NodeInternalSocketTemplate(bpy_struct)
      • NodeLink(bpy_struct)
      • NodeLinks(bpy_prop_collection)
      • NodeMenuSwitchItems(bpy_prop_collection)
      • NodeOutputs(bpy_prop_collection)
      • NodePanelState(bpy_struct)
      • NodeRaycastSampleAttributeItem(bpy_struct)
      • NodeRaycastSampleAttributeItems(bpy_prop_collection)
      • NodeSeparateBundleItem(bpy_struct)
      • NodeSeparateBundleItems(bpy_prop_collection)
      • NodeSocket(bpy_struct)
      • NodeTreeInterface(bpy_struct)
      • NodeTreeInterfaceItem(bpy_struct)
      • NodeTreePath(bpy_struct)
      • Nodes(bpy_prop_collection)
      • NodesModifierBake(bpy_struct)
      • NodesModifierBakeDataBlocks(bpy_prop_collection)
      • NodesModifierBakes(bpy_prop_collection)
      • NodesModifierDataBlock(bpy_struct)
      • NodesModifierPanel(bpy_struct)
      • NodesModifierPanels(bpy_prop_collection)
      • NodesModifierProperties(bpy_struct)
      • NodesModifierPropertiesEmpty(bpy_struct)
      • NodesModifierWarning(bpy_struct)
      • ObjectActivityCulling(bpy_struct)
      • ObjectBase(bpy_struct)
      • ObjectConstraints(bpy_prop_collection)
      • ObjectDisplay(bpy_struct)
      • ObjectLightLinking(bpy_struct)
      • ObjectLineArt(bpy_struct)
      • ObjectModifiers(bpy_prop_collection)
      • ObjectShaderFx(bpy_prop_collection)
      • Operator(bpy_struct)
      • OperatorMacro(bpy_struct)
      • OperatorOptions(bpy_struct)
      • OperatorProperties(bpy_struct)
      • PackedFile(bpy_struct)
      • Paint(bpy_struct)
      • PaintModeSettings(bpy_struct)
      • PaletteColor(bpy_struct)
      • PaletteColors(bpy_prop_collection)
      • Panel(bpy_struct)
      • Particle(bpy_struct)
      • ParticleBrush(bpy_struct)
      • ParticleDupliWeight(bpy_struct)
      • ParticleEdit(bpy_struct)
      • ParticleHairKey(bpy_struct)
      • ParticleKey(bpy_struct)
      • ParticleSettingsTextureSlots(bpy_prop_collection)
      • ParticleSystem(bpy_struct)
      • ParticleSystems(bpy_prop_collection)
      • ParticleTarget(bpy_struct)
      • PathCompare(bpy_struct)
      • PathCompareCollection(bpy_prop_collection)
      • Point(bpy_struct)
      • PointCache(bpy_struct)
      • PointCacheItem(bpy_struct)
      • PointCaches(bpy_prop_collection)
      • Pose(bpy_struct)
      • PoseBone(bpy_struct)
      • PoseBoneConstraints(bpy_prop_collection)
      • Preferences(bpy_struct)
      • PreferencesApps(bpy_struct)
      • PreferencesEdit(bpy_struct)
      • PreferencesExperimental(bpy_struct)
      • PreferencesExtensions(bpy_struct)
      • PreferencesFilePaths(bpy_struct)
      • PreferencesInput(bpy_struct)
      • PreferencesKeymap(bpy_struct)
      • PreferencesSystem(bpy_struct)
      • PreferencesView(bpy_struct)
      • PrimitiveBoolean(bpy_struct)
      • PrimitiveFloat(bpy_struct)
      • PrimitiveInt(bpy_struct)
      • PrimitiveString(bpy_struct)
      • Property(bpy_struct)
      • PropertyGroup(bpy_struct)
      • PropertyGroupItem(bpy_struct)
      • PythonProxy(bpy_struct)
      • PythonProxyProperty(bpy_struct)
      • QuaternionAttributeValue(bpy_struct)
      • RaytraceEEVEE(bpy_struct)
      • ReadOnlyInteger(bpy_struct)
      • Region(bpy_struct)
      • RegionView3D(bpy_struct)
      • RenderEngine(bpy_struct)
      • RenderLayer(bpy_struct)
      • RenderPass(bpy_struct)
      • RenderPasses(bpy_prop_collection)
      • RenderResult(bpy_struct)
      • RenderSettings(bpy_struct)
      • RenderSlot(bpy_struct)
      • RenderSlots(bpy_prop_collection)
      • RenderView(bpy_struct)
      • RenderViews(bpy_prop_collection)
      • RepeatItem(bpy_struct)
      • Report(bpy_struct)
      • RetimingKey(bpy_struct)
      • RetimingKeys(bpy_prop_collection)
      • RigidBodyConstraint(bpy_struct)
      • RigidBodyObject(bpy_struct)
      • RigidBodyWorld(bpy_struct)
      • SPHFluidSettings(bpy_struct)
      • SceneDisplay(bpy_struct)
      • SceneEEVEE(bpy_struct)
      • SceneGameData(bpy_struct)
      • SceneGameRecastData(bpy_struct)
      • SceneGpencil(bpy_struct)
      • SceneHydra(bpy_struct)
      • SceneObjects(bpy_prop_collection)
      • SceneRenderView(bpy_struct)
      • Scopes(bpy_struct)
      • ScriptDirectory(bpy_struct)
      • ScriptDirectoryCollection(bpy_prop_collection)
      • Sensor(bpy_struct)
      • SequenceEditor(bpy_struct)
      • SequenceTimelineChannel(bpy_struct)
      • SequencerCacheOverlay(bpy_struct)
      • SequencerCompositorModifierProperties(bpy_struct)
      • SequencerCompositorModifierPropertiesEmpty(bpy_struct)
      • SequencerPreviewOverlay(bpy_struct)
      • SequencerTimelineOverlay(bpy_struct)
      • SequencerToolSettings(bpy_struct)
      • ShaderFx(bpy_struct)
      • ShapeKey(bpy_struct)
      • ShapeKeyBezierPoint(bpy_struct)
      • ShapeKeyCurvePoint(bpy_struct)
      • ShapeKeyPoint(bpy_struct)
      • Short2AttributeValue(bpy_struct)
      • SimulationStateItem(bpy_struct)
      • SoftBodySettings(bpy_struct)
      • Space(bpy_struct)
      • SpaceClipOverlay(bpy_struct)
      • SpaceDopeSheetOverlay(bpy_struct)
      • SpaceImageOverlay(bpy_struct)
      • SpaceNodeEditorPath(bpy_prop_collection)
      • SpaceNodeOverlay(bpy_struct)
      • SpaceUVEditor(bpy_struct)
      • Spline(bpy_struct)
      • SplineBezierPoints(bpy_prop_collection)
      • SplinePoint(bpy_struct)
      • SplinePoints(bpy_prop_collection)
      • SpreadsheetColumn(bpy_struct)
      • SpreadsheetColumnID(bpy_struct)
      • SpreadsheetRowFilter(bpy_struct)
      • SpreadsheetTable(bpy_struct)
      • SpreadsheetTableID(bpy_struct)
      • SpreadsheetTables(bpy_prop_collection)
      • Stereo3dDisplay(bpy_struct)
      • Stereo3dFormat(bpy_struct)
      • StringAttributeValue(bpy_struct)
      • Strip(bpy_struct)
      • StripColorBalanceData(bpy_struct)
      • StripCrop(bpy_struct)
      • StripElement(bpy_struct)
      • StripElements(bpy_prop_collection)
      • StripModifier(bpy_struct)
      • StripModifiers(bpy_prop_collection)
      • StripProxy(bpy_struct)
      • StripTransform(bpy_struct)
      • StripsMeta(bpy_prop_collection)
      • StripsTopLevel(bpy_prop_collection)
      • Struct(bpy_struct)
      • StudioLight(bpy_struct)
      • StudioLights(bpy_prop_collection)
      • TexMapping(bpy_struct)
      • TexPaintSlot(bpy_struct)
      • TextBox(bpy_struct)
      • TextCharacterFormat(bpy_struct)
      • TextLine(bpy_struct)
      • TextboxState(bpy_struct)
      • TextureSlot(bpy_struct)
      • Theme(bpy_struct)
      • ThemeBoneColorSet(bpy_struct)
      • ThemeClipEditor(bpy_struct)
      • ThemeCollectionColor(bpy_struct)
      • ThemeCommon(bpy_struct)
      • ThemeCommonAnim(bpy_struct)
      • ThemeCommonCurves(bpy_struct)
      • ThemeConsole(bpy_struct)
      • ThemeDopeSheet(bpy_struct)
      • ThemeFileBrowser(bpy_struct)
      • ThemeFontStyle(bpy_struct)
      • ThemeGradientColors(bpy_struct)
      • ThemeGraphEditor(bpy_struct)
      • ThemeImageEditor(bpy_struct)
      • ThemeInfo(bpy_struct)
      • ThemeLogicEditor(bpy_struct)
      • ThemeNLAEditor(bpy_struct)
      • ThemeNodeEditor(bpy_struct)
      • ThemeOutliner(bpy_struct)
      • ThemePreferences(bpy_struct)
      • ThemeProperties(bpy_struct)
      • ThemeRegions(bpy_struct)
      • ThemeRegionsAssetShelf(bpy_struct)
      • ThemeRegionsChannels(bpy_struct)
      • ThemeRegionsScrubbing(bpy_struct)
      • ThemeRegionsSidebars(bpy_struct)
      • ThemeSequenceEditor(bpy_struct)
      • ThemeSpaceGeneric(bpy_struct)
      • ThemeSpaceGradient(bpy_struct)
      • ThemeSpreadsheet(bpy_struct)
      • ThemeStatusBar(bpy_struct)
      • ThemeStripColor(bpy_struct)
      • ThemeStyle(bpy_struct)
      • ThemeTextEditor(bpy_struct)
      • ThemeTopBar(bpy_struct)
      • ThemeUserInterface(bpy_struct)
      • ThemeView3D(bpy_struct)
      • ThemeWidgetColors(bpy_struct)
      • ThemeWidgetStateColors(bpy_struct)
      • TimelineMarker(bpy_struct)
      • TimelineMarkers(bpy_prop_collection)
      • Timer(bpy_struct)
      • ToolSettings(bpy_struct)
      • TransformOrientation(bpy_struct)
      • TransformOrientationSlot(bpy_struct)
      • UDIMTile(bpy_struct)
      • UDIMTiles(bpy_prop_collection)
      • UILayout(bpy_struct)
      • UIList(bpy_struct)
      • UIPieMenu(bpy_struct)
      • UIPopover(bpy_struct)
      • UIPopupMenu(bpy_struct)
      • USDHook(bpy_struct)
      • UVLoopLayers(bpy_prop_collection)
      • UVProjector(bpy_struct)
      • UnifiedPaintSettings(bpy_struct)
      • UnitSettings(bpy_struct)
      • UnknownType(bpy_struct)
      • UserAssetLibrary(bpy_struct)
      • UserExtensionRepo(bpy_struct)
      • UserExtensionRepoCollection(bpy_prop_collection)
      • UserSolidLight(bpy_struct)
      • UvSculpt(bpy_struct)
      • VertexGroup(bpy_struct)
      • VertexGroupElement(bpy_struct)
      • VertexGroups(bpy_prop_collection)
      • View2D(bpy_struct)
      • View3DCursor(bpy_struct)
      • View3DOverlay(bpy_struct)
      • View3DShading(bpy_struct)
      • ViewLayer(bpy_struct)
      • ViewLayerEEVEE(bpy_struct)
      • ViewLayers(bpy_prop_collection)
      • ViewerPath(bpy_struct)
      • ViewerPathElem(bpy_struct)
      • VolumeDisplay(bpy_struct)
      • VolumeGrid(bpy_struct)
      • VolumeGrids(bpy_prop_collection)
      • VolumeRender(bpy_struct)
      • WalkNavigation(bpy_struct)
      • Window(bpy_struct)
      • Windows(bpy_prop_collection)
      • WorkSpaceTool(bpy_struct)
      • WorldLighting(bpy_struct)
      • WorldMistSettings(bpy_struct)
      • XrActionMap(bpy_struct)
      • XrActionMapBinding(bpy_struct)
      • XrActionMapBindings(bpy_prop_collection)
      • XrActionMapItem(bpy_struct)
      • XrActionMapItems(bpy_prop_collection)
      • XrActionMaps(bpy_prop_collection)
      • XrComponentPath(bpy_struct)
      • XrComponentPaths(bpy_prop_collection)
      • XrEventData(bpy_struct)
      • XrNavigation(bpy_struct)
      • XrSessionSettings(bpy_struct)
      • XrSessionState(bpy_struct)
      • XrUserPath(bpy_struct)
      • XrUserPaths(bpy_prop_collection)
      • wmOwnerID(bpy_struct)
      • wmOwnerIDs(bpy_prop_collection)
      • wmTools(bpy_prop_collection)
      • bpy_struct
    • bpy_prop
    • bpy_prop_array
    • bpy_prop_collection_idprop
    • bpy_prop_collection
    • ContextTempOverride
    • GeometrySet
    • InlineShaderNodes
    • Shared Enum Types
    • Types with Custom Property Support
  • Utilities (bpy.utils)
  • Path Utilities (bpy.path)
  • Application Data (bpy.app)
  • Property Definitions (bpy.props)

Game Engine Modules

  • Game Types (bge.types)
  • Game Logic (bge.logic)
  • Rasterizer (bge.render)
  • Video Texture (bge.texture)
  • FFmpeg Video and Image Status
  • Image Blending Modes
  • Game Keys (bge.events)
  • Physics Constraints (bge.constraints)
  • Application Data (bge.app)
  • Game GUI (bgui)

Standalone Modules

  • Audio System (aud)
  • Additional Math Functions (bl_math)
  • Font Drawing (blf)
  • BMesh Module (bmesh)
  • Extra Utilities (bpy_extras)
  • Freestyle Module (freestyle)
  • GPU Module (gpu)
  • GPU Utilities (gpu_extras)
  • ID Properties Module (idprop)
  • Image Buffer (imbuf)
  • Math Types & Utilities (mathutils)
UPBGE 0.5x & Blender 5.2.0 Alpha Python API
  • Types (bpy.types)
  • bpy_struct
  • Menu(bpy_struct)

Menu(bpy_struct)

Basic Menu Example

Here is an example of a simple menu. Menus differ from panels in that they must reference from a header, panel or another menu.

Notice the ‘CATEGORY_MT_name’ in Menu.bl_idname, this is a naming convention for menus.

Note

Menu subclasses must be registered before referencing them from Blender.

Note

Menus have their UILayout.operator_context initialized as ‘EXEC_REGION_WIN’ rather than ‘INVOKE_REGION_WIN’ (see Execution Context). If the operator context needs to initialize inputs from the Operator.invoke function, then this needs to be explicitly set. When a menu is added to UI elements such as a panel or header, the operator execution context will be inherited from them.

import bpy


class BasicMenu(bpy.types.Menu):
    bl_idname = "OBJECT_MT_select_test"
    bl_label = "Select"

    def draw(self, context):
        layout = self.layout

        layout.operator("object.select_all", text="Select/Deselect All").action = 'TOGGLE'
        layout.operator("object.select_all", text="Inverse").action = 'INVERT'
        layout.operator("object.select_random", text="Random")


bpy.utils.register_class(BasicMenu)

# Test call to display immediately.
bpy.ops.wm.call_menu(name="OBJECT_MT_select_test")

Submenus

This menu demonstrates some different functions.

import bpy


class SubMenu(bpy.types.Menu):
    bl_idname = "OBJECT_MT_select_submenu"
    bl_label = "Select"

    def draw(self, context):
        layout = self.layout

        layout.operator("object.select_all", text="Select/Deselect All").action = 'TOGGLE'
        layout.operator("object.select_all", text="Inverse").action = 'INVERT'
        layout.operator("object.select_random", text="Random")

        # Access this operator as a sub-menu.
        layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type")

        layout.separator()

        # Expand each operator option into this menu.
        layout.operator_enum("object.light_add", "type")

        layout.separator()

        # Use existing menu.
        layout.menu("VIEW3D_MT_transform")


bpy.utils.register_class(SubMenu)

# Test call to display immediately.
bpy.ops.wm.call_menu(name="OBJECT_MT_select_submenu")

Extending Menus

When creating menus for add-ons you can’t reference menus in Blender’s default scripts. Instead, the add-on can add menu items to existing menus.

The function menu_draw acts like Menu.draw.

import bpy


def menu_draw(self, context):
    self.layout.operator("wm.save_homefile")


bpy.types.TOPBAR_MT_file.append(menu_draw)

Preset Menus

Preset menus are simply a convention that uses a menu sub-class to perform the common task of managing presets.

This example shows how you can add a preset menu.

This example uses the object display options, however you can use properties defined by your own scripts too.

import bpy
from bpy.types import Operator, Menu
from bl_operators.presets import AddPresetBase


class OBJECT_MT_display_presets(Menu):
    bl_label = "Object Display Presets"
    preset_subdir = "object/display"
    preset_operator = "script.execute_preset"
    draw = Menu.draw_preset


class AddPresetObjectDisplay(AddPresetBase, Operator):
    '''Add a Object Display Preset'''
    bl_idname = "camera.object_display_preset_add"
    bl_label = "Add Object Display Preset"
    preset_menu = "OBJECT_MT_display_presets"

    # Variable used for all preset values.
    preset_defines = [
        "obj = bpy.context.object"
    ]

    # Properties to store in the preset.
    preset_values = [
        "obj.display_type",
        "obj.show_bounds",
        "obj.display_bounds_type",
        "obj.show_name",
        "obj.show_axis",
        "obj.show_wire",
    ]

    # Where to store the preset.
    preset_subdir = "object/display"


# Display into an existing panel.
def panel_func(self, context):
    layout = self.layout

    row = layout.row(align=True)
    row.menu(OBJECT_MT_display_presets.__name__, text=OBJECT_MT_display_presets.bl_label)
    row.operator(AddPresetObjectDisplay.bl_idname, text="", icon='ZOOM_IN')
    row.operator(AddPresetObjectDisplay.bl_idname, text="", icon='ZOOM_OUT').remove_active = True


classes = (
    OBJECT_MT_display_presets,
    AddPresetObjectDisplay,
)


def register():
    for cls in classes:
        bpy.utils.register_class(cls)
    bpy.types.OBJECT_PT_display.prepend(panel_func)


def unregister():
    for cls in classes:
        bpy.utils.unregister_class(cls)
    bpy.types.OBJECT_PT_display.remove(panel_func)


if __name__ == "__main__":
    register()

Extending the Button Context Menu

This example enables you to insert your own menu entry into the common right click menu that you get while hovering over a UI button (e.g. operator, value field, color, string, etc.)

To make the example work, you have to first select an object then right click on an user interface element (maybe a color in the material properties) and choose Execute Custom Action.

Executing the operator will then print all values.

import bpy


def dump(obj, text):
    for attr in dir(obj):
        print("{!r}.{:s} = {!s}".format(obj, attr, getattr(obj, attr)))


class WM_OT_button_context_test(bpy.types.Operator):
    """Right click entry test"""
    bl_idname = "wm.button_context_test"
    bl_label = "Run Context Test"

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

    def execute(self, context):
        value = getattr(context, "button_pointer", None)
        if value is not None:
            dump(value, "button_pointer")

        value = getattr(context, "button_prop", None)
        if value is not None:
            dump(value, "button_prop")

        value = getattr(context, "button_operator", None)
        if value is not None:
            dump(value, "button_operator")

        return {'FINISHED'}


def draw_menu(self, context):
    layout = self.layout
    layout.separator()
    layout.operator(WM_OT_button_context_test.bl_idname)


def register():
    bpy.utils.register_class(WM_OT_button_context_test)
    bpy.types.UI_MT_button_context_menu.append(draw_menu)


def unregister():
    bpy.types.UI_MT_button_context_menu.remove(draw_menu)
    bpy.utils.unregister_class(WM_OT_button_context_test)


if __name__ == "__main__":
    register()

base class — bpy_struct

class bpy.types.Menu(bpy_struct)

Editor menu containing buttons

bl_description

(default “”)

Type:

str

bl_idname

If this is set, the menu gets a custom ID, otherwise it takes the name of the class used to define the menu (for example, if the class name is “OBJECT_MT_hello”, and bl_idname is not set by the script, then bl_idname = “OBJECT_MT_hello”) (default “”, never None)

Type:

str

bl_label

The menu label (default “”, never None)

Type:

str

bl_options

Options for this menu type (default set())

  • SEARCH_ON_KEY_PRESS Search on Key Press – Open a menu search when a key pressed while the menu is open.

Type:

set[Literal[‘SEARCH_ON_KEY_PRESS’]]

bl_owner_id

(default “”, never None)

Type:

str

bl_translation_context

(default “*”, never None)

Type:

str

layout

Defines the structure of the menu in the UI (readonly)

Type:

UILayout | None

classmethod poll(context)

If this method returns a non-null output, then the menu can be drawn

Parameters:

context (Context | None) – The context

Return type:

bool

draw(context)

Draw UI elements into the menu UI layout

Parameters:

context (Context | None) – The context

classmethod append(draw_func)

Append a draw function to this menu, takes the same arguments as the menus draw function

Parameters:

draw_func (Callable[[Self, Context], None]) – Draw function to append.

classmethod draw_collapsible(context, layout)

Draw the menu inline when the header shows menus, otherwise draw it as a collapsed icon. Intended for use within header draw functions.

Parameters:
  • context (Context) – The context.

  • layout (UILayout) – The layout to draw into.

draw_preset(context)

Define these on the subclass: - preset_operator (string) - preset_subdir (string)

Optionally: - preset_add_operator (string) - preset_extensions (set of strings) - preset_operator_defaults (dict of keyword args)

Parameters:

context (Context) – The context.

classmethod is_extended()

Test if any draw function has been added via append() or prepend().

Returns:

True when at least one draw function has been added.

Return type:

bool

path_menu(searchpaths, operator, *, props_default=None, prop_filepath='filepath', filter_ext=None, filter_path=None, display_name=None, add_operator=None, add_operator_props=None, translate=True, recursive_paths=False)

Populate a menu from a list of paths.

Parameters:
  • searchpaths (Sequence[str]) – Paths to scan.

  • operator (str) – The operator id to use with each file.

  • prop_filepath (str) – Optional operator filepath property (defaults to “filepath”).

  • props_default (dict[str, Any] | None) – Properties to assign to each operator.

  • filter_ext (Callable[[str], bool] | None) –

    Optional callback that takes the file extensions.

    Returning false excludes the file from the list.

  • filter_path (Callable[[str], bool] | None) – Optional callback that takes the file name, returns false to exclude it.

  • display_name (Callable[[str], str] | None) – Optional callback that takes the full path, returns the name to display.

  • add_operator (str | None) – Optional operator id used to add or remove entries.

  • add_operator_props (dict[str, Any] | None) – Properties to assign to the add/remove operator.

  • translate (bool) – Translate the displayed names.

  • recursive_paths (bool) – Add submenus for sub-directories instead of listing their contents.

classmethod prepend(draw_func)

Prepend a draw function to this menu, takes the same arguments as the menus draw function

Parameters:

draw_func (Callable[[Self, Context], None]) – Draw function to prepend.

classmethod remove(draw_func)

Remove a draw function that has been added to this menu.

Parameters:

draw_func (Callable[[Self, Context], None]) – Draw function previously registered via append() or prepend().

classmethod bl_rna_get_subclass(id, default=None, /)
Parameters:
  • id (str) – The RNA type identifier.

  • default (bpy.types.Struct | None) – The value to return when not found.

Returns:

The RNA type or default when not found.

Return type:

bpy.types.Struct

classmethod bl_rna_get_subclass_py(id, default=None, /)
Parameters:
  • id (str) – The RNA type identifier.

  • default (type | None) – The value to return when not found.

Returns:

The class or default when not found.

Return type:

type

Inherited Properties

  • bpy_struct.id_data

Inherited Functions

  • bpy_struct.as_pointer

  • bpy_struct.driver_add

  • bpy_struct.driver_remove

  • bpy_struct.get

  • bpy_struct.id_properties_clear

  • bpy_struct.id_properties_ensure

  • bpy_struct.id_properties_ui

  • bpy_struct.is_property_hidden

  • bpy_struct.is_property_overridable_library

  • bpy_struct.is_property_readonly

  • bpy_struct.is_property_set

  • bpy_struct.items

  • bpy_struct.keyframe_delete

  • bpy_struct.keyframe_insert

  • bpy_struct.keys

  • bpy_struct.path_from_id

  • bpy_struct.path_from_module

  • bpy_struct.path_resolve

  • bpy_struct.pop

  • bpy_struct.property_overridable_library_set

  • bpy_struct.property_unset

  • bpy_struct.rna_ancestors

  • bpy_struct.type_recast

  • bpy_struct.values

Previous Next

© Copyright UPBGE & Blender Authors. Revision 90e03b7bdede - 28/05/2026.

  • Report issue on this page