diff options
author | Ove Murberg Henriksen <sorayasilvermoon@hotmail.com> | 2012-05-07 05:04:52 +0400 |
---|---|---|
committer | Ove Murberg Henriksen <sorayasilvermoon@hotmail.com> | 2012-05-07 05:04:52 +0400 |
commit | bc86c410f773aabeb4526679dd0d4c6aba66e793 (patch) | |
tree | 3cabb83ae23850ef21be311aaa0eb2bd539e7e7d | |
parent | 0fa6acce1969dc6eced98e2940f9582d3f6133e4 (diff) | |
parent | c0331cfc090f218537937294fab0abfecc89e2aa (diff) |
svn merge ^/trunk/blender -r46300:46330
312 files changed, 2935 insertions, 2553 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 43636740e91..fe9b535d373 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1641,6 +1641,7 @@ if(WITH_PYTHON) PATH_SUFFIXES site-packages dist-packages + NO_DEFAULT_PATH ) if(NOT EXISTS "${PYTHON_NUMPY_PATH}") diff --git a/intern/audaspace/intern/AUD_Reference.h b/intern/audaspace/intern/AUD_Reference.h index 0c9f02c0155..5a1aa947148 100644 --- a/intern/audaspace/intern/AUD_Reference.h +++ b/intern/audaspace/intern/AUD_Reference.h @@ -174,8 +174,14 @@ public: std::cerr << "-" << typeid(*m_reference).name() << std::endl; #endif if(AUD_ReferenceHandler::decref(m_original)) + { + pthread_mutex_unlock(AUD_ReferenceHandler::getMutex()); delete m_reference; - pthread_mutex_unlock(AUD_ReferenceHandler::getMutex()); + } + else + { + pthread_mutex_unlock(AUD_ReferenceHandler::getMutex()); + } } /** @@ -194,7 +200,11 @@ public: std::cerr << "-" << typeid(*m_reference).name() << std::endl; #endif if(AUD_ReferenceHandler::decref(m_original)) + { + pthread_mutex_unlock(AUD_ReferenceHandler::getMutex()); delete m_reference; + pthread_mutex_lock(AUD_ReferenceHandler::getMutex()); + } m_original = ref.m_original; m_reference = ref.m_reference; diff --git a/intern/audaspace/intern/AUD_SequencerHandle.cpp b/intern/audaspace/intern/AUD_SequencerHandle.cpp index d13efb9683b..f4bfae6cee7 100644 --- a/intern/audaspace/intern/AUD_SequencerHandle.cpp +++ b/intern/audaspace/intern/AUD_SequencerHandle.cpp @@ -154,6 +154,7 @@ void AUD_SequencerHandle::seek(float position) if(seekpos < 0) seekpos = 0; seekpos += m_entry->m_skip; + m_handle->setPitch(1.0f); m_handle->seek(seekpos); if(position < m_entry->m_begin) m_handle->pause(); diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp index 867cc71bf47..d7003729c46 100644 --- a/intern/cycles/blender/blender_mesh.cpp +++ b/intern/cycles/blender/blender_mesh.cpp @@ -202,7 +202,7 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated) { /* test if we can instance or if the object is modified */ BL::ID b_ob_data = b_ob.data(); - BL::ID key = (object_is_modified(b_ob))? b_ob: b_ob_data; + BL::ID key = (BKE_object_is_modified(b_ob))? b_ob: b_ob_data; BL::Material material_override = render_layer.material_override; /* find shader indices */ @@ -309,7 +309,7 @@ void BlenderSync::sync_mesh_motion(BL::Object b_ob, Mesh *mesh, int motion) /* skip objects without deforming modifiers. this is not a totally reliable, * would need a more extensive check to see which objects are animated */ - if(!size || !ccl::object_is_deform_modified(b_ob, b_scene, preview)) + if(!size || !ccl::BKE_object_is_deform_modified(b_ob, b_scene, preview)) return; /* get derived mesh */ diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index bbf48050222..641aa88d6ef 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -34,10 +34,10 @@ CCL_NAMESPACE_BEGIN /* Utilities */ -bool BlenderSync::object_is_modified(BL::Object b_ob) +bool BlenderSync::BKE_object_is_modified(BL::Object b_ob) { /* test if we can instance or if the object is modified */ - if(ccl::object_is_modified(b_ob, b_scene, preview)) { + if(ccl::BKE_object_is_modified(b_ob, b_scene, preview)) { /* modifiers */ return true; } @@ -286,7 +286,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion) BL::Scene::objects_iterator b_ob; for(b_scene.objects.begin(b_ob); b_ob != b_scene.objects.end(); ++b_ob) { - bool hide = (b_v3d)? b_ob->hide(): b_ob->hide_render(); + bool hide = (render_layer.use_viewport_visibility)? b_ob->hide(): b_ob->hide_render(); uint ob_layer = get_layer(b_ob->layers()); if(!hide && (ob_layer & scene_layer)) { diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index 24cf10bc028..c0b6e210bb1 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -87,7 +87,7 @@ bool BlenderSync::sync_recalc() if(object_is_mesh(*b_ob)) { if(b_ob->is_updated_data() || b_ob->data().is_updated()) { - BL::ID key = object_is_modified(*b_ob)? *b_ob: b_ob->data(); + BL::ID key = BKE_object_is_modified(*b_ob)? *b_ob: b_ob->data(); mesh_map.set_recalc(key); } } @@ -215,6 +215,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer) render_layer.holdout_layer = 0; render_layer.material_override = PointerRNA_NULL; render_layer.use_background = true; + render_layer.use_viewport_visibility = true; render_layer.samples = 0; return; } @@ -234,6 +235,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer) render_layer.layer |= render_layer.holdout_layer; render_layer.material_override = b_rlay->material_override(); render_layer.use_background = b_rlay->use_sky(); + render_layer.use_viewport_visibility = false; render_layer.samples = b_rlay->samples(); } diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h index d6a7218f74f..10afd468850 100644 --- a/intern/cycles/blender/blender_sync.h +++ b/intern/cycles/blender/blender_sync.h @@ -88,7 +88,7 @@ private: /* util */ void find_shader(BL::ID id, vector<uint>& used_shaders, int default_shader); - bool object_is_modified(BL::Object b_ob); + bool BKE_object_is_modified(BL::Object b_ob); bool object_is_mesh(BL::Object b_ob); bool object_is_light(BL::Object b_ob); @@ -113,6 +113,7 @@ private: : scene_layer(0), layer(0), holdout_layer(0), material_override(PointerRNA_NULL), use_background(true), + use_viewport_visibility(false), samples(0) {} @@ -122,6 +123,7 @@ private: uint holdout_layer; BL::Material material_override; bool use_background; + bool use_viewport_visibility; int samples; } render_layer; }; diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index 9184e14bc76..b01fa81ee40 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -91,12 +91,12 @@ static inline void object_free_duplilist(BL::Object self) rna_Object_free_duplilist(self.ptr.data, NULL); } -static inline bool object_is_modified(BL::Object self, BL::Scene scene, bool preview) +static inline bool BKE_object_is_modified(BL::Object self, BL::Scene scene, bool preview) { return rna_Object_is_modified(self.ptr.data, scene.ptr.data, (preview)? (1<<0): (1<<1))? true: false; } -static inline bool object_is_deform_modified(BL::Object self, BL::Scene scene, bool preview) +static inline bool BKE_object_is_deform_modified(BL::Object self, BL::Scene scene, bool preview) { return rna_Object_is_deform_modified(self.ptr.data, scene.ptr.data, (preview)? (1<<0): (1<<1))? true: false; } diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp index d865426304a..28237aea611 100644 --- a/intern/cycles/bvh/bvh_build.cpp +++ b/intern/cycles/bvh/bvh_build.cpp @@ -36,12 +36,12 @@ CCL_NAMESPACE_BEGIN class BVHBuildTask : public Task { public: - BVHBuildTask(InnerNode *node_, int child_, BVHObjectBinning& range_, int level_) - : node(node_), child(child_), level(level_), range(range_) {} + BVHBuildTask(BVHBuild *build, InnerNode *node, int child, BVHObjectBinning& range_, int level) + : range(range_) + { + run = function_bind(&BVHBuild::thread_build_node, build, node, child, &range, level); + } - InnerNode *node; - int child; - int level; BVHObjectBinning range; }; @@ -55,8 +55,7 @@ BVHBuild::BVHBuild(const vector<Object*>& objects_, prim_object(prim_object_), params(params_), progress(progress_), - progress_start_time(0.0), - task_pool(function_bind(&BVHBuild::thread_build_node, this, _1, _2)) + progress_start_time(0.0) { spatial_min_overlap = 0.0f; } @@ -177,7 +176,7 @@ BVHNode* BVHBuild::run() /* multithreaded binning build */ BVHObjectBinning rootbin(root, (references.size())? &references[0]: NULL); rootnode = build_node(rootbin, 0); - task_pool.wait(); + task_pool.wait_work(); } /* delete if we cancelled */ @@ -210,25 +209,24 @@ void BVHBuild::progress_update() progress_start_time = time_dt(); } -void BVHBuild::thread_build_node(Task *task_, int thread_id) +void BVHBuild::thread_build_node(InnerNode *inner, int child, BVHObjectBinning *range, int level) { if(progress.get_cancel()) return; /* build nodes */ - BVHBuildTask *task = (BVHBuildTask*)task_; - BVHNode *node = build_node(task->range, task->level); + BVHNode *node = build_node(*range, level); /* set child in inner node */ - task->node->children[task->child] = node; + inner->children[child] = node; /* update progress */ - if(task->range.size() < THREAD_TASK_SIZE) { + if(range->size() < THREAD_TASK_SIZE) { /*rotate(node, INT_MAX, 5);*/ thread_scoped_lock lock(build_mutex); - progress_count += task->range.size(); + progress_count += range->size(); progress_update(); } } @@ -262,8 +260,8 @@ BVHNode* BVHBuild::build_node(const BVHObjectBinning& range, int level) /* threaded build */ inner = new InnerNode(range.bounds()); - task_pool.push(new BVHBuildTask(inner, 0, left, level + 1), true); - task_pool.push(new BVHBuildTask(inner, 1, right, level + 1), true); + task_pool.push(new BVHBuildTask(this, inner, 0, left, level + 1), true); + task_pool.push(new BVHBuildTask(this, inner, 1, right, level + 1), true); } return inner; diff --git a/intern/cycles/bvh/bvh_build.h b/intern/cycles/bvh/bvh_build.h index 84e14632b4b..44ef918b326 100644 --- a/intern/cycles/bvh/bvh_build.h +++ b/intern/cycles/bvh/bvh_build.h @@ -29,7 +29,9 @@ CCL_NAMESPACE_BEGIN +class BVHBuildTask; class BVHParams; +class InnerNode; class Mesh; class Object; class Progress; @@ -54,6 +56,7 @@ protected: friend class BVHMixedSplit; friend class BVHObjectSplit; friend class BVHSpatialSplit; + friend class BVHBuildTask; /* adding references */ void add_reference_mesh(BoundBox& root, BoundBox& center, Mesh *mesh, int i); @@ -68,7 +71,7 @@ protected: /* threads */ enum { THREAD_TASK_SIZE = 4096 }; - void thread_build_node(Task *task_, int thread_id); + void thread_build_node(InnerNode *node, int child, BVHObjectBinning *range, int level); thread_mutex build_mutex; /* progress */ diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index ec84047c44f..07988d32aff 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -44,7 +44,6 @@ public: KernelGlobals *kg; CPUDevice(int threads_num) - : task_pool(function_bind(&CPUDevice::thread_run, this, _1, _2)) { kg = kernel_globals_create(); @@ -113,10 +112,8 @@ public: #endif } - void thread_run(Task *task_, int thread_id) + void thread_run(DeviceTask *task) { - DeviceTask *task = (DeviceTask*)task_; - if(task->type == DeviceTask::PATH_TRACE) thread_path_trace(*task); else if(task->type == DeviceTask::TONEMAP) @@ -125,6 +122,15 @@ public: thread_shader(*task); } + class CPUDeviceTask : public DeviceTask { + public: + CPUDeviceTask(CPUDevice *device, DeviceTask& task) + : DeviceTask(task) + { + run = function_bind(&CPUDevice::thread_run, device, this); + } + }; + void thread_path_trace(DeviceTask& task) { if(task_pool.cancelled()) @@ -226,12 +232,12 @@ public: task.split(tasks, TaskScheduler::num_threads()*10); foreach(DeviceTask& task, tasks) - task_pool.push(new DeviceTask(task)); + task_pool.push(new CPUDeviceTask(this, task)); } void task_wait() { - task_pool.wait(); + task_pool.wait_work(); } void task_cancel() diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h index e4b10f6151c..aed26f5e852 100644 --- a/intern/cycles/kernel/kernel_camera.h +++ b/intern/cycles/kernel/kernel_camera.h @@ -134,7 +134,20 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa /* Environment Camera */ -__device void camera_sample_environment(KernelGlobals *kg, float raster_x, float raster_y, Ray *ray) +__device float3 panorama_to_direction(KernelGlobals *kg, float u, float v) +{ + switch(kernel_data.cam.panorama_type) { + case PANORAMA_EQUIRECTANGULAR: + return equirectangular_to_direction(u, v); + case PANORAMA_FISHEYE_EQUIDISTANT: + return fisheye_to_direction(u, v, kernel_data.cam.fisheye_fov); + case PANORAMA_FISHEYE_EQUISOLID: + default: + return fisheye_equisolid_to_direction(u, v, kernel_data.cam.fisheye_lens, kernel_data.cam.fisheye_fov, kernel_data.cam.sensorwidth, kernel_data.cam.sensorheight); + } +} + +__device void camera_sample_panorama(KernelGlobals *kg, float raster_x, float raster_y, Ray *ray) { Transform rastertocamera = kernel_data.cam.rastertocamera; float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f)); @@ -143,6 +156,21 @@ __device void camera_sample_environment(KernelGlobals *kg, float raster_x, float ray->P = make_float3(0.0f, 0.0f, 0.0f); ray->D = equirectangular_to_direction(Pcamera.x, Pcamera.y); +#ifdef __CAMERA_CLIPPING__ + /* clipping */ + ray->t = kernel_data.cam.cliplength; +#else + ray->t = FLT_MAX; +#endif + + ray->D = panorama_to_direction(kg, Pcamera.x, Pcamera.y); + + /* indicates ray should not receive any light, outside of the lens */ + if(len_squared(ray->D) == 0.0f) { + ray->t = 0.0f; + return; + } + /* transform ray from camera to world */ Transform cameratoworld = kernel_data.cam.cameratoworld; @@ -161,11 +189,10 @@ __device void camera_sample_environment(KernelGlobals *kg, float raster_x, float ray->dP.dy = make_float3(0.0f, 0.0f, 0.0f); Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x + 1.0f, raster_y, 0.0f)); - ray->dD.dx = normalize(transform_direction(&cameratoworld, equirectangular_to_direction(Pcamera.x, Pcamera.y))) - ray->D; + ray->dD.dx = normalize(transform_direction(&cameratoworld, panorama_to_direction(kg, Pcamera.x, Pcamera.y))) - ray->D; Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y + 1.0f, 0.0f)); - ray->dD.dy = normalize(transform_direction(&cameratoworld, equirectangular_to_direction(Pcamera.x, Pcamera.y))) - ray->D; -#endif + ray->dD.dy = normalize(transform_direction(&cameratoworld, panorama_to_direction(kg, Pcamera.x, Pcamera.y))) - ray->D; #ifdef __CAMERA_CLIPPING__ /* clipping */ diff --git a/intern/cycles/kernel/kernel_montecarlo.h b/intern/cycles/kernel/kernel_montecarlo.h index 68f007cfd97..f51ce263ea2 100644 --- a/intern/cycles/kernel/kernel_montecarlo.h +++ b/intern/cycles/kernel/kernel_montecarlo.h @@ -91,8 +91,8 @@ __device_inline void sample_uniform_hemisphere(const float3 N, float3 *omega_in, float *pdf) { float z = randu; - float r = sqrtf(max(0.f, 1.f - z*z)); - float phi = 2.f * M_PI_F * randv; + float r = sqrtf(max(0.0f, 1.0f - z*z)); + float phi = 2.0f * M_PI_F * randv; float x = r * cosf(phi); float y = r * sinf(phi); @@ -224,6 +224,53 @@ __device float3 equirectangular_to_direction(float u, float v) cos(theta)); } +/* Fisheye <- Cartesian direction */ + +__device float3 fisheye_to_direction(float u, float v, float fov) +{ + u = (u - 0.5f) * 2.0f; + v = (v - 0.5f) * 2.0f; + + float r = sqrt(u*u + v*v); + + if(r > 1.0f) + return make_float3(0.0f, 0.0f, 0.0f); + + float phi = acosf((r != 0.0f)? u/r: 0.0f); + float theta = asinf(r) * (fov / M_PI_F); + + if(v < 0.0f) phi = -phi; + + return make_float3( + cosf(theta), + -cosf(phi)*sinf(theta), + sinf(phi)*sinf(theta) + ); +} + +__device float3 fisheye_equisolid_to_direction(float u, float v, float lens, float fov, float width, float height) +{ + u = (u - 0.5f) * width; + v = (v - 0.5f) * height; + + float rmax = 2.0f * lens * sinf(fov * 0.25f); + float r = sqrt(u*u + v*v); + + if(r > rmax) + return make_float3(0.0f, 0.0f, 0.0f); + + float phi = acosf((r != 0.0f)? u/r: 0.0f); + float theta = 2.0f * asinf(r/(2.0f * lens)); + + if(v < 0.0f) phi = -phi; + + return make_float3( + cosf(theta), + -cosf(phi)*sinf(theta), + sinf(phi)*sinf(theta) + ); +} + /* Mirror Ball <-> Cartesion direction */ __device float3 mirrorball_to_direction(float u, float v) diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index 78b8f06c7b4..3e6052338c0 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -324,8 +324,10 @@ bool ImageManager::file_load_float_image(Image *img, device_vector<float4>& tex_ return true; } -void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int slot) +void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int slot, Progress *progress) { + if(progress->get_cancel()) + return; if(osl_texture_system) return; @@ -342,6 +344,9 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int sl } if(is_float) { + string filename = path_filename(float_images[slot]->filename); + progress->set_status("Updating Images", "Loading " + filename); + device_vector<float4>& tex_img = dscene->tex_float_image[slot - TEX_IMAGE_FLOAT_START]; if(tex_img.device_pointer) @@ -365,6 +370,9 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int sl device->tex_alloc(name.c_str(), tex_img, true, true); } else { + string filename = path_filename(images[slot]->filename); + progress->set_status("Updating Images", "Loading " + filename); + device_vector<uchar4>& tex_img = dscene->tex_image[slot]; if(tex_img.device_pointer) @@ -387,6 +395,8 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int sl device->tex_alloc(name.c_str(), tex_img, true, true); } + + img->need_load = false; } void ImageManager::device_free_image(Device *device, DeviceScene *dscene, int slot) @@ -431,39 +441,37 @@ void ImageManager::device_update(Device *device, DeviceScene *dscene, Progress& { if(!need_update) return; + + TaskPool pool; for(size_t slot = 0; slot < images.size(); slot++) { - if(images[slot]) { - if(images[slot]->users == 0) { - device_free_image(device, dscene, slot); - } - else if(images[slot]->need_load) { - string name = path_filename(images[slot]->filename); - progress.set_status("Updating Images", "Loading " + name); - device_load_image(device, dscene, slot); - images[slot]->need_load = false; - } + if(!images[slot]) + continue; - if(progress.get_cancel()) return; + if(images[slot]->users == 0) { + device_free_image(device, dscene, slot); + } + else if(images[slot]->need_load) { + if(!osl_texture_system) + pool.push(function_bind(&ImageManager::device_load_image, this, device, dscene, slot, &progress)); } } for(size_t slot = 0; slot < float_images.size(); slot++) { - if(float_images[slot]) { - if(float_images[slot]->users == 0) { - device_free_image(device, dscene, slot + TEX_IMAGE_FLOAT_START); - } - else if(float_images[slot]->need_load) { - string name = path_filename(float_images[slot]->filename); - progress.set_status("Updating Images", "Loading " + name); - device_load_image(device, dscene, slot + TEX_IMAGE_FLOAT_START); - float_images[slot]->need_load = false; - } + if(!float_images[slot]) + continue; - if(progress.get_cancel()) return; + if(float_images[slot]->users == 0) { + device_free_image(device, dscene, slot + TEX_IMAGE_FLOAT_START); + } + else if(float_images[slot]->need_load) { + if(!osl_texture_system) + pool.push(function_bind(&ImageManager::device_load_image, this, device, dscene, slot + TEX_IMAGE_FLOAT_START, &progress)); } } + pool.wait_work(); + need_update = false; } diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h index d789e6885e3..cc01b4a8e4c 100644 --- a/intern/cycles/render/image.h +++ b/intern/cycles/render/image.h @@ -65,7 +65,7 @@ private: bool file_load_image(Image *img, device_vector<uchar4>& tex_img); bool file_load_float_image(Image *img, device_vector<float4>& tex_img); - void device_load_image(Device *device, DeviceScene *dscene, int slot); + void device_load_image(Device *device, DeviceScene *dscene, int slot, Progress *progess); void device_free_image(Device *device, DeviceScene *dscene, int slot); }; diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index 5d96611ff26..0422f97a706 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -242,31 +242,47 @@ void Mesh::pack_verts(float4 *tri_verts, float4 *tri_vindex, size_t vert_offset) } } -void Mesh::compute_bvh(SceneParams *params, Progress& progress) +void Mesh::compute_bvh(SceneParams *params, Progress *progress, int n, int total) { - Object object; - object.mesh = this; + if(progress->get_cancel()) + return; - vector<Object*> objects; - objects.push_back(&object); + compute_bounds(); - if(bvh && !need_update_rebuild) { - progress.set_substatus("Refitting BVH"); - bvh->objects = objects; - bvh->refit(progress); - } - else { - progress.set_substatus("Building BVH"); + if(!transform_applied) { + string msg = "Updating Mesh BVH "; + if(name == "") + msg += string_printf("%u/%u", (uint)(n+1), (uint)total); + else + msg += string_printf("%s %u/%u", name.c_str(), (uint)(n+1), (uint)total); + + Object object; + object.mesh = this; + + vector<Object*> objects; + objects.push_back(&object); - BVHParams bparams; - bparams.use_cache = params->use_bvh_cache; - bparams.use_spatial_split = params->use_bvh_spatial_split; - bparams.use_qbvh = params->use_qbvh; + if(bvh && !need_update_rebuild) { + progress->set_status(msg, "Refitting BVH"); + bvh->objects = objects; + bvh->refit(*progress); + } + else { + progress->set_status(msg, "Building BVH"); + + BVHParams bparams; + bparams.use_cache = params->use_bvh_cache; + bparams.use_spatial_split = params->use_bvh_spatial_split; + bparams.use_qbvh = params->use_qbvh; - delete bvh; - bvh = BVH::create(bparams, objects); - bvh->build(progress); + delete bvh; + bvh = BVH::create(bparams, objects); + bvh->build(*progress); + } } + + need_update = false; + need_update_rebuild = false; } void Mesh::tag_update(Scene *scene, bool rebuild) @@ -686,35 +702,22 @@ void MeshManager::device_update(Device *device, DeviceScene *dscene, Scene *scen } /* update bvh */ - size_t i = 0, num_instance_bvh = 0; + size_t i = 0, num_bvh = 0; foreach(Mesh *mesh, scene->meshes) if(mesh->need_update && !mesh->transform_applied) - num_instance_bvh++; + num_bvh++; + + TaskPool pool; foreach(Mesh *mesh, scene->meshes) { if(mesh->need_update) { - mesh->compute_bounds(); - - if(!mesh->transform_applied) { - string msg = "Updating Mesh BVH "; - if(mesh->name == "") - msg += string_printf("%u/%u", (uint)(i+1), (uint)num_instance_bvh); - else - msg += string_printf("%s %u/%u", mesh->name.c_str(), (uint)(i+1), (uint)num_instance_bvh); - progress.set_status(msg, "Building BVH"); - - mesh->compute_bvh(&scene->params, progress); - - i++; - } - - if(progress.get_cancel()) return; - - mesh->need_update = false; - mesh->need_update_rebuild = false; + pool.push(function_bind(&Mesh::compute_bvh, mesh, &scene->params, &progress, i, num_bvh)); + i++; } } + + pool.wait_work(); foreach(Shader *shader, scene->shaders) shader->need_update_attributes = false; diff --git a/intern/cycles/render/mesh.h b/intern/cycles/render/mesh.h index 047a2d2624d..637143f5adf 100644 --- a/intern/cycles/render/mesh.h +++ b/intern/cycles/render/mesh.h @@ -96,7 +96,7 @@ public: void pack_normals(Scene *scene, float4 *normal, float4 *vnormal); void pack_verts(float4 *tri_verts, float4 *tri_vindex, size_t vert_offset); - void compute_bvh(SceneParams *params, Progress& progress); + void compute_bvh(SceneParams *params, Progress *progress, int n, int total); bool need_attribute(Scene *scene, AttributeStandard std); bool need_attribute(Scene *scene, ustring name); diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index ca6da539884..8070b60126a 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -377,6 +377,11 @@ class VIEW3D_MT_view_align(Menu): layout.operator("view3d.view_selected") layout.operator("view3d.view_center_cursor") + layout.separator() + + layout.operator("view3d.view_lock_to_active") + layout.operator("view3d.view_lock_clear") + class VIEW3D_MT_view_align_selected(Menu): bl_label = "Align View to Selected" @@ -1152,7 +1157,7 @@ class VIEW3D_MT_vertex_group(Menu): if ob.mode == 'EDIT' or (ob.mode == 'WEIGHT_PAINT' and ob.type == 'MESH' and ob.data.use_paint_mask_vertex): if ob.vertex_groups.active: layout.separator() - layout.operator("object.vertex_group_assign", text="Assign to Active Group") + layout.operator("object.vertex_group_assign", text="Assign to Active Group").new = False layout.operator("object.vertex_group_remove_from", text="Remove from Active Group").all = False layout.operator("object.vertex_group_remove_from", text="Remove from All").all = True layout.separator() diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 564cd235869..a326b514f9a 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -59,13 +59,13 @@ extern "C" { struct bAction *add_empty_action(const char name[]); /* Allocate a copy of the given Action and all its data */ -struct bAction *copy_action(struct bAction *src); +struct bAction *BKE_action_copy(struct bAction *src); /* Deallocate all of the Action's data, but not the Action itself */ -void free_action(struct bAction *act); +void BKE_action_free(struct bAction *act); // XXX is this needed? -void make_local_action(struct bAction *act); +void BKE_action_make_local(struct bAction *act); /* Action API ----------------- */ @@ -122,7 +122,7 @@ void action_groups_add_channel(struct bAction *act, struct bActionGroup *agrp, s void action_groups_remove_channel(struct bAction *act, struct FCurve *fcu); /* Find a group with the given name */ -struct bActionGroup *action_groups_find_named(struct bAction *act, const char name[]); +struct bActionGroup *BKE_action_group_find_name(struct bAction *act, const char name[]); /* Clear all 'temp' flags on all groups */ void action_groups_clear_tempflags(struct bAction *act); @@ -133,71 +133,71 @@ void action_groups_clear_tempflags(struct bAction *act); * Deallocates a pose channel. * Does not free the pose channel itself. */ -void free_pose_channel(struct bPoseChannel *pchan); +void BKE_pose_channel_free(struct bPoseChannel *pchan); /** * Removes and deallocates all channels from a pose. * Does not free the pose itself. */ -void free_pose_channels(struct bPose *pose); +void BKE_pose_channels_free(struct bPose *pose); /** * Removes the hash for quick lookup of channels, must * be done when adding/removing channels. */ -void make_pose_channels_hash(struct bPose *pose); -void free_pose_channels_hash(struct bPose *pose); +void BKE_pose_channels_hash_make(struct bPose *pose); +void BKE_pose_channels_hash_free(struct bPose *pose); /** * Removes and deallocates all data from a pose, and also frees the pose. */ -void free_pose(struct bPose *pose); +void BKE_pose_free(struct bPose *pose); /** * Allocate a new pose on the heap, and copy the src pose and it's channels * into the new pose. *dst is set to the newly allocated structure, and assumed to be NULL. */ -void copy_pose(struct bPose **dst, struct bPose *src, int copyconstraints); +void BKE_pose_copy_data(struct bPose **dst, struct bPose *src, int copyconstraints); /** * Copy the internal members of each pose channel including constraints * and ID-Props, used when duplicating bones in editmode. */ -void duplicate_pose_channel_data(struct bPoseChannel *pchan, const struct bPoseChannel *pchan_from); +void BKE_pose_channel_copy_data(struct bPoseChannel *pchan, const struct bPoseChannel *pchan_from); /** * Return a pointer to the pose channel of the given name * from this pose. */ -struct bPoseChannel *get_pose_channel(const struct bPose *pose, const char *name); +struct bPoseChannel *BKE_pose_channel_find_name(const struct bPose *pose, const char *name); /** * Return a pointer to the active pose channel from this Object. * (Note: Object, not bPose is used here, as we need layer info from Armature) */ -struct bPoseChannel *get_active_posechannel(struct Object *ob); +struct bPoseChannel *BKE_pose_channel_active(struct Object *ob); /** * Looks to see if the channel with the given name * already exists in this pose - if not a new one is * allocated and initialized. */ -struct bPoseChannel *verify_pose_channel(struct bPose* pose, const char* name); +struct bPoseChannel *BKE_pose_channel_verify(struct bPose* pose, const char* name); /* Copy the data from the action-pose (src) into the pose */ void extract_pose_from_pose(struct bPose *pose, const struct bPose *src); /* sets constraint flags */ -void update_pose_constraint_flags(struct bPose *pose); +void BKE_pose_update_constraint_flags(struct bPose *pose); /* return the name of structure pointed by pose->ikparam */ -const char *get_ikparam_name(struct bPose *pose); +const char *BKE_pose_ikparam_get_name(struct bPose *pose); /* allocate and initialize pose->ikparam according to pose->iksolver */ -void init_pose_ikparam(struct bPose *pose); +void BKE_pose_ikparam_init(struct bPose *pose); /* initialize a bItasc structure with default value */ -void init_pose_itasc(struct bItasc *itasc); +void BKE_pose_itasc_init(struct bItasc *itasc); /* clears BONE_UNKEYED flags for frame changing */ // XXX to be depreceated for a more general solution in animsys... @@ -206,10 +206,10 @@ void framechange_poses_clear_unkeyed(void); /* Bone Groups API --------------------- */ /* Adds a new bone-group */ -void pose_add_group(struct Object *ob); +void BKE_pose_add_group(struct Object *ob); /* Remove the active bone-group */ -void pose_remove_group(struct Object *ob); +void BKE_pose_remove_group(struct Object *ob); /* Assorted Evaluation ----------------- */ @@ -217,9 +217,9 @@ void pose_remove_group(struct Object *ob); void what_does_obaction(struct Object *ob, struct Object *workob, struct bPose *pose, struct bAction *act, char groupname[], float cframe); /* for proxy */ -void copy_pose_result(struct bPose *to, struct bPose *from); +void BKE_pose_copy_result(struct bPose *to, struct bPose *from); /* clear all transforms */ -void rest_pose(struct bPose *pose); +void BKE_pose_rest(struct bPose *pose); #ifdef __cplusplus }; diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index dfe3fde17eb..b8c2c42f8d5 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -75,28 +75,28 @@ typedef struct PoseTree extern "C" { #endif -struct bArmature *add_armature(const char *name); -struct bArmature *get_armature(struct Object *ob); -void free_bonelist (struct ListBase *lb); -void free_armature(struct bArmature *arm); -void make_local_armature(struct bArmature *arm); -struct bArmature *copy_armature(struct bArmature *arm); +struct bArmature *BKE_armature_add(const char *name); +struct bArmature *BKE_armature_from_object(struct Object *ob); +void BKE_armature_bonelist_free (struct ListBase *lb); +void BKE_armature_free(struct bArmature *arm); +void BKE_armature_make_local(struct bArmature *arm); +struct bArmature *BKE_armature_copy(struct bArmature *arm); /* Bounding box. */ -struct BoundBox *BKE_armature_get_bb(struct Object *ob); +struct BoundBox *BKE_armature_boundbox_get(struct Object *ob); int bone_autoside_name (char name[64], int strip_number, short axis, float head, float tail); -struct Bone *get_named_bone (struct bArmature *arm, const char *name); +struct Bone *BKE_armature_find_bone_name (struct bArmature *arm, const char *name); float distfactor_to_bone(const float vec[3], const float b1[3], const float b2[3], float r1, float r2, float rdist); -void where_is_armature (struct bArmature *arm); -void where_is_armature_bone(struct Bone *bone, struct Bone *prevbone); -void armature_rebuild_pose(struct Object *ob, struct bArmature *arm); -void where_is_pose (struct Scene *scene, struct Object *ob); -void where_is_pose_bone(struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime, int do_extra); -void where_is_pose_bone_tail(struct bPoseChannel *pchan); +void BKE_armature_where_is(struct bArmature *arm); +void BKE_armature_where_is_bone(struct Bone *bone, struct Bone *prevbone); +void BKE_pose_rebuild(struct Object *ob, struct bArmature *arm); +void BKE_pose_where_is(struct Scene *scene, struct Object *ob); +void BKE_pose_where_is_bone(struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime, int do_extra); +void BKE_pose_where_is_bone_tail(struct bPoseChannel *pchan); /* get_objectspace_bone_matrix has to be removed still */ void get_objectspace_bone_matrix (struct Bone* bone, float M_accumulatedMatrix[][4], int root, int posed); @@ -106,23 +106,23 @@ void mat3_to_vec_roll(float mat[][3], float *vec, float *roll); int get_selected_defgroups(struct Object *ob, char *defbase_sel, int defbase_len); /* Common Conversions Between Co-ordinate Spaces */ -void armature_mat_world_to_pose(struct Object *ob, float inmat[][4], float outmat[][4]); -void armature_loc_world_to_pose(struct Object *ob, const float inloc[3], float outloc[3]); -void armature_mat_pose_to_bone(struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]); -void armature_loc_pose_to_bone(struct bPoseChannel *pchan, const float inloc[3], float outloc[3]); -void armature_mat_bone_to_pose(struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]); -void armature_mat_pose_to_delta(float delta_mat[][4], float pose_mat[][4], float arm_mat[][4]); +void BKE_armature_mat_world_to_pose(struct Object *ob, float inmat[][4], float outmat[][4]); +void BKE_armature_loc_world_to_pose(struct Object *ob, const float inloc[3], float outloc[3]); +void BKE_armature_mat_pose_to_bone(struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]); +void BKE_armature_loc_pose_to_bone(struct bPoseChannel *pchan, const float inloc[3], float outloc[3]); +void BKE_armature_mat_bone_to_pose(struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]); +void BKE_armature_mat_pose_to_delta(float delta_mat[][4], float pose_mat[][4], float arm_mat[][4]); -void armature_mat_pose_to_bone_ex(struct Object *ob, struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]); +void BKE_armature_mat_pose_to_bone_ex(struct Object *ob, struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]); -void pchan_mat3_to_rot(struct bPoseChannel *pchan, float mat[][3], short use_compat); -void pchan_apply_mat4(struct bPoseChannel *pchan, float mat[][4], short use_comat); -void pchan_to_mat4(struct bPoseChannel *pchan, float chan_mat[4][4]); -void pchan_calc_mat(struct bPoseChannel *pchan); +void BKE_pchan_mat3_to_rot(struct bPoseChannel *pchan, float mat[][3], short use_compat); +void BKE_pchan_apply_mat4(struct bPoseChannel *pchan, float mat[][4], short use_comat); +void BKE_pchan_to_mat4(struct bPoseChannel *pchan, float chan_mat[4][4]); +void BKE_pchan_calc_mat(struct bPoseChannel *pchan); /* Get the "pchan to pose" transform matrix. These matrices apply the effects of * HINGE/NO_SCALE/NO_LOCAL_LOCATION options over the pchan loc/rot/scale transformations. */ -void pchan_to_pose_mat(struct bPoseChannel *pchan, float rotscale_mat[][4], float loc_mat[][4]); +void BKE_pchan_to_pose_mat(struct bPoseChannel *pchan, float rotscale_mat[][4], float loc_mat[][4]); /* Rotation Mode Conversions - Used for PoseChannels + Objects... */ void BKE_rotMode_change_values(float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode); diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index 52666ca1538..b5edc8f3e50 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -41,34 +41,34 @@ struct wmOperator; // enum CurveMappingPreset; /* datablock functions */ -struct Brush *add_brush(const char *name); -struct Brush *copy_brush(struct Brush *brush); -void make_local_brush(struct Brush *brush); -void free_brush(struct Brush *brush); +struct Brush *BKE_brush_add(const char *name); +struct Brush *BKE_brush_copy(struct Brush *brush); +void BKE_brush_make_local(struct Brush *brush); +void BKE_brush_free(struct Brush *brush); -void brush_reset_sculpt(struct Brush *brush); +void BKE_brush_sculpt_reset(struct Brush *brush); /* image icon function */ struct ImBuf *get_brush_icon(struct Brush *brush); /* brush library operations used by different paint panels */ -int brush_texture_set_nr(struct Brush *brush, int nr); -int brush_texture_delete(struct Brush *brush); -int brush_clone_image_set_nr(struct Brush *brush, int nr); -int brush_clone_image_delete(struct Brush *brush); +int BKE_brush_texture_set_nr(struct Brush *brush, int nr); +int BKE_brush_texture_delete(struct Brush *brush); +int BKE_brush_clone_image_set_nr(struct Brush *brush, int nr); +int BKE_brush_clone_image_delete(struct Brush *brush); /* jitter */ -void brush_jitter_pos(const struct Scene *scene, struct Brush *brush, +void BKE_brush_jitter_pos(const struct Scene *scene, struct Brush *brush, const float pos[2], float jitterpos[2]); /* brush curve */ -void brush_curve_preset(struct Brush *b, /*enum CurveMappingPreset*/int preset); -float brush_curve_strength_clamp(struct Brush *br, float p, const float len); -float brush_curve_strength(struct Brush *br, float p, const float len); /* used for sculpt */ +void BKE_brush_curve_preset(struct Brush *b, /*enum CurveMappingPreset*/int preset); +float BKE_brush_curve_strength_clamp(struct Brush *br, float p, const float len); +float BKE_brush_curve_strength(struct Brush *br, float p, const float len); /* used for sculpt */ /* sampling */ -void brush_sample_tex(const struct Scene *scene, struct Brush *brush, const float xy[2], float rgba[4], const int thread); -void brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt, short texfalloff, int size, +void BKE_brush_sample_tex(const struct Scene *scene, struct Brush *brush, const float xy[2], float rgba[4], const int thread); +void BKE_brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt, short texfalloff, int size, struct ImBuf **imbuf, int use_color_correction); /* painting */ @@ -76,48 +76,48 @@ struct BrushPainter; typedef struct BrushPainter BrushPainter; typedef int (*BrushFunc)(void *user, struct ImBuf *ibuf, const float lastpos[2], const float pos[2]); -BrushPainter *brush_painter_new(struct Scene *scene, struct Brush *brush); -void brush_painter_require_imbuf(BrushPainter *painter, short flt, +BrushPainter *BKE_brush_painter_new(struct Scene *scene, struct Brush *brush); +void BKE_brush_painter_require_imbuf(BrushPainter *painter, short flt, short texonly, int size); -int brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2], +int BKE_brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2], double time, float pressure, void *user, int use_color_correction); -void brush_painter_break_stroke(BrushPainter *painter); -void brush_painter_free(BrushPainter *painter); +void BKE_brush_painter_break_stroke(BrushPainter *painter); +void BKE_brush_painter_free(BrushPainter *painter); /* texture */ -unsigned int *brush_gen_texture_cache(struct Brush *br, int half_side); +unsigned int *BKE_brush_gen_texture_cache(struct Brush *br, int half_side); /* radial control */ -struct ImBuf *brush_gen_radial_control_imbuf(struct Brush *br); +struct ImBuf *BKE_brush_gen_radial_control_imbuf(struct Brush *br); /* unified strength and size */ -int brush_size(const struct Scene *scene, struct Brush *brush); -void brush_set_size(struct Scene *scene, struct Brush *brush, int value); +int BKE_brush_size_get(const struct Scene *scene, struct Brush *brush); +void BKE_brush_size_set(struct Scene *scene, struct Brush *brush, int value); -float brush_unprojected_radius(const struct Scene *scene, struct Brush *brush); -void brush_set_unprojected_radius(struct Scene *scene, struct Brush *brush, float value); +float BKE_brush_unprojected_radius_get(const struct Scene *scene, struct Brush *brush); +void BKE_brush_unprojected_radius_set(struct Scene *scene, struct Brush *brush, float value); -float brush_alpha(const struct Scene *scene, struct Brush *brush); -float brush_weight(const Scene *scene, struct Brush *brush); -void brush_set_weight(const Scene *scene, struct Brush *brush, float value); +float BKE_brush_alpha_get(const struct Scene *scene, struct Brush *brush); +float BKE_brush_weight_get(const Scene *scene, struct Brush *brush); +void BKE_brush_weight_set(const Scene *scene, struct Brush *brush, float value); -int brush_use_locked_size(const struct Scene *scene, struct Brush *brush); -int brush_use_alpha_pressure(const struct Scene *scene, struct Brush *brush); -int brush_use_size_pressure(const struct Scene *scene, struct Brush *brush); +int BKE_brush_use_locked_size(const struct Scene *scene, struct Brush *brush); +int BKE_brush_use_alpha_pressure(const struct Scene *scene, struct Brush *brush); +int BKE_brush_use_size_pressure(const struct Scene *scene, struct Brush *brush); /* scale unprojected radius to reflect a change in the brush's 2D size */ -void brush_scale_unprojected_radius(float *unprojected_radius, +void BKE_brush_scale_unprojected_radius(float *unprojected_radius, int new_brush_size, int old_brush_size); /* scale brush size to reflect a change in the brush's unprojected radius */ -void brush_scale_size(int *brush_size, +void BKE_brush_scale_size(int *BKE_brush_size_get, float new_unprojected_radius, float old_unprojected_radius); /* debugging only */ -void brush_debug_print_state(struct Brush *br); +void BKE_brush_debug_print_state(struct Brush *br); #endif diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h index 6d10219e74c..8f68d7abcac 100644 --- a/source/blender/blenkernel/BKE_camera.h +++ b/source/blender/blenkernel/BKE_camera.h @@ -48,18 +48,18 @@ struct View3D; /* Camera Datablock */ -void *add_camera(const char *name); -struct Camera *copy_camera(struct Camera *cam); -void make_local_camera(struct Camera *cam); -void free_camera(struct Camera *ca); +void *BKE_camera_add(const char *name); +struct Camera *BKE_camera_copy(struct Camera *cam); +void BKE_camera_make_local(struct Camera *cam); +void BKE_camera_free(struct Camera *ca); /* Camera Usage */ -float object_camera_dof_distance(struct Object *ob); -void object_camera_mode(struct RenderData *rd, struct Object *ob); +float BKE_camera_object_dof_distance(struct Object *ob); +void BKE_camera_object_mode(struct RenderData *rd, struct Object *ob); -int camera_sensor_fit(int sensor_fit, float sizex, float sizey); -float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y); +int BKE_camera_sensor_fit(int sensor_fit, float sizex, float sizey); +float BKE_camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y); /* Camera Parameters: * @@ -102,21 +102,21 @@ typedef struct CameraParams { float winmat[4][4]; } CameraParams; -void camera_params_init(CameraParams *params); -void camera_params_from_object(CameraParams *params, struct Object *camera); -void camera_params_from_view3d(CameraParams *params, struct View3D *v3d, struct RegionView3D *rv3d); +void BKE_camera_params_init(CameraParams *params); +void BKE_camera_params_from_object(CameraParams *params, struct Object *camera); +void BKE_camera_params_from_view3d(CameraParams *params, struct View3D *v3d, struct RegionView3D *rv3d); -void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float aspx, float aspy); -void camera_params_compute_matrix(CameraParams *params); +void BKE_camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float aspx, float aspy); +void BKE_camera_params_compute_matrix(CameraParams *params); /* Camera View Frame */ -void camera_view_frame_ex(struct Scene *scene, struct Camera *camera, float drawsize, const short do_clip, const float scale[3], +void BKE_camera_view_frame_ex(struct Scene *scene, struct Camera *camera, float drawsize, const short do_clip, const float scale[3], float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3]); -void camera_view_frame(struct Scene *scene, struct Camera *camera, float r_vec[4][3]); +void BKE_camera_view_frame(struct Scene *scene, struct Camera *camera, float r_vec[4][3]); -int camera_view_frame_fit_to_scene( +int BKE_camera_view_frame_fit_to_scene( struct Scene *scene, struct View3D *v3d, struct Object *camera_ob, float r_co[3]); diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h index f834ad5e774..b12ab538184 100644 --- a/source/blender/blenkernel/BKE_constraint.h +++ b/source/blender/blenkernel/BKE_constraint.h @@ -62,7 +62,7 @@ typedef struct bConstraintOb { /* ---------------------------------------------------------------------------- */ /* Callback format for performing operations on ID-pointers for Constraints */ -typedef void (*ConstraintIDFunc)(struct bConstraint *con, struct ID **idpoin, void *userdata); +typedef void (*ConstraintIDFunc)(struct bConstraint *con, struct ID **idpoin, short isReference, void *userdata); /* ....... */ diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h index 16e98f25e0c..6636a70e94d 100644 --- a/source/blender/blenkernel/BKE_font.h +++ b/source/blender/blenkernel/BKE_font.h @@ -71,17 +71,17 @@ typedef struct EditFont { } EditFont; -void BKE_font_register_builtin(void *mem, int size); +void BKE_vfont_builtin_register(void *mem, int size); -void free_vfont(struct VFont *sc); -void free_ttfont(void); -struct VFont *get_builtin_font(void); -struct VFont *load_vfont(struct Main *bmain, const char *name); -struct TmpFont *vfont_find_tmpfont(struct VFont *vfont); +void BKE_vfont_free(struct VFont *sc); +void BKE_vfont_free_global_ttf(void); +struct VFont *BKE_vfont_builtin_get(void); +struct VFont *BKE_vfont_load(struct Main *bmain, const char *name); +struct TmpFont *BKE_vfont_find_tmpfont(struct VFont *vfont); -struct chartrans *BKE_text_to_curve(struct Main *bmain, struct Scene *scene, struct Object *ob, int mode); +struct chartrans *BKE_vfont_to_curve(struct Main *bmain, struct Scene *scene, struct Object *ob, int mode); -int BKE_font_getselection(struct Object *ob, int *start, int *end); +int BKE_vfont_select_get(struct Object *ob, int *start, int *end); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h index bb0216fe11c..134ec1acd8e 100644 --- a/source/blender/blenkernel/BKE_gpencil.h +++ b/source/blender/blenkernel/BKE_gpencil.h @@ -41,7 +41,7 @@ struct bGPDframe; void free_gpencil_strokes(struct bGPDframe *gpf); void free_gpencil_frames(struct bGPDlayer *gpl); void free_gpencil_layers(struct ListBase *list); -void free_gpencil_data(struct bGPdata *gpd); +void BKE_gpencil_free(struct bGPdata *gpd); struct bGPDframe *gpencil_frame_addnew(struct bGPDlayer *gpl, int cframe); struct bGPDlayer *gpencil_layer_addnew(struct bGPdata *gpd); diff --git a/source/blender/blenkernel/BKE_group.h b/source/blender/blenkernel/BKE_group.h index 6629f0bdf7f..ccf9e0cef5b 100644 --- a/source/blender/blenkernel/BKE_group.h +++ b/source/blender/blenkernel/BKE_group.h @@ -40,10 +40,10 @@ struct Object; struct bAction; struct Scene; -void free_group_objects(struct Group *group); -void unlink_group(struct Group *group); +void BKE_group_free(struct Group *group); +void BKE_group_unlink(struct Group *group); struct Group *add_group(const char *name); -struct Group *copy_group(struct Group *group); +struct Group *BKE_group_copy(struct Group *group); int add_to_group(struct Group *group, struct Object *ob, struct Scene *scene, struct Base *base); int rem_from_group(struct Group *group, struct Object *ob, struct Scene *scene, struct Base *base); struct Group *find_group(struct Object *ob, struct Group *group); diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index c2112d1e169..563f066bda6 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -46,14 +46,14 @@ struct Object; struct ImageFormatData; /* call from library */ -void free_image(struct Image *me); +void BKE_image_free(struct Image *me); -void BKE_stamp_info(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf); +void BKE_imbuf_stamp_info(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf); void BKE_stamp_buf(struct Scene *scene, struct Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels); -int BKE_alphatest_ibuf(struct ImBuf *ibuf); -int BKE_write_ibuf_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf); -int BKE_write_ibuf(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf); -int BKE_write_ibuf_as(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf, const short is_copy); +int BKE_imbuf_alpha_test(struct ImBuf *ibuf); +int BKE_imbuf_write_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf); +int BKE_imbuf_write(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf); +int BKE_imbuf_write_as(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf, const short is_copy); void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, const char imtype, const short use_ext, const short use_frames); int BKE_add_image_extension(char *string, const char imtype); char BKE_ftype_to_imtype(const int ftype); @@ -72,11 +72,11 @@ void BKE_imformat_defaults(struct ImageFormatData *im_format); struct anim *openanim(const char *name, int flags, int streamindex); -void image_de_interlace(struct Image *ima, int odd); +void BKE_image_de_interlace(struct Image *ima, int odd); -void make_local_image(struct Image *ima); +void BKE_image_make_local(struct Image *ima); -void tag_image_time(struct Image *ima); +void BKE_image_tag_time(struct Image *ima); void free_old_images(void); /* ********************************** NEW IMAGE API *********************** */ @@ -130,13 +130,15 @@ struct ImBuf *BKE_image_get_ibuf(struct Image *ima, struct ImageUser *iuser); struct ImBuf *BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **lock_r); void BKE_image_release_ibuf(struct Image *ima, void *lock); +/* returns a new image or NULL if it can't load */ +struct Image *BKE_image_load(const char *filepath); /* returns existing Image when filename/type is same (frame optional) */ -struct Image *BKE_add_image_file(const char *name); +struct Image *BKE_image_load_exists(const char *filepath); /* adds image, adds ibuf, generates color or pattern */ -struct Image *BKE_add_image_size(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short uvtestgrid, float color[4]); +struct Image *BKE_image_add_generated(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short uvtestgrid, float color[4]); /* adds image from imbuf, owns imbuf */ -struct Image *BKE_add_image_imbuf(struct ImBuf *ibuf); +struct Image *BKE_image_add_from_imbuf(struct ImBuf *ibuf); /* for reload, refresh, pack */ void BKE_image_signal(struct Image *ima, struct ImageUser *iuser, int signal); @@ -148,8 +150,8 @@ struct Image *BKE_image_verify_viewer(int type, const char *name); void BKE_image_assign_ibuf(struct Image *ima, struct ImBuf *ibuf); /* called on frame change or before render */ -void BKE_image_user_calc_frame(struct ImageUser *iuser, int cfra, int fieldnr); -int BKE_image_user_get_frame(const struct ImageUser *iuser, int cfra, int fieldnr); +void BKE_image_user_frame_calc(struct ImageUser *iuser, int cfra, int fieldnr); +int BKE_image_user_frame_get(const struct ImageUser *iuser, int cfra, int fieldnr); /* sets index offset for multilayer files */ struct RenderPass *BKE_image_multilayer_index(struct RenderResult *rr, struct ImageUser *iuser); @@ -176,7 +178,7 @@ void BKE_image_memorypack(struct Image *ima); void BKE_image_print_memlist(void); /* empty image block, of similar type and filename */ -struct Image *copy_image(struct Image *ima); +struct Image *BKE_image_copy(struct Image *ima); /* merge source into dest, and free source */ void BKE_image_merge(struct Image *dest, struct Image *source); diff --git a/source/blender/blenkernel/BKE_ipo.h b/source/blender/blenkernel/BKE_ipo.h index 547e7de7634..ca86e90f192 100644 --- a/source/blender/blenkernel/BKE_ipo.h +++ b/source/blender/blenkernel/BKE_ipo.h @@ -45,7 +45,7 @@ void do_versions_ipos_to_animato(struct Main *main); /* --------------------- xxx stuff ------------------------ */ -void free_ipo(struct Ipo *ipo); +void BKE_ipo_free(struct Ipo *ipo); #ifdef __cplusplus }; diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h index 63d9d731097..757952515e5 100644 --- a/source/blender/blenkernel/BKE_key.h +++ b/source/blender/blenkernel/BKE_key.h @@ -47,12 +47,12 @@ struct Mesh; extern "C" { #endif -void free_key(struct Key *sc); +void BKE_key_free(struct Key *sc); void free_key_nolib(struct Key *key); struct Key *add_key(struct ID *id); -struct Key *copy_key(struct Key *key); +struct Key *BKE_key_copy(struct Key *key); struct Key *copy_key_nolib(struct Key *key); -void make_local_key(struct Key *key); +void BKE_key_make_local(struct Key *key); void sort_keys(struct Key *key); void key_curve_position_weights(float t, float *data, int type); diff --git a/source/blender/blenkernel/BKE_lamp.h b/source/blender/blenkernel/BKE_lamp.h index 50e25576320..f9137e50d74 100644 --- a/source/blender/blenkernel/BKE_lamp.h +++ b/source/blender/blenkernel/BKE_lamp.h @@ -38,11 +38,11 @@ extern "C" { struct Lamp; -void *add_lamp(const char *name); -struct Lamp *copy_lamp(struct Lamp *la); +void *BKE_lamp_add(const char *name); +struct Lamp *BKE_lamp_copy(struct Lamp *la); struct Lamp *localize_lamp(struct Lamp *la); -void make_local_lamp(struct Lamp *la); -void free_lamp(struct Lamp *la); +void BKE_lamp_make_local(struct Lamp *la); +void BKE_lamp_free(struct Lamp *la); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h index a0075c4d6be..9a952fc6b1e 100644 --- a/source/blender/blenkernel/BKE_lattice.h +++ b/source/blender/blenkernel/BKE_lattice.h @@ -41,11 +41,11 @@ struct DerivedMesh; struct BPoint; struct MDeformVert; -void resizelattice(struct Lattice *lt, int u, int v, int w, struct Object *ltOb); -struct Lattice *add_lattice(const char *name); -struct Lattice *copy_lattice(struct Lattice *lt); -void free_lattice(struct Lattice *lt); -void make_local_lattice(struct Lattice *lt); +void BKE_lattice_resize(struct Lattice *lt, int u, int v, int w, struct Object *ltOb); +struct Lattice *BKE_lattice_add(const char *name); +struct Lattice *BKE_lattice_copy(struct Lattice *lt); +void BKE_lattice_free(struct Lattice *lt); +void BKE_lattice_make_local(struct Lattice *lt); void calc_lat_fudu(int flag, int res, float *fu, float *du); void init_latt_deform(struct Object *oblatt, struct Object *ob); @@ -69,11 +69,11 @@ void armature_deform_verts(struct Object *armOb, struct Object *target, float (*defMats)[3][3], int numVerts, int deformflag, float (*prevCos)[3], const char *defgrp_name); -float (*lattice_getVertexCos(struct Object *ob, int *numVerts_r))[3]; -void lattice_applyVertexCos(struct Object *ob, float (*vertexCos)[3]); -void lattice_calc_modifiers(struct Scene *scene, struct Object *ob); +float (*BKE_lattice_vertexcos_get(struct Object *ob, int *numVerts_r))[3]; +void BKE_lattice_vertexcos_apply(struct Object *ob, float (*vertexCos)[3]); +void BKE_lattice_modifiers_calc(struct Scene *scene, struct Object *ob); -struct MDeformVert* lattice_get_deform_verts(struct Object *lattice); +struct MDeformVert* BKE_lattice_deform_verts_get(struct Object *lattice); #endif diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index be21996428a..2804eb407db 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -45,15 +45,16 @@ struct bContext; struct PointerRNA; struct PropertyRNA; -void *alloc_libblock(struct ListBase *lb, short type, const char *name); -void *copy_libblock(struct ID *id); -void copy_libblock_data(struct ID *id, const struct ID *id_from, const short do_action); +void *BKE_libblock_alloc(struct ListBase *lb, short type, const char *name); +void *BKE_libblock_copy(struct ID *id); +void BKE_libblock_copy_data(struct ID *id, const struct ID *id_from, const short do_action); void BKE_id_lib_local_paths(struct Main *bmain, struct Library *lib, struct ID *id); void id_lib_extern(struct ID *id); void BKE_library_filepath_set(struct Library *lib, const char *filepath); void id_us_plus(struct ID *id); void id_us_min(struct ID *id); + int id_make_local(struct ID *id, int test); int id_single_user(struct bContext *C, struct ID *id, struct PointerRNA *ptr, struct PropertyRNA *prop); int id_copy(struct ID *id, struct ID **newid, int test); @@ -68,8 +69,8 @@ struct ListBase *which_libbase(struct Main *mainlib, short type); #define MAX_LIBARRAY 40 int set_listbasepointers(struct Main *main, struct ListBase **lb); -void free_libblock(struct ListBase *lb, void *idv); -void free_libblock_us(struct ListBase *lb, void *idv); +void BKE_libblock_free(struct ListBase *lb, void *idv); +void BKE_libblock_free_us(struct ListBase *lb, void *idv); void free_main(struct Main *mainvar); void tag_main_idcode(struct Main *mainvar, const short type, const short tag); @@ -81,7 +82,7 @@ void name_uiprefix_id(char *name, struct ID *id); void test_idbutton(char *name); void text_idbutton(struct ID *id, char *text); void BKE_library_make_local(struct Main *bmain, struct Library *lib, int untagged_only); -struct ID *find_id(const char *type, const char *name); +struct ID *BKE_libblock_find_name(const short type, const char *name); void clear_id_newpoins(void); void IDnames_to_pupstring(const char **str, const char *title, const char *extraops, diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h index 99561a687b9..801724d1d4f 100644 --- a/source/blender/blenkernel/BKE_material.h +++ b/source/blender/blenkernel/BKE_material.h @@ -46,15 +46,15 @@ struct MTFace; /* materials */ void init_def_material(void); -void free_material(struct Material *sc); +void BKE_material_free(struct Material *sc); void test_object_materials(struct ID *id); void resize_object_material(struct Object *ob, const short totcol); void init_material(struct Material *ma); -struct Material *add_material(const char *name); -struct Material *copy_material(struct Material *ma); +struct Material *BKE_material_add(const char *name); +struct Material *BKE_material_copy(struct Material *ma); struct Material *localize_material(struct Material *ma); struct Material *give_node_material(struct Material *ma); /* returns node material or self */ -void make_local_material(struct Material *ma); +void BKE_material_make_local(struct Material *ma); void extern_local_matarar(struct Material **matar, short totcol); void automatname(struct Material *); diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 14cb5d19ddf..256d4b1cae1 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -119,18 +119,18 @@ void mesh_flush_hidden_from_verts(const struct MVert *mvert, struct MPoly *mpoly, int totpoly); void unlink_mesh(struct Mesh *me); -void free_mesh(struct Mesh *me, int unlink); -struct Mesh *add_mesh(const char *name); -struct Mesh *copy_mesh(struct Mesh *me); +void BKE_mesh_free(struct Mesh *me, int unlink); +struct Mesh *BKE_mesh_add(const char *name); +struct Mesh *BKE_mesh_copy(struct Mesh *me); void mesh_update_customdata_pointers(struct Mesh *me, const short do_ensure_tess_cd); -void make_local_mesh(struct Mesh *me); +void BKE_mesh_make_local(struct Mesh *me); void boundbox_mesh(struct Mesh *me, float *loc, float *size); void tex_space_mesh(struct Mesh *me); float *get_mesh_orco_verts(struct Object *ob); void transform_mesh_orco_verts(struct Mesh *me, float (*orco)[3], int totvert, int invert); int test_index_face(struct MFace *mface, struct CustomData *mfdata, int mfindex, int nr); -struct Mesh *get_mesh(struct Object *ob); +struct Mesh *BKE_mesh_from_object(struct Object *ob); void set_mesh(struct Object *ob, struct Mesh *me); void mball_to_mesh(struct ListBase *lb, struct Mesh *me); int nurbs_to_mdata(struct Object *ob, struct MVert **allvert, int *totvert, diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 4fced71d7f2..92a447f9351 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -50,64 +50,66 @@ struct RenderData; struct rctf; struct MovieClip; -void clear_workob(struct Object *workob); -void what_does_parent(struct Scene *scene, struct Object *ob, struct Object *workob); +void BKE_object_workob_clear(struct Object *workob); +void BKE_object_workob_calc_parent(struct Scene *scene, struct Object *ob, struct Object *workob); -void copy_baseflags(struct Scene *scene); -void copy_objectflags(struct Scene *scene); struct SoftBody *copy_softbody(struct SoftBody *sb); struct BulletSoftBody *copy_bulletsoftbody(struct BulletSoftBody *sb); -void copy_object_particlesystems(struct Object *obn, struct Object *ob); -void copy_object_softbody(struct Object *obn, struct Object *ob); -void object_free_particlesystems(struct Object *ob); -void object_free_softbody(struct Object *ob); -void object_free_bulletsoftbody(struct Object *ob); -void update_base_layer(struct Scene *scene, struct Object *ob); +void BKE_object_copy_particlesystems(struct Object *obn, struct Object *ob); +void BKE_object_copy_softbody(struct Object *obn, struct Object *ob); +void BKE_object_free_particlesystems(struct Object *ob); +void BKE_object_free_softbody(struct Object *ob); +void BKE_object_free_bulletsoftbody(struct Object *ob); +void BKE_object_update_base_layer(struct Scene *scene, struct Object *ob); -void free_object(struct Object *ob); -void object_free_display(struct Object *ob); +void BKE_object_free(struct Object *ob); +void BKE_object_free_display(struct Object *ob); -int object_support_modifier_type(struct Object *ob, int modifier_type); +int BKE_object_support_modifier_type_check(struct Object *ob, int modifier_type); -void object_link_modifiers(struct Object *ob, struct Object *from); -void object_free_modifiers(struct Object *ob); +void BKE_object_link_modifiers(struct Object *ob, struct Object *from); +void BKE_object_free_modifiers(struct Object *ob); -void object_make_proxy(struct Object *ob, struct Object *target, struct Object *gob); -void object_copy_proxy_drivers(struct Object *ob, struct Object *target); +void BKE_object_make_proxy(struct Object *ob, struct Object *target, struct Object *gob); +void BKE_object_copy_proxy_drivers(struct Object *ob, struct Object *target); -void unlink_object(struct Object *ob); -int exist_object(struct Object *obtest); +void BKE_object_unlink(struct Object *ob); +int BKE_object_exists_check(struct Object *obtest); -struct Object *add_only_object(int type, const char *name); -struct Object *add_object(struct Scene *scene, int type); - -struct Object *copy_object(struct Object *ob); -void make_local_object(struct Object *ob); -int object_is_libdata(struct Object *ob); -int object_data_is_libdata(struct Object *ob); - -void object_scale_to_mat3(struct Object *ob, float mat[][3]); -void object_rot_to_mat3(struct Object *ob, float mat[][3]); -void object_mat3_to_rot(struct Object *ob, float mat[][3], short use_compat); -void object_to_mat3(struct Object *ob, float mat[][3]); -void object_to_mat4(struct Object *ob, float mat[][4]); -void object_apply_mat4(struct Object *ob, float mat[][4], const short use_compat, const short use_parent); - -struct Object *object_pose_armature_get(struct Object *ob); - -void where_is_object_time(struct Scene *scene, struct Object *ob, float ctime); -void where_is_object(struct Scene *scene, struct Object *ob); -void where_is_object_simul(struct Scene *scene, struct Object *ob); -void where_is_object_mat(struct Scene *scene, struct Object *ob, float obmat[4][4]); - -struct BoundBox *unit_boundbox(void); -void boundbox_set_from_min_max(struct BoundBox *bb, float min[3], float max[3]); -struct BoundBox *object_get_boundbox(struct Object *ob); -void object_get_dimensions(struct Object *ob, float vec[3]); -void object_set_dimensions(struct Object *ob, const float *value); -void object_boundbox_flag(struct Object *ob, int flag, int set); -void minmax_object(struct Object *ob, float min[3], float max[3]); -int minmax_object_duplis(struct Scene *scene, struct Object *ob, float min[3], float max[3]); +struct Object *BKE_object_add_only_object(int type, const char *name); +struct Object *BKE_object_add(struct Scene *scene, int type); +void *BKE_object_obdata_add_from_type(int type); + +struct Object *BKE_object_copy(struct Object *ob); +void BKE_object_make_local(struct Object *ob); +int BKE_object_is_libdata(struct Object *ob); +int BKE_object_obdata_is_libdata(struct Object *ob); + +void BKE_object_scale_to_mat3(struct Object *ob, float mat[][3]); +void BKE_object_rot_to_mat3(struct Object *ob, float mat[][3]); +void BKE_object_mat3_to_rot(struct Object *ob, float mat[][3], short use_compat); +void BKE_object_to_mat3(struct Object *ob, float mat[][3]); +void BKE_object_to_mat4(struct Object *ob, float mat[][4]); +void BKE_object_apply_mat4(struct Object *ob, float mat[][4], const short use_compat, const short use_parent); + +struct Object *BKE_object_pose_armature_get(struct Object *ob); + +void BKE_object_where_is_calc(struct Scene *scene, struct Object *ob); +void BKE_object_where_is_calc_time(struct Scene *scene, struct Object *ob, float ctime); +void BKE_object_where_is_calc_simul(struct Scene *scene, struct Object *ob); +void BKE_object_where_is_calc_mat4(struct Scene *scene, struct Object *ob, float obmat[4][4]); + +/* possibly belong in own moduke? */ +struct BoundBox *BKE_boundbox_alloc_unit(void); +void BKE_boundbox_init_from_minmax(struct BoundBox *bb, float min[3], float max[3]); +int BKE_boundbox_ray_hit_check(struct BoundBox *bb, float ray_start[3], float ray_normal[3]); + +struct BoundBox *BKE_object_boundbox_get(struct Object *ob); +void BKE_object_dimensions_get(struct Object *ob, float vec[3]); +void BKE_object_dimensions_set(struct Object *ob, const float *value); +void BKE_object_boundbox_flag(struct Object *ob, int flag, int set); +void BKE_object_minmax(struct Object *ob, float r_min[3], float r_max[3]); +int BKE_object_minmax_dupli(struct Scene *scene, struct Object *ob, float r_min[3], float r_max[3]); /* sometimes min-max isn't enough, we need to loop over each point */ void BKE_object_foreach_display_point( @@ -121,10 +123,8 @@ void BKE_scene_foreach_display_point( int BKE_object_parent_loop_check(const struct Object *parent, const struct Object *ob); -int ray_hit_boundbox(struct BoundBox *bb, float ray_start[3], float ray_normal[3]); - -void *object_tfm_backup(struct Object *ob); -void object_tfm_restore(struct Object *ob, void *obtfm_pt); +void *BKE_object_tfm_backup(struct Object *ob); +void BKE_object_tfm_restore(struct Object *ob, void *obtfm_pt); typedef struct ObjectTfmProtectedChannels { float loc[3], dloc[3]; @@ -135,28 +135,28 @@ typedef struct ObjectTfmProtectedChannels { float rotAngle, drotAngle; } ObjectTfmProtectedChannels; -void object_tfm_protected_backup(const struct Object *ob, - ObjectTfmProtectedChannels *obtfm); +void BKE_object_tfm_protected_backup(const struct Object *ob, + ObjectTfmProtectedChannels *obtfm); -void object_tfm_protected_restore(struct Object *ob, - const ObjectTfmProtectedChannels *obtfm, - const short protectflag); +void BKE_object_tfm_protected_restore(struct Object *ob, + const ObjectTfmProtectedChannels *obtfm, + const short protectflag); -void object_handle_update(struct Scene *scene, struct Object *ob); -void object_sculpt_modifiers_changed(struct Object *ob); +void BKE_object_handle_update(struct Scene *scene, struct Object *ob); +void BKE_object_sculpt_modifiers_changed(struct Object *ob); -int give_obdata_texspace(struct Object *ob, short **texflag, float **loc, float **size, float **rot); +int BKE_object_obdata_texspace_get(struct Object *ob, short **r_texflag, float **r_loc, float **r_size, float **r_rot); -int object_insert_ptcache(struct Object *ob); +int BKE_object_insert_ptcache(struct Object *ob); // void object_delete_ptcache(struct Object *ob, int index); -struct KeyBlock *object_insert_shape_key(struct Scene *scene, struct Object *ob, const char *name, int from_mix); +struct KeyBlock *BKE_object_insert_shape_key(struct Scene *scene, struct Object *ob, const char *name, int from_mix); -int object_is_modified(struct Scene *scene, struct Object *ob); -int object_is_deform_modified(struct Scene *scene, struct Object *ob); +int BKE_object_is_modified(struct Scene *scene, struct Object *ob); +int BKE_object_is_deform_modified(struct Scene *scene, struct Object *ob); -void object_relink(struct Object *ob); +void BKE_object_relink(struct Object *ob); -struct MovieClip *object_get_movieclip(struct Scene *scene, struct Object *ob, int use_default); +struct MovieClip *BKE_object_movieclip_get(struct Scene *scene, struct Object *ob, int use_default); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index 67dba6fd7a7..f776295b912 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -246,7 +246,7 @@ void psys_check_group_weights(struct ParticleSettings *part); int psys_uses_gravity(struct ParticleSimulationData *sim); /* free */ -void psys_free_settings(struct ParticleSettings *part); +void BKE_particlesettings_free(struct ParticleSettings *part); void psys_free_path_cache(struct ParticleSystem *psys, struct PTCacheEdit *edit); void psys_free(struct Object * ob, struct ParticleSystem * psys); @@ -266,8 +266,8 @@ struct ParticleSystemModifierData *psys_get_modifier(struct Object *ob, struct P struct ModifierData *object_add_particle_system(struct Scene *scene, struct Object *ob, const char *name); void object_remove_particle_system(struct Scene *scene, struct Object *ob); struct ParticleSettings *psys_new_settings(const char *name, struct Main *main); -struct ParticleSettings *psys_copy_settings(struct ParticleSettings *part); -void make_local_particlesettings(struct ParticleSettings *part); +struct ParticleSettings *BKE_particlesettings_copy(struct ParticleSettings *part); +void BKE_particlesettings_make_local(struct ParticleSettings *part); void psys_reset(struct ParticleSystem *psys, int mode); diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index e46d99ed873..3a93562707d 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -61,40 +61,44 @@ struct Base *_setlooper_base_step(struct Scene **sce_iter, struct Base *base); void free_avicodecdata(struct AviCodecData *acd); void free_qtcodecdata(struct QuicktimeCodecData *acd); -void free_scene(struct Scene *sce); -struct Scene *add_scene(const char *name); -struct Base *object_in_scene(struct Object *ob, struct Scene *sce); +void BKE_scene_free(struct Scene *sce); +struct Scene *BKE_scene_add(const char *name); -void set_scene_bg(struct Main *bmain, struct Scene *sce); -struct Scene *set_scene_name(struct Main *bmain, const char *name); +/* base functions */ +struct Base *BKE_scene_base_find(struct Scene *scene, struct Object *ob); +struct Base *BKE_scene_base_add(struct Scene *sce, struct Object *ob); +void BKE_scene_base_deselect_all(struct Scene *sce); +void BKE_scene_base_select(struct Scene *sce, struct Base *selbase); +int BKE_scene_base_iter_next(struct Scene **scene, int val, struct Base **base, struct Object **ob); -struct Scene *copy_scene(struct Scene *sce, int type); -void unlink_scene(struct Main *bmain, struct Scene *sce, struct Scene *newsce); +void BKE_scene_base_flag_to_objects(struct Scene *scene); +void BKE_scene_base_flag_from_objects(struct Scene *scene); -int next_object(struct Scene **scene, int val, struct Base **base, struct Object **ob); -struct Object *scene_find_camera(struct Scene *sc); -struct Object *scene_camera_switch_find(struct Scene *scene); // DURIAN_CAMERA_SWITCH -int scene_camera_switch_update(struct Scene *scene); +void BKE_scene_set_background(struct Main *bmain, struct Scene *sce); +struct Scene *BKE_scene_set_name(struct Main *bmain, const char *name); -char *scene_find_marker_name(struct Scene *scene, int frame); -char *scene_find_last_marker_name(struct Scene *scene, int frame); +struct Scene *BKE_scene_copy(struct Scene *sce, int type); +void BKE_scene_unlink(struct Main *bmain, struct Scene *sce, struct Scene *newsce); -struct Base *scene_add_base(struct Scene *sce, struct Object *ob); -void scene_deselect_all(struct Scene *sce); -void scene_select_base(struct Scene *sce, struct Base *selbase); +struct Object *BKE_scene_camera_find(struct Scene *sc); +struct Object *BKE_scene_camera_switch_find(struct Scene *scene); // DURIAN_CAMERA_SWITCH +int BKE_scene_camera_switch_update(struct Scene *scene); + +char *BKE_scene_find_marker_name(struct Scene *scene, int frame); +char *BKE_scene_find_last_marker_name(struct Scene *scene, int frame); /* checks for cycle, returns 1 if it's all OK */ -int scene_check_setscene(struct Main *bmain, struct Scene *sce); +int BKE_scene_validate_setscene(struct Main *bmain, struct Scene *sce); -float BKE_curframe(struct Scene *scene); -float BKE_frame_to_ctime(struct Scene *scene, const float frame); +float BKE_scene_frame_get(struct Scene *scene); +float BKE_scene_frame_get_from_ctime(struct Scene *scene, const float frame); -void scene_update_tagged(struct Main *bmain, struct Scene *sce); +void BKE_scene_update_tagged(struct Main *bmain, struct Scene *sce); -void scene_update_for_newframe(struct Main *bmain, struct Scene *sce, unsigned int lay); +void BKE_scene_update_for_newframe(struct Main *bmain, struct Scene *sce, unsigned int lay); -struct SceneRenderLayer *scene_add_render_layer(struct Scene *sce, const char *name); -int scene_remove_render_layer(struct Main *main, struct Scene *scene, struct SceneRenderLayer *srl); +struct SceneRenderLayer *BKE_scene_add_render_layer(struct Scene *sce, const char *name); +int BKE_scene_remove_render_layer(struct Main *main, struct Scene *scene, struct SceneRenderLayer *srl); /* render profile */ int get_render_subsurf_level(struct RenderData *r, int level); @@ -102,7 +106,7 @@ int get_render_child_particle_number(struct RenderData *r, int num); int get_render_shadow_samples(struct RenderData *r, int samples); float get_render_aosss_error(struct RenderData *r, float error); -int scene_use_new_shading_nodes(struct Scene *scene); +int BKE_scene_use_new_shading_nodes(struct Scene *scene); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index fbb93c761c2..af6e793cf2f 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -252,7 +252,7 @@ float BKE_screen_view3d_zoom_to_fac(float camzoom); float BKE_screen_view3d_zoom_from_fac(float zoomfac); /* screen */ -void free_screen(struct bScreen *sc); +void BKE_screen_free(struct bScreen *sc); unsigned int BKE_screen_visible_layers(struct bScreen *screen, struct Scene *scene); #endif diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h index 8b01dbde531..5234f10ddb3 100644 --- a/source/blender/blenkernel/BKE_sound.h +++ b/source/blender/blenkernel/BKE_sound.h @@ -77,7 +77,7 @@ void sound_delete_cache(struct bSound* sound); void sound_load(struct Main *main, struct bSound* sound); -void sound_free(struct bSound* sound); +void BKE_sound_free(struct bSound* sound); #ifdef __AUD_C_API_H__ AUD_Device* sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start, float volume); diff --git a/source/blender/blenkernel/BKE_speaker.h b/source/blender/blenkernel/BKE_speaker.h index fddcfb2c7f3..52c177fce57 100644 --- a/source/blender/blenkernel/BKE_speaker.h +++ b/source/blender/blenkernel/BKE_speaker.h @@ -33,9 +33,9 @@ * \brief General operations for speakers. */ -void *add_speaker(const char *name); -struct Speaker *copy_speaker(struct Speaker *spk); -void make_local_speaker(struct Speaker *spk); -void free_speaker(struct Speaker *spk); +void *BKE_speaker_add(const char *name); +struct Speaker *BKE_speaker_copy(struct Speaker *spk); +void BKE_speaker_make_local(struct Speaker *spk); +void BKE_speaker_free(struct Speaker *spk); #endif diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index b1902c75afb..592b3d1d2e0 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -42,17 +42,17 @@ struct Text; struct TextLine; struct SpaceText; -void free_text (struct Text *text); +void BKE_text_free (struct Text *text); void txt_set_undostate (int u); int txt_get_undostate (void); -struct Text* add_empty_text (const char *name); +struct Text* BKE_text_add (const char *name); int txt_extended_ascii_as_utf8(char **str); -int reopen_text (struct Text *text); -struct Text* add_text (const char *file, const char *relpath); -struct Text* copy_text (struct Text *ta); -void unlink_text (struct Main *bmain, struct Text *text); -void clear_text(struct Text *text); -void write_text(struct Text *text, const char *str); +int BKE_text_reload (struct Text *text); +struct Text* BKE_text_load (const char *file, const char *relpath); +struct Text* BKE_text_copy (struct Text *ta); +void BKE_text_unlink (struct Main *bmain, struct Text *text); +void BKE_text_clear (struct Text *text); +void BKE_text_write (struct Text *text, const char *str); char* txt_to_buf (struct Text *text); void txt_clean_text (struct Text *text); diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h index 2574c45eec2..ed58620b716 100644 --- a/source/blender/blenkernel/BKE_texture.h +++ b/source/blender/blenkernel/BKE_texture.h @@ -59,7 +59,7 @@ struct World; #define MAXCOLORBAND 32 -void free_texture(struct Tex *t); +void BKE_texture_free(struct Tex *t); int test_dlerr(const char *name, const char *symbol); void open_plugin_tex(struct PluginTex *pit); struct PluginTex *add_plugin_tex(char *str); @@ -79,9 +79,9 @@ void tex_set_type(struct Tex *tex, int type); void default_mtex(struct MTex *mtex); struct MTex *add_mtex(void); struct MTex *add_mtex_id(struct ID *id, int slot); -struct Tex *copy_texture(struct Tex *tex); +struct Tex *BKE_texture_copy(struct Tex *tex); struct Tex *localize_texture(struct Tex *tex); -void make_local_texture(struct Tex *tex); +void BKE_texture_make_local(struct Tex *tex); void autotexname(struct Tex *tex); struct Tex *give_current_object_texture(struct Object *ob); diff --git a/source/blender/blenkernel/BKE_world.h b/source/blender/blenkernel/BKE_world.h index 16ff3acaf71..67896fffc4d 100644 --- a/source/blender/blenkernel/BKE_world.h +++ b/source/blender/blenkernel/BKE_world.h @@ -35,11 +35,11 @@ struct World; -void free_world(struct World *sc); +void BKE_world_free(struct World *sc); struct World *add_world(const char *name); -struct World *copy_world(struct World *wrld); +struct World *BKE_world_copy(struct World *wrld); struct World *localize_world(struct World *wrld); -void make_local_world(struct World *wrld); +void BKE_world_make_local(struct World *wrld); #endif diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 74373d28c14..34dee93d95a 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -2111,7 +2111,7 @@ static void clear_mesh_caches(Object *ob) } if (ob->sculpt) { - object_sculpt_modifiers_changed(ob); + BKE_object_sculpt_modifiers_changed(ob); } } @@ -2884,7 +2884,7 @@ void DM_set_object_boundbox(Object *ob, DerivedMesh *dm) if (!ob->bb) ob->bb= MEM_callocN(sizeof(BoundBox), "DM-BoundBox"); - boundbox_set_from_min_max(ob->bb, min, max); + BKE_boundbox_init_from_minmax(ob->bb, min, max); } /* --- NAVMESH (begin) --- */ diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 5a2407ca56b..90cfb9a1d82 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -69,7 +69,7 @@ * - Pose is the local (object level) component of armature. The current * object pose is saved in files, and (will be) is presorted for dependency * - Actions have fewer (or other) channels, and write data to a Pose - * - Currently ob->pose data is controlled in where_is_pose only. The (recalc) + * - Currently ob->pose data is controlled in BKE_pose_where_is only. The (recalc) * event system takes care of calling that * - The NLA system (here too) uses Poses as interpolation format for Actions * - Therefore we assume poses to be static, and duplicates of poses have channels in @@ -83,14 +83,14 @@ bAction *add_empty_action(const char name[]) { bAction *act; - act= alloc_libblock(&G.main->action, ID_AC, name); + act= BKE_libblock_alloc(&G.main->action, ID_AC, name); return act; } /* .................................. */ -/* temp data for make_local_action */ +/* temp data for BKE_action_make_local */ typedef struct tMakeLocalActionContext { bAction *act; /* original action */ bAction *act_new; /* new action */ @@ -99,7 +99,7 @@ typedef struct tMakeLocalActionContext { int is_local; /* some action users were not libraries */ } tMakeLocalActionContext; -/* helper function for make_local_action() - local/lib init step */ +/* helper function for BKE_action_make_local() - local/lib init step */ static void make_localact_init_cb(ID *id, AnimData *adt, void *mlac_ptr) { tMakeLocalActionContext *mlac = (tMakeLocalActionContext *)mlac_ptr; @@ -110,7 +110,7 @@ static void make_localact_init_cb(ID *id, AnimData *adt, void *mlac_ptr) } } -/* helper function for make_local_action() - change references */ +/* helper function for BKE_action_make_local() - change references */ static void make_localact_apply_cb(ID *id, AnimData *adt, void *mlac_ptr) { tMakeLocalActionContext *mlac = (tMakeLocalActionContext *)mlac_ptr; @@ -126,7 +126,7 @@ static void make_localact_apply_cb(ID *id, AnimData *adt, void *mlac_ptr) } // does copy_fcurve... -void make_local_action(bAction *act) +void BKE_action_make_local(bAction *act) { tMakeLocalActionContext mlac = {act, NULL, FALSE, FALSE}; Main *bmain= G.main; @@ -146,7 +146,7 @@ void make_local_action(bAction *act) id_clear_lib_data(bmain, &act->id); } else if (mlac.is_local && mlac.is_lib) { - mlac.act_new= copy_action(act); + mlac.act_new= BKE_action_copy(act); mlac.act_new->id.us= 0; BKE_id_lib_local_paths(bmain, act->id.lib, &mlac.act_new->id); @@ -157,7 +157,7 @@ void make_local_action(bAction *act) /* .................................. */ -void free_action(bAction *act) +void BKE_action_free(bAction *act) { /* sanity check */ if (act == NULL) @@ -177,7 +177,7 @@ void free_action(bAction *act) /* .................................. */ -bAction *copy_action (bAction *src) +bAction *BKE_action_copy (bAction *src) { bAction *dst = NULL; bActionGroup *dgrp, *sgrp; @@ -185,7 +185,7 @@ bAction *copy_action (bAction *src) if (src == NULL) return NULL; - dst= copy_libblock(&src->id); + dst= BKE_libblock_copy(&src->id); /* duplicate the lists of groups and markers */ BLI_duplicatelist(&dst->groups, &src->groups); @@ -383,7 +383,7 @@ void action_groups_remove_channel(bAction *act, FCurve *fcu) } /* Find a group with the given name */ -bActionGroup *action_groups_find_named (bAction *act, const char name[]) +bActionGroup *BKE_action_group_find_name (bAction *act, const char name[]) { /* sanity checks */ if (ELEM3(NULL, act, act->groups.first, name) || (name[0] == 0)) @@ -410,7 +410,7 @@ void action_groups_clear_tempflags(bAction *act) /* *************** Pose channels *************** */ /* usually used within a loop, so we got a N^2 slowdown */ -bPoseChannel *get_pose_channel(const bPose *pose, const char *name) +bPoseChannel *BKE_pose_channel_find_name(const bPose *pose, const char *name) { if (ELEM(NULL, pose, name) || (name[0] == 0)) return NULL; @@ -423,7 +423,7 @@ bPoseChannel *get_pose_channel(const bPose *pose, const char *name) /* Use with care, not on Armature poses but for temporal ones */ /* (currently used for action constraints and in rebuild_pose) */ -bPoseChannel *verify_pose_channel(bPose *pose, const char *name) +bPoseChannel *BKE_pose_channel_verify(bPose *pose, const char *name) { bPoseChannel *chan; @@ -454,13 +454,13 @@ bPoseChannel *verify_pose_channel(bPose *pose, const char *name) chan->protectflag = OB_LOCK_ROT4D; /* lock by components by default */ BLI_addtail(&pose->chanbase, chan); - free_pose_channels_hash(pose); + BKE_pose_channels_hash_free(pose); return chan; } /* Find the active posechannel for an object (we can't just use pose, as layer info is in armature) */ -bPoseChannel *get_active_posechannel (Object *ob) +bPoseChannel *BKE_pose_channel_active (Object *ob) { bArmature *arm= (ob) ? ob->data : NULL; bPoseChannel *pchan; @@ -478,7 +478,7 @@ bPoseChannel *get_active_posechannel (Object *ob) return NULL; } -const char *get_ikparam_name(bPose *pose) +const char *BKE_pose_ikparam_get_name(bPose *pose) { if (pose) { switch (pose->iksolver) { @@ -491,7 +491,7 @@ const char *get_ikparam_name(bPose *pose) return NULL; } /* dst should be freed already, makes entire duplicate */ -void copy_pose(bPose **dst, bPose *src, int copycon) +void BKE_pose_copy_data(bPose **dst, bPose *src, int copycon) { bPose *outPose; bPoseChannel *pchan; @@ -503,7 +503,7 @@ void copy_pose(bPose **dst, bPose *src, int copycon) } if (*dst==src) { - printf("copy_pose source and target are the same\n"); + printf("BKE_pose_copy_data source and target are the same\n"); *dst=NULL; return; } @@ -536,7 +536,7 @@ void copy_pose(bPose **dst, bPose *src, int copycon) *dst=outPose; } -void init_pose_itasc(bItasc *itasc) +void BKE_pose_itasc_init(bItasc *itasc) { if (itasc) { itasc->iksolver = IKSOLVER_ITASC; @@ -553,13 +553,13 @@ void init_pose_itasc(bItasc *itasc) itasc->dampeps = 0.15; } } -void init_pose_ikparam(bPose *pose) +void BKE_pose_ikparam_init(bPose *pose) { bItasc *itasc; switch (pose->iksolver) { case IKSOLVER_ITASC: itasc = MEM_callocN(sizeof(bItasc), "itasc"); - init_pose_itasc(itasc); + BKE_pose_itasc_init(itasc); pose->ikparam = itasc; break; case IKSOLVER_LEGACY: @@ -569,7 +569,7 @@ void init_pose_ikparam(bPose *pose) } } -void make_pose_channels_hash(bPose *pose) +void BKE_pose_channels_hash_make(bPose *pose) { if (!pose->chanhash) { bPoseChannel *pchan; @@ -580,7 +580,7 @@ void make_pose_channels_hash(bPose *pose) } } -void free_pose_channels_hash(bPose *pose) +void BKE_pose_channels_hash_free(bPose *pose) { if (pose->chanhash) { BLI_ghash_free(pose->chanhash, NULL, NULL); @@ -589,7 +589,7 @@ void free_pose_channels_hash(bPose *pose) } -void free_pose_channel(bPoseChannel *pchan) +void BKE_pose_channel_free(bPoseChannel *pchan) { if (pchan->mpath) { @@ -605,25 +605,25 @@ void free_pose_channel(bPoseChannel *pchan) } } -void free_pose_channels(bPose *pose) +void BKE_pose_channels_free(bPose *pose) { bPoseChannel *pchan; if (pose->chanbase.first) { for (pchan = pose->chanbase.first; pchan; pchan=pchan->next) - free_pose_channel(pchan); + BKE_pose_channel_free(pchan); BLI_freelistN(&pose->chanbase); } - free_pose_channels_hash(pose); + BKE_pose_channels_hash_free(pose); } -void free_pose(bPose *pose) +void BKE_pose_free(bPose *pose) { if (pose) { /* free pose-channels */ - free_pose_channels(pose); + BKE_pose_channels_free(pose); /* free pose-groups */ if (pose->agroups.first) @@ -665,8 +665,8 @@ static void copy_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *chan /* makes copies of internal data, unlike copy_pose_channel_data which only * copies the pose state. - * hint: use when copying bones in editmode (on returned value from verify_pose_channel) */ -void duplicate_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *pchan_from) + * hint: use when copying bones in editmode (on returned value from BKE_pose_channel_verify) */ +void BKE_pose_channel_copy_data(bPoseChannel *pchan, const bPoseChannel *pchan_from) { /* copy transform locks */ pchan->protectflag = pchan_from->protectflag; @@ -709,7 +709,7 @@ void duplicate_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *pchan_ * can do more constraints flags later */ /* pose should be entirely OK */ -void update_pose_constraint_flags(bPose *pose) +void BKE_pose_update_constraint_flags(bPose *pose) { bPoseChannel *pchan, *parchan; bConstraint *con; @@ -792,7 +792,7 @@ void framechange_poses_clear_unkeyed(void) /* ************************** Bone Groups ************************** */ /* Adds a new bone-group */ -void pose_add_group(Object *ob) +void BKE_pose_add_group(Object *ob) { bPose *pose= (ob) ? ob->pose : NULL; bActionGroup *grp; @@ -809,7 +809,7 @@ void pose_add_group(Object *ob) } /* Remove the active bone-group */ -void pose_remove_group(Object *ob) +void BKE_pose_remove_group(Object *ob) { bPose *pose= (ob) ? ob->pose : NULL; bActionGroup *grp = NULL; @@ -1072,7 +1072,7 @@ void extract_pose_from_pose(bPose *pose, const bPose *src) } /* for do_all_pose_actions, clears the pose. Now also exported for proxy and tools */ -void rest_pose(bPose *pose) +void BKE_pose_rest(bPose *pose) { bPoseChannel *pchan; @@ -1094,7 +1094,7 @@ void rest_pose(bPose *pose) } /* both poses should be in sync */ -void copy_pose_result(bPose *to, bPose *from) +void BKE_pose_copy_result(bPose *to, bPose *from) { bPoseChannel *pchanto, *pchanfrom; @@ -1104,13 +1104,13 @@ void copy_pose_result(bPose *to, bPose *from) } if (to==from) { - printf("copy_pose_result source and target are the same\n"); + printf("BKE_pose_copy_result source and target are the same\n"); return; } for (pchanfrom= from->chanbase.first; pchanfrom; pchanfrom= pchanfrom->next) { - pchanto= get_pose_channel(to, pchanfrom->name); + pchanto= BKE_pose_channel_find_name(to, pchanfrom->name); if (pchanto) { copy_m4_m4(pchanto->pose_mat, pchanfrom->pose_mat); copy_m4_m4(pchanto->chan_mat, pchanfrom->chan_mat); @@ -1136,10 +1136,10 @@ void copy_pose_result(bPose *to, bPose *from) */ void what_does_obaction(Object *ob, Object *workob, bPose *pose, bAction *act, char groupname[], float cframe) { - bActionGroup *agrp= action_groups_find_named(act, groupname); + bActionGroup *agrp= BKE_action_group_find_name(act, groupname); /* clear workob */ - clear_workob(workob); + BKE_object_workob_clear(workob); /* init workob */ copy_m4_m4(workob->obmat, ob->obmat); @@ -1243,9 +1243,9 @@ static void blend_pose_offset_bone(bActionStrip *strip, bPose *dst, bPose *src, /* are we also blending with matching bones? */ if (strip->prev && strip->start>=strip->prev->start) { - bPoseChannel *dpchan= get_pose_channel(dst, strip->offs_bone); + bPoseChannel *dpchan= BKE_pose_channel_find_name(dst, strip->offs_bone); if (dpchan) { - bPoseChannel *spchan= get_pose_channel(src, strip->offs_bone); + bPoseChannel *spchan= BKE_pose_channel_find_name(src, strip->offs_bone); if (spchan) { float vec[3]; @@ -1397,11 +1397,11 @@ static void cyclic_offs_bone(Object *ob, bPose *pose, bActionStrip *strip, float if (foundvert) { /* bring it into armature space */ sub_v3_v3v3(min, max, min); - bone= get_named_bone(ob->data, strip->offs_bone); /* weak */ + bone= BKE_armature_find_bone_name(ob->data, strip->offs_bone); /* weak */ if (bone) { mul_mat3_m4_v3(bone->arm_mat, min); - /* dominant motion, cyclic_offset was cleared in rest_pose */ + /* dominant motion, cyclic_offset was cleared in BKE_pose_rest */ if (strip->flag & (ACTSTRIP_CYCLIC_USEX | ACTSTRIP_CYCLIC_USEY | ACTSTRIP_CYCLIC_USEZ)) { if (strip->flag & ACTSTRIP_CYCLIC_USEX) pose->cyclic_offset[0]= time*min[0]; if (strip->flag & ACTSTRIP_CYCLIC_USEY) pose->cyclic_offset[1]= time*min[1]; @@ -1453,12 +1453,12 @@ static void do_nla(Scene *scene, Object *ob, int blocktype) bActionStrip *strip, *striplast=NULL, *stripfirst=NULL; float striptime, frametime, length, actlength; float blendfac, stripframe; - float scene_cfra= BKE_curframe(scene); + float scene_cfra= BKE_scene_frame_get(scene); int doit, dostride; if (blocktype==ID_AR) { - copy_pose(&tpose, ob->pose, 1); - rest_pose(ob->pose); // potentially destroying current not-keyed pose + BKE_pose_copy_data(&tpose, ob->pose, 1); + BKE_pose_rest(ob->pose); // potentially destroying current not-keyed pose } else { key= ob_get_key(ob); @@ -1504,7 +1504,7 @@ static void do_nla(Scene *scene, Object *ob, int blocktype) if (striptime>=0.0) { if (blocktype==ID_AR) - rest_pose(tpose); + BKE_pose_rest(tpose); /* To handle repeat, we add 0.1 frame extra to make sure the last frame is included */ if (striptime < 1.0f + 0.1f/length) { @@ -1656,7 +1656,7 @@ static void do_nla(Scene *scene, Object *ob, int blocktype) /* free */ if (tpose) - free_pose(tpose); + BKE_pose_free(tpose); if (chanbase.first) BLI_freelistN(&chanbase); } diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index afa4723bc6d..1d05ecca909 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -341,7 +341,7 @@ static void motionpaths_calc_update_scene(Scene *scene) // is animated but not attached to/updatable from objects for (base=scene->base.first; base; base=base->next) { /* update this object */ - object_handle_update(scene, base->object); + BKE_object_handle_update(scene, base->object); /* if this is the last one we need to update, let's stop to save some time */ if (base == last) @@ -353,7 +353,7 @@ static void motionpaths_calc_update_scene(Scene *scene) * that doesn't force complete update, but for now, this is the * most accurate way! */ - scene_update_for_newframe(G.main, scene, scene->lay); // XXX this is the best way we can get anything moving + BKE_scene_update_for_newframe(G.main, scene, scene->lay); // XXX this is the best way we can get anything moving #endif } @@ -816,7 +816,7 @@ static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, * However, this has always been the way that this worked (i.e. pre 2.5), so I guess that it'll be fine! */ BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, (float)scene->r.cfra, ADT_RECALC_ANIM); /* ob-eval will do drivers, so we don't need to do them */ - where_is_object_time(scene, ob, (float)scene->r.cfra); + BKE_object_where_is_calc_time(scene, ob, (float)scene->r.cfra); dob= new_dupli_object(lb, ob, ob->obmat, ob->lay, scene->r.cfra, OB_DUPLIFRAMES, animated); copy_m4_m4(dob->omat, copyob.obmat); @@ -831,7 +831,7 @@ static void frames_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, scene->r.cfra= cfrao; BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, (float)scene->r.cfra, ADT_RECALC_ANIM); /* ob-eval will do drivers, so we don't need to do them */ - where_is_object_time(scene, ob, (float)scene->r.cfra); + BKE_object_where_is_calc_time(scene, ob, (float)scene->r.cfra); /* but, to make sure unkeyed object transforms are still sane, * let's copy object's original data back over @@ -1249,7 +1249,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p if (G.rendering == 0) no_draw_flag |= PARS_NO_DISP; - ctime = BKE_curframe(scene); /* NOTE: in old animsys, used parent object's timeoffset... */ + ctime = BKE_scene_frame_get(scene); /* NOTE: in old animsys, used parent object's timeoffset... */ totpart = psys->totpart; totchild = psys->totchild; @@ -1309,7 +1309,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p } /* we also copy the actual objects to restore afterwards, since - * where_is_object_time will change the object which breaks transform */ + * BKE_object_where_is_calc_time will change the object which breaks transform */ oblist = MEM_callocN(totgroup*sizeof(Object *), "dupgroup object list"); obcopylist = MEM_callocN(totgroup*sizeof(Object), "dupgroup copy list"); @@ -1445,7 +1445,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p } else { /* to give ipos in object correct offset */ - where_is_object_time(scene, ob, ctime-pa_time); + BKE_object_where_is_calc_time(scene, ob, ctime-pa_time); copy_v3_v3(vec, obmat[3]); obmat[3][0] = obmat[3][1] = obmat[3][2] = 0.0f; @@ -1486,7 +1486,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p } } - /* restore objects since they were changed in where_is_object_time */ + /* restore objects since they were changed in BKE_object_where_is_calc_time */ if (part->ren_as==PART_DRAW_GR) { for (a=0; a<totgroup; a++) *(oblist[a])= obcopylist[a]; @@ -1545,7 +1545,7 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, i /* in par the family name is stored, use this to find the other objects */ - chartransdata= BKE_text_to_curve(G.main, scene, par, FO_DUPLI); + chartransdata= BKE_vfont_to_curve(G.main, scene, par, FO_DUPLI); if (chartransdata==NULL) return; cu= par->data; diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index f3a7ff90373..de70ffcaaef 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -253,8 +253,8 @@ AnimData *BKE_copy_animdata (AnimData *adt, const short do_action) /* make a copy of action - at worst, user has to delete copies... */ if (do_action) { - dadt->action= copy_action(adt->action); - dadt->tmpact= copy_action(adt->tmpact); + dadt->action= BKE_action_copy(adt->action); + dadt->tmpact= BKE_action_copy(adt->tmpact); } else { id_us_plus((ID *)dadt->action); @@ -298,11 +298,11 @@ void BKE_copy_animdata_id_action(ID *id) if (adt) { if (adt->action) { id_us_min((ID *)adt->action); - adt->action= copy_action(adt->action); + adt->action= BKE_action_copy(adt->action); } if (adt->tmpact) { id_us_min((ID *)adt->tmpact); - adt->tmpact= copy_action(adt->tmpact); + adt->tmpact= BKE_action_copy(adt->tmpact); } } } @@ -314,8 +314,8 @@ static void make_local_strips(ListBase *strips) NlaStrip *strip; for (strip=strips->first; strip; strip=strip->next) { - if (strip->act) make_local_action(strip->act); - if (strip->remap && strip->remap->target) make_local_action(strip->remap->target); + if (strip->act) BKE_action_make_local(strip->act); + if (strip->remap && strip->remap->target) BKE_action_make_local(strip->remap->target); make_local_strips(&strip->strips); } @@ -327,10 +327,10 @@ void BKE_animdata_make_local(AnimData *adt) NlaTrack *nlt; /* Actions - Active and Temp */ - if (adt->action) make_local_action(adt->action); - if (adt->tmpact) make_local_action(adt->tmpact); + if (adt->action) BKE_action_make_local(adt->action); + if (adt->tmpact) BKE_action_make_local(adt->tmpact); /* Remaps */ - if (adt->remap && adt->remap->target) make_local_action(adt->remap->target); + if (adt->remap && adt->remap->target) BKE_action_make_local(adt->remap->target); /* Drivers */ // TODO: need to remap the ID-targets too? @@ -425,7 +425,7 @@ void action_move_fcurves_by_basepath(bAction *srcAct, bAction *dstAct, const cha /* if grouped... */ if (fcu->grp) { /* make sure there will be a matching group on the other side for the migrants */ - agrp = action_groups_find_named(dstAct, fcu->grp->name); + agrp = BKE_action_group_find_name(dstAct, fcu->grp->name); if (agrp == NULL) { /* add a new one with a similar name (usually will be the same though) */ @@ -2035,8 +2035,10 @@ static void animsys_evaluate_nla (ListBase *echannels, PointerRNA *ptr, AnimData /* add 'active' Action (may be tweaking track) as last strip to evaluate in NLA stack * - only do this if we're not exclusively evaluating the 'solo' NLA-track + * - however, if the 'solo' track houses the current 'tweaking' strip, + * then we should allow this to play, otherwise nothing happens */ - if ((adt->action) && !(adt->flag & ADT_NLA_SOLO_TRACK)) { + if ((adt->action) && ((adt->flag & ADT_NLA_SOLO_TRACK)==0 || (adt->flag & ADT_NLA_EDIT_ON))) { /* if there are strips, evaluate action as per NLA rules */ if ((has_strips) || (adt->actstrip)) { /* make dummy NLA strip, and add that to the stack */ diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index b0d0ace2a7e..814e9d53503 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -75,25 +75,25 @@ /* **************** Generic Functions, data level *************** */ -bArmature *add_armature(const char *name) +bArmature *BKE_armature_add(const char *name) { bArmature *arm; - arm = alloc_libblock (&G.main->armature, ID_AR, name); + arm = BKE_libblock_alloc (&G.main->armature, ID_AR, name); arm->deformflag = ARM_DEF_VGROUP|ARM_DEF_ENVELOPE; arm->flag = ARM_COL_CUSTOM; /* custom bone-group colors */ arm->layer = 1; return arm; } -bArmature *get_armature(Object *ob) +bArmature *BKE_armature_from_object(Object *ob) { if (ob->type == OB_ARMATURE) return (bArmature *)ob->data; return NULL; } -void free_bonelist(ListBase *lb) +void BKE_armature_bonelist_free(ListBase *lb) { Bone *bone; @@ -102,16 +102,16 @@ void free_bonelist(ListBase *lb) IDP_FreeProperty(bone->prop); MEM_freeN(bone->prop); } - free_bonelist(&bone->childbase); + BKE_armature_bonelist_free(&bone->childbase); } BLI_freelistN(lb); } -void free_armature(bArmature *arm) +void BKE_armature_free(bArmature *arm) { if (arm) { - free_bonelist(&arm->bonebase); + BKE_armature_bonelist_free(&arm->bonebase); /* free editmode data */ if (arm->edbo) { @@ -135,7 +135,7 @@ void free_armature(bArmature *arm) } } -void make_local_armature(bArmature *arm) +void BKE_armature_make_local(bArmature *arm) { Main *bmain = G.main; int is_local = FALSE, is_lib = FALSE; @@ -161,7 +161,7 @@ void make_local_armature(bArmature *arm) id_clear_lib_data(bmain, &arm->id); } else if (is_local && is_lib) { - bArmature *arm_new = copy_armature(arm); + bArmature *arm_new = BKE_armature_copy(arm); arm_new->id.us = 0; /* Remap paths of new ID using old library as base. */ @@ -201,13 +201,13 @@ static void copy_bonechildren(Bone* newBone, Bone* oldBone, Bone* actBone, Bone } } -bArmature *copy_armature(bArmature *arm) +bArmature *BKE_armature_copy(bArmature *arm) { bArmature *newArm; Bone *oldBone, *newBone; Bone *newActBone= NULL; - newArm = copy_libblock(&arm->id); + newArm = BKE_libblock_copy(&arm->id); BLI_duplicatelist(&newArm->bonebase, &arm->bonebase); /* Duplicate the childrens' lists*/ @@ -245,7 +245,7 @@ static Bone *get_named_bone_bonechildren(Bone *bone, const char *name) /* Walk the list until the bone is found */ -Bone *get_named_bone(bArmature *arm, const char *name) +Bone *BKE_armature_find_bone_name(bArmature *arm, const char *name) { Bone *bone = NULL, *curBone; @@ -909,7 +909,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, float defnrToPC = MEM_callocN(sizeof(*defnrToPC) * defbase_tot, "defnrToBone"); defnrToPCIndex = MEM_callocN(sizeof(*defnrToPCIndex) * defbase_tot, "defnrToIndex"); for (i = 0, dg = target->defbase.first; dg; i++, dg = dg->next) { - defnrToPC[i] = get_pose_channel(armOb->pose, dg->name); + defnrToPC[i] = BKE_pose_channel_find_name(armOb->pose, dg->name); /* exclude non-deforming bones */ if (defnrToPC[i]) { if (defnrToPC[i]->bone->flag & BONE_NO_DEFORM) { @@ -1099,7 +1099,7 @@ void get_objectspace_bone_matrix(struct Bone* bone, float M_accumulatedMatrix[][ /* **************** Space to Space API ****************** */ /* Convert World-Space Matrix to Pose-Space Matrix */ -void armature_mat_world_to_pose(Object *ob, float inmat[][4], float outmat[][4]) +void BKE_armature_mat_world_to_pose(Object *ob, float inmat[][4], float outmat[][4]) { float obmat[4][4]; @@ -1117,7 +1117,7 @@ void armature_mat_world_to_pose(Object *ob, float inmat[][4], float outmat[][4]) /* Convert World-Space Location to Pose-Space Location * NOTE: this cannot be used to convert to pose-space location of the supplied * pose-channel into its local space (i.e. 'visual'-keyframing) */ -void armature_loc_world_to_pose(Object *ob, const float inloc[3], float outloc[3]) +void BKE_armature_loc_world_to_pose(Object *ob, const float inloc[3], float outloc[3]) { float xLocMat[4][4] = MAT4_UNITY; float nLocMat[4][4]; @@ -1126,7 +1126,7 @@ void armature_loc_world_to_pose(Object *ob, const float inloc[3], float outloc[3 copy_v3_v3(xLocMat[3], inloc); /* get bone-space cursor matrix and extract location */ - armature_mat_world_to_pose(ob, xLocMat, nLocMat); + BKE_armature_mat_world_to_pose(ob, xLocMat, nLocMat); copy_v3_v3(outloc, nLocMat[3]); } @@ -1165,7 +1165,7 @@ static void get_offset_bone_mat(Bone *bone, float offs_bone[][4]) * pose-channel into its local space (i.e. 'visual'-keyframing). * (note: I don't understand that, so I keep it :p --mont29). */ -void pchan_to_pose_mat(bPoseChannel *pchan, float rotscale_mat[][4], float loc_mat[][4]) +void BKE_pchan_to_pose_mat(bPoseChannel *pchan, float rotscale_mat[][4], float loc_mat[][4]) { Bone *bone, *parbone; bPoseChannel *parchan; @@ -1254,14 +1254,14 @@ void pchan_to_pose_mat(bPoseChannel *pchan, float rotscale_mat[][4], float loc_m /* Convert Pose-Space Matrix to Bone-Space Matrix. * NOTE: this cannot be used to convert to pose-space transforms of the supplied * pose-channel into its local space (i.e. 'visual'-keyframing) */ -void armature_mat_pose_to_bone(bPoseChannel *pchan, float inmat[][4], float outmat[][4]) +void BKE_armature_mat_pose_to_bone(bPoseChannel *pchan, float inmat[][4], float outmat[][4]) { float rotscale_mat[4][4], loc_mat[4][4], inmat_[4][4]; /* Security, this allows to call with inmat == outmat! */ copy_m4_m4(inmat_, inmat); - pchan_to_pose_mat(pchan, rotscale_mat, loc_mat); + BKE_pchan_to_pose_mat(pchan, rotscale_mat, loc_mat); invert_m4(rotscale_mat); invert_m4(loc_mat); @@ -1270,14 +1270,14 @@ void armature_mat_pose_to_bone(bPoseChannel *pchan, float inmat[][4], float outm } /* Convert Bone-Space Matrix to Pose-Space Matrix. */ -void armature_mat_bone_to_pose(bPoseChannel *pchan, float inmat[][4], float outmat[][4]) +void BKE_armature_mat_bone_to_pose(bPoseChannel *pchan, float inmat[][4], float outmat[][4]) { float rotscale_mat[4][4], loc_mat[4][4], inmat_[4][4]; /* Security, this allows to call with inmat == outmat! */ copy_m4_m4(inmat_, inmat); - pchan_to_pose_mat(pchan, rotscale_mat, loc_mat); + BKE_pchan_to_pose_mat(pchan, rotscale_mat, loc_mat); mult_m4_m4m4(outmat, rotscale_mat, inmat_); mul_v3_m4v3(outmat[3], loc_mat, inmat_[3]); @@ -1286,7 +1286,7 @@ void armature_mat_bone_to_pose(bPoseChannel *pchan, float inmat[][4], float outm /* Convert Pose-Space Location to Bone-Space Location * NOTE: this cannot be used to convert to pose-space location of the supplied * pose-channel into its local space (i.e. 'visual'-keyframing) */ -void armature_loc_pose_to_bone(bPoseChannel *pchan, const float inloc[3], float outloc[3]) +void BKE_armature_loc_pose_to_bone(bPoseChannel *pchan, const float inloc[3], float outloc[3]) { float xLocMat[4][4] = MAT4_UNITY; float nLocMat[4][4]; @@ -1295,29 +1295,29 @@ void armature_loc_pose_to_bone(bPoseChannel *pchan, const float inloc[3], float copy_v3_v3(xLocMat[3], inloc); /* get bone-space cursor matrix and extract location */ - armature_mat_pose_to_bone(pchan, xLocMat, nLocMat); + BKE_armature_mat_pose_to_bone(pchan, xLocMat, nLocMat); copy_v3_v3(outloc, nLocMat[3]); } -void armature_mat_pose_to_bone_ex(Object *ob, bPoseChannel *pchan, float inmat[][4], float outmat[][4]) +void BKE_armature_mat_pose_to_bone_ex(Object *ob, bPoseChannel *pchan, float inmat[][4], float outmat[][4]) { bPoseChannel work_pchan = *pchan; /* recalculate pose matrix with only parent transformations, * bone loc/sca/rot is ignored, scene and frame are not used. */ - where_is_pose_bone(NULL, ob, &work_pchan, 0.0f, FALSE); + BKE_pose_where_is_bone(NULL, ob, &work_pchan, 0.0f, FALSE); /* find the matrix, need to remove the bone transforms first so this is * calculated as a matrix to set rather then a difference ontop of whats * already there. */ unit_m4(outmat); - pchan_apply_mat4(&work_pchan, outmat, FALSE); + BKE_pchan_apply_mat4(&work_pchan, outmat, FALSE); - armature_mat_pose_to_bone(&work_pchan, inmat, outmat); + BKE_armature_mat_pose_to_bone(&work_pchan, inmat, outmat); } -/* same as object_mat3_to_rot() */ -void pchan_mat3_to_rot(bPoseChannel *pchan, float mat[][3], short use_compat) +/* same as BKE_object_mat3_to_rot() */ +void BKE_pchan_mat3_to_rot(bPoseChannel *pchan, float mat[][3], short use_compat) { switch (pchan->rotmode) { case ROT_MODE_QUAT: @@ -1335,18 +1335,18 @@ void pchan_mat3_to_rot(bPoseChannel *pchan, float mat[][3], short use_compat) } /* Apply a 4x4 matrix to the pose bone, - * similar to object_apply_mat4() */ -void pchan_apply_mat4(bPoseChannel *pchan, float mat[][4], short use_compat) + * similar to BKE_object_apply_mat4() */ +void BKE_pchan_apply_mat4(bPoseChannel *pchan, float mat[][4], short use_compat) { float rot[3][3]; mat4_to_loc_rot_size(pchan->loc, rot, pchan->size, mat); - pchan_mat3_to_rot(pchan, rot, use_compat); + BKE_pchan_mat3_to_rot(pchan, rot, use_compat); } /* Remove rest-position effects from pose-transform for obtaining * 'visual' transformation of pose-channel. * (used by the Visual-Keyframing stuff) */ -void armature_mat_pose_to_delta(float delta_mat[][4], float pose_mat[][4], float arm_mat[][4]) +void BKE_armature_mat_pose_to_delta(float delta_mat[][4], float pose_mat[][4], float arm_mat[][4]) { float imat[4][4]; @@ -1496,7 +1496,7 @@ void vec_roll_to_mat3(const float vec[3], const float roll, float mat[][3]) /* recursive part, calculates restposition of entire tree of children */ /* used by exiting editmode too */ -void where_is_armature_bone(Bone *bone, Bone *prevbone) +void BKE_armature_where_is_bone(Bone *bone, Bone *prevbone) { float vec[3]; @@ -1529,19 +1529,19 @@ void where_is_armature_bone(Bone *bone, Bone *prevbone) /* and the kiddies */ prevbone = bone; for (bone = bone->childbase.first; bone; bone = bone->next) { - where_is_armature_bone(bone, prevbone); + BKE_armature_where_is_bone(bone, prevbone); } } /* updates vectors and matrices on rest-position level, only needed * after editing armature itself, now only on reading file */ -void where_is_armature(bArmature *arm) +void BKE_armature_where_is(bArmature *arm) { Bone *bone; /* hierarchical from root to children */ for (bone = arm->bonebase.first; bone; bone = bone->next) { - where_is_armature_bone(bone, NULL); + BKE_armature_where_is_bone(bone, NULL); } } @@ -1561,7 +1561,7 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected * to avoid crashing check for possible errors here */ for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { if (pchan->bone->layer & layer_protected) { - if (get_pose_channel(frompose, pchan->name) == NULL) { + if (BKE_pose_channel_find_name(frompose, pchan->name) == NULL) { printf("failed to sync proxy armature because '%s' is missing pose channel '%s'\n", from->id.name, pchan->name); error = 1; @@ -1573,7 +1573,7 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected return; /* clear all transformation values from library */ - rest_pose(frompose); + BKE_pose_rest(frompose); /* copy over all of the proxy's bone groups */ /* TODO for later @@ -1585,7 +1585,7 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected pose->active_group = frompose->active_group; for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { - pchanp = get_pose_channel(frompose, pchan->name); + pchanp = BKE_pose_channel_find_name(frompose, pchan->name); if (pchan->bone->layer & layer_protected) { ListBase proxylocal_constraints = {NULL, NULL}; @@ -1638,7 +1638,7 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected } /* free stuff from current channel */ - free_pose_channel(pchan); + BKE_pose_channel_free(pchan); /* the final copy */ *pchan = pchanw; @@ -1672,7 +1672,7 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected static int rebuild_pose_bone(bPose *pose, Bone *bone, bPoseChannel *parchan, int counter) { - bPoseChannel *pchan = verify_pose_channel(pose, bone->name); /* verify checks and/or adds */ + bPoseChannel *pchan = BKE_pose_channel_verify(pose, bone->name); /* verify checks and/or adds */ pchan->bone = bone; pchan->parent = parchan; @@ -1683,7 +1683,7 @@ static int rebuild_pose_bone(bPose *pose, Bone *bone, bPoseChannel *parchan, int counter = rebuild_pose_bone(pose, bone, pchan, counter); /* for quick detecting of next bone in chain, only b-bone uses it now */ if (bone->flag & BONE_CONNECTED) - pchan->child = get_pose_channel(pose, bone->name); + pchan->child = BKE_pose_channel_find_name(pose, bone->name); } return counter; @@ -1691,7 +1691,7 @@ static int rebuild_pose_bone(bPose *pose, Bone *bone, bPoseChannel *parchan, int /* only after leave editmode, duplicating, validating older files, library syncing */ /* NOTE: pose->flag is set for it */ -void armature_rebuild_pose(Object *ob, bArmature *arm) +void BKE_pose_rebuild(Object *ob, bArmature *arm) { Bone *bone; bPose *pose; @@ -1723,8 +1723,8 @@ void armature_rebuild_pose(Object *ob, bArmature *arm) for (pchan = pose->chanbase.first; pchan; pchan = next) { next = pchan->next; if (pchan->bone == NULL) { - free_pose_channel(pchan); - free_pose_channels_hash(pose); + BKE_pose_channel_free(pchan); + BKE_pose_channels_hash_free(pose); BLI_freelinkN(&pose->chanbase, pchan); } } @@ -1732,11 +1732,11 @@ void armature_rebuild_pose(Object *ob, bArmature *arm) /* synchronize protected layers with proxy */ if (ob->proxy) { - object_copy_proxy_drivers(ob, ob->proxy); + BKE_object_copy_proxy_drivers(ob, ob->proxy); pose_proxy_synchronize(ob, ob->proxy, arm->layer_protected); } - update_pose_constraint_flags(ob->pose); /* for IK detection for example */ + BKE_pose_update_constraint_flags(ob->pose); /* for IK detection for example */ /* the sorting */ if (counter>1) @@ -1745,7 +1745,7 @@ void armature_rebuild_pose(Object *ob, bArmature *arm) ob->pose->flag &= ~POSE_RECALC; ob->pose->flag |= POSE_WAS_REBUILT; - make_pose_channels_hash(ob->pose); + BKE_pose_channels_hash_make(ob->pose); } @@ -1959,7 +1959,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o float splineVec[3], scaleFac, radius =1.0f; /* firstly, calculate the bone matrix the standard way, since this is needed for roll control */ - where_is_pose_bone(scene, ob, pchan, ctime, 1); + BKE_pose_where_is_bone(scene, ob, pchan, ctime, 1); copy_v3_v3(poseHead, pchan->pose_head); copy_v3_v3(poseTail, pchan->pose_tail); @@ -2145,7 +2145,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o copy_v3_v3(pchan->pose_head, poseHead); /* recalculate tail, as it's now outdated after the head gets adjusted above! */ - where_is_pose_bone_tail(pchan); + BKE_pose_where_is_bone_tail(pchan); /* done! */ pchan->flag |= POSE_DONE; @@ -2183,7 +2183,7 @@ static void splineik_execute_tree(Scene *scene, Object *ob, bPoseChannel *pchan_ /* ********************** THE POSE SOLVER ******************* */ /* loc/rot/size to given mat4 */ -void pchan_to_mat4(bPoseChannel *pchan, float chan_mat[4][4]) +void BKE_pchan_to_mat4(bPoseChannel *pchan, float chan_mat[4][4]) { float smat[3][3]; float rmat[3][3]; @@ -2226,12 +2226,12 @@ void pchan_to_mat4(bPoseChannel *pchan, float chan_mat[4][4]) /* loc/rot/size to mat4 */ /* used in constraint.c too */ -void pchan_calc_mat(bPoseChannel *pchan) +void BKE_pchan_calc_mat(bPoseChannel *pchan) { /* this is just a wrapper around the copy of this function which calculates the matrix * and stores the result in any given channel */ - pchan_to_mat4(pchan, pchan->chan_mat); + BKE_pchan_to_mat4(pchan, pchan->chan_mat); } #if 0 /* XXX OLD ANIMSYS, NLASTRIPS ARE NO LONGER USED */ @@ -2361,7 +2361,7 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha #endif /* calculate tail of posechannel */ -void where_is_pose_bone_tail(bPoseChannel *pchan) +void BKE_pose_where_is_bone_tail(bPoseChannel *pchan) { float vec[3]; @@ -2374,17 +2374,17 @@ void where_is_pose_bone_tail(bPoseChannel *pchan) /* pchan is validated, as having bone and parent pointer * 'do_extra': when zero skips loc/size/rot, constraints and strip modifiers. */ -void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float ctime, int do_extra) +void BKE_pose_where_is_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float ctime, int do_extra) { /* This gives a chan_mat with actions (ipos) results. */ if (do_extra) - pchan_calc_mat(pchan); + BKE_pchan_calc_mat(pchan); else unit_m4(pchan->chan_mat); /* Construct the posemat based on PoseChannels, that we do before applying constraints. */ /* pose_mat(b) = pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) * chan_mat(b) */ - armature_mat_bone_to_pose(pchan, pchan->chan_mat, pchan->pose_mat); + BKE_armature_mat_bone_to_pose(pchan, pchan->chan_mat, pchan->pose_mat); /* Only rootbones get the cyclic offset (unless user doesn't want that). */ /* XXX That could be a problem for snapping and other "reverse transform" features... */ @@ -2430,12 +2430,12 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti /* calculate head */ copy_v3_v3(pchan->pose_head, pchan->pose_mat[3]); /* calculate tail */ - where_is_pose_bone_tail(pchan); + BKE_pose_where_is_bone_tail(pchan); } /* This only reads anim data from channels, and writes to channels */ /* This is the only function adding poses */ -void where_is_pose(Scene *scene, Object *ob) +void BKE_pose_where_is(Scene *scene, Object *ob) { bArmature *arm; Bone *bone; @@ -2450,9 +2450,9 @@ void where_is_pose(Scene *scene, Object *ob) if (ELEM(NULL, arm, scene)) return; if ((ob->pose == NULL) || (ob->pose->flag & POSE_RECALC)) - armature_rebuild_pose(ob, arm); + BKE_pose_rebuild(ob, arm); - ctime = BKE_curframe(scene); /* not accurate... */ + ctime = BKE_scene_frame_get(scene); /* not accurate... */ /* In editmode or restposition we read the data from the bones */ if (arm->edbo || (arm->flag & ARM_RESTPOS)) { @@ -2494,7 +2494,7 @@ void where_is_pose(Scene *scene, Object *ob) } /* 5. otherwise just call the normal solver */ else if (!(pchan->flag & POSE_DONE)) { - where_is_pose_bone(scene, ob, pchan, ctime, 1); + BKE_pose_where_is_bone(scene, ob, pchan, ctime, 1); } } /* 6. release the IK tree */ @@ -2517,13 +2517,13 @@ int get_selected_defgroups(Object *ob, char *dg_selection, int defbase_tot) { bDeformGroup *defgroup; unsigned int i; - Object *armob = object_pose_armature_get(ob); + Object *armob = BKE_object_pose_armature_get(ob); int dg_flags_sel_tot = 0; if (armob) { bPose *pose = armob->pose; for (i = 0, defgroup = ob->defbase.first; i < defbase_tot && defgroup; defgroup = defgroup->next, i++) { - bPoseChannel *pchan = get_pose_channel(pose, defgroup->name); + bPoseChannel *pchan = BKE_pose_channel_find_name(pose, defgroup->name); if (pchan && (pchan->bone->flag & BONE_SELECTED)) { dg_selection[i] = TRUE; dg_flags_sel_tot++; @@ -2545,7 +2545,7 @@ int minmax_armature(Object *ob, float min[3], float max[3]) { bPoseChannel *pchan; - /* For now, we assume where_is_pose has already been called (hence we have valid data in pachan). */ + /* For now, we assume BKE_pose_where_is has already been called (hence we have valid data in pachan). */ for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { DO_MINMAX(pchan->pose_head, min, max); DO_MINMAX(pchan->pose_tail, min, max); @@ -2581,10 +2581,10 @@ void boundbox_armature(Object *ob, float *loc, float *size) size[1] = (max[1] - min[1]) / 2.0f; size[2] = (max[2] - min[2]) / 2.0f; - boundbox_set_from_min_max(bb, min, max); + BKE_boundbox_init_from_minmax(bb, min, max); } -BoundBox *BKE_armature_get_bb(Object *ob) +BoundBox *BKE_armature_boundbox_get(Object *ob) { boundbox_armature(ob, NULL, NULL); diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 2b741d6d8eb..58ada7b0784 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -110,7 +110,7 @@ void free_blender(void) IMB_exit(); - BLI_cb_finalize(); + BLI_callback_global_finalize(); seq_stripelem_cache_destruct(); IMB_moviecache_destruct(); @@ -173,7 +173,7 @@ static void clean_paths(Main *main) { Scene *scene; - bpath_traverse_main(main, clean_paths_visit_cb, BPATH_TRAVERSE_SKIP_MULTIFILE, NULL); + BLI_bpath_traverse_main(main, clean_paths_visit_cb, BLI_BPATH_TRAVERSE_SKIP_MULTIFILE, NULL); for (scene= main->scene.first; scene; scene= scene->id.next) { BLI_clean(scene->r.pic); @@ -314,7 +314,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath BLI_strncpy(G.main->name, filepath, FILE_MAX); /* baseflags, groups, make depsgraph, etc */ - set_scene_bg(G.main, CTX_data_scene(C)); + BKE_scene_set_background(G.main, CTX_data_scene(C)); MEM_freeN(bfd); diff --git a/source/blender/blenkernel/intern/booleanops_mesh.c b/source/blender/blenkernel/intern/booleanops_mesh.c index 7c225eb0fad..972793227a8 100644 --- a/source/blender/blenkernel/intern/booleanops_mesh.c +++ b/source/blender/blenkernel/intern/booleanops_mesh.c @@ -78,7 +78,7 @@ MakeCSGMeshFromBlenderBase( Mesh *me; if (output == NULL || base == NULL) return 0; - me = get_mesh(base->object); + me = BKE_mesh_from_object(base->object); output->m_descriptor.user_face_vertex_data_size = 0; output->m_descriptor.user_data_size = sizeof(FaceData); @@ -105,7 +105,7 @@ CSG_LoadBlenderMesh( Mesh *me; if (output == NULL || obj == NULL) return 0; - me = get_mesh(obj); + me = BKE_mesh_from_object(obj); output->m_descriptor.user_face_vertex_data_size = 0; output->m_descriptor.user_data_size = sizeof(FaceData); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index b3d128bf2b4..a1e8a11e9ff 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -67,7 +67,7 @@ #include "RE_render_ext.h" /* externtex */ #include "RE_shader_ext.h" -static void brush_set_defaults(Brush *brush) +static void brush_defaults(Brush *brush) { brush->blend = 0; brush->flag = 0; @@ -122,30 +122,30 @@ static void brush_set_defaults(Brush *brush) /* Datablock add/copy/free/make_local */ -Brush *add_brush(const char *name) +Brush *BKE_brush_add(const char *name) { Brush *brush; - brush= alloc_libblock(&G.main->brush, ID_BR, name); + brush= BKE_libblock_alloc(&G.main->brush, ID_BR, name); /* enable fake user by default */ brush->id.flag |= LIB_FAKEUSER; - brush_set_defaults(brush); + brush_defaults(brush); brush->sculpt_tool = SCULPT_TOOL_DRAW; /* sculpting defaults to the draw tool for new brushes */ /* the default alpha falloff curve */ - brush_curve_preset(brush, CURVE_PRESET_SMOOTH); + BKE_brush_curve_preset(brush, CURVE_PRESET_SMOOTH); return brush; } -Brush *copy_brush(Brush *brush) +Brush *BKE_brush_copy(Brush *brush) { Brush *brushn; - brushn= copy_libblock(&brush->id); + brushn= BKE_libblock_copy(&brush->id); if (brush->mtex.tex) id_us_plus((ID*)brush->mtex.tex); @@ -167,7 +167,7 @@ Brush *copy_brush(Brush *brush) } /* not brush itself */ -void free_brush(Brush *brush) +void BKE_brush_free(Brush *brush) { if (brush->mtex.tex) brush->mtex.tex->id.us--; @@ -186,7 +186,7 @@ static void extern_local_brush(Brush *brush) id_lib_extern((ID *)brush->clone.image); } -void make_local_brush(Brush *brush) +void BKE_brush_make_local(Brush *brush) { /* - only lib users: do nothing @@ -225,7 +225,7 @@ void make_local_brush(Brush *brush) } } else if (is_local && is_lib) { - Brush *brush_new= copy_brush(brush); + Brush *brush_new= BKE_brush_copy(brush); brush_new->id.us= 1; /* only keep fake user */ brush_new->id.flag |= LIB_FAKEUSER; @@ -242,11 +242,11 @@ void make_local_brush(Brush *brush) } } -void brush_debug_print_state(Brush *br) +void BKE_brush_debug_print_state(Brush *br) { /* create a fake brush and set it to the defaults */ Brush def= {{NULL}}; - brush_set_defaults(&def); + brush_defaults(&def); #define BR_TEST(field, t) \ if (br->field != def.field) \ @@ -329,14 +329,14 @@ void brush_debug_print_state(Brush *br) #undef BR_TEST_FLAG } -void brush_reset_sculpt(Brush *br) +void BKE_brush_sculpt_reset(Brush *br) { /* enable this to see any non-default * settings used by a brush: */ - // brush_debug_print_state(br); + // BKE_brush_debug_print_state(br); - brush_set_defaults(br); - brush_curve_preset(br, CURVE_PRESET_SMOOTH); + brush_defaults(br); + BKE_brush_curve_preset(br, CURVE_PRESET_SMOOTH); switch (br->sculpt_tool) { case SCULPT_TOOL_CLAY: @@ -409,7 +409,7 @@ void brush_reset_sculpt(Brush *br) } /* Library Operations */ -void brush_curve_preset(Brush *b, /*CurveMappingPreset*/int preset) +void BKE_brush_curve_preset(Brush *b, /*CurveMappingPreset*/int preset) { CurveMap *cm = NULL; @@ -424,7 +424,7 @@ void brush_curve_preset(Brush *b, /*CurveMappingPreset*/int preset) curvemapping_changed(b->curve, 0); } -int brush_texture_set_nr(Brush *brush, int nr) +int BKE_brush_texture_set_nr(Brush *brush, int nr) { ID *idtest, *id=NULL; @@ -432,12 +432,12 @@ int brush_texture_set_nr(Brush *brush, int nr) idtest= (ID*)BLI_findlink(&G.main->tex, nr-1); if (idtest==NULL) { /* new tex */ - if (id) idtest= (ID *)copy_texture((Tex *)id); + if (id) idtest= (ID *)BKE_texture_copy((Tex *)id); else idtest= (ID *)add_texture("Tex"); idtest->us--; } if (idtest!=id) { - brush_texture_delete(brush); + BKE_brush_texture_delete(brush); brush->mtex.tex= (Tex*)idtest; id_us_plus(idtest); @@ -448,7 +448,7 @@ int brush_texture_set_nr(Brush *brush, int nr) return 0; } -int brush_texture_delete(Brush *brush) +int BKE_brush_texture_delete(Brush *brush) { if (brush->mtex.tex) brush->mtex.tex->id.us--; @@ -456,13 +456,13 @@ int brush_texture_delete(Brush *brush) return 1; } -int brush_clone_image_set_nr(Brush *brush, int nr) +int BKE_brush_clone_image_set_nr(Brush *brush, int nr) { if (brush && nr > 0) { Image *ima= (Image*)BLI_findlink(&G.main->image, nr-1); if (ima) { - brush_clone_image_delete(brush); + BKE_brush_clone_image_delete(brush); brush->clone.image= ima; id_us_plus(&ima->id); brush->clone.offset[0]= brush->clone.offset[1]= 0.0f; @@ -474,7 +474,7 @@ int brush_clone_image_set_nr(Brush *brush, int nr) return 0; } -int brush_clone_image_delete(Brush *brush) +int BKE_brush_clone_image_delete(Brush *brush) { if (brush && brush->clone.image) { brush->clone.image->id.us--; @@ -486,14 +486,14 @@ int brush_clone_image_delete(Brush *brush) } /* Brush Sampling */ -void brush_sample_tex(const Scene *scene, Brush *brush, const float xy[2], float rgba[4], const int thread) +void BKE_brush_sample_tex(const Scene *scene, Brush *brush, const float xy[2], float rgba[4], const int thread) { MTex *mtex= &brush->mtex; if (mtex && mtex->tex) { float co[3], tin, tr, tg, tb, ta; int hasrgb; - const int radius= brush_size(scene, brush); + const int radius= BKE_brush_size_get(scene, brush); co[0]= xy[0]/radius; co[1]= xy[1]/radius; @@ -520,14 +520,14 @@ void brush_sample_tex(const Scene *scene, Brush *brush, const float xy[2], float } /* TODO, use define for 'texfall' arg */ -void brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texfall, int bufsize, ImBuf **outbuf, int use_color_correction) +void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texfall, int bufsize, ImBuf **outbuf, int use_color_correction) { ImBuf *ibuf; float xy[2], rgba[4], *dstf; int x, y, rowbytes, xoff, yoff, imbflag; - const int radius= brush_size(scene, brush); + const int radius= BKE_brush_size_get(scene, brush); unsigned char *dst, crgb[3]; - const float alpha= brush_alpha(scene, brush); + const float alpha= BKE_brush_alpha_get(scene, brush); float brush_rgb[3]; imbflag= (flt)? IB_rectfloat: IB_rect; @@ -555,15 +555,15 @@ void brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texfall, if (texfall == 0) { copy_v3_v3(dstf, brush_rgb); - dstf[3]= alpha*brush_curve_strength_clamp(brush, len_v2(xy), radius); + dstf[3]= alpha*BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); } else if (texfall == 1) { - brush_sample_tex(scene, brush, xy, dstf, 0); + BKE_brush_sample_tex(scene, brush, xy, dstf, 0); } else { - brush_sample_tex(scene, brush, xy, rgba, 0); + BKE_brush_sample_tex(scene, brush, xy, rgba, 0); mul_v3_v3v3(dstf, rgba, brush_rgb); - dstf[3] = rgba[3]*alpha*brush_curve_strength_clamp(brush, len_v2(xy), radius); + dstf[3] = rgba[3]*alpha*BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); } } } @@ -580,7 +580,7 @@ void brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texfall, xy[1] = y + yoff; if (texfall == 0) { - alpha_f = alpha * brush_curve_strength(brush, len_v2(xy), radius); + alpha_f = alpha * BKE_brush_curve_strength(brush, len_v2(xy), radius); dst[0] = crgb[0]; dst[1] = crgb[1]; @@ -588,21 +588,21 @@ void brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texfall, dst[3] = FTOCHAR(alpha_f); } else if (texfall == 1) { - brush_sample_tex(scene, brush, xy, rgba, 0); + BKE_brush_sample_tex(scene, brush, xy, rgba, 0); rgba_float_to_uchar(dst, rgba); } else if (texfall == 2) { - brush_sample_tex(scene, brush, xy, rgba, 0); + BKE_brush_sample_tex(scene, brush, xy, rgba, 0); mul_v3_v3(rgba, brush->rgb); - alpha_f = rgba[3] * alpha * brush_curve_strength_clamp(brush, len_v2(xy), radius); + alpha_f = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); rgb_float_to_uchar(dst, rgba); dst[3] = FTOCHAR(alpha_f); } else { - brush_sample_tex(scene, brush, xy, rgba, 0); - alpha_f = rgba[3] * alpha * brush_curve_strength_clamp(brush, len_v2(xy), radius); + BKE_brush_sample_tex(scene, brush, xy, rgba, 0); + alpha_f = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); dst[0] = crgb[0]; dst[1] = crgb[1]; @@ -631,7 +631,7 @@ void brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texfall, // In anycase, a better solution is needed to prevent // inconsistency. -void brush_set_size(Scene *scene, Brush *brush, int size) +void BKE_brush_size_set(Scene *scene, Brush *brush, int size) { UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; @@ -641,14 +641,14 @@ void brush_set_size(Scene *scene, Brush *brush, int size) brush->size= size; } -int brush_size(const Scene *scene, Brush *brush) +int BKE_brush_size_get(const Scene *scene, Brush *brush) { UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; return (ups->flag & UNIFIED_PAINT_SIZE) ? ups->size : brush->size; } -int brush_use_locked_size(const Scene *scene, Brush *brush) +int BKE_brush_use_locked_size(const Scene *scene, Brush *brush) { const short us_flag = scene->toolsettings->unified_paint_settings.flag; @@ -657,7 +657,7 @@ int brush_use_locked_size(const Scene *scene, Brush *brush) (brush->flag & BRUSH_LOCK_SIZE); } -int brush_use_size_pressure(const Scene *scene, Brush *brush) +int BKE_brush_use_size_pressure(const Scene *scene, Brush *brush) { const short us_flag = scene->toolsettings->unified_paint_settings.flag; @@ -666,7 +666,7 @@ int brush_use_size_pressure(const Scene *scene, Brush *brush) (brush->flag & BRUSH_SIZE_PRESSURE); } -int brush_use_alpha_pressure(const Scene *scene, Brush *brush) +int BKE_brush_use_alpha_pressure(const Scene *scene, Brush *brush) { const short us_flag = scene->toolsettings->unified_paint_settings.flag; @@ -675,7 +675,7 @@ int brush_use_alpha_pressure(const Scene *scene, Brush *brush) (brush->flag & BRUSH_ALPHA_PRESSURE); } -void brush_set_unprojected_radius(Scene *scene, Brush *brush, float unprojected_radius) +void BKE_brush_unprojected_radius_set(Scene *scene, Brush *brush, float unprojected_radius) { UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; @@ -685,7 +685,7 @@ void brush_set_unprojected_radius(Scene *scene, Brush *brush, float unprojected_ brush->unprojected_radius= unprojected_radius; } -float brush_unprojected_radius(const Scene *scene, Brush *brush) +float BKE_brush_unprojected_radius_get(const Scene *scene, Brush *brush) { UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; @@ -694,7 +694,7 @@ float brush_unprojected_radius(const Scene *scene, Brush *brush) brush->unprojected_radius; } -static void brush_set_alpha(Scene *scene, Brush *brush, float alpha) +static void brush_alpha_set(Scene *scene, Brush *brush, float alpha) { UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; @@ -704,21 +704,21 @@ static void brush_set_alpha(Scene *scene, Brush *brush, float alpha) brush->alpha= alpha; } -float brush_alpha(const Scene *scene, Brush *brush) +float BKE_brush_alpha_get(const Scene *scene, Brush *brush) { UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; return (ups->flag & UNIFIED_PAINT_ALPHA) ? ups->alpha : brush->alpha; } -float brush_weight(const Scene *scene, Brush *brush) +float BKE_brush_weight_get(const Scene *scene, Brush *brush) { UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; return (ups->flag & UNIFIED_PAINT_WEIGHT) ? ups->weight : brush->weight; } -void brush_set_weight(const Scene *scene, Brush *brush, float value) +void BKE_brush_weight_set(const Scene *scene, Brush *brush, float value) { UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; @@ -729,9 +729,9 @@ void brush_set_weight(const Scene *scene, Brush *brush, float value) } /* scale unprojected radius to reflect a change in the brush's 2D size */ -void brush_scale_unprojected_radius(float *unprojected_radius, - int new_brush_size, - int old_brush_size) +void BKE_brush_scale_unprojected_radius(float *unprojected_radius, + int new_brush_size, + int old_brush_size) { float scale = new_brush_size; /* avoid division by zero */ @@ -741,15 +741,15 @@ void brush_scale_unprojected_radius(float *unprojected_radius, } /* scale brush size to reflect a change in the brush's unprojected radius */ -void brush_scale_size(int *brush_size, - float new_unprojected_radius, - float old_unprojected_radius) +void BKE_brush_scale_size(int *BKE_brush_size_get, + float new_unprojected_radius, + float old_unprojected_radius) { float scale = new_unprojected_radius; /* avoid division by zero */ if (old_unprojected_radius != 0) scale /= new_unprojected_radius; - (*brush_size)= (int)((float)(*brush_size) * scale); + (*BKE_brush_size_get)= (int)((float)(*BKE_brush_size_get) * scale); } /* Brush Painting */ @@ -757,7 +757,7 @@ void brush_scale_size(int *brush_size, typedef struct BrushPainterCache { short enabled; - int size; /* size override, if 0 uses 2*brush_size(brush) */ + int size; /* size override, if 0 uses 2*BKE_brush_size_get(brush) */ short flt; /* need float imbuf? */ short texonly; /* no alpha, color or fallof, only texture in imbuf */ @@ -795,7 +795,7 @@ struct BrushPainter { BrushPainterCache cache; }; -BrushPainter *brush_painter_new(Scene *scene, Brush *brush) +BrushPainter *BKE_brush_painter_new(Scene *scene, Brush *brush) { BrushPainter *painter= MEM_callocN(sizeof(BrushPainter), "BrushPainter"); @@ -804,15 +804,15 @@ BrushPainter *brush_painter_new(Scene *scene, Brush *brush) painter->firsttouch= 1; painter->cache.lastsize= -1; /* force ibuf create in refresh */ - painter->startsize = brush_size(scene, brush); - painter->startalpha = brush_alpha(scene, brush); + painter->startsize = BKE_brush_size_get(scene, brush); + painter->startalpha = BKE_brush_alpha_get(scene, brush); painter->startjitter = brush->jitter; painter->startspacing = brush->spacing; return painter; } -void brush_painter_require_imbuf(BrushPainter *painter, short flt, short texonly, int size) +void BKE_brush_painter_require_imbuf(BrushPainter *painter, short flt, short texonly, int size) { if ((painter->cache.flt != flt) || (painter->cache.size != size) || ((painter->cache.texonly != texonly) && texonly)) { @@ -834,12 +834,12 @@ void brush_painter_require_imbuf(BrushPainter *painter, short flt, short texonly painter->cache.enabled= 1; } -void brush_painter_free(BrushPainter *painter) +void BKE_brush_painter_free(BrushPainter *painter) { Brush *brush = painter->brush; - brush_set_size(painter->scene, brush, painter->startsize); - brush_set_alpha(painter->scene, brush, painter->startalpha); + BKE_brush_size_set(painter->scene, brush, painter->startsize); + brush_alpha_set(painter->scene, brush, painter->startalpha); brush->jitter = painter->startjitter; brush->spacing = painter->startspacing; @@ -859,7 +859,7 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, float *bf, *mf, *tf, *otf=NULL, xoff, yoff, xy[2], rgba[4]; unsigned char *b, *m, *t, *ot= NULL; int dotexold, origx= x, origy= y; - const int radius= brush_size(painter->scene, brush); + const int radius= BKE_brush_size_get(painter->scene, brush); xoff = -radius + 0.5f; yoff = -radius + 0.5f; @@ -897,7 +897,7 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, xy[0] = x + xoff; xy[1] = y + yoff; - brush_sample_tex(scene, brush, xy, tf, 0); + BKE_brush_sample_tex(scene, brush, xy, tf, 0); } bf[0] = tf[0]*mf[0]; @@ -928,7 +928,7 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, xy[0] = x + xoff; xy[1] = y + yoff; - brush_sample_tex(scene, brush, xy, rgba, 0); + BKE_brush_sample_tex(scene, brush, xy, rgba, 0); rgba_float_to_uchar(t, rgba); } @@ -948,7 +948,7 @@ static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, const BrushPainterCache *cache= &painter->cache; ImBuf *oldtexibuf, *ibuf; int imbflag, destx, desty, srcx, srcy, w, h, x1, y1, x2, y2; - const int diameter= 2*brush_size(scene, brush); + const int diameter= 2*BKE_brush_size_get(scene, brush); imbflag= (cache->flt)? IB_rectfloat: IB_rect; if (!cache->ibuf) @@ -1004,8 +1004,8 @@ static void brush_painter_refresh_cache(BrushPainter *painter, const float pos[2 MTex *mtex= &brush->mtex; int size; short flt; - const int diameter= 2*brush_size(scene, brush); - const float alpha= brush_alpha(scene, brush); + const int diameter= 2*BKE_brush_size_get(scene, brush); + const float alpha= BKE_brush_alpha_get(scene, brush); if (diameter != cache->lastsize || alpha != cache->lastalpha || @@ -1024,11 +1024,11 @@ static void brush_painter_refresh_cache(BrushPainter *painter, const float pos[2 size= (cache->size)? cache->size: diameter; if (brush->flag & BRUSH_FIXED_TEX) { - brush_imbuf_new(scene, brush, flt, 3, size, &cache->maskibuf, use_color_correction); + BKE_brush_imbuf_new(scene, brush, flt, 3, size, &cache->maskibuf, use_color_correction); brush_painter_fixed_tex_partial_update(painter, pos); } else - brush_imbuf_new(scene, brush, flt, 2, size, &cache->ibuf, use_color_correction); + BKE_brush_imbuf_new(scene, brush, flt, 2, size, &cache->ibuf, use_color_correction); cache->lastsize= diameter; cache->lastalpha= alpha; @@ -1043,24 +1043,24 @@ static void brush_painter_refresh_cache(BrushPainter *painter, const float pos[2 } } -void brush_painter_break_stroke(BrushPainter *painter) +void BKE_brush_painter_break_stroke(BrushPainter *painter) { painter->firsttouch= 1; } -static void brush_apply_pressure(BrushPainter *painter, Brush *brush, float pressure) +static void brush_pressure_apply(BrushPainter *painter, Brush *brush, float pressure) { - if (brush_use_alpha_pressure(painter->scene, brush)) - brush_set_alpha(painter->scene, brush, MAX2(0.0f, painter->startalpha*pressure)); - if (brush_use_size_pressure(painter->scene, brush)) - brush_set_size(painter->scene, brush, MAX2(1.0f, painter->startsize*pressure)); + if (BKE_brush_use_alpha_pressure(painter->scene, brush)) + brush_alpha_set(painter->scene, brush, MAX2(0.0f, painter->startalpha*pressure)); + if (BKE_brush_use_size_pressure(painter->scene, brush)) + BKE_brush_size_set(painter->scene, brush, MAX2(1.0f, painter->startsize*pressure)); if (brush->flag & BRUSH_JITTER_PRESSURE) brush->jitter = MAX2(0.0f, painter->startjitter*pressure); if (brush->flag & BRUSH_SPACING_PRESSURE) brush->spacing = MAX2(1.0f, painter->startspacing*(1.5f-pressure)); } -void brush_jitter_pos(const Scene *scene, Brush *brush, const float pos[2], float jitterpos[2]) +void BKE_brush_jitter_pos(const Scene *scene, Brush *brush, const float pos[2], float jitterpos[2]) { int use_jitter= brush->jitter != 0; @@ -1070,7 +1070,7 @@ void brush_jitter_pos(const Scene *scene, Brush *brush, const float pos[2], floa if (use_jitter) { float rand_pos[2]; - const int radius= brush_size(scene, brush); + const int radius= BKE_brush_size_get(scene, brush); const int diameter= 2*radius; // find random position within a circle of diameter 1 @@ -1087,8 +1087,8 @@ void brush_jitter_pos(const Scene *scene, Brush *brush, const float pos[2], floa } } -int brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2], double time, float pressure, - void *user, int use_color_correction) +int BKE_brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2], double time, float pressure, + void *user, int use_color_correction) { Scene *scene= painter->scene; Brush *brush= painter->brush; @@ -1105,7 +1105,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2 painter->startpaintpos[0]= pos[0]; painter->startpaintpos[1]= pos[1]; - brush_apply_pressure(painter, brush, pressure); + brush_pressure_apply(painter, brush, pressure); if (painter->cache.enabled) brush_painter_refresh_cache(painter, pos, use_color_correction); totpaintops += func(user, painter->cache.ibuf, pos, pos); @@ -1152,11 +1152,11 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2 else { float startdistance, spacing, step, paintpos[2], dmousepos[2], finalpos[2]; float t, len, press; - const int radius= brush_size(scene, brush); + const int radius= BKE_brush_size_get(scene, brush); /* compute brush spacing adapted to brush radius, spacing may depend * on pressure, so update it */ - brush_apply_pressure(painter, brush, painter->lastpressure); + brush_pressure_apply(painter, brush, painter->lastpressure); spacing= MAX2(1.0f, radius)*brush->spacing*0.01f; /* setup starting distance, direction vector and accumulated distance */ @@ -1174,10 +1174,10 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2 t = step/len; press= (1.0f-t)*painter->lastpressure + t*pressure; - brush_apply_pressure(painter, brush, press); + brush_pressure_apply(painter, brush, press); spacing= MAX2(1.0f, radius)*brush->spacing*0.01f; - brush_jitter_pos(scene, brush, paintpos, finalpos); + BKE_brush_jitter_pos(scene, brush, paintpos, finalpos); if (painter->cache.enabled) brush_painter_refresh_cache(painter, finalpos, use_color_correction); @@ -1192,7 +1192,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2 } } else { - brush_jitter_pos(scene, brush, pos, finalpos); + BKE_brush_jitter_pos(scene, brush, pos, finalpos); if (painter->cache.enabled) brush_painter_refresh_cache(painter, finalpos, use_color_correction); @@ -1218,9 +1218,9 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2 painter->accumtime -= painttime; while (painter->accumtime >= (double)brush->rate) { - brush_apply_pressure(painter, brush, pressure); + brush_pressure_apply(painter, brush, pressure); - brush_jitter_pos(scene, brush, pos, finalpos); + BKE_brush_jitter_pos(scene, brush, pos, finalpos); if (painter->cache.enabled) brush_painter_refresh_cache(painter, finalpos, use_color_correction); @@ -1238,8 +1238,8 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2 painter->lastmousepos[1]= pos[1]; painter->lastpressure= pressure; - brush_set_alpha(scene, brush, painter->startalpha); - brush_set_size(scene, brush, painter->startsize); + brush_alpha_set(scene, brush, painter->startalpha); + BKE_brush_size_set(scene, brush, painter->startsize); brush->jitter = painter->startjitter; brush->spacing = painter->startspacing; @@ -1247,7 +1247,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2 } /* Uses the brush curve control to find a strength value between 0 and 1 */ -float brush_curve_strength_clamp(Brush *br, float p, const float len) +float BKE_brush_curve_strength_clamp(Brush *br, float p, const float len) { if (p >= len) return 0; else p= p/len; @@ -1259,7 +1259,7 @@ float brush_curve_strength_clamp(Brush *br, float p, const float len) } /* same as above but can return negative values if the curve enables * used for sculpt only */ -float brush_curve_strength(Brush *br, float p, const float len) +float BKE_brush_curve_strength(Brush *br, float p, const float len) { if (p >= len) p= 1.0f; @@ -1270,7 +1270,7 @@ float brush_curve_strength(Brush *br, float p, const float len) } /* TODO: should probably be unified with BrushPainter stuff? */ -unsigned int *brush_gen_texture_cache(Brush *br, int half_side) +unsigned int *BKE_brush_gen_texture_cache(Brush *br, int half_side) { unsigned int *texcache = NULL; MTex *mtex = &br->mtex; @@ -1316,7 +1316,7 @@ unsigned int *brush_gen_texture_cache(Brush *br, int half_side) } /**** Radial Control ****/ -struct ImBuf *brush_gen_radial_control_imbuf(Brush *br) +struct ImBuf *BKE_brush_gen_radial_control_imbuf(Brush *br) { ImBuf *im = MEM_callocN(sizeof(ImBuf), "radial control texture"); unsigned int *texcache; @@ -1324,14 +1324,14 @@ struct ImBuf *brush_gen_radial_control_imbuf(Brush *br) int half = side / 2; int i, j; - texcache = brush_gen_texture_cache(br, half); + texcache = BKE_brush_gen_texture_cache(br, half); im->rect_float = MEM_callocN(sizeof(float) * side * side, "radial control rect"); im->x = im->y = side; for (i=0; i<side; ++i) { for (j=0; j<side; ++j) { float magn= sqrt(pow(i - half, 2) + pow(j - half, 2)); - im->rect_float[i*side + j]= brush_curve_strength_clamp(br, magn, half); + im->rect_float[i*side + j]= BKE_brush_curve_strength_clamp(br, magn, half); } } diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index 2be22e0e28b..6aff331e1b4 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -50,11 +50,11 @@ /****************************** Camera Datablock *****************************/ -void *add_camera(const char *name) +void *BKE_camera_add(const char *name) { Camera *cam; - cam= alloc_libblock(&G.main->camera, ID_CA, name); + cam= BKE_libblock_alloc(&G.main->camera, ID_CA, name); cam->lens= 35.0f; cam->sensor_x= 32.0f; @@ -69,18 +69,18 @@ void *add_camera(const char *name) return cam; } -Camera *copy_camera(Camera *cam) +Camera *BKE_camera_copy(Camera *cam) { Camera *camn; - camn= copy_libblock(&cam->id); + camn= BKE_libblock_copy(&cam->id); id_lib_extern((ID *)camn->dof_ob); return camn; } -void make_local_camera(Camera *cam) +void BKE_camera_make_local(Camera *cam) { Main *bmain= G.main; Object *ob; @@ -108,7 +108,7 @@ void make_local_camera(Camera *cam) id_clear_lib_data(bmain, &cam->id); } else if (is_local && is_lib) { - Camera *cam_new= copy_camera(cam); + Camera *cam_new= BKE_camera_copy(cam); cam_new->id.us= 0; @@ -127,14 +127,14 @@ void make_local_camera(Camera *cam) } } -void free_camera(Camera *ca) +void BKE_camera_free(Camera *ca) { BKE_free_animdata((ID *)ca); } /******************************** Camera Usage *******************************/ -void object_camera_mode(RenderData *rd, Object *cam_ob) +void BKE_camera_object_mode(RenderData *rd, Object *cam_ob) { rd->mode &= ~(R_ORTHO|R_PANORAMA); @@ -146,7 +146,7 @@ void object_camera_mode(RenderData *rd, Object *cam_ob) } /* get the camera's dof value, takes the dof object into account */ -float object_camera_dof_distance(Object *ob) +float BKE_camera_object_dof_distance(Object *ob) { Camera *cam = (Camera *)ob->data; if (ob->type != OB_CAMERA) @@ -165,7 +165,7 @@ float object_camera_dof_distance(Object *ob) return cam->YF_dofdist; } -float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y) +float BKE_camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y) { /* sensor size used to fit to. for auto, sensor_x is both x and y. */ if (sensor_fit == CAMERA_SENSOR_FIT_VERT) @@ -174,7 +174,7 @@ float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y) return sensor_x; } -int camera_sensor_fit(int sensor_fit, float sizex, float sizey) +int BKE_camera_sensor_fit(int sensor_fit, float sizex, float sizey) { if (sensor_fit == CAMERA_SENSOR_FIT_AUTO) { if (sizex >= sizey) @@ -188,7 +188,7 @@ int camera_sensor_fit(int sensor_fit, float sizex, float sizey) /******************************** Camera Params *******************************/ -void camera_params_init(CameraParams *params) +void BKE_camera_params_init(CameraParams *params) { memset(params, 0, sizeof(CameraParams)); @@ -200,7 +200,7 @@ void camera_params_init(CameraParams *params) params->zoom= 1.0f; } -void camera_params_from_object(CameraParams *params, Object *ob) +void BKE_camera_params_from_object(CameraParams *params, Object *ob) { if (!ob) return; @@ -239,7 +239,7 @@ void camera_params_from_object(CameraParams *params, Object *ob) } } -void camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView3D *rv3d) +void BKE_camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView3D *rv3d) { /* common */ params->lens= v3d->lens; @@ -248,7 +248,7 @@ void camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView3D * if (rv3d->persp==RV3D_CAMOB) { /* camera view */ - camera_params_from_object(params, v3d->camera); + BKE_camera_params_from_object(params, v3d->camera); params->zoom= BKE_screen_view3d_zoom_to_fac((float)rv3d->camzoom); @@ -275,7 +275,7 @@ void camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView3D * } } -void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float xasp, float yasp) +void BKE_camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float xasp, float yasp) { rctf viewplane; float pixsize, viewfac, sensor_size, dx, dy; @@ -293,12 +293,12 @@ void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, f } else { /* perspective camera */ - sensor_size= camera_sensor_size(params->sensor_fit, params->sensor_x, params->sensor_y); + sensor_size= BKE_camera_sensor_size(params->sensor_fit, params->sensor_x, params->sensor_y); pixsize= (sensor_size * params->clipsta)/params->lens; } /* determine sensor fit */ - sensor_fit = camera_sensor_fit(params->sensor_fit, xasp*winx, yasp*winy); + sensor_fit = BKE_camera_sensor_fit(params->sensor_fit, xasp*winx, yasp*winy); if (sensor_fit==CAMERA_SENSOR_FIT_HOR) viewfac= winx; @@ -351,23 +351,23 @@ void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, f } /* viewplane is assumed to be already computed */ -void camera_params_compute_matrix(CameraParams *params) +void BKE_camera_params_compute_matrix(CameraParams *params) { - rctf viewplane= params->viewplane; + rctf viewplane = params->viewplane; /* compute projection matrix */ if (params->is_ortho) orthographic_m4(params->winmat, viewplane.xmin, viewplane.xmax, - viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend); + viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend); else perspective_m4(params->winmat, viewplane.xmin, viewplane.xmax, - viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend); + viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend); } /***************************** Camera View Frame *****************************/ -void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const short do_clip, const float scale[3], - float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3]) +void BKE_camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const short do_clip, const float scale[3], + float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3]) { float facx, facy; float depth; @@ -376,7 +376,7 @@ void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const sh if (scene) { float aspx= (float) scene->r.xsch*scene->r.xasp; float aspy= (float) scene->r.ysch*scene->r.yasp; - int sensor_fit= camera_sensor_fit(camera->sensor_fit, aspx, aspy); + int sensor_fit= BKE_camera_sensor_fit(camera->sensor_fit, aspx, aspy); if (sensor_fit==CAMERA_SENSOR_FIT_HOR) { r_asp[0]= 1.0; @@ -431,14 +431,14 @@ void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const sh r_vec[3][0]= r_shift[0] - facx; r_vec[3][1]= r_shift[1] + facy; r_vec[3][2]= depth; } -void camera_view_frame(Scene *scene, Camera *camera, float r_vec[4][3]) +void BKE_camera_view_frame(Scene *scene, Camera *camera, float r_vec[4][3]) { float dummy_asp[2]; float dummy_shift[2]; float dummy_drawsize; const float dummy_scale[3]= {1.0f, 1.0f, 1.0f}; - camera_view_frame_ex(scene, camera, FALSE, 1.0, dummy_scale, + BKE_camera_view_frame_ex(scene, camera, FALSE, 1.0, dummy_scale, dummy_asp, dummy_shift, &dummy_drawsize, r_vec); } @@ -450,7 +450,7 @@ typedef struct CameraViewFrameData { unsigned int tot; } CameraViewFrameData; -static void camera_to_frame_view_cb(const float co[3], void *user_data) +static void BKE_camera_to_frame_view_cb(const float co[3], void *user_data) { CameraViewFrameData *data= (CameraViewFrameData *)user_data; unsigned int i; @@ -467,7 +467,7 @@ static void camera_to_frame_view_cb(const float co[3], void *user_data) /* don't move the camera, just yield the fit location */ /* only valid for perspective cameras */ -int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *camera_ob, float r_co[3]) +int BKE_camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *camera_ob, float r_co[3]) { float shift[2]; float plane_tx[4][3]; @@ -477,7 +477,7 @@ int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *cam unsigned int i; - camera_view_frame(scene, camera_ob->data, data_cb.frame_tx); + BKE_camera_view_frame(scene, camera_ob->data, data_cb.frame_tx); copy_m3_m4(rot_obmat, camera_ob->obmat); normalize_m3(rot_obmat); @@ -514,7 +514,7 @@ int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *cam data_cb.tot= 0; /* run callback on all visible points */ BKE_scene_foreach_display_point(scene, v3d, BA_SELECT, - camera_to_frame_view_cb, &data_cb); + BKE_camera_to_frame_view_cb, &data_cb); if (data_cb.tot <= 1) { return FALSE; diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 47b497188ec..66209e8a924 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -308,7 +308,7 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4] /* pose to local */ else if (to == CONSTRAINT_SPACE_LOCAL) { if (pchan->bone) { - armature_mat_pose_to_bone(pchan, mat, mat); + BKE_armature_mat_pose_to_bone(pchan, mat, mat); #if 0 /* XXX Old code, will remove it later. */ constraint_pchan_diff_mat(pchan, diff_mat); @@ -317,7 +317,7 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4] /* override with local location */ if ((pchan->parent) && (pchan->bone->flag & BONE_NO_LOCAL_LOCATION)) { - armature_mat_pose_to_bone_ex(ob, pchan, pchan->pose_mat, tempmat); + BKE_armature_mat_pose_to_bone_ex(ob, pchan, pchan->pose_mat, tempmat); copy_v3_v3(mat[3], tempmat[3]); } #endif @@ -337,7 +337,7 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4] /* local to pose - do inverse procedure that was done for pose to local */ if (pchan->bone) { /* we need the posespace_matrix = local_matrix + (parent_posespace_matrix + restpos) */ - armature_mat_bone_to_pose(pchan, mat, mat); + BKE_armature_mat_bone_to_pose(pchan, mat, mat); #if 0 constraint_pchan_diff_mat(pchan, diff_mat); @@ -383,7 +383,7 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4] /* Local space in this case will have to be defined as local to the owner's * transform-property-rotated axes. So subtract this rotation component. */ - object_to_mat4(ob, diff_mat); + BKE_object_to_mat4(ob, diff_mat); normalize_m4(diff_mat); zero_v3(diff_mat[3]); @@ -402,7 +402,7 @@ void constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[][4] /* Local space in this case will have to be defined as local to the owner's * transform-property-rotated axes. So add back this rotation component. */ - object_to_mat4(ob, diff_mat); + BKE_object_to_mat4(ob, diff_mat); normalize_m4(diff_mat); zero_v3(diff_mat[3]); @@ -593,7 +593,7 @@ static void constraint_target_to_mat4 (Object *ob, const char *substring, float else { bPoseChannel *pchan; - pchan = get_pose_channel(ob->pose, substring); + pchan = BKE_pose_channel_find_name(ob->pose, substring); if (pchan) { /* Multiply the PoseSpace accumulation/final matrix for this * PoseChannel by the Armature Object's Matrix to get a worldspace @@ -687,7 +687,7 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *UNUSED(cob), bC \ if (ct->tar) { \ if ((ct->tar->type==OB_ARMATURE) && (ct->subtarget[0])) { \ - bPoseChannel *pchan= get_pose_channel(ct->tar->pose, ct->subtarget); \ + bPoseChannel *pchan= BKE_pose_channel_find_name(ct->tar->pose, ct->subtarget); \ ct->type = CONSTRAINT_OBTYPE_BONE; \ ct->rotOrder= (pchan) ? (pchan->rotmode) : EULER_ORDER_DEFAULT; \ }\ @@ -781,7 +781,7 @@ static void childof_id_looper (bConstraint *con, ConstraintIDFunc func, void *us bChildOfConstraint *data= con->data; /* target only */ - func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); } static int childof_get_tars (bConstraint *con, ListBase *list) @@ -917,7 +917,7 @@ static void trackto_id_looper (bConstraint *con, ConstraintIDFunc func, void *us bTrackToConstraint *data= con->data; /* target only */ - func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); } static int trackto_get_tars (bConstraint *con, ListBase *list) @@ -1098,10 +1098,10 @@ static void kinematic_id_looper (bConstraint *con, ConstraintIDFunc func, void * bKinematicConstraint *data= con->data; /* chain target */ - func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); /* poletarget */ - func(con, (ID**)&data->poletar, userdata); + func(con, (ID**)&data->poletar, FALSE, userdata); } static int kinematic_get_tars (bConstraint *con, ListBase *list) @@ -1191,7 +1191,7 @@ static void followpath_id_looper (bConstraint *con, ConstraintIDFunc func, void bFollowPathConstraint *data= con->data; /* target only */ - func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); } static int followpath_get_tars (bConstraint *con, ListBase *list) @@ -1541,7 +1541,7 @@ static void loclike_id_looper (bConstraint *con, ConstraintIDFunc func, void *us bLocateLikeConstraint *data= con->data; /* target only */ - func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); } static int loclike_get_tars (bConstraint *con, ListBase *list) @@ -1632,7 +1632,7 @@ static void rotlike_id_looper (bConstraint *con, ConstraintIDFunc func, void *us bChildOfConstraint *data= con->data; /* target only */ - func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); } static int rotlike_get_tars (bConstraint *con, ListBase *list) @@ -1745,7 +1745,7 @@ static void sizelike_id_looper (bConstraint *con, ConstraintIDFunc func, void *u bSizeLikeConstraint *data= con->data; /* target only */ - func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); } static int sizelike_get_tars (bConstraint *con, ListBase *list) @@ -1835,7 +1835,7 @@ static void translike_id_looper (bConstraint *con, ConstraintIDFunc func, void * bTransLikeConstraint *data= con->data; /* target only */ - func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); } static int translike_get_tars (bConstraint *con, ListBase *list) @@ -2007,10 +2007,10 @@ static void pycon_id_looper (bConstraint *con, ConstraintIDFunc func, void *user /* targets */ for (ct= data->targets.first; ct; ct= ct->next) - func(con, (ID**)&ct->tar, userdata); + func(con, (ID**)&ct->tar, FALSE, userdata); /* script */ - func(con, (ID**)&data->text, userdata); + func(con, (ID**)&data->text, TRUE, userdata); } /* Whether this approach is maintained remains to be seen (aligorith) */ @@ -2107,10 +2107,10 @@ static void actcon_id_looper (bConstraint *con, ConstraintIDFunc func, void *use bActionConstraint *data= con->data; /* target */ - func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); /* action */ - func(con, (ID**)&data->act, userdata); + func(con, (ID**)&data->act, TRUE, userdata); } static int actcon_get_tars (bConstraint *con, ListBase *list) @@ -2199,18 +2199,18 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint */ pchan = cob->pchan; - tchan= verify_pose_channel(pose, pchan->name); + tchan= BKE_pose_channel_verify(pose, pchan->name); tchan->rotmode= pchan->rotmode; /* evaluate action using workob (it will only set the PoseChannel in question) */ what_does_obaction(cob->ob, &workob, pose, data->act, pchan->name, t); /* convert animation to matrices for use here */ - pchan_calc_mat(tchan); + BKE_pchan_calc_mat(tchan); copy_m4_m4(ct->matrix, tchan->chan_mat); /* Clean up */ - free_pose(pose); + BKE_pose_free(pose); } else if (cob->type == CONSTRAINT_OBTYPE_OBJECT) { Object workob; @@ -2218,7 +2218,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint /* evaluate using workob */ // FIXME: we don't have any consistent standards on limiting effects on object... what_does_obaction(cob->ob, &workob, NULL, data->act, NULL, t); - object_to_mat4(&workob, ct->matrix); + BKE_object_to_mat4(&workob, ct->matrix); } else { /* behavior undefined... */ @@ -2273,7 +2273,7 @@ static void locktrack_id_looper (bConstraint *con, ConstraintIDFunc func, void * bLockTrackConstraint *data= con->data; /* target only */ - func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); } static int locktrack_get_tars (bConstraint *con, ListBase *list) @@ -2584,7 +2584,7 @@ static void distlimit_id_looper (bConstraint *con, ConstraintIDFunc func, void * bDistLimitConstraint *data= con->data; /* target only */ - func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); } static int distlimit_get_tars (bConstraint *con, ListBase *list) @@ -2712,7 +2712,7 @@ static void stretchto_id_looper (bConstraint *con, ConstraintIDFunc func, void * bStretchToConstraint *data= con->data; /* target only */ - func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); } static int stretchto_get_tars (bConstraint *con, ListBase *list) @@ -2887,7 +2887,7 @@ static void minmax_id_looper (bConstraint *con, ConstraintIDFunc func, void *use bMinMaxConstraint *data= con->data; /* target only */ - func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); } static int minmax_get_tars (bConstraint *con, ListBase *list) @@ -3030,8 +3030,8 @@ static void rbj_id_looper (bConstraint *con, ConstraintIDFunc func, void *userda bRigidBodyJointConstraint *data= con->data; /* target only */ - func(con, (ID**)&data->tar, userdata); - func(con, (ID**)&data->child, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); + func(con, (ID**)&data->child, FALSE, userdata); } static int rbj_get_tars (bConstraint *con, ListBase *list) @@ -3083,7 +3083,7 @@ static void clampto_id_looper (bConstraint *con, ConstraintIDFunc func, void *us bClampToConstraint *data= con->data; /* target only */ - func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); } static int clampto_get_tars (bConstraint *con, ListBase *list) @@ -3149,7 +3149,7 @@ static void clampto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta copy_v3_v3(ownLoc, obmat[3]); INIT_MINMAX(curveMin, curveMax) - minmax_object(ct->tar, curveMin, curveMax); + BKE_object_minmax(ct->tar, curveMin, curveMax); /* get targetmatrix */ if (cu->path && cu->path->data) { @@ -3268,7 +3268,7 @@ static void transform_id_looper (bConstraint *con, ConstraintIDFunc func, void * bTransformConstraint *data= con->data; /* target only */ - func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); } static int transform_get_tars (bConstraint *con, ListBase *list) @@ -3403,10 +3403,10 @@ static bConstraintTypeInfo CTI_TRANSFORM = { static void shrinkwrap_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata) { - bShrinkwrapConstraint *data= con->data; + bShrinkwrapConstraint *data = con->data; /* target only */ - func(con, (ID**)&data->target, userdata); + func(con, (ID**)&data->target, FALSE, userdata); } static int shrinkwrap_get_tars (bConstraint *con, ListBase *list) @@ -3571,7 +3571,7 @@ static void damptrack_id_looper (bConstraint *con, ConstraintIDFunc func, void * bDampTrackConstraint *data= con->data; /* target only */ - func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); } static int damptrack_get_tars (bConstraint *con, ListBase *list) @@ -3717,7 +3717,7 @@ static void splineik_id_looper (bConstraint *con, ConstraintIDFunc func, void *u bSplineIKConstraint *data= con->data; /* target only */ - func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); } static int splineik_get_tars (bConstraint *con, ListBase *list) @@ -3790,7 +3790,7 @@ static void pivotcon_id_looper (bConstraint *con, ConstraintIDFunc func, void *u bPivotConstraint *data= con->data; /* target only */ - func(con, (ID**)&data->tar, userdata); + func(con, (ID**)&data->tar, FALSE, userdata); } static int pivotcon_get_tars (bConstraint *con, ListBase *list) @@ -3922,9 +3922,9 @@ static void followtrack_id_looper(bConstraint *con, ConstraintIDFunc func, void { bFollowTrackConstraint *data = con->data; - func(con, (ID**)&data->clip, userdata); - func(con, (ID**)&data->camera, userdata); - func(con, (ID**)&data->depth_ob, userdata); + func(con, (ID**)&data->clip, TRUE, userdata); + func(con, (ID**)&data->camera, FALSE, userdata); + func(con, (ID**)&data->depth_ob, FALSE, userdata); } static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets)) @@ -3989,7 +3989,7 @@ static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase float aspect= (scene->r.xsch * scene->r.xasp) / (scene->r.ysch * scene->r.yasp); float len, d; - where_is_object_mat(scene, camob, mat); + BKE_object_where_is_calc_mat4(scene, camob, mat); /* camera axis */ vec[0] = 0.0f; @@ -4012,8 +4012,8 @@ static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase add_v2_v2v2(pos, marker->pos, track->offset); - camera_params_init(¶ms); - camera_params_from_object(¶ms, camob); + BKE_camera_params_init(¶ms); + BKE_camera_params_from_object(¶ms, camob); if (params.is_ortho) { vec[0] = params.ortho_scale * (pos[0] - 0.5f + params.shiftx); @@ -4116,7 +4116,7 @@ static void camerasolver_id_looper(bConstraint *con, ConstraintIDFunc func, void { bCameraSolverConstraint *data = con->data; - func(con, (ID**)&data->clip, userdata); + func(con, (ID**)&data->clip, TRUE, userdata); } static void camerasolver_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets)) @@ -4172,8 +4172,8 @@ static void objectsolver_id_looper(bConstraint *con, ConstraintIDFunc func, void { bObjectSolverConstraint *data= con->data; - func(con, (ID**)&data->clip, userdata); - func(con, (ID**)&data->camera, userdata); + func(con, (ID**)&data->clip, FALSE, userdata); + func(con, (ID**)&data->camera, FALSE, userdata); } static void objectsolver_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets)) @@ -4198,7 +4198,7 @@ static void objectsolver_evaluate(bConstraint *con, bConstraintOb *cob, ListBase if (object) { float mat[4][4], obmat[4][4], imat[4][4], cammat[4][4], camimat[4][4], parmat[4][4]; - where_is_object_mat(scene, camob, cammat); + BKE_object_where_is_calc_mat4(scene, camob, cammat); BKE_tracking_get_interpolated_camera(tracking, object, scene->r.cfra, mat); @@ -4535,12 +4535,20 @@ void id_loop_constraints(ListBase *conlist, ConstraintIDFunc func, void *userdat /* ......... */ /* helper for copy_constraints(), to be used for making sure that ID's are valid */ -static void con_extern_cb(bConstraint *UNUSED(con), ID **idpoin, void *UNUSED(userData)) +static void con_extern_cb(bConstraint *UNUSED(con), ID **idpoin, short UNUSED(isReference), void *UNUSED(userData)) { if (*idpoin && (*idpoin)->lib) id_lib_extern(*idpoin); } +/* helper for copy_constraints(), to be used for making sure that usercounts of copied ID's are fixed up */ +static void con_fix_copied_refs_cb(bConstraint *UNUSED(con), ID **idpoin, short isReference, void *UNUSED(userData)) +{ + /* increment usercount if this is a reference type */ + if ((*idpoin) && (isReference)) + id_us_plus(*idpoin); +} + /* duplicate all of the constraints in a constraint stack */ void copy_constraints(ListBase *dst, const ListBase *src, int do_extern) { @@ -4560,6 +4568,10 @@ void copy_constraints(ListBase *dst, const ListBase *src, int do_extern) /* perform custom copying operations if needed */ if (cti->copy_data) cti->copy_data(con, srccon); + + /* fix usercounts for all referenced data in referenced data */ + if (cti->id_looper) + cti->id_looper(con, con_fix_copied_refs_cb, NULL); /* for proxies we don't want to make extern */ if (do_extern) { diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 906757bdd62..f4879b8d851 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -155,7 +155,7 @@ Curve *BKE_curve_add(const char *name, int type) { Curve *cu; - cu = alloc_libblock(&G.main->curve, ID_CU, name); + cu = BKE_libblock_alloc(&G.main->curve, ID_CU, name); copy_v3_fl(cu->size, 1.0f); cu->flag= CU_FRONT|CU_BACK|CU_DEFORM_BOUNDS_OFF|CU_PATH_RADIUS; cu->pathlen= 100; @@ -170,10 +170,10 @@ Curve *BKE_curve_add(const char *name, int type) cu->twist_mode= CU_TWIST_MINIMUM; // XXX: this one seems to be the best one in most cases, at least for curve deform... cu->type= type; - cu->bb= unit_boundbox(); + cu->bb= BKE_boundbox_alloc_unit(); if (type==OB_FONT) { - cu->vfont= cu->vfontb= cu->vfonti= cu->vfontbi= get_builtin_font(); + cu->vfont= cu->vfontb= cu->vfonti= cu->vfontbi= BKE_vfont_builtin_get(); cu->vfont->id.us+=4; cu->str= MEM_mallocN(12, "str"); BLI_strncpy(cu->str, "Text", 12); @@ -192,7 +192,7 @@ Curve *BKE_curve_copy(Curve *cu) Curve *cun; int a; - cun= copy_libblock(&cu->id); + cun= BKE_libblock_copy(&cu->id); cun->nurb.first= cun->nurb.last= NULL; BKE_nurbList_duplicate(&(cun->nurb), &(cu->nurb)); @@ -206,7 +206,7 @@ Curve *BKE_curve_copy(Curve *cu) cun->tb= MEM_dupallocN(cu->tb); cun->bb= MEM_dupallocN(cu->bb); - cun->key= copy_key(cu->key); + cun->key= BKE_key_copy(cu->key); if (cun->key) cun->key->from= (ID *)cun; cun->disp.first= cun->disp.last= NULL; @@ -383,7 +383,7 @@ void BKE_curve_tex_space_calc(Curve *cu) max[0] = max[1] = max[2] = 1.0f; } - boundbox_set_from_min_max(bb, min, max); + BKE_boundbox_init_from_minmax(bb, min, max); if (cu->texflag & CU_AUTOSPACE) { mid_v3_v3v3(cu->loc, min, max); diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index d8cdd728c16..45298aa0b3b 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -1895,7 +1895,7 @@ static void flush_update_node(DagNode *node, unsigned int layer, int curtime) if ((all_layer & layer)==0) { // XXX && (ob != obedit)) { /* but existing displaylists or derivedmesh should be freed */ if (ob->recalc & OB_RECALC_DATA) - object_free_display(ob); + BKE_object_free_display(ob); ob->recalc &= ~OB_RECALC_ALL; } @@ -2608,7 +2608,7 @@ static void dag_id_flush_update(Scene *sce, ID *id) * so it should happen tracking-related constraints recalculation * when camera is changing (sergey) */ if (sce->camera && &sce->camera->id == id) { - MovieClip *clip = object_get_movieclip(sce, sce->camera, 1); + MovieClip *clip = BKE_object_movieclip_get(sce, sce->camera, 1); if (clip) dag_id_flush_update(sce, &clip->id); @@ -2835,7 +2835,7 @@ void DAG_pose_sort(Object *ob) for (ct= targets.first; ct; ct= ct->next) { if (ct->tar==ob && ct->subtarget[0]) { - bPoseChannel *target= get_pose_channel(ob->pose, ct->subtarget); + bPoseChannel *target= BKE_pose_channel_find_name(ob->pose, ct->subtarget); if (target) { node2= dag_get_node(dag, target); dag_add_relation(dag, node2, node, 0, "Pose Constraint"); diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 1411c910894..7bd95dfa7dd 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -432,7 +432,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal) totvert= 0; nextcol= 0; - BLI_begin_edgefill(&sf_ctx); + BLI_scanfill_begin(&sf_ctx); dl= dispbase->first; while (dl) { @@ -449,18 +449,18 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal) while (a--) { vlast= eve; - eve = BLI_addfillvert(&sf_ctx, f1); + eve = BLI_scanfill_vert_add(&sf_ctx, f1); totvert++; if (vlast==NULL) v1= eve; else { - BLI_addfilledge(&sf_ctx, vlast, eve); + BLI_scanfill_edge_add(&sf_ctx, vlast, eve); } f1+=3; } if (eve!=NULL && v1!=NULL) { - BLI_addfilledge(&sf_ctx, eve, v1); + BLI_scanfill_edge_add(&sf_ctx, eve, v1); } } else if (colnr<dl->col) { @@ -473,7 +473,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal) dl= dl->next; } - if (totvert && (tot= BLI_edgefill(&sf_ctx, FALSE))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) { + if (totvert && (tot= BLI_scanfill_calc(&sf_ctx, FALSE))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) { if (tot) { dlnew= MEM_callocN(sizeof(DispList), "filldisplist"); dlnew->type= DL_INDEX3; @@ -518,7 +518,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal) BLI_addhead(to, dlnew); } - BLI_end_edgefill(&sf_ctx); + BLI_scanfill_end(&sf_ctx); if (nextcol) { /* stay at current char but fill polys with next material */ @@ -1269,7 +1269,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba if (cu->path) free_path(cu->path); cu->path= NULL; - if (ob->type==OB_FONT) BKE_text_to_curve(G.main, scene, ob, 0); + if (ob->type==OB_FONT) BKE_vfont_to_curve(G.main, scene, ob, 0); if (!forOrco) curve_calc_modifiers_pre(scene, ob, forRender, &originalVerts, &deformedVerts, &numVerts); @@ -1528,7 +1528,7 @@ static void boundbox_displist(Object *ob) } if (bb) { - boundbox_set_from_min_max(bb, min, max); + BKE_boundbox_init_from_minmax(bb, min, max); } } diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 6c5826c5bab..2bde31cfd63 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -540,11 +540,11 @@ static int subframe_updateObject(Scene *scene, Object *ob, int flags, float fram /* ignore cache clear during subframe updates * to not mess up cache validity */ object_cacheIgnoreClear(ob, 1); - object_handle_update(scene, ob); + BKE_object_handle_update(scene, ob); object_cacheIgnoreClear(ob, 0); } else - where_is_object_time(scene, ob, frame); + BKE_object_where_is_calc_time(scene, ob, frame); return 0; } @@ -3066,7 +3066,7 @@ static void dynamicPaint_brushMeshCalculateVelocity(Scene *scene, Object *ob, Dy scene->r.cfra = prev_fra; scene->r.subframe = prev_sfra; - subframe_updateObject(scene, ob, UPDATE_EVERYTHING, BKE_curframe(scene)); + subframe_updateObject(scene, ob, UPDATE_EVERYTHING, BKE_scene_frame_get(scene)); dm_p = CDDM_copy(brush->dm); numOfVerts_p = dm_p->getNumVerts(dm_p); mvert_p = dm_p->getVertArray(dm_p); @@ -3076,7 +3076,7 @@ static void dynamicPaint_brushMeshCalculateVelocity(Scene *scene, Object *ob, Dy scene->r.cfra = cur_fra; scene->r.subframe = cur_sfra; - subframe_updateObject(scene, ob, UPDATE_EVERYTHING, BKE_curframe(scene)); + subframe_updateObject(scene, ob, UPDATE_EVERYTHING, BKE_scene_frame_get(scene)); dm_c = brush->dm; numOfVerts_c = dm_c->getNumVerts(dm_c); mvert_c = dm_p->getVertArray(dm_c); @@ -3126,13 +3126,13 @@ static void dynamicPaint_brushObjectCalculateVelocity(Scene *scene, Object *ob, /* previous frame dm */ scene->r.cfra = prev_fra; scene->r.subframe = prev_sfra; - subframe_updateObject(scene, ob, UPDATE_PARENTS, BKE_curframe(scene)); + subframe_updateObject(scene, ob, UPDATE_PARENTS, BKE_scene_frame_get(scene)); copy_m4_m4(prev_obmat, ob->obmat); /* current frame dm */ scene->r.cfra = cur_fra; scene->r.subframe = cur_sfra; - subframe_updateObject(scene, ob, UPDATE_PARENTS, BKE_curframe(scene)); + subframe_updateObject(scene, ob, UPDATE_PARENTS, BKE_scene_frame_get(scene)); /* calculate speed */ mul_m4_v3(prev_obmat, prev_loc); @@ -4841,7 +4841,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su /* update object data on this subframe */ if (subframe) { scene_setSubframe(scene, subframe); - subframe_updateObject(scene, brushObj, UPDATE_EVERYTHING, BKE_curframe(scene)); + subframe_updateObject(scene, brushObj, UPDATE_EVERYTHING, BKE_scene_frame_get(scene)); } /* Prepare materials if required */ if (brush_usesMaterial(brush, scene)) @@ -4854,7 +4854,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su psys_check_enabled(brushObj, brush->psys)) { /* Paint a particle system */ - BKE_animsys_evaluate_animdata(scene, &brush->psys->part->id, brush->psys->part->adt, BKE_curframe(scene), ADT_RECALC_ANIM); + BKE_animsys_evaluate_animdata(scene, &brush->psys->part->id, brush->psys->part->adt, BKE_scene_frame_get(scene), ADT_RECALC_ANIM); dynamicPaint_paintParticles(surface, brush->psys, brush, timescale); } } @@ -4874,7 +4874,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su if (subframe) { scene->r.cfra = scene_frame; scene->r.subframe = scene_subframe; - subframe_updateObject(scene, brushObj, UPDATE_EVERYTHING, BKE_curframe(scene)); + subframe_updateObject(scene, brushObj, UPDATE_EVERYTHING, BKE_scene_frame_get(scene)); } /* process special brush effects, like smudge */ diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index 5e3f886c762..34794bd5b1f 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -197,18 +197,18 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm) ScanFillFace *efa; int totfilltri; - BLI_begin_edgefill(&sf_ctx); + BLI_scanfill_begin(&sf_ctx); /*scanfill time*/ l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f); for (j=0; l; l=BM_iter_step(&liter), j++) { /*mark order*/ BM_elem_index_set(l, j); /* set_loop */ - v = BLI_addfillvert(&sf_ctx, l->v->co); + v = BLI_scanfill_vert_add(&sf_ctx, l->v->co); v->tmp.p = l; if (lastv) { - /* e = */ BLI_addfilledge(&sf_ctx, lastv, v); + /* e = */ BLI_scanfill_edge_add(&sf_ctx, lastv, v); } lastv = v; @@ -216,9 +216,9 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm) } /*complete the loop*/ - BLI_addfilledge(&sf_ctx, firstv, v); + BLI_scanfill_edge_add(&sf_ctx, firstv, v); - totfilltri = BLI_edgefill_ex(&sf_ctx, FALSE, f->no); + totfilltri = BLI_scanfill_calc_ex(&sf_ctx, FALSE, f->no); BLI_array_grow_items(looptris, totfilltri); for (efa = sf_ctx.fillfacebase.first; efa; efa=efa->next) { @@ -236,7 +236,7 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm) i += 1; } - BLI_end_edgefill(&sf_ctx); + BLI_scanfill_end(&sf_ctx); } } diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 7fb0cf9f0fa..4024deee1e8 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -202,9 +202,9 @@ static void precalculate_effector(EffectorCache *eff) if (eff->ob) { float old_vel[3]; - where_is_object_time(eff->scene, eff->ob, cfra - 1.0f); + BKE_object_where_is_calc_time(eff->scene, eff->ob, cfra - 1.0f); copy_v3_v3(old_vel, eff->ob->obmat[3]); - where_is_object_time(eff->scene, eff->ob, cfra); + BKE_object_where_is_calc_time(eff->scene, eff->ob, cfra); sub_v3_v3v3(eff->velocity, eff->ob->obmat[3], old_vel); } } diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 0414d69785f..f1942b24810 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1085,7 +1085,7 @@ static bPoseChannel *dtar_get_pchan_ptr (ChannelDriver *driver, DriverTarget *dt Object *ob= (Object *)id; /* get pose, and subsequently, posechannel */ - return get_pose_channel(ob->pose, dtar->pchan_name); + return BKE_pose_channel_find_name(ob->pose, dtar->pchan_name); } else { /* cannot find a posechannel this way */ @@ -1164,7 +1164,7 @@ static float dvar_eval_locDiff (ChannelDriver *driver, DriverVar *dvar) } /* try to get posechannel */ - pchan= get_pose_channel(ob->pose, dtar->pchan_name); + pchan= BKE_pose_channel_find_name(ob->pose, dtar->pchan_name); /* check if object or bone */ if (pchan) { @@ -1251,7 +1251,7 @@ static float dvar_eval_transChan (ChannelDriver *driver, DriverVar *dvar) } /* try to get posechannel */ - pchan= get_pose_channel(ob->pose, dtar->pchan_name); + pchan= BKE_pose_channel_find_name(ob->pose, dtar->pchan_name); /* check if object or bone, and get transform matrix accordingly * - "useEulers" code is used to prevent the problems associated with non-uniqueness @@ -1278,7 +1278,7 @@ static float dvar_eval_transChan (ChannelDriver *driver, DriverVar *dvar) * since it stores delta transform of pose_mat so that deforms work * so it cannot be used here for "transform" space */ - pchan_to_mat4(pchan, mat); + BKE_pchan_to_mat4(pchan, mat); } } else { @@ -1302,7 +1302,7 @@ static float dvar_eval_transChan (ChannelDriver *driver, DriverVar *dvar) } else { /* transforms to matrix */ - object_to_mat4(ob, mat); + BKE_object_to_mat4(ob, mat); } } else { diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index a7f01393a02..fa57cc7ce44 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -63,7 +63,7 @@ static ListBase ttfdata= {NULL, NULL}; /* The vfont code */ -void free_vfont(struct VFont *vf) +void BKE_vfont_free(struct VFont *vf) { if (vf == NULL) return; @@ -93,7 +93,7 @@ void free_vfont(struct VFont *vf) static void *builtin_font_data= NULL; static int builtin_font_size= 0; -void BKE_font_register_builtin(void *mem, int size) +void BKE_vfont_builtin_register(void *mem, int size) { builtin_font_data= mem; builtin_font_size= size; @@ -115,7 +115,7 @@ static PackedFile *get_builtin_packedfile(void) } } -void free_ttfont(void) +void BKE_vfont_free_global_ttf(void) { struct TmpFont *tf; @@ -127,7 +127,7 @@ void free_ttfont(void) BLI_freelistN(&ttfdata); } -struct TmpFont *vfont_find_tmpfont(VFont *vfont) +struct TmpFont *BKE_vfont_find_tmpfont(VFont *vfont) { struct TmpFont *tmpfnt = NULL; @@ -151,7 +151,7 @@ static VFontData *vfont_get_data(Main *bmain, VFont *vfont) if (vfont==NULL) return NULL; // Try finding the font from font list - tmpfnt = vfont_find_tmpfont(vfont); + tmpfnt = BKE_vfont_find_tmpfont(vfont); // And then set the data if (!vfont->data) { @@ -210,7 +210,7 @@ static VFontData *vfont_get_data(Main *bmain, VFont *vfont) return vfont->data; } -VFont *load_vfont(Main *bmain, const char *name) +VFont *BKE_vfont_load(Main *bmain, const char *name) { char filename[FILE_MAXFILE]; VFont *vfont= NULL; @@ -242,7 +242,7 @@ VFont *load_vfont(Main *bmain, const char *name) vfd= BLI_vfontdata_from_freetypefont(pf); if (vfd) { - vfont = alloc_libblock(&bmain->vfont, ID_VF, filename); + vfont = BKE_libblock_alloc(&bmain->vfont, ID_VF, filename); vfont->data = vfd; /* if there's a font name, use it for the ID name */ @@ -290,7 +290,7 @@ static VFont *which_vfont(Curve *cu, CharInfo *info) } } -VFont *get_builtin_font(void) +VFont *BKE_vfont_builtin_get(void) { VFont *vf; @@ -298,7 +298,7 @@ VFont *get_builtin_font(void) if (strcmp(vf->name, FO_BUILTIN_NAME)==0) return vf; - return load_vfont(G.main, FO_BUILTIN_NAME); + return BKE_vfont_load(G.main, FO_BUILTIN_NAME); } static VChar *find_vfont_char(VFontData *vfd, intptr_t character) @@ -487,7 +487,7 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo } } -int BKE_font_getselection(Object *ob, int *start, int *end) +int BKE_vfont_select_get(Object *ob, int *start, int *end) { Curve *cu= ob->data; @@ -520,7 +520,7 @@ static float char_width(Curve *cu, VChar *che, CharInfo *info) } } -struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int mode) +struct chartrans *BKE_vfont_to_curve(Main *bmain, Scene *scene, Object *ob, int mode) { VFont *vfont, *oldvfont; VFontData *vfd= NULL; @@ -605,7 +605,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m if (cu->selboxes) MEM_freeN(cu->selboxes); cu->selboxes = NULL; - if (BKE_font_getselection(ob, &selstart, &selend)) + if (BKE_vfont_select_get(ob, &selstart, &selend)) cu->selboxes = MEM_callocN((selend-selstart+1)*sizeof(SelBox), "font selboxes"); tb = &(cu->tb[0]); diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 9ea4eafdd73..da3acce9228 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -108,7 +108,7 @@ void free_gpencil_layers(ListBase *list) } /* Free all of GPencil datablock's related data, but not the block itself */ -void free_gpencil_data(bGPdata *gpd) +void BKE_gpencil_free(bGPdata *gpd) { /* free layers */ free_gpencil_layers(&gpd->layers); @@ -198,7 +198,7 @@ bGPdata *gpencil_data_addnew (const char name[]) bGPdata *gpd; /* allocate memory for a new block */ - gpd= alloc_libblock(&G.main->gpencil, ID_GD, name); + gpd= BKE_libblock_alloc(&G.main->gpencil, ID_GD, name); /* initial settings */ gpd->flag = (GP_DATA_DISPINFO|GP_DATA_EXPAND); diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index d46ceebdfee..c722522250c 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -52,7 +52,7 @@ #include "BKE_library.h" #include "BKE_main.h" #include "BKE_object.h" -#include "BKE_scene.h" /* object_in_scene */ +#include "BKE_scene.h" /* BKE_scene_base_find */ static void free_group_object(GroupObject *go) { @@ -60,7 +60,7 @@ static void free_group_object(GroupObject *go) } -void free_group_objects(Group *group) +void BKE_group_free(Group *group) { /* don't free group itself */ GroupObject *go; @@ -72,7 +72,7 @@ void free_group_objects(Group *group) } } -void unlink_group(Group *group) +void BKE_group_unlink(Group *group) { Main *bmain= G.main; Material *ma; @@ -133,7 +133,7 @@ void unlink_group(Group *group) } /* group stays in library, but no members */ - free_group_objects(group); + BKE_group_free(group); group->id.us= 0; } @@ -141,12 +141,12 @@ Group *add_group(const char *name) { Group *group; - group = alloc_libblock(&G.main->group, ID_GR, name); + group = BKE_libblock_alloc(&G.main->group, ID_GR, name); group->layer= (1<<20)-1; return group; } -Group *copy_group(Group *group) +Group *BKE_group_copy(Group *group) { Group *groupn; @@ -182,7 +182,7 @@ int add_to_group(Group *group, Object *object, Scene *scene, Base *base) if ((object->flag & OB_FROMGROUP)==0) { if (scene && base==NULL) - base= object_in_scene(object, scene); + base= BKE_scene_base_find(scene, object); object->flag |= OB_FROMGROUP; @@ -223,7 +223,7 @@ int rem_from_group(Group *group, Object *object, Scene *scene, Base *base) /* object can be NULL */ if (object && find_group(object, NULL) == NULL) { if (scene && base==NULL) - base= object_in_scene(object, scene); + base= BKE_scene_base_find(scene, object); object->flag &= ~OB_FROMGROUP; @@ -361,7 +361,7 @@ void group_handle_recalc_and_update(Scene *scene, Object *UNUSED(parent), Group go->ob->recalc= go->recalc; group_replaces_nla(parent, go->ob, 's'); - object_handle_update(scene, go->ob); + BKE_object_handle_update(scene, go->ob); group_replaces_nla(parent, go->ob, 'e'); /* leave recalc tags in case group members are in normal scene */ @@ -379,7 +379,7 @@ void group_handle_recalc_and_update(Scene *scene, Object *UNUSED(parent), Group for (go= group->gobject.first; go; go= go->next) { if (go->ob) { if (go->ob->recalc) { - object_handle_update(scene, go->ob); + BKE_object_handle_update(scene, go->ob); } } } diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 9c5c99592ed..88cfa63e3e7 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -157,7 +157,7 @@ static void de_interlace_st(struct ImBuf *ibuf) /* standard fields */ ibuf->y /= 2; } -void image_de_interlace(Image *ima, int odd) +void BKE_image_de_interlace(Image *ima, int odd) { ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL); if (ibuf) { @@ -198,7 +198,7 @@ static void image_free_buffers(Image *ima) } /* called by library too, do not free ima itself */ -void free_image(Image *ima) +void BKE_image_free(Image *ima) { int a; @@ -225,7 +225,7 @@ static Image *image_alloc(const char *name, short source, short type) { Image *ima; - ima= alloc_libblock(&G.main->image, ID_IM, name); + ima= BKE_libblock_alloc(&G.main->image, ID_IM, name); if (ima) { ima->ok= IMA_OK; @@ -300,7 +300,7 @@ static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int frame) } /* empty image block, of similar type and filename */ -Image *copy_image(Image *ima) +Image *BKE_image_copy(Image *ima) { Image *nima= image_alloc(ima->id.name+2, ima->source, ima->type); @@ -327,7 +327,7 @@ static void extern_local_image(Image *UNUSED(ima)) * match id_make_local pattern. */ } -void make_local_image(struct Image *ima) +void BKE_image_make_local(struct Image *ima) { Main *bmain= G.main; Tex *tex; @@ -408,7 +408,7 @@ void make_local_image(struct Image *ima) extern_local_image(ima); } else if (is_local && is_lib) { - Image *ima_new= copy_image(ima); + Image *ima_new= BKE_image_copy(ima); ima_new->id.us= 0; @@ -501,30 +501,52 @@ void BKE_image_merge(Image *dest, Image *source) image_assign_ibuf(dest, ibuf, IMA_INDEX_PASS(ibuf->index), IMA_INDEX_FRAME(ibuf->index)); } - free_libblock(&G.main->image, source); + BKE_libblock_free(&G.main->image, source); } } - -/* checks if image was already loaded, then returns same image */ -/* otherwise creates new. */ -/* does not load ibuf itself */ -/* pass on optional frame for #name images */ -Image *BKE_add_image_file(const char *name) +Image *BKE_image_load(const char *filepath) { Image *ima; int file, len; const char *libname; - char str[FILE_MAX], strtest[FILE_MAX]; - - BLI_strncpy(str, name, sizeof(str)); + char str[FILE_MAX]; + + BLI_strncpy(str, filepath, sizeof(str)); BLI_path_abs(str, G.main->name); - + /* exists? */ file= BLI_open(str, O_BINARY|O_RDONLY, 0); if (file== -1) return NULL; close(file); + + /* create a short library name */ + len= strlen(filepath); + + while (len > 0 && filepath[len - 1] != '/' && filepath[len - 1] != '\\') len--; + libname= filepath+len; + + ima= image_alloc(libname, IMA_SRC_FILE, IMA_TYPE_IMAGE); + BLI_strncpy(ima->name, filepath, sizeof(ima->name)); + + if (BLI_testextensie_array(filepath, imb_ext_movie)) + ima->source= IMA_SRC_MOVIE; + + return ima; +} + +/* checks if image was already loaded, then returns same image */ +/* otherwise creates new. */ +/* does not load ibuf itself */ +/* pass on optional frame for #name images */ +Image *BKE_image_load_exists(const char *filepath) +{ + Image *ima; + char str[FILE_MAX], strtest[FILE_MAX]; + BLI_strncpy(str, filepath, sizeof(str)); + BLI_path_abs(str, G.main->name); + /* first search an identical image */ for (ima= G.main->image.first; ima; ima= ima->id.next) { if (ima->source!=IMA_SRC_VIEWER && ima->source!=IMA_SRC_GENERATED) { @@ -533,7 +555,7 @@ Image *BKE_add_image_file(const char *name) if (BLI_path_cmp(strtest, str)==0) { if (ima->anim==NULL || ima->id.us==0) { - BLI_strncpy(ima->name, name, sizeof(ima->name)); /* for stringcode */ + BLI_strncpy(ima->name, filepath, sizeof(ima->name)); /* for stringcode */ ima->id.us++; /* officially should not, it doesn't link here! */ if (ima->ok==0) ima->ok= IMA_OK; @@ -543,21 +565,8 @@ Image *BKE_add_image_file(const char *name) } } } - /* add new image */ - - /* create a short library name */ - len= strlen(name); - - while (len > 0 && name[len - 1] != '/' && name[len - 1] != '\\') len--; - libname= name+len; - - ima= image_alloc(libname, IMA_SRC_FILE, IMA_TYPE_IMAGE); - BLI_strncpy(ima->name, name, sizeof(ima->name)); - - if (BLI_testextensie_array(name, imb_ext_movie)) - ima->source= IMA_SRC_MOVIE; - - return ima; + + return BKE_image_load(filepath); } static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short uvtestgrid, float color[4]) @@ -593,7 +602,7 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char } /* adds new image block, creates ImBuf and initializes color */ -Image *BKE_add_image_size(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short uvtestgrid, float color[4]) +Image *BKE_image_add_generated(unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short uvtestgrid, float color[4]) { /* on save, type is changed to FILE in editsima.c */ Image *ima= image_alloc(name, IMA_SRC_GENERATED, IMA_TYPE_UV_TEST); @@ -617,7 +626,7 @@ Image *BKE_add_image_size(unsigned int width, unsigned int height, const char *n } /* creates an image image owns the imbuf passed */ -Image *BKE_add_image_imbuf(ImBuf *ibuf) +Image *BKE_image_add_from_imbuf(ImBuf *ibuf) { /* on save, type is changed to FILE in editsima.c */ Image *ima; @@ -669,7 +678,7 @@ void BKE_image_memorypack(Image *ima) } } -void tag_image_time(Image *ima) +void BKE_image_tag_time(Image *ima) { if (ima) ima->lastused = (int)PIL_check_seconds_timer(); @@ -1222,7 +1231,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d } if (scene->r.stamp & R_STAMP_MARKER) { - char *name = scene_find_last_marker_name(scene, CFRA); + char *name = BKE_scene_find_last_marker_name(scene, CFRA); if (name) BLI_strncpy(text, name, sizeof(text)); else BLI_strncpy(text, "<none>", sizeof(text)); @@ -1522,7 +1531,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec #undef BUFF_MARGIN_Y } -void BKE_stamp_info(Scene *scene, Object *camera, struct ImBuf *ibuf) +void BKE_imbuf_stamp_info(Scene *scene, Object *camera, struct ImBuf *ibuf) { struct StampData stamp_data; @@ -1544,7 +1553,7 @@ void BKE_stamp_info(Scene *scene, Object *camera, struct ImBuf *ibuf) if (stamp_data.rendertime[0]) IMB_metadata_change_field (ibuf, "RenderTime", stamp_data.rendertime); } -int BKE_alphatest_ibuf(ImBuf *ibuf) +int BKE_imbuf_alpha_test(ImBuf *ibuf) { int tot; if (ibuf->rect_float) { @@ -1569,7 +1578,7 @@ int BKE_alphatest_ibuf(ImBuf *ibuf) /* note: imf->planes is ignored here, its assumed the image channels * are already set */ -int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf) +int BKE_imbuf_write(ImBuf *ibuf, const char *name, ImageFormatData *imf) { char imtype= imf->imtype; char compress= imf->compress; @@ -1673,9 +1682,9 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf) return(ok); } -/* same as BKE_write_ibuf() but crappy workaround not to perminantly modify +/* same as BKE_imbuf_write() but crappy workaround not to perminantly modify * _some_, values in the imbuf */ -int BKE_write_ibuf_as(ImBuf *ibuf, const char *name, ImageFormatData *imf, +int BKE_imbuf_write_as(ImBuf *ibuf, const char *name, ImageFormatData *imf, const short save_copy) { ImBuf ibuf_back= *ibuf; @@ -1685,7 +1694,7 @@ int BKE_write_ibuf_as(ImBuf *ibuf, const char *name, ImageFormatData *imf, * this just controls how to save for some formats */ ibuf->planes= imf->planes; - ok= BKE_write_ibuf(ibuf, name, imf); + ok= BKE_imbuf_write(ibuf, name, imf); if (save_copy) { /* note that we are not restoring _all_ settings */ @@ -1696,12 +1705,12 @@ int BKE_write_ibuf_as(ImBuf *ibuf, const char *name, ImageFormatData *imf, return ok; } -int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const char *name, struct ImageFormatData *imf) +int BKE_imbuf_write_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const char *name, struct ImageFormatData *imf) { if (scene && scene->r.stamp & R_STAMP_ALL) - BKE_stamp_info(scene, camera, ibuf); + BKE_imbuf_stamp_info(scene, camera, ibuf); - return BKE_write_ibuf(ibuf, name, imf); + return BKE_imbuf_write(ibuf, name, imf); } @@ -2566,7 +2575,7 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r) BLI_unlock_thread(LOCK_IMAGE); } - tag_image_time(ima); + BKE_image_tag_time(ima); return ibuf; } @@ -2590,7 +2599,7 @@ ImBuf *BKE_image_get_ibuf(Image *ima, ImageUser *iuser) return BKE_image_acquire_ibuf(ima, iuser, NULL); } -int BKE_image_user_get_frame(const ImageUser *iuser, int cfra, int fieldnr) +int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, int fieldnr) { const int len= (iuser->fie_ima*iuser->frames)/2; @@ -2630,9 +2639,9 @@ int BKE_image_user_get_frame(const ImageUser *iuser, int cfra, int fieldnr) } } -void BKE_image_user_calc_frame(ImageUser *iuser, int cfra, int fieldnr) +void BKE_image_user_frame_calc(ImageUser *iuser, int cfra, int fieldnr) { - const int framenr= BKE_image_user_get_frame(iuser, cfra, fieldnr); + const int framenr= BKE_image_user_frame_get(iuser, cfra, fieldnr); /* allows image users to handle redraws */ if (iuser->flag & IMA_ANIM_ALWAYS) diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 48763382f2a..c2cb45d9f9d 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -81,7 +81,7 @@ /* Free data from old IPO-Blocks (those which haven't been converted), but not IPO block itself */ // XXX this shouldn't be necessary anymore, but may occur while not all data is converted yet -void free_ipo(Ipo *ipo) +void BKE_ipo_free(Ipo *ipo) { IpoCurve *icu, *icn; int n= 0; @@ -1104,7 +1104,7 @@ static void fcurve_add_to_list (ListBase *groups, ListBase *list, FCurve *fcu, c /* ... xxx, the other vars don't need to be filled in */ /* get the group to use */ - agrp= action_groups_find_named(&tmp_act, grpname); + agrp= BKE_action_group_find_name(&tmp_act, grpname); /* no matching group, so add one */ if (agrp == NULL) { /* Add a new group, and make it active */ diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 54a2613991a..e36e7bf6cf3 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -78,7 +78,7 @@ int slurph_opt = 1; -void free_key(Key *key) +void BKE_key_free(Key *key) { KeyBlock *kb; @@ -126,7 +126,7 @@ Key *add_key(ID *id) /* common function */ Key *key; char *el; - key = alloc_libblock(&G.main->key, ID_KE, "Key"); + key = BKE_libblock_alloc(&G.main->key, ID_KE, "Key"); key->type = KEY_NORMAL; key->from = id; @@ -170,14 +170,14 @@ Key *add_key(ID *id) /* common function */ return key; } -Key *copy_key(Key *key) +Key *BKE_key_copy(Key *key) { Key *keyn; KeyBlock *kbn, *kb; if (key == NULL) return NULL; - keyn = copy_libblock(&key->id); + keyn = BKE_libblock_copy(&key->id); BLI_duplicatelist(&keyn->block, &key->block); @@ -223,7 +223,7 @@ Key *copy_key_nolib(Key *key) return keyn; } -void make_local_key(Key *key) +void BKE_key_make_local(Key *key) { /* - only lib users: do nothing diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c index 11c3269ad37..e7206af3a0f 100644 --- a/source/blender/blenkernel/intern/lamp.c +++ b/source/blender/blenkernel/intern/lamp.c @@ -51,11 +51,11 @@ #include "BKE_main.h" #include "BKE_node.h" -void *add_lamp(const char *name) +void *BKE_lamp_add(const char *name) { Lamp *la; - la= alloc_libblock(&G.main->lamp, ID_LA, name); + la= BKE_libblock_alloc(&G.main->lamp, ID_LA, name); la->r= la->g= la->b= la->k= 1.0f; la->haint= la->energy= 1.0f; @@ -102,12 +102,12 @@ void *add_lamp(const char *name) return la; } -Lamp *copy_lamp(Lamp *la) +Lamp *BKE_lamp_copy(Lamp *la) { Lamp *lan; int a; - lan= copy_libblock(&la->id); + lan= BKE_libblock_copy(&la->id); for (a=0; a<MAX_MTEX; a++) { if (lan->mtex[a]) { @@ -133,7 +133,7 @@ Lamp *localize_lamp(Lamp *la) Lamp *lan; int a; - lan= copy_libblock(&la->id); + lan= BKE_libblock_copy(&la->id); BLI_remlink(&G.main->lamp, lan); for (a=0; a<MAX_MTEX; a++) { @@ -155,7 +155,7 @@ Lamp *localize_lamp(Lamp *la) return lan; } -void make_local_lamp(Lamp *la) +void BKE_lamp_make_local(Lamp *la) { Main *bmain= G.main; Object *ob; @@ -185,7 +185,7 @@ void make_local_lamp(Lamp *la) id_clear_lib_data(bmain, &la->id); } else if (is_local && is_lib) { - Lamp *la_new= copy_lamp(la); + Lamp *la_new= BKE_lamp_copy(la); la_new->id.us= 0; /* Remap paths of new ID using old library as base. */ @@ -206,7 +206,7 @@ void make_local_lamp(Lamp *la) } } -void free_lamp(Lamp *la) +void BKE_lamp_free(Lamp *la) { MTex *mtex; int a; diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index e78da48d153..12496e78037 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -83,7 +83,7 @@ void calc_lat_fudu(int flag, int res, float *fu, float *du) } } -void resizelattice(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb) +void BKE_lattice_resize(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb) { BPoint *bp; int i, u, v, w; @@ -184,30 +184,30 @@ void resizelattice(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb) MEM_freeN(vertexCos); } -Lattice *add_lattice(const char *name) +Lattice *BKE_lattice_add(const char *name) { Lattice *lt; - lt= alloc_libblock(&G.main->latt, ID_LT, name); + lt= BKE_libblock_alloc(&G.main->latt, ID_LT, name); lt->flag= LT_GRID; lt->typeu= lt->typev= lt->typew= KEY_BSPLINE; lt->def= MEM_callocN(sizeof(BPoint), "lattvert"); /* temporary */ - resizelattice(lt, 2, 2, 2, NULL); /* creates a uniform lattice */ + BKE_lattice_resize(lt, 2, 2, 2, NULL); /* creates a uniform lattice */ return lt; } -Lattice *copy_lattice(Lattice *lt) +Lattice *BKE_lattice_copy(Lattice *lt) { Lattice *ltn; - ltn= copy_libblock(<->id); + ltn= BKE_libblock_copy(<->id); ltn->def= MEM_dupallocN(lt->def); - ltn->key= copy_key(ltn->key); + ltn->key= BKE_key_copy(ltn->key); if (ltn->key) ltn->key->from= (ID *)ltn; if (lt->dvert) { @@ -221,7 +221,7 @@ Lattice *copy_lattice(Lattice *lt) return ltn; } -void free_lattice(Lattice *lt) +void BKE_lattice_free(Lattice *lt) { if (lt->def) MEM_freeN(lt->def); if (lt->dvert) free_dverts(lt->dvert, lt->pntsu*lt->pntsv*lt->pntsw); @@ -243,7 +243,7 @@ void free_lattice(Lattice *lt) } -void make_local_lattice(Lattice *lt) +void BKE_lattice_make_local(Lattice *lt) { Main *bmain= G.main; Object *ob; @@ -271,7 +271,7 @@ void make_local_lattice(Lattice *lt) id_clear_lib_data(bmain, <->id); } else if (is_local && is_lib) { - Lattice *lt_new= copy_lattice(lt); + Lattice *lt_new= BKE_lattice_copy(lt); lt_new->id.us= 0; /* Remap paths of new ID using old library as base. */ @@ -353,7 +353,7 @@ void calc_latt_deform(Object *ob, float co[3], float weight) /* vgroup influence */ int defgroup_nr= -1; float co_prev[3], weight_blend= 0.0f; - MDeformVert *dvert= lattice_get_deform_verts(ob); + MDeformVert *dvert= BKE_lattice_deform_verts_get(ob); if (lt->editlatt) lt= lt->editlatt->latt; @@ -928,7 +928,7 @@ void outside_lattice(Lattice *lt) } } -float (*lattice_getVertexCos(struct Object *ob, int *numVerts_r))[3] +float (*BKE_lattice_vertexcos_get(struct Object *ob, int *numVerts_r))[3] { Lattice *lt = ob->data; int i, numVerts; @@ -946,7 +946,7 @@ float (*lattice_getVertexCos(struct Object *ob, int *numVerts_r))[3] return vertexCos; } -void lattice_applyVertexCos(struct Object *ob, float (*vertexCos)[3]) +void BKE_lattice_vertexcos_apply(struct Object *ob, float (*vertexCos)[3]) { Lattice *lt = ob->data; int i, numVerts = lt->pntsu*lt->pntsv*lt->pntsw; @@ -956,7 +956,7 @@ void lattice_applyVertexCos(struct Object *ob, float (*vertexCos)[3]) } } -void lattice_calc_modifiers(Scene *scene, Object *ob) +void BKE_lattice_modifiers_calc(Scene *scene, Object *ob) { Lattice *lt= ob->data; ModifierData *md = modifiers_getVirtualModifierList(ob); @@ -975,12 +975,12 @@ void lattice_calc_modifiers(Scene *scene, Object *ob) if (mti->isDisabled && mti->isDisabled(md, 0)) continue; if (mti->type!=eModifierTypeType_OnlyDeform) continue; - if (!vertexCos) vertexCos = lattice_getVertexCos(ob, &numVerts); + if (!vertexCos) vertexCos = BKE_lattice_vertexcos_get(ob, &numVerts); mti->deformVerts(md, ob, NULL, vertexCos, numVerts, 0, 0); } /* always displist to make this work like derivedmesh */ - if (!vertexCos) vertexCos = lattice_getVertexCos(ob, &numVerts); + if (!vertexCos) vertexCos = BKE_lattice_vertexcos_get(ob, &numVerts); { DispList *dl = MEM_callocN(sizeof(*dl), "lt_dl"); @@ -993,7 +993,7 @@ void lattice_calc_modifiers(Scene *scene, Object *ob) } } -struct MDeformVert* lattice_get_deform_verts(struct Object *oblatt) +struct MDeformVert* BKE_lattice_deform_verts_get(struct Object *oblatt) { Lattice *lt = (Lattice*)oblatt->data; BLI_assert(oblatt->type == OB_LATTICE); diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 2924ea457a8..20444045c1c 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -135,9 +135,9 @@ void BKE_id_lib_local_paths(Main *bmain, Library *lib, ID *id) { char *bpath_user_data[2]= {bmain->name, lib->filepath}; - bpath_traverse_id(bmain, id, - bpath_relocate_visitor, - BPATH_TRAVERSE_SKIP_MULTIFILE, + BLI_bpath_traverse_id(bmain, id, + BLI_bpath_relocate_visitor, + BLI_BPATH_TRAVERSE_SKIP_MULTIFILE, bpath_user_data); } @@ -188,54 +188,54 @@ int id_make_local(ID *id, int test) case ID_LI: return 0; /* can't be linked */ case ID_OB: - if (!test) make_local_object((Object*)id); + if (!test) BKE_object_make_local((Object *)id); return 1; case ID_ME: if (!test) { - make_local_mesh((Mesh*)id); - make_local_key(((Mesh*)id)->key); + BKE_mesh_make_local((Mesh *)id); + BKE_key_make_local(((Mesh *)id)->key); } return 1; case ID_CU: if (!test) { - BKE_curve_make_local((Curve*)id); - make_local_key(((Curve*)id)->key); + BKE_curve_make_local((Curve *)id); + BKE_key_make_local(((Curve *)id)->key); } return 1; case ID_MB: - if (!test) BKE_metaball_make_local((MetaBall*)id); + if (!test) BKE_metaball_make_local((MetaBall *)id); return 1; case ID_MA: - if (!test) make_local_material((Material*)id); + if (!test) BKE_material_make_local((Material *)id); return 1; case ID_TE: - if (!test) make_local_texture((Tex*)id); + if (!test) BKE_texture_make_local((Tex *)id); return 1; case ID_IM: - if (!test) make_local_image((Image*)id); + if (!test) BKE_image_make_local((Image *)id); return 1; case ID_LT: if (!test) { - make_local_lattice((Lattice*)id); - make_local_key(((Lattice*)id)->key); + BKE_lattice_make_local((Lattice *)id); + BKE_key_make_local(((Lattice *)id)->key); } return 1; case ID_LA: - if (!test) make_local_lamp((Lamp*)id); + if (!test) BKE_lamp_make_local((Lamp *)id); return 1; case ID_CA: - if (!test) make_local_camera((Camera*)id); + if (!test) BKE_camera_make_local((Camera *)id); return 1; case ID_SPK: - if (!test) make_local_speaker((Speaker*)id); + if (!test) BKE_speaker_make_local((Speaker *)id); return 1; case ID_IP: return 0; /* deprecated */ case ID_KE: - if (!test) make_local_key((Key*)id); + if (!test) BKE_key_make_local((Key *)id); return 1; case ID_WO: - if (!test) make_local_world((World*)id); + if (!test) BKE_world_make_local((World *)id); return 1; case ID_SCR: return 0; /* can't be linked */ @@ -250,18 +250,18 @@ int id_make_local(ID *id, int test) case ID_GR: return 0; /* not implemented */ case ID_AR: - if (!test) make_local_armature((bArmature*)id); + if (!test) BKE_armature_make_local((bArmature *)id); return 1; case ID_AC: - if (!test) make_local_action((bAction*)id); + if (!test) BKE_action_make_local((bAction *)id); return 1; case ID_NT: return 0; /* not implemented */ case ID_BR: - if (!test) make_local_brush((Brush*)id); + if (!test) BKE_brush_make_local((Brush *)id); return 1; case ID_PA: - if (!test) make_local_particlesettings((ParticleSettings*)id); + if (!test) BKE_particlesettings_make_local((ParticleSettings *)id); return 1; case ID_WM: return 0; /* can't be linked */ @@ -285,74 +285,74 @@ int id_copy(ID *id, ID **newid, int test) case ID_LI: return 0; /* can't be copied from here */ case ID_OB: - if (!test) *newid= (ID*)copy_object((Object*)id); + if (!test) *newid = (ID *)BKE_object_copy((Object*)id); return 1; case ID_ME: - if (!test) *newid= (ID*)copy_mesh((Mesh*)id); + if (!test) *newid = (ID *)BKE_mesh_copy((Mesh*)id); return 1; case ID_CU: - if (!test) *newid= (ID*)BKE_curve_copy((Curve*)id); + if (!test) *newid = (ID *)BKE_curve_copy((Curve*)id); return 1; case ID_MB: - if (!test) *newid= (ID*)BKE_metaball_copy((MetaBall*)id); + if (!test) *newid = (ID *)BKE_metaball_copy((MetaBall*)id); return 1; case ID_MA: - if (!test) *newid= (ID*)copy_material((Material*)id); + if (!test) *newid = (ID *)BKE_material_copy((Material*)id); return 1; case ID_TE: - if (!test) *newid= (ID*)copy_texture((Tex*)id); + if (!test) *newid = (ID *)BKE_texture_copy((Tex*)id); return 1; case ID_IM: - if (!test) *newid= (ID*)copy_image((Image*)id); + if (!test) *newid = (ID *)BKE_image_copy((Image*)id); return 1; case ID_LT: - if (!test) *newid= (ID*)copy_lattice((Lattice*)id); + if (!test) *newid = (ID *)BKE_lattice_copy((Lattice*)id); return 1; case ID_LA: - if (!test) *newid= (ID*)copy_lamp((Lamp*)id); + if (!test) *newid = (ID *)BKE_lamp_copy((Lamp*)id); return 1; case ID_SPK: - if (!test) *newid= (ID*)copy_speaker((Speaker*)id); + if (!test) *newid = (ID *)BKE_speaker_copy((Speaker*)id); return 1; case ID_CA: - if (!test) *newid= (ID*)copy_camera((Camera*)id); + if (!test) *newid = (ID *)BKE_camera_copy((Camera*)id); return 1; case ID_IP: return 0; /* deprecated */ case ID_KE: - if (!test) *newid= (ID*)copy_key((Key*)id); + if (!test) *newid = (ID *)BKE_key_copy((Key*)id); return 1; case ID_WO: - if (!test) *newid= (ID*)copy_world((World*)id); + if (!test) *newid = (ID *)BKE_world_copy((World*)id); return 1; case ID_SCR: return 0; /* can't be copied from here */ case ID_VF: return 0; /* not implemented */ case ID_TXT: - if (!test) *newid= (ID*)copy_text((Text*)id); + if (!test) *newid = (ID *)BKE_text_copy((Text*)id); return 1; case ID_SCRIPT: return 0; /* deprecated */ case ID_SO: return 0; /* not implemented */ case ID_GR: - if (!test) *newid= (ID*)copy_group((Group*)id); + if (!test) *newid = (ID *)BKE_group_copy((Group*)id); return 1; case ID_AR: - if (!test) *newid= (ID*)copy_armature((bArmature*)id); + if (!test) *newid = (ID *)BKE_armature_copy((bArmature*)id); return 1; case ID_AC: - if (!test) *newid= (ID*)copy_action((bAction*)id); + if (!test) *newid = (ID *)BKE_action_copy((bAction*)id); return 1; case ID_NT: - if (!test) *newid= (ID*)ntreeCopyTree((bNodeTree*)id); + if (!test) *newid = (ID *)ntreeCopyTree((bNodeTree*)id); return 1; case ID_BR: - if (!test) *newid= (ID*)copy_brush((Brush*)id); + if (!test) *newid = (ID *)BKE_brush_copy((Brush*)id); return 1; case ID_PA: - if (!test) *newid= (ID*)psys_copy_settings((ParticleSettings*)id); + if (!test) *newid = (ID *)BKE_particlesettings_copy((ParticleSettings*)id); return 1; case ID_WM: return 0; /* can't be copied from here */ @@ -371,15 +371,15 @@ int id_unlink(ID *id, int test) switch (GS(id->name)) { case ID_TXT: if (test) return 1; - unlink_text(mainlib, (Text*)id); + BKE_text_unlink(mainlib, (Text *)id); break; case ID_GR: if (test) return 1; - unlink_group((Group*)id); + BKE_group_unlink((Group *)id); break; case ID_OB: if (test) return 1; - unlink_object((Object*)id); + BKE_object_unlink((Object *)id); break; } @@ -387,7 +387,7 @@ int id_unlink(ID *id, int test) if (test) return 1; lb= which_libbase(mainlib, GS(id->name)); - free_libblock(lb, id); + BKE_libblock_free(lb, id); return 1; } @@ -577,10 +577,10 @@ int set_listbasepointers(Main *main, ListBase **lb) /* *********** ALLOC AND FREE ***************** * - * free_libblock(ListBase *lb, ID *id ) + * BKE_libblock_free(ListBase *lb, ID *id ) * provide a list-basis and datablock, but only ID is read * - * void *alloc_libblock(ListBase *lb, type, name) + * void *BKE_libblock_alloc(ListBase *lb, type, name) * inserts in list and returns a new ID * * **************************** */ @@ -685,7 +685,7 @@ static ID *alloc_libblock_notest(short type) } /* used everywhere in blenkernel and text.c */ -void *alloc_libblock(ListBase *lb, short type, const char *name) +void *BKE_libblock_alloc(ListBase *lb, short type, const char *name) { ID *id= NULL; @@ -714,7 +714,7 @@ static void id_copy_animdata(ID *id, const short do_action) } /* material nodes use this since they are not treated as libdata */ -void copy_libblock_data(ID *id, const ID *id_from, const short do_action) +void BKE_libblock_copy_data(ID *id, const ID *id_from, const short do_action) { if (id_from->properties) id->properties = IDP_CopyProperty(id_from->properties); @@ -724,14 +724,14 @@ void copy_libblock_data(ID *id, const ID *id_from, const short do_action) } /* used everywhere in blenkernel */ -void *copy_libblock(ID *id) +void *BKE_libblock_copy(ID *id) { ID *idn; ListBase *lb; size_t idn_len; lb= which_libbase(G.main, GS(id->name)); - idn= alloc_libblock(lb, GS(id->name), id->name+2); + idn= BKE_libblock_alloc(lb, GS(id->name), id->name+2); assert(idn != NULL); @@ -746,12 +746,12 @@ void *copy_libblock(ID *id) id->newid= idn; idn->flag |= LIB_NEW; - copy_libblock_data(idn, id, FALSE); + BKE_libblock_copy_data(idn, id, FALSE); return idn; } -static void free_library(Library *UNUSED(lib)) +static void BKE_library_free(Library *UNUSED(lib)) { /* no freeing needed for libraries yet */ } @@ -788,7 +788,7 @@ static void animdata_dtar_clear_cb(ID *UNUSED(id), AnimData *adt, void *userdata /* used in headerbuttons.c image.c mesh.c screen.c sound.c and library.c */ -void free_libblock(ListBase *lb, void *idv) +void BKE_libblock_free(ListBase *lb, void *idv) { ID *id= idv; @@ -798,16 +798,16 @@ void free_libblock(ListBase *lb, void *idv) switch ( GS(id->name) ) { /* GetShort from util.h */ case ID_SCE: - free_scene((Scene *)id); + BKE_scene_free((Scene *)id); break; case ID_LI: - free_library((Library *)id); + BKE_library_free((Library *)id); break; case ID_OB: - free_object((Object *)id); + BKE_object_free((Object *)id); break; case ID_ME: - free_mesh((Mesh *)id, 1); + BKE_mesh_free((Mesh *)id, 1); break; case ID_CU: BKE_curve_free((Curve *)id); @@ -816,74 +816,74 @@ void free_libblock(ListBase *lb, void *idv) BKE_metaball_free((MetaBall *)id); break; case ID_MA: - free_material((Material *)id); + BKE_material_free((Material *)id); break; case ID_TE: - free_texture((Tex *)id); + BKE_texture_free((Tex *)id); break; case ID_IM: - free_image((Image *)id); + BKE_image_free((Image *)id); break; case ID_LT: - free_lattice((Lattice *)id); + BKE_lattice_free((Lattice *)id); break; case ID_LA: - free_lamp((Lamp *)id); + BKE_lamp_free((Lamp *)id); break; case ID_CA: - free_camera((Camera*) id); + BKE_camera_free((Camera *) id); break; case ID_IP: - free_ipo((Ipo *)id); + BKE_ipo_free((Ipo *)id); break; case ID_KE: - free_key((Key *)id); + BKE_key_free((Key *)id); break; case ID_WO: - free_world((World *)id); + BKE_world_free((World *)id); break; case ID_SCR: - free_screen((bScreen *)id); + BKE_screen_free((bScreen *)id); break; case ID_VF: - free_vfont((VFont *)id); + BKE_vfont_free((VFont *)id); break; case ID_TXT: - free_text((Text *)id); + BKE_text_free((Text *)id); break; case ID_SCRIPT: //XXX free_script((Script *)id); break; case ID_SPK: - free_speaker((Speaker *)id); + BKE_speaker_free((Speaker *)id); break; case ID_SO: - sound_free((bSound*)id); + BKE_sound_free((bSound *)id); break; case ID_GR: - free_group_objects((Group *)id); + BKE_group_free((Group *)id); break; case ID_AR: - free_armature((bArmature *)id); + BKE_armature_free((bArmature *)id); break; case ID_AC: - free_action((bAction *)id); + BKE_action_free((bAction *)id); break; case ID_NT: ntreeFreeTree((bNodeTree *)id); break; case ID_BR: - free_brush((Brush *)id); + BKE_brush_free((Brush *)id); break; case ID_PA: - psys_free_settings((ParticleSettings *)id); + BKE_particlesettings_free((ParticleSettings *)id); break; case ID_WM: if (free_windowmanager_cb) free_windowmanager_cb(NULL, (wmWindowManager *)id); break; case ID_GD: - free_gpencil_data((bGPdata *)id); + BKE_gpencil_free((bGPdata *)id); break; case ID_MC: BKE_movieclip_free((MovieClip *)id); @@ -903,7 +903,7 @@ void free_libblock(ListBase *lb, void *idv) MEM_freeN(id); } -void free_libblock_us(ListBase *lb, void *idv) /* test users */ +void BKE_libblock_free_us(ListBase *lb, void *idv) /* test users */ { ID *id= idv; @@ -914,9 +914,9 @@ void free_libblock_us(ListBase *lb, void *idv) /* test users */ else printf("ERROR block %s users %d\n", id->name, id->us); } if (id->us==0) { - if ( GS(id->name)==ID_OB ) unlink_object((Object *)id); + if ( GS(id->name)==ID_OB ) BKE_object_unlink((Object *)id); - free_libblock(lb, id); + BKE_libblock_free(lb, id); } } @@ -933,7 +933,7 @@ void free_main(Main *mainvar) ID *id; while ( (id= lb->first) ) { - free_libblock(lb, id); + BKE_libblock_free(lb, id); } } @@ -943,9 +943,9 @@ void free_main(Main *mainvar) /* ***************** ID ************************ */ -ID *find_id(const char *type, const char *name) /* type: "OB" or "MA" etc */ +ID *BKE_libblock_find_name(const short type, const char *name) /* type: "OB" or "MA" etc */ { - ListBase *lb= which_libbase(G.main, GS(type)); + ListBase *lb= which_libbase(G.main, type); return BLI_findstring(lb, name, offsetof(ID, name) + 2); } diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index e52a9217673..f4d9bcfd218 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -77,7 +77,7 @@ void init_def_material(void) } /* not material itself */ -void free_material(Material *ma) +void BKE_material_free(Material *ma) { MTex *mtex; int a; @@ -199,11 +199,11 @@ void init_material(Material *ma) ma->preview = NULL; } -Material *add_material(const char *name) +Material *BKE_material_add(const char *name) { Material *ma; - ma= alloc_libblock(&G.main->mat, ID_MA, name); + ma= BKE_libblock_alloc(&G.main->mat, ID_MA, name); init_material(ma); @@ -211,12 +211,12 @@ Material *add_material(const char *name) } /* XXX keep synced with next function */ -Material *copy_material(Material *ma) +Material *BKE_material_copy(Material *ma) { Material *man; int a; - man= copy_libblock(&ma->id); + man= BKE_libblock_copy(&ma->id); id_lib_extern((ID *)man->group); @@ -248,7 +248,7 @@ Material *localize_material(Material *ma) Material *man; int a; - man= copy_libblock(&ma->id); + man= BKE_libblock_copy(&ma->id); BLI_remlink(&G.main->mat, man); /* no increment for texture ID users, in previewrender.c it prevents decrement */ @@ -280,7 +280,7 @@ static void extern_local_material(Material *ma) } } -void make_local_material(Material *ma) +void BKE_material_make_local(Material *ma) { Main *bmain= G.main; Object *ob; @@ -365,7 +365,7 @@ void make_local_material(Material *ma) } /* Both user and local, so copy. */ else if (is_local && is_lib) { - Material *ma_new= copy_material(ma); + Material *ma_new= BKE_material_copy(ma); ma_new->id.us= 0; @@ -1674,7 +1674,7 @@ static short convert_tfacenomaterial(Main *main, Mesh *me, MTFace *tf, int flag) } /* create a new material */ else { - ma= add_material(idname+2); + ma= BKE_material_add(idname+2); if (ma) { printf("TexFace Convert: Material \"%s\" created.\n", idname+2); @@ -1743,7 +1743,7 @@ static void convert_tfacematerial(Main *main, Material *ma) } /* create a new material */ else { - mat_new=copy_material(ma); + mat_new=BKE_material_copy(ma); if (mat_new) { /* rename the material*/ strcpy(mat_new->id.name, idname); diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 8b2e66812c7..a841649e007 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -203,7 +203,7 @@ MetaBall *BKE_metaball_add(const char *name) { MetaBall *mb; - mb= alloc_libblock(&G.main->mball, ID_MB, name); + mb= BKE_libblock_alloc(&G.main->mball, ID_MB, name); mb->size[0]= mb->size[1]= mb->size[2]= 1.0; mb->texflag= MB_AUTOSPACE; @@ -220,7 +220,7 @@ MetaBall *BKE_metaball_copy(MetaBall *mb) MetaBall *mbn; int a; - mbn= copy_libblock(&mb->id); + mbn= BKE_libblock_copy(&mb->id); BLI_duplicatelist(&mbn->elems, &mb->elems); @@ -387,7 +387,7 @@ void BKE_metaball_tex_space_calc(Object *ob) size[1]= (max[1]-min[1])/2.0f; size[2]= (max[2]-min[2])/2.0f; #endif - boundbox_set_from_min_max(bb, min, max); + BKE_boundbox_init_from_minmax(bb, min, max); } float *BKE_metaball_make_orco(Object *ob, ListBase *dispbase) @@ -482,11 +482,11 @@ void BKE_metaball_properties_copy(Scene *scene, Object *active_object) BLI_split_name_num(basisname, &basisnr, active_object->id.name+2, '.'); - /* XXX recursion check, see scene.c, just too simple code this next_object() */ - if (F_ERROR==next_object(&sce_iter, 0, NULL, NULL)) + /* XXX recursion check, see scene.c, just too simple code this BKE_scene_base_iter_next() */ + if (F_ERROR==BKE_scene_base_iter_next(&sce_iter, 0, NULL, NULL)) return; - while (next_object(&sce_iter, 1, &base, &ob)) { + while (BKE_scene_base_iter_next(&sce_iter, 1, &base, &ob)) { if (ob->type==OB_MBALL) { if (ob != active_object) { BLI_split_name_num(obname, &obnr, ob->id.name+2, '.'); @@ -528,11 +528,11 @@ Object *BKE_metaball_basis_find(Scene *scene, Object *basis) BLI_split_name_num(basisname, &basisnr, basis->id.name+2, '.'); totelem= 0; - /* XXX recursion check, see scene.c, just too simple code this next_object() */ - if (F_ERROR==next_object(&sce_iter, 0, NULL, NULL)) + /* XXX recursion check, see scene.c, just too simple code this BKE_scene_base_iter_next() */ + if (F_ERROR==BKE_scene_base_iter_next(&sce_iter, 0, NULL, NULL)) return NULL; - while (next_object(&sce_iter, 1, &base, &ob)) { + while (BKE_scene_base_iter_next(&sce_iter, 1, &base, &ob)) { if (ob->type==OB_MBALL) { if (ob==bob) { @@ -1701,15 +1701,15 @@ static float init_meta(Scene *scene, Object *ob) /* return totsize */ int a, obnr, zero_size=0; char obname[MAX_ID_NAME]; - copy_m4_m4(obmat, ob->obmat); /* to cope with duplicators from next_object */ + copy_m4_m4(obmat, ob->obmat); /* to cope with duplicators from BKE_scene_base_iter_next */ invert_m4_m4(obinv, ob->obmat); a= 0; BLI_split_name_num(obname, &obnr, ob->id.name+2, '.'); /* make main array */ - next_object(&sce_iter, 0, NULL, NULL); - while (next_object(&sce_iter, 1, &base, &bob)) { + BKE_scene_base_iter_next(&sce_iter, 0, NULL, NULL); + while (BKE_scene_base_iter_next(&sce_iter, 1, &base, &bob)) { if (bob->type==OB_MBALL) { zero_size= 0; diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index c7f6bf93831..79bc7395d6d 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -412,7 +412,7 @@ void unlink_mesh(Mesh *me) } /* do not free mesh itself */ -void free_mesh(Mesh *me, int unlink) +void BKE_mesh_free(Mesh *me, int unlink) { if (unlink) unlink_mesh(me); @@ -484,23 +484,23 @@ static void mesh_tessface_clear_intern(Mesh *mesh, int free_customdata) memset(&mesh->fdata, 0, sizeof(mesh->fdata)); } -Mesh *add_mesh(const char *name) +Mesh *BKE_mesh_add(const char *name) { Mesh *me; - me= alloc_libblock(&G.main->mesh, ID_ME, name); + me= BKE_libblock_alloc(&G.main->mesh, ID_ME, name); me->size[0]= me->size[1]= me->size[2]= 1.0; me->smoothresh= 30; me->texflag= ME_AUTOSPACE; me->flag= ME_TWOSIDED; - me->bb= unit_boundbox(); + me->bb= BKE_boundbox_alloc_unit(); me->drawflag= ME_DRAWEDGES|ME_DRAWFACES|ME_DRAWCREASES; return me; } -Mesh *copy_mesh(Mesh *me) +Mesh *BKE_mesh_copy(Mesh *me) { Mesh *men; MTFace *tface; @@ -508,7 +508,7 @@ Mesh *copy_mesh(Mesh *me) int a, i; const int do_tessface = ((me->totface != 0) && (me->totpoly == 0)); /* only do tessface if we have no polys */ - men= copy_libblock(&me->id); + men= BKE_libblock_copy(&me->id); men->mat= MEM_dupallocN(me->mat); for (a=0; a<men->totcol; a++) { @@ -555,7 +555,7 @@ Mesh *copy_mesh(Mesh *me) men->bb= MEM_dupallocN(men->bb); - men->key= copy_key(me->key); + men->key= BKE_key_copy(me->key); if (men->key) men->key->from= (ID *)men; return men; @@ -611,7 +611,7 @@ static void expand_local_mesh(Mesh *me) } } -void make_local_mesh(Mesh *me) +void BKE_mesh_make_local(Mesh *me) { Main *bmain= G.main; Object *ob; @@ -641,7 +641,7 @@ void make_local_mesh(Mesh *me) expand_local_mesh(me); } else if (is_local && is_lib) { - Mesh *me_new= copy_mesh(me); + Mesh *me_new= BKE_mesh_copy(me); me_new->id.us= 0; @@ -682,7 +682,7 @@ void boundbox_mesh(Mesh *me, float *loc, float *size) size[1]= (max[1]-min[1])/2.0f; size[2]= (max[2]-min[2])/2.0f; - boundbox_set_from_min_max(bb, min, max); + BKE_boundbox_init_from_minmax(bb, min, max); } void tex_space_mesh(Mesh *me) @@ -846,7 +846,7 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr) return nr; } -Mesh *get_mesh(Object *ob) +Mesh *BKE_mesh_from_object(Object *ob) { if (ob==NULL) return NULL; @@ -1489,7 +1489,7 @@ void nurbs_to_mesh(Object *ob) } /* make mesh */ - me= add_mesh("Mesh"); + me= BKE_mesh_add("Mesh"); me->totvert= totvert; me->totedge= totedge; me->totloop = totloop; @@ -1505,7 +1505,7 @@ void nurbs_to_mesh(Object *ob) BKE_mesh_calc_edges(me, TRUE); } else { - me= add_mesh("Mesh"); + me= BKE_mesh_add("Mesh"); DM_to_mesh(dm, me, ob); } @@ -1518,7 +1518,7 @@ void nurbs_to_mesh(Object *ob) cu->totcol= 0; if (ob->data) { - free_libblock(&bmain->curve, ob->data); + BKE_libblock_free(&bmain->curve, ob->data); } ob->data= me; ob->type= OB_MESH; @@ -2481,24 +2481,24 @@ int mesh_recalcTessellation(CustomData *fdata, ml = mloop + mp->loopstart; - BLI_begin_edgefill(&sf_ctx); + BLI_scanfill_begin(&sf_ctx); firstv = NULL; lastv = NULL; for (j=0; j<mp->totloop; j++, ml++) { - v = BLI_addfillvert(&sf_ctx, mvert[ml->v].co); + v = BLI_scanfill_vert_add(&sf_ctx, mvert[ml->v].co); v->keyindex = mp->loopstart + j; if (lastv) - BLI_addfilledge(&sf_ctx, lastv, v); + BLI_scanfill_edge_add(&sf_ctx, lastv, v); if (!firstv) firstv = v; lastv = v; } - BLI_addfilledge(&sf_ctx, lastv, firstv); + BLI_scanfill_edge_add(&sf_ctx, lastv, firstv); - totfilltri = BLI_edgefill(&sf_ctx, FALSE); + totfilltri = BLI_scanfill_calc(&sf_ctx, FALSE); if (totfilltri) { BLI_array_grow_items(mface_to_poly_map, totfilltri); BLI_array_grow_items(mface, totfilltri); @@ -2531,7 +2531,7 @@ int mesh_recalcTessellation(CustomData *fdata, } } - BLI_end_edgefill(&sf_ctx); + BLI_scanfill_end(&sf_ctx); } } diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index d2219484ff4..964a20659e0 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -430,7 +430,7 @@ static MovieClip *movieclip_alloc(const char *name) { MovieClip *clip; - clip = alloc_libblock(&G.main->movieclip, ID_MC, name); + clip = BKE_libblock_alloc(&G.main->movieclip, ID_MC, name); clip->aspx = clip->aspy= 1.0f; diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index f3901cec506..e432428eae4 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -381,7 +381,7 @@ void multires_force_update(Object *ob) void multires_force_external_reload(Object *ob) { - Mesh *me = get_mesh(ob); + Mesh *me = BKE_mesh_from_object(ob); CustomData_external_reload(&me->ldata, &me->id, CD_MASK_MDISPS, me->totloop); multires_force_update(ob); @@ -650,7 +650,7 @@ static void multires_del_higher(MultiresModifierData *mmd, Object *ob, int lvl) /* direction=1 for delete higher, direction=0 for lower (not implemented yet) */ void multiresModifier_del_levels(MultiresModifierData *mmd, Object *ob, int direction) { - Mesh *me = get_mesh(ob); + Mesh *me = BKE_mesh_from_object(ob); int lvl = multires_get_level(ob, mmd, 0); int levels = mmd->totlvl - lvl; MDisps *mdisps; @@ -717,7 +717,7 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob) multires_force_update(ob); - me = get_mesh(ob); + me = BKE_mesh_from_object(ob); totlvl = mmd->totlvl; /* nothing to do */ @@ -2146,7 +2146,7 @@ void multiresModifier_scale_disp(Scene *scene, Object *ob) float smat[3][3]; /* object's scale matrix */ - object_scale_to_mat3(ob, smat); + BKE_object_scale_to_mat3(ob, smat); multires_apply_smat(scene, ob, smat); } @@ -2157,9 +2157,9 @@ void multiresModifier_prepare_join(Scene *scene, Object *ob, Object *to_ob) multires_sync_levels(scene, ob, to_ob); /* construct scale matrix for displacement */ - object_scale_to_mat3(to_ob, tmat); + BKE_object_scale_to_mat3(to_ob, tmat); invert_m3(tmat); - object_scale_to_mat3(ob, smat); + BKE_object_scale_to_mat3(ob, smat); mul_m3_m3m3(mat, smat, tmat); multires_apply_smat(scene, ob, mat); diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index b2a85ad0629..7832947be73 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -643,7 +643,7 @@ bNodeTree *ntreeAddTree(const char *name, int type, int nodetype) BLI_strncpy(ntree->id.name+2, name, sizeof(ntree->id.name)); } else - ntree= alloc_libblock(&G.main->nodetree, ID_NT, name); + ntree= BKE_libblock_alloc(&G.main->nodetree, ID_NT, name); ntree->type= type; ntree->nodetype = nodetype; @@ -675,11 +675,11 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree) for (newtree=G.main->nodetree.first; newtree; newtree= newtree->id.next) if (newtree==ntree) break; if (newtree) { - newtree= copy_libblock(&ntree->id); + newtree= BKE_libblock_copy(&ntree->id); } else { newtree= MEM_dupallocN(ntree); - copy_libblock_data(&newtree->id, &ntree->id, TRUE); /* copy animdata and ID props */ + BKE_libblock_copy_data(&newtree->id, &ntree->id, TRUE); /* copy animdata and ID props */ } id_us_plus((ID *)newtree->gpd); @@ -931,7 +931,7 @@ void nodeFreeNode(bNodeTree *ntree, bNode *node) ntree->update |= NTREE_UPDATE_NODES; } -/* do not free ntree itself here, free_libblock calls this function too */ +/* do not free ntree itself here, BKE_libblock_free calls this function too */ void ntreeFreeTree(bNodeTree *ntree) { bNode *node, *next; @@ -2093,7 +2093,7 @@ void free_nodesystem(void) free_typeinfos(&ntreeGetType(NTREE_TEXTURE)->node_types); } -/* called from unlink_scene, when deleting a scene goes over all scenes +/* called from BKE_scene_unlink, when deleting a scene goes over all scenes * other than the input, checks if they have render layer nodes referencing * the to-be-deleted scene, and resets them to NULL. */ diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 2cfacbcf034..c04fdc4f410 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -117,9 +117,9 @@ /* Local function protos */ static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[][4], float slowmat[][4], int simul); -float originmat[3][3]; /* after where_is_object(), can be used in other functions (bad!) */ +float originmat[3][3]; /* after BKE_object_where_is_calc(), can be used in other functions (bad!) */ -void clear_workob(Object *workob) +void BKE_object_workob_clear(Object *workob) { memset(workob, 0, sizeof(Object)); @@ -128,27 +128,7 @@ void clear_workob(Object *workob) workob->rotmode= ROT_MODE_EUL; } -void copy_baseflags(struct Scene *scene) -{ - Base *base= scene->base.first; - - while (base) { - base->object->flag= base->flag; - base= base->next; - } -} - -void copy_objectflags(struct Scene *scene) -{ - Base *base= scene->base.first; - - while (base) { - base->flag= base->object->flag; - base= base->next; - } -} - -void update_base_layer(struct Scene *scene, Object *ob) +void BKE_object_update_base_layer(struct Scene *scene, Object *ob) { Base *base= scene->base.first; @@ -158,7 +138,7 @@ void update_base_layer(struct Scene *scene, Object *ob) } } -void object_free_particlesystems(Object *ob) +void BKE_object_free_particlesystems(Object *ob) { while (ob->particlesystem.first) { ParticleSystem *psys = ob->particlesystem.first; @@ -169,7 +149,7 @@ void object_free_particlesystems(Object *ob) } } -void object_free_softbody(Object *ob) +void BKE_object_free_softbody(Object *ob) { if (ob->soft) { sbFree(ob->soft); @@ -177,7 +157,7 @@ void object_free_softbody(Object *ob) } } -void object_free_bulletsoftbody(Object *ob) +void BKE_object_free_bulletsoftbody(Object *ob) { if (ob->bsoft) { bsbFree(ob->bsoft); @@ -185,7 +165,7 @@ void object_free_bulletsoftbody(Object *ob) } } -void object_free_modifiers(Object *ob) +void BKE_object_free_modifiers(Object *ob) { while (ob->modifiers.first) { ModifierData *md = ob->modifiers.first; @@ -196,13 +176,13 @@ void object_free_modifiers(Object *ob) } /* particle modifiers were freed, so free the particlesystems as well */ - object_free_particlesystems(ob); + BKE_object_free_particlesystems(ob); /* same for softbody */ - object_free_softbody(ob); + BKE_object_free_softbody(ob); } -int object_support_modifier_type(Object *ob, int modifier_type) +int BKE_object_support_modifier_type_check(Object *ob, int modifier_type) { ModifierTypeInfo *mti; @@ -217,10 +197,10 @@ int object_support_modifier_type(Object *ob, int modifier_type) return TRUE; } -void object_link_modifiers(struct Object *ob, struct Object *from) +void BKE_object_link_modifiers(struct Object *ob, struct Object *from) { ModifierData *md; - object_free_modifiers(ob); + BKE_object_free_modifiers(ob); if (!ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) { /* only objects listed above can have modifiers and linking them to objects @@ -233,7 +213,7 @@ void object_link_modifiers(struct Object *ob, struct Object *from) if (ELEM4(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_ParticleInstance, eModifierType_Collision)) continue; - if (!object_support_modifier_type(ob, md->type)) + if (!BKE_object_support_modifier_type_check(ob, md->type)) continue; nmd = modifier_new(md->type); @@ -241,15 +221,15 @@ void object_link_modifiers(struct Object *ob, struct Object *from) BLI_addtail(&ob->modifiers, nmd); } - copy_object_particlesystems(ob, from); - copy_object_softbody(ob, from); + BKE_object_copy_particlesystems(ob, from); + BKE_object_copy_softbody(ob, from); // TODO: smoke?, cloth? } /* here we will collect all local displist stuff */ /* also (ab)used in depsgraph */ -void object_free_display(Object *ob) +void BKE_object_free_display(Object *ob) { if (ob->derivedDeform) { ob->derivedDeform->needsFree = 1; @@ -308,11 +288,11 @@ void free_sculptsession(Object *ob) /* do not free object itself */ -void free_object(Object *ob) +void BKE_object_free(Object *ob) { int a; - object_free_display(ob); + BKE_object_free_display(ob); /* disconnect specific data */ if (ob->data) { @@ -341,11 +321,11 @@ void free_object(Object *ob) if (ob->defbase.first) BLI_freelistN(&ob->defbase); if (ob->pose) - free_pose(ob->pose); + BKE_pose_free(ob->pose); if (ob->mpath) animviz_free_motionpath(ob->mpath); free_properties(&ob->prop); - object_free_modifiers(ob); + BKE_object_free_modifiers(ob); free_sensors(&ob->sensors); free_controllers(&ob->controllers); @@ -374,7 +354,7 @@ static void unlink_object__unlinkModifierLinks(void *userData, Object *ob, Objec } } -void unlink_object(Object *ob) +void BKE_object_unlink(Object *ob) { Main *bmain= G.main; Object *obt; @@ -731,7 +711,7 @@ void unlink_object(Object *ob) } } -int exist_object(Object *obtest) +int BKE_object_exists_check(Object *obtest) { Object *ob; @@ -747,22 +727,22 @@ int exist_object(Object *obtest) /* *************************************************** */ -static void *add_obdata_from_type(int type) +void *BKE_object_obdata_add_from_type(int type) { switch (type) { - case OB_MESH: return add_mesh("Mesh"); - case OB_CURVE: return BKE_curve_add("Curve", OB_CURVE); - case OB_SURF: return BKE_curve_add("Surf", OB_SURF); - case OB_FONT: return BKE_curve_add("Text", OB_FONT); - case OB_MBALL: return BKE_metaball_add("Meta"); - case OB_CAMERA: return add_camera("Camera"); - case OB_LAMP: return add_lamp("Lamp"); - case OB_LATTICE: return add_lattice("Lattice"); - case OB_ARMATURE: return add_armature("Armature"); - case OB_SPEAKER: return add_speaker("Speaker"); - case OB_EMPTY: return NULL; + case OB_MESH: return BKE_mesh_add("Mesh"); + case OB_CURVE: return BKE_curve_add("Curve", OB_CURVE); + case OB_SURF: return BKE_curve_add("Surf", OB_SURF); + case OB_FONT: return BKE_curve_add("Text", OB_FONT); + case OB_MBALL: return BKE_metaball_add("Meta"); + case OB_CAMERA: return BKE_camera_add("Camera"); + case OB_LAMP: return BKE_lamp_add("Lamp"); + case OB_LATTICE: return BKE_lattice_add("Lattice"); + case OB_ARMATURE: return BKE_armature_add("Armature"); + case OB_SPEAKER: return BKE_speaker_add("Speaker"); + case OB_EMPTY: return NULL; default: - printf("add_obdata_from_type: Internal error, bad type: %d\n", type); + printf("BKE_object_obdata_add_from_type: Internal error, bad type: %d\n", type); return NULL; } } @@ -788,11 +768,11 @@ static const char *get_obdata_defname(int type) } /* more general add: creates minimum required data, but without vertices etc. */ -Object *add_only_object(int type, const char *name) +Object *BKE_object_add_only_object(int type, const char *name) { Object *ob; - ob= alloc_libblock(&G.main->object, ID_OB, name); + ob= BKE_libblock_alloc(&G.main->object, ID_OB, name); /* default object vars */ ob->type= type; @@ -866,21 +846,22 @@ Object *add_only_object(int type, const char *name) /* general add: to scene, with layer from area and default name */ /* creates minimum required data, but without vertices etc. */ -Object *add_object(struct Scene *scene, int type) +Object *BKE_object_add(struct Scene *scene, int type) { Object *ob; Base *base; char name[MAX_ID_NAME]; BLI_strncpy(name, get_obdata_defname(type), sizeof(name)); - ob = add_only_object(type, name); + ob = BKE_object_add_only_object(type, name); - ob->data= add_obdata_from_type(type); + ob->data= BKE_object_obdata_add_from_type(type); ob->lay= scene->lay; - base= scene_add_base(scene, ob); - scene_select_base(scene, base); + base= BKE_scene_base_add(scene, ob); + BKE_scene_base_deselect_all(scene); + BKE_scene_base_select(scene, base); ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; return ob; @@ -988,7 +969,7 @@ static ParticleSystem *copy_particlesystem(ParticleSystem *psys) return psysn; } -void copy_object_particlesystems(Object *obn, Object *ob) +void BKE_object_copy_particlesystems(Object *obn, Object *ob) { ParticleSystem *psys, *npsys; ModifierData *md; @@ -1033,7 +1014,7 @@ void copy_object_particlesystems(Object *obn, Object *ob) } } -void copy_object_softbody(Object *obn, Object *ob) +void BKE_object_copy_softbody(Object *obn, Object *ob) { if (ob->soft) obn->soft= copy_softbody(ob->soft); @@ -1043,9 +1024,9 @@ static void copy_object_pose(Object *obn, Object *ob) { bPoseChannel *chan; - /* note: need to clear obn->pose pointer first, so that copy_pose works (otherwise there's a crash) */ + /* note: need to clear obn->pose pointer first, so that BKE_pose_copy_data works (otherwise there's a crash) */ obn->pose= NULL; - copy_pose(&obn->pose, ob->pose, 1); /* 1 = copy constraints */ + BKE_pose_copy_data(&obn->pose, ob->pose, 1); /* 1 = copy constraints */ for (chan = obn->pose->chanbase.first; chan; chan=chan->next) { bConstraint *con; @@ -1086,7 +1067,7 @@ static int object_pose_context(Object *ob) } } -Object *object_pose_armature_get(Object *ob) +Object *BKE_object_pose_armature_get(Object *ob) { if (ob==NULL) return NULL; @@ -1113,13 +1094,13 @@ static void copy_object_transform(Object *ob_tar, Object *ob_src) copy_v3_v3(ob_tar->size, ob_src->size); } -Object *copy_object(Object *ob) +Object *BKE_object_copy(Object *ob) { Object *obn; ModifierData *md; int a; - obn= copy_libblock(&ob->id); + obn= BKE_libblock_copy(&ob->id); if (ob->totcol) { obn->mat= MEM_dupallocN(ob->mat); @@ -1150,7 +1131,7 @@ Object *copy_object(Object *ob) copy_object_pose(obn, ob); /* backwards compat... non-armatures can get poses in older files? */ if (ob->type==OB_ARMATURE) - armature_rebuild_pose(obn, obn->data); + BKE_pose_rebuild(obn, obn->data); } defgroup_copy_list(&obn->defbase, &ob->defbase); copy_constraints(&obn->constraints, &ob->constraints, TRUE); @@ -1177,7 +1158,7 @@ Object *copy_object(Object *ob) obn->soft= copy_softbody(ob->soft); obn->bsoft = copy_bulletsoftbody(ob->bsoft); - copy_object_particlesystems(obn, ob); + BKE_object_copy_particlesystems(obn, ob); obn->derivedDeform = NULL; obn->derivedFinal = NULL; @@ -1205,7 +1186,7 @@ static void extern_local_object(Object *ob) id_lib_extern((ID *)psys->part); } -void make_local_object(Object *ob) +void BKE_object_make_local(Object *ob) { Main *bmain= G.main; Scene *sce; @@ -1227,7 +1208,7 @@ void make_local_object(Object *ob) } else { for (sce= bmain->scene.first; sce && ELEM(0, is_lib, is_local); sce= sce->id.next) { - if (object_in_scene(ob, sce)) { + if (BKE_scene_base_find(sce, ob)) { if (sce->id.lib) is_lib= TRUE; else is_local= TRUE; } @@ -1238,7 +1219,7 @@ void make_local_object(Object *ob) extern_local_object(ob); } else if (is_local && is_lib) { - Object *ob_new= copy_object(ob); + Object *ob_new= BKE_object_copy(ob); ob_new->id.us= 0; @@ -1267,7 +1248,7 @@ void make_local_object(Object *ob) /* * Returns true if the Object is a from an external blend file (libdata) */ -int object_is_libdata(Object *ob) +int BKE_object_is_libdata(Object *ob) { if (!ob) return 0; if (ob->proxy) return 0; @@ -1276,7 +1257,7 @@ int object_is_libdata(Object *ob) } /* Returns true if the Object data is a from an external blend file (libdata) */ -int object_data_is_libdata(Object *ob) +int BKE_object_obdata_is_libdata(Object *ob) { if (!ob) return 0; if (ob->proxy && (ob->data==NULL || ((ID *)ob->data)->lib==NULL)) return 0; @@ -1303,7 +1284,7 @@ static void armature_set_id_extern(Object *ob) } -void object_copy_proxy_drivers(Object *ob, Object *target) +void BKE_object_copy_proxy_drivers(Object *ob, Object *target) { if ((target->adt) && (target->adt->drivers.first)) { FCurve *fcu; @@ -1345,7 +1326,7 @@ void object_copy_proxy_drivers(Object *ob, Object *target) /* local_object->proxy == pointer to library object, saved in files and read */ /* local_object->proxy_group == pointer to group dupli-object, saved in files and read */ -void object_make_proxy(Object *ob, Object *target, Object *gob) +void BKE_object_make_proxy(Object *ob, Object *target, Object *gob) { /* paranoia checks */ if (ob->id.lib || target->id.lib==NULL) { @@ -1374,7 +1355,7 @@ void object_make_proxy(Object *ob, Object *target, Object *gob) mul_mat3_m4_v3(ob->obmat, tvec); sub_v3_v3(ob->obmat[3], tvec); } - object_apply_mat4(ob, ob->obmat, FALSE, TRUE); + BKE_object_apply_mat4(ob, ob->obmat, FALSE, TRUE); } else { copy_object_transform(ob, target); @@ -1383,7 +1364,7 @@ void object_make_proxy(Object *ob, Object *target, Object *gob) } /* copy animdata stuff - drivers only for now... */ - object_copy_proxy_drivers(ob, target); + BKE_object_copy_proxy_drivers(ob, target); /* skip constraints? */ // FIXME: this is considered by many as a bug @@ -1416,8 +1397,8 @@ void object_make_proxy(Object *ob, Object *target, Object *gob) /* type conversions */ if (target->type == OB_ARMATURE) { copy_object_pose(ob, target); /* data copy, object pointers in constraints */ - rest_pose(ob->pose); /* clear all transforms in channels */ - armature_rebuild_pose(ob, ob->data); /* set all internal links */ + BKE_pose_rest(ob->pose); /* clear all transforms in channels */ + BKE_pose_rebuild(ob, ob->data); /* set all internal links */ armature_set_id_extern(ob); } @@ -1443,14 +1424,14 @@ void object_make_proxy(Object *ob, Object *target, Object *gob) /* *************** CALC ****************** */ -void object_scale_to_mat3(Object *ob, float mat[][3]) +void BKE_object_scale_to_mat3(Object *ob, float mat[][3]) { float vec[3]; mul_v3_v3v3(vec, ob->size, ob->dscale); size_to_mat3(mat, vec); } -void object_rot_to_mat3(Object *ob, float mat[][3]) +void BKE_object_rot_to_mat3(Object *ob, float mat[][3]) { float rmat[3][3], dmat[3][3]; @@ -1484,7 +1465,7 @@ void object_rot_to_mat3(Object *ob, float mat[][3]) mul_m3_m3m3(mat, dmat, rmat); } -void object_mat3_to_rot(Object *ob, float mat[][3], short use_compat) +void BKE_object_mat3_to_rot(Object *ob, float mat[][3], short use_compat) { switch (ob->rotmode) { case ROT_MODE_QUAT: @@ -1521,7 +1502,7 @@ void object_mat3_to_rot(Object *ob, float mat[][3], short use_compat) } } -void object_tfm_protected_backup(const Object *ob, +void BKE_object_tfm_protected_backup(const Object *ob, ObjectTfmProtectedChannels *obtfm) { @@ -1548,7 +1529,7 @@ void object_tfm_protected_backup(const Object *ob, } -void object_tfm_protected_restore(Object *ob, +void BKE_object_tfm_protected_restore(Object *ob, const ObjectTfmProtectedChannels *obtfm, const short protectflag) { @@ -1586,8 +1567,8 @@ void object_tfm_protected_restore(Object *ob, } } -/* see pchan_apply_mat4() for the equivalent 'pchan' function */ -void object_apply_mat4(Object *ob, float mat[][4], const short use_compat, const short use_parent) +/* see BKE_pchan_apply_mat4() for the equivalent 'pchan' function */ +void BKE_object_apply_mat4(Object *ob, float mat[][4], const short use_compat, const short use_parent) { float rot[3][3]; @@ -1596,15 +1577,15 @@ void object_apply_mat4(Object *ob, float mat[][4], const short use_compat, const mult_m4_m4m4(diff_mat, ob->parent->obmat, ob->parentinv); invert_m4_m4(imat, diff_mat); mult_m4_m4m4(rmat, imat, mat); /* get the parent relative matrix */ - object_apply_mat4(ob, rmat, use_compat, FALSE); + BKE_object_apply_mat4(ob, rmat, use_compat, FALSE); /* same as below, use rmat rather than mat */ mat4_to_loc_rot_size(ob->loc, rot, ob->size, rmat); - object_mat3_to_rot(ob, rot, use_compat); + BKE_object_mat3_to_rot(ob, rot, use_compat); } else { mat4_to_loc_rot_size(ob->loc, rot, ob->size, mat); - object_mat3_to_rot(ob, rot, use_compat); + BKE_object_mat3_to_rot(ob, rot, use_compat); } sub_v3_v3(ob->loc, ob->dloc); @@ -1613,28 +1594,28 @@ void object_apply_mat4(Object *ob, float mat[][4], const short use_compat, const if (ob->dscale[1] != 0.0f) ob->size[1] /= ob->dscale[1]; if (ob->dscale[2] != 0.0f) ob->size[2] /= ob->dscale[2]; - /* object_mat3_to_rot handles delta rotations */ + /* BKE_object_mat3_to_rot handles delta rotations */ } -void object_to_mat3(Object *ob, float mat[][3]) /* no parent */ +void BKE_object_to_mat3(Object *ob, float mat[][3]) /* no parent */ { float smat[3][3]; float rmat[3][3]; /*float q1[4];*/ /* size */ - object_scale_to_mat3(ob, smat); + BKE_object_scale_to_mat3(ob, smat); /* rot */ - object_rot_to_mat3(ob, rmat); + BKE_object_rot_to_mat3(ob, rmat); mul_m3_m3m3(mat, rmat, smat); } -void object_to_mat4(Object *ob, float mat[][4]) +void BKE_object_to_mat4(Object *ob, float mat[][4]) { float tmat[3][3]; - object_to_mat3(ob, tmat); + BKE_object_to_mat3(ob, tmat); copy_m4_m3(mat, tmat); @@ -1739,7 +1720,7 @@ static void ob_parbone(Object *ob, Object *par, float mat[][4]) } /* Make sure the bone is still valid */ - pchan= get_pose_channel(par->pose, ob->parsubstr); + pchan= BKE_pose_channel_find_name(par->pose, ob->parsubstr); if (!pchan) { printf ("Object %s with Bone parent: bone %s doesn't exist\n", ob->id.name+2, ob->parsubstr); unit_m4(mat); @@ -1933,7 +1914,7 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[ return 1; } -void where_is_object_time(Scene *scene, Object *ob, float ctime) +void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime) { float slowmat[4][4] = MAT4_UNITY; float stime=ctime; @@ -1957,7 +1938,7 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime) Object tmp= *par; if (par->proxy_from); // was a copied matrix, no where_is! bad... - else where_is_object_time(scene, par, ctime); + else BKE_object_where_is_calc_time(scene, par, ctime); solve_parenting(scene, ob, par, ob->obmat, slowmat, 0); @@ -1975,7 +1956,7 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime) } } else { - object_to_mat4(ob, ob->obmat); + BKE_object_to_mat4(ob, ob->obmat); } /* solve constraints */ @@ -1984,7 +1965,7 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime) cob= constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT); - /* constraints need ctime, not stime. Some call where_is_object_time and bsystem_time */ + /* constraints need ctime, not stime. Some call BKE_object_where_is_calc_time and bsystem_time */ solve_constraints (&ob->constraints, cob, ctime); constraints_clear_evalob(cob); @@ -1999,7 +1980,7 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime) * constraints -- assume dependencies are already solved by depsgraph. * no changes to object and it's parent would be done. * used for bundles orientation in 3d space relative to parented blender camera */ -void where_is_object_mat(Scene *scene, Object *ob, float obmat[4][4]) +void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4]) { float slowmat[4][4] = MAT4_UNITY; @@ -2012,7 +1993,7 @@ void where_is_object_mat(Scene *scene, Object *ob, float obmat[4][4]) where_is_object_parslow(ob, obmat, slowmat); } else { - object_to_mat4(ob, obmat); + BKE_object_to_mat4(ob, obmat); } } @@ -2024,7 +2005,7 @@ static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[ float vec[3]; int ok; - object_to_mat4(ob, locmat); + BKE_object_to_mat4(ob, locmat); if (ob->partype & PARSLOW) copy_m4_m4(slowmat, obmat); @@ -2095,13 +2076,13 @@ static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[ } -void where_is_object(struct Scene *scene, Object *ob) +void BKE_object_where_is_calc(struct Scene *scene, Object *ob) { - where_is_object_time(scene, ob, (float)scene->r.cfra); + BKE_object_where_is_calc_time(scene, ob, (float)scene->r.cfra); } -void where_is_object_simul(Scene *scene, Object *ob) +void BKE_object_where_is_calc_simul(Scene *scene, Object *ob) /* was written for the old game engine (until 2.04) */ /* It seems that this function is only called * for a lamp that is the child of another object */ @@ -2129,7 +2110,7 @@ void where_is_object_simul(Scene *scene, Object *ob) } } else { - object_to_mat4(ob, ob->obmat); + BKE_object_to_mat4(ob, ob->obmat); } /* solve constraints */ @@ -2143,9 +2124,9 @@ void where_is_object_simul(Scene *scene, Object *ob) } /* for calculation of the inverse parent transform, only used for editor */ -void what_does_parent(Scene *scene, Object *ob, Object *workob) +void BKE_object_workob_calc_parent(Scene *scene, Object *ob, Object *workob) { - clear_workob(workob); + BKE_object_workob_clear(workob); unit_m4(workob->obmat); unit_m4(workob->parentinv); @@ -2165,21 +2146,21 @@ void what_does_parent(Scene *scene, Object *ob, Object *workob) BLI_strncpy(workob->parsubstr, ob->parsubstr, sizeof(workob->parsubstr)); - where_is_object(scene, workob); + BKE_object_where_is_calc(scene, workob); } -BoundBox *unit_boundbox(void) +BoundBox *BKE_boundbox_alloc_unit(void) { BoundBox *bb; float min[3] = {-1.0f, -1.0f, -1.0f}, max[3] = {-1.0f, -1.0f, -1.0f}; bb= MEM_callocN(sizeof(BoundBox), "OB-BoundBox"); - boundbox_set_from_min_max(bb, min, max); + BKE_boundbox_init_from_minmax(bb, min, max); return bb; } -void boundbox_set_from_min_max(BoundBox *bb, float min[3], float max[3]) +void BKE_boundbox_init_from_minmax(BoundBox *bb, float min[3], float max[3]) { bb->vec[0][0]=bb->vec[1][0]=bb->vec[2][0]=bb->vec[3][0]= min[0]; bb->vec[4][0]=bb->vec[5][0]=bb->vec[6][0]=bb->vec[7][0]= max[0]; @@ -2191,7 +2172,7 @@ void boundbox_set_from_min_max(BoundBox *bb, float min[3], float max[3]) bb->vec[1][2]=bb->vec[2][2]=bb->vec[5][2]=bb->vec[6][2]= max[2]; } -BoundBox *object_get_boundbox(Object *ob) +BoundBox *BKE_object_boundbox_get(Object *ob) { BoundBox *bb= NULL; @@ -2208,20 +2189,20 @@ BoundBox *object_get_boundbox(Object *ob) } /* used to temporally disable/enable boundbox */ -void object_boundbox_flag(Object *ob, int flag, int set) +void BKE_object_boundbox_flag(Object *ob, int flag, int set) { - BoundBox *bb= object_get_boundbox(ob); + BoundBox *bb= BKE_object_boundbox_get(ob); if (bb) { if (set) bb->flag |= flag; else bb->flag &= ~flag; } } -void object_get_dimensions(Object *ob, float vec[3]) +void BKE_object_dimensions_get(Object *ob, float vec[3]) { BoundBox *bb = NULL; - bb= object_get_boundbox(ob); + bb= BKE_object_boundbox_get(ob); if (bb) { float scale[3]; @@ -2236,11 +2217,11 @@ void object_get_dimensions(Object *ob, float vec[3]) } } -void object_set_dimensions(Object *ob, const float *value) +void BKE_object_dimensions_set(Object *ob, const float *value) { BoundBox *bb = NULL; - bb= object_get_boundbox(ob); + bb= BKE_object_boundbox_get(ob); if (bb) { float scale[3], len[3]; @@ -2256,7 +2237,7 @@ void object_set_dimensions(Object *ob, const float *value) } } -void minmax_object(Object *ob, float min[3], float max[3]) +void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3]) { BoundBox bb; float vec[3]; @@ -2275,7 +2256,7 @@ void minmax_object(Object *ob, float min[3], float max[3]) for (a=0; a<8; a++) { mul_m4_v3(ob->obmat, bb.vec[a]); - DO_MINMAX(bb.vec[a], min, max); + DO_MINMAX(bb.vec[a], min_r, max_r); } change= TRUE; } @@ -2290,7 +2271,7 @@ void minmax_object(Object *ob, float min[3], float max[3]) for (v=0; v<lt->pntsv; v++) { for (u=0; u<lt->pntsu; u++, bp++) { mul_v3_m4v3(vec, ob->obmat, bp->vec); - DO_MINMAX(vec, min, max); + DO_MINMAX(vec, min_r, max_r); } } } @@ -2302,23 +2283,23 @@ void minmax_object(Object *ob, float min[3], float max[3]) bPoseChannel *pchan; for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { mul_v3_m4v3(vec, ob->obmat, pchan->pose_head); - DO_MINMAX(vec, min, max); + DO_MINMAX(vec, min_r, max_r); mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail); - DO_MINMAX(vec, min, max); + DO_MINMAX(vec, min_r, max_r); } change= TRUE; } break; case OB_MESH: { - Mesh *me= get_mesh(ob); + Mesh *me= BKE_mesh_from_object(ob); if (me) { bb = *mesh_get_bb(ob); for (a=0; a<8; a++) { mul_m4_v3(ob->obmat, bb.vec[a]); - DO_MINMAX(bb.vec[a], min, max); + DO_MINMAX(bb.vec[a], min_r, max_r); } change= TRUE; } @@ -2327,19 +2308,19 @@ void minmax_object(Object *ob, float min[3], float max[3]) } if (change == FALSE) { - DO_MINMAX(ob->obmat[3], min, max); + DO_MINMAX(ob->obmat[3], min_r, max_r); copy_v3_v3(vec, ob->obmat[3]); add_v3_v3(vec, ob->size); - DO_MINMAX(vec, min, max); + DO_MINMAX(vec, min_r, max_r); copy_v3_v3(vec, ob->obmat[3]); sub_v3_v3(vec, ob->size); - DO_MINMAX(vec, min, max); + DO_MINMAX(vec, min_r, max_r); } } -int minmax_object_duplis(Scene *scene, Object *ob, float min[3], float max[3]) +int BKE_object_minmax_dupli(Scene *scene, Object *ob, float r_min[3], float r_max[3]) { int ok= 0; if ((ob->transflag & OB_DUPLI)==0) { @@ -2352,14 +2333,14 @@ int minmax_object_duplis(Scene *scene, Object *ob, float min[3], float max[3]) lb= object_duplilist(scene, ob); for (dob= lb->first; dob; dob= dob->next) { if (dob->no_draw == 0) { - BoundBox *bb= object_get_boundbox(dob->ob); + BoundBox *bb= BKE_object_boundbox_get(dob->ob); if (bb) { int i; for (i=0; i<8; i++) { float vec[3]; mul_v3_m4v3(vec, dob->mat, bb->vec[i]); - DO_MINMAX(vec, min, max); + DO_MINMAX(vec, r_min, r_max); } ok= 1; @@ -2449,7 +2430,7 @@ typedef struct ObTfmBack { float imat[4][4]; /* inverse matrix of 'obmat' for during render, old game engine, temporally: ipokeys of transform */ } ObTfmBack; -void *object_tfm_backup(Object *ob) +void *BKE_object_tfm_backup(Object *ob) { ObTfmBack *obtfm= MEM_mallocN(sizeof(ObTfmBack), "ObTfmBack"); copy_v3_v3(obtfm->loc, ob->loc); @@ -2473,7 +2454,7 @@ void *object_tfm_backup(Object *ob) return (void *)obtfm; } -void object_tfm_restore(Object *ob, void *obtfm_pt) +void BKE_object_tfm_restore(Object *ob, void *obtfm_pt) { ObTfmBack *obtfm= (ObTfmBack *)obtfm_pt; copy_v3_v3(ob->loc, obtfm->loc); @@ -2510,26 +2491,26 @@ int BKE_object_parent_loop_check(const Object *par, const Object *ob) /* the main object update call, for object matrix, constraints, keys and displist (modifiers) */ /* requires flags to be set! */ -void object_handle_update(Scene *scene, Object *ob) +void BKE_object_handle_update(Scene *scene, Object *ob) { if (ob->recalc & OB_RECALC_ALL) { /* speed optimization for animation lookups */ if (ob->pose) - make_pose_channels_hash(ob->pose); + BKE_pose_channels_hash_make(ob->pose); if (ob->recalc & OB_RECALC_DATA) { if (ob->type==OB_ARMATURE) { /* this happens for reading old files and to match library armatures - * with poses we do it ahead of where_is_object to ensure animation + * with poses we do it ahead of BKE_object_where_is_calc to ensure animation * is evaluated on the rebuilt pose, otherwise we get incorrect poses * on file load */ if (ob->pose==NULL || (ob->pose->flag & POSE_RECALC)) - armature_rebuild_pose(ob, ob->data); + BKE_pose_rebuild(ob, ob->data); } } /* XXX new animsys warning: depsgraph tag OB_RECALC_DATA should not skip drivers, - * which is only in where_is_object now */ + * which is only in BKE_object_where_is_calc now */ // XXX: should this case be OB_RECALC_OB instead? if (ob->recalc & OB_RECALC_ALL) { @@ -2551,7 +2532,7 @@ void object_handle_update(Scene *scene, Object *ob) copy_m4_m4(ob->obmat, ob->proxy_from->obmat); } else - where_is_object(scene, ob); + BKE_object_where_is_calc(scene, ob); } if (ob->recalc & OB_RECALC_DATA) { @@ -2601,10 +2582,10 @@ void object_handle_update(Scene *scene, Object *ob) case OB_ARMATURE: if (ob->id.lib && ob->proxy_from) { // printf("pose proxy copy, lib ob %s proxy %s\n", ob->id.name, ob->proxy_from->id.name); - copy_pose_result(ob->pose, ob->proxy_from->pose); + BKE_pose_copy_result(ob->pose, ob->proxy_from->pose); } else { - where_is_pose(scene, ob); + BKE_pose_where_is(scene, ob); } break; @@ -2619,7 +2600,7 @@ void object_handle_update(Scene *scene, Object *ob) break; case OB_LATTICE: - lattice_calc_modifiers(scene, ob); + BKE_lattice_modifiers_calc(scene, ob); break; } @@ -2691,7 +2672,7 @@ void object_handle_update(Scene *scene, Object *ob) /* set pointer in library proxy target, for copying, but restore it */ ob->proxy->proxy_from= ob; // printf("call update, lib ob %s proxy %s\n", ob->proxy->id.name, ob->id.name); - object_handle_update(scene, ob->proxy); + BKE_object_handle_update(scene, ob->proxy); } ob->recalc &= ~OB_RECALC_ALL; @@ -2704,7 +2685,7 @@ void object_handle_update(Scene *scene, Object *ob) } } -void object_sculpt_modifiers_changed(Object *ob) +void BKE_object_sculpt_modifiers_changed(Object *ob) { SculptSession *ss= ob->sculpt; @@ -2732,7 +2713,7 @@ void object_sculpt_modifiers_changed(Object *ob) } } -int give_obdata_texspace(Object *ob, short **texflag, float **loc, float **size, float **rot) +int BKE_object_obdata_texspace_get(Object *ob, short **r_texflag, float **r_loc, float **r_size, float **r_rot) { if (ob->data==NULL) @@ -2742,28 +2723,28 @@ int give_obdata_texspace(Object *ob, short **texflag, float **loc, float **size, case ID_ME: { Mesh *me= ob->data; - if (texflag) *texflag = &me->texflag; - if (loc) *loc = me->loc; - if (size) *size = me->size; - if (rot) *rot = me->rot; + if (r_texflag) *r_texflag = &me->texflag; + if (r_loc) *r_loc = me->loc; + if (r_size) *r_size = me->size; + if (r_rot) *r_rot = me->rot; break; } case ID_CU: { Curve *cu= ob->data; - if (texflag) *texflag = &cu->texflag; - if (loc) *loc = cu->loc; - if (size) *size = cu->size; - if (rot) *rot = cu->rot; + if (r_texflag) *r_texflag = &cu->texflag; + if (r_loc) *r_loc = cu->loc; + if (r_size) *r_size = cu->size; + if (r_rot) *r_rot = cu->rot; break; } case ID_MB: { MetaBall *mb= ob->data; - if (texflag) *texflag = &mb->texflag; - if (loc) *loc = mb->loc; - if (size) *size = mb->size; - if (rot) *rot = mb->rot; + if (r_texflag) *r_texflag = &mb->texflag; + if (r_loc) *r_loc = mb->loc; + if (r_size) *r_size = mb->size; + if (r_rot) *r_rot = mb->rot; break; } default: @@ -2776,7 +2757,7 @@ int give_obdata_texspace(Object *ob, short **texflag, float **loc, float **size, * Test a bounding box for ray intersection * assumes the ray is already local to the boundbox space */ -int ray_hit_boundbox(struct BoundBox *bb, float ray_start[3], float ray_normal[3]) +int BKE_boundbox_ray_hit_check(struct BoundBox *bb, float ray_start[3], float ray_normal[3]) { static int triangle_indexes[12][3] = {{0, 1, 2}, {0, 2, 3}, {3, 2, 6}, {3, 6, 7}, @@ -2807,7 +2788,7 @@ static int pc_cmp(void *a, void *b) else return 0; } -int object_insert_ptcache(Object *ob) +int BKE_object_insert_ptcache(Object *ob) { LinkData *link = NULL; int i = 0; @@ -2966,7 +2947,7 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int return kb; } -KeyBlock *object_insert_shape_key(Scene *scene, Object *ob, const char *name, int from_mix) +KeyBlock *BKE_object_insert_shape_key(Scene *scene, Object *ob, const char *name, int from_mix) { switch (ob->type) { case OB_MESH: @@ -2984,7 +2965,7 @@ KeyBlock *object_insert_shape_key(Scene *scene, Object *ob, const char *name, in /* most important if this is modified it should _always_ return True, in certain * cases false positives are hard to avoid (shape keys for example) */ -int object_is_modified(Scene *scene, Object *ob) +int BKE_object_is_modified(Scene *scene, Object *ob) { int flag= 0; @@ -3012,7 +2993,7 @@ int object_is_modified(Scene *scene, Object *ob) /* test if object is affected by deforming modifiers (for motion blur). again * most important is to avoid false positives, this is to skip computations * and we can still if there was actual deformation afterwards */ -int object_is_deform_modified(Scene *scene, Object *ob) +int BKE_object_is_deform_modified(Scene *scene, Object *ob) { ModifierData *md; int flag= 0; @@ -3042,7 +3023,7 @@ static void copy_object__forwardModifierLinks(void *UNUSED(userData), Object *UN if (*idpoin && (*idpoin)->newid) *idpoin = (*idpoin)->newid; } -void object_relink(Object *ob) +void BKE_object_relink(Object *ob) { if (ob->id.lib) return; @@ -3065,7 +3046,7 @@ void object_relink(Object *ob) ID_NEW(ob->proxy_group); } -MovieClip *object_get_movieclip(Scene *scene, Object *ob, int use_default) +MovieClip *BKE_object_movieclip_get(Scene *scene, Object *ob, int use_default) { MovieClip *clip= use_default ? scene->clip : NULL; bConstraint *con= ob->constraints.first, *scon= NULL; diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index 4ddcd6f4b51..6242976d323 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -1251,18 +1251,18 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v /* write the images */ cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_DISPLACE); - if (0 == BKE_write_ibuf(ibuf_disp, string, &imf)) + if (0 == BKE_imbuf_write(ibuf_disp, string, &imf)) printf("Cannot save Displacement File Output to %s\n", string); if (o->_do_jacobian) { cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_FOAM); - if (0 == BKE_write_ibuf(ibuf_foam, string, &imf)) + if (0 == BKE_imbuf_write(ibuf_foam, string, &imf)) printf("Cannot save Foam File Output to %s\n", string); } if (o->_do_normals) { cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_NORMAL); - if (0 == BKE_write_ibuf(ibuf_normal, string, &imf)) + if (0 == BKE_imbuf_write(ibuf_normal, string, &imf)) printf("Cannot save Normal File Output to %s\n", string); } diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index f417f9b79fb..08d8479fd93 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -126,7 +126,7 @@ void paint_init(Paint *p, const char col[3]) /* If there's no brush, create one */ brush = paint_brush(p); if (brush == NULL) - brush= add_brush("Brush"); + brush= BKE_brush_add("Brush"); paint_brush_set(p, brush); memcpy(p->paint_cursor_col, col, 3); diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 1a1ae8e949c..0e56839a6e9 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -369,7 +369,7 @@ static void fluid_free_settings(SPHFluidSettings *fluid) MEM_freeN(fluid); } -void psys_free_settings(ParticleSettings *part) +void BKE_particlesettings_free(ParticleSettings *part) { MTex *mtex; int a; @@ -3475,7 +3475,7 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n psys->totpart=0; psys->flag = PSYS_ENABLED|PSYS_CURRENT; - psys->cfra = BKE_frame_to_ctime(scene, CFRA + 1); + psys->cfra = BKE_scene_frame_get_from_ctime(scene, CFRA + 1); DAG_scene_sort(G.main, scene); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); @@ -3610,19 +3610,19 @@ ParticleSettings *psys_new_settings(const char *name, Main *main) if (main==NULL) main = G.main; - part= alloc_libblock(&main->particle, ID_PA, name); + part= BKE_libblock_alloc(&main->particle, ID_PA, name); default_particle_settings(part); return part; } -ParticleSettings *psys_copy_settings(ParticleSettings *part) +ParticleSettings *BKE_particlesettings_copy(ParticleSettings *part) { ParticleSettings *partn; int a; - partn= copy_libblock(&part->id); + partn= BKE_libblock_copy(&part->id); partn->pd= MEM_dupallocN(part->pd); partn->pd2= MEM_dupallocN(part->pd2); partn->effector_weights= MEM_dupallocN(part->effector_weights); @@ -3653,7 +3653,7 @@ static void expand_local_particlesettings(ParticleSettings *part) } } -void make_local_particlesettings(ParticleSettings *part) +void BKE_particlesettings_make_local(ParticleSettings *part) { Main *bmain= G.main; Object *ob; @@ -3687,7 +3687,7 @@ void make_local_particlesettings(ParticleSettings *part) expand_local_particlesettings(part); } else if (is_local && is_lib) { - ParticleSettings *part_new= psys_copy_settings(part); + ParticleSettings *part_new= BKE_particlesettings_copy(part); part_new->id.us= 0; /* Remap paths of new ID using old library as base. */ @@ -4266,7 +4266,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta float timestep = psys_get_timestep(sim); /* negative time means "use current time" */ - cfra = state->time > 0 ? state->time : BKE_curframe(sim->scene); + cfra = state->time > 0 ? state->time : BKE_scene_frame_get(sim->scene); if (p>=totpart) { if (!psys->totchild) diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index daa7f847df6..b89daea1249 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -1853,7 +1853,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, ob = ob->parent; } ob = sim->ob; - where_is_object_time(sim->scene, ob, pa->time); + BKE_object_where_is_calc_time(sim->scene, ob, pa->time); psys->flag |= PSYS_OB_ANIM_RESTORE; } @@ -4464,7 +4464,7 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys) if (!psys_check_enabled(ob, psys)) return; - cfra= BKE_curframe(scene); + cfra= BKE_scene_frame_get(scene); sim.scene= scene; sim.ob= ob; @@ -4611,7 +4611,7 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys) ob = ob->parent; } ob = sim.ob; - where_is_object_time(scene, ob, cfra); + BKE_object_where_is_calc_time(scene, ob, cfra); psys->flag &= ~PSYS_OB_ANIM_RESTORE; } diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 1e80f1e6d1e..69808db52b6 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1122,7 +1122,7 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p if (do_ext) { if (pid->cache->index < 0) - pid->cache->index = pid->stack_index = object_insert_ptcache(pid->ob); + pid->cache->index = pid->stack_index = BKE_object_insert_ptcache(pid->ob); if (pid->cache->flag & PTCACHE_EXTERNAL) { if (pid->cache->index >= 0) @@ -2320,8 +2320,8 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra cache= pid->cache; if (timescale) { - time= BKE_curframe(scene); - nexttime = BKE_frame_to_ctime(scene, CFRA + 1.0f); + time= BKE_scene_frame_get(scene); + nexttime = BKE_scene_frame_get_from_ctime(scene, CFRA + 1.0f); *timescale= MAX2(nexttime - time, 0.0f); } @@ -2743,7 +2743,7 @@ static void *ptcache_bake_thread(void *ptr) efra = data->endframe; for (; (*data->cfra_ptr <= data->endframe) && !data->break_operation; *data->cfra_ptr+=data->step) { - scene_update_for_newframe(data->main, data->scene, data->scene->lay); + BKE_scene_update_for_newframe(data->main, data->scene, data->scene->lay); if (G.background) { printf("bake: frame %d :: %d\n", (int)*data->cfra_ptr, data->endframe); } @@ -2974,7 +2974,7 @@ void BKE_ptcache_bake(PTCacheBaker* baker) CFRA = cfrao; if (bake) /* already on cfra unless baking */ - scene_update_for_newframe(bmain, scene, scene->lay); + BKE_scene_update_for_newframe(bmain, scene, scene->lay); if (thread_data.break_operation) WM_cursor_wait(0); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 864260833a6..2526bd05857 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -110,7 +110,7 @@ void free_qtcodecdata(QuicktimeCodecData *qcd) } } -Scene *copy_scene(Scene *sce, int type) +Scene *BKE_scene_copy(Scene *sce, int type) { Scene *scen; ToolSettings *ts; @@ -118,7 +118,7 @@ Scene *copy_scene(Scene *sce, int type) if (type == SCE_COPY_EMPTY) { ListBase lb; - scen= add_scene(sce->id.name+2); + scen= BKE_scene_add(sce->id.name+2); lb= scen->r.layers; scen->r= sce->r; @@ -131,7 +131,7 @@ Scene *copy_scene(Scene *sce, int type) MEM_freeN(scen->toolsettings); } else { - scen= copy_libblock(&sce->id); + scen= BKE_libblock_copy(&sce->id); BLI_duplicatelist(&(scen->base), &(sce->base)); clear_id_newpoins(); @@ -229,7 +229,7 @@ Scene *copy_scene(Scene *sce, int type) BKE_copy_animdata_id_action((ID *)scen); if (scen->world) { id_us_plus((ID *)scen->world); - scen->world= copy_world(scen->world); + scen->world= BKE_world_copy(scen->world); BKE_copy_animdata_id_action((ID *)scen->world); } @@ -244,7 +244,7 @@ Scene *copy_scene(Scene *sce, int type) } /* do not free scene itself */ -void free_scene(Scene *sce) +void BKE_scene_free(Scene *sce) { Base *base; @@ -332,14 +332,14 @@ void free_scene(Scene *sce) sound_destroy_scene(sce); } -Scene *add_scene(const char *name) +Scene *BKE_scene_add(const char *name) { Main *bmain= G.main; Scene *sce; ParticleEditSettings *pset; int a; - sce= alloc_libblock(&bmain->scene, ID_SCE, name); + sce= BKE_libblock_alloc(&bmain->scene, ID_SCE, name); sce->lay= sce->layact= 1; sce->r.mode= R_GAMMA|R_OSA|R_SHADOW|R_SSS|R_ENVMAP|R_RAYTRACE; @@ -490,7 +490,7 @@ Scene *add_scene(const char *name) sce->r.osa= 8; /* note; in header_info.c the scene copy happens..., if you add more to renderdata it has to be checked there */ - scene_add_render_layer(sce, NULL); + BKE_scene_add_render_layer(sce, NULL); /* game data */ sce->gm.stereoflag = STEREO_NOSTEREO; @@ -544,11 +544,11 @@ Scene *add_scene(const char *name) return sce; } -Base *object_in_scene(Object *ob, Scene *sce) +Base *BKE_scene_base_find(Scene *scene, Object *ob) { Base *base; - base= sce->base.first; + base= scene->base.first; while (base) { if (base->object == ob) return base; base= base->next; @@ -556,7 +556,7 @@ Base *object_in_scene(Object *ob, Scene *sce) return NULL; } -void set_scene_bg(Main *bmain, Scene *scene) +void BKE_scene_set_background(Main *bmain, Scene *scene) { Scene *sce; Base *base; @@ -566,7 +566,7 @@ void set_scene_bg(Main *bmain, Scene *scene) int flag; /* check for cyclic sets, for reading old files but also for definite security (py?) */ - scene_check_setscene(bmain, scene); + BKE_scene_validate_setscene(bmain, scene); /* can happen when switching modes in other scenes */ if (scene->obedit && !(scene->obedit->mode & OB_MODE_EDIT)) @@ -613,11 +613,11 @@ void set_scene_bg(Main *bmain, Scene *scene) } /* called from creator.c */ -Scene *set_scene_name(Main *bmain, const char *name) +Scene *BKE_scene_set_name(Main *bmain, const char *name) { - Scene *sce= (Scene *)find_id("SC", name); + Scene *sce = (Scene *)BKE_libblock_find_name(ID_SCE, name); if (sce) { - set_scene_bg(bmain, sce); + BKE_scene_set_background(bmain, sce); printf("Scene switch: '%s' in file: '%s'\n", name, G.main->name); return sce; } @@ -626,7 +626,7 @@ Scene *set_scene_name(Main *bmain, const char *name) return NULL; } -void unlink_scene(Main *bmain, Scene *sce, Scene *newsce) +void BKE_scene_unlink(Main *bmain, Scene *sce, Scene *newsce) { Scene *sce1; bScreen *sc; @@ -647,13 +647,13 @@ void unlink_scene(Main *bmain, Scene *sce, Scene *newsce) if (sc->scene == sce) sc->scene= newsce; - free_libblock(&bmain->scene, sce); + BKE_libblock_free(&bmain->scene, sce); } /* used by metaballs * doesnt return the original duplicated object, only dupli's */ -int next_object(Scene **scene, int val, Base **base, Object **ob) +int BKE_scene_base_iter_next(Scene **scene, int val, Base **base, Object **ob) { static ListBase *duplilist= NULL; static DupliObject *dupob; @@ -776,7 +776,7 @@ int next_object(Scene **scene, int val, Base **base, Object **ob) return fase; } -Object *scene_find_camera(Scene *sc) +Object *BKE_scene_camera_find(Scene *sc) { Base *base; @@ -788,7 +788,7 @@ Object *scene_find_camera(Scene *sc) } #ifdef DURIAN_CAMERA_SWITCH -Object *scene_camera_switch_find(Scene *scene) +Object *BKE_scene_camera_switch_find(Scene *scene) { TimeMarker *m; int cfra = scene->r.cfra; @@ -809,10 +809,10 @@ Object *scene_camera_switch_find(Scene *scene) } #endif -int scene_camera_switch_update(Scene *scene) +int BKE_scene_camera_switch_update(Scene *scene) { #ifdef DURIAN_CAMERA_SWITCH - Object *camera= scene_camera_switch_find(scene); + Object *camera= BKE_scene_camera_switch_find(scene); if (camera) { scene->camera= camera; return 1; @@ -823,7 +823,7 @@ int scene_camera_switch_update(Scene *scene) return 0; } -char *scene_find_marker_name(Scene *scene, int frame) +char *BKE_scene_find_marker_name(Scene *scene, int frame) { ListBase *markers= &scene->markers; TimeMarker *m1, *m2; @@ -845,7 +845,7 @@ char *scene_find_marker_name(Scene *scene, int frame) /* return the current marker for this frame, * we can have more then 1 marker per frame, this just returns the first :/ */ -char *scene_find_last_marker_name(Scene *scene, int frame) +char *BKE_scene_find_last_marker_name(Scene *scene, int frame) { TimeMarker *marker, *best_marker = NULL; int best_frame = -MAXFRAME*2; @@ -864,9 +864,9 @@ char *scene_find_last_marker_name(Scene *scene, int frame) } -Base *scene_add_base(Scene *sce, Object *ob) +Base *BKE_scene_base_add(Scene *sce, Object *ob) { - Base *b= MEM_callocN(sizeof(*b), "scene_add_base"); + Base *b= MEM_callocN(sizeof(*b), "BKE_scene_base_add"); BLI_addhead(&sce->base, b); b->object= ob; @@ -876,7 +876,7 @@ Base *scene_add_base(Scene *sce, Object *ob) return b; } -void scene_deselect_all(Scene *sce) +void BKE_scene_base_deselect_all(Scene *sce) { Base *b; @@ -886,7 +886,7 @@ void scene_deselect_all(Scene *sce) } } -void scene_select_base(Scene *sce, Base *selbase) +void BKE_scene_base_select(Scene *sce, Base *selbase) { scene_deselect_all(sce); @@ -897,7 +897,7 @@ void scene_select_base(Scene *sce, Base *selbase) } /* checks for cycle, returns 1 if it's all OK */ -int scene_check_setscene(Main *bmain, Scene *sce) +int BKE_scene_validate_setscene(Main *bmain, Scene *sce) { Scene *scene; int a, totscene; @@ -923,13 +923,13 @@ int scene_check_setscene(Main *bmain, Scene *sce) /* This function is needed to cope with fractional frames - including two Blender rendering features * mblur (motion blur that renders 'subframes' and blurs them together), and fields rendering. */ -float BKE_curframe(Scene *scene) +float BKE_scene_frame_get(Scene *scene) { - return BKE_frame_to_ctime(scene, scene->r.cfra); + return BKE_scene_frame_get_from_ctime(scene, scene->r.cfra); } /* This function is used to obtain arbitrary fractional frames */ -float BKE_frame_to_ctime(Scene *scene, const float frame) +float BKE_scene_frame_get_from_ctime(Scene *scene, const float frame) { float ctime = frame; ctime += scene->r.subframe; @@ -946,7 +946,7 @@ float BKE_frame_to_ctime(Scene *scene, const float frame) */ static void scene_update_drivers(Main *UNUSED(bmain), Scene *scene) { - float ctime = BKE_curframe(scene); + float ctime = BKE_scene_frame_get(scene); /* scene itself */ if (scene->adt && scene->adt->drivers.first) { @@ -989,7 +989,7 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen for (base= scene->base.first; base; base= base->next) { Object *ob= base->object; - object_handle_update(scene_parent, ob); + BKE_object_handle_update(scene_parent, ob); if (ob->dup_group && (ob->transflag & OB_DUPLIGROUP)) group_handle_recalc_and_update(scene_parent, ob, ob->dup_group); @@ -1006,10 +1006,10 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen } /* this is called in main loop, doing tagged updates before redraw */ -void scene_update_tagged(Main *bmain, Scene *scene) +void BKE_scene_update_tagged(Main *bmain, Scene *scene) { /* keep this first */ - BLI_exec_cb(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_PRE); + BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_PRE); /* flush recalc flags to dependencies */ DAG_ids_flush_tagged(bmain); @@ -1026,7 +1026,7 @@ void scene_update_tagged(Main *bmain, Scene *scene) /* extra call here to recalc scene animation (for sequencer) */ { AnimData *adt= BKE_animdata_from_id(&scene->id); - float ctime = BKE_curframe(scene); + float ctime = BKE_scene_frame_get(scene); if (adt && (adt->recalc & ADT_RECALC_ANIM)) BKE_animsys_evaluate_animdata(scene, &scene->id, adt, ctime, 0); @@ -1037,7 +1037,7 @@ void scene_update_tagged(Main *bmain, Scene *scene) BKE_ptcache_quick_cache_all(bmain, scene); /* notify editors and python about recalc */ - BLI_exec_cb(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_POST); + BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_SCENE_UPDATE_POST); DAG_ids_check_recalc(bmain, scene, FALSE); /* clear recalc flags */ @@ -1045,14 +1045,14 @@ void scene_update_tagged(Main *bmain, Scene *scene) } /* applies changes right away, does all sets too */ -void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) +void BKE_scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) { - float ctime = BKE_curframe(sce); + float ctime = BKE_scene_frame_get(sce); Scene *sce_iter; /* keep this first */ - BLI_exec_cb(bmain, &sce->id, BLI_CB_EVT_FRAME_CHANGE_PRE); - BLI_exec_cb(bmain, &sce->id, BLI_CB_EVT_SCENE_UPDATE_PRE); + BLI_callback_exec(bmain, &sce->id, BLI_CB_EVT_FRAME_CHANGE_PRE); + BLI_callback_exec(bmain, &sce->id, BLI_CB_EVT_SCENE_UPDATE_PRE); sound_set_cfra(sce->r.cfra); @@ -1066,7 +1066,7 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) /* flush recalc flags to dependencies, if we were only changing a frame * this would not be necessary, but if a user or a script has modified - * some datablock before scene_update_tagged was called, we need the flush */ + * some datablock before BKE_scene_update_tagged was called, we need the flush */ DAG_ids_flush_tagged(bmain); /* Following 2 functions are recursive @@ -1082,12 +1082,12 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) BKE_animsys_evaluate_all_animation(bmain, sce, ctime); /*...done with recusrive funcs */ - /* object_handle_update() on all objects, groups and sets */ + /* BKE_object_handle_update() on all objects, groups and sets */ scene_update_tagged_recursive(bmain, sce, sce); /* notify editors and python about recalc */ - BLI_exec_cb(bmain, &sce->id, BLI_CB_EVT_SCENE_UPDATE_POST); - BLI_exec_cb(bmain, &sce->id, BLI_CB_EVT_FRAME_CHANGE_POST); + BLI_callback_exec(bmain, &sce->id, BLI_CB_EVT_SCENE_UPDATE_POST); + BLI_callback_exec(bmain, &sce->id, BLI_CB_EVT_FRAME_CHANGE_POST); DAG_ids_check_recalc(bmain, sce, TRUE); @@ -1096,7 +1096,7 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) } /* return default layer, also used to patch old files */ -SceneRenderLayer *scene_add_render_layer(Scene *sce, const char *name) +SceneRenderLayer *BKE_scene_add_render_layer(Scene *sce, const char *name) { SceneRenderLayer *srl; @@ -1116,7 +1116,7 @@ SceneRenderLayer *scene_add_render_layer(Scene *sce, const char *name) return srl; } -int scene_remove_render_layer(Main *bmain, Scene *scene, SceneRenderLayer *srl) +int BKE_scene_remove_render_layer(Main *bmain, Scene *scene, SceneRenderLayer *srl) { const int act= BLI_findindex(&scene->r.layers, srl); Scene *sce; @@ -1211,9 +1211,28 @@ Base *_setlooper_base_step(Scene **sce_iter, Base *base) return NULL; } -int scene_use_new_shading_nodes(Scene *scene) +int BKE_scene_use_new_shading_nodes(Scene *scene) { RenderEngineType *type= RE_engines_find(scene->r.engine); return (type && type->flag & RE_USE_SHADING_NODES); } +void BKE_scene_base_flag_to_objects(struct Scene *scene) +{ + Base *base= scene->base.first; + + while (base) { + base->object->flag= base->flag; + base= base->next; + } +} + +void BKE_scene_base_flag_from_objects(struct Scene *scene) +{ + Base *base= scene->base.first; + + while (base) { + base->flag= base->object->flag; + base= base->next; + } +} diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index f69495483ea..8e380c3674f 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -297,7 +297,7 @@ void BKE_screen_area_free(ScrArea *sa) } /* don't free screen itself */ -void free_screen(bScreen *sc) +void BKE_screen_free(bScreen *sc) { ScrArea *sa, *san; ARegion *ar; diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 395214b1609..6e043c74816 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -2099,7 +2099,7 @@ static ImBuf *seq_render_scene_strip( if (seq->scene_camera) camera = seq->scene_camera; else { - scene_camera_switch_update(scene); + BKE_scene_camera_switch_update(scene); camera = scene->camera; } @@ -2127,7 +2127,7 @@ static ImBuf *seq_render_scene_strip( context.scene->r.seq_prev_type = 3 /* ==OB_SOLID */; /* opengl offscreen render */ - scene_update_for_newframe(context.bmain, scene, scene->lay); + BKE_scene_update_for_newframe(context.bmain, scene, scene->lay); ibuf = sequencer_view3d_cb(scene, camera, context.rectx, context.recty, IB_rect, context.scene->r.seq_prev_type, TRUE, err_out); if (ibuf == NULL) { @@ -2182,7 +2182,7 @@ static ImBuf *seq_render_scene_strip( scene->r.cfra = oldcfra; if (frame != oldcfra) - scene_update_for_newframe(context.bmain, scene, scene->lay); + BKE_scene_update_for_newframe(context.bmain, scene, scene->lay); #ifdef DURIAN_CAMERA_SWITCH /* stooping to new low's in hackyness :( */ diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index d6fea87397d..fdda1c6ec0a 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -492,7 +492,7 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM calc.dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT); } else if (calc.ob->type == OB_LATTICE) { - calc.dvert = lattice_get_deform_verts(calc.ob); + calc.dvert = BKE_lattice_deform_verts_get(calc.ob); } diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 28ce95ea8d1..da73491eaa3 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -89,21 +89,21 @@ struct bSound* sound_new_file(struct Main *bmain, const char *filename) while (len > 0 && filename[len-1] != '/' && filename[len-1] != '\\') len--; - sound = alloc_libblock(&bmain->sound, ID_SO, filename+len); + sound = BKE_libblock_alloc(&bmain->sound, ID_SO, filename+len); BLI_strncpy(sound->name, filename, FILE_MAX); // XXX unused currently sound->type = SOUND_TYPE_FILE; sound_load(bmain, sound); if (!sound->playback_handle) { - free_libblock(&bmain->sound, sound); + BKE_libblock_free(&bmain->sound, sound); sound = NULL; } return sound; } -void sound_free(struct bSound* sound) +void BKE_sound_free(struct bSound* sound) { if (sound->packedfile) { freePackedFile(sound->packedfile); @@ -231,7 +231,7 @@ struct bSound* sound_new_buffer(struct Main *bmain, struct bSound *source) strcpy(name, "buf_"); strcpy(name + 4, source->id.name); - sound = alloc_libblock(&bmain->sound, ID_SO, name); + sound = BKE_libblock_alloc(&bmain->sound, ID_SO, name); sound->child_sound = source; sound->type = SOUND_TYPE_BUFFER; @@ -240,7 +240,7 @@ struct bSound* sound_new_buffer(struct Main *bmain, struct bSound *source) if (!sound->playback_handle) { - free_libblock(&bmain->sound, sound); + BKE_libblock_free(&bmain->sound, sound); sound = NULL; } @@ -255,7 +255,7 @@ struct bSound* sound_new_limiter(struct Main *bmain, struct bSound *source, floa strcpy(name, "lim_"); strcpy(name + 4, source->id.name); - sound = alloc_libblock(&bmain->sound, ID_SO, name); + sound = BKE_libblock_alloc(&bmain->sound, ID_SO, name); sound->child_sound = source; sound->start = start; @@ -266,7 +266,7 @@ struct bSound* sound_new_limiter(struct Main *bmain, struct bSound *source, floa if (!sound->playback_handle) { - free_libblock(&bmain->sound, sound); + BKE_libblock_free(&bmain->sound, sound); sound = NULL; } @@ -277,9 +277,9 @@ struct bSound* sound_new_limiter(struct Main *bmain, struct bSound *source, floa void sound_delete(struct Main *bmain, struct bSound* sound) { if (sound) { - sound_free(sound); + BKE_sound_free(sound); - free_libblock(&bmain->sound, sound); + BKE_libblock_free(&bmain->sound, sound); } } diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c index 5466630f621..e94a11b8f89 100644 --- a/source/blender/blenkernel/intern/speaker.c +++ b/source/blender/blenkernel/intern/speaker.c @@ -43,11 +43,11 @@ #include "BKE_main.h" #include "BKE_speaker.h" -void *add_speaker(const char *name) +void *BKE_speaker_add(const char *name) { Speaker *spk; - spk= alloc_libblock(&G.main->speaker, ID_SPK, name); + spk= BKE_libblock_alloc(&G.main->speaker, ID_SPK, name); spk->attenuation = 1.0f; spk->cone_angle_inner = 360.0f; @@ -65,18 +65,18 @@ void *add_speaker(const char *name) return spk; } -Speaker *copy_speaker(Speaker *spk) +Speaker *BKE_speaker_copy(Speaker *spk) { Speaker *spkn; - spkn= copy_libblock(&spk->id); + spkn= BKE_libblock_copy(&spk->id); if (spkn->sound) spkn->sound->id.us++; return spkn; } -void make_local_speaker(Speaker *spk) +void BKE_speaker_make_local(Speaker *spk) { Main *bmain= G.main; Object *ob; @@ -106,7 +106,7 @@ void make_local_speaker(Speaker *spk) id_clear_lib_data(bmain, &spk->id); } else if (is_local && is_lib) { - Speaker *spk_new= copy_speaker(spk); + Speaker *spk_new= BKE_speaker_copy(spk); spk_new->id.us= 0; /* Remap paths of new ID using old library as base. */ @@ -127,7 +127,7 @@ void make_local_speaker(Speaker *spk) } } -void free_speaker(Speaker *spk) +void BKE_speaker_free(Speaker *spk) { if (spk->sound) spk->sound->id.us--; diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 85ecc7c204d..b4b4e0f623c 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -160,7 +160,7 @@ static void init_undo_text(Text *text) text->undo_buf= MEM_mallocN(text->undo_len, "undo buf"); } -void free_text(Text *text) +void BKE_text_free(Text *text) { TextLine *tmp; @@ -180,13 +180,13 @@ void free_text(Text *text) #endif } -Text *add_empty_text(const char *name) +Text *BKE_text_add(const char *name) { Main *bmain= G.main; Text *ta; TextLine *tmp; - ta= alloc_libblock(&bmain->text, ID_TXT, name); + ta= BKE_libblock_alloc(&bmain->text, ID_TXT, name); ta->id.us= 1; ta->name= NULL; @@ -278,7 +278,7 @@ static void cleanup_textline(TextLine * tl) tl->len+= txt_extended_ascii_as_utf8(&tl->line); } -int reopen_text(Text *text) +int BKE_text_reload(Text *text) { FILE *fp; int i, llen, len; @@ -373,7 +373,7 @@ int reopen_text(Text *text) return 1; } -Text *add_text(const char *file, const char *relpath) +Text *BKE_text_load(const char *file, const char *relpath) { Main *bmain= G.main; FILE *fp; @@ -391,7 +391,7 @@ Text *add_text(const char *file, const char *relpath) fp= BLI_fopen(str, "r"); if (fp==NULL) return NULL; - ta= alloc_libblock(&bmain->text, ID_TXT, BLI_path_basename(str)); + ta= BKE_libblock_alloc(&bmain->text, ID_TXT, BLI_path_basename(str)); ta->id.us= 1; ta->lines.first= ta->lines.last= NULL; @@ -473,12 +473,12 @@ Text *add_text(const char *file, const char *relpath) return ta; } -Text *copy_text(Text *ta) +Text *BKE_text_copy(Text *ta) { Text *tan; TextLine *line, *tmp; - tan= copy_libblock(&ta->id); + tan= BKE_libblock_copy(&ta->id); /* file name can be NULL */ if (ta->name) { @@ -521,7 +521,7 @@ Text *copy_text(Text *ta) return tan; } -void unlink_text(Main *bmain, Text *text) +void BKE_text_unlink(Main *bmain, Text *text) { bScreen *scr; ScrArea *area; @@ -593,7 +593,7 @@ void unlink_text(Main *bmain, Text *text) text->id.us= 0; } -void clear_text(Text *text) /* called directly from rna */ +void BKE_text_clear(Text *text) /* called directly from rna */ { int oldstate; @@ -606,7 +606,7 @@ void clear_text(Text *text) /* called directly from rna */ txt_make_dirty(text); } -void write_text(Text *text, const char *str) /* called directly from rna */ +void BKE_text_write(Text *text, const char *str) /* called directly from rna */ { int oldstate; diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 9200b1dca18..9b3689df941 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -547,7 +547,7 @@ int colorband_element_remove(struct ColorBand *coba, int index) /* ******************* TEX ************************ */ -void free_texture(Tex *tex) +void BKE_texture_free(Tex *tex) { free_plugin_tex(tex->plugin); @@ -693,7 +693,7 @@ Tex *add_texture(const char *name) Main *bmain= G.main; Tex *tex; - tex= alloc_libblock(&bmain->tex, ID_TE, name); + tex= BKE_libblock_alloc(&bmain->tex, ID_TE, name); default_tex(tex); @@ -824,11 +824,11 @@ MTex *add_mtex_id(ID *id, int slot) /* ------------------------------------------------------------------------- */ -Tex *copy_texture(Tex *tex) +Tex *BKE_texture_copy(Tex *tex) { Tex *texn; - texn= copy_libblock(&tex->id); + texn= BKE_libblock_copy(&tex->id); if (texn->type==TEX_IMAGE) id_us_plus((ID *)texn->ima); else texn->ima= NULL; @@ -859,10 +859,10 @@ Tex *localize_texture(Tex *tex) { Tex *texn; - texn= copy_libblock(&tex->id); + texn= BKE_libblock_copy(&tex->id); BLI_remlink(&G.main->tex, texn); - /* image texture: free_texture also doesn't decrease */ + /* image texture: BKE_texture_free also doesn't decrease */ if (texn->plugin) { texn->plugin= MEM_dupallocN(texn->plugin); @@ -901,7 +901,7 @@ static void extern_local_texture(Tex *tex) id_lib_extern((ID *)tex->ima); } -void make_local_texture(Tex *tex) +void BKE_texture_make_local(Tex *tex) { Main *bmain= G.main; Material *ma; @@ -978,7 +978,7 @@ void make_local_texture(Tex *tex) extern_local_texture(tex); } else if (is_local && is_lib) { - Tex *tex_new= copy_texture(tex); + Tex *tex_new= BKE_texture_copy(tex); tex_new->id.us= 0; diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 316cb4b6159..760743aafeb 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -2108,11 +2108,11 @@ void BKE_get_tracking_mat(Scene *scene, Object *ob, float mat[4][4]) if (scene->camera) ob = scene->camera; else - ob = scene_find_camera(scene); + ob = BKE_scene_camera_find(scene); } if (ob) - where_is_object_mat(scene, ob, mat); + BKE_object_where_is_calc_mat4(scene, ob, mat); else unit_m4(mat); } diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index 07a83da3d8c..f50a655236f 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -51,7 +51,7 @@ #include "BKE_node.h" #include "BKE_world.h" -void free_world(World *wrld) +void BKE_world_free(World *wrld) { MTex *mtex; int a; @@ -81,7 +81,7 @@ World *add_world(const char *name) Main *bmain= G.main; World *wrld; - wrld= alloc_libblock(&bmain->world, ID_WO, name); + wrld= BKE_libblock_alloc(&bmain->world, ID_WO, name); wrld->horr= 0.05f; wrld->horg= 0.05f; @@ -113,16 +113,16 @@ World *add_world(const char *name) return wrld; } -World *copy_world(World *wrld) +World *BKE_world_copy(World *wrld) { World *wrldn; int a; - wrldn= copy_libblock(&wrld->id); + wrldn= BKE_libblock_copy(&wrld->id); for (a=0; a<MAX_MTEX; a++) { if (wrld->mtex[a]) { - wrldn->mtex[a]= MEM_mallocN(sizeof(MTex), "copy_world"); + wrldn->mtex[a]= MEM_mallocN(sizeof(MTex), "BKE_world_copy"); memcpy(wrldn->mtex[a], wrld->mtex[a], sizeof(MTex)); id_us_plus((ID *)wrldn->mtex[a]->tex); } @@ -142,7 +142,7 @@ World *localize_world(World *wrld) World *wrldn; int a; - wrldn= copy_libblock(&wrld->id); + wrldn= BKE_libblock_copy(&wrld->id); BLI_remlink(&G.main->world, wrldn); for (a=0; a<MAX_MTEX; a++) { @@ -162,7 +162,7 @@ World *localize_world(World *wrld) return wrldn; } -void make_local_world(World *wrld) +void BKE_world_make_local(World *wrld) { Main *bmain= G.main; Scene *sce; @@ -190,7 +190,7 @@ void make_local_world(World *wrld) id_clear_lib_data(bmain, &wrld->id); } else if (is_local && is_lib) { - World *wrld_new= copy_world(wrld); + World *wrld_new= BKE_world_copy(wrld); wrld_new->id.us= 0; /* Remap paths of new ID using old library as base. */ diff --git a/source/blender/blenlib/BLI_bitmap.h b/source/blender/blenlib/BLI_bitmap.h index 2aed71a7d44..f19d6d6f465 100644 --- a/source/blender/blenlib/BLI_bitmap.h +++ b/source/blender/blenlib/BLI_bitmap.h @@ -69,7 +69,7 @@ typedef unsigned int* BLI_bitmap; /* set or clear the value of a single bit at '_index' */ #define BLI_BITMAP_MODIFY(_bitmap, _index, _set) \ do { \ - if(_set) \ + if (_set) \ BLI_BITMAP_SET(_bitmap, _index); \ else \ BLI_BITMAP_CLEAR(_bitmap, _index); \ diff --git a/source/blender/blenlib/BLI_boxpack2d.h b/source/blender/blenlib/BLI_boxpack2d.h index 7f92047b312..77e937d7b6f 100644 --- a/source/blender/blenlib/BLI_boxpack2d.h +++ b/source/blender/blenlib/BLI_boxpack2d.h @@ -34,7 +34,7 @@ /* Box Packer */ -typedef struct boxPack { +typedef struct BoxPack { float x; float y; float w; @@ -44,9 +44,9 @@ typedef struct boxPack { /* Verts this box uses * (BL,TR,TL,BR) / 0,1,2,3 */ struct boxVert *v[4]; -} boxPack; +} BoxPack; -void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_height); +void BLI_box_pack_2D(BoxPack *boxarray, const int len, float *tot_width, float *tot_height); #endif diff --git a/source/blender/blenlib/BLI_bpath.h b/source/blender/blenlib/BLI_bpath.h index 91252d3beb5..27b373e6eb8 100644 --- a/source/blender/blenlib/BLI_bpath.h +++ b/source/blender/blenlib/BLI_bpath.h @@ -43,25 +43,25 @@ struct ReportList; * path has changed, and in that case, should write the result to pathOut. */ typedef int (*BPathVisitor)(void *userdata, char *path_dst, const char *path_src); /* Executes 'visit' for each path associated with 'id'. */ -void bpath_traverse_id(struct Main *bmain, struct ID *id, BPathVisitor visit_cb, const int flag, void *userdata); -void bpath_traverse_id_list(struct Main *bmain, struct ListBase *lb, BPathVisitor visit_cb, const int flag, void *userdata); -void bpath_traverse_main(struct Main *bmain, BPathVisitor visit_cb, const int flag, void *userdata); -int bpath_relocate_visitor(void *oldbasepath, char *path_dst, const char *path_src); +void BLI_bpath_traverse_id(struct Main *bmain, struct ID *id, BPathVisitor visit_cb, const int flag, void *userdata); +void BLI_bpath_traverse_id_list(struct Main *bmain, struct ListBase *lb, BPathVisitor visit_cb, const int flag, void *userdata); +void BLI_bpath_traverse_main(struct Main *bmain, BPathVisitor visit_cb, const int flag, void *userdata); +int BLI_bpath_relocate_visitor(void *oldbasepath, char *path_dst, const char *path_src); -#define BPATH_TRAVERSE_ABS (1<<0) /* convert paths to absolute */ -#define BPATH_TRAVERSE_SKIP_LIBRARY (1<<2) /* skip library paths */ -#define BPATH_TRAVERSE_SKIP_PACKED (1<<3) /* skip packed data */ -#define BPATH_TRAVERSE_SKIP_MULTIFILE (1<<4) /* skip paths where a single dir is used with an array of files, eg. - * sequence strip images and pointcache. in this case only use the first - * file, this is needed for directory manipulation functions which might - * otherwise modify the same directory multiple times */ +#define BLI_BPATH_TRAVERSE_ABS (1<<0) /* convert paths to absolute */ +#define BLI_BPATH_TRAVERSE_SKIP_LIBRARY (1<<2) /* skip library paths */ +#define BLI_BPATH_TRAVERSE_SKIP_PACKED (1<<3) /* skip packed data */ +#define BLI_BPATH_TRAVERSE_SKIP_MULTIFILE (1<<4) /* skip paths where a single dir is used with an array of files, eg. + * sequence strip images and pointcache. in this case only use the first + * file, this is needed for directory manipulation functions which might + * otherwise modify the same directory multiple times */ /* high level funcs */ /* creates a text file with missing files if there are any */ -void checkMissingFiles(struct Main *bmain, struct ReportList *reports); -void makeFilesRelative(struct Main *bmain, const char *basedir, struct ReportList *reports); -void makeFilesAbsolute(struct Main *bmain, const char *basedir, struct ReportList *reports); -void findMissingFiles(struct Main *bmain, const char *searchpath, struct ReportList *reports); +void BLI_bpath_missing_files_check(struct Main *bmain, struct ReportList *reports); +void BLI_bpath_missing_files_find(struct Main *bmain, const char *searchpath, struct ReportList *reports); +void BLI_bpath_relative_convert(struct Main *bmain, const char *basedir, struct ReportList *reports); +void BLI_bpath_absolute_convert(struct Main *bmain, const char *basedir, struct ReportList *reports); #endif // __BLI_BPATH_H__ diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenlib/BLI_callbacks.h index b32a1e272c8..bfc336781aa 100644 --- a/source/blender/blenlib/BLI_callbacks.h +++ b/source/blender/blenlib/BLI_callbacks.h @@ -62,11 +62,11 @@ typedef struct { } bCallbackFuncStore; -void BLI_exec_cb(struct Main *main, struct ID *self, eCbEvent evt); -void BLI_add_cb(bCallbackFuncStore *funcstore, eCbEvent evt); +void BLI_callback_exec(struct Main *main, struct ID *self, eCbEvent evt); +void BLI_callback_add(bCallbackFuncStore *funcstore, eCbEvent evt); -void BLI_cb_init(void); -void BLI_cb_finalize(void); +void BLI_callback_global_init(void); +void BLI_callback_global_finalize(void); /* This is blenlib internal only, unrelated to above */ diff --git a/source/blender/blenlib/BLI_jitter.h b/source/blender/blenlib/BLI_jitter.h index 9aa21a89521..c2a6250c154 100644 --- a/source/blender/blenlib/BLI_jitter.h +++ b/source/blender/blenlib/BLI_jitter.h @@ -32,7 +32,7 @@ * \ingroup bli */ -void BLI_initjit(float *jitarr, int num); +void BLI_jitter_init(float *jitarr, int num); void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1); void BLI_jitterate2(float *jit1, float *jit2, int num, float rad2); diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h index 26bcd50ef3e..081d5ccfb66 100644 --- a/source/blender/blenlib/BLI_scanfill.h +++ b/source/blender/blenlib/BLI_scanfill.h @@ -91,14 +91,14 @@ typedef struct ScanFillFace } ScanFillFace; /* scanfill.c: used in displist only... */ -struct ScanFillVert *BLI_addfillvert(ScanFillContext *sf_ctx, const float vec[3]); -struct ScanFillEdge *BLI_addfilledge(ScanFillContext *sf_ctx, struct ScanFillVert *v1, struct ScanFillVert *v2); +struct ScanFillVert *BLI_scanfill_vert_add(ScanFillContext *sf_ctx, const float vec[3]); +struct ScanFillEdge *BLI_scanfill_edge_add(ScanFillContext *sf_ctx, struct ScanFillVert *v1, struct ScanFillVert *v2); -int BLI_begin_edgefill(ScanFillContext *sf_ctx); -int BLI_edgefill(ScanFillContext *sf_ctx, const short do_quad_tri_speedup); -int BLI_edgefill_ex(ScanFillContext *sf_ctx, const short do_quad_tri_speedup, +int BLI_scanfill_begin(ScanFillContext *sf_ctx); +int BLI_scanfill_calc(ScanFillContext *sf_ctx, const short do_quad_tri_speedup); +int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const short do_quad_tri_speedup, const float nor_proj[3]); -void BLI_end_edgefill(ScanFillContext *sf_ctx); +void BLI_scanfill_end(ScanFillContext *sf_ctx); /* These callbacks are needed to make the lib finction properly */ diff --git a/source/blender/blenlib/BLI_uvproject.h b/source/blender/blenlib/BLI_uvproject.h index 5abad87452c..516a9b8b237 100644 --- a/source/blender/blenlib/BLI_uvproject.h +++ b/source/blender/blenlib/BLI_uvproject.h @@ -24,22 +24,22 @@ * \ingroup bli */ -struct UvCameraInfo; +struct ProjCameraInfo; struct Object; /* create uv info from the camera, needs to be freed */ -struct UvCameraInfo *project_camera_info(struct Object *ob, float rotmat[4][4], float winx, float winy); +struct ProjCameraInfo *BLI_uvproject_camera_info(struct Object *ob, float rotmat[4][4], float winx, float winy); /* apply uv from uvinfo (camera) */ -void project_from_camera(float target[2], float source[3], struct UvCameraInfo *uci); +void BLI_uvproject_from_camera(float target[2], float source[3], struct ProjCameraInfo *uci); /* apply uv from perspective matrix */ -void project_from_view(float target[2], float source[3], float persmat[4][4], float rotmat[4][4], float winx, float winy); +void BLI_uvproject_from_view(float target[2], float source[3], float persmat[4][4], float rotmat[4][4], float winx, float winy); /* apply ortho uv's */ -void project_from_view_ortho(float target[2], float source[3], float rotmat[4][4]); +void BLI_uvproject_from_view_ortho(float target[2], float source[3], float rotmat[4][4]); /* so we can adjust scale with keeping the struct private */ -void project_camera_info_scale(struct UvCameraInfo *uci, float scale_x, float scale_y); +void BLI_uvproject_camera_info_scale(struct ProjCameraInfo *uci, float scale_x, float scale_y); #endif diff --git a/source/blender/blenlib/BLI_voxel.h b/source/blender/blenlib/BLI_voxel.h index 4a13810a705..7b92ac05d29 100644 --- a/source/blender/blenlib/BLI_voxel.h +++ b/source/blender/blenlib/BLI_voxel.h @@ -33,12 +33,12 @@ */ /** find the index number of a voxel, given x/y/z integer coords and resolution vector */ -#define V_I(x, y, z, res) ( (z)*(res)[1]*(res)[0] + (y)*(res)[0] + (x) ) +#define BLI_VOXEL_INDEX(x, y, z, res) ((z) * (res)[1] * (res)[0] + (y) * (res)[0] + (x)) /* all input coordinates must be in bounding box 0.0 - 1.0 */ -float voxel_sample_nearest(float *data, const int res[3], const float co[3]); -float voxel_sample_trilinear(float *data, const int res[3], const float co[3]); -float voxel_sample_triquadratic(float *data, const int res[3], const float co[3]); -float voxel_sample_tricubic(float *data, const int res[3], const float co[3], int bspline); +float BLI_voxel_sample_nearest(float *data, const int res[3], const float co[3]); +float BLI_voxel_sample_trilinear(float *data, const int res[3], const float co[3]); +float BLI_voxel_sample_triquadratic(float *data, const int res[3], const float co[3]); +float BLI_voxel_sample_tricubic(float *data, const int res[3], const float co[3], int bspline); #endif /* __BLI_VOXEL_H__ */ diff --git a/source/blender/blenlib/intern/boxpack2d.c b/source/blender/blenlib/intern/boxpack2d.c index 6631e36fc72..f1931d35819 100644 --- a/source/blender/blenlib/intern/boxpack2d.c +++ b/source/blender/blenlib/intern/boxpack2d.c @@ -38,14 +38,14 @@ typedef struct boxVert { float y; short free; - struct boxPack *trb; /* top right box */ - struct boxPack *blb; /* bottom left box */ - struct boxPack *brb; /* bottom right box */ - struct boxPack *tlb; /* top left box */ + struct BoxPack *trb; /* top right box */ + struct BoxPack *blb; /* bottom left box */ + struct BoxPack *brb; /* bottom right box */ + struct BoxPack *tlb; /* top left box */ /* Store last intersecting boxes here * speedup intersection testing */ - struct boxPack *isect_cache[4]; + struct BoxPack *isect_cache[4]; int index; } boxVert; @@ -105,7 +105,7 @@ typedef struct boxVert { /* qsort function - sort largest to smallest */ static int box_areasort(const void *p1, const void *p2) { - const boxPack *b1 = p1, *b2 = p2; + const BoxPack *b1 = p1, *b2 = p2; const float a1 = BOXAREA(b1); const float a2 = BOXAREA(b2); @@ -152,12 +152,12 @@ static int vertex_sort(const void *p1, const void *p2) * len - the number of boxes in the array. * tot_width and tot_height are set so you can normalize the data. * */ -void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_height) +void BLI_box_pack_2D(BoxPack *boxarray, const int len, float *tot_width, float *tot_height) { boxVert *vert; /* the current vert */ int box_index, verts_pack_len, i, j, k, isect; int quad_flags[4] = {BLF, TRF, TLF, BRF}; /* use for looping */ - boxPack *box, *box_test; /*current box and another for intersection tests*/ + BoxPack *box, *box_test; /*current box and another for intersection tests*/ int *vertex_pack_indices; /*an array of indices used for sorting verts*/ if (!len) { @@ -167,11 +167,11 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he } /* Sort boxes, biggest first */ - qsort(boxarray, len, sizeof(boxPack), box_areasort); + qsort(boxarray, len, sizeof(BoxPack), box_areasort); /* add verts to the boxes, these are only used internally */ - vert = vertarray = MEM_mallocN(len * 4 * sizeof(boxVert), "boxPack Verts"); - vertex_pack_indices = MEM_mallocN(len * 3 * sizeof(int), "boxPack Indices"); + vert = vertarray = MEM_mallocN(len * 4 * sizeof(boxVert), "BoxPack Verts"); + vertex_pack_indices = MEM_mallocN(len * 3 * sizeof(int), "BoxPack Indices"); for (box = boxarray, box_index = 0, i = 0; box_index < len; box_index++, box++) { diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 739c4e00cc7..48912eb927a 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -92,9 +92,9 @@ static int checkMissingFiles_visit_cb(void *userdata, char *UNUSED(path_dst), co } /* high level function */ -void checkMissingFiles(Main *bmain, ReportList *reports) +void BLI_bpath_missing_files_check(Main *bmain, ReportList *reports) { - bpath_traverse_main(bmain, checkMissingFiles_visit_cb, BPATH_TRAVERSE_ABS, reports); + BLI_bpath_traverse_main(bmain, checkMissingFiles_visit_cb, BLI_BPATH_TRAVERSE_ABS, reports); } typedef struct BPathRemap_Data { @@ -129,7 +129,7 @@ static int makeFilesRelative_visit_cb(void *userdata, char *path_dst, const char } } -void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports) +void BLI_bpath_relative_convert(Main *bmain, const char *basedir, ReportList *reports) { BPathRemap_Data data = {NULL}; @@ -141,7 +141,7 @@ void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports) data.basedir = basedir; data.reports = reports; - bpath_traverse_main(bmain, makeFilesRelative_visit_cb, 0, (void *)&data); + BLI_bpath_traverse_main(bmain, makeFilesRelative_visit_cb, 0, (void *)&data); BKE_reportf(reports, data.count_failed ? RPT_WARNING : RPT_INFO, "Total files %d|Changed %d|Failed %d", @@ -171,8 +171,8 @@ static int makeFilesAbsolute_visit_cb(void *userdata, char *path_dst, const char } } -/* similar to makeFilesRelative - keep in sync! */ -void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports) +/* similar to BLI_bpath_relative_convert - keep in sync! */ +void BLI_bpath_absolute_convert(Main *bmain, const char *basedir, ReportList *reports) { BPathRemap_Data data = {NULL}; @@ -184,7 +184,7 @@ void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports) data.basedir = basedir; data.reports = reports; - bpath_traverse_main(bmain, makeFilesAbsolute_visit_cb, 0, (void *)&data); + BLI_bpath_traverse_main(bmain, makeFilesAbsolute_visit_cb, 0, (void *)&data); BKE_reportf(reports, data.count_failed ? RPT_WARNING : RPT_INFO, "Total files %d|Changed %d|Failed %d", @@ -293,14 +293,14 @@ static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char } } -void findMissingFiles(Main *bmain, const char *searchpath, ReportList *reports) +void BLI_bpath_missing_files_find(Main *bmain, const char *searchpath, ReportList *reports) { struct BPathFind_Data data = {NULL}; data.reports = reports; BLI_split_dir_part(searchpath, data.searchdir, sizeof(data.searchdir)); - bpath_traverse_main(bmain, findMissingFiles_visit_cb, 0, (void *)&data); + BLI_bpath_traverse_main(bmain, findMissingFiles_visit_cb, 0, (void *)&data); } /* Run a visitor on a string, replacing the contents of the string as needed. */ @@ -378,19 +378,19 @@ static int rewrite_path_alloc(char **path, BPathVisitor visit_cb, const char *ab } /* Run visitor function 'visit' on all paths contained in 'id'. */ -void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int flag, void *bpath_user_data) +void BLI_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int flag, void *bpath_user_data) { Image *ima; - const char *absbase = (flag & BPATH_TRAVERSE_ABS) ? ID_BLEND_PATH(bmain, id) : NULL; + const char *absbase = (flag & BLI_BPATH_TRAVERSE_ABS) ? ID_BLEND_PATH(bmain, id) : NULL; - if ((flag & BPATH_TRAVERSE_SKIP_LIBRARY) && id->lib) { + if ((flag & BLI_BPATH_TRAVERSE_SKIP_LIBRARY) && id->lib) { return; } switch (GS(id->name)) { case ID_IM: ima= (Image *)id; - if (ima->packedfile == NULL || (flag & BPATH_TRAVERSE_SKIP_PACKED) == 0) { + if (ima->packedfile == NULL || (flag & BLI_BPATH_TRAVERSE_SKIP_PACKED) == 0) { if (ELEM3(ima->source, IMA_SRC_FILE, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) { rewrite_path_fixed(ima->name, visit_cb, absbase, bpath_user_data); } @@ -470,7 +470,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla case ID_SO: { bSound *sound= (bSound *)id; - if (sound->packedfile == NULL || (flag & BPATH_TRAVERSE_SKIP_PACKED) == 0) { + if (sound->packedfile == NULL || (flag & BLI_BPATH_TRAVERSE_SKIP_PACKED) == 0) { rewrite_path_fixed(sound->name, visit_cb, absbase, bpath_user_data); } } @@ -483,7 +483,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla case ID_VF: { VFont *vf= (VFont *)id; - if (vf->packedfile == NULL || (flag & BPATH_TRAVERSE_SKIP_PACKED) == 0) { + if (vf->packedfile == NULL || (flag & BLI_BPATH_TRAVERSE_SKIP_PACKED) == 0) { if (strcmp(vf->name, FO_BUILTIN_NAME) != 0) { rewrite_path_fixed(((VFont *)id)->name, visit_cb, absbase, bpath_user_data); } @@ -523,7 +523,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla int len= MEM_allocN_len(se) / sizeof(*se); int i; - if (flag & BPATH_TRAVERSE_SKIP_MULTIFILE) { + if (flag & BLI_BPATH_TRAVERSE_SKIP_MULTIFILE) { /* only operate on one path */ len= MIN2(1, len); } @@ -575,26 +575,26 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla } } -void bpath_traverse_id_list(Main *bmain, ListBase *lb, BPathVisitor visit_cb, const int flag, void *bpath_user_data) +void BLI_bpath_traverse_id_list(Main *bmain, ListBase *lb, BPathVisitor visit_cb, const int flag, void *bpath_user_data) { ID *id; for (id = lb->first; id; id = id->next) { - bpath_traverse_id(bmain, id, visit_cb, flag, bpath_user_data); + BLI_bpath_traverse_id(bmain, id, visit_cb, flag, bpath_user_data); } } -void bpath_traverse_main(Main *bmain, BPathVisitor visit_cb, const int flag, void *bpath_user_data) +void BLI_bpath_traverse_main(Main *bmain, BPathVisitor visit_cb, const int flag, void *bpath_user_data) { ListBase *lbarray[MAX_LIBARRAY]; int a = set_listbasepointers(bmain, lbarray); while (a--) { - bpath_traverse_id_list(bmain, lbarray[a], visit_cb, flag, bpath_user_data); + BLI_bpath_traverse_id_list(bmain, lbarray[a], visit_cb, flag, bpath_user_data); } } /* Rewrites a relative path to be relative to the main file - unless the path is * absolute, in which case it is not altered. */ -int bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *path_src) +int BLI_bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *path_src) { /* be sure there is low chance of the path being too short */ char filepath[(FILE_MAXDIR * 2) + FILE_MAXFILE]; diff --git a/source/blender/blenlib/intern/callbacks.c b/source/blender/blenlib/intern/callbacks.c index 0cb986d9090..876599f7480 100644 --- a/source/blender/blenlib/intern/callbacks.c +++ b/source/blender/blenlib/intern/callbacks.c @@ -28,7 +28,7 @@ static ListBase callback_slots[BLI_CB_EVT_TOT]= {{NULL}}; -void BLI_exec_cb(struct Main *main, struct ID *self, eCbEvent evt) +void BLI_callback_exec(struct Main *main, struct ID *self, eCbEvent evt) { ListBase *lb= &callback_slots[evt]; bCallbackFuncStore *funcstore; @@ -38,19 +38,19 @@ void BLI_exec_cb(struct Main *main, struct ID *self, eCbEvent evt) } } -void BLI_add_cb(bCallbackFuncStore *funcstore, eCbEvent evt) +void BLI_callback_add(bCallbackFuncStore *funcstore, eCbEvent evt) { ListBase *lb= &callback_slots[evt]; BLI_addtail(lb, funcstore); } -void BLI_cb_init(void) +void BLI_callback_global_init(void) { /* do nothing */ } /* call on application exit */ -void BLI_cb_finalize(void) +void BLI_callback_global_finalize(void) { eCbEvent evt; for (evt= 0; evt < BLI_CB_EVT_TOT; evt++) { diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index c9f7b7c7e64..d85765d8f56 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -297,7 +297,7 @@ static int objchr_to_ftvfontdata(VFont *vfont, FT_ULong charcode) struct TmpFont *tf; // Find the correct FreeType font - tf= vfont_find_tmpfont(vfont); + tf= BKE_vfont_find_tmpfont(vfont); // What, no font found. Something strange here if (!tf) return FALSE; diff --git a/source/blender/blenlib/intern/jitter.c b/source/blender/blenlib/intern/jitter.c index c7977378f6a..afe31fb1377 100644 --- a/source/blender/blenlib/intern/jitter.c +++ b/source/blender/blenlib/intern/jitter.c @@ -136,7 +136,7 @@ void BLI_jitterate2(float *jit1, float *jit2, int num, float rad2) } -void BLI_initjit(float *jitarr, int num) +void BLI_jitter_init(float *jitarr, int num) { float *jit2, x, rad1, rad2, rad3; int i; diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 25850e14ae7..503de31616a 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -99,7 +99,7 @@ typedef struct ScanFillVertLink { #define SF_VERT_ZERO_LEN 255 /* Optionally set ScanFillEdge f to this to mark original boundary edges. - * Only needed if there are internal diagonal edges passed to BLI_edgefill. */ + * Only needed if there are internal diagonal edges passed to BLI_scanfill_calc. */ #define SF_EDGE_BOUNDARY 1 #define SF_EDGE_UNKNOWN 2 /* TODO, what is this for exactly? - need to document it! */ @@ -191,7 +191,7 @@ static void mem_element_reset(ScanFillContext *sf_ctx, int keep_first) sf_ctx->melem__offs = 0; } -void BLI_end_edgefill(ScanFillContext *sf_ctx) +void BLI_scanfill_end(ScanFillContext *sf_ctx) { mem_element_reset(sf_ctx, FALSE); @@ -202,7 +202,7 @@ void BLI_end_edgefill(ScanFillContext *sf_ctx) /* **** FILL ROUTINES *************************** */ -ScanFillVert *BLI_addfillvert(ScanFillContext *sf_ctx, const float vec[3]) +ScanFillVert *BLI_scanfill_vert_add(ScanFillContext *sf_ctx, const float vec[3]) { ScanFillVert *eve; @@ -214,7 +214,7 @@ ScanFillVert *BLI_addfillvert(ScanFillContext *sf_ctx, const float vec[3]) return eve; } -ScanFillEdge *BLI_addfilledge(ScanFillContext *sf_ctx, ScanFillVert *v1, ScanFillVert *v2) +ScanFillEdge *BLI_scanfill_edge_add(ScanFillContext *sf_ctx, ScanFillVert *v1, ScanFillVert *v2) { ScanFillEdge *newed; @@ -453,7 +453,7 @@ static void testvertexnearedge(ScanFillContext *sf_ctx) const float dist = dist_to_line_v2(eed->v1->xy, eed->v2->xy, eve->xy); if (dist < SF_EPSILON) { /* new edge */ - ed1 = BLI_addfilledge(sf_ctx, eed->v1, eve); + ed1 = BLI_scanfill_edge_add(sf_ctx, eed->v1, eve); /* printf("fill: vertex near edge %x\n",eve); */ ed1->f = 0; @@ -681,7 +681,7 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf) /* make new edge, and start over */ /* printf("add new edge %x %x and start again\n",v2,sc1->v1); */ - ed3 = BLI_addfilledge(sf_ctx, v2, sc1->v1); + ed3 = BLI_scanfill_edge_add(sf_ctx, v2, sc1->v1); BLI_remlink(&sf_ctx->filledgebase, ed3); BLI_insertlinkbefore((ListBase *)&(sc->first), ed2, ed3); ed3->v2->f = SF_VERT_UNKNOWN; @@ -709,7 +709,7 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf) } /* new edge */ - ed3 = BLI_addfilledge(sf_ctx, v1, v3); + ed3 = BLI_scanfill_edge_add(sf_ctx, v1, v3); BLI_remlink(&sf_ctx->filledgebase, ed3); ed3->f = SF_EDGE_UNKNOWN; ed3->v1->h++; @@ -764,19 +764,19 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf) } -int BLI_begin_edgefill(ScanFillContext *sf_ctx) +int BLI_scanfill_begin(ScanFillContext *sf_ctx) { memset(sf_ctx, 0, sizeof(*sf_ctx)); return 1; } -int BLI_edgefill(ScanFillContext *sf_ctx, const short do_quad_tri_speedup) +int BLI_scanfill_calc(ScanFillContext *sf_ctx, const short do_quad_tri_speedup) { - return BLI_edgefill_ex(sf_ctx, do_quad_tri_speedup, NULL); + return BLI_scanfill_calc_ex(sf_ctx, do_quad_tri_speedup, NULL); } -int BLI_edgefill_ex(ScanFillContext *sf_ctx, const short do_quad_tri_speedup, const float nor_proj[3]) +int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const short do_quad_tri_speedup, const float nor_proj[3]) { /* * - fill works with its own lists, so create that first (no faces!) diff --git a/source/blender/blenlib/intern/uvproject.c b/source/blender/blenlib/intern/uvproject.c index 89621cdf48d..31229c76869 100644 --- a/source/blender/blenlib/intern/uvproject.c +++ b/source/blender/blenlib/intern/uvproject.c @@ -32,7 +32,7 @@ #include "BLI_math.h" #include "BLI_uvproject.h" -typedef struct UvCameraInfo { +typedef struct ProjCameraInfo { float camangle; float camsize; float xasp, yasp; @@ -40,9 +40,9 @@ typedef struct UvCameraInfo { float rotmat[4][4]; float caminv[4][4]; short do_persp, do_pano, do_rotmat; -} UvCameraInfo; +} ProjCameraInfo; -void project_from_camera(float target[2], float source[3], UvCameraInfo *uci) +void BLI_uvproject_from_camera(float target[2], float source[3], ProjCameraInfo *uci) { float pv4[4]; @@ -93,7 +93,7 @@ void project_from_camera(float target[2], float source[3], UvCameraInfo *uci) } /* could rv3d->persmat */ -void project_from_view(float target[2], float source[3], float persmat[4][4], float rotmat[4][4], float winx, float winy) +void BLI_uvproject_from_view(float target[2], float source[3], float persmat[4][4], float rotmat[4][4], float winx, float winy) { float pv[3], pv4[4], x = 0.0, y = 0.0; @@ -133,9 +133,9 @@ void project_from_view(float target[2], float source[3], float persmat[4][4], fl /* 'rotmat' can be obedit->obmat when uv project is used. * 'winx' and 'winy' can be from scene->r.xsch/ysch */ -UvCameraInfo *project_camera_info(Object *ob, float(*rotmat)[4], float winx, float winy) +ProjCameraInfo *BLI_uvproject_camera_info(Object *ob, float(*rotmat)[4], float winx, float winy) { - UvCameraInfo uci; + ProjCameraInfo uci; Camera *camera = ob->data; uci.do_pano = (camera->flag & CAM_PANORAMA); @@ -149,7 +149,7 @@ UvCameraInfo *project_camera_info(Object *ob, float(*rotmat)[4], float winx, flo normalize_m4(uci.caminv); if (invert_m4(uci.caminv)) { - UvCameraInfo *uci_pt; + ProjCameraInfo *uci_pt; /* normal projection */ if (rotmat) { @@ -174,7 +174,7 @@ UvCameraInfo *project_camera_info(Object *ob, float(*rotmat)[4], float winx, flo uci.shiftx = 0.5f - (camera->shiftx * uci.xasp); uci.shifty = 0.5f - (camera->shifty * uci.yasp); - uci_pt = MEM_mallocN(sizeof(UvCameraInfo), "UvCameraInfo"); + uci_pt = MEM_mallocN(sizeof(ProjCameraInfo), "ProjCameraInfo"); *uci_pt = uci; return uci_pt; } @@ -182,7 +182,7 @@ UvCameraInfo *project_camera_info(Object *ob, float(*rotmat)[4], float winx, flo return NULL; } -void project_from_view_ortho(float target[2], float source[3], float rotmat[4][4]) +void BLI_uvproject_from_view_ortho(float target[2], float source[3], float rotmat[4][4]) { float pv[3]; @@ -193,7 +193,7 @@ void project_from_view_ortho(float target[2], float source[3], float rotmat[4][4 target[1] = pv[2]; } -void project_camera_info_scale(UvCameraInfo *uci, float scale_x, float scale_y) +void BLI_uvproject_camera_info_scale(ProjCameraInfo *uci, float scale_x, float scale_y) { uci->xasp *= scale_x; uci->yasp *= scale_y; diff --git a/source/blender/blenlib/intern/voxel.c b/source/blender/blenlib/intern/voxel.c index 34862c724e1..3ad9edd14a3 100644 --- a/source/blender/blenlib/intern/voxel.c +++ b/source/blender/blenlib/intern/voxel.c @@ -37,15 +37,15 @@ BLI_INLINE float D(float *data, const int res[3], int x, int y, int z) { - CLAMP(x, 0, res[0]-1); - CLAMP(y, 0, res[1]-1); - CLAMP(z, 0, res[2]-1); - return data[ V_I(x, y, z, res) ]; + CLAMP(x, 0, res[0] - 1); + CLAMP(y, 0, res[1] - 1); + CLAMP(z, 0, res[2] - 1); + return data[ BLI_VOXEL_INDEX(x, y, z, res) ]; } /* *** nearest neighbor *** */ /* input coordinates must be in bounding box 0.0 - 1.0 */ -float voxel_sample_nearest(float *data, const int res[3], const float co[3]) +float BLI_voxel_sample_nearest(float *data, const int res[3], const float co[3]) { int xi, yi, zi; @@ -70,7 +70,7 @@ BLI_INLINE int _clamp(int a, int b, int c) return (a < b) ? b : ((a > c) ? c : a); } -float voxel_sample_trilinear(float *data, const int res[3], const float co[3]) +float BLI_voxel_sample_trilinear(float *data, const int res[3], const float co[3]) { if (data) { @@ -102,7 +102,7 @@ float voxel_sample_trilinear(float *data, const int res[3], const float co[3]) } -float voxel_sample_triquadratic(float *data, const int res[3], const float co[3]) +float BLI_voxel_sample_triquadratic(float *data, const int res[3], const float co[3]) { if (data) { @@ -132,7 +132,7 @@ float voxel_sample_triquadratic(float *data, const int res[3], const float co[3] return 0.f; } -float voxel_sample_tricubic(float *data, const int res[3], const float co[3], int bspline) +float BLI_voxel_sample_tricubic(float *data, const int res[3], const float co[3], int bspline) { if (data) { diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 6c0ac651f13..479b45b82a3 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -553,7 +553,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepat m= MEM_callocN(sizeof(Main), "find_main"); BLI_addtail(mainlist, m); - lib= alloc_libblock(&m->library, ID_LI, "lib"); + lib= BKE_libblock_alloc(&m->library, ID_LI, "lib"); BLI_strncpy(lib->name, filepath, sizeof(lib->name)); BLI_strncpy(lib->filepath, name1, sizeof(lib->filepath)); @@ -1670,7 +1670,7 @@ static void direct_link_brush(FileData *fd, Brush *brush) if (brush->curve) direct_link_curvemapping(fd, brush->curve); else - brush_curve_preset(brush, CURVE_PRESET_SHARP); + BKE_brush_curve_preset(brush, CURVE_PRESET_SHARP); brush->preview= NULL; brush->icon_imbuf= NULL; @@ -2458,10 +2458,19 @@ typedef struct tConstraintLinkData { ID *id; } tConstraintLinkData; /* callback function used to relink constraint ID-links */ -static void lib_link_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, void *userdata) +static void lib_link_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, short isReference, void *userdata) { tConstraintLinkData *cld= (tConstraintLinkData *)userdata; - *idpoin = newlibadr(cld->fd, cld->id->lib, *idpoin); + + /* for reference types, we need to increment the usercounts on load... */ + if (isReference) { + /* reference type - with usercount */ + *idpoin = newlibadr_us(cld->fd, cld->id->lib, *idpoin); + } + else { + /* target type - no usercount needed */ + *idpoin = newlibadr(cld->fd, cld->id->lib, *idpoin); + } } static void lib_link_constraints(FileData *fd, ID *id, ListBase *conlist) @@ -2550,7 +2559,7 @@ static void lib_link_pose(FileData *fd, Object *ob, bPose *pose) /* sync proxy active bone */ if (pose->proxy_act_bone[0]) { - Bone *bone = get_named_bone(arm, pose->proxy_act_bone); + Bone *bone = BKE_armature_find_bone_name(arm, pose->proxy_act_bone); if (bone) arm->act_bone = bone; } @@ -2560,7 +2569,7 @@ static void lib_link_pose(FileData *fd, Object *ob, bPose *pose) lib_link_constraints(fd, (ID *)ob, &pchan->constraints); /* hurms... loop in a loop, but yah... later... (ton) */ - pchan->bone= get_named_bone(arm, pchan->name); + pchan->bone= BKE_armature_find_bone_name(arm, pchan->name); pchan->custom= newlibadr_us(fd, arm->id.lib, pchan->custom); if (pchan->bone==NULL) @@ -2940,7 +2949,7 @@ static void direct_link_text(FileData *fd, Text *text) #if 0 if (text->flags & TXT_ISEXT) { - reopen_text(text); + BKE_text_reload(text); } else { #endif @@ -4072,7 +4081,7 @@ static void lib_link_object(FileData *fd, Main *main) warn= 1; if (ob->pose) { - free_pose(ob->pose); + BKE_pose_free(ob->pose); ob->pose= NULL; ob->mode &= ~OB_MODE_POSE; } @@ -14081,7 +14090,7 @@ typedef struct tConstraintExpandData { Main *mainvar; } tConstraintExpandData; /* callback function used to expand constraint ID-links */ -static void expand_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, void *userdata) +static void expand_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, short UNUSED(isReference), void *userdata) { tConstraintExpandData *ced= (tConstraintExpandData *)userdata; expand_doit(ced->fd, ced->mainvar, *idpoin); @@ -14495,7 +14504,7 @@ static int object_in_any_scene(Main *mainvar, Object *ob) Scene *sce; for (sce= mainvar->scene.first; sce; sce= sce->id.next) - if (object_in_scene(ob, sce)) + if (BKE_scene_base_find(sce, ob)) return 1; return 0; } @@ -14571,13 +14580,13 @@ static void give_base_to_groups(Main *mainvar, Scene *scene) if (((group->id.flag & LIB_INDIRECT)==0 && (group->id.flag & LIB_PRE_EXISTING)==0)) { Base *base; - /* add_object(...) messes with the selection */ - Object *ob= add_only_object(OB_EMPTY, group->id.name+2); + /* BKE_object_add(...) messes with the selection */ + Object *ob= BKE_object_add_only_object(OB_EMPTY, group->id.name+2); ob->type= OB_EMPTY; ob->lay= scene->lay; /* assign the base */ - base= scene_add_base(scene, ob); + base= BKE_scene_base_add(scene, ob); base->flag |= SELECT; base->object->flag= base->flag; ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 7947d6f8f71..3e2c140d6d2 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1271,7 +1271,7 @@ static void write_pose(WriteData *wd, bPose *pose) /* write IK param */ if (pose->ikparam) { - char *structname = (char *)get_ikparam_name(pose); + char *structname = (char *)BKE_pose_ikparam_get_name(pose); if (structname) writestruct(wd, DATA, structname, 1, pose->ikparam); } @@ -2933,7 +2933,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL * we should not have any relative paths, but if there * is somehow, an invalid or empty G.main->name it will * print an error, don't try make the absolute in this case. */ - makeFilesAbsolute(mainvar, G.main->name, NULL); + BLI_bpath_absolute_convert(mainvar, G.main->name, NULL); } } } @@ -2942,7 +2942,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL write_user_block= (BLI_path_cmp(filepath, userfilename) == 0); if (write_flags & G_FILE_RELATIVE_REMAP) - makeFilesRelative(mainvar, filepath, NULL); /* note, making relative to something OTHER then G.main->name */ + BLI_bpath_relative_convert(mainvar, filepath, NULL); /* note, making relative to something OTHER then G.main->name */ /* actual file writing */ err= write_file_handle(mainvar, file, NULL, NULL, write_user_block, write_flags, thumb); diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c index 0659a42c26d..212ec33e626 100644 --- a/source/blender/bmesh/operators/bmo_dupe.c +++ b/source/blender/bmesh/operators/bmo_dupe.c @@ -181,7 +181,7 @@ static BMFace *copy_face(BMOperator *op, BMesh *source_mesh, * Internal Copy function. */ -static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target) +static void BKE_mesh_copy(BMOperator *op, BMesh *source, BMesh *target) { BMVert *v = NULL, *v2; @@ -326,7 +326,7 @@ void bmo_dupe_exec(BMesh *bm, BMOperator *op) BMO_slot_buffer_flag_enable(bm, dupeop, "geom", BM_ALL, DUPE_INPUT); /* use the internal copy function */ - copy_mesh(dupeop, bm, bm2); + BKE_mesh_copy(dupeop, bm, bm2); /* Output */ /* First copy the input buffers to output buffers - original data */ diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c index 9632a79b7dd..2fe94a01368 100644 --- a/source/blender/bmesh/operators/bmo_triangulate.c +++ b/source/blender/bmesh/operators/bmo_triangulate.c @@ -168,30 +168,30 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op) BLI_smallhash_init(&hash); - BLI_begin_edgefill(&sf_ctx); + BLI_scanfill_begin(&sf_ctx); BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) { BMO_elem_flag_enable(bm, e, EDGE_MARK); if (!BLI_smallhash_haskey(&hash, (uintptr_t)e->v1)) { - eve = BLI_addfillvert(&sf_ctx, e->v1->co); + eve = BLI_scanfill_vert_add(&sf_ctx, e->v1->co); eve->tmp.p = e->v1; BLI_smallhash_insert(&hash, (uintptr_t)e->v1, eve); } if (!BLI_smallhash_haskey(&hash, (uintptr_t)e->v2)) { - eve = BLI_addfillvert(&sf_ctx, e->v2->co); + eve = BLI_scanfill_vert_add(&sf_ctx, e->v2->co); eve->tmp.p = e->v2; BLI_smallhash_insert(&hash, (uintptr_t)e->v2, eve); } v1 = BLI_smallhash_lookup(&hash, (uintptr_t)e->v1); v2 = BLI_smallhash_lookup(&hash, (uintptr_t)e->v2); - /* eed = */ BLI_addfilledge(&sf_ctx, v1, v2); + /* eed = */ BLI_scanfill_edge_add(&sf_ctx, v1, v2); /* eed->tmp.p = e; */ /* UNUSED */ } - BLI_edgefill(&sf_ctx, FALSE); + BLI_scanfill_calc(&sf_ctx, FALSE); for (efa = sf_ctx.fillfacebase.first; efa; efa = efa->next) { BMFace *f = BM_face_create_quad_tri(bm, @@ -208,7 +208,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op) } } - BLI_end_edgefill(&sf_ctx); + BLI_scanfill_end(&sf_ctx); BLI_smallhash_release(&hash); /* clean up fill */ diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 6565a9e0c2e..3e40afadd99 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -371,7 +371,7 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B } if (!(fcu)) return; - bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name); + bPoseChannel *pchan = BKE_pose_channel_find_name(ob_arm->pose, bone->name); if (!pchan) return; @@ -379,7 +379,7 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B if (flag & ARM_RESTPOS) { arm->flag &= ~ARM_RESTPOS; - where_is_pose(scene, ob_arm); + BKE_pose_where_is(scene, ob_arm); } if (fra.size()) { @@ -388,7 +388,7 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B if (flag & ARM_RESTPOS) arm->flag = flag; - where_is_pose(scene, ob_arm); + BKE_pose_where_is(scene, ob_arm); } void AnimationExporter::dae_baked_animation(std::vector<float> &fra, Object *ob_arm, Bone *bone) @@ -739,7 +739,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Obj bPoseChannel *pchan = NULL; bPose *pose = ob_arm->pose; - pchan = get_pose_channel(pose, bone->name); + pchan = BKE_pose_channel_find_name(pose, bone->name); if (!pchan) return ""; @@ -753,10 +753,10 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Obj for (it = frames.begin(); it != frames.end(); it++) { float mat[4][4], ipar[4][4]; - float ctime = BKE_frame_to_ctime(scene, *it); + float ctime = BKE_scene_frame_get_from_ctime(scene, *it); BKE_animsys_evaluate_animdata(scene, &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM); - where_is_pose_bone(scene, ob_arm, pchan, ctime, 1); + BKE_pose_where_is_bone(scene, ob_arm, pchan, ctime, 1); // compute bone local mat if (bone->parent) { @@ -1206,7 +1206,7 @@ void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bo BLI_snprintf(prefix, sizeof(prefix), "pose.bones[\"%s\"]", bone->name); - bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name); + bPoseChannel *pchan = BKE_pose_channel_find_name(ob_arm->pose, bone->name); if (!pchan) return; //Fill frame array with key frame values framed at \param:transform_type @@ -1227,7 +1227,7 @@ void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bo // exit rest position if (flag & ARM_RESTPOS) { arm->flag &= ~ARM_RESTPOS; - where_is_pose(scene, ob_arm); + BKE_pose_where_is(scene, ob_arm); } //v array will hold all values which will be exported. if (fra.size()) { @@ -1257,7 +1257,7 @@ void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bo // restore restpos if (flag & ARM_RESTPOS) arm->flag = flag; - where_is_pose(scene, ob_arm); + BKE_pose_where_is(scene, ob_arm); } void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, int type, Bone *bone, Object *ob_arm, bPoseChannel *pchan) @@ -1265,7 +1265,7 @@ void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, i bPoseChannel *parchan = NULL; bPose *pose = ob_arm->pose; - pchan = get_pose_channel(pose, bone->name); + pchan = BKE_pose_channel_find_name(pose, bone->name); if (!pchan) return; @@ -1278,11 +1278,11 @@ void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, i for (it = frames.begin(); it != frames.end(); it++) { float mat[4][4], ipar[4][4]; - float ctime = BKE_frame_to_ctime(scene, *it); + float ctime = BKE_scene_frame_get_from_ctime(scene, *it); BKE_animsys_evaluate_animdata(scene, &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM); - where_is_pose_bone(scene, ob_arm, pchan, ctime, 1); + BKE_pose_where_is_bone(scene, ob_arm, pchan, ctime, 1); // compute bone local mat if (bone->parent) { diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 6a66f1fb817..3180245eac1 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -206,7 +206,7 @@ void AnimationImporter::add_fcurves_to_object(Object *ob, std::vector<FCurve*>& if (bone_name) { /* try to find group */ - grp = action_groups_find_named(act, bone_name); + grp = BKE_action_group_find_name(act, bone_name); /* no matching groups, so add one */ if (grp == NULL) { @@ -324,7 +324,7 @@ void AnimationImporter::read_node_transform(COLLADAFW::Node *node, Object *ob) TransformReader::get_node_mat(mat, node, &uid_animated_map, ob); if (ob) { copy_m4_m4(ob->obmat, mat); - object_apply_mat4(ob, ob->obmat, 0, 0); + BKE_object_apply_mat4(ob, ob->obmat, 0, 0); } } @@ -361,7 +361,7 @@ virtual void AnimationImporter::change_eul_to_quat(Object *ob, bAction *act) create_fcurve(3, rna_path) }; - bPoseChannel *chan = get_pose_channel(ob->pose, grp->name); + bPoseChannel *chan = BKE_pose_channel_find_name(ob->pose, grp->name); float m4[4][4], irest[3][3]; invert_m4_m4(m4, chan->bone->arm_mat); @@ -653,7 +653,7 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>& get_joint_rest_mat(irest_dae, root, node); invert_m4(irest_dae); - Bone *bone = get_named_bone((bArmature*)ob->data, bone_name); + Bone *bone = BKE_armature_find_bone_name((bArmature*)ob->data, bone_name); if (!bone) { fprintf(stderr, "cannot find bone \"%s\"\n", bone_name); return; @@ -767,7 +767,7 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>& } if (is_joint) { - bPoseChannel *chan = get_pose_channel(ob->pose, bone_name); + bPoseChannel *chan = BKE_pose_channel_find_name(ob->pose, bone_name); chan->rotmode = ROT_MODE_QUAT; } else { @@ -1008,7 +1008,7 @@ void AnimationImporter::add_bone_animation_sampled(Object * ob, std::vector<FCur get_joint_rest_mat(irest_dae, root, node); invert_m4(irest_dae); - Bone *bone = get_named_bone((bArmature*)ob->data, bone_name); + Bone *bone = BKE_armature_find_bone_name((bArmature*)ob->data, bone_name); if (!bone) { fprintf(stderr, "cannot find bone \"%s\"\n", bone_name); return; @@ -1106,7 +1106,7 @@ void AnimationImporter::add_bone_animation_sampled(Object * ob, std::vector<FCur add_bone_fcurve(ob, node, newcu[i]); } - bPoseChannel *chan = get_pose_channel(ob->pose, bone_name); + bPoseChannel *chan = BKE_pose_channel_find_name(ob->pose, bone_name); chan->rotmode = ROT_MODE_QUAT; } @@ -1290,7 +1290,7 @@ Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node, get_joint_rest_mat(irest_dae, root, node); invert_m4(irest_dae); - Bone *bone = get_named_bone((bArmature*)ob->data, bone_name); + Bone *bone = BKE_armature_find_bone_name((bArmature*)ob->data, bone_name); if (!bone) { fprintf(stderr, "cannot find bone \"%s\"\n", bone_name); return NULL; @@ -1498,7 +1498,7 @@ Object *AnimationImporter::translate_animation_OLD(COLLADAFW::Node *node, if (is_rotation || is_matrix) { if (is_joint) { - bPoseChannel *chan = get_pose_channel(ob->pose, bone_name); + bPoseChannel *chan = BKE_pose_channel_find_name(ob->pose, bone_name); chan->rotmode = ROT_MODE_QUAT; } else { @@ -1755,9 +1755,7 @@ Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, COLLADAFW::No if (joint_objects.find(node->getUniqueId()) == joint_objects.end()) { Object *job = add_object(scene, OB_EMPTY); - rename_id((ID*)&job->id, (char*)get_joint_name(node)); - - job->lay = object_in_scene(job, scene)->lay = 2; + job->lay = BKE_scene_base_find(scene, job)->lay = 2; mul_v3_fl(job->size, 0.5f); job->recalc |= OB_RECALC_OB; @@ -1785,7 +1783,7 @@ Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, COLLADAFW::No job->parsubstr[0] = 0; } - where_is_object(scene, job); + BKE_object_where_is_calc(scene, job); // after parenting and layer change DAG_scene_sort(CTX_data_main(C), scene); @@ -1834,7 +1832,7 @@ void AnimationImporter::add_bone_fcurve(Object *ob, COLLADAFW::Node *node, FCurv bAction *act = ob->adt->action; /* try to find group */ - bActionGroup *grp = action_groups_find_named(act, bone_name); + bActionGroup *grp = BKE_action_group_find_name(act, bone_name); /* no matching groups, so add one */ if (grp == NULL) { diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index d5a3b4cb0a2..38a5e9b5df4 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -251,13 +251,13 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene* sce, }*/ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node) { - bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name); + bPoseChannel *pchan = BKE_pose_channel_find_name(ob_arm->pose, bone->name); float mat[4][4]; if (bone->parent) { // get bone-space matrix from armature-space - bPoseChannel *parchan = get_pose_channel(ob_arm->pose, bone->parent->name); + bPoseChannel *parchan = BKE_pose_channel_find_name(ob_arm->pose, bone->parent->name); float invpar[4][4]; invert_m4_m4(invpar, parchan->pose_mat); @@ -481,12 +481,12 @@ std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase // put armature in rest position if (!(arm->flag & ARM_RESTPOS)) { arm->flag |= ARM_RESTPOS; - where_is_pose(scene, ob_arm); + BKE_pose_where_is(scene, ob_arm); } for (bDeformGroup *def = (bDeformGroup*)defbase->first; def; def = def->next) { if (is_bone_defgroup(ob_arm, def)) { - bPoseChannel *pchan = get_pose_channel(pose, def->name); + bPoseChannel *pchan = BKE_pose_channel_find_name(pose, def->name); float mat[4][4]; float world[4][4]; @@ -515,7 +515,7 @@ std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase // back from rest positon if (!(flag & ARM_RESTPOS)) { arm->flag = flag; - where_is_pose(scene, ob_arm); + BKE_pose_where_is(scene, ob_arm); } source.finish(); @@ -525,7 +525,7 @@ std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase Bone *ArmatureExporter::get_bone_from_defgroup(Object *ob_arm, bDeformGroup* def) { - bPoseChannel *pchan = get_pose_channel(ob_arm->pose, def->name); + bPoseChannel *pchan = BKE_pose_channel_find_name(ob_arm->pose, def->name); return pchan ? pchan->bone : NULL; } diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 833904e20c2..e0bb9840925 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -321,7 +321,7 @@ void ArmatureImporter::set_leaf_bone_shapes(Object *ob_arm) for (it = leaf_bones.begin(); it != leaf_bones.end(); it++) { LeafBone& leaf = *it; - bPoseChannel *pchan = get_pose_channel(pose, leaf.name); + bPoseChannel *pchan = BKE_pose_channel_find_name(pose, leaf.name); if (pchan) { pchan->custom = get_empty_for_leaves(); } @@ -499,7 +499,7 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin) std::map<COLLADAFW::UniqueId, SkinInfo>::iterator it; for (it = skin_by_data_uid.begin(); it != skin_by_data_uid.end(); it++) { SkinInfo *b = &it->second; - if (b == a || b->get_armature() == NULL) + if (b == a || b->BKE_armature_from_object() == NULL) continue; skin_root_joints.clear(); @@ -509,7 +509,7 @@ void ArmatureImporter::create_armature_bones(SkinInfo& skin) std::vector<COLLADAFW::Node*>::iterator ri; for (ri = skin_root_joints.begin(); ri != skin_root_joints.end(); ri++) { if (a->uses_joint_or_descendant(*ri)) { - shared = b->get_armature(); + shared = b->BKE_armature_from_object(); break; } } @@ -582,13 +582,13 @@ void ArmatureImporter::set_pose(Object * ob_arm, COLLADAFW::Node * root_node, c get_node_mat(obmat, root_node, NULL, NULL); //if (*edbone) - bPoseChannel * pchan = get_pose_channel(ob_arm -> pose, bone_name); + bPoseChannel * pchan = BKE_pose_channel_find_name(ob_arm -> pose, bone_name); //else fprintf ( "", // get world-space if (parentname) { mult_m4_m4m4(mat, parent_mat, obmat); - bPoseChannel *parchan = get_pose_channel(ob_arm->pose, parentname); + bPoseChannel *parchan = BKE_pose_channel_find_name(ob_arm->pose, parentname); mult_m4_m4m4(pchan->pose_mat, parchan->pose_mat, mat ); @@ -660,7 +660,7 @@ void ArmatureImporter::make_armatures(bContext *C) // set armature parent if any Object *par = skin.get_parent(); if (par) - bc_set_parent(skin.get_armature(), par, C, false); + bc_set_parent(skin.BKE_armature_from_object(), par, C, false); // free memory stolen from SkinControllerData skin.free(); @@ -761,7 +761,7 @@ Object *ArmatureImporter::get_armature_for_joint(COLLADAFW::Node *node) SkinInfo& skin = it->second; if (skin.uses_joint_or_descendant(node)) - return skin.get_armature(); + return skin.BKE_armature_from_object(); } std::map<COLLADAFW::UniqueId, Object*>::iterator arm; diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 947bedc2ff7..c8f617ff1d9 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -121,6 +121,9 @@ bool DocumentImporter::import() loader.registerExtraDataCallbackHandler(ehandler); + // deselect all to select new objects + BKE_scene_base_deselect_all(CTX_data_scene(mContext)); + if (!root.loadDocument(mFilename)) { fprintf(stderr, "COLLADAFW::Root::loadDocument() returned false on 1st pass\n"); return false; @@ -222,10 +225,10 @@ void DocumentImporter::finish() for (it = libnode_ob.begin(); it != libnode_ob.end(); it++) { Object *ob = *it; - Base *base = object_in_scene(ob, sce); + Base *base = BKE_scene_base_find(sce, ob); if (base) { BLI_remlink(&sce->base, base); - free_libblock_us(&G.main->object, base->object); + BKE_libblock_free_us(&G.main->object, base->object); if (sce->basact==base) sce->basact= NULL; MEM_freeN(base); @@ -306,7 +309,7 @@ Object* DocumentImporter::create_camera_object(COLLADAFW::InstanceCamera *camera ob->data = cam; old_cam->id.us--; if (old_cam->id.us == 0) - free_libblock(&G.main->camera, old_cam); + BKE_libblock_free(&G.main->camera, old_cam); return ob; } @@ -323,7 +326,7 @@ Object* DocumentImporter::create_lamp_object(COLLADAFW::InstanceLight *lamp, Sce ob->data = la; old_lamp->id.us--; if (old_lamp->id.us == 0) - free_libblock(&G.main->lamp, old_lamp); + BKE_libblock_free(&G.main->lamp, old_lamp); return ob; } @@ -331,9 +334,9 @@ Object* DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod { fprintf(stderr, "create <instance_node> under node id=%s from node id=%s\n", instance_node ? instance_node->getOriginalId().c_str() : NULL, source_node ? source_node->getOriginalId().c_str() : NULL); - Object *obn = copy_object(source_ob); + Object *obn = BKE_object_copy(source_ob); obn->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; - scene_add_base(sce, obn); + BKE_scene_base_add(sce, obn); if (instance_node) { anim_importer.read_node_transform(instance_node, obn); @@ -352,7 +355,7 @@ Object* DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod } // calc new matrix and apply mult_m4_m4m4(obn->obmat, obn->obmat, mat); - object_apply_mat4(obn, obn->obmat, 0, 0); + BKE_object_apply_mat4(obn, obn->obmat, 0, 0); } } else { @@ -565,7 +568,7 @@ bool DocumentImporter::writeMaterial( const COLLADAFW::Material* cmat ) return true; const std::string& str_mat_id = cmat->getName().size() ? cmat->getName() : cmat->getOriginalId(); - Material *ma = add_material((char*)str_mat_id.c_str()); + Material *ma = BKE_material_add((char*)str_mat_id.c_str()); this->uid_effect_map[cmat->getInstantiatedEffect()] = ma; this->uid_material_map[cmat->getUniqueId()] = ma; @@ -795,8 +798,8 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) cam_id = camera->getOriginalId(); cam_name = camera->getName(); - if (cam_name.size()) cam = (Camera*)add_camera((char*)cam_name.c_str()); - else cam = (Camera*)add_camera((char*)cam_id.c_str()); + if (cam_name.size()) cam = (Camera *)BKE_camera_add((char*)cam_name.c_str()); + else cam = (Camera *)BKE_camera_add((char*)cam_id.c_str()); if (!cam) { fprintf(stderr, "Cannot create camera.\n"); @@ -914,7 +917,7 @@ bool DocumentImporter::writeImage( const COLLADAFW::Image* image ) BLI_split_dir_part(filename, dir, sizeof(dir)); BLI_join_dirfile(full_path, sizeof(full_path), dir, filepath.c_str()); - Image *ima = BKE_add_image_file(full_path); + Image *ima = BKE_image_load_exists(full_path); if (!ima) { fprintf(stderr, "Cannot create image.\n"); return true; @@ -942,8 +945,8 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light ) la_id = light->getOriginalId(); la_name = light->getName(); - if (la_name.size()) lamp = (Lamp*)add_lamp((char*)la_name.c_str()); - else lamp = (Lamp*)add_lamp((char*)la_id.c_str()); + if (la_name.size()) lamp = (Lamp*)BKE_lamp_add((char*)la_name.c_str()); + else lamp = (Lamp*)BKE_lamp_add((char*)la_id.c_str()); if (!lamp) { fprintf(stderr, "Cannot create lamp.\n"); diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index d6cc35deca7..5560a80f68e 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -909,7 +909,7 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta set_mesh(ob, uid_mesh_map[*geom_uid]); - if (old_mesh->id.us == 0) free_libblock(&G.main->mesh, old_mesh); + if (old_mesh->id.us == 0) BKE_libblock_free(&G.main->mesh, old_mesh); char layername[100]; layername[0] = '\0'; @@ -957,7 +957,7 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry* geom) } const std::string& str_geom_id = mesh->getName().size() ? mesh->getName() : mesh->getOriginalId(); - Mesh *me = add_mesh((char*)str_geom_id.c_str()); + Mesh *me = BKE_mesh_add((char*)str_geom_id.c_str()); // store the Mesh pointer to link it later with an Object this->uid_mesh_map[mesh->getUniqueId()] = me; diff --git a/source/blender/collada/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp index 99a4f024f77..75cec3337e8 100644 --- a/source/blender/collada/SkinInfo.cpp +++ b/source/blender/collada/SkinInfo.cpp @@ -178,7 +178,7 @@ bool SkinInfo::get_joint_inv_bind_matrix(float inv_bind_mat[][4], COLLADAFW::Nod return false; } -Object *SkinInfo::get_armature() +Object *SkinInfo::BKE_armature_from_object() { return ob_arm; } @@ -221,7 +221,7 @@ void SkinInfo::link_armature(bContext *C, Object *ob, std::map<COLLADAFW::Unique ((ArmatureModifierData *)md)->object = ob_arm; copy_m4_m4(ob->obmat, bind_shape_matrix); - object_apply_mat4(ob, ob->obmat, 0, 0); + BKE_object_apply_mat4(ob, ob->obmat, 0, 0); #if 1 bc_set_parent(ob, ob_arm, C); #else @@ -229,7 +229,7 @@ void SkinInfo::link_armature(bContext *C, Object *ob, std::map<COLLADAFW::Unique ob->parent = ob_arm; ob->partype = PAROBJECT; - what_does_parent(scene, ob, &workob); + BKE_object_workob_calc_parent(scene, ob, &workob); invert_m4_m4(ob->parentinv, workob.obmat); ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA; @@ -288,7 +288,7 @@ void SkinInfo::link_armature(bContext *C, Object *ob, std::map<COLLADAFW::Unique bPoseChannel *SkinInfo::get_pose_channel_from_node(COLLADAFW::Node *node) { - return get_pose_channel(ob_arm->pose, bc_get_joint_name(node)); + return BKE_pose_channel_find_name(ob_arm->pose, bc_get_joint_name(node)); } void SkinInfo::set_parent(Object *_parent) diff --git a/source/blender/collada/SkinInfo.h b/source/blender/collada/SkinInfo.h index 7befe7168d3..894f53f07c3 100644 --- a/source/blender/collada/SkinInfo.h +++ b/source/blender/collada/SkinInfo.h @@ -105,7 +105,7 @@ public: bool get_joint_inv_bind_matrix(float inv_bind_mat[][4], COLLADAFW::Node *node); - Object *get_armature(); + Object *BKE_armature_from_object(); const COLLADAFW::UniqueId& get_controller_uid(); diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp index 4974566bba1..fbd36cd6613 100644 --- a/source/blender/collada/TransformWriter.cpp +++ b/source/blender/collada/TransformWriter.cpp @@ -70,7 +70,7 @@ void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob) copy_v3_v3(scale, ob->size); ob->size[0] = ob->size[1] = ob->size[2] = 1.0f; - object_to_mat4(ob, C); + BKE_object_to_mat4(ob, C); copy_v3_v3(ob->size, scale); mul_serie_m4(tmat, ob->parent->obmat, ob->parentinv, C, NULL, NULL, NULL, NULL, NULL); diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index 4aed29defbc..015a48d4bc7 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -86,7 +86,7 @@ int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space) if (is_parent_space) { float mat[4][4]; // calc par->obmat - where_is_object(sce, par); + BKE_object_where_is_calc(sce, par); // move child obmat into world space mult_m4_m4m4(mat, par->obmat, ob->obmat); @@ -94,10 +94,10 @@ int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space) } // apply child obmat (i.e. decompose it into rot/loc/size) - object_apply_mat4(ob, ob->obmat, 0, 0); + BKE_object_apply_mat4(ob, ob->obmat, 0, 0); // compute parentinv - what_does_parent(sce, ob, &workob); + BKE_object_workob_calc_parent(sce, ob, &workob); invert_m4_m4(ob->parentinv, workob.obmat); ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA; @@ -110,3 +110,16 @@ int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space) return true; } +Object *bc_add_object(Scene *scene, int type, const char *name) +{ + Object *ob = BKE_object_add_only_object(type, name); + + ob->data= BKE_object_obdata_add_from_type(type); + ob->lay= scene->lay; + ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; + + BKE_scene_base_select(scene, BKE_scene_base_add(scene, ob)); + + return ob; +} + diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index b449c11ff7b..5b8e696f05a 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -144,7 +144,7 @@ static void animchan_sync_group (bAnimContext *UNUSED(ac), bAnimListElem *ale) * NOTE: this feature will only really work if groups by default contain the F-Curves for a single bone */ if (ob->pose) { - bPoseChannel *pchan= get_pose_channel(ob->pose, agrp->name); + bPoseChannel *pchan= BKE_pose_channel_find_name(ob->pose, agrp->name); /* if one matches, sync the selection status */ if (pchan) { @@ -179,7 +179,7 @@ static void animchan_sync_fcurve (bAnimContext *UNUSED(ac), bAnimListElem *ale) /* get bone-name, and check if this bone is selected */ bone_name= BLI_getQuotedStr(fcu->rna_path, "pose.bones["); - pchan= get_pose_channel(ob->pose, bone_name); + pchan= BKE_pose_channel_find_name(ob->pose, bone_name); if (bone_name) MEM_freeN(bone_name); /* F-Curve selection depends on whether the bone is selected */ diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index cc3401da6c5..180953ea017 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -842,7 +842,7 @@ static short skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner_ /* get bone-name, and check if this bone is selected */ bone_name= BLI_getQuotedStr(fcu->rna_path, "pose.bones["); - pchan= get_pose_channel(ob->pose, bone_name); + pchan= BKE_pose_channel_find_name(ob->pose, bone_name); if (bone_name) MEM_freeN(bone_name); /* check whether to continue or skip */ diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 2527cb7eb40..1db43177ef0 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -1048,7 +1048,7 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera) int sel= 0; if (!extend) - scene_deselect_all(scene); + BKE_scene_base_deselect_all(scene); for (marker= markers->first; marker; marker= marker->next) { if (marker->frame==cfra) { @@ -1060,7 +1060,7 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera) for (marker= markers->first; marker; marker= marker->next) { if (marker->camera) { if (marker->frame==cfra) { - base= object_in_scene(marker->camera, scene); + base= BKE_scene_base_find(scene, marker->camera); if (base) { ED_base_object_select(base, sel); if (sel) @@ -1437,7 +1437,7 @@ static int ed_marker_camera_bind_exec(bContext *C, wmOperator *UNUSED(op)) marker->camera= ob; /* camera may have changes */ - scene_camera_switch_update(scene); + BKE_scene_camera_switch_update(scene); BKE_screen_view3d_scene_sync(sc); WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL); diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 4dd3406dafc..4563768728c 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -183,7 +183,7 @@ FCurve *verify_fcurve (bAction *act, const char group[], const char rna_path[], /* if a group name has been provided, try to add or find a group, then add F-Curve to it */ if (group) { /* try to find group */ - grp= action_groups_find_named(act, group); + grp= BKE_action_group_find_name(act, group); /* no matching groups, so add one */ if (grp == NULL) @@ -1479,6 +1479,7 @@ void ANIM_OT_keyframe_insert_button(wmOperatorType *ot) /* identifiers */ ot->name = "Insert Keyframe (Buttons)"; ot->idname = "ANIM_OT_keyframe_insert_button"; + ot->description = "Insert a keyframe for current UI-active property"; /* callbacks */ ot->exec = insert_key_button_exec; diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index f9c4082e429..2933fb649c9 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -528,7 +528,7 @@ ListBase builtin_keyingsets = {NULL, NULL}; /* --------------- */ /* Find KeyingSet type info given a name */ -KeyingSetInfo *ANIM_keyingset_info_find_named (const char name[]) +KeyingSetInfo *ANIM_keyingset_info_find_name (const char name[]) { /* sanity checks */ if ((name == NULL) || (name[0] == 0)) @@ -783,7 +783,7 @@ EnumPropertyItem *ANIM_keying_sets_enum_itemf (bContext *C, PointerRNA *UNUSED(p short ANIM_keyingset_context_ok_poll(bContext *C, KeyingSet *ks) { if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) { - KeyingSetInfo *ksi = ANIM_keyingset_info_find_named(ks->typeinfo); + KeyingSetInfo *ksi = ANIM_keyingset_info_find_name(ks->typeinfo); /* get the associated 'type info' for this KeyingSet */ if (ksi == NULL) @@ -865,7 +865,7 @@ short ANIM_validate_keyingset(bContext *C, ListBase *dsources, KeyingSet *ks) /* if relative Keying Sets, poll and build up the paths */ if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) { - KeyingSetInfo *ksi = ANIM_keyingset_info_find_named(ks->typeinfo); + KeyingSetInfo *ksi = ANIM_keyingset_info_find_name(ks->typeinfo); /* clear all existing paths * NOTE: BKE_keyingset_free() frees all of the paths for the KeyingSet, but not the set itself diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index aeecbc1fd28..9a15a100179 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -171,17 +171,19 @@ void ED_operatormacros_armature(void) wmOperatorType *ot; wmOperatorTypeMacro *otmacro; - ot = WM_operatortype_append_macro("ARMATURE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); + ot = WM_operatortype_append_macro("ARMATURE_OT_duplicate_move", "Duplicate", + "Make copies of the selected bones within the same armature and move them", + OPTYPE_UNDO|OPTYPE_REGISTER); if (ot) { - ot->description = "Make copies of the selected bones within the same armature and move them"; WM_operatortype_macro_define(ot, "ARMATURE_OT_duplicate"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); } - ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_move", "Extrude", OPTYPE_UNDO|OPTYPE_REGISTER); + ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_move", "Extrude", + "Create new bones from the selected joints and move them", + OPTYPE_UNDO|OPTYPE_REGISTER); if (ot) { - ot->description = "Create new bones from the selected joints and move them"; otmacro=WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude"); RNA_boolean_set(otmacro->ptr, "forked", FALSE); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); @@ -190,9 +192,10 @@ void ED_operatormacros_armature(void) // XXX would it be nicer to just be able to have standard extrude_move, but set the forked property separate? // that would require fixing a properties bug 19733 - ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_forked", "Extrude Forked", OPTYPE_UNDO|OPTYPE_REGISTER); + ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_forked", "Extrude Forked", + "Create new bones from the selected joints and move them", + OPTYPE_UNDO|OPTYPE_REGISTER); if (ot) { - ot->description = "Create new bones from the selected joints and move them"; otmacro=WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude"); RNA_boolean_set(otmacro->ptr, "forked", TRUE); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index eb821ffc147..8c9a8472c54 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -340,7 +340,7 @@ static void fix_bonelist_roll (ListBase *bonelist, ListBase *editbonelist) for (curBone=bonelist->first; curBone; curBone=curBone->next) { /* sets local matrix and arm_mat (restpos) */ - where_is_armature_bone(curBone, curBone->parent); + BKE_armature_where_is_bone(curBone, curBone->parent); /* Find the associated editbone */ for (ebone = editbonelist->first; ebone; ebone=ebone->next) @@ -367,7 +367,7 @@ static void fix_bonelist_roll (ListBase *bonelist, ListBase *editbonelist) curBone->roll = (float)-atan2(difmat[2][0], difmat[2][2]); /* and set restposition again */ - where_is_armature_bone(curBone, curBone->parent); + BKE_armature_where_is_bone(curBone, curBone->parent); } fix_bonelist_roll(&curBone->childbase, editbonelist); } @@ -382,7 +382,7 @@ void ED_armature_from_edit(Object *obedit) Object *obt; /* armature bones */ - free_bonelist(&arm->bonebase); + BKE_armature_bonelist_free(&arm->bonebase); /* remove zero sized bones, this gives instable restposes */ for (eBone=arm->edbo->first; eBone; eBone= neBone) { @@ -476,13 +476,13 @@ void ED_armature_from_edit(Object *obedit) } /* Make a pass through the new armature to fix rolling */ - /* also builds restposition again (like where_is_armature) */ + /* also builds restposition again (like BKE_armature_where_is) */ fix_bonelist_roll(&arm->bonebase, arm->edbo); /* so all users of this armature should get rebuilt */ for (obt= G.main->object.first; obt; obt= obt->id.next) { if (obt->data==arm) - armature_rebuild_pose(obt, arm); + BKE_pose_rebuild(obt, arm); } DAG_id_tag_update(&obedit->id, OB_RECALC_DATA); @@ -632,9 +632,9 @@ static void applyarmature_fix_boneparents (Scene *scene, Object *armob) /* apply current transform from parent (not yet destroyed), * then calculate new parent inverse matrix */ - object_apply_mat4(ob, ob->obmat, FALSE, FALSE); + BKE_object_apply_mat4(ob, ob->obmat, FALSE, FALSE); - what_does_parent(scene, ob, &workob); + BKE_object_workob_calc_parent(scene, ob, &workob); invert_m4_m4(ob->parentinv, workob.obmat); } } @@ -644,8 +644,8 @@ static void applyarmature_fix_boneparents (Scene *scene, Object *armob) static int apply_armature_pose2bones_exec (bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); // must be active object, not edit-object - bArmature *arm= get_armature(ob); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); // must be active object, not edit-object + bArmature *arm= BKE_armature_from_object(ob); bPose *pose; bPoseChannel *pchan; EditBone *curbone; @@ -653,7 +653,7 @@ static int apply_armature_pose2bones_exec (bContext *C, wmOperator *op) /* don't check if editmode (should be done by caller) */ if (ob->type!=OB_ARMATURE) return OPERATOR_CANCELLED; - if (object_data_is_libdata(ob)) { + if (BKE_object_obdata_is_libdata(ob)) { BKE_report(op->reports, RPT_ERROR, "Cannot apply pose to lib-linked armature"); //error_libdata(); return OPERATOR_CANCELLED; } @@ -716,7 +716,7 @@ static int apply_armature_pose2bones_exec (bContext *C, wmOperator *op) ED_armature_edit_free(ob); /* flush positions of posebones */ - where_is_pose(scene, ob); + BKE_pose_where_is(scene, ob); /* fix parenting of objects which are bone-parented */ applyarmature_fix_boneparents(scene, ob); @@ -746,7 +746,7 @@ void POSE_OT_armature_apply(wmOperatorType *ot) /* set the current pose as the restpose */ static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op)) { - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); // must be active object, not edit-object + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); // must be active object, not edit-object /* don't check if editmode (should be done by caller) */ if (ob->type!=OB_ARMATURE) @@ -766,7 +766,7 @@ static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op) * change, thus changing the result we may be trying to record. */ copy_m4_m4(delta_mat, pchan->chan_mat); - pchan_apply_mat4(pchan, delta_mat, TRUE); + BKE_pchan_apply_mat4(pchan, delta_mat, TRUE); } CTX_DATA_END; @@ -991,8 +991,8 @@ int join_armature_exec(bContext *C, wmOperator *UNUSED(op)) BLI_remlink(&opose->chanbase, pchan); BLI_addtail(&pose->chanbase, pchan); - free_pose_channels_hash(opose); - free_pose_channels_hash(pose); + BKE_pose_channels_hash_free(opose); + BKE_pose_channels_hash_free(pose); } ED_base_object_free_and_unlink(bmain, scene, base); @@ -1155,8 +1155,8 @@ static void separate_armature_bones(Object *ob, short sel) } /* free any of the extra-data this pchan might have */ - free_pose_channel(pchan); - free_pose_channels_hash(ob->pose); + BKE_pose_channel_free(pchan); + BKE_pose_channels_hash_free(ob->pose); /* get rid of unneeded bone */ bone_free(arm, curbone); @@ -1694,8 +1694,8 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op)) curBone = editbone_name_exists(arm->edbo, pchan->name); if (curBone && (curBone->flag & BONE_SELECTED) && (arm->layer & curBone->layer)) { - free_pose_channel(pchan); - free_pose_channels_hash(obedit->pose); + BKE_pose_channel_free(pchan); + BKE_pose_channels_hash_free(obedit->pose); BLI_freelinkN (&obedit->pose->chanbase, pchan); } else { @@ -2481,7 +2481,7 @@ void updateDuplicateSubtargetObjects(EditBone *dupBone, ListBase *editbones, Obj bConstraint *curcon; ListBase *conlist; - if ( (pchan = verify_pose_channel(dst_ob->pose, dupBone->name)) ) { + if ( (pchan = BKE_pose_channel_verify(dst_ob->pose, dupBone->name)) ) { if ( (conlist = &pchan->constraints) ) { for (curcon = conlist->first; curcon; curcon=curcon->next) { /* does this constraint have a subtarget in @@ -2552,15 +2552,15 @@ EditBone *duplicateEditBoneObjects(EditBone *curBone, const char *name, ListBase if (src_ob->pose) { bPoseChannel *chanold, *channew; - chanold = verify_pose_channel(src_ob->pose, curBone->name); + chanold = BKE_pose_channel_verify(src_ob->pose, curBone->name); if (chanold) { /* WARNING: this creates a new posechannel, but there will not be an attached bone * yet as the new bones created here are still 'EditBones' not 'Bones'. */ - channew= verify_pose_channel(dst_ob->pose, eBone->name); + channew= BKE_pose_channel_verify(dst_ob->pose, eBone->name); if (channew) { - duplicate_pose_channel_data(channew, chanold); + BKE_pose_channel_copy_data(channew, chanold); } } } @@ -4611,7 +4611,7 @@ static int bone_skinnable_cb(Object *ob, Bone *bone, void *datap) if (!(ob->mode & OB_MODE_WEIGHT_PAINT) || !(bone->flag & BONE_HIDDEN_P)) { if (!(bone->flag & BONE_NO_DEFORM)) { - if (data->heat && data->armob->pose && get_pose_channel(data->armob->pose, bone->name)) + if (data->heat && data->armob->pose && BKE_pose_channel_find_name(data->armob->pose, bone->name)) segments = bone->segments; else segments = 1; @@ -4678,7 +4678,7 @@ static int dgroup_skinnable_cb(Object *ob, Bone *bone, void *datap) if (!wpmode || !(bone->flag & BONE_HIDDEN_P)) { if (!(bone->flag & BONE_NO_DEFORM)) { - if (data->heat && data->armob->pose && get_pose_channel(data->armob->pose, bone->name)) + if (data->heat && data->armob->pose && BKE_pose_channel_find_name(data->armob->pose, bone->name)) segments = bone->segments; else segments = 1; @@ -4821,7 +4821,7 @@ static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, segments = 1; bbone = NULL; - if ((par->pose) && (pchan=get_pose_channel(par->pose, bone->name))) { + if ((par->pose) && (pchan=BKE_pose_channel_find_name(par->pose, bone->name))) { if (bone->segments > 1) { segments = bone->segments; bbone = b_bone_spline_setup(pchan, 1); @@ -5088,7 +5088,7 @@ static int pose_clear_transform_generic_exec(bContext *C, wmOperator *op, void (*clear_func)(bPoseChannel*), const char default_ksName[]) { Scene *scene= CTX_data_scene(C); - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); short autokey = 0; /* sanity checks */ @@ -5292,7 +5292,7 @@ void POSE_OT_select_all(wmOperatorType *ot) static int pose_select_parent_exec(bContext *C, wmOperator *UNUSED(op)) { - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); bPoseChannel *pchan, *parent; /* Determine if there is an active bone */ @@ -5368,7 +5368,7 @@ static int hide_unselected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr /* active object is armature in posemode, poll checked */ static int pose_hide_exec(bContext *C, wmOperator *op) { - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); bArmature *arm= ob->data; if (RNA_boolean_get(op->ptr, "unselected")) @@ -5417,7 +5417,7 @@ static int show_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr)) /* active object is armature in posemode, poll checked */ static int pose_reveal_exec(bContext *C, wmOperator *UNUSED(op)) { - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); bArmature *arm= ob->data; bone_looper(ob, arm->bonebase.first, NULL, show_pose_bone_cb); @@ -5447,7 +5447,7 @@ void POSE_OT_reveal(wmOperatorType *ot) static int bone_unique_check(void *arg, const char *name) { - return get_named_bone((bArmature *)arg, name) != NULL; + return BKE_armature_find_bone_name((bArmature *)arg, name) != NULL; } static void unique_bone_name(bArmature *arm, char *name) @@ -5509,7 +5509,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n else return; } else { - Bone *bone= get_named_bone(arm, oldname); + Bone *bone= BKE_armature_find_bone_name(arm, oldname); if (bone) { unique_bone_name(arm, newname); @@ -5528,7 +5528,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n /* Rename the pose channel, if it exists */ if (ob->pose) { - bPoseChannel *pchan = get_pose_channel(ob->pose, oldname); + bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, oldname); if (pchan) { BLI_strncpy(pchan->name, newname, MAXBONENAME); @@ -5932,7 +5932,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg) ED_armature_edit_free(obedit); } - dst = add_object(scene, OB_ARMATURE); + dst = BKE_object_add(scene, OB_ARMATURE); ED_object_base_init_transform(NULL, scene->basact, NULL, NULL); // XXX NULL is C, loc, rot obedit= scene->basact->object; @@ -5941,7 +5941,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg) mat4_to_eul(dst->rot, src->obmat); mat4_to_size(dst->size, src->obmat); - where_is_object(scene, obedit); + BKE_object_where_is_calc(scene, obedit); ED_armature_to_edit(obedit); diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c index 40dc0a7cd36..f33dce00f8d 100644 --- a/source/blender/editors/armature/poseSlide.c +++ b/source/blender/editors/armature/poseSlide.c @@ -130,7 +130,7 @@ static int pose_slide_init (bContext *C, wmOperator *op, short mode) /* get info from context */ pso->scene= CTX_data_scene(C); - pso->ob= object_pose_armature_get(CTX_data_active_object(C)); + pso->ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); pso->arm= (pso->ob)? pso->ob->data : NULL; pso->sa= CTX_wm_area(C); /* only really needed when doing modal() */ pso->ar= CTX_wm_region(C); /* only really needed when doing modal() */ @@ -1165,7 +1165,7 @@ static void pose_propagate_fcurve (wmOperator *op, Object *ob, FCurve *fcu, static int pose_propagate_exec (bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); bAction *act= (ob && ob->adt)? ob->adt->action : NULL; ListBase pflinks = {NULL, NULL}; diff --git a/source/blender/editors/armature/poseUtils.c b/source/blender/editors/armature/poseUtils.c index 3c855ff96e6..3b613a6d25c 100644 --- a/source/blender/editors/armature/poseUtils.c +++ b/source/blender/editors/armature/poseUtils.c @@ -189,7 +189,7 @@ void poseAnim_mapping_refresh(bContext *C, Scene *scene, Object *ob) if ((arm->flag & ARM_DELAYDEFORM)==0) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); /* sets recalc flags */ else - where_is_pose(scene, ob); + BKE_pose_where_is(scene, ob); /* note, notifier might evolve */ WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob); diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 8791a345489..f180f735294 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -174,7 +174,7 @@ static Object *get_poselib_object (bContext *C) if (sa && (sa->spacetype == SPACE_BUTS)) return ED_object_context(C); else - return object_pose_armature_get(CTX_data_active_object(C)); + return BKE_object_pose_armature_get(CTX_data_active_object(C)); } /* Poll callback for operators that require existing PoseLib data (with poses) to work */ @@ -650,7 +650,7 @@ static int poselib_rename_invoke (bContext *C, wmOperator *op, wmEvent *evt) static int poselib_rename_exec (bContext *C, wmOperator *op) { - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); bAction *act= (ob) ? ob->poselib : NULL; TimeMarker *marker; char newname[64]; @@ -786,7 +786,7 @@ static void poselib_backup_posecopy (tPoseLib_PreviewData *pld) /* for each posechannel that has an actionchannel in */ for (agrp= pld->act->groups.first; agrp; agrp= agrp->next) { /* try to find posechannel */ - pchan= get_pose_channel(pld->pose, agrp->name); + pchan= BKE_pose_channel_find_name(pld->pose, agrp->name); /* backup data if available */ if (pchan) { @@ -885,7 +885,7 @@ static void poselib_apply_pose (tPoseLib_PreviewData *pld) /* check if group has any keyframes */ if (ANIM_animchanneldata_keyframes_loop(&ked, NULL, agrp, ALE_GROUP, NULL, group_ok_cb, NULL)) { /* has keyframe on this frame, so try to get a PoseChannel with this name */ - pchan= get_pose_channel(pose, agrp->name); + pchan= BKE_pose_channel_find_name(pose, agrp->name); if (pchan) { short ok= 0; @@ -927,7 +927,7 @@ static void poselib_keytag_pose (bContext *C, Scene *scene, tPoseLib_PreviewData /* start tagging/keying */ for (agrp= act->groups.first; agrp; agrp= agrp->next) { /* only for selected bones unless there aren't any selected, in which case all are included */ - pchan= get_pose_channel(pose, agrp->name); + pchan= BKE_pose_channel_find_name(pose, agrp->name); if (pchan) { if ( (pld->selcount == 0) || ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED)) ) { @@ -987,7 +987,7 @@ static void poselib_preview_apply (bContext *C, wmOperator *op) if ((pld->arm->flag & ARM_DELAYDEFORM)==0) DAG_id_tag_update(&pld->ob->id, OB_RECALC_DATA); /* sets recalc flags */ else - where_is_pose(pld->scene, pld->ob); + BKE_pose_where_is(pld->scene, pld->ob); } /* do header print - if interactively previewing */ @@ -1495,7 +1495,7 @@ static void poselib_preview_cleanup (bContext *C, wmOperator *op) if ((arm->flag & ARM_DELAYDEFORM)==0) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); /* sets recalc flags */ else - where_is_pose(scene, ob); + BKE_pose_where_is(scene, ob); } else if (pld->state == PL_PREVIEW_CONFIRM) { @@ -1514,7 +1514,7 @@ static void poselib_preview_cleanup (bContext *C, wmOperator *op) //remake_action_ipos(ob->action); } else - where_is_pose(scene, ob); + BKE_pose_where_is(scene, ob); } /* free memory used for backups and searching */ diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 8a2af14e6f3..15d2d32c073 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -164,7 +164,7 @@ static int pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan, int level) } } for (bone= pchan->bone->childbase.first; bone; bone= bone->next) { - pchan= get_pose_channel(ob->pose, bone->name); + pchan= BKE_pose_channel_find_name(ob->pose, bone->name); if (pchan && pose_channel_in_IK_chain(ob, pchan, level + 1)) return 1; } @@ -200,7 +200,7 @@ void ED_pose_recalculate_paths(Scene *scene, Object *ob) /* show popup to determine settings */ static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - Object *ob = object_pose_armature_get(CTX_data_active_object(C)); + Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); if (ELEM(NULL, ob, ob->pose)) return OPERATOR_CANCELLED; @@ -227,7 +227,7 @@ static int pose_calculate_paths_invoke(bContext *C, wmOperator *op, wmEvent *UNU */ static int pose_calculate_paths_exec(bContext *C, wmOperator *op) { - Object *ob = object_pose_armature_get(CTX_data_active_object(C)); + Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); Scene *scene= CTX_data_scene(C); if (ELEM(NULL, ob, ob->pose)) @@ -320,7 +320,7 @@ static void ED_pose_clear_paths(Object *ob) /* operator callback for this */ static int pose_clear_paths_exec (bContext *C, wmOperator *UNUSED(op)) { - Object *ob = object_pose_armature_get(CTX_data_active_object(C)); + Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); /* only continue if there's an object */ if (ELEM(NULL, ob, ob->pose)) @@ -354,7 +354,7 @@ void POSE_OT_paths_clear(wmOperatorType *ot) static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op)) { - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); bConstraint *con; int found= 0; @@ -371,7 +371,7 @@ static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op for (ct= targets.first; ct; ct= ct->next) { if ((ct->tar == ob) && (ct->subtarget[0])) { - bPoseChannel *pchanc= get_pose_channel(ob->pose, ct->subtarget); + bPoseChannel *pchanc= BKE_pose_channel_find_name(ob->pose, ct->subtarget); if ((pchanc) && !(pchanc->bone->flag & BONE_UNSELECTABLE)) { pchanc->bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL; found= 1; @@ -414,7 +414,7 @@ void POSE_OT_select_constraint_target(wmOperatorType *ot) static int pose_select_hierarchy_exec(bContext *C, wmOperator *op) { - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); bArmature *arm= ob->data; Bone *curbone, *pabone, *chbone; int direction = RNA_enum_get(op->ptr, "direction"); @@ -650,7 +650,7 @@ static int pose_select_same_keyingset(bContext *C, Object *ob, short extend) char *boneName = BLI_getQuotedStr(ksp->rna_path, "bones["); if (boneName) { - bPoseChannel *pchan = get_pose_channel(pose, boneName); + bPoseChannel *pchan = BKE_pose_channel_find_name(pose, boneName); if (pchan) { /* select if bone is visible and can be affected */ @@ -674,7 +674,7 @@ static int pose_select_same_keyingset(bContext *C, Object *ob, short extend) static int pose_select_grouped_exec (bContext *C, wmOperator *op) { - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); short extend= RNA_boolean_get(op->ptr, "extend"); short changed = 0; @@ -741,7 +741,7 @@ void POSE_OT_select_grouped(wmOperatorType *ot) static int pose_bone_flip_active_exec (bContext *C, wmOperator *UNUSED(op)) { Object *ob_act= CTX_data_active_object(C); - Object *ob= object_pose_armature_get(ob_act); + Object *ob= BKE_object_pose_armature_get(ob_act); if (ob && (ob->mode & OB_MODE_POSE)) { bArmature *arm= ob->data; @@ -751,7 +751,7 @@ static int pose_bone_flip_active_exec (bContext *C, wmOperator *UNUSED(op)) char name[MAXBONENAME]; flip_side_name(name, arm->act_bone->name, TRUE); - pchanf= get_pose_channel(ob->pose, name); + pchanf= BKE_pose_channel_find_name(ob->pose, name); if (pchanf && pchanf->bone != arm->act_bone) { arm->act_bone->flag &= ~BONE_SELECTED; pchanf->bone->flag |= BONE_SELECTED; @@ -805,7 +805,7 @@ static void pose_copy_menu(Scene *scene) if (ELEM(NULL, ob, ob->pose)) return; if ((ob==obedit) || (ob->mode & OB_MODE_POSE)==0) return; - pchan= get_active_posechannel(ob); + pchan= BKE_pose_channel_active(ob); if (pchan==NULL) return; pchanact= pchan; @@ -891,13 +891,13 @@ static void pose_copy_menu(Scene *scene) pchan->custom = pchanact->custom; break; case 9: /* Visual Location */ - armature_loc_pose_to_bone(pchan, pchanact->pose_mat[3], pchan->loc); + BKE_armature_loc_pose_to_bone(pchan, pchanact->pose_mat[3], pchan->loc); break; case 10: /* Visual Rotation */ { float delta_mat[4][4]; - armature_mat_pose_to_bone(pchan, pchanact->pose_mat, delta_mat); + BKE_armature_mat_pose_to_bone(pchan, pchanact->pose_mat, delta_mat); if (pchan->rotmode == ROT_MODE_AXISANGLE) { float tmp_quat[4]; @@ -916,7 +916,7 @@ static void pose_copy_menu(Scene *scene) { float delta_mat[4][4], size[4]; - armature_mat_pose_to_bone(pchan, pchanact->pose_mat, delta_mat); + BKE_armature_mat_pose_to_bone(pchan, pchanact->pose_mat, delta_mat); mat4_to_size(size, delta_mat); copy_v3_v3(pchan->size, size); } @@ -978,7 +978,7 @@ static void pose_copy_menu(Scene *scene) } } BLI_freelistN(&const_copy); - update_pose_constraint_flags(ob->pose); /* we could work out the flags but its simpler to do this */ + BKE_pose_update_constraint_flags(ob->pose); /* we could work out the flags but its simpler to do this */ if (ob->pose) ob->pose->flag |= POSE_RECALC; @@ -1059,7 +1059,7 @@ static bPoseChannel *pose_bone_do_paste (Object *ob, bPoseChannel *chan, short s * 1) channel exists - poses are not meant to add random channels to anymore * 2) if selection-masking is on, channel is selected - only selected bones get pasted on, allowing making both sides symmetrical */ - pchan= get_pose_channel(ob->pose, name); + pchan= BKE_pose_channel_find_name(ob->pose, name); if (selOnly) paste_ok= ((pchan) && (pchan->bone->flag & BONE_SELECTED)); @@ -1163,7 +1163,7 @@ static bPoseChannel *pose_bone_do_paste (Object *ob, bPoseChannel *chan, short s static int pose_copy_exec (bContext *C, wmOperator *op) { - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); /* sanity checking */ if (ELEM(NULL, ob, ob->pose)) { @@ -1176,7 +1176,7 @@ static int pose_copy_exec (bContext *C, wmOperator *op) /* sets chan->flag to POSE_KEY if bone selected, then copy those bones to the buffer */ set_pose_keys(ob); - copy_pose(&g_posebuf, ob->pose, 0); + BKE_pose_copy_data(&g_posebuf, ob->pose, 0); return OPERATOR_FINISHED; @@ -1201,7 +1201,7 @@ void POSE_OT_copy(wmOperatorType *ot) static int pose_paste_exec (bContext *C, wmOperator *op) { - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); Scene *scene= CTX_data_scene(C); bPoseChannel *chan; int flip= RNA_boolean_get(op->ptr, "flipped"); @@ -1284,14 +1284,14 @@ static int pose_group_add_exec (bContext *C, wmOperator *UNUSED(op)) if (sa->spacetype == SPACE_BUTS) ob= ED_object_context(C); else - ob= object_pose_armature_get(CTX_data_active_object(C)); + ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); /* only continue if there's an object */ if (ob == NULL) return OPERATOR_CANCELLED; /* for now, just call the API function for this */ - pose_add_group(ob); + BKE_pose_add_group(ob); /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob); @@ -1324,14 +1324,14 @@ static int pose_group_remove_exec (bContext *C, wmOperator *UNUSED(op)) if (sa->spacetype == SPACE_BUTS) ob= ED_object_context(C); else - ob= object_pose_armature_get(CTX_data_active_object(C)); + ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); /* only continue if there's an object */ if (ob == NULL) return OPERATOR_CANCELLED; /* for now, just call the API function for this */ - pose_remove_group(ob); + BKE_pose_remove_group(ob); /* notifiers for updates */ WM_event_add_notifier(C, NC_OBJECT|ND_POSE, ob); @@ -1372,7 +1372,7 @@ static int pose_groups_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED if (sa->spacetype == SPACE_BUTS) ob= ED_object_context(C); else - ob= object_pose_armature_get(CTX_data_active_object(C)); + ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); /* only continue if there's an object, and a pose there too */ if (ELEM(NULL, ob, ob->pose)) @@ -1421,7 +1421,7 @@ static int pose_group_assign_exec (bContext *C, wmOperator *op) if (sa->spacetype == SPACE_BUTS) ob= ED_object_context(C); else - ob= object_pose_armature_get(CTX_data_active_object(C)); + ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); /* only continue if there's an object, and a pose there too */ if (ELEM(NULL, ob, ob->pose)) @@ -1434,7 +1434,7 @@ static int pose_group_assign_exec (bContext *C, wmOperator *op) */ pose->active_group= RNA_int_get(op->ptr, "type"); if (pose->active_group == 0) - pose_add_group(ob); + BKE_pose_add_group(ob); /* add selected bones to group then */ CTX_DATA_BEGIN (C, bPoseChannel*, pchan, selected_pose_bones) @@ -1484,7 +1484,7 @@ static int pose_group_unassign_exec (bContext *C, wmOperator *UNUSED(op)) if (sa->spacetype == SPACE_BUTS) ob= ED_object_context(C); else - ob= object_pose_armature_get(CTX_data_active_object(C)); + ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); /* only continue if there's an object, and a pose there too */ if (ELEM(NULL, ob, ob->pose)) @@ -1719,7 +1719,7 @@ static int pose_group_select_exec (bContext *C, wmOperator *UNUSED(op)) if (sa->spacetype == SPACE_BUTS) ob= ED_object_context(C); else - ob= object_pose_armature_get(CTX_data_active_object(C)); + ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); /* only continue if there's an object, and a pose there too */ if (ELEM(NULL, ob, ob->pose)) @@ -1757,7 +1757,7 @@ static int pose_group_deselect_exec (bContext *C, wmOperator *UNUSED(op)) if (sa->spacetype == SPACE_BUTS) ob= ED_object_context(C); else - ob= object_pose_armature_get(CTX_data_active_object(C)); + ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); /* only continue if there's an object, and a pose there too */ if (ELEM(NULL, ob, ob->pose)) @@ -1790,7 +1790,7 @@ void POSE_OT_group_deselect(wmOperatorType *ot) static int pose_flip_names_exec (bContext *C, wmOperator *UNUSED(op)) { - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); bArmature *arm; /* paranoia checks */ @@ -1835,7 +1835,7 @@ void POSE_OT_flip_names(wmOperatorType *ot) static int pose_autoside_names_exec (bContext *C, wmOperator *op) { - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); bArmature *arm; char newname[MAXBONENAME]; short axis= RNA_enum_get(op->ptr, "axis"); @@ -1939,7 +1939,7 @@ static int pose_armature_layers_showall_poll (bContext *C) static int pose_armature_layers_showall_exec (bContext *C, wmOperator *op) { - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); bArmature *arm = (ob)? ob->data : NULL; PointerRNA ptr; int maxLayers = (RNA_boolean_get(op->ptr, "all"))? 32 : 16; @@ -1991,7 +1991,7 @@ void ARMATURE_OT_layers_show_all(wmOperatorType *ot) /* Present a popup to get the layers that should be used */ static int pose_armature_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt) { - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); bArmature *arm= (ob)? ob->data : NULL; PointerRNA ptr; int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ @@ -2012,7 +2012,7 @@ static int pose_armature_layers_invoke (bContext *C, wmOperator *op, wmEvent *ev /* Set the visible layers for the active armature (edit and pose modes) */ static int pose_armature_layers_exec (bContext *C, wmOperator *op) { - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); PointerRNA ptr; int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ @@ -2102,7 +2102,7 @@ static int pose_bone_layers_invoke (bContext *C, wmOperator *op, wmEvent *evt) /* Set the visible layers for the active armature (edit and pose modes) */ static int pose_bone_layers_exec (bContext *C, wmOperator *op) { - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); PointerRNA ptr; int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ @@ -2225,7 +2225,7 @@ void ARMATURE_OT_bone_layers(wmOperatorType *ot) static int pose_flip_quats_exec (bContext *C, wmOperator *UNUSED(op)) { Scene *scene= CTX_data_scene(C); - Object *ob= object_pose_armature_get(CTX_data_active_object(C)); + Object *ob= BKE_object_pose_armature_get(CTX_data_active_object(C)); KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOC_ROT_SCALE_ID); /* loop through all selected pchans, flipping and keying (as needed) */ @@ -2281,7 +2281,7 @@ static int pose_clear_user_transforms_exec (bContext *C, wmOperator *UNUSED(op)) bPoseChannel *pchan; /* execute animation step for current frame using a dummy copy of the pose */ - copy_pose(&dummyPose, ob->pose, 0); + BKE_pose_copy_data(&dummyPose, ob->pose, 0); BLI_strncpy(workob.id.name, "OB<ClearTfmWorkOb>", sizeof(workob.id.name)); workob.type = OB_ARMATURE; @@ -2314,7 +2314,7 @@ static int pose_clear_user_transforms_exec (bContext *C, wmOperator *UNUSED(op)) /* no animation, so just reset whole pose to rest pose * (cannot just restore for selected though) */ - rest_pose(ob->pose); + BKE_pose_rest(ob->pose); } /* notifiers and updates */ diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index 94ec7c7ce93..dea7ccb161d 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -140,15 +140,15 @@ void ED_operatormacros_curve(void) wmOperatorType *ot; wmOperatorTypeMacro *otmacro; - ot = WM_operatortype_append_macro("CURVE_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); - ot->description = "Duplicate curve and move"; + ot = WM_operatortype_append_macro("CURVE_OT_duplicate_move", "Add Duplicate", "Duplicate curve and move", + OPTYPE_UNDO|OPTYPE_REGISTER); WM_operatortype_macro_define(ot, "CURVE_OT_duplicate"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); RNA_boolean_set(otmacro->ptr, "mirror", FALSE); - ot = WM_operatortype_append_macro("CURVE_OT_extrude_move", "Extrude Curve and Move", OPTYPE_UNDO|OPTYPE_REGISTER); - ot->description = "Extrude curve and move result"; + ot = WM_operatortype_append_macro("CURVE_OT_extrude_move", "Extrude Curve and Move", + "Extrude curve and move result", OPTYPE_UNDO|OPTYPE_REGISTER); WM_operatortype_macro_define(ot, "CURVE_OT_extrude"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index cca5dd7a37b..51be7dcc600 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -275,7 +275,7 @@ static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int re if (mode == FO_EDIT) update_string(cu); - BKE_text_to_curve(bmain, scene, obedit, mode); + BKE_vfont_to_curve(bmain, scene, obedit, mode); if (recalc) DAG_id_tag_update(obedit->data, 0); @@ -437,19 +437,19 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, float int nchars = 0, a; float rot[3] = {0.f, 0.f, 0.f}; - obedit= add_object(scene, OB_FONT); + obedit= BKE_object_add(scene, OB_FONT); base= scene->basact; ED_object_base_init_transform(C, base, NULL, rot); /* seems to assume view align ? TODO - look into this, could be an operator option */ - where_is_object(scene, obedit); + BKE_object_where_is_calc(scene, obedit); obedit->loc[0] += offset[0]; obedit->loc[1] += offset[1]; obedit->loc[2] += offset[2]; cu= obedit->data; - cu->vfont= get_builtin_font(); + cu->vfont= BKE_vfont_builtin_get(); cu->vfont->id.us++; for (tmp=firstline, a=0; cu->len<MAXTEXT && a<totline; tmp=tmp->next, a++) @@ -556,7 +556,7 @@ static int kill_selection(Object *obedit, int ins) /* 1 == new character */ int offset = 0; int getfrom; - direction = BKE_font_getselection(obedit, &selstart, &selend); + direction = BKE_vfont_select_get(obedit, &selstart, &selend); if (direction) { int size; if (ins) offset = 1; @@ -593,7 +593,7 @@ static int set_style(bContext *C, const int style, const int clear) EditFont *ef= cu->editfont; int i, selstart, selend; - if (!BKE_font_getselection(obedit, &selstart, &selend)) + if (!BKE_vfont_select_get(obedit, &selstart, &selend)) return OPERATOR_CANCELLED; for (i=selstart; i<=selend; i++) { @@ -644,7 +644,7 @@ static int toggle_style_exec(bContext *C, wmOperator *op) Curve *cu= obedit->data; int style, clear, selstart, selend; - if (!BKE_font_getselection(obedit, &selstart, &selend)) + if (!BKE_vfont_select_get(obedit, &selstart, &selend)) return OPERATOR_CANCELLED; style= RNA_enum_get(op->ptr, "style"); @@ -679,7 +679,7 @@ static void copy_selection(Object *obedit) { int selstart, selend; - if (BKE_font_getselection(obedit, &selstart, &selend)) { + if (BKE_vfont_select_get(obedit, &selstart, &selend)) { Curve *cu= obedit->data; EditFont *ef= cu->editfont; @@ -718,7 +718,7 @@ static int cut_text_exec(bContext *C, wmOperator *UNUSED(op)) Object *obedit= CTX_data_edit_object(C); int selstart, selend; - if (!BKE_font_getselection(obedit, &selstart, &selend)) + if (!BKE_vfont_select_get(obedit, &selstart, &selend)) return OPERATOR_CANCELLED; copy_selection(obedit); @@ -901,7 +901,7 @@ static int move_cursor(bContext *C, int type, int select) struct Main *bmain= CTX_data_main(C); cu->selstart = cu->selend = 0; update_string(cu); - BKE_text_to_curve(bmain, scene, obedit, FO_SELCHANGE); + BKE_vfont_to_curve(bmain, scene, obedit, FO_SELCHANGE); } } @@ -1121,7 +1121,7 @@ static int delete_exec(bContext *C, wmOperator *op) if (cu->len == 0) return OPERATOR_CANCELLED; - if (BKE_font_getselection(obedit, &selstart, &selend)) { + if (BKE_vfont_select_get(obedit, &selstart, &selend)) { if (type == DEL_NEXT_SEL) type= DEL_SELECTION; else if (type == DEL_PREV_SEL) type= DEL_SELECTION; } @@ -1634,7 +1634,7 @@ static int font_open_exec(bContext *C, wmOperator *op) char filepath[FILE_MAX]; RNA_string_get(op->ptr, "filepath", filepath); - font= load_vfont(bmain, filepath); + font= BKE_vfont_load(bmain, filepath); if (!font) { if (op->customdata) MEM_freeN(op->customdata); @@ -1725,7 +1725,7 @@ static int font_unlink_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - builtin_font = get_builtin_font(); + builtin_font = BKE_vfont_builtin_get(); RNA_id_pointer_create(&builtin_font->id, &idptr); RNA_property_pointer_set(&pprop.ptr, pprop.prop, idptr); diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 34a95cd89bf..990b1acd321 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -568,7 +568,7 @@ static void gp_layer_to_curve (bContext *C, bGPdata *gpd, bGPDlayer *gpl, short /* init the curve object (remove rotation and get curve data from it) * - must clear transforms set on object, as those skew our results */ - ob= add_object(scene, OB_CURVE); + ob= BKE_object_add(scene, OB_CURVE); zero_v3(ob->loc); zero_v3(ob->rot); cu= ob->data; diff --git a/source/blender/editors/gpencil/gpencil_undo.c b/source/blender/editors/gpencil/gpencil_undo.c index 36624b88a9f..916b4fff561 100644 --- a/source/blender/editors/gpencil/gpencil_undo.c +++ b/source/blender/editors/gpencil/gpencil_undo.c @@ -131,7 +131,7 @@ void gpencil_undo_push(bGPdata *gpd) while (undo_node) { bGPundonode *next_node= undo_node->next; - free_gpencil_data(undo_node->gpd); + BKE_gpencil_free(undo_node->gpd); MEM_freeN(undo_node->gpd); BLI_freelinkN(&undo_nodes, undo_node); @@ -154,7 +154,7 @@ void gpencil_undo_finish(void) bGPundonode *undo_node= undo_nodes.first; while (undo_node) { - free_gpencil_data(undo_node->gpd); + BKE_gpencil_free(undo_node->gpd); MEM_freeN(undo_node->gpd); undo_node= undo_node->next; diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index afb14191797..490a8830d3a 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -190,7 +190,7 @@ int ANIM_apply_keyingset(struct bContext *C, ListBase *dsources, struct bAction struct KeyingSet *ANIM_builtin_keyingset_get_named(struct KeyingSet *prevKS, const char name[]); /* Find KeyingSet type info given a name */ -KeyingSetInfo *ANIM_keyingset_info_find_named(const char name[]); +KeyingSetInfo *ANIM_keyingset_info_find_name(const char name[]); /* for RNA type registrations... */ void ANIM_keyingset_info_register(KeyingSetInfo *ksi); @@ -292,7 +292,7 @@ short fcurve_frame_has_keyframe(struct FCurve *fcu, float frame, short filter); * Checks whether a keyframe exists for the given ID-block one the given frame. * - It is recommended to call this method over the other keyframe-checkers directly, * in case some detail of the implementation changes... - * - frame: the value of this is quite often result of BKE_curframe() + * - frame: the value of this is quite often result of BKE_scene_frame_get() */ short id_frame_has_keyframe(struct ID *id, float frame, short filter); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 4b614085f8e..e3759ef5fde 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -304,6 +304,8 @@ void ED_view3d_camera_lock_init(struct View3D *v3d, struct RegionView3D *rv3d); /* copy the view to the camera, return TRUE if */ int ED_view3d_camera_lock_sync(struct View3D *v3d, struct RegionView3D *rv3d); +void ED_view3D_lock_clear(struct View3D *v3d); + struct BGpic *ED_view3D_background_image_new(struct View3D *v3d); void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic); void ED_view3D_background_image_clear(struct View3D *v3d); diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 93546d74c1b..aaca5181531 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -507,7 +507,7 @@ static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op)) char *str; /* create new text-block to write to */ - txt = add_empty_text("Recent Reports"); + txt = BKE_text_add("Recent Reports"); /* convert entire list to a display string, and add this to the text-block * - if commandline debug option enabled, show debug reports too @@ -516,7 +516,7 @@ static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op)) str = BKE_reports_string(reports, (G.debug & G_DEBUG) ? RPT_DEBUG : RPT_INFO); if (str) { - write_text(txt, str); + BKE_text_write(txt, str); MEM_freeN(str); return OPERATOR_FINISHED; @@ -652,7 +652,7 @@ static int editsource_text_edit(bContext *C, wmOperator *op, } if (text == NULL) { - text = add_text(filepath, bmain->name); + text = BKE_text_load(filepath, bmain->name); } if (text == NULL) { diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index bc6753be557..1c0a98eda6e 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -835,7 +835,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, if (!ELEM(md->type, eModifierType_Collision, eModifierType_Surface)) { /* only here obdata, the rest of modifiers is ob level */ - uiBlockSetButLock(block, object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE); + uiBlockSetButLock(block, BKE_object_obdata_is_libdata(ob), ERROR_LIBDATA_MESSAGE); if (md->type == eModifierType_ParticleSystem) { ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys; @@ -953,7 +953,7 @@ static void do_constraint_panels(bContext *C, void *ob_pt, int event) // if there are problems because of this, then rna needs changed update functions. // // object_test_constraints(ob); - // if (ob->pose) update_pose_constraint_flags(ob->pose); + // if (ob->pose) BKE_pose_update_constraint_flags(ob->pose); if (ob->type == OB_ARMATURE) DAG_id_tag_update(&ob->id, OB_RECALC_DATA | OB_RECALC_OB); else DAG_id_tag_update(&ob->id, OB_RECALC_OB); @@ -969,7 +969,7 @@ static void constraint_active_func(bContext *UNUSED(C), void *ob_v, void *con_v) /* draw panel showing settings for a constraint */ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) { - bPoseChannel *pchan = get_active_posechannel(ob); + bPoseChannel *pchan = BKE_pose_channel_active(ob); bConstraintTypeInfo *cti; uiBlock *block; uiLayout *result = NULL, *col, *box, *row; @@ -2150,7 +2150,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe uiItemL(sub, name, icon); ma = give_current_material(ob, index + 1); - if (ma && !scene_use_new_shading_nodes(scene)) { + if (ma && !BKE_scene_use_new_shading_nodes(scene)) { manode = give_node_material(ma); if (manode) { char str[MAX_ID_NAME + 12]; diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index cfc9e11879e..5f6384d6b24 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -67,7 +67,7 @@ * use in object mode when selecting faces (while painting) */ void paintface_flush_flags(Object *ob) { - Mesh *me = get_mesh(ob); + Mesh *me = BKE_mesh_from_object(ob); DerivedMesh *dm = ob->derivedFinal; MPoly *polys, *mp_orig; MFace *faces; @@ -166,7 +166,7 @@ void paintface_hide(Object *ob, const int unselected) MPoly *mpoly; int a; - me = get_mesh(ob); + me = BKE_mesh_from_object(ob); if (me == NULL || me->totpoly == 0) return; mpoly = me->mpoly; @@ -195,7 +195,7 @@ void paintface_reveal(Object *ob) MPoly *mpoly; int a; - me = get_mesh(ob); + me = BKE_mesh_from_object(ob); if (me == NULL || me->totpoly == 0) return; mpoly = me->mpoly; @@ -325,7 +325,7 @@ void paintface_select_linked(bContext *UNUSED(C), Object *ob, int UNUSED(mval[2] Mesh *me; unsigned int index = 0; - me = get_mesh(ob); + me = BKE_mesh_from_object(ob); if (me == NULL || me->totpoly == 0) return; if (mode == 0 || mode == 1) { @@ -347,7 +347,7 @@ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags) MPoly *mpoly; int a; - me = get_mesh(ob); + me = BKE_mesh_from_object(ob); if (me == NULL) return; if (action == SEL_INVERT) { @@ -410,7 +410,7 @@ int paintface_minmax(Object *ob, float r_min[3], float r_max[3]) int a, b, ok = FALSE; float vec[3], bmat[3][3]; - me = get_mesh(ob); + me = BKE_mesh_from_object(ob); if (!me || !me->mtpoly) return ok; copy_m3_m4(bmat, ob->obmat); @@ -459,7 +459,7 @@ void seam_mark_clear_tface(Scene *scene, short mode) MEdge *med; int a, b; - me = get_mesh(OBACT); + me = BKE_mesh_from_object(OBACT); if (me == 0 || me->totpoly == 0) return; if (mode == 0) @@ -516,7 +516,7 @@ int paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], in unsigned int a, index; /* Get the face under the cursor */ - me = get_mesh(ob); + me = BKE_mesh_from_object(ob); if (!facesel_face_pick(C, me, ob, mval, &index, 1)) return 0; @@ -567,7 +567,7 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, int select, int extend) int sx = rect->xmax - rect->xmin + 1; int sy = rect->ymax - rect->ymin + 1; - me = get_mesh(ob); + me = BKE_mesh_from_object(ob); if (me == NULL || me->totpoly == 0 || sx * sy <= 0) return OPERATOR_CANCELLED; @@ -629,7 +629,7 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, int select, int extend) * use in object mode when selecting vertices (while painting) */ void paintvert_flush_flags(Object *ob) { - Mesh *me = get_mesh(ob); + Mesh *me = BKE_mesh_from_object(ob); DerivedMesh *dm = ob->derivedFinal; MVert *dm_mvert, *dm_mv; int *index_array = NULL; @@ -668,7 +668,7 @@ void paintvert_deselect_all_visible(Object *ob, int action, short flush_flags) MVert *mvert; int a; - me = get_mesh(ob); + me = BKE_mesh_from_object(ob); if (me == NULL) return; if (action == SEL_INVERT) { diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 6f33fcd05b7..1c04a7ff32e 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1877,11 +1877,11 @@ static void knifenet_fill_faces(KnifeTool_OpData *kcd) if (face_nets[i].first) BMO_elem_flag_enable(bm, f, DEL); - BLI_begin_edgefill(&sf_ctx); + BLI_scanfill_begin(&sf_ctx); for (entry = face_nets[i].first; entry; entry = entry->next) { if (!BLI_smallhash_haskey(hash, (intptr_t)entry->kfe->v1)) { - eve = BLI_addfillvert(&sf_ctx, entry->kfe->v1->v->co); + eve = BLI_scanfill_vert_add(&sf_ctx, entry->kfe->v1->v->co); eve->poly_nr = 0; rnd_offset_co(eve->co, rndscale); eve->tmp.p = entry->kfe->v1->v; @@ -1889,7 +1889,7 @@ static void knifenet_fill_faces(KnifeTool_OpData *kcd) } if (!BLI_smallhash_haskey(hash, (intptr_t)entry->kfe->v2)) { - eve = BLI_addfillvert(&sf_ctx, entry->kfe->v2->v->co); + eve = BLI_scanfill_vert_add(&sf_ctx, entry->kfe->v2->v->co); eve->poly_nr = 0; rnd_offset_co(eve->co, rndscale); eve->tmp.p = entry->kfe->v2->v; @@ -1911,7 +1911,7 @@ static void knifenet_fill_faces(KnifeTool_OpData *kcd) if (eve->poly_nr > 1 && lasteve->poly_nr > 1) { ScanFillEdge *eed; - eed = BLI_addfilledge(&sf_ctx, lasteve, eve); + eed = BLI_scanfill_edge_add(&sf_ctx, lasteve, eve); if (entry->kfe->oe) eed->f = SF_EDGE_BOUNDARY; /* mark as original boundary edge */ @@ -1926,7 +1926,7 @@ static void knifenet_fill_faces(KnifeTool_OpData *kcd) } } - BLI_edgefill(&sf_ctx, FALSE); + BLI_scanfill_calc(&sf_ctx, FALSE); for (efa = sf_ctx.fillfacebase.first; efa; efa = efa->next) { BMVert *v1 = efa->v3->tmp.p, *v2 = efa->v2->tmp.p, *v3 = efa->v1->tmp.p; @@ -1959,7 +1959,7 @@ static void knifenet_fill_faces(KnifeTool_OpData *kcd) } } - BLI_end_edgefill(&sf_ctx); + BLI_scanfill_end(&sf_ctx); BLI_smallhash_release(hash); } bm->elem_index_dirty |= BM_FACE; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 92f4d6f01d5..2052e2833da 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -483,7 +483,7 @@ static int edbm_extrude_mesh(Scene *scene, Object *obedit, BMEditMesh *em, wmOpe * automatically building this data if invalid. Or something. */ // DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - object_handle_update(scene, obedit); + BKE_object_handle_update(scene, obedit); /* individual faces? */ // BIF_TransformSetUndo("Extrude"); @@ -1249,6 +1249,7 @@ void MESH_OT_edge_split(wmOperatorType *ot) /* identifiers */ ot->name = "Edge Split"; ot->idname = "MESH_OT_edge_split"; + ot->description = "Split selected edges so that each neighbor face gets its own copy"; /* api callbacks */ ot->exec = edbm_edge_split_exec; @@ -3058,6 +3059,7 @@ void MESH_OT_beautify_fill(wmOperatorType *ot) /* identifiers */ ot->name = "Beautify Fill"; ot->idname = "MESH_OT_beautify_fill"; + ot->description = "Rearrange some faces to try to get less degenerated geometry"; /* api callbacks */ ot->exec = edbm_beautify_fill_exec; diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 2ebeb9ca224..75e220395db 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -545,11 +545,11 @@ static void free_undo(void *me_v) { Mesh *me = me_v; if (me->key) { - free_key(me->key); + BKE_key_free(me->key); MEM_freeN(me->key); } - free_mesh(me, FALSE); + BKE_mesh_free(me, FALSE); MEM_freeN(me); } diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index fb9b012a31a..d38c7e8da1e 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -556,11 +556,11 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event) char path[FILE_MAX]; RNA_string_get(op->ptr, "filepath", path); - ima = BKE_add_image_file(path); + ima = BKE_image_load_exists(path); } else { RNA_string_get(op->ptr, "name", name); - ima = (Image *)find_id("IM", name); + ima = (Image *)BKE_libblock_find_name(ID_IM, name); } if (!ima) { diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c index c234cf44aec..14d20d68455 100644 --- a/source/blender/editors/mesh/mesh_navmesh.c +++ b/source/blender/editors/mesh/mesh_navmesh.c @@ -316,7 +316,8 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, } else { obedit = base->object; - scene_select_base(scene, base); + BKE_scene_base_deselect_all(scene); + BKE_scene_base_select(scene, base); copy_v3_v3(obedit->loc, co); copy_v3_v3(obedit->rot, rot); } diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 1b87e7813db..e57285cca25 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -197,49 +197,49 @@ void ED_operatormacros_mesh(void) wmOperatorType *ot; wmOperatorTypeMacro *otmacro; - ot = WM_operatortype_append_macro("MESH_OT_loopcut_slide", "Loop Cut and Slide", OPTYPE_UNDO | OPTYPE_REGISTER); - ot->description = "Cut mesh loop and slide it"; + ot = WM_operatortype_append_macro("MESH_OT_loopcut_slide", "Loop Cut and Slide", "Cut mesh loop and slide it", + OPTYPE_UNDO | OPTYPE_REGISTER); WM_operatortype_macro_define(ot, "MESH_OT_loopcut"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide"); RNA_struct_idprops_unset(otmacro->ptr, "release_confirm"); - ot = WM_operatortype_append_macro("MESH_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO | OPTYPE_REGISTER); - ot->description = "Duplicate mesh and move"; + ot = WM_operatortype_append_macro("MESH_OT_duplicate_move", "Add Duplicate", "Duplicate mesh and move", + OPTYPE_UNDO | OPTYPE_REGISTER); WM_operatortype_macro_define(ot, "MESH_OT_duplicate"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); RNA_boolean_set(otmacro->ptr, "mirror", FALSE); - ot = WM_operatortype_append_macro("MESH_OT_rip_move", "Rip", OPTYPE_UNDO | OPTYPE_REGISTER); - ot->description = "Rip polygons and move the result"; + ot = WM_operatortype_append_macro("MESH_OT_rip_move", "Rip", "Rip polygons and move the result", + OPTYPE_UNDO | OPTYPE_REGISTER); WM_operatortype_macro_define(ot, "MESH_OT_rip"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); RNA_boolean_set(otmacro->ptr, "mirror", FALSE); - ot = WM_operatortype_append_macro("MESH_OT_extrude_region_move", "Extrude Region and Move", OPTYPE_UNDO | OPTYPE_REGISTER); - ot->description = "Extrude region and move result"; + ot = WM_operatortype_append_macro("MESH_OT_extrude_region_move", "Extrude Region and Move", + "Extrude region and move result", OPTYPE_UNDO | OPTYPE_REGISTER); otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_region"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); RNA_boolean_set(otmacro->ptr, "mirror", FALSE); - ot = WM_operatortype_append_macro("MESH_OT_extrude_faces_move", "Extrude Individual Faces and Move", OPTYPE_UNDO | OPTYPE_REGISTER); - ot->description = "Extrude faces and move result"; + ot = WM_operatortype_append_macro("MESH_OT_extrude_faces_move", "Extrude Individual Faces and Move", + "Extrude faces and move result", OPTYPE_UNDO | OPTYPE_REGISTER); otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_faces_indiv"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten"); RNA_enum_set(otmacro->ptr, "proportional", 0); RNA_boolean_set(otmacro->ptr, "mirror", FALSE); - ot = WM_operatortype_append_macro("MESH_OT_extrude_edges_move", "Extrude Only Edges and Move", OPTYPE_UNDO | OPTYPE_REGISTER); - ot->description = "Extrude edges and move result"; + ot = WM_operatortype_append_macro("MESH_OT_extrude_edges_move", "Extrude Only Edges and Move", + "Extrude edges and move result", OPTYPE_UNDO | OPTYPE_REGISTER); otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_edges_indiv"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); RNA_boolean_set(otmacro->ptr, "mirror", FALSE); - ot = WM_operatortype_append_macro("MESH_OT_extrude_vertices_move", "Extrude Only Vertices and Move", OPTYPE_UNDO | OPTYPE_REGISTER); - ot->description = "Extrude vertices and move result"; + ot = WM_operatortype_append_macro("MESH_OT_extrude_vertices_move", "Extrude Only Vertices and Move", + "Extrude vertices and move result", OPTYPE_UNDO | OPTYPE_REGISTER); otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_verts_indiv"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", 0); diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index e41807787f1..aa89eaa0c6d 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -182,7 +182,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) */ if (key) { /* make a duplicate copy that will only be used here... (must remember to free it!) */ - nkey = copy_key(key); + nkey = BKE_key_copy(key); /* for all keys in old block, clear data-arrays */ for (kb = key->block.first; kb; kb = kb->next) { @@ -524,13 +524,13 @@ int join_mesh_exec(bContext *C, wmOperator *op) #if 0 /* free it's ipo too - both are not actually freed from memory yet as ID-blocks */ if (nkey->ipo) { - free_ipo(nkey->ipo); + BKE_ipo_free(nkey->ipo); BLI_remlink(&bmain->ipo, nkey->ipo); MEM_freeN(nkey->ipo); } #endif - free_key(nkey); + BKE_key_free(nkey); BLI_remlink(&bmain->key, nkey); MEM_freeN(nkey); } diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 52d14b9d374..b9aff50d243 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -147,7 +147,7 @@ void ED_object_base_init_transform(bContext *C, Base *base, float *loc, float *r if (rot) copy_v3_v3(ob->rot, rot); - where_is_object(scene, ob); + BKE_object_where_is_calc(scene, ob); } /* uses context to figure out transform for primitive */ @@ -325,7 +325,7 @@ Object *ED_object_add_type(bContext *C, int type, float *loc, float *rot, ED_object_exit_editmode(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO); /* freedata, and undo */ /* deselects all, sets scene->basact */ - ob = add_object(scene, type); + ob = BKE_object_add(scene, type); BASACT->lay = ob->lay = layer; /* editor level activate, notifiers */ ED_base_object_activate(C, BASACT); @@ -733,7 +733,7 @@ static int object_lamp_add_exec(bContext *C, wmOperator *op) rename_id(&ob->id, get_lamp_defname(type)); rename_id(&la->id, get_lamp_defname(type)); - if (scene_use_new_shading_nodes(scene)) { + if (BKE_scene_use_new_shading_nodes(scene)) { ED_node_shader_default(scene, &la->id); la->use_nodes = 1; } @@ -891,7 +891,7 @@ void ED_base_object_free_and_unlink(Main *bmain, Scene *scene, Base *base) { DAG_id_type_tag(bmain, ID_OB); BLI_remlink(&scene->base, base); - free_libblock_us(&bmain->object, base->object); + BKE_libblock_free_us(&bmain->object, base->object); if (scene->basact == base) scene->basact = NULL; MEM_freeN(base); } @@ -923,7 +923,7 @@ static int object_delete_exec(bContext *C, wmOperator *op) for (scene_iter = bmain->scene.first; scene_iter; scene_iter = scene_iter->id.next) { if (scene_iter != scene && !(scene_iter->id.lib)) { - base_other = object_in_scene(base->object, scene_iter); + base_other = BKE_scene_base_find(scene_iter, base->object); if (base_other) { ED_base_object_free_and_unlink(bmain, scene_iter, base_other); } @@ -975,7 +975,7 @@ static void copy_object_set_idnew(bContext *C, int dupflag) /* XXX check object pointers */ CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { - object_relink(ob); + BKE_object_relink(ob); } CTX_DATA_END; @@ -993,7 +993,7 @@ static void copy_object_set_idnew(bContext *C, int dupflag) id = (ID *)ma->mtex[a]->tex; if (id) { ID_NEW_US(ma->mtex[a]->tex) - else ma->mtex[a]->tex = copy_texture(ma->mtex[a]->tex); + else ma->mtex[a]->tex = BKE_texture_copy(ma->mtex[a]->tex); id->us--; } } @@ -1073,7 +1073,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, for (dob = lb->first; dob; dob = dob->next) { Base *basen; - Object *ob = copy_object(dob->ob); + Object *ob = BKE_object_copy(dob->ob); /* font duplis can have a totcol without material, we get them from parent * should be implemented better... */ @@ -1097,7 +1097,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, ob->lay = base->lay; copy_m4_m4(ob->obmat, dob->mat); - object_apply_mat4(ob, ob->obmat, FALSE, FALSE); + BKE_object_apply_mat4(ob, ob->obmat, FALSE, FALSE); if (dupli_gh) BLI_ghash_insert(dupli_gh, dob, ob); @@ -1143,7 +1143,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, /* note, this may be the parent of other objects, but it should * still work out ok */ - object_apply_mat4(ob_dst, dob->mat, FALSE, TRUE); + BKE_object_apply_mat4(ob_dst, dob->mat, FALSE, TRUE); /* to set ob_dst->orig and in case theres any other discrepicies */ DAG_id_tag_update(&ob_dst->id, OB_RECALC_OB); @@ -1162,7 +1162,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base, /* similer to the code above, see comments */ invert_m4_m4(ob_dst->parentinv, dob->mat); - object_apply_mat4(ob_dst, dob->mat, FALSE, TRUE); + BKE_object_apply_mat4(ob_dst, dob->mat, FALSE, TRUE); DAG_id_tag_update(&ob_dst->id, OB_RECALC_OB); @@ -1244,7 +1244,7 @@ static void curvetomesh(Scene *scene, Object *ob) nurbs_to_mesh(ob); /* also does users */ if (ob->type == OB_MESH) - object_free_modifiers(ob); + BKE_object_free_modifiers(ob); } static int convert_poll(bContext *C) @@ -1265,7 +1265,7 @@ static Base *duplibase_for_convert(Scene *scene, Base *base, Object *ob) ob = base->object; } - obn = copy_object(ob); + obn = BKE_object_copy(ob); obn->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; basen = MEM_mallocN(sizeof(Base), "duplibase"); @@ -1325,7 +1325,7 @@ static int convert_exec(bContext *C, wmOperator *op) /* When 2 objects with linked data are selected, converting both * would keep modifiers on all but the converted object [#26003] */ if (ob->type == OB_MESH) { - object_free_modifiers(ob); /* after derivedmesh calls! */ + BKE_object_free_modifiers(ob); /* after derivedmesh calls! */ } } } @@ -1341,7 +1341,7 @@ static int convert_exec(bContext *C, wmOperator *op) me->id.us--; /* make a new copy of the mesh */ - newob->data = copy_mesh(me); + newob->data = BKE_mesh_copy(me); } else { newob = ob; @@ -1350,7 +1350,7 @@ static int convert_exec(bContext *C, wmOperator *op) mesh_to_curve(scene, newob); if (newob->type == OB_CURVE) - object_free_modifiers(newob); /* after derivedmesh calls! */ + BKE_object_free_modifiers(newob); /* after derivedmesh calls! */ } else if (ob->type == OB_MESH && ob->modifiers.first) { /* converting a mesh with no modifiers causes a segfault */ ob->flag |= OB_DONE; @@ -1364,7 +1364,7 @@ static int convert_exec(bContext *C, wmOperator *op) me->id.us--; /* make a new copy of the mesh */ - newob->data = copy_mesh(me); + newob->data = BKE_mesh_copy(me); } else { newob = ob; @@ -1383,7 +1383,7 @@ static int convert_exec(bContext *C, wmOperator *op) /* re-tessellation is called by DM_to_mesh */ dm->release(dm); - object_free_modifiers(newob); /* after derivedmesh calls! */ + BKE_object_free_modifiers(newob); /* after derivedmesh calls! */ } else if (ob->type == OB_FONT) { ob->flag |= OB_DONE; @@ -1499,7 +1499,7 @@ static int convert_exec(bContext *C, wmOperator *op) mb = newob->data; mb->id.us--; - newob->data = add_mesh("Mesh"); + newob->data = BKE_mesh_add("Mesh"); newob->type = OB_MESH; me = newob->data; @@ -1631,7 +1631,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base ; /* nothing? */ } else { - obn = copy_object(ob); + obn = BKE_object_copy(ob); obn->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; basen = MEM_mallocN(sizeof(Base), "duplibase"); @@ -1657,7 +1657,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base id = (ID *)obn->mat[a]; if (id) { ID_NEW_US(obn->mat[a]) - else obn->mat[a] = copy_material(obn->mat[a]); + else obn->mat[a] = BKE_material_copy(obn->mat[a]); id->us--; if (dupflag & USER_DUP_ACT) { @@ -1672,7 +1672,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base id = (ID *) psys->part; if (id) { ID_NEW_US(psys->part) - else psys->part = psys_copy_settings(psys->part); + else psys->part = BKE_particlesettings_copy(psys->part); if (dupflag & USER_DUP_ACT) { BKE_copy_animdata_id_action(&psys->part->id); @@ -1691,7 +1691,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base if (dupflag & USER_DUP_MESH) { ID_NEW_US2(obn->data) else { - obn->data = copy_mesh(obn->data); + obn->data = BKE_mesh_copy(obn->data); if (obn->fluidsimSettings) { obn->fluidsimSettings->orgMesh = (Mesh *)obn->data; @@ -1746,7 +1746,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base if (dupflag & USER_DUP_LAMP) { ID_NEW_US2(obn->data) else { - obn->data = copy_lamp(obn->data); + obn->data = BKE_lamp_copy(obn->data); didit = 1; } id->us--; @@ -1760,8 +1760,8 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base if (dupflag & USER_DUP_ARM) { ID_NEW_US2(obn->data) else { - obn->data = copy_armature(obn->data); - armature_rebuild_pose(obn, obn->data); + obn->data = BKE_armature_copy(obn->data); + BKE_pose_rebuild(obn, obn->data); didit = 1; } id->us--; @@ -1773,7 +1773,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base if (dupflag != 0) { ID_NEW_US2(obn->data) else { - obn->data = copy_lattice(obn->data); + obn->data = BKE_lattice_copy(obn->data); didit = 1; } id->us--; @@ -1783,7 +1783,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base if (dupflag != 0) { ID_NEW_US2(obn->data) else { - obn->data = copy_camera(obn->data); + obn->data = BKE_camera_copy(obn->data); didit = 1; } id->us--; @@ -1793,7 +1793,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base if (dupflag != 0) { ID_NEW_US2(obn->data) else { - obn->data = copy_speaker(obn->data); + obn->data = BKE_speaker_copy(obn->data); didit = 1; } id->us--; @@ -1832,7 +1832,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base id = (ID *)(*matarar)[a]; if (id) { ID_NEW_US((*matarar)[a]) - else (*matarar)[a] = copy_material((*matarar)[a]); + else (*matarar)[a] = BKE_material_copy((*matarar)[a]); id->us--; } @@ -1863,7 +1863,7 @@ Base *ED_object_add_duplicate(Main *bmain, Scene *scene, Base *base, int dupflag ob = basen->object; /* link own references to the newly duplicated data [#26816] */ - object_relink(ob); + BKE_object_relink(ob); set_sca_new_poins_ob(ob); DAG_scene_sort(bmain, scene); @@ -1954,7 +1954,7 @@ static int add_named_exec(bContext *C, wmOperator *op) /* find object, create fake base */ RNA_string_get(op->ptr, "name", name); - ob = (Object *)find_id("OB", name); + ob = (Object *)BKE_libblock_find_name(ID_OB, name); if (ob == NULL) return OPERATOR_CANCELLED; @@ -2033,7 +2033,7 @@ static int join_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_ERROR, "This data does not support joining in editmode"); return OPERATOR_CANCELLED; } - else if (object_data_is_libdata(ob)) { + else if (BKE_object_obdata_is_libdata(ob)) { BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata"); return OPERATOR_CANCELLED; } @@ -2086,7 +2086,7 @@ static int join_shapes_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_ERROR, "This data does not support joining in editmode"); return OPERATOR_CANCELLED; } - else if (object_data_is_libdata(ob)) { + else if (BKE_object_obdata_is_libdata(ob)) { BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata"); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index e63e0e34934..ec3360f236b 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -89,7 +89,7 @@ ListBase *get_active_constraints(Object *ob) if (ob->mode & OB_MODE_POSE) { bPoseChannel *pchan; - pchan = get_active_posechannel(ob); + pchan = BKE_pose_channel_active(ob); if (pchan) return &pchan->constraints; } @@ -309,23 +309,23 @@ static void test_constraints(Object *owner, bPoseChannel *pchan) * the constraint is deemed invalid */ /* default IK check ... */ - if (exist_object(data->tar) == 0) { + if (BKE_object_exists_check(data->tar) == 0) { data->tar = NULL; curcon->flag |= CONSTRAINT_DISABLE; } else if (data->tar == owner) { - if (!get_named_bone(get_armature(owner), data->subtarget)) { + if (!BKE_armature_find_bone_name(BKE_armature_from_object(owner), data->subtarget)) { curcon->flag |= CONSTRAINT_DISABLE; } } if (data->poletar) { - if (exist_object(data->poletar) == 0) { + if (BKE_object_exists_check(data->poletar) == 0) { data->poletar = NULL; curcon->flag |= CONSTRAINT_DISABLE; } else if (data->poletar == owner) { - if (!get_named_bone(get_armature(owner), data->polesubtarget)) { + if (!BKE_armature_find_bone_name(BKE_armature_from_object(owner), data->polesubtarget)) { curcon->flag |= CONSTRAINT_DISABLE; } } @@ -339,12 +339,12 @@ static void test_constraints(Object *owner, bPoseChannel *pchan) bPivotConstraint *data = curcon->data; /* target doesn't have to exist, but if it is non-null, it must exist! */ - if (data->tar && exist_object(data->tar) == 0) { + if (data->tar && BKE_object_exists_check(data->tar) == 0) { data->tar = NULL; curcon->flag |= CONSTRAINT_DISABLE; } else if (data->tar == owner) { - if (!get_named_bone(get_armature(owner), data->subtarget)) { + if (!BKE_armature_find_bone_name(BKE_armature_from_object(owner), data->subtarget)) { curcon->flag |= CONSTRAINT_DISABLE; } } @@ -446,14 +446,14 @@ static void test_constraints(Object *owner, bPoseChannel *pchan) /* disable and clear constraints targets that are incorrect */ for (ct = targets.first; ct; ct = ct->next) { /* general validity checks (for those constraints that need this) */ - if (exist_object(ct->tar) == 0) { + if (BKE_object_exists_check(ct->tar) == 0) { /* object doesn't exist, but constraint requires target */ ct->tar = NULL; curcon->flag |= CONSTRAINT_DISABLE; } else if (ct->tar == owner) { if (type == CONSTRAINT_OBTYPE_BONE) { - if (!get_named_bone(get_armature(owner), ct->subtarget)) { + if (!BKE_armature_find_bone_name(BKE_armature_from_object(owner), ct->subtarget)) { /* bone must exist in armature... */ // TODO: clear subtarget? curcon->flag |= CONSTRAINT_DISABLE; @@ -585,7 +585,7 @@ static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int list = &ob->constraints; } else if (owner == EDIT_CONSTRAINT_OWNER_BONE) { - bPoseChannel *pchan = get_active_posechannel(ob); + bPoseChannel *pchan = BKE_pose_channel_active(ob); if (pchan) list = &pchan->constraints; else { @@ -713,7 +713,7 @@ static void child_get_inverse_matrix(Scene *scene, Object *ob, bConstraint *con, /* try to find a pose channel - assume that this is the constraint owner */ // TODO: get from context instead? if (ob && ob->pose) - pchan = get_active_posechannel(ob); + pchan = BKE_pose_channel_active(ob); /* calculate/set inverse matrix: * We just calculate all transform-stack eval up to but not including this constraint. @@ -729,7 +729,7 @@ static void child_get_inverse_matrix(Scene *scene, Object *ob, bConstraint *con, * to use as baseline ("pmat") to derive delta from. This extra calc saves users * from having pressing "Clear Inverse" first */ - where_is_pose(scene, ob); + BKE_pose_where_is(scene, ob); copy_m4_m4(pmat, pchan->pose_mat); /* 2. knock out constraints starting from this one */ @@ -746,7 +746,7 @@ static void child_get_inverse_matrix(Scene *scene, Object *ob, bConstraint *con, } /* 3. solve pose without disabled constraints */ - where_is_pose(scene, ob); + BKE_pose_where_is(scene, ob); /* 4. determine effect of constraint by removing the newly calculated * pchan->pose_mat from the original pchan->pose_mat, thus determining @@ -769,13 +769,13 @@ static void child_get_inverse_matrix(Scene *scene, Object *ob, bConstraint *con, } /* 6. recalculate pose with new inv-mat applied */ - where_is_pose(scene, ob); + BKE_pose_where_is(scene, ob); } else if (ob) { Object workob; - /* use what_does_parent to find inverse - just like for normal parenting */ - what_does_parent(scene, ob, &workob); + /* use BKE_object_workob_calc_parent to find inverse - just like for normal parenting */ + BKE_object_workob_calc_parent(scene, ob, &workob); invert_m4_m4(invmat, workob.obmat); } } @@ -977,7 +977,7 @@ void ED_object_constraint_set_active(Object *ob, bConstraint *con) void ED_object_constraint_update(Object *ob) { - if (ob->pose) update_pose_constraint_flags(ob->pose); + if (ob->pose) BKE_pose_update_constraint_flags(ob->pose); object_test_constraints(ob); @@ -1147,7 +1147,7 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - Object *ob = object_pose_armature_get(CTX_data_active_object(C)); + Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); /* free constraints for all selected bones */ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) @@ -1312,7 +1312,7 @@ void OBJECT_OT_constraints_copy(wmOperatorType *ot) static short get_new_constraint_target(bContext *C, int con_type, Object **tar_ob, bPoseChannel **tar_pchan, short add) { Object *obact = ED_object_active_context(C); - bPoseChannel *pchanact = get_active_posechannel(obact); + bPoseChannel *pchanact = BKE_pose_channel_active(obact); short only_curve = 0, only_mesh = 0, only_ob = 0; short found = 0; @@ -1413,7 +1413,7 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o Object *obt; /* add new target object */ - obt = add_object(scene, OB_EMPTY); + obt = BKE_object_add(scene, OB_EMPTY); /* set layers OK */ newbase = BASACT; @@ -1434,7 +1434,7 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o copy_v3_v3(obt->loc, obact->obmat[3]); } - /* restore, add_object sets active */ + /* restore, BKE_object_add sets active */ BASACT = base; base->flag |= SELECT; @@ -1459,7 +1459,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase pchan = NULL; } else { - pchan = get_active_posechannel(ob); + pchan = BKE_pose_channel_active(ob); /* ensure not to confuse object/pose adding */ if (pchan == NULL) { @@ -1541,7 +1541,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase object_test_constraints(ob); if (pchan) - update_pose_constraint_flags(ob->pose); + BKE_pose_update_constraint_flags(ob->pose); /* force depsgraph to get recalculated since new relationships added */ @@ -1586,7 +1586,7 @@ static int object_constraint_add_exec(bContext *C, wmOperator *op) /* dummy operator callback */ static int pose_constraint_add_exec(bContext *C, wmOperator *op) { - Object *ob = object_pose_armature_get(ED_object_active_context(C)); + Object *ob = BKE_object_pose_armature_get(ED_object_active_context(C)); int type = RNA_enum_get(op->ptr, "type"); short with_targets = 0; @@ -1689,8 +1689,8 @@ void POSE_OT_constraint_add_with_targets(wmOperatorType *ot) /* present menu with options + validation for targets to use */ static int pose_ik_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(evt)) { - Object *ob = object_pose_armature_get(CTX_data_active_object(C)); - bPoseChannel *pchan = get_active_posechannel(ob); + Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); + bPoseChannel *pchan = BKE_pose_channel_active(ob); bConstraint *con = NULL; uiPopupMenu *pup; @@ -1773,7 +1773,7 @@ void POSE_OT_ik_add(wmOperatorType *ot) /* remove IK constraints from selected bones */ static int pose_ik_clear_exec(bContext *C, wmOperator *UNUSED(op)) { - Object *ob = object_pose_armature_get(CTX_data_active_object(C)); + Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); /* only remove IK Constraints */ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index c669bbfe3b2..d6d7342f900 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -427,7 +427,7 @@ void ED_object_enter_editmode(bContext *C, int flag) ob = base->object; - if (object_data_is_libdata(ob)) { + if (BKE_object_obdata_is_libdata(ob)) { error_libdata(); return; } @@ -465,11 +465,11 @@ void ED_object_enter_editmode(bContext *C, int flag) bArmature *arm = base->object->data; if (!arm) return; /* - * The function object_data_is_libdata make a problem here, the + * The function BKE_object_obdata_is_libdata make a problem here, the * check for ob->proxy return 0 and let blender enter to edit mode * this causes a crash when you try leave the edit mode. * The problem is that i can't remove the ob->proxy check from - * object_data_is_libdata that prevent the bugfix #6614, so + * BKE_object_obdata_is_libdata that prevent the bugfix #6614, so * i add this little hack here. */ if (arm->id.lib) { @@ -783,7 +783,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) return; } else if (event == 24) { - /* moved to object_link_modifiers */ + /* moved to BKE_object_link_modifiers */ /* copymenu_modifiers(bmain, scene, v3d, ob); */ return; } @@ -885,7 +885,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) cu1->vfontbi = cu->vfontbi; id_us_plus((ID *)cu1->vfontbi); - BKE_text_to_curve(bmain, scene, base->object, 0); /* needed? */ + BKE_vfont_to_curve(bmain, scene, base->object, 0); /* needed? */ BLI_strncpy(cu1->family, cu->family, sizeof(cu1->family)); @@ -1703,6 +1703,7 @@ void OBJECT_OT_game_property_copy(wmOperatorType *ot) /* identifiers */ ot->name = "Copy Game Property"; ot->idname = "OBJECT_OT_game_property_copy"; + ot->description = "Copy/merge/replace a game property from active object to all selected objects"; /* api callbacks */ ot->exec = game_property_copy_exec; @@ -1733,6 +1734,7 @@ void OBJECT_OT_game_property_clear(wmOperatorType *ot) /* identifiers */ ot->name = "Clear Game Property"; ot->idname = "OBJECT_OT_game_property_clear"; + ot->description = "Remove all game properties from all selected objects"; /* api callbacks */ ot->exec = game_property_clear_exec; diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c index dd6c08a2247..b47591dddee 100644 --- a/source/blender/editors/object/object_group.c +++ b/source/blender/editors/object/object_group.c @@ -327,6 +327,7 @@ void OBJECT_OT_group_remove(wmOperatorType *ot) /* identifiers */ ot->name = "Remove Group"; ot->idname = "OBJECT_OT_group_remove"; + ot->description = "Remove the active object from this group"; /* api callbacks */ ot->exec = group_remove_exec; diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 0aec83610b8..71db051a6e1 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -414,13 +414,13 @@ static Object *add_hook_object_new(Scene *scene, Object *obedit) Base *base, *basedit; Object *ob; - ob = add_object(scene, OB_EMPTY); + ob = BKE_object_add(scene, OB_EMPTY); - basedit = object_in_scene(obedit, scene); - base = object_in_scene(ob, scene); + basedit = BKE_scene_base_find(scene, obedit); + base = BKE_scene_base_find(scene, ob); base->lay = ob->lay = obedit->lay; - /* icky, add_object sets new base as active. + /* icky, BKE_object_add sets new base as active. * so set it back to the original edit object */ scene->basact = basedit; @@ -466,7 +466,7 @@ static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *o /* matrix calculus */ /* vert x (obmat x hook->imat) x hook->obmat x ob->imat */ /* (parentinv ) */ - where_is_object(scene, ob); + BKE_object_where_is_calc(scene, ob); invert_m4_m4(ob->imat, ob->obmat); /* apparently this call goes from right to left... */ @@ -645,7 +645,7 @@ static int object_hook_reset_exec(bContext *C, wmOperator *op) /* reset functionality */ if (hmd->object) { - bPoseChannel *pchan = get_pose_channel(hmd->object->pose, hmd->subtarget); + bPoseChannel *pchan = BKE_pose_channel_find_name(hmd->object->pose, hmd->subtarget); if (hmd->subtarget[0] && pchan) { float imat[4][4], mat[4][4]; diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index 648f530881a..7b37ca8ab95 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -271,12 +271,12 @@ static int make_regular_exec(bContext *C, wmOperator *UNUSED(op)) if (ob) { lt = ob->data; - resizelattice(lt->editlatt->latt, lt->pntsu, lt->pntsv, lt->pntsw, NULL); + BKE_lattice_resize(lt->editlatt->latt, lt->pntsu, lt->pntsv, lt->pntsw, NULL); } else { ob = CTX_data_active_object(C); lt = ob->data; - resizelattice(lt, lt->pntsu, lt->pntsv, lt->pntsw, NULL); + BKE_lattice_resize(lt, lt->pntsu, lt->pntsv, lt->pntsw, NULL); } DAG_id_tag_update(&ob->id, OB_RECALC_DATA); diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 281ca7e59b6..f6bf9ba2f15 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -368,7 +368,7 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene * if (totvert == 0) return 0; /* add new mesh */ - obn = add_object(scene, OB_MESH); + obn = BKE_object_add(scene, OB_MESH); me = obn->data; me->totvert = totvert; @@ -661,7 +661,7 @@ static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr) if (mti->flags & eModifierTypeFlag_NoUserAdd) continue; - if (!object_support_modifier_type(ob, md_item->value)) + if (!BKE_object_support_modifier_type_check(ob, md_item->value)) continue; } else { @@ -1369,7 +1369,7 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op) dm->release(dm); } else if (ob->type == OB_LATTICE) { - lattice_calc_modifiers(scene, ob); + BKE_lattice_modifiers_calc(scene, ob); } else if (ob->type == OB_MBALL) { makeDispListMBall(scene, ob); diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 72f23177946..311240d189f 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -223,18 +223,18 @@ void ED_operatormacros_object(void) wmOperatorType *ot; wmOperatorTypeMacro *otmacro; - ot = WM_operatortype_append_macro("OBJECT_OT_duplicate_move", "Duplicate Objects", OPTYPE_UNDO | OPTYPE_REGISTER); + ot = WM_operatortype_append_macro("OBJECT_OT_duplicate_move", "Duplicate Objects", + "Duplicate selected objects and move them", OPTYPE_UNDO | OPTYPE_REGISTER); if (ot) { - ot->description = "Duplicate selected objects and move them"; WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF); } /* grr, should be able to pass options on... */ - ot = WM_operatortype_append_macro("OBJECT_OT_duplicate_move_linked", "Duplicate Linked", OPTYPE_UNDO | OPTYPE_REGISTER); + ot = WM_operatortype_append_macro("OBJECT_OT_duplicate_move_linked", "Duplicate Linked", + "Duplicate selected objects and move them", OPTYPE_UNDO | OPTYPE_REGISTER); if (ot) { - ot->description = "Duplicate selected objects and move them"; otmacro = WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate"); RNA_boolean_set(otmacro->ptr, "linked", TRUE); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); @@ -242,9 +242,9 @@ void ED_operatormacros_object(void) } /* XXX */ - ot = WM_operatortype_append_macro("OBJECT_OT_add_named_cursor", "Add named object at cursor", OPTYPE_UNDO | OPTYPE_REGISTER); + ot = WM_operatortype_append_macro("OBJECT_OT_add_named_cursor", "Add Named At Cursor", + "Add named object at cursor", OPTYPE_UNDO | OPTYPE_REGISTER); if (ot) { - ot->description = "Add named object at cursor"; RNA_def_string(ot->srna, "name", "Cube", MAX_ID_NAME - 2, "Name", "Object name to add"); WM_operatortype_macro_define(ot, "VIEW3D_OT_cursor3d"); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 35b3b0a0407..d31e0b69473 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -235,7 +235,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) ob->par3 = v3 - 1; /* inverse parent matrix */ - what_does_parent(scene, ob, &workob); + BKE_object_workob_calc_parent(scene, ob, &workob); invert_m4_m4(ob->parentinv, workob.obmat); } else { @@ -243,7 +243,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) ob->par1 = v1 - 1; /* inverse parent matrix */ - what_does_parent(scene, ob, &workob); + BKE_object_workob_calc_parent(scene, ob, &workob); invert_m4_m4(ob->parentinv, workob.obmat); } } @@ -335,24 +335,24 @@ static int make_proxy_exec(bContext *C, wmOperator *op) char name[MAX_ID_NAME + 4]; /* Add new object for the proxy */ - newob = add_object(scene, OB_EMPTY); + newob = BKE_object_add(scene, OB_EMPTY); BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name + 2); rename_id(&newob->id, name); /* set layers OK */ - newbase = BASACT; /* add_object sets active... */ + newbase = BASACT; /* BKE_object_add sets active... */ newbase->lay = oldbase->lay; newob->lay = newbase->lay; - /* remove base, leave user count of object, it gets linked in object_make_proxy */ + /* remove base, leave user count of object, it gets linked in BKE_object_make_proxy */ if (gob == NULL) { BLI_remlink(&scene->base, oldbase); MEM_freeN(oldbase); } - object_make_proxy(newob, ob, gob); + BKE_object_make_proxy(newob, ob, gob); /* depsgraph flushes are needed for the new data */ DAG_scene_sort(bmain, scene); @@ -439,7 +439,7 @@ void ED_object_parent_clear(bContext *C, int type) } else if (type == 1) { ob->parent = NULL; - object_apply_mat4(ob, ob->obmat, TRUE, FALSE); + BKE_object_apply_mat4(ob, ob->obmat, TRUE, FALSE); } else if (type == 2) unit_m4(ob->parentinv); @@ -554,7 +554,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object } } else if (partype == PAR_BONE) { - pchan = get_active_posechannel(par); + pchan = BKE_pose_channel_active(par); if (pchan == NULL) { BKE_report(reports, RPT_ERROR, "No active Bone"); @@ -571,7 +571,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object Object workob; /* apply transformation of previous parenting */ - /* object_apply_mat4(ob, ob->obmat); */ /* removed because of bug [#23577] */ + /* BKE_object_apply_mat4(ob, ob->obmat); */ /* removed because of bug [#23577] */ /* set the parent (except for follow-path constraint option) */ if (partype != PAR_PATH_CONST) { @@ -650,13 +650,13 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object } /* get corrected inverse */ ob->partype = PAROBJECT; - what_does_parent(scene, ob, &workob); + BKE_object_workob_calc_parent(scene, ob, &workob); invert_m4_m4(ob->parentinv, workob.obmat); } else { /* calculate inverse parent matrix */ - what_does_parent(scene, ob, &workob); + BKE_object_workob_calc_parent(scene, ob, &workob); invert_m4_m4(ob->parentinv, workob.obmat); } @@ -814,7 +814,7 @@ static int object_slow_parent_clear_exec(bContext *C, wmOperator *UNUSED(op)) if (ob->parent) { if (ob->partype & PARSLOW) { ob->partype -= PARSLOW; - where_is_object(scene, ob); + BKE_object_where_is_calc(scene, ob); ob->partype |= PARSLOW; ob->recalc |= OB_RECALC_OB; } @@ -920,7 +920,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op) } if (type == 1) - object_apply_mat4(ob, ob->obmat, TRUE, TRUE); + BKE_object_apply_mat4(ob, ob->obmat, TRUE, TRUE); } CTX_DATA_END; @@ -1217,7 +1217,7 @@ static int make_links_scene_exec(bContext *C, wmOperator *op) CTX_DATA_BEGIN (C, Base *, base, selected_bases) { - if (!object_in_scene(base->object, scene_to)) { + if (!BKE_scene_base_find(scene_to, base->object)) { Base *nbase = MEM_mallocN(sizeof(Base), "newbase"); *nbase = *base; BLI_addhead(&(scene_to->base), nbase); @@ -1313,7 +1313,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op) } break; case MAKE_LINKS_MODIFIERS: - object_link_modifiers(obt, ob); + BKE_object_link_modifiers(obt, ob); obt->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME; break; } @@ -1401,7 +1401,7 @@ static void single_object_users(Scene *scene, View3D *v3d, int flag) if ( (base->flag & flag) == flag) { if (ob->id.lib == NULL && ob->id.us > 1) { /* base gets copy of object */ - obn = copy_object(ob); + obn = BKE_object_copy(ob); base->object = obn; ob->id.us--; } @@ -1413,7 +1413,7 @@ static void single_object_users(Scene *scene, View3D *v3d, int flag) /* object pointers */ for (base = FIRSTBASE; base; base = base->next) { - object_relink(base->object); + BKE_object_relink(base->object); } set_sca_new_poins(); @@ -1447,7 +1447,7 @@ static void new_id_matar(Material **matar, int totcol) id->us--; } else if (id->us > 1) { - matar[a] = copy_material(matar[a]); + matar[a] = BKE_material_copy(matar[a]); id->us--; id->newid = (ID *)matar[a]; } @@ -1478,7 +1478,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag) switch (ob->type) { case OB_LAMP: - ob->data = la = copy_lamp(ob->data); + ob->data = la = BKE_lamp_copy(ob->data); for (a = 0; a < MAX_MTEX; a++) { if (la->mtex[a]) { ID_NEW(la->mtex[a]->object); @@ -1486,10 +1486,10 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag) } break; case OB_CAMERA: - ob->data = copy_camera(ob->data); + ob->data = BKE_camera_copy(ob->data); break; case OB_MESH: - ob->data = copy_mesh(ob->data); + ob->data = BKE_mesh_copy(ob->data); //me= ob->data; //if (me && me->key) // ipo_idnew(me->key->ipo); /* drivers */ @@ -1505,15 +1505,15 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag) ID_NEW(cu->taperobj); break; case OB_LATTICE: - ob->data = copy_lattice(ob->data); + ob->data = BKE_lattice_copy(ob->data); break; case OB_ARMATURE: ob->recalc |= OB_RECALC_DATA; - ob->data = copy_armature(ob->data); - armature_rebuild_pose(ob, ob->data); + ob->data = BKE_armature_copy(ob->data); + BKE_pose_rebuild(ob, ob->data); break; case OB_SPEAKER: - ob->data = copy_speaker(ob->data); + ob->data = BKE_speaker_copy(ob->data); break; default: if (G.debug & G_DEBUG) @@ -1568,7 +1568,7 @@ static void single_mat_users(Scene *scene, int flag, int do_textures) /* do not test for LIB_NEW: this functions guaranteed delivers single_users! */ if (ma->id.us > 1) { - man = copy_material(ma); + man = BKE_material_copy(ma); BKE_copy_animdata_id_action(&man->id); man->id.us = 0; @@ -1579,7 +1579,7 @@ static void single_mat_users(Scene *scene, int flag, int do_textures) if (ma->mtex[b] && (tex = ma->mtex[b]->tex)) { if (tex->id.us > 1) { tex->id.us--; - tex = copy_texture(tex); + tex = BKE_texture_copy(tex); BKE_copy_animdata_id_action(&tex->id); man->mtex[b]->tex = tex; } @@ -1606,7 +1606,7 @@ static void do_single_tex_user(Tex **from) tex->id.us--; } else if (tex->id.us > 1) { - texn = copy_texture(tex); + texn = BKE_texture_copy(tex); BKE_copy_animdata_id_action(&texn->id); tex->id.newid = (ID *)texn; tex->id.us--; @@ -1911,7 +1911,7 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *even char name[MAX_ID_NAME - 2]; RNA_string_get(op->ptr, "name", name); - ma = (Material *)find_id("MA", name); + ma = (Material *)BKE_libblock_find_name(ID_MA, name); if (base == NULL || ma == NULL) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index ed53e4a9b91..86823be09a4 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -416,7 +416,7 @@ static short select_grouped_parent(bContext *C) /* Makes parent active and de-se if (!basact || !(basact->object->parent)) return 0; /* we know OBACT is valid */ - baspar = object_in_scene(basact->object->parent, scene); + baspar = BKE_scene_base_find(scene, basact->object->parent); /* can be NULL if parent in other scene */ if (baspar && BASE_SELECTABLE(v3d, baspar)) { @@ -487,7 +487,7 @@ static short select_grouped_object_hooks(bContext *C, Object *ob) if (md->type == eModifierType_Hook) { hmd = (HookModifierData *) md; if (hmd->object && !(hmd->object->flag & SELECT)) { - base = object_in_scene(hmd->object, scene); + base = BKE_scene_base_find(scene, hmd->object); if (base && (BASE_SELECTABLE(v3d, base))) { ED_base_object_select(base, BA_SELECT); changed = 1; @@ -884,9 +884,9 @@ static int object_select_mirror_exec(bContext *C, wmOperator *op) flip_side_name(tmpname, primbase->object->id.name + 2, TRUE); if (strcmp(tmpname, primbase->object->id.name + 2) != 0) { /* names differ */ - Object *ob = (Object *)find_id("OB", tmpname); + Object *ob = (Object *)BKE_libblock_find_name(ID_OB, tmpname); if (ob) { - Base *secbase = object_in_scene(ob, scene); + Base *secbase = BKE_scene_base_find(scene, ob); if (secbase) { ED_base_object_select(secbase, BA_SELECT); diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index 5d31bfff99a..19864ed58cf 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -77,7 +77,7 @@ static void ED_object_shape_key_add(bContext *C, Scene *scene, Object *ob, int from_mix) { KeyBlock *kb; - if ((kb = object_insert_shape_key(scene, ob, NULL, from_mix))) { + if ((kb = BKE_object_insert_shape_key(scene, ob, NULL, from_mix))) { Key *key = ob_get_key(ob); /* for absolute shape keys, new keys may not be added last */ ob->shapenr = BLI_findindex(&key->block, kb) + 1; @@ -141,7 +141,7 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob) else if (GS(key->from->name) == ID_CU) ((Curve *)key->from)->key = NULL; else if (GS(key->from->name) == ID_LT) ((Lattice *)key->from)->key = NULL; - free_libblock_us(&(bmain->key), key); + BKE_libblock_free_us(&(bmain->key), key); } DAG_id_tag_update(&ob->id, OB_RECALC_DATA); @@ -403,6 +403,7 @@ void OBJECT_OT_shape_key_mirror(wmOperatorType *ot) /* identifiers */ ot->name = "Mirror Shape Key"; ot->idname = "OBJECT_OT_shape_key_mirror"; + ot->description = "Mirror the current shape key along the local X axis"; /* api callbacks */ ot->poll = shape_key_mode_poll; @@ -474,6 +475,7 @@ void OBJECT_OT_shape_key_move(wmOperatorType *ot) /* identifiers */ ot->name = "Move Shape Key"; ot->idname = "OBJECT_OT_shape_key_move"; + ot->description = "Move the active shape key up/down in the list"; /* api callbacks */ ot->poll = shape_key_mode_poll; diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index b8a7ce999f1..785b9c0a9b7 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -370,8 +370,8 @@ static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob) /* a change was made, adjust the children to compensate */ for (ob_child = bmain->object.first; ob_child; ob_child = ob_child->id.next) { if (ob_child->parent == ob) { - object_apply_mat4(ob_child, ob_child->obmat, TRUE, FALSE); - what_does_parent(scene, ob_child, &workob); + BKE_object_apply_mat4(ob_child, ob_child->obmat, TRUE, FALSE); + BKE_object_workob_calc_parent(scene, ob_child, &workob); invert_m4_m4(ob_child->parentinv, workob.obmat); } } @@ -434,17 +434,17 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo /* calculate rotation/scale matrix */ if (apply_scale && apply_rot) - object_to_mat3(ob, rsmat); + BKE_object_to_mat3(ob, rsmat); else if (apply_scale) - object_scale_to_mat3(ob, rsmat); + BKE_object_scale_to_mat3(ob, rsmat); else if (apply_rot) { float tmat[3][3], timat[3][3]; /* simple rotation matrix */ - object_rot_to_mat3(ob, rsmat); + BKE_object_rot_to_mat3(ob, rsmat); /* correct for scale, note mul_m3_m3m3 has swapped args! */ - object_scale_to_mat3(ob, tmat); + BKE_object_scale_to_mat3(ob, tmat); invert_m3_m3(timat, tmat); mul_m3_m3m3(rsmat, timat, rsmat); mul_m3_m3m3(rsmat, rsmat, tmat); @@ -460,7 +460,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo if (!(apply_scale && apply_rot)) { /* correct for scale and rotation that is still applied */ - object_to_mat3(ob, obmat); + BKE_object_to_mat3(ob, obmat); invert_m3_m3(iobmat, obmat); mul_m3_m3m3(tmat, rsmat, iobmat); mul_m3_v3(tmat, mat[3]); @@ -546,9 +546,9 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo unit_axis_angle(ob->rotAxis, &ob->rotAngle); } - where_is_object(scene, ob); + BKE_object_where_is_calc(scene, ob); if (ob->type == OB_ARMATURE) { - where_is_pose(scene, ob); /* needed for bone parents */ + BKE_pose_where_is(scene, ob); /* needed for bone parents */ } ignore_parent_tx(bmain, scene, ob); @@ -573,9 +573,9 @@ static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op)) CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { - where_is_object(scene, ob); - object_apply_mat4(ob, ob->obmat, TRUE, TRUE); - where_is_object(scene, ob); + BKE_object_where_is_calc(scene, ob); + BKE_object_apply_mat4(ob, ob->obmat, TRUE, TRUE); + BKE_object_where_is_calc(scene, ob); /* update for any children that may get moved */ DAG_id_tag_update(&ob->id, OB_RECALC_OB); @@ -750,7 +750,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) else { /* only bounds support */ INIT_MINMAX(min, max); - minmax_object_duplis(scene, ob, min, max); + BKE_object_minmax_dupli(scene, ob, min, max); mid_v3_v3v3(cent, min, max); invert_m4_m4(ob->imat, ob->obmat); mul_m4_v3(ob->imat, cent); @@ -854,8 +854,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) arm->id.flag |= LIB_DOIT; /* do_inverse_offset= TRUE; */ /* docenter_armature() handles this */ - where_is_object(scene, ob); - where_is_pose(scene, ob); /* needed for bone parents */ + BKE_object_where_is_calc(scene, ob); + BKE_pose_where_is(scene, ob); /* needed for bone parents */ ignore_parent_tx(bmain, scene, ob); @@ -893,9 +893,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) mul_mat3_m4_v3(ob->obmat, centn); /* ommit translation part */ add_v3_v3(ob->loc, centn); - where_is_object(scene, ob); + BKE_object_where_is_calc(scene, ob); if (ob->type == OB_ARMATURE) { - where_is_pose(scene, ob); /* needed for bone parents */ + BKE_pose_where_is(scene, ob); /* needed for bone parents */ } ignore_parent_tx(bmain, scene, ob); @@ -915,9 +915,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) mul_mat3_m4_v3(ob_other->obmat, centn); /* ommit translation part */ add_v3_v3(ob_other->loc, centn); - where_is_object(scene, ob_other); + BKE_object_where_is_calc(scene, ob_other); if (ob_other->type == OB_ARMATURE) { - where_is_pose(scene, ob_other); /* needed for bone parents */ + BKE_pose_where_is(scene, ob_other); /* needed for bone parents */ } ignore_parent_tx(bmain, scene, ob_other); } diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index cc01e83d568..652b7c04b2e 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -2324,6 +2324,7 @@ void OBJECT_OT_vertex_group_add(wmOperatorType *ot) /* identifiers */ ot->name = "Add Vertex Group"; ot->idname = "OBJECT_OT_vertex_group_add"; + ot->description = "Add a new vertex group to the active object"; /* api callbacks */ ot->poll = vertex_group_poll; @@ -2354,6 +2355,7 @@ void OBJECT_OT_vertex_group_remove(wmOperatorType *ot) /* identifiers */ ot->name = "Remove Vertex Group"; ot->idname = "OBJECT_OT_vertex_group_remove"; + ot->description = "Delete the active vertex group"; /* api callbacks */ ot->poll = vertex_group_poll; @@ -2389,6 +2391,7 @@ void OBJECT_OT_vertex_group_assign(wmOperatorType *ot) /* identifiers */ ot->name = "Assign Vertex Group"; ot->idname = "OBJECT_OT_vertex_group_assign"; + ot->description = "Assign the selected vertices to the current (or a new) vertex group"; /* api callbacks */ ot->poll = vertex_group_poll_edit_or_wpaint_vert_select; @@ -2431,6 +2434,7 @@ void OBJECT_OT_vertex_group_remove_from(wmOperatorType *ot) /* identifiers */ ot->name = "Remove from Vertex Group"; ot->idname = "OBJECT_OT_vertex_group_remove_from"; + ot->description = "Remove the selected vertices from the active vertex group"; /* api callbacks */ ot->poll = vertex_group_poll_edit_or_wpaint_vert_select; @@ -2464,6 +2468,7 @@ void OBJECT_OT_vertex_group_select(wmOperatorType *ot) /* identifiers */ ot->name = "Select Vertex Group"; ot->idname = "OBJECT_OT_vertex_group_select"; + ot->description = "Select all the vertices assigned to the active vertex group"; /* api callbacks */ ot->poll = vertex_group_poll_edit_or_wpaint_vert_select; @@ -2488,6 +2493,7 @@ void OBJECT_OT_vertex_group_deselect(wmOperatorType *ot) /* identifiers */ ot->name = "Deselect Vertex Group"; ot->idname = "OBJECT_OT_vertex_group_deselect"; + ot->description = "Deselect all selected vertices assigned to the active vertex group"; /* api callbacks */ ot->poll = vertex_group_poll_edit_or_wpaint_vert_select; @@ -2515,6 +2521,7 @@ void OBJECT_OT_vertex_group_copy(wmOperatorType *ot) /* identifiers */ ot->name = "Copy Vertex Group"; ot->idname = "OBJECT_OT_vertex_group_copy"; + ot->description = "Make a copy of the active vertex group"; /* api callbacks */ ot->poll = vertex_group_poll; @@ -2545,6 +2552,7 @@ void OBJECT_OT_vertex_group_levels(wmOperatorType *ot) /* identifiers */ ot->name = "Vertex Group Levels"; ot->idname = "OBJECT_OT_vertex_group_levels"; + ot->description = "Add some offset and multiply with some gain the weights of the active vertex group"; /* api callbacks */ ot->poll = vertex_group_poll; @@ -2575,6 +2583,7 @@ void OBJECT_OT_vertex_group_normalize(wmOperatorType *ot) /* identifiers */ ot->name = "Normalize Vertex Group"; ot->idname = "OBJECT_OT_vertex_group_normalize"; + ot->description = "Normalize weights of the active vertex group, so that the highest ones are now 1.0"; /* api callbacks */ ot->poll = vertex_group_poll; @@ -2603,6 +2612,8 @@ void OBJECT_OT_vertex_group_normalize_all(wmOperatorType *ot) /* identifiers */ ot->name = "Normalize All Vertex Groups"; ot->idname = "OBJECT_OT_vertex_group_normalize_all"; + ot->description = "Normalize all weights of all vertex groups, " + "so that for each vertex, the sum of all weights is 1.0"; /* api callbacks */ ot->poll = vertex_group_poll; @@ -2683,6 +2694,7 @@ void OBJECT_OT_vertex_group_lock(wmOperatorType *ot) /* identifiers */ ot->name = "Change the Lock On Vertex Groups"; ot->idname = "OBJECT_OT_vertex_group_lock"; + ot->description = "Change the lock state of all vertex groups of active object"; /* api callbacks */ ot->poll = vertex_group_poll; @@ -2713,6 +2725,7 @@ void OBJECT_OT_vertex_group_invert(wmOperatorType *ot) /* identifiers */ ot->name = "Invert Vertex Group"; ot->idname = "OBJECT_OT_vertex_group_invert"; + ot->description = "Invert active vertex group's weights"; /* api callbacks */ ot->poll = vertex_group_poll; @@ -3252,6 +3265,7 @@ void OBJECT_OT_vertex_group_move(wmOperatorType *ot) /* identifiers */ ot->name = "Move Vertex Group"; ot->idname = "OBJECT_OT_vertex_group_move"; + ot->description = "Move the active vertex group up/down in the list"; /* api callbacks */ ot->poll = vertex_group_poll; diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index ba80fd83de7..64f4ffe4881 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -1367,6 +1367,7 @@ void PARTICLE_OT_select_all(wmOperatorType *ot) /* identifiers */ ot->name = "(De)select All"; ot->idname = "PARTICLE_OT_select_all"; + ot->description = "(De)select all particles' keys"; /* api callbacks */ ot->exec = pe_select_all_exec; @@ -1441,6 +1442,7 @@ void PARTICLE_OT_select_roots(wmOperatorType *ot) /* identifiers */ ot->name = "Select Roots"; ot->idname = "PARTICLE_OT_select_roots"; + ot->description = "Select roots of all visible particles"; /* api callbacks */ ot->exec = select_roots_exec; @@ -1481,7 +1483,8 @@ void PARTICLE_OT_select_tips(wmOperatorType *ot) /* identifiers */ ot->name = "Select Tips"; ot->idname = "PARTICLE_OT_select_tips"; - + ot->description = "Select tips of all visible particles"; + /* api callbacks */ ot->exec = select_tips_exec; ot->poll = PE_poll; @@ -1525,6 +1528,7 @@ void PARTICLE_OT_select_linked(wmOperatorType *ot) /* identifiers */ ot->name = "Select Linked"; ot->idname = "PARTICLE_OT_select_linked"; + ot->description = "Select nearest particle from mouse pointer"; /* api callbacks */ ot->exec = select_linked_exec; @@ -1717,6 +1721,7 @@ void PARTICLE_OT_hide(wmOperatorType *ot) /* identifiers */ ot->name = "Hide Selected"; ot->idname = "PARTICLE_OT_hide"; + ot->description = "Hide selected particles"; /* api callbacks */ ot->exec = hide_exec; @@ -1759,6 +1764,7 @@ void PARTICLE_OT_reveal(wmOperatorType *ot) /* identifiers */ ot->name = "Reveal"; ot->idname = "PARTICLE_OT_reveal"; + ot->description = "Show hidden particles"; /* api callbacks */ ot->exec = reveal_exec; @@ -1817,6 +1823,7 @@ void PARTICLE_OT_select_less(wmOperatorType *ot) /* identifiers */ ot->name = "Select Less"; ot->idname = "PARTICLE_OT_select_less"; + ot->description = "Deselect boundary selected keys of each particle"; /* api callbacks */ ot->exec = select_less_exec; @@ -1878,6 +1885,7 @@ void PARTICLE_OT_select_more(wmOperatorType *ot) /* identifiers */ ot->name = "Select More"; ot->idname = "PARTICLE_OT_select_more"; + ot->description = "Select keys linked to boundary selected keys of each particle"; /* api callbacks */ ot->exec = select_more_exec; @@ -1974,6 +1982,7 @@ void PARTICLE_OT_rekey(wmOperatorType *ot) /* identifiers */ ot->name = "Rekey"; ot->idname = "PARTICLE_OT_rekey"; + ot->description = "Change the number of keys of selected particles (root and tip keys included)"; /* api callbacks */ ot->exec = rekey_exec; @@ -2304,6 +2313,7 @@ void PARTICLE_OT_subdivide(wmOperatorType *ot) /* identifiers */ ot->name = "Subdivide"; ot->idname = "PARTICLE_OT_subdivide"; + ot->description = "Subdivide selected particles segments (adds keys)"; /* api callbacks */ ot->exec = subdivide_exec; @@ -2392,6 +2402,7 @@ void PARTICLE_OT_remove_doubles(wmOperatorType *ot) /* identifiers */ ot->name = "Remove Doubles"; ot->idname = "PARTICLE_OT_remove_doubles"; + ot->description = "Remove selected particles close enough of others"; /* api callbacks */ ot->exec = remove_doubles_exec; @@ -2442,6 +2453,7 @@ void PARTICLE_OT_weight_set(wmOperatorType *ot) /* identifiers */ ot->name = "Weight Set"; ot->idname = "PARTICLE_OT_weight_set"; + ot->description = "Set the weight of selected keys"; /* api callbacks */ ot->exec = weight_set_exec; @@ -2450,7 +2462,8 @@ void PARTICLE_OT_weight_set(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_float(ot->srna, "factor", 1, 0, 1, "Factor", "", 0, 1); + RNA_def_float(ot->srna, "factor", 1, 0, 1, "Factor", + "Interpolation factor between current brush weight, and keys' weights", 0, 1); } /************************ cursor drawing *******************************/ @@ -2545,6 +2558,7 @@ void PARTICLE_OT_delete(wmOperatorType *ot) /* identifiers */ ot->name = "Delete"; ot->idname = "PARTICLE_OT_delete"; + ot->description = "Delete selected particles or keys"; /* api callbacks */ ot->exec = delete_exec; @@ -2710,6 +2724,7 @@ void PARTICLE_OT_mirror(wmOperatorType *ot) /* identifiers */ ot->name = "Mirror"; ot->idname = "PARTICLE_OT_mirror"; + ot->description = "Duplicate and mirror the selected particles along the local X axis"; /* api callbacks */ ot->exec = mirror_exec; @@ -2990,7 +3005,7 @@ static void brush_puff(PEData *data, int point_index) } -static void brush_weight(PEData *data, float UNUSED(mat[][4]), float UNUSED(imat[][4]), int point_index, int key_index, PTCacheEditKey *UNUSED(key)) +static void BKE_brush_weight_get(PEData *data, float UNUSED(mat[][4]), float UNUSED(imat[][4]), int point_index, int key_index, PTCacheEditKey *UNUSED(key)) { /* roots have full weight allways */ if (key_index) { @@ -3622,7 +3637,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) data.weightfac = brush->strength; /* note that this will never be zero */ - foreach_mouse_hit_key(&data, brush_weight, selected); + foreach_mouse_hit_key(&data, BKE_brush_weight_get, selected); } break; @@ -3739,6 +3754,7 @@ void PARTICLE_OT_brush_edit(wmOperatorType *ot) /* identifiers */ ot->name = "Brush Edit"; ot->idname = "PARTICLE_OT_brush_edit"; + ot->description = "Apply a stroke of brush to the particles"; /* api callbacks */ ot->exec = brush_edit_exec; @@ -4068,7 +4084,7 @@ int PE_minmax(Scene *scene, float min[3], float max[3]) } if (!ok) { - minmax_object(ob, min, max); + BKE_object_minmax(ob, min, max); ok= 1; } @@ -4229,6 +4245,7 @@ void PARTICLE_OT_particle_edit_toggle(wmOperatorType *ot) /* identifiers */ ot->name = "Particle Edit Toggle"; ot->idname = "PARTICLE_OT_particle_edit_toggle"; + ot->description = "Toggle particle edit mode"; /* api callbacks */ ot->exec = particle_edit_toggle_exec; @@ -4278,6 +4295,7 @@ void PARTICLE_OT_edited_clear(wmOperatorType *ot) /* identifiers */ ot->name = "Clear Edited"; ot->idname = "PARTICLE_OT_edited_clear"; + ot->description = "Undo all edition performed on the particle system"; /* api callbacks */ ot->exec = clear_edited_exec; diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 13e407040c3..b57500df719 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -158,7 +158,7 @@ static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op)) /* add or copy particle setting */ if (psys->part) - part= psys_copy_settings(psys->part); + part= BKE_particlesettings_copy(psys->part); else part= psys_new_settings("ParticleSettings", bmain); diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 068e93e7a5a..5a56672f766 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -126,7 +126,7 @@ static float get_fluid_size_m(Scene *scene, Object *domainob, FluidsimSettings * float dim[3]; float longest_axis; - object_get_dimensions(domainob, dim); + BKE_object_dimensions_get(domainob, dim); longest_axis = MAX3(dim[0], dim[1], dim[2]); return longest_axis * scene->unit.scale_length; diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 1a2e42d691a..595b51d22c4 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -170,7 +170,7 @@ static void screen_render_scene_layer_set(wmOperator *op, Main *mainp, Scene **s if (scn) { /* camera switch wont have updated */ scn->r.cfra = (*scene)->r.cfra; - scene_camera_switch_update(scn); + BKE_scene_camera_switch_update(scn); *scene = scn; } diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index a46e3c69456..86f6ce6d56a 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -185,7 +185,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender) float *accum_tmp = MEM_mallocN(sizex * sizey * sizeof(float) * 4, "accum2"); int j; - BLI_initjit(jit_ofs[0], scene->r.osa); + BLI_jitter_init(jit_ofs[0], scene->r.osa); /* first sample buffer, also initializes 'rv3d->persmat' */ ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat, TRUE); @@ -264,7 +264,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender) } BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, FALSE); - ok = BKE_write_ibuf_as(ibuf, name, &scene->r.im_format, TRUE); /* no need to stamp here */ + ok = BKE_imbuf_write_as(ibuf, name, &scene->r.im_format, TRUE); /* no need to stamp here */ if (ok) printf("OpenGL Render written to '%s'\n", name); else printf("OpenGL Render failed to write '%s'\n", name); } @@ -406,7 +406,7 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) if (oglrender->timer) { /* exec will not have a timer */ scene->r.cfra = oglrender->cfrao; - scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender)); + BKE_scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender)); WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), oglrender->timer); } @@ -471,7 +471,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) Object *camera = NULL; /* update animated image textures for gpu, etc, - * call before scene_update_for_newframe so modifiers with textures don't lag 1 frame */ + * call before BKE_scene_update_for_newframe so modifiers with textures don't lag 1 frame */ ED_image_update_frame(bmain, scene->r.cfra); /* go to next frame */ @@ -481,17 +481,17 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) if (lay & 0xFF000000) lay &= 0xFF000000; - scene_update_for_newframe(bmain, scene, lay); + BKE_scene_update_for_newframe(bmain, scene, lay); CFRA++; } - scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender)); + BKE_scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender)); if (view_context) { if (oglrender->rv3d->persp == RV3D_CAMOB && oglrender->v3d->camera && oglrender->v3d->scenelock) { - /* since scene_update_for_newframe() is used rather + /* since BKE_scene_update_for_newframe() is used rather * then ED_update_for_newframe() the camera needs to be set */ - if (scene_camera_switch_update(scene)) { + if (BKE_scene_camera_switch_update(scene)) { oglrender->v3d->camera = scene->camera; } @@ -499,7 +499,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) } } else { - scene_camera_switch_update(scene); + BKE_scene_camera_switch_update(scene); camera = scene->camera; } @@ -539,7 +539,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) } else { BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, TRUE); - ok = BKE_write_ibuf_stamp(scene, camera, ibuf, name, &scene->r.im_format); + ok = BKE_imbuf_write_stamp(scene, camera, ibuf, name, &scene->r.im_format); if (ok == 0) { printf("Write error: cannot save %s\n", name); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 32ed74097e1..f7024444e86 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -754,13 +754,13 @@ static void shader_preview_free(void *customdata) /* get rid of copied material */ BLI_remlink(&pr_main->mat, sp->matcopy); - /* free_material decrements texture, prevent this. hack alert! */ + /* BKE_material_free decrements texture, prevent this. hack alert! */ for (a = 0; a < MAX_MTEX; a++) { MTex *mtex = sp->matcopy->mtex[a]; if (mtex && mtex->tex) mtex->tex = NULL; } - free_material(sp->matcopy); + BKE_material_free(sp->matcopy); properties = IDP_GetProperties((ID *)sp->matcopy, FALSE); if (properties) { @@ -776,7 +776,7 @@ static void shader_preview_free(void *customdata) /* get rid of copied texture */ BLI_remlink(&pr_main->tex, sp->texcopy); - free_texture(sp->texcopy); + BKE_texture_free(sp->texcopy); properties = IDP_GetProperties((ID *)sp->texcopy, FALSE); if (properties) { @@ -792,7 +792,7 @@ static void shader_preview_free(void *customdata) /* get rid of copied world */ BLI_remlink(&pr_main->world, sp->worldcopy); - free_world(sp->worldcopy); + BKE_world_free(sp->worldcopy); properties = IDP_GetProperties((ID *)sp->worldcopy, FALSE); if (properties) { @@ -808,7 +808,7 @@ static void shader_preview_free(void *customdata) /* get rid of copied lamp */ BLI_remlink(&pr_main->lamp, sp->lampcopy); - free_lamp(sp->lampcopy); + BKE_lamp_free(sp->lampcopy); properties = IDP_GetProperties((ID *)sp->lampcopy, FALSE); if (properties) { diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 0b8408c698c..ca4683b864c 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -190,7 +190,7 @@ static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op)) EditFont *ef = ((Curve *)ob->data)->editfont; int i, selstart, selend; - if (ef && BKE_font_getselection(ob, &selstart, &selend)) { + if (ef && BKE_vfont_select_get(ob, &selstart, &selend)) { for (i = selstart; i <= selend; i++) ef->textbufinfo[i].mat_nr = ob->actcol; } @@ -372,12 +372,12 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op)) /* add or copy material */ if (ma) { - ma = copy_material(ma); + ma = BKE_material_copy(ma); } else { - ma = add_material("Material"); + ma = BKE_material_add("Material"); - if (scene_use_new_shading_nodes(scene)) { + if (BKE_scene_use_new_shading_nodes(scene)) { ED_node_shader_default(scene, &ma->id); ma->use_nodes = 1; } @@ -425,7 +425,7 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op)) /* add or copy texture */ if (tex) - tex = copy_texture(tex); + tex = BKE_texture_copy(tex); else tex = add_texture("Texture"); @@ -472,12 +472,12 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op)) /* add or copy world */ if (wo) { - wo = copy_world(wo); + wo = BKE_world_copy(wo); } else { wo = add_world("World"); - if (scene_use_new_shading_nodes(scene)) { + if (BKE_scene_use_new_shading_nodes(scene)) { ED_node_shader_default(scene, &wo->id); wo->use_nodes = 1; } @@ -521,7 +521,7 @@ static int render_layer_add_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); - scene_add_render_layer(scene, NULL); + BKE_scene_add_render_layer(scene, NULL); scene->r.actlay = BLI_countlist(&scene->r.layers) - 1; WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); @@ -548,7 +548,7 @@ static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op)) Scene *scene = CTX_data_scene(C); SceneRenderLayer *rl = BLI_findlink(&scene->r.layers, scene->r.actlay); - if (!scene_remove_render_layer(CTX_data_main(C), scene, rl)) + if (!BKE_scene_remove_render_layer(CTX_data_main(C), scene, rl)) return OPERATOR_CANCELLED; WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 9e044068468..6c5991422e5 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -145,7 +145,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult for (base=scene->base.first; base; base=base->next) { if ((base->flag & SELECT) && (base->lay & scene->lay)) { if ((base->object->restrictflag & OB_RESTRICT_VIEW)==0) { - if (0==object_is_libdata(base->object)) { + if (0==BKE_object_is_libdata(base->object)) { if (selected_editable_objects) CTX_data_id_list_add(result, &base->object->id); else @@ -242,7 +242,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult } } else if (CTX_data_equals(member, "visible_pose_bones")) { - Object *obpose= object_pose_armature_get(obact); + Object *obpose= BKE_object_pose_armature_get(obact); bArmature *arm= (obpose) ? obpose->data : NULL; bPoseChannel *pchan; @@ -258,7 +258,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult } } else if (CTX_data_equals(member, "selected_pose_bones")) { - Object *obpose= object_pose_armature_get(obact); + Object *obpose= BKE_object_pose_armature_get(obact); bArmature *arm= (obpose) ? obpose->data : NULL; bPoseChannel *pchan; @@ -293,9 +293,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult } else if (CTX_data_equals(member, "active_pose_bone")) { bPoseChannel *pchan; - Object *obpose= object_pose_armature_get(obact); + Object *obpose= BKE_object_pose_armature_get(obact); - pchan= get_active_posechannel(obpose); + pchan= BKE_pose_channel_active(obpose); if (pchan) { CTX_data_pointer_set(result, &obpose->id, &RNA_PoseBone, pchan); return 1; diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 512cd404273..b2a2a371a1a 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -419,7 +419,7 @@ bScreen *ED_screen_add(wmWindow *win, Scene *scene, const char *name) bScreen *sc; ScrVert *sv1, *sv2, *sv3, *sv4; - sc= alloc_libblock(&G.main->screen, ID_SCR, name); + sc= BKE_libblock_alloc(&G.main->screen, ID_SCR, name); sc->scene= scene; sc->do_refresh= 1; sc->redraws_flag= TIME_ALL_3D_WIN|TIME_ALL_ANIM_WIN; @@ -448,7 +448,7 @@ static void screen_copy(bScreen *to, bScreen *from) ScrArea *sa, *saf; /* free contents of 'to', is from blenkernel screen.c */ - free_screen(to); + BKE_screen_free(to); BLI_duplicatelist(&to->vertbase, &from->vertbase); BLI_duplicatelist(&to->edgebase, &from->edgebase); @@ -1426,7 +1426,7 @@ void ED_screen_delete(bContext *C, bScreen *sc) ED_screen_set(C, newsc); if (delete && win->screen != sc) - free_libblock(&bmain->screen, sc); + BKE_libblock_free(&bmain->screen, sc); } /* only call outside of area/region loops */ @@ -1471,8 +1471,8 @@ void ED_screen_set_scene(bContext *C, bScreen *screen, Scene *scene) BKE_screen_view3d_sync(v3d, scene); - if (!v3d->camera || !object_in_scene(v3d->camera, scene)) { - v3d->camera= scene_find_camera(sc->scene); + if (!v3d->camera || !BKE_scene_base_find(scene, v3d->camera)) { + v3d->camera= BKE_scene_camera_find(sc->scene); // XXX if (sc==curscreen) handle_view3d_lock(); if (!v3d->camera) { ARegion *ar; @@ -1495,7 +1495,7 @@ void ED_screen_set_scene(bContext *C, bScreen *screen, Scene *scene) } CTX_data_scene_set(C, scene); - set_scene_bg(bmain, scene); + BKE_scene_set_background(bmain, scene); ED_render_engine_changed(bmain); ED_update_for_newframe(bmain, scene, screen, 1); @@ -1520,7 +1520,7 @@ void ED_screen_delete_scene(bContext *C, Scene *scene) ED_screen_set_scene(C, CTX_wm_screen(C), newscene); - unlink_scene(bmain, scene, newscene); + BKE_scene_unlink(bmain, scene, newscene); } ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *sa, int type) @@ -1654,8 +1654,8 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa) ED_screen_set(C, sc); - free_screen(oldscreen); - free_libblock(&CTX_data_main(C)->screen, oldscreen); + BKE_screen_free(oldscreen); + BKE_libblock_free(&CTX_data_main(C)->screen, oldscreen); } else { @@ -1816,7 +1816,7 @@ void ED_screen_animation_timer_update(bScreen *screen, int redraws, int refresh) void ED_update_for_newframe(Main *bmain, Scene *scene, bScreen *screen, int UNUSED(mute)) { #ifdef DURIAN_CAMERA_SWITCH - void *camera= scene_camera_switch_find(scene); + void *camera= BKE_scene_camera_switch_find(scene); if (camera && scene->camera != camera) { bScreen *sc; scene->camera= camera; @@ -1830,14 +1830,14 @@ void ED_update_for_newframe(Main *bmain, Scene *scene, bScreen *screen, int UNUS //extern void audiostream_scrub(unsigned int frame); /* seqaudio.c */ /* update animated image textures for gpu, etc, - * call before scene_update_for_newframe so modifiers with textures don't lag 1 frame */ + * call before BKE_scene_update_for_newframe so modifiers with textures don't lag 1 frame */ ED_image_update_frame(bmain, scene->r.cfra); ED_clip_update_frame(bmain, scene->r.cfra); /* this function applies the changes too */ /* XXX future: do all windows */ - scene_update_for_newframe(bmain, scene, BKE_screen_visible_layers(screen, scene)); /* BKE_scene.h */ + BKE_scene_update_for_newframe(bmain, scene, BKE_screen_visible_layers(screen, scene)); /* BKE_scene.h */ //if ( (CFRA>1) && (!mute) && (scene->r.audio.flag & AUDIO_SCRUB)) // audiostream_scrub( CFRA ); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 49672b77d43..1f30fe691c1 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -347,7 +347,7 @@ int ED_operator_posemode(bContext *C) if (obact && !(obact->mode & OB_MODE_EDIT)) { Object *obpose; - if ((obpose= object_pose_armature_get(obact))) { + if ((obpose= BKE_object_pose_armature_get(obact))) { if ((obact == obpose) || (obact->mode & OB_MODE_WEIGHT_PAINT)) { return 1; } @@ -3319,10 +3319,10 @@ static int scene_new_exec(bContext *C, wmOperator *op) int type= RNA_enum_get(op->ptr, "type"); if (type == SCE_COPY_NEW) { - newscene= add_scene("Scene"); + newscene= BKE_scene_add("Scene"); } else { /* different kinds of copying */ - newscene= copy_scene(scene, type); + newscene= BKE_scene_copy(scene, type); /* these can't be handled in blenkernel curently, so do them here */ if (type == SCE_COPY_LINK_DATA) { diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 22a1770412f..4f2433977e0 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -190,7 +190,7 @@ static int screenshot_exec(bContext *C, wmOperator *op) /* bw screenshot? - users will notice if it fails! */ IMB_color_to_bw(ibuf); } - BKE_write_ibuf(ibuf, path, &scd->im_format); + BKE_imbuf_write(ibuf, path, &scd->im_format); IMB_freeImBuf(ibuf); } @@ -357,7 +357,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float BKE_makepicstring(name, rd.pic, sj->bmain->name, rd.cfra, rd.im_format.imtype, rd.scemode & R_EXTENSION, TRUE); ibuf->rect= sj->dumprect; - ok= BKE_write_ibuf(ibuf, name, &rd.im_format); + ok= BKE_imbuf_write(ibuf, name, &rd.im_format); if (ok==0) { printf("Write error: cannot save %s\n", name); diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 553a9a335d7..c681f8ddb75 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -69,7 +69,7 @@ typedef struct Snapshot { float size[3]; float ofs[3]; float rot; - int brush_size; + int BKE_brush_size_get; int winx; int winy; int brush_map_mode; @@ -87,8 +87,8 @@ static int same_snap(Snapshot *snap, Brush *brush, ViewContext *vc) /* make brush smaller shouldn't cause a resample */ ((mtex->brush_map_mode == MTEX_MAP_MODE_FIXED && - (brush_size(vc->scene, brush) <= snap->brush_size)) || - (brush_size(vc->scene, brush) == snap->brush_size)) && + (BKE_brush_size_get(vc->scene, brush) <= snap->BKE_brush_size_get)) || + (BKE_brush_size_get(vc->scene, brush) == snap->BKE_brush_size_get)) && (mtex->brush_map_mode == snap->brush_map_mode) && (vc->ar->winx == snap->winx) && @@ -110,7 +110,7 @@ static void make_snap(Snapshot *snap, Brush *brush, ViewContext *vc) snap->rot = -1; } - snap->brush_size = brush_size(vc->scene, brush); + snap->BKE_brush_size_get = BKE_brush_size_get(vc->scene, brush); snap->winx = vc->ar->winx; snap->winy = vc->ar->winy; } @@ -155,7 +155,7 @@ static int load_tex(Sculpt *sd, Brush *br, ViewContext *vc) make_snap(&snap, br, vc); if (br->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) { - int s = brush_size(vc->scene, br); + int s = BKE_brush_size_get(vc->scene, br); int r = 1; for (s >>= 1; s > 0; s >>= 1) @@ -196,7 +196,7 @@ static int load_tex(Sculpt *sd, Brush *br, ViewContext *vc) // largely duplicated from tex_strength const float rotation = -br->mtex.rot; - float radius = brush_size(vc->scene, br); + float radius = BKE_brush_size_get(vc->scene, br); int index = j * size + i; float x; float avg; @@ -240,7 +240,7 @@ static int load_tex(Sculpt *sd, Brush *br, ViewContext *vc) avg += br->texture_sample_bias; if (br->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) - avg *= brush_curve_strength(br, len, 1); /* Falloff curve */ + avg *= BKE_brush_curve_strength(br, len, 1); /* Falloff curve */ buffer[index] = 255 - (GLubyte)(255 * avg); } @@ -345,11 +345,11 @@ static int sculpt_get_brush_geometry(bContext *C, ViewContext *vc, sculpt_stroke_get_location(C, location, window)) { *pixel_radius = project_brush_radius(vc, - brush_unprojected_radius(scene, brush), + BKE_brush_unprojected_radius_get(scene, brush), location); if (*pixel_radius == 0) - *pixel_radius = brush_size(scene, brush); + *pixel_radius = BKE_brush_size_get(scene, brush); mul_m4_v3(vc->obact->obmat, location); @@ -359,7 +359,7 @@ static int sculpt_get_brush_geometry(bContext *C, ViewContext *vc, Sculpt *sd = CTX_data_tool_settings(C)->sculpt; Brush *brush = paint_brush(&sd->paint); - *pixel_radius = brush_size(scene, brush); + *pixel_radius = BKE_brush_size_get(scene, brush); hit = 0; } @@ -414,7 +414,7 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush, glTranslatef(-0.5f, -0.5f, 0); /* scale based on tablet pressure */ - if (sd->draw_pressure && brush_use_size_pressure(vc->scene, brush)) { + if (sd->draw_pressure && BKE_brush_use_size_pressure(vc->scene, brush)) { glTranslatef(0.5f, 0.5f, 0); glScalef(1.0f / sd->pressure_value, 1.0f / sd->pressure_value, 1); glTranslatef(-0.5f, -0.5f, 0); @@ -429,7 +429,7 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush, quad.ymax = aim[1] + sd->anchored_size - win->ymin; } else { - const int radius = brush_size(vc->scene, brush); + const int radius = BKE_brush_size_get(vc->scene, brush); quad.xmin = x - radius; quad.ymin = y - radius; quad.xmax = x + radius; @@ -475,7 +475,7 @@ static void paint_cursor_on_hit(Sculpt *sd, Brush *brush, ViewContext *vc, float unprojected_radius, projected_radius; /* update the brush's cached 3D radius */ - if (!brush_use_locked_size(vc->scene, brush)) { + if (!BKE_brush_use_locked_size(vc->scene, brush)) { /* get 2D brush radius */ if (sd->draw_anchored) projected_radius = sd->anchored_size; @@ -483,7 +483,7 @@ static void paint_cursor_on_hit(Sculpt *sd, Brush *brush, ViewContext *vc, if (brush->flag & BRUSH_ANCHORED) projected_radius = 8; else - projected_radius = brush_size(vc->scene, brush); + projected_radius = BKE_brush_size_get(vc->scene, brush); } /* convert brush radius from 2D to 3D */ @@ -491,11 +491,11 @@ static void paint_cursor_on_hit(Sculpt *sd, Brush *brush, ViewContext *vc, projected_radius); /* scale 3D brush radius by pressure */ - if (sd->draw_pressure && brush_use_size_pressure(vc->scene, brush)) + if (sd->draw_pressure && BKE_brush_use_size_pressure(vc->scene, brush)) unprojected_radius *= sd->pressure_value; /* set cached value in either Brush or UnifiedPaintSettings */ - brush_set_unprojected_radius(vc->scene, brush, unprojected_radius); + BKE_brush_unprojected_radius_set(vc->scene, brush, unprojected_radius); } } @@ -514,7 +514,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) translation[1] = y; outline_alpha = 0.5; outline_col = brush->add_col; - final_radius = brush_size(scene, brush); + final_radius = BKE_brush_size_get(scene, brush); /* check that brush drawing is enabled */ if (!(paint->flags & PAINT_SHOW_BRUSH)) @@ -557,8 +557,8 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) /* draw overlay */ paint_draw_alpha_overlay(sd, brush, &vc, x, y); - if (brush_use_locked_size(scene, brush)) - brush_set_size(scene, brush, pixel_radius); + if (BKE_brush_use_locked_size(scene, brush)) + BKE_brush_size_set(scene, brush, pixel_radius); /* check if brush is subtracting, use different color then */ /* TODO: no way currently to know state of pen flip or diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index 47536d99fcb..c96da7d52c6 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -364,6 +364,7 @@ void PAINT_OT_hide_show(struct wmOperatorType *ot) /* identifiers */ ot->name = "Hide/Show"; ot->idname = "PAINT_OT_hide_show"; + ot->description = "Hide/show some vertices"; /* api callbacks */ ot->invoke = hide_show_invoke; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index dcf4efeff13..c46c153aa70 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -310,7 +310,7 @@ typedef struct ProjPaintState { short do_occlude; /* Use raytraced occlusion? - ortherwise will paint right through to the back*/ short do_backfacecull; /* ignore faces with normals pointing away, skips a lot of raycasts if your normals are correctly flipped */ short do_mask_normal; /* mask out pixels based on their normals */ - short do_new_shading_nodes; /* cache scene_use_new_shading_nodes value */ + short do_new_shading_nodes; /* cache BKE_scene_use_new_shading_nodes value */ float normal_angle; /* what angle to mask at*/ float normal_angle_inner; float normal_angle_range; /* difference between normal_angle and normal_angle_inner, for easy access */ @@ -526,7 +526,7 @@ static Image *imapaint_face_image(const ImagePaintState *s, int face_index) { Image *ima; - if (scene_use_new_shading_nodes(s->scene)) { + if (BKE_scene_use_new_shading_nodes(s->scene)) { MFace *mf = &s->dm_mface[face_index]; ED_object_get_active_image(s->ob, mf->mat_nr + 1, &ima, NULL, NULL); } @@ -542,7 +542,7 @@ static Image *project_paint_face_image(const ProjPaintState *ps, MTFace *dm_mtfa { Image *ima; - if (ps->do_new_shading_nodes) { /* cached scene_use_new_shading_nodes result */ + if (ps->do_new_shading_nodes) { /* cached BKE_scene_use_new_shading_nodes result */ MFace *mf = ps->dm_mface + face_index; ED_object_get_active_image(ps->ob, mf->mat_nr + 1, &ima, NULL, NULL); } @@ -1457,7 +1457,7 @@ static float project_paint_uvpixel_mask( // This only works when the opacity dosnt change while painting, stylus pressure messes with this // so don't use it. - // if (ps->is_airbrush==0) mask *= brush_alpha(ps->brush); + // if (ps->is_airbrush==0) mask *= BKE_brush_alpha_get(ps->brush); return mask; } @@ -2953,7 +2953,7 @@ static void project_paint_begin(ProjPaintState *ps) MemArena *arena; /* at the moment this is just ps->arena_mt[0], but use this to show were not multithreading */ - const int diameter = 2 * brush_size(ps->scene, ps->brush); + const int diameter = 2 * BKE_brush_size_get(ps->scene, ps->brush); /* ---- end defines ---- */ @@ -3091,10 +3091,10 @@ static void project_paint_begin(ProjPaintState *ps) invert_m4_m4(viewmat, viewinv); /* window matrix, clipping and ortho */ - camera_params_init(¶ms); - camera_params_from_object(¶ms, cam_ob); - camera_params_compute_viewplane(¶ms, ps->winx, ps->winy, 1.0f, 1.0f); - camera_params_compute_matrix(¶ms); + BKE_camera_params_init(¶ms); + BKE_camera_params_from_object(¶ms, cam_ob); + BKE_camera_params_compute_viewplane(¶ms, ps->winx, ps->winy, 1.0f, 1.0f); + BKE_camera_params_compute_matrix(¶ms); copy_m4_m4(winmat, params.winmat); ps->clipsta = params.clipsta; @@ -3597,7 +3597,7 @@ static int project_bucket_iter_init(ProjPaintState *ps, const float mval_f[2]) { if (ps->source == PROJ_SRC_VIEW) { float min_brush[2], max_brush[2]; - const float radius = (float)brush_size(ps->scene, ps->brush); + const float radius = (float)BKE_brush_size_get(ps->scene, ps->brush); /* so we don't have a bucket bounds that is way too small to paint into */ // if (radius < 1.0f) radius = 1.0f; // this doesn't work yet :/ @@ -3635,7 +3635,7 @@ static int project_bucket_iter_init(ProjPaintState *ps, const float mval_f[2]) static int project_bucket_iter_next(ProjPaintState *ps, int *bucket_index, rctf *bucket_bounds, const float mval[2]) { - const int diameter = 2 * brush_size(ps->scene, ps->brush); + const int diameter = 2 * BKE_brush_size_get(ps->scene, ps->brush); if (ps->thread_tot > 1) BLI_lock_thread(LOCK_CUSTOM1); @@ -3859,7 +3859,7 @@ static void *do_projectpaint_thread(void *ph_v) float co[2]; float mask = 1.0f; /* airbrush wont use mask */ unsigned short mask_short; - const float radius = (float)brush_size(ps->scene, ps->brush); + const float radius = (float)BKE_brush_size_get(ps->scene, ps->brush); const float radius_squared = radius * radius; /* avoid a square root with every dist comparison */ short lock_alpha = ELEM(ps->brush->blend, IMB_BLEND_ERASE_ALPHA, IMB_BLEND_ADD_ALPHA) ? 0 : ps->brush->flag & BRUSH_LOCK_ALPHA; @@ -3913,12 +3913,12 @@ static void *do_projectpaint_thread(void *ph_v) if (dist_nosqrt <= radius_squared) { dist = sqrtf(dist_nosqrt); - falloff = brush_curve_strength_clamp(ps->brush, dist, radius); + falloff = BKE_brush_curve_strength_clamp(ps->brush, dist, radius); if (falloff > 0.0f) { if (ps->is_texbrush) { /* note, for clone and smear, we only use the alpha, could be a special function */ - brush_sample_tex(ps->scene, ps->brush, projPixel->projCoSS, rgba, thread_index); + BKE_brush_sample_tex(ps->scene, ps->brush, projPixel->projCoSS, rgba, thread_index); alpha = rgba[3]; } else { @@ -3927,7 +3927,7 @@ static void *do_projectpaint_thread(void *ph_v) if (ps->is_airbrush) { /* for an aurbrush there is no real mask, so just multiply the alpha by it */ - alpha *= falloff * brush_alpha(ps->scene, ps->brush); + alpha *= falloff * BKE_brush_alpha_get(ps->scene, ps->brush); mask = ((float)projPixel->mask) / 65535.0f; } else { @@ -3935,7 +3935,7 @@ static void *do_projectpaint_thread(void *ph_v) falloff = 1.0f - falloff; falloff = 1.0f - (falloff * falloff); - mask_short = (unsigned short)(projPixel->mask * (brush_alpha(ps->scene, ps->brush) * falloff)); + mask_short = (unsigned short)(projPixel->mask * (BKE_brush_alpha_get(ps->scene, ps->brush) * falloff)); if (mask_short > projPixel->mask_max) { mask = ((float)mask_short) / 65535.0f; projPixel->mask_max = mask_short; @@ -4101,9 +4101,9 @@ static int project_paint_sub_stroke(ProjPaintState *ps, BrushPainter *painter, c pos[1] = (float)(mval_i[1]); // we may want to use this later - // brush_painter_require_imbuf(painter, ((ibuf->rect_float)? 1: 0), 0, 0); + // BKE_brush_painter_require_imbuf(painter, ((ibuf->rect_float)? 1: 0), 0, 0); - if (brush_painter_paint(painter, project_paint_op, pos, time, pressure, ps, 0)) { + if (BKE_brush_painter_paint(painter, project_paint_op, pos, time, pressure, ps, 0)) { return 1; } else return 0; @@ -4525,9 +4525,9 @@ static int imapaint_paint_sub_stroke(ImagePaintState *s, BrushPainter *painter, pos[0] = uv[0] * ibuf->x; pos[1] = uv[1] * ibuf->y; - brush_painter_require_imbuf(painter, ((ibuf->rect_float) ? 1 : 0), 0, 0); + BKE_brush_painter_require_imbuf(painter, ((ibuf->rect_float) ? 1 : 0), 0, 0); - if (brush_painter_paint(painter, imapaint_paint_op, pos, time, pressure, s, ibuf->profile == IB_PROFILE_LINEAR_RGB)) { + if (BKE_brush_painter_paint(painter, imapaint_paint_op, pos, time, pressure, s, ibuf->profile == IB_PROFILE_LINEAR_RGB)) { if (update) imapaint_image_update(s->sima, image, ibuf, texpaint); return 1; @@ -4580,7 +4580,7 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint redraw |= imapaint_paint_sub_stroke(s, painter, s->image, texpaint, fwuv, time, 1, pressure); imapaint_clear_partial_redraw(); - brush_painter_break_stroke(painter); + BKE_brush_painter_break_stroke(painter); } /* set new canvas */ @@ -4775,7 +4775,7 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps) ps->do_backfacecull = (settings->imapaint.flag & IMAGEPAINT_PROJECT_BACKFACE) ? 0 : 1; ps->do_occlude = (settings->imapaint.flag & IMAGEPAINT_PROJECT_XRAY) ? 0 : 1; ps->do_mask_normal = (settings->imapaint.flag & IMAGEPAINT_PROJECT_FLAT) ? 0 : 1; - ps->do_new_shading_nodes = scene_use_new_shading_nodes(scene); /* only cache the value */ + ps->do_new_shading_nodes = BKE_scene_use_new_shading_nodes(scene); /* only cache the value */ if (ps->tool == PAINT_TOOL_CLONE) ps->do_layer_clone = (settings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_CLONE); @@ -4854,11 +4854,11 @@ static int texture_paint_init(bContext *C, wmOperator *op) if (pop->mode == PAINT_MODE_3D && (pop->s.tool == PAINT_TOOL_CLONE)) pop->s.tool = PAINT_TOOL_DRAW; pop->s.blend = brush->blend; - pop->orig_brush_size = brush_size(scene, brush); + pop->orig_brush_size = BKE_brush_size_get(scene, brush); if (pop->mode != PAINT_MODE_2D) { Object *ob = OBACT; - Mesh *me = get_mesh(ob); + Mesh *me = BKE_mesh_from_object(ob); if (!me) { return 0; @@ -4920,8 +4920,8 @@ static int texture_paint_init(bContext *C, wmOperator *op) return 0; /* Don't allow brush size below 2 */ - if (brush_size(scene, brush) < 2) - brush_set_size(scene, brush, 2); + if (BKE_brush_size_get(scene, brush) < 2) + BKE_brush_size_set(scene, brush, 2); /* allocate and initialize spacial data structures */ project_paint_begin(&pop->ps); @@ -4935,7 +4935,7 @@ static int texture_paint_init(bContext *C, wmOperator *op) image_undo_restore, image_undo_free); /* create painter */ - pop->painter = brush_painter_new(scene, pop->s.brush); + pop->painter = BKE_brush_painter_new(scene, pop->s.brush); return 1; } @@ -5002,10 +5002,10 @@ static void paint_exit(bContext *C, wmOperator *op) settings->imapaint.flag &= ~IMAGEPAINT_DRAWING; imapaint_canvas_free(&pop->s); - brush_painter_free(pop->painter); + BKE_brush_painter_free(pop->painter); if (pop->mode == PAINT_MODE_3D_PROJECT) { - brush_set_size(scene, pop->ps.brush, pop->orig_brush_size); + BKE_brush_size_set(scene, pop->ps.brush, pop->orig_brush_size); paint_brush_exit_tex(pop->ps.brush); project_paint_end(&pop->ps); @@ -5079,13 +5079,13 @@ static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event) /* special exception here for too high pressure values on first touch in * windows for some tablets, then we just skip first touch .. */ - if (tablet && (pressure >= 0.99f) && ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) || brush_use_alpha_pressure(scene, pop->s.brush) || brush_use_size_pressure(scene, pop->s.brush))) + if (tablet && (pressure >= 0.99f) && ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) || BKE_brush_use_alpha_pressure(scene, pop->s.brush) || BKE_brush_use_size_pressure(scene, pop->s.brush))) return; /* This can be removed once fixed properly in - * brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, double time, float pressure, void *user) + * BKE_brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, double time, float pressure, void *user) * at zero pressure we should do nothing 1/2^12 is .0002 which is the sensitivity of the most sensitive pen tablet available */ - if (tablet && (pressure < .0002f) && ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) || brush_use_alpha_pressure(scene, pop->s.brush) || brush_use_size_pressure(scene, pop->s.brush))) + if (tablet && (pressure < .0002f) && ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) || BKE_brush_use_alpha_pressure(scene, pop->s.brush) || BKE_brush_use_size_pressure(scene, pop->s.brush))) return; } @@ -5160,6 +5160,7 @@ void PAINT_OT_image_paint(wmOperatorType *ot) /* identifiers */ ot->name = "Image Paint"; ot->idname = "PAINT_OT_image_paint"; + ot->description = "Paint a stroke into the image"; /* api callbacks */ ot->exec = paint_exec; @@ -5208,7 +5209,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata) if (paint && brush && paint->flags & PAINT_SHOW_BRUSH) { ToolSettings *ts; float zoomx, zoomy; - const float size = (float)brush_size(scene, brush); + const float size = (float)BKE_brush_size_get(scene, brush); short use_zoom; float pixel_size; float alpha = 0.5f; @@ -5387,6 +5388,7 @@ void PAINT_OT_grab_clone(wmOperatorType *ot) /* identifiers */ ot->name = "Grab Clone"; ot->idname = "PAINT_OT_grab_clone"; + ot->description = "Move the clone source image"; /* api callbacks */ ot->exec = grab_clone_exec; @@ -5451,7 +5453,7 @@ static int image_paint_sample_color_poll(bContext *C) if (CTX_wm_view3d(C)) { Object *obact = CTX_data_active_object(C); if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) { - Mesh *me = get_mesh(obact); + Mesh *me = BKE_mesh_from_object(obact); if (me) { return !(me->editflag & ME_EDIT_PAINT_MASK); } @@ -5469,6 +5471,7 @@ void PAINT_OT_sample_color(wmOperatorType *ot) /* identifiers */ ot->name = "Sample Color"; ot->idname = "PAINT_OT_sample_color"; + ot->description = "Use the mouse to sample a color in the image"; /* api callbacks */ ot->exec = sample_color_exec; @@ -5520,6 +5523,7 @@ void PAINT_OT_clone_cursor_set(wmOperatorType *ot) /* identifiers */ ot->name = "Set Clone Cursor"; ot->idname = "PAINT_OT_clone_cursor_set"; + ot->description = "Set the location of the clone cursor"; /* api callbacks */ ot->exec = set_clone_cursor_exec; @@ -5554,12 +5558,12 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op) if (ob == NULL) return OPERATOR_CANCELLED; - if (object_data_is_libdata(ob)) { + if (BKE_object_obdata_is_libdata(ob)) { BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata"); return OPERATOR_CANCELLED; } - me = get_mesh(ob); + me = BKE_mesh_from_object(ob); if (!(ob->mode & OB_MODE_TEXTURE_PAINT) && !me) { BKE_report(op->reports, RPT_ERROR, "Can only enter texture paint mode for mesh objects"); @@ -5602,6 +5606,7 @@ void PAINT_OT_texture_paint_toggle(wmOperatorType *ot) /* identifiers */ ot->name = "Texture Paint Toggle"; ot->idname = "PAINT_OT_texture_paint_toggle"; + ot->description = "Toggle texture paint mode in 3D view"; /* api callbacks */ ot->exec = texture_paint_toggle_exec; @@ -5702,8 +5707,8 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op) /* override */ ps.is_texbrush = 0; ps.is_airbrush = 1; - orig_brush_size = brush_size(scene, ps.brush); - brush_set_size(scene, ps.brush, 32); /* cover the whole image */ + orig_brush_size = BKE_brush_size_get(scene, ps.brush); + BKE_brush_size_set(scene, ps.brush, 32); /* cover the whole image */ ps.tool = PAINT_TOOL_DRAW; /* so pixels are initialized with minimal info */ @@ -5716,7 +5721,7 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op) project_paint_begin(&ps); if (ps.dm == NULL) { - brush_set_size(scene, ps.brush, orig_brush_size); + BKE_brush_size_set(scene, ps.brush, orig_brush_size); return OPERATOR_CANCELLED; } else { @@ -5740,7 +5745,7 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op) project_paint_end(&ps); scene->toolsettings->imapaint.flag &= ~IMAGEPAINT_DRAWING; - brush_set_size(scene, ps.brush, orig_brush_size); + BKE_brush_size_set(scene, ps.brush, orig_brush_size); return OPERATOR_FINISHED; } @@ -5794,7 +5799,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - image = BKE_add_image_imbuf(ibuf); + image = BKE_image_add_from_imbuf(ibuf); if (image) { /* now for the trickyness. store the view projection here! diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 6860b551556..bf01c91171b 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -63,9 +63,9 @@ static int brush_add_exec(bContext *C, wmOperator *UNUSED(op)) struct Brush *br = paint_brush(paint); if (br) - br = copy_brush(br); + br = BKE_brush_copy(br); else - br = add_brush("Brush"); + br = BKE_brush_add("Brush"); paint_brush_set(paint_get_active(CTX_data_scene(C)), br); @@ -98,7 +98,7 @@ static int brush_scale_size_exec(bContext *C, wmOperator *op) if (brush) { // pixel radius { - const int old_size = brush_size(scene, brush); + const int old_size = BKE_brush_size_get(scene, brush); int size = (int)(scalar * old_size); if (old_size == size) { @@ -111,17 +111,17 @@ static int brush_scale_size_exec(bContext *C, wmOperator *op) } CLAMP(size, 1, 2000); // XXX magic number - brush_set_size(scene, brush, size); + BKE_brush_size_set(scene, brush, size); } // unprojected radius { - float unprojected_radius = scalar * brush_unprojected_radius(scene, brush); + float unprojected_radius = scalar * BKE_brush_unprojected_radius_get(scene, brush); if (unprojected_radius < 0.001f) // XXX magic number unprojected_radius = 0.001f; - brush_set_unprojected_radius(scene, brush, unprojected_radius); + BKE_brush_unprojected_radius_set(scene, brush, unprojected_radius); } } @@ -160,6 +160,7 @@ static void PAINT_OT_vertex_color_set(wmOperatorType *ot) /* identifiers */ ot->name = "Set Vertex Colors"; ot->idname = "PAINT_OT_vertex_color_set"; + ot->description = "Fill the active vertex color layer with the current paint color"; /* api callbacks */ ot->exec = vertex_color_set_exec; @@ -178,7 +179,7 @@ static int brush_reset_exec(bContext *C, wmOperator *UNUSED(op)) if (!ob) return OPERATOR_CANCELLED; if (ob->mode & OB_MODE_SCULPT) - brush_reset_sculpt(brush); + BKE_brush_sculpt_reset(brush); /* TODO: other modes */ return OPERATOR_FINISHED; diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 448fb37ef54..7471787eb95 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -146,10 +146,10 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev if (stroke->vc.obact->sculpt) { float delta[2]; - brush_jitter_pos(scene, brush, mouse_in, mouse); + BKE_brush_jitter_pos(scene, brush, mouse_in, mouse); /* XXX: meh, this is round about because - * brush_jitter_pos isn't written in the best way to + * BKE_brush_jitter_pos isn't written in the best way to * be reused here */ if (brush->flag & BRUSH_JITTER_PRESSURE) { sub_v2_v2v2(delta, mouse, mouse_in); @@ -231,11 +231,11 @@ static int paint_space_stroke(bContext *C, wmOperator *op, wmEvent *event, const float pressure = 1.0f; /* XXX mysterious :) what has 'use size' do with this here... if you don't check for it, pressure fails */ - if (brush_use_size_pressure(scene, stroke->brush)) + if (BKE_brush_use_size_pressure(scene, stroke->brush)) pressure = event_tablet_data(event, NULL); if (pressure > FLT_EPSILON) { - scale = (brush_size(scene, stroke->brush) * pressure * stroke->brush->spacing / 50.0f) / length; + scale = (BKE_brush_size_get(scene, stroke->brush) * pressure * stroke->brush->spacing / 50.0f) / length; if (scale > FLT_EPSILON) { mul_v2_fl(vec, scale); diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 89a46272a8f..fb5ddda7a3e 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -358,7 +358,7 @@ void paint_sample_color(Scene *scene, ARegion *ar, int x, int y) /* frontbuf static int brush_curve_preset_exec(bContext *C, wmOperator *op) { Brush *br = paint_brush(paint_get_active(CTX_data_scene(C))); - brush_curve_preset(br, RNA_enum_get(op->ptr, "shape")); + BKE_brush_curve_preset(br, RNA_enum_get(op->ptr, "shape")); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 18ddc965976..9d7b7c75837 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -93,7 +93,7 @@ static int vertex_paint_use_fast_update_check(Object *ob) DerivedMesh *dm = ob->derivedFinal; if (dm) { - Mesh *me = get_mesh(ob); + Mesh *me = BKE_mesh_from_object(ob); if (me && me->mcol) { return (me->mcol == CustomData_get_layer(&dm->faceData, CD_MCOL)); } @@ -110,7 +110,7 @@ static int vertex_paint_use_tessface_check(Object *ob) DerivedMesh *dm = ob->derivedFinal; if (dm) { - Mesh *me = get_mesh(ob); + Mesh *me = BKE_mesh_from_object(ob); return (me->mpoly == CustomData_get_layer(&dm->faceData, CD_MPOLY)); } @@ -317,7 +317,7 @@ static void make_vertexcol(Object *ob) /* single ob */ { Mesh *me; if (!ob || ob->id.lib) return; - me = get_mesh(ob); + me = BKE_mesh_from_object(ob); if (me == NULL) return; if (me->edit_btmesh) return; @@ -433,7 +433,7 @@ void vpaint_fill(Object *ob, unsigned int paintcol) MLoopCol *lcol; int i, j, selected; - me = get_mesh(ob); + me = BKE_mesh_from_object(ob); if (me == NULL || me->totpoly == 0) return; if (!me->mloopcol) make_vertexcol(ob); @@ -551,7 +551,7 @@ void vpaint_dogamma(Scene *scene) unsigned char *cp, gamtab[256]; ob = OBACT; - me = get_mesh(ob); + me = BKE_mesh_from_object(ob); if (!(ob->mode & OB_MODE_VERTEX_PAINT)) return; if (me == 0 || me->mcol == 0 || me->totface == 0) return; @@ -859,7 +859,7 @@ static float calc_vp_strength_dl(VPaint *vp, ViewContext *vc, const float *vert_ } else { const float dist = sqrtf(dist_squared); - return brush_curve_strength_clamp(brush, dist, brush_size_pressure); + return BKE_brush_curve_strength_clamp(brush, dist, brush_size_pressure); } } @@ -1007,7 +1007,7 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, wmEvent *event) short change = FALSE; view3d_set_viewcontext(C, &vc); - me = get_mesh(vc.obact); + me = BKE_mesh_from_object(vc.obact); if (me && me->dvert && vc.v3d && vc.rv3d) { int index; @@ -1051,7 +1051,7 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, wmEvent *event) if (v_idx_best != -1) { /* should always be valid */ float vgroup_weight = defvert_find_weight(&me->dvert[v_idx_best], vgroup_active); - brush_set_weight(scene, brush, vgroup_weight); + BKE_brush_weight_set(scene, brush, vgroup_weight); change = TRUE; } } @@ -1075,6 +1075,7 @@ void PAINT_OT_weight_sample(wmOperatorType *ot) /* identifiers */ ot->name = "Weight Paint Sample Weight"; ot->idname = "PAINT_OT_weight_sample"; + ot->description = "Use the mouse to sample a weight in the 3D view"; /* api callbacks */ ot->invoke = weight_sample_invoke; @@ -1094,7 +1095,7 @@ static EnumPropertyItem *weight_paint_sample_enum_itemf(bContext *C, PointerRNA Mesh *me; view3d_set_viewcontext(C, &vc); - me = get_mesh(vc.obact); + me = BKE_mesh_from_object(vc.obact); if (me && me->dvert && vc.v3d && vc.rv3d) { int index; @@ -1176,6 +1177,7 @@ void PAINT_OT_weight_sample_group(wmOperatorType *ot) /* identifiers */ ot->name = "Weight Paint Sample Group"; ot->idname = "PAINT_OT_weight_sample_group"; + ot->description = "Select one of the vertex groups available under current mouse position"; /* api callbacks */ ot->exec = weight_sample_group_exec; @@ -1641,7 +1643,7 @@ typedef struct WeightPaintInfo { char do_multipaint; char do_auto_normalize; - float brush_alpha_value; /* result of brush_alpha() */ + float brush_alpha_value; /* result of BKE_brush_alpha_get() */ } WeightPaintInfo; /* fresh start to make multi-paint and locking modular */ @@ -1975,7 +1977,7 @@ static int set_wpaint(bContext *C, wmOperator *UNUSED(op)) /* toggle */ VPaint *wp = scene->toolsettings->wpaint; Mesh *me; - me = get_mesh(ob); + me = BKE_mesh_from_object(ob); if (ob->id.lib || me == NULL) return OPERATOR_PASS_THROUGH; if (ob->mode & OB_MODE_WEIGHT_PAINT) ob->mode &= ~OB_MODE_WEIGHT_PAINT; @@ -2038,6 +2040,7 @@ void PAINT_OT_weight_paint_toggle(wmOperatorType *ot) /* identifiers */ ot->name = "Weight Paint Mode"; ot->idname = "PAINT_OT_weight_paint_toggle"; + ot->description = "Toggle weight paint mode in 3D view"; /* api callbacks */ ot->exec = set_wpaint; @@ -2139,7 +2142,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED return FALSE; } - me = get_mesh(ob); + me = BKE_mesh_from_object(ob); if (me == NULL || me->totpoly == 0) return OPERATOR_PASS_THROUGH; /* if nothing was added yet, we make dverts and a vertex deform group */ @@ -2154,7 +2157,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED if ((modob = modifiers_isDeformedByArmature(ob))) { Bone *actbone = ((bArmature *)modob->data)->act_bone; if (actbone) { - bPoseChannel *pchan = get_pose_channel(modob->pose, actbone->name); + bPoseChannel *pchan = BKE_pose_channel_find_name(modob->pose, actbone->name); if (pchan) { bDeformGroup *dg = defgroup_find_name(ob, pchan->name); @@ -2244,9 +2247,9 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P char *defbase_sel; const float pressure = RNA_float_get(itemptr, "pressure"); - const float brush_size_pressure = brush_size(scene, brush) * (brush_use_size_pressure(scene, brush) ? pressure : 1.0f); - const float brush_alpha_value = brush_alpha(scene, brush); - const float brush_alpha_pressure = brush_alpha_value * (brush_use_alpha_pressure(scene, brush) ? pressure : 1.0f); + const float brush_size_pressure = BKE_brush_size_get(scene, brush) * (BKE_brush_use_size_pressure(scene, brush) ? pressure : 1.0f); + const float brush_alpha_value = BKE_brush_alpha_get(scene, brush); + const float brush_alpha_pressure = brush_alpha_value * (BKE_brush_use_alpha_pressure(scene, brush) ? pressure : 1.0f); /* intentionally don't initialize as NULL, make sure we initialize all members below */ WeightPaintInfo wpi; @@ -2342,7 +2345,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P if (brush->vertexpaint_tool == PAINT_BLEND_BLUR) paintweight = 0.0f; else - paintweight = brush_weight(scene, brush); + paintweight = BKE_brush_weight_get(scene, brush); for (index = 0; index < totindex; index++) { if (indexar[index] && indexar[index] <= me->totpoly) { @@ -2490,6 +2493,7 @@ void PAINT_OT_weight_paint(wmOperatorType *ot) /* identifiers */ ot->name = "Weight Paint"; ot->idname = "PAINT_OT_weight_paint"; + ot->description = "Paint a stroke in the current vertex group's weights"; /* api callbacks */ ot->invoke = wpaint_invoke; @@ -2510,7 +2514,7 @@ static int weight_paint_set_exec(bContext *C, wmOperator *UNUSED(op)) Object *obact = CTX_data_active_object(C); ToolSettings *ts = CTX_data_tool_settings(C); Brush *brush = paint_brush(&ts->wpaint->paint); - float vgroup_weight = brush_weight(scene, brush); + float vgroup_weight = BKE_brush_weight_get(scene, brush); wpaint_fill(scene->toolsettings->wpaint, obact, vgroup_weight); ED_region_tag_redraw(CTX_wm_region(C)); /* XXX - should redraw all 3D views */ @@ -2522,6 +2526,7 @@ void PAINT_OT_weight_set(wmOperatorType *ot) /* identifiers */ ot->name = "Set Weight"; ot->idname = "PAINT_OT_weight_set"; + ot->description = "Fill the active vertex group with the current paint weight"; /* api callbacks */ ot->exec = weight_paint_set_exec; @@ -2541,9 +2546,9 @@ static int set_vpaint(bContext *C, wmOperator *op) /* toggle */ VPaint *vp = scene->toolsettings->vpaint; Mesh *me; - me = get_mesh(ob); + me = BKE_mesh_from_object(ob); - if (me == NULL || object_data_is_libdata(ob)) { + if (me == NULL || BKE_object_obdata_is_libdata(ob)) { ob->mode &= ~OB_MODE_VERTEX_PAINT; return OPERATOR_PASS_THROUGH; } @@ -2586,6 +2591,7 @@ void PAINT_OT_vertex_paint_toggle(wmOperatorType *ot) /* identifiers */ ot->name = "Vertex Paint Mode"; ot->idname = "PAINT_OT_vertex_paint_toggle"; + ot->description = "Toggle the vertex paint mode in 3D view"; /* api callbacks */ ot->exec = set_vpaint; @@ -2678,7 +2684,7 @@ static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, wmEvent float mat[4][4], imat[4][4]; /* context checks could be a poll() */ - me = get_mesh(ob); + me = BKE_mesh_from_object(ob); if (me == NULL || me->totpoly == 0) return OPERATOR_PASS_THROUGH; @@ -2726,7 +2732,7 @@ static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob, { ViewContext *vc = &vpd->vc; Brush *brush = paint_brush(&vp->paint); - Mesh *me = get_mesh(ob); + Mesh *me = BKE_mesh_from_object(ob); MFace *mface = &me->mface[index]; unsigned int *mcol = ((unsigned int *)me->mcol) + 4 * index; unsigned int *mcolorig = ((unsigned int *)vp->vpaint_prev) + 4 * index; @@ -2771,7 +2777,7 @@ static void vpaint_paint_poly(VPaint *vp, VPaintData *vpd, Object *ob, { ViewContext *vc = &vpd->vc; Brush *brush = paint_brush(&vp->paint); - Mesh *me = get_mesh(ob); + Mesh *me = BKE_mesh_from_object(ob); MPoly *mpoly = &me->mpoly[index]; MFace *mf; MCol *mc; @@ -2870,8 +2876,8 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P float mval[2]; const float pressure = RNA_float_get(itemptr, "pressure"); - const float brush_size_pressure = brush_size(scene, brush) * (brush_use_size_pressure(scene, brush) ? pressure : 1.0f); - const float brush_alpha_pressure = brush_alpha(scene, brush) * (brush_use_alpha_pressure(scene, brush) ? pressure : 1.0f); + const float brush_size_pressure = BKE_brush_size_get(scene, brush) * (BKE_brush_use_size_pressure(scene, brush) ? pressure : 1.0f); + const float brush_alpha_pressure = BKE_brush_alpha_get(scene, brush) * (BKE_brush_use_alpha_pressure(scene, brush) ? pressure : 1.0f); RNA_float_get_array(itemptr, "mouse", mval); @@ -2991,6 +2997,7 @@ void PAINT_OT_vertex_paint(wmOperatorType *ot) /* identifiers */ ot->name = "Vertex Paint"; ot->idname = "PAINT_OT_vertex_paint"; + ot->description = "Paint a stroke in the active vertex color layer"; /* api callbacks */ ot->invoke = vpaint_invoke; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 8d2dfc8dbfa..81b418b51f5 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -437,7 +437,7 @@ static float overlapped_curve(Brush *br, float x) xx = fabs(x0 + i * h); if (xx < 1.0f) - sum += brush_curve_strength(br, xx, 1); + sum += BKE_brush_curve_strength(br, xx, 1); } return sum; @@ -550,10 +550,10 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather) Brush *brush = paint_brush(&sd->paint); /* Primary strength input; square it to make lower values more sensitive */ - const float root_alpha = brush_alpha(scene, brush); + const float root_alpha = BKE_brush_alpha_get(scene, brush); float alpha = root_alpha * root_alpha; float dir = brush->flag & BRUSH_DIR_IN ? -1 : 1; - float pressure = brush_use_alpha_pressure(scene, brush) ? cache->pressure : 1; + float pressure = BKE_brush_use_alpha_pressure(scene, brush) ? cache->pressure : 1; float pen_flip = cache->pen_flip ? -1 : 1; float invert = cache->invert ? -1 : 1; float accum = integrate_overlap(brush); @@ -684,7 +684,7 @@ static float tex_strength(SculptSession *ss, Brush *br, float point[3], /* leave the coordinates relative to the screen */ /* use unadjusted size for tiled mode */ - radius = brush_size(ss->cache->vc->scene, br); + radius = BKE_brush_size_get(ss->cache->vc->scene, br); x = point_2d[0]; y = point_2d[1]; @@ -724,7 +724,7 @@ static float tex_strength(SculptSession *ss, Brush *br, float point[3], avg += br->texture_sample_bias; /* Falloff curve */ - avg *= brush_curve_strength(br, len, ss->cache->radius); + avg *= BKE_brush_curve_strength(br, len, ss->cache->radius); avg *= frontface(br, sculpt_normal, vno, fno); @@ -1182,8 +1182,8 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod /* we divide out the squared alpha and multiply by the squared crease to give us the pinch strength */ - if (brush_alpha(scene, brush) > 0.0f) - crease_correction = brush->crease_pinch_factor * brush->crease_pinch_factor / (brush_alpha(scene, brush) * brush_alpha(scene, brush)); + if (BKE_brush_alpha_get(scene, brush) > 0.0f) + crease_correction = brush->crease_pinch_factor * brush->crease_pinch_factor / (BKE_brush_alpha_get(scene, brush) * BKE_brush_alpha_get(scene, brush)); else crease_correction = brush->crease_pinch_factor * brush->crease_pinch_factor; @@ -2652,7 +2652,7 @@ static void do_symmetrical_brush_actions(Sculpt *sd, Object *ob) static void sculpt_update_tex(const Scene *scene, Sculpt *sd, SculptSession *ss) { Brush *brush = paint_brush(&sd->paint); - const int radius = brush_size(scene, brush); + const int radius = BKE_brush_size_get(scene, brush); if (ss->texcache) { MEM_freeN(ss->texcache); @@ -2662,7 +2662,7 @@ static void sculpt_update_tex(const Scene *scene, Sculpt *sd, SculptSession *ss) /* Need to allocate a bigger buffer for bigger brush size */ ss->texcache_side = 2 * radius; if (!ss->texcache || ss->texcache_side > ss->texcache_actual) { - ss->texcache = brush_gen_texture_cache(brush, radius); + ss->texcache = BKE_brush_gen_texture_cache(brush, radius); ss->texcache_actual = ss->texcache_side; } } @@ -2688,7 +2688,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_ ss->face_normals = NULL; } else { - Mesh *me = get_mesh(ob); + Mesh *me = BKE_mesh_from_object(ob); ss->totvert = me->totvert; ss->totpoly = me->totpoly; ss->mvert = me->mvert; @@ -2877,7 +2877,7 @@ static void sculpt_update_cache_invariants(bContext *C, Sculpt *sd, SculptSessio BLI_strncpy(cache->saved_active_brush_name, brush->id.name + 2, sizeof(cache->saved_active_brush_name)); - br = (Brush *)find_id("BR", "Smooth"); + br = (Brush *)BKE_libblock_find_name(ID_BR, "Smooth"); if (br) { paint_brush_set(p, br); brush = br; @@ -3062,19 +3062,19 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, sd->pressure_value = cache->pressure; cache->previous_pixel_radius = cache->pixel_radius; - cache->pixel_radius = brush_size(scene, brush); + cache->pixel_radius = BKE_brush_size_get(scene, brush); if (cache->first_time) { - if (!brush_use_locked_size(scene, brush)) { - cache->initial_radius = paint_calc_object_space_radius(cache->vc, cache->true_location, brush_size(scene, brush)); - brush_set_unprojected_radius(scene, brush, cache->initial_radius); + if (!BKE_brush_use_locked_size(scene, brush)) { + cache->initial_radius = paint_calc_object_space_radius(cache->vc, cache->true_location, BKE_brush_size_get(scene, brush)); + BKE_brush_unprojected_radius_set(scene, brush, cache->initial_radius); } else { - cache->initial_radius = brush_unprojected_radius(scene, brush); + cache->initial_radius = BKE_brush_unprojected_radius_get(scene, brush); } } - if (brush_use_size_pressure(scene, brush)) { + if (BKE_brush_use_size_pressure(scene, brush)) { cache->pixel_radius *= cache->pressure; cache->radius = cache->initial_radius * cache->pressure; } @@ -3306,7 +3306,7 @@ static void sculpt_restore_mesh(Sculpt *sd, SculptSession *ss) /* Restore the mesh before continuing with anchored stroke */ if ((brush->flag & BRUSH_ANCHORED) || (brush->sculpt_tool == SCULPT_TOOL_GRAB && - brush_use_size_pressure(ss->cache->vc->scene, brush)) || + BKE_brush_use_size_pressure(ss->cache->vc->scene, brush)) || (brush->flag & BRUSH_RESTORE_MESH)) { StrokeCache *cache = ss->cache; @@ -3476,7 +3476,7 @@ static void sculpt_stroke_done(bContext *C, struct PaintStroke *UNUSED(stroke)) /* Alt-Smooth */ if (ss->cache->alt_smooth) { Paint *p = &sd->paint; - brush = (Brush *)find_id("BR", ss->cache->saved_active_brush_name); + brush = (Brush *)BKE_libblock_find_name(ID_BR, ss->cache->saved_active_brush_name); if (brush) { paint_brush_set(p, brush); } diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 4545c498fed..5d2791daf87 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -205,7 +205,7 @@ void HC_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *sculptdata, float if ((dist = dot_v2v2(diff, diff)) <= radius) { UvElement *element; float strength; - strength = alpha * brush_curve_strength(brush, sqrt(dist), radius_root); + strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root); sculptdata->uv[i].uv[0] = (1.0 - strength) * sculptdata->uv[i].uv[0] + strength * (tmp_uvdata[i].p[0] - 0.5f * (tmp_uvdata[i].b[0] + tmp_uvdata[i].sum_b[0] / tmp_uvdata[i].ncounter)); sculptdata->uv[i].uv[1] = (1.0 - strength) * sculptdata->uv[i].uv[1] + strength * (tmp_uvdata[i].p[1] - 0.5f * (tmp_uvdata[i].b[1] + tmp_uvdata[i].sum_b[1] / tmp_uvdata[i].ncounter)); @@ -269,7 +269,7 @@ static void laplacian_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *scul if ((dist = dot_v2v2(diff, diff)) <= radius) { UvElement *element; float strength; - strength = alpha * brush_curve_strength(brush, sqrt(dist), radius_root); + strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root); sculptdata->uv[i].uv[0] = (1.0 - strength) * sculptdata->uv[i].uv[0] + strength * tmp_uvdata[i].p[0]; sculptdata->uv[i].uv[1] = (1.0 - strength) * sculptdata->uv[i].uv[1] + strength * tmp_uvdata[i].p[1]; @@ -311,14 +311,14 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, wmEvent *event, ToolSettings *toolsettings = CTX_data_tool_settings(C); tool = sculptdata->tool; invert = sculptdata->invert ? -1 : 1; - alpha = brush_alpha(scene, brush); + alpha = BKE_brush_alpha_get(scene, brush); UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]); sima = CTX_wm_space_image(C); ED_space_image_size(sima, &width, &height); ED_space_image_zoom(sima, ar, &zoomx, &zoomy); - radius = brush_size(scene, brush) / (width * zoomx); + radius = BKE_brush_size_get(scene, brush) / (width * zoomx); aspectRatio = width / (float)height; /* We will compare squares to save some computation */ @@ -344,7 +344,7 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, wmEvent *event, if ((dist = dot_v2v2(diff, diff)) <= radius) { UvElement *element; float strength; - strength = alpha * brush_curve_strength(brush, sqrt(dist), radius_root); + strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root); normalize_v2(diff); sculptdata->uv[i].uv[0] -= strength * diff[0] * 0.001; @@ -679,9 +679,9 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, wmEvent float alpha, zoomx, zoomy; Brush *brush = paint_brush(sculptdata->uvsculpt); - alpha = brush_alpha(scene, brush); + alpha = BKE_brush_alpha_get(scene, brush); - radius = brush_size(scene, brush); + radius = BKE_brush_size_get(scene, brush); sima = CTX_wm_space_image(C); ED_space_image_size(sima, &width, &height); ED_space_image_zoom(sima, ar, &zoomx, &zoomy); @@ -715,7 +715,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, wmEvent diff[1] /= aspectRatio; if ((dist = dot_v2v2(diff, diff)) <= radius) { float strength; - strength = alpha * brush_curve_strength(brush, sqrt(dist), radius_root); + strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root); data->initial_stroke->initialSelection[counter].uv = i; data->initial_stroke->initialSelection[counter].strength = strength; diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 24bc01989fc..e91b29ff0c1 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -286,11 +286,11 @@ static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op)) for (cfra = (scene->r.sfra > 0) ? (scene->r.sfra - 1) : 0; cfra <= scene->r.efra + 1; cfra++) { scene->r.cfra = cfra; - scene_update_for_newframe(bmain, scene, scene->lay); + BKE_scene_update_for_newframe(bmain, scene, scene->lay); } scene->r.cfra = oldfra; - scene_update_for_newframe(bmain, scene, scene->lay); + BKE_scene_update_for_newframe(bmain, scene, scene->lay); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index a44eca17dfd..723efdc484c 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -98,7 +98,7 @@ static int act_new_exec(bContext *C, wmOperator *UNUSED(op)) if (oldact && GS(oldact->id.name)==ID_AC) { /* make a copy of the existing action */ - action= copy_action(oldact); + action= BKE_action_copy(oldact); } else { /* just make a new (empty) action */ diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c index f502a97967f..da3e88ba188 100644 --- a/source/blender/editors/space_action/action_ops.c +++ b/source/blender/editors/space_action/action_ops.c @@ -45,6 +45,7 @@ #include "action_intern.h" #include "RNA_access.h" +#include "RNA_define.h" #include "WM_api.h" #include "WM_types.h" @@ -93,9 +94,10 @@ void ED_operatormacros_action(void) wmOperatorType *ot; wmOperatorTypeMacro *otmacro; - ot = WM_operatortype_append_macro("ACTION_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); + ot = WM_operatortype_append_macro("ACTION_OT_duplicate_move", "Duplicate", + "Make a copy of all selected keyframes and move them", + OPTYPE_UNDO|OPTYPE_REGISTER); if (ot) { - ot->description = "Make a copy of all selected keyframes and move them"; WM_operatortype_macro_define(ot, "ACTION_OT_duplicate"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform"); RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE); diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 20d5257a62f..ff466c23953 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -294,7 +294,7 @@ static int buttons_context_path_pose_bone(ButsContextPath *path) } else { if (arm->act_bone) { - bPoseChannel *pchan= get_pose_channel(ob->pose, arm->act_bone->name); + bPoseChannel *pchan= BKE_pose_channel_find_name(ob->pose, arm->act_bone->name); if (pchan) { RNA_pointer_create(&ob->id, &RNA_PoseBone, pchan, &path->ptr[path->len]); path->len++; diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c index ba37cb8a892..88f66855cff 100644 --- a/source/blender/editors/space_buttons/buttons_texture.c +++ b/source/blender/editors/space_buttons/buttons_texture.c @@ -253,7 +253,7 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts) ButsContextTexture *ct= sbuts->texuser; Scene *scene= CTX_data_scene(C); - if (!scene_use_new_shading_nodes(scene)) { + if (!BKE_scene_use_new_shading_nodes(scene)) { if (ct) { BLI_freelistN(&ct->users); MEM_freeN(ct); diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 2bfc7a1dec8..fa7b534fa2f 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -1086,14 +1086,15 @@ void ED_operatormacros_clip(void) wmOperatorType *ot; wmOperatorTypeMacro *otmacro; - ot = WM_operatortype_append_macro("CLIP_OT_add_marker_move", "Add Marker and Move", OPTYPE_UNDO|OPTYPE_REGISTER); - ot->description = "Add new marker and move it on movie"; + ot = WM_operatortype_append_macro("CLIP_OT_add_marker_move", "Add Marker and Move", + "Add new marker and move it on movie", OPTYPE_UNDO|OPTYPE_REGISTER); WM_operatortype_macro_define(ot, "CLIP_OT_add_marker"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_struct_idprops_unset(otmacro->ptr, "release_confirm"); - ot = WM_operatortype_append_macro("CLIP_OT_add_marker_slide", "Add Marker and Slide", OPTYPE_UNDO|OPTYPE_REGISTER); - ot->description = "Add new marker and slide it with mouse until mouse button release"; + ot = WM_operatortype_append_macro("CLIP_OT_add_marker_slide", "Add Marker and Slide", + "Add new marker and slide it with mouse until mouse button release", + OPTYPE_UNDO|OPTYPE_REGISTER); WM_operatortype_macro_define(ot, "CLIP_OT_add_marker"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_boolean_set(otmacro->ptr, "release_confirm", TRUE); diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 2c9b61ed1ef..ea92366f0cb 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -1975,13 +1975,13 @@ static Object *get_camera_with_movieclip(Scene *scene, MovieClip *clip) Object *camera = scene->camera; Base *base; - if (camera && object_get_movieclip(scene, camera, 0)==clip) + if (camera && BKE_object_movieclip_get(scene, camera, 0)==clip) return camera; base = scene->base.first; while (base) { if (base->object->type == OB_CAMERA) { - if (object_get_movieclip(scene, base->object, 0)==clip) { + if (BKE_object_movieclip_get(scene, base->object, 0)==clip) { camera = base->object; break; } @@ -2071,7 +2071,7 @@ static void object_solver_inverted_matrix(Scene *scene, Object *ob, float invmat if (!found) { Object *cam = data->camera ? data->camera : scene->camera; - where_is_object_mat(scene, cam, invmat); + BKE_object_where_is_calc_mat4(scene, cam, invmat); } mult_m4_m4m4(invmat, invmat, data->invmat); @@ -2198,7 +2198,7 @@ static void set_axis(Scene *scene, Object *ob, MovieClip *clip, MovieTrackingOb int flip = FALSE; float mat[4][4], vec[3], obmat[4][4], dvec[3]; - object_to_mat4(ob, obmat); + BKE_object_to_mat4(ob, obmat); BKE_get_tracking_mat(scene, camera, mat); mul_v3_m4v3(vec, mat, track->bundle_pos); @@ -2283,7 +2283,7 @@ static void set_axis(Scene *scene, Object *ob, MovieClip *clip, MovieTrackingOb if (!flip) { float lmat[4][4], ilmat[4][4], rmat[3][3]; - object_rot_to_mat3(ob, rmat); + BKE_object_rot_to_mat3(ob, rmat); invert_m3(rmat); mul_m4_m4m3(mat, mat, rmat); @@ -2298,7 +2298,7 @@ static void set_axis(Scene *scene, Object *ob, MovieClip *clip, MovieTrackingOb } } - object_apply_mat4(ob, mat, 0, 0); + BKE_object_apply_mat4(ob, mat, 0, 0); } static int set_plane_exec(bContext *C, wmOperator *op) @@ -2385,23 +2385,23 @@ static int set_plane_exec(bContext *C, wmOperator *op) if (tracking_object->flag & TRACKING_OBJECT_CAMERA) { invert_m4(mat); - object_to_mat4(object, obmat); + BKE_object_to_mat4(object, obmat); mult_m4_m4m4(mat, mat, obmat); mult_m4_m4m4(newmat, rot, mat); - object_apply_mat4(object, newmat, 0, 0); + BKE_object_apply_mat4(object, newmat, 0, 0); /* make camera have positive z-coordinate */ if (object->loc[2]<0) { invert_m4(rot); mult_m4_m4m4(newmat, rot, mat); - object_apply_mat4(object, newmat, 0, 0); + BKE_object_apply_mat4(object, newmat, 0, 0); } } else { - object_apply_mat4(object, mat, 0, 0); + BKE_object_apply_mat4(object, mat, 0, 0); } - where_is_object(scene, object); + BKE_object_where_is_calc(scene, object); set_axis(scene, object, clip, tracking_object, axis_track, 'X'); DAG_id_tag_update(&clip->id, 0); diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 2887fa1c881..49c56ec75e4 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -241,9 +241,10 @@ void ED_operatormacros_graph(void) wmOperatorType *ot; wmOperatorTypeMacro *otmacro; - ot = WM_operatortype_append_macro("GRAPH_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); + ot = WM_operatortype_append_macro("GRAPH_OT_duplicate_move", "Duplicate", + "Make a copy of all selected keyframes and move them", + OPTYPE_UNDO|OPTYPE_REGISTER); if (ot) { - ot->description = "Make a copy of all selected keyframes and move them"; WM_operatortype_macro_define(ot, "GRAPH_OT_duplicate"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform"); RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE); diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index ecbd9a4033a..de171bc45f8 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -146,7 +146,7 @@ static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf, /* the frame number, even if we cant */ if (ima->source == IMA_SRC_SEQUENCE) { /* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */ - const int framenr = BKE_image_user_get_frame(iuser, CFRA, 0); + const int framenr = BKE_image_user_frame_get(iuser, CFRA, 0); ofs += sprintf(str + ofs, ", Frame: %d", framenr); } @@ -430,7 +430,7 @@ static void set_frames_cb(bContext *C, void *ima_v, void *iuser_v) if (ima->anim) { iuser->frames = IMB_anim_get_duration(ima->anim, IMB_TC_RECORD_RUN); - BKE_image_user_calc_frame(iuser, scene->r.cfra, 0); + BKE_image_user_frame_calc(iuser, scene->r.cfra, 0); } } diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 793e5712c8c..aab628180c8 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -606,7 +606,7 @@ static void draw_image_view_tool(Scene *scene) if (draw) { getmouseco_areawin(mval); - radius = brush_size(brush) * G.sima->zoom; + radius = BKE_brush_size_get(brush) * G.sima->zoom; fdrawXORcirc(mval[0], mval[1], radius); if (brush->innerradius != 1.0) { diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index d9f3ffafb14..e99d907b14f 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -825,7 +825,7 @@ static int image_open_exec(bContext *C, wmOperator *op) errno = 0; - ima = BKE_add_image_file(str); + ima = BKE_image_load_exists(str); if (!ima) { if (op->customdata) MEM_freeN(op->customdata); @@ -1141,7 +1141,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI /* TODO, better solution, if a 24bit image is painted onto it may contain alpha */ if (ibuf->userflags & IB_BITMAPDIRTY) { /* it has been painted onto */ /* checks each pixel, not ideal */ - ibuf->planes = BKE_alphatest_ibuf(ibuf) ? 32 : 24; + ibuf->planes = BKE_imbuf_alpha_test(ibuf) ? 32 : 24; } } @@ -1158,7 +1158,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI BKE_image_release_renderresult(scene, ima); } else { - if (BKE_write_ibuf_as(ibuf, simopts->filepath, &simopts->im_format, save_copy)) { + if (BKE_imbuf_write_as(ibuf, simopts->filepath, &simopts->im_format, save_copy)) { ok = TRUE; } } @@ -1515,7 +1515,7 @@ static int image_new_exec(bContext *C, wmOperator *op) if (!alpha) color[3] = 1.0f; - ima = BKE_add_image_size(width, height, name, alpha ? 32 : 24, floatbuf, uvtestgrid, color); + ima = BKE_image_add_generated(width, height, name, alpha ? 32 : 24, floatbuf, uvtestgrid, color); if (!ima) return OPERATOR_CANCELLED; @@ -2390,7 +2390,7 @@ void ED_image_update_frame(const Main *mainp, int cfra) if (tex->type == TEX_IMAGE && tex->ima) { if (ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) { if (tex->iuser.flag & IMA_ANIM_ALWAYS) - BKE_image_user_calc_frame(&tex->iuser, cfra, 0); + BKE_image_user_frame_calc(&tex->iuser, cfra, 0); } } } @@ -2405,12 +2405,12 @@ void ED_image_update_frame(const Main *mainp, int cfra) BGpic *bgpic; for (bgpic = v3d->bgpicbase.first; bgpic; bgpic = bgpic->next) if (bgpic->iuser.flag & IMA_ANIM_ALWAYS) - BKE_image_user_calc_frame(&bgpic->iuser, cfra, 0); + BKE_image_user_frame_calc(&bgpic->iuser, cfra, 0); } else if (sa->spacetype == SPACE_IMAGE) { SpaceImage *sima = sa->spacedata.first; if (sima->iuser.flag & IMA_ANIM_ALWAYS) - BKE_image_user_calc_frame(&sima->iuser, cfra, 0); + BKE_image_user_frame_calc(&sima->iuser, cfra, 0); } else if (sa->spacetype == SPACE_NODE) { SpaceNode *snode = sa->spacedata.first; @@ -2422,7 +2422,7 @@ void ED_image_update_frame(const Main *mainp, int cfra) ImageUser *iuser = node->storage; if (ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) if (iuser->flag & IMA_ANIM_ALWAYS) - BKE_image_user_calc_frame(iuser, cfra, 0); + BKE_image_user_frame_calc(iuser, cfra, 0); } } } diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 447028b8bef..9e0f538056c 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -590,7 +590,7 @@ static void image_refresh(const bContext *C, ScrArea *UNUSED(sa)) ima = ED_space_image(sima); if (sima->iuser.flag & IMA_ANIM_ALWAYS) - BKE_image_user_calc_frame(&sima->iuser, scene->r.cfra, 0); + BKE_image_user_frame_calc(&sima->iuser, scene->r.cfra, 0); /* check if we have to set the image from the editmesh */ if (ima && (ima->source == IMA_SRC_VIEWER || sima->pin)) ; @@ -599,7 +599,7 @@ static void image_refresh(const bContext *C, ScrArea *UNUSED(sa)) struct BMEditMesh *em = me->edit_btmesh; int sloppy = 1; /* partially selected face is ok */ - if (scene_use_new_shading_nodes(scene)) { + if (BKE_scene_use_new_shading_nodes(scene)) { /* new shading system, get image from material */ BMFace *efa = BM_active_face_get(em->bm, sloppy); diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 5256fc8f044..870a5724b49 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -198,7 +198,7 @@ static int make_paths_relative_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - makeFilesRelative(bmain, bmain->name, op->reports); + BLI_bpath_relative_convert(bmain, bmain->name, op->reports); /* redraw everything so any changed paths register */ WM_main_add_notifier(NC_WINDOW, NULL); @@ -230,7 +230,7 @@ static int make_paths_absolute_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - makeFilesAbsolute(bmain, bmain->name, op->reports); + BLI_bpath_absolute_convert(bmain, bmain->name, op->reports); /* redraw everything so any changed paths register */ WM_main_add_notifier(NC_WINDOW, NULL); @@ -258,7 +258,7 @@ static int report_missing_files_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); /* run the missing file check */ - checkMissingFiles(bmain, op->reports); + BLI_bpath_missing_files_check(bmain, op->reports); return OPERATOR_FINISHED; } @@ -282,7 +282,7 @@ static int find_missing_files_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); const char *searchpath = RNA_string_get_alloc(op->ptr, "filepath", NULL, 0); - findMissingFiles(bmain, searchpath, op->reports); + BLI_bpath_missing_files_find(bmain, searchpath, op->reports); MEM_freeN((void *)searchpath); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 184357344e1..97b6c32d81d 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -1084,7 +1084,7 @@ static void get_armature_bone_constraint(Object *ob, const char *posechannel, co { /* check that bone exist in the active object */ if (ob->type == OB_ARMATURE && ob->pose) { - bPoseChannel *pchan= get_pose_channel(ob->pose, posechannel); + bPoseChannel *pchan= BKE_pose_channel_find_name(ob->pose, posechannel); if (pchan) { bConstraint *con= BLI_findstring(&pchan->constraints, constraint_name, offsetof(bConstraint, name)); if (con) { @@ -4789,7 +4789,7 @@ void logic_buttons(bContext *C, ARegion *ar) } if (ob==NULL) return; -// uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE); +// uiSetButLock(BKE_object_is_libdata(ob), ERROR_LIBDATA_MESSAGE); BLI_snprintf(numstr, sizeof(numstr), "buttonswin %p", (void *)ar); block= uiBeginBlock(C, ar, numstr, UI_EMBOSS); @@ -4833,7 +4833,7 @@ void logic_buttons(bContext *C, ARegion *ar) ob= (Object *)idar[a]; // uiClearButLock(); -// uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE); +// uiSetButLock(BKE_object_is_libdata(ob), ERROR_LIBDATA_MESSAGE); if ( (ob->scavisflag & OB_VIS_CONT) == 0) continue; /* presume it is only objects for now */ @@ -4970,7 +4970,7 @@ void logic_buttons(bContext *C, ARegion *ar) for (a=0; a<count; a++) { ob= (Object *)idar[a]; // uiClearButLock(); -// uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE); +// uiSetButLock(BKE_object_is_libdata(ob), ERROR_LIBDATA_MESSAGE); if ( (ob->scavisflag & OB_VIS_SENS) == 0) continue; @@ -5051,7 +5051,7 @@ void logic_buttons(bContext *C, ARegion *ar) for (a=0; a<count; a++) { ob= (Object *)idar[a]; // uiClearButLock(); -// uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE); +// uiSetButLock(BKE_object_is_libdata(ob), ERROR_LIBDATA_MESSAGE); if ( (ob->scavisflag & OB_VIS_ACT) == 0) continue; /* presume it is only objects for now */ diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c index 93105c39f39..1caf1075ae6 100644 --- a/source/blender/editors/space_logic/space_logic.c +++ b/source/blender/editors/space_logic/space_logic.c @@ -152,7 +152,7 @@ static void logic_free(SpaceLink *UNUSED(sl)) // Spacelogic *slogic= (SpaceLogic*) sl; // if (slogic->gpd) -// XXX free_gpencil_data(slogic->gpd); +// XXX BKE_gpencil_free(slogic->gpd); } diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 994021db9ff..57ad552f7e2 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -1682,7 +1682,7 @@ static int nlaedit_apply_scale_exec (bContext *C, wmOperator *UNUSED(op)) continue; if (strip->act->id.us > 1) { /* make a copy of the Action to work on */ - bAction *act= copy_action(strip->act); + bAction *act= BKE_action_copy(strip->act); /* set this as the new referenced action, decrementing the users of the old one */ strip->act->id.us--; diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index bfa8111af3e..c2b7a1d6a7f 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -1247,7 +1247,7 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA * Scene *scene= CTX_data_scene(C); ImageUser *iuser= node->storage; char numstr[32]; - const int framenr= BKE_image_user_get_frame(iuser, CFRA, 0); + const int framenr= BKE_image_user_frame_get(iuser, CFRA, 0); BLI_snprintf(numstr, sizeof(numstr), "Frame: %d", framenr); uiItemL(layout, numstr, ICON_NONE); } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 4bbba419613..1173d04bf85 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -243,8 +243,37 @@ static bNode *editnode_get_active(bNodeTree *ntree) return nodeGetActive(ntree); } -void snode_dag_update(bContext *UNUSED(C), SpaceNode *snode) +static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup) { + bNode *node; + + if (ntree == lookup) + return 1; + + for (node=ntree->nodes.first; node; node=node->next) + if (node->type == NODE_GROUP && node->id) + if (has_nodetree((bNodeTree*)node->id, lookup)) + return 1; + + return 0; +} + +static void snode_dag_update_group(void *calldata, ID *owner_id, bNodeTree *ntree) +{ + if (has_nodetree(ntree, calldata)) + DAG_id_tag_update(owner_id, 0); +} + +void snode_dag_update(bContext *C, SpaceNode *snode) +{ + Main *bmain = CTX_data_main(C); + + /* for groups, update all ID's using this */ + if (snode->edittree!=snode->nodetree) { + bNodeTreeType *tti= ntreeGetType(snode->edittree->type); + tti->foreach_nodetree(bmain, snode->edittree, snode_dag_update_group); + } + DAG_id_tag_update(snode->id, 0); } @@ -289,7 +318,7 @@ void ED_node_shader_default(Scene *scene, ID *id) Material *ma= (Material*)id; ma->nodetree = ntree; - if (scene_use_new_shading_nodes(scene)) { + if (BKE_scene_use_new_shading_nodes(scene)) { output_type = SH_NODE_OUTPUT_MATERIAL; shader_type = SH_NODE_BSDF_DIFFUSE; } @@ -347,7 +376,7 @@ void ED_node_shader_default(Scene *scene, ID *id) nodeAddLink(ntree, in, fromsock, out, tosock); /* default values */ - if (scene_use_new_shading_nodes(scene)) { + if (BKE_scene_use_new_shading_nodes(scene)) { sock= in->inputs.first; copy_v3_v3(((bNodeSocketValueRGBA*)sock->default_value)->value, color); @@ -585,21 +614,6 @@ static void snode_update(SpaceNode *snode, bNode *node) nodeUpdateID(snode->nodetree, gnode->id); } -static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup) -{ - bNode *node; - - if (ntree == lookup) - return 1; - - for (node=ntree->nodes.first; node; node=node->next) - if (node->type == NODE_GROUP && node->id) - if (has_nodetree((bNodeTree*)node->id, lookup)) - return 1; - - return 0; -} - void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node) { int was_active_texture = (node->flag & NODE_ACTIVE_TEXTURE); @@ -1316,6 +1330,7 @@ void NODE_OT_backimage_zoom(wmOperatorType *ot) /* identifiers */ ot->name = "Background Image Zoom"; ot->idname = "NODE_OT_backimage_zoom"; + ot->description = "Zoom in/out the brackground image"; /* api callbacks */ ot->exec = backimage_zoom; @@ -1482,6 +1497,7 @@ void NODE_OT_backimage_sample(wmOperatorType *ot) /* identifiers */ ot->name = "Backimage Sample"; ot->idname = "NODE_OT_backimage_sample"; + ot->description = "Use mouse to sample background image"; /* api callbacks */ ot->invoke = sample_invoke; @@ -1593,6 +1609,7 @@ void NODE_OT_resize(wmOperatorType *ot) /* identifiers */ ot->name = "Resize Node"; ot->idname = "NODE_OT_resize"; + ot->description = "Resize a node"; /* api callbacks */ ot->invoke = node_resize_invoke; @@ -2575,6 +2592,7 @@ void NODE_OT_link(wmOperatorType *ot) /* identifiers */ ot->name = "Link Nodes"; ot->idname = "NODE_OT_link"; + ot->description = "Use the mouse to create a link between two nodes"; /* api callbacks */ ot->invoke = node_link_invoke; @@ -2694,6 +2712,7 @@ void NODE_OT_links_cut(wmOperatorType *ot) ot->name = "Cut links"; ot->idname = "NODE_OT_links_cut"; + ot->description = "Use the mouse to cut (remove) some links"; ot->invoke = WM_gesture_lines_invoke; ot->modal = WM_gesture_lines_modal; @@ -2739,6 +2758,7 @@ void NODE_OT_links_detach(wmOperatorType *ot) { ot->name = "Detach Links"; ot->idname = "NODE_OT_links_detach"; + ot->description = "Remove all links to selected nodes, and try to connect neighbor nodes together"; ot->exec = detach_links_exec; ot->poll = ED_operator_node_active; @@ -2933,6 +2953,7 @@ void NODE_OT_read_renderlayers(wmOperatorType *ot) ot->name = "Read Render Layers"; ot->idname = "NODE_OT_read_renderlayers"; + ot->description = "Read all render layers of all used scenes"; ot->exec = node_read_renderlayers_exec; @@ -2966,6 +2987,7 @@ void NODE_OT_read_fullsamplelayers(wmOperatorType *ot) ot->name = "Read Full Sample Layers"; ot->idname = "NODE_OT_read_fullsamplelayers"; + ot->description = "Read all render layers of current scene, in full sample"; ot->exec = node_read_fullsamplelayers_exec; @@ -3014,6 +3036,7 @@ void NODE_OT_render_changed(wmOperatorType *ot) ot->name = "Render Changed Layer"; ot->idname = "NODE_OT_render_changed"; + ot->description = "Render current scene, when input node's layer has been changed"; ot->exec = node_render_changed_exec; @@ -3436,7 +3459,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op) errno= 0; - ima= BKE_add_image_file(path); + ima= BKE_image_load_exists(path); if (!ima) { BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s", path, errno ? strerror(errno) : "Unsupported image format"); @@ -3446,7 +3469,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op) else if (RNA_struct_property_is_set(op->ptr, "name")) { char name[MAX_ID_NAME-2]; RNA_string_get(op->ptr, "name", name); - ima= (Image *)find_id("IM", name); + ima= (Image *)BKE_libblock_find_name(ID_IM, name); if (!ima) { BKE_reportf(op->reports, RPT_ERROR, "Image named \"%s\", not found", name); @@ -3572,8 +3595,9 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) void NODE_OT_new_node_tree(wmOperatorType *ot) { /* identifiers */ - ot->name = "New node tree"; + ot->name = "New Node Tree"; ot->idname = "NODE_OT_new_node_tree"; + ot->description = "Create a new node tree"; /* api callbacks */ ot->exec = new_node_tree_exec; diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index 7ddc4bdf857..bb52c1570aa 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -201,7 +201,7 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass) } if (ntree->type == NTREE_SHADER) { - if (scene_use_new_shading_nodes(scene)) + if (BKE_scene_use_new_shading_nodes(scene)) compatibility= NODE_NEW_SHADING; else compatibility= NODE_OLD_SHADING; diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c index 1c681220016..7d9d7d736f6 100644 --- a/source/blender/editors/space_node/node_ops.c +++ b/source/blender/editors/space_node/node_ops.c @@ -111,30 +111,31 @@ void ED_operatormacros_node(void) wmOperatorType *ot; wmOperatorTypeMacro *mot; - ot = WM_operatortype_append_macro("NODE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); - ot->description = "Duplicate selected nodes and move them"; + ot = WM_operatortype_append_macro("NODE_OT_duplicate_move", "Duplicate", "Duplicate selected nodes and move them", + OPTYPE_UNDO|OPTYPE_REGISTER); WM_operatortype_macro_define(ot, "NODE_OT_duplicate"); WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); /* modified operator call for duplicating with input links */ - ot = WM_operatortype_append_macro("NODE_OT_duplicate_move_keep_inputs", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER); - ot->description = "Duplicate selected nodes keeping input links and move them"; + ot = WM_operatortype_append_macro("NODE_OT_duplicate_move_keep_inputs", "Duplicate", + "Duplicate selected nodes keeping input links and move them", + OPTYPE_UNDO|OPTYPE_REGISTER); mot = WM_operatortype_macro_define(ot, "NODE_OT_duplicate"); RNA_boolean_set(mot->ptr, "keep_inputs", TRUE); WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); - ot = WM_operatortype_append_macro("NODE_OT_select_link_viewer", "Link Viewer", OPTYPE_UNDO); - ot->description = "Select node and link it to a viewer node"; + ot = WM_operatortype_append_macro("NODE_OT_select_link_viewer", "Link Viewer", + "Select node and link it to a viewer node", OPTYPE_UNDO); WM_operatortype_macro_define(ot, "NODE_OT_select"); WM_operatortype_macro_define(ot, "NODE_OT_link_viewer"); - ot = WM_operatortype_append_macro("NODE_OT_move_detach_links", "Detach", OPTYPE_UNDO|OPTYPE_REGISTER); - ot->description = "Move a node to detach links"; + ot = WM_operatortype_append_macro("NODE_OT_move_detach_links", "Detach", "Move a node to detach links", + OPTYPE_UNDO|OPTYPE_REGISTER); WM_operatortype_macro_define(ot, "NODE_OT_links_detach"); WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); - ot = WM_operatortype_append_macro("NODE_OT_move_detach_links_release", "Detach", OPTYPE_UNDO|OPTYPE_REGISTER); - ot->description = "Move a node to detach links"; + ot = WM_operatortype_append_macro("NODE_OT_move_detach_links_release", "Detach", "Move a node to detach links", + OPTYPE_UNDO|OPTYPE_REGISTER); WM_operatortype_macro_define(ot, "NODE_OT_links_detach"); mot = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_boolean_set(mot->ptr, "release_confirm", TRUE); diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c index 13e85c7f74d..785eafeb7c9 100644 --- a/source/blender/editors/space_node/node_templates.c +++ b/source/blender/editors/space_node/node_templates.c @@ -333,7 +333,7 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname) int compatibility= 0; if (ntree->type == NTREE_SHADER) { - if (scene_use_new_shading_nodes(arg->scene)) + if (BKE_scene_use_new_shading_nodes(arg->scene)) compatibility= NODE_NEW_SHADING; else compatibility= NODE_OLD_SHADING; diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 042b668c9cc..a32923f17c9 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -136,7 +136,7 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2) if (ob->restrictflag & OB_RESTRICT_VIEW) { /* Ouch! There is no backwards pointer from Object to Base, * so have to do loop to find it. */ - ED_base_object_select(object_in_scene(ob, scene), BA_DESELECT); + ED_base_object_select(BKE_scene_base_find(scene, ob), BA_DESELECT); } WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); @@ -153,7 +153,7 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2) if (ob->restrictflag & OB_RESTRICT_SELECT) { /* Ouch! There is no backwards pointer from Object to Base, * so have to do loop to find it. */ - ED_base_object_select(object_in_scene(ob, scene), BA_DESELECT); + ED_base_object_select(BKE_scene_base_find(scene, ob), BA_DESELECT); } WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); @@ -230,7 +230,7 @@ void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag) if (flag==OB_RESTRICT_VIEW) if (gob->ob->flag & SELECT) - ED_base_object_select(object_in_scene(gob->ob, scene), BA_DESELECT); + ED_base_object_select(BKE_scene_base_find(scene, gob->ob), BA_DESELECT); } } else { @@ -241,7 +241,7 @@ void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag) if (flag==OB_RESTRICT_VIEW) if ((gob->ob->flag & SELECT) == 0) - ED_base_object_select(object_in_scene(gob->ob, scene), BA_SELECT); + ED_base_object_select(BKE_scene_base_find(scene, gob->ob), BA_SELECT); } } } diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 7b200e9593d..43f186f4b31 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -348,7 +348,7 @@ void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, Tre /* add check for edit mode */ if (!common_restrict_check(C, ob)) return; - if (base || (base= object_in_scene(ob, scene))) { + if (base || (base= BKE_scene_base_find(scene, ob))) { if ((base->object->restrictflag ^= OB_RESTRICT_VIEW)) { ED_base_object_select(base, BA_DESELECT); } @@ -395,7 +395,7 @@ void object_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeEleme { Base *base= (Base *)te->directdata; - if (base==NULL) base= object_in_scene((Object *)tselem->id, scene); + if (base==NULL) base= BKE_scene_base_find(scene, (Object *)tselem->id); if (base) { base->object->restrictflag^=OB_RESTRICT_SELECT; } @@ -441,7 +441,7 @@ void object_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeEleme { Base *base= (Base *)te->directdata; - if (base==NULL) base= object_in_scene((Object *)tselem->id, scene); + if (base==NULL) base= BKE_scene_base_find(scene, (Object *)tselem->id); if (base) { base->object->restrictflag^=OB_RESTRICT_RENDER; } @@ -674,7 +674,7 @@ static void outliner_set_coordinates(ARegion *ar, SpaceOops *soops) } /* find next element that has this name */ -static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *name, int flags, TreeElement *prev, int *prevFound) +static TreeElement *outliner_find_name(SpaceOops *soops, ListBase *lb, char *name, int flags, TreeElement *prev, int *prevFound) { TreeElement *te, *tes; @@ -694,7 +694,7 @@ static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *na return te; } - tes= outliner_find_named(soops, &te->subtree, name, flags, prev, prevFound); + tes= outliner_find_name(soops, &te->subtree, name, flags, prev, prevFound); if (tes) return tes; } @@ -721,18 +721,18 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so flags= soops->search_flags; /* try to find matching element */ - te= outliner_find_named(soops, &soops->tree, name, flags, last_find, &prevFound); + te= outliner_find_name(soops, &soops->tree, name, flags, last_find, &prevFound); if (te==NULL) { /* no more matches after previous, start from beginning again */ prevFound= 1; - te= outliner_find_named(soops, &soops->tree, name, flags, last_find, &prevFound); + te= outliner_find_name(soops, &soops->tree, name, flags, last_find, &prevFound); } } else { /* pop up panel - no previous, or user didn't want search after previous */ name[0]= '\0'; // XXX if (sbutton(name, 0, sizeof(name)-1, "Find: ") && name[0]) { -// te= outliner_find_named(soops, &soops->tree, name, flags, NULL, &prevFound); +// te= outliner_find_name(soops, &soops->tree, name, flags, NULL, &prevFound); // } // else return; /* XXX RETURN! XXX */ } @@ -1402,9 +1402,9 @@ static int parent_drop_exec(bContext *C, wmOperator *op) partype= RNA_enum_get(op->ptr, "type"); RNA_string_get(op->ptr, "parent", parname); - par= (Object *)find_id("OB", parname); + par= (Object *)BKE_libblock_find_name(ID_OB, parname); RNA_string_get(op->ptr, "child", childname); - ob= (Object *)find_id("OB", childname); + ob= (Object *)BKE_libblock_find_name(ID_OB, childname); ED_object_parent_set(op->reports, bmain, scene, ob, par, partype); @@ -1473,9 +1473,9 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event) RNA_string_set(op->ptr, "parent", te_found->name); /* Identify parent and child */ RNA_string_get(op->ptr, "child", childname); - ob= (Object *)find_id("OB", childname); + ob= (Object *)BKE_libblock_find_name(ID_OB, childname); RNA_string_get(op->ptr, "parent", parname); - par= (Object *)find_id("OB", parname); + par= (Object *)BKE_libblock_find_name(ID_OB, parname); if (ELEM(NULL, ob, par)) { if (par == NULL) printf("par==NULL\n"); @@ -1487,7 +1487,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event) /* check dragged object (child) is active */ if (ob != CTX_data_active_object(C)) - ED_base_object_select(object_in_scene(ob, scene), BA_SELECT); + ED_base_object_select(BKE_scene_base_find(scene, ob), BA_SELECT); if ((par->type != OB_ARMATURE) && (par->type != OB_CURVE) && (par->type != OB_LATTICE)) { if (ED_object_parent_set(op->reports, bmain, scene, ob, par, partype)) { @@ -1659,11 +1659,11 @@ static int parent_clear_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even char obname[MAX_ID_NAME]; RNA_string_get(op->ptr, "dragged_obj", obname); - ob= (Object *)find_id("OB", obname); + ob= (Object *)BKE_libblock_find_name(ID_OB, obname); /* check dragged object (child) is active */ if (ob != CTX_data_active_object(C)) - ED_base_object_select(object_in_scene(ob, scene), BA_SELECT); + ED_base_object_select(BKE_scene_base_find(scene, ob), BA_SELECT); ED_object_parent_clear(C, RNA_enum_get(op->ptr, "type")); diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 00b3979b074..800953c1a62 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -159,7 +159,7 @@ static int tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops } /* find associated base in current scene */ - base= object_in_scene(ob, scene); + base= BKE_scene_base_find(scene, ob); if (base) { if (set==2) { @@ -171,7 +171,7 @@ static int tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops } else { /* deleselect all */ - scene_deselect_all(scene); + BKE_scene_base_deselect_all(scene); ED_base_object_select(base, BA_SELECT); } if (C) { @@ -551,7 +551,7 @@ static int tree_element_active_text(bContext *UNUSED(C), Scene *UNUSED(scene), S static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set) { Object *ob= (Object *)tselem->id; - Base *base= object_in_scene(ob, scene); + Base *base= BKE_scene_base_find(scene, ob); if (set) { if (scene->obedit) @@ -745,15 +745,15 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa } for (gob= gr->gobject.first; gob; gob= gob->next) { - ED_base_object_select(object_in_scene(gob->ob, scene), sel); + ED_base_object_select(BKE_scene_base_find(scene, gob->ob), sel); } } else { - scene_deselect_all(scene); + BKE_scene_base_deselect_all(scene); for (gob= gr->gobject.first; gob; gob= gob->next) { if ((gob->ob->flag & SELECT) == 0) - ED_base_object_select(object_in_scene(gob->ob, scene), BA_SELECT); + ED_base_object_select(BKE_scene_base_find(scene, gob->ob), BA_SELECT); } } diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index 89eb51f73ba..c22ed22ff92 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -202,7 +202,7 @@ static void unlink_group_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEleme } } else { - unlink_group(group); + BKE_group_unlink(group); } } @@ -242,7 +242,7 @@ static void object_select_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, { Base *base= (Base *)te->directdata; - if (base==NULL) base= object_in_scene((Object *)tselem->id, scene); + if (base==NULL) base= BKE_scene_base_find(scene, (Object *)tselem->id); if (base && ((base->object->restrictflag & OB_RESTRICT_VIEW)==0)) { base->flag |= SELECT; base->object->flag |= SELECT; @@ -253,7 +253,7 @@ static void object_deselect_cb(bContext *UNUSED(C), Scene *scene, TreeElement *t { Base *base= (Base *)te->directdata; - if (base==NULL) base= object_in_scene((Object *)tselem->id, scene); + if (base==NULL) base= BKE_scene_base_find(scene, (Object *)tselem->id); if (base) { base->flag &= ~SELECT; base->object->flag &= ~SELECT; @@ -265,7 +265,7 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto Base *base= (Base *)te->directdata; if (base==NULL) - base= object_in_scene((Object *)tselem->id, scene); + base= BKE_scene_base_find(scene, (Object *)tselem->id); if (base) { // check also library later if (scene->obedit==base->object) @@ -349,7 +349,7 @@ static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElemen Base *base; for (gob=group->gobject.first; gob; gob=gob->next) { - base= object_in_scene(gob->ob, scene); + base= BKE_scene_base_find(scene, gob->ob); if (base) { base->object->flag |= SELECT; base->flag |= SELECT; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 5766099aabb..b021c233f8c 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2657,19 +2657,6 @@ void SEQUENCER_OT_copy(wmOperatorType *ot) /* properties */ } -static void seq_paste_add_sound(Scene *scene, Sequence *seq) -{ - if (seq->type == SEQ_META) { - Sequence *iseq; - for (iseq = seq->seqbase.first; iseq; iseq = iseq->next) { - seq_paste_add_sound(scene, iseq); - } - } - else if (seq->type == SEQ_SOUND) { - seq->scene_sound = sound_add_scene_sound_defaults(scene, seq); - } -} - static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); @@ -2698,9 +2685,6 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op)) /* make sure the pasted strips have unique names between them */ for (; iseq; iseq = iseq->next) { seq_recursive_apply(iseq, apply_unique_name_cb, scene); - - /* restore valid sound_scene for newly added strips */ - seq_paste_add_sound(scene, iseq); } WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index e421ace75a0..4168cb9ac77 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -186,7 +186,7 @@ static void sequencer_free(SpaceLink *UNUSED(sl)) { // SpaceSeq *sseq= (SpaceSequencer*) sl; -// XXX if (sseq->gpd) free_gpencil_data(sseq->gpd); +// XXX if (sseq->gpd) BKE_gpencil_free(sseq->gpd); } diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index f60217ba8ac..3116d94df87 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -167,7 +167,7 @@ static int text_new_exec(bContext *C, wmOperator *UNUSED(op)) PointerRNA ptr, idptr; PropertyRNA *prop; - text = add_empty_text("Text"); + text = BKE_text_add("Text"); /* hook into UI */ uiIDContextProperty(C, &ptr, &prop); @@ -236,7 +236,7 @@ static int text_open_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", str); - text = add_text(str, G.main->name); + text = BKE_text_load(str, G.main->name); if (!text) { if (op->customdata) MEM_freeN(op->customdata); @@ -320,7 +320,7 @@ static int text_reload_exec(bContext *C, wmOperator *op) { Text *text = CTX_data_edit_text(C); - if (!reopen_text(text)) { + if (!BKE_text_reload(text)) { BKE_report(op->reports, RPT_ERROR, "Could not reopen file"); return OPERATOR_CANCELLED; } @@ -379,8 +379,8 @@ static int text_unlink_exec(bContext *C, wmOperator *UNUSED(op)) } } - unlink_text(bmain, text); - free_libblock(&bmain->text, text); + BKE_text_unlink(bmain, text); + BKE_libblock_free(&bmain->text, text); text_drawcache_tag_update(st, 1); WM_event_add_notifier(C, NC_TEXT | NA_REMOVED, NULL); @@ -1331,6 +1331,46 @@ void TEXT_OT_select_word(wmOperatorType *ot) ot->poll = text_edit_poll; } +/********************* move lines operators ***********************/ + +static int move_lines_exec(bContext *C, wmOperator *op) +{ + Text *text = CTX_data_edit_text(C); + const int direction = RNA_enum_get(op->ptr, "direction"); + + txt_move_lines(text, direction); + + text_update_cursor_moved(C); + WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text); + + /* run the script while editing, evil but useful */ + if (CTX_wm_space_text(C)->live_edit) + text_run_script(C, NULL); + + return OPERATOR_FINISHED; +} + +void TEXT_OT_move_lines(wmOperatorType *ot) +{ + static EnumPropertyItem direction_items[]= { + {TXT_MOVE_LINE_UP, "UP", 0, "Up", ""}, + {TXT_MOVE_LINE_DOWN, "DOWN", 0, "Down", ""}, + {0, NULL, 0, NULL, NULL} + }; + + /* identifiers */ + ot->name = "Move Lines"; + ot->idname = "TEXT_OT_move_lines"; + ot->description = "Move the currently selected line(s) up/down"; + + /* api callbacks */ + ot->exec = move_lines_exec; + ot->poll = text_edit_poll; + + /* properties */ + RNA_def_enum(ot->srna, "direction", direction_items, 1, "Direction", ""); +} + /******************* previous marker operator *********************/ static int text_previous_marker_exec(bContext *C, wmOperator *UNUSED(op)) diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c index ca5b21012aa..a9801012d67 100644 --- a/source/blender/editors/space_view3d/drawanimviz.c +++ b/source/blender/editors/space_view3d/drawanimviz.c @@ -258,7 +258,7 @@ void draw_motion_path_instance(Scene *scene, * unless an option is set to always use the whole action */ if ((pchan) && (avs->path_viewflag & MOTIONPATH_VIEW_KFACT) == 0) { - bActionGroup *agrp = action_groups_find_named(adt->action, pchan->name); + bActionGroup *agrp = BKE_action_group_find_name(adt->action, pchan->name); if (agrp) { agroup_to_keylist(adt, agrp, &keys, NULL); diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index fec93b3b9aa..a03b6cca8df 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -2338,9 +2338,9 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base /* copy the pose */ poseo = ob->pose; - copy_pose(&posen, ob->pose, 1); + BKE_pose_copy_data(&posen, ob->pose, 1); ob->pose = posen; - armature_rebuild_pose(ob, ob->data); /* child pointers for IK */ + BKE_pose_rebuild(ob, ob->data); /* child pointers for IK */ ghost_poses_tag_unselected(ob, 0); /* hide unselected bones if need be */ glEnable(GL_BLEND); @@ -2352,20 +2352,20 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128 - (int)(120.0 * sqrt(colfac))); BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - where_is_pose(scene, ob); + BKE_pose_where_is(scene, ob); draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE, FALSE); } glDisable(GL_BLEND); if (v3d->zbuf) glEnable(GL_DEPTH_TEST); ghost_poses_tag_unselected(ob, 1); /* unhide unselected bones if need be */ - free_pose(posen); + BKE_pose_free(posen); /* restore */ CFRA = cfrao; ob->pose = poseo; arm->flag = flago; - armature_rebuild_pose(ob, ob->data); + BKE_pose_rebuild(ob, ob->data); ob->mode |= OB_MODE_POSE; ob->ipoflag = ipoflago; } @@ -2415,9 +2415,9 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base * /* copy the pose */ poseo = ob->pose; - copy_pose(&posen, ob->pose, 1); + BKE_pose_copy_data(&posen, ob->pose, 1); ob->pose = posen; - armature_rebuild_pose(ob, ob->data); /* child pointers for IK */ + BKE_pose_rebuild(ob, ob->data); /* child pointers for IK */ ghost_poses_tag_unselected(ob, 0); /* hide unselected bones if need be */ glEnable(GL_BLEND); @@ -2431,7 +2431,7 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base * CFRA = (int)ak->cfra; BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - where_is_pose(scene, ob); + BKE_pose_where_is(scene, ob); draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE, FALSE); } glDisable(GL_BLEND); @@ -2439,13 +2439,13 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base * ghost_poses_tag_unselected(ob, 1); /* unhide unselected bones if need be */ BLI_dlrbTree_free(&keys); - free_pose(posen); + BKE_pose_free(posen); /* restore */ CFRA = cfrao; ob->pose = poseo; arm->flag = flago; - armature_rebuild_pose(ob, ob->data); + BKE_pose_rebuild(ob, ob->data); ob->mode |= OB_MODE_POSE; } @@ -2481,9 +2481,9 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base) /* copy the pose */ poseo = ob->pose; - copy_pose(&posen, ob->pose, 1); + BKE_pose_copy_data(&posen, ob->pose, 1); ob->pose = posen; - armature_rebuild_pose(ob, ob->data); /* child pointers for IK */ + BKE_pose_rebuild(ob, ob->data); /* child pointers for IK */ ghost_poses_tag_unselected(ob, 0); /* hide unselected bones if need be */ glEnable(GL_BLEND); @@ -2501,7 +2501,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base) if (CFRA != cfrao) { BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - where_is_pose(scene, ob); + BKE_pose_where_is(scene, ob); draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE, FALSE); } } @@ -2516,7 +2516,7 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base) if (CFRA != cfrao) { BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL); - where_is_pose(scene, ob); + BKE_pose_where_is(scene, ob); draw_pose_bones(scene, v3d, ar, base, OB_WIRE, TRUE, FALSE); } } @@ -2525,13 +2525,13 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base) if (v3d->zbuf) glEnable(GL_DEPTH_TEST); ghost_poses_tag_unselected(ob, 1); /* unhide unselected bones if need be */ - free_pose(posen); + BKE_pose_free(posen); /* restore */ CFRA = cfrao; ob->pose = poseo; arm->flag = flago; - armature_rebuild_pose(ob, ob->data); + BKE_pose_rebuild(ob, ob->data); ob->mode |= OB_MODE_POSE; } diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index 524b66c852c..79470e22c93 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -928,7 +928,7 @@ static int tex_mat_set_face_editmesh_cb(void *userData, int index) void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags) { - if ((!scene_use_new_shading_nodes(scene)) || (draw_flags & DRAW_MODIFIERS_PREVIEW)) { + if ((!BKE_scene_use_new_shading_nodes(scene)) || (draw_flags & DRAW_MODIFIERS_PREVIEW)) { draw_mesh_textured_old(scene, v3d, rv3d, ob, dm, draw_flags); return; } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 585fc43e5c2..beb1cc57f6e 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -190,7 +190,7 @@ static int check_object_draw_texture(Scene *scene, View3D *v3d, int drawtype) return TRUE; /* textured solid */ - if (v3d->drawtype == OB_SOLID && (v3d->flag2 & V3D_SOLID_TEX) && !scene_use_new_shading_nodes(scene)) + if (v3d->drawtype == OB_SOLID && (v3d->flag2 & V3D_SOLID_TEX) && !BKE_scene_use_new_shading_nodes(scene)) return TRUE; return FALSE; @@ -332,7 +332,7 @@ int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt) return 0; if (ob == OBACT && (ob && ob->mode & OB_MODE_WEIGHT_PAINT)) return 0; - if (scene_use_new_shading_nodes(scene)) + if (BKE_scene_use_new_shading_nodes(scene)) return 0; return (scene->gm.matmode == GAME_MAT_GLSL) && (dt > OB_SOLID); @@ -1740,7 +1740,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base int i; float drawsize; const short is_view = (rv3d->persp == RV3D_CAMOB && ob == v3d->camera); - MovieClip *clip = object_get_movieclip(scene, base->object, 0); + MovieClip *clip = BKE_object_movieclip_get(scene, base->object, 0); /* draw data for movie clip set as active for scene */ if (clip) { @@ -1762,7 +1762,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base scale[1] = 1.0f / len_v3(ob->obmat[1]); scale[2] = 1.0f / len_v3(ob->obmat[2]); - camera_view_frame_ex(scene, cam, cam->drawsize, is_view, scale, + BKE_camera_view_frame_ex(scene, cam, cam->drawsize, is_view, scale, asp, shift, &drawsize, vec); glDisable(GL_LIGHTING); @@ -1834,7 +1834,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base if (cam->flag & CAM_SHOWLIMITS) { draw_limit_line(cam->clipsta, cam->clipend, 0x77FFFF); /* qdn: was yafray only, now also enabled for Blender to be used with defocus composite node */ - draw_focus_cross(object_camera_dof_distance(ob), cam->drawsize); + draw_focus_cross(BKE_camera_object_dof_distance(ob), cam->drawsize); } wrld = scene->world; @@ -1971,7 +1971,7 @@ static void drawlattice(Scene *scene, View3D *v3d, Object *ob) /* now we default make displist, this will modifiers work for non animated case */ if (ob->disp.first == NULL) - lattice_calc_modifiers(scene, ob); + BKE_lattice_modifiers_calc(scene, ob); dl = find_displist(&ob->disp, DL_VERTS); if (is_edit) { @@ -4284,7 +4284,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv totpart = psys->totpart; - cfra = BKE_curframe(scene); + cfra = BKE_scene_frame_get(scene); if (draw_as == PART_DRAW_PATH && psys->pathcache == NULL && psys->childcache == NULL) draw_as = PART_DRAW_DOT; @@ -6091,7 +6091,7 @@ static void draw_box(float vec[8][3]) #if 0 static void get_local_bounds(Object *ob, float center[3], float size[3]) { - BoundBox *bb = object_get_boundbox(ob); + BoundBox *bb = BKE_object_boundbox_get(ob); if (bb == NULL) { zero_v3(center); @@ -6167,7 +6167,7 @@ static void draw_bounding_volume(Scene *scene, Object *ob, char type) } } else if (ob->type == OB_ARMATURE) { - bb = BKE_armature_get_bb(ob); + bb = BKE_armature_boundbox_get(ob); } else { drawcube(); @@ -6434,7 +6434,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) view3d_cached_text_draw_begin(); /* patch? children objects with a timeoffs change the parents. How to solve! */ - /* if ( ((int)ob->ctime) != F_(scene->r.cfra)) where_is_object(scene, ob); */ + /* if ( ((int)ob->ctime) != F_(scene->r.cfra)) BKE_object_where_is_calc(scene, ob); */ /* draw motion paths (in view space) */ if (ob->mpath && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { @@ -6646,7 +6646,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) setlinestyle(0); - if (BKE_font_getselection(ob, &selstart, &selend) && cu->selboxes) { + if (BKE_vfont_select_get(ob, &selstart, &selend) && cu->selboxes) { float selboxw; cpack(0xffffff); @@ -7140,7 +7140,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) for (ct = targets.first; ct; ct = ct->next) { /* calculate target's matrix */ if (cti->get_target_matrix) - cti->get_target_matrix(curcon, cob, ct, BKE_curframe(scene)); + cti->get_target_matrix(curcon, cob, ct, BKE_scene_frame_get(scene)); else unit_m4(ct->matrix); diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 72b67c2a716..28fd2c8bc74 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -1016,7 +1016,7 @@ static void space_view3d_listener(struct ScrArea *sa, struct wmNotifier *wmn) break; } - // removed since BKE_image_user_calc_frame is now called in draw_bgpic because screen_ops doesnt call the notifier. + // removed since BKE_image_user_frame_calc is now called in draw_bgpic because screen_ops doesnt call the notifier. #if 0 if (wmn->category == NC_SCENE && wmn->data == ND_FRAME) { View3D *v3d = area->spacedata.first; @@ -1025,7 +1025,7 @@ static void space_view3d_listener(struct ScrArea *sa, struct wmNotifier *wmn) for (; bgpic; bgpic = bgpic->next) { if (bgpic->ima) { Scene *scene = wmn->reference; - BKE_image_user_calc_frame(&bgpic->iuser, scene->r.cfra, 0); + BKE_image_user_frame_calc(&bgpic->iuser, scene->r.cfra, 0); } } } @@ -1071,7 +1071,7 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes for (base = scene->base.first; base; base = base->next) { if ((base->flag & SELECT) && (base->lay & lay)) { if ((base->object->restrictflag & OB_RESTRICT_VIEW) == 0) { - if (0 == object_is_libdata(base->object)) { + if (0 == BKE_object_is_libdata(base->object)) { if (selected_editable_objects) CTX_data_id_list_add(result, &base->object->id); else diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 13129616843..723dc9d5fc8 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -939,7 +939,7 @@ static void v3d_posearmature_buts(uiLayout *layout, Object *ob) PointerRNA pchanptr; uiLayout *col; - pchan = get_active_posechannel(ob); + pchan = BKE_pose_channel_active(ob); if (!pchan) { uiItemL(layout, IFACE_("No Bone Active"), ICON_NONE); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index ec383e1dbdb..0a890230ca7 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -847,7 +847,7 @@ static void draw_selected_name(Scene *scene, Object *ob) short offset = 30; /* get name of marker on current frame (if available) */ - markern = scene_find_marker_name(scene, CFRA); + markern = BKE_scene_find_marker_name(scene, CFRA); /* check if there is an object */ if (ob) { @@ -910,7 +910,7 @@ static void draw_selected_name(Scene *scene, Object *ob) } /* color depends on whether there is a keyframe */ - if (id_frame_has_keyframe((ID *)ob, /*BKE_curframe(scene)*/ (float)(CFRA), ANIMFILTER_KEYS_LOCAL)) + if (id_frame_has_keyframe((ID *)ob, /*BKE_scene_frame_get(scene)*/ (float)(CFRA), ANIMFILTER_KEYS_LOCAL)) UI_ThemeColor(TH_VERTEX_SELECT); else UI_ThemeColor(TH_TEXT_HI); @@ -939,21 +939,21 @@ static void view3d_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionV rctf rect_view, rect_camera; /* get viewport viewplane */ - camera_params_init(¶ms); - camera_params_from_view3d(¶ms, v3d, rv3d); + BKE_camera_params_init(¶ms); + BKE_camera_params_from_view3d(¶ms, v3d, rv3d); if (no_zoom) params.zoom = 1.0f; - camera_params_compute_viewplane(¶ms, ar->winx, ar->winy, 1.0f, 1.0f); + BKE_camera_params_compute_viewplane(¶ms, ar->winx, ar->winy, 1.0f, 1.0f); rect_view = params.viewplane; /* get camera viewplane */ - camera_params_init(¶ms); - camera_params_from_object(¶ms, v3d->camera); + BKE_camera_params_init(¶ms); + BKE_camera_params_from_object(¶ms, v3d->camera); if (no_shift) { params.shiftx = 0.0f; params.shifty = 0.0f; } - camera_params_compute_viewplane(¶ms, scene->r.xsch, scene->r.ysch, scene->r.xasp, scene->r.yasp); + BKE_camera_params_compute_viewplane(¶ms, scene->r.xsch, scene->r.ysch, scene->r.xasp, scene->r.yasp); rect_camera = params.viewplane; /* get camera border within viewport */ @@ -1226,7 +1226,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) * assume and square sensor and only use sensor_x */ float sizex = scene->r.xsch * scene->r.xasp; float sizey = scene->r.ysch * scene->r.yasp; - int sensor_fit = camera_sensor_fit(ca->sensor_fit, sizex, sizey); + int sensor_fit = BKE_camera_sensor_fit(ca->sensor_fit, sizex, sizey); float sensor_x = ca->sensor_x; float sensor_y = (ca->sensor_fit == CAMERA_SENSOR_FIT_AUTO) ? ca->sensor_x : ca->sensor_y; @@ -1544,7 +1544,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, int foreground) ima = bgpic->ima; if (ima == NULL) continue; - BKE_image_user_calc_frame(&bgpic->iuser, CFRA, 0); + BKE_image_user_frame_calc(&bgpic->iuser, CFRA, 0); ibuf = BKE_image_get_ibuf(ima, &bgpic->iuser); } else { @@ -1552,7 +1552,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, int foreground) if (bgpic->flag & V3D_BGPIC_CAMERACLIP) { if (scene->camera) - clip = object_get_movieclip(scene, scene->camera, 1); + clip = BKE_object_movieclip_get(scene, scene->camera, 1); } else clip = bgpic->clip; @@ -1866,7 +1866,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas /* lamp drawing messes with matrices, could be handled smarter... but this works */ (dob->ob->type == OB_LAMP) || (dob->type == OB_DUPLIGROUP && dob->animated) || - !(bb_tmp = object_get_boundbox(dob->ob))) + !(bb_tmp = BKE_object_boundbox_get(dob->ob))) { // printf("draw_dupli_objects_color: skipping displist for %s\n", dob->ob->id.name+2); use_displist = 0; @@ -1876,7 +1876,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas bb = *bb_tmp; /* must make a copy */ /* disable boundbox check for list creation */ - object_boundbox_flag(dob->ob, OB_BB_DISABLED, 1); + BKE_object_boundbox_flag(dob->ob, OB_BB_DISABLED, 1); /* need this for next part of code */ unit_m4(dob->ob->obmat); /* obmat gets restored */ @@ -1886,7 +1886,7 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas glEndList(); use_displist = 1; - object_boundbox_flag(dob->ob, OB_BB_DISABLED, 0); + BKE_object_boundbox_flag(dob->ob, OB_BB_DISABLED, 0); } } if (use_displist) { @@ -2043,7 +2043,7 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d) RegionView3D *rv3d = ar->regiondata; setwinmatrixview3d(ar, v3d, NULL); /* 0= no pick rect */ - setviewmatrixview3d(scene, v3d, rv3d); /* note: calls where_is_object for camera... */ + setviewmatrixview3d(scene, v3d, rv3d); /* note: calls BKE_object_where_is_calc for camera... */ mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat); invert_m4_m4(rv3d->persinv, rv3d->persmat); @@ -2078,7 +2078,7 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (*func)(void *)) U.obcenter_dia = 0; setwinmatrixview3d(ar, v3d, NULL); /* 0= no pick rect */ - setviewmatrixview3d(scene, v3d, rv3d); /* note: calls where_is_object for camera... */ + setviewmatrixview3d(scene, v3d, rv3d); /* note: calls BKE_object_where_is_calc for camera... */ mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat); invert_m4_m4(rv3d->persinv, rv3d->persmat); @@ -2297,7 +2297,7 @@ CustomDataMask ED_view3d_datamask(Scene *scene, View3D *v3d) { mask |= CD_MASK_MTFACE | CD_MASK_MCOL; - if (scene_use_new_shading_nodes(scene)) { + if (BKE_scene_use_new_shading_nodes(scene)) { if (v3d->drawtype == OB_MATERIAL) mask |= CD_MASK_ORCO; } @@ -2367,7 +2367,7 @@ void ED_view3d_update_viewmat(Scene *scene, View3D *v3d, ARegion *ar, float view if (viewmat) copy_m4_m4(rv3d->viewmat, viewmat); else - setviewmatrixview3d(scene, v3d, rv3d); /* note: calls where_is_object for camera... */ + setviewmatrixview3d(scene, v3d, rv3d); /* note: calls BKE_object_where_is_calc for camera... */ /* update utilitity matrices */ mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat); @@ -2612,10 +2612,10 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, if (rv3d->persp == RV3D_CAMOB && v3d->camera) { CameraParams params; - camera_params_init(¶ms); - camera_params_from_object(¶ms, v3d->camera); - camera_params_compute_viewplane(¶ms, sizex, sizey, scene->r.xasp, scene->r.yasp); - camera_params_compute_matrix(¶ms); + BKE_camera_params_init(¶ms); + BKE_camera_params_from_object(¶ms, v3d->camera); + BKE_camera_params_compute_viewplane(¶ms, sizex, sizey, scene->r.xasp, scene->r.yasp); + BKE_camera_params_compute_matrix(¶ms); ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, params.winmat, draw_background); } @@ -2673,10 +2673,10 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int w { CameraParams params; - camera_params_init(¶ms); - camera_params_from_object(¶ms, v3d.camera); - camera_params_compute_viewplane(¶ms, width, height, scene->r.xasp, scene->r.yasp); - camera_params_compute_matrix(¶ms); + BKE_camera_params_init(¶ms); + BKE_camera_params_from_object(¶ms, v3d.camera); + BKE_camera_params_compute_viewplane(¶ms, width, height, scene->r.xasp, scene->r.yasp); + BKE_camera_params_compute_matrix(¶ms); copy_m4_m4(rv3d.winmat, params.winmat); v3d.near = params.clipsta; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 2f66fdf8cd4..62f38281871 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -56,6 +56,8 @@ #include "BKE_report.h" #include "BKE_scene.h" #include "BKE_screen.h" +#include "BKE_action.h" +#include "BKE_armature.h" #include "BKE_depsgraph.h" /* for ED_view3d_camera_lock_sync */ @@ -68,6 +70,7 @@ #include "RNA_access.h" #include "RNA_define.h" +#include "ED_armature.h" #include "ED_particle.h" #include "ED_screen.h" #include "ED_transform.h" @@ -120,9 +123,9 @@ int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) mult_m4_m4m4(parent_mat, diff_mat, root_parent->obmat); - object_tfm_protected_backup(root_parent, &obtfm); - object_apply_mat4(root_parent, parent_mat, TRUE, FALSE); - object_tfm_protected_restore(root_parent, &obtfm, root_parent->protectflag); + BKE_object_tfm_protected_backup(root_parent, &obtfm); + BKE_object_apply_mat4(root_parent, parent_mat, TRUE, FALSE); + BKE_object_tfm_protected_restore(root_parent, &obtfm, root_parent->protectflag); ob_update = v3d->camera; while (ob_update) { @@ -132,9 +135,9 @@ int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d) } } else { - object_tfm_protected_backup(v3d->camera, &obtfm); + BKE_object_tfm_protected_backup(v3d->camera, &obtfm); ED_view3d_to_object(v3d->camera, rv3d->ofs, rv3d->viewquat, rv3d->dist); - object_tfm_protected_restore(v3d->camera, &obtfm, v3d->camera->protectflag); + BKE_object_tfm_protected_restore(v3d->camera, &obtfm, v3d->camera->protectflag); DAG_id_tag_update(&v3d->camera->id, OB_RECALC_OB); WM_main_add_notifier(NC_OBJECT | ND_TRANSFORM, v3d->camera); @@ -2067,7 +2070,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in continue; } - minmax_object(base->object, min, max); + BKE_object_minmax(base->object, min, max); } } if (!onedone) { @@ -2209,8 +2212,8 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op)) } /* account for duplis */ - if (minmax_object_duplis(scene, base->object, min, max) == 0) - minmax_object(base->object, min, max); /* use if duplis not found */ + if (BKE_object_minmax_dupli(scene, base->object, min, max) == 0) + BKE_object_minmax(base->object, min, max); /* use if duplis not found */ ok = 1; } @@ -2280,6 +2283,89 @@ void VIEW3D_OT_view_selected(wmOperatorType *ot) ot->flag = 0; } +static int view_lock_clear_exec(bContext *C, wmOperator *UNUSED(op)) +{ + View3D *v3d = CTX_wm_view3d(C); + + if (v3d) { + ED_view3D_lock_clear(v3d); + + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d); + + return OPERATOR_FINISHED; + } + else { + return OPERATOR_CANCELLED; + } +} + +void VIEW3D_OT_view_lock_clear(wmOperatorType *ot) +{ + + /* identifiers */ + ot->name = "View Lock Clear"; + ot->description = "Clears all view locking"; + ot->idname = "VIEW3D_OT_view_lock_clear"; + + /* api callbacks */ + ot->exec = view_lock_clear_exec; + ot->poll = ED_operator_region_view3d_active; + + /* flags */ + ot->flag = 0; +} + +static int view_lock_to_active_exec(bContext *C, wmOperator *UNUSED(op)) +{ + View3D *v3d = CTX_wm_view3d(C); + Object *obact = CTX_data_active_object(C); + + if (v3d) { + + ED_view3D_lock_clear(v3d); + + v3d->ob_centre = obact; /* can be NULL */ + + if (obact && obact->type == OB_ARMATURE) { + if (obact->mode & OB_MODE_POSE) { + bPoseChannel *pcham_act = BKE_pose_channel_active(obact); + if (pcham_act) { + BLI_strncpy(v3d->ob_centre_bone, pcham_act->name, sizeof(v3d->ob_centre_bone)); + } + } + else { + EditBone *ebone_act = ((bArmature *)obact->data)->act_edbone; + if (ebone_act) { + BLI_strncpy(v3d->ob_centre_bone, ebone_act->name, sizeof(v3d->ob_centre_bone)); + } + } + } + + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d); + + return OPERATOR_FINISHED; + } + else { + return OPERATOR_CANCELLED; + } +} + +void VIEW3D_OT_view_lock_to_active(wmOperatorType *ot) +{ + + /* identifiers */ + ot->name = "View Lock to Active"; + ot->description = "Lock the view to the active object/bone"; + ot->idname = "VIEW3D_OT_view_lock_to_active"; + + /* api callbacks */ + ot->exec = view_lock_to_active_exec; + ot->poll = ED_operator_region_view3d_active; + + /* flags */ + ot->flag = 0; +} + static int viewcenter_cursor_exec(bContext *C, wmOperator *UNUSED(op)) { View3D *v3d = CTX_wm_view3d(C); @@ -2840,7 +2926,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op) v3d->camera = ob; if (v3d->camera == NULL) - v3d->camera = scene_find_camera(scene); + v3d->camera = BKE_scene_camera_find(scene); /* couldnt find any useful camera, bail out */ if (v3d->camera == NULL) @@ -3083,11 +3169,11 @@ static int background_image_add_invoke(bContext *C, wmOperator *op, wmEvent *UNU char path[FILE_MAX]; RNA_string_get(op->ptr, "filepath", path); - ima = BKE_add_image_file(path); + ima = BKE_image_load_exists(path); } else if (RNA_struct_property_is_set(op->ptr, "name")) { RNA_string_get(op->ptr, "name", name); - ima = (Image *)find_id("IM", name); + ima = (Image *)BKE_libblock_find_name(ID_IM, name); } bgpic = background_image_add(C); @@ -3649,8 +3735,8 @@ void ED_view3d_from_object(Object *ob, float ofs[3], float quat[4], float *dist, if (lens) { CameraParams params; - camera_params_init(¶ms); - camera_params_from_object(¶ms, ob); + BKE_camera_params_init(¶ms); + BKE_camera_params_from_object(¶ms, ob); *lens = params.lens; } } @@ -3660,7 +3746,7 @@ void ED_view3d_to_object(Object *ob, const float ofs[3], const float quat[4], co { float mat[4][4]; ED_view3d_to_m4(mat, ofs, quat, dist); - object_apply_mat4(ob, mat, TRUE, TRUE); + BKE_object_apply_mat4(ob, mat, TRUE, TRUE); } BGpic *ED_view3D_background_image_new(View3D *v3d) @@ -3698,3 +3784,11 @@ void ED_view3D_background_image_clear(View3D *v3d) bgpic = next_bgpic; } } + +void ED_view3D_lock_clear(View3D *v3d) +{ + v3d->ob_centre = NULL; + v3d->ob_centre_bone[0] = '\0'; + v3d->ob_centre_cursor = FALSE; + v3d->flag2 &= ~V3D_LOCK_CAMERA; +} diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 5b6624889c8..c2a2a2be2fd 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -366,9 +366,9 @@ static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event /* store the original camera loc and rot */ /* TODO. axis angle etc */ - fly->obtfm = object_tfm_backup(ob_back); + fly->obtfm = BKE_object_tfm_backup(ob_back); - where_is_object(fly->scene, fly->v3d->camera); + BKE_object_where_is_calc(fly->scene, fly->v3d->camera); negate_v3_v3(fly->rv3d->ofs, fly->v3d->camera->obmat[3]); fly->rv3d->dist = 0.0; @@ -429,7 +429,7 @@ static int flyEnd(bContext *C, FlyInfo *fly) ob_back = (fly->root_parent) ? fly->root_parent : fly->v3d->camera; /* store the original camera loc and rot */ - object_tfm_restore(ob_back, fly->obtfm); + BKE_object_tfm_restore(ob_back, fly->obtfm); DAG_id_tag_update(&ob_back->id, OB_RECALC_OB); } @@ -709,9 +709,9 @@ static void move_camera(bContext *C, RegionView3D *rv3d, FlyInfo *fly, int orien ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist); mult_m4_m4m4(diff_mat, view_mat, prev_view_imat); mult_m4_m4m4(parent_mat, diff_mat, fly->root_parent->obmat); - object_apply_mat4(fly->root_parent, parent_mat, TRUE, FALSE); + BKE_object_apply_mat4(fly->root_parent, parent_mat, TRUE, FALSE); - // where_is_object(scene, fly->root_parent); + // BKE_object_where_is_calc(scene, fly->root_parent); ob_update = v3d->camera->parent; while (ob_update) { @@ -724,7 +724,7 @@ static void move_camera(bContext *C, RegionView3D *rv3d, FlyInfo *fly, int orien else { float view_mat[4][4]; ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist); - object_apply_mat4(v3d->camera, view_mat, TRUE, FALSE); + BKE_object_apply_mat4(v3d->camera, view_mat, TRUE, FALSE); id_key = &v3d->camera->id; } diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 66b8ceb7a85..23de42ecc36 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -78,6 +78,8 @@ void VIEW3D_OT_ndof_pan(struct wmOperatorType *ot); void VIEW3D_OT_view_all(struct wmOperatorType *ot); void VIEW3D_OT_viewnumpad(struct wmOperatorType *ot); void VIEW3D_OT_view_selected(struct wmOperatorType *ot); +void VIEW3D_OT_view_lock_clear(struct wmOperatorType *ot); +void VIEW3D_OT_view_lock_to_active(struct wmOperatorType *ot); void VIEW3D_OT_view_center_cursor(struct wmOperatorType *ot); void VIEW3D_OT_view_center_camera(struct wmOperatorType *ot); void VIEW3D_OT_view_pan(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index 99da487f923..f760254e8d2 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -72,6 +72,8 @@ void view3d_operatortypes(void) WM_operatortype_append(VIEW3D_OT_background_image_add); WM_operatortype_append(VIEW3D_OT_background_image_remove); WM_operatortype_append(VIEW3D_OT_view_selected); + WM_operatortype_append(VIEW3D_OT_view_lock_clear); + WM_operatortype_append(VIEW3D_OT_view_lock_to_active); WM_operatortype_append(VIEW3D_OT_view_center_cursor); WM_operatortype_append(VIEW3D_OT_view_center_camera); WM_operatortype_append(VIEW3D_OT_select); @@ -135,7 +137,10 @@ void view3d_keymap(wmKeyConfig *keyconf) WM_keymap_verify_item(keymap, "VIEW3D_OT_dolly", MIDDLEMOUSE, KM_PRESS, KM_CTRL | KM_SHIFT, 0); WM_keymap_verify_item(keymap, "VIEW3D_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "VIEW3D_OT_view_center_cursor", PADPERIOD, KM_PRESS, KM_CTRL, 0); - + + WM_keymap_verify_item(keymap, "VIEW3D_OT_view_lock_to_active", PADPERIOD, KM_PRESS, KM_SHIFT, 0); + WM_keymap_verify_item(keymap, "VIEW3D_OT_view_lock_clear", PADPERIOD, KM_PRESS, KM_ALT, 0); + WM_keymap_verify_item(keymap, "VIEW3D_OT_fly", FKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_verify_item(keymap, "VIEW3D_OT_smoothview", TIMER1, KM_ANY, KM_ANY, 0); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 8a211c6a22e..447a65ced87 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1407,7 +1407,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce /* index of bundle is 1<<16-based. if there's no "bone" index * in hight word, this buffer value belongs to camera,. not to bundle */ if (buffer[4 * i + 3] & 0xFFFF0000) { - MovieClip *clip = object_get_movieclip(scene, basact->object, 0); + MovieClip *clip = BKE_object_movieclip_get(scene, basact->object, 0); MovieTracking *tracking = &clip->tracking; ListBase *tracksbase; MovieTrackingTrack *track; diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 87edf6a37a0..367b36db583 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -582,7 +582,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) mul_m4_v3(ob->imat, vec); /* Get location of grid point in pose space. */ - armature_loc_pose_to_bone(pchan, vec, vec); + BKE_armature_loc_pose_to_bone(pchan, vec, vec); /* adjust location */ if ((pchan->protectflag & OB_LOCK_LOCX) == 0) @@ -613,7 +613,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) vec[2] = -ob->obmat[3][2] + gridf *floorf(0.5f + ob->obmat[3][2] / gridf); if (ob->parent) { - where_is_object(scene, ob); + BKE_object_where_is_calc(scene, ob); invert_m3_m3(imat, originmat); mul_m3_v3(imat, vec); @@ -707,7 +707,7 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) if (pchan->bone->layer & arm->layer) { if ((pchan->bone->flag & BONE_CONNECTED) == 0) { /* Get position in pchan (pose) space. */ - armature_loc_pose_to_bone(pchan, vec, vec); + BKE_armature_loc_pose_to_bone(pchan, vec, vec); /* copy new position */ if ((pchan->protectflag & OB_LOCK_LOCX) == 0) @@ -738,7 +738,7 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) vec[2] = -ob->obmat[3][2] + curs[2]; if (ob->parent) { - where_is_object(scene, ob); + BKE_object_where_is_calc(scene, ob); invert_m3_m3(imat, originmat); mul_m3_v3(imat, vec); @@ -818,7 +818,7 @@ void VIEW3D_OT_snap_cursor_to_grid(wmOperatorType *ot) static void bundle_midpoint(Scene *scene, Object *ob, float vec[3]) { - MovieClip *clip = object_get_movieclip(scene, ob, 0); + MovieClip *clip = BKE_object_movieclip_get(scene, ob, 0); MovieTracking *tracking; MovieTrackingObject *object; int ok = 0; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 8a0cb4b597b..e1be274663a 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -358,11 +358,11 @@ static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op)) rv3d->lpersp = rv3d->persp; } - object_tfm_protected_backup(v3d->camera, &obtfm); + BKE_object_tfm_protected_backup(v3d->camera, &obtfm); ED_view3d_to_object(v3d->camera, rv3d->ofs, rv3d->viewquat, rv3d->dist); - object_tfm_protected_restore(v3d->camera, &obtfm, v3d->camera->protectflag); + BKE_object_tfm_protected_restore(v3d->camera, &obtfm, v3d->camera->protectflag); DAG_id_tag_update(&v3d->camera->id, OB_RECALC_OB); rv3d->persp = RV3D_CAMOB; @@ -412,7 +412,7 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *UNUSED(o float r_co[3]; /* the new location to apply */ /* this function does all the important stuff */ - if (camera_view_frame_fit_to_scene(scene, v3d, camera_ob, r_co)) { + if (BKE_camera_view_frame_fit_to_scene(scene, v3d, camera_ob, r_co)) { ObjectTfmProtectedChannels obtfm; float obmat_new[4][4]; @@ -421,9 +421,9 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *UNUSED(o copy_v3_v3(obmat_new[3], r_co); /* only touch location */ - object_tfm_protected_backup(camera_ob, &obtfm); - object_apply_mat4(camera_ob, obmat_new, TRUE, TRUE); - object_tfm_protected_restore(camera_ob, &obtfm, OB_LOCK_SCALE | OB_LOCK_ROT4D); + BKE_object_tfm_protected_backup(camera_ob, &obtfm); + BKE_object_apply_mat4(camera_ob, obmat_new, TRUE, TRUE); + BKE_object_tfm_protected_restore(camera_ob, &obtfm, OB_LOCK_SCALE | OB_LOCK_ROT4D); /* notifiers */ DAG_id_tag_update(&camera_ob->id, OB_RECALC_OB); @@ -1000,8 +1000,8 @@ int ED_view3d_clip_range_get(View3D *v3d, RegionView3D *rv3d, float *clipsta, fl { CameraParams params; - camera_params_init(¶ms); - camera_params_from_view3d(¶ms, v3d, rv3d); + BKE_camera_params_init(¶ms); + BKE_camera_params_from_view3d(¶ms, v3d, rv3d); if (clipsta) *clipsta = params.clipsta; if (clipend) *clipend = params.clipend; @@ -1015,9 +1015,9 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winx, int winy, { CameraParams params; - camera_params_init(¶ms); - camera_params_from_view3d(¶ms, v3d, rv3d); - camera_params_compute_viewplane(¶ms, winx, winy, 1.0f, 1.0f); + BKE_camera_params_init(¶ms); + BKE_camera_params_from_view3d(¶ms, v3d, rv3d); + BKE_camera_params_compute_viewplane(¶ms, winx, winy, 1.0f, 1.0f); if (viewplane) *viewplane = params.viewplane; if (clipsta) *clipsta = params.clipsta; @@ -1155,7 +1155,7 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d) { if (rv3d->persp == RV3D_CAMOB) { /* obs/camera */ if (v3d->camera) { - where_is_object(scene, v3d->camera); + BKE_object_where_is_calc(scene, v3d->camera); obmat_to_viewmat(v3d, rv3d, v3d->camera, 0); } else { @@ -1176,7 +1176,7 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d) copy_v3_v3(vec, ob->obmat[3]); if (ob->type == OB_ARMATURE && v3d->ob_centre_bone[0]) { - bPoseChannel *pchan = get_pose_channel(ob->pose, v3d->ob_centre_bone); + bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, v3d->ob_centre_bone); if (pchan) { copy_v3_v3(vec, pchan->pose_mat[3]); mul_m4_v3(ob->obmat, vec); @@ -1412,7 +1412,7 @@ static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa) } else { if (scene->obedit) { - minmax_object(scene->obedit, min, max); + BKE_object_minmax(scene->obedit, min, max); ok = 1; @@ -1422,7 +1422,7 @@ static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa) else { for (base = FIRSTBASE; base; base = base->next) { if (TESTBASE(v3d, base)) { - minmax_object(base->object, min, max); + BKE_object_minmax(base->object, min, max); base->lay |= locallay; base->object->lay = base->lay; ok = 1; @@ -1799,8 +1799,8 @@ static int game_engine_exec(bContext *C, wmOperator *op) RestoreState(C, prevwin); //XXX restore_all_scene_cfra(scene_cfra_store); - set_scene_bg(CTX_data_main(C), startscene); - //XXX scene_update_for_newframe(bmain, scene, scene->lay); + BKE_scene_set_background(CTX_data_main(C), startscene); + //XXX BKE_scene_update_for_newframe(bmain, scene, scene->lay); return OPERATOR_FINISHED; #else diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 5ee3e4bb96d..9ab1b90ed2e 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -284,7 +284,7 @@ static void createTransTexspace(TransInfo *t) normalize_m3(td->axismtx); invert_m3_m3(td->smtx, td->mtx); - if (give_obdata_texspace(ob, &texflag, &td->loc, &td->ext->size, &td->ext->rot)) { + if (BKE_object_obdata_texspace_get(ob, &texflag, &td->loc, &td->ext->size, &td->ext->rot)) { ob->dtx |= OB_TEXSPACE; *texflag &= ~ME_AUTOSPACE; } @@ -424,7 +424,7 @@ static short apply_targetless_ik(Object *ob) bone= parchan->bone; bone->flag |= BONE_TRANSFORM; /* ensures it gets an auto key inserted */ - armature_mat_pose_to_bone(parchan, parchan->pose_mat, rmat); + BKE_armature_mat_pose_to_bone(parchan, parchan->pose_mat, rmat); /* apply and decompose, doesn't work for constraints or non-uniform scale well */ { @@ -535,11 +535,11 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr /* proper way to get parent transform + own transform + constraints transform */ copy_m3_m4(omat, ob->obmat); - /* New code, using "generic" pchan_to_pose_mat(). */ + /* New code, using "generic" BKE_pchan_to_pose_mat(). */ { float rotscale_mat[4][4], loc_mat[4][4]; - pchan_to_pose_mat(pchan, rotscale_mat, loc_mat); + BKE_pchan_to_pose_mat(pchan, rotscale_mat, loc_mat); if (t->mode == TFM_TRANSLATION) copy_m3_m4(pmat, loc_mat); else @@ -884,7 +884,7 @@ static short pose_grab_with_ik_children(bPose *pose, Bone *bone) } } if (wentdeeper==0) { - bPoseChannel *pchan= get_pose_channel(pose, bone->name); + bPoseChannel *pchan= BKE_pose_channel_find_name(pose, bone->name); if (pchan) added+= pose_grab_with_ik_add(pchan); } @@ -953,7 +953,7 @@ static void createTransPose(TransInfo *t, Object *ob) t->total= 0; /* check validity of state */ - arm= get_armature(ob); + arm= BKE_armature_from_object(ob); if ((arm==NULL) || (ob->pose==NULL)) return; if (arm->flag & ARM_RESTPOS) { @@ -4258,15 +4258,15 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob) if (skip_invert == 0 && constinv == 0) { if (constinv == 0) - ob->transflag |= OB_NO_CONSTRAINTS; /* where_is_object_time checks this */ + ob->transflag |= OB_NO_CONSTRAINTS; /* BKE_object_where_is_calc_time checks this */ - where_is_object(t->scene, ob); + BKE_object_where_is_calc(t->scene, ob); if (constinv == 0) ob->transflag &= ~OB_NO_CONSTRAINTS; } else - where_is_object(t->scene, ob); + BKE_object_where_is_calc(t->scene, ob); td->ob = ob; @@ -4320,7 +4320,7 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob) * NOTE: some Constraints, and also Tracking should never get this * done, as it doesn't work well. */ - object_to_mat3(ob, obmtx); + BKE_object_to_mat3(ob, obmtx); copy_m3_m4(totmat, ob->obmat); invert_m3_m3(obinv, totmat); mul_m3_m3m3(td->smtx, obmtx, obinv); @@ -4357,12 +4357,12 @@ static void set_trans_object_base_flags(TransInfo *t) return; /* makes sure base flags and object flags are identical */ - copy_baseflags(t->scene); + BKE_scene_base_flag_to_objects(t->scene); /* handle pending update events, otherwise they got copied below */ for (base= scene->base.first; base; base= base->next) { if (base->object->recalc) - object_handle_update(t->scene, base->object); + BKE_object_handle_update(t->scene, base->object); } for (base= scene->base.first; base; base= base->next) { @@ -4375,7 +4375,7 @@ static void set_trans_object_base_flags(TransInfo *t) /* if parent selected, deselect */ while (parsel) { if (parsel->flag & SELECT) { - Base *parbase = object_in_scene(parsel, scene); + Base *parbase = BKE_scene_base_find(scene, parsel); if (parbase) { /* in rare cases this can fail */ if (TESTBASELIB_BGMODE(v3d, scene, parbase)) { break; @@ -5046,7 +5046,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) * we need to update the pose otherwise no updates get called during * transform and the auto-ik is not applied. see [#26164] */ struct Object *pose_ob=t->poseobj; - where_is_pose(t->scene, pose_ob); + BKE_pose_where_is(t->scene, pose_ob); } /* set BONE_TRANSFORM flags for autokey, manipulator draw might have changed them */ @@ -5141,7 +5141,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t) /* recalculating the frame positions means we loose our original transform if its not auto-keyed [#24451] * this hack re-applies it, which is annoying, only alternatives are... * - don't recalc paths. - * - have an object_handle_update() which gives is the new transform without touching the objects. + * - have an BKE_object_handle_update() which gives is the new transform without touching the objects. * - only recalc paths on auto-keying. * - ED_objects_recalculate_paths could backup/restore transforms. * - re-apply the transform which is simplest in this case. (2 lines below) @@ -5878,7 +5878,7 @@ void createTransData(bContext *C, TransInfo *t) * lines below just check is also visible */ Object *ob_armature= modifiers_isDeformedByArmature(ob); if (ob_armature && ob_armature->mode & OB_MODE_POSE) { - Base *base_arm= object_in_scene(ob_armature, t->scene); + Base *base_arm= BKE_scene_base_find(t->scene, ob_armature); if (base_arm) { View3D *v3d = t->view; if (BASE_VISIBLE(v3d, base_arm)) { diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 0bf02d1a2bf..a528bf7e47f 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -833,7 +833,7 @@ static void recalcData_view3d(TransInfo *t) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); /* sets recalc flags */ } else - where_is_pose(t->scene, ob); + BKE_pose_where_is(t->scene, ob); } else if (base && (base->object->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(t->scene, base->object)) { if (t->state != TRANS_CANCEL) { diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 093c81c8d37..94f6640ca5b 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -203,7 +203,7 @@ int gimbal_axis(Object *ob, float gmat[][3]) { if (ob) { if (ob->mode & OB_MODE_POSE) { - bPoseChannel *pchan= get_active_posechannel(ob); + bPoseChannel *pchan= BKE_pose_channel_active(ob); if (pchan) { float mat[3][3], tmat[3][3], obmat[3][3]; diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index fa579293a73..b875886e80a 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -284,7 +284,7 @@ void applyProject(TransInfo *t) } else if (t->flag & T_OBJECT) { td->ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; - object_handle_update(t->scene, td->ob); + BKE_object_handle_update(t->scene, td->ob); copy_v3_v3(iloc, td->ob->obmat[3]); } @@ -966,7 +966,7 @@ static void TargetSnapClosest(TransInfo *t) if (t->flag & T_OBJECT) { int i; for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++) { - struct BoundBox *bb = object_get_boundbox(td->ob); + struct BoundBox *bb = BKE_object_boundbox_get(td->ob); /* use boundbox if possible */ if (bb) { @@ -1303,8 +1303,8 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh * test against boundbox first * */ if (totface > 16) { - struct BoundBox *bb = object_get_boundbox(ob); - test = ray_hit_boundbox(bb, ray_start_local, ray_normal_local); + struct BoundBox *bb = BKE_object_boundbox_get(ob); + test = BKE_boundbox_ray_hit_check(bb, ray_start_local, ray_normal_local); } if (test == 1) { @@ -1709,8 +1709,8 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4], * test against boundbox first * */ if (totface > 16) { - struct BoundBox *bb = object_get_boundbox(ob); - test = ray_hit_boundbox(bb, ray_start_local, ray_normal_local); + struct BoundBox *bb = BKE_object_boundbox_get(ob); + test = BKE_boundbox_ray_hit_check(bb, ray_start_local, ray_normal_local); } if (test == 1) { diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 1073369a36d..b275ce64cbd 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -186,7 +186,7 @@ void ED_uvedit_assign_image(Main *bmain, Scene *scene, Object *obedit, Image *im return; } - if (scene_use_new_shading_nodes(scene)) { + if (BKE_scene_use_new_shading_nodes(scene)) { /* new shading system, assign image in material */ int sloppy = 1; BMFace *efa = BM_active_face_get(em->bm, sloppy); diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 478643be947..2b93246e797 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -4356,7 +4356,7 @@ void param_smooth_area(ParamHandle *handle) void param_pack(ParamHandle *handle, float margin) { /* box packing variables */ - boxPack *boxarray, *box; + BoxPack *boxarray, *box; float tot_width, tot_height, scale; PChart *chart; @@ -4373,7 +4373,7 @@ void param_pack(ParamHandle *handle, float margin) param_scale(handle, 1.0f / phandle->aspx, 1.0f / phandle->aspy); /* we may not use all these boxes */ - boxarray = MEM_mallocN(phandle->ncharts * sizeof(boxPack), "boxPack box"); + boxarray = MEM_mallocN(phandle->ncharts * sizeof(BoxPack), "BoxPack box"); for (i = 0; i < phandle->ncharts; i++) { @@ -4424,7 +4424,7 @@ void param_pack(ParamHandle *handle, float margin) } } - boxPack2D(boxarray, phandle->ncharts - unpacked, &tot_width, &tot_height); + BLI_box_pack_2D(boxarray, phandle->ncharts - unpacked, &tot_width, &tot_height); if (tot_height > tot_width) scale = 1.0f / tot_height; diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 743869e82cc..f38c33fa750 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -262,13 +262,13 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em, } else { /* ngon - scanfill time! */ - BLI_begin_edgefill(&sf_ctx); + BLI_scanfill_begin(&sf_ctx); firstv = lastv = NULL; BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { int i; - v = BLI_addfillvert(&sf_ctx, l->v->co); + v = BLI_scanfill_vert_add(&sf_ctx, l->v->co); /* add small random offset */ for (i = 0; i < 3; i++) { @@ -278,7 +278,7 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em, v->tmp.p = l; if (lastv) { - BLI_addfilledge(&sf_ctx, lastv, v); + BLI_scanfill_edge_add(&sf_ctx, lastv, v); } lastv = v; @@ -286,9 +286,9 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em, firstv = v; } - BLI_addfilledge(&sf_ctx, firstv, v); + BLI_scanfill_edge_add(&sf_ctx, firstv, v); - BLI_edgefill_ex(&sf_ctx, TRUE, efa->no); + BLI_scanfill_calc_ex(&sf_ctx, TRUE, efa->no); for (sefa = sf_ctx.fillfacebase.first; sefa; sefa = sefa->next) { ls[0] = sefa->v1->tmp.p; ls[1] = sefa->v2->tmp.p; @@ -306,7 +306,7 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em, param_face_add(handle, key, 3, vkeys, co, uv, pin, select); } - BLI_end_edgefill(&sf_ctx); + BLI_scanfill_end(&sf_ctx); } } @@ -1178,7 +1178,8 @@ static int unwrap_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_INFO, "Object scale is not 1.0. Unwrap will operate on a non-scaled version of the mesh."); /* remember last method for live unwrap */ - scene->toolsettings->unwrapper = method; + if(RNA_struct_property_is_set(op->ptr, "method")) + scene->toolsettings->unwrapper = method; scene->toolsettings->uv_subsurf_level = subsurf_level; @@ -1265,12 +1266,12 @@ static int uv_from_view_exec(bContext *C, wmOperator *op) BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); - project_from_view_ortho(luv->uv, l->v->co, rotmat); + BLI_uvproject_from_view_ortho(luv->uv, l->v->co, rotmat); } } } else if (camera) { - struct UvCameraInfo *uci = project_camera_info(v3d->camera, obedit->obmat, scene->r.xsch, scene->r.ysch); + struct ProjCameraInfo *uci = BLI_uvproject_camera_info(v3d->camera, obedit->obmat, scene->r.xsch, scene->r.ysch); if (uci) { BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { @@ -1279,7 +1280,7 @@ static int uv_from_view_exec(bContext *C, wmOperator *op) BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); - project_from_camera(luv->uv, l->v->co, uci); + BLI_uvproject_from_camera(luv->uv, l->v->co, uci); } } @@ -1295,7 +1296,7 @@ static int uv_from_view_exec(bContext *C, wmOperator *op) BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV); - project_from_view(luv->uv, l->v->co, rv3d->persmat, rotmat, ar->winx, ar->winy); + BLI_uvproject_from_view(luv->uv, l->v->co, rv3d->persmat, rotmat, ar->winx, ar->winy); } } } diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 09ed3c6f5fb..fdd964d0727 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -714,7 +714,7 @@ int GPU_set_tpage(MTFace *tface, int mipmap, int alphablend) gpu_verify_repeat(ima); /* Did this get lost in the image recode? */ - /* tag_image_time(ima);*/ + /* BKE_image_tag_time(ima);*/ return 1; } @@ -1076,7 +1076,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O GPUBlendMode alphablend; int a; int gamma = scene->r.color_mgt_flag & R_COLOR_MANAGEMENT; - int new_shading_nodes = scene_use_new_shading_nodes(scene); + int new_shading_nodes = BKE_scene_use_new_shading_nodes(scene); /* initialize state */ memset(&GMS, 0, sizeof(GMS)); @@ -1410,7 +1410,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4 glPushMatrix(); glLoadMatrixf((float *)viewmat); - where_is_object_simul(scene, base->object); + BKE_object_where_is_calc_simul(scene, base->object); if (la->type==LA_SUN) { /* sun lamp */ diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 383dd6b8f2f..f75c1576fb9 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1501,7 +1501,7 @@ GPUMaterial *GPU_material_from_blender(Scene *scene, Material *ma) GPU_material_output_link(mat, outlink); } - if (!scene_use_new_shading_nodes(scene)) { + if (!BKE_scene_use_new_shading_nodes(scene)) { if (gpu_do_color_management(mat)) if (mat->outlink) GPU_link(mat, "linearrgb_to_srgb", mat->outlink, &mat->outlink); diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c index 08c5e24aca6..c726102247a 100644 --- a/source/blender/ikplugin/intern/iksolver_plugin.c +++ b/source/blender/ikplugin/intern/iksolver_plugin.c @@ -229,7 +229,7 @@ static void where_is_ik_bone(bPoseChannel *pchan, float ik_mat[][3]) // nr = t } -/* called from within the core where_is_pose loop, all animsystems and constraints +/* called from within the core BKE_pose_where_is loop, all animsystems and constraints * were executed & assigned. Now as last we do an IK pass */ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree) { @@ -535,8 +535,8 @@ void iksolver_execute_tree(struct Scene *scene, struct Object *ob, struct bPose /* 4. walk over the tree for regular solving */ for (a=0; a<tree->totchannel; a++) { if (!(tree->pchan[a]->flag & POSE_DONE)) // successive trees can set the flag - where_is_pose_bone(scene, ob, tree->pchan[a], ctime, 1); - // tell blender that this channel was controlled by IK, it's cleared on each where_is_pose() + BKE_pose_where_is_bone(scene, ob, tree->pchan[a], ctime, 1); + // tell blender that this channel was controlled by IK, it's cleared on each BKE_pose_where_is() tree->pchan[a]->flag |= POSE_CHAIN; } /* 5. execute the IK solver */ diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index 2e437c627a2..d94529b6104 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -418,7 +418,7 @@ static IK_Data* get_ikdata(bPose *pose) // here init ikdata if needed // now that we have scene, make sure the default param are initialized if (!DefIKParam.iksolver) - init_pose_itasc(&DefIKParam); + BKE_pose_itasc_init(&DefIKParam); return (IK_Data*)pose->ikdata; } @@ -1023,7 +1023,7 @@ static void convert_pose(IK_Scene *ikscene) } // compute array of joint value corresponding to current pose -static void rest_pose(IK_Scene *ikscene) +static void BKE_pose_rest(IK_Scene *ikscene) { bPoseChannel *pchan; IK_Channel *ikchan; @@ -1133,7 +1133,7 @@ static IK_Scene* convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan) } else { // in Blender, the rest pose is always 0 for joints - rest_pose(ikscene); + BKE_pose_rest(ikscene); } rot = &ikscene->jointArray(0); for (a=0, ikchan = ikscene->channels; a<tree->totchannel; ++a, ++ikchan) { @@ -1545,7 +1545,7 @@ static void execute_scene(Scene* blscene, IK_Scene* ikscene, bItasc* ikparam, fl if (ikparam->flag & ITASC_SIMULATION) { for (i=0, ikchan=ikscene->channels; i<ikscene->numchan; i++, ++ikchan) { // In simulation mode we don't allow external contraint to change our bones, mark the channel done - // also tell Blender that this channel is part of IK tree (cleared on each where_is_pose() + // also tell Blender that this channel is part of IK tree (cleared on each BKE_pose_where_is() ikchan->pchan->flag |= (POSE_DONE|POSE_CHAIN); ikchan->jointValid = 0; } @@ -1554,8 +1554,8 @@ static void execute_scene(Scene* blscene, IK_Scene* ikscene, bItasc* ikparam, fl // in animation mode, we must get the bone position from action and constraints for (i=0, ikchan=ikscene->channels; i<ikscene->numchan; i++, ++ikchan) { if (!(ikchan->pchan->flag & POSE_DONE)) - where_is_pose_bone(blscene, ikscene->blArmature, ikchan->pchan, ctime, 1); - // tell blender that this channel was controlled by IK, it's cleared on each where_is_pose() + BKE_pose_where_is_bone(blscene, ikscene->blArmature, ikchan->pchan, ctime, 1); + // tell blender that this channel was controlled by IK, it's cleared on each BKE_pose_where_is() ikchan->pchan->flag |= (POSE_DONE|POSE_CHAIN); ikchan->jointValid = 0; } diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 43474d72de9..30b3e75255d 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -335,7 +335,7 @@ typedef struct bPose { float ctime; /* local action time of this pose */ float stride_offset[3]; /* applied to object */ - float cyclic_offset[3]; /* result of match and cycles, applied in where_is_pose() */ + float cyclic_offset[3]; /* result of match and cycles, applied in BKE_pose_where_is() */ ListBase agroups; /* list of bActionGroups */ @@ -352,7 +352,7 @@ typedef struct bPose { /* Pose->flag */ typedef enum ePose_Flags { - /* results in armature_rebuild_pose being called */ + /* results in BKE_pose_rebuild being called */ POSE_RECALC = (1<<0), /* prevents any channel from getting overridden by anim from IPO */ POSE_LOCKED = (1<<1), @@ -362,7 +362,7 @@ typedef enum ePose_Flags { POSE_CONSTRAINTS_TIMEDEPEND = (1<<3), /* recalculate bone paths */ POSE_RECALCPATHS = (1<<4), - /* set by armature_rebuild_pose to give a chance to the IK solver to rebuild IK tree */ + /* set by BKE_pose_rebuild to give a chance to the IK solver to rebuild IK tree */ POSE_WAS_REBUILT = (1<<5), /* set by game_copy_pose to indicate that this pose is used in the game engine */ POSE_GAME_ENGINE = (1<<6) diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index c9d80476fde..a50cd16e351 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -190,7 +190,7 @@ typedef struct Curve { short type; /* creation-time type of curve datablock */ - short texflag; /* keep a short because of give_obdata_texspace() */ + short texflag; /* keep a short because of BKE_object_obdata_texspace_get() */ short drawflag, twist_mode; float twist_smooth, smallcaps_scale; diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index 58ffcf6480e..f5d525d47b5 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -236,7 +236,7 @@ typedef struct ParticleSettings { typedef struct ParticleSystem { /* note1: make sure all (runtime) are NULL's in 'copy_particlesystem' XXX, this function is no more! - need to invstigate */ - /* note2: make sure any uses of this struct in DNA are accounted for in 'copy_object_particlesystems' */ + /* note2: make sure any uses of this struct in DNA are accounted for in 'BKE_object_copy_particlesystems' */ struct ParticleSystem *next, *prev; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 81cc4f13372..a40b07a8d01 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1119,7 +1119,7 @@ typedef struct Scene { /* Movie Tracking */ struct MovieClip *clip; /* active movie clip */ - uint64_t customdata_mask; /* XXX. runtime flag for drawing, actually belongs in the window, only used by object_handle_update() */ + uint64_t customdata_mask; /* XXX. runtime flag for drawing, actually belongs in the window, only used by BKE_object_handle_update() */ uint64_t customdata_mask_modal; /* XXX. same as above but for temp operator use (gl renders) */ } Scene; @@ -1398,7 +1398,7 @@ typedef struct Scene { #define SCE_FRAME_DROP (1<<3) - /* return flag next_object function */ + /* return flag BKE_scene_base_iter_next function */ #define F_ERROR -1 #define F_START 0 #define F_SCENE 1 diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index c3beffbe223..47b25720373 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -147,49 +147,49 @@ typedef enum PropertyFlag { /* editable means the property is editable in the user * interface, properties are editable by default except * for pointers and collections. */ - PROP_EDITABLE = 1<<0, + PROP_EDITABLE = (1<<0), /* this property is editable even if it is lib linked, * meaning it will get lost on reload, but it's useful * for editing. */ - PROP_LIB_EXCEPTION = 1<<16, + PROP_LIB_EXCEPTION = (1<<16), /* animatable means the property can be driven by some * other input, be it animation curves, expressions, .. * properties are animatable by default except for pointers * and collections */ - PROP_ANIMATABLE = 1<<1, + PROP_ANIMATABLE = (1<<1), /* icon */ - PROP_ICONS_CONSECUTIVE = 1<<12, + PROP_ICONS_CONSECUTIVE = (1<<12), /* hidden in the user interface */ - PROP_HIDDEN = 1<<19, + PROP_HIDDEN = (1<<19), /* do not write in presets */ - PROP_SKIP_SAVE = 1<<28, + PROP_SKIP_SAVE = (1<<28), /* function paramater flags */ - PROP_REQUIRED = 1<<2, - PROP_OUTPUT = 1<<3, - PROP_RNAPTR = 1<<11, + PROP_REQUIRED = (1<<2), + PROP_OUTPUT = (1<<3), + PROP_RNAPTR = (1<<11), /* registering */ - PROP_REGISTER = 1<<4, + PROP_REGISTER = (1<<4), PROP_REGISTER_OPTIONAL = (1<<4)|(1<<5), /* pointers */ - PROP_ID_REFCOUNT = 1<<6, + PROP_ID_REFCOUNT = (1<<6), /* disallow assigning a variable to its self, eg an object tracking its self * only apply this to types that are derived from an ID ()*/ - PROP_ID_SELF_CHECK = 1<<20, + PROP_ID_SELF_CHECK = (1<<20), /* use for... * - pointers: in the UI and python so unsetting or setting to None won't work * - strings: so our internal generated get/length/set functions know to do NULL checks before access [#30865] */ - PROP_NEVER_NULL = 1<<18, + PROP_NEVER_NULL = (1<<18), /* currently only used for UI, this is similar to PROP_NEVER_NULL * except that the value may be NULL at times, used for ObData, where an Empty's will be NULL * but setting NULL on a mesh object is not possible. So, if its not NULL, setting NULL cant be done! */ - PROP_NEVER_UNLINK = 1<<25, + PROP_NEVER_UNLINK = (1<<25), /* flag contains multiple enums. * note: not to be confused with prop->enumbitflags @@ -197,32 +197,32 @@ typedef enum PropertyFlag { * * note: these can't be animated so use with care. */ - PROP_ENUM_FLAG = 1<<21, + PROP_ENUM_FLAG = (1<<21), /* need context for update function */ - PROP_CONTEXT_UPDATE = 1<<22, + PROP_CONTEXT_UPDATE = (1<<22), PROP_CONTEXT_PROPERTY_UPDATE = (1<<22)|(1<<27), /* Use for arrays or for any data that should not have a referene kept * most common case is functions that return arrays where the array */ - PROP_THICK_WRAP = 1<<23, + PROP_THICK_WRAP = (1<<23), /* Reject values outside limits, use for python api only so far * this is for use when silently clamping string length will give * bad behavior later. Could also enforce this for INT's and other types. * note: currently no support for function arguments or non utf8 paths (filepaths) */ - PROP_NEVER_CLAMP = 1<<26, + PROP_NEVER_CLAMP = (1<<26), /* internal flags */ - PROP_BUILTIN = 1<<7, - PROP_EXPORT = 1<<8, - PROP_RUNTIME = 1<<9, - PROP_IDPROPERTY = 1<<10, - PROP_RAW_ACCESS = 1<<13, - PROP_RAW_ARRAY = 1<<14, - PROP_FREE_POINTERS = 1<<15, - PROP_DYNAMIC = 1<<17, /* for dynamic arrays, and retvals of type string */ - PROP_ENUM_NO_CONTEXT = 1<<24 /* for enum that shouldn't be contextual */ + PROP_BUILTIN = (1<<7), + PROP_EXPORT = (1<<8), + PROP_RUNTIME = (1<<9), + PROP_IDPROPERTY = (1<<10), + PROP_RAW_ACCESS = (1<<13), + PROP_RAW_ARRAY = (1<<14), + PROP_FREE_POINTERS = (1<<15), + PROP_DYNAMIC = (1<<17), /* for dynamic arrays, and retvals of type string */ + PROP_ENUM_NO_CONTEXT = (1<<24) /* for enum that shouldn't be contextual */ } PropertyFlag; typedef struct CollectionPropertyIterator { diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 6992d992cca..74a55b97e1b 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -269,7 +269,7 @@ static void rna_ID_update_tag(ID *id, ReportList *reports, int flag) if (ob->type == OB_FONT) { Curve *cu = ob->data; freedisplist(&cu->disp); - BKE_text_to_curve(sce, ob, CU_LEFT); + BKE_vfont_to_curve(sce, ob, CU_LEFT); } #endif diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 94ea79099c2..7f52456355c 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -201,7 +201,7 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain, ReportList *reports, v } /* check if we have registered this info before, and remove it */ - ksi = ANIM_keyingset_info_find_named(dummyksi.idname); + ksi = ANIM_keyingset_info_find_name(dummyksi.idname); if (ksi && ksi->ext.srna) rna_KeyingSetInfo_unregister(bmain, ksi->ext.srna); @@ -337,7 +337,7 @@ static PointerRNA rna_KeyingSet_typeinfo_get(PointerRNA *ptr) /* keying set info is only for builtin Keying Sets */ if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) - ksi = ANIM_keyingset_info_find_named(ks->typeinfo); + ksi = ANIM_keyingset_info_find_name(ks->typeinfo); return rna_pointer_inherit_refine(ptr, &RNA_KeyingSetInfo, ksi); } @@ -837,7 +837,7 @@ void rna_def_animdata(BlenderRNA *brna) /* Active Action */ prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); /* this flag as well as the dynamic test must be defined for this to be editable... */ - RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_REFCOUNT); RNA_def_property_pointer_funcs(prop, NULL, "rna_AnimData_action_set", NULL, "rna_Action_id_poll"); RNA_def_property_editable_func(prop, "rna_AnimData_action_editable"); RNA_def_property_ui_text(prop, "Action", "Active Action for this datablock"); diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index bdff545df5c..ee4b34508d1 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -288,7 +288,7 @@ static void rna_Brush_set_size(PointerRNA *ptr, int value) Brush* brush = ptr->data; /* scale unprojected radius so it stays consistent with brush size */ - brush_scale_unprojected_radius(&brush->unprojected_radius, + BKE_brush_scale_unprojected_radius(&brush->unprojected_radius, value, brush->size); brush->size = value; } @@ -298,7 +298,7 @@ static void rna_Brush_set_unprojected_radius(PointerRNA *ptr, float value) Brush* brush = ptr->data; /* scale brush size so it stays consistent with unprojected_radius */ - brush_scale_size(&brush->size, value, brush->unprojected_radius); + BKE_brush_scale_size(&brush->size, value, brush->unprojected_radius); brush->unprojected_radius = value; } diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 180479d6f63..0da971d01a0 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -46,14 +46,14 @@ static float rna_Camera_angle_get(PointerRNA *ptr) { Camera *cam = ptr->id.data; - float sensor = camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y); + float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y); return focallength_to_fov(cam->lens, sensor); } static void rna_Camera_angle_set(PointerRNA *ptr, float value) { Camera *cam = ptr->id.data; - float sensor = camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y); + float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y); cam->lens = fov_to_focallength(value, sensor); } diff --git a/source/blender/makesrna/intern/rna_camera_api.c b/source/blender/makesrna/intern/rna_camera_api.c index 14391e74239..2d19047ef89 100644 --- a/source/blender/makesrna/intern/rna_camera_api.c +++ b/source/blender/makesrna/intern/rna_camera_api.c @@ -46,7 +46,7 @@ void rna_camera_view_frame(struct Camera *camera, struct Scene *scene, { float vec[4][3]; - camera_view_frame(scene, camera, vec); + BKE_camera_view_frame(scene, camera, vec); copy_v3_v3(vec1_r, vec[0]); copy_v3_v3(vec2_r, vec[1]); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index e321e83dd61..b812c574a01 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -562,7 +562,7 @@ static void rna_def_constraint_python(BlenderRNA *brna) prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE); RNA_def_property_ui_text(prop, "Script", "The text object that contains the Python script"); - RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_REFCOUNT); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop = RNA_def_property(srna, "use_targets", PROP_BOOLEAN, PROP_NONE); @@ -1097,7 +1097,7 @@ static void rna_def_constraint_action(BlenderRNA *brna) prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "act"); RNA_def_property_ui_text(prop, "Action", "The constraining action"); - RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_REFCOUNT); RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update"); prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME); diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index f7e7435598b..7052bfa8225 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -134,7 +134,7 @@ static void rna_ImageUser_update(Main *UNUSED(bmain), Scene *scene, PointerRNA * { ImageUser *iuser = ptr->data; - BKE_image_user_calc_frame(iuser, scene->r.cfra, 0); + BKE_image_user_frame_calc(iuser, scene->r.cfra, 0); } diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index ff717635250..84321809ae9 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -85,7 +85,7 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports const float dither_back = ibuf->dither; ibuf->planes = scene->r.im_format.planes; ibuf->dither = scene->r.dither_intensity; - if (!BKE_write_ibuf(ibuf, path, &scene->r.im_format)) { + if (!BKE_imbuf_write(ibuf, path, &scene->r.im_format)) { BKE_reportf(reports, RPT_ERROR, "Couldn't write image: %s", path); } ibuf->planes = imb_planes_back; diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c index 5d8d8c7bd02..d919406a14d 100644 --- a/source/blender/makesrna/intern/rna_lattice.c +++ b/source/blender/makesrna/intern/rna_lattice.c @@ -109,21 +109,21 @@ static void rna_Lattice_update_size(Main *bmain, Scene *scene, PointerRNA *ptr) newv = (lt->opntsv > 0)? lt->opntsv: lt->pntsv; neww = (lt->opntsw > 0)? lt->opntsw: lt->pntsw; - /* resizelattice needs an object, any object will have the same result */ + /* BKE_lattice_resize needs an object, any object will have the same result */ for (ob = bmain->object.first; ob; ob = ob->id.next) { if (ob->data == lt) { - resizelattice(lt, newu, newv, neww, ob); + BKE_lattice_resize(lt, newu, newv, neww, ob); if (lt->editlatt) - resizelattice(lt->editlatt->latt, newu, newv, neww, ob); + BKE_lattice_resize(lt->editlatt->latt, newu, newv, neww, ob); break; } } /* otherwise without, means old points are not repositioned */ if (!ob) { - resizelattice(lt, newu, newv, neww, NULL); + BKE_lattice_resize(lt, newu, newv, neww, NULL); if (lt->editlatt) - resizelattice(lt->editlatt->latt, newu, newv, neww, NULL); + BKE_lattice_resize(lt->editlatt->latt, newu, newv, neww, NULL); } rna_Lattice_update_data(bmain, scene, ptr); diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 63006af7c72..0451d7c239c 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -92,14 +92,14 @@ Camera *rna_Main_cameras_new(Main *UNUSED(bmain), const char *name) { - ID *id = add_camera(name); + ID *id = BKE_camera_add(name); id_us_min(id); return (Camera *)id; } void rna_Main_cameras_remove(Main *bmain, ReportList *reports, struct Camera *camera) { if (ID_REAL_USERS(camera) <= 0) - free_libblock(&bmain->camera, camera); + BKE_libblock_free(&bmain->camera, camera); else BKE_reportf(reports, RPT_ERROR, "Camera \"%s\" must have zero users to be removed, found %d", camera->id.name+2, ID_REAL_USERS(camera)); @@ -109,11 +109,11 @@ void rna_Main_cameras_remove(Main *bmain, ReportList *reports, struct Camera *ca Scene *rna_Main_scenes_new(Main *UNUSED(bmain), const char *name) { - return add_scene(name); + return BKE_scene_add(name); } void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, struct Scene *scene) { - /* don't call free_libblock(...) directly */ + /* don't call BKE_libblock_free(...) directly */ Scene *newscene; if (scene->id.prev) @@ -128,7 +128,7 @@ void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, struc if (CTX_wm_screen(C)->scene == scene) ED_screen_set_scene(C, CTX_wm_screen(C), newscene); - unlink_scene(bmain, scene, newscene); + BKE_scene_unlink(bmain, scene, newscene); } Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, const char *name, ID *data) @@ -175,7 +175,7 @@ Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, const cha id_us_plus(data); } - ob = add_only_object(type, name); + ob = BKE_object_add_only_object(type, name); id_us_min(&ob->id); ob->data = data; @@ -187,8 +187,8 @@ Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, const cha void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Object *object) { if (ID_REAL_USERS(object) <= 0) { - unlink_object(object); /* needed or ID pointers to this are not cleared */ - free_libblock(&bmain->object, object); + BKE_object_unlink(object); /* needed or ID pointers to this are not cleared */ + BKE_libblock_free(&bmain->object, object); } else { BKE_reportf(reports, RPT_ERROR, "Object \"%s\" must have zero users to be removed, found %d", @@ -198,14 +198,14 @@ void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Object *ob struct Material *rna_Main_materials_new(Main *UNUSED(bmain), const char *name) { - ID *id = (ID *)add_material(name); + ID *id = (ID *)BKE_material_add(name); id_us_min(id); return (Material *)id; } void rna_Main_materials_remove(Main *bmain, ReportList *reports, struct Material *material) { if (ID_REAL_USERS(material) <= 0) - free_libblock(&bmain->mat, material); + BKE_libblock_free(&bmain->mat, material); else BKE_reportf(reports, RPT_ERROR, "Material \"%s\" must have zero users to be removed, found %d", material->id.name+2, ID_REAL_USERS(material)); @@ -223,7 +223,7 @@ struct bNodeTree *rna_Main_nodetree_new(Main *UNUSED(bmain), const char *name, i void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bNodeTree *tree) { if (ID_REAL_USERS(tree) <= 0) - free_libblock(&bmain->nodetree, tree); + BKE_libblock_free(&bmain->nodetree, tree); else BKE_reportf(reports, RPT_ERROR, "Node Tree \"%s\" must have zero users to be removed, found %d", tree->id.name+2, ID_REAL_USERS(tree)); @@ -233,14 +233,14 @@ void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bNodeTree Mesh *rna_Main_meshes_new(Main *UNUSED(bmain), const char *name) { - Mesh *me = add_mesh(name); + Mesh *me = BKE_mesh_add(name); id_us_min(&me->id); return me; } void rna_Main_meshes_remove(Main *bmain, ReportList *reports, Mesh *mesh) { if (ID_REAL_USERS(mesh) <= 0) - free_libblock(&bmain->mesh, mesh); + BKE_libblock_free(&bmain->mesh, mesh); else BKE_reportf(reports, RPT_ERROR, "Mesh \"%s\" must have zero users to be removed, found %d", mesh->id.name+2, ID_REAL_USERS(mesh)); @@ -250,7 +250,7 @@ void rna_Main_meshes_remove(Main *bmain, ReportList *reports, Mesh *mesh) Lamp *rna_Main_lamps_new(Main *UNUSED(bmain), const char *name, int type) { - Lamp *lamp = add_lamp(name); + Lamp *lamp = BKE_lamp_add(name); lamp->type = type; id_us_min(&lamp->id); return lamp; @@ -258,7 +258,7 @@ Lamp *rna_Main_lamps_new(Main *UNUSED(bmain), const char *name, int type) void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp) { if (ID_REAL_USERS(lamp) <= 0) - free_libblock(&bmain->lamp, lamp); + BKE_libblock_free(&bmain->lamp, lamp); else BKE_reportf(reports, RPT_ERROR, "Lamp \"%s\" must have zero users to be removed, found %d", lamp->id.name+2, ID_REAL_USERS(lamp)); @@ -269,7 +269,7 @@ void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp) Image *rna_Main_images_new(Main *UNUSED(bmain), const char *name, int width, int height, int alpha, int float_buffer) { float color[4] = {0.0, 0.0, 0.0, 1.0}; - Image *image = BKE_add_image_size(width, height, name, alpha ? 32:24, float_buffer, 0, color); + Image *image = BKE_image_add_generated(width, height, name, alpha ? 32:24, float_buffer, 0, color); id_us_min(&image->id); return image; } @@ -278,7 +278,7 @@ Image *rna_Main_images_load(Main *UNUSED(bmain), ReportList *reports, const char Image *ima; errno = 0; - ima = BKE_add_image_file(filepath); + ima = BKE_image_load(filepath); if (!ima) BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath, @@ -289,7 +289,7 @@ Image *rna_Main_images_load(Main *UNUSED(bmain), ReportList *reports, const char void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *image) { if (ID_REAL_USERS(image) <= 0) - free_libblock(&bmain->image, image); + BKE_libblock_free(&bmain->image, image); else BKE_reportf(reports, RPT_ERROR, "Image \"%s\" must have zero users to be removed, found %d", image->id.name+2, ID_REAL_USERS(image)); @@ -299,14 +299,14 @@ void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *image) Lattice *rna_Main_lattices_new(Main *UNUSED(bmain), const char *name) { - Lattice *lt = add_lattice(name); + Lattice *lt = BKE_lattice_add(name); id_us_min(<->id); return lt; } void rna_Main_lattices_remove(Main *bmain, ReportList *reports, struct Lattice *lt) { if (ID_REAL_USERS(lt) <= 0) - free_libblock(&bmain->latt, lt); + BKE_libblock_free(&bmain->latt, lt); else BKE_reportf(reports, RPT_ERROR, "Lattice \"%s\" must have zero users to be removed, found %d", lt->id.name+2, ID_REAL_USERS(lt)); @@ -321,7 +321,7 @@ Curve *rna_Main_curves_new(Main *UNUSED(bmain), const char *name, int type) void rna_Main_curves_remove(Main *bmain, ReportList *reports, struct Curve *cu) { if (ID_REAL_USERS(cu) <= 0) - free_libblock(&bmain->curve, cu); + BKE_libblock_free(&bmain->curve, cu); else BKE_reportf(reports, RPT_ERROR, "Curve \"%s\" must have zero users to be removed, found %d", cu->id.name+2, ID_REAL_USERS(cu)); @@ -336,7 +336,7 @@ MetaBall *rna_Main_metaballs_new(Main *UNUSED(bmain), const char *name) void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall *mb) { if (ID_REAL_USERS(mb) <= 0) - free_libblock(&bmain->mball, mb); + BKE_libblock_free(&bmain->mball, mb); else BKE_reportf(reports, RPT_ERROR, "Metaball \"%s\" must have zero users to be removed, found %d", mb->id.name+2, ID_REAL_USERS(mb)); @@ -347,7 +347,7 @@ VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepat VFont *font; errno = 0; - font = load_vfont(bmain, filepath); + font = BKE_vfont_load(bmain, filepath); if (!font) BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath, @@ -359,7 +359,7 @@ VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepat void rna_Main_fonts_remove(Main *bmain, ReportList *reports, VFont *vfont) { if (ID_REAL_USERS(vfont) <= 0) - free_libblock(&bmain->vfont, vfont); + BKE_libblock_free(&bmain->vfont, vfont); else BKE_reportf(reports, RPT_ERROR, "Font \"%s\" must have zero users to be removed, found %d", vfont->id.name+2, ID_REAL_USERS(vfont)); @@ -377,7 +377,7 @@ Tex *rna_Main_textures_new(Main *UNUSED(bmain), const char *name, int type) void rna_Main_textures_remove(Main *bmain, ReportList *reports, struct Tex *tex) { if (ID_REAL_USERS(tex) <= 0) - free_libblock(&bmain->tex, tex); + BKE_libblock_free(&bmain->tex, tex); else BKE_reportf(reports, RPT_ERROR, "Texture \"%s\" must have zero users to be removed, found %d", tex->id.name+2, ID_REAL_USERS(tex)); @@ -385,14 +385,14 @@ void rna_Main_textures_remove(Main *bmain, ReportList *reports, struct Tex *tex) Brush *rna_Main_brushes_new(Main *UNUSED(bmain), const char *name) { - Brush *brush = add_brush(name); + Brush *brush = BKE_brush_add(name); id_us_min(&brush->id); return brush; } void rna_Main_brushes_remove(Main *bmain, ReportList *reports, struct Brush *brush) { if (ID_REAL_USERS(brush) <= 0) - free_libblock(&bmain->brush, brush); + BKE_libblock_free(&bmain->brush, brush); else BKE_reportf(reports, RPT_ERROR, "Brush \"%s\" must have zero users to be removed, found %d", brush->id.name+2, ID_REAL_USERS(brush)); @@ -407,7 +407,7 @@ World *rna_Main_worlds_new(Main *UNUSED(bmain), const char *name) void rna_Main_worlds_remove(Main *bmain, ReportList *reports, struct World *world) { if (ID_REAL_USERS(world) <= 0) - free_libblock(&bmain->world, world); + BKE_libblock_free(&bmain->world, world); else BKE_reportf(reports, RPT_ERROR, "World \"%s\" must have zero users to be removed, found %d", world->id.name+2, ID_REAL_USERS(world)); @@ -419,21 +419,21 @@ Group *rna_Main_groups_new(Main *UNUSED(bmain), const char *name) } void rna_Main_groups_remove(Main *bmain, Group *group) { - unlink_group(group); - free_libblock(&bmain->group, group); + BKE_group_unlink(group); + BKE_libblock_free(&bmain->group, group); /* XXX python now has invalid pointer? */ } Speaker *rna_Main_speakers_new(Main *UNUSED(bmain), const char *name) { - Speaker *speaker = add_speaker(name); + Speaker *speaker = BKE_speaker_add(name); id_us_min(&speaker->id); return speaker; } void rna_Main_speakers_remove(Main *bmain, ReportList *reports, Speaker *speaker) { if (ID_REAL_USERS(speaker) <= 0) - free_libblock(&bmain->speaker, speaker); + BKE_libblock_free(&bmain->speaker, speaker); else BKE_reportf(reports, RPT_ERROR, "Speaker \"%s\" must have zero users to be removed, found %d", speaker->id.name+2, ID_REAL_USERS(speaker)); @@ -443,12 +443,12 @@ void rna_Main_speakers_remove(Main *bmain, ReportList *reports, Speaker *speaker Text *rna_Main_texts_new(Main *UNUSED(bmain), const char *name) { - return add_empty_text(name); + return BKE_text_add(name); } void rna_Main_texts_remove(Main *bmain, Text *text) { - unlink_text(bmain, text); - free_libblock(&bmain->text, text); + BKE_text_unlink(bmain, text); + BKE_libblock_free(&bmain->text, text); /* XXX python now has invalid pointer? */ } @@ -457,7 +457,7 @@ Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath Text *txt; errno = 0; - txt = add_text(filepath, bmain->name); + txt = BKE_text_load(filepath, bmain->name); if (!txt) BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath, @@ -468,14 +468,14 @@ Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath bArmature *rna_Main_armatures_new(Main *UNUSED(bmain), const char *name) { - bArmature *arm = add_armature(name); + bArmature *arm = BKE_armature_add(name); id_us_min(&arm->id); return arm; } void rna_Main_armatures_remove(Main *bmain, ReportList *reports, bArmature *arm) { if (ID_REAL_USERS(arm) <= 0) - free_libblock(&bmain->armature, arm); + BKE_libblock_free(&bmain->armature, arm); else BKE_reportf(reports, RPT_ERROR, "Armature \"%s\" must have zero users to be removed, found %d", arm->id.name+2, ID_REAL_USERS(arm)); @@ -493,7 +493,7 @@ bAction *rna_Main_actions_new(Main *UNUSED(bmain), const char *name) void rna_Main_actions_remove(Main *bmain, ReportList *reports, bAction *act) { if (ID_REAL_USERS(act) <= 0) - free_libblock(&bmain->action, act); + BKE_libblock_free(&bmain->action, act); else BKE_reportf(reports, RPT_ERROR, "Action \"%s\" must have zero users to be removed, found %d", act->id.name+2, ID_REAL_USERS(act)); @@ -510,7 +510,7 @@ ParticleSettings *rna_Main_particles_new(Main *bmain, const char *name) void rna_Main_particles_remove(Main *bmain, ReportList *reports, ParticleSettings *part) { if (ID_REAL_USERS(part) <= 0) - free_libblock(&bmain->particle, part); + BKE_libblock_free(&bmain->particle, part); else BKE_reportf(reports, RPT_ERROR, "Particle Settings \"%s\" must have zero users to be removed, found %d", part->id.name+2, ID_REAL_USERS(part)); @@ -535,7 +535,7 @@ MovieClip *rna_Main_movieclip_load(Main *UNUSED(bmain), ReportList *reports, con void rna_Main_movieclips_remove(Main *bmain, MovieClip *clip) { BKE_movieclip_unlink(bmain, clip); - free_libblock(&bmain->movieclip, clip); + BKE_libblock_free(&bmain->movieclip, clip); /* XXX python now has invalid pointer? */ } diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index 8d262c58f9b..7ad13b8a6d1 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -459,7 +459,7 @@ static void rna_def_nlastrip(BlenderRNA *brna) prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "act"); RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Action_id_poll"); - RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_REFCOUNT); RNA_def_property_editable_func(prop, "rna_NlaStrip_action_editable"); RNA_def_property_ui_text(prop, "Action", "Action referenced by this strip"); RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */ diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 6a4809e54e5..38f0b7e26cb 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -164,7 +164,7 @@ static void rna_Object_internal_update(Main *UNUSED(bmain), Scene *UNUSED(scene) static void rna_Object_matrix_world_update(Main *bmain, Scene *scene, PointerRNA *ptr) { /* don't use compat so we get predictable rotation */ - object_apply_mat4(ptr->id.data, ((Object *)ptr->id.data)->obmat, FALSE, TRUE); + BKE_object_apply_mat4(ptr->id.data, ((Object *)ptr->id.data)->obmat, FALSE, TRUE); rna_Object_internal_update(bmain, scene, ptr); } @@ -199,19 +199,19 @@ static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16]) } /* don't use compat so we get predictable rotation */ - object_apply_mat4(ob, ob->obmat, FALSE, FALSE); + BKE_object_apply_mat4(ob, ob->obmat, FALSE, FALSE); } static void rna_Object_matrix_basis_get(PointerRNA *ptr, float values[16]) { Object *ob = ptr->id.data; - object_to_mat4(ob, (float(*)[4])values); + BKE_object_to_mat4(ob, (float(*)[4])values); } static void rna_Object_matrix_basis_set(PointerRNA *ptr, const float values[16]) { Object *ob = ptr->id.data; - object_apply_mat4(ob, (float(*)[4])values, FALSE, FALSE); + BKE_object_apply_mat4(ob, (float(*)[4])values, FALSE, FALSE); } void rna_Object_internal_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -263,7 +263,7 @@ static void rna_Object_select_update(Main *UNUSED(bmain), Scene *scene, PointerR if (scene) { Object *ob = (Object*)ptr->id.data; short mode = ob->flag & SELECT ? BA_SELECT : BA_DESELECT; - ED_base_object_select(object_in_scene(ob, scene), mode); + ED_base_object_select(BKE_scene_base_find(scene, ob), mode); } } @@ -298,7 +298,7 @@ static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) Object *ob = (Object*)ptr->id.data; Base *base; - base = scene ? object_in_scene(ob, scene) : NULL; + base = scene ? BKE_scene_base_find(scene, ob) : NULL; if (!base) return; @@ -355,7 +355,7 @@ static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value) if (GS(id->name) == ID_CU) BKE_curve_type_test(ob); else if (ob->type == OB_ARMATURE) - armature_rebuild_pose(ob, ob->data); + BKE_pose_rebuild(ob, ob->data); } } @@ -708,13 +708,13 @@ static void rna_Object_rotation_mode_set(PointerRNA *ptr, int value) static void rna_Object_dimensions_get(PointerRNA *ptr, float *value) { Object *ob = ptr->data; - object_get_dimensions(ob, value); + BKE_object_dimensions_get(ob, value); } static void rna_Object_dimensions_set(PointerRNA *ptr, const float *value) { Object *ob = ptr->data; - object_set_dimensions(ob, value); + BKE_object_dimensions_set(ob, value); } static int rna_Object_location_editable(PointerRNA *ptr, int index) @@ -1202,7 +1202,7 @@ static void rna_Object_modifier_clear(Object *object, bContext *C) static void rna_Object_boundbox_get(PointerRNA *ptr, float *values) { Object *ob = (Object*)ptr->id.data; - BoundBox *bb = object_get_boundbox(ob); + BoundBox *bb = BKE_object_boundbox_get(ob); if (bb) { memcpy(values, bb->vec, sizeof(bb->vec)); } diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index cb0f1d307aa..e95e49e8150 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -87,13 +87,13 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_ case OB_SURF: /* copies object and modifiers (but not the data) */ - tmpobj = copy_object(ob); + tmpobj = BKE_object_copy(ob); tmpcu = (Curve *)tmpobj->data; tmpcu->id.us--; /* if getting the original caged mesh, delete object modifiers */ if ( cage ) - object_free_modifiers(tmpobj); + BKE_object_free_modifiers(tmpobj); /* copies the data */ copycu = tmpobj->data = BKE_curve_copy((Curve *) ob->data ); @@ -114,12 +114,12 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_ /* nurbs_to_mesh changes the type to a mesh, check it worked */ if (tmpobj->type != OB_MESH) { - free_libblock_us(&(G.main->object), tmpobj); + BKE_libblock_free_us(&(G.main->object), tmpobj); BKE_report(reports, RPT_ERROR, "cant convert curve to mesh. Does the curve have any segments?"); return NULL; } tmpmesh = tmpobj->data; - free_libblock_us(&G.main->object, tmpobj); + BKE_libblock_free_us(&G.main->object, tmpobj); break; case OB_MBALL: { @@ -131,7 +131,7 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_ if (ob != basis_ob) return NULL; /* only do basis metaball */ - tmpmesh = add_mesh("Mesh"); + tmpmesh = BKE_mesh_add("Mesh"); if (render) { ListBase disp = {NULL, NULL}; @@ -148,7 +148,7 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_ /* copies object and modifiers (but not the data) */ if (cage) { /* copies the data */ - tmpmesh = copy_mesh( ob->data ); + tmpmesh = BKE_mesh_copy( ob->data ); /* if not getting the original caged mesh, get final derived mesh */ } else { @@ -164,7 +164,7 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_ else dm = mesh_create_derived_view(sce, ob, mask); - tmpmesh = add_mesh("Mesh"); + tmpmesh = BKE_mesh_add("Mesh"); DM_to_mesh(dm, tmpmesh, ob); dm->release(dm); } @@ -328,7 +328,7 @@ static PointerRNA rna_Object_shape_key_add(Object *ob, bContext *C, ReportList * Scene *scene = CTX_data_scene(C); KeyBlock *kb = NULL; - if ((kb = object_insert_shape_key(scene, ob, name, from_mix))) { + if ((kb = BKE_object_insert_shape_key(scene, ob, name, from_mix))) { PointerRNA keyptr; RNA_pointer_create((ID *)ob->data, &RNA_ShapeKey, kb, &keyptr); @@ -473,12 +473,12 @@ void rna_ObjectBase_layers_from_view(Base *base, View3D *v3d) int rna_Object_is_modified(Object *ob, Scene *scene, int settings) { - return object_is_modified(scene, ob) & settings; + return BKE_object_is_modified(scene, ob) & settings; } int rna_Object_is_deform_modified(Object *ob, Scene *scene, int settings) { - return object_is_deform_modified(scene, ob) & settings; + return BKE_object_is_deform_modified(scene, ob) & settings; } #ifndef NDEBUG diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index ceace424f35..c87dabf46ca 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -173,7 +173,7 @@ static void rna_Pose_ik_solver_set(struct PointerRNA *ptr, int value) pose->ikparam = NULL; } pose->iksolver = value; - init_pose_ikparam(pose); + BKE_pose_ikparam_init(pose); } } @@ -185,7 +185,7 @@ static void rna_Pose_ik_solver_update(Main *bmain, Scene *scene, PointerRNA *ptr pose->flag |= POSE_RECALC; /* checks & sorts pose channels */ DAG_scene_sort(bmain, scene); - update_pose_constraint_flags(pose); + BKE_pose_update_constraint_flags(pose); object_test_constraints(ob); @@ -586,7 +586,7 @@ static int rna_PoseChannel_rotation_4d_editable(PointerRNA *ptr, int index) int rna_PoseBones_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) { bPose *pose = (bPose*)ptr->data; - bPoseChannel *pchan = get_pose_channel(pose, key); + bPoseChannel *pchan = BKE_pose_channel_find_name(pose, key); if (pchan) { RNA_pointer_create(ptr->id.data, &RNA_PoseBone, pchan, r_ptr); return TRUE; @@ -599,13 +599,13 @@ int rna_PoseBones_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ static void rna_PoseChannel_matrix_basis_get(PointerRNA *ptr, float *values) { bPoseChannel *pchan = (bPoseChannel*)ptr->data; - pchan_to_mat4(pchan, (float (*)[4])values); + BKE_pchan_to_mat4(pchan, (float (*)[4])values); } static void rna_PoseChannel_matrix_basis_set(PointerRNA *ptr, const float *values) { bPoseChannel *pchan = (bPoseChannel*)ptr->data; - pchan_apply_mat4(pchan, (float (*)[4])values, FALSE); /* no compat for predictable result */ + BKE_pchan_apply_mat4(pchan, (float (*)[4])values, FALSE); /* no compat for predictable result */ } static void rna_PoseChannel_matrix_set(PointerRNA *ptr, const float *values) @@ -614,9 +614,9 @@ static void rna_PoseChannel_matrix_set(PointerRNA *ptr, const float *values) Object *ob = (Object*)ptr->id.data; float tmat[4][4]; - armature_mat_pose_to_bone_ex(ob, pchan, (float (*)[4])values, tmat); + BKE_armature_mat_pose_to_bone_ex(ob, pchan, (float (*)[4])values, tmat); - pchan_apply_mat4(pchan, tmat, FALSE); /* no compat for predictable result */ + BKE_pchan_apply_mat4(pchan, tmat, FALSE); /* no compat for predictable result */ } #else diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index eb3c1c75cf4..9a273d90f14 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -330,15 +330,15 @@ static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *report Scene *scene_act = CTX_data_scene(C); Base *base; - if (object_in_scene(ob, scene)) { + if (BKE_scene_base_find(scene, ob)) { BKE_reportf(reports, RPT_ERROR, "Object \"%s\" is already in scene \"%s\"", ob->id.name+2, scene->id.name+2); return NULL; } - base = scene_add_base(scene, ob); + base = BKE_scene_base_add(scene, ob); id_us_plus(&ob->id); - /* this is similar to what object_add_type and add_object do */ + /* this is similar to what object_add_type and BKE_object_add do */ base->lay = scene->lay; /* when linking to an inactive scene don't touch the layer */ @@ -357,7 +357,7 @@ static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *report static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *ob) { - Base *base = object_in_scene(ob, scene); + Base *base = BKE_scene_base_find(scene, ob); if (!base) { BKE_reportf(reports, RPT_ERROR, "Object '%s' is not in this scene '%s'", ob->id.name+2, scene->id.name+2); return; @@ -401,7 +401,7 @@ static void rna_Scene_active_object_set(PointerRNA *ptr, PointerRNA value) { Scene *scene = (Scene*)ptr->data; if (value.data) - scene->basact = object_in_scene((Object*)value.data, scene); + scene->basact = BKE_scene_base_find(scene, (Object *)value.data); else scene->basact = NULL; } @@ -993,7 +993,7 @@ static void rna_RenderSettings_active_layer_set(PointerRNA *ptr, PointerRNA valu static SceneRenderLayer *rna_RenderLayer_new(ID *id, RenderData *UNUSED(rd), const char *name) { Scene *scene = (Scene *)id; - SceneRenderLayer *srl = scene_add_render_layer(scene, name); + SceneRenderLayer *srl = BKE_scene_add_render_layer(scene, name); WM_main_add_notifier(NC_SCENE|ND_RENDER_OPTIONS, NULL); @@ -1005,7 +1005,7 @@ static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, { Scene *scene = (Scene *)id; - if (!scene_remove_render_layer(bmain, scene, srl)) { + if (!BKE_scene_remove_render_layer(bmain, scene, srl)) { BKE_reportf(reports, RPT_ERROR, "RenderLayer '%s' could not be removed from scene '%s'", srl->name, scene->id.name+2); } @@ -1125,7 +1125,7 @@ static int rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr)) static int rna_RenderSettings_use_shading_nodes_get(PointerRNA *ptr) { Scene *scene = (Scene*)ptr->id.data; - return scene_use_new_shading_nodes(scene); + return BKE_scene_use_new_shading_nodes(scene); } static int rna_RenderSettings_use_game_engine_get(PointerRNA *ptr) @@ -1184,7 +1184,7 @@ static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value ts->selectmode = flag; if (scene->basact) { - Mesh *me = get_mesh(scene->basact->object); + Mesh *me = BKE_mesh_from_object(scene->basact->object); if (me && me->edit_btmesh && me->edit_btmesh->selectmode != flag) { me->edit_btmesh->selectmode = flag; EDBM_selectmode_set(me->edit_btmesh); @@ -1198,7 +1198,7 @@ static void rna_Scene_editmesh_select_mode_update(Main *UNUSED(bmain), Scene *sc Mesh *me = NULL; if (scene->basact) { - me = get_mesh(scene->basact->object); + me = BKE_mesh_from_object(scene->basact->object); if (me && me->edit_btmesh == NULL) me = NULL; } @@ -1370,7 +1370,7 @@ static void rna_UnifiedPaintSettings_size_set(PointerRNA *ptr, int value) UnifiedPaintSettings* ups = ptr->data; /* scale unprojected radius so it stays consistent with brush size */ - brush_scale_unprojected_radius(&ups->unprojected_radius, + BKE_brush_scale_unprojected_radius(&ups->unprojected_radius, value, ups->size); ups->size = value; } @@ -1380,7 +1380,7 @@ static void rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA *ptr, flo UnifiedPaintSettings* ups = ptr->data; /* scale brush size so it stays consistent with unprojected_radius */ - brush_scale_size(&ups->size, value, ups->unprojected_radius); + BKE_brush_scale_size(&ups->size, value, ups->unprojected_radius); ups->unprojected_radius = value; } diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index c92a29cec3c..a5e807a9622 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -56,11 +56,11 @@ void rna_Scene_frame_set(Scene *scene, int frame, float subframe) scene->r.subframe = subframe; CLAMP(scene->r.cfra, MINAFRAME, MAXFRAME); - scene_update_for_newframe(G.main, scene, (1<<20) - 1); - scene_camera_switch_update(scene); + BKE_scene_update_for_newframe(G.main, scene, (1<<20) - 1); + BKE_scene_camera_switch_update(scene); /* cant use NC_SCENE|ND_FRAME because this casues wm_event_do_notifiers to call - * scene_update_for_newframe which will loose any un-keyed changes [#24690] */ + * BKE_scene_update_for_newframe which will loose any un-keyed changes [#24690] */ /* WM_main_add_notifier(NC_SCENE|ND_FRAME, scene); */ /* instead just redraw the views */ @@ -69,7 +69,7 @@ void rna_Scene_frame_set(Scene *scene, int frame, float subframe) static void rna_Scene_update_tagged(Scene *scene) { - scene_update_tagged(G.main, scene); + BKE_scene_update_tagged(G.main, scene); } static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 47bad8f31e5..34c3e328ae5 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -494,7 +494,7 @@ static EnumPropertyItem *rna_SpaceView3D_viewport_shade_itemf(bContext *UNUSED(C RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_SOLID); RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_TEXTURE); - if (scene_use_new_shading_nodes(scene)) + if (BKE_scene_use_new_shading_nodes(scene)) RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_MATERIAL); if (type->view_draw) diff --git a/source/blender/makesrna/intern/rna_text_api.c b/source/blender/makesrna/intern/rna_text_api.c index 3f511858332..338d0c7c52c 100644 --- a/source/blender/makesrna/intern/rna_text_api.c +++ b/source/blender/makesrna/intern/rna_text_api.c @@ -37,13 +37,13 @@ static void rna_Text_clear(Text *text) { - clear_text(text); + BKE_text_clear(text); WM_main_add_notifier(NC_TEXT|NA_EDITED, text); } static void rna_Text_write(Text *text, const char *str) { - write_text(text, str); + BKE_text_write(text, str); WM_main_add_notifier(NC_TEXT|NA_EDITED, text); } diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 1fe4f92e124..6f1f379987d 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -356,7 +356,7 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, float tmp_mat[3][3]; float scale; - object_to_mat3(amd->curve_ob, tmp_mat); + BKE_object_to_mat3(amd->curve_ob, tmp_mat); scale = mat3_to_scale(tmp_mat); if (!cu->path) { diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index 711c7e6e4ff..2fce6b2373f 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -277,7 +277,7 @@ static Object *AddNewBlenderMesh(Scene *scene, Base *base) // now create a new blender object. // duplicating all the settings from the previous object // to the new one. - ob_new= copy_object(base->object); + ob_new= BKE_object_copy(base->object); // Ok we don't want to use the actual data from the // last object, the above function incremented the @@ -295,7 +295,7 @@ static Object *AddNewBlenderMesh(Scene *scene, Base *base) basen->flag &= ~SELECT; // Initialize the mesh data associated with this object. - ob_new->data= add_mesh("Mesh"); + ob_new->data= BKE_mesh_add("Mesh"); // Finally assign the object type. ob_new->type= OB_MESH; diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index ddfb793bd5d..8e23555ea12 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -115,7 +115,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), faceMap = MEM_callocN(sizeof(*faceMap) * numPoly_src, "build modifier faceMap"); for (i = 0; i < numPoly_src; i++) faceMap[i] = i; - frac = (BKE_curframe(md->scene) - bmd->start) / bmd->length; + frac = (BKE_scene_frame_get(md->scene) - bmd->start) / bmd->length; CLAMP(frac, 0.0f, 1.0f); numFaces_dst = numPoly_src * frac; diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 83a366815de..f65789013d9 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -131,7 +131,7 @@ static void deformVerts(ModifierData *md, Object *ob, CDDM_apply_vert_coords(dm, vertexCos); CDDM_calc_normals(dm); - current_time = BKE_curframe(md->scene); + current_time = BKE_scene_frame_get(md->scene); if (G.rt > 0) printf("current_time %f, collmd->time_xnew %f\n", current_time, collmd->time_xnew); diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 4270659d851..429369d6650 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -815,7 +815,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd, /* timestep= psys_get_timestep(&sim); */ - cfra= BKE_curframe(scene); + cfra= BKE_scene_frame_get(scene); /* hash table for vertice <-> particle relations */ vertpahash= BLI_edgehash_new(); diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index b115e5bb244..773b5d04a17 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -146,7 +146,7 @@ static float hook_falloff(const float co_1[3], const float co_2[3], const float static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm, float (*vertexCos)[3], int numVerts) { - bPoseChannel *pchan= get_pose_channel(hmd->object->pose, hmd->subtarget); + bPoseChannel *pchan= BKE_pose_channel_find_name(hmd->object->pose, hmd->subtarget); float vec[3], mat[4][4], dmat[4][4]; int i, *index_pt; const float falloff_squared= hmd->falloff * hmd->falloff; /* for faster comparisons */ diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index 32376acc553..8eea871c97f 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -45,7 +45,7 @@ #include "DNA_modifier_types.h" #include "DNA_object_types.h" -#include "BKE_action.h" /* get_pose_channel */ +#include "BKE_action.h" /* BKE_pose_channel_find_name */ #include "BKE_cdderivedmesh.h" #include "BKE_mesh.h" #include "BKE_modifier.h" @@ -146,15 +146,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, char *bone_select_array; int bone_select_tot= 0; const int defbase_tot= BLI_countlist(&ob->defbase); - + /* check that there is armature object with bones to use, otherwise return original mesh */ if (ELEM3(NULL, mmd->ob_arm, mmd->ob_arm->pose, ob->defbase.first)) return derivedData; - + bone_select_array= MEM_mallocN(defbase_tot * sizeof(char), "mask array"); - + for (i = 0, def = ob->defbase.first; def; def = def->next, i++) { - pchan = get_pose_channel(oba->pose, def->name); + pchan = BKE_pose_channel_find_name(oba->pose, def->name); if (pchan && pchan->bone && (pchan->bone->flag & BONE_SELECTED)) { bone_select_array[i]= TRUE; bone_select_tot++; @@ -198,7 +198,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, for (i= 0, dv= dvert; i < maxVerts; i++, dv++) { MDeformWeight *dw= dv->dw; int j; - + for (j= dv->totweight; j > 0; j--, dw++) { if (dw->def_nr < defbase_tot) { if (bone_select_array[dw->def_nr]) { @@ -291,7 +291,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, MLoop *ml = mloop + mp->loopstart; int ok = TRUE; int j; - + for (j = 0; j < mp->totloop; j++, ml++) { if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(ml->v))) { ok = FALSE; diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index dc1429208a0..5ac1e2786d6 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -79,7 +79,7 @@ static void copyData(ModifierData *md, ModifierData *target) tpsmd->totdmvert = tpsmd->totdmedge = tpsmd->totdmface = 0; //tpsmd->facepa = 0; tpsmd->flag = psmd->flag; - /* need to keep this to recognise a bit later in copy_object */ + /* need to keep this to recognise a bit later in BKE_object_copy */ tpsmd->psys = psmd->psys; } diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 4e143bcb008..6a173362ade 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -66,7 +66,7 @@ void modifier_init_texture(Scene *scene, Tex *tex) return; if (tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) - BKE_image_user_calc_frame(&tex->iuser, scene->r.cfra, 0); + BKE_image_user_frame_calc(&tex->iuser, scene->r.cfra, 0); } void get_texture_value(Tex *texture, float *tex_co, TexResult *texres) @@ -223,7 +223,7 @@ void modifier_get_vgroup(Object *ob, DerivedMesh *dm, const char *name, MDeformV if (*defgrp_index >= 0) { if (ob->type == OB_LATTICE) - *dvert = lattice_get_deform_verts(ob); + *dvert = BKE_lattice_deform_verts_get(ob); else if (dm) *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT); } diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 80a3b70d8e3..df9a4f2d017 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -194,13 +194,13 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, cam = (Camera *)projectors[i].ob->data; if (cam->flag & CAM_PANORAMA) { - projectors[i].uci= project_camera_info(projectors[i].ob, NULL, aspx, aspy); - project_camera_info_scale(projectors[i].uci, scax, scay); + projectors[i].uci= BLI_uvproject_camera_info(projectors[i].ob, NULL, aspx, aspy); + BLI_uvproject_camera_info_scale(projectors[i].uci, scax, scay); free_uci= 1; } else { - float sensor= camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y); - int sensor_fit= camera_sensor_fit(cam->sensor_fit, aspx, aspy); + float sensor= BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y); + int sensor_fit= BKE_camera_sensor_fit(cam->sensor_fit, aspx, aspy); float scale= (cam->type == CAM_PERSP) ? cam->clipsta * sensor / cam->lens : cam->ortho_scale; float xmax, xmin, ymax, ymin; @@ -304,7 +304,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, do { unsigned int lidx= mp->loopstart + fidx; unsigned int vidx= mloop[lidx].v; - project_from_camera(mloop_uv[lidx].uv, coords[vidx], projectors[0].uci); + BLI_uvproject_from_camera(mloop_uv[lidx].uv, coords[vidx], projectors[0].uci); } while (fidx--); } else { @@ -347,7 +347,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd, do { unsigned int lidx= mp->loopstart + fidx; unsigned int vidx= mloop[lidx].v; - project_from_camera(mloop_uv[lidx].uv, coords[vidx], best_projector->uci); + BLI_uvproject_from_camera(mloop_uv[lidx].uv, coords[vidx], best_projector->uci); } while (fidx--); } else { diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 5fa3090cd87..db5538aba51 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -178,7 +178,7 @@ static void waveModifier_do(WaveModifierData *md, MVert *mvert = NULL; MDeformVert *dvert; int defgrp_index; - float ctime = BKE_curframe(scene); + float ctime = BKE_scene_frame_get(scene); float minfac = (float)(1.0 / exp(wmd->width * wmd->narrow * wmd->width * wmd->narrow)); float lifefac = wmd->height; diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 049b5dd8178..b526c25e2dc 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -136,7 +136,7 @@ static void localize(bNodeTree *localtree, bNodeTree *ntree) if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { if (node->id) { if (node->flag & NODE_DO_OUTPUT) - node->new_node->id= (ID *)copy_image((Image *)node->id); + node->new_node->id= (ID *)BKE_image_copy((Image *)node->id); else node->new_node->id= NULL; } diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c index fc6e6847f34..72dec01066e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.c +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c @@ -261,7 +261,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, if (camob && camob->type==OB_CAMERA) { Camera* cam = (Camera*)camob->data; cam_lens = cam->lens; - cam_fdist = object_camera_dof_distance(camob); + cam_fdist = BKE_camera_object_dof_distance(camob); if (cam_fdist==0.0f) cam_fdist = 1e10f; /* if the dof is 0.0 then set it be be far away */ cam_invfdist = 1.f/cam_fdist; } diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index 1789710b096..02bb16f644a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -420,7 +420,7 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE ImageUser *iuser= (ImageUser *)node->storage; /* first set the right frame number in iuser */ - BKE_image_user_calc_frame(iuser, rd->cfra, 0); + BKE_image_user_frame_calc(iuser, rd->cfra, 0); /* force a load, we assume iuser index will be set OK anyway */ if (ima->type==IMA_TYPE_MULTILAYER) diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c index f89dcf63f64..18a535018ba 100644 --- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c +++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c @@ -192,7 +192,7 @@ static void exec_output_file_singlelayer(RenderData *rd, bNode *node, bNodeStack BLI_join_dirfile(path, FILE_MAX, nimf->base_path, sockdata->path); BKE_makepicstring(filename, path, bmain->name, rd->cfra, format->imtype, (rd->scemode & R_EXTENSION), TRUE); - if (0 == BKE_write_ibuf(ibuf, filename, format)) + if (0 == BKE_imbuf_write(ibuf, filename, format)) printf("Cannot save Node File Output to %s\n", filename); else printf("Saved: %s\n", filename); diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c index c2263053987..a12a1042553 100644 --- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c +++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c @@ -69,7 +69,7 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack * buf1= typecheck_compbuf(in[0]->data, CB_RGBA); buf2= typecheck_compbuf(in[1]->data, CB_RGBA); - BKE_image_user_calc_frame(node->storage, rd->cfra, 0); + BKE_image_user_frame_calc(node->storage, rd->cfra, 0); /* always returns for viewer image, but we check nevertheless */ ibuf= BKE_image_acquire_ibuf(ima, node->storage, &lock); diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.c b/source/blender/nodes/composite/nodes/node_composite_viewer.c index f9b1e55f29f..3fdedbb2e42 100644 --- a/source/blender/nodes/composite/nodes/node_composite_viewer.c +++ b/source/blender/nodes/composite/nodes/node_composite_viewer.c @@ -55,7 +55,7 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in, int rectx, recty; void *lock; - BKE_image_user_calc_frame(node->storage, rd->cfra, 0); + BKE_image_user_frame_calc(node->storage, rd->cfra, 0); /* always returns for viewer image, but we check nevertheless */ ibuf= BKE_image_acquire_ibuf(ima, node->storage, &lock); diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 3aadcef4c82..49a3d6c07b4 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -368,7 +368,7 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode) bAction *waction; /* firstly, wgroup needs to temporary dummy action that can be destroyed, as it shares copies */ - waction = wgroup->adt->action = copy_action(wgroup->adt->action); + waction = wgroup->adt->action = BKE_action_copy(wgroup->adt->action); /* now perform the moving */ BKE_animdata_separate_by_basepath(&wgroup->id, &ntree->id, &anim_basepaths); @@ -383,7 +383,7 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode) /* free temp action too */ if (waction) { - free_libblock(&G.main->action, waction); + BKE_libblock_free(&G.main->action, waction); } } @@ -391,7 +391,7 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode) nodeFreeNode(ntree, gnode); /* free the group tree (takes care of user count) */ - free_libblock(&G.main->nodetree, wgroup); + BKE_libblock_free(&G.main->nodetree, wgroup); ntree->update |= NTREE_UPDATE_NODES | NTREE_UPDATE_LINKS; ntreeUpdateTree(ntree); diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index c028ca83664..716d31a8cd1 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -83,7 +83,7 @@ static void foreach_nodeclass(Scene *scene, void *calldata, bNodeClassCallback f func(calldata, NODE_CLASS_INPUT, IFACE_("Input")); func(calldata, NODE_CLASS_OUTPUT, IFACE_("Output")); - if (scene_use_new_shading_nodes(scene)) { + if (BKE_scene_use_new_shading_nodes(scene)) { func(calldata, NODE_CLASS_SHADER, IFACE_("Shader")); func(calldata, NODE_CLASS_TEXTURE, IFACE_("Texture")); } diff --git a/source/blender/nodes/shader/nodes/node_shader_dynamic.c b/source/blender/nodes/shader/nodes/node_shader_dynamic.c index 5a6a92b5e27..b441545441a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_dynamic.c +++ b/source/blender/nodes/shader/nodes/node_shader_dynamic.c @@ -254,7 +254,7 @@ static void node_dynamic_rem_all_links(bNodeType *tinfo) /* node_dynamic_reset: clean a pynode, getting rid of all * data dynamically created for it. */ -static void node_dynamic_reset(bNode *node, int unlink_text) +static void node_dynamic_reset(bNode *node, int BKE_text_unlink) { bNodeType *tinfo, *tinfo_default; Material *ma; @@ -262,7 +262,7 @@ static void node_dynamic_reset(bNode *node, int unlink_text) tinfo = node->typeinfo; tinfo_default = node_dynamic_find_typeinfo(&node_all_shaders, NULL); - if ((tinfo == tinfo_default) && unlink_text) { + if ((tinfo == tinfo_default) && BKE_text_unlink) { ID *textID = node->id; /* already at default (empty) state, which happens if this node's * script failed to parse at the first stage: definition. We're here @@ -296,7 +296,7 @@ static void node_dynamic_reset(bNode *node, int unlink_text) node_dynamic_free_sockets(nd); //node_dynamic_update_socket_links(nd, ma->nodetree); nd->typeinfo = tinfo_default; - if (unlink_text) { + if (BKE_text_unlink) { nd->id = NULL; nd->custom1 = 0; nd->custom1 = BSET(nd->custom1, NODE_DYNAMIC_NEW); diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index 834ca1227b5..4d5c02dad68 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -125,13 +125,13 @@ static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObjec return NULL; } - if (absolute) flag |= BPATH_TRAVERSE_ABS; - if (!packed) flag |= BPATH_TRAVERSE_SKIP_PACKED; - if (local) flag |= BPATH_TRAVERSE_SKIP_LIBRARY; + if (absolute) flag |= BLI_BPATH_TRAVERSE_ABS; + if (!packed) flag |= BLI_BPATH_TRAVERSE_SKIP_PACKED; + if (local) flag |= BLI_BPATH_TRAVERSE_SKIP_LIBRARY; list = PyList_New(0); - bpath_traverse_main(G.main, bpy_blend_paths_visit_cb, flag, (void *)list); + BLI_bpath_traverse_main(G.main, bpy_blend_paths_visit_cb, flag, (void *)list); return list; } diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c index 5128cf0b924..bab5a83a6ed 100644 --- a/source/blender/python/intern/bpy_app_handlers.c +++ b/source/blender/python/intern/bpy_app_handlers.c @@ -225,7 +225,7 @@ PyObject *BPY_app_handlers_struct(void) funcstore->func = bpy_app_generic_callback; funcstore->alloc = 0; funcstore->arg = SET_INT_IN_POINTER(pos); - BLI_add_cb(funcstore, pos); + BLI_callback_add(funcstore, pos); } } diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index 203da5d1bd2..9e9b96a885b 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -1150,11 +1150,11 @@ static PyObject *M_Geometry_tessellate_polygon(PyObject *UNUSED(self), PyObject } -static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray) +static int boxPack_FromPyObject(PyObject *value, BoxPack **boxarray) { Py_ssize_t len, i; PyObject *list_item, *item_1, *item_2; - boxPack *box; + BoxPack *box; /* Error checking must already be done */ @@ -1166,7 +1166,7 @@ static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray) len = PyList_GET_SIZE(value); - *boxarray = MEM_mallocN(len * sizeof(boxPack), "boxPack box"); + *boxarray = MEM_mallocN(len * sizeof(BoxPack), "BoxPack box"); for (i = 0; i < len; i++) { @@ -1201,11 +1201,11 @@ static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray) return 0; } -static void boxPack_ToPyObject(PyObject *value, boxPack **boxarray) +static void boxPack_ToPyObject(PyObject *value, BoxPack **boxarray) { Py_ssize_t len, i; PyObject *list_item; - boxPack *box; + BoxPack *box; len = PyList_GET_SIZE(value); @@ -1243,13 +1243,13 @@ static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlis len = PyList_GET_SIZE(boxlist); if (len) { - boxPack *boxarray = NULL; + BoxPack *boxarray = NULL; if (boxPack_FromPyObject(boxlist, &boxarray) == -1) { return NULL; /* exception set */ } /* Non Python function */ - boxPack2D(boxarray, len, &tot_width, &tot_height); + BLI_box_pack_2D(boxarray, len, &tot_width, &tot_height); boxPack_ToPyObject(boxlist, &boxarray); } diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index f6030c8c0b5..75901008d9f 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -1574,7 +1574,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem float hasize, pa_size, r_tilt, r_length; float pa_time, pa_birthtime, pa_dietime; float random, simplify[2], pa_co[3]; - const float cfra= BKE_curframe(re->scene); + const float cfra= BKE_scene_frame_get(re->scene); int i, a, k, max_k=0, totpart, dosimplify = 0, dosurfacecache = 0, use_duplimat = 0; int totchild=0; int seed, path_nbr=0, orco1=0, num; @@ -5051,12 +5051,12 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l /* applies changes fully */ if ((re->r.scemode & (R_NO_FRAME_UPDATE|R_PREVIEWBUTS))==0) - scene_update_for_newframe(re->main, re->scene, lay); + BKE_scene_update_for_newframe(re->main, re->scene, lay); /* if no camera, viewmat should have been set! */ if (use_camera_view && camera) { /* called before but need to call again in case of lens animation from the - * above call to scene_update_for_newframe, fixes bug. [#22702]. + * above call to BKE_scene_update_for_newframe, fixes bug. [#22702]. * following calls don't depend on 'RE_SetCamera' */ RE_SetCamera(re, camera); @@ -5206,7 +5206,7 @@ static void database_fromscene_vectors(Render *re, Scene *scene, unsigned int la /* applies changes fully */ scene->r.cfra += timeoffset; - scene_update_for_newframe(re->main, re->scene, lay); + BKE_scene_update_for_newframe(re->main, re->scene, lay); /* if no camera, viewmat should have been set! */ if (camera) { @@ -5868,7 +5868,7 @@ void RE_make_sticky(Scene *scene, View3D *v3d) me->msticky= CustomData_add_layer(&me->vdata, CD_MSTICKY, CD_CALLOC, NULL, me->totvert); - where_is_object(scene, ob); + BKE_object_where_is_calc(scene, ob); mult_m4_m4m4(mat, re->viewmat, ob->obmat); ms= me->msticky; diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index da7e4335f7d..eebcf23a7a6 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -49,7 +49,7 @@ #include "BKE_library.h" #include "BKE_main.h" -#include "BKE_image.h" // BKE_write_ibuf +#include "BKE_image.h" // BKE_imbuf_write #include "BKE_texture.h" diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c index b3c7a565d55..c23a93a52fe 100644 --- a/source/blender/render/intern/source/external_engine.c +++ b/source/blender/render/intern/source/external_engine.c @@ -313,7 +313,7 @@ int RE_engine_render(Render *re, int do_all) engine->camera_override = re->camera_override; if ((re->r.scemode & (R_NO_FRAME_UPDATE|R_PREVIEWBUTS))==0) - scene_update_for_newframe(re->main, re->scene, re->lay); + BKE_scene_update_for_newframe(re->main, re->scene, re->lay); if (type->update) type->update(engine, re->main, re->scene); diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c index 3e82bec7e52..e712950f4f8 100644 --- a/source/blender/render/intern/source/initrender.c +++ b/source/blender/render/intern/source/initrender.c @@ -94,10 +94,10 @@ static void init_render_jit(Render *re) if (lastjit!=re->r.osa || last_mblur_jit != re->r.mblur_samples) { memset(jit, 0, sizeof(jit)); - BLI_initjit(jit[0], re->r.osa); + BLI_jitter_init(jit[0], re->r.osa); memset(mblur_jit, 0, sizeof(mblur_jit)); - BLI_initjit(mblur_jit[0], re->r.mblur_samples); + BLI_jitter_init(mblur_jit[0], re->r.mblur_samples); } lastjit= re->r.osa; @@ -463,7 +463,7 @@ static void re_camera_params_get(Render *re, CameraParams *params, Object *cam_o re->viewdy= params->viewdy; re->viewplane= params->viewplane; - object_camera_mode(&re->r, cam_ob); + BKE_camera_object_mode(&re->r, cam_ob); } void RE_SetEnvmapCamera(Render *re, Object *cam_ob, float viewscale, float clipsta, float clipend) @@ -471,8 +471,8 @@ void RE_SetEnvmapCamera(Render *re, Object *cam_ob, float viewscale, float clips CameraParams params; /* setup parameters */ - camera_params_init(¶ms); - camera_params_from_object(¶ms, cam_ob); + BKE_camera_params_init(¶ms); + BKE_camera_params_from_object(¶ms, cam_ob); params.lens= 16.0f*viewscale; params.sensor_x= 32.0f; @@ -482,8 +482,8 @@ void RE_SetEnvmapCamera(Render *re, Object *cam_ob, float viewscale, float clips params.clipend= clipend; /* compute matrix, viewplane, .. */ - camera_params_compute_viewplane(¶ms, re->winx, re->winy, 1.0f, 1.0f); - camera_params_compute_matrix(¶ms); + BKE_camera_params_compute_viewplane(¶ms, re->winx, re->winy, 1.0f, 1.0f); + BKE_camera_params_compute_matrix(¶ms); /* extract results */ re_camera_params_get(re, ¶ms, cam_ob); @@ -496,16 +496,16 @@ void RE_SetCamera(Render *re, Object *cam_ob) CameraParams params; /* setup parameters */ - camera_params_init(¶ms); - camera_params_from_object(¶ms, cam_ob); + BKE_camera_params_init(¶ms); + BKE_camera_params_from_object(¶ms, cam_ob); params.use_fields= (re->r.mode & R_FIELDS); params.field_second= (re->flag & R_SEC_FIELD); params.field_odd= (re->r.mode & R_ODDFIELD); /* compute matrix, viewplane, .. */ - camera_params_compute_viewplane(¶ms, re->winx, re->winy, re->r.xasp, re->r.yasp); - camera_params_compute_matrix(¶ms); + BKE_camera_params_compute_viewplane(¶ms, re->winx, re->winy, re->r.xasp, re->r.yasp); + BKE_camera_params_compute_matrix(¶ms); /* extract results */ re_camera_params_get(re, ¶ms, cam_ob); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 57c39a03c06..63daaaed21a 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -171,7 +171,7 @@ static void stats_background(void *UNUSED(arg), RenderStats *rs) fprintf(stdout, "Sce: %s Ve:%d Fa:%d La:%d", rs->scenename, rs->totvert, rs->totface, rs->totlamp); } - BLI_exec_cb(G.main, NULL, BLI_CB_EVT_RENDER_STATS); + BLI_callback_exec(G.main, NULL, BLI_CB_EVT_RENDER_STATS); fputc('\n', stdout); fflush(stdout); @@ -1265,7 +1265,7 @@ static void render_scene(Render *re, Scene *sce, int cfra) sce->r.cfra= cfra; - scene_camera_switch_update(sce); + BKE_scene_camera_switch_update(sce); /* exception: scene uses own size (unfinished code) */ if (0) { @@ -1282,7 +1282,7 @@ static void render_scene(Render *re, Scene *sce, int cfra) resc->lay= sce->lay; /* ensure scene has depsgraph, base flags etc OK */ - set_scene_bg(re->main, sce); + BKE_scene_set_background(re->main, sce); /* copy callbacks */ resc->display_draw= re->display_draw; @@ -1368,7 +1368,7 @@ static void ntree_render_scenes(Render *re) /* restore scene if we rendered another last */ if (restore_scene) - set_scene_bg(re->main, re->scene); + BKE_scene_set_background(re->main, re->scene); } /* bad call... need to think over proper method still */ @@ -1591,7 +1591,7 @@ static void do_render_composite_fields_blur_3d(Render *re) R.stats_draw= re->stats_draw; if (update_newframe) - scene_update_for_newframe(re->main, re->scene, re->lay); + BKE_scene_update_for_newframe(re->main, re->scene, re->lay); if (re->r.scemode & R_FULL_SAMPLE) do_merge_fullsample(re, ntree); @@ -1654,7 +1654,7 @@ static void do_render_seq(Render * re) if (recurs_depth==0) { /* otherwise sequencer animation isn't updated */ - BKE_animsys_evaluate_all_animation(re->main, re->scene, (float)cfra); // XXX, was BKE_curframe(re->scene) + BKE_animsys_evaluate_all_animation(re->main, re->scene, (float)cfra); // XXX, was BKE_scene_frame_get(re->scene) } recurs_depth++; @@ -1713,7 +1713,7 @@ static void do_render_seq(Render * re) /* main loop: doing sequence + fields + blur + 3d render + compositing */ static void do_render_all_options(Render *re) { - scene_camera_switch_update(re->scene); + BKE_scene_camera_switch_update(re->scene); re->i.starttime= PIL_check_seconds_timer(); @@ -1751,7 +1751,7 @@ static int check_valid_camera(Scene *scene, Object *camera_override) int check_comp= 1; if (camera_override == NULL && scene->camera == NULL) - scene->camera= scene_find_camera(scene); + scene->camera= BKE_scene_camera_find(scene); if (scene->r.scemode&R_DOSEQ) { if (scene->ed) { @@ -1762,7 +1762,7 @@ static int check_valid_camera(Scene *scene, Object *camera_override) while (seq) { if (seq->type == SEQ_SCENE && seq->scene) { if (!seq->scene_camera) { - if (!seq->scene->camera && !scene_find_camera(seq->scene)) { + if (!seq->scene->camera && !BKE_scene_camera_find(seq->scene)) { if (seq->scene == scene) { /* for current scene camera could be unneeded due to compisite nodes */ check_comp= 1; @@ -1788,7 +1788,7 @@ static int check_valid_camera(Scene *scene, Object *camera_override) if (node->type == CMP_NODE_R_LAYERS) { Scene *sce= node->id ? (Scene*)node->id : scene; - if (!sce->camera && !scene_find_camera(sce)) { + if (!sce->camera && !BKE_scene_camera_find(sce)) { /* all render layers nodes need camera */ return 0; } @@ -1872,7 +1872,7 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r } /* get panorama & ortho, only after camera is set */ - object_camera_mode(&scene->r, camera_override ? camera_override : scene->camera); + BKE_camera_object_mode(&scene->r, camera_override ? camera_override : scene->camera); /* forbidden combinations */ if (scene->r.mode & R_PANORAMA) { @@ -2021,7 +2021,7 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr if (render_initialize_from_main(re, bmain, scene, srl, camera_override, lay, 0, 0)) { MEM_reset_peak_memory(); - BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_PRE); + BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_PRE); do_render_all_options(re); @@ -2039,10 +2039,10 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr } } - BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */ + BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */ } - BLI_exec_cb(re->main, (ID *)scene, G.afbreek ? BLI_CB_EVT_RENDER_CANCEL : BLI_CB_EVT_RENDER_COMPLETE); + BLI_callback_exec(re->main, (ID *)scene, G.afbreek ? BLI_CB_EVT_RENDER_CANCEL : BLI_CB_EVT_RENDER_COMPLETE); /* UGLY WARNING */ G.rendering= 0; @@ -2090,7 +2090,7 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie else { ImBuf *ibuf= render_result_rect_to_ibuf(&rres, &scene->r); - ok= BKE_write_ibuf_stamp(scene, camera, ibuf, name, &scene->r.im_format); + ok= BKE_imbuf_write_stamp(scene, camera, ibuf, name, &scene->r.im_format); if (ok==0) { printf("Render error: cannot save %s\n", name); @@ -2106,7 +2106,7 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie name[strlen(name)-4]= 0; BKE_add_image_extension(name, R_IMF_IMTYPE_JPEG90); ibuf->planes= 24; - BKE_write_ibuf_stamp(scene, camera, ibuf, name, &imf); + BKE_imbuf_write_stamp(scene, camera, ibuf, name, &imf); printf("\nSaved: %s", name); } @@ -2120,7 +2120,7 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie BLI_timestr(re->i.lastframetime, name); printf(" Time: %s", name); - BLI_exec_cb(G.main, NULL, BLI_CB_EVT_RENDER_STATS); + BLI_callback_exec(G.main, NULL, BLI_CB_EVT_RENDER_STATS); fputc('\n', stdout); fflush(stdout); /* needed for renderd !! (not anymore... (ton)) */ @@ -2155,7 +2155,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri if (nf >= 0 && nf >= scene->r.sfra && nf <= scene->r.efra) { scene->r.cfra = re->r.cfra = nf; - BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_PRE); + BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_PRE); do_render_all_options(re); totrendered++; @@ -2166,7 +2166,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri } if (G.afbreek == 0) { - BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */ + BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */ } } else { @@ -2195,7 +2195,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri else updatelay= re->lay; - scene_update_for_newframe(bmain, scene, updatelay); + BKE_scene_update_for_newframe(bmain, scene, updatelay); continue; } else @@ -2220,7 +2220,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri re->r.cfra= scene->r.cfra; /* weak.... */ /* run callbacs before rendering, before the scene is updated */ - BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_PRE); + BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_PRE); do_render_all_options(re); @@ -2246,7 +2246,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri } if (G.afbreek==0) { - BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */ + BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */ } } } @@ -2262,7 +2262,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri re->flag &= ~R_ANIMATION; - BLI_exec_cb(re->main, (ID *)scene, G.afbreek ? BLI_CB_EVT_RENDER_CANCEL : BLI_CB_EVT_RENDER_COMPLETE); + BLI_callback_exec(re->main, (ID *)scene, G.afbreek ? BLI_CB_EVT_RENDER_CANCEL : BLI_CB_EVT_RENDER_COMPLETE); /* UGLY WARNING */ G.rendering= 0; @@ -2455,7 +2455,7 @@ int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env, BLI_strncpy(filepath, relpath, sizeof(filepath)); BLI_path_abs(filepath, G.main->name); - ok= BKE_write_ibuf(ibuf, filepath, &imf); + ok= BKE_imbuf_write(ibuf, filepath, &imf); IMB_freeImBuf(ibuf); diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index 8bbb16739f7..96a1a13b75f 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -106,7 +106,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa ParticleKey state; ParticleSimulationData sim= {NULL}; ParticleData *pa=NULL; - float cfra = BKE_curframe(re->scene); + float cfra = BKE_scene_frame_get(re->scene); int i /*, childexists*/ /* UNUSED */; int total_particles, offset=0; int data_used = point_data_used(pd); diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c index a49097f5b7d..a88057ef3d2 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/source/render_result.c @@ -1020,7 +1020,7 @@ ImBuf *render_result_rect_to_ibuf(RenderResult *rr, RenderData *rd) int flags = (rd->color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE)? IB_cm_predivide: 0; ImBuf *ibuf= IMB_allocImBuf(rr->rectx, rr->recty, rd->im_format.planes, flags); - /* if not exists, BKE_write_ibuf makes one */ + /* if not exists, BKE_imbuf_write makes one */ ibuf->rect= (unsigned int *)rr->rect32; ibuf->rect_float= rr->rectf; ibuf->zbuf_float= rr->rectz; diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 521b295fb0b..9aec75c70d4 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -100,13 +100,13 @@ static void init_render_texture(Render *re, Tex *tex) /* imap test */ if (tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) { - BKE_image_user_calc_frame(&tex->iuser, cfra, re?re->flag & R_SEC_FIELD:0); + BKE_image_user_frame_calc(&tex->iuser, cfra, re?re->flag & R_SEC_FIELD:0); } if (tex->type==TEX_PLUGIN) { if (tex->plugin && tex->plugin->doit) { if (tex->plugin->cfra) { - *(tex->plugin->cfra)= (float)cfra; //BKE_curframe(re->scene); // XXX old animsys - timing stuff to be fixed + *(tex->plugin->cfra)= (float)cfra; //BKE_scene_frame_get(re->scene); // XXX old animsys - timing stuff to be fixed } } } @@ -1214,7 +1214,7 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, case TEX_IMAGE: if (osatex) retval= imagewraposa(tex, tex->ima, NULL, texvec, dxt, dyt, texres); else retval= imagewrap(tex, tex->ima, NULL, texvec, texres); - tag_image_time(tex->ima); /* tag image as having being used */ + BKE_image_tag_time(tex->ima); /* tag image as having being used */ break; case TEX_PLUGIN: retval= plugintex(tex, texvec, dxt, dyt, osatex, texres); @@ -3558,7 +3558,7 @@ Material *RE_init_sample_material(Material *orig_mat, Scene *scene) mat = localize_material(orig_mat); /* update material anims */ - BKE_animsys_evaluate_animdata(scene, &mat->id, mat->adt, BKE_curframe(scene), ADT_RECALC_ANIM); + BKE_animsys_evaluate_animdata(scene, &mat->id, mat->adt, BKE_scene_frame_get(scene), ADT_RECALC_ANIM); /* strip material copy from unsupported flags */ for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) { @@ -3605,7 +3605,7 @@ Material *RE_init_sample_material(Material *orig_mat, Scene *scene) tex= mtex->tex = localize_texture(mtex->tex); /* update texture anims */ - BKE_animsys_evaluate_animdata(scene, &tex->id, tex->adt, BKE_curframe(scene), ADT_RECALC_ANIM); + BKE_animsys_evaluate_animdata(scene, &tex->id, tex->adt, BKE_scene_frame_get(scene), ADT_RECALC_ANIM); /* update texture cache if required */ if (tex->type==TEX_VOXELDATA) { @@ -3625,7 +3625,7 @@ Material *RE_init_sample_material(Material *orig_mat, Scene *scene) /* update image sequences and movies */ if (tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) { if (tex->iuser.flag & IMA_ANIM_ALWAYS) - BKE_image_user_calc_frame(&tex->iuser, (int)scene->r.cfra, 0); + BKE_image_user_frame_calc(&tex->iuser, (int)scene->r.cfra, 0); } } } @@ -3644,14 +3644,14 @@ void RE_free_sample_material(Material *mat) MTex *mtex= mat->mtex[tex_nr]; if (mtex->tex) { - free_texture(mtex->tex); + BKE_texture_free(mtex->tex); MEM_freeN(mtex->tex); mtex->tex = NULL; } } } - free_material(mat); + BKE_material_free(mat); MEM_freeN(mat); } diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c index 04e1bee4376..0dc7f35dc56 100644 --- a/source/blender/render/intern/source/rendercore.c +++ b/source/blender/render/intern/source/rendercore.c @@ -2567,7 +2567,7 @@ static void *do_bake_thread(void *bs_v) void RE_bake_ibuf_filter(ImBuf *ibuf, char *mask, const int filter) { /* must check before filtering */ - const short is_new_alpha= (ibuf->planes != R_IMF_PLANES_RGBA) && BKE_alphatest_ibuf(ibuf); + const short is_new_alpha= (ibuf->planes != R_IMF_PLANES_RGBA) && BKE_imbuf_alpha_test(ibuf); /* Margin */ if (filter) { diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c index 1c572524a70..b3167e15df5 100644 --- a/source/blender/render/intern/source/shadbuf.c +++ b/source/blender/render/intern/source/shadbuf.c @@ -139,7 +139,7 @@ static float *give_jitter_tab(int samp) if (ctab[samp]==0) { ctab[samp]= 1; - BLI_initjit(jit[offset], samp*samp); + BLI_jitter_init(jit[offset], samp*samp); } return jit[offset]; diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c index 69aa6082950..ff715eeca07 100644 --- a/source/blender/render/intern/source/volume_precache.c +++ b/source/blender/render/intern/source/volume_precache.c @@ -177,7 +177,7 @@ static float get_avg_surrounds(float *cache, int *res, int xx, int yy, int zz) for (x=-1; x <= 1; x++) { x_ = xx+x; if (x_ >= 0 && x_ <= res[0]-1) { - const int i= V_I(x_, y_, z_, res); + const int i = BLI_VOXEL_INDEX(x_, y_, z_, res); if (cache[i] > 0.0f) { tot += cache[i]; @@ -208,7 +208,7 @@ static void lightcache_filter(VolumePrecache *vp) for (y=0; y < vp->res[1]; y++) { for (x=0; x < vp->res[0]; x++) { /* trigger for outside mesh */ - const int i= V_I(x, y, z, vp->res); + const int i = BLI_VOXEL_INDEX(x, y, z, vp->res); if (vp->data_r[i] < -0.f) vp->data_r[i] = get_avg_surrounds(vp->data_r, vp->res, x, y, z); @@ -240,7 +240,7 @@ static void lightcache_filter2(VolumePrecache *vp) for (y=0; y < vp->res[1]; y++) { for (x=0; x < vp->res[0]; x++) { /* trigger for outside mesh */ - const int i= V_I(x, y, z, vp->res); + const int i = BLI_VOXEL_INDEX(x, y, z, vp->res); if (vp->data_r[i] < -0.f) new_r[i] = get_avg_surrounds(vp->data_r, vp->res, x, y, z); if (vp->data_g[i] < -0.f) @@ -291,7 +291,7 @@ static float total_ss_energy(Render *re, int do_test_break, VolumePrecache *vp) for (z=0; z < res[2]; z++) { for (y=0; y < res[1]; y++) { for (x=0; x < res[0]; x++) { - const int i=V_I(x, y, z, res); + const int i = BLI_VOXEL_INDEX(x, y, z, res); if (vp->data_r[i] > 0.f) energy += vp->data_r[i]; if (vp->data_g[i] > 0.f) energy += vp->data_g[i]; @@ -527,7 +527,7 @@ static void *vol_precache_part(void *data) /* convert from world->camera space for shading */ mul_v3_m4v3(cco, pa->viewmat, co); - i= V_I(x, y, z, res); + i = BLI_VOXEL_INDEX(x, y, z, res); // don't bother if the point is not inside the volume mesh if (!point_inside_obi(tree, obi, cco)) { diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index c51cb2af842..b599da48803 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -234,9 +234,9 @@ static void vol_get_precached_scattering(Render *re, ShadeInput *shi, float scat sample_co[1] = (world_co[1] - bbmin[1]) / dim[1]; sample_co[2] = (world_co[2] - bbmin[2]) / dim[2]; - scatter_col[0] = voxel_sample_triquadratic(vp->data_r, vp->res, sample_co); - scatter_col[1] = voxel_sample_triquadratic(vp->data_g, vp->res, sample_co); - scatter_col[2] = voxel_sample_triquadratic(vp->data_b, vp->res, sample_co); + scatter_col[0] = BLI_voxel_sample_triquadratic(vp->data_r, vp->res, sample_co); + scatter_col[1] = BLI_voxel_sample_triquadratic(vp->data_g, vp->res, sample_co); + scatter_col[2] = BLI_voxel_sample_triquadratic(vp->data_b, vp->res, sample_co); } /* Meta object density, brute force for now diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c index 940f718d4ad..90e6594d888 100644 --- a/source/blender/render/intern/source/voxeldata.c +++ b/source/blender/render/intern/source/voxeldata.c @@ -184,7 +184,7 @@ static void load_frame_image_sequence(VoxelData *vd, Tex *tex) for (y=0; y < ibuf->y; y++) { for (x=0; x < ibuf->x; x++) { /* currently averaged to monchrome */ - vd->dataset[ V_I(x, y, z, vd->resol) ] = (rf[0] + rf[1] + rf[2])*0.333f; + vd->dataset[ BLI_VOXEL_INDEX(x, y, z, vd->resol) ] = (rf[0] + rf[1] + rf[2]) * 0.333f; rf +=4; } } @@ -423,17 +423,17 @@ int voxeldatatex(struct Tex *tex, const float texvec[3], struct TexResult *texre switch (vd->interp_type) { case TEX_VD_NEARESTNEIGHBOR: - texres->tin = voxel_sample_nearest(vd->dataset, vd->resol, co); + texres->tin = BLI_voxel_sample_nearest(vd->dataset, vd->resol, co); break; case TEX_VD_LINEAR: - texres->tin = voxel_sample_trilinear(vd->dataset, vd->resol, co); + texres->tin = BLI_voxel_sample_trilinear(vd->dataset, vd->resol, co); break; case TEX_VD_QUADRATIC: - texres->tin = voxel_sample_triquadratic(vd->dataset, vd->resol, co); + texres->tin = BLI_voxel_sample_triquadratic(vd->dataset, vd->resol, co); break; case TEX_VD_TRICUBIC_CATROM: case TEX_VD_TRICUBIC_BSPLINE: - texres->tin = voxel_sample_tricubic(vd->dataset, vd->resol, co, (vd->interp_type == TEX_VD_TRICUBIC_BSPLINE)); + texres->tin = BLI_voxel_sample_tricubic(vd->dataset, vd->resol, co, (vd->interp_type == TEX_VD_TRICUBIC_BSPLINE)); break; } diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 50fb9211995..bc70cdaafbf 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -3047,7 +3047,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float * /* has to become static, the init-jit calls a random-seed, screwing up texture noise node */ if (firsttime) { firsttime= 0; - BLI_initjit(jit[0], 256); + BLI_jitter_init(jit[0], 256); } memset(newrect, 0, sizeof(float)*xsize*ysize*4); diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 4c81a0a8654..f3872cb9594 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -188,7 +188,7 @@ void WM_operatortype_append_ptr (void (*opfunc)(struct wmOperatorType*, void *) void WM_operatortype_append_macro_ptr (void (*opfunc)(struct wmOperatorType*, void *), void *userdata); int WM_operatortype_remove(const char *idname); -struct wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *name, int flag); +struct wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *name, const char *description, int flag); struct wmOperatorTypeMacro *WM_operatortype_macro_define(struct wmOperatorType *ot, const char *idname); diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 638dd4ca807..7285e155dc6 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -291,7 +291,7 @@ void wm_clear_default_size(bContext *C) /* on startup, it adds all data, for matching */ void wm_add_default(bContext *C) { - wmWindowManager *wm = alloc_libblock(&CTX_data_main(C)->wm, ID_WM, "WinMan"); + wmWindowManager *wm = BKE_libblock_alloc(&CTX_data_main(C)->wm, ID_WM, "WinMan"); wmWindow *win; bScreen *screen = CTX_wm_screen(C); /* XXX from file read hrmf */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 56a7ff30ad8..fd3e287a6a5 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -240,7 +240,7 @@ void wm_event_do_notifiers(bContext *C) if (do_anim) { /* XXX, quick frame changes can cause a crash if framechange and rendering - * collide (happens on slow scenes), scene_update_for_newframe can be called + * collide (happens on slow scenes), BKE_scene_update_for_newframe can be called * twice which can depgraph update the same object at once */ if (!G.rendering) { @@ -311,7 +311,7 @@ void wm_event_do_notifiers(bContext *C) /* XXX, hack so operators can enforce datamasks [#26482], gl render */ win->screen->scene->customdata_mask |= win->screen->scene->customdata_mask_modal; - scene_update_tagged(bmain, win->screen->scene); + BKE_scene_update_tagged(bmain, win->screen->scene); } } diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index e50fbaa624e..56052b895ab 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -361,7 +361,7 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports) WM_cursor_wait(1); - BLI_exec_cb(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_PRE); + BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_PRE); /* first try to append data from exotic file formats... */ /* it throws error box when file doesn't exist and returns -1 */ @@ -421,7 +421,7 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports) #endif /* important to do before NULL'ing the context */ - BLI_exec_cb(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_POST); + BLI_callback_exec(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_POST); if (!G.background) { /* in background mode this makes it hard to load @@ -484,7 +484,7 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory char tstr[FILE_MAX]; int success = 0; - free_ttfont(); /* still weird... what does it here? */ + BKE_vfont_free_global_ttf(); /* still weird... what does it here? */ G.relbase_valid = 0; if (!from_memory) { @@ -791,7 +791,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re ibuf_thumb = blend_file_thumb(CTX_data_scene(C), CTX_wm_screen(C), &thumb); } - BLI_exec_cb(G.main, NULL, BLI_CB_EVT_SAVE_PRE); + BLI_callback_exec(G.main, NULL, BLI_CB_EVT_SAVE_PRE); /* operator now handles overwrite checks */ @@ -826,7 +826,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re write_history(); } - BLI_exec_cb(G.main, NULL, BLI_CB_EVT_SAVE_POST); + BLI_callback_exec(G.main, NULL, BLI_CB_EVT_SAVE_POST); /* run this function after because the file cant be written before the blend is */ if (ibuf_thumb) { diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index bfa3645bf57..7f40d2980a6 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -236,7 +236,7 @@ static void draw_filled_lasso(wmGesture *gt) short *lasso = (short *)gt->customdata; int i; - BLI_begin_edgefill(&sf_ctx); + BLI_scanfill_begin(&sf_ctx); for (i = 0; i < gt->points; i++, lasso += 2) { float co[3]; @@ -244,9 +244,9 @@ static void draw_filled_lasso(wmGesture *gt) co[1] = (float)lasso[1]; co[2] = 0.0f; - v = BLI_addfillvert(&sf_ctx, co); + v = BLI_scanfill_vert_add(&sf_ctx, co); if (lastv) - /* e = */ /* UNUSED */ BLI_addfilledge(&sf_ctx, lastv, v); + /* e = */ /* UNUSED */ BLI_scanfill_edge_add(&sf_ctx, lastv, v); lastv = v; if (firstv == NULL) firstv = v; } @@ -254,8 +254,8 @@ static void draw_filled_lasso(wmGesture *gt) /* highly unlikely this will fail, but could crash if (gt->points == 0) */ if (firstv) { float zvec[3] = {0.0f, 0.0f, 1.0f}; - BLI_addfilledge(&sf_ctx, firstv, v); - BLI_edgefill_ex(&sf_ctx, FALSE, zvec); + BLI_scanfill_edge_add(&sf_ctx, firstv, v); + BLI_scanfill_calc_ex(&sf_ctx, FALSE, zvec); glEnable(GL_BLEND); glColor4f(1.0, 1.0, 1.0, 0.05); @@ -268,7 +268,7 @@ static void draw_filled_lasso(wmGesture *gt) glEnd(); glDisable(GL_BLEND); - BLI_end_edgefill(&sf_ctx); + BLI_scanfill_end(&sf_ctx); } } diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 58c2c649163..1a1cb9d6507 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -360,7 +360,7 @@ void WM_exit_ext(bContext *C, const short do_python) // BIF_freeRetarget(); BIF_freeTemplates(C); - free_ttfont(); /* bke_font.h */ + BKE_vfont_free_global_ttf(); /* bke_font.h */ free_openrecent(); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 1de8c95fcce..8f12ffc955c 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -345,7 +345,7 @@ static int wm_macro_cancel(bContext *C, wmOperator *op) } /* Names have to be static for now */ -wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *name, int flag) +wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *name, const char *description, int flag) { wmOperatorType *ot; @@ -359,6 +359,7 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam ot->idname = idname; ot->name = name; + ot->description = description; ot->flag = OPTYPE_MACRO | flag; ot->exec = wm_macro_exec; @@ -1773,7 +1774,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op) /* now we have or selected, or an indicated file */ if (RNA_boolean_get(op->ptr, "autoselect")) - scene_deselect_all(scene); + BKE_scene_base_deselect_all(scene); flag = wm_link_append_flag(op); @@ -2977,7 +2978,7 @@ static void radial_control_set_tex(RadialControl *rc) switch (RNA_type_to_ID_code(rc->image_id_ptr.type)) { case ID_BR: - if ((ibuf = brush_gen_radial_control_imbuf(rc->image_id_ptr.data))) { + if ((ibuf = BKE_brush_gen_radial_control_imbuf(rc->image_id_ptr.data))) { glGenTextures(1, &rc->gltex); glBindTexture(GL_TEXTURE_2D, rc->gltex); glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, ibuf->x, ibuf->y, 0, @@ -3523,7 +3524,7 @@ static int redraw_timer_exec(bContext *C, wmOperator *op) if (a & 1) scene->r.cfra--; else scene->r.cfra++; - scene_update_for_newframe(bmain, scene, scene->lay); + BKE_scene_update_for_newframe(bmain, scene, scene->lay); } else if (type == 5) { @@ -3538,7 +3539,7 @@ static int redraw_timer_exec(bContext *C, wmOperator *op) if (scene->r.cfra > scene->r.efra) scene->r.cfra = scene->r.sfra; - scene_update_for_newframe(bmain, scene, scene->lay); + BKE_scene_update_for_newframe(bmain, scene, scene->lay); redraw_timer_window_swap(C); } } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 031cfe90042..8d962c828ca 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -282,7 +282,7 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win) /* if temp screen, delete it after window free (it stops jobs that can access it) */ if (screen->temp) { Main *bmain = CTX_data_main(C); - free_libblock(&bmain->screen, screen); + BKE_libblock_free(&bmain->screen, screen); } /* check remaining windows */ diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c index 55124ab227c..d1ace96194a 100644 --- a/source/blenderplayer/bad_level_call_stubs/stubs.c +++ b/source/blenderplayer/bad_level_call_stubs/stubs.c @@ -267,7 +267,7 @@ struct EditMesh; struct FCurve *verify_fcurve (struct bAction *act, const char group[], const char rna_path[], const int array_index, short add){return (struct FCurve *) NULL;} int insert_vert_fcurve(struct FCurve *fcu, float x, float y, short flag){return 0;} void delete_fcurve_key(struct FCurve *fcu, int index, short do_recalc){} -struct KeyingSetInfo *ANIM_keyingset_info_find_named (const char name[]){return (struct KeyingSetInfo *) NULL;} +struct KeyingSetInfo *ANIM_keyingset_info_find_name (const char name[]){return (struct KeyingSetInfo *) NULL;} struct KeyingSet *ANIM_scene_get_active_keyingset (struct Scene *scene){return (struct KeyingSet *) NULL;} int ANIM_scene_get_keyingset_index(struct Scene *scene, struct KeyingSet *ks){return 0;} struct ListBase builtin_keyingsets; diff --git a/source/creator/creator.c b/source/creator/creator.c index 8024356c181..c3da352136d 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -795,7 +795,7 @@ static int set_scene(int argc, const char **argv, void *data) { if (argc > 1) { bContext *C = data; - Scene *scene = set_scene_name(CTX_data_main(C), argv[1]); + Scene *scene = BKE_scene_set_name(CTX_data_main(C), argv[1]); if (scene) { CTX_data_scene_set(C, scene); } @@ -1248,7 +1248,7 @@ int main(int argc, const char **argv) IMB_init(); - BLI_cb_init(); + BLI_callback_global_init(); #ifdef WITH_GAMEENGINE syshandle = SYS_GetSystem(); @@ -1270,7 +1270,7 @@ int main(int argc, const char **argv) #endif /* background render uses this font too */ - BKE_font_register_builtin(datatoc_Bfont, datatoc_Bfont_size); + BKE_vfont_builtin_register(datatoc_Bfont, datatoc_Bfont_size); /* Initialize ffmpeg if built in, also needed for bg mode if videos are * rendered via ffmpeg */ diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 61379209151..9869dfb9424 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -370,10 +370,10 @@ PyObject* BL_ActionActuator::PyGetChannel(PyObject* value) obj->GetPose(&m_pose); /* Get the underlying pose from the armature */ } - // get_pose_channel accounts for NULL pose, run on both in case one exists but + // BKE_pose_channel_find_name accounts for NULL pose, run on both in case one exists but // the channel doesnt - if ( !(pchan=get_pose_channel(m_userpose, string)) && - !(pchan=get_pose_channel(m_pose, string)) ) + if ( !(pchan=BKE_pose_channel_find_name(m_userpose, string)) && + !(pchan=BKE_pose_channel_find_name(m_pose, string)) ) { PyErr_SetString(PyExc_ValueError, "channel doesnt exist"); return NULL; @@ -457,8 +457,8 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, obj->GetPose(&m_pose); /* Get the underlying pose from the armature */ game_copy_pose(&m_userpose, m_pose, 0); } - // pchan= verify_pose_channel(m_userpose, string); // adds the channel if its not there. - pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there. + // pchan= BKE_pose_channel_verify(m_userpose, string); // adds the channel if its not there. + pchan= BKE_pose_channel_find_name(m_userpose, string); // adds the channel if its not there. if (pchan) { copy_v3_v3(pchan->loc, matrix[3]); @@ -480,8 +480,8 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, obj->GetPose(&m_pose); /* Get the underlying pose from the armature */ game_copy_pose(&m_userpose, m_pose, 0); } - // pchan= verify_pose_channel(m_userpose, string); - pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there. + // pchan= BKE_pose_channel_verify(m_userpose, string); + pchan= BKE_pose_channel_find_name(m_userpose, string); // adds the channel if its not there. // for some reason loc.setValue(pchan->loc) fails if (pchan) { diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp index f9ddc258cfe..f38782a9405 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.cpp +++ b/source/gameengine/Converter/BL_ArmatureObject.cpp @@ -61,7 +61,7 @@ /** * Move here pose function for game engine so that we can mix with GE objects * Principle is as follow: - * Use Blender structures so that where_is_pose can be used unchanged + * Use Blender structures so that BKE_pose_where_is can be used unchanged * Copy the constraint so that they can be enabled/disabled/added/removed at runtime * Don't copy the constraints for the pose used by the Action actuator, it does not need them. * Scan the constraint structures so that the KX equivalent of target objects are identified and @@ -84,7 +84,7 @@ void game_copy_pose(bPose **dst, bPose *src, int copy_constraint) return; } else if (*dst==src) { - printf("copy_pose source and target are the same\n"); + printf("BKE_pose_copy_data source and target are the same\n"); *dst=NULL; return; } @@ -129,7 +129,7 @@ void game_copy_pose(bPose **dst, bPose *src, int copy_constraint) BLI_ghash_free(ghash, NULL, NULL); // set acceleration structure for channel lookup - make_pose_channels_hash(out); + BKE_pose_channels_hash_make(out); *dst=out; } @@ -200,7 +200,7 @@ void game_free_pose(bPose *pose) { if (pose) { /* free pose-channels and constraints */ - free_pose_channels(pose); + BKE_pose_channels_free(pose); /* free IK solver state */ BIK_clear_data(pose); @@ -225,7 +225,7 @@ BL_ArmatureObject::BL_ArmatureObject( m_poseChannels(), m_objArma(armature), m_framePose(NULL), - m_scene(scene), // maybe remove later. needed for where_is_pose + m_scene(scene), // maybe remove later. needed for BKE_pose_where_is m_lastframe(0.0), m_timestep(0.040), m_activeAct(NULL), @@ -477,7 +477,7 @@ void BL_ArmatureObject::ApplyPose() } // update ourself UpdateBlenderObjectMatrix(m_objArma); - where_is_pose(m_scene, m_objArma); // XXX + BKE_pose_where_is(m_scene, m_objArma); // XXX // restore ourself memcpy(m_objArma->obmat, m_obmat, sizeof(m_obmat)); // restore active targets @@ -590,7 +590,7 @@ bool BL_ArmatureObject::GetBoneMatrix(Bone* bone, MT_Matrix4x4& matrix) bPoseChannel *pchan; ApplyPose(); - pchan = get_pose_channel(m_objArma->pose, bone->name); + pchan = BKE_pose_channel_find_name(m_objArma->pose, bone->name); if (pchan) matrix.setValue(&pchan->pose_mat[0][0]); RestorePose(); diff --git a/source/gameengine/Converter/BL_ArmatureObject.h b/source/gameengine/Converter/BL_ArmatureObject.h index a6848cf57df..ced6b94e6fd 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.h +++ b/source/gameengine/Converter/BL_ArmatureObject.h @@ -132,7 +132,7 @@ protected: struct bPose *m_pose; struct bPose *m_armpose; struct bPose *m_framePose; - struct Scene *m_scene; // need for where_is_pose + struct Scene *m_scene; // need for BKE_pose_where_is double m_lastframe; double m_timestep; // delta since last pose evaluation. class BL_ActionActuator *m_activeAct; diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index ad232818c33..14362cd8f06 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -188,7 +188,7 @@ extern "C" { #endif //XXX #include "BSE_headerbuttons.h" //XXX void update_for_newframe(); -//void scene_update_for_newframe(struct Scene *sce, unsigned int lay); +//void BKE_scene_update_for_newframe(struct Scene *sce, unsigned int lay); //#include "BKE_ipo.h" //void do_all_data_ipos(void); #ifdef __cplusplus @@ -2613,7 +2613,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, case PARBONE: { // parent this to a bone - Bone *parent_bone = get_named_bone( (bArmature *)(blenderchild->parent)->data, blenderchild->parsubstr); + Bone *parent_bone = BKE_armature_find_bone_name( (bArmature *)(blenderchild->parent)->data, blenderchild->parsubstr); if (parent_bone) { KX_BoneParentRelation *bone_parent_relation = KX_BoneParentRelation::New(parent_bone); diff --git a/source/gameengine/Converter/BL_ShapeDeformer.cpp b/source/gameengine/Converter/BL_ShapeDeformer.cpp index bb3636881ea..b93d731c5e6 100644 --- a/source/gameengine/Converter/BL_ShapeDeformer.cpp +++ b/source/gameengine/Converter/BL_ShapeDeformer.cpp @@ -77,7 +77,7 @@ BL_ShapeDeformer::BL_ShapeDeformer(BL_DeformableGameObject *gameobj, m_lastShapeUpdate(-1) { m_key = m_bmesh->key; - m_bmesh->key = copy_key(m_key); + m_bmesh->key = BKE_key_copy(m_key); }; /* this second constructor is needed for making a mesh deformable on the fly. */ @@ -94,14 +94,14 @@ BL_ShapeDeformer::BL_ShapeDeformer(BL_DeformableGameObject *gameobj, m_lastShapeUpdate(-1) { m_key = m_bmesh->key; - m_bmesh->key = copy_key(m_key); + m_bmesh->key = BKE_key_copy(m_key); }; BL_ShapeDeformer::~BL_ShapeDeformer() { if (m_key && m_bmesh->key && m_key != m_bmesh->key) { - free_key(m_bmesh->key); + BKE_key_free(m_bmesh->key); BLI_remlink_safe(&G.main->key, m_bmesh->key); MEM_freeN(m_bmesh->key); m_bmesh->key = m_key; diff --git a/source/gameengine/Converter/BL_SkinDeformer.cpp b/source/gameengine/Converter/BL_SkinDeformer.cpp index 2aa97370330..ab275fa773a 100644 --- a/source/gameengine/Converter/BL_SkinDeformer.cpp +++ b/source/gameengine/Converter/BL_SkinDeformer.cpp @@ -230,7 +230,7 @@ void BL_SkinDeformer::BGEDeformVerts() dg; ++i, dg=(bDeformGroup*)dg->next) { - m_dfnrToPC[i] = get_pose_channel(par_arma->pose, dg->name); + m_dfnrToPC[i] = BKE_pose_channel_find_name(par_arma->pose, dg->name); if (m_dfnrToPC[i] && m_dfnrToPC[i]->bone->flag & BONE_NO_DEFORM) m_dfnrToPC[i] = NULL; diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index df6be142b30..b62e667c211 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -88,8 +88,8 @@ extern "C" #include "BKE_global.h" #include "BKE_animsys.h" #include "BKE_library.h" -#include "BKE_material.h" // copy_material -#include "BKE_mesh.h" // copy_mesh +#include "BKE_material.h" // BKE_material_copy +#include "BKE_mesh.h" // BKE_mesh_copy #include "DNA_space_types.h" #include "DNA_anim_types.h" #include "RNA_define.h" @@ -1409,7 +1409,7 @@ RAS_MeshObject *KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene* kx_scene, /* Watch this!, if its used in the original scene can cause big troubles */ if (me->us > 0) { printf("Mesh has a user \"%s\"\n", name); - me = (ID*)copy_mesh((Mesh*)me); + me = (ID*)BKE_mesh_copy((Mesh*)me); me->us--; } BLI_remlink(&m_maggie->mesh, me); /* even if we made the copy it needs to be removed */ @@ -1433,7 +1433,7 @@ RAS_MeshObject *KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene* kx_scene, if (mat_old && (mat_old->id.flag & LIB_DOIT)==0) { Material *mat_old= mesh->mat[i]; - Material *mat_new= copy_material( mat_old ); + Material *mat_new= BKE_material_copy( mat_old ); mat_new->id.flag |= LIB_DOIT; mat_old->id.us--; diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index b5e165a58ec..9e072f2de3a 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -870,7 +870,7 @@ int main(int argc, char** argv) if (domeWarp) { //XXX to do: convert relative to absolute path - domeText= add_text(domeWarp, ""); + domeText= BKE_text_load(domeWarp, ""); if (!domeText) printf("error: invalid warpdata text file - %s\n", domeWarp); else |