svn merge ^/trunk/blender -r55815:55840

This commit is contained in:
Sergey Sharybin 2013-04-06 13:24:34 +00:00
commit acfc0ea511
87 changed files with 962 additions and 249 deletions

@ -549,7 +549,7 @@ void BlenderSession::get_progress(float& progress, double& total_time)
session->progress.get_tile(tile, total_time, tile_time); session->progress.get_tile(tile, total_time, tile_time);
sample = session->progress.get_sample(); sample = session->progress.get_sample();
samples_per_tile = session->params.samples; samples_per_tile = session->tile_manager.num_samples;
if(samples_per_tile && tile_total) if(samples_per_tile && tile_total)
progress = ((float)sample / (float)(tile_total * samples_per_tile)); progress = ((float)sample / (float)(tile_total * samples_per_tile));

@ -100,7 +100,6 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
Transform rastertocamera = kernel_data.cam.rastertocamera; Transform rastertocamera = kernel_data.cam.rastertocamera;
float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f)); float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
ray->P = Pcamera;
ray->D = make_float3(0.0f, 0.0f, 1.0f); ray->D = make_float3(0.0f, 0.0f, 1.0f);
/* modify ray for depth of field */ /* modify ray for depth of field */
@ -116,11 +115,12 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
/* update ray for effect of lens */ /* update ray for effect of lens */
float3 lensuvw = make_float3(lensuv.x, lensuv.y, 0.0f); float3 lensuvw = make_float3(lensuv.x, lensuv.y, 0.0f);
ray->P = Pcamera + lensuvw;
ray->P += lensuvw;
ray->D = normalize(Pfocus - lensuvw); ray->D = normalize(Pfocus - lensuvw);
} }
else {
ray->P = Pcamera;
}
/* transform ray from camera to world */ /* transform ray from camera to world */
Transform cameratoworld = kernel_data.cam.cameratoworld; Transform cameratoworld = kernel_data.cam.cameratoworld;

@ -48,6 +48,14 @@ color color_scene_linear_to_srgb(color c)
color_scene_linear_to_srgb(c[2])); color_scene_linear_to_srgb(c[2]));
} }
color color_unpremultiply(color c, float alpha)
{
if(alpha != 1.0 && alpha != 0.0)
return c/alpha;
return c;
}
/* Color Operations */ /* Color Operations */
color rgb_to_hsv(color rgb) color rgb_to_hsv(color rgb)

@ -66,6 +66,9 @@ shader node_environment_texture(
/* todo: use environment for better texture filtering of equirectangular */ /* todo: use environment for better texture filtering of equirectangular */
Color = (color)texture(filename, p[0], 1.0 - p[1], "wrap", "periodic", "alpha", Alpha); Color = (color)texture(filename, p[0], 1.0 - p[1], "wrap", "periodic", "alpha", Alpha);
if (isconnected(Alpha))
Color = color_unpremultiply(Color, Alpha);
if (color_space == "sRGB") if (color_space == "sRGB")
Color = color_srgb_to_scene_linear(Color); Color = color_srgb_to_scene_linear(Color);
} }

@ -19,10 +19,13 @@
#include "stdosl.h" #include "stdosl.h"
#include "node_color.h" #include "node_color.h"
color image_texture_lookup(string filename, string color_space, float u, float v, output float Alpha) color image_texture_lookup(string filename, string color_space, float u, float v, output float Alpha, int use_alpha)
{ {
color rgb = (color)texture(filename, u, 1.0 - v, "wrap", "periodic", "alpha", Alpha); color rgb = (color)texture(filename, u, 1.0 - v, "wrap", "periodic", "alpha", Alpha);
if (use_alpha)
rgb = color_unpremultiply(rgb, Alpha);
if (color_space == "sRGB") if (color_space == "sRGB")
rgb = color_srgb_to_scene_linear(rgb); rgb = color_srgb_to_scene_linear(rgb);
@ -44,9 +47,11 @@ shader node_image_texture(
if (use_mapping) if (use_mapping)
p = transform(mapping, p); p = transform(mapping, p);
int use_alpha = isconnected(Alpha);
if (projection == "Flat") { if (projection == "Flat") {
Color = image_texture_lookup(filename, color_space, p[0], p[1], Alpha); Color = image_texture_lookup(filename, color_space, p[0], p[1], Alpha, use_alpha);
} }
else if (projection == "Box") { else if (projection == "Box") {
/* object space normal */ /* object space normal */
@ -111,15 +116,15 @@ shader node_image_texture(
float tmp_alpha; float tmp_alpha;
if (weight[0] > 0.0) { if (weight[0] > 0.0) {
Color += weight[0] * image_texture_lookup(filename, color_space, p[1], p[2], tmp_alpha); Color += weight[0] * image_texture_lookup(filename, color_space, p[1], p[2], tmp_alpha, use_alpha);
Alpha += weight[0] * tmp_alpha; Alpha += weight[0] * tmp_alpha;
} }
if (weight[1] > 0.0) { if (weight[1] > 0.0) {
Color += weight[1] * image_texture_lookup(filename, color_space, p[0], p[2], tmp_alpha); Color += weight[1] * image_texture_lookup(filename, color_space, p[0], p[2], tmp_alpha, use_alpha);
Alpha += weight[1] * tmp_alpha; Alpha += weight[1] * tmp_alpha;
} }
if (weight[2] > 0.0) { if (weight[2] > 0.0) {
Color += weight[2] * image_texture_lookup(filename, color_space, p[1], p[0], tmp_alpha); Color += weight[2] * image_texture_lookup(filename, color_space, p[1], p[0], tmp_alpha, use_alpha);
Alpha += weight[2] * tmp_alpha; Alpha += weight[2] * tmp_alpha;
} }
} }

@ -50,7 +50,7 @@ __device_inline float svm_image_texture_frac(float x, int *ix)
return x - (float)i; return x - (float)i;
} }
__device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, uint srgb) __device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, uint srgb, uint use_alpha)
{ {
/* first slots are used by float textures, which are not supported here */ /* first slots are used by float textures, which are not supported here */
if(id < TEX_NUM_FLOAT_IMAGES) if(id < TEX_NUM_FLOAT_IMAGES)
@ -88,6 +88,13 @@ __device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, u
r += ty*(1.0f - tx)*svm_image_texture_read(kg, offset + ix + niy*width); r += ty*(1.0f - tx)*svm_image_texture_read(kg, offset + ix + niy*width);
r += ty*tx*svm_image_texture_read(kg, offset + nix + niy*width); r += ty*tx*svm_image_texture_read(kg, offset + nix + niy*width);
if(use_alpha && r.w != 1.0f && r.w != 0.0f) {
float invw = 1.0f/r.w;
r.x *= invw;
r.y *= invw;
r.z *= invw;
}
if(srgb) { if(srgb) {
r.x = color_srgb_to_scene_linear(r.x); r.x = color_srgb_to_scene_linear(r.x);
r.y = color_srgb_to_scene_linear(r.y); r.y = color_srgb_to_scene_linear(r.y);
@ -99,7 +106,7 @@ __device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, u
#else #else
__device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, uint srgb) __device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, uint srgb, uint use_alpha)
{ {
float4 r; float4 r;
@ -222,6 +229,13 @@ __device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y, u
} }
#endif #endif
if(use_alpha && r.w != 1.0f && r.w != 0.0f) {
float invw = 1.0f/r.w;
r.x *= invw;
r.y *= invw;
r.z *= invw;
}
if(srgb) { if(srgb) {
r.x = color_srgb_to_scene_linear(r.x); r.x = color_srgb_to_scene_linear(r.x);
r.y = color_srgb_to_scene_linear(r.y); r.y = color_srgb_to_scene_linear(r.y);
@ -241,7 +255,8 @@ __device void svm_node_tex_image(KernelGlobals *kg, ShaderData *sd, float *stack
decode_node_uchar4(node.z, &co_offset, &out_offset, &alpha_offset, &srgb); decode_node_uchar4(node.z, &co_offset, &out_offset, &alpha_offset, &srgb);
float3 co = stack_load_float3(stack, co_offset); float3 co = stack_load_float3(stack, co_offset);
float4 f = svm_image_texture(kg, id, co.x, co.y, srgb); uint use_alpha = stack_valid(alpha_offset);
float4 f = svm_image_texture(kg, id, co.x, co.y, srgb, use_alpha);
if(stack_valid(out_offset)) if(stack_valid(out_offset))
stack_store_float3(stack, out_offset, make_float3(f.x, f.y, f.z)); stack_store_float3(stack, out_offset, make_float3(f.x, f.y, f.z));
@ -322,13 +337,14 @@ __device void svm_node_tex_image_box(KernelGlobals *kg, ShaderData *sd, float *s
uint id = node.y; uint id = node.y;
float4 f = make_float4(0.0f, 0.0f, 0.0f, 0.0f); float4 f = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
uint use_alpha = stack_valid(alpha_offset);
if(weight.x > 0.0f) if(weight.x > 0.0f)
f += weight.x*svm_image_texture(kg, id, co.y, co.z, srgb); f += weight.x*svm_image_texture(kg, id, co.y, co.z, srgb, use_alpha);
if(weight.y > 0.0f) if(weight.y > 0.0f)
f += weight.y*svm_image_texture(kg, id, co.x, co.z, srgb); f += weight.y*svm_image_texture(kg, id, co.x, co.z, srgb, use_alpha);
if(weight.z > 0.0f) if(weight.z > 0.0f)
f += weight.z*svm_image_texture(kg, id, co.y, co.x, srgb); f += weight.z*svm_image_texture(kg, id, co.y, co.x, srgb, use_alpha);
if(stack_valid(out_offset)) if(stack_valid(out_offset))
stack_store_float3(stack, out_offset, make_float3(f.x, f.y, f.z)); stack_store_float3(stack, out_offset, make_float3(f.x, f.y, f.z));
@ -355,7 +371,8 @@ __device void svm_node_tex_environment(KernelGlobals *kg, ShaderData *sd, float
else else
uv = direction_to_mirrorball(co); uv = direction_to_mirrorball(co);
float4 f = svm_image_texture(kg, id, uv.x, uv.y, srgb); uint use_alpha = stack_valid(alpha_offset);
float4 f = svm_image_texture(kg, id, uv.x, uv.y, srgb, use_alpha);
if(stack_valid(out_offset)) if(stack_valid(out_offset))
stack_store_float3(stack, out_offset, make_float3(f.x, f.y, f.z)); stack_store_float3(stack, out_offset, make_float3(f.x, f.y, f.z));

@ -72,20 +72,33 @@ size_t Attribute::data_sizeof() const
size_t Attribute::element_size(int numverts, int numtris, int numcurves, int numkeys) const size_t Attribute::element_size(int numverts, int numtris, int numcurves, int numkeys) const
{ {
if(element == ATTR_ELEMENT_VALUE) size_t size;
return 1;
if(element == ATTR_ELEMENT_VERTEX)
return numverts;
else if(element == ATTR_ELEMENT_FACE)
return numtris;
else if(element == ATTR_ELEMENT_CORNER)
return numtris*3;
else if(element == ATTR_ELEMENT_CURVE)
return numcurves;
else if(element == ATTR_ELEMENT_CURVE_KEY)
return numkeys;
return 0; switch(element) {
case ATTR_ELEMENT_VALUE:
size = 1;
break;
case ATTR_ELEMENT_VERTEX:
size = numverts;
break;
case ATTR_ELEMENT_FACE:
size = numtris;
break;
case ATTR_ELEMENT_CORNER:
size = numtris*3;
break;
case ATTR_ELEMENT_CURVE:
size = numcurves;
break;
case ATTR_ELEMENT_CURVE_KEY:
size = numkeys;
break;
default:
size = 0;
break;
}
return size;
} }
size_t Attribute::buffer_size(int numverts, int numtris, int numcurves, int numkeys) const size_t Attribute::buffer_size(int numverts, int numtris, int numcurves, int numkeys) const
@ -214,44 +227,66 @@ Attribute *AttributeSet::add(AttributeStandard std, ustring name)
name = Attribute::standard_name(std); name = Attribute::standard_name(std);
if(triangle_mesh) { if(triangle_mesh) {
if(std == ATTR_STD_VERTEX_NORMAL) switch(std) {
attr = add(name, TypeDesc::TypeNormal, ATTR_ELEMENT_VERTEX); case ATTR_STD_VERTEX_NORMAL:
else if(std == ATTR_STD_FACE_NORMAL) attr = add(name, TypeDesc::TypeNormal, ATTR_ELEMENT_VERTEX);
attr = add(name, TypeDesc::TypeNormal, ATTR_ELEMENT_FACE); break;
else if(std == ATTR_STD_UV) case ATTR_STD_FACE_NORMAL:
attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CORNER); attr = add(name, TypeDesc::TypeNormal, ATTR_ELEMENT_FACE);
else if(std == ATTR_STD_UV_TANGENT) break;
attr = add(name, TypeDesc::TypeVector, ATTR_ELEMENT_CORNER); case ATTR_STD_UV:
else if(std == ATTR_STD_UV_TANGENT_SIGN) attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CORNER);
attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_CORNER); break;
else if(std == ATTR_STD_GENERATED) case ATTR_STD_UV_TANGENT:
attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX); attr = add(name, TypeDesc::TypeVector, ATTR_ELEMENT_CORNER);
else if(std == ATTR_STD_POSITION_UNDEFORMED) break;
attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX); case ATTR_STD_UV_TANGENT_SIGN:
else if(std == ATTR_STD_POSITION_UNDISPLACED) attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_CORNER);
attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX); break;
else if(std == ATTR_STD_MOTION_PRE) case ATTR_STD_GENERATED:
attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX); attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX);
else if(std == ATTR_STD_MOTION_POST) break;
attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX); case ATTR_STD_POSITION_UNDEFORMED:
else attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX);
assert(0); break;
case ATTR_STD_POSITION_UNDISPLACED:
attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX);
break;
case ATTR_STD_MOTION_PRE:
attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX);
break;
case ATTR_STD_MOTION_POST:
attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_VERTEX);
break;
default:
assert(0);
break;
}
} }
else if(curve_mesh) { else if(curve_mesh) {
if(std == ATTR_STD_UV) switch(std) {
attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE); case ATTR_STD_UV:
else if(std == ATTR_STD_GENERATED) attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE);
attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE); break;
else if(std == ATTR_STD_MOTION_PRE) case ATTR_STD_GENERATED:
attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE_KEY); attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE);
else if(std == ATTR_STD_MOTION_POST) break;
attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE_KEY); case ATTR_STD_MOTION_PRE:
else if(std == ATTR_STD_CURVE_TANGENT) attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE_KEY);
attr = add(name, TypeDesc::TypeVector, ATTR_ELEMENT_CURVE_KEY); break;
else if(std == ATTR_STD_CURVE_INTERCEPT) case ATTR_STD_MOTION_POST:
attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_CURVE_KEY); attr = add(name, TypeDesc::TypePoint, ATTR_ELEMENT_CURVE_KEY);
else break;
assert(0); case ATTR_STD_CURVE_TANGENT:
attr = add(name, TypeDesc::TypeVector, ATTR_ELEMENT_CURVE_KEY);
break;
case ATTR_STD_CURVE_INTERCEPT:
attr = add(name, TypeDesc::TypeFloat, ATTR_ELEMENT_CURVE_KEY);
break;
default:
assert(0);
break;
}
} }
attr->std = std; attr->std = std;

