本文整理汇总了C++中RNA_enum_get函数的典型用法代码示例。如果您正苦于以下问题:C++ RNA_enum_get函数的具体用法?C++ RNA_enum_get怎么用?C++ RNA_enum_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RNA_enum_get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: edbm_bevel_calc
static bool edbm_bevel_calc(wmOperator *op)
{
BevelData *opdata = op->customdata;
BMEditMesh *em = opdata->em;
BMOperator bmop;
const float offset = RNA_float_get(op->ptr, "offset");
const int offset_type = RNA_enum_get(op->ptr, "offset_type");
const int segments = RNA_int_get(op->ptr, "segments");
const bool vertex_only = RNA_boolean_get(op->ptr, "vertex_only");
/* revert to original mesh */
if (opdata->is_modal) {
EDBM_redo_state_restore(opdata->mesh_backup, em, false);
}
EDBM_op_init(em, &bmop, op,
"bevel geom=%hev offset=%f segments=%i vertex_only=%b offset_type=%i",
BM_ELEM_SELECT, offset, segments, vertex_only, offset_type);
BMO_op_exec(em->bm, &bmop);
if (offset != 0.0f) {
/* not essential, but we may have some loose geometry that
* won't get bevel'd and better not leave it selected */
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true);
}
/* no need to de-select existing geometry */
if (!EDBM_op_finish(em, &bmop, op, true))
return false;
EDBM_mesh_normals_update(opdata->em);
EDBM_update_generic(opdata->em, true, true);
return true;
}
开发者ID:silkentrance,项目名称:blender,代码行数:38,代码来源:editmesh_bevel.c
示例2: gpencil_select_all_exec
static int gpencil_select_all_exec(bContext *C, wmOperator *op)
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
int action = RNA_enum_get(op->ptr, "action");
if (gpd == NULL) {
BKE_report(op->reports, RPT_ERROR, "No Grease Pencil data");
return OPERATOR_CANCELLED;
}
/* for "toggle", test for existing selected strokes */
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
CTX_DATA_BEGIN(C, bGPDstroke *, gps, editable_gpencil_strokes)
{
if (gps->flag & GP_STROKE_SELECT) {
action = SEL_DESELECT;
break; // XXX: this only gets out of the inner loop...
}
}
CTX_DATA_END;
}
开发者ID:flair2005,项目名称:mechanical-blender,代码行数:23,代码来源:gpencil_select.c
示例3: rigidbody_object_add_exec
static int rigidbody_object_add_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_active_context(C);
int type = RNA_enum_get(op->ptr, "type");
bool changed;
/* apply to active object */
changed = ED_rigidbody_object_add(bmain, scene, ob, type, op->reports);
if (changed) {
/* send updates */
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, NULL);
/* done */
return OPERATOR_FINISHED;
}
else {
return OPERATOR_CANCELLED;
}
}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:23,代码来源:rigidbody_object.c
示例4: unpack_item_exec
static int unpack_item_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
ID *id;
char idname[MAX_ID_NAME - 2];
int type = RNA_int_get(op->ptr, "id_type");
int method = RNA_enum_get(op->ptr, "method");
RNA_string_get(op->ptr, "id_name", idname);
id = BKE_libblock_find_name(type, idname);
if (id == NULL) {
BKE_report(op->reports, RPT_WARNING, "No packed file");
return OPERATOR_CANCELLED;
}
if (method != PF_KEEP)
BKE_unpack_id(bmain, id, op->reports, method); /* XXX PF_ASK can't work here */
G.fileflags &= ~G_AUTOPACK;
return OPERATOR_FINISHED;
}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:23,代码来源:info_ops.c
示例5: actkeys_mirror_exec
static int actkeys_mirror_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
short mode;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
/* get mirroring mode */
mode= RNA_enum_get(op->ptr, "type");
/* mirror keyframes */
mirror_action_keys(&ac, mode);
/* validate keyframes after editing */
ANIM_editkeyframes_refresh(&ac);
/* set notifier that keyframes have changed */
WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:23,代码来源:action_edit.c
示例6: pose_calculate_paths_invoke
/* show popup to determine settings */
static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
if (ELEM(NULL, ob, ob->pose))
return OPERATOR_CANCELLED;
/* set default settings from existing/stored settings */
{
bAnimVizSettings *avs = &ob->pose->avs;
PointerRNA avs_ptr;
RNA_int_set(op->ptr, "start_frame", avs->path_sf);
RNA_int_set(op->ptr, "end_frame", avs->path_ef);
RNA_pointer_create(NULL, &RNA_AnimVizMotionPaths, avs, &avs_ptr);
RNA_enum_set(op->ptr, "bake_location", RNA_enum_get(&avs_ptr, "bake_location"));
}
/* show popup dialog to allow editing of range... */
// FIXME: hardcoded dimensions here are just arbitrary
return WM_operator_props_dialog_popup(C, op, 10 * UI_UNIT_X, 10 * UI_UNIT_Y);
}
开发者ID:Moguri,项目名称:blender,代码行数:24,代码来源:pose_edit.c
示例7: sensor_add_exec
static int sensor_add_exec(bContext *C, wmOperator *op)
{
Object *ob;
bSensor *sens;
PointerRNA sens_ptr;
PropertyRNA *prop;
const char *sens_name;
char name[MAX_NAME];
int type = RNA_enum_get(op->ptr, "type");
ob = edit_object_property_get(C, op);
if (!ob)
return OPERATOR_CANCELLED;
sens = new_sensor(type);
BLI_addtail(&(ob->sensors), sens);
/* set the sensor name based on rna type enum */
RNA_pointer_create((ID *)ob, &RNA_Sensor, sens, &sens_ptr);
prop = RNA_struct_find_property(&sens_ptr, "type");
RNA_string_get(op->ptr, "name", name);
if (*name) {
BLI_strncpy(sens->name, name, sizeof(sens->name));
}
else {
RNA_property_enum_name(C, &sens_ptr, prop, RNA_property_enum_get(&sens_ptr, prop), &sens_name);
BLI_strncpy(sens->name, sens_name, sizeof(sens->name));
}
BLI_uniquename(&ob->sensors, sens, DATA_("Sensor"), '.', offsetof(bSensor, name), sizeof(sens->name));
ob->scaflag |= OB_SHOWSENS;
WM_event_add_notifier(C, NC_LOGIC, NULL);
return OPERATOR_FINISHED;
}
开发者ID:diekev,项目名称:blender,代码行数:37,代码来源:logic_ops.c
示例8: actuator_add_exec
static int actuator_add_exec(bContext *C, wmOperator *op)
{
Object *ob;
bActuator *act;
PointerRNA act_ptr;
PropertyRNA *prop;
const char *act_name;
char name[MAX_NAME];
int type = RNA_enum_get(op->ptr, "type");
ob = edit_object_property_get(C, op);
if (!ob)
return OPERATOR_CANCELLED;
act = new_actuator(type);
BLI_addtail(&(ob->actuators), act);
/* set the actuator name based on rna type enum */
RNA_pointer_create((ID *)ob, &RNA_Actuator, act, &act_ptr);
prop = RNA_struct_find_property(&act_ptr, "type");
RNA_string_get(op->ptr, "name", name);
if (*name) {
BLI_strncpy(act->name, name, sizeof(act->name));
}
else {
RNA_property_enum_name(C, &act_ptr, prop, RNA_property_enum_get(&act_ptr, prop), &act_name);
BLI_strncpy(act->name, act_name, sizeof(act->name));
}
make_unique_prop_names(C, act->name);
ob->scaflag |= OB_SHOWACT;
WM_event_add_notifier(C, NC_LOGIC, NULL);
return OPERATOR_FINISHED;
}
开发者ID:244xiao,项目名称:blender,代码行数:37,代码来源:logic_ops.c
示例9: outliner_group_operation_exec
static int outliner_group_operation_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
SpaceOops *soops = CTX_wm_space_outliner(C);
int event;
/* check for invalid states */
if (soops == NULL)
return OPERATOR_CANCELLED;
event = RNA_enum_get(op->ptr, "type");
switch (event) {
case 0: outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_group_cb); break;
case 1: outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb); break;
case 2: outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_linkobs2scene_cb); break;
case 3: outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_instance_cb); break;
case 4: outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_visibility_cb); break;
case 5: outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_selectability_cb); break;
case 6: outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_renderability_cb); break;
case 7: outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb); break;
default:
BLI_assert(0);
return OPERATOR_CANCELLED;
}
if (event == 3) { /* instance */
/* works without this except if you try render right after, see: 22027 */
DAG_relations_tag_update(CTX_data_main(C));
}
ED_undo_push(C, prop_group_op_types[event].name);
WM_event_add_notifier(C, NC_GROUP, NULL);
return OPERATOR_FINISHED;
}
开发者ID:244xiao,项目名称:blender,代码行数:37,代码来源:outliner_tools.c
示例10: mball_select_all_exec
/* Select or deselect all MetaElements */
static int mball_select_all_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
MetaBall *mb = (MetaBall *)obedit->data;
MetaElem *ml;
int action = RNA_enum_get(op->ptr, "action");
if (mb->editelems->first == NULL)
return OPERATOR_CANCELLED;
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
for (ml = mb->editelems->first; ml; ml = ml->next) {
if (ml->flag & SELECT) {
action = SEL_DESELECT;
break;
}
}
}
switch (action) {
case SEL_SELECT:
BKE_mball_select_all(mb);
break;
case SEL_DESELECT:
BKE_mball_deselect_all(mb);
break;
case SEL_INVERT:
BKE_mball_select_swap(mb);
break;
}
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, mb);
return OPERATOR_FINISHED;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:37,代码来源:mball_edit.c
示例11: actkeys_mirror_exec
static int actkeys_mirror_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
short mode;
/* get editor data */
if (ANIM_animdata_get_context(C, &ac) == 0)
return OPERATOR_CANCELLED;
/* XXX... */
if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK))
return OPERATOR_PASS_THROUGH;
/* get mirroring mode */
mode = RNA_enum_get(op->ptr, "type");
/* mirror keyframes */
mirror_action_keys(&ac, mode);
/* set notifier that keyframes have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
开发者ID:pawkoz,项目名称:dyplom,代码行数:24,代码来源:action_edit.c
示例12: RNA_enum_get
/* Note: DT_layers_select_dst_items enum is from rna_modifier.c */
static EnumPropertyItem *dt_layers_select_dst_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
EnumPropertyItem *item = NULL;
int totitem = 0;
const int layers_select_src = RNA_enum_get(ptr, "layers_select_src");
if (!C) { /* needed for docs and i18n tools */
return DT_layers_select_dst_items;
}
if (layers_select_src == DT_LAYERS_ACTIVE_SRC || layers_select_src >= 0) {
RNA_enum_items_add_value(&item, &totitem, DT_layers_select_dst_items, DT_LAYERS_ACTIVE_DST);
}
RNA_enum_items_add_value(&item, &totitem, DT_layers_select_dst_items, DT_LAYERS_NAME_DST);
RNA_enum_items_add_value(&item, &totitem, DT_layers_select_dst_items, DT_LAYERS_INDEX_DST);
/* No 'specific' to-layers here, since we may transfer to several objects at once! */
RNA_enum_item_end(&item, &totitem);
*r_free = true;
return item;
}
开发者ID:sntulix,项目名称:blender-api-javascript,代码行数:25,代码来源:object_data_transfer.c
示例13: outliner_id_operation_exec
static int outliner_id_operation_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
SpaceOops *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutlinerIdOpTypes event;
/* check for invalid states */
if (soops == NULL)
return OPERATOR_CANCELLED;
set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
event = RNA_enum_get(op->ptr, "type");
switch (event) {
case OUTLINER_IDOP_UNLINK:
{
/* unlink datablock from its parent */
switch (idlevel) {
case ID_AC:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_action_cb);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
ED_undo_push(C, "Unlink action");
break;
case ID_MA:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_material_cb);
WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, NULL);
ED_undo_push(C, "Unlink material");
break;
case ID_TE:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_texture_cb);
WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, NULL);
ED_undo_push(C, "Unlink texture");
break;
case ID_WO:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_world_cb);
WM_event_add_notifier(C, NC_SCENE | ND_WORLD, NULL);
ED_undo_push(C, "Unlink world");
break;
default:
BKE_report(op->reports, RPT_WARNING, "Not yet implemented");
break;
}
}
break;
case OUTLINER_IDOP_LOCAL:
{
/* make local */
outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb);
ED_undo_push(C, "Localized Data");
}
break;
case OUTLINER_IDOP_SINGLE:
{
/* make single user */
switch (idlevel) {
case ID_AC:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, singleuser_action_cb);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
ED_undo_push(C, "Single-User Action");
break;
case ID_WO:
outliner_do_libdata_operation(C, scene, soops, &soops->tree, singleuser_world_cb);
WM_event_add_notifier(C, NC_SCENE | ND_WORLD, NULL);
ED_undo_push(C, "Single-User World");
break;
default:
BKE_report(op->reports, RPT_WARNING, "Not yet implemented");
break;
}
}
break;
case OUTLINER_IDOP_FAKE_ADD:
{
/* set fake user */
outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_fake_user_set_cb);
WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
ED_undo_push(C, "Add Fake User");
}
break;
case OUTLINER_IDOP_FAKE_CLEAR:
{
/* clear fake user */
outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_fake_user_clear_cb);
WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
//.........这里部分代码省略.........
开发者ID:244xiao,项目名称:blender,代码行数:101,代码来源:outliner_tools.c
示例14: outliner_object_operation_exec
static int outliner_object_operation_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
SpaceOops *soops = CTX_wm_space_outliner(C);
int event;
const char *str = NULL;
/* check for invalid states */
if (soops == NULL)
return OPERATOR_CANCELLED;
event = RNA_enum_get(op->ptr, "type");
if (event == OL_OP_SELECT) {
Scene *sce = scene; // to be able to delete, scenes are set...
outliner_do_object_operation(C, scene, soops, &soops->tree, object_select_cb);
if (scene != sce) {
ED_screen_set_scene(C, CTX_wm_screen(C), sce);
}
str = "Select Objects";
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
else if (event == OL_OP_SELECT_HIERARCHY) {
Scene *sce = scene; // to be able to delete, scenes are set...
outliner_do_object_operation(C, scene, soops, &soops->tree, object_select_hierarchy_cb);
if (scene != sce) {
ED_screen_set_scene(C, CTX_wm_screen(C), sce);
}
str = "Select Object Hierarchy";
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
else if (event == OL_OP_DESELECT) {
outliner_do_object_operation(C, scene, soops, &soops->tree, object_deselect_cb);
str = "Deselect Objects";
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
else if (event == OL_OP_DELETE) {
outliner_do_object_operation(C, scene, soops, &soops->tree, object_delete_cb);
/* XXX: tree management normally happens from draw_outliner(), but when
* you're clicking to fast on Delete object from context menu in
* outliner several mouse events can be handled in one cycle without
* handling notifiers/redraw which leads to deleting the same object twice.
* cleanup tree here to prevent such cases. */
outliner_cleanup_tree(soops);
DAG_relations_tag_update(bmain);
str = "Delete Objects";
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
}
else if (event == OL_OP_LOCALIZED) { /* disabled, see above enum (ton) */
outliner_do_object_operation(C, scene, soops, &soops->tree, id_local_cb);
str = "Localized Objects";
}
else if (event == OL_OP_TOGVIS) {
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_visibility_cb);
str = "Toggle Visibility";
WM_event_add_notifier(C, NC_SCENE | ND_OB_VISIBLE, scene);
}
else if (event == OL_OP_TOGSEL) {
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_selectability_cb);
str = "Toggle Selectability";
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
else if (event == OL_OP_TOGREN) {
outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_renderability_cb);
str = "Toggle Renderability";
WM_event_add_notifier(C, NC_SCENE | ND_OB_RENDER, scene);
}
else if (event == OL_OP_RENAME) {
outliner_do_object_operation(C, scene, soops, &soops->tree, item_rename_cb);
str = "Rename Object";
}
ED_undo_push(C, str);
return OPERATOR_FINISHED;
}
开发者ID:244xiao,项目名称:blender,代码行数:80,代码来源:outliner_tools.c
示例15: outliner_data_operation_exec
static int outliner_data_operation_exec(bContext *C, wmOperator *op)
{
SpaceOops *soops = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
int event;
/* check for invalid states */
if (soops == NULL)
return OPERATOR_CANCELLED;
event = RNA_enum_get(op->ptr, "type");
set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
if (event <= 0)
return OPERATOR_CANCELLED;
switch (datalevel) {
case TSE_POSE_CHANNEL:
{
outliner_do_data_operation(soops, datalevel, event, &soops->tree, pchan_cb, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
ED_undo_push(C, "PoseChannel operation");
}
break;
case TSE_BONE:
{
outliner_do_data_operation(soops, datalevel, event, &soops->tree, bone_cb, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
ED_undo_push(C, "Bone operation");
}
break;
case TSE_EBONE:
{
outliner_do_data_operation(soops, datalevel, event, &soops->tree, ebone_cb, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
ED_undo_push(C, "EditBone operation");
}
break;
case TSE_SEQUENCE:
{
Scene *scene = CTX_data_scene(C);
outliner_do_data_operation(soops, datalevel, event, &soops->tree, sequence_cb, scene);
}
break;
case TSE_RNA_STRUCT:
if (event == 5) {
outliner_do_data_operation(soops, datalevel, event, &soops->tree, data_select_linked_cb, C);
}
break;
default:
BKE_report(op->reports, RPT_WARNING, "Not yet implemented");
break;
}
return OPERATOR_FINISHED;
}
开发者ID:244xiao,项目名称:blender,代码行数:61,代码来源:outliner_tools.c
示例16: data_transfer_draw_check_prop
/* Used by both OBJECT_OT_data_transfer and OBJECT_OT_datalayout_transfer */
static bool data_transfer_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
{
PropertyRNA *prop_other;
const char *prop_id = RNA_property_identifier(prop);
const int data_type = RNA_enum_get(ptr, "data_type");
bool use_auto_transform = false;
bool use_max_distance = false;
bool use_modifier = false;
if ((prop_other = RNA_struct_find_property(ptr, "use_auto_transform"))) {
use_auto_transform = RNA_property_boolean_get(ptr, prop_other);
}
if ((prop_other = RNA_struct_find_property(ptr, "use_max_distance"))) {
use_max_distance = RNA_property_boolean_get(ptr, prop_other);
}
if ((prop_other = RNA_struct_find_property(ptr, "modifier"))) {
use_modifier = RNA_property_is_set(ptr, prop_other);
}
if (STREQ(prop_id, "modifier")) {
return use_modifier;
}
if (use_modifier) {
/* Hide everything but 'modifier' property, if set. */
return false;
}
if (STREQ(prop_id, "use_object_transform") && use_auto_transform) {
return false;
}
if (STREQ(prop_id, "max_distance") && !use_max_distance) {
return false;
}
if (STREQ(prop_id, "islands_precision") && !DT_DATATYPE_IS_LOOP(data_type)) {
return false;
}
if (STREQ(prop_id, "vert_mapping") && !DT_DATATYPE_IS_VERT(data_type)) {
return false;
}
if (STREQ(prop_id, "edge_mapping") && !DT_DATATYPE_IS_EDGE(data_type)) {
return false;
}
if (STREQ(prop_id, "loop_mapping") && !DT_DATATYPE_IS_LOOP(data_type)) {
return false;
}
if (STREQ(prop_id, "poly_mapping") && !DT_DATATYPE_IS_POLY(data_type)) {
return false;
}
if ((STREQ(prop_id, "layers_select_src") || STREQ(prop_id, "layers_select_dst")) &&
!DT_DATATYPE_IS_MULTILAYERS(data_type))
{
return false;
}
/* Else, show it! */
return true;
}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:62,代码来源:object_data_transfer.c
示例17: blender_camera_init
void BlenderSync::sync_camera(BL::RenderSettings& b_render,
BL::Object& b_override,
int width, int height)
{
BlenderCamera bcam;
blender_camera_init(&bcam, b_render);
/* pixel aspect */
bcam.pixelaspect.x = b_render.pixel_aspect_x();
bcam.pixelaspect.y = b_render.pixel_aspect_y();
bcam.shuttertime = b_render.motion_blur_shutter();
BL::CurveMapping b_shutter_curve(b_render.motion_blur_shutter_curve());
curvemapping_to_array(b_shutter_curve, bcam.shutter_curve, RAMP_TABLE_SIZE);
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
switch(RNA_enum_get(&cscene, "motion_blur_position")) {
case 0:
bcam.motion_position = Camera::MOTION_POSITION_START;
break;
case 1:
bcam.motion_position = Camera::MOTION_POSITION_CENTER;
break;
case 2:
bcam.motion_position = Camera::MOTION_POSITION_END;
break;
default:
bcam.motion_position = Camera::MOTION_POSITION_CENTER;
break;
}
switch(RNA_enum_get(&cscene, "rolling_shutter_type")) {
case 0:
bcam.rolling_shutter_type = Camera::ROLLING_SHUTTER_NONE;
break;
case 1:
bcam.rolling_shutter_type = Camera::ROLLING_SHUTTER_TOP;
break;
default:
bcam.rolling_shutter_type = Camera::ROLLING_SHUTTER_NONE;
break;
}
bcam.rolling_shutter_duration = RNA_float_get(&cscene, "rolling_shutter_duration");
/* border */
if(b_render.use_border()) {
bcam.border.left = b_render.border_min_x();
bcam.border.right = b_render.border_max_x();
bcam.border.bottom = b_render.border_min_y();
bcam.border.top = b_render.border_max_y();
}
/* camera object */
BL::Object b_ob = b_scene.camera();
if(b_override)
b_ob = b_override;
if(b_ob) {
BL::Array<float, 16> b_ob_matrix;
blender_camera_from_object(&bcam, b_engine, b_ob);
b_engine.camera_model_matrix(b_ob, b_ob_matrix);
bcam.matrix = get_transform(b_ob_matrix);
}
/* sync */
Camera *cam = scene->camera;
blender_camera_sync(cam, &bcam, width, height);
}
开发者ID:ChunHungLiu,项目名称:blender,代码行数:69,代码来源:blender_camera.cpp
示例18: pose_select_hierarchy_exec
static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
{
Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C));
bArmature *arm = ob->data;
Bone *curbone, *pabone, *chbone;
int direction = RNA_enum_get(op->ptr, "direction");
const bool add_to_sel = RNA_boolean_get(op->ptr, "extend");
bool found = false;
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones)
{
curbone = pchan->bone;
if ((curbone->flag & BONE_UNSELECTABLE) == 0) {
if (curbone == arm->act_bone) {
if (direction == BONE_SELECT_PARENT) {
if (pchan->parent == NULL) continue;
else pabone = pchan->parent->bone;
if (PBONE_SELECTABLE(arm, pabone)) {
if (!add_to_sel) curbone->flag &= ~BONE_SELECTED;
pabone->flag |= BONE_SELECTED;
arm->act_bone = pabone;
found = 1;
break;
}
}
else { /* direction == BONE_SELECT_CHILD */
/* the child member is only assigned to connected bones, see [#30340] */
#if 0
if (pchan->child == NULL) continue;
else chbone = pchan->child->bone;
#else
/* instead. find _any_ visible child bone, using the first one is a little arbitrary - campbell */
chbone = pchan->child ? pchan->child->bone : NULL;
if (chbone == NULL) {
bPoseChannel *pchan_child;
for (pchan_child = ob->pose->chanbase.first; pchan_child; pchan_child = pchan_child->next) {
/* possible we have multiple children, some invisible */
if (PBONE_SELECTABLE(arm, pchan_child->bone)) {
if (pchan_child->parent == pchan) {
chbone = pchan_child->bone;
break;
}
}
}
}
if (chbone == NULL) continue;
#endif
if (PBONE_SELECTABLE(arm, chbone)) {
if (!add_to_sel) curbone->flag &= ~BONE_SELECTED;
chbone->flag |= BONE_SELECTED;
arm->act_bone = chbone;
found = 1;
break;
}
}
}
}
}
开发者ID:BlueLabelStudio,项目名称:blender,代码行数:65,代码来源:pose_select.c
示例19: wm_collada_export_exec
/* function used for WM_OT_save_mainfile too */
static int wm_collada_export_exec(bContext *C, wmOperator *op)
{
char filepath[FILE_MAX];
int apply_modifiers;
int export_mesh_type;
int selected;
int include_children;
int include_armatures;
int include_shapekeys;
int deform_bones_only;
int include_uv_textures;
int include_material_textures;
int use_texture_copies;
int active_uv_only;
int triangulate;
int use_object_instantiation;
int sort_by_name;
int export_transformation_type;
int open_sim;
int export_count;
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
BKE_report(op->reports, RPT_ERROR, "No filename given");
return OPERATOR_CANCELLED;
}
RNA_string_get(op->ptr, "filepath", filepath);
BLI_ensure_extension(filepath, sizeof(filepath), ".dae");
/* Avoid File write exceptions in Collada */
if (!BLI_exists(filepath)) {
BLI_make_existing_file(filepath);
if (!BLI_file_touch(filepath)) {
BKE_report(op->reports, RPT_ERROR, "Can't create export file");
fprintf(stdout, "Collada export: Can not create: %s\n", filepath);
return OPERATOR_CANCELLED;
}
}
else if (!BLI_file_is_writable(filepath)) {
BKE_report(op->reports, RPT_ERROR, "Can't overwrite export file");
fprintf(stdout, "Collada export: Can not modify: %s\n", filepath);
return OPERATOR_CANCELLED;
}
/* Now the exporter can create and write the export file */
/* Options panel */
apply_modifiers = RNA_boolean_get(op->ptr, "apply_modifiers");
export_mesh_type = RNA_enum_get(op->ptr, "export_mesh_type_selection");
selected = RNA_boolean_get(op->ptr, "selected");
include_children = RNA_boolean_get(op->ptr, "include_children");
include_armatures = RNA_boolean_get(op->ptr, "include_armatures");
include_shapekeys = RNA_boolean_get(op->ptr, "include_shapekeys");
deform_bones_only = RNA_boolean_get(op->ptr, "deform_bones_only");
include_uv_textures = RNA_boolean_get(op->ptr, "include_uv_textures");
include_material_textures = RNA_boolean_get(op->ptr, "include_material_textures");
use_texture_copies = RNA_boolean_get(op->ptr, "use_texture_copies");
active_uv_only = RNA_boolean_get(op->ptr, "active_uv_only");
triangulate = RNA_boolean_get(op->ptr, "triangulate");
use_object_instantiation = RNA_boolean_get(op->ptr, "use_object_instantiation");
sort_by_name = RNA_boolean_get(op->ptr, "sort_by_name");
export_transformation_type = RNA_enum_get(op->ptr, "export_transformation_type_selection");
open_sim = RNA_boolean_get(op->ptr, "open_sim");
/* get editmode results */
ED_object_editmode_load(CTX_data_edit_object(C));
export_count = collada_export(CTX_data_scene(C),
filepath,
apply_modifiers,
export_mesh_type,
selected,
include_children,
include_armatures,
include_shapekeys,
deform_bones_only,
active_uv_only,
include_uv_textures,
include_material_textures,
use_texture_copies,
triangulate,
use_object_instantiation,
sort_by_name,
export_transformation_type,
open_sim);
if (export_count == 0) {
BKE_report(op->reports, RPT_WARNING, "Export file is empty");
return OPERATOR_CANCELLED;
}
//.........这里部分代码省略.........
开发者ID:Bforartists,项目名称:Bforartists,代码行数:101,代码来源:io_collada.c
示例20: RNA_enum_get
/* Note: rna_enum_dt_layers_select_src_items enum is from rna_modifier.c */
static EnumPropertyItem *dt_layers_select_src_itemf(
bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
EnumPropertyItem *item = NULL, tmp_item = {0};
int totitem = 0;
const int data_type = RNA_enum_get(ptr, "data_type");
if (!C) { /* needed for docs and i18n tools */
return rna_enum_dt_layers_select_src_items;
}
RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_ACTIVE_SRC);
RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_ALL_SRC);
if (data_type == DT_TYPE_MDEFORMVERT) {
Object *ob_src = CTX_data_active_object(C);
if (BKE_object_pose_armature_get(ob_src)) {
RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_VGROUP_SRC_BONE_SELECT);
RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_VGROUP_SRC_BONE_DEFORM);
}
if (ob_src) {
bDeformGroup *dg;
int i;
RNA_enum_item_add_separator(&item, &totitem);
for (i = 0, dg = ob_src->defbase.first; dg; i++, dg = dg->next) {
tmp_item.value = i;
tmp_item.identifier = tmp_item.name = dg->name;
RNA_enum_item_add(&item, &totitem, &tmp_item);
}
}
}
else if (data_type == DT_TYPE_SHAPEKEY) {
/* TODO */
}
else if (data_type == DT_TYPE_UV) {
Object *ob_src = CTX_data_active_object(C);
Scene *scene = CTX_data_scene(C);
if (ob_src) {
DerivedMesh *dm_src;
CustomData *pdata;
int num_data, i;
/* XXX Is this OK? */
dm_src = mesh_get_derived_final(scene, ob_src, CD_MASK_BAREMESH | CD_MTEXPOLY);
pdata = dm_src->getPolyDataLayout(dm_src);
num_data = CustomData_number_of_layers(pdata, CD_MTEXPOLY);
RNA_enum_item_add_separator(&item, &totitem);
for (i = 0; i < num_data; i++) {
tmp_item.value = i;
tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(pdata, CD_MTEXPOLY, i);
RNA_enum_item_add(&item, &totitem, &tmp_item);
}
}
}
else if (data_type == DT_TYPE_VCOL) {
Object *ob_src = CTX_data_active_object(C);
Scene *scene = CTX_data_scene(C);
if (ob_src) {
DerivedMesh *dm_src;
CustomData *ldata;
int num_data, i;
/* XXX Is this OK? */
dm_src = mesh_get_derived_final(scene, ob_src, CD_MASK_BAREMESH | CD_MLOOPCOL);
ldata = dm_src->getLoopDataLayout(dm_src);
num_data = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
RNA_enum_item_add_separator(&item, &totitem);
for (i = 0; i < num_data; i++) {
tmp_item.value = i;
tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(ldata, CD_MLOOPCOL, i);
RNA_enum_item_add(&item, &totitem, &tmp_item);
}
}
}
RNA_enum_item_end(&item, &totitem);
*r_free = true;
return item;
}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:92,代码来源:object_data_transfer.c
注:本文中的RNA_enum_get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论