本文整理汇总了C++中RNA_float_get_array函数的典型用法代码示例。如果您正苦于以下问题:C++ RNA_float_get_array函数的具体用法?C++ RNA_float_get_array怎么用?C++ RNA_float_get_array使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RNA_float_get_array函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: curve_draw_stroke_from_operator_elem
static void curve_draw_stroke_from_operator_elem(
wmOperator *op, PointerRNA *itemptr)
{
struct CurveDrawData *cdd = op->customdata;
struct StrokeElem *selem = BLI_mempool_calloc(cdd->stroke_elem_pool);
RNA_float_get_array(itemptr, "mouse", selem->mval);
RNA_float_get_array(itemptr, "location", selem->location_world);
mul_v3_m4v3(selem->location_local, cdd->vc.obedit->imat, selem->location_world);
selem->pressure = RNA_float_get(itemptr, "pressure");
}
示例3: ED_view3d_operator_properties_viewmat_get
void ED_view3d_operator_properties_viewmat_get(wmOperator *op, int *winx, int *winy, float persmat[4][4])
{
*winx = RNA_int_get(op->ptr, "region_width");
*winy = RNA_int_get(op->ptr, "region_height");
RNA_float_get_array(op->ptr, "perspective_matrix", (float *)persmat);
}
示例4: create_primitive_from_points
static int create_primitive_from_points(bContext *C, wmOperator *op, const float (*points)[2],
int num_points, char handle_type)
{
ScrArea *sa = CTX_wm_area(C);
Scene *scene = CTX_data_scene(C);
Mask *mask;
MaskLayer *mask_layer;
MaskSpline *new_spline;
float scale, location[2], frame_size[2];
int i, width, height;
int size = RNA_float_get(op->ptr, "size");
ED_mask_get_size(sa, &width, &height);
scale = (float)size / max_ii(width, height);
/* Get location in mask space. */
frame_size[0] = width;
frame_size[1] = height;
RNA_float_get_array(op->ptr, "location", location);
location[0] /= width;
location[1] /= height;
BKE_mask_coord_from_frame(location, location, frame_size);
/* Make it so new primitive is centered to mouse location. */
location[0] -= 0.5f * scale;
location[1] -= 0.5f * scale;
mask_layer = ED_mask_layer_ensure(C);
mask = CTX_data_edit_mask(C);
ED_mask_select_toggle_all(mask, SEL_DESELECT);
new_spline = BKE_mask_spline_add(mask_layer);
new_spline->flag = MASK_SPLINE_CYCLIC | SELECT;
new_spline->tot_point = num_points;
new_spline->points = MEM_recallocN(new_spline->points,
sizeof(MaskSplinePoint) * new_spline->tot_point);
mask_layer->act_spline = new_spline;
mask_layer->act_point = NULL;
for (i = 0; i < num_points; i++) {
MaskSplinePoint *new_point = &new_spline->points[i];
copy_v2_v2(new_point->bezt.vec[1], points[i]);
mul_v2_fl(new_point->bezt.vec[1], scale);
add_v2_v2(new_point->bezt.vec[1], location);
new_point->bezt.h1 = handle_type;
new_point->bezt.h2 = handle_type;
BKE_mask_point_select_set(new_point, true);
}
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
/* TODO: only update this spline */
BKE_mask_update_display(mask, CFRA);
return OPERATOR_FINISHED;
}
示例5: get_node_output_vector
static float3 get_node_output_vector(BL::Node b_node, const string& name)
{
BL::NodeSocket b_sock = get_node_output(b_node, name);
float value[3];
RNA_float_get_array(&b_sock.ptr, "default_value", value);
return make_float3(value[0], value[1], value[2]);
}
示例6: select_exec
static int select_exec(bContext *C, wmOperator *op)
{
float co[2];
bool extend = RNA_boolean_get(op->ptr, "extend");
RNA_float_get_array(op->ptr, "location", co);
return mouse_select(C, co, extend);
}
示例7: drop_color_invoke
static int drop_color_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
ARegion *ar = CTX_wm_region(C);
uiBut *but = NULL;
float color[4];
bool gamma;
RNA_float_get_array(op->ptr, "color", color);
gamma = RNA_boolean_get(op->ptr, "gamma");
/* find button under mouse, check if it has RNA color property and
* if it does copy the data */
but = ui_region_find_active_but(ar);
if (but && but->type == UI_BTYPE_COLOR && but->rnaprop) {
const int color_len = RNA_property_array_length(&but->rnapoin, but->rnaprop);
BLI_assert(color_len <= 4);
/* keep alpha channel as-is */
if (color_len == 4) {
color[3] = RNA_property_float_get_index(&but->rnapoin, but->rnaprop, 3);
}
if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) {
if (!gamma) {
IMB_colormanagement_scene_linear_to_srgb_v3(color);
}
RNA_property_float_set_array(&but->rnapoin, but->rnaprop, color);
RNA_property_update(C, &but->rnapoin, but->rnaprop);
}
else if (RNA_property_subtype(but->rnaprop) == PROP_COLOR) {
if (gamma) {
IMB_colormanagement_srgb_to_scene_linear_v3(color);
}
RNA_property_float_set_array(&but->rnapoin, but->rnaprop, color);
RNA_property_update(C, &but->rnapoin, but->rnaprop);
}
}
else {
if (gamma) {
srgb_to_linearrgb_v3_v3(color, color);
}
ED_imapaint_bucket_fill(C, color, op);
}
ED_region_tag_redraw(ar);
return OPERATOR_FINISHED;
}
示例8: clip_set_2d_cursor_exec
static int clip_set_2d_cursor_exec(bContext *C, wmOperator *op)
{
SpaceClip *sclip = CTX_wm_space_clip(C);
bool show_cursor = false;
show_cursor |= sclip->mode == SC_MODE_MASKEDIT;
show_cursor |= sclip->around == V3D_CURSOR;
if (!show_cursor) {
return OPERATOR_CANCELLED;
}
RNA_float_get_array(op->ptr, "location", sclip->cursor);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CLIP, NULL);
return OPERATOR_FINISHED;
}
示例9: dopesheet_select_channel_exec
static int dopesheet_select_channel_exec(bContext *C, wmOperator *op)
{
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
MovieTrackingObject *object = BKE_tracking_object_get_active(tracking);
MovieTrackingDopesheet *dopesheet = &tracking->dopesheet;
MovieTrackingDopesheetChannel *channel;
ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, object);
float location[2];
const bool extend = RNA_boolean_get(op->ptr, "extend");
int current_channel_index = 0, channel_index;
const bool show_selected_only = (dopesheet->flag & TRACKING_DOPE_SELECTED_ONLY) != 0;
RNA_float_get_array(op->ptr, "location", location);
channel_index = -(location[1] - (CHANNEL_FIRST + CHANNEL_HEIGHT_HALF)) / CHANNEL_STEP;
for (channel = dopesheet->channels.first; channel; channel = channel->next) {
MovieTrackingTrack *track = channel->track;
if (current_channel_index == channel_index) {
if (extend)
track->flag ^= TRACK_DOPE_SEL;
else
track->flag |= TRACK_DOPE_SEL;
if (track->flag & TRACK_DOPE_SEL) {
tracking->act_track = track;
BKE_tracking_track_select(tracksbase, track, TRACK_AREA_ALL, true);
}
else if (show_selected_only == false) {
BKE_tracking_track_deselect(track, TRACK_AREA_ALL);
}
}
else if (!extend)
track->flag &= ~TRACK_DOPE_SEL;
current_channel_index++;
}
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, NULL);
return OPERATOR_FINISHED;
}
示例10: add_feather_vertex_exec
static int add_feather_vertex_exec(bContext *C, wmOperator *op)
{
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *masklay;
MaskSpline *spline;
MaskSplinePoint *point = NULL;
const float threshold = 9;
float co[2], u;
RNA_float_get_array(op->ptr, "location", co);
point = ED_mask_point_find_nearest(C, mask, co, threshold, NULL, NULL, NULL, NULL);
if (point)
return OPERATOR_FINISHED;
if (ED_mask_find_nearest_diff_point(C, mask, co, threshold, true, NULL, true, true,
&masklay, &spline, &point, &u, NULL))
{
Scene *scene = CTX_data_scene(C);
float w = BKE_mask_point_weight(spline, point, u);
float weight_scalar = BKE_mask_point_weight_scalar(spline, point, u);
if (weight_scalar != 0.0f) {
w = w / weight_scalar;
}
BKE_mask_point_add_uw(point, u, w);
BKE_mask_update_display(mask, scene->r.cfra);
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
DAG_id_tag_update(&mask->id, 0);
return OPERATOR_FINISHED;
}
return OPERATOR_CANCELLED;
}
示例11: node_socket_get_vector
void node_socket_get_vector(bNodeTree *ntree, bNode *UNUSED(node), bNodeSocket *sock, float *value)
{
PointerRNA ptr;
RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &ptr);
RNA_float_get_array(&ptr, "default_value", value);
}
示例12: select_exec
static int select_exec(bContext *C, wmOperator *op)
{
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *masklay;
MaskSpline *spline;
MaskSplinePoint *point = NULL;
float co[2];
bool extend = RNA_boolean_get(op->ptr, "extend");
bool deselect = RNA_boolean_get(op->ptr, "deselect");
bool toggle = RNA_boolean_get(op->ptr, "toggle");
eMaskWhichHandle which_handle;
const float threshold = 19;
RNA_float_get_array(op->ptr, "location", co);
point = ED_mask_point_find_nearest(C, mask, co, threshold, &masklay, &spline, &which_handle, NULL);
if (extend == false && deselect == false && toggle == false)
ED_mask_select_toggle_all(mask, SEL_DESELECT);
if (point) {
if (which_handle != MASK_WHICH_HANDLE_NONE) {
if (extend) {
masklay->act_spline = spline;
masklay->act_point = point;
BKE_mask_point_select_set_handle(point, which_handle, true);
}
else if (deselect) {
BKE_mask_point_select_set_handle(point, which_handle, false);
}
else {
masklay->act_spline = spline;
masklay->act_point = point;
if (!MASKPOINT_ISSEL_HANDLE(point, which_handle)) {
BKE_mask_point_select_set_handle(point, which_handle, true);
}
else if (toggle) {
BKE_mask_point_select_set_handle(point, which_handle, false);
}
}
}
else {
if (extend) {
masklay->act_spline = spline;
masklay->act_point = point;
BKE_mask_point_select_set(point, true);
}
else if (deselect) {
BKE_mask_point_select_set(point, false);
}
else {
masklay->act_spline = spline;
masklay->act_point = point;
if (!MASKPOINT_ISSEL_ANY(point)) {
BKE_mask_point_select_set(point, true);
}
else if (toggle) {
BKE_mask_point_select_set(point, false);
}
}
}
masklay->act_spline = spline;
masklay->act_point = point;
ED_mask_select_flush_all(mask);
WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);
return OPERATOR_FINISHED;
}
else {
MaskSplinePointUW *uw;
if (ED_mask_feather_find_nearest(C, mask, co, threshold, &masklay, &spline, &point, &uw, NULL)) {
if (extend) {
masklay->act_spline = spline;
masklay->act_point = point;
if (uw) uw->flag |= SELECT;
}
else if (deselect) {
if (uw) uw->flag &= ~SELECT;
}
else {
masklay->act_spline = spline;
masklay->act_point = point;
if (uw) {
if (!(uw->flag & SELECT)) {
uw->flag |= SELECT;
}
else if (toggle) {
uw->flag &= ~SELECT;
}
//.........这里部分代码省略.........
示例13: add_vertex_exec
static int add_vertex_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
Mask *mask = CTX_data_edit_mask(C);
MaskLayer *masklay;
float co[2];
if (mask == NULL) {
/* if there's no active mask, create one */
mask = ED_mask_new(C, NULL);
}
masklay = BKE_mask_layer_active(mask);
if (masklay && masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
masklay = NULL;
}
RNA_float_get_array(op->ptr, "location", co);
/* TODO, having an active point but no active spline is possible, why? */
if (masklay && masklay->act_spline && masklay->act_point && MASKPOINT_ISSEL_ANY(masklay->act_point)) {
/* cheap trick - double click for cyclic */
MaskSpline *spline = masklay->act_spline;
MaskSplinePoint *point = masklay->act_point;
const bool is_sta = (point == spline->points);
const bool is_end = (point == &spline->points[spline->tot_point - 1]);
/* then check are we overlapping the mouse */
if ((is_sta || is_end) && equals_v2v2(co, point->bezt.vec[1])) {
if (spline->flag & MASK_SPLINE_CYCLIC) {
/* nothing to do */
return OPERATOR_CANCELLED;
}
else {
/* recalc the connecting point as well to make a nice even curve */
MaskSplinePoint *point_other = is_end ? spline->points : &spline->points[spline->tot_point - 1];
spline->flag |= MASK_SPLINE_CYCLIC;
/* TODO, update keyframes in time */
BKE_mask_calc_handle_point_auto(spline, point, false);
BKE_mask_calc_handle_point_auto(spline, point_other, false);
/* TODO: only update this spline */
BKE_mask_update_display(mask, CFRA);
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
return OPERATOR_FINISHED;
}
}
if (!add_vertex_subdivide(C, mask, co)) {
if (!add_vertex_extrude(C, mask, masklay, co)) {
return OPERATOR_CANCELLED;
}
}
}
else {
if (!add_vertex_subdivide(C, mask, co)) {
if (!add_vertex_new(C, mask, masklay, co)) {
return OPERATOR_CANCELLED;
}
}
}
/* TODO: only update this spline */
BKE_mask_update_display(mask, CFRA);
return OPERATOR_FINISHED;
}
示例14: RNA_enum_get
void BlenderSync::get_cam_settings(Camera* cam, PointerRNA &oct_camera, bool view) {
if(!view) {
cam->pan_type = RNA_enum_get(&oct_camera, "pan_mode");
cam->fov_x = RNA_float_get(&oct_camera, "fov_x");
cam->fov_y = RNA_float_get(&oct_camera, "fov_y");
RNA_float_get_array(&oct_camera, "left_filter", reinterpret_cast<float*>(&cam->left_filter));
RNA_float_get_array(&oct_camera, "right_filter", reinterpret_cast<float*>(&cam->right_filter));
cam->aperture = RNA_float_get(&oct_camera, "aperture");
cam->aperture_edge = RNA_float_get(&oct_camera, "aperture_edge");
cam->distortion = RNA_float_get(&oct_camera, "distortion");
cam->autofocus = RNA_boolean_get(&oct_camera, "autofocus");
cam->persp_corr = RNA_boolean_get(&oct_camera, "persp_corr");
cam->stereo_mode = RNA_enum_get(&oct_camera, "stereo_mode");
cam->stereo_out = RNA_enum_get(&oct_camera, "stereo_out");
cam->stereo_dist = RNA_float_get(&oct_camera, "stereo_dist");
cam->stereo_dist_falloff = RNA_float_get(&oct_camera, "stereo_dist_falloff");
cam->postprocess = RNA_boolean_get(&oct_camera, "postprocess");
cam->bloom_power = RNA_float_get(&oct_camera, "bloom_power");
cam->glare_power = RNA_float_get(&oct_camera, "glare_power");
cam->glare_ray_count = RNA_int_get(&oct_camera, "glare_ray_count");
cam->glare_angle = RNA_float_get(&oct_camera, "glare_angle");
cam->glare_blur = RNA_float_get(&oct_camera, "glare_blur");
cam->spectral_intencity = RNA_float_get(&oct_camera, "spectral_intencity");
cam->spectral_shift = RNA_float_get(&oct_camera, "spectral_shift");
cam->pixel_aspect = RNA_float_get(&oct_camera, "pixel_aspect");
cam->aperture_aspect = RNA_float_get(&oct_camera, "aperture_aspect");
cam->keep_upright = RNA_boolean_get(&oct_camera, "keep_upright");
cam->blackout_lat = RNA_float_get(&oct_camera, "blackout_lat");
}
else {
cam->pan_type = 0;
cam->aperture = 0;
cam->aperture_edge = 1.0f;
cam->distortion = 0;
cam->autofocus = true;
cam->persp_corr = false;
cam->postprocess = false;
cam->stereo_mode = 1;
cam->stereo_out = 0;
cam->pixel_aspect = 1.0f;
cam->aperture_aspect = 1.0f;
cam->keep_upright = false;
cam->blackout_lat = 90.0f;
}
RNA_float_get_array(&oct_camera, "white_balance", reinterpret_cast<float*>(&cam->white_balance));
int response_type = RNA_enum_get(&oct_camera, "response_type");
if(response_type >=0 && response_type < 55) cam->response_type = response_type_translation[response_type];
else cam->response_type = Linear;
cam->exposure = RNA_float_get(&oct_camera, "exposure");
cam->gamma = RNA_float_get(&oct_camera, "gamma");
cam->vignetting = RNA_float_get(&oct_camera, "vignetting");
cam->saturation = RNA_float_get(&oct_camera, "saturation");
cam->hot_pix = RNA_float_get(&oct_camera, "hot_pix");
cam->premultiplied_alpha = RNA_boolean_get(&oct_camera, "premultiplied_alpha");
cam->min_display_samples = RNA_int_get(&oct_camera, "min_display_samples");
cam->dithering = RNA_boolean_get(&oct_camera, "dithering");
cam->white_saturation = RNA_float_get(&oct_camera, "white_saturation");
cam->highlight_compression = RNA_float_get(&oct_camera, "highlight_compression");
} //get_cam_settings()