@ -758,7 +758,7 @@ void Session::update_status_time(bool show_pause, bool show_done)
* also display the info on CPU, when using 1 tile only * also display the info on CPU, when using 1 tile only
*/ */
int sample = progress.get_sample(), num_samples = tile_manager.state.num_samples; int sample = progress.get_sample(), num_samples = tile_manager.num_samples;
if(tile > 1) { if(tile > 1) {
/* sample counter is global for all tiles, subtract samples /* sample counter is global for all tiles, subtract samples
@ -771,10 +771,10 @@ void Session::update_status_time(bool show_pause, bool show_done)
substatus += string_printf(", Sample %d/%d", sample, num_samples); substatus += string_printf(", Sample %d/%d", sample, num_samples);
} }
} }
else if(params.samples == INT_MAX) else if(tile_manager.num_samples == INT_MAX)
substatus = string_printf("Path Tracing Sample %d", sample+1); substatus = string_printf("Path Tracing Sample %d", sample+1);
else else
substatus = string_printf("Path Tracing Sample %d/%d", sample+1, params.samples); substatus = string_printf("Path Tracing Sample %d/%d", sample+1, tile_manager.num_samples);
if(show_pause) if(show_pause)
status = "Paused"; status = "Paused";
@ -846,7 +846,7 @@ void Session::tonemap()
bool Session::update_progressive_refine(bool cancel) bool Session::update_progressive_refine(bool cancel)
{ {
int sample = tile_manager.state.sample + 1; int sample = tile_manager.state.sample + 1;
bool write = sample == params.samples || cancel; bool write = sample == tile_manager.num_samples || cancel;
double current_time = time_dt(); double current_time = time_dt();

@ -58,6 +58,8 @@ public:
list<Tile> tiles; list<Tile> tiles;
} state; } state;
int num_samples;
TileManager(bool progressive, int num_samples, int2 tile_size, int start_resolution, TileManager(bool progressive, int num_samples, int2 tile_size, int start_resolution,
bool preserve_tile_device, bool background, int tile_order, int num_devices = 1); bool preserve_tile_device, bool background, int tile_order, int num_devices = 1);
~TileManager(); ~TileManager();
@ -82,7 +84,6 @@ protected:
void set_tiles(); void set_tiles();
bool progressive; bool progressive;
int num_samples;
int2 tile_size; int2 tile_size;
int tile_order; int tile_order;
int start_resolution; int start_resolution;

@ -155,7 +155,7 @@ Transform transform_inverse(const Transform& tfm)
/* Motion Transform */ /* Motion Transform */
static float4 transform_to_quat(const Transform& tfm) float4 transform_to_quat(const Transform& tfm)
{ {
double trace = tfm[0][0] + tfm[1][1] + tfm[2][2]; double trace = tfm[0][0] + tfm[1][1] + tfm[2][2];
float4 qt; float4 qt;

@ -454,6 +454,7 @@ __device_inline bool operator==(const MotionTransform& A, const MotionTransform&
return (A.pre == B.pre && A.post == B.post); return (A.pre == B.pre && A.post == B.post);
} }
float4 transform_to_quat(const Transform& tfm);
void transform_motion_decompose(DecompMotionTransform *decomp, const MotionTransform *motion, const Transform *mid); void transform_motion_decompose(DecompMotionTransform *decomp, const MotionTransform *motion, const Transform *mid);
#endif #endif

@ -1641,6 +1641,12 @@ class VIEW3D_MT_pose_specials(Menu):
def draw(self, context): def draw(self, context):
layout = self.layout layout = self.layout
layout.operator("paint.weight_from_bones", text="Assign Automatic from Bones").type="AUTOMATIC"
layout.operator("paint.weight_from_bones", text="Assign from Bone Envelopes").type="ENVELOPES"
layout.separator()
layout.operator("pose.select_constraint_target") layout.operator("pose.select_constraint_target")
layout.operator("pose.flip_names") layout.operator("pose.flip_names")
layout.operator("pose.paths_calculate") layout.operator("pose.paths_calculate")
@ -1958,6 +1964,7 @@ class VIEW3D_MT_edit_mesh_faces(Menu):
layout.separator() layout.separator()
layout.operator("mesh.poke")
layout.operator("mesh.quads_convert_to_tris") layout.operator("mesh.quads_convert_to_tris")
layout.operator("mesh.tris_convert_to_quads") layout.operator("mesh.tris_convert_to_quads")

@ -7,15 +7,15 @@
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include "BKE_ccg.h"
#include "CCGSubSurf.h"
#include "BKE_subsurf.h"
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "BLO_sys_types.h" // for intptr_t support #include "BLO_sys_types.h" // for intptr_t support
#include "BLI_utildefines.h" /* for BLI_assert */ #include "BLI_utildefines.h" /* for BLI_assert */
#include "BKE_ccg.h"
#include "CCGSubSurf.h"
#include "BKE_subsurf.h"
/* used for normalize_v3 in BLI_math_vector /* used for normalize_v3 in BLI_math_vector
* float.h's FLT_EPSILON causes trouble with subsurf normals - campbell */ * float.h's FLT_EPSILON causes trouble with subsurf normals - campbell */
#define EPSILON (1.0e-35f) #define EPSILON (1.0e-35f)

@ -32,8 +32,6 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "BKE_cloth.h"
#include "DNA_cloth_types.h" #include "DNA_cloth_types.h"
#include "DNA_group_types.h" #include "DNA_group_types.h"
#include "DNA_mesh_types.h" #include "DNA_mesh_types.h"
@ -52,11 +50,12 @@
#include "BLI_rand.h" #include "BLI_rand.h"
#include "BKE_DerivedMesh.h" #include "BKE_DerivedMesh.h"
#include "BKE_cloth.h"
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_scene.h"
#include "BKE_mesh.h" #include "BKE_mesh.h"
#include "BKE_object.h"
#include "BKE_modifier.h" #include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_scene.h"
#include "BKE_DerivedMesh.h" #include "BKE_DerivedMesh.h"
#ifdef WITH_BULLET #ifdef WITH_BULLET

@ -45,12 +45,12 @@
# include <unistd.h> // read # include <unistd.h> // read
#endif #endif
#include "BLO_readfile.h"
#include "BLO_runtime.h"
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BLO_readfile.h"
#include "BLO_runtime.h"
#include "BKE_blender.h" #include "BKE_blender.h"
#include "BKE_report.h" #include "BKE_report.h"

@ -30,7 +30,6 @@
* \ingroup blenloader * \ingroup blenloader
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
@ -40,13 +39,10 @@
#include "DNA_listBase.h" #include "DNA_listBase.h"
#include "BLO_undofile.h"
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
#include "BLI_linklist.h" #include "BLI_linklist.h"
#include "BLO_undofile.h"
/* **************** support for memory-write, for undo buffers *************** */ /* **************** support for memory-write, for undo buffers *************** */

@ -54,6 +54,7 @@ set(SRC
operators/bmo_join_triangles.c operators/bmo_join_triangles.c
operators/bmo_mesh_conv.c operators/bmo_mesh_conv.c
operators/bmo_mirror.c operators/bmo_mirror.c
operators/bmo_poke.c
operators/bmo_primitive.c operators/bmo_primitive.c
operators/bmo_removedoubles.c operators/bmo_removedoubles.c
operators/bmo_similar.c operators/bmo_similar.c

@ -36,12 +36,12 @@
#include "DNA_mesh_types.h" #include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h" #include "DNA_meshdata_types.h"
#include "BKE_customdata.h"
#include "BKE_multires.h"
#include "BLI_array.h" #include "BLI_array.h"
#include "BLI_math.h" #include "BLI_math.h"
#include "BKE_customdata.h"
#include "BKE_multires.h"
#include "bmesh.h" #include "bmesh.h"
#include "intern/bmesh_private.h" #include "intern/bmesh_private.h"

@ -1500,12 +1500,34 @@ static BMOpDefine bmo_solidify_def = {
}; };
/* /*
* Face Inset. * Face Inset (Individual).
* *
* Inset or outset faces. * Insets individual faces.
*/ */
static BMOpDefine bmo_inset_def = { static BMOpDefine bmo_inset_individual_def = {
"inset", "inset_individual",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
{"thickness", BMO_OP_SLOT_FLT},
{"depth", BMO_OP_SLOT_FLT},
{"use_even_offset", BMO_OP_SLOT_BOOL},
{{'\0'}},
},
/* slots_out */
{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
{{'\0'}},
},
bmo_inset_individual_exec,
0
};
/*
* Face Inset (Regions).
*
* Inset or outset face regions.
*/
static BMOpDefine bmo_inset_region_def = {
"inset_region",
/* slots_in */ /* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */ {{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
{"use_boundary", BMO_OP_SLOT_BOOL}, {"use_boundary", BMO_OP_SLOT_BOOL},
@ -1520,7 +1542,7 @@ static BMOpDefine bmo_inset_def = {
{{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */ {{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
{{'\0'}}, {{'\0'}},
}, },
bmo_inset_exec, bmo_inset_region_exec,
0 0
}; };
@ -1549,6 +1571,29 @@ static BMOpDefine bmo_wireframe_def = {
0 0
}; };
/*
* Pokes a face.
*
* Splits a face into a triangle fan.
*/
static BMOpDefine bmo_poke_def = {
"poke",
/* slots_in */
{{"faces", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* input faces */
{"offset", BMO_OP_SLOT_FLT}, /* center vertex offset along normal */
{"center_mode", BMO_OP_SLOT_INT}, /* calculation mode for center vertex */
{"use_relative_offset", BMO_OP_SLOT_BOOL}, /* apply offset */
{{'\0'}},
},
/* slots_out */
{{"verts.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}}, /* output verts */
{"faces.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_FACE}}, /* output faces */
{{'\0'}},
},
bmo_poke_exec,
0
};
#ifdef WITH_BULLET #ifdef WITH_BULLET
/* /*
* Convex Hull * Convex Hull
@ -1647,13 +1692,15 @@ const BMOpDefine *bmo_opdefines[] = {
&bmo_extrude_face_region_def, &bmo_extrude_face_region_def,
&bmo_extrude_vert_indiv_def, &bmo_extrude_vert_indiv_def,
&bmo_find_doubles_def, &bmo_find_doubles_def,
&bmo_inset_def, &bmo_inset_individual_def,
&bmo_inset_region_def,
&bmo_join_triangles_def, &bmo_join_triangles_def,
&bmo_mesh_to_bmesh_def, &bmo_mesh_to_bmesh_def,
&bmo_mirror_def, &bmo_mirror_def,
&bmo_object_load_bmesh_def, &bmo_object_load_bmesh_def,
&bmo_pointmerge_def, &bmo_pointmerge_def,
&bmo_pointmerge_facedata_def, &bmo_pointmerge_facedata_def,
&bmo_poke_def,
&bmo_recalc_face_normals_def, &bmo_recalc_face_normals_def,
&bmo_region_extend_def, &bmo_region_extend_def,
&bmo_remove_doubles_def, &bmo_remove_doubles_def,

@ -482,6 +482,8 @@ typedef struct BMOElemMapping {
extern const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES]; extern const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES];
int BMO_opcode_from_opname(const char *opname);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

@ -47,7 +47,6 @@ static void bmo_flag_layer_free(BMesh *bm);
static void bmo_flag_layer_clear(BMesh *bm); static void bmo_flag_layer_clear(BMesh *bm);
static int bmo_name_to_slotcode(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier); static int bmo_name_to_slotcode(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
static int bmo_name_to_slotcode_check(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier); static int bmo_name_to_slotcode_check(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier);
static int bmo_opname_to_opcode(const char *opname);
static const char *bmo_error_messages[] = { static const char *bmo_error_messages[] = {
NULL, NULL,
@ -145,7 +144,7 @@ static void bmo_op_slots_init(const BMOSlotType *slot_types, BMOpSlot *slot_args
*/ */
void BMO_op_init(BMesh *bm, BMOperator *op, const int flag, const char *opname) void BMO_op_init(BMesh *bm, BMOperator *op, const int flag, const char *opname)
{ {
int opcode = bmo_opname_to_opcode(opname); int opcode = BMO_opcode_from_opname(opname);
#ifdef DEBUG #ifdef DEBUG
BM_ELEM_INDEX_VALIDATE(bm, "pre bmo", opname); BM_ELEM_INDEX_VALIDATE(bm, "pre bmo", opname);
@ -1522,20 +1521,27 @@ static int bmo_name_to_slotcode_check(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], cons
return i; return i;
} }
static int bmo_opname_to_opcode(const char *opname) int BMO_opcode_from_opname(const char *opname)
{ {
int i;
for (i = 0; i < bmo_opdefines_total; i++) { const unsigned int tot = bmo_opdefines_total;
if (STREQ(opname, bmo_opdefines[i]->opname)) { unsigned int i;
for (i = 0; i < tot; i++) {
if (STREQ(bmo_opdefines[i]->opname, opname)) {
return i; return i;
} }
} }
fprintf(stderr, "%s: could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, opname);
return -1; return -1;
} }
static int BMO_opcode_from_opname_check(const char *opname)
{
int i = BMO_opcode_from_opname(opname);
if (i == -1)
fprintf(stderr, "%s: could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, opname);
return i;
}
/** /**
* \brief Format Strings for #BMOperator Initialization. * \brief Format Strings for #BMOperator Initialization.
* *
@ -1628,10 +1634,11 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
fmt += i + (noslot ? 0 : 1); fmt += i + (noslot ? 0 : 1);
i = bmo_opname_to_opcode(opname); i = BMO_opcode_from_opname_check(opname);
if (i == -1) { if (i == -1) {
MEM_freeN(ofmt); MEM_freeN(ofmt);
BLI_assert(0);
return false; return false;
} }

@ -95,6 +95,13 @@ enum {
VPATH_SELECT_TOPOLOGICAL VPATH_SELECT_TOPOLOGICAL
}; };
/* Poke face center calculation */
enum {
BMOP_POKE_MEAN_WEIGHTED = 0,
BMOP_POKE_MEAN,
BMOP_POKE_BOUNDS
};
extern const BMOpDefine *bmo_opdefines[]; extern const BMOpDefine *bmo_opdefines[];
extern const int bmo_opdefines_total; extern const int bmo_opdefines_total;

@ -65,7 +65,8 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op);
void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op); void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op);
void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op); void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op);
void bmo_find_doubles_exec(BMesh *bm, BMOperator *op); void bmo_find_doubles_exec(BMesh *bm, BMOperator *op);
void bmo_inset_exec(BMesh *bm, BMOperator *op); void bmo_inset_individual_exec(BMesh *bm, BMOperator *op);
void bmo_inset_region_exec(BMesh *bm, BMOperator *op);
void bmo_join_triangles_exec(BMesh *bm, BMOperator *op); void bmo_join_triangles_exec(BMesh *bm, BMOperator *op);
void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op); void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op);
void bmo_mirror_exec(BMesh *bm, BMOperator *op); void bmo_mirror_exec(BMesh *bm, BMOperator *op);
@ -73,6 +74,7 @@ void bmo_object_load_bmesh_exec(BMesh *bm, BMOperator *op);
void bmo_pointmerge_exec(BMesh *bm, BMOperator *op); void bmo_pointmerge_exec(BMesh *bm, BMOperator *op);
void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op); void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op);
void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op); void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op);
void bmo_poke_exec(BMesh *bm, BMOperator *op);
void bmo_region_extend_exec(BMesh *bm, BMOperator *op); void bmo_region_extend_exec(BMesh *bm, BMOperator *op);
void bmo_remove_doubles_exec(BMesh *bm, BMOperator *op); void bmo_remove_doubles_exec(BMesh *bm, BMOperator *op);
void bmo_reverse_colors_exec(BMesh *bm, BMOperator *op); void bmo_reverse_colors_exec(BMesh *bm, BMOperator *op);

