0
$\begingroup$

Someone just asked whether it would be possible to change the default for an export script. I rightclicked the button>>Edit Source and got this instructive message:

"Active Button is not from a script, cannot edit source."

And I thought to myself... hm... yeah... bull...

So I found the script because I already knew where to look and answered the question, hopefully satisfactorily.

It so happens that I post the occasional screenshot in here and it's almost always just a region, not the whole window.

Could above message be wrong again?

Is it possible that the screenshot dialog has some python code hidden deep wthin the installation bowels where I can turn True into False, so "full Screen" doesn't bother me anymore?

If yes, where would it be? My motivation to compile from source is somewhat limited.

$\endgroup$
  • 3
    $\begingroup$ I don't think it is. Similarly, the bevel and crease sliders in the properties panel also have no raw python code. They are hardcoded in C. The screenshot dialog is also probably hardcoded. But it is possible recreate it ( I have no idea how) since the bevel and crease panel was recreated. $\endgroup$ – Retrax Feb 20 '18 at 7:10
  • 1
    $\begingroup$ This one? I already knew where to look and answered the question, hopefully satisfactorily Possibly the easiest way to make screenshot_full = False the default is to edit the ctrl-F3 hotkey, and uncheck it there. $\endgroup$ – batFINGER Feb 20 '18 at 8:13
  • 1
    $\begingroup$ I "recreate it" by external means, placing a shortcut to a screenshot app on my toolbar. $\endgroup$ – Doyousketch2 Feb 20 '18 at 11:01
  • $\begingroup$ @batFINGER why waste an amazingly cool answer on a mere comment? I had no idea all these settings were hidden in the shortcuts. $\endgroup$ – Haunt_House Feb 20 '18 at 11:13
  • $\begingroup$ This question (particularly the title) feels a bit like an 'asking about y instead of x' case. I suggest editing this question slightly to focus on the actual problem (how to customise the screenshot tool) instead of asking about what you think is the solution to your problem (finding out whether the dialog is part of a python script). At the minute, people will be unlikely to find the answer below via searching based on the current title (and body). $\endgroup$ – Ray Mairlot Feb 20 '18 at 14:59
1
$\begingroup$

Set default settings in the shortcut.

As a workaround to editing scripts, set the properties in the shortcut. As long as the operator is invoked using the shortcut, the new settings will be used.

For screenshot the default shortcut is CtrlF3

Edit settings from User Preferences > Input > Screen > Save Screenshot Uncheck "Full Screen" setting on the keymap editor.

enter image description here

A "helper" operator

Alternatively, can write a simple helper operator with the settings you want already set. For example having to type in the filename each time. Sample script below saves screenshot into a folder of your choosing and simply timestamps the filename. Change screen.screenshot to screen.area_screeny in keyset enter image description hereabove and not have to bother with invoking the file select dialog. The script is based on scripting > templates > python > operator simple

import bpy

def main(context):
    from os import path
    from datetime import datetime
    directory = "/home/batfinger/Pictures/"
    filename = "Blender%s.png" % str(datetime.now())
    filepath = path.join(directory, filename)
    bpy.ops.screen.screenshot(filepath=filepath, full=False)

class SimpleOperator(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "screen.area_screeny"
    bl_label = "Area Screeny"

    @classmethod
    def poll(cls, context):
        return True

    def execute(self, context):
        main(context)
        return {'FINISHED'}

def register():
    bpy.utils.register_class(SimpleOperator)

def unregister():
    bpy.utils.unregister_class(SimpleOperator)

if __name__ == "__main__":
    register()

    # test call
    bpy.ops.screen.area_screeny()

Note: edit the directory above to suit.

$\endgroup$
  • $\begingroup$ Dear Blender, having all the settings greyed out is a peculiar way of telling me that I can click them, $\endgroup$ – Haunt_House Feb 20 '18 at 11:57

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.