本文整理汇总了C++中RNA_string_set函数的典型用法代码示例。如果您正苦于以下问题:C++ RNA_string_set函数的具体用法?C++ RNA_string_set怎么用?C++ RNA_string_set使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RNA_string_set函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: file_sfile_to_operator
void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath)
{
BLI_join_dirfile(filepath, FILE_MAX, sfile->params->dir, sfile->params->file); /* XXX, not real length */
if(RNA_struct_find_property(op->ptr, "relative_path")) {
if(RNA_boolean_get(op->ptr, "relative_path")) {
BLI_path_rel(filepath, G.main->name);
}
}
if(RNA_struct_find_property(op->ptr, "filename")) {
RNA_string_set(op->ptr, "filename", sfile->params->file);
}
if(RNA_struct_find_property(op->ptr, "directory")) {
RNA_string_set(op->ptr, "directory", sfile->params->dir);
}
if(RNA_struct_find_property(op->ptr, "filepath")) {
RNA_string_set(op->ptr, "filepath", filepath);
}
/* some ops have multiple files to select */
/* this is called on operators check() so clear collections first since
* they may be already set. */
{
PointerRNA itemptr;
PropertyRNA *prop_files= RNA_struct_find_property(op->ptr, "files");
PropertyRNA *prop_dirs= RNA_struct_find_property(op->ptr, "dirs");
int i, numfiles = filelist_numfiles(sfile->files);
if(prop_files) {
RNA_property_collection_clear(op->ptr, prop_files);
for (i=0; i<numfiles; i++) {
if (filelist_is_selected(sfile->files, i, CHECK_FILES)) {
struct direntry *file= filelist_file(sfile->files, i);
RNA_property_collection_add(op->ptr, prop_files, &itemptr);
RNA_string_set(&itemptr, "name", file->relname);
}
}
}
if(prop_dirs) {
RNA_property_collection_clear(op->ptr, prop_dirs);
for (i=0; i<numfiles; i++) {
if (filelist_is_selected(sfile->files, i, CHECK_DIRS)) {
struct direntry *file= filelist_file(sfile->files, i);
RNA_property_collection_add(op->ptr, prop_dirs, &itemptr);
RNA_string_set(&itemptr, "name", file->relname);
}
}
}
}
}
示例2: set_brush_rc_props
void set_brush_rc_props(PointerRNA *ptr, const char *paint,
const char *prop, const char *secondary_prop,
RCFlags flags)
{
const char *ups_path = "tool_settings.unified_paint_settings";
char *brush_path;
brush_path = BLI_sprintfN("tool_settings.%s.brush", paint);
set_brush_rc_path(ptr, brush_path, "data_path_primary", prop);
if (secondary_prop) {
set_brush_rc_path(ptr, ups_path, "use_secondary", secondary_prop);
set_brush_rc_path(ptr, ups_path, "data_path_secondary", prop);
}
else {
RNA_string_set(ptr, "use_secondary", "");
RNA_string_set(ptr, "data_path_secondary", "");
}
set_brush_rc_path(ptr, brush_path, "color_path", "cursor_color_add");
if (flags & RC_SECONDARY_ROTATION)
set_brush_rc_path(ptr, brush_path, "rotation_path", "mask_texture_slot.angle");
else
set_brush_rc_path(ptr, brush_path, "rotation_path", "texture_slot.angle");
RNA_string_set(ptr, "image_id", brush_path);
if (flags & RC_COLOR) {
set_brush_rc_path(ptr, brush_path, "fill_color_path", "color");
}
else {
RNA_string_set(ptr, "fill_color_path", "");
}
if (flags & RC_COLOR_OVERRIDE) {
RNA_string_set(ptr, "fill_color_override_path", "tool_settings.unified_paint_settings.color");
RNA_string_set(ptr, "fill_color_override_test_path", "tool_settings.unified_paint_settings.use_unified_color");
}
else {
RNA_string_set(ptr, "fill_color_override_path", "");
RNA_string_set(ptr, "fill_color_override_test_path", "");
}
if (flags & RC_ZOOM)
RNA_string_set(ptr, "zoom_path", "space_data.zoom");
else
RNA_string_set(ptr, "zoom_path", "");
RNA_boolean_set(ptr, "secondary_tex", (flags & RC_SECONDARY_ROTATION) != 0);
MEM_freeN(brush_path);
}
示例3: console_insert_invoke
static int console_insert_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
// if (!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */
if (!RNA_string_length(op->ptr, "text")) {
/* if alt/ctrl/super are pressed pass through except for utf8 character event
* (when input method are used for utf8 inputs, the user may assign key event
* including alt/ctrl/super like ctrl+m to commit utf8 string. in such case,
* the modifiers in the utf8 character event make no sense.) */
if ((event->ctrl || event->oskey) && !event->utf8_buf[0]) {
return OPERATOR_PASS_THROUGH;
}
else {
char str[BLI_UTF8_MAX + 1];
size_t len;
if (event->utf8_buf[0]) {
len = BLI_str_utf8_size_safe(event->utf8_buf);
memcpy(str, event->utf8_buf, len);
}
else {
/* in theory, ghost can set value to extended ascii here */
len = BLI_str_utf8_from_unicode(event->ascii, str);
}
str[len] = '\0';
RNA_string_set(op->ptr, "text", str);
}
}
return console_insert_exec(C, op);
}
示例4: multires_external_save_invoke
static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
Object *ob = ED_object_active_context(C);
MultiresModifierData *mmd;
Mesh *me= ob->data;
char path[FILE_MAX];
if (!edit_modifier_invoke_properties(C, op))
return OPERATOR_CANCELLED;
mmd = (MultiresModifierData *)edit_modifier_property_get(op, ob, eModifierType_Multires);
if (!mmd)
return OPERATOR_CANCELLED;
if(CustomData_external_test(&me->fdata, CD_MDISPS))
return OPERATOR_CANCELLED;
if(RNA_struct_property_is_set(op->ptr, "filepath"))
return multires_external_save_exec(C, op);
op->customdata= me;
BLI_snprintf(path, sizeof(path), "//%s.btx", me->id.name+2);
RNA_string_set(op->ptr, "filepath", path);
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
}
示例5: ED_keymap_proportional_cycle
void ED_keymap_proportional_cycle(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyMap *keymap)
{
wmKeyMapItem *kmi;
kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_enum", OKEY, KM_PRESS, KM_SHIFT, 0);
RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_edit_falloff");
}
示例6: script_keymap
void script_keymap(wmKeyConfig *keyconf)
{
wmKeyMap *keymap= WM_keymap_find(keyconf, "Script", SPACE_SCRIPT, 0);
/* TODO - this is just while we have no way to load a text datablock */
RNA_string_set(WM_keymap_add_item(keymap, "SCRIPT_OT_python_file_run", PKEY, KM_PRESS, KM_CTRL|KM_SHIFT|KM_ALT, 0)->ptr, "filepath", "test.py");
}
示例7: wm_alembic_export_invoke
static int wm_alembic_export_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
RNA_boolean_set(op->ptr, "init_scene_frame_range", true);
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
Main *bmain = CTX_data_main(C);
char filepath[FILE_MAX];
if (bmain->name[0] == '\0') {
BLI_strncpy(filepath, "untitled", sizeof(filepath));
}
else {
BLI_strncpy(filepath, bmain->name, sizeof(filepath));
}
BLI_replace_extension(filepath, sizeof(filepath), ".abc");
RNA_string_set(op->ptr, "filepath", filepath);
}
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
UNUSED_VARS(event);
}
示例8: ED_keymap_proportional_maskmode
void ED_keymap_proportional_maskmode(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyMap *keymap)
{
wmKeyMapItem *kmi;
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", OKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_proportional_edit_mask");
}
示例9: workspace_append
static int workspace_append(bContext *C, const char *directory, const char *idname)
{
wmOperatorType *ot = WM_operatortype_find("WM_OT_append", false);
PointerRNA opptr;
int retval;
WM_operator_properties_create_ptr(&opptr, ot);
RNA_string_set(&opptr, "directory", directory);
RNA_string_set(&opptr, "filename", idname);
RNA_boolean_set(&opptr, "autoselect", false);
retval = WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &opptr);
WM_operator_properties_free(&opptr);
return retval;
}
示例10: edit_sensor_invoke_properties
static int edit_sensor_invoke_properties(bContext *C, wmOperator *op)
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "sensor", &RNA_Sensor);
if (RNA_struct_property_is_set(op->ptr, "sensor") && RNA_struct_property_is_set(op->ptr, "object") )
return 1;
if (ptr.data) {
bSensor *sens = ptr.data;
Object *ob = ptr.id.data;
RNA_string_set(op->ptr, "sensor", sens->name);
RNA_string_set(op->ptr, "object", ob->id.name + 2);
return 1;
}
return 0;
}
示例11: edit_controller_invoke_properties
static int edit_controller_invoke_properties(bContext *C, wmOperator *op)
{
PointerRNA ptr= CTX_data_pointer_get_type(C, "controller", &RNA_Controller);
if (RNA_property_is_set(op->ptr, "controller") && RNA_property_is_set(op->ptr, "object") )
return 1;
if (ptr.data) {
bController *cont = ptr.data;
Object *ob = ptr.id.data;
RNA_string_set(op->ptr, "controller", cont->name);
RNA_string_set(op->ptr, "object", ob->id.name+2);
return 1;
}
return 0;
}
示例12: ed_marker_rename_invoke_wrapper
static int ed_marker_rename_invoke_wrapper(bContext *C, wmOperator *op, const wmEvent *event)
{
/* must initialize the marker name first if there is a marker selected */
TimeMarker *marker = ED_markers_get_first_selected(ED_context_get_markers(C));
if (marker)
RNA_string_set(op->ptr, "name", marker->name);
/* now see if the operator is usable */
return ed_markers_opwrap_invoke_custom(C, op, event, WM_operator_props_popup);
}
示例13: file_panel_cb
static void file_panel_cb(bContext *C, void *arg_entry, void *UNUSED(arg_v))
{
PointerRNA ptr;
char *entry= (char*)arg_entry;
WM_operator_properties_create(&ptr, "FILE_OT_select_bookmark");
RNA_string_set(&ptr, "dir", entry);
WM_operator_name_call(C, "FILE_OT_select_bookmark", WM_OP_INVOKE_REGION_WIN, &ptr);
WM_operator_properties_free(&ptr);
}
示例14: RNA_pointer_get
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Send the license info to OctaneServer
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool BlenderSession::activate(BL::Scene b_scene) {
bool ret = false;
PointerRNA oct_scene = RNA_pointer_get(&b_scene.ptr, "octane");
// Render-server address
RenderServerInfo &server_info = RenderServer::get_info();
string server_addr = get_string(oct_scene, "server_address");
if(server_addr.length() > 0)
::strcpy(server_info.net_address, server_addr.c_str());
string login = get_string(oct_scene, "server_login");
string pass = get_string(oct_scene, "server_pass");
string stand_login = get_string(oct_scene, "stand_login");
string stand_pass = get_string(oct_scene, "stand_pass");
if(stand_login.length() > 0 && stand_pass.length() > 0 && login.length() > 0 && pass.length() > 0) {
RenderServer *server = new RenderServer(server_info.net_address, "", false, true);
if(server) {
if(server->activate(stand_login, stand_pass, login, pass)) {
RNA_string_set(&oct_scene, "stand_login", "");
RNA_string_set(&oct_scene, "stand_pass", "");
RNA_string_set(&oct_scene, "server_login", "");
RNA_string_set(&oct_scene, "server_pass", "");
fprintf(stdout, "Octane: server activation is completed successfully.\n");
ret = true;
}
delete server;
}
else {
fprintf(stderr, "Octane: ERROR during server activation.\n");
ret = false;
}
}
else {
fprintf(stderr, "Octane: ERROR: login-password fields must be filled in before activation.\n");
ret = false;
}
return ret;
} //activate()
示例15: workspace_append_button
static void workspace_append_button(uiLayout *layout,
wmOperatorType *ot_append,
const WorkSpace *workspace,
const Main *from_main)
{
const ID *id = (ID *)workspace;
PointerRNA opptr;
char lib_path[FILE_MAX_LIBEXTRA];
const char *filepath = from_main->name;
if (strlen(filepath) == 0) {
filepath = BLO_EMBEDDED_STARTUP_BLEND;
}
BLI_path_join(lib_path, sizeof(lib_path), filepath, BKE_idcode_to_name(GS(id->name)), NULL);
BLI_assert(STREQ(ot_append->idname, "WORKSPACE_OT_append_activate"));
uiItemFullO_ptr(
layout, ot_append, workspace->id.name + 2, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &opptr);
RNA_string_set(&opptr, "idname", id->name + 2);
RNA_string_set(&opptr, "filepath", lib_path);
}