@ -336,6 +336,34 @@ void BM_face_calc_center_mean(BMFace *f, float r_cent[3])
mul_v3_fl(r_cent, 1.0f / (float) f->len); mul_v3_fl(r_cent, 1.0f / (float) f->len);
} }
/**
* computes the center of a face, using the mean average
* weighted by edge length
*/
void BM_face_calc_center_mean_weighted(BMFace *f, float r_cent[3])
{
BMLoop *l_iter;
BMLoop *l_first;
float totw = 0.0f;
float w_prev;
zero_v3(r_cent);
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
w_prev = BM_edge_calc_length(l_iter->prev->e);
do {
const float w_curr = BM_edge_calc_length(l_iter->e);
const float w = (w_curr + w_prev);
madd_v3_v3fl(r_cent, l_iter->v->co, w);
totw += w;
w_prev = w_curr;
} while ((l_iter = l_iter->next) != l_first);
if (totw != 0.0f)
mul_v3_fl(r_cent, 1.0f / (float) totw);
}
/** /**
* COMPUTE POLY PLANE * COMPUTE POLY PLANE
* *

@ -37,6 +37,7 @@ float BM_face_calc_area(BMFace *f);
float BM_face_calc_perimeter(BMFace *f); float BM_face_calc_perimeter(BMFace *f);
void BM_face_calc_center_bounds(BMFace *f, float center[3]); void BM_face_calc_center_bounds(BMFace *f, float center[3]);
void BM_face_calc_center_mean(BMFace *f, float center[3]); void BM_face_calc_center_mean(BMFace *f, float center[3]);
void BM_face_calc_center_mean_weighted(BMFace *f, float center[3]);
void BM_face_normal_update(BMFace *f); void BM_face_normal_update(BMFace *f);
void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3], void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3],

@ -24,14 +24,14 @@
* \ingroup bmesh * \ingroup bmesh
* *
* Inset face regions. * Inset face regions.
* Inset individual faces.
* *
* TODO
* - Inset indervidual faces.
*/ */
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "BLI_math.h" #include "BLI_math.h"
#include "BLI_array.h"
#include "bmesh.h" #include "bmesh.h"
@ -39,6 +39,227 @@
#define ELE_NEW 1 #define ELE_NEW 1
/* -------------------------------------------------------------------- */
/* Inset Individual */
/* Holds Per-Face Inset Edge Data */
typedef struct EdgeInsetInfo {
float no[3];
BMEdge *e_old;
BMEdge *e_new;
} EdgeInsetInfo;
/**
* Individual Face Inset.
* Find all tagged faces (f), duplicate edges around faces, inset verts of
* created edges, create new faces between old and new edges, fill face
* between connected new edges, kill old face (f).
*/
void bmo_inset_individual_exec(BMesh *bm, BMOperator *op)
{
BMEdge **f_edges = NULL;
BMVert **f_verts = NULL;
BMFace *f;
BMOIter oiter;
EdgeInsetInfo *eiinfo_arr = NULL;
BLI_array_declare(eiinfo_arr);
BLI_array_declare(f_edges);
BLI_array_declare(f_verts);
const float thickness = BMO_slot_float_get(op->slots_in, "thickness");
const float depth = BMO_slot_float_get(op->slots_in, "depth");
const bool use_even_offset = BMO_slot_bool_get(op->slots_in, "use_even_offset");
/* Only tag faces in slot */
BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, false);
BMO_slot_buffer_hflag_enable(bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, false);
BMO_ITER(f, &oiter, op->slots_in, "faces", BM_FACE) {
BMLoop *l_iter, *l_first;
BMLoop *l_iter_inner = NULL;
int i;
BLI_array_empty(f_verts);
BLI_array_empty(f_edges);
BLI_array_empty(eiinfo_arr);
BLI_array_grow_items(f_verts, f->len);
BLI_array_grow_items(f_edges, f->len);
BLI_array_grow_items(eiinfo_arr, f->len);
/* create verts */
i = 0;
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
f_verts[i] = BM_vert_create(bm, l_iter->v->co, l_iter->v, 0);
i++;
} while ((l_iter = l_iter->next) != l_first);
/* make edges */
i = 0;
l_iter = l_first;
do {
f_edges[i] = BM_edge_create(bm, f_verts[i], f_verts[(i + 1) % f->len], l_iter->e, 0);
eiinfo_arr[i].e_new = f_edges[i];
eiinfo_arr[i].e_old = l_iter->e;
BM_edge_calc_face_tangent(l_iter->e, l_iter, eiinfo_arr[i].no);
/* Tagging (old elements) required when iterating over edges
* connected to verts for translation vector calculation */
BM_elem_flag_enable(l_iter->e, BM_ELEM_TAG);
BM_elem_index_set(l_iter->e, i); /* set_dirty! */
i++;
} while ((l_iter = l_iter->next) != l_first);
/* done with edges */
bm->elem_index_dirty |= BM_EDGE;
/* Calculate translation vector for new */
l_iter = l_first;
do {
EdgeInsetInfo *ei_prev = &eiinfo_arr[BM_elem_index_get(l_iter->prev->e)];
EdgeInsetInfo *ei_next = &eiinfo_arr[BM_elem_index_get(l_iter->e)];
float tvec[3];
float v_new_co[3];
int index = 0;
add_v3_v3v3(tvec, ei_prev->no, ei_next->no);
normalize_v3(tvec);
/* l->e is traversed in order */
index = BM_elem_index_get(l_iter->e);
copy_v3_v3(v_new_co, eiinfo_arr[index].e_new->v1->co);
if (use_even_offset) {
mul_v3_fl(tvec, shell_angle_to_dist(angle_normalized_v3v3(ei_prev->no, ei_next->no) / 2.0f));
}
/* Modify vertices and their normals */
madd_v3_v3fl(v_new_co, tvec, thickness);
/* Set normal, add depth and write new vertex position*/
copy_v3_v3(eiinfo_arr[index].e_new->v1->no, f->no);
madd_v3_v3fl(v_new_co, f->no, depth);
copy_v3_v3(eiinfo_arr[index].e_new->v1->co, v_new_co);
} while ((l_iter = l_iter->next) != l_first);
{
BMFace *f_new_inner;
/* Create New Inset Faces */
f_new_inner = BM_face_create(bm, f_verts, f_edges, f->len, 0);
if (UNLIKELY(f_new_inner == NULL)) {
BMO_error_raise(bm, op, BMERR_MESH_ERROR, "Inset failed: could not create inner face.");
BLI_array_free(f_edges);
BLI_array_free(f_verts);
BLI_array_free(eiinfo_arr);
return;
}
/* Copy Face Data */
BM_elem_attrs_copy(bm, bm, f, f_new_inner);
// Don't tag, gives more useful inner/outer select option
// BMO_elem_flag_enable(bm, f_new_inner, ELE_NEW);
l_iter_inner = BM_FACE_FIRST_LOOP(f_new_inner);
}
l_iter = l_first;
do {
BMFace *f_new_outer;
BMLoop *l_iter_sub;
BMLoop *l_a = NULL;
BMLoop *l_b = NULL;
BMLoop *l_a_other = NULL;
BMLoop *l_b_other = NULL;
BMLoop *l_shared = NULL;
BM_elem_attrs_copy(bm, bm, l_iter, l_iter_inner);
f_new_outer = BM_face_create_quad_tri(bm,
l_iter->v,
l_iter->next->v,
l_iter_inner->next->v,
l_iter_inner->v,
f, false);
if (UNLIKELY(f_new_outer == NULL)) {
BMO_error_raise(bm, op, BMERR_MESH_ERROR, "Inset failed: could not create an outer face.");
BLI_array_free(f_edges);
BLI_array_free(f_verts);
BLI_array_free(eiinfo_arr);
return;
}
BM_elem_attrs_copy(bm, bm, f, f_new_outer);
BMO_elem_flag_enable(bm, f_new_outer, ELE_NEW);
BM_elem_flag_enable(f_new_outer, BM_ELEM_TAG);
/* Copy Loop Data */
l_a = BM_FACE_FIRST_LOOP(f_new_outer);
l_b = l_a->next;
l_iter_sub = l_iter;
/* Skip old face f and new inset face.
* If loop if found we are a boundary. This
* is required as opposed to BM_edge_is_boundary()
* Because f_new_outer shares an edge with f */
do {
if (l_iter_sub->f != f && l_iter_sub->f != f_new_outer) {
l_shared = l_iter_sub;
break;
}
} while ((l_iter_sub = l_iter_sub->radial_next) != l_iter);
if (l_shared) {
BM_elem_attrs_copy(bm, bm, l_shared, l_a->next);
BM_elem_attrs_copy(bm, bm, l_shared->next, l_a);
}
else {
l_a_other = BM_edge_other_loop(l_a->e, l_a);
l_b_other = l_a_other->next;
BM_elem_attrs_copy(bm, bm, l_a_other, l_a);
BM_elem_attrs_copy(bm, bm, l_b_other, l_b);
}
/* Move to the last two loops in new face */
l_a = l_b->next;
l_b = l_a->next;
/* This loop should always have >1 radials
* (associated edge connects new and old face) */
BM_elem_attrs_copy(bm, bm, l_iter, l_b);
BM_elem_attrs_copy(bm, bm, l_iter->next, l_a);
} while ((l_iter_inner = l_iter_inner->next),
(l_iter = l_iter->next) != l_first);
BM_face_kill(bm, f);
}
/* we could flag new edges/verts too, is it useful? */
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, ELE_NEW);
BLI_array_free(f_verts);
BLI_array_free(f_edges);
BLI_array_free(eiinfo_arr);
}
/* -------------------------------------------------------------------- */
/* Inset Region */
typedef struct SplitEdgeInfo { typedef struct SplitEdgeInfo {
float no[3]; float no[3];
float length; float length;
@ -95,7 +316,7 @@ static BMLoop *bm_edge_is_mixed_face_tag(BMLoop *l)
* - inset the new edges into their faces. * - inset the new edges into their faces.
*/ */
void bmo_inset_exec(BMesh *bm, BMOperator *op) void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
{ {
const bool use_outset = BMO_slot_bool_get(op->slots_in, "use_outset"); const bool use_outset = BMO_slot_bool_get(op->slots_in, "use_outset");
const bool use_boundary = BMO_slot_bool_get(op->slots_in, "use_boundary") && (use_outset == false); const bool use_boundary = BMO_slot_bool_get(op->slots_in, "use_boundary") && (use_outset == false);

@ -33,11 +33,11 @@
#include "DNA_meshdata_types.h" #include "DNA_meshdata_types.h"
#include "BKE_customdata.h"
#include "BLI_math.h" #include "BLI_math.h"
#include "BLI_array.h" #include "BLI_array.h"
#include "BKE_customdata.h"
#include "bmesh.h" #include "bmesh.h"
#include "intern/bmesh_operators_private.h" /* own include */ #include "intern/bmesh_operators_private.h" /* own include */

@ -0,0 +1,141 @@
/*
* ***** 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.
*
* Contributor(s): Francisco De La Cruz
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/bmesh/operators/bmo_poke.c
* \ingroup bmesh
*
* Pokes a face.
*
* Splits a face into a triangle fan.
*/
#include "BLI_math.h"
#include "bmesh.h"
#include "intern/bmesh_operators_private.h" /* own include */
#define ELE_NEW 1
/**
* Pokes a face
*
* Splits a face into a triangle fan.
* Iterate over all selected faces, create a new center vertex and
* create triangles between original face edges and new center vertex.
*/
void bmo_poke_exec(BMesh *bm, BMOperator *op)
{
BMOIter oiter;
BMFace *f;
const float offset = BMO_slot_float_get(op->slots_in, "offset");
const bool use_relative_offset = BMO_slot_bool_get(op->slots_in, "use_relative_offset");
const int center_mode = BMO_slot_int_get(op->slots_in, "center_mode");
void (*bm_face_calc_center_fn)(BMFace *f, float r_cent[3]);
switch (center_mode) {
case BMOP_POKE_MEAN_WEIGHTED:
bm_face_calc_center_fn = BM_face_calc_center_mean_weighted;
break;
case BMOP_POKE_BOUNDS:
bm_face_calc_center_fn = BM_face_calc_center_bounds;
break;
case BMOP_POKE_MEAN:
bm_face_calc_center_fn = BM_face_calc_center_mean;
break;
default:
BLI_assert(0);
break;
}
BMO_ITER(f, &oiter, op->slots_in, "faces", BM_FACE) {
BMFace *f_new;
float f_center[3];
BMVert *v_center = NULL;
BMLoop *l_iter, *l_first;
/* only interpolate the centeral loop from the face once,
* then copy to all others in the fan */
BMLoop *l_center_example;
/* 1.0 or the average length from the center to the face verts */
float offset_fac;
int i;
bm_face_calc_center_fn(f, f_center);
v_center = BM_vert_create(bm, f_center, NULL, 0);
BMO_elem_flag_enable(bm, v_center, ELE_NEW);
/* handled by BM_loop_interp_from_face */
// BM_vert_interp_from_face(bm, v_center, f);
if (use_relative_offset) {
offset_fac = 0.0f;
}
else {
offset_fac = 1.0f;
}
i = 0;
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
BMLoop *l_new;
f_new = BM_face_create_quad_tri(bm, l_iter->v, l_iter->next->v, v_center, NULL, f, false);
l_new = BM_FACE_FIRST_LOOP(f_new);
if (i == 0) {
l_center_example = l_new->prev;
BM_loop_interp_from_face(bm, l_center_example, f, true, true);
}
else {
BM_elem_attrs_copy(bm, bm, l_center_example, l_new->prev);
}
/* Copy Loop Data */
BM_elem_attrs_copy(bm, bm, l_iter, l_new);
BM_elem_attrs_copy(bm, bm, l_iter->next, l_new->next);
BMO_elem_flag_enable(bm, f_new, ELE_NEW);
if (use_relative_offset) {
offset_fac += len_v3v3(f_center, l_iter->v->co);
}
} while (i++, (l_iter = l_iter->next) != l_first);
if (use_relative_offset) {
offset_fac /= (float)f->len;
}
/* else remain at 1.0 */
copy_v3_v3(v_center->no, f->no);
madd_v3_v3fl(v_center->co, v_center->no, offset * offset_fac);
/* Kill Face */
BM_face_kill(bm, f);
}
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "verts.out", BM_VERT, ELE_NEW);
BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, ELE_NEW);
}

@ -23,8 +23,6 @@
#include <list> #include <list>
#include <stdio.h> #include <stdio.h>
#include "BKE_global.h"
#include "COM_compositor.h" #include "COM_compositor.h"
#include "COM_WorkScheduler.h" #include "COM_WorkScheduler.h"
#include "COM_CPUDevice.h" #include "COM_CPUDevice.h"
@ -38,6 +36,8 @@
#include "PIL_time.h" #include "PIL_time.h"
#include "BLI_threads.h" #include "BLI_threads.h"
#include "BKE_global.h"
#if COM_CURRENT_THREADING_MODEL == COM_TM_NOTHREAD #if COM_CURRENT_THREADING_MODEL == COM_TM_NOTHREAD
# ifndef DEBUG /* test this so we dont get warnings in debug builds */ # ifndef DEBUG /* test this so we dont get warnings in debug builds */
# warning COM_CURRENT_THREADING_MODEL COM_TM_NOTHREAD is activated. Use only for debugging. # warning COM_CURRENT_THREADING_MODEL COM_TM_NOTHREAD is activated. Use only for debugging.

@ -26,13 +26,13 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "BKE_context.h"
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
#include "BLI_math.h" #include "BLI_math.h"
#include "BLI_edgehash.h" #include "BLI_edgehash.h"
#include "BLI_ghash.h" #include "BLI_ghash.h"
#include "BKE_context.h"
#include "reeb.h" #include "reeb.h"
#if 0 /* UNUSED 2.5 */ #if 0 /* UNUSED 2.5 */

@ -38,12 +38,12 @@
#include "DNA_listBase.h" #include "DNA_listBase.h"
#include "DNA_windowmanager_types.h" #include "DNA_windowmanager_types.h"
#include "BLI_listbase.h"
#include "BKE_blender.h" #include "BKE_blender.h"
#include "BKE_context.h" #include "BKE_context.h"
#include "BKE_gpencil.h" #include "BKE_gpencil.h"
#include "BLI_listbase.h"
#include "ED_gpencil.h" #include "ED_gpencil.h"
#include "WM_api.h" #include "WM_api.h"

@ -311,4 +311,4 @@ const unsigned char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, i
void UI_make_axis_color(const unsigned char *src_col, unsigned char *dst_col, const char axis); void UI_make_axis_color(const unsigned char *src_col, unsigned char *dst_col, const char axis);
#endif /* UI_RESOURCES_H */ #endif /* __UI_RESOURCES_H__ */

@ -2233,6 +2233,17 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
retval = WM_UI_HANDLER_BREAK; retval = WM_UI_HANDLER_BREAK;
break; break;
case AKEY:
/* Ctrl + A: Select all */
if (event->ctrl && !(event->alt || event->shift || event->oskey)) {
ui_textedit_move(but, data, STRCUR_DIR_PREV,
false, STRCUR_JUMP_ALL);
ui_textedit_move(but, data, STRCUR_DIR_NEXT,
true, STRCUR_JUMP_ALL);
retval = WM_UI_HANDLER_BREAK;
}
break;
case TABKEY: case TABKEY:
/* there is a key conflict here, we can't tab with autocomplete */ /* there is a key conflict here, we can't tab with autocomplete */
if (but->autocomplete_func || data->searchbox) { if (but->autocomplete_func || data->searchbox) {

@ -2506,8 +2506,8 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int
/* make the progress bar a proportion of the original height */ /* make the progress bar a proportion of the original height */
/* hardcoded 4px high for now */ /* hardcoded 4px high for now */
rect_prog.ymax = rect_prog.ymin + 4; rect_prog.ymax = rect_prog.ymin + 4 * UI_DPI_FAC;
rect_bar.ymax = rect_bar.ymin + 4; rect_bar.ymax = rect_bar.ymin + 4 * UI_DPI_FAC;
w = value * BLI_rcti_size_x(&rect_prog); w = value * BLI_rcti_size_x(&rect_prog);
@ -2520,8 +2520,8 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int
uiWidgetScrollDraw(wcol, &rect_prog, &rect_bar, UI_SCROLL_NO_OUTLINE); uiWidgetScrollDraw(wcol, &rect_prog, &rect_bar, UI_SCROLL_NO_OUTLINE);
/* raise text a bit */ /* raise text a bit */
rect->ymin += 6; rect->ymin += 6 * UI_DPI_FAC;
rect->xmin -= 6; rect->xmin -= 6 * UI_DPI_FAC;
} }
static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))

