Page MenuHome

Fix python path generation for Space* properties
AbandonedPublic

Authored by Aleksandr Zinovev (raa) on May 11 2017, 11:44 AM.

Details

Summary

There is no way in Blender to generate "absolute" path (bpy.data.screens['Default']...) for C.space_data properties which causes these issues:

  • We can't use Copy Data Path operator for these buttons.
  • Blender generates incorrect python path in Info area for some buttons. Eg. for Sticky Select Mode in UV Editor - bpy.data.screens["Default"].(null)

To fix the issue we can use context "relative" paths (bpy.context.space_data....) for Space* properties.

Diff Detail

Repository
rB Blender

Event Timeline

Brecht Van Lommel (brecht) requested changes to this revision.May 11 2017, 8:21 PM

I don't think this is implemented in the right place, RNA paths should not return "bpy.context". These are also used for e.g. the animation system and generally not aware of the Python API.

Is it possible to implement this in wm_prop_pystring_from_context rather than modifying the RNA paths themselves? Or why can't this generate an absolute path in the first place, can that be solved?

This revision now requires changes to proceed.May 11 2017, 8:21 PM

Thanks for review.
Yes I'll try to fix the issue in wm_prop_pystring_from_context.

Aleksandr Zinovev (raa) edited edge metadata.

Fixed path generation for:

  • UVEditor
  • Dopesheet
  • Active grease pencil brush
  • GPUFxSettings
  • FileSelectParams