-2
$\begingroup$

Does anybody know how I could, from the 3D view and with a customized shortcut, automatically open, in the text editor, a .txt file whose name is the same() as the one of the active object?

()Most objects are instanced and their names are followed by '.r'/'.l'; this part should be ignored.

$\endgroup$
5
  • 1
    $\begingroup$ Suggest start from the Simple Operator template in text editor > templates > python and try something like text = bpy.data.objects.texts.new(context.object.name) $\endgroup$
    – batFINGER
    Sep 15 at 12:44
  • 1
    $\begingroup$ Related adds a text block with the geometry to create the acitve object. blender.stackexchange.com/questions/65129/… Please edit any extra details into question, and where your efforts are at so far. $\endgroup$
    – batFINGER
    Sep 15 at 14:42
  • $\begingroup$ Ok, I tried the script of the link and it actually creates a new .txt file. In my case, I want to open a .txt file that already exists, and that has the same name as the active object. $\endgroup$ Sep 15 at 16:46
  • $\begingroup$ Yep got it. . It's a pretty simple script to write. Sure someone will write it for you, as an answer in due course. $\endgroup$
    – batFINGER
    Sep 15 at 17:03
  • $\begingroup$ Does it have to be a .txt files? It would be better IMO to use a .json format. It would be cleaner for organizing the data and making modifications using python. $\endgroup$
    – Noizirom
    Sep 18 at 11:25

Your Answer

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

Browse other questions tagged or ask your own question.