@ -80,7 +80,7 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C)
InsetData *opdata = op->customdata; InsetData *opdata = op->customdata;
const char *str = IFACE_("Confirm: Enter/LClick, Cancel: (Esc/RClick), Thickness: %s, " const char *str = IFACE_("Confirm: Enter/LClick, Cancel: (Esc/RClick), Thickness: %s, "
"Depth (Ctrl to tweak): %s (%s), Outset (O): (%s), Boundary (B): (%s)"); "Depth (Ctrl to tweak): %s (%s), Outset (O): (%s), Boundary (B): (%s), Individual (I): (%s)");
char msg[HEADER_LENGTH]; char msg[HEADER_LENGTH];
ScrArea *sa = CTX_wm_area(C); ScrArea *sa = CTX_wm_area(C);
@ -98,7 +98,8 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C)
flts_str + NUM_STR_REP_LEN, flts_str + NUM_STR_REP_LEN,
opdata->modify_depth ? IFACE_("On") : IFACE_("Off"), opdata->modify_depth ? IFACE_("On") : IFACE_("Off"),
RNA_boolean_get(op->ptr, "use_outset") ? IFACE_("On") : IFACE_("Off"), RNA_boolean_get(op->ptr, "use_outset") ? IFACE_("On") : IFACE_("Off"),
RNA_boolean_get(op->ptr, "use_boundary") ? IFACE_("On") : IFACE_("Off") RNA_boolean_get(op->ptr, "use_boundary") ? IFACE_("On") : IFACE_("Off"),
RNA_boolean_get(op->ptr, "individual") ? IFACE_("On") : IFACE_("Off")
); );
ED_area_headerprint(sa, msg); ED_area_headerprint(sa, msg);
@ -191,6 +192,7 @@ static int edbm_inset_calc(wmOperator *op)
const float depth = RNA_float_get(op->ptr, "depth"); const float depth = RNA_float_get(op->ptr, "depth");
const bool use_outset = RNA_boolean_get(op->ptr, "use_outset"); const bool use_outset = RNA_boolean_get(op->ptr, "use_outset");
const bool use_select_inset = RNA_boolean_get(op->ptr, "use_select_inset"); /* not passed onto the BMO */ const bool use_select_inset = RNA_boolean_get(op->ptr, "use_select_inset"); /* not passed onto the BMO */
const bool individual = RNA_boolean_get(op->ptr, "individual");
opdata = op->customdata; opdata = op->customdata;
em = opdata->em; em = opdata->em;
@ -199,12 +201,18 @@ static int edbm_inset_calc(wmOperator *op)
EDBM_redo_state_restore(opdata->mesh_backup, em, false); EDBM_redo_state_restore(opdata->mesh_backup, em, false);
} }
EDBM_op_init(em, &bmop, op, if (individual) {
"inset faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b " EDBM_op_init(em, &bmop, op,
"thickness=%f depth=%f use_outset=%b", "inset_individual faces=%hf thickness=%f depth=%f use_even_offset=%b",
BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset, BM_ELEM_SELECT, thickness, depth, use_even_offset);
thickness, depth, use_outset); }
else {
EDBM_op_init(em, &bmop, op,
"inset_region faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b "
"thickness=%f depth=%f use_outset=%b",
BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset,
thickness, depth, use_outset);
}
BMO_op_exec(em->bm, &bmop); BMO_op_exec(em->bm, &bmop);
if (use_select_inset) { if (use_select_inset) {
@ -410,6 +418,20 @@ static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event)
} }
} }
break; break;
case IKEY:
if (event->val == KM_PRESS) {
int individual = RNA_boolean_get(op->ptr, "individual");
RNA_boolean_set(op->ptr, "individual", !individual);
if (edbm_inset_calc(op)) {
edbm_inset_update_header(op, C);
}
else {
edbm_inset_cancel(C, op);
return OPERATOR_CANCELLED;
}
}
break;
} }
return OPERATOR_RUNNING_MODAL; return OPERATOR_RUNNING_MODAL;
@ -448,4 +470,5 @@ void MESH_OT_inset(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "use_outset", false, "Outset", "Outset rather than inset"); RNA_def_boolean(ot->srna, "use_outset", false, "Outset", "Outset rather than inset");
RNA_def_boolean(ot->srna, "use_select_inset", true, "Select Outer", "Select the new inset faces"); RNA_def_boolean(ot->srna, "use_select_inset", true, "Select Outer", "Select the new inset faces");
RNA_def_boolean(ot->srna, "individual", false, "Individual", "Individual Face Inset");
} }

