本文整理汇总了C++中RNA_string_get函数的典型用法代码示例。如果您正苦于以下问题:C++ RNA_string_get函数的具体用法?C++ RNA_string_get怎么用?C++ RNA_string_get使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RNA_string_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: workspace_append_activate_exec
static int workspace_append_activate_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
char idname[MAX_ID_NAME - 2], filepath[FILE_MAX];
if (!RNA_struct_property_is_set(op->ptr, "idname") ||
!RNA_struct_property_is_set(op->ptr, "filepath")) {
return OPERATOR_CANCELLED;
}
RNA_string_get(op->ptr, "idname", idname);
RNA_string_get(op->ptr, "filepath", filepath);
if (workspace_append(C, filepath, idname) != OPERATOR_CANCELLED) {
WorkSpace *appended_workspace = BLI_findstring(
&bmain->workspaces, idname, offsetof(ID, name) + 2);
BLI_assert(appended_workspace != NULL);
if (appended_workspace) {
/* Reorder to last position. */
BKE_id_reorder(&bmain->workspaces, &appended_workspace->id, NULL, true);
/* Changing workspace changes context. Do delayed! */
WM_event_add_notifier(C, NC_SCREEN | ND_WORKSPACE_SET, appended_workspace);
return OPERATOR_FINISHED;
}
}
return OPERATOR_CANCELLED;
}
示例2: screen_render_scene_layer_set
static void screen_render_scene_layer_set(wmOperator *op, Main *mainp, Scene **scene, SceneRenderLayer **srl)
{
/* single layer re-render */
if (RNA_struct_property_is_set(op->ptr, "scene")) {
Scene *scn;
char scene_name[MAX_ID_NAME - 2];
RNA_string_get(op->ptr, "scene", scene_name);
scn = (Scene *)BLI_findstring(&mainp->scene, scene_name, offsetof(ID, name) + 2);
if (scn) {
/* camera switch wont have updated */
scn->r.cfra = (*scene)->r.cfra;
BKE_scene_camera_switch_update(scn);
*scene = scn;
}
}
if (RNA_struct_property_is_set(op->ptr, "layer")) {
SceneRenderLayer *rl;
char rl_name[RE_MAXNAME];
RNA_string_get(op->ptr, "layer", rl_name);
rl = (SceneRenderLayer *)BLI_findstring(&(*scene)->r.layers, rl_name, offsetof(SceneRenderLayer, name));
if (rl)
*srl = rl;
}
}
示例3: bake_init_api_data
static void bake_init_api_data(wmOperator *op, bContext *C, BakeAPIRender *bkr)
{
bool is_save_internal;
bScreen *sc = CTX_wm_screen(C);
bkr->ob = CTX_data_active_object(C);
bkr->main = CTX_data_main(C);
bkr->scene = CTX_data_scene(C);
bkr->sa = sc ? BKE_screen_find_big_area(sc, SPACE_IMAGE, 10) : NULL;
bkr->pass_type = RNA_enum_get(op->ptr, "type");
bkr->pass_filter = RNA_enum_get(op->ptr, "pass_filter");
bkr->margin = RNA_int_get(op->ptr, "margin");
bkr->save_mode = RNA_enum_get(op->ptr, "save_mode");
is_save_internal = (bkr->save_mode == R_BAKE_SAVE_INTERNAL);
bkr->is_clear = RNA_boolean_get(op->ptr, "use_clear");
bkr->is_split_materials = (!is_save_internal) && RNA_boolean_get(op->ptr, "use_split_materials");
bkr->is_automatic_name = RNA_boolean_get(op->ptr, "use_automatic_name");
bkr->is_selected_to_active = RNA_boolean_get(op->ptr, "use_selected_to_active");
bkr->is_cage = RNA_boolean_get(op->ptr, "use_cage");
bkr->cage_extrusion = RNA_float_get(op->ptr, "cage_extrusion");
bkr->normal_space = RNA_enum_get(op->ptr, "normal_space");
bkr->normal_swizzle[0] = RNA_enum_get(op->ptr, "normal_r");
bkr->normal_swizzle[1] = RNA_enum_get(op->ptr, "normal_g");
bkr->normal_swizzle[2] = RNA_enum_get(op->ptr, "normal_b");
bkr->width = RNA_int_get(op->ptr, "width");
bkr->height = RNA_int_get(op->ptr, "height");
bkr->identifier = "";
RNA_string_get(op->ptr, "uv_layer", bkr->uv_layer);
RNA_string_get(op->ptr, "cage_object", bkr->custom_cage);
if ((!is_save_internal) && bkr->is_automatic_name) {
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "type");
RNA_property_enum_identifier(C, op->ptr, prop, bkr->pass_type, &bkr->identifier);
}
CTX_data_selected_objects(C, &bkr->selected_objects);
bkr->reports = op->reports;
bkr->result = OPERATOR_CANCELLED;
bkr->render = RE_NewSceneRender(bkr->scene);
/* XXX hack to force saving to always be internal. Whether (and how) to support
* external saving will be addressed later */
bkr->save_mode = R_BAKE_SAVE_INTERNAL;
}
示例4: mask_new_exec
static int mask_new_exec(bContext *C, wmOperator *op)
{
ScrArea *sa = CTX_wm_area(C);
Mask *mask;
char name[MAX_ID_NAME - 2];
RNA_string_get(op->ptr, "name", name);
mask = BKE_mask_new(name);
if (sa && sa->spacedata.first) {
switch (sa->spacetype) {
case SPACE_CLIP:
{
SpaceClip *sc = sa->spacedata.first;
ED_space_clip_set_mask(C, sc, mask);
break;
}
case SPACE_SEQ:
{
/* do nothing */
break;
}
case SPACE_IMAGE:
{
SpaceImage *sima = sa->spacedata.first;
ED_space_image_set_mask(C, sima, mask);
break;
}
}
}
return OPERATOR_FINISHED;
}
示例5: strip_modifier_move_exec
static int strip_modifier_move_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Sequence *seq = BKE_sequencer_active_get(scene);
char name[MAX_NAME];
int direction;
SequenceModifierData *smd;
RNA_string_get(op->ptr, "name", name);
direction = RNA_enum_get(op->ptr, "direction");
smd = BKE_sequence_modifier_find_by_name(seq, name);
if (!smd)
return OPERATOR_CANCELLED;
if (direction == SEQ_MODIFIER_MOVE_UP) {
if (smd->prev) {
BLI_remlink(&seq->modifiers, smd);
BLI_insertlinkbefore(&seq->modifiers, smd->prev, smd);
}
}
else if (direction == SEQ_MODIFIER_MOVE_DOWN) {
if (smd->next) {
BLI_remlink(&seq->modifiers, smd);
BLI_insertlinkafter(&seq->modifiers, smd->next, smd);
}
}
BKE_sequence_invalidate_cache(scene, seq);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
}
示例6: wm_alembic_import_exec
static int wm_alembic_import_exec(bContext *C, wmOperator *op)
{
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
BKE_report(op->reports, RPT_ERROR, "No filename given");
return OPERATOR_CANCELLED;
}
char filename[FILE_MAX];
RNA_string_get(op->ptr, "filepath", filename);
const float scale = RNA_float_get(op->ptr, "scale");
const bool is_sequence = RNA_boolean_get(op->ptr, "is_sequence");
const bool set_frame_range = RNA_boolean_get(op->ptr, "set_frame_range");
const bool validate_meshes = RNA_boolean_get(op->ptr, "validate_meshes");
const bool as_background_job = RNA_boolean_get(op->ptr, "as_background_job");
int offset = 0;
int sequence_len = 1;
if (is_sequence) {
sequence_len = get_sequence_len(filename, &offset);
if (sequence_len < 0) {
BKE_report(op->reports, RPT_ERROR, "Unable to determine ABC sequence length");
return OPERATOR_CANCELLED;
}
}
bool ok = ABC_import(C, filename, scale, is_sequence, set_frame_range,
sequence_len, offset, validate_meshes,
as_background_job);
return as_background_job || ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
}
示例7: ed_undo_push_exec
static int ed_undo_push_exec(bContext *C, wmOperator *op)
{
char str[BKE_UNDO_STR_MAX];
RNA_string_get(op->ptr, "message", str);
ED_undo_push(C, str);
return OPERATOR_FINISHED;
}
示例8: wm_collada_import_exec
/* function used for WM_OT_save_mainfile too */
static int wm_collada_import_exec(bContext *C, wmOperator *op)
{
char filename[FILE_MAX];
int import_units;
int find_chains;
int fix_orientation;
int min_chain_length;
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
BKE_report(op->reports, RPT_ERROR, "No filename given");
return OPERATOR_CANCELLED;
}
/* Options panel */
import_units = RNA_boolean_get(op->ptr, "import_units");
find_chains = RNA_boolean_get(op->ptr, "find_chains");
fix_orientation = RNA_boolean_get(op->ptr, "fix_orientation");
min_chain_length = RNA_int_get(op->ptr, "min_chain_length");
RNA_string_get(op->ptr, "filepath", filename);
if (collada_import(
C, filename,
import_units,
find_chains,
fix_orientation,
min_chain_length))
{
return OPERATOR_FINISHED;
}
else {
BKE_report(op->reports, RPT_ERROR, "Errors found during parsing COLLADA document (see console for details)");
return OPERATOR_CANCELLED;
}
}
示例9: jump_to_target_ptr
/** Jump to the object or bone referenced by the pointer, or check if it is possible. */
static bool jump_to_target_ptr(bContext *C, PointerRNA ptr, const bool poll)
{
if (RNA_pointer_is_null(&ptr)) {
return false;
}
/* Verify pointer type. */
char bone_name[MAXBONENAME];
const StructRNA *target_type = NULL;
if (ELEM(ptr.type, &RNA_EditBone, &RNA_PoseBone, &RNA_Bone)) {
RNA_string_get(&ptr, "name", bone_name);
if (bone_name[0] != '\0') {
target_type = &RNA_Bone;
}
}
else if (RNA_struct_is_a(ptr.type, &RNA_Object)) {
target_type = &RNA_Object;
}
if (target_type == NULL) {
return false;
}
/* Find the containing Object. */
ViewLayer *view_layer = CTX_data_view_layer(C);
Base *base = NULL;
const short id_type = GS(((ID *)ptr.id.data)->name);
if (id_type == ID_OB) {
base = BKE_view_layer_base_find(view_layer, ptr.id.data);
}
else if (OB_DATA_SUPPORT_ID(id_type)) {
base = ED_object_find_first_by_data_id(view_layer, ptr.id.data);
}
bool ok = false;
if ((base == NULL) || ((target_type == &RNA_Bone) && (base->object->type != OB_ARMATURE))) {
/* pass */
}
else if (poll) {
ok = true;
}
else {
/* Make optional. */
const bool reveal_hidden = true;
/* Select and activate the target. */
if (target_type == &RNA_Bone) {
ok = ED_object_jump_to_bone(C, base->object, bone_name, reveal_hidden);
}
else if (target_type == &RNA_Object) {
ok = ED_object_jump_to_object(C, base->object, reveal_hidden);
}
else {
BLI_assert(0);
}
}
return ok;
}
示例10: file_directory_new_exec
int file_directory_new_exec(bContext *C, wmOperator *op)
{
char name[FILE_MAXFILE];
char path[FILE_MAX];
int generate_name = 1;
wmWindowManager *wm = CTX_wm_manager(C);
SpaceFile *sfile = CTX_wm_space_file(C);
if (!sfile->params) {
BKE_report(op->reports, RPT_WARNING, "No parent directory given");
return OPERATOR_CANCELLED;
}
path[0] = '\0';
if (RNA_struct_find_property(op->ptr, "directory")) {
RNA_string_get(op->ptr, "directory", path);
if (path[0] != '\0') generate_name = 0;
}
if (generate_name) {
/* create a new, non-existing folder name */
if (!new_folder_path(sfile->params->dir, path, name)) {
BKE_report(op->reports, RPT_ERROR, "Could not create new folder name");
return OPERATOR_CANCELLED;
}
}
/* create the file */
BLI_dir_create_recursive(path);
if (!BLI_exists(path)) {
BKE_report(op->reports, RPT_ERROR, "Could not create new folder");
return OPERATOR_CANCELLED;
}
/* now remember file to jump into editing */
BLI_strncpy(sfile->params->renamefile, name, FILE_MAXFILE);
/* set timer to smoothly view newly generated file */
sfile->smoothscroll_timer = WM_event_add_timer(wm, CTX_wm_window(C), TIMER1, 1.0 / 1000.0); /* max 30 frs/sec */
sfile->scroll_offset = 0;
/* reload dir to make sure we're seeing what's in the directory */
ED_fileselect_clear(wm, sfile);
if (RNA_boolean_get(op->ptr, "open")) {
BLI_strncpy(sfile->params->dir, path, sizeof(sfile->params->dir));
file_change_dir(C, 1);
}
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
return OPERATOR_FINISHED;
}
示例11: mask_new_exec
static int mask_new_exec(bContext *C, wmOperator *op)
{
char name[MAX_ID_NAME - 2];
RNA_string_get(op->ptr, "name", name);
ED_mask_new(C, name);
return OPERATOR_FINISHED;
}
示例12: controller_add_exec
static int controller_add_exec(bContext *C, wmOperator *op)
{
Object *ob;
bController *cont;
PointerRNA cont_ptr;
PropertyRNA *prop;
const char *cont_name;
int bit;
char name[MAX_NAME];
int type = RNA_enum_get(op->ptr, "type");
ob = edit_object_property_get(C, op);
if (!ob)
return OPERATOR_CANCELLED;
cont = new_controller(type);
BLI_addtail(&(ob->controllers), cont);
/* set the controller name based on rna type enum */
RNA_pointer_create((ID *)ob, &RNA_Controller, cont, &cont_ptr);
prop = RNA_struct_find_property(&cont_ptr, "type");
RNA_string_get(op->ptr, "name", name);
if (*name) {
BLI_strncpy(cont->name, name, sizeof(cont->name));
}
else {
RNA_property_enum_name(C, &cont_ptr, prop, RNA_property_enum_get(&cont_ptr, prop), &cont_name);
BLI_strncpy(cont->name, cont_name, sizeof(cont->name));
}
BLI_uniquename(&ob->controllers, cont, DATA_("Controller"), '.', offsetof(bController, name), sizeof(cont->name));
/* set the controller state mask from the current object state.
* A controller is always in a single state, so select the lowest bit set
* from the object state */
for (bit = 0; bit < OB_MAX_STATES; bit++) {
if (ob->state & (1 << bit))
break;
}
cont->state_mask = (1 << bit);
if (cont->state_mask == 0) {
/* shouldn't happen, object state is never 0 */
cont->state_mask = 1;
}
ob->scaflag |= OB_SHOWCONT;
WM_event_add_notifier(C, NC_LOGIC, NULL);
return OPERATOR_FINISHED;
}
示例13: wm_alembic_export_check
static bool wm_alembic_export_check(bContext *UNUSED(C), wmOperator *op)
{
char filepath[FILE_MAX];
RNA_string_get(op->ptr, "filepath", filepath);
if (!BLI_path_extension_check(filepath, ".abc")) {
BLI_path_extension_ensure(filepath, FILE_MAX, ".abc");
RNA_string_set(op->ptr, "filepath", filepath);
return true;
}
return false;
}
示例14: RNA_string_get
static ModifierData *edit_modifier_property_get(wmOperator *op, Object *ob, int type)
{
char modifier_name[MAX_NAME];
ModifierData *md;
RNA_string_get(op->ptr, "modifier", modifier_name);
md = modifiers_findByName(ob, modifier_name);
if (md && type != 0 && md->type != type)
md = NULL;
return md;
}
示例15: RNA_string_get
static bController *edit_controller_property_get(bContext *C, wmOperator *op, Object **ob)
{
char controller_name[MAX_NAME];
bController *cont;
RNA_string_get(op->ptr, "controller", controller_name);
*ob = edit_object_property_get(C, op);
if (!*ob) return NULL;
cont = BLI_findstring(&((*ob)->controllers), controller_name, offsetof(bController, name));
return cont;
}