Post #4709: Hmm, could you please tell me the purpose rather than the procedure you tried? T

📋 Metadata

🏷️ Tags

scripting intermediate solved

  • Property Editor
  • UserData
  • Store in Addon Preferences
  • Python Scripting

💬 Content

Hmm, could you please tell me the purpose rather than the procedure you tried? That procedure doesn’t seem to have worked, and it’s confusing for me. When, how, and for what purpose do you want to use the saved coordinates?

From our previous conversations, I gather that Cam_0V0 is something like a preset that applies multiple configuration settings to a camera, right? And you want to save the current settings before applying that preset, so you can revert to them at any time?

If that’s the case, saving data in the “Pie Menu Editor” is not appropriate. While UserData can temporarily store data, it will be reset when Blender is restarted. If it were me, I’d be happier if I could return to the original camera data even after reopening the file the next day. The PME Property’s “Store in Addon Preferences” option solves this problem, but it’s still not suitable. That’s because the number and names of cameras may vary depending on the project, making it unrealistic to create a PME Property for each one.

If you want to save the camera position information, you should save it in the Blender scene. With that in mind, I suggest using Blender’s custom properties. Here’s a script that you can try in Blender’s text editor. It saves the position, rotation, and focal length with a single action. Even if you change the camera position, you can return to the saved state by executing it again. I’ve included explanations in each part of the script, so please read them. You should be able to understand the functionality as well. If you like it, either incorporate it into your add-on or add it to PME’s “autorun.”


🔗 View on Blender Artists