@ -2632,6 +2632,67 @@ void MESH_OT_beautify_fill(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
} }
/********************** Poke Face **********************/
static int edbm_poke_face_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
BMOperator bmop;
const float offset = RNA_float_get(op->ptr, "offset");
const bool use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset");
const int center_mode = RNA_enum_get(op->ptr, "center_mode");
EDBM_op_init(em, &bmop, op, "poke faces=%hf offset=%f use_relative_offset=%b center_mode=%i",
BM_ELEM_SELECT, offset, use_relative_offset, center_mode);
BMO_op_exec(em->bm, &bmop);
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "verts.out", BM_VERT, BM_ELEM_SELECT, true);
BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true);
if (!EDBM_op_finish(em, &bmop, op, true)) {
return OPERATOR_CANCELLED;
}
EDBM_mesh_normals_update(em);
EDBM_update_generic(em, true, true);
return OPERATOR_FINISHED;
}
void MESH_OT_poke(wmOperatorType *ot)
{
static EnumPropertyItem poke_center_modes[] = {
{BMOP_POKE_MEAN_WEIGHTED, "MEAN_WEIGHTED", 0, "Weighted Mean", "Weighted Mean Face Center"},
{BMOP_POKE_MEAN, "MEAN", 0, "Mean", "Mean Face Center"},
{BMOP_POKE_BOUNDS, "BOUNDS", 0, "Bounds", "Face Bounds Center"},
{0, NULL, 0, NULL, NULL}};
/* identifiers */
ot->name = "Poke Faces";
ot->idname = "MESH_OT_poke";
ot->description = "Splits a face into a fan";
/* api callbacks */
ot->exec = edbm_poke_face_exec;
ot->poll = ED_operator_editmesh;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_float(ot->srna, "offset", 0.0f, -FLT_MAX, FLT_MAX, "Poke Offset", "Poke Offset", -1.0f, 1.0f);
RNA_def_boolean(ot->srna, "use_relative_offset", false, "Offset Relative", "Scale the offset by surrounding geometry");
RNA_def_enum(ot->srna, "center_mode", poke_center_modes, BMOP_POKE_MEAN_WEIGHTED, "Poke Center", "Poke Face Center Calculation");
}
/********************** Quad/Tri Operators *************************/ /********************** Quad/Tri Operators *************************/
static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op) static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op)
@ -2660,6 +2721,7 @@ static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
} }
void MESH_OT_quads_convert_to_tris(wmOperatorType *ot) void MESH_OT_quads_convert_to_tris(wmOperatorType *ot)
{ {
/* identifiers */ /* identifiers */

@ -202,6 +202,7 @@ void MESH_OT_edge_face_add(struct wmOperatorType *ot);
void MESH_OT_duplicate(struct wmOperatorType *ot); void MESH_OT_duplicate(struct wmOperatorType *ot);
void MESH_OT_merge(struct wmOperatorType *ot); void MESH_OT_merge(struct wmOperatorType *ot);
void MESH_OT_remove_doubles(struct wmOperatorType *ot); void MESH_OT_remove_doubles(struct wmOperatorType *ot);
void MESH_OT_poke(struct wmOperatorType *ot);
#ifdef WITH_FREESTYLE #ifdef WITH_FREESTYLE
void MESH_OT_mark_freestyle_edge(struct wmOperatorType *ot); void MESH_OT_mark_freestyle_edge(struct wmOperatorType *ot);

@ -158,6 +158,7 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_bridge_edge_loops); WM_operatortype_append(MESH_OT_bridge_edge_loops);
WM_operatortype_append(MESH_OT_inset); WM_operatortype_append(MESH_OT_inset);
WM_operatortype_append(MESH_OT_poke);
WM_operatortype_append(MESH_OT_wireframe); WM_operatortype_append(MESH_OT_wireframe);
WM_operatortype_append(MESH_OT_edge_split); WM_operatortype_append(MESH_OT_edge_split);
@ -266,7 +267,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "MESH_OT_loopcut_slide", RKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "MESH_OT_loopcut_slide", RKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "MESH_OT_inset", IKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "MESH_OT_inset", IKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "MESH_OT_poke", PKEY, KM_PRESS, KM_ALT, 0);
kmi = WM_keymap_add_item(keymap, "MESH_OT_bevel", BKEY, KM_PRESS, KM_CTRL, 0); kmi = WM_keymap_add_item(keymap, "MESH_OT_bevel", BKEY, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(kmi->ptr, "vertex_only", false); RNA_boolean_set(kmi->ptr, "vertex_only", false);
kmi = WM_keymap_add_item(keymap, "MESH_OT_bevel", BKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); kmi = WM_keymap_add_item(keymap, "MESH_OT_bevel", BKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);

@ -43,13 +43,13 @@
#endif #endif
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "BLO_readfile.h"
#include "BLI_math.h" #include "BLI_math.h"
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
#include "BLI_threads.h" #include "BLI_threads.h"
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BLO_readfile.h"
#include "DNA_world_types.h" #include "DNA_world_types.h"
#include "DNA_camera_types.h" #include "DNA_camera_types.h"
#include "DNA_material_types.h" #include "DNA_material_types.h"

@ -993,8 +993,6 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", VKEY, KM_PRESS, 0, 0); /* vert mask toggle */ kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", VKEY, KM_PRESS, 0, 0); /* vert mask toggle */
RNA_string_set(kmi->ptr, "data_path", "weight_paint_object.data.use_paint_mask_vertex"); RNA_string_set(kmi->ptr, "data_path", "weight_paint_object.data.use_paint_mask_vertex");
WM_keymap_verify_item(keymap, "PAINT_OT_weight_from_bones", WKEY, KM_PRESS, 0, 0);
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", SKEY, KM_PRESS, KM_SHIFT, 0); kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", SKEY, KM_PRESS, KM_SHIFT, 0);
RNA_string_set(kmi->ptr, "data_path", "tool_settings.weight_paint.brush.use_smooth_stroke"); RNA_string_set(kmi->ptr, "data_path", "tool_settings.weight_paint.brush.use_smooth_stroke");

