本文整理汇总了C++中RNA_struct_property_is_set函数的典型用法代码示例。如果您正苦于以下问题:C++ RNA_struct_property_is_set函数的具体用法?C++ RNA_struct_property_is_set怎么用?C++ RNA_struct_property_is_set使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RNA_struct_property_is_set函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initSnapping
void initSnapping(TransInfo *t, wmOperator *op)
{
ToolSettings *ts = t->settings;
short snap_target = t->settings->snap_target;
resetSnapping(t);
/* if snap property exists */
if (op && RNA_struct_find_property(op->ptr, "snap") && RNA_struct_property_is_set(op->ptr, "snap")) {
if (RNA_boolean_get(op->ptr, "snap")) {
t->modifiers |= MOD_SNAP;
if (RNA_struct_property_is_set(op->ptr, "snap_target")) {
snap_target = RNA_enum_get(op->ptr, "snap_target");
}
if (RNA_struct_property_is_set(op->ptr, "snap_point")) {
RNA_float_get_array(op->ptr, "snap_point", t->tsnap.snapPoint);
t->tsnap.status |= SNAP_FORCED | POINT_INIT;
}
/* snap align only defined in specific cases */
if (RNA_struct_find_property(op->ptr, "snap_align")) {
t->tsnap.align = RNA_boolean_get(op->ptr, "snap_align");
RNA_float_get_array(op->ptr, "snap_normal", t->tsnap.snapNormal);
normalize_v3(t->tsnap.snapNormal);
}
if (RNA_struct_find_property(op->ptr, "use_snap_project")) {
t->tsnap.project = RNA_boolean_get(op->ptr, "use_snap_project");
}
if (RNA_struct_find_property(op->ptr, "use_snap_self")) {
t->tsnap.snap_self = RNA_boolean_get(op->ptr, "use_snap_self");
}
}
}
/* use scene defaults only when transform is modal */
else if (t->flag & T_MODAL) {
if (ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE, SPACE_NODE)) {
if (ts->snap_flag & SCE_SNAP) {
t->modifiers |= MOD_SNAP;
}
t->tsnap.align = ((t->settings->snap_flag & SCE_SNAP_ROTATE) != 0);
t->tsnap.project = ((t->settings->snap_flag & SCE_SNAP_PROJECT) != 0);
t->tsnap.snap_self = !((t->settings->snap_flag & SCE_SNAP_NO_SELF) != 0);
t->tsnap.peel = ((t->settings->snap_flag & SCE_SNAP_PROJECT) != 0);
}
/* for now only 3d view (others can be added if we want) */
if (t->spacetype == SPACE_VIEW3D) {
t->tsnap.snap_spatial_grid = ((t->settings->snap_flag & SCE_SNAP_ABS_GRID) != 0);
}
}
t->tsnap.target = snap_target;
initSnappingMode(t);
}
示例2: 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;
}
示例3: 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;
}
}
示例4: wm_alembic_export_invoke
static int wm_alembic_export_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
if (!RNA_struct_property_is_set(op->ptr, "as_background_job")) {
RNA_boolean_set(op->ptr, "as_background_job", true);
}
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 (BKE_main_blendfile_path(bmain)[0] == '\0') {
BLI_strncpy(filepath, "untitled", sizeof(filepath));
}
else {
BLI_strncpy(filepath, BKE_main_blendfile_path(bmain), sizeof(filepath));
}
BLI_path_extension_replace(filepath, sizeof(filepath), ".abc");
RNA_string_set(op->ptr, "filepath", filepath);
}
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
UNUSED_VARS(event);
}
示例5: ED_view3d_operator_properties_viewmat_set
void ED_view3d_operator_properties_viewmat_set(bContext *C, wmOperator *op)
{
ARegion *ar = CTX_wm_region(C);
RegionView3D *rv3d = ED_view3d_context_rv3d(C);
if (!RNA_struct_property_is_set(op->ptr, "region_width"))
RNA_int_set(op->ptr, "region_width", ar->winx);
if (!RNA_struct_property_is_set(op->ptr, "region_height"))
RNA_int_set(op->ptr, "region_height", ar->winy);
if (!RNA_struct_property_is_set(op->ptr, "perspective_matrix"))
RNA_float_set_array(op->ptr, "perspective_matrix", (float *)rv3d->persmat);
}
示例6: rigidbody_world_export_invoke
static int rigidbody_world_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
if (!RNA_struct_property_is_set(op->ptr, "relative_path"))
RNA_boolean_set(op->ptr, "relative_path", (U.flag & USER_RELPATHS) != 0);
if (RNA_struct_property_is_set(op->ptr, "filepath"))
return rigidbody_world_export_exec(C, op);
// TODO: use the actual rigidbody world's name + .bullet instead of this temp crap
RNA_string_set(op->ptr, "filepath", "rigidbodyworld_export.bullet");
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;
}
示例7: wm_alembic_import_invoke
/* op->invoke, opens fileselect if path property not set, otherwise executes */
static int wm_alembic_import_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
if (!RNA_struct_property_is_set(op->ptr, "as_background_job")) {
RNA_boolean_set(op->ptr, "as_background_job", true);
}
return WM_operator_filesel(C, op, event);
}
示例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: 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;
}
示例10: 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;
}
示例11: undo_history_exec
/* note: also check ed_undo_step() in top if you change notifiers */
static int undo_history_exec(bContext *C, wmOperator *op)
{
if (RNA_struct_property_is_set(op->ptr, "item")) {
int undosys = get_undo_system(C);
int item = RNA_int_get(op->ptr, "item");
if (undosys == UNDOSYSTEM_PARTICLE) {
PE_undo_number(CTX_data_scene(C), item);
}
else if (undosys == UNDOSYSTEM_EDITMODE) {
undo_editmode_number(C, item + 1);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, NULL);
}
else if (undosys == UNDOSYSTEM_IMAPAINT) {
ED_undo_paint_step_num(C, UNDO_PAINT_IMAGE, item );
}
else {
ED_viewport_render_kill_jobs(C, true);
BKE_undo_number(C, item);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, CTX_data_scene(C));
}
WM_event_add_notifier(C, NC_WINDOW, NULL);
return OPERATOR_FINISHED;
}
return OPERATOR_CANCELLED;
}
示例12: file_browse_exec
static int file_browse_exec(bContext *C, wmOperator *op)
{
FileBrowseOp *fbo = op->customdata;
ID *id;
char *str, path[FILE_MAX];
const char *path_prop = RNA_struct_find_property(op->ptr, "directory") ? "directory" : "filepath";
if (RNA_struct_property_is_set(op->ptr, path_prop) == 0 || fbo == NULL)
return OPERATOR_CANCELLED;
str = RNA_string_get_alloc(op->ptr, path_prop, NULL, 0);
/* add slash for directories, important for some properties */
if (RNA_property_subtype(fbo->prop) == PROP_DIRPATH) {
int is_relative = RNA_boolean_get(op->ptr, "relative_path");
id = fbo->ptr.id.data;
BLI_strncpy(path, str, FILE_MAX);
BLI_path_abs(path, id ? ID_BLEND_PATH(G.main, id) : G.main->name);
if (BLI_is_dir(path)) {
/* do this first so '//' isnt converted to '//\' on windows */
BLI_add_slash(path);
if (is_relative) {
BLI_strncpy(path, str, FILE_MAX);
BLI_path_rel(path, G.main->name);
str = MEM_reallocN(str, strlen(path) + 2);
BLI_strncpy(str, path, FILE_MAX);
}
else {
str = MEM_reallocN(str, strlen(str) + 2);
}
}
else {
char * const lslash = (char *)BLI_last_slash(str);
if (lslash) lslash[1] = '\0';
}
}
RNA_property_string_set(&fbo->ptr, fbo->prop, str);
RNA_property_update(C, &fbo->ptr, fbo->prop);
MEM_freeN(str);
/* special, annoying exception, filesel on redo panel [#26618] */
{
wmOperator *redo_op = WM_operator_last_redo(C);
if (redo_op) {
if (fbo->ptr.data == redo_op->ptr->data) {
ED_undo_operator_repeat(C, redo_op);
}
}
}
MEM_freeN(op->customdata);
return OPERATOR_FINISHED;
}
示例13: apply_solution_scale_invoke
static int apply_solution_scale_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
if (!RNA_struct_property_is_set(op->ptr, "distance")) {
RNA_float_set(op->ptr, "distance", clip->tracking.settings.dist);
}
return apply_solution_scale_exec(C, op);
}
示例14: 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;
}
示例15: 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;
}