svn merge ^/trunk/blender -r42778:42839

This commit is contained in:
Campbell Barton 2011-12-23 08:41:53 +00:00
commit 4ced91da47
116 changed files with 2071 additions and 737 deletions

@ -1480,3 +1480,640 @@ Added
* :class:`bpy.types.SceneGameData.restrict_animation_updates`
* :class:`bpy.types.SceneGameData.show_obstacle_simulation`
2.60 to 2.61
============
bpy.types.BlendDataGroups
-------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataGroups.is_updated`
bpy.types.BlendDataBrushes
--------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataBrushes.is_updated`
bpy.types.Theme
---------------
Added
^^^^^
* :class:`bpy.types.Theme.clip_editor`
bpy.types.BlendData
-------------------
Added
^^^^^
* :class:`bpy.types.BlendData.movieclips`
bpy.types.BlendDataGreasePencils
--------------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataGreasePencils.is_updated`
bpy.types.BlendDataImages
-------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataImages.is_updated`
bpy.types.CompositorNodes
-------------------------
Added
^^^^^
* :class:`bpy.types.CompositorNodes.clear`
bpy.types.BlendDataScenes
-------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataScenes.is_updated`
bpy.types.RenderEngine
----------------------
Added
^^^^^
* :class:`bpy.types.RenderEngine.bl_use_shading_nodes`
* :class:`bpy.types.RenderEngine.is_animation`
* :class:`bpy.types.RenderEngine.is_preview`
* :class:`bpy.types.RenderEngine.tag_redraw`
* :class:`bpy.types.RenderEngine.tag_update`
* :class:`bpy.types.RenderEngine.update`
* :class:`bpy.types.RenderEngine.update_progress`
* :class:`bpy.types.RenderEngine.view_draw`
* :class:`bpy.types.RenderEngine.view_update`
bpy.types.BackgroundImage
-------------------------
Added
^^^^^
* :class:`bpy.types.BackgroundImage.clip`
* :class:`bpy.types.BackgroundImage.clip_user`
* :class:`bpy.types.BackgroundImage.show_background_image`
* :class:`bpy.types.BackgroundImage.source`
* :class:`bpy.types.BackgroundImage.use_camera_clip`
bpy.types.BlendDataMetaBalls
----------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataMetaBalls.is_updated`
bpy.types.SpaceTimeline
-----------------------
Added
^^^^^
* :class:`bpy.types.SpaceTimeline.cache_dynamicpaint`
bpy.types.BlendDataMeshes
-------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataMeshes.is_updated`
bpy.types.BlendDataNodeTrees
----------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataNodeTrees.is_updated`
bpy.types.RenderSettings
------------------------
Added
^^^^^
* :class:`bpy.types.RenderSettings.image_settings`
* :class:`bpy.types.RenderSettings.use_shading_nodes`
Removed
^^^^^^^
* **cineon_black**
* **cineon_gamma**
* **cineon_white**
* **color_mode**
* **exr_codec**
* **exr_preview**
* **exr_zbuf**
* **file_format**
* **file_quality**
* **jpeg2k_depth**
* **jpeg2k_preset**
* **jpeg2k_ycc**
* **use_cineon_log**
* **use_exr_half**
* **use_tiff_16bit**
bpy.types.Curve
---------------
Added
^^^^^
* :class:`bpy.types.Curve.cycles`
bpy.types.RegionView3D
----------------------
Added
^^^^^
* :class:`bpy.types.RegionView3D.view_camera_offset`
* :class:`bpy.types.RegionView3D.view_camera_zoom`
bpy.types.Scene
---------------
Added
^^^^^
* :class:`bpy.types.Scene.active_clip`
* :class:`bpy.types.Scene.cycles`
bpy.types.NodeLinks
-------------------
Added
^^^^^
* :class:`bpy.types.NodeLinks.clear`
bpy.types.BlendDataLattices
---------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataLattices.is_updated`
bpy.types.BlendDataParticles
----------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataParticles.is_updated`
bpy.types.BlendDataWorlds
-------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataWorlds.is_updated`
bpy.types.ObjectConstraints
---------------------------
Added
^^^^^
* :class:`bpy.types.ObjectConstraints.clear`
bpy.types.RenderLayers
----------------------
Added
^^^^^
* :class:`bpy.types.RenderLayers.new`
* :class:`bpy.types.RenderLayers.remove`
bpy.types.Menu
--------------
Added
^^^^^
* :class:`bpy.types.Menu.bl_description`
bpy.types.Lamp
--------------
Added
^^^^^
* :class:`bpy.types.Lamp.cycles`
* :class:`bpy.types.Lamp.node_tree`
* :class:`bpy.types.Lamp.use_nodes`
bpy.types.CurveSplines
----------------------
Added
^^^^^
* :class:`bpy.types.CurveSplines.clear`
bpy.types.Screen
----------------
Added
^^^^^
* :class:`bpy.types.Screen.use_play_clip_editors`
bpy.types.BlendDataActions
--------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataActions.is_updated`
bpy.types.BlendDataSounds
-------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataSounds.is_updated`
bpy.types.Object
----------------
Added
^^^^^
* :class:`bpy.types.Object.cycles_visibility`
* :class:`bpy.types.Object.slow_parent_offset`
Removed
^^^^^^^
* **time_offset**
* **use_time_offset_add_parent**
* **use_time_offset_edit**
* **use_time_offset_parent**
* **use_time_offset_particle**
bpy.types.ObjectModifiers
-------------------------
Added
^^^^^
* :class:`bpy.types.ObjectModifiers.clear`
bpy.types.BlendDataMaterials
----------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataMaterials.is_updated`
bpy.types.MetaBallElements
--------------------------
Added
^^^^^
* :class:`bpy.types.MetaBallElements.clear`
bpy.types.NodeSocket
--------------------
Added
^^^^^
* :class:`bpy.types.NodeSocket.group_socket`
* :class:`bpy.types.NodeSocket.show_expanded`
bpy.types.Node
--------------
Added
^^^^^
* :class:`bpy.types.Node.show_texture`
bpy.types.CompositorNodeOutputFile
----------------------------------
Added
^^^^^
* :class:`bpy.types.CompositorNodeOutputFile.image_settings`
Removed
^^^^^^^
* **exr_codec**
* **image_type**
* **quality**
* **use_exr_half**
bpy.types.BlendDataTexts
------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataTexts.is_updated`
bpy.types.ThemeView3D
---------------------
Added
^^^^^
* :class:`bpy.types.ThemeView3D.bundle_solid`
* :class:`bpy.types.ThemeView3D.camera_path`
bpy.types.Event
---------------
Added
^^^^^
* :class:`bpy.types.Event.unicode`
bpy.types.VertexGroups
----------------------
Added
^^^^^
* :class:`bpy.types.VertexGroups.clear`
bpy.types.TexMapping
--------------------
Added
^^^^^
* :class:`bpy.types.TexMapping.mapping`
* :class:`bpy.types.TexMapping.mapping_x`
* :class:`bpy.types.TexMapping.mapping_y`
* :class:`bpy.types.TexMapping.mapping_z`
bpy.types.BlendDataObjects
--------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataObjects.is_updated`
bpy.types.BlendDataCurves
-------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataCurves.is_updated`
bpy.types.BlendDataLibraries
----------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataLibraries.is_updated`
bpy.types.ThemeUserInterface
----------------------------
Added
^^^^^
* :class:`bpy.types.ThemeUserInterface.icon_alpha`
* :class:`bpy.types.ThemeUserInterface.panel`
bpy.types.SpaceNodeEditor
-------------------------
Added
^^^^^
* :class:`bpy.types.SpaceNodeEditor.shader_type`
bpy.types.SpaceView3D
---------------------
Added
^^^^^
* :class:`bpy.types.SpaceView3D.show_bundle_names`
* :class:`bpy.types.SpaceView3D.show_camera_path`
* :class:`bpy.types.SpaceView3D.show_reconstruction`
* :class:`bpy.types.SpaceView3D.tracks_draw_size`
* :class:`bpy.types.SpaceView3D.tracks_draw_type`
bpy.types.BlendDataWindowManagers
---------------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataWindowManagers.is_updated`
bpy.types.BlendDataScreens
--------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataScreens.is_updated`
bpy.types.BlendDataArmatures
----------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataArmatures.is_updated`
bpy.types.UserPreferencesInput
------------------------------
Added
^^^^^
* :class:`bpy.types.UserPreferencesInput.tweak_threshold`
Removed
^^^^^^^
* **ndof_orbit_invert_axes**
bpy.types.Mesh
--------------
Added
^^^^^
* :class:`bpy.types.Mesh.cycles`
bpy.types.BlendDataCameras
--------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataCameras.is_updated`
bpy.types.MetaBall
------------------
Added
^^^^^
* :class:`bpy.types.MetaBall.cycles`
bpy.types.UILayout
------------------
Added
^^^^^
* :class:`bpy.types.UILayout.template_image_settings`
* :class:`bpy.types.UILayout.template_marker`
* :class:`bpy.types.UILayout.template_movieclip`
* :class:`bpy.types.UILayout.template_node_link`
* :class:`bpy.types.UILayout.template_node_view`
* :class:`bpy.types.UILayout.template_texture_user`
* :class:`bpy.types.UILayout.template_track`
Function Arguments
^^^^^^^^^^^^^^^^^^
* :class:`bpy.types.UILayout.template_list` (data, property, active_data, active_property, prop_list, rows, maxrows, type), *was (data, property, active_data, active_property, rows, maxrows, type)*
bpy.types.ID
------------
Added
^^^^^
* :class:`bpy.types.ID.is_updated`
* :class:`bpy.types.ID.is_updated_data`
bpy.types.World
---------------
Added
^^^^^
* :class:`bpy.types.World.cycles`
* :class:`bpy.types.World.node_tree`
* :class:`bpy.types.World.use_nodes`
bpy.types.BlendDataTextures
---------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataTextures.is_updated`
bpy.types.ShaderNodes
---------------------
Added
^^^^^
* :class:`bpy.types.ShaderNodes.clear`
bpy.types.TimelineMarkers
-------------------------
Added
^^^^^
* :class:`bpy.types.TimelineMarkers.clear`
bpy.types.SpaceFileBrowser
--------------------------
Added
^^^^^
* :class:`bpy.types.SpaceFileBrowser.active_operator`
bpy.types.Material
------------------
Added
^^^^^
* :class:`bpy.types.Material.cycles`
bpy.types.BlendDataSpeakers
---------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataSpeakers.is_updated`
bpy.types.Camera
----------------
Added
^^^^^
* :class:`bpy.types.Camera.angle_x`
* :class:`bpy.types.Camera.angle_y`
* :class:`bpy.types.Camera.cycles`
* :class:`bpy.types.Camera.sensor_fit`
* :class:`bpy.types.Camera.sensor_height`
* :class:`bpy.types.Camera.sensor_width`
* :class:`bpy.types.Camera.show_sensor`
bpy.types.BlendDataLamps
------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataLamps.is_updated`
bpy.types.TextureNodes
----------------------
Added
^^^^^
* :class:`bpy.types.TextureNodes.clear`
bpy.types.BlendDataFonts
------------------------
Added
^^^^^
* :class:`bpy.types.BlendDataFonts.is_updated`

@ -121,7 +121,9 @@ void AUD_SoftwareDevice::AUD_SoftwareHandle::update()
if(flags & AUD_RENDER_DISTANCE)
{
if(m_device->m_distance_model == AUD_DISTANCE_MODEL_INVERSE_CLAMPED || m_device->m_distance_model == AUD_DISTANCE_MODEL_LINEAR_CLAMPED || m_device->m_distance_model == AUD_DISTANCE_MODEL_EXPONENT_CLAMPED)
if(m_device->m_distance_model == AUD_DISTANCE_MODEL_INVERSE_CLAMPED ||
m_device->m_distance_model == AUD_DISTANCE_MODEL_LINEAR_CLAMPED ||
m_device->m_distance_model == AUD_DISTANCE_MODEL_EXPONENT_CLAMPED)
{
distance = AUD_MAX(AUD_MIN(m_distance_max, distance), m_distance_reference);
}

@ -82,9 +82,9 @@ static void session_print_status()
session_print(status);
}
static BufferParams session_buffer_params()
static BufferParams& session_buffer_params()
{
BufferParams buffer_params;
static BufferParams buffer_params;
buffer_params.width = options.width;
buffer_params.height = options.height;
buffer_params.full_width = options.width;

@ -258,7 +258,6 @@ static void xml_read_integrator(const XMLReadState& state, pugi::xml_node node)
xml_read_int(&integrator->min_bounce, node, "min_bounce");
xml_read_int(&integrator->max_bounce, node, "max_bounce");
xml_read_bool(&integrator->no_caustics, node, "no_caustics");
xml_read_float(&integrator->blur_caustics, node, "blur_caustics");
}
/* Camera */

@ -160,18 +160,17 @@ class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
scene = context.scene
rd = scene.render
# row = layout.row()
# row.template_list(rd, "layers", rd.layers, "active_index", rows=2)
row = layout.row()
row.template_list(rd, "layers", rd.layers, "active_index", rows=2)
# col = row.column(align=True)
# col.operator("scene.render_layer_add", icon='ZOOMIN', text="")
# col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="")
col = row.column(align=True)
col.operator("scene.render_layer_add", icon='ZOOMIN', text="")
col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="")
row = layout.row()
# rl = rd.layers.active
rl = rd.layers[0]
rl = rd.layers.active
row.prop(rl, "name")
#row.prop(rd, "use_single_layer", text="", icon_only=True)
row.prop(rd, "use_single_layer", text="", icon_only=True)
split = layout.split()
@ -183,6 +182,7 @@ class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
layout.separator()
rl = rd.layers[0]
layout.prop(rl, "material_override", text="Material")
@ -745,6 +745,12 @@ def get_panels():
bpy.types.RENDER_PT_encoding,
bpy.types.RENDER_PT_dimensions,
bpy.types.RENDER_PT_stamp,
bpy.types.SCENE_PT_scene,
bpy.types.SCENE_PT_audio,
bpy.types.SCENE_PT_unit,
bpy.types.SCENE_PT_keying_sets,
bpy.types.SCENE_PT_keying_set_paths,
bpy.types.SCENE_PT_physics,
bpy.types.WORLD_PT_context_world,
bpy.types.DATA_PT_context_mesh,
bpy.types.DATA_PT_context_camera,

@ -232,8 +232,10 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated)
BL::Object::material_slots_iterator slot;
for(b_ob.material_slots.begin(slot); slot != b_ob.material_slots.end(); ++slot) {
if(render_layer.material_override)
find_shader(render_layer.material_override, used_shaders, scene->default_surface);
BL::Material material_override = render_layers.front().material_override;
if(material_override)
find_shader(material_override, used_shaders, scene->default_surface);
else
find_shader(slot->material(), used_shaders, scene->default_surface);
}

@ -154,7 +154,7 @@ void BlenderSync::sync_light(BL::Object b_parent, int b_index, BL::Object b_ob,
/* Object */
void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm, uint visibility)
void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm, uint layer_flag)
{
/* light is handled separately */
if(object_is_light(b_ob)) {
@ -182,10 +182,18 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob,
object->name = b_ob.name().c_str();
object->tfm = tfm;
object->visibility = object_ray_visibility(b_ob) & visibility;
/* visibility flags for both parent */
object->visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL;
if(b_parent.ptr.data != b_ob.ptr.data)
object->visibility &= object_ray_visibility(b_parent);
/* camera flag is not actually used, instead is tested
against render layer flags */
if(object->visibility & PATH_RAY_CAMERA) {
object->visibility |= layer_flag << PATH_RAY_LAYER_SHIFT;
object->visibility &= ~PATH_RAY_CAMERA;
}
object->tag_update(scene);
}
}
@ -195,8 +203,7 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob,
void BlenderSync::sync_objects(BL::SpaceView3D b_v3d)
{
/* layer data */
uint scene_layer = render_layer.scene_layer;
uint layer = render_layer.layer;
uint scene_layer = render_layers.front().scene_layer;
/* prepare for sync */
light_map.pre_sync();
@ -212,11 +219,6 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d)
uint ob_layer = get_layer(b_ob->layers());
if(!hide && (ob_layer & scene_layer)) {
uint visibility = PATH_RAY_ALL;
if(!(ob_layer & layer))
visibility &= ~PATH_RAY_CAMERA;
if(b_ob->is_duplicator()) {
/* dupli objects */
object_create_duplilist(*b_ob, b_scene);
@ -226,7 +228,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d)
for(b_ob->dupli_list.begin(b_dup); b_dup != b_ob->dupli_list.end(); ++b_dup) {
Transform tfm = get_transform(b_dup->matrix());
sync_object(*b_ob, b_index, b_dup->object(), tfm, visibility);
sync_object(*b_ob, b_index, b_dup->object(), tfm, ob_layer);
b_index++;
}
@ -244,7 +246,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d)
if(!hide) {
/* object itself */
Transform tfm = get_transform(b_ob->matrix_world());
sync_object(*b_ob, 0, *b_ob, tfm, visibility);
sync_object(*b_ob, 0, *b_ob, tfm, ob_layer);
}
}
}

@ -40,7 +40,8 @@
CCL_NAMESPACE_BEGIN
BlenderSession::BlenderSession(BL::RenderEngine b_engine_, BL::BlendData b_data_, BL::Scene b_scene_)
: b_engine(b_engine_), b_data(b_data_), b_scene(b_scene_), b_v3d(PointerRNA_NULL), b_rv3d(PointerRNA_NULL)
: b_engine(b_engine_), b_data(b_data_), b_scene(b_scene_), b_v3d(PointerRNA_NULL), b_rv3d(PointerRNA_NULL),
b_rr(PointerRNA_NULL), b_rlay(PointerRNA_NULL)
{
/* offline render */
BL::RenderSettings r = b_scene.render();
@ -55,7 +56,8 @@ BlenderSession::BlenderSession(BL::RenderEngine b_engine_, BL::BlendData b_data_
BlenderSession::BlenderSession(BL::RenderEngine b_engine_, BL::BlendData b_data_, BL::Scene b_scene_,
BL::SpaceView3D b_v3d_, BL::RegionView3D b_rv3d_, int width_, int height_)
: b_engine(b_engine_), b_data(b_data_), b_scene(b_scene_), b_v3d(b_v3d_), b_rv3d(b_rv3d_)
: b_engine(b_engine_), b_data(b_data_), b_scene(b_scene_), b_v3d(b_v3d_), b_rv3d(b_rv3d_),
b_rr(PointerRNA_NULL), b_rlay(PointerRNA_NULL)
{
/* 3d view render */
width = width_;
@ -64,6 +66,7 @@ BlenderSession::BlenderSession(BL::RenderEngine b_engine_, BL::BlendData b_data_
last_redraw_time = 0.0f;
create_session();
session->start();
}
BlenderSession::~BlenderSession()
@ -99,11 +102,9 @@ void BlenderSession::create_session()
session->progress.set_cancel_callback(function_bind(&BlenderSession::test_cancel, this));
session->set_pause(BlenderSync::get_session_pause(b_scene, background));
/* start rendering */
/* set buffer parameters */
BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_rv3d, width, height);
session->reset(buffer_params, session_params.samples);
session->start();
}
void BlenderSession::free_session()
@ -114,42 +115,67 @@ void BlenderSession::free_session()
void BlenderSession::render()
{
/* get buffer parameters */
BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_rv3d, width, height);
int w = buffer_params.width, h = buffer_params.height;
/* create render result */
RenderResult *rrp = RE_engine_begin_result((RenderEngine*)b_engine.ptr.data, 0, 0, w, h);
PointerRNA rrptr;
RNA_pointer_create(NULL, &RNA_RenderResult, rrp, &rrptr);
b_rr = BL::RenderResult(rrptr);
BL::RenderSettings r = b_scene.render();
BL::RenderResult::layers_iterator b_iter;
BL::RenderLayers b_rr_layers(r.ptr);
int active = 0;
/* render each layer */
for(b_rr.layers.begin(b_iter); b_iter != b_rr.layers.end(); ++b_iter, ++active) {
/* single layer render */
if(r.use_single_layer())
active = b_rr_layers.active_index();
/* set layer */
b_rlay = *b_iter;
/* update scene */
sync->sync_data(b_v3d, active);
/* render */
session->start();
session->wait();
if(session->progress.get_cancel())
return;
break;
/* write result */
write_render_result();
}
/* delete render result */
RE_engine_end_result((RenderEngine*)b_engine.ptr.data, (RenderResult*)b_rr.ptr.data);
}
void BlenderSession::write_render_result()
{
/* get result */
/* get state */
RenderBuffers *buffers = session->buffers;
float exposure = scene->film->exposure;
double total_time, sample_time;
int sample;
session->progress.get_sample(sample, total_time, sample_time);
/* get pixels */
float4 *pixels = buffers->copy_from_device(exposure, sample);
if(!pixels)
return;
BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_rv3d, width, height);
int w = buffer_params.width, h = buffer_params.height;
struct RenderResult *rrp = RE_engine_begin_result((RenderEngine*)b_engine.ptr.data, 0, 0, w, h);
PointerRNA rrptr;
RNA_pointer_create(NULL, &RNA_RenderResult, rrp, &rrptr);
BL::RenderResult rr(rrptr);
BL::RenderResult::layers_iterator layer;
rr.layers.begin(layer);
rna_RenderLayer_rect_set(&layer->ptr, (float*)pixels);
RE_engine_end_result((RenderEngine*)b_engine.ptr.data, rrp);
/* write pixels */
rna_RenderLayer_rect_set(&b_rlay.ptr, (float*)pixels);
RE_engine_update_result((RenderEngine*)b_engine.ptr.data, (RenderResult*)b_rr.ptr.data);
delete [] pixels;
}
@ -164,6 +190,7 @@ void BlenderSession::synchronize()
scene->params.modified(scene_params)) {
free_session();
create_session();
session->start();
return;
}

@ -69,6 +69,8 @@ public:
BL::Scene b_scene;
BL::SpaceView3D b_v3d;
BL::RegionView3D b_rv3d;
BL::RenderResult b_rr;
BL::RenderLayer b_rlay;
string last_status;
float last_progress;

@ -48,7 +48,8 @@ BlenderSync::BlenderSync(BL::BlendData b_data_, BL::Scene b_scene_, Scene *scene
light_map(&scene_->lights),
world_map(NULL),
world_recalc(false),
experimental(false)
experimental(false),
active_layer(0)
{
scene = scene_;
preview = preview_;
@ -120,18 +121,18 @@ bool BlenderSync::sync_recalc()
return recalc;
}
void BlenderSync::sync_data(BL::SpaceView3D b_v3d)
void BlenderSync::sync_data(BL::SpaceView3D b_v3d, int layer)
{
sync_integrator();
sync_render_layers(b_v3d);
sync_integrator(layer);
sync_film();
sync_render_layer(b_v3d);
sync_shaders();
sync_objects(b_v3d);
}
/* Integrator */
void BlenderSync::sync_integrator()
void BlenderSync::sync_integrator(int layer)
{
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
@ -152,9 +153,8 @@ void BlenderSync::sync_integrator()
integrator->transparent_shadows = get_boolean(cscene, "use_transparent_shadows");
integrator->no_caustics = get_boolean(cscene, "no_caustics");
integrator->blur_caustics = get_float(cscene, "blur_caustics");
integrator->seed = get_int(cscene, "seed");
integrator->layer_flag = render_layers[layer].layer;
if(integrator->modified(previntegrator))
integrator->tag_update(scene);
@ -186,27 +186,32 @@ void BlenderSync::sync_film()
/* Render Layer */
void BlenderSync::sync_render_layer(BL::SpaceView3D b_v3d)
void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d)
{
render_layers.clear();
if(b_v3d) {
render_layer.scene_layer = get_layer(b_v3d.layers());
render_layer.layer = render_layer.scene_layer;
render_layer.material_override = PointerRNA_NULL;
RenderLayerInfo rlay;
rlay.scene_layer = get_layer(b_v3d.layers());
rlay.layer = rlay.scene_layer;
rlay.material_override = PointerRNA_NULL;
render_layers.push_back(rlay);
}
else {
BL::RenderSettings r = b_scene.render();
BL::RenderSettings::layers_iterator b_rlay;
bool first = true;
for(r.layers.begin(b_rlay); b_rlay != r.layers.end(); ++b_rlay) {
/* single layer for now */
if(first) {
render_layer.scene_layer = get_layer(b_scene.layers());
render_layer.layer = get_layer(b_rlay->layers());
render_layer.material_override = b_rlay->material_override();
RenderLayerInfo rlay;
first = false;
}
rlay.scene_layer = get_layer(b_scene.layers());
rlay.layer = get_layer(b_rlay->layers());
rlay.material_override = b_rlay->material_override();
render_layers.push_back(rlay);
}
}
}

@ -54,7 +54,7 @@ public:
/* sync */
bool sync_recalc();
void sync_data(BL::SpaceView3D b_v3d);
void sync_data(BL::SpaceView3D b_v3d, int layer = 0);
void sync_camera(int width, int height);
void sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height);
@ -70,15 +70,15 @@ private:
void sync_materials();
void sync_objects(BL::SpaceView3D b_v3d);
void sync_film();
void sync_integrator();
void sync_integrator(int layer);
void sync_view();
void sync_world();
void sync_render_layer(BL::SpaceView3D b_v3d);
void sync_render_layers(BL::SpaceView3D b_v3d);
void sync_shaders();
void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree);
Mesh *sync_mesh(BL::Object b_ob, bool object_updated);
void sync_object(BL::Object b_parent, int b_index, BL::Object b_object, Transform& tfm, uint visibility);
void sync_object(BL::Object b_parent, int b_index, BL::Object b_object, Transform& tfm, uint layer_flag);
void sync_light(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm);
/* util */
@ -112,7 +112,10 @@ private:
uint scene_layer;
uint layer;
BL::Material material_override;
} render_layer;
};
vector<RenderLayerInfo> render_layers;
int active_layer;
};
CCL_NAMESPACE_END

@ -130,13 +130,16 @@ __device_inline void path_state_next(KernelGlobals *kg, PathState *state, int la
}
}
__device_inline uint path_state_ray_visibility(PathState *state)
__device_inline uint path_state_ray_visibility(KernelGlobals *kg, PathState *state)
{
uint flag = state->flag;
/* for visibility, diffuse/glossy are for reflection only */
if(flag & PATH_RAY_TRANSMIT)
flag &= ~(PATH_RAY_DIFFUSE|PATH_RAY_GLOSSY);
/* for camera visibility, use render layer flags */
if(flag & PATH_RAY_CAMERA)
flag |= kernel_data.integrator.layer_flag;
return flag;
}
@ -249,7 +252,7 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R
for(;; rng_offset += PRNG_BOUNCE_NUM) {
/* intersect scene */
Intersection isect;
uint visibility = path_state_ray_visibility(&state);
uint visibility = path_state_ray_visibility(kg, &state);
if(!scene_intersect(kg, &ray, visibility, &isect)) {
/* eval background shader if nothing hit */

@ -100,7 +100,10 @@ enum PathTraceDimension {
/* these flag values correspond exactly to OSL defaults, so be careful not to
* change this, or if you do, set the "raytypes" shading system attribute with
* your own new ray types and bitflag values */
* your own new ray types and bitflag values.
*
* for ray visibility tests in BVH traversal, the upper 20 bits are used for
* layer visibility tests. */
enum PathRayFlag {
PATH_RAY_CAMERA = 1,
@ -117,7 +120,9 @@ enum PathRayFlag {
PATH_RAY_MIS_SKIP = 512,
PATH_RAY_ALL = (1|2|4|8|16|32|64|128|256|512)
PATH_RAY_ALL = (1|2|4|8|16|32|64|128|256|512),
PATH_RAY_LAYER_SHIFT = (32-20)
};
/* Closure Label */
@ -383,10 +388,12 @@ typedef struct KernelIntegrator {
/* caustics */
int no_caustics;
float blur_caustics;
/* seed */
int seed;
/* render layer */
int layer_flag;
} KernelIntegrator;
typedef struct KernelBVH {

@ -56,6 +56,12 @@ public:
full_height = 0;
}
void get_offset_stride(int& offset, int& stride)
{
offset = -(full_x + full_y*width);
stride = width;
}
bool modified(const BufferParams& params)
{
return !(full_x == params.full_x

@ -41,9 +41,8 @@ Integrator::Integrator()
transparent_shadows = false;
no_caustics = false;
blur_caustics = 0.0f;
seed = 0;
layer_flag = ~0;
need_update = true;
}
@ -81,9 +80,8 @@ void Integrator::device_update(Device *device, DeviceScene *dscene)
kintegrator->transparent_shadows = transparent_shadows;
kintegrator->no_caustics = no_caustics;
kintegrator->blur_caustics = blur_caustics;
kintegrator->seed = hash_int(seed);
kintegrator->layer_flag = layer_flag << PATH_RAY_LAYER_SHIFT;
/* sobol directions table */
int dimensions = PRNG_BASE_NUM + (max_bounce + transparent_max_bounce + 2)*PRNG_BOUNCE_NUM;
@ -115,7 +113,7 @@ bool Integrator::modified(const Integrator& integrator)
transparent_probalistic == integrator.transparent_probalistic &&
transparent_shadows == integrator.transparent_shadows &&
no_caustics == integrator.no_caustics &&
blur_caustics == integrator.blur_caustics &&
layer_flag == integrator.layer_flag &&
seed == integrator.seed);
}

@ -41,9 +41,9 @@ public:
bool transparent_shadows;
bool no_caustics;
float blur_caustics;
int seed;
int layer_flag;
bool need_update;

@ -515,10 +515,8 @@ void Session::update_scene()
knows nothing about progressive or cropped rendering, it just gets the
image dimensions passed in */
Camera *cam = scene->camera;
float progressive_x = tile_manager.state.width/(float)tile_manager.params.width;
float progressive_y = tile_manager.state.height/(float)tile_manager.params.height;
int width = tile_manager.params.full_width*progressive_x;
int height = tile_manager.params.full_height*progressive_y;
int width = tile_manager.state.buffer.full_width;
int height = tile_manager.state.buffer.full_height;
if(width != cam->width || height != cam->height) {
cam->width = width;
@ -574,16 +572,15 @@ void Session::path_trace(Tile& tile)
/* add path trace task */
DeviceTask task(DeviceTask::PATH_TRACE);
task.x = tile_manager.state.full_x + tile.x;
task.y = tile_manager.state.full_y + tile.y;
task.x = tile_manager.state.buffer.full_x + tile.x;
task.y = tile_manager.state.buffer.full_y + tile.y;
task.w = tile.w;
task.h = tile.h;
task.buffer = buffers->buffer.device_pointer;
task.rng_state = buffers->rng_state.device_pointer;
task.sample = tile_manager.state.sample;
task.resolution = tile_manager.state.resolution;
task.offset = -(tile_manager.state.full_x + tile_manager.state.full_y*tile_manager.state.width);
task.stride = tile_manager.state.width;
tile_manager.state.buffer.get_offset_stride(task.offset, task.stride);
device->task_add(task);
}
@ -593,16 +590,15 @@ void Session::tonemap()
/* add tonemap task */
DeviceTask task(DeviceTask::TONEMAP);
task.x = tile_manager.state.full_x;
task.y = tile_manager.state.full_y;
task.w = tile_manager.state.width;
task.h = tile_manager.state.height;
task.x = tile_manager.state.buffer.full_x;
task.y = tile_manager.state.buffer.full_y;
task.w = tile_manager.state.buffer.width;
task.h = tile_manager.state.buffer.height;
task.rgba = display->rgba.device_pointer;
task.buffer = buffers->buffer.device_pointer;
task.sample = tile_manager.state.sample;
task.resolution = tile_manager.state.resolution;
task.offset = -(tile_manager.state.full_x + tile_manager.state.full_y*tile_manager.state.width);
task.stride = tile_manager.state.width;
tile_manager.state.buffer.get_offset_stride(task.offset, task.stride);
if(task.w > 0 && task.h > 0) {
device->task_add(task);

@ -55,10 +55,7 @@ void TileManager::reset(BufferParams& params_, int samples_)
samples = samples_;
state.full_x = 0;
state.full_y = 0;
state.width = 0;
state.height = 0;
state.buffer = BufferParams();
state.sample = -1;
state.resolution = start_resolution;
state.tiles.clear();
@ -92,10 +89,13 @@ void TileManager::set_tiles()
}
}
state.full_x = params.full_x/resolution;
state.full_y = params.full_y/resolution;
state.width = image_w;
state.height = image_h;
state.buffer.width = image_w;
state.buffer.height = image_h;
state.buffer.full_x = params.full_x/resolution;
state.buffer.full_y = params.full_y/resolution;
state.buffer.full_width = max(1, params.full_width/resolution);
state.buffer.full_height = max(1, params.full_height/resolution);
}
bool TileManager::done()

@ -41,11 +41,9 @@ public:
class TileManager {
public:
BufferParams params;
struct State {
int full_x;
int full_y;
int width;
int height;
BufferParams buffer;
int sample;
int resolution;
list<Tile> tiles;

@ -225,11 +225,12 @@ void IK_SetStiffness(IK_Segment *seg, IK_SegmentAxis axis, float stiffness)
void IK_GetBasisChange(IK_Segment *seg, float basis_change[][3])
{
IK_QSegment *qseg = (IK_QSegment*)seg;
const MT_Matrix3x3& change = qseg->BasisChange();
if (qseg->Translational() && qseg->Composite())
qseg = qseg->Composite();
const MT_Matrix3x3& change = qseg->BasisChange();
// convert from moto row major to blender column major
basis_change[0][0] = (float)change[0][0];
basis_change[1][0] = (float)change[0][1];

@ -1350,7 +1350,6 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con
for(s=0; s<iUniqueSubGroups; s++)
free(pUniSubGroups[s].pTriMembers);
iUniqueTspaces += iUniqueSubGroups;
iUniqueSubGroups = 0;
}
// clean up

@ -1137,7 +1137,7 @@ static NLboolean __nlInvert_SUPERLU(__NLContext *context) {
/* SuperLU variables */
SuperMatrix B;
NLint info;
NLint info = 0;
for(j=0; j<context->nb_rhs; j++, b+=n, x+=n) {
/* Create superlu array for B */

@ -368,7 +368,7 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
int m, n, bnz, *b_colptr, i;
int delta, maxint, nofsub, *invp;
int *b_rowind, *dhead, *qsize, *llist, *marker;
double t, SuperLU_timer_();
/* double t, SuperLU_timer_(); */
/* make gcc happy */
b_rowind=NULL;
@ -377,7 +377,7 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
m = A->nrow;
n = A->ncol;
t = SuperLU_timer_();
/* t = SuperLU_timer_(); */
switch ( ispec ) {
case 0: /* Natural ordering */
for (i = 0; i < n; ++i) perm_c[i] = i;
@ -391,8 +391,8 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
#if ( PRNTlevel>=1 )
printf("Use minimum degree ordering on A'*A.\n");
#endif
t = SuperLU_timer_() - t;
/*printf("Form A'*A time = %8.3f\n", t);*/
/*t = SuperLU_timer_() - t;
printf("Form A'*A time = %8.3f\n", t);*/
break;
case 2: /* Minimum degree ordering on A'+A */
if ( m != n ) ABORT("Matrix is not square");
@ -401,8 +401,8 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
#if ( PRNTlevel>=1 )
printf("Use minimum degree ordering on A'+A.\n");
#endif
t = SuperLU_timer_() - t;
/*printf("Form A'+A time = %8.3f\n", t);*/
/*t = SuperLU_timer_() - t;
printf("Form A'+A time = %8.3f\n", t);*/
break;
case 3: /* Approximate minimum degree column ordering. */
get_colamd(m, n, Astore->nnz, Astore->colptr, Astore->rowind,
@ -417,7 +417,7 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
}
if ( bnz != 0 ) {
t = SuperLU_timer_();
/* t = SuperLU_timer_(); */
/* Initialize and allocate storage for GENMMD. */
delta = 1; /* DELTA is a parameter to allow the choice of nodes
@ -452,8 +452,8 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
SUPERLU_FREE(llist);
SUPERLU_FREE(marker);
t = SuperLU_timer_() - t;
/* printf("call GENMMD time = %8.3f\n", t);*/
/* t = SuperLU_timer_() - t;
printf("call GENMMD time = %8.3f\n", t);*/
} else { /* Empty adjacency structure */
for (i = 0; i < n; ++i) perm_c[i] = i;

@ -303,7 +303,6 @@ scolumn_bmod (
d_fsupc=0 if fsupc >= fpanelc. */
d_fsupc = fst_col - fsupc;
lptr = xlsub[fsupc] + d_fsupc;
luptr = xlusup[fst_col] + d_fsupc;
nsupr = xlsub[fsupc+1] - xlsub[fsupc]; /* Leading dimension */
nsupc = jcol - fst_col; /* Excluding jcol */

@ -9,9 +9,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
{
/* System generated locals */
int i__1, i__2;
/* Local variables */
static int info;
static float temp;
@ -213,14 +210,12 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
}
} else {
if (*incx == 1) {
i__1 = *n;
for (j = 1; j <= *n; ++j) {
if (X(j) != 0.f) {
if (nounit) {
X(j) /= A(j,j);
}
temp = X(j);
i__2 = *n;
for (i = j + 1; i <= *n; ++i) {
X(i) -= temp * A(i,j);
/* L50: */
@ -230,7 +225,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
}
} else {
jx = kx;
i__1 = *n;
for (j = 1; j <= *n; ++j) {
if (X(jx) != 0.f) {
if (nounit) {
@ -238,7 +232,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
}
temp = X(jx);
ix = jx;
i__2 = *n;
for (i = j + 1; i <= *n; ++i) {
ix += *incx;
X(ix) -= temp * A(i,j);
@ -256,10 +249,8 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
if (lsame_(uplo, "U")) {
if (*incx == 1) {
i__1 = *n;
for (j = 1; j <= *n; ++j) {
temp = X(j);
i__2 = j - 1;
for (i = 1; i <= j-1; ++i) {
temp -= A(i,j) * X(i);
/* L90: */
@ -272,11 +263,9 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
}
} else {
jx = kx;
i__1 = *n;
for (j = 1; j <= *n; ++j) {
temp = X(jx);
ix = kx;
i__2 = j - 1;
for (i = 1; i <= j-1; ++i) {
temp -= A(i,j) * X(ix);
ix += *incx;
@ -294,7 +283,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
if (*incx == 1) {
for (j = *n; j >= 1; --j) {
temp = X(j);
i__1 = j + 1;
for (i = *n; i >= j+1; --i) {
temp -= A(i,j) * X(i);
/* L130: */
@ -311,7 +299,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
for (j = *n; j >= 1; --j) {
temp = X(jx);
ix = kx;
i__1 = j + 1;
for (i = *n; i >= j+1; --i) {
temp -= A(i,j) * X(ix);
ix -= *incx;

@ -370,8 +370,6 @@ void
sFillRHS(trans_t trans, int nrhs, float *x, int ldx,
SuperMatrix *A, SuperMatrix *B)
{
NCformat *Astore;
float *Aval;
DNformat *Bstore;
float *rhs;
float one = 1.0;
@ -379,8 +377,6 @@ sFillRHS(trans_t trans, int nrhs, float *x, int ldx,
int ldc;
char transc[1];
Astore = A->Store;
Aval = (float *) Astore->nzval;
Bstore = B->Store;
rhs = Bstore->nzval;
ldc = Bstore->lda;

@ -24,7 +24,8 @@
#define NUM_TEMPV(m,w,t,b) ( SUPERLU_MAX(m, (t + b)*w) )
#ifndef USER_ABORT
#define USER_ABORT(msg) superlu_abort_and_exit(msg)
#define USER_ABORT(msg) \
{ fprintf(stderr, "%s", msg); exit (-1); }
#endif
#define ABORT(err_msg) \

@ -121,24 +121,24 @@ _axis_convert_matrix = (
((-1.0, 0.0, 0.0), (0.0, 0.0, 1.0), (0.0, 1.0, 0.0)),
((-1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, -1.0)),
((0.0, -1.0, 0.0), (-1.0, 0.0, 0.0), (0.0, 0.0, -1.0)),
((0.0, -1.0, 0.0), (0.0, 0.0, -1.0), (1.0, 0.0, 0.0)),
((0.0, -1.0, 0.0), (0.0, 0.0, 1.0), (-1.0, 0.0, 0.0)),
((0.0, -1.0, 0.0), (1.0, 0.0, 0.0), (0.0, 0.0, 1.0)),
((0.0, 0.0, -1.0), (-1.0, 0.0, 0.0), (0.0, 1.0, 0.0)),
((0.0, 0.0, -1.0), (0.0, -1.0, 0.0), (-1.0, 0.0, 0.0)),
((0.0, 0.0, -1.0), (0.0, 1.0, 0.0), (1.0, 0.0, 0.0)),
((0.0, 0.0, -1.0), (1.0, 0.0, 0.0), (0.0, -1.0, 0.0)),
((0.0, 0.0, 1.0), (-1.0, 0.0, 0.0), (0.0, -1.0, 0.0)),
((0.0, 0.0, 1.0), (0.0, -1.0, 0.0), (1.0, 0.0, 0.0)),
((0.0, 0.0, 1.0), (0.0, 1.0, 0.0), (-1.0, 0.0, 0.0)),
((0.0, 0.0, 1.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0)),
((0.0, 0.0, -1.0), (-1.0, 0.0, 0.0), (0.0, 1.0, 0.0)),
((0.0, 1.0, 0.0), (-1.0, 0.0, 0.0), (0.0, 0.0, 1.0)),
((0.0, -1.0, 0.0), (0.0, 0.0, 1.0), (-1.0, 0.0, 0.0)),
((0.0, 0.0, -1.0), (0.0, -1.0, 0.0), (-1.0, 0.0, 0.0)),
((0.0, 0.0, 1.0), (0.0, 1.0, 0.0), (-1.0, 0.0, 0.0)),
((0.0, 1.0, 0.0), (0.0, 0.0, -1.0), (-1.0, 0.0, 0.0)),
((0.0, -1.0, 0.0), (0.0, 0.0, -1.0), (1.0, 0.0, 0.0)),
((0.0, 0.0, 1.0), (0.0, -1.0, 0.0), (1.0, 0.0, 0.0)),
((0.0, 0.0, -1.0), (0.0, 1.0, 0.0), (1.0, 0.0, 0.0)),
((0.0, 1.0, 0.0), (0.0, 0.0, 1.0), (1.0, 0.0, 0.0)),
((0.0, -1.0, 0.0), (1.0, 0.0, 0.0), (0.0, 0.0, 1.0)),
((0.0, 0.0, -1.0), (1.0, 0.0, 0.0), (0.0, -1.0, 0.0)),
((0.0, 0.0, 1.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0)),
((0.0, 1.0, 0.0), (1.0, 0.0, 0.0), (0.0, 0.0, -1.0)),
((1.0, 0.0, 0.0), (0.0, -1.0, 0.0), (0.0, 0.0, -1.0)),
((1.0, 0.0, 0.0), (0.0, 0.0, -1.0), (0.0, 1.0, 0.0)),
((1.0, 0.0, 0.0), (0.0, 0.0, 1.0), (0.0, -1.0, 0.0)),
((1.0, 0.0, 0.0), (0.0, 0.0, -1.0), (0.0, 1.0, 0.0)),
)
# store args as a single int

@ -188,7 +188,7 @@ class CLIP_OT_delete_proxy(Operator):
proxydir = clip.proxy.directory
else:
clipdir = os.path.dirname(clip.filepath)
proxydir = os.path.join(clipdir, 'BL_proxy')
proxydir = os.path.join(clipdir, "BL_proxy")
clipfile = os.path.basename(clip.filepath)
proxy = os.path.join(proxydir, clipfile)
@ -196,15 +196,15 @@ class CLIP_OT_delete_proxy(Operator):
# proxy_<quality>[_undostorted]
for x in (25, 50, 75, 100):
d = os.path.join(absproxy, 'proxy_' + str(x))
d = os.path.join(absproxy, "proxy_%d" % x)
self._rmproxy(d)
self._rmproxy(d + '_undistorted')
self._rmproxy(os.path.join(absproxy, 'proxy_' + str(x) + '.avi'))
self._rmproxy(d + "_undistorted")
self._rmproxy(os.path.join(absproxy, "proxy_%d.avi" % x))
tc = ('free_run.blen_tc',
'interp_free_run.blen_tc',
'record_run.blen_tc')
tc = ("free_run.blen_tc",
"interp_free_run.blen_tc",
"record_run.blen_tc")
for x in tc:
self._rmproxy(os.path.join(absproxy, x))
@ -269,7 +269,7 @@ object's movement caused by this constraint"""
# TODO: several camera solvers and track followers would fail,
# but can't think about eal workflow where it'll be useful
for x in ob.constraints:
if x.type in ('CAMERA_SOLVER', 'FOLLOW_TRACK'):
if x.type in {'CAMERA_SOLVER', 'FOLLOW_TRACK'}:
con = x
if not con:
@ -340,7 +340,8 @@ object's movement caused by this constraint"""
def execute(self, context):
scene = context.scene
# XXX, should probably use context.selected_editable_objects
# since selected objects can be from a lib or in hidden layer!
for ob in scene.objects:
if ob.select:
self._bake_object(scene, ob)

@ -60,14 +60,14 @@ class SequencerCrossfadeSounds(Operator):
if seq1.frame_final_end > seq2.frame_final_start:
tempcfra = context.scene.frame_current
context.scene.frame_current = seq2.frame_final_start
seq1.keyframe_insert('volume')
seq1.keyframe_insert("volume")
context.scene.frame_current = seq1.frame_final_end
seq1.volume = 0
seq1.keyframe_insert('volume')
seq2.keyframe_insert('volume')
seq1.keyframe_insert("volume")
seq2.keyframe_insert("volume")
context.scene.frame_current = seq2.frame_final_start
seq2.volume = 0
seq2.keyframe_insert('volume')
seq2.keyframe_insert("volume")
context.scene.frame_current = tempcfra
return {'FINISHED'}
else:

@ -756,7 +756,7 @@ def VectoQuat(vec):
class thickface(object):
__slots__= ('v', 'uv', 'no', 'area', 'edge_keys')
__slost__= "v", "uv", "no", "area", "edge_keys"
def __init__(self, face, uv_layer, mesh_verts):
self.v = [mesh_verts[i] for i in face.vertices]
self.uv = [uv_layer[i].uv for i in face.loops]

@ -766,12 +766,12 @@ class WM_OT_path_open(Operator):
return {'CANCELLED'}
if sys.platform[:3] == "win":
subprocess.Popen(['start', filepath], shell=True)
elif sys.platform == 'darwin':
subprocess.Popen(['open', filepath])
subprocess.Popen(["start", filepath], shell=True)
elif sys.platform == "darwin":
subprocess.Popen(["open", filepath])
else:
try:
subprocess.Popen(['xdg-open', filepath])
subprocess.Popen(["xdg-open", filepath])
except OSError:
# xdg-open *should* be supported by recent Gnome, KDE, Xfce
pass
@ -847,8 +847,8 @@ class WM_OT_doc_edit(Operator):
print("sending data:", data_dict)
import xmlrpc.client
user = 'blenderuser'
pwd = 'blender>user'
user = "blenderuser"
pwd = "blender>user"
docblog = xmlrpc.client.ServerProxy(self._url)
docblog.metaWeblog.newPost(1, user, pwd, data_dict, 1)
@ -986,9 +986,8 @@ class WM_OT_properties_edit(Operator):
prop_ui = rna_idprop_ui_prop_get(item, prop)
if prop_type in {float, int}:
prop_ui['soft_min'] = prop_ui['min'] = prop_type(self.min)
prop_ui['soft_max'] = prop_ui['max'] = prop_type(self.max)
prop_ui["soft_min"] = prop_ui["min"] = prop_type(self.min)
prop_ui["soft_max"] = prop_ui["max"] = prop_type(self.max)
prop_ui['description'] = self.description
@ -1035,7 +1034,7 @@ class WM_OT_properties_add(Operator):
item = eval("context.%s" % data_path)
def unique_name(names):
prop = 'prop'
prop = "prop"
prop_new = prop
i = 1
while prop_new in names:
@ -1163,10 +1162,10 @@ class WM_OT_copy_prev_settings(Operator):
# in 2.57 and earlier windows installers, system scripts were copied
# into the configuration directory, don't want to copy those
system_script = os.path.join(path_dst, 'scripts/modules/bpy_types.py')
system_script = os.path.join(path_dst, "scripts/modules/bpy_types.py")
if os.path.isfile(system_script):
shutil.rmtree(os.path.join(path_dst, 'scripts'))
shutil.rmtree(os.path.join(path_dst, 'plugins'))
shutil.rmtree(os.path.join(path_dst, "scripts"))
shutil.rmtree(os.path.join(path_dst, "plugins"))
# don't loose users work if they open the splash later.
if bpy.data.is_saved is bpy.data.is_dirty is False:
@ -1178,20 +1177,20 @@ class WM_OT_copy_prev_settings(Operator):
return {'CANCELLED'}
class WM_OT_blenderplayer_start(bpy.types.Operator):
'''Launches the Blenderplayer with the current blendfile'''
'''Launch the Blenderplayer with the current blendfile'''
bl_idname = "wm.blenderplayer_start"
bl_label = "Start"
blender_bin_path = bpy.app.binary_path
blender_bin_dir = os.path.dirname(blender_bin_path)
ext = os.path.splitext(blender_bin_path)[-1]
player_path = os.path.join(blender_bin_dir, 'blenderplayer' + ext)
player_path = os.path.join(blender_bin_dir, "blenderplayer" + ext)
def execute(self, context):
import sys
if sys.platform == 'darwin':
self.player_path = os.path.join(self.blender_bin_dir, '../../../blenderplayer.app/Contents/MacOS/blenderplayer')
if sys.platform == "darwin":
self.player_path = os.path.join(self.blender_bin_dir, "../../../blenderplayer.app/Contents/MacOS/blenderplayer")
filepath = bpy.app.tempdir + "game.blend"
bpy.ops.wm.save_as_mainfile(filepath=filepath, check_existing=False, copy=True)
@ -1451,7 +1450,7 @@ class WM_OT_operator_cheat_sheet(Operator):
for op_submodule_name in dir(op_module):
op = getattr(op_module, op_submodule_name)
text = repr(op)
if text.split("\n")[-1].startswith('bpy.ops.'):
if text.split("\n")[-1].startswith("bpy.ops."):
op_strings.append(text)
tot += 1

@ -992,6 +992,7 @@ class VIEW3D_MT_object_game(Menu):
layout = self.layout
layout.operator("object.logic_bricks_copy", text="Copy Logic Bricks")
layout.operator("object.game_physics_copy", text="Copy Physics Properties")
layout.separator()
@ -2247,6 +2248,8 @@ class VIEW3D_PT_view3d_meshdisplay(Panel):
col.prop(mesh, "show_extra_edge_length")
col.prop(mesh, "show_extra_face_angle")
col.prop(mesh, "show_extra_face_area")
if bpy.app.debug:
col.prop(mesh, "show_extra_indices")
class VIEW3D_PT_view3d_curvedisplay(Panel):

@ -33,6 +33,8 @@
#ifndef BLF_TRANSLATION_H
#define BLF_TRANSLATION_H
#define TEXT_DOMAIN_NAME "blender"
/* blf_translation.c */
#ifdef WITH_INTERNATIONAL
@ -40,7 +42,8 @@ unsigned char *BLF_get_unifont(int *unifont_size);
void BLF_free_unifont(void);
#endif
const char* BLF_gettext(const char *msgid);
const char *BLF_gettext(const char *msgid);
const char *BLF_pgettext(const char *context, const char *message);
/* blf_lang.c */

@ -58,7 +58,6 @@
#include "BLI_utildefines.h"
#include "BLI_path_util.h"
#define DOMAIN_NAME "blender"
#define SYSTEM_ENCODING_DEFAULT "UTF-8"
#define FONT_SIZE_DEFAULT 12
@ -86,7 +85,7 @@ static const char *locales[] = {
"Chinese (Traditional)_China.1252", "zh_TW",
"russian", "ru_RU",
"croatian", "hr_HR",
"serbian", "sr_RS",
"serbian", "sr",
"ukrainian", "uk_UA",
"polish", "pl_PL",
"romanian", "ro_RO",
@ -96,7 +95,8 @@ static const char *locales[] = {
"korean", "ko_KR",
"nepali", "ne_NP",
"persian", "fa_PE",
"indonesian", "id_ID"
"indonesian", "id_ID",
"serbian (latin)", "sr@latin",
};
void BLF_lang_init(void)
@ -189,6 +189,12 @@ void BLF_lang_set(const char *str)
if (locreturn == NULL) {
printf("Could not change locale to %s nor %s\n", short_locale, short_locale_utf8);
/* fallback to default settings */
locreturn= setlocale(LC_ALL, "");
BLI_setenv("LANG", default_locale);
BLI_setenv("LANGUAGE", default_locale);
ok= 0;
}
@ -204,15 +210,15 @@ void BLF_lang_set(const char *str)
setlocale(LC_NUMERIC, "C");
textdomain(DOMAIN_NAME);
bindtextdomain(DOMAIN_NAME, global_messagepath);
bind_textdomain_codeset(DOMAIN_NAME, global_encoding_name);
textdomain(TEXT_DOMAIN_NAME);
bindtextdomain(TEXT_DOMAIN_NAME, global_messagepath);
bind_textdomain_codeset(TEXT_DOMAIN_NAME, global_encoding_name);
}
void BLF_lang_encoding(const char *str)
{
BLI_strncpy(global_encoding_name, str, sizeof(global_encoding_name));
/* bind_textdomain_codeset(DOMAIN_NAME, encoding_name); */
/* bind_textdomain_codeset(TEXT_DOMAIN_NAME, encoding_name); */
}
#else /* ! WITH_INTERNATIONAL */

@ -29,9 +29,19 @@
*/
#include <stdlib.h>
#include <string.h>
#ifdef WITH_INTERNATIONAL
#include <libintl.h>
#include <locale.h>
#define GETTEXT_CONTEXT_GLUE "\004"
/* needed for windows version of gettext */
#ifndef LC_MESSAGES
# define LC_MESSAGES 1729
#endif
#endif
#include "MEM_guardedalloc.h"
@ -91,6 +101,40 @@ const char* BLF_gettext(const char *msgid)
#endif
}
const char *BLF_pgettext(const char *context, const char *message)
{
#ifdef WITH_INTERNATIONAL
char static_msg_ctxt_id[1024];
char *dynamic_msg_ctxt_id = NULL;
char *msg_ctxt_id;
const char *translation;
size_t overall_length = strlen(context) + strlen(message) + sizeof(GETTEXT_CONTEXT_GLUE) + 1;
if (overall_length > sizeof(static_msg_ctxt_id)) {
dynamic_msg_ctxt_id = malloc(overall_length);
msg_ctxt_id = dynamic_msg_ctxt_id;
}
else {
msg_ctxt_id = static_msg_ctxt_id;
}
sprintf(msg_ctxt_id, "%s%s%s", context, GETTEXT_CONTEXT_GLUE, message);
translation = (char*)dcgettext(TEXT_DOMAIN_NAME, msg_ctxt_id, LC_MESSAGES);
if (dynamic_msg_ctxt_id)
free(dynamic_msg_ctxt_id);
if (translation == msg_ctxt_id)
translation = message;
return translation;
#else
return message;
#endif
}
int BLF_translate_iface(void)
{
#ifdef WITH_INTERNATIONAL
@ -132,4 +176,3 @@ const char *BLF_translate_do_tooltip(const char *msgid)
return msgid;
#endif
}

@ -1704,7 +1704,7 @@ static void scene_sort_groups(Main *bmain, Scene *sce)
/* sort the base list on dependency order */
void DAG_scene_sort(Main *bmain, Scene *sce)
{
DagNode *node;
DagNode *node, *rootnode;
DagNodeQueue *nqueue;
DagAdjList *itA;
int time;
@ -1726,11 +1726,10 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
time = 1;
node = sce->theDag->DagNode.first;
node->color = DAG_GRAY;
rootnode = sce->theDag->DagNode.first;
rootnode->color = DAG_GRAY;
time++;
push_stack(nqueue,node);
push_stack(nqueue,rootnode);
while(nqueue->count) {
@ -2848,10 +2847,8 @@ void DAG_pose_sort(Object *ob)
for(node = dag->DagNode.first; node; node= node->next)
node->color = DAG_WHITE;
node = dag->DagNode.first;
node->color = DAG_GRAY;
push_stack(nqueue, node);
rootnode->color = DAG_GRAY;
push_stack(nqueue, rootnode);
while(nqueue->count) {

@ -1414,10 +1414,7 @@ void driver_free_variable (ChannelDriver *driver, DriverVar *dvar)
DRIVER_TARGETS_LOOPER_END
/* remove the variable from the driver */
if (driver)
BLI_freelinkN(&driver->variables, dvar);
else
MEM_freeN(dvar);
#ifdef WITH_PYTHON
/* since driver variables are cached, the expression needs re-compiling too */

@ -692,7 +692,11 @@ IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *n
case IDP_ARRAY:
{
/*for now, we only support float and int and double arrays*/
if (val->array.type == IDP_FLOAT || val->array.type == IDP_INT || val->array.type == IDP_DOUBLE || val->array.type == IDP_GROUP) {
if ( (val->array.type == IDP_FLOAT) ||
(val->array.type == IDP_INT) ||
(val->array.type == IDP_DOUBLE) ||
(val->array.type == IDP_GROUP) )
{
prop = MEM_callocN(sizeof(IDProperty), "IDProperty array");
prop->subtype = val->array.type;
if (val->array.len)

@ -910,7 +910,9 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
*array_index= dummy_index;
}
/* 'buf' _must_ be initialized in this block */
/* append preceding bits to path */
/* note, strings are not escapted and they should be! */
if ((actname && actname[0]) && (constname && constname[0])) {
/* Constraint in Pose-Channel */
sprintf(buf, "pose.bones[\"%s\"].constraints[\"%s\"]", actname, constname);
@ -918,6 +920,7 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
else if (actname && actname[0]) {
if ((blocktype == ID_OB) && strcmp(actname, "Object")==0) {
/* Actionified "Object" IPO's... no extra path stuff needed */
buf[0]= '\0'; /* empty string */
}
else if ((blocktype == ID_KE) && strcmp(actname, "Shape")==0) {
/* Actionified "Shape" IPO's - these are forced onto object level via the action container there... */
@ -936,8 +939,10 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
/* Sequence names in Scene */
sprintf(buf, "sequence_editor.sequences_all[\"%s\"]", seq->name+2);
}
else
else {
buf[0]= '\0'; /* empty string */
}
BLI_dynstr_append(path, buf);
/* need to add dot before property if there was anything precceding this */

@ -372,7 +372,10 @@ static MovieClip *movieclip_alloc(const char *name)
BKE_tracking_init_settings(&clip->tracking);
clip->proxy.build_size_flag= IMB_PROXY_25;
clip->proxy.build_tc_flag= IMB_TC_RECORD_RUN|IMB_TC_FREE_RUN|IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN;
clip->proxy.build_tc_flag= IMB_TC_RECORD_RUN |
IMB_TC_FREE_RUN |
IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN |
IMB_TC_RECORD_RUN_NO_GAPS;
clip->proxy.quality= 90;
return clip;
@ -985,9 +988,9 @@ void unlink_movieclip(Main *bmain, MovieClip *clip)
}
for(ob= bmain->object.first; ob; ob= ob->id.next) {
bConstraint *con= ob->constraints.first;
bConstraint *con;
for (con= ob->constraints.first; con; con= con->next) {
for(con= ob->constraints.first; con; con= con->next) {
bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
if(cti->type==CONSTRAINT_TYPE_FOLLOWTRACK) {

@ -2653,6 +2653,9 @@ static int cgdm_adjacent_grid(CCGSubSurf *ss, int *gridOffset, CCGFace *f, int S
}
}
if(numEdges == 0)
return -1;
fIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, adjf));
return gridOffset[fIndex] + (j + offset)%numEdges;

@ -1288,8 +1288,8 @@ int BKE_tracking_next(MovieTrackingContext *context)
MEM_freeN(image_new);
}
coords_correct= !isnan(x2) && !isnan(y2) && finite(x2) && finite(y2);
if(coords_correct && !onbound && (tracked || !context->disable_failed)) {
coords_correct= !onbound && !isnan(x2) && !isnan(y2) && finite(x2) && finite(y2);
if(coords_correct && (tracked || !context->disable_failed)) {
if(context->first_time) {
#pragma omp critical
{

@ -299,7 +299,8 @@ static bUnitDef *unit_best_fit(double value, bUnitCollection *usys, bUnitDef *un
if(suppress && (unit->flag & B_UNIT_DEF_SUPPRESS))
continue;
if (value_abs >= unit->scalar*(1.0-EPS)) /* scale down scalar so 1cm doesnt convert to 10mm because of float error */
/* scale down scalar so 1cm doesnt convert to 10mm because of float error */
if (value_abs >= unit->scalar*(1.0-EPS))
return unit;
}
@ -481,11 +482,14 @@ static int ch_is_op(char op)
}
}
static int unit_scale_str(char *str, int len_max, char *str_tmp, double scale_pref, bUnitDef *unit, const char *replace_str)
static int unit_scale_str(char *str, int len_max, char *str_tmp,
double scale_pref, bUnitDef *unit, const char *replace_str)
{
char *str_found;
if((len_max>0) && (str_found= (char *)unit_find_str(str, replace_str))) { /* XXX - investigate, does not respect len_max properly */
if((len_max>0) && (str_found= (char *)unit_find_str(str, replace_str))) {
/* XXX - investigate, does not respect len_max properly */
int len, len_num, len_name, len_move, found_ofs;
found_ofs = (int)(str_found-str);

@ -0,0 +1,45 @@
/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef BLI_MD5_H
#define BLI_MD5_H
/** \file BLI_md5.h
* \ingroup bli
*/
#include <stdio.h>
#include <stdlib.h>
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
void *md5_buffer(const char *buffer, size_t len, void *resblock);
/* Compute MD5 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 16 bytes
beginning at RESBLOCK. */
int md5_stream(FILE *stream, void *resblock);
#endif

@ -72,6 +72,7 @@ set(SRC
intern/math_rotation.c
intern/math_vector.c
intern/math_vector_inline.c
intern/md5.c
intern/noise.c
intern/path_util.c
intern/pbvh.c
@ -123,6 +124,7 @@ set(SRC
BLI_math_matrix.h
BLI_math_rotation.h
BLI_math_vector.h
BLI_md5.h
BLI_memarena.h
BLI_mempool.h
BLI_noise.h

@ -21,12 +21,82 @@
/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>. */
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/types.h>
# include <stdlib.h>
# include <string.h>
#if defined HAVE_LIMITS_H || defined _LIBC
# include <limits.h>
#endif
/* The following contortions are an attempt to use the C preprocessor
to determine an unsigned integral type that is 32 bits wide. An
alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
doing that would require that the configure script compile and *run*
the resulting executable. Locally running cross-compiled executables
is usually not possible. */
#if defined __STDC__ && __STDC__
# define UINT_MAX_32_BITS 4294967295U
#else
# define UINT_MAX_32_BITS 0xFFFFFFFF
#endif
/* If UINT_MAX isn't defined, assume it's a 32-bit type.
This should be valid for all systems GNU cares about because
that doesn't include 16-bit systems, and only modern systems
(that certainly have <limits.h>) have 64+-bit integral types. */
#ifndef UINT_MAX
# define UINT_MAX UINT_MAX_32_BITS
#endif
#if UINT_MAX == UINT_MAX_32_BITS
typedef unsigned int md5_uint32;
#else
# if USHRT_MAX == UINT_MAX_32_BITS
typedef unsigned short md5_uint32;
# else
# if ULONG_MAX == UINT_MAX_32_BITS
typedef unsigned long md5_uint32;
# else
/* The following line is intended to evoke an error.
Using #error is not portable enough. */
"Cannot determine unsigned 32-bit data type."
# endif
# endif
#endif
/* Structure to save state of computation between the single steps. */
struct md5_ctx
{
md5_uint32 A;
md5_uint32 B;
md5_uint32 C;
md5_uint32 D;
};
/*
* The following three functions are build up the low level used in
* the functions `md5_stream' and `md5_buffer'.
*/
/* Initialize structure containing state of computation.
(RFC 1321, 3.3: Step 3) */
static void md5_init_ctx(struct md5_ctx *ctx);
/* Starting with the result of former calls of this function (or the
initialzation function update the context for the next LEN bytes
starting at BUFFER.
It is necessary that LEN is a multiple of 64!!! */
static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx);
/* Put result from CTX in first 16 bytes following RESBUF. The result is
always in little endian byte order, so that a byte-wise output yields
to the wanted ASCII representation of the message digest. */
static void *md5_read_ctx(const struct md5_ctx *ctx, void *resbuf);
#include "md5.h"
#ifdef __BIG_ENDIAN__
# define SWAP(n) \
@ -43,9 +113,7 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
/* Initialize structure containing state of computation.
(RFC 1321, 3.3: Step 3) */
void
md5_init_ctx (ctx)
struct md5_ctx *ctx;
static void md5_init_ctx(struct md5_ctx *ctx)
{
ctx->A = 0x67452301;
ctx->B = 0xefcdab89;
@ -55,10 +123,7 @@ md5_init_ctx (ctx)
/* Put result from CTX in first 16 bytes following RESBUF. The result must
be in little endian byte order. */
void *
md5_read_ctx (ctx, resbuf)
const struct md5_ctx *ctx;
void *resbuf;
static void *md5_read_ctx(const struct md5_ctx *ctx, void *resbuf)
{
((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
@ -71,10 +136,7 @@ md5_read_ctx (ctx, resbuf)
/* Compute MD5 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 16 bytes
beginning at RESBLOCK. */
int
md5_stream (stream, resblock)
FILE *stream;
void *resblock;
int md5_stream(FILE *stream, void *resblock)
{
/* Important: BLOCKSIZE must be a multiple of 64. */
#define BLOCKSIZE 4096
@ -154,11 +216,7 @@ md5_stream (stream, resblock)
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
void *
md5_buffer (buffer, len, resblock)
const char *buffer;
size_t len;
void *resblock;
void *md5_buffer(const char *buffer, size_t len, void *resblock)
{
struct md5_ctx ctx;
char restbuf[64 + 72];
@ -207,11 +265,7 @@ md5_buffer (buffer, len, resblock)
/* Process LEN bytes of BUFFER, accumulating context into CTX.
It is assumed that LEN % 64 == 0. */
void
md5_process_block (buffer, len, ctx)
const void *buffer;
size_t len;
struct md5_ctx *ctx;
void md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
{
md5_uint32 correct_words[16];
const md5_uint32 *words = buffer;

@ -317,7 +317,7 @@ void BLI_uniquename(ListBase *list, void *vlink, const char defname[], char deli
void BLI_cleanup_path(const char *relabase, char *dir)
{
short a;
ptrdiff_t a;
char *start, *eind;
if (relabase) {
BLI_path_abs(dir, relabase);
@ -1416,7 +1416,7 @@ int BLI_replace_extension(char *path, size_t maxlen, const char *ext)
{
size_t path_len= strlen(path);
size_t ext_len= strlen(ext);
size_t a;
ssize_t a;
for(a= path_len - 1; a >= 0; a--) {
if (ELEM3(path[a], '.', '/', '\\')) {
@ -1424,7 +1424,7 @@ int BLI_replace_extension(char *path, size_t maxlen, const char *ext)
}
}
if (path[a] != '.') {
if ((a < 0) || (path[a] != '.')) {
a= path_len;
}
@ -1440,7 +1440,7 @@ int BLI_ensure_extension(char *path, size_t maxlen, const char *ext)
{
size_t path_len= strlen(path);
size_t ext_len= strlen(ext);
size_t a;
ssize_t a;
/* first check the extension is alread there */
if ( (ext_len <= path_len) &&

@ -32,6 +32,7 @@ set(INC
../nodes
../render/extern/include
../../../intern/guardedalloc
../imbuf
)
set(INC_SYS

@ -5,7 +5,7 @@ sources = env.Glob('intern/*.c')
incs = '. #/intern/guardedalloc ../blenlib ../blenkernel'
incs += ' ../makesdna ../editors/include'
incs += ' ../render/extern/include ../makesrna ../nodes ../bmesh'
incs += ' ../render/extern/include ../makesrna ../nodes ../bmesh ../imbuf'
incs += ' ' + env['BF_ZLIB_INC']

@ -141,6 +141,8 @@
#include "BKE_utildefines.h" // SWITCH_INT DATA ENDB DNA1 O_BINARY GLOB USER TEST REND
#include "BKE_sound.h"
#include "IMB_imbuf.h" // for proxy / timecode versioning stuff
#include "NOD_socket.h"
//XXX #include "BIF_butspace.h" // badlevel, for do_versions, patching event codes
@ -10771,8 +10773,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
void *olddata = ob->data;
ob->data = me;
if(me && me->id.lib==NULL && me->mr && me->mr->level_count > 1) /* XXX - library meshes crash on loading most yoFrankie levels, the multires pointer gets invalid - Campbell */
/* XXX - library meshes crash on loading most yoFrankie levels,
* the multires pointer gets invalid - Campbell */
if(me && me->id.lib==NULL && me->mr && me->mr->level_count > 1) {
multires_load_old(ob, me);
}
ob->data = olddata;
}
@ -12670,10 +12675,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
clip->aspy= 1.0f;
}
/* XXX: a bit hacky, probably include imbuf and use real constants are nicer */
clip->proxy.build_tc_flag= 7;
clip->proxy.build_tc_flag= IMB_TC_RECORD_RUN |
IMB_TC_FREE_RUN |
IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN;
if(clip->proxy.build_size_flag==0)
clip->proxy.build_size_flag= 1;
clip->proxy.build_size_flag= IMB_PROXY_25;
if(clip->proxy.quality==0)
clip->proxy.quality= 90;
@ -12813,6 +12820,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
scene->gm.exitkey = 218; // Blender key code for ESC
}
}
{
MovieClip *clip;
for(clip= main->movieclip.first; clip; clip= clip->id.next) {
clip->proxy.build_tc_flag|= IMB_TC_RECORD_RUN_NO_GAPS;
}
}
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
@ -14343,7 +14356,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
expand_main(fd, mainptr);
/* dang FileData... now new libraries need to be appended to original filedata, it is not a good replacement for the old global (ton) */
/* dang FileData... now new libraries need to be appended to original filedata,
* it is not a good replacement for the old global (ton) */
while( fd->mainlist.first ) {
Main *mp= fd->mainlist.first;
BLI_remlink(&fd->mainlist, mp);
@ -14365,8 +14379,13 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
ID *idn= id->next;
if(id->flag & LIB_READ) {
BLI_remlink(lbarray[a], id);
BKE_reportf(basefd->reports, RPT_ERROR, "LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
if(!G.background && basefd->reports)printf("LIB ERROR: %s:'%s' unread libblock missing from '%s'\n", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
BKE_reportf(basefd->reports, RPT_ERROR,
"LIB ERROR: %s:'%s' unread libblock missing from '%s'\n",
BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
if (!G.background && basefd->reports) {
printf("LIB ERROR: %s:'%s' unread libblock missing from '%s'\n",
BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath);
}
change_idid_adr(mainlist, basefd, id, NULL);
MEM_freeN(id);

@ -496,7 +496,7 @@ void ANIM_flush_setting_anim_channels (bAnimContext *ac, ListBase *anim_data, bA
break;
/* store this level as the 'old' level now */
prevLevel= level; // XXX: prevLevel is unused
// prevLevel= level; // XXX: prevLevel is unused
}
}
}

@ -2205,12 +2205,12 @@ size_t ANIM_animdata_filter (bAnimContext *ac, ListBase *anim_data, int filter_m
/* only filter data if there's somewhere to put it */
if (data && anim_data) {
Object *obact= (ac) ? ac->obact : NULL;
/* firstly filter the data */
switch (datatype) {
case ANIMCONT_ACTION: /* 'Action Editor' */
{
Object *obact= ac->obact;
SpaceAction *saction = (SpaceAction *)ac->sl;
bDopeSheet *ads = (saction)? &saction->ads : NULL;

@ -904,7 +904,9 @@ void uiEndBlock(const bContext *C, uiBlock *block)
/* handle pending stuff */
if(block->layouts.first) uiBlockLayoutResolve(block, NULL, NULL);
ui_block_do_align(block);
if((block->flag & UI_BLOCK_LOOP) && (block->flag & UI_BLOCK_NUMSELECT)) ui_menu_block_set_keyaccels(block); /* could use a different flag to check */
if((block->flag & UI_BLOCK_LOOP) && (block->flag & UI_BLOCK_NUMSELECT)) {
ui_menu_block_set_keyaccels(block); /* could use a different flag to check */
}
if(block->flag & UI_BLOCK_LOOP) ui_menu_block_set_keymaps(C, block);
/* after keymaps! */
@ -1901,7 +1903,7 @@ void ui_set_but_soft_range(uiBut *but, double value)
if(softmin < (double)but->hardmin)
softmin= (double)but->hardmin;
}
else if(value_max-1e-10 > softmax) {
if(value_max-1e-10 > softmax) {
if(value_max < 0.0)
softmax= -soft_range_round_down(-value_max, -softmax);
else

@ -5247,7 +5247,7 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
highlight when not in a popup menu, we remove because data used in
button below popup might have been removed by action of popup. Needs
a more reliable solution... */
if(state != BUTTON_STATE_HIGHLIGHT || but->block->handle)
if(state != BUTTON_STATE_HIGHLIGHT || (but->block->flag & UI_BLOCK_LOOP))
ui_check_but(but);
}

@ -681,7 +681,7 @@ static void modifiers_convertToReal(bContext *C, void *ob_v, void *md_v)
static int modifier_can_delete(ModifierData *md)
{
// fluid particle modifier can't be deleted here
/* fluid particle modifier can't be deleted here */
if(md->type == eModifierType_ParticleSystem)
if(((ParticleSystemModifierData *)md)->psys->part->type == PART_FLUID)
return 0;
@ -689,14 +689,16 @@ static int modifier_can_delete(ModifierData *md)
return 1;
}
// Check wheter Modifier is a simulation or not, this is used for switching to the physics/particles context tab
/* Check wheter Modifier is a simulation or not, this is used for switching to the physics/particles context tab */
static int modifier_is_simulation(ModifierData *md)
{
// Physic Tab
if(ELEM7(md->type, eModifierType_Cloth, eModifierType_Collision, eModifierType_Fluidsim, eModifierType_Smoke, eModifierType_Softbody, eModifierType_Surface, eModifierType_DynamicPaint)) {
/* Physic Tab */
if (ELEM7(md->type, eModifierType_Cloth, eModifierType_Collision, eModifierType_Fluidsim, eModifierType_Smoke,
eModifierType_Softbody, eModifierType_Surface, eModifierType_DynamicPaint))
{
return 1;
}
// Particle Tab
/* Particle Tab */
else if (md->type == eModifierType_ParticleSystem) {
return 2;
}
@ -705,7 +707,8 @@ static int modifier_is_simulation(ModifierData *md)
}
}
static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, ModifierData *md, int index, int cageIndex, int lastCageIndex)
static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
ModifierData *md, int index, int cageIndex, int lastCageIndex)
{
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
PointerRNA ptr;

@ -1795,7 +1795,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
{
/* gouraud triangle fan */
float radstep, ang= 0.0f;
float centx, centy, radius;
float centx, centy, radius, cursor_radius;
float rgb[3], hsvo[3], hsv[3], col[3], colcent[3];
int a, tot= 32;
int color_profile = but->block->color_profile;
@ -1864,12 +1864,12 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
ang= 2.0f*(float)M_PI*hsvo[0] + 0.5f*(float)M_PI;
if(but->flag & UI_BUT_COLOR_CUBIC)
radius= (1.0f - powf(1.0f - hsvo[1], 3.0f)) *radius;
cursor_radius = (1.0f - powf(1.0f - hsvo[1], 3.0f));
else
radius= hsvo[1] * radius;
cursor_radius = hsvo[1];
radius= CLAMPIS(cursor_radius, 0.0f, 1.0f) * radius;
ui_hsv_cursor(centx + cosf(-ang)*radius, centy + sinf(-ang)*radius);
}
/* ************ custom buttons, old stuff ************** */

@ -2179,3 +2179,51 @@ void OBJECT_OT_logic_bricks_copy(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob=ED_object_active_context(C);
CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
if(ob != ob_iter) {
ob_iter->gameflag = ob->gameflag;
ob_iter->gameflag2 = ob->gameflag2;
ob_iter->inertia = ob->inertia;
ob_iter->formfactor = ob->formfactor;;
ob_iter->damping = ob->damping;
ob_iter->rdamping = ob->rdamping;
ob_iter->min_vel = ob->min_vel;
ob_iter->max_vel = ob->max_vel;
ob_iter->obstacleRad = ob->obstacleRad;
ob_iter->mass = ob->mass;
ob_iter->anisotropicFriction[0] = ob->anisotropicFriction[0];
ob_iter->anisotropicFriction[1] = ob->anisotropicFriction[1];
ob_iter->anisotropicFriction[2] = ob->anisotropicFriction[2];
ob_iter->collision_boundtype = ob->collision_boundtype;
ob_iter->margin = ob->margin;
ob_iter->bsoft = copy_bulletsoftbody(ob->bsoft);
if(ob->restrictflag & OB_RESTRICT_RENDER)
ob_iter->restrictflag |= OB_RESTRICT_RENDER;
else
ob_iter->restrictflag &= ~OB_RESTRICT_RENDER;
}
}
CTX_DATA_END;
return OPERATOR_FINISHED;
}
void OBJECT_OT_game_physics_copy(struct wmOperatorType *ot)
{
/* identifiers */
ot->name= "Copy Game Physics Properties to Selected";
ot->description = "Copy game physics properties to other selected objects";
ot->idname= "OBJECT_OT_game_physics_copy";
/* api callbacks */
ot->exec= game_physics_copy_exec;
ot->poll= ED_operator_object_active_editable;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}

@ -92,6 +92,7 @@ void OBJECT_OT_game_property_remove(struct wmOperatorType *ot);
void OBJECT_OT_game_property_copy(struct wmOperatorType *ot);
void OBJECT_OT_game_property_clear(struct wmOperatorType *ot);
void OBJECT_OT_logic_bricks_copy(struct wmOperatorType *ot);
void OBJECT_OT_game_physics_copy(struct wmOperatorType *ot);
/* object_select.c */
void OBJECT_OT_select_all(struct wmOperatorType *ot);

@ -655,7 +655,7 @@ static int modifier_add_exec(bContext *C, wmOperator *op)
static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
Object *ob= ED_object_active_context(C);
EnumPropertyItem *item= NULL, *md_item;
EnumPropertyItem *item= NULL, *md_item, *group_item= NULL;
ModifierTypeInfo *mti;
int totitem= 0, a;
@ -675,6 +675,17 @@ static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr)
(ob->type==OB_MESH && (mti->flags & eModifierTypeFlag_AcceptsMesh))))
continue;
}
else {
group_item= md_item;
md_item= NULL;
continue;
}
if(group_item) {
RNA_enum_item_add(&item, &totitem, group_item);
group_item= NULL;
}
RNA_enum_item_add(&item, &totitem, md_item);
}

@ -189,6 +189,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_game_property_copy);
WM_operatortype_append(OBJECT_OT_game_property_clear);
WM_operatortype_append(OBJECT_OT_logic_bricks_copy);
WM_operatortype_append(OBJECT_OT_game_physics_copy);
WM_operatortype_append(OBJECT_OT_shape_key_add);
WM_operatortype_append(OBJECT_OT_shape_key_remove);

@ -1816,7 +1816,9 @@ static int project_bucket_isect_circle(const float cent[2], const float radius_s
return 1;
*/
if((bucket_bounds->xmin <= cent[0] && bucket_bounds->xmax >= cent[0]) || (bucket_bounds->ymin <= cent[1] && bucket_bounds->ymax >= cent[1]) ) {
if ( (bucket_bounds->xmin <= cent[0] && bucket_bounds->xmax >= cent[0]) ||
(bucket_bounds->ymin <= cent[1] && bucket_bounds->ymax >= cent[1]) )
{
return 1;
}
@ -2816,7 +2818,11 @@ static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucke
p4[0] = bucket_bounds.xmax; p4[1] = bucket_bounds.ymin;
if (mf->v4) {
if( isect_point_quad_v2(p1, v1, v2, v3, v4) || isect_point_quad_v2(p2, v1, v2, v3, v4) || isect_point_quad_v2(p3, v1, v2, v3, v4) || isect_point_quad_v2(p4, v1, v2, v3, v4) ||
if ( isect_point_quad_v2(p1, v1, v2, v3, v4) ||
isect_point_quad_v2(p2, v1, v2, v3, v4) ||
isect_point_quad_v2(p3, v1, v2, v3, v4) ||
isect_point_quad_v2(p4, v1, v2, v3, v4) ||
/* we can avoid testing v3,v1 because another intersection MUST exist if this intersects */
(isect_line_line_v2(p1, p2, v1, v2) || isect_line_line_v2(p1, p2, v2, v3) || isect_line_line_v2(p1, p2, v3, v4)) ||
(isect_line_line_v2(p2, p3, v1, v2) || isect_line_line_v2(p2, p3, v2, v3) || isect_line_line_v2(p2, p3, v3, v4)) ||
@ -2827,7 +2833,10 @@ static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucke
}
}
else {
if( isect_point_tri_v2(p1, v1, v2, v3) || isect_point_tri_v2(p2, v1, v2, v3) || isect_point_tri_v2(p3, v1, v2, v3) || isect_point_tri_v2(p4, v1, v2, v3) ||
if ( isect_point_tri_v2(p1, v1, v2, v3) ||
isect_point_tri_v2(p2, v1, v2, v3) ||
isect_point_tri_v2(p3, v1, v2, v3) ||
isect_point_tri_v2(p4, v1, v2, v3) ||
/* we can avoid testing v3,v1 because another intersection MUST exist if this intersects */
(isect_line_line_v2(p1, p2, v1, v2) || isect_line_line_v2(p1, p2, v2, v3)) ||
(isect_line_line_v2(p2, p3, v1, v2) || isect_line_line_v2(p2, p3, v2, v3)) ||

@ -592,7 +592,12 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
float pen_flip = cache->pen_flip ? -1 : 1;
float invert = cache->invert ? -1 : 1;
float accum = integrate_overlap(brush);
float overlap = (brush->flag & BRUSH_SPACE_ATTEN && brush->flag & BRUSH_SPACE && !(brush->flag & BRUSH_ANCHORED)) && (brush->spacing < 100) ? 1.0f/accum : 1; // spacing is integer percentage of radius, divide by 50 to get normalized diameter
/* spacing is integer percentage of radius, divide by 50 to get
normalized diameter */
float overlap = (brush->flag & BRUSH_SPACE_ATTEN &&
brush->flag & BRUSH_SPACE &&
!(brush->flag & BRUSH_ANCHORED) &&
(brush->spacing < 100)) ? 1.0f/accum : 1;
float flip = dir * invert * pen_flip;
switch(brush->sculpt_tool){
@ -1716,7 +1721,9 @@ static void calc_flatten_center(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
/* this calculates flatten center and area normal together,
amortizing the memory bandwidth and loop overhead to calculate both at the same time */
static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float an[3], float fc[3])
static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
PBVHNode **nodes, int totnode,
float an[3], float fc[3])
{
SculptSession *ss = ob->sculpt;
int n;
@ -2588,7 +2595,9 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob)
/* Flip all the editdata across the axis/axes specified by symm. Used to
calculate multiple modifications to the mesh when symmetry is enabled. */
static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm, const char axis, const float angle, const float UNUSED(feather))
static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm,
const char axis, const float angle,
const float UNUSED(feather))
{
(void)sd; /* unused */
@ -2620,7 +2629,9 @@ static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm,
mul_m4_v3(cache->symm_rot_mat, cache->grab_delta_symmetry);
}
static void do_radial_symmetry(Sculpt *sd, Object *ob, Brush *brush, const char symm, const int axis, const float feather)
static void do_radial_symmetry(Sculpt *sd, Object *ob, Brush *brush,
const char symm, const int axis,
const float feather)
{
SculptSession *ss = ob->sculpt;
int i;
@ -2954,7 +2965,10 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio
cache->original = 1;
}
if(ELEM8(brush->sculpt_tool, SCULPT_TOOL_DRAW, SCULPT_TOOL_CREASE, SCULPT_TOOL_BLOB, SCULPT_TOOL_LAYER, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY, SCULPT_TOOL_CLAY_TUBES, SCULPT_TOOL_ROTATE))
if(ELEM8(brush->sculpt_tool,
SCULPT_TOOL_DRAW, SCULPT_TOOL_CREASE, SCULPT_TOOL_BLOB,
SCULPT_TOOL_LAYER, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY,
SCULPT_TOOL_CLAY_TUBES, SCULPT_TOOL_ROTATE))
if(!(brush->flag & BRUSH_ACCUMULATE))
cache->original = 1;
@ -3038,7 +3052,9 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush)
}
/* Initialize the stroke cache variants from operator properties */
static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, struct PaintStroke *stroke, PointerRNA *ptr)
static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
struct PaintStroke *stroke,
PointerRNA *ptr)
{
SculptSession *ss = ob->sculpt;
StrokeCache *cache = ss->cache;
@ -3095,7 +3111,9 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, st
cache->radius_squared = cache->radius*cache->radius;
if(!(brush->flag & BRUSH_ANCHORED || ELEM4(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE))) {
if(!(brush->flag & BRUSH_ANCHORED ||
ELEM4(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK,
SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE))) {
copy_v2_v2(cache->tex_mouse, cache->mouse);
if ( (brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) &&
@ -3137,7 +3155,9 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, st
if (!hit)
copy_v2_v2(sd->anchored_initial_mouse, cache->initial_mouse);
cache->radius= paint_calc_object_space_radius(paint_stroke_view_context(stroke), cache->true_location, cache->pixel_radius);
cache->radius= paint_calc_object_space_radius(paint_stroke_view_context(stroke),
cache->true_location,
cache->pixel_radius);
cache->radius_squared = cache->radius*cache->radius;
copy_v3_v3(sd->anchored_location, cache->true_location);

@ -221,12 +221,17 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot)
static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports)
{
/* can't rename rna datablocks entries */
if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))
;
else if(ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
/* do nothing */;
}
else if(ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE,
TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
{
BKE_report(reports, RPT_WARNING, "Cannot edit builtin name");
else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP))
}
else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) {
BKE_report(reports, RPT_WARNING, "Cannot edit sequence name");
}
else if(tselem->id->lib) {
// XXX error_libdata();
}

@ -823,8 +823,12 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], fmval, fmval+1);
if(!ELEM3(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF, SO_KEYMAP) && !(soops->flag & SO_HIDE_RESTRICTCOLS) && fmval[0] > ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX)
if ( !ELEM3(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF, SO_KEYMAP) &&
!(soops->flag & SO_HIDE_RESTRICTCOLS) &&
(fmval[0] > ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX))
{
return OPERATOR_CANCELLED;
}
for(te= soops->tree.first; te; te= te->next) {
if(do_outliner_item_activate(C, scene, ar, soops, te, extend, fmval)) break;

@ -2685,8 +2685,7 @@ static void draw_em_fancy_edges(BMEditMesh *em, Scene *scene, View3D *v3d,
}
}
static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d,
Object *ob, BMEditMesh *em, UnitSettings *unit)
static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitSettings *unit)
{
Mesh *me= ob->data;
float v1[3], v2[3], v3[3], vmid[3], fvec[3];
@ -2710,11 +2709,6 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d,
else if (grid < 10.0f) conv_float= "%.3g";
else conv_float= "%.2g";
if(v3d->zbuf && (v3d->flag & V3D_ZBUF_SELECT)==0)
glDisable(GL_DEPTH_TEST);
if(v3d->zbuf) bglPolygonOffset(rv3d->dist, 5.0f);
if(me->drawflag & ME_DRAWEXTRA_EDGELEN) {
BMEdge *eed;
@ -2836,43 +2830,52 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d,
}
}
}
}
static void draw_em_indices(BMEditMesh *em)
{
BMEdge *e;
BMFace *f;
BMVert *v;
int i;
char val[32];
float pos[3];
unsigned char col[4];
/* useful for debugging index vs shape key index */
#if 0
{
BMIter iter;
BMVert *eve;
int j=0;
BMesh *bm= em->bm;
/* For now, reuse appropriate theme colors from stats text colors */
i= 0;
UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col);
if(CustomData_has_layer(&em->bm->vdata, CD_SHAPE_KEYINDEX)) {
int *keyi;
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
keyi = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_SHAPE_KEYINDEX);
if(keyi && *keyi != ORIGINDEX_NONE) {
sprintf(val, "%d:%d", j, *keyi);
BM_ITER(v, &iter, bm, BM_VERTS_OF_MESH, NULL) {
if (BM_TestHFlag(v, BM_SELECT)) {
sprintf(val, "%d", i);
view3d_cached_text_draw_add(v->co, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
else {
sprintf(val, "%d", j);
}
view3d_cached_text_draw_add(eve->co, val, 0, V3D_CACHE_TEXT_ASCII, col);
i++;
}
}
else {
BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
sprintf(val, "%d", j);
view3d_cached_text_draw_add(eve->co, val, 0, V3D_CACHE_TEXT_ASCII, col);
j++;
}
}
}
#endif
if(v3d->zbuf) {
glEnable(GL_DEPTH_TEST);
bglPolygonOffset(rv3d->dist, 0.0f);
i= 0;
UI_GetThemeColor3ubv(TH_DRAWEXTRA_EDGELEN, col);
BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
if (BM_TestHFlag(e, BM_SELECT)) {
sprintf(val, "%d", i);
mid_v3_v3v3(pos, e->v1->co, e->v2->co);
view3d_cached_text_draw_add(pos, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
i++;
}
i= 0;
UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col);
BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) {
if (BM_TestHFlag(f, BM_SELECT)) {
BM_Compute_Face_CenterMean(bm, f, pos);
sprintf(val, "%d", i);
view3d_cached_text_draw_add(pos, val, 0, V3D_CACHE_TEXT_ASCII, col);
}
i++;
}
}
@ -3050,7 +3053,12 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
if ( (me->drawflag & (ME_DRAWEXTRA_EDGELEN|ME_DRAWEXTRA_FACEAREA|ME_DRAWEXTRA_FACEANG)) &&
!(v3d->flag2 & V3D_RENDER_OVERRIDE))
{
draw_em_measure_stats(v3d, rv3d, ob, em, &scene->unit);
draw_em_measure_stats(v3d, ob, em, &scene->unit);
}
if ((G.f & G_DEBUG) && (me->drawflag & ME_DRAWEXTRA_INDICES) &&
!(v3d->flag2 & V3D_RENDER_OVERRIDE)) {
draw_em_indices(em);
}
}

@ -277,7 +277,7 @@ static int modeselect_addmode(char *str, const char *title, int id, int icon)
static char *view3d_modeselect_pup(Scene *scene)
{
Object *ob= OBACT;
static char string[256];
static char string[512];
const char *title= IFACE_("Mode: %t");
char *str = string;
@ -317,7 +317,10 @@ static char *view3d_modeselect_pup(Scene *scene)
str += modeselect_addmode(str, N_("Pose Mode"), OB_MODE_POSE, ICON_POSE_HLT);
}
if (ob->particlesystem.first || modifiers_findByType(ob, eModifierType_Cloth) || modifiers_findByType(ob, eModifierType_Softbody)) {
if ( ob->particlesystem.first ||
modifiers_findByType(ob, eModifierType_Cloth) ||
modifiers_findByType(ob, eModifierType_Softbody))
{
str += modeselect_addmode(str, N_("Particle Mode"), OB_MODE_PARTICLE_EDIT, ICON_PARTICLEMODE);
}
(void)str;

@ -1725,7 +1725,11 @@ static int game_engine_exec(bContext *C, wmOperator *op)
game_set_commmandline_options(&startscene->gm);
if(rv3d->persp==RV3D_CAMOB && startscene->gm.framing.type == SCE_GAMEFRAMING_BARS && startscene->gm.stereoflag != STEREO_DOME) { /* Letterbox */
if((rv3d->persp == RV3D_CAMOB) &&
(startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) &&
(startscene->gm.stereoflag != STEREO_DOME))
{
/* Letterbox */
rctf cam_framef;
ED_view3d_calc_camera_border(startscene, ar, CTX_wm_view3d(C), rv3d, &cam_framef, FALSE);
cam_frame.xmin = cam_framef.xmin + ar->winrct.xmin;

@ -1556,8 +1556,10 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
/* TODO - in the case of tilt and radius we can also avoid allocating the initTransDataCurveHandles
* but for now just dont change handle types */
if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT) == 0)
testhandlesNurb(nu); /* sets the handles based on their selection, do this after the data is copied to the TransData */
if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT) == 0) {
/* sets the handles based on their selection, do this after the data is copied to the TransData */
testhandlesNurb(nu);
}
}
else {
TransData *head, *tail;
@ -3504,7 +3506,10 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
* then check if we're using auto-handles.
* - If so, change them auto-handles to aligned handles so that handles get affected too
*/
if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) && ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM) && ELEM(t->mode, TFM_ROTATION, TFM_RESIZE)) {
if ( ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) &&
ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM) &&
ELEM(t->mode, TFM_ROTATION, TFM_RESIZE))
{
if (hdata && (sel1) && (sel3)) {
bezt->h1= HD_ALIGN;
bezt->h2= HD_ALIGN;
@ -4200,7 +4205,10 @@ static void createTransSeqData(bContext *C, TransInfo *t)
int i;
for(i=0; i<3; i++) {
seq_user= *((&seq->seq1) + i);
if (seq_user && (seq_user->flag & SELECT) && !(seq_user->flag & SEQ_LOCK) && !(seq_user->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL))) {
if ( seq_user && (seq_user->flag & SELECT) &&
!(seq_user->flag & SEQ_LOCK) &&
!(seq_user->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)))
{
seq->flag |= SELECT;
}
}
@ -4499,7 +4507,8 @@ static int count_proportional_objects(TransInfo *t)
/* mark all children */
for (base= scene->base.first; base; base= base->next) {
/* all base not already selected or marked that is editable */
if ((base->object->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && BASE_EDITABLE_BGMODE(v3d, scene, base))
if ( (base->object->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 &&
(BASE_EDITABLE_BGMODE(v3d, scene, base)))
{
mark_children(base->object);
}
@ -4510,7 +4519,8 @@ static int count_proportional_objects(TransInfo *t)
Object *ob= base->object;
/* if base is not selected, not a parent of selection or not a child of selection and it is editable */
if ((ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && BASE_EDITABLE_BGMODE(v3d, scene, base))
if ( (ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 &&
(BASE_EDITABLE_BGMODE(v3d, scene, base)))
{
/* used for flush, depgraph will change recalcs if needed :) */
@ -4586,7 +4596,9 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob,
if (adt && adt->action) {
for (fcu= adt->action->curves.first; fcu; fcu= fcu->next) {
fcu->flag &= ~FCURVE_SELECTED;
insert_keyframe(reports, id, adt->action, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
insert_keyframe(reports, id, adt->action,
(fcu->grp ? fcu->grp->name : NULL),
fcu->rna_path, fcu->array_index, cfra, flag);
}
}
}
@ -5104,8 +5116,12 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
else if(t->scene->basact && (ob = t->scene->basact->object) && (ob->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(t->scene, ob)) {
;
else if ( (t->scene->basact) &&
(ob = t->scene->basact->object) &&
(ob->mode & OB_MODE_PARTICLE_EDIT) &&
PE_get_current(t->scene, ob))
{
/* do nothing */ ;
}
else { /* Objects */
int i, recalcObPaths=0;

@ -1637,7 +1637,12 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, c
}
for ( base = FIRSTBASE; base != NULL; base = base->next ) {
if ( BASE_VISIBLE(v3d, base) && (base->flag & (BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA)) == 0 && ((mode == SNAP_NOT_SELECTED && (base->flag & (SELECT|BA_WAS_SEL)) == 0) || (ELEM(mode, SNAP_ALL, SNAP_NOT_OBEDIT) && base != BASACT)) ) {
if ( (BASE_VISIBLE(v3d, base)) &&
(base->flag & (BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA)) == 0 &&
( (mode == SNAP_NOT_SELECTED && (base->flag & (SELECT|BA_WAS_SEL)) == 0) ||
(ELEM(mode, SNAP_ALL, SNAP_NOT_OBEDIT) && base != BASACT)) )
{
Object *ob = base->object;
if (ob->transflag & OB_DUPLI)

@ -241,7 +241,12 @@ GPUFunction *GPU_lookup_function(const char *name)
return (GPUFunction*)BLI_ghash_lookup(FUNCTION_HASH, (void *)name);
}
void GPU_extensions_exit(void)
void GPU_codegen_init(void)
{
GPU_code_generate_glsl_lib();
}
void GPU_codegen_exit(void)
{
extern Material defmaterial; // render module abuse...
@ -253,8 +258,11 @@ void GPU_extensions_exit(void)
FUNCTION_HASH = NULL;
}
if(glsl_material_library)
if(glsl_material_library) {
MEM_freeN(glsl_material_library);
glsl_material_library = NULL;
}
/*if(FUNCTION_PROTOTYPES) {
MEM_freeN(FUNCTION_PROTOTYPES);
FUNCTION_PROTOTYPES = NULL;
@ -538,12 +546,8 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final
BLI_dynstr_appendf(ds, ", gl_TexCoord[%d].st", input->texid);
}
else if (input->source == GPU_SOURCE_TEX_PIXEL) {
if (input->link && input->link->output)
codegen_convert_datatype(ds, input->link->output->type, input->type,
"tmp", input->link->output->id);
else
codegen_convert_datatype(ds, input->link->output->type, input->type,
"tex", input->texid);
}
else if(input->source == GPU_SOURCE_BUILTIN)
BLI_dynstr_appendf(ds, "%s", GPU_builtin_name(input->builtin));

@ -178,6 +178,9 @@ void GPU_pass_unbind(GPUPass *pass);
void GPU_pass_free(GPUPass *pass);
void GPU_codegen_init(void);
void GPU_codegen_exit(void);
/* Material calls */
const char *GPU_builtin_name(GPUBuiltin builtin);

@ -1069,7 +1069,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
/* setting do_alpha_after = 1 indicates this object needs to be
* drawn in a second alpha pass for improved blending */
if(GMS.use_alpha_pass && !GMS.is_alpha_pass)
if(do_alpha_after && !GMS.is_alpha_pass)
if(ELEM3(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ADD, GPU_BLEND_ALPHA_SORT))
*do_alpha_after= 1;

@ -45,6 +45,7 @@
#include "GPU_draw.h"
#include "GPU_extensions.h"
#include "gpu_codegen.h"
#include <stdlib.h>
#include <stdio.h>
@ -85,6 +86,8 @@ int GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver)
/* GPU Extensions */
static int gpu_extensions_init = 0;
void GPU_extensions_disable(void)
{
GG.extdisabled = 1;
@ -96,11 +99,11 @@ void GPU_extensions_init(void)
const char *vendor, *renderer;
/* can't avoid calling this multiple times, see wm_window_add_ghostwindow */
static char init= 0;
if(init) return;
init= 1;
if(gpu_extensions_init) return;
gpu_extensions_init= 1;
glewInit();
GPU_codegen_init();
/* glewIsSupported("GL_VERSION_2_0") */
@ -112,8 +115,6 @@ void GPU_extensions_init(void)
if (!GLEW_ARB_vertex_shader) GG.glslsupport = 0;
if (!GLEW_ARB_fragment_shader) GG.glslsupport = 0;
GPU_code_generate_glsl_lib();
glGetIntegerv(GL_RED_BITS, &r);
glGetIntegerv(GL_GREEN_BITS, &g);
glGetIntegerv(GL_BLUE_BITS, &b);
@ -188,6 +189,12 @@ void GPU_extensions_init(void)
#endif
}
void GPU_extensions_exit(void)
{
gpu_extensions_init = 0;
GPU_codegen_exit();
}
int GPU_glsl_support(void)
{
return !GG.extdisabled && GG.glslsupport;

@ -972,7 +972,6 @@ static void do_material_tex(GPUShadeInput *shi)
GPU_link(mat, "mtex_mapping_ofs", texco, GPU_uniform(ofs), &texco);
talpha = 0;
rgbnor = 0;
if(tex && tex->type == TEX_IMAGE && tex->ima) {
GPU_link(mat, "mtex_image", texco, GPU_image(tex->ima, &tex->iuser), &tin, &trgb);

@ -53,7 +53,6 @@ set(SRC
intern/indexer_dv.c
intern/iris.c
intern/jpeg.c
intern/md5.c
intern/metadata.c
intern/module.c
intern/moviecache.c
@ -96,7 +95,6 @@ set(SRC
intern/dds/Stream.h
intern/dds/dds_api.h
intern/imbuf.h
intern/md5.h
intern/openexr/openexr_api.h
intern/openexr/openexr_multi.h

@ -1,119 +0,0 @@
/** \file blender/imbuf/intern/md5.h
* \ingroup imbuf
*/
/* md5.h - Declaration of functions and data types used for MD5 sum
computing library functions.
Copyright (C) 1995 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _MD5_H
#define _MD5_H
#include <stdio.h>
#if defined HAVE_LIMITS_H || defined _LIBC
# include <limits.h>
#endif
/* The following contortions are an attempt to use the C preprocessor
to determine an unsigned integral type that is 32 bits wide. An
alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
doing that would require that the configure script compile and *run*
the resulting executable. Locally running cross-compiled executables
is usually not possible. */
#if defined __STDC__ && __STDC__
# define UINT_MAX_32_BITS 4294967295U
#else
# define UINT_MAX_32_BITS 0xFFFFFFFF
#endif
/* If UINT_MAX isn't defined, assume it's a 32-bit type.
This should be valid for all systems GNU cares about because
that doesn't include 16-bit systems, and only modern systems
(that certainly have <limits.h>) have 64+-bit integral types. */
#ifndef UINT_MAX
# define UINT_MAX UINT_MAX_32_BITS
#endif
#if UINT_MAX == UINT_MAX_32_BITS
typedef unsigned int md5_uint32;
#else
# if USHRT_MAX == UINT_MAX_32_BITS
typedef unsigned short md5_uint32;
# else
# if ULONG_MAX == UINT_MAX_32_BITS
typedef unsigned long md5_uint32;
# else
/* The following line is intended to evoke an error.
Using #error is not portable enough. */
"Cannot determine unsigned 32-bit data type."
# endif
# endif
#endif
#undef __P
#if defined (__STDC__) && __STDC__
#define __P(x) x
#else
#define __P(x) ()
#endif
/* Structure to save state of computation between the single steps. */
struct md5_ctx
{
md5_uint32 A;
md5_uint32 B;
md5_uint32 C;
md5_uint32 D;
};
/*
* The following three functions are build up the low level used in
* the functions `md5_stream' and `md5_buffer'.
*/
/* Initialize structure containing state of computation.
(RFC 1321, 3.3: Step 3) */
void md5_init_ctx __P ((struct md5_ctx *ctx));
/* Starting with the result of former calls of this function (or the
initialzation function update the context for the next LEN bytes
starting at BUFFER.
It is necessary that LEN is a multiple of 64!!! */
void md5_process_block __P ((const void *buffer, size_t len,
struct md5_ctx *ctx));
/* Put result from CTX in first 16 bytes following RESBUF. The result is
always in little endian byte order, so that a byte-wise output yields
to the wanted ASCII representation of the message digest. */
void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf));
/* Compute MD5 message digest for bytes read from STREAM. The
resulting message digest number will be written into the 16 bytes
beginning at RESBLOCK. */
int md5_stream __P ((FILE *stream, void *resblock));
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
result is always in little endian byte order, so that a byte-wise
output yields to the wanted ASCII representation of the message
digest. */
void *md5_buffer __P ((const char *buffer, size_t len, void *resblock));
#endif

@ -32,17 +32,18 @@
#include <stdio.h>
#include "BKE_utildefines.h"
#include "BLI_blenlib.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_md5.h"
#include "BKE_utildefines.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "IMB_thumbs.h"
#include "IMB_metadata.h"
#include "md5.h"
#include <ctype.h>
#include <stdlib.h>
#include <string.h>

@ -38,6 +38,23 @@ struct SDNA;
extern unsigned char DNAstr[]; /* DNA.c */
extern int DNAlen;
typedef enum eSDNA_Type {
SDNA_TYPE_CHAR = 0,
SDNA_TYPE_UCHAR = 1,
SDNA_TYPE_SHORT = 2,
SDNA_TYPE_USHORT = 3,
SDNA_TYPE_INT = 4,
SDNA_TYPE_LONG = 5,
SDNA_TYPE_ULONG = 6,
SDNA_TYPE_FLOAT = 7,
SDNA_TYPE_DOUBLE = 8,
SDNA_TYPE_INT64 = 9
/* ,SDNA_TYPE_VOID = 10 */ /* nothing uses yet */
} eSDNA_Type;
/* define so switch statements don't complain */
#define SDNA_TYPE_VOID 10
struct SDNA *DNA_sdna_from_data(void *data, int datalen, int do_endian_swap);
void DNA_sdna_free(struct SDNA *sdna);
@ -49,6 +66,7 @@ void *DNA_struct_reconstruct(struct SDNA *newsdna, struct SDNA *oldsdna, char *c
int DNA_elem_array_size(const char *astr, int len);
int DNA_elem_offset(struct SDNA *sdna, const char *stype, const char *vartype, const char *name);
int DNA_elem_type_size(const eSDNA_Type elem_nr);
#endif

@ -179,6 +179,9 @@ typedef struct TFace {
#define ME_DRAWEXTRA_FACEAREA (1 << 11)
#define ME_DRAWEXTRA_FACEANG (1 << 12)
/* debug only option */
#define ME_DRAWEXTRA_INDICES (1 << 13)
/* old global flags:
#define G_DRAWEDGES (1 << 18)
#define G_DRAWFACES (1 << 7)

@ -492,7 +492,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
for(nr=0; nr<sdna->nr_structs; nr++) {
sp= sdna->structs[nr];
if(strcmp(sdna->types[sp[0]], "ClothSimSettings") == 0)
sp[10]= 9;
sp[10]= SDNA_TYPE_VOID;
}
}
@ -656,92 +656,87 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna)
return compflags;
}
static void cast_elem(char *ctype, char *otype, const char *name, char *curdata, char *olddata)
static eSDNA_Type sdna_type_nr(const char *dna_type)
{
if ((strcmp(dna_type, "char")==0) || (strcmp(dna_type, "const char")==0)) return SDNA_TYPE_CHAR;
else if((strcmp(dna_type, "uchar")==0) || (strcmp(dna_type, "unsigned char")==0)) return SDNA_TYPE_UCHAR;
else if( strcmp(dna_type, "short")==0) return SDNA_TYPE_SHORT;
else if((strcmp(dna_type, "ushort")==0)||(strcmp(dna_type, "unsigned short")==0)) return SDNA_TYPE_USHORT;
else if( strcmp(dna_type, "int")==0) return SDNA_TYPE_INT;
else if( strcmp(dna_type, "long")==0) return SDNA_TYPE_LONG;
else if((strcmp(dna_type, "ulong")==0)||(strcmp(dna_type, "unsigned long")==0)) return SDNA_TYPE_ULONG;
else if( strcmp(dna_type, "float")==0) return SDNA_TYPE_FLOAT;
else if( strcmp(dna_type, "double")==0) return SDNA_TYPE_DOUBLE;
else if( strcmp(dna_type, "int64_t")==0) return SDNA_TYPE_INT64;
else return -1; /* invalid! */
}
static void cast_elem(const char *ctype, const char *otype, const char *name, char *curdata, char *olddata)
{
double val = 0.0;
int arrlen, curlen=1, oldlen=1, ctypenr, otypenr;
int arrlen, curlen=1, oldlen=1;
eSDNA_Type ctypenr, otypenr;
arrlen= DNA_elem_array_size(name, strlen(name));
/* define otypenr */
if(strcmp(otype, "char")==0 || (strcmp(otype, "const char")==0)) otypenr= 0;
else if((strcmp(otype, "uchar")==0) || (strcmp(otype, "unsigned char")==0)) otypenr= 1;
else if(strcmp(otype, "short")==0) otypenr= 2;
else if((strcmp(otype, "ushort")==0)||(strcmp(otype, "unsigned short")==0)) otypenr= 3;
else if(strcmp(otype, "int")==0) otypenr= 4;
else if(strcmp(otype, "long")==0) otypenr= 5;
else if((strcmp(otype, "ulong")==0)||(strcmp(otype, "unsigned long")==0)) otypenr= 6;
else if(strcmp(otype, "float")==0) otypenr= 7;
else if(strcmp(otype, "double")==0) otypenr= 8;
else return;
/* define ctypenr */
if(strcmp(ctype, "char")==0) ctypenr= 0;
else if(strcmp(ctype, "const char")==0) ctypenr= 0;
else if((strcmp(ctype, "uchar")==0)||(strcmp(ctype, "unsigned char")==0)) ctypenr= 1;
else if(strcmp(ctype, "short")==0) ctypenr= 2;
else if((strcmp(ctype, "ushort")==0)||(strcmp(ctype, "unsigned short")==0)) ctypenr= 3;
else if(strcmp(ctype, "int")==0) ctypenr= 4;
else if(strcmp(ctype, "long")==0) ctypenr= 5;
else if((strcmp(ctype, "ulong")==0)||(strcmp(ctype, "unsigned long")==0)) ctypenr= 6;
else if(strcmp(ctype, "float")==0) ctypenr= 7;
else if(strcmp(ctype, "double")==0) ctypenr= 8;
else return;
if ( (otypenr= sdna_type_nr(otype)) == -1 ||
(ctypenr= sdna_type_nr(ctype)) == -1 )
{
return;
}
/* define lengths */
if(otypenr < 2) oldlen= 1;
else if(otypenr < 4) oldlen= 2;
else if(otypenr < 8) oldlen= 4;
else oldlen= 8;
if(ctypenr < 2) curlen= 1;
else if(ctypenr < 4) curlen= 2;
else if(ctypenr < 8) curlen= 4;
else curlen= 8;
oldlen= DNA_elem_type_size(otypenr);
curlen= DNA_elem_type_size(ctypenr);
while(arrlen>0) {
switch(otypenr) {
case 0:
case SDNA_TYPE_CHAR:
val= *olddata; break;
case 1:
case SDNA_TYPE_UCHAR:
val= *( (unsigned char *)olddata); break;
case 2:
case SDNA_TYPE_SHORT:
val= *( (short *)olddata); break;
case 3:
case SDNA_TYPE_USHORT:
val= *( (unsigned short *)olddata); break;
case 4:
case SDNA_TYPE_INT:
val= *( (int *)olddata); break;
case 5:
case SDNA_TYPE_LONG:
val= *( (int *)olddata); break;
case 6:
case SDNA_TYPE_ULONG:
val= *( (unsigned int *)olddata); break;
case 7:
case SDNA_TYPE_FLOAT:
val= *( (float *)olddata); break;
case 8:
case SDNA_TYPE_DOUBLE:
val= *( (double *)olddata); break;
case SDNA_TYPE_INT64:
val= *( (int64_t *)olddata); break;
}
switch(ctypenr) {
case 0:
case SDNA_TYPE_CHAR:
*curdata= val; break;
case 1:
case SDNA_TYPE_UCHAR:
*( (unsigned char *)curdata)= val; break;
case 2:
case SDNA_TYPE_SHORT:
*( (short *)curdata)= val; break;
case 3:
case SDNA_TYPE_USHORT:
*( (unsigned short *)curdata)= val; break;
case 4:
case SDNA_TYPE_INT:
*( (int *)curdata)= val; break;
case 5:
case SDNA_TYPE_LONG:
*( (int *)curdata)= val; break;
case 6:
case SDNA_TYPE_ULONG:
*( (unsigned int *)curdata)= val; break;
case 7:
case SDNA_TYPE_FLOAT:
if(otypenr<2) val/= 255;
*( (float *)curdata)= val; break;
case 8:
case SDNA_TYPE_DOUBLE:
if(otypenr<2) val/= 255;
*( (double *)curdata)= val; break;
case SDNA_TYPE_INT64:
*( (int64_t *)curdata)= val; break;
}
olddata+= oldlen;
@ -839,7 +834,8 @@ static char *find_elem(SDNA *sdna, const char *type, const char *name, short *ol
return NULL;
}
static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, char *type, const char *name, char *curdata, short *old, char *olddata)
static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna,
char *type, const char *name, char *curdata, short *old, char *olddata)
{
/* rules: test for NAME:
- name equal:
@ -913,7 +909,8 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna, char *type, const cha
}
}
static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna, char *compflags, int oldSDNAnr, char *data, int curSDNAnr, char *cur)
static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna,
char *compflags, int oldSDNAnr, char *data, int curSDNAnr, char *cur)
{
/* Recursive!
* Per element from cur_struct, read data from old_struct.
@ -1055,7 +1052,9 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
}
else {
if( spc[0]==2 || spc[0]==3 ) { /* short-ushort */
if ( spc[0]==SDNA_TYPE_SHORT ||
spc[0]==SDNA_TYPE_USHORT )
{
/* exception: variable called blocktype/ipowin: derived from ID_ */
skip= 0;
@ -1077,7 +1076,11 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
}
}
}
else if(spc[0]>3 && spc[0]<8) { /* int-long-ulong-float */
else if ( (spc[0]==SDNA_TYPE_INT ||
spc[0]==SDNA_TYPE_LONG ||
spc[0]==SDNA_TYPE_ULONG ||
spc[0]==SDNA_TYPE_FLOAT))
{
mul= DNA_elem_array_size(name, strlen(name));
cpo= cur;
@ -1091,6 +1094,18 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
cpo+= 4;
}
}
else if ( (spc[0]==SDNA_TYPE_INT64)) {
mul= DNA_elem_array_size(name, strlen(name));
cpo= cur;
while(mul--) {
cval= cpo[0]; cpo[0]= cpo[7]; cpo[7]= cval;
cval= cpo[1]; cpo[1]= cpo[6]; cpo[6]= cval;
cval= cpo[2]; cpo[2]= cpo[5]; cpo[5]= cval;
cval= cpo[3]; cpo[3]= cpo[4]; cpo[4]= cval;
cpo+= 8;
}
}
}
}
cur+= elen;
@ -1139,3 +1154,26 @@ int DNA_elem_offset(SDNA *sdna, const char *stype, const char *vartype, const ch
return (int)((intptr_t)cp);
}
int DNA_elem_type_size(const eSDNA_Type elem_nr)
{
/* should containt all enum types */
switch (elem_nr) {
case SDNA_TYPE_CHAR:
case SDNA_TYPE_UCHAR:
return 1;
case SDNA_TYPE_SHORT:
case SDNA_TYPE_USHORT:
return 2;
case SDNA_TYPE_INT:
case SDNA_TYPE_LONG:
case SDNA_TYPE_ULONG:
case SDNA_TYPE_FLOAT:
return 4;
case SDNA_TYPE_DOUBLE:
case SDNA_TYPE_INT64:
return 8;
}
/* weak */
return 8;
}

@ -928,16 +928,18 @@ static int make_structDNA(char *baseDirectory, FILE *file)
/* insertion of all known types */
/* watch it: uint is not allowed! use in structs an unsigned int */
add_type("char", 1); /* 0 */
add_type("uchar", 1); /* 1 */
add_type("short", 2); /* 2 */
add_type("ushort", 2); /* 3 */
add_type("int", 4); /* 4 */
add_type("long", 4); /* 5 */ /* should it be 8 on 64 bits? */
add_type("ulong", 4); /* 6 */
add_type("float", 4); /* 7 */
add_type("double", 8); /* 8 */
add_type("void", 0); /* 9 */
/* watch it: sizes must match DNA_elem_type_size() */
add_type("char", 1); /* SDNA_TYPE_CHAR */
add_type("uchar", 1); /* SDNA_TYPE_UCHAR */
add_type("short", 2); /* SDNA_TYPE_SHORT */
add_type("ushort", 2); /* SDNA_TYPE_USHORT */
add_type("int", 4); /* SDNA_TYPE_INT */
add_type("long", 4); /* SDNA_TYPE_LONG */ /* should it be 8 on 64 bits? */
add_type("ulong", 4); /* SDNA_TYPE_ULONG */
add_type("float", 4); /* SDNA_TYPE_FLOAT */
add_type("double", 8); /* SDNA_TYPE_DOUBLE */
add_type("int64_t", 8); /* SDNA_TYPE_INT64 */
add_type("void", 0); /* SDNA_TYPE_VOID */
// the defines above shouldn't be output in the padding file...
firststruct = nr_types;

@ -175,6 +175,8 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con
void RNA_def_property_srna(PropertyRNA *prop, const char *type);
void RNA_def_py_data(PropertyRNA *prop, void *py_data);
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context);
/* Function */
FunctionRNA *RNA_def_function(StructRNA *srna, const char *identifier, const char *call);

@ -2229,6 +2229,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
rna_print_c_string(f, prop->name); fprintf(f, ",\n\t");
rna_print_c_string(f, prop->description); fprintf(f, ",\n\t");
fprintf(f, "%d,\n", prop->icon);
rna_print_c_string(f, prop->translation_context); fprintf(f, ",\n\t");
fprintf(f, "\t%s, %s|%s, %s, %u, {%u, %u, %u}, %u,\n", RNA_property_typename(prop->type), rna_property_subtypename(prop->subtype), rna_property_subtype_unit(prop->subtype), rna_function_string(prop->getlength), prop->arraydimension, prop->arraylength[0], prop->arraylength[1], prop->arraylength[2], prop->totarraylength);
fprintf(f, "\t%s%s, %d, %s, %s,\n", (prop->flag & PROP_CONTEXT_UPDATE)? "(UpdateFunc)": "", rna_function_string(prop->update), prop->noteflag, rna_function_string(prop->editable), rna_function_string(prop->itemeditable));

@ -486,8 +486,12 @@ static const char *rna_ensure_property_name(PropertyRNA *prop)
name= ((IDProperty*)prop)->name;
#ifdef WITH_INTERNATIONAL
if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE))
name= BLF_gettext(name);
if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE)) {
if(prop->translation_context)
name = BLF_pgettext(prop->translation_context, name);
else
name = BLF_gettext(name);
}
#endif
return name;
@ -837,12 +841,17 @@ char RNA_property_array_item_char(PropertyRNA *prop, int index)
PropertySubType subtype= rna_ensure_property(prop)->subtype;
/* get string to use for array index */
if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE))
if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE)) {
return quatitem[index];
else if((index < 4) && ELEM8(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH, PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION, PROP_COORDS))
}
else if((index < 4) && ELEM8(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH,
PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION, PROP_COORDS))
{
return vectoritem[index];
else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA))
}
else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) {
return coloritem[index];
}
return '\0';
}
@ -865,7 +874,9 @@ int RNA_property_array_item_index(PropertyRNA *prop, char name)
return 3;
}
}
else if(ELEM6(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION)) {
else if(ELEM6(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ,
PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION))
{
switch (name) {
case 'x':
return 0;
@ -1187,8 +1198,12 @@ void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA
}
for(i=0; nitem[i].identifier; i++) {
if( nitem[i].name )
if( nitem[i].name ) {
if(prop->translation_context)
nitem[i].name = BLF_pgettext(prop->translation_context, nitem[i].name);
else
nitem[i].name = BLF_gettext(nitem[i].name);
}
if( nitem[i].description )
nitem[i].description = BLF_gettext(nitem[i].description);
}
@ -1519,7 +1534,8 @@ void RNA_property_update_cache_add(PointerRNA *ptr, PropertyRNA *prop)
/* find cache element for which key matches... */
for (uce = rna_updates_cache.first; uce; uce = uce->next) {
/* just match by id only for now, since most update calls that we'll encounter only really care about this */
// TODO: later, the cache might need to have some nesting on L1 to cope better with these problems + some tagging to indicate we need this
/* TODO: later, the cache might need to have some nesting on L1 to cope better
* with these problems + some tagging to indicate we need this */
if (uce->ptr.id.data == ptr->id.data)
break;
}
@ -4969,7 +4985,9 @@ static int rna_function_format_array_length(const char *format, int ofs, int fle
return 0;
}
static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, PropertyType type, char ftype, int len, void *dest, void *src, StructRNA *srna, const char *tid, const char *fid, const char *pid)
static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, PropertyType type,
char ftype, int len, void *dest, void *src, StructRNA *srna,
const char *tid, const char *fid, const char *pid)
{
/* ptr is always a function pointer, prop always a parameter */
@ -5055,7 +5073,9 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
}
if (ptype!=srna && !RNA_struct_is_a(srna, ptype)) {
fprintf(stderr, "%s.%s: wrong type for parameter %s, an object of type %s was expected, passed an object of type %s\n", tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
fprintf(stderr, "%s.%s: wrong type for parameter %s, "
"an object of type %s was expected, passed an object of type %s\n",
tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
return -1;
}
@ -5080,7 +5100,10 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
ptype= RNA_property_pointer_type(ptr, prop);
if (ptype!=srna && !RNA_struct_is_a(srna, ptype)) {
fprintf(stderr, "%s.%s: wrong type for parameter %s, a collection of objects of type %s was expected, passed a collection of objects of type %s\n", tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
fprintf(stderr, "%s.%s: wrong type for parameter %s, "
"a collection of objects of type %s was expected, "
"passed a collection of objects of type %s\n",
tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
return -1;
}
@ -5159,7 +5182,10 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
if (len!=alen) {
err= -1;
fprintf(stderr, "%s.%s: for parameter %s, was expecting an array of %i elements, passed %i elements instead\n", tid, fid, pid, len, alen);
fprintf(stderr, "%s.%s: for parameter %s, "
"was expecting an array of %i elements, "
"passed %i elements instead\n",
tid, fid, pid, len, alen);
break;
}
@ -5224,7 +5250,9 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
if (len!=alen) {
err= -1;
fprintf(stderr, "%s.%s: for return parameter %s, was expecting an array of %i elements, passed %i elements instead\n", tid, fid, pid, len, alen);
fprintf(stderr, "%s.%s: for return parameter %s, "
"was expecting an array of %i elements, passed %i elements instead\n",
tid, fid, pid, len, alen);
}
else {
switch (type) {
@ -5278,7 +5306,8 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
return err;
}
int RNA_function_call_direct_va_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, const char *identifier, const char *format, va_list args)
int RNA_function_call_direct_va_lookup(bContext *C, ReportList *reports, PointerRNA *ptr,
const char *identifier, const char *format, va_list args)
{
FunctionRNA *func;

@ -1824,6 +1824,11 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname,
}
}
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
{
prop->translation_context= context;
}
/* Functions */
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)

@ -147,6 +147,8 @@ struct PropertyRNA {
const char *description;
/* icon ID */
int icon;
/* context for translation */
const char *translation_context;
/* property type as it appears to the outside */
PropertyType type;

@ -415,8 +415,8 @@ static void rna_def_material_mtex(BlenderRNA *brna)
{MTEX_COMPAT_BUMP, "BUMP_COMPATIBLE", 0, "Compatible", ""},
{MTEX_3TAP_BUMP, "BUMP_LOW_QUALITY", 0, "Low Quality", "Use 3 tap filtering"},
{MTEX_5TAP_BUMP, "BUMP_MEDIUM_QUALITY", 0, "Medium Quality", "Use 5 tap filtering"},
{MTEX_BICUBIC_BUMP, "BUMP_BEST_QUALITY", 0, "Best Quality", "Use bicubic filtering. Requires OpenGL 3.0+. "
"It will fall back on medium setting for other systems"},
{MTEX_BICUBIC_BUMP, "BUMP_BEST_QUALITY", 0, "Best Quality", "Use bicubic filtering (requires OpenGL 3.0+, "
"it will fall back on medium setting for other systems)"},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem prop_bump_space_items[] = {

@ -2537,6 +2537,11 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Face Area", "Displays the area of selected faces, Using global values when set in the transform panel");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
prop= RNA_def_property(srna, "show_extra_indices", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_INDICES);
RNA_def_property_ui_text(prop, "Indices", "Displays the index numbers of selected vertices, edges, and faces");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
/* editflag */
prop= RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_X);

@ -78,6 +78,7 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna)
{IMB_TC_RECORD_RUN, "RECORD_RUN", 0, "Record Run", "Use images in the order they are recorded"},
{IMB_TC_FREE_RUN, "FREE_RUN", 0, "Free Run", "Use global timestamp written by recording device"},
{IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN, "FREE_RUN_REC_DATE", 0, "Free Run (rec date)", "Interpolate a global timestamp using the record date and time written by recording device"},
{IMB_TC_RECORD_RUN_NO_GAPS, "FREE_RUN_NO_GAPS", 0, "Free Run No Gaps", "Record run, but ignore timecode, changes in framerate or dropouts"},
{0, NULL, 0, NULL, NULL}};
srna = RNA_def_struct(brna, "MovieClipProxy", NULL);

@ -465,6 +465,20 @@ static int rna_Property_description_length(PointerRNA *ptr)
return prop->description ? strlen(prop->description) : 0;
}
static void rna_Property_translation_context_get(PointerRNA *ptr, char *value)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;
rna_idproperty_check(&prop, ptr);
strcpy(value, prop->translation_context ? prop->translation_context:"");
}
static int rna_Property_translation_context_length(PointerRNA *ptr)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;
rna_idproperty_check(&prop, ptr);
return prop->translation_context ? strlen(prop->translation_context) : 0;
}
static int rna_Property_type_get(PointerRNA *ptr)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;
@ -1047,6 +1061,11 @@ static void rna_def_property(BlenderRNA *brna)
RNA_def_property_string_funcs(prop, "rna_Property_description_get", "rna_Property_description_length", NULL);
RNA_def_property_ui_text(prop, "Description", "Description of the property for tooltips");
prop= RNA_def_property(srna, "translation_context", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_funcs(prop, "rna_Property_translation_context_get", "rna_Property_translation_context_length", NULL);
RNA_def_property_ui_text(prop, "Translation Context", "Translation context of the property");
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_enum_items(prop, property_type_items);

@ -2117,7 +2117,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
RNA_def_property_enum_sdna(prop, NULL, "exitkey");
RNA_def_property_enum_items(prop, event_type_items);
RNA_def_property_enum_funcs(prop, NULL, "rna_GameSettings_exit_key_set", NULL);
RNA_def_property_ui_text(prop, "Exit Key", "Sets the key that exits the Game Engine");
RNA_def_property_ui_text(prop, "Exit Key", "The key that exits the Game Engine");
RNA_def_property_update(prop, NC_SCENE, NULL);
// Do we need it here ? (since we already have it in World

@ -2607,40 +2607,43 @@ static void rna_def_userdef_system(BlenderRNA *brna)
/* hardcoded here, could become dynamic somehow */
/* locale according to http://www.roseindia.net/tutorials/I18N/locales-list.shtml */
/* if you edit here, please also edit the source/blender/blenfont/intern/blf_lang.c 's locales */
/* Note: As this list is in alphabetical order, and not defined order,
* here is the highest define currently in use: 28 (serbian latin). */
static EnumPropertyItem language_items[] = {
{0, "", 0, "Nearly done", ""},
{0, "DEFAULT", 0, "Default (Default)", ""},
{1, "ENGLISH", 0, "English (English)", "en_US"},
{8, "FRENCH", 0, "French (Français)", "fr_FR"},
{4, "ITALIAN", 0, "Italian (Italiano)", "it_IT"},
{ 0, "", 0, "Nearly done", ""},
{ 0, "DEFAULT", 0, "Default (Default)", ""},
{ 1, "ENGLISH", 0, "English (English)", "en_US"},
{ 8, "FRENCH", 0, "French (Français)", "fr_FR"},
{ 4, "ITALIAN", 0, "Italian (Italiano)", "it_IT"},
{15, "RUSSIAN", 0, "Russian (Русский)", "ru_RU"},
{13, "SIMPLIFIED_CHINESE", 0, "Simplified Chinese (简体中文)", "zh_CN"},
{9, "SPANISH", 0, "Spanish (Español)", "es"},
{ 9, "SPANISH", 0, "Spanish (Español)", "es"},
{14, "TRADITIONAL_CHINESE", 0, "Traditional Chinese (繁體中文)", "zh_TW"},
{0, "", 0, "In progress", ""},
{2, "JAPANESE", 0, "Japanese (日本語)", "ja_JP"},
{3, "DUTCH", 0, "Dutch (Nederlandse taal)", "nl_NL"},
{5, "GERMAN", 0, "German (Deutsch)", "de_DE"},
{6, "FINNISH", 0, "Finnish (Suomi)", "fi_FI"},
{7, "SWEDISH", 0, "Swedish (Svenska)", "sv_SE"},
{10, "CATALAN", 0, "Catalan (Català)", "ca_AD"},
{11, "CZECH", 0, "Czech (Český)", "cs_CZ"},
{12, "BRAZILIAN_PORTUGUESE", 0, "Brazilian Portuguese (Português do Brasil)", "pt_BR"},
{16, "CROATIAN", 0, "Croatian (Hrvatski)", "hr_HR"},
{17, "SERBIAN", 0, "Serbian (Српском језику)", "sr_RS"},
{18, "UKRAINIAN", 0, "Ukrainian (Український)", "uk_UA"},
{19, "POLISH", 0, "Polish (Polski)", "pl_PL"},
{20, "ROMANIAN", 0, "Romanian (Român)", "ro_RO"},
{ 0, "", 0, "In progress", ""},
/* using the utf8 flipped form of Arabic (العربية) */
{21, "ARABIC", 0, "Arabic (ﺔﻴﺑﺮﻌﻟﺍ)", "ar_EG"},
{12, "BRAZILIAN_PORTUGUESE", 0, "Brazilian Portuguese (Português do Brasil)", "pt_BR"},
{22, "BULGARIAN", 0, "Bulgarian (Български)", "bg_BG"},
{10, "CATALAN", 0, "Catalan (Català)", "ca_AD"},
{16, "CROATIAN", 0, "Croatian (Hrvatski)", "hr_HR"},
{11, "CZECH", 0, "Czech (Český)", "cs_CZ"},
{ 3, "DUTCH", 0, "Dutch (Nederlandse taal)", "nl_NL"},
{ 6, "FINNISH", 0, "Finnish (Suomi)", "fi_FI"},
{ 5, "GERMAN", 0, "German (Deutsch)", "de_DE"},
{23, "GREEK", 0, "Greek (Ελληνικά)", "el_GR"},
{27, "INDONESIAN", 0, "Indonesian (Bahasa indonesia)", "id_ID"},
{ 2, "JAPANESE", 0, "Japanese (日本語)", "ja_JP"},
{24, "KOREAN", 0, "Korean (한국 언어)", "ko_KR"},
{25, "NEPALI", 0, "Nepali (नेपाली)", "ne_NP"},
/* using the utf8 flipped form of Persian (فارسی) */
{26, "PERSIAN", 0, "Persian (ﯽﺳﺭﺎﻓ)", "fa_PE"},
{27, "INDONESIAN", 0, "Indonesian (Bahasa indonesia)", "id_ID"},
{0, NULL, 0, NULL, NULL}};
{19, "POLISH", 0, "Polish (Polski)", "pl_PL"},
{20, "ROMANIAN", 0, "Romanian (Român)", "ro_RO"},
{17, "SERBIAN", 0, "Serbian (Српски)", "sr"},
{28, "SERBIAN_LATIN", 0, "Serbian latin (Srpski latinica)", "sr@latin"},
{ 7, "SWEDISH", 0, "Swedish (Svenska)", "sv_SE"},
{18, "UKRAINIAN", 0, "Ukrainian (Український)", "uk_UA"},
{ 0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "UserPreferencesSystem", NULL);
RNA_def_struct_sdna(srna, "UserDef");

@ -399,29 +399,37 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
MEM_freeN(tdw);
return dm;
}
if(numIdx != numVerts) {
indices = MEM_mallocN(sizeof(int) * numIdx, "WeightVGProximity Modifier, indices");
memcpy(indices, tidx, sizeof(int) * numIdx);
org_w = MEM_mallocN(sizeof(float) * numIdx, "WeightVGProximity Modifier, org_w");
new_w = MEM_mallocN(sizeof(float) * numIdx, "WeightVGProximity Modifier, new_w");
memcpy(org_w, tw, sizeof(float) * numIdx);
dw = MEM_mallocN(sizeof(MDeformWeight*) * numIdx, "WeightVGProximity Modifier, dw");
memcpy(dw, tdw, sizeof(MDeformWeight*) * numIdx);
MEM_freeN(tidx);
MEM_freeN(tw);
MEM_freeN(tdw);
}
else {
org_w = tw;
dw = tdw;
}
new_w = MEM_mallocN(sizeof(float) * numIdx, "WeightVGProximity Modifier, new_w");
MEM_freeN(tidx);
/* Get our vertex coordinates. */
{
v_cos = MEM_mallocN(sizeof(float[3]) * numIdx, "WeightVGProximity Modifier, v_cos");
if(numIdx != numVerts) {
/* XXX In some situations, this code can be up to about 50 times more performant
* than simply using getVertCo for each affected vertex...
*/
float (*tv_cos)[3] = MEM_mallocN(sizeof(float[3]) * numVerts, "WeightVGProximity Modifier, tv_cos");
v_cos = MEM_mallocN(sizeof(float[3]) * numIdx, "WeightVGProximity Modifier, v_cos");
dm->getVertCos(dm, tv_cos);
for (i = 0; i < numIdx; i++)
copy_v3_v3(v_cos[i], tv_cos[indices[i]]);
MEM_freeN(tv_cos);
}
else
dm->getVertCos(dm, v_cos);
/* Compute wanted distances. */
if (wmd->proximity_mode == MOD_WVG_PROXIMITY_OBJECT) {
@ -497,6 +505,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
MEM_freeN(org_w);
MEM_freeN(new_w);
MEM_freeN(dw);
if(indices)
MEM_freeN(indices);
MEM_freeN(v_cos);

@ -47,7 +47,8 @@ static bNodeSocketTemplate cmp_node_alphaover_out[]= {
static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, float *over, float *fac)
{
if(over[3]<=0.0f) {
/* Zero alpha values should still permit an add of RGB data */
if(over[3]<0.0f) {
copy_v4_v4(out, src);
}
else if(fac[0]==1.0f && over[3]>=1.0f) {

@ -1304,6 +1304,7 @@ PyObject *BPyInit_bgl(void)
PyModule_AddObject(submodule, "Buffer", (PyObject *)&BGL_bufferType);
Py_INCREF((PyObject *)&BGL_bufferType);
#define EXPP_ADDCONST(x) PyDict_SetItemString(dict, #x, item=PyLong_FromLong((int)x)); Py_DECREF(item)

@ -36,6 +36,12 @@
#include "RNA_access.h"
#define USE_MATHUTILS
#ifdef USE_MATHUTILS
# include "../mathutils/mathutils.h" /* so we can have mathutils callbacks */
#endif
#define MAX_ARRAY_DIMENSION 10
typedef void (*ItemConvertFunc)(PyObject *, char *);
@ -259,10 +265,47 @@ static int validate_array(PyObject *rvalue, PointerRNA *ptr, PropertyRNA *prop,
/* validate type first because length validation may modify property array length */
#ifdef USE_MATHUTILS
if (lvalue_dim == 0) { /* only valid for first level array */
if (MatrixObject_Check(rvalue)) {
MatrixObject *pymat= (MatrixObject *)rvalue;
if (BaseMath_ReadCallback(pymat) == -1)
return -1;
if (RNA_property_type(prop) != PROP_FLOAT) {
PyErr_Format(PyExc_ValueError, "%s %.200s.%.200s, matrix assign to non float array",
error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop));
return -1;
}
else if (totdim != 2) {
PyErr_Format(PyExc_ValueError, "%s %.200s.%.200s, matrix assign array with %d dimensions",
error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), totdim);
return -1;
}
else if (pymat->num_col != dimsize[0] || pymat->num_row != dimsize[1]) {
PyErr_Format(PyExc_ValueError, "%s %.200s.%.200s, matrix assign dimension size mismatch, "
"is %dx%d, expected be %dx%d",
error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop),
pymat->num_col, pymat->num_row, dimsize[0], dimsize[1]);
return -1;
}
else {
*totitem= dimsize[0] * dimsize[1];
return 0;
}
}
}
#endif /* USE_MATHUTILS */
{
if (validate_array_type(rvalue, lvalue_dim, totdim, dimsize, check_item_type, item_type_str, error_prefix) == -1)
return -1;
return validate_array_length(rvalue, ptr, prop, lvalue_dim, totitem, error_prefix);
}
}
static char *copy_value_single(PyObject *item, PointerRNA *ptr, PropertyRNA *prop,
@ -305,6 +348,26 @@ static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop,
return NULL;
}
#ifdef USE_MATHUTILS
if (dim == 0) {
if (MatrixObject_Check(seq)) {
MatrixObject *pymat= (MatrixObject *)seq;
size_t allocsize= pymat->num_col * pymat->num_row * sizeof(float);
/* read callback already done by validate */
/* since this is the first iteration we can assume data is allocated */
memcpy(data, pymat->matrix, allocsize);
/* not really needed but do for completeness */
data += allocsize;
return data;
}
}
#endif /* USE_MATHUTILS */
for (i= 0; i < seq_size; i++) {
PyObject *item= PySequence_GetItem(seq, i);
if (item) {

@ -145,6 +145,14 @@ PyInit_gpu(void)
PyObject_SetAttrString(d, #f, val); \
Py_DECREF(val)
PyDoc_STRVAR(GPU_export_shader_doc,
"export_shader(scene, material)\n"
"\n"
" Returns the GLSL shader that produces the visual effect of material in scene.\n"
"\n"
" :return: Dictionary defining the shader, uniforms and attributes.\n"
" :rtype: Dict"
);
static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObject *kwds)
{
PyObject* pyscene;
@ -279,11 +287,9 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
return result;
}
static PyMethodDef meth_export_shader[] = {{ "export_shader", (PyCFunction)GPU_export_shader, METH_VARARGS | METH_KEYWORDS,
"export_shader(scene,material)\n\n"
"Returns the GLSL shader that produces the visual effect of material in scene.\n\n"
":return: Dictionary defining the shader, uniforms and attributes.\n"
":rtype: Dict"}};
static PyMethodDef meth_export_shader[] = {
{"export_shader", (PyCFunction)GPU_export_shader, METH_VARARGS | METH_KEYWORDS, GPU_export_shader_doc}
};
PyObject* GPU_initPython(void)
{

@ -456,6 +456,7 @@ PyMODINIT_FUNC PyInit_mathutils(void)
Py_INCREF(item);
mathutils_matrix_vector_cb_index= Mathutils_RegisterCallback(&mathutils_matrix_vector_cb);
mathutils_matrix_column_cb_index= Mathutils_RegisterCallback(&mathutils_matrix_column_cb);
return submodule;
}

@ -42,7 +42,7 @@ static PyObject *Matrix_copy(MatrixObject *self);
static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *value);
static PyObject *matrix__apply_to_copy(PyNoArgsFunction matrix_func, MatrixObject *self);
/* matrix vector callbacks */
/* matrix row callbacks */
int mathutils_matrix_vector_cb_index= -1;
static int mathutils_matrix_vector_check(BaseMathObject *bmo)
@ -51,56 +51,56 @@ static int mathutils_matrix_vector_check(BaseMathObject *bmo)
return BaseMath_ReadCallback(self);
}
static int mathutils_matrix_vector_get(BaseMathObject *bmo, int col)
static int mathutils_matrix_vector_get(BaseMathObject *bmo, int row)
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
int row;
int col;
if (BaseMath_ReadCallback(self) == -1)
return -1;
for (row=0; row < self->num_row; row++) {
bmo->data[row] = MATRIX_ITEM(self, row, col);
for (col=0; col < self->num_col; col++) {
bmo->data[col] = MATRIX_ITEM(self, row, col);
}
return 0;
}
static int mathutils_matrix_vector_set(BaseMathObject *bmo, int col)
static int mathutils_matrix_vector_set(BaseMathObject *bmo, int row)
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
int row;
int col;
if (BaseMath_ReadCallback(self) == -1)
return -1;
for (row=0; row < self->num_row; row++) {
MATRIX_ITEM(self, row, col) = bmo->data[row];
for (col=0; col < self->num_col; col++) {
MATRIX_ITEM(self, row, col) = bmo->data[col];
}
(void)BaseMath_WriteCallback(self);
return 0;
}
static int mathutils_matrix_vector_get_index(BaseMathObject *bmo, int col, int row)
static int mathutils_matrix_vector_get_index(BaseMathObject *bmo, int row, int col)
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
if (BaseMath_ReadCallback(self) == -1)
return -1;
bmo->data[row]= MATRIX_ITEM(self, row, col);
bmo->data[col]= MATRIX_ITEM(self, row, col);
return 0;
}
static int mathutils_matrix_vector_set_index(BaseMathObject *bmo, int col, int row)
static int mathutils_matrix_vector_set_index(BaseMathObject *bmo, int row, int col)
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
if (BaseMath_ReadCallback(self) == -1)
return -1;
MATRIX_ITEM(self, row, col) = bmo->data[row];
MATRIX_ITEM(self, row, col) = bmo->data[col];
(void)BaseMath_WriteCallback(self);
return 0;
@ -115,6 +115,87 @@ Mathutils_Callback mathutils_matrix_vector_cb = {
};
/* matrix vector callbacks, this is so you can do matrix[i][j] = val */
/* matrix row callbacks */
int mathutils_matrix_column_cb_index= -1;
static int mathutils_matrix_column_check(BaseMathObject *bmo)
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
return BaseMath_ReadCallback(self);
}
static int mathutils_matrix_column_get(BaseMathObject *bmo, int col)
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
int num_row;
int row;
if (BaseMath_ReadCallback(self) == -1)
return -1;
/* for 'translation' size will always be '3' even on 4x4 vec */
num_row = MIN2(self->num_row, ((VectorObject *)bmo)->size);
for (row = 0; row < num_row; row++) {
bmo->data[row] = MATRIX_ITEM(self, row, col);
}
return 0;
}
static int mathutils_matrix_column_set(BaseMathObject *bmo, int col)
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
int num_row;
int row;
if (BaseMath_ReadCallback(self) == -1)
return -1;
/* for 'translation' size will always be '3' even on 4x4 vec */
num_row = MIN2(self->num_row, ((VectorObject *)bmo)->size);
for (row = 0; row < num_row; row++) {
MATRIX_ITEM(self, row, col) = bmo->data[row];
}
(void)BaseMath_WriteCallback(self);
return 0;
}
static int mathutils_matrix_column_get_index(BaseMathObject *bmo, int col, int row)
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
if (BaseMath_ReadCallback(self) == -1)
return -1;
bmo->data[row]= MATRIX_ITEM(self, row, col);
return 0;
}
static int mathutils_matrix_column_set_index(BaseMathObject *bmo, int col, int row)
{
MatrixObject *self= (MatrixObject *)bmo->cb_user;
if (BaseMath_ReadCallback(self) == -1)
return -1;
MATRIX_ITEM(self, row, col) = bmo->data[row];
(void)BaseMath_WriteCallback(self);
return 0;
}
Mathutils_Callback mathutils_matrix_column_cb = {
mathutils_matrix_column_check,
mathutils_matrix_column_get,
mathutils_matrix_column_set,
mathutils_matrix_column_get_index,
mathutils_matrix_column_set_index
};
/* matrix column callbacks, this is so you can do matrix.translation = Vector() */
//----------------------------------mathutils.Matrix() -----------------
//mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc.
//create a new matrix type
@ -134,15 +215,19 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *arg= PyTuple_GET_ITEM(args, 0);
/* Input is now as a sequence of rows so length of sequence
* is the number of rows */
/* -1 is an error, size checks will accunt for this */
const unsigned short num_col= PySequence_Size(arg);
if (num_col >= 2 && num_col <= 4) {
PyObject *item= PySequence_GetItem(arg, 0);
const unsigned short num_row= PySequence_Size(item);
Py_XDECREF(item);
const unsigned short num_row= PySequence_Size(arg);
if (num_row >= 2 && num_row <= 4) {
PyObject *item= PySequence_GetItem(arg, 0);
/* Since each item is a row, number of items is the
* same as the number of columns */
const unsigned short num_col= PySequence_Size(item);
Py_XDECREF(item);
if (num_col >= 2 && num_col <= 4) {
/* sane row & col size, new matrix and assign as slice */
PyObject *matrix= Matrix_CreatePyObject(NULL, num_col, num_row, Py_NEW, type);
if (Matrix_ass_slice((MatrixObject *)matrix, 0, INT_MAX, arg) == 0) {
@ -761,7 +846,8 @@ PyDoc_STRVAR(Matrix_resize_4x4_doc,
);
static PyObject *Matrix_resize_4x4(MatrixObject *self)
{
int x, first_row_elem, curr_pos, new_pos, blank_columns, blank_rows, index;
float mat[16];
int col;
if (self->wrapped==Py_WRAP) {
PyErr_SetString(PyExc_TypeError,
@ -784,30 +870,14 @@ static PyObject *Matrix_resize_4x4(MatrixObject *self)
return NULL;
}
/*move data to new spot in array + clean*/
for (blank_rows = (4 - self->num_col); blank_rows > 0; blank_rows--) {
for (x = 0; x < 4; x++) {
index = (4 * (self->num_col + (blank_rows - 1))) + x;
if (index == 10 || index == 15) {
self->matrix[index] = 1.0f;
}
else {
self->matrix[index] = 0.0f;
}
}
}
for (x = 1; x <= self->num_col; x++) {
first_row_elem = (self->num_row * (self->num_col - x));
curr_pos = (first_row_elem + (self->num_row -1));
new_pos = (4 * (self->num_col - x)) + (curr_pos - first_row_elem);
for (blank_columns = (4 - self->num_row); blank_columns > 0; blank_columns--) {
self->matrix[new_pos + blank_columns] = 0.0f;
}
for ( ; curr_pos >= first_row_elem; curr_pos--) {
self->matrix[new_pos] = self->matrix[curr_pos];
new_pos--;
}
unit_m4((float (*)[4])mat);
for (col = 0; col < self->num_col; col++) {
memcpy(mat + (4 * col), MATRIX_COL_PTR(self, col), self->num_row * sizeof(float));
}
copy_m4_m4((float (*)[4])self->matrix, (float (*)[4])mat);
self->num_col = 4;
self->num_row = 4;
@ -1298,13 +1368,13 @@ static PyObject *Matrix_repr(MatrixObject *self)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
for (col = 0; col < self->num_col; col++) {
rows[col]= PyTuple_New(self->num_row);
for (row = 0; row < self->num_row; row++) {
PyTuple_SET_ITEM(rows[col], row, PyFloat_FromDouble(MATRIX_ITEM(self, row, col)));
rows[row]= PyTuple_New(self->num_col);
for (col = 0; col < self->num_col; col++) {
PyTuple_SET_ITEM(rows[row], col, PyFloat_FromDouble(MATRIX_ITEM(self, row, col)));
}
}
switch (self->num_col) {
switch (self->num_row) {
case 2: return PyUnicode_FromFormat("Matrix((%R,\n"
" %R))", rows[0], rows[1]);
@ -1402,44 +1472,48 @@ static PyObject* Matrix_richcmpr(PyObject *a, PyObject *b, int op)
sequence length*/
static int Matrix_len(MatrixObject *self)
{
return (self->num_col);
return (self->num_row);
}
/*----------------------------object[]---------------------------
sequence accessor (get)
the wrapped vector gives direct access to the matrix data*/
static PyObject *Matrix_item(MatrixObject *self, int i)
static PyObject *Matrix_item(MatrixObject *self, int row)
{
if (BaseMath_ReadCallback(self) == -1)
return NULL;
if (i < 0 || i >= self->num_col) {
if (row < 0 || row >= self->num_row) {
PyErr_SetString(PyExc_IndexError,
"matrix[attribute]: "
"array index out of range");
return NULL;
}
return Vector_CreatePyObject_cb((PyObject *)self, self->num_row, mathutils_matrix_vector_cb_index, i);
return Vector_CreatePyObject_cb((PyObject *)self, self->num_col, mathutils_matrix_vector_cb_index, row);
}
/*----------------------------object[]-------------------------
sequence accessor (set) */
static int Matrix_ass_item(MatrixObject *self, int i, PyObject *value)
static int Matrix_ass_item(MatrixObject *self, int row, PyObject *value)
{
int col;
float vec[4];
if (BaseMath_ReadCallback(self) == -1)
return -1;
if (i >= self->num_col || i < 0) {
if (row >= self->num_row || row < 0) {
PyErr_SetString(PyExc_IndexError,
"matrix[attribute] = x: bad column");
"matrix[attribute] = x: bad row");
return -1;
}
if (mathutils_array_parse(vec, self->num_row, self->num_row, value, "matrix[i] = value assignment") < 0) {
if (mathutils_array_parse(vec, self->num_col, self->num_col, value, "matrix[i] = value assignment") < 0) {
return -1;
}
memcpy(MATRIX_COL_PTR(self, i), vec, self->num_row * sizeof(float));
/* Since we are assigning a row we cannot memcpy */
for (col = 0; col < self->num_col; col++) {
MATRIX_ITEM(self, row, col) = vec[col];
}
(void)BaseMath_WriteCallback(self);
return 0;
@ -1456,14 +1530,14 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end)
if (BaseMath_ReadCallback(self) == -1)
return NULL;
CLAMP(begin, 0, self->num_col);
CLAMP(end, 0, self->num_col);
CLAMP(begin, 0, self->num_row);
CLAMP(end, 0, self->num_row);
begin= MIN2(begin, end);
tuple= PyTuple_New(end - begin);
for (count= begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin,
Vector_CreatePyObject_cb((PyObject *)self, self->num_row, mathutils_matrix_vector_cb_index, count));
Vector_CreatePyObject_cb((PyObject *)self, self->num_col, mathutils_matrix_vector_cb_index, count));
}
@ -1478,8 +1552,8 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
if (BaseMath_ReadCallback(self) == -1)
return -1;
CLAMP(begin, 0, self->num_col);
CLAMP(end, 0, self->num_col);
CLAMP(begin, 0, self->num_row);
CLAMP(end, 0, self->num_row);
begin = MIN2(begin, end);
/* non list/tuple cases */
@ -1489,8 +1563,9 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
}
else {
const int size= end - begin;
int i;
int row, col;
float mat[16];
float vec[4];
if (PySequence_Fast_GET_SIZE(value_fast) != size) {
Py_DECREF(value_fast);
@ -1500,22 +1575,25 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
return -1;
}
/*parse sub items*/
for (i = 0; i < size; i++) {
/*parse each sub sequence*/
PyObject *item= PySequence_Fast_GET_ITEM(value_fast, i);
memcpy(mat, self->matrix, self->num_col * self->num_row * sizeof(float));
if (mathutils_array_parse(&mat[i * self->num_row], self->num_row, self->num_row, item,
"matrix[begin:end] = value assignment") < 0)
{
/*parse sub items*/
for (row = begin; row < end; row++) {
/*parse each sub sequence*/
PyObject *item= PySequence_Fast_GET_ITEM(value_fast, row - begin);
if (mathutils_array_parse(vec, self->num_col, self->num_col, item, "matrix[begin:end] = value assignment") < 0)
return -1;
for (col = 0; col < self->num_col; col++) {
mat[col * self->num_row + row] = vec[col];
}
}
Py_DECREF(value_fast);
/*parsed well - now set in matrix*/
memcpy(self->matrix + (begin * self->num_row), mat, sizeof(float) * (size * self->num_row));
memcpy(self->matrix, mat, self->num_col * self->num_row * sizeof(float));
(void)BaseMath_WriteCallback(self);
return 0;
@ -1598,6 +1676,7 @@ static PyObject *matrix_mul_float(MatrixObject *mat, const float scalar)
static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
{
float scalar;
int vec_size;
MatrixObject *mat1 = NULL, *mat2 = NULL;
@ -1621,12 +1700,19 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
double dot = 0.0f;
int col, row, item;
if (mat1->num_col != mat2->num_row) {
PyErr_SetString(PyExc_ValueError,
"matrix1 * matrix2: matrix1 number of columns "
"and the matrix2 number of rows must be the same");
return NULL;
}
for (col = 0; col < mat2->num_col; col++) {
for (row = 0; row < mat1->num_row; row++) {
for (item = 0; item < mat1->num_col; item++) {
dot += MATRIX_ITEM(mat1, row, item) * MATRIX_ITEM(mat2, item, col);
}
mat[((col * mat1->num_row) + row)] = (float)dot;
mat[(col * mat1->num_row) + row] = (float)dot;
dot = 0.0f;
}
}
@ -1640,7 +1726,7 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
}
}
else if (mat1) {
/*VEC * MATRIX */
/* MATRIX * VECTOR */
if (VectorObject_Check(m2)) {
VectorObject *vec2= (VectorObject *)m2;
float tvec[4];
@ -1650,7 +1736,14 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
return NULL;
}
return Vector_CreatePyObject(tvec, vec2->size, Py_NEW, Py_TYPE(m2));
if (mat1->num_col == 4 && vec2->size == 3) {
vec_size = 3;
}
else {
vec_size = mat1->num_row;
}
return Vector_CreatePyObject(tvec, vec_size, Py_NEW, Py_TYPE(m2));
}
/*FLOAT/INT * MATRIX */
else if (((scalar= PyFloat_AsDouble(m2)) == -1.0f && PyErr_Occurred())==0) {
@ -1813,6 +1906,51 @@ static PyObject *Matrix_getColSize(MatrixObject *self, void *UNUSED(closure))
return PyLong_FromLong((long) self->num_row);
}
static PyObject *Matrix_translation_get(MatrixObject *self, void *UNUSED(closure))
{
PyObject *ret;
if (BaseMath_ReadCallback(self) == -1)
return NULL;
/*must be 4x4 square matrix*/
if (self->num_row != 4 || self->num_col != 4) {
PyErr_SetString(PyExc_AttributeError,
"Matrix.translation: "
"inappropriate matrix size, must be 4x4");
return NULL;
}
ret = (PyObject *)Vector_CreatePyObject_cb((PyObject *)self, 3, mathutils_matrix_column_cb_index, 3);
return ret;
}
static int Matrix_translation_set(MatrixObject *self, PyObject *value, void *UNUSED(closure))
{
float tvec[3];
if (BaseMath_ReadCallback(self) == -1)
return -1;
/*must be 4x4 square matrix*/
if (self->num_row != 4 || self->num_col != 4) {
PyErr_SetString(PyExc_AttributeError,
"Matrix.translation: "
"inappropriate matrix size, must be 4x4");
return -1;
}
if ((mathutils_array_parse(tvec, 3, 3, value, "Matrix.translation")) == -1)
return -1;
copy_v3_v3(((float (*)[4])self->matrix)[3], tvec);
(void)BaseMath_WriteCallback(self);
return 0;
}
static PyObject *Matrix_median_scale_get(MatrixObject *self, void *UNUSED(closure))
{
float mat[3][3];
@ -1876,6 +2014,7 @@ static PyGetSetDef Matrix_getseters[] = {
{(char *)"row_size", (getter)Matrix_getRowSize, (setter)NULL, (char *)"The row size of the matrix (readonly).\n\n:type: int", NULL},
{(char *)"col_size", (getter)Matrix_getColSize, (setter)NULL, (char *)"The column size of the matrix (readonly).\n\n:type: int", NULL},
{(char *)"median_scale", (getter)Matrix_median_scale_get, (setter)NULL, (char *)"The average scale applied to each axis (readonly).\n\n:type: float", NULL},
{(char *)"translation", (getter)Matrix_translation_get, (setter)Matrix_translation_set, (char *)"The translation component of the matrix.\n\n:type: Vector", NULL},
{(char *)"is_negative", (getter)Matrix_is_negative_get, (setter)NULL, (char *)"True if this matrix results in a negative scale, 3x3 and 4x4 only, (readonly).\n\n:type: bool", NULL},
{(char *)"is_orthogonal", (getter)Matrix_is_orthogonal_get, (setter)NULL, (char *)"True if this matrix is orthogonal, 3x3 and 4x4 only, (readonly).\n\n:type: bool", NULL},
{(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, (char *)BaseMathObject_Wrapped_doc, NULL},

Some files were not shown because too many files have changed in this diff Show More