@ -35,10 +35,6 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "BKE_context.h"
#include "BKE_movieclip.h"
#include "BKE_tracking.h"
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BLI_math.h" #include "BLI_math.h"
#include "BLI_string.h" #include "BLI_string.h"
@ -46,6 +42,10 @@
#include "BLI_math.h" #include "BLI_math.h"
#include "BLI_rect.h" #include "BLI_rect.h"
#include "BKE_context.h"
#include "BKE_movieclip.h"
#include "BKE_tracking.h"
#include "ED_screen.h" #include "ED_screen.h"
#include "ED_clip.h" #include "ED_clip.h"

@ -37,11 +37,6 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "BKE_context.h"
#include "BKE_movieclip.h"
#include "BKE_tracking.h"
#include "BKE_mask.h"
#include "IMB_colormanagement.h" #include "IMB_colormanagement.h"
#include "IMB_imbuf_types.h" #include "IMB_imbuf_types.h"
#include "IMB_imbuf.h" #include "IMB_imbuf.h"
@ -52,6 +47,11 @@
#include "BLI_rect.h" #include "BLI_rect.h"
#include "BLI_math_base.h" #include "BLI_math_base.h"
#include "BKE_context.h"
#include "BKE_movieclip.h"
#include "BKE_tracking.h"
#include "BKE_mask.h"
#include "ED_screen.h" #include "ED_screen.h"
#include "ED_clip.h" #include "ED_clip.h"
#include "ED_mask.h" #include "ED_mask.h"

@ -35,14 +35,14 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "BKE_context.h"
#include "BKE_movieclip.h"
#include "BKE_tracking.h"
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BLI_math.h" #include "BLI_math.h"
#include "BLI_string.h" #include "BLI_string.h"
#include "BKE_context.h"
#include "BKE_movieclip.h"
#include "BKE_tracking.h"
#include "ED_screen.h" #include "ED_screen.h"
#include "ED_clip.h" #include "ED_clip.h"

@ -28,13 +28,12 @@
* \ingroup spfile * \ingroup spfile
*/ */
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BKE_context.h" #include "BKE_context.h"
#include "BKE_screen.h" #include "BKE_screen.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BLF_translation.h" #include "BLF_translation.h"
#include "DNA_screen_types.h" #include "DNA_screen_types.h"

@ -35,14 +35,14 @@
#include "BIF_gl.h" #include "BIF_gl.h"
#include "BLO_readfile.h"
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
#include "BLI_math.h" #include "BLI_math.h"
#include "BLI_rand.h" #include "BLI_rand.h"
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BLI_fileops_types.h" #include "BLI_fileops_types.h"
#include "BLO_readfile.h"
#include "BKE_context.h" #include "BKE_context.h"
#include "BKE_screen.h" #include "BKE_screen.h"
#include "BKE_global.h" #include "BKE_global.h"

@ -438,7 +438,6 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
case NC_WINDOW: case NC_WINDOW:
/* notifier comes from editing color space */ /* notifier comes from editing color space */
image_scopes_tag_refresh(sa); image_scopes_tag_refresh(sa);
ED_area_tag_refresh(sa);
ED_area_tag_redraw(sa); ED_area_tag_redraw(sa);
break; break;
case NC_SCENE: case NC_SCENE:

@ -31,10 +31,10 @@
#include "DNA_node_types.h" #include "DNA_node_types.h"
#include "BKE_context.h"
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BKE_context.h"
#include "ED_node.h" /* own include */ #include "ED_node.h" /* own include */
#include "ED_screen.h" #include "ED_screen.h"
#include "ED_transform.h" #include "ED_transform.h"

@ -49,12 +49,12 @@
#include "BIF_gl.h" #include "BIF_gl.h"
#include "BIF_glutil.h" #include "BIF_glutil.h"
#include "BKE_context.h"
#include "BLI_math.h" #include "BLI_math.h"
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BLI_string.h" #include "BLI_string.h"
#include "BKE_context.h"
#include "ED_image.h" #include "ED_image.h"
#include "ED_view3d.h" #include "ED_view3d.h"

@ -186,6 +186,11 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
//#ifdef WITH_PYTHON //#ifdef WITH_PYTHON
// XXX BPY_scripts_clear_pyobjects(); // XXX BPY_scripts_clear_pyobjects();
//#endif //#endif
/* for global undo/redo we should just clear the editmode stack */
/* for example, texface stores image pointers */
undo_editmode_clear();
if (undoname) if (undoname)
BKE_undo_name(C, undoname); BKE_undo_name(C, undoname);
else else

@ -27,9 +27,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <limits.h> #include <limits.h>
#include "BKE_cloth.h"
#include "BKE_modifier.h"
#include "DNA_cloth_types.h" #include "DNA_cloth_types.h"
#include "DNA_object_types.h" #include "DNA_object_types.h"
#include "DNA_scene_types.h" #include "DNA_scene_types.h"
@ -38,6 +35,9 @@
#include "rna_internal.h" #include "rna_internal.h"
#include "BKE_cloth.h"
#include "BKE_modifier.h"
#include "WM_api.h" #include "WM_api.h"
#include "WM_types.h" #include "WM_types.h"

@ -27,12 +27,12 @@
#ifndef __RNA_INTERNAL_H__ #ifndef __RNA_INTERNAL_H__
#define __RNA_INTERNAL_H__ #define __RNA_INTERNAL_H__
#include "UI_resources.h"
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "rna_internal_types.h" #include "rna_internal_types.h"
#include "UI_resources.h"
#define RNA_MAGIC ((int)~0) #define RNA_MAGIC ((int)~0)
struct ColorBand; struct ColorBand;

@ -30,9 +30,6 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "BKE_movieclip.h"
#include "BKE_tracking.h"
#include "DNA_movieclip_types.h" #include "DNA_movieclip_types.h"
#include "DNA_scene_types.h" #include "DNA_scene_types.h"
@ -40,6 +37,9 @@
#include "rna_internal.h" #include "rna_internal.h"
#include "BKE_movieclip.h"
#include "BKE_tracking.h"
#include "WM_types.h" #include "WM_types.h"
#include "IMB_imbuf_types.h" #include "IMB_imbuf_types.h"

@ -33,7 +33,7 @@
/* **************** ALPHAOVER ******************** */ /* **************** ALPHAOVER ******************** */
static bNodeSocketTemplate cmp_node_alphaover_in[] = { static bNodeSocketTemplate cmp_node_alphaover_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ -1, 0, "" } { -1, 0, "" }

