Operators functions wont call in c

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

rasamohamed
Posts: 8
Joined: Sat Oct 05, 2013 11:44 am
Location: INDIA

Operators functions wont call in c

Postby rasamohamed » Thu Oct 31, 2013 8:15 am

Hi, Advance Thanks for your valuable reply.

In this Folder source / blender / windowmanager / intern /
File : wm_operators.c

In this file, this WM_OT_quit_blender function calls every operator functions like wm_exit_blender_op, wm_console_toggle_op, wm_save_as_mainfile_exec through invoke or exec or check but I can't call any other operator functions like wm_save_mainfile_invoke within wm_exit_blender_op. Why? what I have do for this. I have to execute the save mainfile function within the exit_blender function. Whats solution for this. Pls refer the following code.

static int wm_exit_blender_op(bContext *C, wmOperator *op)
{
// Here, I can't call functions like wm_save_mainfile_invoke why>

WM_operator_free(op);

WM_exit(C);

return OPERATOR_FINISHED;
}

static void WM_OT_quit_blender(wmOperatorType *ot)
{
ot->name = "Quit Blender";
ot->idname = "WM_OT_quit_blender";
ot->description = "Quit Blender";

ot->invoke = WM_operator_confirm;
ot->exec = wm_exit_blender_op;
ot->poll = WM_operator_winactive;

}

Thanks
projectvismaya.com

Regards
Rasa [India]
http://projectvismaya.com/

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Thu Oct 31, 2013 3:05 pm

blender saves to .blend if you close blender, check quit.blend
I'm sitting, waiting, wishing, building Blender in superstition...

rasamohamed
Posts: 8
Joined: Sat Oct 05, 2013 11:44 am
Location: INDIA

Postby rasamohamed » Mon Nov 04, 2013 7:46 am

CoDEmanX wrote:blender saves to .blend if you close blender, check quit.blend


Ya Thanks I know this temp saved. But I'm trying to execute this line

ot->exec = wm_save_mainfile;

in to this operator function

static int wm_exit_blender_op(bContext *C, wmOperator *op)
{
- - - - - ;
}
But I can't. How its possible? or Shall I create a NEW operator like WM_OT_quit_blender(wmOperatorType *ot) what are the steps I have to follow, Is there any link for this?

FOR YOUR UNDERSTAND : I'm trying to show save option directly while closing the blender only if user have made any changes in Blender.
Regards

Rasa [India]

http://projectvismaya.com/

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Mon Nov 04, 2013 6:50 pm

calling an operator from within another operator in C doesn't sound like good practise. You may check the automatic saving feature (quit.blend) and see how that is called / executed. You might have to use some functions but not operators.
I'm sitting, waiting, wishing, building Blender in superstition...


Return to “Python”

Who is online

Users browsing this forum: No registered users and 0 guests