It appears you are right clicking view source in the custom property in the UI. Copy data_path will give you the path, eg ["prop"]. ["prop"]
where the property name is prop. In the material properties panel the rna_item will be the active material, in the object, the context.object, in the data context.object.datacontext.object.data
, in the scene context.scenescene context.scene
etc.
The code you are seeing is setup to handle the different object types that can have a custom property. escape_identifier
most likely handles garbage property names.
The pie menu template. A custom property "prop" has been added to the scene. The rna_item'rna_item' equates to context.scenecontext.scene
, the key to "prop":
class VIEW3D_PIE_template(Menu):
# label is displayed at the center of the pie menu.
bl_label = "Select Mode"
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
pie.prop(context.scene, '["prop"]')
# operator_enum will just spread all available options
# for the type enum of the operator on the pie
pie.operator_enum("mesh.select_mode", "type")