@ -36,7 +36,7 @@
/* **************** BLUR ******************** */ /* **************** BLUR ******************** */
static bNodeSocketTemplate cmp_node_blur_in[] = { static bNodeSocketTemplate cmp_node_blur_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Size"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Size"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" } { -1, 0, "" }
}; };
static bNodeSocketTemplate cmp_node_blur_out[] = { static bNodeSocketTemplate cmp_node_blur_out[] = {

@ -34,7 +34,7 @@
/* ******************* Color Spill Supression ********************************* */ /* ******************* Color Spill Supression ********************************* */
static bNodeSocketTemplate cmp_node_color_spill_in[] = { static bNodeSocketTemplate cmp_node_color_spill_in[] = {
{SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, {SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, {SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{-1, 0, ""} {-1, 0, ""}
}; };

@ -36,7 +36,7 @@
/* ******************* Color Balance ********************************* */ /* ******************* Color Balance ********************************* */
static bNodeSocketTemplate cmp_node_colorbalance_in[] = { static bNodeSocketTemplate cmp_node_colorbalance_in[] = {
{SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, {SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, {SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{-1, 0, ""} {-1, 0, ""}
}; };

@ -38,7 +38,7 @@
/* ******************* Color Balance ********************************* */ /* ******************* Color Balance ********************************* */
static bNodeSocketTemplate cmp_node_colorcorrection_in[] = { static bNodeSocketTemplate cmp_node_colorcorrection_in[] = {
{ SOCK_RGBA,1,N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA,1,N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Mask"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Mask"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ -1,0,""} { -1,0,""}
}; };

@ -34,8 +34,8 @@
/* **************** COMPOSITE ******************** */ /* **************** COMPOSITE ******************** */
static bNodeSocketTemplate cmp_node_composite_in[] = { static bNodeSocketTemplate cmp_node_composite_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("Z"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Z"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" } { -1, 0, "" }
}; };

@ -95,7 +95,7 @@ void register_node_type_cmp_curve_vec(void)
/* **************** CURVE RGB ******************** */ /* **************** CURVE RGB ******************** */
static bNodeSocketTemplate cmp_node_curve_rgb_in[] = { static bNodeSocketTemplate cmp_node_curve_rgb_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_RGBA, 1, N_("Black Level"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 1, N_("Black Level"), 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_RGBA, 1, N_("White Level"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("White Level"), 1.0f, 1.0f, 1.0f, 1.0f},

@ -36,7 +36,7 @@
/* ************ qdn: Defocus node ****************** */ /* ************ qdn: Defocus node ****************** */
static bNodeSocketTemplate cmp_node_defocus_in[] = { static bNodeSocketTemplate cmp_node_defocus_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" } { -1, 0, "" }
}; };
static bNodeSocketTemplate cmp_node_defocus_out[] = { static bNodeSocketTemplate cmp_node_defocus_out[] = {

@ -33,7 +33,7 @@
/* **************** FILTER ******************** */ /* **************** FILTER ******************** */
static bNodeSocketTemplate cmp_node_despeckle_in[] = { static bNodeSocketTemplate cmp_node_despeckle_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ -1, 0, "" } { -1, 0, "" }
}; };

@ -36,7 +36,7 @@
/* **************** Dilate/Erode ******************** */ /* **************** Dilate/Erode ******************** */
static bNodeSocketTemplate cmp_node_dilateerode_in[] = { static bNodeSocketTemplate cmp_node_dilateerode_in[] = {
{ SOCK_FLOAT, 1, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Mask"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" } { -1, 0, "" }
}; };
static bNodeSocketTemplate cmp_node_dilateerode_out[] = { static bNodeSocketTemplate cmp_node_dilateerode_out[] = {

@ -38,8 +38,8 @@
static bNodeSocketTemplate cmp_node_displace_in[] = { static bNodeSocketTemplate cmp_node_displace_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_VECTOR, 1, N_("Vector"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_TRANSLATION}, { SOCK_VECTOR, 1, N_("Vector"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_TRANSLATION},
{ SOCK_FLOAT, 1, N_("X Scale"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("X Scale"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("Y Scale"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Y Scale"), 0.0f, 0.0f, 0.0f, 0.0f, -1000.0f, 1000.0f, PROP_NONE},
{ -1, 0, "" } { -1, 0, "" }
}; };
static bNodeSocketTemplate cmp_node_displace_out[] = { static bNodeSocketTemplate cmp_node_displace_out[] = {

@ -34,7 +34,7 @@
/* **************** FILTER ******************** */ /* **************** FILTER ******************** */
static bNodeSocketTemplate cmp_node_filter_in[] = { static bNodeSocketTemplate cmp_node_filter_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ -1, 0, "" } { -1, 0, "" }
}; };

@ -35,7 +35,7 @@
/* **************** Hue Saturation ******************** */ /* **************** Hue Saturation ******************** */
static bNodeSocketTemplate cmp_node_hue_sat_in[] = { static bNodeSocketTemplate cmp_node_hue_sat_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ -1, 0, "" } { -1, 0, "" }
}; };

@ -33,7 +33,7 @@
#include "node_composite_util.h" #include "node_composite_util.h"
static bNodeSocketTemplate cmp_node_huecorrect_in[] = { static bNodeSocketTemplate cmp_node_huecorrect_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ -1, 0, "" } { -1, 0, "" }
}; };

@ -33,7 +33,7 @@
/* **************** INVERT ******************** */ /* **************** INVERT ******************** */
static bNodeSocketTemplate cmp_node_invert_in[] = { static bNodeSocketTemplate cmp_node_invert_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f},
{ -1, 0, "" } { -1, 0, "" }
}; };

@ -33,7 +33,7 @@
/* **************** MIX RGB ******************** */ /* **************** MIX RGB ******************** */
static bNodeSocketTemplate cmp_node_mix_rgb_in[] = { static bNodeSocketTemplate cmp_node_mix_rgb_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 5.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 5.0f, PROP_NONE},
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ -1, 0, "" } { -1, 0, "" }

@ -37,7 +37,7 @@
/* **************** Pixelate ******************** */ /* **************** Pixelate ******************** */
static bNodeSocketTemplate cmp_node_pixelate_in[] = { static bNodeSocketTemplate cmp_node_pixelate_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" } { -1, 0, "" }
}; };
static bNodeSocketTemplate cmp_node_pixelate_out[] = { static bNodeSocketTemplate cmp_node_pixelate_out[] = {

@ -36,8 +36,8 @@
static bNodeSocketTemplate cmp_node_scale_in[] = { static bNodeSocketTemplate cmp_node_scale_in[] = {
{ SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, { SOCK_RGBA, 1, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("X"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("X"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_NONE},
{ SOCK_FLOAT, 1, N_("Y"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Y"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_NONE},
{ -1, 0, "" } { -1, 0, "" }
}; };
static bNodeSocketTemplate cmp_node_scale_out[] = { static bNodeSocketTemplate cmp_node_scale_out[] = {

@ -35,7 +35,7 @@
/* **************** VALTORGB ******************** */ /* **************** VALTORGB ******************** */
static bNodeSocketTemplate cmp_node_valtorgb_in[] = { static bNodeSocketTemplate cmp_node_valtorgb_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" } { -1, 0, "" }
}; };
static bNodeSocketTemplate cmp_node_valtorgb_out[] = { static bNodeSocketTemplate cmp_node_valtorgb_out[] = {

@ -35,7 +35,7 @@
/* **************** CURVE VEC ******************** */ /* **************** CURVE VEC ******************** */
static bNodeSocketTemplate sh_node_curve_vec_in[] = { static bNodeSocketTemplate sh_node_curve_vec_in[] = {
{ SOCK_FLOAT, 0, N_("Fac"), 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 0, N_("Fac"), 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE}, { SOCK_VECTOR, 1, N_("Vector"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
{ -1, 0, "" } { -1, 0, "" }
}; };
@ -88,7 +88,7 @@ void register_node_type_sh_curve_vec(void)
/* **************** CURVE RGB ******************** */ /* **************** CURVE RGB ******************** */
static bNodeSocketTemplate sh_node_curve_rgb_in[] = { static bNodeSocketTemplate sh_node_curve_rgb_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE},
{ SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
{ -1, 0, "" } { -1, 0, "" }
}; };

@ -36,9 +36,9 @@
/* **************** Hue Saturation ******************** */ /* **************** Hue Saturation ******************** */
static bNodeSocketTemplate sh_node_hue_sat_in[] = { static bNodeSocketTemplate sh_node_hue_sat_in[] = {
{ SOCK_FLOAT, 1, N_("Hue"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, { SOCK_FLOAT, 1, N_("Hue"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f}, { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f},
{ -1, 0, "" } { -1, 0, "" }
}; };

@ -36,7 +36,7 @@
/* **************** INVERT ******************** */ /* **************** INVERT ******************** */
static bNodeSocketTemplate sh_node_invert_in[] = { static bNodeSocketTemplate sh_node_invert_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
{ -1, 0, "" } { -1, 0, "" }
}; };

@ -36,7 +36,7 @@
static bNodeSocketTemplate sh_node_material_in[] = { static bNodeSocketTemplate sh_node_material_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_RGBA, 1, N_("Spec"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 1, N_("Spec"), 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Refl"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Refl"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION},
{ -1, 0, "" } { -1, 0, "" }
}; };
@ -53,15 +53,15 @@ static bNodeSocketTemplate sh_node_material_out[] = {
static bNodeSocketTemplate sh_node_material_ext_in[] = { static bNodeSocketTemplate sh_node_material_ext_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_RGBA, 1, N_("Spec"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 1, N_("Spec"), 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Refl"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Refl"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION}, { SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_DIRECTION},
{ SOCK_RGBA, 1, N_("Mirror"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 1, N_("Mirror"), 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Ambient"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Ambient"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("Emit"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, { SOCK_FLOAT, 1, N_("Emit"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
{ SOCK_FLOAT, 1, N_("SpecTra"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("SpecTra"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("Ray Mirror"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Ray Mirror"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_FLOAT, 1, N_("Alpha"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, { SOCK_FLOAT, 1, N_("Alpha"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED},
{ SOCK_FLOAT, 1, N_("Translucency"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Translucency"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" } { -1, 0, "" }
}; };

@ -34,7 +34,7 @@
/* **************** MIX RGB ******************** */ /* **************** MIX RGB ******************** */
static bNodeSocketTemplate sh_node_mix_rgb_in[] = { static bNodeSocketTemplate sh_node_mix_rgb_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_RGBA, 1, N_("Color1"), 0.5f, 0.5f, 0.5f, 1.0f}, { SOCK_RGBA, 1, N_("Color1"), 0.5f, 0.5f, 0.5f, 1.0f},
{ SOCK_RGBA, 1, N_("Color2"), 0.5f, 0.5f, 0.5f, 1.0f}, { SOCK_RGBA, 1, N_("Color2"), 0.5f, 0.5f, 0.5f, 1.0f},
{ -1, 0, "" } { -1, 0, "" }

@ -30,7 +30,7 @@
/* **************** OUTPUT ******************** */ /* **************** OUTPUT ******************** */
static bNodeSocketTemplate sh_node_mix_shader_in[] = { static bNodeSocketTemplate sh_node_mix_shader_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ SOCK_SHADER, 1, N_("Shader")}, { SOCK_SHADER, 1, N_("Shader")},
{ SOCK_SHADER, 1, N_("Shader")}, { SOCK_SHADER, 1, N_("Shader")},
{ -1, 0, "" } { -1, 0, "" }

@ -35,7 +35,7 @@
/* **************** OUTPUT ******************** */ /* **************** OUTPUT ******************** */
static bNodeSocketTemplate sh_node_output_in[] = { static bNodeSocketTemplate sh_node_output_in[] = {
{ SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, { SOCK_RGBA, 1, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f},
{ SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" } { -1, 0, "" }
}; };

@ -29,10 +29,10 @@
* \ingroup shdnodes * \ingroup shdnodes
*/ */
#include "BKE_idprop.h"
#include "node_shader_util.h" #include "node_shader_util.h"
#include "BKE_idprop.h"
/* **************** Script ******************** */ /* **************** Script ******************** */
static void init(bNodeTree *UNUSED(ntree), bNode *node) static void init(bNodeTree *UNUSED(ntree), bNode *node)

@ -34,7 +34,7 @@
/* **************** VALTORGB ******************** */ /* **************** VALTORGB ******************** */
static bNodeSocketTemplate sh_node_valtorgb_in[] = { static bNodeSocketTemplate sh_node_valtorgb_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" } { -1, 0, "" }
}; };
static bNodeSocketTemplate sh_node_valtorgb_out[] = { static bNodeSocketTemplate sh_node_valtorgb_out[] = {

@ -36,9 +36,9 @@
static bNodeSocketTemplate inputs[] = { static bNodeSocketTemplate inputs[] = {
{ SOCK_FLOAT, 1, N_("Hue"), 0.0f, 0.0f, 0.0f, 0.0f, -0.5f, 0.5f, PROP_NONE }, { SOCK_FLOAT, 1, N_("Hue"), 0.0f, 0.0f, 0.0f, 0.0f, -0.5f, 0.5f, PROP_NONE },
{ SOCK_FLOAT, 1, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR }, { SOCK_FLOAT, 1, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE },
{ SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_FACTOR }, { SOCK_FLOAT, 1, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE },
{ SOCK_FLOAT, 1, N_("Factor"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR }, { SOCK_FLOAT, 1, N_("Factor"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE },
{ SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f }, { SOCK_RGBA, 1, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f },
{ -1, 0, "" } { -1, 0, "" }
}; };

@ -35,7 +35,7 @@
/* **************** MIX RGB ******************** */ /* **************** MIX RGB ******************** */
static bNodeSocketTemplate inputs[] = { static bNodeSocketTemplate inputs[] = {
{ SOCK_FLOAT, 1, N_("Factor"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR }, { SOCK_FLOAT, 1, N_("Factor"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE },
{ SOCK_RGBA, 1, N_("Color1"), 0.5f, 0.5f, 0.5f, 1.0f }, { SOCK_RGBA, 1, N_("Color1"), 0.5f, 0.5f, 0.5f, 1.0f },
{ SOCK_RGBA, 1, N_("Color2"), 0.5f, 0.5f, 0.5f, 1.0f }, { SOCK_RGBA, 1, N_("Color2"), 0.5f, 0.5f, 0.5f, 1.0f },
{ -1, 0, "" } { -1, 0, "" }

@ -35,7 +35,7 @@
/* **************** VALTORGB ******************** */ /* **************** VALTORGB ******************** */
static bNodeSocketTemplate valtorgb_in[] = { static bNodeSocketTemplate valtorgb_in[] = {
{ SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, { SOCK_FLOAT, 1, N_("Fac"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE},
{ -1, 0, "" } { -1, 0, "" }
}; };
static bNodeSocketTemplate valtorgb_out[] = { static bNodeSocketTemplate valtorgb_out[] = {

@ -33,6 +33,7 @@
#include <Python.h> #include <Python.h>
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BLI_dynstr.h"
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
@ -68,6 +69,76 @@ static PyObject *bpy_bmesh_op_repr(BPy_BMeshOpFunc *self)
} }
/* methods
* ======= */
/* __doc__
* ------- */
static char *bmp_slots_as_args(const BMOSlotType slot_types[BMO_OP_MAX_SLOTS], const bool is_out)
{
DynStr *dyn_str = BLI_dynstr_new();
char *ret;
int i = 0;
while (*slot_types[i].name) {
/* cut off '.out' by using a string size arg */
const int name_len = is_out ?
(strchr(slot_types[i].name, '.') - slot_types[i].name) :
sizeof(slot_types[i].name);
const char *value = "<Unknown>";
switch (slot_types[i].type) {
case BMO_OP_SLOT_BOOL: value = "False"; break;
case BMO_OP_SLOT_INT: value = "0"; break;
case BMO_OP_SLOT_FLT: value = "0.0"; break;
case BMO_OP_SLOT_PTR: value = "None"; break;
case BMO_OP_SLOT_MAT: value = "Matrix()"; break;
case BMO_OP_SLOT_VEC: value = "Vector()"; break;
case BMO_OP_SLOT_ELEMENT_BUF: value =
(slot_types[i].subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE) ? "None" : "[]"; break;
case BMO_OP_SLOT_MAPPING: value = "{}"; break;
}
BLI_dynstr_appendf(dyn_str, i ? ", %.*s=%s" : "%.*s=%s", name_len, slot_types[i].name, value);
i++;
};
ret = BLI_dynstr_get_cstring(dyn_str);
BLI_dynstr_free(dyn_str);
return ret;
}
static PyObject *bpy_bmesh_op_doc_get(BPy_BMeshOpFunc *self, void *UNUSED(closure))
{
PyObject *ret;
char *slot_in;
char *slot_out;
int i;
i = BMO_opcode_from_opname(self->opname);
slot_in = bmp_slots_as_args(bmo_opdefines[i]->slot_types_in, false);
slot_out = bmp_slots_as_args(bmo_opdefines[i]->slot_types_out, true);
ret = PyUnicode_FromFormat("%.200s bmesh.ops.%.200s(bmesh, %s)\n -> dict(%s)",
Py_TYPE(self)->tp_name,
self->opname, slot_in, slot_out);
MEM_freeN(slot_in);
MEM_freeN(slot_out);
return ret;
}
static PyGetSetDef bpy_bmesh_op_getseters[] = {
{(char *)"__doc__", (getter)bpy_bmesh_op_doc_get, (setter)NULL, NULL, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
/* Types
* ===== */
PyTypeObject bmesh_op_Type = { PyTypeObject bmesh_op_Type = {
PyVarObject_HEAD_INIT(NULL, 0) PyVarObject_HEAD_INIT(NULL, 0)
@ -126,7 +197,7 @@ PyTypeObject bmesh_op_Type = {
/*** Attribute descriptor and subclassing stuff ***/ /*** Attribute descriptor and subclassing stuff ***/
NULL, /* struct PyMethodDef *tp_methods; */ NULL, /* struct PyMethodDef *tp_methods; */
NULL, /* struct PyMemberDef *tp_members; */ NULL, /* struct PyMemberDef *tp_members; */
NULL, /* struct PyGetSetDef *tp_getset; */ bpy_bmesh_op_getseters, /* struct PyGetSetDef *tp_getset; */
NULL, /* struct _typeobject *tp_base; */ NULL, /* struct _typeobject *tp_base; */
NULL, /* PyObject *tp_dict; */ NULL, /* PyObject *tp_dict; */
NULL, /* descrgetfunc tp_descr_get; */ NULL, /* descrgetfunc tp_descr_get; */
@ -154,20 +225,17 @@ PyTypeObject bmesh_op_Type = {
static PyObject *bpy_bmesh_ops_fakemod_getattro(PyObject *UNUSED(self), PyObject *pyname) static PyObject *bpy_bmesh_ops_fakemod_getattro(PyObject *UNUSED(self), PyObject *pyname)
{ {
const unsigned int tot = bmo_opdefines_total;
unsigned int i;
const char *opname = _PyUnicode_AsString(pyname); const char *opname = _PyUnicode_AsString(pyname);
for (i = 0; i < tot; i++) { if (BMO_opcode_from_opname(opname) != -1) {
if (STREQ(bmo_opdefines[i]->opname, opname)) { return bpy_bmesh_op_CreatePyObject(opname);
return bpy_bmesh_op_CreatePyObject(opname); }
} else {
PyErr_Format(PyExc_AttributeError,
"BMeshOpsModule: operator \"%.200s\" doesn't exist",
opname);
return NULL;
} }
PyErr_Format(PyExc_AttributeError,
"BMeshOpsModule: operator \"%.200s\" doesn't exist",
opname);
return NULL;
} }
static PyObject *bpy_bmesh_ops_fakemod_dir(PyObject *UNUSED(self)) static PyObject *bpy_bmesh_ops_fakemod_dir(PyObject *UNUSED(self))

@ -1718,6 +1718,22 @@ static PyObject *bpy_bmface_calc_center_mean(BPy_BMFace *self)
return Vector_CreatePyObject(cent, 3, Py_NEW, NULL); return Vector_CreatePyObject(cent, 3, Py_NEW, NULL);
} }
PyDoc_STRVAR(bpy_bmface_calc_center_mean_weighted_doc,
".. method:: calc_center_median_weighted()\n"
"\n"
" Return median center of the face weighted by edge lengths.\n"
"\n"
" :return: a 3D vector.\n"
" :rtype: :class:`mathutils.Vector`\n"
);
static PyObject *bpy_bmface_calc_center_mean_weighted(BPy_BMFace *self)
{
float cent[3];
BPY_BM_CHECK_OBJ(self);
BM_face_calc_center_mean_weighted(self->f, cent);
return Vector_CreatePyObject(cent, 3, Py_NEW, NULL);
}
PyDoc_STRVAR(bpy_bmface_calc_center_bounds_doc, PyDoc_STRVAR(bpy_bmface_calc_center_bounds_doc,
".. method:: calc_center_bounds()\n" ".. method:: calc_center_bounds()\n"
@ -2573,6 +2589,7 @@ static struct PyMethodDef bpy_bmface_methods[] = {
{"calc_area", (PyCFunction)bpy_bmface_calc_area, METH_NOARGS, bpy_bmface_calc_area_doc}, {"calc_area", (PyCFunction)bpy_bmface_calc_area, METH_NOARGS, bpy_bmface_calc_area_doc},
{"calc_perimeter", (PyCFunction)bpy_bmface_calc_perimeter, METH_NOARGS, bpy_bmface_calc_perimeter_doc}, {"calc_perimeter", (PyCFunction)bpy_bmface_calc_perimeter, METH_NOARGS, bpy_bmface_calc_perimeter_doc},
{"calc_center_median", (PyCFunction)bpy_bmface_calc_center_mean, METH_NOARGS, bpy_bmface_calc_center_mean_doc}, {"calc_center_median", (PyCFunction)bpy_bmface_calc_center_mean, METH_NOARGS, bpy_bmface_calc_center_mean_doc},
{"calc_center_median_weighted", (PyCFunction)bpy_bmface_calc_center_mean_weighted, METH_NOARGS, bpy_bmface_calc_center_mean_weighted_doc},
{"calc_center_bounds", (PyCFunction)bpy_bmface_calc_center_bounds, METH_NOARGS, bpy_bmface_calc_center_bounds_doc}, {"calc_center_bounds", (PyCFunction)bpy_bmface_calc_center_bounds, METH_NOARGS, bpy_bmface_calc_center_bounds_doc},
{"normal_update", (PyCFunction)bpy_bmface_normal_update, METH_NOARGS, bpy_bmface_normal_update_doc}, {"normal_update", (PyCFunction)bpy_bmface_normal_update, METH_NOARGS, bpy_bmface_normal_update_doc},

@ -31,20 +31,17 @@
* a context manager. * a context manager.
*/ */
/* nifty feature. swap out strings for RNA data */
#define USE_RNA_DATABLOCKS
#include <Python.h> #include <Python.h>
#include <stddef.h> #include <stddef.h>
#include "BLO_readfile.h"
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BLI_string.h" #include "BLI_string.h"
#include "BLI_linklist.h" #include "BLI_linklist.h"
#include "BLI_path_util.h" #include "BLI_path_util.h"
#include "BLI_listbase.h" #include "BLI_listbase.h"
#include "BLO_readfile.h"
#include "BKE_global.h" #include "BKE_global.h"
#include "BKE_main.h" #include "BKE_main.h"
#include "BKE_library.h" #include "BKE_library.h"
@ -57,6 +54,9 @@
#include "bpy_util.h" #include "bpy_util.h"
#include "bpy_library.h" #include "bpy_library.h"
/* nifty feature. swap out strings for RNA data */
#define USE_RNA_DATABLOCKS
#ifdef USE_RNA_DATABLOCKS #ifdef USE_RNA_DATABLOCKS
# include "bpy_rna.h" # include "bpy_rna.h"
# include "RNA_access.h" # include "RNA_access.h"

@ -628,6 +628,26 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
wm_triple_copy_textures(win, triple); wm_triple_copy_textures(win, triple);
} }
if (paintcursor && wm->paintcursors.first) {
for (sa = screen->areabase.first; sa; sa = sa->next) {
for (ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar->swinid && ar->swinid == screen->subwinactive) {
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
/* make region ready for draw, scissor, pixelspace */
ED_region_set(C, ar);
wm_paintcursor_draw(C, ar);
CTX_wm_region_set(C, NULL);
CTX_wm_area_set(C, NULL);
}
}
}
wmSubWindowSet(win, screen->mainwin);
}
/* draw overlapping area regions (always like popups) */ /* draw overlapping area regions (always like popups) */
for (sa = screen->areabase.first; sa; sa = sa->next) { for (sa = screen->areabase.first; sa; sa = sa->next) {
CTX_wm_area_set(C, sa); CTX_wm_area_set(C, sa);
@ -662,26 +682,6 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
/* always draw, not only when screen tagged */ /* always draw, not only when screen tagged */
if (win->gesture.first) if (win->gesture.first)
wm_gesture_draw(win); wm_gesture_draw(win);
if (paintcursor && wm->paintcursors.first) {
for (sa = screen->areabase.first; sa; sa = sa->next) {
for (ar = sa->regionbase.first; ar; ar = ar->next) {
if (ar->swinid && ar->swinid == screen->subwinactive) {
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
/* make region ready for draw, scissor, pixelspace */
ED_region_set(C, ar);
wm_paintcursor_draw(C, ar);
CTX_wm_region_set(C, NULL);
CTX_wm_area_set(C, NULL);
}
}
}
wmSubWindowSet(win, screen->mainwin);
}
/* needs pixel coords in screen */ /* needs pixel coords in screen */
if (wm->drags.first) { if (wm->drags.first) {