本文整理匯總了C++中BKE_report函數的典型用法代碼示例。如果您正苦於以下問題:C++ BKE_report函數的具體用法?C++ BKE_report怎麽用?C++ BKE_report使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了BKE_report函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: objects_add_active_exec
static int objects_add_active_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_context(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
int group_object_index = RNA_enum_get(op->ptr, "group");
int is_cycle = FALSE;
if (ob) {
Group *group = group_object_active_find_index(ob, group_object_index);
/* now add all selected objects from the group */
if (group) {
/* for recursive check */
tag_main_lb(&bmain->group, TRUE);
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
if (group_link_early_exit_check(group, base->object))
continue;
if (base->object->dup_group != group && !check_group_contains_object_recursive(group, base->object)) {
BKE_group_object_add(group, base->object, scene, base);
}
else {
is_cycle = TRUE;
}
}
CTX_DATA_END;
if (is_cycle) {
BKE_report(op->reports, RPT_WARNING, "Skipped some groups because of cycle detected");
}
DAG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
}
return OPERATOR_CANCELLED;
}
示例2: mesh_bisect_invoke
static int mesh_bisect_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
int ret;
if (em->bm->totedgesel == 0) {
BKE_report(op->reports, RPT_ERROR, "Selected edges/faces required");
return OPERATOR_CANCELLED;
}
/* if the properties are set or there is no rv3d,
* skip model and exec immediately */
if ((CTX_wm_region_view3d(C) == NULL) ||
(RNA_struct_property_is_set(op->ptr, "plane_co") &&
RNA_struct_property_is_set(op->ptr, "plane_no")))
{
return mesh_bisect_exec(C, op);
}
ret = WM_gesture_straightline_invoke(C, op, event);
if (ret & OPERATOR_RUNNING_MODAL) {
View3D *v3d = CTX_wm_view3d(C);
wmGesture *gesture = op->customdata;
BisectData *opdata;
opdata = MEM_mallocN(sizeof(BisectData), "inset_operator_data");
opdata->mesh_backup = EDBM_redo_state_store(em);
opdata->is_first = true;
gesture->userdata = opdata;
/* misc other vars */
G.moving = G_TRANSFORM_EDIT;
opdata->twtype = v3d->twtype;
v3d->twtype = 0;
/* initialize modal callout */
ED_area_headerprint(CTX_wm_area(C), IFACE_("LMB: Click and drag to draw cut line"));
}
return ret;
}
示例3: action_layer_prev_exec
static int action_layer_prev_exec(bContext *C, wmOperator *op)
{
AnimData *adt = ED_actedit_animdata_from_context(C);
NlaTrack *act_track;
NlaTrack *nlt;
Scene *scene = CTX_data_scene(C);
float ctime = BKE_scene_frame_get(scene);
/* Sanity Check */
if (adt == NULL) {
BKE_report(op->reports, RPT_ERROR, "Internal Error: Could not find Animation Data/NLA Stack to use");
return OPERATOR_CANCELLED;
}
/* Get active track */
act_track = BKE_nlatrack_find_tweaked(adt);
/* If there is no active track, that means we are using the active action... */
if (act_track) {
/* Active Track - Start from the one below it */
nlt = act_track->prev;
}
else {
/* Active Action - Use the top-most track */
nlt = adt->nla_tracks.last;
}
/* Find previous action and hook it up */
for (; nlt; nlt = nlt->prev) {
NlaStrip *strip = action_layer_get_nlastrip(&nlt->strips, ctime);
if (strip) {
action_layer_switch_strip(adt, act_track, adt->actstrip, nlt, strip);
break;
}
}
/* Update the action that this editor now uses
* NOTE: The calls above have already handled the usercount/animdata side of things
*/
actedit_change_action(C, adt->action);
return OPERATOR_FINISHED;
}
示例4: create_navmesh_exec
static int create_navmesh_exec(bContext *C, wmOperator *op)
{
Scene* scene= CTX_data_scene(C);
LinkNode* obs= NULL;
Base* navmeshBase= NULL;
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
if (base->object->type == OB_MESH) {
if (base->object->body_type==OB_BODY_TYPE_NAVMESH) {
if (!navmeshBase || base == scene->basact) {
navmeshBase= base;
}
}
else {
BLI_linklist_append(&obs, (void*)base->object);
}
}
}
CTX_DATA_END;
if (obs) {
struct recast_polyMesh *pmesh= NULL;
struct recast_polyMeshDetail *dmesh= NULL;
int nverts= 0, ntris= 0;
int *tris= 0;
float *verts= NULL;
createVertsTrisData(C, obs, &nverts, &verts, &ntris, &tris);
BLI_linklist_free(obs, NULL);
buildNavMesh(&scene->gm.recastData, nverts, verts, ntris, tris, &pmesh, &dmesh);
createRepresentation(C, pmesh, dmesh, navmeshBase);
MEM_freeN(verts);
MEM_freeN(tris);
return OPERATOR_FINISHED;
}
else {
BKE_report(op->reports, RPT_ERROR, "No mesh objects found");
return OPERATOR_CANCELLED;
}
}
示例5: EDBM_op_finish
/* returns 0 on error, 1 on success. executes and finishes a bmesh operator */
bool EDBM_op_finish(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const bool do_report)
{
const char *errmsg;
BMO_op_finish(em->bm, bmop);
if (BMO_error_get(em->bm, &errmsg, NULL)) {
BMEditMesh *emcopy = em->emcopy;
if (do_report) {
BKE_report(op->reports, RPT_ERROR, errmsg);
}
EDBM_mesh_free(em);
*em = *emcopy;
MEM_freeN(emcopy);
em->emcopyusers = 0;
em->emcopy = NULL;
/* when copying, tessellation isn't to for faster copying,
* but means we need to re-tessellate here */
if (em->looptris == NULL) {
BKE_editmesh_tessface_calc(em);
}
return false;
}
else {
em->emcopyusers--;
if (em->emcopyusers < 0) {
printf("warning: em->emcopyusers was less than zero.\n");
}
if (em->emcopyusers <= 0) {
BKE_editmesh_free(em->emcopy);
MEM_freeN(em->emcopy);
em->emcopy = NULL;
}
return true;
}
}
示例6: outliner_action_set_exec
static int outliner_action_set_exec(bContext *C, wmOperator *op)
{
SpaceOops *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
bAction *act;
/* check for invalid states */
if (soops == NULL)
return OPERATOR_CANCELLED;
set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
/* get action to use */
act = BLI_findlink(&CTX_data_main(C)->action, RNA_enum_get(op->ptr, "action"));
if (act == NULL) {
BKE_report(op->reports, RPT_ERROR, "No valid action to add");
return OPERATOR_CANCELLED;
}
else if (act->idroot == 0) {
/* hopefully in this case (i.e. library of userless actions), the user knows what they're doing... */
BKE_reportf(op->reports, RPT_WARNING,
"Action '%s' does not specify what datablocks it can be used on "
"(try setting the 'ID Root Type' setting from the Datablocks Editor "
"for this action to avoid future problems)",
act->id.name + 2);
}
/* perform action if valid channel */
if (datalevel == TSE_ANIM_DATA)
outliner_do_id_set_operation(soops, datalevel, &soops->tree, (ID *)act, actionset_id_cb);
else if (idlevel == ID_AC)
outliner_do_id_set_operation(soops, idlevel, &soops->tree, (ID *)act, actionset_id_cb);
else
return OPERATOR_CANCELLED;
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
ED_undo_push(C, "Set action");
/* done */
return OPERATOR_FINISHED;
}
示例7: start_avi
static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports)
{
int x, y;
char name[256];
AviFormat format;
int quality;
double framerate;
(void)scene; /* unused */
filepath_avi(name, rd);
x = rectx;
y = recty;
quality = rd->im_format.quality;
framerate = (double) rd->frs_sec / (double) rd->frs_sec_base;
avi = MEM_mallocN(sizeof(AviMovie), "avimovie");
if (rd->im_format.imtype != R_IMF_IMTYPE_AVIJPEG) format = AVI_FORMAT_AVI_RGB;
else format = AVI_FORMAT_MJPEG;
if (AVI_open_compress(name, avi, 1, format) != AVI_ERROR_NONE) {
BKE_report(reports, RPT_ERROR, "Cannot open or start AVI movie file");
MEM_freeN(avi);
avi = NULL;
return 0;
}
AVI_set_compress_option(avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_WIDTH, &x);
AVI_set_compress_option(avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_HEIGHT, &y);
AVI_set_compress_option(avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_QUALITY, &quality);
AVI_set_compress_option(avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_FRAMERATE, &framerate);
avi->interlace = 0;
avi->odd_fields = 0;
/* avi->interlace = rd->mode & R_FIELDS; */
/* avi->odd_fields = (rd->mode & R_ODDFIELD) ? 1 : 0; */
printf("Created avi: %s\n", name);
return 1;
}
示例8: rna_KeyingSet_paths_clear
static void rna_KeyingSet_paths_clear(KeyingSet *keyingset, ReportList *reports)
{
/* if data is valid, call the API function for this */
if (keyingset) {
KS_Path *ksp, *kspn;
/* free each path as we go to avoid looping twice */
for (ksp = keyingset->paths.first; ksp; ksp = kspn) {
kspn = ksp->next;
BKE_keyingset_free_path(keyingset, ksp);
}
/* reset the active path, since there aren't any left */
keyingset->active_path = 0;
}
else {
BKE_report(reports, RPT_ERROR, "Keying set paths could not be removed");
}
}
示例9: write_video_frame
/* Write a frame to the output file */
static int write_video_frame(RenderData *rd, AVFrame* frame, ReportList *reports)
{
int outsize = 0;
int ret, success= 1;
AVCodecContext* c = video_stream->codec;
frame->pts = rd->cfra - rd->sfra;
if (rd->mode & R_FIELDS) {
frame->top_field_first = ((rd->mode & R_ODDFIELD) != 0);
}
outsize = avcodec_encode_video(c, video_buffer, video_buffersize,
frame);
if (outsize != 0) {
AVPacket packet;
av_init_packet(&packet);
if (c->coded_frame->pts != AV_NOPTS_VALUE) {
packet.pts = av_rescale_q(c->coded_frame->pts,
c->time_base,
video_stream->time_base);
fprintf(stderr, "Video Frame PTS: %d\n", (int)packet.pts);
} else {
fprintf(stderr, "Video Frame PTS: not set\n");
}
if (c->coded_frame->key_frame)
packet.flags |= AV_PKT_FLAG_KEY;
packet.stream_index = video_stream->index;
packet.data = video_buffer;
packet.size = outsize;
ret = av_interleaved_write_frame(outfile, &packet);
} else {
ret = 0;
}
if (ret != 0) {
success= 0;
BKE_report(reports, RPT_ERROR, "Error writing frame.");
}
return success;
}
示例10: knifeproject_exec
static int knifeproject_exec(bContext *C, wmOperator *op)
{
ARegion *ar = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
const bool cut_through = RNA_boolean_get(op->ptr, "cut_through");
LinkNode *polys = NULL;
CTX_DATA_BEGIN (C, Object *, ob, selected_objects)
{
if (ob != obedit) {
polys = knifeproject_poly_from_object(ar, scene, ob, polys);
}
}
CTX_DATA_END;
if (polys) {
EDBM_mesh_knife(C, polys, true, cut_through);
/* select only tagged faces */
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, false);
/* not essential, but switch out of vertex mode since the
* selected regions wont be nicely isolated after flushing.
* note: call after de-select to avoid selection flushing */
EDBM_selectmode_disable(scene, em, SCE_SELECT_VERTEX, SCE_SELECT_EDGE);
BM_mesh_elem_hflag_enable_test(em->bm, BM_FACE, BM_ELEM_SELECT, true, false, BM_ELEM_TAG);
BM_mesh_select_mode_flush(em->bm);
BLI_linklist_freeN(polys);
return OPERATOR_FINISHED;
}
else {
BKE_report(op->reports, RPT_ERROR, "No other selected objects found to use for projection");
return OPERATOR_CANCELLED;
}
}
示例11: ED_object_modifier_move_up
int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md)
{
if(md->prev) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
if(mti->type!=eModifierTypeType_OnlyDeform) {
ModifierTypeInfo *nmti = modifierType_getInfo(md->prev->type);
if(nmti->flags&eModifierTypeFlag_RequiresOriginalData) {
BKE_report(reports, RPT_WARNING, "Cannot move above a modifier requiring original data");
return 0;
}
}
BLI_remlink(&ob->modifiers, md);
BLI_insertlink(&ob->modifiers, md->prev->prev, md);
}
return 1;
}
示例12: BKE_spacetype_from_id
static ARegionType *region_type_find(ReportList *reports, int space_type, int region_type)
{
SpaceType *st;
ARegionType *art;
st = BKE_spacetype_from_id(space_type);
for (art = (st) ? st->regiontypes.first : NULL; art; art = art->next) {
if (art->regionid == region_type)
break;
}
/* region type not found? abort */
if (art == NULL) {
BKE_report(reports, RPT_ERROR, "Region not found in space type");
return NULL;
}
return art;
}
示例13: ED_object_modifier_move_down
int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData *md)
{
if(md->next) {
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
if(mti->flags&eModifierTypeFlag_RequiresOriginalData) {
ModifierTypeInfo *nmti = modifierType_getInfo(md->next->type);
if(nmti->type!=eModifierTypeType_OnlyDeform) {
BKE_report(reports, RPT_WARNING, "Cannot move beyond a non-deforming modifier");
return 0;
}
}
BLI_remlink(&ob->modifiers, md);
BLI_insertlink(&ob->modifiers, md->next, md);
}
return 1;
}
示例14: gp_layer_add_exec
/* add new layer - wrapper around API */
static int gp_layer_add_exec(bContext *C, wmOperator *op)
{
bGPdata **gpd_ptr = gpencil_data_get_pointers(C, NULL);
/* if there's no existing Grease-Pencil data there, add some */
if (gpd_ptr == NULL) {
BKE_report(op->reports, RPT_ERROR, "Nowhere for grease pencil data to go");
return OPERATOR_CANCELLED;
}
if (*gpd_ptr == NULL)
*gpd_ptr = gpencil_data_addnew(DATA_("GPencil"));
/* add new layer now */
gpencil_layer_addnew(*gpd_ptr, DATA_("GP_Layer"), 1);
/* notifiers */
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
示例15: BKE_report
static Base *rna_Object_local_view_property_helper(
bScreen *sc, View3D *v3d, Object *ob, ReportList *reports, Scene **r_scene)
{
if (v3d->localvd == NULL) {
BKE_report(reports, RPT_ERROR, "Viewport not in local view");
return NULL;
}
wmWindow *win = ED_screen_window_find(sc, G_MAIN->wm.first);
ViewLayer *view_layer = WM_window_get_active_view_layer(win);
Base *base = BKE_view_layer_base_find(view_layer, ob);
if (base == NULL) {
BKE_reportf(
reports, RPT_WARNING, "Object %s not in view layer %s", ob->id.name + 2, view_layer->name);
}
if (r_scene) {
*r_scene = win->scene;
}
return base;
}