/* dummy operator callback */
static int object_constraint_add_exec(bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
-
+ ScrArea *sa= CTX_wm_area(C);
+ Object *ob;
+
+ if (sa->spacetype == SPACE_BUTS)
+ ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
+ else
+ ob= CTX_data_active_object(C);
+
if (!ob)
return OPERATOR_CANCELLED;
/* dummy operator callback */
static int pose_constraint_add_exec(bContext *C, wmOperator *op)
{
- Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
-
+ ScrArea *sa= CTX_wm_area(C);
+ Object *ob;
+
+ if (sa->spacetype == SPACE_BUTS)
+ ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
+ else
+ ob= CTX_data_active_object(C);
+
if (!ob)
return OPERATOR_CANCELLED;
SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
struct direntry* file;
- if(!sfile->params ) poll= 0;
-
- if (sfile->params->active_file < 0) {
- poll= 0;
- } else {
- file = filelist_file(sfile->files, sfile->params->active_file);
- if (file && S_ISDIR(file->type)) poll= 0;
+ if (sfile->params) {
+ if (sfile->params->active_file < 0) {
+ poll= 0;
+ } else {
+ file = filelist_file(sfile->files, sfile->params->active_file);
+ if (file && S_ISDIR(file->type)) poll= 0;
+ }
}
+ else
+ poll= 0;
+
return poll;
}