本文整理汇总了C++中RNA_pointer_get函数的典型用法代码示例。如果您正苦于以下问题:C++ RNA_pointer_get函数的具体用法?C++ RNA_pointer_get怎么用?C++ RNA_pointer_get使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RNA_pointer_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RNA_pointer_get
void BlenderSync::sync_background_light()
{
BL::World b_world = b_scene.world();
if(b_world) {
PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles");
bool sample_as_light = get_boolean(cworld, "sample_as_light");
if(sample_as_light) {
/* test if we need to sync */
Light *light;
ObjectKey key(b_world, 0, b_world);
if(light_map.sync(&light, b_world, b_world, key) ||
world_recalc ||
b_world.ptr.data != world_map)
{
light->type = LIGHT_BACKGROUND;
light->map_resolution = get_int(cworld, "sample_map_resolution");
light->shader = scene->default_background;
light->tag_update(scene);
light_map.set_recalc(b_world);
}
}
}
world_map = b_world.ptr.data;
world_recalc = false;
}
示例2: use_scene_camera_cull_
CCL_NAMESPACE_BEGIN
BlenderObjectCulling::BlenderObjectCulling(Scene *scene, BL::Scene& b_scene)
: use_scene_camera_cull_(false),
use_camera_cull_(false),
camera_cull_margin_(0.0f),
use_scene_distance_cull_(false),
use_distance_cull_(false),
distance_cull_margin_(0.0f)
{
if(b_scene.render().use_simplify()) {
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
use_scene_camera_cull_ = scene->camera->type != CAMERA_PANORAMA &&
!b_scene.render().use_multiview() &&
get_boolean(cscene, "use_camera_cull");
use_scene_distance_cull_ = scene->camera->type != CAMERA_PANORAMA &&
!b_scene.render().use_multiview() &&
get_boolean(cscene, "use_distance_cull");
camera_cull_margin_ = get_float(cscene, "camera_cull_margin");
distance_cull_margin_ = get_float(cscene, "distance_cull_margin");
if(distance_cull_margin_ == 0.0f) {
use_scene_distance_cull_ = false;
}
}
}
示例3: RNA_id_pointer_create
void UnitConverter::calculate_scale(Scene &sce)
{
PointerRNA scene_ptr, unit_settings;
PropertyRNA *system_ptr, *scale_ptr;
RNA_id_pointer_create(&sce.id, &scene_ptr);
unit_settings = RNA_pointer_get(&scene_ptr, "unit_settings");
system_ptr = RNA_struct_find_property(&unit_settings, "system");
scale_ptr = RNA_struct_find_property(&unit_settings, "scale_length");
int type = RNA_property_enum_get(&unit_settings, system_ptr);
float bl_scale;
switch (type) {
case USER_UNIT_NONE:
bl_scale = 1.0; // map 1 Blender unit to 1 Meter
break;
case USER_UNIT_METRIC:
bl_scale = RNA_property_float_get(&unit_settings, scale_ptr);
break;
default :
bl_scale = RNA_property_float_get(&unit_settings, scale_ptr);
// it looks like the conversion to Imperial is done implicitly.
// So nothing to do here.
break;
}
float rescale[3];
rescale[0] = rescale[1] = rescale[2] = getLinearMeter() / bl_scale;
size_to_mat4(scale_mat4, rescale);
}
示例4: ShaderGraph
void BlenderSync::sync_world(bool update_all)
{
Background *background = scene->background;
Background prevbackground = *background;
BL::World b_world = b_scene.world();
if(world_recalc || update_all || b_world.ptr.data != world_map) {
Shader *shader = scene->shaders[scene->default_background];
ShaderGraph *graph = new ShaderGraph();
/* create nodes */
if(b_world && b_world.use_nodes() && b_world.node_tree()) {
BL::ShaderNodeTree b_ntree(b_world.node_tree());
add_nodes(scene, b_data, b_scene, graph, b_ntree);
}
else if(b_world) {
ShaderNode *closure, *out;
closure = graph->add(new BackgroundNode());
closure->input("Color")->value = get_float3(b_world.horizon_color());
out = graph->output();
graph->connect(closure->output("Background"), out->input("Surface"));
}
/* AO */
if(b_world) {
BL::WorldLighting b_light = b_world.light_settings();
if(b_light.use_ambient_occlusion())
background->ao_factor = b_light.ao_factor();
else
background->ao_factor = 0.0f;
background->ao_distance = b_light.distance();
}
shader->set_graph(graph);
shader->tag_update(scene);
}
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
/* when doing preview render check for BI's transparency settings,
* this is so because bledner's preview render routines are not able
* to tweak all cycles's settings depending on different circumstances
*/
if(b_engine.is_preview() == false)
background->transparent = get_boolean(cscene, "film_transparent");
else
background->transparent = b_scene.render().alpha_mode() == BL::RenderSettings::alpha_mode_TRANSPARENT;
background->use = render_layer.use_background;
if(background->modified(prevbackground))
background->tag_update(scene);
}
示例5: RNA_pointer_get
void BlenderSync::sync_background_light(bool use_portal)
{
BL::World b_world = b_scene.world();
if (b_world) {
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles");
enum SamplingMethod { SAMPLING_NONE = 0, SAMPLING_AUTOMATIC, SAMPLING_MANUAL, SAMPLING_NUM };
int sampling_method = get_enum(cworld, "sampling_method", SAMPLING_NUM, SAMPLING_AUTOMATIC);
bool sample_as_light = (sampling_method != SAMPLING_NONE);
if (sample_as_light || use_portal) {
/* test if we need to sync */
Light *light;
ObjectKey key(b_world, 0, b_world);
if (light_map.sync(&light, b_world, b_world, key) || world_recalc ||
b_world.ptr.data != world_map) {
light->type = LIGHT_BACKGROUND;
if (sampling_method == SAMPLING_MANUAL) {
light->map_resolution = get_int(cworld, "sample_map_resolution");
}
else {
light->map_resolution = 0;
}
light->shader = scene->default_background;
light->use_mis = sample_as_light;
light->max_bounces = get_int(cworld, "max_bounces");
int samples = get_int(cworld, "samples");
if (get_boolean(cscene, "use_square_samples"))
light->samples = samples * samples;
else
light->samples = samples;
light->tag_update(scene);
light_map.set_recalc(b_world);
}
}
}
world_map = b_world.ptr.data;
world_recalc = false;
}
示例6: blender_camera_init
void BlenderSync::sync_camera(BL::RenderSettings& b_render,
BL::Object& b_override,
int width, int height,
const char *viewname)
{
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");
bcam.motion_position =
(Camera::MotionPosition)get_enum(cscene,
"motion_blur_position",
Camera::MOTION_NUM_POSITIONS,
Camera::MOTION_POSITION_CENTER);
bcam.rolling_shutter_type =
(Camera::RollingShutterType)get_enum(cscene,
"rolling_shutter_type",
Camera::ROLLING_SHUTTER_NUM_TYPES,
Camera::ROLLING_SHUTTER_NONE);
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, bcam.use_spherical_stereo, b_ob_matrix);
bcam.matrix = get_transform(b_ob_matrix);
}
/* sync */
Camera *cam = scene->camera;
blender_camera_sync(cam, &bcam, width, height, viewname);
}
示例7: object_ray_visibility
static uint object_ray_visibility(BL::Object b_ob)
{
PointerRNA cvisibility = RNA_pointer_get(&b_ob.ptr, "cycles_visibility");
uint flag = 0;
flag |= get_boolean(cvisibility, "camera")? PATH_RAY_CAMERA: 0;
flag |= get_boolean(cvisibility, "diffuse")? PATH_RAY_DIFFUSE: 0;
flag |= get_boolean(cvisibility, "glossy")? PATH_RAY_GLOSSY: 0;
flag |= get_boolean(cvisibility, "transmission")? PATH_RAY_TRANSMIT: 0;
flag |= get_boolean(cvisibility, "shadow")? PATH_RAY_SHADOW: 0;
return flag;
}
示例8: create_subd_mesh
static void create_subd_mesh(Scene *scene,
Mesh *mesh,
BL::Object& b_ob,
BL::Mesh& b_mesh,
const vector<Shader*>& used_shaders,
float dicing_rate,
int max_subdivisions)
{
BL::SubsurfModifier subsurf_mod(b_ob.modifiers[b_ob.modifiers.length()-1]);
bool subdivide_uvs = subsurf_mod.use_subsurf_uv();
create_mesh(scene, mesh, b_mesh, used_shaders, true, subdivide_uvs);
/* export creases */
size_t num_creases = 0;
BL::Mesh::edges_iterator e;
for(b_mesh.edges.begin(e); e != b_mesh.edges.end(); ++e) {
if(e->crease() != 0.0f) {
num_creases++;
}
}
mesh->subd_creases.resize(num_creases);
Mesh::SubdEdgeCrease* crease = mesh->subd_creases.data();
for(b_mesh.edges.begin(e); e != b_mesh.edges.end(); ++e) {
if(e->crease() != 0.0f) {
crease->v[0] = e->vertices()[0];
crease->v[1] = e->vertices()[1];
crease->crease = e->crease();
crease++;
}
}
/* set subd params */
if(!mesh->subd_params) {
mesh->subd_params = new SubdParams(mesh);
}
SubdParams& sdparams = *mesh->subd_params;
PointerRNA cobj = RNA_pointer_get(&b_ob.ptr, "cycles");
sdparams.dicing_rate = max(0.1f, RNA_float_get(&cobj, "dicing_rate") * dicing_rate);
sdparams.max_level = max_subdivisions;
scene->camera->update();
sdparams.camera = scene->camera;
sdparams.objecttoworld = get_transform(b_ob.matrix_world());
}
示例9: ShaderGraph
void BlenderSync::sync_world(bool update_all)
{
Background *background = scene->background;
Background prevbackground = *background;
BL::World b_world = b_scene.world();
if(world_recalc || update_all || b_world.ptr.data != world_map) {
Shader *shader = scene->shaders[scene->default_background];
ShaderGraph *graph = new ShaderGraph();
/* create nodes */
if(b_world && b_world.use_nodes() && b_world.node_tree()) {
PtrSockMap sock_to_node;
BL::ShaderNodeTree b_ntree(b_world.node_tree());
add_nodes(scene, b_data, b_scene, graph, b_ntree, sock_to_node);
}
else if(b_world) {
ShaderNode *closure, *out;
closure = graph->add(new BackgroundNode());
closure->input("Color")->value = get_float3(b_world.horizon_color());
out = graph->output();
graph->connect(closure->output("Background"), out->input("Surface"));
}
/* AO */
if(b_world) {
BL::WorldLighting b_light = b_world.light_settings();
if(b_light.use_ambient_occlusion())
background->ao_factor = b_light.ao_factor();
else
background->ao_factor = 0.0f;
background->ao_distance = b_light.distance();
}
shader->set_graph(graph);
shader->tag_update(scene);
}
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
background->transparent = get_boolean(cscene, "film_transparent");
background->use = render_layer.use_background;
if(background->modified(prevbackground))
background->tag_update(scene);
}
示例10: UI_rnaptr_icon_get
int UI_rnaptr_icon_get(bContext *C, PointerRNA *ptr, int rnaicon, const bool big)
{
ID *id = NULL;
if (!ptr->data)
return rnaicon;
/* try ID, material, texture or dynapaint slot */
if (RNA_struct_is_ID(ptr->type)) {
id = ptr->id.data;
}
else if (RNA_struct_is_a(ptr->type, &RNA_MaterialSlot)) {
id = RNA_pointer_get(ptr, "material").data;
}
else if (RNA_struct_is_a(ptr->type, &RNA_TextureSlot)) {
id = RNA_pointer_get(ptr, "texture").data;
}
else if (RNA_struct_is_a(ptr->type, &RNA_DynamicPaintSurface)) {
DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data;
if (surface->format == MOD_DPAINT_SURFACE_F_PTEX)
return ICON_TEXTURE_SHADED;
else if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX)
return ICON_OUTLINER_DATA_MESH;
else if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ)
return ICON_FILE_IMAGE;
}
/* get icon from ID */
if (id) {
int icon = ui_id_icon_get(C, id, big);
return icon ? icon : rnaicon;
}
return rnaicon;
}
示例11: RNA_pointer_get
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Create the Blender session and all Octane session data structures
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void BlenderSession::create_session() {
SessionParams session_params = BlenderSync::get_session_params(b_engine, b_userpref, b_scene, interactive);
session_params.width = width;
session_params.height = height;
BL::RenderSettings r = b_scene.render();
motion_blur = r.use_motion_blur();
shuttertime = r.motion_blur_shutter();
mb_samples = r.motion_blur_samples();
mb_cur_sample = 0;
mb_sample_in_work = 0;
PointerRNA oct_scene = RNA_pointer_get(&b_scene.ptr, "octane");
mb_type = static_cast<MotionBlurType>(RNA_enum_get(&oct_scene, "mb_type"));
mb_direction = static_cast<MotionBlurDirection>(RNA_enum_get(&oct_scene, "mb_direction"));
mb_frame_time_sampling = motion_blur && mb_type == INTERNAL ? 1.0f / session_params.fps : -1.0f;
// Reset status/progress
last_status = "";
last_progress = -1.0f;
// Create session
string cur_path = blender_absolute_path(b_data, b_scene, b_scene.render().filepath().c_str());
cur_path += "/alembic_export.abc";
session = new Session(session_params, cur_path.c_str());
session->set_blender_session(this);
session->set_pause(BlenderSync::get_session_pause_state(b_scene, interactive));
// Create scene
scene = new Scene(session, interactive || !b_engine.is_animation() ? true : (b_scene.frame_current() == b_scene.frame_start()));
session->scene = scene;
scene->server = session->server;
// Create sync
sync = new BlenderSync(b_engine, b_data, b_scene, scene, interactive, session->progress);
if(b_rv3d)
sync->sync_view(b_v3d, b_rv3d, width, height);
else
sync->sync_camera(b_engine.camera_override(), width, height);
// Set buffer parameters
BufferParams buffer_params = BlenderSync::get_display_buffer_params(scene->camera, width, height);
if(interactive || !b_engine.is_animation() || b_scene.frame_current() == b_scene.frame_start())
session->reset(buffer_params, mb_frame_time_sampling);
} //create_session()
示例12: RNA_pointer_get
void BlenderObjectCulling::init_object(Scene *scene, BL::Object& b_ob)
{
if(!use_scene_camera_cull_ && !use_scene_distance_cull_) {
return;
}
PointerRNA cobject = RNA_pointer_get(&b_ob.ptr, "cycles");
use_camera_cull_ = use_scene_camera_cull_ && get_boolean(cobject, "use_camera_cull");
use_distance_cull_ = use_scene_distance_cull_ && get_boolean(cobject, "use_distance_cull");
if(use_camera_cull_ || use_distance_cull_) {
/* Need to have proper projection matrix. */
scene->camera->update(scene);
}
}
示例13: ShaderGraph
void BlenderSync::sync_materials(bool update_all)
{
shader_map.set_default(scene->shaders[scene->default_surface]);
/* material loop */
BL::BlendData::materials_iterator b_mat;
for(b_data.materials.begin(b_mat); b_mat != b_data.materials.end(); ++b_mat) {
Shader *shader;
/* test if we need to sync */
if(shader_map.sync(&shader, *b_mat) || update_all) {
ShaderGraph *graph = new ShaderGraph();
shader->name = b_mat->name().c_str();
shader->pass_id = b_mat->pass_index();
/* create nodes */
if(b_mat->use_nodes() && b_mat->node_tree()) {
BL::ShaderNodeTree b_ntree(b_mat->node_tree());
add_nodes(scene, b_engine, b_data, b_scene, !preview, graph, b_ntree);
}
else {
ShaderNode *closure, *out;
closure = graph->add(new DiffuseBsdfNode());
closure->input("Color")->value = get_float3(b_mat->diffuse_color());
out = graph->output();
graph->connect(closure->output("BSDF"), out->input("Surface"));
}
/* settings */
PointerRNA cmat = RNA_pointer_get(&b_mat->ptr, "cycles");
shader->use_mis = get_boolean(cmat, "sample_as_light");
shader->use_transparent_shadow = get_boolean(cmat, "use_transparent_shadow");
shader->heterogeneous_volume = !get_boolean(cmat, "homogeneous_volume");
shader->volume_sampling_method = (VolumeSampling)RNA_enum_get(&cmat, "volume_sampling");
shader->volume_interpolation_method = (VolumeInterpolation)RNA_enum_get(&cmat, "volume_interpolation");
shader->set_graph(graph);
shader->tag_update(scene);
}
}
}
示例14: RNA_pointer_get
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Set the parent blender session
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Session::set_blender_session(BlenderSession *b_session_) {
if(!b_session_->interactive) b_session = b_session_;
progress.set_blender_session(b_session_);
// Render-server address
PointerRNA oct_scene = RNA_pointer_get(&b_session_->b_scene.ptr, "octane");
string server_addr = get_string(oct_scene, "server_address");
if(!server_addr.length())
fprintf(stderr, "Octane: no server address set.\n");
else {
if(!server->connectToServer(server_addr.c_str())) {
if(server->getFailReason() == ::OctaneEngine::OctaneClient::FailReasons::NOT_ACTIVATED)
fprintf(stdout, "Octane: current server activation state is: not activated.\n");
else if(server->getFailReason() == ::OctaneEngine::OctaneClient::FailReasons::NO_CONNECTION)
fprintf(stderr, "Octane: can't connect to Octane server.\n");
else if(server->getFailReason() == ::OctaneEngine::OctaneClient::FailReasons::WRONG_VERSION)
fprintf(stderr, "Octane: wrong version of Octane server.\n");
else
fprintf(stderr, "Octane: can't connect to Octane server.\n");
}
}
} //set_blender_session()
示例15: CTX_data_main
void DocumentImporter::finish()
{
if (mImportStage != General)
return;
Main *bmain = CTX_data_main(mContext);
// TODO: create a new scene except the selected <visual_scene> - use current blender scene for it
Scene *sce = CTX_data_scene(mContext);
unit_converter.calculate_scale(*sce);
std::vector<Object *> *objects_to_scale = new std::vector<Object *>();
/** TODO Break up and put into 2-pass parsing of DAE */
std::vector<const COLLADAFW::VisualScene *>::iterator it;
for (it = vscenes.begin(); it != vscenes.end(); it++) {
PointerRNA sceneptr, unit_settings;
PropertyRNA *system, *scale;
// for scene unit settings: system, scale_length
RNA_id_pointer_create(&sce->id, &sceneptr);
unit_settings = RNA_pointer_get(&sceneptr, "unit_settings");
system = RNA_struct_find_property(&unit_settings, "system");
scale = RNA_struct_find_property(&unit_settings, "scale_length");
if (this->import_settings->import_units) {
switch (unit_converter.isMetricSystem()) {
case UnitConverter::Metric:
RNA_property_enum_set(&unit_settings, system, USER_UNIT_METRIC);
break;
case UnitConverter::Imperial:
RNA_property_enum_set(&unit_settings, system, USER_UNIT_IMPERIAL);
break;
default:
RNA_property_enum_set(&unit_settings, system, USER_UNIT_NONE);
break;
}
float unit_factor = unit_converter.getLinearMeter();
RNA_property_float_set(&unit_settings, scale, unit_factor);
fprintf(stdout, "Collada: Adjusting Blender units to Importset units: %f.\n", unit_factor);
}
// Write nodes to scene
const COLLADAFW::NodePointerArray& roots = (*it)->getRootNodes();
for (unsigned int i = 0; i < roots.getCount(); i++) {
std::vector<Object *> *objects_done = write_node(roots[i], NULL, sce, NULL, false);
objects_to_scale->insert(objects_to_scale->end(), objects_done->begin(), objects_done->end());
delete objects_done;
}
// update scene
DAG_relations_tag_update(bmain);
WM_event_add_notifier(mContext, NC_OBJECT | ND_TRANSFORM, NULL);
}
mesh_importer.optimize_material_assignements();
armature_importer.set_tags_map(this->uid_tags_map);
armature_importer.make_armatures(mContext);
armature_importer.make_shape_keys();
DAG_relations_tag_update(bmain);
#if 0
armature_importer.fix_animation();
#endif
for (std::vector<const COLLADAFW::VisualScene *>::iterator it = vscenes.begin(); it != vscenes.end(); it++) {
const COLLADAFW::NodePointerArray& roots = (*it)->getRootNodes();
for (unsigned int i = 0; i < roots.getCount(); i++) {
translate_anim_recursive(roots[i], NULL, NULL);
}
}
if (libnode_ob.size()) {
Scene *sce = CTX_data_scene(mContext);
fprintf(stderr, "got %d library nodes to free\n", (int)libnode_ob.size());
// free all library_nodes
std::vector<Object *>::iterator it;
for (it = libnode_ob.begin(); it != libnode_ob.end(); it++) {
Object *ob = *it;
Base *base = BKE_scene_base_find(sce, ob);
if (base) {
BLI_remlink(&sce->base, base);
BKE_libblock_free_us(G.main, base->object);
if (sce->basact == base)
sce->basact = NULL;
MEM_freeN(base);
}
}
libnode_ob.clear();
DAG_relations_tag_update(bmain);
}
//.........这里部分代码省略.........