1
$\begingroup$

Can you provide me with different methods, or at least one, for accessing the vector of cursor location? I need anything but the one described in this line of code:

bpy.context.scene.cursor_location

I do not want to access any method in my code using "context"! My code reloads the modules recursively and Blender for no reason I know always loses context when I do so. By the way, lots of people are complaining about losing context in scripts and add-ons after reloading Blender (not in a direct way). If you have any suggestions I would be more than glad.

$\endgroup$
  • 1
    $\begingroup$ Suggest if you don't know something ask a question. If it involves code, show code. Try and avoid "hearsay" in questions. $\endgroup$ – batFINGER Jan 4 at 14:43
1
$\begingroup$

A .blend file can contain many scenes. Each scene has a .cursor_location attribute:

>>> {scene.name:scene.cursor_location for scene in bpy.data.scenes}
{'Scene': Vector((0.9819498062133789, -5.541140079498291, -6.299274444580078))}

If you know the name of the scene, (e.g. 'Scene'), you could use

bpy.data.scenes['Scene'].cursor_location
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.