This commit is contained in:
Joerg Mueller 2010-07-25 13:12:58 +00:00
commit 147a5229a1
132 changed files with 9765 additions and 8407 deletions

@ -63,7 +63,7 @@
extern "C" {
#endif
/** Returns the lenght of the allocated memory segment pointed at
/** Returns the length of the allocated memory segment pointed at
* by vmemh. If the pointer was not previously allocated by this
* module, the result is undefined.*/
size_t MEM_allocN_len(void *vmemh);

@ -30,6 +30,7 @@
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iostream>
#include "OBSTACLE.h"
// #include "WTURBULENCE.h"

@ -947,10 +947,7 @@ def write(filename, batch_objects = None, \
render = scene.render
width = render.resolution_x
height = render.resolution_y
# render = scene.render
# width = render.sizeX
# height = render.sizeY
aspect = float(width)/height
aspect = width / height
data = my_cam.blenObject.data
@ -962,11 +959,9 @@ def write(filename, batch_objects = None, \
file.write('\n\t\t\tProperty: "FieldOfView", "FieldOfView", "A+",%.6f' % math.degrees(data.angle))
file.write('\n\t\t\tProperty: "FieldOfViewX", "FieldOfView", "A+",1')
file.write('\n\t\t\tProperty: "FieldOfViewY", "FieldOfView", "A+",1')
file.write('\n\t\t\tProperty: "FocalLength", "Real", "A+",14.0323972702026')
# file.write('\n\t\t\tProperty: "FocalLength", "Real", "A+",14.0323972702026')
file.write('\n\t\t\tProperty: "OpticalCenterX", "Real", "A+",%.6f' % data.shift_x) # not sure if this is in the correct units?
# file.write('\n\t\t\tProperty: "OpticalCenterX", "Real", "A+",%.6f' % data.shiftX) # not sure if this is in the correct units?
file.write('\n\t\t\tProperty: "OpticalCenterY", "Real", "A+",%.6f' % data.shift_y) # ditto
# file.write('\n\t\t\tProperty: "OpticalCenterY", "Real", "A+",%.6f' % data.shiftY) # ditto
file.write('\n\t\t\tProperty: "BackgroundColor", "Color", "A+",0,0,0')
file.write('\n\t\t\tProperty: "TurnTable", "Real", "A+",0')
file.write('\n\t\t\tProperty: "DisplayTurnTableIcon", "bool", "",1')
@ -975,7 +970,7 @@ def write(filename, batch_objects = None, \
file.write('\n\t\t\tProperty: "UseRealTimeMotionBlur", "bool", "",1')
file.write('\n\t\t\tProperty: "ResolutionMode", "enum", "",0')
file.write('\n\t\t\tProperty: "ApertureMode", "enum", "",2')
file.write('\n\t\t\tProperty: "GateFit", "enum", "",0')
file.write('\n\t\t\tProperty: "GateFit", "enum", "",2')
file.write('\n\t\t\tProperty: "CameraFormat", "enum", "",0')
file.write('\n\t\t\tProperty: "AspectW", "double", "",%i' % width)
file.write('\n\t\t\tProperty: "AspectH", "double", "",%i' % height)
@ -2782,7 +2777,7 @@ Takes: {''')
# Set the action active
for my_bone in ob_arms:
if blenAction in my_bone.blenActionList:
if ob.animation_data and blenAction in my_bone.blenActionList:
ob.animation_data.action = blenAction
# print '\t\tSetting Action!', blenAction
# scene.update(1)

@ -420,8 +420,7 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
# Add an MTL with the same name as the obj if no MTLs are spesified.
temp_mtl = os.path.splitext((os.path.basename(filepath)))[0] + '.mtl'
if os.path.exists(DIR + temp_mtl) and temp_mtl not in material_libs:
# if sys.exists(DIR + temp_mtl) and temp_mtl not in material_libs:
if os.path.exists(os.path.join(DIR, temp_mtl)) and temp_mtl not in material_libs:
material_libs.append( temp_mtl )
del temp_mtl
@ -435,11 +434,9 @@ def create_materials(filepath, material_libs, unique_materials, unique_material_
unique_material_images[None]= None, False
for libname in material_libs:
mtlpath= DIR + libname
mtlpath= os.path.join(DIR, libname)
if not os.path.exists(mtlpath):
# if not sys.exists(mtlpath):
#print '\tError Missing MTL: "%s"' % mtlpath
pass
print ("\tError Missing MTL: '%s'" % mtlpath)
else:
#print '\t\tloading mtl: "%s"' % mtlpath
context_material= None

@ -42,6 +42,9 @@ def register():
def unregister():
import bpy
bpy.types.Scene.RemoveProperty("network_render")
bpy.types.unregister(ui.NetRenderJob)
bpy.types.unregister(ui.NetRenderSettings)
bpy.types.unregister(ui.NetRenderSlave)

@ -113,45 +113,47 @@ class SelectHierarchy(bpy.types.Operator):
return context.object
def execute(self, context):
objs = context.selected_objects
select_new = []
act_new = None
selected_objects = context.selected_objects
obj_act = context.object
if context.object not in objs:
objs.append(context.object)
if not self.properties.extend:
# for obj in objs:
# obj.select = False
bpy.ops.object.select_all(action='DESELECT')
if context.object not in selected_objects:
selected_objects.append(context.object)
if self.properties.direction == 'PARENT':
parents = []
for obj in objs:
for obj in selected_objects:
parent = obj.parent
if parent:
parents.append(parent)
if obj_act == obj:
context.scene.objects.active = parent
act_new = parent
parent.select = True
if parents:
return {'CANCELLED'}
select_new.append(parent)
else:
children = []
for obj in objs:
children += list(obj.children)
for obj_iter in children:
obj_iter.select = True
for obj in selected_objects:
select_new.extend(obj.children)
children.sort(key=lambda obj_iter: obj_iter.name)
context.scene.objects.active = children[0]
if select_new:
select_new.sort(key=lambda obj_iter: obj_iter.name)
act_new = select_new[0]
# dont edit any object settings above this
if select_new:
if not self.properties.extend:
bpy.ops.object.select_all(action='DESELECT')
for obj in select_new:
obj.select = True
context.scene.objects.active = act_new
return {'FINISHED'}
return {'CANCELLED'}
class SubdivisionSet(bpy.types.Operator):
'''Sets a Subdivision Surface Level (1-5)'''

@ -360,6 +360,7 @@ def register():
def unregister():
bpy.types.Scene.RemoveProperty("pose_templates")
unregister = bpy.types.unregister
for cls in classes:
unregister(cls)

@ -562,22 +562,10 @@ class IMAGE_PT_paint(bpy.types.Panel):
toolsettings = context.tool_settings.image_paint
brush = toolsettings.brush
wide_ui = context.region.width > narrowui
col = layout.split().column()
row = col.row()
row.template_list(toolsettings, "brushes", toolsettings, "active_brush_index", rows=2)
col.template_ID(toolsettings, "brush", new="brush.add")
if wide_ui:
sub = layout.row(align=True)
else:
sub = layout.column(align=True)
sub.prop_enum(brush, "imagepaint_tool", 'DRAW')
sub.prop_enum(brush, "imagepaint_tool", 'SOFTEN')
sub.prop_enum(brush, "imagepaint_tool", 'CLONE')
sub.prop_enum(brush, "imagepaint_tool", 'SMEAR')
col.template_ID_preview(toolsettings, "brush", new="brush.add", filter="is_imapaint_brush", rows=3, cols=8)
if brush:
col = layout.column()
@ -604,6 +592,30 @@ class IMAGE_PT_paint(bpy.types.Panel):
col.prop(brush, "clone_alpha", text="Alpha")
class IMAGE_PT_tools_brush_texture(bpy.types.Panel):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'UI'
bl_label = "Texture"
bl_default_closed = True
def poll(self, context):
sima = context.space_data
toolsettings = context.tool_settings.image_paint
return sima.show_paint and toolsettings.brush
def draw(self, context):
layout = self.layout
toolsettings = context.tool_settings.image_paint
brush = toolsettings.brush
# tex_slot = brush.texture_slot
col = layout.column()
col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
class IMAGE_PT_paint_stroke(bpy.types.Panel):
bl_space_type = 'IMAGE_EDITOR'
bl_region_type = 'UI'
@ -653,8 +665,15 @@ class IMAGE_PT_paint_curve(bpy.types.Panel):
brush = toolsettings.brush
layout.template_curve_mapping(brush, "curve")
layout.operator_menu_enum("brush.curve_preset", "shape")
row = layout.row(align=True)
row.operator("brush.curve_preset", icon="SMOOTHCURVE", text="").shape = 'SMOOTH'
row.operator("brush.curve_preset", icon="SPHERECURVE", text="").shape = 'ROUND'
row.operator("brush.curve_preset", icon="ROOTCURVE", text="").shape = 'ROOT'
row.operator("brush.curve_preset", icon="SHARPCURVE", text="").shape = 'SHARP'
row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE'
row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX'
row.operator("brush.curve_preset", icon="RNDCURVE", text="").shape = 'MID9'
classes = [
IMAGE_MT_view,
@ -669,6 +688,7 @@ classes = [
IMAGE_HT_header,
IMAGE_PT_image_properties,
IMAGE_PT_paint,
IMAGE_PT_tools_brush_texture,
IMAGE_PT_paint_stroke,
IMAGE_PT_paint_curve,
IMAGE_PT_game_properties,

@ -487,6 +487,20 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel):
if not strip.use_effect_default_fade:
col.prop(strip, "effect_fader", text="Effect fader")
layout.prop(strip, "use_translation", text="Image Offset:")
if strip.use_translation:
col = layout.column(align=True)
col.prop(strip.transform, "offset_x", text="X")
col.prop(strip.transform, "offset_y", text="Y")
layout.prop(strip, "use_crop", text="Image Crop:")
if strip.use_crop:
col = layout.column(align=True)
col.prop(strip.crop, "top")
col.prop(strip.crop, "left")
col.prop(strip.crop, "bottom")
col.prop(strip.crop, "right")
def draw_panel_transform(self, strip):
layout = self.layout
col = layout.column()

@ -170,7 +170,7 @@ class USERPREF_PT_interface(bpy.types.Panel):
col.prop(view, "show_mini_axis", text="Display Mini Axis")
sub = col.column()
sub.enabled = view.show_mini_axis
sub.active = view.show_mini_axis
sub.prop(view, "mini_axis_size", text="Size")
sub.prop(view, "mini_axis_brightness", text="Brightness")
@ -216,7 +216,7 @@ class USERPREF_PT_interface(bpy.types.Panel):
#col.prop(view, "open_right_mouse_delay", text="Hold RMB")
col.prop(view, "use_manipulator")
sub = col.column()
sub.enabled = view.use_manipulator
sub.active = view.use_manipulator
sub.prop(view, "manipulator_size", text="Size")
sub.prop(view, "manipulator_handle_size", text="Handle Size")
sub.prop(view, "manipulator_hotspot", text="Hotspot")
@ -720,7 +720,7 @@ class USERPREF_PT_file(bpy.types.Panel):
col.prop(paths, "save_preview_images")
col.prop(paths, "auto_save_temporary_files")
sub = col.column()
sub.enabled = paths.auto_save_temporary_files
sub.active = paths.auto_save_temporary_files
sub.prop(paths, "auto_save_time", text="Timer (mins)")
from space_userpref_keymap import InputKeyMapPanel
@ -748,7 +748,7 @@ class USERPREF_PT_input(InputKeyMapPanel):
sub.label(text="Mouse:")
sub1 = sub.column()
sub1.enabled = (inputs.select_mouse == 'RIGHT')
sub1.active = (inputs.select_mouse == 'RIGHT')
sub1.prop(inputs, "emulate_3_button_mouse")
sub.prop(inputs, "continuous_mouse")

@ -2079,7 +2079,7 @@ class VIEW3D_PT_view3d_meshdisplay(bpy.types.Panel):
col.separator()
col.label(text="Numerics:")
col.prop(mesh, "draw_edge_lenght")
col.prop(mesh, "draw_edge_length")
col.prop(mesh, "draw_edge_angle")
col.prop(mesh, "draw_face_area")

@ -555,7 +555,6 @@ class VIEW3D_PT_tools_brush(PaintPanel):
# Sculpt Mode #
elif context.sculpt_object and brush:
edit = context.user_preferences.edit
col = layout.column()
@ -564,20 +563,11 @@ class VIEW3D_PT_tools_brush(PaintPanel):
row = col.row(align=True)
if edit.sculpt_paint_use_unified_size:
if edit.sculpt_paint_unified_lock_brush_size:
row.prop(edit, "sculpt_paint_unified_lock_brush_size", toggle=True, text="", icon='LOCKED')
row.prop(edit, "sculpt_paint_unified_unprojected_radius", text="Radius", slider=True)
else:
row.prop(edit, "sculpt_paint_unified_lock_brush_size", toggle=True, text="", icon='UNLOCKED')
row.prop(edit, "sculpt_paint_unified_size", text="Radius", slider=True)
else:
if brush.lock_brush_size:
row.prop(brush, "lock_brush_size", toggle=True, text="", icon='LOCKED')
if brush.use_locked_size:
row.prop(brush, "use_locked_size", toggle=True, text="", icon='LOCKED')
row.prop(brush, "unprojected_radius", text="Radius", slider=True)
else:
row.prop(brush, "lock_brush_size", toggle=True, text="", icon='UNLOCKED')
row.prop(brush, "use_locked_size", toggle=True, text="", icon='UNLOCKED')
row.prop(brush, "size", text="Radius", slider=True)
row.prop(brush, "use_size_pressure", toggle=True, text="")
@ -594,11 +584,7 @@ class VIEW3D_PT_tools_brush(PaintPanel):
else:
row.prop(brush, "use_space_atten", toggle=True, text="", icon='UNLOCKED')
if edit.sculpt_paint_use_unified_strength:
row.prop(edit, "sculpt_paint_unified_strength", text="Unified Strength", slider=True)
else:
row.prop(brush, "strength", text="Strength", slider=True)
row.prop(brush, "use_strength_pressure", text="")
@ -710,11 +696,11 @@ class VIEW3D_PT_tools_brush(PaintPanel):
col.prop(brush, "color", text="")
row = col.row(align=True)
row.prop(brush, "size", slider=True)
row.prop(brush, "size", text="Radius", slider=True)
row.prop(brush, "use_size_pressure", toggle=True, text="")
row = col.row(align=True)
row.prop(brush, "strength", slider=True)
row.prop(brush, "strength", text="Strength", slider=True)
row.prop(brush, "use_strength_pressure", toggle=True, text="")
row = col.row(align=True)
@ -735,12 +721,13 @@ class VIEW3D_PT_tools_brush(PaintPanel):
layout.prop(context.tool_settings, "auto_normalize", text="Auto Normalize")
col = layout.column()
row = col.row(align=True)
row.prop(brush, "size", slider=True)
row.prop(brush, "size", text="Radius", slider=True)
row.prop(brush, "use_size_pressure", toggle=True, text="")
row = col.row(align=True)
row.prop(brush, "strength", slider=True)
row.prop(brush, "strength", text="Strength", slider=True)
row.prop(brush, "use_strength_pressure", toggle=True, text="")
row = col.row(align=True)
@ -755,11 +742,11 @@ class VIEW3D_PT_tools_brush(PaintPanel):
col.prop(brush, "color", text="")
row = col.row(align=True)
row.prop(brush, "size", slider=True)
row.prop(brush, "size", text="Radius", slider=True)
row.prop(brush, "use_size_pressure", toggle=True, text="")
row = col.row(align=True)
row.prop(brush, "strength", slider=True)
row.prop(brush, "strength", text="Strength", slider=True)
row.prop(brush, "use_strength_pressure", toggle=True, text="")
# XXX - TODO
@ -1032,7 +1019,8 @@ class VIEW3D_PT_sculpt_options(PaintPanel):
wide_ui = context.region.width > narrowui
sculpt = context.tool_settings.sculpt
tool_settings = context.tool_settings
sculpt = tool_settings.sculpt
settings = self.paint_settings(context)
brush = settings.brush
@ -1040,10 +1028,9 @@ class VIEW3D_PT_sculpt_options(PaintPanel):
col = split.column()
edit = context.user_preferences.edit
col.label(text="Unified Settings:")
col.prop(edit, "sculpt_paint_use_unified_size", text="Size")
col.prop(edit, "sculpt_paint_use_unified_strength", text="Strength")
col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
if wide_ui:
col = split.column()
@ -1111,12 +1098,14 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel):
col = layout.column();
if context.sculpt_object and context.tool_settings.sculpt:
#if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'CLAY_TUBES', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE'):
#if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE', 'CLAY_TUBES'):
if brush.sculpt_tool in ('DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE'):
col.prop(brush, "add_col", text="Add Color")
col.prop(brush, "sub_col", text="Subtract Color")
else:
col.prop(brush, "add_col", text="Color")
else:
col.prop(brush, "add_col", text="Color")
col.separator()
@ -1154,7 +1143,8 @@ class VIEW3D_PT_tools_weightpaint_options(View3DPanel):
def draw(self, context):
layout = self.layout
wpaint = context.tool_settings.weight_paint
tool_settings = context.tool_settings
wpaint = tool_settings.weight_paint
col = layout.column()
col.prop(wpaint, "all_faces")
@ -1167,6 +1157,10 @@ class VIEW3D_PT_tools_weightpaint_options(View3DPanel):
col.prop(mesh, "use_mirror_x")
col.prop(mesh, "use_mirror_topology")
col.label(text="Unified Settings:")
col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
# Commented out because the Apply button isn't an operator yet, making these settings useless
# col.label(text="Gamma:")
# col.prop(wpaint, "gamma", text="")
@ -1186,7 +1180,8 @@ class VIEW3D_PT_tools_vertexpaint(View3DPanel):
def draw(self, context):
layout = self.layout
vpaint = context.tool_settings.vertex_paint
tool_settings = context.tool_settings
vpaint = tool_settings.vertex_paint
col = layout.column()
#col.prop(vpaint, "mode", text="")
@ -1194,6 +1189,10 @@ class VIEW3D_PT_tools_vertexpaint(View3DPanel):
col.prop(vpaint, "normals")
col.prop(vpaint, "spray")
col.label(text="Unified Settings:")
col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
# Commented out because the Apply button isn't an operator yet, making these settings useless
# col.label(text="Gamma:")
# col.prop(vpaint, "gamma", text="")
@ -1272,6 +1271,23 @@ class VIEW3D_PT_tools_projectpaint(View3DPanel):
sub.operator("image.save_dirty", text="Save All Edited")
class VIEW3D_PT_imagepaint_options(PaintPanel):
bl_label = "Options"
bl_default_closed = True
def poll(self, context):
return (context.texture_paint_object and context.tool_settings.image_paint)
def draw(self, context):
layout = self.layout
col = layout.column()
tool_settings = context.tool_settings
col.label(text="Unified Settings:")
col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
class VIEW3D_MT_tools_projectpaint_clone(bpy.types.Menu):
bl_label = "Clone Layer"
@ -1339,7 +1355,7 @@ class VIEW3D_PT_tools_particlemode(View3DPanel):
col = layout.column(align=True)
col.active = pe.editable
col.label(text="Keep:")
col.prop(pe, "keep_lengths", text="Lenghts")
col.prop(pe, "keep_lengths", text="Lengths")
col.prop(pe, "keep_root", text="Root")
if not pe.hair:
col.label(text="Correct:")
@ -1385,6 +1401,7 @@ classes = [
VIEW3D_PT_sculpt_options,
VIEW3D_PT_tools_vertexpaint,
VIEW3D_PT_tools_weightpaint_options,
VIEW3D_PT_imagepaint_options,
VIEW3D_PT_tools_projectpaint,
VIEW3D_MT_tools_projectpaint_clone,

@ -58,7 +58,7 @@ struct BME_Loop;
-Remove the eflags completely, they are mostly not used
-Remove the selection/vis/bevel weight flag/values ect and move them to custom data
-Remove EID member and move to custom data
-Add a radial cycle length, disk cycle length and loop cycle lenght attributes to custom data and have eulers maintain/use them if present.
-Add a radial cycle length, disk cycle length and loop cycle length attributes to custom data and have eulers maintain/use them if present.
-Move data such as vertex coordinates/normals to custom data and leave pointers in structures to active layer data.
-Remove BME_CycleNode structure?
*/

@ -88,14 +88,24 @@ void brush_radial_control_invoke(struct wmOperator *op, struct Brush *br, float
int brush_radial_control_exec(struct wmOperator *op, struct Brush *br, float size_weight);
/* unified strength and size */
int sculpt_get_brush_size(struct Brush *brush);
void sculpt_set_brush_size(struct Brush *brush, int size);
int sculpt_get_lock_brush_size(struct Brush *brush);
float sculpt_get_brush_unprojected_radius(struct Brush *brush);
void sculpt_set_brush_unprojected_radius(struct Brush *brush, float unprojected_radius);
float sculpt_get_brush_alpha(struct Brush *brush);
void sculpt_set_brush_alpha(struct Brush *brush, float alpha);
int brush_size(struct Brush *brush);
void brush_set_size(struct Brush *brush, int value);
int brush_use_locked_size(struct Brush *brush);
void brush_set_use_locked_size(struct Brush *brush, int value);
int brush_use_alpha_pressure(struct Brush *brush);
void brush_set_use_alpha_pressure(struct Brush *brush, int value);
int brush_use_size_pressure(struct Brush *brush);
void brush_set_use_size_pressure(struct Brush *brush, int value);
float brush_unprojected_radius(struct Brush *brush);
void brush_set_unprojected_radius(struct Brush *brush, float value);
float brush_alpha(struct Brush *brush);
void brush_set_alpha(struct Brush *brush, float value);
#endif

@ -105,5 +105,7 @@ int check_valid_nurb_v( struct Nurb *nu);
int clamp_nurb_order_u( struct Nurb *nu);
int clamp_nurb_order_v( struct Nurb *nu);
ListBase *BKE_curve_nurbs(struct Curve *cu);
#endif

@ -164,6 +164,28 @@ struct StripElem *give_stripelem(struct Sequence *seq, int cfra);
// intern?
void update_changed_seq_and_deps(struct Scene *scene, struct Sequence *changed_seq, int len_change, int ibuf_change);
/* seqcache.c */
typedef enum {
SEQ_STRIPELEM_IBUF,
SEQ_STRIPELEM_IBUF_COMP,
SEQ_STRIPELEM_IBUF_STARTSTILL,
SEQ_STRIPELEM_IBUF_ENDSTILL
} seq_stripelem_ibuf_t;
void seq_stripelem_cache_init();
void seq_stripelem_cache_destruct();
void seq_stripelem_cache_cleanup();
struct ImBuf * seq_stripelem_cache_get(
struct Sequence * seq, int rectx, int recty,
float cfra, seq_stripelem_ibuf_t type);
void seq_stripelem_cache_put(
struct Sequence * seq, int rectx, int recty,
float cfra, seq_stripelem_ibuf_t type, struct ImBuf * nval);
/* seqeffects.c */
// intern?
struct SeqEffectHandle get_sequence_blend(struct Sequence *seq);

@ -66,6 +66,8 @@
#include "BKE_utildefines.h"
#include "BKE_depsgraph.h"
#include "ED_curve.h" /* for ED_curve_nurbs */
// XXX bad level call...
/* --------------------- */
@ -458,16 +460,16 @@ void calc_curvepath(Object *ob)
float *fp, *dist, *maxdist, xyz[3];
float fac, d=0, fac1, fac2;
int a, tot, cycl=0;
ListBase *nurbs;
/* in a path vertices are with equal differences: path->len = number of verts */
/* NOW WITH BEVELCURVE!!! */
if(ob==NULL || ob->type != OB_CURVE) return;
cu= ob->data;
if(cu->editnurb)
nu= cu->editnurb->first;
else
nu= cu->nurb.first;
nurbs= BKE_curve_nurbs(cu);
nu= nurbs->first;
if(cu->path) free_path(cu->path);
cu->path= NULL;

@ -102,6 +102,7 @@ void free_blender(void)
BKE_spacetypes_free(); /* after free main, it uses space callbacks */
IMB_exit();
seq_stripelem_cache_destruct();
free_nodesystem();
}

@ -38,6 +38,7 @@
#include "DNA_windowmanager_types.h"
#include "WM_types.h"
#include "WM_api.h"
#include "RNA_access.h"
@ -357,9 +358,10 @@ void brush_sample_tex(Brush *brush, float *xy, float *rgba)
if (mtex && mtex->tex) {
float co[3], tin, tr, tg, tb, ta;
int hasrgb;
const int radius= brush_size(brush);
co[0]= xy[0]/(brush->size >> 1);
co[1]= xy[1]/(brush->size >> 1);
co[0]= xy[0]/radius;
co[1]= xy[1]/radius;
co[2]= 0.0f;
hasrgb= externtex(mtex, co, &tin, &tr, &tg, &tb, &ta);
@ -382,23 +384,24 @@ void brush_sample_tex(Brush *brush, float *xy, float *rgba)
}
void brush_imbuf_new(Brush *brush, short flt, short texfall, int size, ImBuf **outbuf)
void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf **outbuf)
{
ImBuf *ibuf;
float xy[2], dist, rgba[4], *dstf;
int x, y, rowbytes, xoff, yoff, imbflag;
int maxsize = brush->size >> 1;
const int radius= brush_size(brush);
char *dst, crgb[3];
const float alpha= brush_alpha(brush);
imbflag= (flt)? IB_rectfloat: IB_rect;
xoff = -size/2.0f + 0.5f;
yoff = -size/2.0f + 0.5f;
rowbytes= size*4;
xoff = -bufsize/2.0f + 0.5f;
yoff = -bufsize/2.0f + 0.5f;
rowbytes= bufsize*4;
if (*outbuf)
ibuf= *outbuf;
else
ibuf= IMB_allocImBuf(size, size, 32, imbflag, 0);
ibuf= IMB_allocImBuf(bufsize, bufsize, 32, imbflag, 0);
if (flt) {
for (y=0; y < ibuf->y; y++) {
@ -412,7 +415,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int size, ImBuf **o
dist = sqrt(xy[0]*xy[0] + xy[1]*xy[1]);
VECCOPY(dstf, brush->rgb);
dstf[3]= brush->alpha*brush_curve_strength_clamp(brush, dist, maxsize);
dstf[3]= alpha*brush_curve_strength_clamp(brush, dist, radius);
}
else if (texfall == 1) {
brush_sample_tex(brush, xy, dstf);
@ -425,7 +428,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int size, ImBuf **o
dstf[0] = rgba[0]*brush->rgb[0];
dstf[1] = rgba[1]*brush->rgb[1];
dstf[2] = rgba[2]*brush->rgb[2];
dstf[3] = rgba[3]*brush->alpha*brush_curve_strength_clamp(brush, dist, maxsize);
dstf[3] = rgba[3]*alpha*brush_curve_strength_clamp(brush, dist, radius);
}
}
}
@ -448,7 +451,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int size, ImBuf **o
dst[0]= crgb[0];
dst[1]= crgb[1];
dst[2]= crgb[2];
dst[3]= FTOCHAR(brush->alpha*brush_curve_strength(brush, dist, maxsize));
dst[3]= FTOCHAR(alpha*brush_curve_strength(brush, dist, radius));
}
else if (texfall == 1) {
brush_sample_tex(brush, xy, rgba);
@ -464,7 +467,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int size, ImBuf **o
dst[0] = FTOCHAR(rgba[0]*brush->rgb[0]);
dst[1] = FTOCHAR(rgba[1]*brush->rgb[1]);
dst[2] = FTOCHAR(rgba[2]*brush->rgb[2]);
dst[3] = FTOCHAR(rgba[3]*brush->alpha*brush_curve_strength_clamp(brush, dist, maxsize));
dst[3] = FTOCHAR(rgba[3]*alpha*brush_curve_strength_clamp(brush, dist, radius));
}
}
}
@ -478,7 +481,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int size, ImBuf **o
typedef struct BrushPainterCache {
short enabled;
int size; /* size override, if 0 uses brush->size */
int size; /* size override, if 0 uses 2*brush_size(brush) */
short flt; /* need float imbuf? */
short texonly; /* no alpha, color or fallof, only texture in imbuf */
@ -523,8 +526,8 @@ BrushPainter *brush_painter_new(Brush *brush)
painter->firsttouch= 1;
painter->cache.lastsize= -1; /* force ibuf create in refresh */
painter->startsize = brush->size;
painter->startalpha = brush->alpha;
painter->startsize = brush_size(brush);
painter->startalpha = brush_alpha(brush);
painter->startjitter = brush->jitter;
painter->startspacing = brush->spacing;
@ -557,8 +560,8 @@ void brush_painter_free(BrushPainter *painter)
{
Brush *brush = painter->brush;
brush->size = painter->startsize;
brush->alpha = painter->startalpha;
brush_set_size(brush, painter->startsize);
brush_set_alpha(brush, painter->startalpha);
brush->jitter = painter->startjitter;
brush->spacing = painter->startspacing;
@ -575,9 +578,10 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, i
float *bf, *mf, *tf, *otf=NULL, xoff, yoff, xy[2], rgba[4];
char *b, *m, *t, *ot= NULL;
int dotexold, origx= x, origy= y;
const int radius= brush_size(brush);
xoff = -brush->size/2.0f + 0.5f;
yoff = -brush->size/2.0f + 0.5f;
xoff = -radius + 0.5f;
yoff = -radius + 0.5f;
xoff += (int)pos[0] - (int)painter->startpaintpos[0];
yoff += (int)pos[1] - (int)painter->startpaintpos[1];
@ -659,14 +663,15 @@ static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, float
BrushPainterCache *cache= &painter->cache;
ImBuf *oldtexibuf, *ibuf;
int imbflag, destx, desty, srcx, srcy, w, h, x1, y1, x2, y2;
const int diameter= 2*brush_size(brush);
imbflag= (cache->flt)? IB_rectfloat: IB_rect;
if (!cache->ibuf)
cache->ibuf= IMB_allocImBuf(brush->size, brush->size, 32, imbflag, 0);
cache->ibuf= IMB_allocImBuf(diameter, diameter, 32, imbflag, 0);
ibuf= cache->ibuf;
oldtexibuf= cache->texibuf;
cache->texibuf= IMB_allocImBuf(brush->size, brush->size, 32, imbflag, 0);
cache->texibuf= IMB_allocImBuf(diameter, diameter, 32, imbflag, 0);
if (oldtexibuf) {
srcx= srcy= 0;
@ -713,9 +718,13 @@ static void brush_painter_refresh_cache(BrushPainter *painter, float *pos)
MTex *mtex= &brush->mtex;
int size;
short flt;
const int diameter= 2*brush_size(brush);
const float alpha= brush_alpha(brush);
if ((brush->size != cache->lastsize) || (brush->alpha != cache->lastalpha)
|| (brush->jitter != cache->lastjitter)) {
if (diameter != cache->lastsize ||
alpha != cache->lastalpha ||
brush->jitter != cache->lastjitter)
{
if (cache->ibuf) {
IMB_freeImBuf(cache->ibuf);
cache->ibuf= NULL;
@ -726,7 +735,7 @@ static void brush_painter_refresh_cache(BrushPainter *painter, float *pos)
}
flt= cache->flt;
size= (cache->size)? cache->size: brush->size;
size= (cache->size)? cache->size: diameter;
if (!(mtex && mtex->tex) || (mtex->tex->type==0)) {
brush_imbuf_new(brush, flt, 0, size, &cache->ibuf);
@ -738,8 +747,8 @@ static void brush_painter_refresh_cache(BrushPainter *painter, float *pos)
else
brush_imbuf_new(brush, flt, 2, size, &cache->ibuf);
cache->lastsize= brush->size;
cache->lastalpha= brush->alpha;
cache->lastsize= diameter;
cache->lastalpha= alpha;
cache->lastjitter= brush->jitter;
}
else if ((brush->flag & BRUSH_FIXED_TEX) && mtex && mtex->tex) {
@ -758,10 +767,10 @@ void brush_painter_break_stroke(BrushPainter *painter)
static void brush_apply_pressure(BrushPainter *painter, Brush *brush, float pressure)
{
if (brush->flag & BRUSH_ALPHA_PRESSURE)
brush->alpha = MAX2(0.0, painter->startalpha*pressure);
if (brush->flag & BRUSH_SIZE_PRESSURE)
brush->size = MAX2(1.0, painter->startsize*pressure);
if (brush_use_alpha_pressure(brush))
brush_set_alpha(brush, MAX2(0.0, painter->startalpha*pressure));
if (brush_use_size_pressure(brush))
brush_set_size(brush, MAX2(1.0, painter->startsize*pressure));
if (brush->flag & BRUSH_JITTER_PRESSURE)
brush->jitter = MAX2(0.0, painter->startjitter*pressure);
if (brush->flag & BRUSH_SPACING_PRESSURE)
@ -772,6 +781,8 @@ void brush_jitter_pos(Brush *brush, float *pos, float *jitterpos)
{
if(brush->jitter){
float rand_pos[2];
const int radius= brush_size(brush);
const int diameter= 2*radius;
// find random position within a circle of diameter 1
do {
@ -779,8 +790,8 @@ void brush_jitter_pos(Brush *brush, float *pos, float *jitterpos)
rand_pos[1] = BLI_frand()-0.5f;
} while (len_v2(rand_pos) > 0.5f);
jitterpos[0] = pos[0] + 2*rand_pos[0]*brush->size*brush->jitter;
jitterpos[1] = pos[1] + 2*rand_pos[1]*brush->size*brush->jitter;
jitterpos[0] = pos[0] + 2*rand_pos[0]*diameter*brush->jitter;
jitterpos[1] = pos[1] + 2*rand_pos[1]*diameter*brush->jitter;
}
else {
VECCOPY2D(jitterpos, pos);
@ -819,7 +830,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
double starttime, curtime= time;
/* compute brush spacing adapted to brush size */
spacing= brush->rate; //brush->size*brush->spacing*0.01f;
spacing= brush->rate; //radius*brush->spacing*0.01f;
/* setup starting time, direction vector and accumulated time */
starttime= painter->accumtime;
@ -850,11 +861,13 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
else {
float startdistance, spacing, step, paintpos[2], dmousepos[2], finalpos[2];
float t, len, press;
const int radius= brush_size(brush);
const int diameter= 2*radius;
/* compute brush spacing adapted to brush size, spacing may depend
/* compute brush spacing adapted to brush radius, spacing may depend
on pressure, so update it */
brush_apply_pressure(painter, brush, painter->lastpressure);
spacing= MAX2(1.0f, brush->size)*brush->spacing*0.01f;
spacing= MAX2(1.0f, radius)*brush->spacing*0.01f;
/* setup starting distance, direction vector and accumulated distance */
startdistance= painter->accumdistance;
@ -871,7 +884,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
t = step/len;
press= (1.0f-t)*painter->lastpressure + t*pressure;
brush_apply_pressure(painter, brush, press);
spacing= MAX2(1.0f, brush->size)*brush->spacing*0.01f;
spacing= MAX2(1.0f, radius)*brush->spacing*0.01f;
brush_jitter_pos(brush, paintpos, finalpos);
@ -921,8 +934,8 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
painter->lastmousepos[1]= pos[1];
painter->lastpressure= pressure;
brush->alpha = painter->startalpha;
brush->size = painter->startsize;
brush_set_alpha(brush, painter->startalpha);
brush_set_size(brush, painter->startsize);
brush->jitter = painter->startjitter;
brush->spacing = painter->startspacing;
@ -1041,9 +1054,9 @@ void brush_radial_control_invoke(wmOperator *op, Brush *br, float size_weight)
float original_value= 0;
if(mode == WM_RADIALCONTROL_SIZE)
original_value = sculpt_get_brush_size(br) * size_weight;
original_value = brush_size(br) * size_weight;
else if(mode == WM_RADIALCONTROL_STRENGTH)
original_value = sculpt_get_brush_alpha(br);
original_value = brush_alpha(br);
else if(mode == WM_RADIALCONTROL_ANGLE) {
MTex *mtex = brush_active_texture(br);
if(mtex)
@ -1061,15 +1074,15 @@ int brush_radial_control_exec(wmOperator *op, Brush *br, float size_weight)
const float conv = 0.017453293;
if(mode == WM_RADIALCONTROL_SIZE)
if (sculpt_get_lock_brush_size(br)) {
if (brush_use_locked_size(br)) {
float initial_value = RNA_float_get(op->ptr, "initial_value");
const float unprojected_radius = sculpt_get_brush_unprojected_radius(br);
sculpt_set_brush_unprojected_radius(br, unprojected_radius * new_value/initial_value * size_weight);
const float unprojected_radius = brush_unprojected_radius(br);
brush_set_unprojected_radius(br, unprojected_radius * new_value/initial_value * size_weight);
}
else
sculpt_set_brush_size(br, new_value * size_weight);
brush_set_size(br, new_value * size_weight);
else if(mode == WM_RADIALCONTROL_STRENGTH)
sculpt_set_brush_alpha(br, new_value);
brush_set_alpha(br, new_value);
else if(mode == WM_RADIALCONTROL_ANGLE) {
MTex *mtex = brush_active_texture(br);
if(mtex)
@ -1078,3 +1091,248 @@ int brush_radial_control_exec(wmOperator *op, Brush *br, float size_weight)
return OPERATOR_FINISHED;
}
/* Unified Size and Strength */
static void set_unified_settings(Brush *brush, short flag, int value)
{
Scene *sce;
for (sce= G.main->scene.first; sce; sce= sce->id.next) {
if (sce->toolsettings &&
ELEM4(brush,
paint_brush(&(sce->toolsettings->imapaint.paint)),
paint_brush(&(sce->toolsettings->vpaint->paint)),
paint_brush(&(sce->toolsettings->wpaint->paint)),
paint_brush(&(sce->toolsettings->sculpt->paint))))
{
if (value)
sce->toolsettings->sculpt_paint_settings |= flag;
else
sce->toolsettings->sculpt_paint_settings &= ~flag;
}
}
}
static short unified_settings(Brush *brush)
{
Scene *sce;
for (sce= G.main->scene.first; sce; sce= sce->id.next) {
if (sce->toolsettings &&
ELEM4(brush,
paint_brush(&(sce->toolsettings->imapaint.paint)),
paint_brush(&(sce->toolsettings->vpaint->paint)),
paint_brush(&(sce->toolsettings->wpaint->paint)),
paint_brush(&(sce->toolsettings->sculpt->paint))))
{
return sce->toolsettings->sculpt_paint_settings;
}
}
return 0;
}
static void set_unified_size(Brush *brush, int value)
{
Scene *sce;
for (sce= G.main->scene.first; sce; sce= sce->id.next) {
if (sce->toolsettings &&
ELEM4(brush,
paint_brush(&(sce->toolsettings->imapaint.paint)),
paint_brush(&(sce->toolsettings->vpaint->paint)),
paint_brush(&(sce->toolsettings->wpaint->paint)),
paint_brush(&(sce->toolsettings->sculpt->paint))))
{
sce->toolsettings->sculpt_paint_unified_size= value;
}
}
}
static int unified_size(Brush *brush)
{
Scene *sce;
for (sce= G.main->scene.first; sce; sce= sce->id.next) {
if (sce->toolsettings &&
ELEM4(brush,
paint_brush(&(sce->toolsettings->imapaint.paint)),
paint_brush(&(sce->toolsettings->vpaint->paint)),
paint_brush(&(sce->toolsettings->wpaint->paint)),
paint_brush(&(sce->toolsettings->sculpt->paint))))
{
return sce->toolsettings->sculpt_paint_unified_size;
}
}
return 35; // XXX magic number
}
static void set_unified_alpha(Brush *brush, float value)
{
Scene *sce;
for (sce= G.main->scene.first; sce; sce= sce->id.next) {
if (sce->toolsettings &&
ELEM4(brush,
paint_brush(&(sce->toolsettings->imapaint.paint)),
paint_brush(&(sce->toolsettings->vpaint->paint)),
paint_brush(&(sce->toolsettings->wpaint->paint)),
paint_brush(&(sce->toolsettings->sculpt->paint))))
{
sce->toolsettings->sculpt_paint_unified_alpha= value;
}
}
}
static float unified_alpha(Brush *brush)
{
Scene *sce;
for (sce= G.main->scene.first; sce; sce= sce->id.next) {
if (sce->toolsettings &&
ELEM4(brush,
paint_brush(&(sce->toolsettings->imapaint.paint)),
paint_brush(&(sce->toolsettings->vpaint->paint)),
paint_brush(&(sce->toolsettings->wpaint->paint)),
paint_brush(&(sce->toolsettings->sculpt->paint))))
{
return sce->toolsettings->sculpt_paint_unified_alpha;
}
}
return 0.5f; // XXX magic number
}
static void set_unified_unprojected_radius(Brush *brush, float value)
{
Scene *sce;
for (sce= G.main->scene.first; sce; sce= sce->id.next) {
if (sce->toolsettings &&
ELEM4(brush,
paint_brush(&(sce->toolsettings->imapaint.paint)),
paint_brush(&(sce->toolsettings->vpaint->paint)),
paint_brush(&(sce->toolsettings->wpaint->paint)),
paint_brush(&(sce->toolsettings->sculpt->paint))))
{
sce->toolsettings->sculpt_paint_unified_unprojected_radius= value;
}
}
}
static float unified_unprojected_radius(Brush *brush)
{
Scene *sce;
for (sce= G.main->scene.first; sce; sce= sce->id.next) {
if (sce->toolsettings &&
ELEM4(brush,
paint_brush(&(sce->toolsettings->imapaint.paint)),
paint_brush(&(sce->toolsettings->vpaint->paint)),
paint_brush(&(sce->toolsettings->wpaint->paint)),
paint_brush(&(sce->toolsettings->sculpt->paint))))
{
return sce->toolsettings->sculpt_paint_unified_unprojected_radius;
}
}
return 0.125f; // XXX magic number
}
void brush_set_size(Brush *brush, int size)
{
if (unified_settings(brush) & SCULPT_PAINT_USE_UNIFIED_SIZE)
set_unified_size(brush, size);
else
brush->size= size;
WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
}
int brush_size(Brush *brush)
{
return (unified_settings(brush) & SCULPT_PAINT_USE_UNIFIED_SIZE) ? unified_size(brush) : brush->size;
}
void brush_set_use_locked_size(Brush *brush, int value)
{
if (unified_settings(brush) & SCULPT_PAINT_USE_UNIFIED_SIZE) {
set_unified_settings(brush, SCULPT_PAINT_UNIFIED_LOCK_BRUSH_SIZE, value);
}
else {
if (value)
brush->flag |= BRUSH_LOCK_SIZE;
else
brush->flag &= ~BRUSH_LOCK_SIZE;
}
WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
}
int brush_use_locked_size(Brush *brush)
{
return (unified_settings(brush) & SCULPT_PAINT_USE_UNIFIED_SIZE) ? (unified_settings(brush) & SCULPT_PAINT_UNIFIED_LOCK_BRUSH_SIZE) : (brush->flag & BRUSH_LOCK_SIZE);
}
void brush_set_use_size_pressure(Brush *brush, int value)
{
if (unified_settings(brush) & SCULPT_PAINT_USE_UNIFIED_SIZE) {
set_unified_settings(brush, SCULPT_PAINT_UNIFIED_SIZE_PRESSURE, value);
}
else {
if (value)
brush->flag |= BRUSH_SIZE_PRESSURE;
else
brush->flag &= ~BRUSH_SIZE_PRESSURE;
}
WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
}
int brush_use_size_pressure(Brush *brush)
{
return (unified_settings(brush) & SCULPT_PAINT_USE_UNIFIED_SIZE) ? (unified_settings(brush) & SCULPT_PAINT_UNIFIED_SIZE_PRESSURE) : (brush->flag & BRUSH_SIZE_PRESSURE);
}
void brush_set_use_alpha_pressure(Brush *brush, int value)
{
if (unified_settings(brush) & SCULPT_PAINT_USE_UNIFIED_ALPHA) {
set_unified_settings(brush, SCULPT_PAINT_UNIFIED_ALPHA_PRESSURE, value);
}
else {
if (value)
brush->flag |= BRUSH_ALPHA_PRESSURE;
else
brush->flag &= ~BRUSH_ALPHA_PRESSURE;
}
WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
}
int brush_use_alpha_pressure(Brush *brush)
{
return (unified_settings(brush) & SCULPT_PAINT_USE_UNIFIED_ALPHA) ? (unified_settings(brush) & SCULPT_PAINT_UNIFIED_ALPHA_PRESSURE) : (brush->flag & BRUSH_ALPHA_PRESSURE);
}
void brush_set_unprojected_radius(Brush *brush, float unprojected_radius)
{
if (unified_settings(brush) & SCULPT_PAINT_USE_UNIFIED_SIZE)
set_unified_unprojected_radius(brush, unprojected_radius);
else
brush->unprojected_radius= unprojected_radius;
WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
}
float brush_unprojected_radius(Brush *brush)
{
return (unified_settings(brush) & SCULPT_PAINT_USE_UNIFIED_SIZE) ? unified_unprojected_radius(brush) : brush->unprojected_radius;
}
void brush_set_alpha(Brush *brush, float alpha)
{
if (unified_settings(brush) & SCULPT_PAINT_USE_UNIFIED_ALPHA)
set_unified_alpha(brush, alpha);
else
brush->alpha= alpha;
WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
}
float brush_alpha(Brush *brush)
{
return (unified_settings(brush) & SCULPT_PAINT_USE_UNIFIED_ALPHA) ? unified_alpha(brush) : brush->alpha;
}

@ -144,6 +144,9 @@ void cloth_init ( ClothModifierData *clmd )
if(!clmd->sim_parms->effector_weights)
clmd->sim_parms->effector_weights = BKE_add_effector_weights(NULL);
if(clmd->point_cache)
clmd->point_cache->step = 1;
}
static BVHTree *bvhselftree_build_from_cloth (ClothModifierData *clmd, float epsilon)

@ -58,6 +58,8 @@
#include "BKE_object.h"
#include "BKE_utildefines.h" // VECCOPY
#include "ED_curve.h"
/* globals */
/* local */
@ -105,12 +107,7 @@ void free_curve(Curve *cu)
freedisplist(&cu->disp);
BKE_free_editfont(cu);
if(cu->editnurb) {
freeNurblist(cu->editnurb);
MEM_freeN(cu->editnurb);
cu->editnurb= NULL;
}
free_curve_editNurb(cu);
unlink_curve(cu);
BKE_free_animdata((ID *)cu);
@ -2008,8 +2005,10 @@ void makeBevelList(Object *ob)
/* STEP 1: MAKE POLYS */
BLI_freelistN(&(cu->bev));
if(cu->editnurb && ob->type!=OB_FONT) nu= cu->editnurb->first;
else nu= cu->nurb.first;
if(cu->editnurb && ob->type!=OB_FONT) {
ListBase *nurbs= ED_curve_editnurbs(cu);
nu= nurbs->first;
} else nu= cu->nurb.first;
while(nu) {
@ -2999,7 +2998,7 @@ float (*curve_getKeyVertexCos(Curve *cu, ListBase *lb, float *key))[3]
VECCOPY(co, key); co+=3; key+=3;
VECCOPY(co, key); co+=3; key+=3;
VECCOPY(co, key); co+=3; key+=3;
key++; /* skip tilt */
key+=3; /* skip tilt */
}
}
else {
@ -3099,5 +3098,12 @@ int clamp_nurb_order_v( struct Nurb *nu)
return change;
}
/* Get edit nurbs or normal nurbs list */
ListBase *BKE_curve_nurbs(Curve *cu)
{
if (cu->editnurb) {
return ED_curve_editnurbs(cu);
}
return &cu->nurb;
}

@ -63,6 +63,7 @@
#include "BLO_sys_types.h" // for intptr_t support
#include "ED_curve.h" /* for BKE_curve_nurbs */
static void boundbox_displist(Object *ob);
@ -1221,7 +1222,7 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
ModifierData *md = modifiers_getVirtualModifierList(ob);
ModifierData *preTesselatePoint;
Curve *cu= ob->data;
ListBase *nurb= cu->editnurb?cu->editnurb:&cu->nurb;
ListBase *nurb= BKE_curve_nurbs(cu);
int numVerts = 0;
int editmode = (!forRender && cu->editnurb);
float (*originalVerts)[3] = NULL;
@ -1324,8 +1325,9 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
ModifierData *md = modifiers_getVirtualModifierList(ob);
ModifierData *preTesselatePoint;
Curve *cu= ob->data;
ListBase *nurb= cu->editnurb?cu->editnurb:&cu->nurb;
int required_mode, totvert = 0;
ListBase *nurb= BKE_curve_nurbs(cu);
DispList *dl;
int required_mode = 0, totvert = 0;
int editmode = (!forRender && cu->editnurb);
DerivedMesh *dm= NULL, *ndm;
float (*vertCos)[3] = NULL;
@ -1592,7 +1594,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
float (*deformedVerts)[3];
if(!forRender && cu->editnurb)
nubase= cu->editnurb;
nubase= ED_curve_editnurbs(cu);
else
nubase= &cu->nurb;
@ -1689,10 +1691,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
cu->taperobj = NULL;
}
if(cu->editnurb)
nubase= cu->editnurb;
else
nubase= &cu->nurb;
nubase= BKE_curve_nurbs(cu);
BLI_freelistN(&(cu->bev));

@ -542,11 +542,15 @@ static void cp_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *
poinsize= ofs[0];
}
else if( GS(key->from->name)==ID_CU ) {
if(mode==KEY_BPOINT) ofs[0]= sizeof(float)*4;
else ofs[0]= sizeof(float)*10;
if(mode==KEY_BPOINT) {
ofs[0]= sizeof(float)*4;
poinsize= ofs[0];
}else {
ofs[0]= sizeof(float)*12;
poinsize= ofs[0]/3;
}
ofs[1]= 0;
poinsize= ofs[0];
}
if(end>tot) end= tot;
@ -612,7 +616,7 @@ static void cp_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *
memcpy(poin, k1, sizeof(float)*4);
break;
case IPO_BEZTRIPLE:
memcpy(poin, k1, sizeof(float)*10);
memcpy(poin, k1, sizeof(float)*12);
break;
}
@ -644,28 +648,25 @@ static void cp_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *
static void cp_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, int start, int end, char *out, int tot)
{
Nurb *nu;
char *poin;
int a, step, a1, a2;
for(a=0, nu=cu->nurb.first; nu; nu=nu->next, a+=step) {
if(nu->bp) {
step= nu->pntsu*nu->pntsv;
/* exception because keys prefer to work with complete blocks */
poin= out - a*sizeof(float)*4;
a1= MAX2(a, start);
a2= MIN2(a+step, end);
if(a1<a2) cp_key(a1, a2, tot, poin, key, actkb, kb, NULL, KEY_BPOINT);
if(a1<a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_BPOINT);
}
else if(nu->bezt) {
step= 3*nu->pntsu;
poin= out - a*sizeof(float)*10;
/* exception because keys prefer to work with complete blocks */
a1= MAX2(a, start);
a2= MIN2(a+step, end);
if(a1<a2) cp_key(a1, a2, tot, poin, key, actkb, kb, NULL, KEY_BEZTRIPLE);
if(a1<a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_BEZTRIPLE);
}
else
step= 0;
@ -679,20 +680,28 @@ void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, KeyBlock
int *ofsp, ofs[3], elemsize, b;
char *cp, *poin, *reffrom, *from, elemstr[8];
char *freefrom, *freereffrom;
int poinsize= 0;
if(key->from==NULL) return;
if( GS(key->from->name)==ID_ME ) {
ofs[0]= sizeof(float)*3;
ofs[1]= 0;
poinsize= ofs[0];
}
else if( GS(key->from->name)==ID_LT ) {
ofs[0]= sizeof(float)*3;
ofs[1]= 0;
poinsize= ofs[0];
}
else if( GS(key->from->name)==ID_CU ) {
if(mode==KEY_BPOINT) ofs[0]= sizeof(float)*4;
else ofs[0]= sizeof(float)*10;
if(mode==KEY_BPOINT) {
ofs[0]= sizeof(float)*4;
poinsize= ofs[0];
} else {
ofs[0]= sizeof(float)*12;
poinsize= ofs[0] / 3;
}
ofs[1]= 0;
}
@ -730,7 +739,7 @@ void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, KeyBlock
from= key_block_get_data(key, actkb, kb, &freefrom);
reffrom= key_block_get_data(key, actkb, refb, &freereffrom);
poin+= start*ofs[0];
poin+= start*poinsize;
reffrom+= key->elemsize*start; // key elemsize yes!
from+= key->elemsize*start;
@ -756,7 +765,7 @@ void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, KeyBlock
rel_flerp(4, (float *)poin, (float *)reffrom, (float *)from, weight);
break;
case IPO_BEZTRIPLE:
rel_flerp(10, (float *)poin, (float *)reffrom, (float *)from, weight);
rel_flerp(12, (float *)poin, (float *)reffrom, (float *)from, weight);
break;
}
@ -803,11 +812,15 @@ static void do_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *
poinsize= ofs[0];
}
else if( GS(key->from->name)==ID_CU ) {
if(mode==KEY_BPOINT) ofs[0]= sizeof(float)*4;
else ofs[0]= sizeof(float)*10;
if(mode==KEY_BPOINT) {
ofs[0]= sizeof(float)*4;
poinsize= ofs[0];
} else {
ofs[0]= sizeof(float)*12;
poinsize= ofs[0] / 3;
}
ofs[1]= 0;
poinsize= ofs[0];
}
if(end>tot) end= tot;
@ -929,7 +942,7 @@ static void do_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *
flerp(4, (float *)poin, (float *)k1, (float *)k2, (float *)k3, (float *)k4, t);
break;
case IPO_BEZTRIPLE:
flerp(10, (void *)poin, (void *)k1, (void *)k2, (void *)k3, (void *)k4, t);
flerp(12, (void *)poin, (void *)k1, (void *)k2, (void *)k3, (void *)k4, t);
break;
}
@ -1137,19 +1150,16 @@ static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, int tot)
static void do_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock **k, float *t, char *out, int tot)
{
Nurb *nu;
char *poin;
int a, step;
for(a=0, nu=cu->nurb.first; nu; nu=nu->next, a+=step) {
if(nu->bp) {
step= nu->pntsu*nu->pntsv;
poin= out - a*sizeof(float)*4;
do_key(a, a+step, tot, poin, key, actkb, k, t, KEY_BPOINT);
do_key(a, a+step, tot, out, key, actkb, k, t, KEY_BPOINT);
}
else if(nu->bezt) {
step= 3*nu->pntsu;
poin= out - a*sizeof(float)*10;
do_key(a, a+step, tot, poin, key, actkb, k, t, KEY_BEZTRIPLE);
do_key(a, a+step, tot, out, key, actkb, k, t, KEY_BEZTRIPLE);
}
else
step= 0;
@ -1159,19 +1169,16 @@ static void do_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock **k, float
static void do_rel_cu_key(Curve *cu, Key *key, KeyBlock *actkb, float ctime, char *out, int tot)
{
Nurb *nu;
char *poin;
int a, step;
for(a=0, nu=cu->nurb.first; nu; nu=nu->next, a+=step) {
if(nu->bp) {
step= nu->pntsu*nu->pntsv;
poin= out - a*sizeof(float)*3;
do_rel_key(a, a+step, tot, out, key, actkb, KEY_BPOINT);
}
else if(nu->bezt) {
step= 3*nu->pntsu;
poin= out - a*sizeof(float)*10;
do_rel_key(a, a+step, tot, poin, key, actkb, KEY_BEZTRIPLE);
do_rel_key(a, a+step, tot, out, key, actkb, KEY_BEZTRIPLE);
}
else
step= 0;
@ -1185,9 +1192,11 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, int tot)
float cfra, ctime, t[4], delta;
int a, flag = 0, step = 0;
if(key->slurph) {
delta= key->slurph;
delta/= tot;
if(key->slurph && key->type!=KEY_RELATIVE) {
Nurb *nu;
int mode, i= 0, remain= 0, estep, count;
delta= (float)key->slurph / tot;
step= 1;
if(tot>100 && slurph_opt) {
@ -1198,21 +1207,45 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, int tot)
cfra= (float)scene->r.cfra;
for(a=0; a<tot; a+=step, cfra+= delta) {
ctime= bsystem_time(scene, 0, cfra, 0.0f); // XXX old cruft
#if 0 // XXX old animation system
if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
ctime /= 100.0;
CLAMP(ctime, 0.0, 1.0);
for(nu=cu->nurb.first; nu; nu=nu->next) {
if(nu->bp) {
mode= KEY_BPOINT;
estep= nu->pntsu*nu->pntsv;
}
#endif // XXX old animation system
else if(nu->bezt) {
mode= KEY_BEZTRIPLE;
estep= 3*nu->pntsu;
}
else
step= 0;
a= 0;
while (a < estep) {
if (remain <= 0) {
cfra+= delta;
ctime= bsystem_time(scene, 0, cfra, 0.0f); // XXX old cruft
ctime /= 100.0f;
CLAMP(ctime, 0.0f, 1.0f); // XXX for compat, we use this, but this clamping was confusing
flag= setkeys(ctime, &key->block, k, t, 0);
remain= step;
}
count= MIN2(remain, estep);
if (mode == KEY_BEZTRIPLE) {
count += 3 - count % 3;
}
if(flag==0)
do_key(a, a+step, tot, (char *)out, key, actkb, k, t, 0);
do_key(i, i+count, tot, (char *)out, key, actkb, k, t, mode);
else
cp_key(a, a+step, tot, (char *)out, key, actkb, k[2], NULL, 0);
cp_key(i, i+count, tot, (char *)out, key, actkb, k[2], NULL, mode);
a += count;
i += count;
remain -= count;
}
}
}
else {
@ -1336,11 +1369,11 @@ float *do_ob_key(Scene *scene, Object *ob)
for(nu=cu->nurb.first; nu; nu=nu->next) {
if(nu->bezt) {
tot += 3*nu->pntsu;
size += nu->pntsu*10*sizeof(float);
size += nu->pntsu*12*sizeof(float);
}
else if(nu->bp) {
tot += nu->pntsu*nu->pntsv;
size += nu->pntsu*nu->pntsv*10*sizeof(float);
size += nu->pntsu*nu->pntsv*12*sizeof(float);
}
}
}

@ -1015,7 +1015,9 @@ int splitIDname(char *name, char *left, int *nr)
left[a]= 0;
}
strcpy(left, name);
for(a= 0; name[a]; a++)
left[a]= name[a];
return a;
}
@ -1105,14 +1107,12 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
if(nr>999 && strlen(left)>16) left[16]= 0;
else if(strlen(left)>17) left[17]= 0;
if(left_len) {
for(idtest= lb->first; idtest; idtest= idtest->next) {
if( (id != idtest) &&
(idtest->lib == NULL) &&
(*name == *(idtest->name+2)) &&
(strncmp(name, idtest->name+2, left_len)==0) &&
(splitIDname(idtest->name+2, leftest, &nrtest) == left_len)
) {
if(nrtest < sizeof(in_use))
in_use[nrtest]= 1; /* mark as used */
@ -1120,7 +1120,6 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
nr= nrtest+1; /* track largest unused */
}
}
}
/* decide which value of nr to use */
for(a=0; a < sizeof(in_use); a++) {

@ -1885,12 +1885,11 @@ static void give_parvert(Object *par, int nr, float *vec)
BPoint *bp;
BezTriple *bezt;
int found= 0;
ListBase *nurbs;
cu= par->data;
if(cu->editnurb)
nu= cu->editnurb->first;
else
nu= cu->nurb.first;
nurbs= BKE_curve_nurbs(cu);
nu= nurbs->first;
count= 0;
while(nu && !found) {
@ -2946,7 +2945,7 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, char *name, int from_
Curve *cu= ob->data;
Key *key= cu->key;
KeyBlock *kb;
ListBase *lb= (cu->editnurb)? cu->editnurb: &cu->nurb;
ListBase *lb= BKE_curve_nurbs(cu);
int newkey= 0;
if(key==NULL) {

@ -1041,12 +1041,14 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
if((lb_dupli_ob=object_duplilist(scene, ob))) {
DupliObject *dob;
for(dob= lb_dupli_ob->first; dob; dob= dob->next) {
if(dob->ob != ob) { /* avoids recursive loops with dupliframes: bug 22988 */
ListBase lb_dupli_pid;
BKE_ptcache_ids_from_object(&lb_dupli_pid, dob->ob, scene, duplis);
addlisttolist(lb, &lb_dupli_pid);
if(lb_dupli_pid.first)
printf("Adding Dupli\n");
}
}
free_object_duplilist(lb_dupli_ob); /* does restore */
}

@ -512,6 +512,10 @@ void set_scene_bg(Scene *scene)
/* check for cyclic sets, for reading old files but also for definite security (py?) */
scene_check_setscene(scene);
/* can happen when switching modes in other scenes */
if(scene->obedit && !(scene->obedit->mode & OB_MODE_EDIT))
scene->obedit= NULL;
/* deselect objects (for dataselect) */
for(ob= G.main->object.first; ob; ob= ob->id.next)
ob->flag &= ~(SELECT|OB_FROMGROUP);

@ -0,0 +1,267 @@
/**
* $Id$
*
* ***** 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.
*
* Peter Schlaile <peter [at] schlaile [dot] de> 2010
*
* ***** END GPL LICENSE BLOCK *****
*/
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "MEM_guardedalloc.h"
#include "MEM_CacheLimiterC-Api.h"
#include "DNA_sequence_types.h"
#include "BKE_sequencer.h"
#include "BLI_ghash.h"
#include "BLI_mempool.h"
#include <pthread.h>
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
typedef struct seqCacheKey
{
struct Sequence * seq;
int rectx;
int recty;
float cfra;
seq_stripelem_ibuf_t type;
} seqCacheKey;
typedef struct seqCacheEntry
{
ImBuf * ibuf;
MEM_CacheLimiterHandleC * c_handle;
} seqCacheEntry;
static GHash * hash = 0;
static MEM_CacheLimiterC * limitor = 0;
static struct BLI_mempool * entrypool = 0;
static struct BLI_mempool * keypool = 0;
static int ibufs_in = 0;
static int ibufs_rem = 0;
static unsigned int HashHash(void *key_)
{
seqCacheKey * key = (seqCacheKey*) key_;
unsigned int rval = key->rectx + key->recty;
rval ^= *(unsigned int*) &key->cfra;
rval += key->type;
rval ^= ((unsigned int) key->seq) << 6;
return rval;
}
static int HashCmp(void *a_, void *b_)
{
seqCacheKey * a = (seqCacheKey*) a_;
seqCacheKey * b = (seqCacheKey*) b_;
if (a->seq < b->seq) {
return -1;
}
if (a->seq > b->seq) {
return 1;
}
if (a->cfra < b->cfra) {
return -1;
}
if (a->cfra > b->cfra) {
return 1;
}
if (a->type < b->type) {
return -1;
}
if (a->type > b->type) {
return 1;
}
if (a->rectx < b->rectx) {
return -1;
}
if (a->rectx > b->rectx) {
return 1;
}
if (a->recty < b->recty) {
return -1;
}
if (a->recty > b->recty) {
return 1;
}
return 0;
}
static void HashKeyFree(void *key)
{
BLI_mempool_free(keypool, key);
}
static void HashValFree(void *val)
{
seqCacheEntry* e = (seqCacheEntry*) val;
if (e->ibuf) {
/* fprintf(stderr, "Removing: %p, cnt: %d\n", e->ibuf,
e->ibuf->refcounter); */
IMB_freeImBuf(e->ibuf);
MEM_CacheLimiter_unmanage(e->c_handle);
ibufs_rem++;
}
e->ibuf = 0;
e->c_handle = 0;
BLI_mempool_free(entrypool, e);
}
static void IMB_seq_cache_destructor(void * p)
{
seqCacheEntry* e = (seqCacheEntry*) p;
if (e && e->ibuf) {
/* fprintf(stderr, "Removing: %p, cnt: %d\n", e->ibuf,
e->ibuf->refcounter); */
IMB_freeImBuf(e->ibuf);
ibufs_rem++;
e->ibuf = 0;
e->c_handle = 0;
}
}
void seq_stripelem_cache_init()
{
hash = BLI_ghash_new(HashHash, HashCmp, "seq stripelem cache hash");
limitor = new_MEM_CacheLimiter( IMB_seq_cache_destructor );
entrypool = BLI_mempool_create(sizeof(seqCacheEntry), 64, 64, 0);
keypool = BLI_mempool_create(sizeof(seqCacheKey), 64, 64, 0);
}
void seq_stripelem_cache_destruct()
{
if (!entrypool) {
return;
}
BLI_ghash_free(hash, HashKeyFree, HashValFree);
delete_MEM_CacheLimiter(limitor);
BLI_mempool_destroy(entrypool);
BLI_mempool_destroy(keypool);
}
void seq_stripelem_cache_cleanup()
{
if (!entrypool) {
seq_stripelem_cache_init();
}
/* fprintf(stderr, "Stats before cleanup: in: %d rem: %d\n",
ibufs_in, ibufs_rem); */
BLI_ghash_free(hash, HashKeyFree, HashValFree);
hash = BLI_ghash_new(HashHash, HashCmp, "seq stripelem cache hash");
/* fprintf(stderr, "Stats after cleanup: in: %d rem: %d\n",
ibufs_in, ibufs_rem); */
}
struct ImBuf * seq_stripelem_cache_get(
struct Sequence * seq, int rectx, int recty,
float cfra, seq_stripelem_ibuf_t type)
{
seqCacheKey key;
seqCacheEntry * e;
if (!seq) {
return 0;
}
if (!entrypool) {
seq_stripelem_cache_init();
}
key.seq = seq;
key.rectx = rectx;
key.recty = recty;
key.cfra = cfra - seq->start;
key.type = type;
e = (seqCacheEntry*) BLI_ghash_lookup(hash, &key);
if (e && e->ibuf) {
IMB_refImBuf(e->ibuf);
MEM_CacheLimiter_touch(e->c_handle);
return e->ibuf;
}
return 0;
}
void seq_stripelem_cache_put(
struct Sequence * seq, int rectx, int recty,
float cfra, seq_stripelem_ibuf_t type, struct ImBuf * i)
{
seqCacheKey * key;
seqCacheEntry * e;
if (!i) {
return;
}
ibufs_in++;
if (!entrypool) {
seq_stripelem_cache_init();
}
key = (seqCacheKey*) BLI_mempool_alloc(keypool);
key->seq = seq;
key->rectx = rectx;
key->recty = recty;
key->cfra = cfra - seq->start;
key->type = type;
/* we want our own version */
IMB_refImBuf(i);
e = (seqCacheEntry*) BLI_mempool_alloc(entrypool);
e->ibuf = i;
e->c_handle = 0;
BLI_ghash_remove(hash, key, HashKeyFree, HashValFree);
BLI_ghash_insert(hash, key, e);
e->c_handle = MEM_CacheLimiter_insert(limitor, e);
MEM_CacheLimiter_ref(e->c_handle);
MEM_CacheLimiter_enforce_limits(limitor);
MEM_CacheLimiter_unref(e->c_handle);
}

@ -827,7 +827,7 @@ static void makeGammaTables(float gamma)
/* The end of the table should match 1.0 carefully. In order to avoid */
/* rounding errors, we just set this explicitly. The last segment may */
/* have a different lenght than the other segments, but our */
/* have a different length than the other segments, but our */
/* interpolation is insensitive to that. */
color_domain_table[RE_GAMMA_TABLE_SIZE] = 1.0;
gamma_range_table[RE_GAMMA_TABLE_SIZE] = 1.0;
@ -2786,6 +2786,7 @@ static void do_multicam(Scene *scene, Sequence *seq, int cfra,
IMB_float_from_rect_simple(i);
memcpy(out->rect_float, i->rect_float, out->x * out->y *4*sizeof(float));
}
IMB_freeImBuf(i);
}
/* **********************************************************************

File diff suppressed because it is too large Load Diff

@ -3226,7 +3226,7 @@ static void get_scalar_from_vertexgroup(Object *ob, int vertID, short groupindex
}
/* Resetting a Mesh SB object's springs */
/* Spring lenght are caculted from'raw' mesh vertices that are NOT altered by modifier stack. */
/* Spring length are caculted from'raw' mesh vertices that are NOT altered by modifier stack. */
static void springs_from_mesh(Object *ob)
{
SoftBody *sb;
@ -3362,7 +3362,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
add_2nd_order_springs(ob,sb->secondspring); /* exploits the the first run of build_bps_springlist(ob);*/
build_bps_springlist(ob); /* yes we need to do it again*/
}
springs_from_mesh(ob); /* write the 'rest'-lenght of the springs */
springs_from_mesh(ob); /* write the 'rest'-length of the springs */
if (ob->softflag & OB_SB_SELF) {calculate_collision_balls(ob);}
}

@ -1225,7 +1225,7 @@ static int point_in_slice_as(float p[3],float origin[3],float normal[3])
return 1;
}
/*mama (knowing the squared lenght of the normal)*/
/*mama (knowing the squared length of the normal)*/
static int point_in_slice_m(float p[3],float origin[3],float normal[3],float lns)
{
float h,rp[3];

@ -10853,12 +10853,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
/* put 2.50 compatibility code here until next subversion bump */
if (main->versionfile < 253)
{
Object *ob;
Scene *scene;
bScreen *sc;
Tex *tex;
Brush *brush;
for (sc= main->screen.first; sc; sc= sc->id.next) {
ScrArea *sa;
@ -10974,12 +10975,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
SEQ_END
}
}
}
{
/* GSOC 2010 Sculpt - New settings for Brush */
Brush *brush;
for (brush= main->brush.first; brush; brush= brush->id.next) {
/* Sanity Check */
@ -11052,6 +11050,25 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
/* GSOC Sculpt 2010 - Sanity check on Sculpt/Paint settings */
if (main->versionfile < 253) {
Scene *sce;
for (sce= main->scene.first; sce; sce= sce->id.next) {
if (sce->toolsettings->sculpt_paint_unified_alpha == 0)
sce->toolsettings->sculpt_paint_unified_alpha = 0.5f;
if (sce->toolsettings->sculpt_paint_unified_unprojected_radius == 0)
sce->toolsettings->sculpt_paint_unified_unprojected_radius = 0.125f;
if (sce->toolsettings->sculpt_paint_unified_size == 0)
sce->toolsettings->sculpt_paint_unified_size = 35;
}
}
/* put compatibility code here until next subversion bump */
{
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */

@ -1423,7 +1423,7 @@ static void write_curves(WriteData *wd, ListBase *idbase)
if(cu->vfont) {
writedata(wd, DATA, amount_of_chars(cu->str)+1, cu->str);
writestruct(wd, DATA, "CharInfo", cu->len, cu->strinfo);
writestruct(wd, DATA, "CharInfo", cu->len+1, cu->strinfo);
writestruct(wd, DATA, "TextBox", cu->totbox, cu->tb);
}
else {

@ -43,6 +43,7 @@
#include "DNA_constraint_types.h"
#include "DNA_scene_types.h"
#include "BKE_main.h"
#include "BKE_animsys.h"
#include "BKE_action.h"
#include "BKE_context.h"
@ -589,7 +590,7 @@ void ANIM_keyingset_info_register (const bContext *C, KeyingSetInfo *ksi)
/* Remove the given KeyingSetInfo from the list of type infos, and also remove the builtin set if appropriate */
void ANIM_keyingset_info_unregister (const bContext *C, KeyingSetInfo *ksi)
{
Scene *scene = CTX_data_scene(C);
Main *bmain= CTX_data_main(C);
KeyingSet *ks, *ksn;
/* find relevant builtin KeyingSets which use this, and remove them */
@ -600,8 +601,14 @@ void ANIM_keyingset_info_unregister (const bContext *C, KeyingSetInfo *ksi)
/* remove if matching typeinfo name */
if (strcmp(ks->typeinfo, ksi->idname) == 0) {
Scene *scene;
BKE_keyingset_free(ks);
BLI_freelinkN(&scene->keyingsets, ks);
BLI_remlink(&builtin_keyingsets, ks);
for(scene= bmain->scene.first; scene; scene= scene->id.next)
BLI_remlink_safe(&scene->keyingsets, ks);
MEM_freeN(ks);
}
}

@ -4095,7 +4095,7 @@ void ARMATURE_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "deselect all editbone";
ot->name= "Select or Deselect All";
ot->idname= "ARMATURE_OT_select_all";
/* api callbacks */
@ -5213,7 +5213,7 @@ void POSE_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "deselect all bones";
ot->name= "Select or Deselect All";
ot->idname= "POSE_OT_select_all";
/* api callbacks */

File diff suppressed because it is too large Load Diff

@ -1229,7 +1229,7 @@ static int insert_text_exec(bContext *C, wmOperator *op)
Object *obedit= CTX_data_edit_object(C);
char *inserted_utf8;
wchar_t *inserted_text, first;
int len;
int a, len;
if(!RNA_property_is_set(op->ptr, "text"))
return OPERATOR_CANCELLED;
@ -1241,13 +1241,12 @@ static int insert_text_exec(bContext *C, wmOperator *op)
utf8towchar(inserted_text, inserted_utf8);
first= inserted_text[0];
for(a=0; a<len; a++)
insert_into_textbuf(obedit, inserted_text[a]);
MEM_freeN(inserted_text);
MEM_freeN(inserted_utf8);
if(!first)
return OPERATOR_CANCELLED;
insert_into_textbuf(obedit, first);
kill_selection(obedit, 1);
text_update_edited(C, scene, obedit, 1, 0);

File diff suppressed because it is too large Load Diff

@ -37,6 +37,10 @@ struct Text;
struct View3D;
struct wmOperator;
struct wmKeyConfig;
struct Curve;
struct EditNurb;
struct BezTriple;
struct BPoint;
/* curve_ops.c */
void ED_operatortypes_curve(void);
@ -55,6 +59,8 @@ void load_editNurb (struct Object *obedit);
void make_editNurb (struct Object *obedit);
void free_editNurb (struct Object *obedit);
void free_curve_editNurb (struct Curve *cu);
int mouse_nurb (struct bContext *C, short mval[2], int extend);
struct Nurb *add_nurbs_primitive(struct bContext *C, float mat[4][4], int type, int newname);
@ -72,6 +78,10 @@ void free_editText (struct Object *obedit);
void ED_text_to_object(struct bContext *C, struct Text *text, int split_lines);
int CU_select_nth(struct Object *obedit, int nth);
ListBase *ED_curve_editnurbs(struct Curve *cu);
void ED_curve_beztcpy(struct EditNurb *editnurb, struct BezTriple *dst, struct BezTriple *src, int count);
void ED_curve_bpcpy(struct EditNurb *editnurb, struct BPoint *dst, struct BPoint *src, int count);
#endif /* ED_CURVE_H */

@ -49,7 +49,7 @@ void ED_keymap_paint(struct wmKeyConfig *keyconf);
#define UNDO_PAINT_IMAGE 0
#define UNDO_PAINT_MESH 1
void ED_undo_paint_step(struct bContext *C, int type, int step);
int ED_undo_paint_step(struct bContext *C, int type, int step, const char *name);
void ED_undo_paint_free(void);
#endif

@ -1464,13 +1464,13 @@ static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double va
bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision, scene->unit.system, unit_type, do_split, pad);
}
static float ui_get_but_step_unit(uiBut *but, double value, float step_default)
static float ui_get_but_step_unit(uiBut *but, float step_default)
{
Scene *scene= CTX_data_scene((bContext *)but->block->evil_C);
int unit_type= RNA_SUBTYPE_UNIT_VALUE(RNA_property_subtype(but->rnaprop));
float step;
step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, value), scene->unit.system, unit_type);
step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, step_default), scene->unit.system, unit_type);
if(step > 0.0) { /* -1 is an error value */
return (step/ui_get_but_scale_unit(but, 1.0))*100;
@ -2563,7 +2563,7 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1,
/* If this button uses units, calculate the step from this */
if(ui_is_but_unit(but))
but->a1= ui_get_but_step_unit(but, ui_get_but_val(but), but->a1);
but->a1= ui_get_but_step_unit(but, but->a1);
if(freestr)
MEM_freeN(str);

@ -1155,7 +1155,7 @@ static int ui_textedit_delete_selection(uiBut *but, uiHandleButtonData *data)
int len= strlen(str);
int change= 0;
if(but->selsta != but->selend && len) {
memmove( str+but->selsta, str+but->selend, len+1 );
memmove( str+but->selsta, str+but->selend, len-but->selsta+1 );
change= 1;
}
@ -5192,7 +5192,8 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut *
button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT);
}
else {
if(event->type != MOUSEMOVE) {
if (ISKEYBOARD(event->type)) {
/* keyboard menu hierarchy navigation, going back to previous level */
but->active->used_mouse= 0;
button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT);
}

@ -1521,17 +1521,4 @@ void init_userdef_do_versions(void)
/* this timer uses U */
// XXX reset_autosave();
/* GSOC Sculpt 2010 - Sanity check on Sculpt/Paint settings */
if (U.sculpt_paint_unified_alpha == 0)
U.sculpt_paint_unified_alpha = 0.5f;
if (U.sculpt_paint_unified_unprojected_radius == 0)
U.sculpt_paint_unified_unprojected_radius = 0.125f;
if (U.sculpt_paint_unified_size == 0)
U.sculpt_paint_unified_size = 35;
if (G.main->versionfile < 252 || (G.main->versionfile == 252 && G.main->subversionfile < 5))
U.sculpt_paint_settings |= SCULPT_PAINT_USE_UNIFIED_SIZE;
}

@ -1652,7 +1652,7 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_int(ot->srna, "subdivisions", 2, 0, 6, "Subdivisions", "", 0, 8);
RNA_def_int(ot->srna, "subdivisions", 2, 0, INT_MAX, "Subdivisions", "", 0, 8);
RNA_def_float(ot->srna, "size", 1.0f, 0.0f, FLT_MAX, "Size", "", 0.001f, 100.00);
ED_object_add_generic_props(ot, TRUE);

@ -3420,7 +3420,7 @@ static int select_all_exec(bContext *C, wmOperator *op)
void MESH_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Select/Deselect All";
ot->name= "Select or Deselect All";
ot->description= "Change selection of all vertices, edges or faces";
ot->idname= "MESH_OT_select_all";

@ -3095,21 +3095,21 @@ static void givequadverts(EditFace *efa, EditFace *efa1, EditVert **v1, EditVert
if VTEST(efa1, 1, efa) {
*v3= efa1->v1;
*v4= efa1->v2;
*v4= (efa1->v2 == *v2)? efa1->v3: efa1->v2;
vindex[2]= 0;
vindex[3]= 1;
vindex[3]= (efa1->v2 == *v2)? 2: 1;
}
else if VTEST(efa1, 2, efa) {
*v3= efa1->v2;
*v4= efa1->v3;
*v4= (efa1->v3 == *v2)? efa1->v1: efa1->v3;
vindex[2]= 1;
vindex[3]= 2;
vindex[3]= (efa1->v3 == *v2)? 0: 2;
}
else if VTEST(efa1, 3, efa) {
*v3= efa1->v3;
*v4= efa1->v1;
*v4= (efa1->v1 == *v2)? efa1->v2: efa1->v1;
vindex[2]= 2;
vindex[3]= 0;
vindex[3]= (efa1->v1 == *v2)? 1: 0;
}
else
*v3= *v4= NULL;

@ -204,7 +204,7 @@ static int select_all_exec(bContext *C, wmOperator *op)
void MBALL_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Select/Deselect All";
ot->name= "Select or Deselect All";
ot->description= "Change selection of all meta elements";
ot->idname= "MBALL_OT_select_all";

@ -435,7 +435,12 @@ void ED_object_enter_editmode(bContext *C, int flag)
if(flag & EM_WAITCURSOR) waitcursor(1);
ob->restore_mode = ob->mode;
/* note, when switching scenes the object can have editmode data but
* not be scene->obedit: bug 22954, this avoids calling self eternally */
if((ob->restore_mode & OB_MODE_EDIT)==0)
ED_object_toggle_modes(C, ob->mode);
ob->mode= OB_MODE_EDIT;
if(ob->type==OB_MESH) {

@ -760,7 +760,7 @@ void OBJECT_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "deselect all";
ot->name= "Select or Deselect All";
ot->description = "Change selection of all visible objects in scene";
ot->idname= "OBJECT_OT_select_all";

@ -205,7 +205,7 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op)
eulO_to_axis_angle( ob->rotAxis, &ob->rotAngle,eul, EULER_ORDER_DEFAULT);
}
else {
VECCOPY(ob->rot, eul);
copy_v3_v3(ob->rot, eul);
}
}
} // Duplicated in source/blender/editors/armature/editarmature.c
@ -340,10 +340,7 @@ static int object_origin_clear_exec(bContext *C, wmOperator *op)
v3= ob->parentinv[3];
copy_m3_m4(mat, ob->parentinv);
VECCOPY(v3, v1);
v3[0]= -v3[0];
v3[1]= -v3[1];
v3[2]= -v3[2];
negate_v3_v3(v3, v1);
mul_m3_v3(mat, v3);
}
ob->recalc |= OB_RECALC_OB;
@ -712,6 +709,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
ScrArea *sa= CTX_wm_area(C);
View3D *v3d= sa->spacedata.first;
Object *obedit= CTX_data_edit_object(C);
Object *tob;
Mesh *me, *tme;
Curve *cu;
/* BezTriple *bezt;
@ -780,8 +778,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
for (me= G.main->mesh.first; me; me= me->id.next) {
me->flag &= ~ME_ISDONE;
for (tob= G.main->object.first; tob; tob= tob->id.next) {
if(tob->data)
((ID *)tob->data)->flag &= ~LIB_DOIT;
}
CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
@ -824,12 +823,13 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
}
me->flag |= ME_ISDONE;
tot_change++;
me->id.flag |= LIB_DOIT;
if(centermode) {
copy_m3_m4(omat, ob->obmat);
VECCOPY(centn, cent);
copy_v3_v3(centn, cent);
mul_m3_v3(omat, centn);
ob->loc[0]+= centn[0];
ob->loc[1]+= centn[1];
@ -849,7 +849,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
ob_other->recalc= OB_RECALC_OB|OB_RECALC_DATA;
copy_m3_m4(omat, ob_other->obmat);
VECCOPY(centn, cent);
copy_v3_v3(centn, cent);
mul_m3_v3(omat, centn);
ob_other->loc[0]+= centn[0];
ob_other->loc[1]+= centn[1];
@ -858,7 +858,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
where_is_object(scene, ob_other);
ignore_parent_tx(bmain, scene, ob_other);
if(tme && (tme->flag & ME_ISDONE)==0) {
if(!(tme->id.flag & LIB_DOIT)) {
mvert= tme->mvert;
for(a=0; a<tme->totvert; a++, mvert++) {
sub_v3_v3(mvert->co, cent);
@ -875,14 +875,14 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
}
tme->flag |= ME_ISDONE;
tot_change++;
tme->id.flag |= LIB_DOIT;
}
}
}
}
CTX_DATA_END;
}
tot_change++;
}
}
else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
@ -903,7 +903,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
tot_lib_error++;
} else {
if(centermode==2) {
VECCOPY(cent, give_cursor(scene, v3d));
copy_v3_v3(cent, give_cursor(scene, v3d));
invert_m4_m4(ob->imat, ob->obmat);
mul_m4_v3(ob->imat, cent);
@ -956,6 +956,8 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
tot_change++;
cu->id.flag |= LIB_DOIT;
if(obedit) {
if (centermode==0) {
DAG_id_flush_update(&obedit->id, OB_RECALC_DATA);
@ -982,6 +984,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
cu->yof /= cu->fsize;
tot_change++;
cu->id.flag |= LIB_DOIT;
}
}
else if(ob->type==OB_ARMATURE) {
@ -998,7 +1001,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
* Bone + object locations are handled there.
*/
docenter_armature(scene, v3d, ob, centermode);
tot_change++;
cu->id.flag |= LIB_DOIT;
where_is_object(scene, ob);
ignore_parent_tx(bmain, scene, ob);
@ -1007,11 +1012,16 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
break;
}
}
ob->recalc= OB_RECALC_OB|OB_RECALC_DATA;
}
}
CTX_DATA_END;
for (tob= G.main->object.first; tob; tob= tob->id.next) {
if(tob->data && (((ID *)tob->data)->flag & LIB_DOIT)) {
tob->recalc= OB_RECALC_OB|OB_RECALC_DATA;
}
}
if (tot_change) {
DAG_ids_flush_update(0);
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);

@ -2098,6 +2098,7 @@ static void remove_tagged_keys(Scene *scene, Object *ob, ParticleSystem *psys)
ParticleData *pa;
HairKey *hkey, *nhkey, *new_hkeys=0;
POINT_P; KEY_K;
PTCacheEditKey *nkey, *new_keys;
ParticleSystemModifierData *psmd;
short new_totkey;
@ -2133,9 +2134,10 @@ static void remove_tagged_keys(Scene *scene, Object *ob, ParticleSystem *psys)
}
if(new_totkey != pa->totkey) {
hkey= pa->hair;
nhkey= new_hkeys= MEM_callocN(new_totkey*sizeof(HairKey), "HairKeys");
nkey= new_keys= MEM_callocN(new_totkey*sizeof(PTCacheEditKey), "particle edit keys");
hkey= pa->hair;
LOOP_KEYS {
while(key->flag & PEK_TAG && hkey < pa->hair + pa->totkey) {
key++;
@ -2144,29 +2146,36 @@ static void remove_tagged_keys(Scene *scene, Object *ob, ParticleSystem *psys)
if(hkey < pa->hair + pa->totkey) {
VECCOPY(nhkey->co, hkey->co);
nhkey->editflag = hkey->editflag;
nhkey->time= hkey->time;
nhkey->weight= hkey->weight;
nkey->co= nhkey->co;
nkey->time= &nhkey->time;
/* these can be copied from old edit keys */
nkey->flag = key->flag;
nkey->ftime = key->ftime;
nkey->length = key->length;
VECCOPY(nkey->world_co, key->world_co);
}
hkey++;
nkey++;
nhkey++;
hkey++;
}
if(pa->hair)
MEM_freeN(pa->hair);
if(point->keys)
MEM_freeN(point->keys);
pa->hair= new_hkeys;
point->keys= new_keys;
point->totkey= pa->totkey= new_totkey;
if(point->keys)
MEM_freeN(point->keys);
key= point->keys= MEM_callocN(new_totkey*sizeof(PTCacheEditKey), "particle edit keys");
hkey = pa->hair;
LOOP_KEYS {
key->co= hkey->co;
key->time= &hkey->time;
hkey++;
}
/* flag for recalculating length */
point->flag |= PEP_EDIT_RECALC;
}
}
}

@ -310,11 +310,11 @@ static int material_slot_assign_exec(bContext *C, wmOperator *op)
}
}
else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
ListBase *editnurb= ((Curve*)ob->data)->editnurb;
Nurb *nu;
ListBase *nurbs= ED_curve_editnurbs((Curve*)ob->data);
if(editnurb) {
for(nu= editnurb->first; nu; nu= nu->next)
if(nurbs) {
for(nu= nurbs->first; nu; nu= nu->next)
if(isNurbsel(nu))
nu->mat_nr= nu->charidx= ob->actcol-1;
}
@ -368,13 +368,13 @@ static int material_slot_de_select(bContext *C, int select)
}
}
else if ELEM(ob->type, OB_CURVE, OB_SURF) {
ListBase *editnurb= ((Curve*)ob->data)->editnurb;
ListBase *nurbs= ED_curve_editnurbs((Curve*)ob->data);
Nurb *nu;
BPoint *bp;
BezTriple *bezt;
int a;
for(nu= editnurb->first; nu; nu=nu->next) {
for(nu= nurbs->first; nu; nu=nu->next) {
if(nu->mat_nr==ob->actcol-1) {
if(nu->bezt) {
a= nu->pntsu;

@ -117,12 +117,6 @@ void ED_region_do_listen(ARegion *ar, wmNotifier *note)
case NC_WINDOW:
ED_region_tag_redraw(ar);
break;
#ifndef WM_FAST_DRAW
case NC_SCREEN:
if(note->action==NA_EDITED)
ED_region_tag_redraw(ar);
break;
#endif
}
if(ar->type && ar->type->listener)
@ -1427,7 +1421,7 @@ void ED_region_header(const bContext *C, ARegion *ar)
/* draw all headers types */
for(ht= ar->type->headertypes.first; ht; ht= ht->next) {
block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS);
block= uiBeginBlock(C, ar, ht->idname, UI_EMBOSS);
layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, HEADERY-6, 1, style);
if(ht->draw) {

@ -58,9 +58,6 @@ void ed_screen_context(const bContext *C, const char *member, bContextDataResult
void SCREEN_OT_screenshot(struct wmOperatorType *ot);
void SCREEN_OT_screencast(struct wmOperatorType *ot);
/* partial updates, much faster then drawing everything, ton is away so allow easy undo'ing - campbell */
#define WM_FAST_DRAW
#endif /* ED_SCREEN_INTERN_H */

@ -615,10 +615,8 @@ static int area_swap_modal(bContext *C, wmOperator *op, wmEvent *event)
return area_swap_cancel(C, op);
}
#ifdef WM_FAST_DRAW
ED_area_tag_redraw(sad->sa1);
ED_area_tag_redraw(sad->sa2);
#endif
ED_area_swapspace(C, sad->sa1, sad->sa2);
@ -692,9 +690,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* copy area to new screen */
area_copy_data((ScrArea *)newsc->areabase.first, sa, 0);
#ifdef WM_FAST_DRAW
ED_area_tag_redraw((ScrArea *)newsc->areabase.first);
#endif
/* screen, areas init */
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
@ -820,6 +816,7 @@ static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int
wmWindow *win= CTX_wm_window(C);
bScreen *sc= CTX_wm_screen(C);
ScrVert *v1;
ScrArea *sa;
delta= CLAMPIS(delta, -smaller, bigger);
@ -842,15 +839,12 @@ static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int
}
}
}
#ifdef WM_FAST_DRAW
{
ScrArea *sa;
for(sa= sc->areabase.first; sa; sa= sa->next)
for(sa= sc->areabase.first; sa; sa= sa->next) {
if(sa->v1->flag || sa->v2->flag || sa->v3->flag || sa->v4->flag)
ED_area_tag_redraw(sa);
}
#endif
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL); /* redraw everything */
}
@ -1113,10 +1107,9 @@ static int area_split_apply(bContext *C, wmOperator *op)
if(dir=='h') sd->origval= sd->nedge->v1->vec.y;
else sd->origval= sd->nedge->v1->vec.x;
#ifdef WM_FAST_DRAW
ED_area_tag_redraw(sd->sarea);
ED_area_tag_redraw(sd->narea);
#endif
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
return 1;
@ -1128,11 +1121,9 @@ static int area_split_apply(bContext *C, wmOperator *op)
static void area_split_exit(bContext *C, wmOperator *op)
{
if (op->customdata) {
#ifdef WM_FAST_DRAW
sAreaSplitData *sd= (sAreaSplitData *)op->customdata;
if(sd->sarea) ED_area_tag_redraw(sd->sarea);
if(sd->narea) ED_area_tag_redraw(sd->narea);
#endif
MEM_freeN(op->customdata);
op->customdata = NULL;
@ -1444,9 +1435,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
else if(rmd->ar->flag & RGN_FLAG_HIDDEN)
ED_region_toggle_hidden(C, rmd->ar);
}
#ifdef WM_FAST_DRAW
ED_area_tag_redraw(rmd->sa);
#endif
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
break;
@ -1457,9 +1446,7 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
if(ABS(event->x - rmd->origx) < 2 && ABS(event->y - rmd->origy) < 2) {
if(rmd->ar->flag & RGN_FLAG_HIDDEN) {
ED_region_toggle_hidden(C, rmd->ar);
#ifdef WM_FAST_DRAW
ED_area_tag_redraw(rmd->sa);
#endif
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
}
}
@ -1962,10 +1949,9 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
break;
case LEFTMOUSE:
if(event->val==KM_RELEASE) {
#ifdef WM_FAST_DRAW
ED_area_tag_redraw(jd->sa1);
ED_area_tag_redraw(jd->sa2);
#endif
area_join_apply(C, op);
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
area_join_exit(C, op);
@ -2148,9 +2134,7 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
MEM_freeN(ar);
}
}
#ifdef WM_FAST_DRAW
ED_area_tag_redraw(sa);
#endif
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
}
else if(ar->next)
@ -2190,10 +2174,7 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
rv3d->view= RV3D_VIEW_CAMERA; rv3d->persp= RV3D_CAMOB;
if (rv3d->localvd) {rv3d->localvd->view = rv3d->view; rv3d->localvd->persp = rv3d->persp; }
}
#ifdef WM_FAST_DRAW
ED_area_tag_redraw(sa);
#endif
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
}
@ -2236,9 +2217,7 @@ static int region_flip_exec(bContext *C, wmOperator *op)
else if(ar->alignment==RGN_ALIGN_RIGHT)
ar->alignment= RGN_ALIGN_LEFT;
#ifdef WM_FAST_DRAW
ED_area_tag_redraw(CTX_wm_area(C));
#endif
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
return OPERATOR_FINISHED;
@ -2291,9 +2270,7 @@ static int header_flip_exec(bContext *C, wmOperator *op)
else if(ar->alignment==RGN_ALIGN_RIGHT)
ar->alignment= RGN_ALIGN_LEFT;
#ifdef WM_FAST_DRAW
ED_area_tag_redraw(CTX_wm_area(C));
#endif
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);

@ -1334,7 +1334,7 @@ float project_paint_uvpixel_mask(
// This only works when the opacity dosnt change while painting, stylus pressure messes with this
// so dont use it.
// if (ps->is_airbrush==0) mask *= ps->brush->alpha;
// if (ps->is_airbrush==0) mask *= brush_alpha(ps->brush);
return mask;
}
@ -2810,6 +2810,8 @@ static void project_paint_begin(ProjPaintState *ps)
MemArena *arena; /* at the moment this is just ps->arena_mt[0], but use this to show were not multithreading */
const int diameter= 2*brush_size(ps->brush);
/* ---- end defines ---- */
if(ps->source==PROJ_SRC_VIEW)
@ -3030,11 +3032,11 @@ static void project_paint_begin(ProjPaintState *ps)
if(ps->source==PROJ_SRC_VIEW) {
#ifdef PROJ_DEBUG_WINCLIP
CLAMP(ps->screenMin[0], (float)(-ps->brush->size), (float)(ps->winx + ps->brush->size));
CLAMP(ps->screenMax[0], (float)(-ps->brush->size), (float)(ps->winx + ps->brush->size));
CLAMP(ps->screenMin[0], (float)(-diameter), (float)(ps->winx + diameter));
CLAMP(ps->screenMax[0], (float)(-diameter), (float)(ps->winx + diameter));
CLAMP(ps->screenMin[1], (float)(-ps->brush->size), (float)(ps->winy + ps->brush->size));
CLAMP(ps->screenMax[1], (float)(-ps->brush->size), (float)(ps->winy + ps->brush->size));
CLAMP(ps->screenMin[1], (float)(-diameter), (float)(ps->winy + diameter));
CLAMP(ps->screenMax[1], (float)(-diameter), (float)(ps->winy + diameter));
#endif
}
else { /* reprojection, use bounds */
@ -3049,8 +3051,8 @@ static void project_paint_begin(ProjPaintState *ps)
ps->screen_width = ps->screenMax[0] - ps->screenMin[0];
ps->screen_height = ps->screenMax[1] - ps->screenMin[1];
ps->buckets_x = (int)(ps->screen_width / (((float)ps->brush->size) / PROJ_BUCKET_BRUSH_DIV));
ps->buckets_y = (int)(ps->screen_height / (((float)ps->brush->size) / PROJ_BUCKET_BRUSH_DIV));
ps->buckets_x = (int)(ps->screen_width / (((float)diameter) / PROJ_BUCKET_BRUSH_DIV));
ps->buckets_y = (int)(ps->screen_height / (((float)diameter) / PROJ_BUCKET_BRUSH_DIV));
/* printf("\tscreenspace bucket division x:%d y:%d\n", ps->buckets_x, ps->buckets_y); */
@ -3448,16 +3450,16 @@ static int project_bucket_iter_init(ProjPaintState *ps, const float mval_f[2])
{
if(ps->source==PROJ_SRC_VIEW) {
float min_brush[2], max_brush[2];
float size_half = ((float)ps->brush->size) * 0.5f;
const float radius = (float)brush_size(ps->brush);
/* so we dont have a bucket bounds that is way too small to paint into */
// if (size_half < 1.0f) size_half = 1.0f; // this dosnt work yet :/
// if (radius < 1.0f) radius = 1.0f; // this doesn't work yet :/
min_brush[0] = mval_f[0] - size_half;
min_brush[1] = mval_f[1] - size_half;
min_brush[0] = mval_f[0] - radius;
min_brush[1] = mval_f[1] - radius;
max_brush[0] = mval_f[0] + size_half;
max_brush[1] = mval_f[1] + size_half;
max_brush[0] = mval_f[0] + radius;
max_brush[1] = mval_f[1] + radius;
/* offset to make this a valid bucket index */
project_paint_bucket_bounds(ps, min_brush, max_brush, ps->bucketMin, ps->bucketMax);
@ -3486,6 +3488,8 @@ static int project_bucket_iter_init(ProjPaintState *ps, const float mval_f[2])
static int project_bucket_iter_next(ProjPaintState *ps, int *bucket_index, rctf *bucket_bounds, const float mval[2])
{
const int diameter= 2*brush_size(ps->brush);
if (ps->thread_tot > 1)
BLI_lock_thread(LOCK_CUSTOM1);
@ -3498,7 +3502,7 @@ static int project_bucket_iter_next(ProjPaintState *ps, int *bucket_index, rctf
project_bucket_bounds(ps, ps->context_bucket_x, ps->context_bucket_y, bucket_bounds);
if ( (ps->source != PROJ_SRC_VIEW) ||
project_bucket_isect_circle(ps->context_bucket_x, ps->context_bucket_y, mval, (float)(ps->brush->size * ps->brush->size), bucket_bounds)
project_bucket_isect_circle(ps->context_bucket_x, ps->context_bucket_y, mval, (float)(diameter*diameter), bucket_bounds)
) {
*bucket_index = ps->context_bucket_x + (ps->context_bucket_y * ps->buckets_x);
ps->context_bucket_x++;
@ -3685,7 +3689,6 @@ static void *do_projectpaint_thread(void *ph_v)
float rgba[4], alpha, dist_nosqrt, dist;
float brush_size_sqared;
float falloff;
int bucket_index;
int is_floatbuf = 0;
@ -3697,14 +3700,15 @@ static void *do_projectpaint_thread(void *ph_v)
float co[2];
float mask = 1.0f; /* airbrush wont use mask */
unsigned short mask_short;
float size_half = ((float)ps->brush->size) * 0.5f;
const float radius= (float)brush_size(ps->brush);
const float radius_squared= radius*radius; /* avoid a square root with every dist comparison */
short lock_alpha= ELEM(ps->brush->blend, IMB_BLEND_ERASE_ALPHA, IMB_BLEND_ADD_ALPHA) ? 0 : ps->brush->flag & BRUSH_LOCK_ALPHA;
LinkNode *smearPixels = NULL;
LinkNode *smearPixels_f = NULL;
MemArena *smearArena = NULL; /* mem arena for this brush projection only */
if (tool==PAINT_TOOL_SMEAR) {
pos_ofs[0] = pos[0] - lastpos[0];
pos_ofs[1] = pos[1] - lastpos[1];
@ -3712,9 +3716,6 @@ static void *do_projectpaint_thread(void *ph_v)
smearArena = BLI_memarena_new(1<<16, "paint smear arena");
}
/* avoid a square root with every dist comparison */
brush_size_sqared = (float)(ps->brush->size * ps->brush->size);
/* printf("brush bounds %d %d %d %d\n", bucketMin[0], bucketMin[1], bucketMax[0], bucketMax[1]); */
while (project_bucket_iter_next(ps, &bucket_index, &bucket_bounds, pos)) {
@ -3735,7 +3736,7 @@ static void *do_projectpaint_thread(void *ph_v)
bicubic_interpolation_color(ps->reproject_ibuf, projPixel->newColor.ch, NULL, projPixel->projCoSS[0], projPixel->projCoSS[1]);
if(projPixel->newColor.ch[3]) {
mask = ((float)projPixel->mask)/65535.0f;
blend_color_mix_accum(projPixel->pixel.ch_pt, projPixel->origColor.ch, projPixel->newColor.ch, (mask*projPixel->newColor.ch[3]));
blend_color_mix_accum(projPixel->pixel.ch_pt, projPixel->origColor.ch, projPixel->newColor.ch, (int)(mask*projPixel->newColor.ch[3]));
}
}
@ -3750,9 +3751,11 @@ static void *do_projectpaint_thread(void *ph_v)
/*dist = len_v2v2(projPixel->projCoSS, pos);*/ /* correct but uses a sqrtf */
dist_nosqrt = Vec2Lenf_nosqrt(projPixel->projCoSS, pos);
/*if (dist < s->brush->size) {*/ /* correct but uses a sqrtf */
if (dist_nosqrt < brush_size_sqared && (dist=sqrtf(dist_nosqrt)) < size_half) {
falloff = brush_curve_strength_clamp(ps->brush, dist, size_half);
/*if (dist < radius) {*/ /* correct but uses a sqrtf */
if (dist_nosqrt <= radius_squared) {
dist=sqrtf(dist_nosqrt);
falloff = brush_curve_strength_clamp(ps->brush, dist, radius);
if (falloff > 0.0f) {
if (ps->is_texbrush) {
@ -3764,7 +3767,7 @@ static void *do_projectpaint_thread(void *ph_v)
if (ps->is_airbrush) {
/* for an aurbrush there is no real mask, so just multiply the alpha by it */
alpha *= falloff * ps->brush->alpha;
alpha *= falloff * brush_alpha(ps->brush);
mask = ((float)projPixel->mask)/65535.0f;
}
else {
@ -3772,7 +3775,7 @@ static void *do_projectpaint_thread(void *ph_v)
falloff = 1.0f - falloff;
falloff = 1.0f - (falloff * falloff);
mask_short = (unsigned short)(projPixel->mask * (ps->brush->alpha * falloff));
mask_short = (unsigned short)(projPixel->mask * (brush_alpha(ps->brush) * falloff));
if (mask_short > projPixel->mask_max) {
mask = ((float)mask_short)/65535.0f;
projPixel->mask_max = mask_short;
@ -4520,7 +4523,7 @@ typedef struct PaintOperation {
int first;
int prevmouse[2];
float prev_pressure; /* need this since we dont get tablet events for pressure change */
int brush_size_orig;
int orig_brush_size;
double starttime;
ViewContext vc;
@ -4653,7 +4656,7 @@ static int texture_paint_init(bContext *C, wmOperator *op)
if(pop->mode == PAINT_MODE_3D && (pop->s.tool == PAINT_TOOL_CLONE))
pop->s.tool = PAINT_TOOL_DRAW;
pop->s.blend = brush->blend;
pop->brush_size_orig= brush->size;
pop->orig_brush_size= brush_size(brush);
if(pop->mode != PAINT_MODE_2D) {
pop->s.ob = OBACT;
@ -4685,8 +4688,8 @@ static int texture_paint_init(bContext *C, wmOperator *op)
return 0;
/* Dont allow brush size below 2 */
if (brush->size <= 1)
brush->size = 2;
if (brush_size(brush) < 2)
brush_set_size(brush, 2);
/* allocate and initialize spacial data structures */
project_paint_begin(&pop->ps);
@ -4696,7 +4699,7 @@ static int texture_paint_init(bContext *C, wmOperator *op)
}
settings->imapaint.flag |= IMAGEPAINT_DRAWING;
undo_paint_push_begin(UNDO_PAINT_IMAGE, "Image Paint",
undo_paint_push_begin(UNDO_PAINT_IMAGE, op->type->name,
image_undo_restore, image_undo_free);
/* create painter */
@ -4756,7 +4759,7 @@ static void paint_exit(bContext *C, wmOperator *op)
brush_painter_free(pop->painter);
if(pop->mode == PAINT_MODE_3D_PROJECT) {
pop->ps.brush->size = pop->brush_size_orig;
brush_set_size(pop->ps.brush, pop->orig_brush_size);
project_paint_end(&pop->ps);
}
@ -4827,8 +4830,15 @@ static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event)
/* special exception here for too high pressure values on first touch in
windows for some tablets, then we just skip first touch .. */
if ((pop->s.brush->flag & (BRUSH_ALPHA_PRESSURE|BRUSH_SIZE_PRESSURE|BRUSH_SPACING_PRESSURE)) && tablet && (pressure >= 0.99f))
if (tablet && (pressure >= 0.99f) && (pop->s.brush->flag & BRUSH_SPACING_PRESSURE) && brush_use_alpha_pressure(pop->s.brush) && brush_use_size_pressure(pop->s.brush))
return;
/* This can be removed once fixed properly in
brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, double time, float pressure, void *user)
at zero pressure we should do nothing 1/2^12 is .0002 which is the sensitivity of the most sensitive pen tablet available*/
if ((pop->s.brush->flag & (BRUSH_ALPHA_PRESSURE|BRUSH_SIZE_PRESSURE|BRUSH_SPACING_PRESSURE)) && tablet && (pressure <= 0.0002f))
return;
}
/* fill in stroke */
@ -4939,9 +4949,14 @@ static int get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy)
static void brush_drawcursor(bContext *C, int x, int y, void *customdata)
{
Brush *brush= image_paint_brush(C);
Paint *paint= paint_get_active(CTX_data_scene(C));
if(brush) {
if(paint && brush) {
float zoomx, zoomy;
if(!(paint->flags & PAINT_SHOW_BRUSH))
return;
glPushMatrix();
glTranslatef((float)x, (float)y, 0.0f);
@ -4949,10 +4964,10 @@ static void brush_drawcursor(bContext *C, int x, int y, void *customdata)
if(get_imapaint_zoom(C, &zoomx, &zoomy))
glScalef(zoomx, zoomy, 1.0f);
glColor4ub(255, 255, 255, 128);
glColor4f(brush->add_col[0], brush->add_col[1], brush->add_col[2], 0.5f);
glEnable( GL_LINE_SMOOTH );
glEnable(GL_BLEND);
glutil_draw_lined_arc(0, (float)(M_PI*2.0), brush->size*0.5f, 40);
glutil_draw_lined_arc(0, (float)(M_PI*2.0), (float)brush_size(brush), 40);
glDisable(GL_BLEND);
glDisable( GL_LINE_SMOOTH );
@ -4979,7 +4994,7 @@ static int paint_radial_control_invoke(bContext *C, wmOperator *op, wmEvent *eve
ToolSettings *ts = CTX_data_scene(C)->toolsettings;
get_imapaint_zoom(C, &zoom, &zoom);
toggle_paint_cursor(C, !ts->imapaint.paintcursor);
brush_radial_control_invoke(op, paint_brush(&ts->imapaint.paint), 0.5f * zoom);
brush_radial_control_invoke(op, paint_brush(&ts->imapaint.paint), zoom);
return WM_radial_control_invoke(C, op, event);
}
@ -4999,7 +5014,7 @@ static int paint_radial_control_exec(bContext *C, wmOperator *op)
int ret;
char str[256];
get_imapaint_zoom(C, &zoom, &zoom);
ret = brush_radial_control_exec(op, brush, 2.0f / zoom);
ret = brush_radial_control_exec(op, brush, 1.0f / zoom);
WM_radial_control_string(op, str, 256);
WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush);
@ -5306,14 +5321,14 @@ static int texture_paint_radial_control_invoke(bContext *C, wmOperator *op, wmEv
{
ToolSettings *ts = CTX_data_scene(C)->toolsettings;
toggle_paint_cursor(C, !ts->imapaint.paintcursor);
brush_radial_control_invoke(op, paint_brush(&ts->imapaint.paint), 0.5);
brush_radial_control_invoke(op, paint_brush(&ts->imapaint.paint), 1);
return WM_radial_control_invoke(C, op, event);
}
static int texture_paint_radial_control_exec(bContext *C, wmOperator *op)
{
Brush *brush = paint_brush(&CTX_data_scene(C)->toolsettings->imapaint.paint);
int ret = brush_radial_control_exec(op, brush, 2);
int ret = brush_radial_control_exec(op, brush, 1);
char str[256];
WM_radial_control_string(op, str, 256);
@ -5349,7 +5364,7 @@ void PAINT_OT_texture_paint_radial_control(wmOperatorType *ot)
ot->poll= texture_paint_poll;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
}
@ -5418,21 +5433,21 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
/* override */
ps.is_texbrush= 0;
ps.is_airbrush= 1;
orig_brush_size= ps.brush->size;
ps.brush->size= 32; /* cover the whole image */
orig_brush_size= brush_size(ps.brush);
brush_set_size(ps.brush, 32); /* cover the whole image */
ps.tool= PAINT_TOOL_DRAW; /* so pixels are initialized with minimal info */
scene->toolsettings->imapaint.flag |= IMAGEPAINT_DRAWING;
undo_paint_push_begin(UNDO_PAINT_IMAGE, "Image Paint",
undo_paint_push_begin(UNDO_PAINT_IMAGE, op->type->name,
image_undo_restore, image_undo_free);
/* allocate and initialize spacial data structures */
project_paint_begin(&ps);
if(ps.dm==NULL) {
ps.brush->size= orig_brush_size;
brush_set_size(ps.brush, orig_brush_size);
return OPERATOR_CANCELLED;
}
else {
@ -5456,7 +5471,7 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
project_paint_end(&ps);
scene->toolsettings->imapaint.flag &= ~IMAGEPAINT_DRAWING;
ps.brush->size= orig_brush_size;
brush_set_size(ps.brush, orig_brush_size);
return OPERATOR_FINISHED;
}

@ -121,7 +121,7 @@ typedef enum wmBrushStrokeMode {
typedef void (*UndoRestoreCb)(struct bContext *C, struct ListBase *lb);
typedef void (*UndoFreeCb)(struct ListBase *lb);
void undo_paint_push_begin(int type, char *name, UndoRestoreCb restore, UndoFreeCb free);
void undo_paint_push_begin(int type, const char *name, UndoRestoreCb restore, UndoFreeCb free);
struct ListBase *undo_paint_push_get_list(int type);
void undo_paint_push_count_alloc(int type, int size);
void undo_paint_push_end(int type);

@ -69,23 +69,44 @@ void BRUSH_OT_add(wmOperatorType *ot)
ot->exec= brush_add_exec;
/* flags */
ot->flag= OPTYPE_UNDO;
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
static int brush_scale_size_exec(bContext *C, wmOperator *op)
{
/*int type = RNA_enum_get(op->ptr, "type");*/
Paint *paint= paint_get_active(CTX_data_scene(C));
Brush *br = paint_brush(paint);
float factor = RNA_float_get(op->ptr, "scalar");
Brush *brush= paint_brush(paint);
// Object *ob= CTX_data_active_object(C);
float scalar= RNA_float_get(op->ptr, "scalar");
if (br) {
if (U.sculpt_paint_settings & SCULPT_PAINT_USE_UNIFIED_SIZE) {
U.sculpt_paint_unified_size *= factor;
if (brush) {
// pixel radius
{
const int old_size= brush_size(brush);
int size= (int)(scalar*old_size);
if (old_size == size) {
if (scalar > 1) {
size++;
}
else {
br->size *= factor;
else if (scalar < 1) {
size--;
}
}
CLAMP(size, 1, 2000); // XXX magic number
brush_set_size(brush, size);
}
// unprojected radius
{
float unprojected_radius= scalar*brush_unprojected_radius(brush);
if (unprojected_radius < 0.001) // XXX magic number
unprojected_radius= 0.001f;
brush_set_unprojected_radius(brush, unprojected_radius);
}
}
@ -103,7 +124,7 @@ void BRUSH_OT_scale_size(wmOperatorType *ot)
ot->exec= brush_scale_size_exec;
/* flags */
ot->flag= OPTYPE_UNDO;
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_float(ot->srna, "scalar", 1, 0, 2, "Scalar", "Factor to scale brush size by", 0, 2);
}

@ -227,7 +227,7 @@ static int same_snap(Snapshot* snap, Brush* brush, ViewContext* vc)
mtex->size[1] == snap->size[1] &&
mtex->size[2] == snap->size[2] &&
mtex->rot == snap->rot) &&
((mtex->brush_map_mode == MTEX_MAP_MODE_FIXED && sculpt_get_brush_size(brush) <= snap->brush_size) || (sculpt_get_brush_size(brush) == snap->brush_size)) && // make brush smaller shouldn't cause a resample
((mtex->brush_map_mode == MTEX_MAP_MODE_FIXED && brush_size(brush) <= snap->brush_size) || (brush_size(brush) == snap->brush_size)) && // make brush smaller shouldn't cause a resample
mtex->brush_map_mode == snap->brush_map_mode &&
vc->ar->winx == snap->winx &&
vc->ar->winy == snap->winy;
@ -248,7 +248,7 @@ static void make_snap(Snapshot* snap, Brush* brush, ViewContext* vc)
snap->rot = -1;
}
snap->brush_size = sculpt_get_brush_size(brush);
snap->brush_size = brush_size(brush);
snap->winx = vc->ar->winx;
snap->winy = vc->ar->winy;
}
@ -289,7 +289,7 @@ int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
make_snap(&snap, br, vc);
if (br->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) {
int s = sculpt_get_brush_size(br);
int s = brush_size(br);
int r = 1;
for (s >>= 1; s > 0; s >>= 1)
@ -330,7 +330,7 @@ int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
// largely duplicated from tex_strength
const float rotation = -br->mtex.rot;
float diameter = sculpt_get_brush_size(br);
float radius = brush_size(br);
int index = j*size + i;
float x;
float avg;
@ -342,8 +342,8 @@ int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
y -= 0.5f;
if (br->mtex.brush_map_mode == MTEX_MAP_MODE_TILED) {
x *= vc->ar->winx / diameter;
y *= vc->ar->winy / diameter;
x *= vc->ar->winx / radius;
y *= vc->ar->winy / radius;
}
else {
x *= 2;
@ -488,10 +488,10 @@ int sculpt_get_brush_geometry(bContext* C, int x, int y, int* pixel_radius, floa
memcpy(viewport, stroke->mats.viewport, sizeof(int[4]));
if (stroke->vc.obact->sculpt && stroke->vc.obact->sculpt->pbvh && sculpt_stroke_get_location(C, stroke, location, window)) {
*pixel_radius = project_brush_radius(stroke->vc.rv3d, sculpt_get_brush_unprojected_radius(stroke->brush), location, &stroke->mats);
*pixel_radius = project_brush_radius(stroke->vc.rv3d, brush_unprojected_radius(stroke->brush), location, &stroke->mats);
if (*pixel_radius == 0)
*pixel_radius = sculpt_get_brush_size(stroke->brush);
*pixel_radius = brush_size(stroke->brush);
mul_m4_v3(stroke->vc.obact->sculpt->ob->obmat, location);
@ -501,7 +501,7 @@ int sculpt_get_brush_geometry(bContext* C, int x, int y, int* pixel_radius, floa
Sculpt* sd = CTX_data_tool_settings(C)->sculpt;
Brush* brush = paint_brush(&sd->paint);
*pixel_radius = sculpt_get_brush_size(brush);
*pixel_radius = brush_size(brush);
hit = 0;
}
@ -556,7 +556,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *unused)
float* col;
float alpha;
float visual_strength = sculpt_get_brush_alpha(brush)*sculpt_get_brush_alpha(brush);
float visual_strength = brush_alpha(brush)*brush_alpha(brush);
const float min_alpha = 0.20f;
const float max_alpha = 0.80f;
@ -577,13 +577,13 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *unused)
}
}
if(!sculpt_get_lock_brush_size(brush) && !(paint->flags & PAINT_SHOW_BRUSH))
if(!brush_use_locked_size(brush) && !(paint->flags & PAINT_SHOW_BRUSH))
return;
hit = sculpt_get_brush_geometry(C, x, y, &pixel_radius, location, modelview, projection, viewport);
if (sculpt_get_lock_brush_size(brush))
sculpt_set_brush_size(brush, pixel_radius);
if (brush_use_locked_size(brush))
brush_set_size(brush, pixel_radius);
// XXX: no way currently to know state of pen flip or invert key modifier without starting a stroke
flip = 1;
@ -633,7 +633,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *unused)
glTranslatef(-0.5f, -0.5f, 0);
if (sd->draw_pressure && (brush->flag & BRUSH_SIZE_PRESSURE)) {
if (sd->draw_pressure && brush_use_size_pressure(brush)) {
glTranslatef(0.5f, 0.5f, 0);
glScalef(1.0f/sd->pressure_value, 1.0f/sd->pressure_value, 1);
glTranslatef(-0.5f, -0.5f, 0);
@ -662,17 +662,19 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *unused)
glVertex2f(sd->anchored_initial_mouse[0]-sd->anchored_size - vc.ar->winrct.xmin, sd->anchored_initial_mouse[1]+sd->anchored_size - vc.ar->winrct.ymin);
}
else {
const int radius= brush_size(brush);
glTexCoord2f(0, 0);
glVertex2f((float)x-sculpt_get_brush_size(brush), (float)y-sculpt_get_brush_size(brush));
glVertex2f((float)x-radius, (float)y-radius);
glTexCoord2f(1, 0);
glVertex2f((float)x+sculpt_get_brush_size(brush), (float)y-sculpt_get_brush_size(brush));
glVertex2f((float)x+radius, (float)y-radius);
glTexCoord2f(1, 1);
glVertex2f((float)x+sculpt_get_brush_size(brush), (float)y+sculpt_get_brush_size(brush));
glVertex2f((float)x+radius, (float)y+radius);
glTexCoord2f(0, 1);
glVertex2f((float)x-sculpt_get_brush_size(brush), (float)y+sculpt_get_brush_size(brush));
glVertex2f((float)x-radius, (float)y+radius);
}
}
else {
@ -702,7 +704,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *unused)
// XXX duplicated from brush_strength & paint_stroke_add_step, refactor later
//wmEvent* event = CTX_wm_window(C)->eventstate;
if (sd->draw_pressure && (brush->flag & BRUSH_ALPHA_PRESSURE))
if (sd->draw_pressure && brush_use_alpha_pressure(brush))
visual_strength *= sd->pressure_value;
// don't show effect of strength past the soft limit
@ -715,14 +717,14 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *unused)
if (brush->flag & BRUSH_ANCHORED)
unprojected_radius = unproject_brush_radius(CTX_data_active_object(C), &vc, location, 8);
else
unprojected_radius = unproject_brush_radius(CTX_data_active_object(C), &vc, location, sculpt_get_brush_size(brush));
unprojected_radius = unproject_brush_radius(CTX_data_active_object(C), &vc, location, brush_size(brush));
}
if (sd->draw_pressure && (brush->flag & BRUSH_SIZE_PRESSURE))
if (sd->draw_pressure && brush_use_size_pressure(brush))
unprojected_radius *= sd->pressure_value;
if (!sculpt_get_lock_brush_size(brush))
sculpt_set_brush_unprojected_radius(brush, unprojected_radius);
if (!brush_use_locked_size(brush))
brush_set_unprojected_radius(brush, unprojected_radius);
if(!(paint->flags & PAINT_SHOW_BRUSH))
return;
@ -754,7 +756,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *unused)
}
else {
glTranslatef((float)x, (float)y, 0.0f);
glutil_draw_lined_arc(0.0, M_PI*2.0, sculpt_get_brush_size(brush), 40);
glutil_draw_lined_arc(0.0, M_PI*2.0, brush_size(brush), 40);
glTranslatef(-(float)x, -(float)y, 0.0f);
}
@ -767,12 +769,12 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *unused)
if(!(paint->flags & PAINT_SHOW_BRUSH))
return;
glColor4ubv(paint_get_active(CTX_data_scene(C))->paint_cursor_col);
glColor4f(brush->add_col[0], brush->add_col[1], brush->add_col[2], 0.5f);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
glTranslatef((float)x, (float)y, 0.0f);
glutil_draw_lined_arc(0.0, M_PI*2.0, brush->size, 40); // XXX: for now use the brushes size instead of potentially using the unified size because the feature has been enabled for sculpt
glutil_draw_lined_arc(0.0, M_PI*2.0, brush_size(brush), 40); // XXX: for now use the brushes size instead of potentially using the unified size because the feature has been enabled for sculpt
glTranslatef((float)-x, (float)-y, 0.0f);
glDisable(GL_BLEND);
@ -909,10 +911,10 @@ static int paint_space_stroke(bContext *C, wmOperator *op, wmEvent *event, const
if(event->custom == EVT_DATA_TABLET) {
wmTabletData *wmtab= event->customdata;
if(wmtab->Active != EVT_TABLET_NONE)
pressure = stroke->brush->flag & BRUSH_SIZE_PRESSURE ? wmtab->Pressure : 1;
pressure = brush_use_size_pressure(stroke->brush) ? wmtab->Pressure : 1;
}
scale = (sculpt_get_brush_size(stroke->brush)*pressure*stroke->brush->spacing/50.0f) / length;
scale = (brush_size(stroke->brush)*pressure*stroke->brush->spacing/50.0f) / length;
mul_v2_fl(vec, scale);
steps = (int)(1.0f / scale);

@ -76,7 +76,7 @@ static void undo_elem_free(UndoStack *stack, UndoElem *uel)
}
}
static void undo_stack_push_begin(UndoStack *stack, char *name, UndoRestoreCb restore, UndoFreeCb free)
static void undo_stack_push_begin(UndoStack *stack, const char *name, UndoRestoreCb restore, UndoFreeCb free)
{
UndoElem *uel;
int nr;
@ -145,29 +145,37 @@ static void undo_stack_push_end(UndoStack *stack)
}
}
static void undo_stack_step(bContext *C, UndoStack *stack, int step)
static int undo_stack_step(bContext *C, UndoStack *stack, int step, const char *name)
{
UndoElem *undo;
if(step==1) {
if(stack->current==NULL);
else {
if(!name || strcmp(stack->current->name, name) == 0) {
if(G.f & G_DEBUG) printf("undo %s\n", stack->current->name);
undo_restore(C, stack, stack->current);
stack->current= stack->current->prev;
return 1;
}
}
}
else if(step==-1) {
if((stack->current!=NULL && stack->current->next==NULL) || stack->elems.first==NULL);
else {
if(!name || strcmp(stack->current->name, name) == 0) {
undo= (stack->current && stack->current->next)? stack->current->next: stack->elems.first;
undo_restore(C, stack, undo);
stack->current= undo;
if(G.f & G_DEBUG) printf("redo %s\n", undo->name);
return 1;
}
}
}
return 0;
}
static void undo_stack_free(UndoStack *stack)
{
UndoElem *uel;
@ -181,7 +189,7 @@ static void undo_stack_free(UndoStack *stack)
/* Exported Functions */
void undo_paint_push_begin(int type, char *name, UndoRestoreCb restore, UndoFreeCb free)
void undo_paint_push_begin(int type, const char *name, UndoRestoreCb restore, UndoFreeCb free)
{
if(type == UNDO_PAINT_IMAGE)
undo_stack_push_begin(&ImageUndoStack, name, restore, free);
@ -219,12 +227,14 @@ void undo_paint_push_end(int type)
undo_stack_push_end(&MeshUndoStack);
}
void ED_undo_paint_step(bContext *C, int type, int step)
int ED_undo_paint_step(bContext *C, int type, int step, const char *name)
{
if(type == UNDO_PAINT_IMAGE)
undo_stack_step(C, &ImageUndoStack, step);
return undo_stack_step(C, &ImageUndoStack, step, name);
else if(type == UNDO_PAINT_MESH)
undo_stack_step(C, &MeshUndoStack, step);
return undo_stack_step(C, &MeshUndoStack, step, name);
return 0;
}
void ED_undo_paint_free(void)

@ -229,7 +229,7 @@ void BRUSH_OT_curve_preset(wmOperatorType *ot)
ot->exec= brush_curve_preset_exec;
ot->poll= brush_curve_preset_poll;
ot->flag= OPTYPE_UNDO;
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
RNA_def_enum(ot->srna, "shape", prop_shape_items, CURVE_PRESET_SMOOTH, "Mode", "");
}

@ -663,7 +663,7 @@ static void vpaint_blend(VPaint *vp, unsigned int *col, unsigned int *colorig, u
unsigned int testcol=0, a;
char *cp, *ct, *co;
alpha= (int)(255.0*brush->alpha);
alpha= (int)(255.0*brush_alpha(brush));
if(brush->vertexpaint_tool==VP_MIX || brush->vertexpaint_tool==VP_BLUR) testcol= mcol_blend( *colorig, paintcol, alpha);
else if(brush->vertexpaint_tool==VP_ADD) testcol= mcol_add( *colorig, paintcol, alpha);
@ -733,23 +733,24 @@ static float calc_vp_alpha_dl(VPaint *vp, ViewContext *vc, float vpimat[][3], fl
float fac, fac_2, size, dx, dy;
float alpha;
short vertco[2];
const int radius= brush_size(brush);
project_short_noclip(vc->ar, vert_nor, vertco);
dx= mval[0]-vertco[0];
dy= mval[1]-vertco[1];
if (brush->flag & BRUSH_SIZE_PRESSURE)
size = pressure * brush->size;
if (brush_use_size_pressure(brush))
size = pressure * radius;
else
size = brush->size;
size = radius;
fac_2= dx*dx + dy*dy;
if(fac_2 > size*size) return 0.f;
fac = sqrtf(fac_2);
alpha= brush->alpha * brush_curve_strength_clamp(brush, fac, size);
alpha= brush_alpha(brush) * brush_curve_strength_clamp(brush, fac, size);
if (brush->flag & BRUSH_ALPHA_PRESSURE)
if (brush_use_alpha_pressure(brush))
alpha *= pressure;
if(vp->flag & VP_NORMALS) {
@ -813,7 +814,7 @@ static void wpaint_blend(VPaint *wp, MDeformWeight *dw, MDeformWeight *uw, float
if((wp->flag & VP_SPRAY)==0) {
float testw=0.0f;
alpha= brush->alpha;
alpha= brush_alpha(brush);
if(tool==VP_MIX || tool==VP_BLUR)
testw = paintval*alpha + uw->weight*(1.0-alpha);
else if(tool==VP_ADD)
@ -1454,7 +1455,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
/* which faces are involved */
if(wp->flag & VP_AREA) {
totindex= sample_backbuf_area(vc, indexar, me->totface, mval[0], mval[1], brush->size);
totindex= sample_backbuf_area(vc, indexar, me->totface, mval[0], mval[1], brush_size(brush));
}
else {
indexar[0]= view3d_sample_backbuf(vc, mval[0], mval[1]);
@ -1740,7 +1741,6 @@ void PAINT_OT_vertex_paint_toggle(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
@ -1874,7 +1874,7 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
/* which faces are involved */
if(vp->flag & VP_AREA) {
totindex= sample_backbuf_area(vc, indexar, me->totface, mval[0], mval[1], brush->size);
totindex= sample_backbuf_area(vc, indexar, me->totface, mval[0], mval[1], brush_size(brush));
}
else {
indexar[0]= view3d_sample_backbuf(vc, mval[0], mval[1]);

@ -112,8 +112,14 @@ void ED_sculpt_force_update(bContext *C)
it's the last modifier on the stack and it is not on the first level */
struct MultiresModifierData *sculpt_multires_active(Scene *scene, Object *ob)
{
Mesh *me= (Mesh*)ob->data;
ModifierData *md, *nmd;
if(!CustomData_get_layer(&me->fdata, CD_MDISPS)) {
/* multires can't work without displacement layer */
return NULL;
}
for(md= modifiers_getVirtualModifierList(ob); md; md= md->next) {
if(md->type == eModifierType_Multires) {
MultiresModifierData *mmd= (MultiresModifierData*)md;
@ -583,9 +589,10 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
Brush *brush = paint_brush(&sd->paint);
/* Primary strength input; square it to make lower values more sensitive */
float alpha = sculpt_get_brush_alpha(brush)*sculpt_get_brush_alpha(brush);
const float root_alpha = brush_alpha(brush);
float alpha = root_alpha*root_alpha;
float dir = brush->flag & BRUSH_DIR_IN ? -1 : 1;
float pressure = brush->flag & BRUSH_ALPHA_PRESSURE ? cache->pressure : 1;
float pressure = brush_use_alpha_pressure(brush) ? cache->pressure : 1;
float pen_flip = cache->pen_flip ? -1 : 1;
float invert = cache->invert ? -1 : 1;
float accum = integrate_overlap(brush);
@ -733,7 +740,7 @@ static float tex_strength(SculptSession *ss, Brush *br, float *point, const floa
else if(ss->texcache) {
float rotation = -mtex->rot;
float x, y, point_2d[3];
float diameter;
float radius;
/* if the active area is being applied for symmetry, flip it
across the symmetry axis and rotate it back to the orignal
@ -754,7 +761,7 @@ static float tex_strength(SculptSession *ss, Brush *br, float *point, const floa
point_2d[0] -= ss->cache->tex_mouse[0];
point_2d[1] -= ss->cache->tex_mouse[1];
diameter = ss->cache->pixel_radius; // use pressure adjusted size for fixed mode
radius = ss->cache->pixel_radius; // use pressure adjusted size for fixed mode
x = point_2d[0];
y = point_2d[1];
@ -762,7 +769,7 @@ static float tex_strength(SculptSession *ss, Brush *br, float *point, const floa
else /* else (mtex->brush_map_mode == MTEX_MAP_MODE_TILED),
leave the coordinates relative to the screen */
{
diameter = sculpt_get_brush_size(br); // use unadjusted size for tiled mode
radius = brush_size(br); // use unadjusted size for tiled mode
x = point_2d[0] - ss->cache->vc->ar->winrct.xmin;
y = point_2d[1] - ss->cache->vc->ar->winrct.ymin;
@ -776,8 +783,8 @@ static float tex_strength(SculptSession *ss, Brush *br, float *point, const floa
y -= 0.5f;
}
x *= ss->cache->vc->ar->winx / diameter;
y *= ss->cache->vc->ar->winy / diameter;
x *= ss->cache->vc->ar->winx / radius;
y *= ss->cache->vc->ar->winy / radius;
/* it is probably worth optimizing for those cases where
the texture is not rotated by skipping the calls to
@ -1247,8 +1254,8 @@ static void do_crease_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int
/* we divide out the squared alpha and multiply by the squared crease to give us the pinch strength */
if(sculpt_get_brush_alpha(brush) > 0.0f)
crease_correction = brush->crease_pinch_factor*brush->crease_pinch_factor/(sculpt_get_brush_alpha(brush)*sculpt_get_brush_alpha(brush));
if(brush_alpha(brush) > 0.0f)
crease_correction = brush->crease_pinch_factor*brush->crease_pinch_factor/(brush_alpha(brush)*brush_alpha(brush));
else
crease_correction = brush->crease_pinch_factor*brush->crease_pinch_factor;
@ -1801,8 +1808,13 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, SculptSession *ss, P
normalize_v3(an);
// fc
if (count != 0) {
mul_v3_fl(fc, 1.0f / count);
}
else {
zero_v3(fc);
}
}
static void calc_sculpt_plane(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int totnode, float an[3], float fc[3])
{
@ -2608,6 +2620,7 @@ static void do_symmetrical_brush_actions(Sculpt *sd, SculptSession *ss)
static void sculpt_update_tex(Sculpt *sd, SculptSession *ss)
{
Brush *brush = paint_brush(&sd->paint);
const int radius= brush_size(brush);
if(ss->texcache) {
MEM_freeN(ss->texcache);
@ -2615,9 +2628,9 @@ static void sculpt_update_tex(Sculpt *sd, SculptSession *ss)
}
/* Need to allocate a bigger buffer for bigger brush size */
ss->texcache_side = 2*sculpt_get_brush_size(brush);
ss->texcache_side = 2*radius;
if(!ss->texcache || ss->texcache_side > ss->texcache_actual) {
ss->texcache = brush_gen_texture_cache(brush, sculpt_get_brush_size(brush));
ss->texcache = brush_gen_texture_cache(brush, radius);
ss->texcache_actual = ss->texcache_side;
}
}
@ -2791,50 +2804,6 @@ static void sculpt_cache_free(StrokeCache *cache)
MEM_freeN(cache);
}
int sculpt_get_brush_size(Brush *brush)
{
return (U.sculpt_paint_settings & SCULPT_PAINT_USE_UNIFIED_SIZE) ? U.sculpt_paint_unified_size : brush->size;
}
void sculpt_set_brush_size(Brush *brush, int size)
{
if (U.sculpt_paint_settings & SCULPT_PAINT_USE_UNIFIED_SIZE)
U.sculpt_paint_unified_size = size;
else
brush->size = size;
}
int sculpt_get_lock_brush_size(Brush *brush)
{
return (U.sculpt_paint_settings & SCULPT_PAINT_USE_UNIFIED_SIZE) ? (U.sculpt_paint_settings & SCULPT_PAINT_UNIFIED_LOCK_BRUSH_SIZE) : (brush->flag & BRUSH_LOCK_SIZE);
}
float sculpt_get_brush_unprojected_radius(Brush *brush)
{
return (U.sculpt_paint_settings & SCULPT_PAINT_USE_UNIFIED_SIZE) ? U.sculpt_paint_unified_unprojected_radius : brush->unprojected_radius;
}
void sculpt_set_brush_unprojected_radius(Brush *brush, float unprojected_radius)
{
if (U.sculpt_paint_settings & SCULPT_PAINT_USE_UNIFIED_SIZE)
U.sculpt_paint_unified_unprojected_radius = unprojected_radius;
else
brush->unprojected_radius = unprojected_radius;
}
float sculpt_get_brush_alpha(Brush *brush)
{
return (U.sculpt_paint_settings & SCULPT_PAINT_USE_UNIFIED_ALPHA) ? U.sculpt_paint_unified_alpha : brush->alpha;
}
void sculpt_set_brush_alpha(Brush *brush, float alpha)
{
if (U.sculpt_paint_settings & SCULPT_PAINT_USE_UNIFIED_ALPHA)
U.sculpt_paint_unified_alpha = alpha;
else
brush->alpha = alpha;
}
/* Initialize the stroke cache invariants from operator properties */
static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSession *ss, wmOperator *op, wmEvent *event)
{
@ -3058,22 +3027,22 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, SculptSession
sd->pressure_value= cache->pressure;
cache->previous_pixel_radius = cache->pixel_radius;
cache->pixel_radius = sculpt_get_brush_size(brush);
cache->pixel_radius = brush_size(brush);
if(cache->first_time) {
if (!sculpt_get_lock_brush_size(brush)) {
cache->initial_radius= unproject_brush_radius(ss->ob, cache->vc, cache->true_location, sculpt_get_brush_size(brush));
sculpt_set_brush_unprojected_radius(brush, cache->initial_radius);
if (!brush_use_locked_size(brush)) {
cache->initial_radius= unproject_brush_radius(ss->ob, cache->vc, cache->true_location, brush_size(brush));
brush_set_unprojected_radius(brush, cache->initial_radius);
}
else {
cache->initial_radius= sculpt_get_brush_unprojected_radius(brush);
cache->initial_radius= brush_unprojected_radius(brush);
}
if (ELEM(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK))
cache->initial_radius *= 2.0f;
}
if(brush->flag & BRUSH_SIZE_PRESSURE) {
if(brush_use_size_pressure(brush)) {
cache->pixel_radius *= cache->pressure;
cache->radius= cache->initial_radius * cache->pressure;
}
@ -3284,7 +3253,7 @@ static void sculpt_restore_mesh(Sculpt *sd, SculptSession *ss)
/* Restore the mesh before continuing with anchored stroke */
if((brush->flag & BRUSH_ANCHORED) ||
(brush->sculpt_tool == SCULPT_TOOL_GRAB && (brush->flag & BRUSH_SIZE_PRESSURE)) ||
(brush->sculpt_tool == SCULPT_TOOL_GRAB && brush_use_size_pressure(brush)) ||
(brush->flag & BRUSH_RESTORE_MESH))
{
StrokeCache *cache = ss->cache;
@ -3598,7 +3567,7 @@ static void SCULPT_OT_set_persistent_base(wmOperatorType *ot)
ot->exec= sculpt_set_persistent_base;
ot->poll= sculpt_mode_poll;
ot->flag= 0;//OPTYPE_REGISTER;
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
/**** Toggle operator for turning sculpt mode on or off ****/
@ -3679,7 +3648,7 @@ static void SCULPT_OT_sculptmode_toggle(wmOperatorType *ot)
ot->exec= sculpt_toggle_mode;
ot->poll= ED_operator_object_active;
ot->flag= 0;
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
void ED_operatortypes_sculpt()

@ -333,7 +333,7 @@ static int file_select_all_exec(bContext *C, wmOperator *op)
void FILE_OT_select_all_toggle(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Select/Deselect all files";
ot->name= "Select/Deselect All Files";
ot->description= "Select/deselect all files";
ot->idname= "FILE_OT_select_all_toggle";

@ -521,7 +521,7 @@ static void draw_image_view_tool(Scene *scene)
if(draw) {
getmouseco_areawin(mval);
radius= brush->size*G.sima->zoom/2;
radius= brush_size(brush)*G.sima->zoom;
fdrawXORcirc(mval[0], mval[1], radius);
if (brush->innerradius != 1.0) {

@ -33,6 +33,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_object_types.h"
#include "DNA_node_types.h"
#include "DNA_packedFile_types.h"
#include "DNA_scene_types.h"
@ -127,10 +128,15 @@ static int space_image_file_exists_poll(bContext *C)
SpaceImage *sima= CTX_wm_space_image(C);
ImBuf *ibuf;
void *lock;
int poll;
int poll= 0;
char name[FILE_MAX];
ibuf= ED_space_image_acquire_buffer(sima, &lock);
poll= (ibuf && BLI_exists(ibuf->name) && BLI_is_writable(ibuf->name));
if(ibuf) {
BLI_strncpy(name, ibuf->name, FILE_MAX);
BLI_path_abs(name, G.sce);
poll= (BLI_exists(name) && BLI_is_writable(name));
}
ED_space_image_release_buffer(sima, lock);
return poll;
@ -1030,6 +1036,8 @@ static int save_exec(bContext *C, wmOperator *op)
BLI_strncpy(name, ibuf->name, FILE_MAX);
if(name[0]==0)
BLI_strncpy(name, G.ima, FILE_MAX);
else
BLI_path_abs(name, G.sce);
if(BLI_exists(name) && BLI_is_writable(name)) {
rr= BKE_image_acquire_renderresult(scene, ima);
@ -1237,7 +1245,7 @@ static int new_exec(bContext *C, wmOperator *op)
void IMAGE_OT_new(wmOperatorType *ot)
{
PropertyRNA *prop;
float default_color[4]= {0.0f, 0.0f, 0.0f, 1.0f};
static float default_color[4]= {0.0f, 0.0f, 0.0f, 1.0f};
/* identifiers */
ot->name= "New";
@ -2054,6 +2062,8 @@ void ED_image_update_frame(const bContext *C)
{
Main *mainp= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
wmWindowManager *wm= CTX_wm_manager(C);
wmWindow *win;
Tex *tex;
/* texture users */
@ -2066,14 +2076,15 @@ void ED_image_update_frame(const bContext *C)
}
}
#if 0
/* image window, compo node users */
if(G.curscreen) {
if(wm) {
for(win= wm->windows.first; win; win= win->next) {
ScrArea *sa;
for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
if(sa->spacetype==SPACE_VIEW3D) {
View3D *v3d= sa->spacedata.first;
if(v3d->bgpic)
BGpic *bgpic;
for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
if(v3d->bgpic->iuser.flag & IMA_ANIM_ALWAYS)
BKE_image_user_calc_frame(&v3d->bgpic->iuser, scene->r.cfra, 0);
}
@ -2099,8 +2110,6 @@ void ED_image_update_frame(const bContext *C)
}
}
}
#endif
}
}

@ -45,6 +45,7 @@
#include "ED_armature.h"
#include "ED_mesh.h"
#include "ED_curve.h" /* for ED_curve_editnurbs */
#include "BLI_editVert.h"
@ -187,8 +188,9 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
BezTriple *bezt;
BPoint *bp;
int a;
ListBase *nurbs= ED_curve_editnurbs(cu);
for(nu=cu->editnurb->first; nu; nu=nu->next) {
for(nu=nurbs->first; nu; nu=nu->next) {
if(nu->type == CU_BEZIER) {
bezt= nu->bezt;
a= nu->pntsu;

@ -52,6 +52,7 @@
#include "UI_resources.h"
#include "UI_interface.h"
#include "info_intern.h" // own include
/* ******************** default callbacks for info space ***************** */

@ -271,7 +271,7 @@ static int node_select_all_exec(bContext *C, wmOperator *op)
void NODE_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Select/Deselect All";
ot->name = "Select or Deselect All";
ot->description = "(De)select all nodes";
ot->idname = "NODE_OT_select_all";

@ -90,13 +90,9 @@ static int script_reload_exec(bContext *C, wmOperator *op)
#ifndef DISABLE_PYTHON
/* TODO, this crashes on netrender and keying sets, need to look into why
* disable for now unless running in debug mode */
if(G.f & G_DEBUG) {
WM_cursor_wait(1);
BPY_eval_string(C, "__import__('bpy').utils.load_scripts(reload_scripts=True)");
}
else {
BKE_reportf(op->reports, RPT_ERROR, "reloading is currently unstable, only operates in debug mode.\n");
return OPERATOR_CANCELLED;
}
WM_cursor_wait(0);
return OPERATOR_FINISHED;
#endif
return OPERATOR_CANCELLED;

@ -341,6 +341,9 @@ static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op)
static int sequencer_add_movie_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
if(RNA_collection_length(op->ptr, "files") || RNA_property_is_set(op->ptr, "filepath"))
return sequencer_add_movie_strip_exec(C, op);
if(!ED_operator_sequencer_active(C)) {
BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
return OPERATOR_CANCELLED;
@ -349,6 +352,10 @@ static int sequencer_add_movie_strip_invoke(bContext *C, wmOperator *op, wmEvent
if(!RNA_property_is_set(op->ptr, "relative_path"))
RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
/* This is for drag and drop */
if(RNA_property_is_set(op->ptr, "filepath"))
return sequencer_add_movie_strip_exec(C, op);
sequencer_generic_invoke_xy__internal(C, op, event, 0);
WM_event_add_fileselect(C, op);
@ -389,6 +396,9 @@ static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op)
static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
if(RNA_collection_length(op->ptr, "files") || RNA_property_is_set(op->ptr, "filepath"))
return sequencer_add_sound_strip_exec(C, op);
if(!ED_operator_sequencer_active(C)) {
BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
return OPERATOR_CANCELLED;
@ -397,6 +407,10 @@ static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, wmEvent
if(!RNA_property_is_set(op->ptr, "relative_path"))
RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
/* This is for drag and drop */
if(RNA_property_is_set(op->ptr, "filepath"))
return sequencer_add_sound_strip_exec(C, op);
sequencer_generic_invoke_xy__internal(C, op, event, 0);
WM_event_add_fileselect(C, op);
@ -486,6 +500,9 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
static int sequencer_add_image_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
if(RNA_collection_length(op->ptr, "files"))
return sequencer_add_image_strip_exec(C, op);
if(!ED_operator_sequencer_active(C)) {
BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
return OPERATOR_CANCELLED;

@ -696,11 +696,11 @@ void set_special_seq_update(int val)
void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs)
{
extern void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad);
struct ImBuf *ibuf;
struct ImBuf *ibuf = 0;
struct ImBuf *scope = 0;
struct View2D *v2d = &ar->v2d;
int rectx, recty;
float viewrectx, viewrecty;
int free_ibuf = 0;
static int recursive= 0;
float render_size = 0.0;
float proxy_size = 100.0;
@ -778,28 +778,29 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
switch(sseq->mainb) {
case SEQ_DRAW_IMG_IMBUF:
if (sseq->zebra != 0) {
ibuf = make_zebra_view_from_ibuf(ibuf, sseq->zebra);
free_ibuf = 1;
scope = make_zebra_view_from_ibuf(ibuf, sseq->zebra);
}
break;
case SEQ_DRAW_IMG_WAVEFORM:
if ((sseq->flag & SEQ_DRAW_COLOR_SEPERATED) != 0) {
ibuf = make_sep_waveform_view_from_ibuf(ibuf);
scope = make_sep_waveform_view_from_ibuf(ibuf);
} else {
ibuf = make_waveform_view_from_ibuf(ibuf);
scope = make_waveform_view_from_ibuf(ibuf);
}
free_ibuf = 1;
break;
case SEQ_DRAW_IMG_VECTORSCOPE:
ibuf = make_vectorscope_view_from_ibuf(ibuf);
free_ibuf = 1;
scope = make_vectorscope_view_from_ibuf(ibuf);
break;
case SEQ_DRAW_IMG_HISTOGRAM:
ibuf = make_histogram_view_from_ibuf(ibuf);
free_ibuf = 1;
scope = make_histogram_view_from_ibuf(ibuf);
break;
}
if (scope) {
IMB_freeImBuf(ibuf);
ibuf = scope;
}
if(ibuf->rect_float && ibuf->rect==NULL) {
IMB_rect_from_float(ibuf);
}
@ -889,9 +890,7 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
// if (sseq->flag & SEQ_DRAW_GPENCIL)
// XXX draw_gpencil_2dimage(sa, ibuf);
if (free_ibuf) {
IMB_freeImBuf(ibuf);
}
/* draw grease-pencil (screen aligned) */
// if (sseq->flag & SEQ_DRAW_GPENCIL)

@ -247,7 +247,7 @@ static int sequencer_deselect_exec(bContext *C, wmOperator *op)
void SEQUENCER_OT_select_all_toggle(struct wmOperatorType *ot)
{
/* identifiers */
ot->name= "(De)Select All";
ot->name= "Select or Deselect All";
ot->idname= "SEQUENCER_OT_select_all_toggle";
ot->description="Select or deselect all strips";

@ -35,6 +35,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_path_util.h"
#include "BKE_context.h"
#include "BKE_screen.h"
@ -322,7 +323,20 @@ static int sound_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
static void sequencer_drop_copy(wmDrag *drag, wmDropBox *drop)
{
/* copy drag path to properties */
if(RNA_struct_find_property(drop->ptr, "filepath"))
RNA_string_set(drop->ptr, "filepath", drag->path);
if(RNA_struct_find_property(drop->ptr, "directory")) {
PointerRNA itemptr;
char dir[FILE_MAX], file[FILE_MAX];
BLI_split_dirfile(drag->path, dir, file);
RNA_string_set(drop->ptr, "directory", dir);
RNA_collection_add(drop->ptr, "files", &itemptr);
RNA_string_set(&itemptr, "name", file);
}
}
/* this region dropbox definition */

@ -86,6 +86,7 @@
#include "ED_screen.h"
#include "ED_sculpt.h"
#include "ED_types.h"
#include "ED_curve.h" /* for ED_curve_editnurbs */
#include "UI_resources.h"
@ -1610,10 +1611,11 @@ void nurbs_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, Nurb
short s[2] = {IS_CLIPPED, 0};
Nurb *nu;
int i;
ListBase *nurbs= ED_curve_editnurbs(cu);
ED_view3d_local_clipping(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
for (nu= cu->editnurb->first; nu; nu=nu->next) {
for (nu= nurbs->first; nu; nu=nu->next) {
if(nu->type == CU_BEZIER) {
for (i=0; i<nu->pntsu; i++) {
BezTriple *bezt = &nu->bezt[i];
@ -5882,7 +5884,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
cu= ob->data;
if(cu->editnurb) {
drawnurb(scene, v3d, rv3d, base, cu->editnurb->first, dt);
ListBase *nurbs= ED_curve_editnurbs(cu);
drawnurb(scene, v3d, rv3d, base, nurbs->first, dt);
}
else if(dt==OB_BOUNDBOX) {
if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)

@ -73,6 +73,7 @@
#include "ED_mesh.h"
#include "ED_screen.h"
#include "ED_transform.h"
#include "ED_curve.h"
#include "UI_interface.h"
#include "UI_resources.h"
@ -205,8 +206,9 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d
BPoint *bp;
BezTriple *bezt;
int a;
ListBase *nurbs= ED_curve_editnurbs(cu);
nu= cu->editnurb->first;
nu= nurbs->first;
while(nu) {
if(nu->type == CU_BEZIER) {
bezt= nu->bezt;
@ -410,8 +412,9 @@ static void v3d_editvertex_buts(const bContext *C, uiLayout *layout, View3D *v3d
BPoint *bp;
BezTriple *bezt;
int a;
ListBase *nurbs= ED_curve_editnurbs(cu);
nu= cu->editnurb->first;
nu= nurbs->first;
while(nu) {
if(nu->type == CU_BEZIER) {
bezt= nu->bezt;

@ -1063,7 +1063,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
/* *********************** backdraw for selection *************** */
void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
{
RegionView3D *rv3d= ar->regiondata;
struct Base *base = scene->basact;
@ -1116,6 +1116,7 @@ void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
}
v3d->flag &= ~V3D_INVALID_BACKBUF;
ar->swap= 0; /* mark invalid backbuf for wm draw */
G.f &= ~G_BACKBUFSEL;
v3d->zbuf= FALSE;

@ -1924,11 +1924,12 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
/* lastview - */
if(rv3d->persp != RV3D_CAMOB) {
Object *ob= OBACT;
if (!rv3d->smooth_timer) {
/* store settings of current view before allowing overwriting with camera view
* only if we're not currently in a view transition */
QUATCOPY(rv3d->lviewquat, rv3d->viewquat);
copy_qt_qt(rv3d->lviewquat, rv3d->viewquat);
rv3d->lview= rv3d->view;
rv3d->lpersp= rv3d->persp;
}
@ -1942,19 +1943,34 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
}
#endif
if(BASACT) {
/* check both G.vd as G.scene cameras */
if((v3d->camera==NULL || scene->camera==NULL) && OBACT->type==OB_CAMERA) {
v3d->camera= OBACT;
/*handle_view3d_lock();*/
/* first get the default camera for the view lock type */
if(v3d->scenelock) {
/* sets the camera view if available */
v3d->camera= scene->camera;
}
else {
/* use scene camera if one is not set (even though we're unlocked) */
if(v3d->camera==NULL) {
v3d->camera= scene->camera;
}
}
if(v3d->camera==NULL) {
/* if the camera isnt found, check a number of options */
if(v3d->camera==NULL && ob && ob->type==OB_CAMERA)
v3d->camera= ob;
if(v3d->camera==NULL)
v3d->camera= scene_find_camera(scene);
/* couldnt find any useful camera, bail out */
if(v3d->camera==NULL)
return OPERATOR_CANCELLED;
}
/* important these dont get out of sync for locked scenes */
if(v3d->scenelock)
scene->camera= v3d->camera;
/* finally do snazzy view zooming */
rv3d->persp= RV3D_CAMOB;
smooth_view(C, NULL, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);

@ -144,7 +144,7 @@ void view3d_settings_from_ob(struct Object *ob, float *ofs, float *quat, float *
void VIEW3D_OT_smoothview(struct wmOperatorType *ot);
void VIEW3D_OT_setcameratoview(struct wmOperatorType *ot);
void VIEW3D_OT_setobjectascamera(struct wmOperatorType *ot);
void VIEW3D_OT_object_as_camera(struct wmOperatorType *ot);
void VIEW3D_OT_localview(struct wmOperatorType *ot);
void VIEW3D_OT_game_start(struct wmOperatorType *ot);
void VIEW3D_OT_fly(struct wmOperatorType *ot);

@ -83,7 +83,7 @@ void view3d_operatortypes(void)
WM_operatortype_append(VIEW3D_OT_cursor3d);
WM_operatortype_append(VIEW3D_OT_select_lasso);
WM_operatortype_append(VIEW3D_OT_setcameratoview);
WM_operatortype_append(VIEW3D_OT_setobjectascamera);
WM_operatortype_append(VIEW3D_OT_object_as_camera);
WM_operatortype_append(VIEW3D_OT_localview);
WM_operatortype_append(VIEW3D_OT_game_start);
WM_operatortype_append(VIEW3D_OT_fly);

@ -66,6 +66,7 @@
#include "ED_armature.h"
#include "ED_mesh.h"
#include "ED_screen.h"
#include "ED_curve.h" /* for ED_curve_editnurbs */
#include "view3d_intern.h"
@ -100,7 +101,8 @@ static void special_transvert_update(Scene *scene, Object *obedit)
}
else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
Curve *cu= obedit->data;
Nurb *nu= cu->editnurb->first;
ListBase *nurbs= ED_curve_editnurbs(cu);
Nurb *nu= nurbs->first;
while(nu) {
test2DNurb(nu);
@ -288,8 +290,9 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
Curve *cu= obedit->data;
int totmalloc= 0;
ListBase *nurbs= ED_curve_editnurbs(cu);
for(nu= cu->editnurb->first; nu; nu= nu->next) {
for(nu= nurbs->first; nu; nu= nu->next) {
if(nu->type == CU_BEZIER)
totmalloc += 3*nu->pntsu;
else
@ -297,7 +300,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
}
tv=transvmain= MEM_callocN(totmalloc*sizeof(TransVert), "maketransverts curve");
nu= cu->editnurb->first;
nu= nurbs->first;
while(nu) {
if(nu->type == CU_BEZIER) {
a= nu->pntsu;

@ -458,7 +458,7 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
void VIEW3D_OT_setobjectascamera(wmOperatorType *ot)
void VIEW3D_OT_object_as_camera(wmOperatorType *ot)
{
/* identifiers */

@ -4780,10 +4780,11 @@ int doEdgeSlide(TransInfo *t, float perc)
//Non prop code
look = vertlist;
while(look) {
float newlen;
float newlen, edgelen;
ev = look->link;
tempsv = BLI_ghash_lookup(vertgh,ev);
newlen = (len / len_v3v3(editedge_getOtherVert(tempsv->up,ev)->co,editedge_getOtherVert(tempsv->down,ev)->co));
edgelen = len_v3v3(editedge_getOtherVert(tempsv->up,ev)->co,editedge_getOtherVert(tempsv->down,ev)->co);
newlen = (edgelen != 0.0f)? (len / edgelen): 0.0f;
if(newlen > 1.0) {newlen = 1.0;}
if(newlen < 0.0) {newlen = 0.0;}
if(flip == 0) {

@ -620,6 +620,8 @@ void drawConstraint(const struct bContext *C, TransInfo *t)
if (tc->mode & CON_SELECT) {
float vec[3];
char col2[3] = {255,255,255};
int depth_test_enabled;
convertViewVec(t, vec, (short)(t->mval[0] - t->con.imval[0]), (short)(t->mval[1] - t->con.imval[1]));
add_v3_v3(vec, tc->center);
@ -629,15 +631,18 @@ void drawConstraint(const struct bContext *C, TransInfo *t)
glColor3ubv((GLubyte *)col2);
depth_test_enabled = glIsEnabled(GL_DEPTH_TEST);
if(depth_test_enabled)
glDisable(GL_DEPTH_TEST);
setlinestyle(1);
glBegin(GL_LINE_STRIP);
glVertex3fv(tc->center);
glVertex3fv(vec);
glEnd();
setlinestyle(0);
// TRANSFORM_FIX_ME
//if(G.vd->zbuf)
if(depth_test_enabled)
glEnable(GL_DEPTH_TEST);
}

@ -94,6 +94,7 @@
#include "ED_mesh.h"
#include "ED_types.h"
#include "ED_uvedit.h"
#include "ED_curve.h" /* for ED_curve_editnurbs */
#include "UI_view2d.h"
@ -1347,12 +1348,14 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
int count=0, countsel=0;
int propmode = t->flag & T_PROP_EDIT;
short hide_handles = (cu->drawflag & CU_HIDE_HANDLES);
ListBase *nurbs;
/* to be sure */
if(cu->editnurb==NULL) return;
/* count total of vertices, check identical as in 2nd loop for making transdata! */
for(nu= cu->editnurb->first; nu; nu= nu->next) {
nurbs= ED_curve_editnurbs(cu);
for(nu= nurbs->first; nu; nu= nu->next) {
if(nu->type == CU_BEZIER) {
for(a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
if(bezt->hide==0) {
@ -1388,7 +1391,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
invert_m3_m3(smtx, mtx);
td = t->data;
for(nu= cu->editnurb->first; nu; nu= nu->next) {
for(nu= nurbs->first; nu; nu= nu->next) {
if(nu->type == CU_BEZIER) {
TransData *head, *tail;
head = tail = td;

@ -84,6 +84,7 @@
#include "ED_space_api.h"
#include "ED_uvedit.h"
#include "ED_view3d.h"
#include "ED_curve.h" /* for ED_curve_editnurbs */
//#include "BDR_unwrapper.h"
@ -636,7 +637,8 @@ void recalcData(TransInfo *t)
if (t->obedit) {
if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
Curve *cu= t->obedit->data;
Nurb *nu= cu->editnurb->first;
ListBase *nurbs= ED_curve_editnurbs(cu);
Nurb *nu= nurbs->first;
if(t->state != TRANS_CANCEL) {
clipMirrorModifier(t, t->obedit);

@ -197,17 +197,17 @@ void InputCustomRatio(TransInfo *t, MouseInput *mi, short mval[2], float output[
mdx = (mi->precision_mval[0] + (float)(mval[0] - mi->precision_mval[0]) / 10.0f) - data[2];
mdy = (mi->precision_mval[1] + (float)(mval[1] - mi->precision_mval[1]) / 10.0f) - data[3];
distance = (mdx*dx + mdy*dy) / length;
distance = (length != 0.0f)? (mdx*dx + mdy*dy) / length: 0.0f;
}
else {
short mdx, mdy;
mdx = mval[0] - data[2];
mdy = mval[1] - data[3];
distance = (mdx*dx + mdy*dy) / length;
distance = (length != 0.0f)? (mdx*dx + mdy*dy) / length: 0.0f;
}
output[0] = distance / length;
output[0] = (length != 0.0f)? distance / length: 0.0f;
}
}

@ -73,6 +73,7 @@
#include "ED_mesh.h"
#include "ED_particle.h"
#include "ED_view3d.h"
#include "ED_curve.h" /* for ED_curve_editnurbs */
#include "UI_resources.h"
@ -311,8 +312,9 @@ int calc_manipulator_stats(const bContext *C)
Nurb *nu;
BezTriple *bezt;
BPoint *bp;
ListBase *nurbs= ED_curve_editnurbs(cu);
nu= cu->editnurb->first;
nu= nurbs->first;
while(nu) {
if(nu->type == CU_BEZIER) {
bezt= nu->bezt;

@ -51,6 +51,7 @@
#include "ED_armature.h"
#include "ED_mesh.h"
#include "ED_curve.h" /* for ED_curve_editnurbs */
#include "RNA_define.h"
@ -740,8 +741,9 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
Nurb *nu;
BezTriple *bezt;
int a;
ListBase *nurbs= ED_curve_editnurbs(cu);
for (nu = cu->editnurb->first; nu; nu = nu->next)
for (nu = nurbs->first; nu; nu = nu->next)
{
/* only bezier has a normal */
if(nu->type == CU_BEZIER)

@ -116,7 +116,9 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
if((obact && obact->mode & OB_MODE_TEXTURE_PAINT) || sima->flag & SI_DRAWTOOL) {
ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step);
if(!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname) && undoname)
if(U.uiflag & USER_GLOBALUNDO)
BKE_undo_name(C, undoname);
WM_event_add_notifier(C, NC_WINDOW, NULL);
return OPERATOR_FINISHED;
@ -139,10 +141,14 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
else {
int do_glob_undo= 0;
if(obact && obact->mode & OB_MODE_TEXTURE_PAINT)
ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step);
else if(obact && obact->mode & OB_MODE_SCULPT)
ED_undo_paint_step(C, UNDO_PAINT_MESH, step);
if(obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
if(!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname) && undoname)
do_glob_undo= 1;
}
else if(obact && obact->mode & OB_MODE_SCULPT) {
if(!ED_undo_paint_step(C, UNDO_PAINT_MESH, step, undoname) && undoname)
do_glob_undo= 1;
}
else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
if(step==1)
PE_undo(CTX_data_scene(C));

@ -48,6 +48,7 @@ struct VFont;
struct AnimData;
struct SelBox;
struct EditFont;
struct GHash;
/* These two Lines with # tell makesdna this struct can be excluded. */
#
@ -150,6 +151,14 @@ typedef struct TextBox {
float x, y, w, h;
} TextBox;
typedef struct EditNurb {
/* base of nurbs' list (old Curve->editnurb) */
ListBase nurbs;
/* index data for shape keys */
struct GHash *keyindex;
} EditNurb;
typedef struct Curve {
ID id;
struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
@ -159,7 +168,7 @@ typedef struct Curve {
ListBase nurb; /* actual data, called splines in rna */
ListBase disp;
ListBase *editnurb; /* edited data, not in file, use pointer so we can check for it */
EditNurb *editnurb; /* edited data, not in file, use pointer so we can check for it */
struct Object *bevobj, *taperobj, *textoncurve;
struct Ipo *ipo; // XXX depreceated... old animation system

@ -128,7 +128,7 @@ typedef struct TFace {
/* me->flag */
#define ME_ISDONE 1
/* #define ME_ISDONE 1 */
#define ME_NOPUNOFLIP 2
#define ME_TWOSIDED 4
#define ME_UVEFFECT 8

@ -726,6 +726,12 @@ typedef struct ToolSettings {
short proportional, prop_mode;
int auto_normalize, intpad; /*auto normalizing mode in wpaint*/
short sculpt_paint_settings; /* user preferences for sculpt and paint */
short pad;
int sculpt_paint_unified_size; /* unified radius of brush in pixels */
float sculpt_paint_unified_unprojected_radius;/* unified radius of brush in Blender units */
float sculpt_paint_unified_alpha; /* unified strength of brush */
} ToolSettings;
typedef struct bStats {
@ -1141,6 +1147,13 @@ typedef enum SculptFlags {
SCULPT_USE_OPENMP = (1<<7),
} SculptFlags;
/* sculpt_paint_settings */
#define SCULPT_PAINT_USE_UNIFIED_SIZE (1<<0)
#define SCULPT_PAINT_USE_UNIFIED_ALPHA (1<<1)
#define SCULPT_PAINT_UNIFIED_LOCK_BRUSH_SIZE (1<<2)
#define SCULPT_PAINT_UNIFIED_SIZE_PRESSURE (1<<3)
#define SCULPT_PAINT_UNIFIED_ALPHA_PRESSURE (1<<4)
/* ImagePaintSettings.flag */
#define IMAGEPAINT_DRAWING 1
#define IMAGEPAINT_DRAW_TOOL 2

@ -341,10 +341,10 @@ typedef struct UserDef {
short gp_settings;
short tb_leftmouse, tb_rightmouse;
struct SolidLight light[3];
short sculpt_paint_settings; /* user preferences for sculpt and paint */
short tw_hotspot, tw_flag, tw_handlesize, tw_size;
short textimeout,texcollectrate;
short wmdrawmethod; /* removed wmpad */
short pad2;
int memcachelimit;
int prefetchframes;
short frameserverport;
@ -375,10 +375,8 @@ typedef struct UserDef {
struct ColorBand coba_weight; /* from texture.h */
int sculpt_paint_unified_size; /* unified radius of brush in pixels */
float sculpt_paint_unified_unprojected_radius;/* unified radius of brush in Blender units */
float sculpt_paint_unified_alpha; /* unified strength of brush */
float sculpt_paint_overlay_col[3];
int pad3;
} UserDef;
extern UserDef U; /* from blenkernel blender.c */
@ -530,11 +528,6 @@ extern UserDef U; /* from blenkernel blender.c */
#define GP_PAINT_DOSMOOTH (1<<0)
#define GP_PAINT_DOSIMPLIFY (1<<1)
/* sculpt_paint_settings */
#define SCULPT_PAINT_USE_UNIFIED_SIZE (1<<0)
#define SCULPT_PAINT_USE_UNIFIED_ALPHA (1<<1)
#define SCULPT_PAINT_UNIFIED_LOCK_BRUSH_SIZE (1<<2)
/* color picker types */
#define USER_CP_CIRCLE 0
#define USER_CP_SQUARE_SV 1

@ -110,7 +110,7 @@ DONE:
- pointer conversion (32-64 bits)
IMPORTANT:
- do not use #defines in structs for array lenghts, this cannot be read by the dna functions
- do not use #defines in structs for array lengths, this cannot be read by the dna functions
- do not use uint, but unsigned int instead, ushort and ulong are allowed
- only use a long in Blender if you want this to be the size of a pointer. so it is
32 bits or 64 bits, dependant at the cpu architecture

@ -203,7 +203,7 @@ static int calculate_structlens(int);
void dna_write(FILE *file, void *pntr, int size);
/**
* Report all structures found so far, and print their lenghts.
* Report all structures found so far, and print their lengths.
*/
void printStructLenghts(void);

@ -6,7 +6,7 @@ objs = []
o = SConscript('intern/SConscript')
objs += o
incs = '#/intern/guardedalloc #/intern/audaspace/intern ../blenkernel ../blenlib ../makesdna intern .'
incs = '#/intern/guardedalloc #/intern/memutil #/intern/audaspace/intern ../blenkernel ../blenlib ../makesdna intern .'
incs += ' ../windowmanager ../editors/include ../gpu ../imbuf ../ikplugin'
incs += ' ../render/extern/include'

@ -42,6 +42,7 @@ SET(SRC
INCLUDE_DIRECTORIES(
../../../../intern/audaspace/intern
../../../../intern/guardedalloc
../../../../intern/memutil
..
../../makesdna
../../blenkernel

@ -46,6 +46,7 @@ endif
CFLAGS += $(LEVEL_1_C_WARNINGS)
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
CPPFLAGS += -I$(NAN_MEMUTIL)/include
CPPFLAGS += -I../../../../intern/audaspace/intern
CPPFLAGS += -I../../blenlib
CPPFLAGS += -I../../blenkernel

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