本文整理汇总了C++中CTX_data_active_object函数的典型用法代码示例。如果您正苦于以下问题:C++ CTX_data_active_object函数的具体用法?C++ CTX_data_active_object怎么用?C++ CTX_data_active_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CTX_data_active_object函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: mask_flood_fill_exec
static int mask_flood_fill_exec(bContext *C, wmOperator *op)
{
ARegion *ar = CTX_wm_region(C);
Object *ob = CTX_data_active_object(C);
PaintMaskFloodMode mode;
float value;
DerivedMesh *dm;
PBVH *pbvh;
PBVHNode **nodes;
int totnode, i;
mode = RNA_enum_get(op->ptr, "mode");
value = RNA_float_get(op->ptr, "value");
dm = mesh_get_derived_final(CTX_data_scene(C), ob, CD_MASK_BAREMESH);
pbvh = dm->getPBVH(ob, dm);
ob->sculpt->pbvh = pbvh;
BLI_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode);
sculpt_undo_push_begin("Mask flood fill");
for (i = 0; i < totnode; i++) {
PBVHVertexIter vi;
sculpt_undo_push_node(ob, nodes[i], SCULPT_UNDO_MASK);
BLI_pbvh_vertex_iter_begin(pbvh, nodes[i], vi, PBVH_ITER_UNIQUE) {
mask_flood_fill_set_elem(vi.mask, mode, value);
} BLI_pbvh_vertex_iter_end;
BLI_pbvh_node_mark_update(nodes[i]);
if (BLI_pbvh_type(pbvh) == PBVH_GRIDS)
multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:35,代码来源:paint_mask.c
示例2: action_new_poll
/* Criteria:
* 1) There must be an dopesheet/action editor, and it must be in a mode which uses actions...
* OR
* The NLA Editor is active (i.e. Animation Data panel -> new action)
* 2) The associated AnimData block must not be in tweakmode
*/
static int action_new_poll(bContext *C)
{
Scene *scene = CTX_data_scene(C);
/* Check tweakmode is off (as you don't want to be tampering with the action in that case) */
/* NOTE: unlike for pushdown, this operator needs to be run when creating an action from nothing... */
if (ED_operator_action_active(C)) {
SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
Object *ob = CTX_data_active_object(C);
/* For now, actions are only for the active object, and on object and shapekey levels... */
if (saction->mode == SACTCONT_ACTION) {
/* XXX: This assumes that actions are assigned to the active object in this mode */
if (ob) {
if ((ob->adt == NULL) || (ob->adt->flag & ADT_NLA_EDIT_ON) == 0)
return true;
}
}
else if (saction->mode == SACTCONT_SHAPEKEY) {
Key *key = BKE_key_from_object(ob);
if (key) {
if ((key->adt == NULL) || (key->adt->flag & ADT_NLA_EDIT_ON) == 0)
return true;
}
}
}
else if (ED_operator_nla_active(C)) {
if (!(scene->flag & SCE_NLA_EDIT_ON)) {
return true;
}
}
/* something failed... */
return false;
}
开发者ID:diekev,项目名称:blender,代码行数:41,代码来源:action_data.c
示例3: fluid_bake_exec
static int fluid_bake_exec(bContext *C, wmOperator *op)
{
if (!fluidsimBake(C, op->reports, CTX_data_active_object(C), false))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:7,代码来源:physics_fluid.c
示例4: pose_select_parent_exec
static int pose_select_parent_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm = (bArmature *)ob->data;
bPoseChannel *pchan, *parent;
/* Determine if there is an active bone */
pchan = CTX_data_active_pose_bone(C);
if (pchan) {
parent = pchan->parent;
if ((parent) && !(parent->bone->flag & (BONE_HIDDEN_P | BONE_UNSELECTABLE))) {
parent->bone->flag |= BONE_SELECTED;
arm->act_bone = parent->bone;
}
else {
return OPERATOR_CANCELLED;
}
}
else {
return OPERATOR_CANCELLED;
}
/* updates */
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
if (arm->flag & ARM_HAS_VIZ_DEPS) {
/* mask modifier ('armature' mode), etc. */
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
return OPERATOR_FINISHED;
}
开发者ID:BlueLabelStudio,项目名称:blender,代码行数:32,代码来源:pose_select.c
示例5: sculpt_undo_restore_hidden
static int sculpt_undo_restore_hidden(bContext *C, DerivedMesh *dm,
SculptUndoNode *unode)
{
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
int i;
if (unode->maxvert) {
MVert *mvert = ss->mvert;
for (i = 0; i < unode->totvert; i++) {
MVert *v = &mvert[unode->index[i]];
int uval = BLI_BITMAP_GET(unode->vert_hidden, i);
BLI_BITMAP_MODIFY(unode->vert_hidden, i,
v->flag & ME_HIDE);
if (uval)
v->flag |= ME_HIDE;
else
v->flag &= ~ME_HIDE;
v->flag |= ME_VERT_PBVH_UPDATE;
}
}
else if (unode->maxgrid && dm->getGridData) {
BLI_bitmap **grid_hidden = dm->getGridHidden(dm);
for (i = 0; i < unode->totgrid; i++) {
SWAP(BLI_bitmap *,
unode->grid_hidden[i],
grid_hidden[unode->grids[i]]);
}
}
开发者ID:BlueLabelStudio,项目名称:blender,代码行数:34,代码来源:sculpt_undo.c
示例6: paint_curve_poll
bool paint_curve_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
Paint *p;
RegionView3D *rv3d = CTX_wm_region_view3d(C);
SpaceImage *sima;
if (rv3d && !(ob && ((ob->mode & OB_MODE_ALL_PAINT) != 0))) {
return false;
}
sima = CTX_wm_space_image(C);
if (sima && sima->mode != SI_MODE_PAINT) {
return false;
}
p = BKE_paint_get_active_from_context(C);
if (p && p->brush && (p->brush->flag & BRUSH_CURVE)) {
return true;
}
return false;
}
开发者ID:dfelinto,项目名称:blender,代码行数:25,代码来源:paint_curve.c
示例7: pose_calculate_paths_exec
/* For the object with pose/action: create path curves for selected bones
* This recalculates the WHOLE path within the pchan->pathsf and pchan->pathef range
*/
static int pose_calculate_paths_exec(bContext *C, wmOperator *op)
{
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
Scene *scene = CTX_data_scene(C);
if (ELEM(NULL, ob, ob->pose))
return OPERATOR_CANCELLED;
/* grab baking settings from operator settings */
{
bAnimVizSettings *avs = &ob->pose->avs;
PointerRNA avs_ptr;
avs->path_sf = RNA_int_get(op->ptr, "start_frame");
avs->path_ef = RNA_int_get(op->ptr, "end_frame");
RNA_pointer_create(NULL, &RNA_AnimVizMotionPaths, avs, &avs_ptr);
RNA_enum_set(&avs_ptr, "bake_location", RNA_enum_get(op->ptr, "bake_location"));
}
/* set up path data for bones being calculated */
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones)
{
/* verify makes sure that the selected bone has a bone with the appropriate settings */
animviz_verify_motionpaths(op->reports, scene, ob, pchan);
}
开发者ID:Moguri,项目名称:blender,代码行数:29,代码来源:pose_edit.c
示例8: face_select_reveal_exec
static int face_select_reveal_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = CTX_data_active_object(C);
paintface_reveal(ob);
ED_region_tag_redraw(CTX_wm_region(C));
return OPERATOR_FINISHED;
}
开发者ID:sftd,项目名称:blender,代码行数:7,代码来源:paint_utils.c
示例9: paint_select_linked_pick_invoke
static int paint_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
int mode= RNA_boolean_get(op->ptr, "extend") ? 1:0;
select_linked_tfaces(C, CTX_data_active_object(C), event->mval, mode);
ED_region_tag_redraw(CTX_wm_region(C));
return OPERATOR_FINISHED;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:7,代码来源:paint_utils.c
示例10: ED_preview_shader_job
void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, MTex *slot, int sizex, int sizey, int method)
{
Object *ob= CTX_data_active_object(C);
wmJob *steve;
ShaderPreview *sp;
steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Shader Preview", WM_JOB_EXCL_RENDER);
sp= MEM_callocN(sizeof(ShaderPreview), "shader preview");
/* customdata for preview thread */
sp->scene= CTX_data_scene(C);
sp->owner= owner;
sp->sizex= sizex;
sp->sizey= sizey;
sp->pr_method= method;
sp->id = id;
sp->parent= parent;
sp->slot= slot;
if(ob && ob->totcol) copy_v4_v4(sp->col, ob->col);
else sp->col[0]= sp->col[1]= sp->col[2]= sp->col[3]= 1.0f;
/* setup job */
WM_jobs_customdata(steve, sp, shader_preview_free);
WM_jobs_timer(steve, 0.1, NC_MATERIAL, NC_MATERIAL);
WM_jobs_callbacks(steve, common_preview_startjob, NULL, shader_preview_updatejob, NULL);
WM_jobs_start(CTX_wm_manager(C), steve);
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:28,代码来源:render_preview.c
示例11: vert_select_all_exec
static int vert_select_all_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_active_object(C);
paintvert_deselect_all_visible(ob, RNA_enum_get(op->ptr, "action"), true);
ED_region_tag_redraw(CTX_wm_region(C));
return OPERATOR_FINISHED;
}
开发者ID:sftd,项目名称:blender,代码行数:7,代码来源:paint_utils.c
示例12: keyingset_context_ok_poll
/* Check if context data is suitable for the given absolute Keying Set */
short keyingset_context_ok_poll (bContext *C, KeyingSet *ks)
{
ScrArea *sa= CTX_wm_area(C);
/* data retrieved from context depends on active editor */
if (sa == NULL) return 0;
switch (sa->spacetype) {
case SPACE_VIEW3D:
{
Object *obact= CTX_data_active_object(C);
/* if in posemode, check if 'pose-channels' requested for in KeyingSet */
if ((obact && obact->pose) && (obact->mode & OB_MODE_POSE)) {
/* check for posechannels */
}
else {
/* check for selected object */
}
}
break;
}
return 1;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:29,代码来源:keyingsets.c
示例13: time_draw_keyframes
/* draw keyframe lines for timeline */
static void time_draw_keyframes(const bContext *C, ARegion *ar)
{
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
View2D *v2d = &ar->v2d;
bool onlysel = ((scene->flag & SCE_KEYS_NO_SELONLY) == 0);
/* set this for all keyframe lines once and for all */
glLineWidth(1.0);
/* draw grease pencil keyframes (if available) */
UI_ThemeColor(TH_TIME_GP_KEYFRAME);
if (scene->gpd) {
time_draw_idblock_keyframes(v2d, (ID *)scene->gpd, onlysel);
}
if (ob && ob->gpd) {
time_draw_idblock_keyframes(v2d, (ID *)ob->gpd, onlysel);
}
/* draw scene keyframes first
* - don't try to do this when only drawing active/selected data keyframes,
* since this can become quite slow
*/
if (onlysel == 0) {
/* set draw color */
UI_ThemeColorShade(TH_TIME_KEYFRAME, -50);
time_draw_idblock_keyframes(v2d, (ID *)scene, onlysel);
}
/* draw keyframes from selected objects
* - only do the active object if in posemode (i.e. showing only keyframes for the bones)
* OR the onlysel flag was set, which means that only active object's keyframes should
* be considered
*/
UI_ThemeColor(TH_TIME_KEYFRAME);
if (ob && ((ob->mode == OB_MODE_POSE) || onlysel)) {
/* draw keyframes for active object only */
time_draw_idblock_keyframes(v2d, (ID *)ob, onlysel);
}
else {
bool active_done = false;
/* draw keyframes from all selected objects */
CTX_DATA_BEGIN (C, Object *, obsel, selected_objects)
{
/* last arg is 0, since onlysel doesn't apply here... */
time_draw_idblock_keyframes(v2d, (ID *)obsel, 0);
/* if this object is the active one, set flag so that we don't draw again */
if (obsel == ob)
active_done = true;
}
CTX_DATA_END;
/* if active object hasn't been done yet, draw it... */
if (ob && (active_done == 0))
time_draw_idblock_keyframes(v2d, (ID *)ob, 0);
}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:60,代码来源:space_time.c
示例14: face_select_hide_exec
static int face_select_hide_exec(bContext *C, wmOperator *op)
{
const bool unselected = RNA_boolean_get(op->ptr, "unselected");
Object *ob = CTX_data_active_object(C);
paintface_hide(ob, unselected);
ED_region_tag_redraw(CTX_wm_region(C));
return OPERATOR_FINISHED;
}
开发者ID:sftd,项目名称:blender,代码行数:8,代码来源:paint_utils.c
示例15: paint_select_linked_pick_invoke
static int paint_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
const bool select = !RNA_boolean_get(op->ptr, "deselect");
view3d_operator_needs_opengl(C);
paintface_select_linked(C, CTX_data_active_object(C), event->mval, select);
ED_region_tag_redraw(CTX_wm_region(C));
return OPERATOR_FINISHED;
}
开发者ID:sftd,项目名称:blender,代码行数:8,代码来源:paint_utils.c
示例16: make_regular_poll
static int make_regular_poll(bContext *C)
{
Object *ob;
if (ED_operator_editlattice(C)) return 1;
ob = CTX_data_active_object(C);
return (ob && ob->type == OB_LATTICE);
}
开发者ID:pawkoz,项目名称:dyplom,代码行数:9,代码来源:object_lattice.c
示例17: CTX_wm_area
/* Temporary wrapper for driver operators for buttons to make it easier to create
* such drivers by rerouting all paths through the active object instead so that
* they will get picked up by the dependency system.
*
* < C: context pointer - for getting active data
* <> ptr: RNA pointer for property's datablock. May be modified as result of path remapping.
* < prop: RNA definition of property to add for
*
* > returns: MEM_alloc'd string representing the path to the property from the given PointerRNA
*/
static char *get_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
{
ID *id = (ID *)ptr->id.data;
ScrArea *sa = CTX_wm_area(C);
/* get standard path which may be extended */
char *basepath = RNA_path_from_ID_to_property(ptr, prop);
char *path = basepath; /* in case no remapping is needed */
/* Remapping will only be performed in the Properties Editor, as only this
* restricts the subspace of options to the 'active' data (a manageable state)
*/
// TODO: watch out for pinned context?
if ((sa) && (sa->spacetype == SPACE_BUTS)) {
Object *ob = CTX_data_active_object(C);
if (ob && id) {
/* only id-types which can be remapped to go through objects should be considered */
switch (GS(id->name)) {
case ID_TE: /* textures */
{
Material *ma = give_current_material(ob, ob->actcol);
Tex *tex = give_current_material_texture(ma);
/* assumes: texture will only be shown if it is active material's active texture it's ok */
if ((ID *)tex == id) {
char name_esc_ma[(sizeof(ma->id.name) - 2) * 2];
char name_esc_tex[(sizeof(tex->id.name) - 2) * 2];
BLI_strescape(name_esc_ma, ma->id.name + 2, sizeof(name_esc_ma));
BLI_strescape(name_esc_tex, tex->id.name + 2, sizeof(name_esc_tex));
/* create new path */
// TODO: use RNA path functions to construct step by step instead?
// FIXME: maybe this isn't even needed anymore...
path = BLI_sprintfN("material_slots[\"%s\"].material.texture_slots[\"%s\"].texture.%s",
name_esc_ma, name_esc_tex, basepath);
/* free old one */
MEM_freeN(basepath);
}
break;
}
}
/* fix RNA pointer, as we've now changed the ID root by changing the paths */
if (basepath != path) {
/* rebase provided pointer so that it starts from object... */
RNA_pointer_create(&ob->id, ptr->type, ptr->data, ptr);
}
}
}
/* the path should now have been corrected for use */
return path;
}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:67,代码来源:drivers.c
示例18: ED_operator_rigidbody_con_active_poll
static int ED_operator_rigidbody_con_active_poll(bContext *C)
{
if (ED_operator_object_active_editable(C)) {
Object *ob = CTX_data_active_object(C);
return (ob && ob->rigidbody_constraint);
}
else
return 0;
}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:9,代码来源:rigidbody_constraint.c
示例19: fluid_bake_exec
static int fluid_bake_exec(bContext *C, wmOperator *op)
{
Object *ob= CTX_data_active_object(C);
// XXX TODO redraw, escape, non-blocking, ..
if(!fluidsimBake(C, op->reports, ob))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:10,代码来源:physics_fluid.c
示例20: vertex_color_set_exec
static int vertex_color_set_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
Object *obact = CTX_data_active_object(C);
unsigned int paintcol = vpaint_get_current_col(scene->toolsettings->vpaint);
vpaint_fill(obact, paintcol);
ED_region_tag_redraw(CTX_wm_region(C)); // XXX - should redraw all 3D views
return OPERATOR_FINISHED;
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:10,代码来源:paint_ops.c
注:本文中的CTX_data_active_object函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论