Merged changes in the trunk up to revision 36408.

This commit is contained in:
Tamito Kajiyama 2011-05-01 13:50:38 +00:00
commit b9d4121283
146 changed files with 1953 additions and 1084 deletions

@ -102,8 +102,12 @@ get_blender_version()
# Blender internal features
option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
option(WITH_PYTHON "Enable Embedded Python API (only disable for development)" ON)
option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default (recommend to leave off)" OFF)
mark_as_advanced(WITH_PYTHON) # dont want people disabling this unless they really know what they are doing.
mark_as_advanced(WITH_PYTHON_SECURITY) # some distrobutions see this as a security issue, rather then have them patch it, make a build option.
option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF)
option(WITH_PYTHON_MODULE "Enable building as a python module (experemental, only enable for development)" OFF)
option(WITH_BUILDINFO "Include extra build details (only disable for development & faster builds)" ON)

@ -22,20 +22,14 @@ BF_EXPAT_LIB = ''
WITH_BF_FFMPEG = True
WITH_BF_STATICFFMPEG = True
# Used for linking against system ffmpeg, but it gives pixelization,, so fall back to ffmpeg from 2.52 temporary
#BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
# '${BF_FFMPEG_LIBPATH}/libavutil.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libdc1394.a ' + \
# '${BF_FFMPEG_LIBPATH}/libraw1394.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ' + \
# '${BF_FFMPEG_LIBPATH}/libfaad.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
# '${BF_FFMPEG_LIBPATH}/libspeex.a ${BF_FFMPEG_LIBPATH}/libbz2.a ${BF_FFMPEG_LIBPATH}/liboil-0.3.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
# '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libgsm.a'
BF_FFMPEG = '/home/sources/staticlibs/ffmpeg'
BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib32'
BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libextern_libavformat.a ${BF_FFMPEG_LIBPATH}/libextern_libswscale.a ' + \
'${BF_FFMPEG_LIBPATH}/libextern_libavcodec.a ${BF_FFMPEG_LIBPATH}/libextern_libavdevice.a ' + \
'${BF_FFMPEG_LIBPATH}/libextern_libavutil.a ${BF_FFMPEG_LIBPATH}/libextern_xvidcore.a ' + \
'${BF_FFMPEG_LIBPATH}/libextern_libmp3lame.a ${BF_FFMPEG_LIBPATH}/libextern_x264.a'
BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
'${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
'${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
'${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
'${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
'${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a'
# Don't depend on system's libstdc++
WITH_BF_STATICCXX = True

@ -22,20 +22,14 @@ BF_EXPAT_LIB = ''
WITH_BF_FFMPEG = True
WITH_BF_STATICFFMPEG = True
# Used for linking against system ffmpeg, but it gives pixelization,, so fall back to ffmpeg from 2.52 temporary
#BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
# '${BF_FFMPEG_LIBPATH}/libavutil.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libdc1394.a ' + \
# '${BF_FFMPEG_LIBPATH}/libraw1394.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ' + \
# '${BF_FFMPEG_LIBPATH}/libfaad.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
# '${BF_FFMPEG_LIBPATH}/libspeex.a ${BF_FFMPEG_LIBPATH}/libbz2.a ${BF_FFMPEG_LIBPATH}/liboil-0.3.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
# '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libgsm.a'
BF_FFMPEG = '/home/sources/staticlibs/ffmpeg'
BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib64'
BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libextern_libavformat.a ${BF_FFMPEG_LIBPATH}/libextern_libswscale.a ' + \
'${BF_FFMPEG_LIBPATH}/libextern_libavcodec.a ${BF_FFMPEG_LIBPATH}/libextern_libavdevice.a ' + \
'${BF_FFMPEG_LIBPATH}/libextern_libavutil.a ${BF_FFMPEG_LIBPATH}/libextern_xvidcore.a ' + \
'${BF_FFMPEG_LIBPATH}/libextern_libmp3lame.a ${BF_FFMPEG_LIBPATH}/libextern_x264.a'
BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
'${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
'${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
'${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
'${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
'${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a'
# Don't depend on system's libstdc++
WITH_BF_STATICCXX = True

@ -32,7 +32,7 @@ class SimpleMouseOperator(bpy.types.Operator):
def execute(self, context):
# rather then printing, use the report function,
# this way the messag appiers in the header,
# this way the message appears in the header,
self.report({'INFO'}, "Mouse coords are %d %d" % (self.x, self.y))
return {'FINISHED'}

@ -83,71 +83,71 @@ static void testTimerProc(GHOST_TimerTaskHandle task, GHOST_TUns64 time)
static void gearGL(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, GLint teeth, GLfloat tooth_depth)
{
GLint i;
GLfloat r0, r1, r2;
GLfloat angle, da;
GLfloat u, v, len;
GLfloat r0, r1, r2;
GLfloat angle, da;
GLfloat u, v, len;
const double pi = 3.14159264;
r0 = inner_radius;
r1 = (float)(outer_radius - tooth_depth/2.0);
r2 = (float)(outer_radius + tooth_depth/2.0);
r0 = inner_radius;
r1 = (float)(outer_radius - tooth_depth/2.0);
r2 = (float)(outer_radius + tooth_depth/2.0);
da = (float)(2.0*pi / teeth / 4.0);
da = (float)(2.0*pi / teeth / 4.0);
glShadeModel(GL_FLAT);
glNormal3f(0.0, 0.0, 1.0);
glShadeModel(GL_FLAT);
glNormal3f(0.0, 0.0, 1.0);
/* draw front face */
glBegin(GL_QUAD_STRIP);
for (i=0;i<=teeth;i++) {
/* draw front face */
glBegin(GL_QUAD_STRIP);
for (i=0;i<=teeth;i++) {
angle = (float)(i * 2.0*pi / teeth);
glVertex3f((float)(r0*cos(angle)), (float)(r0*sin(angle)), (float)(width*0.5));
glVertex3f((float)(r1*cos(angle)), (float)(r1*sin(angle)), (float)(width*0.5));
glVertex3f((float)(r0*cos(angle)), (float)(r0*sin(angle)), (float)(width*0.5));
glVertex3f((float)(r1*cos(angle+3*da)), (float)(r1*sin(angle+3*da)), (float)(width*0.5));
}
glEnd();
}
glEnd();
/* draw front sides of teeth */
glBegin(GL_QUADS);
da = (float)(2.0*pi / teeth / 4.0);
for (i=0;i<teeth;i++) {
/* draw front sides of teeth */
glBegin(GL_QUADS);
da = (float)(2.0*pi / teeth / 4.0);
for (i=0;i<teeth;i++) {
angle = (float)(i * 2.0*pi / teeth);
glVertex3f((float)(r1*cos(angle)), (float)(r1*sin(angle)), (float)(width*0.5));
glVertex3f((float)(r2*cos(angle+da)), (float)(r2*sin(angle+da)), (float)(width*0.5));
glVertex3f((float)(r2*cos(angle+2*da)), (float)(r2*sin(angle+2*da)), (float)(width*0.5));
glVertex3f((float)(r1*cos(angle+3*da)), (float)(r1*sin(angle+3*da)), (float)(width*0.5));
}
glEnd();
}
glEnd();
glNormal3f(0.0, 0.0, -1.0);
glNormal3f(0.0, 0.0, -1.0);
/* draw back face */
glBegin(GL_QUAD_STRIP);
for (i=0;i<=teeth;i++) {
glBegin(GL_QUAD_STRIP);
for (i=0;i<=teeth;i++) {
angle = (float)(i * 2.0*pi / teeth);
glVertex3f((float)(r1*cos(angle)), (float)(r1*sin(angle)), (float)(-width*0.5));
glVertex3f((float)(r0*cos(angle)), (float)(r0*sin(angle)), (float)(-width*0.5));
glVertex3f((float)(r1*cos(angle+3*da)), (float)(r1*sin(angle+3*da)), (float)(-width*0.5));
glVertex3f((float)(r0*cos(angle)), (float)(r0*sin(angle)), (float)(-width*0.5));
}
glEnd();
}
glEnd();
/* draw back sides of teeth */
glBegin(GL_QUADS);
da = (float)(2.0*pi / teeth / 4.0);
for (i=0;i<teeth;i++) {
/* draw back sides of teeth */
glBegin(GL_QUADS);
da = (float)(2.0*pi / teeth / 4.0);
for (i=0;i<teeth;i++) {
angle = (float)(i * 2.0*pi / teeth);
glVertex3f((float)(r1*cos(angle+3*da)), (float)(r1*sin(angle+3*da)), (float)(-width*0.5));
glVertex3f((float)(r2*cos(angle+2*da)), (float)(r2*sin(angle+2*da)), (float)(-width*0.5));
glVertex3f((float)(r2*cos(angle+da)), (float)(r2*sin(angle+da)), (float)(-width*0.5));
glVertex3f((float)(r1*cos(angle)), (float)(r1*sin(angle)), (float)(-width*0.5));
}
glEnd();
}
glEnd();
/* draw outward faces of teeth */
glBegin(GL_QUAD_STRIP);
for (i=0;i<teeth;i++) {
/* draw outward faces of teeth */
glBegin(GL_QUAD_STRIP);
for (i=0;i<teeth;i++) {
angle = (float)(i * 2.0*pi / teeth);
glVertex3f((float)(r1*cos(angle)), (float)(r1*sin(angle)), (float)(width*0.5));
glVertex3f((float)(r1*cos(angle)), (float)(r1*sin(angle)), (float)(-width*0.5));
@ -168,22 +168,22 @@ static void gearGL(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, GL
glVertex3f((float)(r1*cos(angle+3*da)), (float)(r1*sin(angle+3*da)), (float)(width*0.5));
glVertex3f((float)(r1*cos(angle+3*da)), (float)(r1*sin(angle+3*da)), (float)(-width*0.5));
glNormal3f((float)(cos(angle)), (float)(sin(angle)), 0.0);
}
glVertex3f((float)(r1*cos(0.0)), (float)(r1*sin(0.0)), (float)(width*0.5));
glVertex3f((float)(r1*cos(0.0)), (float)(r1*sin(0.0)), (float)(-width*0.5));
glEnd();
}
glVertex3f((float)(r1*cos(0.0)), (float)(r1*sin(0.0)), (float)(width*0.5));
glVertex3f((float)(r1*cos(0.0)), (float)(r1*sin(0.0)), (float)(-width*0.5));
glEnd();
glShadeModel(GL_SMOOTH);
glShadeModel(GL_SMOOTH);
/* draw inside radius cylinder */
glBegin(GL_QUAD_STRIP);
for (i=0;i<=teeth;i++) {
/* draw inside radius cylinder */
glBegin(GL_QUAD_STRIP);
for (i=0;i<=teeth;i++) {
angle = (float)(i * 2.0*pi / teeth);
glNormal3f((float)(-cos(angle)), (float)(-sin(angle)), 0.0);
glVertex3f((float)(r0*cos(angle)), (float)(r0*sin(angle)), (float)(-width*0.5));
glVertex3f((float)(r0*cos(angle)), (float)(r0*sin(angle)), (float)(width*0.5));
}
glEnd();
}
glEnd();
}

@ -48,8 +48,8 @@
* \ingroup MEM
*/
#ifndef BLO_SYS_TYPES_H
#define BLO_SYS_TYPES_H
#ifndef MEM_SYS_TYPES_H
#define MEM_SYS_TYPES_H
#ifdef __cplusplus
extern "C" {
@ -127,5 +127,5 @@ typedef unsigned long uintptr_t;
}
#endif
#endif /* eof */
#endif /* MEM_SYS_TYPES_H */

@ -48,8 +48,8 @@
// jesterKing: renamed to superlu_sys_types.h
*/
#ifndef BLO_SYS_TYPES_H
#define BLO_SYS_TYPES_H
#ifndef SUPERLU_SYS_TYPES_H
#define SUPERLU_SYS_TYPES_H
#ifdef __cplusplus
extern "C" {
@ -129,5 +129,5 @@ typedef unsigned long uintptr_t;
}
#endif
#endif /* eof */
#endif /* SUPERLU_SYS_TYPES_H */

@ -1,2 +0,0 @@
/
/tmp/

@ -10,4 +10,4 @@ bpy.context.user_preferences.inputs.select_mouse = 'RIGHT'
bpy.context.user_preferences.inputs.view_zoom_method = 'DOLLY'
bpy.context.user_preferences.inputs.view_zoom_axis = 'VERTICAL'
bpy.context.user_preferences.inputs.view_rotate_method = 'TRACKBALL'
bpy.context.user_preferences.inputs.invert_mouse_wheel_zoom = False
bpy.context.user_preferences.inputs.invert_mouse_zoom = False

@ -7,4 +7,4 @@ bpy.context.user_preferences.inputs.select_mouse = 'LEFT'
bpy.context.user_preferences.inputs.view_zoom_method = 'DOLLY'
bpy.context.user_preferences.inputs.view_zoom_axis = 'HORIZONTAL'
bpy.context.user_preferences.inputs.view_rotate_method = 'TURNTABLE'
bpy.context.user_preferences.inputs.invert_mouse_wheel_zoom = True
bpy.context.user_preferences.inputs.invert_mouse_zoom = True

@ -20,6 +20,8 @@
import bpy
from bpy.props import EnumProperty
class MeshSelectInteriorFaces(bpy.types.Operator):
'''Select faces where all edges have more then 2 face users.'''
@ -66,17 +68,23 @@ class MeshSelectInteriorFaces(bpy.types.Operator):
class MeshMirrorUV(bpy.types.Operator):
'''Copy mirror UV coordinates on the X axis based on a mirrored mesh'''
bl_idname = "mesh.faces_miror_uv"
bl_idname = "mesh.faces_mirror_uv"
bl_label = "Copy Mirrored UV coords"
bl_options = {'REGISTER', 'UNDO'}
direction = EnumProperty(items=(
('POSITIVE', "Positive", ""),
('NEGATIVE', "Negative", "")),
name="Axis Direction",
description="")
@classmethod
def poll(cls, context):
ob = context.active_object
return (ob and ob.type == 'MESH')
def execute(self, context):
DIR = 1 # TODO, make an option
DIR = (self.direction == 'NEGATIVE')
from mathutils import Vector

@ -177,6 +177,9 @@ class SubdivisionSet(bpy.types.Operator):
if relative and level == 0:
return {'CANCELLED'} # nothing to do
if not relative and level < 0:
self.level = level = 0
def set_object_subd(obj):
for mod in obj.modifiers:
if mod.type == 'MULTIRES':

@ -264,7 +264,7 @@ class AddPresetInteraction(AddPresetBase, bpy.types.Operator):
preset_values = [
"user_preferences.edit.use_drag_immediately",
"user_preferences.edit.use_insertkey_xyz_to_rgb",
"user_preferences.inputs.invert_mouse_wheel_zoom",
"user_preferences.inputs.invert_mouse_zoom",
"user_preferences.inputs.select_mouse",
"user_preferences.inputs.use_emulate_numpad",
"user_preferences.inputs.use_mouse_continuous",

@ -395,7 +395,7 @@ class WM_MT_context_menu_enum(bpy.types.Menu):
base_path, prop_string = data_path.rsplit(".", 1)
value_base = context_path_validate(context, base_path)
values = [(i.name, i.identifier) for i in value_base.bl_rna.properties[prop_string].items]
values = [(i.name, i.identifier) for i in value_base.bl_rna.properties[prop_string].enum_items]
for name, identifier in values:
prop = self.layout.operator("wm.context_set_enum", text=name)
@ -837,6 +837,18 @@ class WM_OT_properties_add(bpy.types.Operator):
item[property] = 1.0
return {'FINISHED'}
class WM_OT_properties_context_change(bpy.types.Operator):
"Change the context tab in a Properties Window"
bl_idname = "wm.properties_context_change"
bl_label = ""
context = StringProperty(name="Context", maxlen=32)
def execute(self, context):
context.space_data.context = (self.context)
return {'FINISHED'}
class WM_OT_properties_remove(bpy.types.Operator):
'''Internal use (edit a property data_path)'''

@ -118,11 +118,8 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
def BEVEL(self, layout, ob, md):
split = layout.split()
col = split.column()
col.prop(md, "width")
col = split.column()
col.prop(md, "use_only_vertices")
split.prop(md, "width")
split.prop(md, "use_only_vertices")
layout.label(text="Limit Method:")
layout.row().prop(md, "limit_method", expand=True)
@ -186,10 +183,10 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col.prop(md, "use_transform")
def CLOTH(self, layout, ob, md):
layout.label(text="See Cloth panel.")
layout.label(text="Settings can be found inside the Physics context")
def COLLISION(self, layout, ob, md):
layout.label(text="See Collision panel.")
layout.label(text="Settings can be found inside the Physics context")
def CURVE(self, layout, ob, md):
split = layout.split()
@ -265,7 +262,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
layout.operator("object.explode_refresh", text="Refresh")
def FLUID_SIMULATION(self, layout, ob, md):
layout.label(text="See Fluid panel.")
layout.label(text="Settings can be found inside the Physics context")
def HOOK(self, layout, ob, md):
split = layout.split()
@ -444,7 +441,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col.prop(md, "random_position", text="Random", slider=True)
def PARTICLE_SYSTEM(self, layout, ob, md):
layout.label(text="See Particle panel.")
layout.label(text="Settings can be found inside the Particle context")
def SCREW(self, layout, ob, md):
split = layout.split()
@ -541,7 +538,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col.prop(md, "lock_y")
def SMOKE(self, layout, ob, md):
layout.label(text="See Smoke panel.")
layout.label(text="Settings can be found inside the Physics context")
def SMOOTH(self, layout, ob, md):
split = layout.split(percentage=0.25)
@ -559,10 +556,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
def SOFT_BODY(self, layout, ob, md):
layout.label(text="See Soft Body panel.")
layout.label(text="Settings can be found inside the Physics context")
def SOLIDIFY(self, layout, ob, md):
split = layout.split()
col = split.column()
@ -578,22 +574,21 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(md, "offset")
colsub = col.column()
colsub.active = bool(md.vertex_group)
colsub.prop(md, "invert_vertex_group", text="Invert")
sub = col.column()
sub.active = bool(md.vertex_group)
sub.prop(md, "invert_vertex_group", text="Invert")
col.prop(md, "use_even_offset")
col.prop(md, "use_quality_normals")
col.prop(md, "use_rim")
colsub = col.column()
colsub.label()
rowsub = colsub.split(align=True, percentage=0.4)
rowsub.prop(md, "material_offset", text="")
colsub = rowsub.row()
colsub.active = md.use_rim
colsub.prop(md, "material_offset_rim", text="Rim")
sub = col.column()
sub.label()
row = sub.split(align=True, percentage=0.4)
row.prop(md, "material_offset", text="")
row = row.row()
row.active = md.use_rim
row.prop(md, "material_offset_rim", text="Rim")
def SUBSURF(self, layout, ob, md):
layout.row().prop(md, "subdivision_type", expand=True)
@ -610,7 +605,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
col.prop(md, "show_only_control_edges")
def SURFACE(self, layout, ob, md):
layout.label(text="See Fields panel.")
layout.label(text="Settings can be found inside the Physics context")
def UV_PROJECT(self, layout, ob, md):
if ob.type == 'MESH':

@ -721,6 +721,15 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel, bpy.types.Panel):
col.prop(pd, "falloff", text="")
if pd.falloff == 'SOFT':
col.prop(pd, "falloff_soft")
if pd.falloff == "PARTICLE_VELOCITY":
col.prop(pd, "falloff_speed_scale")
col.prop(pd, "use_falloff_curve")
if pd.use_falloff_curve:
col = layout.column()
col.label(text="Falloff Curve")
col.template_curve_mapping(pd, "falloff_curve", brush=False)
class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel, bpy.types.Panel):

@ -91,7 +91,7 @@ class IMAGE_MT_select(bpy.types.Menu):
layout.separator()
layout.operator("uv.select_all")
layout.operator("uv.select_inverse")
layout.operator("uv.select_all", text="Inverse").action = 'INVERT'
layout.operator("uv.unlink_selected")
layout.separator()
@ -263,7 +263,7 @@ class IMAGE_MT_uvs(bpy.types.Menu):
layout.operator("uv.average_islands_scale")
layout.operator("uv.minimize_stretch")
layout.operator("uv.stitch")
layout.operator("mesh.faces_miror_uv")
layout.operator("mesh.faces_mirror_uv")
layout.separator()

@ -17,7 +17,7 @@ from bpy.props import StringProperty, BoolProperty, EnumProperty
class ExportSomeData(bpy.types.Operator, ExportHelper):
'''This appiers in the tooltip of the operator and in the generated docs.'''
'''This appears in the tooltip of the operator and in the generated docs.'''
bl_idname = "export.some_data" # this is important since its how bpy.ops.export.some_data is constructed
bl_label = "Export Some Data"

@ -157,7 +157,7 @@ void BLF_shadow_offset(int fontid, int x, int y);
*
* BLF_buffer(NULL, NULL, 0, 0, 0);
*/
void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, unsigned int w, unsigned int h, int nch);
void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch);
/*
* Set the color to be used for text.

@ -657,7 +657,7 @@ void BLF_shadow_offset(int fontid, int x, int y)
}
}
void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, unsigned int w, unsigned int h, int nch)
void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch)
{
FontBLF *font;

@ -218,7 +218,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
FT_Vector delta;
FT_UInt glyph_index;
float a, *fbuf;
int pen_x, y, x, yb;
int pen_x, y, x;
int i, has_kerning, st, chx, chy;
if (!font->glyph_cache || (!font->b_fbuf && !font->b_cbuf))
@ -276,13 +276,20 @@ void blf_font_buffer(FontBLF *font, const char *str)
/* dont draw beyond the buffer bounds */
int width_clip= g->width;
int height_clip= g->height;
int yb_start= g->pitch < 0 ? 0 : g->height-1;
if (width_clip + chx > font->bw) width_clip -= chx + width_clip - font->bw;
if (height_clip + pen_y > font->bh) height_clip -= pen_y + height_clip - font->bh;
yb= g->pitch < 0 ? 0 : g->height-1;
/* drawing below the image? */
if(pen_y < 0) {
yb_start += (g->pitch < 0) ? -pen_y : pen_y;
height_clip += pen_y;
pen_y= 0;
}
if (font->b_fbuf) {
int yb= yb_start;
for (y=(chy >= 0 ? 0:-chy); y < height_clip; y++) {
for (x=(chx >= 0 ? 0:-chx); x < width_clip; x++) {
@ -311,6 +318,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
}
if (font->b_cbuf) {
int yb= yb_start;
for (y= 0; y < height_clip; y++) {
for (x= 0; x < width_clip; x++) {
a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;

@ -200,9 +200,9 @@ typedef struct FontBLF {
/* the same but unsigned char */
unsigned char *b_cbuf;
/* buffer size. */
unsigned int bw;
unsigned int bh;
/* buffer size, keep signed so comparisons with negative values work */
int bw;
int bh;
/* number of channels. */
int bch;

@ -44,14 +44,14 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather then defining with quotes */
#define BLENDER_VERSION 257
#define BLENDER_SUBVERSION 0
#define BLENDER_SUBVERSION 1
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
/* used by packaging tools */
/* can be left blank, otherwise a,b,c... etc with no quotes */
#define BLENDER_VERSION_CHAR a
#define BLENDER_VERSION_CHAR b
/* alpha/beta/rc/release, docs use this */
#define BLENDER_VERSION_CYCLE release

@ -44,14 +44,16 @@ struct ImBuf;
struct Tex;
struct anim;
struct Scene;
struct Object;
/* call from library */
void free_image(struct Image *me);
void BKE_stamp_info(struct Scene *scene, struct ImBuf *ibuf);
void BKE_stamp_buf(struct Scene *scene, unsigned char *rect, float *rectf, int width, int height, int channels);
void BKE_stamp_info(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf);
void BKE_stamp_buf(struct Scene *scene, struct Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels);
int BKE_alphatest_ibuf(struct ImBuf *ibuf);
int BKE_write_ibuf(struct Scene *scene, struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
int BKE_write_ibuf_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
int BKE_write_ibuf(struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
void BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames);
int BKE_add_image_extension(char *string, int imtype);
int BKE_ftype_to_imtype(int ftype);

@ -55,6 +55,7 @@ struct Material *copy_material(struct Material *ma);
struct Material *localize_material(struct Material *ma);
struct Material *give_node_material(struct Material *ma); /* returns node material or self */
void make_local_material(struct Material *ma);
void extern_local_matarar(struct Material **matar, short totcol);
void automatname(struct Material *);

@ -66,7 +66,6 @@ void free_mesh(struct Mesh *me);
struct Mesh *add_mesh(const char *name);
struct Mesh *copy_mesh(struct Mesh *me);
void mesh_update_customdata_pointers(struct Mesh *me);
void make_local_tface(struct Mesh *me);
void make_local_mesh(struct Mesh *me);
void boundbox_mesh(struct Mesh *me, float *loc, float *size);
void tex_space_mesh(struct Mesh *me);

@ -91,7 +91,6 @@ struct Object *add_only_object(int type, const char *name);
struct Object *add_object(struct Scene *scene, int type);
struct Object *copy_object(struct Object *ob);
void expand_local_object(struct Object *ob);
void make_local_object(struct Object *ob);
int object_is_libdata(struct Object *ob);
int object_data_is_libdata(struct Object *ob);

@ -330,7 +330,7 @@ struct Sequence *sequencer_add_sound_strip(struct bContext *C, ListBase *seqbase
struct Sequence *sequencer_add_movie_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load);
/* view3d draw callback, run when not in background view */
typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, int, int, unsigned int, int, char[256]);
typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, struct Object *, int, int, unsigned int, int, char[256]);
extern SequencerDrawView sequencer_view3d_cb;
/* copy/paste */

@ -90,7 +90,7 @@ void space_transform_invert(const struct SpaceTransform *data, float *co);
* - Normal projection
*
* ShrinkwrapCalcData encapsulates all needed data for shrinkwrap functions.
* (So that you dont have to pass an enormous ammount of arguments to functions)
* (So that you dont have to pass an enormous amount of arguments to functions)
*/
struct Object;

@ -284,6 +284,10 @@ endif()
if(WITH_PYTHON)
list(APPEND INC ../python ${PYTHON_INCLUDE_DIRS})
add_definitions(-DWITH_PYTHON)
if(WITH_PYTHON_SECURITY)
add_definitions(-DWITH_PYTHON_SECURITY)
endif()
endif()
if(WITH_OPENMP)

@ -2558,7 +2558,6 @@ static void GetNormal(const SMikkTSpaceContext * pContext, float fNorm[], const
else {
const short *no= pMesh->mvert[(&pMesh->mface[face_num].v1)[vert_index]].no;
normal_short_to_float_v3(fNorm, no);
normalize_v3(fNorm); /* XXX, is this needed */
}
}
static void SetTSpace(const SMikkTSpaceContext * pContext, const float fvTangent[], const float fSign, const int face_num, const int iVert)

@ -95,6 +95,7 @@ bAction *add_empty_action(const char name[])
void make_local_action(bAction *act)
{
// Object *ob;
Main *bmain= G.main;
bAction *actn;
int local=0, lib=0;
@ -102,7 +103,7 @@ void make_local_action(bAction *act)
if (act->id.us==1) {
act->id.lib= NULL;
act->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)act, NULL);
new_id(&bmain->action, (ID *)act, NULL);
return;
}
@ -121,7 +122,7 @@ void make_local_action(bAction *act)
act->id.lib= NULL;
act->id.flag= LIB_LOCAL;
//make_local_action_channels(act);
new_id(NULL, (ID *)act, NULL);
new_id(&bmain->action, (ID *)act, NULL);
}
else if(local && lib) {
actn= copy_action(act);
@ -419,11 +420,11 @@ bPoseChannel *verify_pose_channel(bPose *pose, const char *name)
return NULL;
/* See if this channel exists */
for (chan=pose->chanbase.first; chan; chan=chan->next) {
if (!strcmp (name, chan->name))
return chan;
chan= BLI_findstring(&pose->chanbase, name, offsetof(bPoseChannel, name));
if(chan) {
return chan;
}
/* If not, create it and add it */
chan = MEM_callocN(sizeof(bPoseChannel), "verifyPoseChannel");

@ -195,7 +195,7 @@ AnimData *BKE_copy_animdata (AnimData *adt, const short do_action)
dadt= MEM_dupallocN(adt);
/* make a copy of action - at worst, user has to delete copies... */
if(do_action) {
if (do_action) {
dadt->action= copy_action(adt->action);
dadt->tmpact= copy_action(adt->tmpact);
}
@ -217,11 +217,11 @@ AnimData *BKE_copy_animdata (AnimData *adt, const short do_action)
return dadt;
}
int BKE_copy_animdata_id(struct ID *id_to, struct ID *id_from, const short do_action)
int BKE_copy_animdata_id (ID *id_to, ID *id_from, const short do_action)
{
AnimData *adt;
if((id_to && id_from) && (GS(id_to->name) != GS(id_from->name)))
if ((id_to && id_from) && (GS(id_to->name) != GS(id_from->name)))
return 0;
BKE_free_animdata(id_to);
@ -238,13 +238,13 @@ int BKE_copy_animdata_id(struct ID *id_to, struct ID *id_from, const short do_ac
void BKE_copy_animdata_id_action(struct ID *id)
{
AnimData *adt= BKE_animdata_from_id(id);
if(adt) {
if(adt->action) {
((ID *)adt->action)->us--;
if (adt) {
if (adt->action) {
id_us_min((ID *)adt->action);
adt->action= copy_action(adt->action);
}
if(adt->tmpact) {
((ID *)adt->tmpact)->us--;
if (adt->tmpact) {
id_us_min((ID *)adt->tmpact);
adt->tmpact= copy_action(adt->tmpact);
}
}

@ -137,39 +137,42 @@ void free_armature(bArmature *arm)
void make_local_armature(bArmature *arm)
{
Main *bmain= G.main;
int local=0, lib=0;
Object *ob;
bArmature *newArm;
if (arm->id.lib==NULL)
return;
if (arm->id.lib==NULL) return;
if (arm->id.us==1) {
arm->id.lib= NULL;
arm->id.flag= LIB_LOCAL;
new_id(NULL, (ID*)arm, NULL);
new_id(&bmain->armature, (ID*)arm, NULL);
return;
}
for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
if(ob->data == arm) {
if(ob->id.lib) lib= 1;
else local= 1;
}
}
if(local && lib==0) {
arm->id.lib= NULL;
arm->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)arm, NULL);
new_id(&bmain->armature, (ID *)arm, NULL);
}
else if(local && lib) {
newArm= copy_armature(arm);
newArm->id.us= 0;
bArmature *armn= copy_armature(arm);
armn->id.us= 0;
ob= G.main->object.first;
while(ob) {
if(ob->data==arm) {
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data == arm) {
if(ob->id.lib==NULL) {
ob->data= newArm;
newArm->id.us++;
ob->data= armn;
armn->id.us++;
arm->id.us--;
}
}
ob= ob->id.next;
}
}
}

@ -140,8 +140,12 @@ void initglobals(void)
G.charstart = 0x0000;
G.charmin = 0x0000;
G.charmax = 0xffff;
#ifndef WITH_PYTHON_SECURITY /* default */
G.f |= G_SCRIPT_AUTOEXEC;
#else
G.f &= ~G_SCRIPT_AUTOEXEC;
#endif
}
/***/

@ -1299,7 +1299,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
bpa->data.mode = eBoidMode_OnLand;
}
/* fly above ground */
else {
else if(bpa->ground) {
pa->state.co[2] = ground_co[2] + pa->size * boids->height;
pa->state.vel[2] = 0.0f;
}

@ -180,14 +180,20 @@ void free_brush(Brush *brush)
curvemapping_free(brush->curve);
}
static void extern_local_brush(Brush *brush)
{
id_lib_extern((ID *)brush->mtex.tex);
}
void make_local_brush(Brush *brush)
{
/* - only lib users: do nothing
* - only local users: set flag
* - mixed: make copy
*/
Brush *brushn;
* - only local users: set flag
* - mixed: make copy
*/
Main *bmain= G.main;
Scene *scene;
int local= 0, lib= 0;
@ -197,19 +203,22 @@ void make_local_brush(Brush *brush)
/* special case: ima always local immediately */
brush->clone.image->id.lib= NULL;
brush->clone.image->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)brush->clone.image, NULL);
new_id(&bmain->brush, (ID *)brush->clone.image, NULL);
extern_local_brush(brush);
}
for(scene= G.main->scene.first; scene; scene=scene->id.next)
for(scene= bmain->scene.first; scene && ELEM(0, lib, local); scene=scene->id.next) {
if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
if(scene->id.lib) lib= 1;
else local= 1;
}
}
if(local && lib==0) {
brush->id.lib= NULL;
brush->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)brush, NULL);
new_id(&bmain->brush, (ID *)brush, NULL);
extern_local_brush(brush);
/* enable fake user by default */
if (!(brush->id.flag & LIB_FAKEUSER)) {
@ -218,17 +227,19 @@ void make_local_brush(Brush *brush)
}
}
else if(local && lib) {
brushn= copy_brush(brush);
Brush *brushn= copy_brush(brush);
brushn->id.us= 1; /* only keep fake user */
brushn->id.flag |= LIB_FAKEUSER;
for(scene= G.main->scene.first; scene; scene=scene->id.next)
if(paint_brush(&scene->toolsettings->imapaint.paint)==brush)
for(scene= bmain->scene.first; scene; scene=scene->id.next) {
if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
if(scene->id.lib==NULL) {
paint_brush_set(&scene->toolsettings->imapaint.paint, brushn);
brushn->id.us++;
brush->id.us--;
}
}
}
}
}

@ -172,11 +172,7 @@ static void cdDM_getVertCos(DerivedMesh *dm, float (*cos_r)[3])
static void cdDM_getVertNo(DerivedMesh *dm, int index, float no_r[3])
{
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
short *no = cddm->mvert[index].no;
no_r[0] = no[0]/32767.f;
no_r[1] = no[1]/32767.f;
no_r[2] = no[2]/32767.f;
normal_short_to_float_v3(no_r, cddm->mvert[index].no);
}
static ListBase *cdDM_getFaceMap(Object *ob, DerivedMesh *dm)
@ -580,8 +576,9 @@ static void cdDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned cha
/* there's a conflict here... twosided colors versus culling...? */
/* defined by history, only texture faces have culling option */
/* we need that as mesh option builtin, next to double sided lighting */
if(col1 && col2)
if(col2) {
glEnable(GL_CULL_FACE);
}
cdDM_update_normals_from_pbvh(dm);
@ -773,6 +770,19 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
}
if( !GPU_buffer_legacy(dm) ) {
/* warning!, this logic is incorrect, see bug [#27175]
* firstly, there are no checks for changes in context, such as texface image.
* secondly, drawParams() sets the GL context, so checking if there is a change
* from lastFlag is too late once glDrawArrays() runs, since drawing the arrays
* will use the modified, OpenGL settings.
*
* However its tricky to fix this without duplicating the internal logic
* of drawParams(), perhaps we need an argument like...
* drawParams(..., keep_gl_state_but_return_when_changed) ?.
*
* We could also just disable VBO's here, since texface may be deprecated - campbell.
*/
glShadeModel( GL_SMOOTH );
lastFlag = 0;
for(i = 0; i < dm->drawObject->nelements/3; i++) {

@ -451,11 +451,10 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res
C->data.recursion= 1;
for(entry=C->wm.store->entries.first; entry; entry=entry->next) {
if(strcmp(entry->name, member) == 0) {
result->ptr= entry->ptr;
done= 1;
}
entry= BLI_findstring(&C->wm.store->entries, member, offsetof(bContextStoreEntry, name));
if(entry) {
result->ptr= entry->ptr;
done= 1;
}
}
if(done!=1 && recursion < 2 && C->wm.region) {
@ -649,7 +648,7 @@ int CTX_data_equals(const char *member, const char *str)
int CTX_data_dir(const char *member)
{
return (strcmp(member, "") == 0);
return member[0] == '\0';
}
void CTX_data_id_pointer_set(bContextDataResult *result, ID *id)

@ -63,7 +63,8 @@
#include "BKE_key.h"
#include "BKE_library.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_object.h"
#include "BKE_material.h"
#include "ED_curve.h"
@ -216,10 +217,22 @@ Curve *copy_curve(Curve *cu)
return cun;
}
static void extern_local_curve(Curve *cu)
{
id_lib_extern((ID *)cu->vfont);
id_lib_extern((ID *)cu->vfontb);
id_lib_extern((ID *)cu->vfonti);
id_lib_extern((ID *)cu->vfontbi);
if(cu->mat) {
extern_local_matarar(cu->mat, cu->totcol);
}
}
void make_local_curve(Curve *cu)
{
Object *ob = NULL;
Curve *cun;
Main *bmain= G.main;
Object *ob;
int local=0, lib=0;
/* - when there are only lib users: don't do
@ -229,47 +242,41 @@ void make_local_curve(Curve *cu)
if(cu->id.lib==NULL) return;
if(cu->vfont) cu->vfont->id.lib= NULL;
if(cu->vfontb) cu->vfontb->id.lib= NULL;
if(cu->vfonti) cu->vfonti->id.lib= NULL;
if(cu->vfontbi) cu->vfontbi->id.lib= NULL;
if(cu->id.us==1) {
cu->id.lib= NULL;
cu->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)cu, NULL);
new_id(&bmain->curve, (ID *)cu, NULL);
extern_local_curve(cu);
return;
}
ob= G.main->object.first;
while(ob) {
if(ob->data==cu) {
for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
if(ob->data == cu) {
if(ob->id.lib) lib= 1;
else local= 1;
}
ob= ob->id.next;
}
if(local && lib==0) {
cu->id.lib= NULL;
cu->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)cu, NULL);
new_id(&bmain->curve, (ID *)cu, NULL);
extern_local_curve(cu);
}
else if(local && lib) {
cun= copy_curve(cu);
Curve *cun= copy_curve(cu);
cun->id.us= 0;
ob= G.main->object.first;
while(ob) {
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data==cu) {
if(ob->id.lib==NULL) {
ob->data= cun;
cun->id.us++;
cu->id.us--;
}
}
ob= ob->id.next;
}
}
}

@ -1905,7 +1905,9 @@ static void dag_scene_flush_layers(Scene *sce, int lay)
}
/* ensure cameras are set as if they are on a visible layer, because
they ared still used for rendering or setting the camera view */
* they ared still used for rendering or setting the camera view
*
* XXX, this wont work for local view / unlocked camera's */
if(sce->camera) {
node= dag_get_node(sce->theDag, sce->camera);
node->scelay |= lay;

@ -386,7 +386,7 @@ VFont *load_vfont(const char *name)
vfont->data = vfd;
/* if there's a font name, use it for the ID name */
if (strcmp(vfd->name, "")!=0) {
if (vfd->name[0] != '\0') {
BLI_strncpy(vfont->id.name+2, vfd->name, sizeof(vfont->id.name)-2);
}
BLI_strncpy(vfont->name, name, sizeof(vfont->name));

@ -426,35 +426,30 @@ static IDProperty *IDP_CopyGroup(IDProperty *prop)
* When values name and types match, copy the values, else ignore */
void IDP_SyncGroupValues(IDProperty *dest, IDProperty *src)
{
IDProperty *loop, *prop;
IDProperty *other, *prop;
for (prop=src->data.group.first; prop; prop=prop->next) {
for (loop=dest->data.group.first; loop; loop=loop->next) {
if (strcmp(loop->name, prop->name)==0) {
if(prop->type==loop->type) {
other= BLI_findstring(&dest->data.group, prop->name, offsetof(IDProperty, name));
if (other && prop->type==other->type) {
switch (prop->type) {
case IDP_INT:
case IDP_FLOAT:
case IDP_DOUBLE:
other->data= prop->data;
break;
case IDP_GROUP:
IDP_SyncGroupValues(other, prop);
break;
default:
{
IDProperty *tmp= other;
IDProperty *copy= IDP_CopyProperty(prop);
switch (prop->type) {
case IDP_INT:
case IDP_FLOAT:
case IDP_DOUBLE:
loop->data= prop->data;
break;
case IDP_GROUP:
IDP_SyncGroupValues(loop, prop);
break;
default:
{
IDProperty *tmp= loop;
IDProperty *copy= IDP_CopyProperty(prop);
BLI_insertlinkafter(&dest->data.group, other, copy);
BLI_remlink(&dest->data.group, tmp);
BLI_insertlinkafter(&dest->data.group, loop, copy);
BLI_remlink(&dest->data.group, tmp);
IDP_FreeProperty(tmp);
MEM_freeN(tmp);
}
}
IDP_FreeProperty(tmp);
MEM_freeN(tmp);
}
break;
}
}
}

@ -880,7 +880,7 @@ typedef struct StampData {
char rendertime[64];
} StampData;
static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix)
static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int do_prefix)
{
char text[256];
struct tm *tl;
@ -959,14 +959,14 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix)
}
if (scene->r.stamp & R_STAMP_CAMERA) {
BLI_snprintf(stamp_data->camera, sizeof(stamp_data->camera), do_prefix ? "Camera %s":"%s", scene->camera ? scene->camera->id.name+2 : "<none>");
BLI_snprintf(stamp_data->camera, sizeof(stamp_data->camera), do_prefix ? "Camera %s":"%s", camera ? camera->id.name+2 : "<none>");
} else {
stamp_data->camera[0] = '\0';
}
if (scene->r.stamp & R_STAMP_CAMERALENS) {
if (scene->camera && scene->camera->type == OB_CAMERA) {
BLI_snprintf(text, sizeof(text), "%.2f", ((Camera *)scene->camera->data)->lens);
if (camera && camera->type == OB_CAMERA) {
BLI_snprintf(text, sizeof(text), "%.2f", ((Camera *)camera->data)->lens);
}
else strcpy(text, "<none>");
@ -1006,18 +1006,18 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix)
}
}
void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, int height, int channels)
void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels)
{
struct StampData stamp_data;
float w, h, pad;
int x, y;
int x, y, y_ofs;
float h_fixed;
const int mono= blf_mono_font_render; // XXX
if (!rect && !rectf)
return;
stampdata(scene, &stamp_data, 1);
stampdata(scene, camera, &stamp_data, 1);
/* TODO, do_versions */
if(scene->r.stamp_font_id < 8)
@ -1034,8 +1034,17 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
// BLF_width_and_height(mono, "^|/_AgPpJjlYy", &w, &h_fixed);
{
rctf box;
float baseline;
BLF_boundbox(mono, "^|/_AgPpJjlYy", &box);
h_fixed= box.ymax - box.ymin;
/* crude way to get the decent line from A->j*/
BLF_boundbox(mono, "A", &box);
baseline= box.ymin;
BLF_boundbox(mono, "j", &box);
y_ofs = (int)(baseline - box.ymin);
if(y_ofs < 0) y_ofs= 0; /* should never happen */
y_ofs++;
}
x= 0;
@ -1050,7 +1059,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y-3, w+3, y+h+2);
/* and draw the text. */
BLF_position(mono, x, y, 0.0);
BLF_position(mono, x, y + y_ofs, 0.0);
BLF_draw_buffer(mono, stamp_data.file);
/* the extra pixel for background. */
@ -1065,7 +1074,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
/* and space for background. */
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-3, w+3, y+h+2);
BLF_position(mono, x, y+1, 0.0);
BLF_position(mono, x, y + y_ofs, 0.0);
BLF_draw_buffer(mono, stamp_data.note);
/* the extra pixel for background. */
@ -1080,7 +1089,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
/* and space for background. */
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-3, w+3, y+h+2);
BLF_position(mono, x, y, 0.0);
BLF_position(mono, x, y + y_ofs, 0.0);
BLF_draw_buffer(mono, stamp_data.date);
/* the extra pixel for background. */
@ -1095,7 +1104,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
/* and space for background. */
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-3, w+3, y+h+2);
BLF_position(mono, x, y, 0.0);
BLF_position(mono, x, y + y_ofs, 0.0);
BLF_draw_buffer(mono, stamp_data.rendertime);
}
@ -1110,7 +1119,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, w+2, y+h+2);
/* and pad the text. */
BLF_position(mono, x, y+3, 0.0);
BLF_position(mono, x, y + y_ofs, 0.0);
BLF_draw_buffer(mono, stamp_data.marker);
/* space width. */
@ -1125,7 +1134,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+2);
/* and pad the text. */
BLF_position(mono, x, y+3, 0.0);
BLF_position(mono, x, y + y_ofs, 0.0);
BLF_draw_buffer(mono, stamp_data.time);
/* space width. */
@ -1139,7 +1148,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+2);
/* and pad the text. */
BLF_position(mono, x, y+3, 0.0);
BLF_position(mono, x, y + y_ofs, 0.0);
BLF_draw_buffer(mono, stamp_data.frame);
/* space width. */
@ -1151,7 +1160,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
/* extra space for background. */
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+2);
BLF_position(mono, x, y+3, 0.0);
BLF_position(mono, x, y + y_ofs, 0.0);
BLF_draw_buffer(mono, stamp_data.camera);
/* space width. */
@ -1163,7 +1172,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
/* extra space for background. */
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+2);
BLF_position(mono, x, y+3, 0.0);
BLF_position(mono, x, y + y_ofs, 0.0);
BLF_draw_buffer(mono, stamp_data.cameralens);
}
@ -1177,7 +1186,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+3, y+h+2);
/* and pad the text. */
BLF_position(mono, x, y+3, 0.0);
BLF_position(mono, x, y+y_ofs, 0.0);
BLF_draw_buffer(mono, stamp_data.scene);
}
@ -1191,7 +1200,7 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
/* extra space for background. */
buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y-3, x+w+pad, y+h+2);
BLF_position(mono, x, y, 0.0);
BLF_position(mono, x, y + y_ofs, 0.0);
BLF_draw_buffer(mono, stamp_data.strip);
}
@ -1199,14 +1208,14 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
BLF_buffer(mono, NULL, NULL, 0, 0, 0);
}
void BKE_stamp_info(Scene *scene, struct ImBuf *ibuf)
void BKE_stamp_info(Scene *scene, Object *camera, struct ImBuf *ibuf)
{
struct StampData stamp_data;
if (!ibuf) return;
/* fill all the data values, no prefix */
stampdata(scene, &stamp_data, 0);
stampdata(scene, camera, &stamp_data, 0);
if (stamp_data.file[0]) IMB_metadata_change_field (ibuf, "File", stamp_data.file);
if (stamp_data.note[0]) IMB_metadata_change_field (ibuf, "Note", stamp_data.note);
@ -1244,7 +1253,7 @@ int BKE_alphatest_ibuf(ImBuf *ibuf)
return FALSE;
}
int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality)
int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality)
{
int ok;
(void)subimtype; /* quies unused warnings */
@ -1339,9 +1348,6 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, const char *name, int imtype, int
}
BLI_make_existing_file(name);
if(scene && scene->r.stamp & R_STAMP_ALL)
BKE_stamp_info(scene, ibuf);
ok = IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat);
if (ok == 0) {
@ -1351,6 +1357,14 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, const char *name, int imtype, int
return(ok);
}
int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality)
{
if(scene && scene->r.stamp & R_STAMP_ALL)
BKE_stamp_info(scene, camera, ibuf);
return BKE_write_ibuf(ibuf, name, imtype, subimtype, quality);
}
void BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames)
{

@ -249,8 +249,8 @@ void free_lattice(Lattice *lt)
void make_local_lattice(Lattice *lt)
{
Main *bmain= G.main;
Object *ob;
Lattice *ltn;
int local=0, lib=0;
/* - only lib users: do nothing
@ -262,39 +262,34 @@ void make_local_lattice(Lattice *lt)
if(lt->id.us==1) {
lt->id.lib= NULL;
lt->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)lt, NULL);
new_id(&bmain->latt, (ID *)lt, NULL);
return;
}
ob= G.main->object.first;
while(ob) {
for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
if(ob->data==lt) {
if(ob->id.lib) lib= 1;
else local= 1;
}
ob= ob->id.next;
}
if(local && lib==0) {
lt->id.lib= NULL;
lt->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)lt, NULL);
new_id(&bmain->latt, (ID *)lt, NULL);
}
else if(local && lib) {
ltn= copy_lattice(lt);
Lattice *ltn= copy_lattice(lt);
ltn->id.us= 0;
ob= G.main->object.first;
while(ob) {
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data==lt) {
if(ob->id.lib==NULL) {
ob->data= ltn;
ltn->id.us++;
lt->id.us--;
}
}
ob= ob->id.next;
}
}
}

@ -268,6 +268,14 @@ Material *localize_material(Material *ma)
return man;
}
static void extern_local_material(Material *ma)
{
int i;
for(i=0; i < MAX_MTEX; i++) {
if(ma->mtex[i]) id_lib_extern((ID *)ma->mtex[i]->tex);
}
}
void make_local_material(Material *ma)
{
Main *bmain= G.main;
@ -287,11 +295,9 @@ void make_local_material(Material *ma)
if(ma->id.us==1) {
ma->id.lib= NULL;
ma->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)ma, NULL);
for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a]) id_lib_extern((ID *)ma->mtex[a]->tex);
}
new_id(&bmain->mat, (ID *)ma, NULL);
extern_local_material(ma);
return;
}
@ -351,12 +357,9 @@ void make_local_material(Material *ma)
if(local && lib==0) {
ma->id.lib= NULL;
ma->id.flag= LIB_LOCAL;
for(a=0; a<MAX_MTEX; a++) {
if(ma->mtex[a]) id_lib_extern((ID *)ma->mtex[a]->tex);
}
new_id(NULL, (ID *)ma, NULL);
new_id(&bmain->mat, (ID *)ma, NULL);
extern_local_material(ma);
}
else if(local && lib) {
@ -430,6 +433,15 @@ void make_local_material(Material *ma)
}
}
/* for curve, mball, mesh types */
void extern_local_matarar(struct Material **matar, short totcol)
{
short i;
for(i= 0; i < totcol; i++) {
id_lib_extern((ID *)matar[i]);
}
}
Material ***give_matarar(Object *ob)
{
Mesh *me;

@ -67,6 +67,7 @@
#include "BKE_displist.h"
#include "BKE_mball.h"
#include "BKE_object.h"
#include "BKE_material.h"
/* Global variables */
@ -139,10 +140,17 @@ MetaBall *copy_mball(MetaBall *mb)
return mbn;
}
static void extern_local_mball(MetaBall *mb)
{
if(mb->mat) {
extern_local_matarar(mb->mat, mb->totcol);
}
}
void make_local_mball(MetaBall *mb)
{
Main *bmain= G.main;
Object *ob;
MetaBall *mbn;
int local=0, lib=0;
/* - only lib users: do nothing
@ -154,37 +162,38 @@ void make_local_mball(MetaBall *mb)
if(mb->id.us==1) {
mb->id.lib= NULL;
mb->id.flag= LIB_LOCAL;
new_id(&bmain->mball, (ID *)mb, NULL);
extern_local_mball(mb);
return;
}
ob= G.main->object.first;
while(ob) {
if(ob->data==mb) {
for(ob= G.main->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
if(ob->data == mb) {
if(ob->id.lib) lib= 1;
else local= 1;
}
ob= ob->id.next;
}
if(local && lib==0) {
mb->id.lib= NULL;
mb->id.flag= LIB_LOCAL;
new_id(&bmain->mball, (ID *)mb, NULL);
extern_local_mball(mb);
}
else if(local && lib) {
mbn= copy_mball(mb);
MetaBall *mbn= copy_mball(mb);
mbn->id.us= 0;
ob= G.main->object.first;
while(ob) {
if(ob->data==mb) {
for(ob= G.main->object.first; ob; ob= ob->id.next) {
if(ob->data == mb) {
if(ob->id.lib==NULL) {
ob->data= mbn;
mbn->id.us++;
mb->id.us--;
}
}
ob= ob->id.next;
}
}
}

@ -247,7 +247,7 @@ Mesh *copy_mesh(Mesh *me)
return men;
}
void make_local_tface(Mesh *me)
static void make_local_tface(Main *bmain, Mesh *me)
{
MTFace *tface;
Image *ima;
@ -264,7 +264,7 @@ void make_local_tface(Mesh *me)
if(ima->id.lib) {
ima->id.lib= NULL;
ima->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)ima, NULL);
new_id(&bmain->image, (ID *)ima, NULL);
}
}
}
@ -272,58 +272,65 @@ void make_local_tface(Mesh *me)
}
}
static void expand_local_mesh(Main *bmain, Mesh *me)
{
id_lib_extern((ID *)me->texcomesh);
if(me->mtface) {
/* why is this an exception? - should not really make local when extern'ing - campbell */
make_local_tface(bmain, me);
}
if(me->mat) {
extern_local_matarar(me->mat, me->totcol);
}
}
void make_local_mesh(Mesh *me)
{
Main *bmain= G.main;
Object *ob;
Mesh *men;
int local=0, lib=0;
/* - only lib users: do nothing
* - only local users: set flag
* - mixed: make copy
*/
* - only local users: set flag
* - mixed: make copy
*/
if(me->id.lib==NULL) return;
if(me->id.us==1) {
me->id.lib= NULL;
me->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)me, NULL);
if(me->mtface) make_local_tface(me);
new_id(&bmain->mesh, (ID *)me, NULL);
expand_local_mesh(bmain, me);
return;
}
ob= bmain->object.first;
while(ob) {
if( me==get_mesh(ob) ) {
for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
if(me == ob->data) {
if(ob->id.lib) lib= 1;
else local= 1;
}
ob= ob->id.next;
}
if(local && lib==0) {
me->id.lib= NULL;
me->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)me, NULL);
if(me->mtface) make_local_tface(me);
new_id(&bmain->mesh, (ID *)me, NULL);
expand_local_mesh(bmain, me);
}
else if(local && lib) {
men= copy_mesh(me);
Mesh *men= copy_mesh(me);
men->id.us= 0;
ob= bmain->object.first;
while(ob) {
if( me==get_mesh(ob) ) {
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(me == ob->data) {
if(ob->id.lib==NULL) {
set_mesh(ob, men);
}
}
ob= ob->id.next;
}
}
}

@ -307,7 +307,9 @@ int BKE_mesh_validate_arrays(Mesh *me, MVert *UNUSED(mverts), unsigned int totve
int BKE_mesh_validate(Mesh *me, int do_verbose)
{
printf("MESH: %s\n", me->id.name+2);
if(do_verbose) {
printf("MESH: %s\n", me->id.name+2);
}
return BKE_mesh_validate_arrays(me, me->mvert, me->totvert, me->medge, me->totedge, me->mface, me->totface, do_verbose, TRUE);
}

@ -2244,16 +2244,40 @@ static void group_tag_used_outputs(bNode *gnode, bNodeStack *stack, bNodeStack *
}
}
/* set stack types (for local stack entries) */
for(sock= node->outputs.first; sock; sock= sock->next) {
bNodeStack *ns = get_socket_stack(stack, sock, NULL);
if (ns)
ns->sockettype = sock->type;
}
/* non-composite trees do all nodes by default */
if (ntree->type!=NTREE_COMPOSIT)
node->need_exec = 1;
for(sock= node->inputs.first; sock; sock= sock->next) {
bNodeStack *ns = get_socket_stack(stack, sock, gin);
if (ns) {
ns->hasoutput = 1;
/* sock type is needed to detect rgba or value or vector types */
if(sock->link && sock->link->fromsock)
ns->sockettype= sock->link->fromsock->type;
else
sock->ns.sockettype= sock->type;
}
if(sock->link) {
bNodeLink *link= sock->link;
/* this is the test for a cyclic case */
if(link->fromnode && link->tonode) {
if(link->fromnode->level >= link->tonode->level && link->tonode->level!=0xFFF);
else {
node->need_exec= 0;
}
}
}
}
/* set stack types (for local stack entries) */
for(sock= node->outputs.first; sock; sock= sock->next) {
bNodeStack *ns = get_socket_stack(stack, sock, gin);
if (ns)
ns->sockettype = sock->type;
}
}
}

@ -97,6 +97,7 @@
#include "BKE_scene.h"
#include "BKE_sequencer.h"
#include "BKE_softbody.h"
#include "BKE_material.h"
#include "LBM_fluidsim.h"
@ -746,51 +747,45 @@ void make_local_camera(Camera *cam)
{
Main *bmain= G.main;
Object *ob;
Camera *camn;
int local=0, lib=0;
/* - only lib users: do nothing
* - only local users: set flag
* - mixed: make copy
*/
* - only local users: set flag
* - mixed: make copy
*/
if(cam->id.lib==NULL) return;
if(cam->id.us==1) {
cam->id.lib= NULL;
cam->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)cam, NULL);
new_id(&bmain->camera, (ID *)cam, NULL);
return;
}
ob= bmain->object.first;
while(ob) {
for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
if(ob->data==cam) {
if(ob->id.lib) lib= 1;
else local= 1;
}
ob= ob->id.next;
}
if(local && lib==0) {
cam->id.lib= NULL;
cam->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)cam, NULL);
new_id(&bmain->camera, (ID *)cam, NULL);
}
else if(local && lib) {
camn= copy_camera(cam);
Camera *camn= copy_camera(cam);
camn->id.us= 0;
ob= bmain->object.first;
while(ob) {
if(ob->data==cam) {
for(ob= bmain->object.first; ob; ob= ob->id.next) {
if(ob->data == cam) {
if(ob->id.lib==NULL) {
ob->data= camn;
camn->id.us++;
cam->id.us--;
}
}
ob= ob->id.next;
}
}
}
@ -907,7 +902,7 @@ void make_local_lamp(Lamp *la)
if(la->id.us==1) {
la->id.lib= NULL;
la->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)la, NULL);
new_id(&bmain->lamp, (ID *)la, NULL);
return;
}
@ -923,7 +918,7 @@ void make_local_lamp(Lamp *la)
if(local && lib==0) {
la->id.lib= NULL;
la->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)la, NULL);
new_id(&bmain->lamp, (ID *)la, NULL);
}
else if(local && lib) {
lan= copy_lamp(la);
@ -1376,11 +1371,10 @@ Object *copy_object(Object *ob)
return obn;
}
void expand_local_object(Object *ob)
static void extern_local_object(Object *ob)
{
//bActionStrip *strip;
ParticleSystem *psys;
int a;
#if 0 // XXX old animation system
id_lib_extern((ID *)ob->action);
@ -1388,10 +1382,11 @@ void expand_local_object(Object *ob)
#endif // XXX old animation system
id_lib_extern((ID *)ob->data);
id_lib_extern((ID *)ob->dup_group);
for(a=0; a<ob->totcol; a++) {
id_lib_extern((ID *)ob->mat[a]);
}
id_lib_extern((ID *)ob->poselib);
id_lib_extern((ID *)ob->gpd);
extern_local_matarar(ob->mat, ob->totcol);
#if 0 // XXX old animation system
for (strip=ob->nlastrips.first; strip; strip=strip->next) {
id_lib_extern((ID *)strip->act);
@ -1404,16 +1399,15 @@ void expand_local_object(Object *ob)
void make_local_object(Object *ob)
{
Main *bmain= G.main;
Object *obn;
Scene *sce;
Base *base;
int local=0, lib=0;
/* - only lib users: do nothing
* - only local users: set flag
* - mixed: make copy
*/
* - only local users: set flag
* - mixed: make copy
*/
if(ob->id.lib==NULL) return;
ob->proxy= ob->proxy_from= NULL;
@ -1421,31 +1415,23 @@ void make_local_object(Object *ob)
if(ob->id.us==1) {
ob->id.lib= NULL;
ob->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)ob, NULL);
new_id(&bmain->object, (ID *)ob, NULL);
}
else {
sce= bmain->scene.first;
while(sce) {
base= sce->base.first;
while(base) {
if(base->object==ob) {
if(sce->id.lib) lib++;
else local++;
break;
}
base= base->next;
for(sce= bmain->scene.first; sce && ELEM(0, lib, local); sce= sce->id.next) {
if(object_in_scene(ob, sce)) {
if(sce->id.lib) lib= 1;
else local= 1;
}
sce= sce->id.next;
}
if(local && lib==0) {
ob->id.lib= NULL;
ob->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)ob, NULL);
new_id(&bmain->object, (ID *)ob, NULL);
}
else if(local && lib) {
obn= copy_object(ob);
Object *obn= copy_object(ob);
obn->id.us= 0;
sce= bmain->scene.first;
@ -1466,7 +1452,7 @@ void make_local_object(Object *ob)
}
}
expand_local_object(ob);
extern_local_object(ob);
}
/*
@ -1574,7 +1560,10 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
ob->rotmode= target->rotmode;
mul_m4_m4m4(ob->obmat, target->obmat, gob->obmat);
if(gob->dup_group) { /* should always be true */
sub_v3_v3(ob->obmat[3], gob->dup_group->dupli_ofs);
float tvec[3];
copy_v3_v3(tvec, gob->dup_group->dupli_ofs);
mul_mat3_m4_v3(ob->obmat, tvec);
sub_v3_v3(ob->obmat[3], tvec);
}
object_apply_mat4(ob, ob->obmat, FALSE, TRUE);
}
@ -2570,7 +2559,10 @@ void object_handle_update(Scene *scene, Object *ob)
invert_m4_m4(obg->imat, obg->obmat);
mul_m4_m4m4(ob->obmat, ob->proxy_from->obmat, obg->imat);
if(obg->dup_group) { /* should always be true */
add_v3_v3(ob->obmat[3], obg->dup_group->dupli_ofs);
float tvec[3];
copy_v3_v3(tvec, obg->dup_group->dupli_ofs);
mul_mat3_m4_v3(ob->obmat, tvec);
sub_v3_v3(ob->obmat[3], tvec);
}
}
else

@ -3030,7 +3030,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
psys->totcached = totpart;
if(psys && psys->lattice){
if(psys->lattice){
end_latt_deform(psys->lattice);
psys->lattice= NULL;
}
@ -3589,28 +3589,38 @@ ParticleSettings *psys_copy_settings(ParticleSettings *part)
return partn;
}
static void expand_local_particlesettings(ParticleSettings *part)
{
int i;
id_lib_extern((ID *)part->dup_group);
for(i=0; i<MAX_MTEX; i++) {
if(part->mtex[i]) id_lib_extern((ID *)part->mtex[i]->tex);
}
}
void make_local_particlesettings(ParticleSettings *part)
{
Main *bmain= G.main;
Object *ob;
ParticleSettings *par;
int local=0, lib=0;
/* - only lib users: do nothing
* - only local users: set flag
* - mixed: make copy
*/
* - only local users: set flag
* - mixed: make copy
*/
if(part->id.lib==0) return;
if(part->id.us==1) {
part->id.lib= 0;
part->id.flag= LIB_LOCAL;
new_id(0, (ID *)part, 0);
new_id(&bmain->particle, (ID *)part, 0);
expand_local_particlesettings(part);
return;
}
/* test objects */
ob= G.main->object.first;
while(ob) {
for(ob= bmain->object.first; ob && ELEM(0, lib, local); ob= ob->id.next) {
ParticleSystem *psys=ob->particlesystem.first;
for(; psys; psys=psys->next){
if(psys->part==part) {
@ -3618,31 +3628,28 @@ void make_local_particlesettings(ParticleSettings *part)
else local= 1;
}
}
ob= ob->id.next;
}
if(local && lib==0) {
part->id.lib= 0;
part->id.flag= LIB_LOCAL;
new_id(0, (ID *)part, 0);
new_id(&bmain->particle, (ID *)part, 0);
expand_local_particlesettings(part);
}
else if(local && lib) {
par= psys_copy_settings(part);
par->id.us= 0;
ParticleSettings *partn= psys_copy_settings(part);
partn->id.us= 0;
/* do objects */
ob= G.main->object.first;
while(ob) {
ParticleSystem *psys=ob->particlesystem.first;
for(; psys; psys=psys->next){
for(ob= bmain->object.first; ob; ob= ob->id.next) {
ParticleSystem *psys;
for(psys= ob->particlesystem.first; psys; psys=psys->next){
if(psys->part==part && ob->id.lib==0) {
psys->part= par;
par->id.us++;
psys->part= partn;
partn->id.us++;
part->id.us--;
}
}
ob= ob->id.next;
}
}
}

@ -938,7 +938,7 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p
len = ptcache_path(pid, filename);
newname += len;
}
if(strcmp(pid->cache->name, "")==0 && (pid->cache->flag & PTCACHE_EXTERNAL)==0) {
if(pid->cache->name[0] == '\0' && (pid->cache->flag & PTCACHE_EXTERNAL)==0) {
idname = (pid->ob->id.name+2);
/* convert chars to hex so they are always a valid filename */
while('\0' != *idname) {
@ -1382,7 +1382,7 @@ static void ptcache_find_frames_around(PTCacheID *pid, unsigned int frame, int *
}
}
if(pm && !pm2) {
if(!pm2) {
*fra1 = 0;
*fra2 = pm->frame;
}
@ -1844,7 +1844,8 @@ static int ptcache_write(PTCacheID *pid, int cfra, int overwrite)
if(cache->flag & PTCACHE_DISK_CACHE) {
error += !ptcache_mem_frame_to_disk(pid, pm);
if(pm) {
// if(pm) /* pm is always set */
{
ptcache_data_free(pm);
ptcache_extra_free(pm);
MEM_freeN(pm);

@ -1858,7 +1858,7 @@ static ImBuf * seq_render_scene_strip_impl(
ImBuf * ibuf = NULL;
float frame= seq->sfra + nr + seq->anim_startofs;
float oldcfra;
Object *oldcamera;
Object *camera;
ListBase oldmarkers;
/* Old info:
@ -1896,59 +1896,65 @@ static ImBuf * seq_render_scene_strip_impl(
int doseq;
int doseq_gl= G.rendering ? /*(scene->r.seq_flag & R_SEQ_GL_REND)*/ 0 : /*(scene->r.seq_flag & R_SEQ_GL_PREV)*/ 1;
int have_seq= FALSE;
Scene *sce= seq->scene; /* dont refer to seq->scene above this point!, it can be NULL */
int sce_valid= FALSE;
Scene *scene;
if(sce) {
have_seq= (sce->r.scemode & R_DOSEQ) && sce->ed && sce->ed->seqbase.first;
sce_valid= (sce->camera || have_seq);
/* dont refer to seq->scene above this point!, it can be NULL */
if(seq->scene == NULL) {
return NULL;
}
if (!sce_valid)
return NULL;
scene= seq->scene;
oldcfra= seq->scene->r.cfra;
oldcamera= seq->scene->camera;
have_seq= (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first;
oldcfra= scene->r.cfra;
scene->r.cfra= frame;
if(seq->scene_camera)
camera= seq->scene_camera;
else {
scene_camera_switch_update(scene);
camera= scene->camera;
}
if(scene && have_seq==FALSE && camera==NULL) {
scene->r.cfra= oldcfra;
return NULL;
}
/* prevent eternal loop */
doseq= context.scene->r.scemode & R_DOSEQ;
context.scene->r.scemode &= ~R_DOSEQ;
seq->scene->r.cfra= frame;
if(seq->scene_camera)
seq->scene->camera= seq->scene_camera;
else
scene_camera_switch_update(seq->scene);
#ifdef DURIAN_CAMERA_SWITCH
/* stooping to new low's in hackyness :( */
oldmarkers= seq->scene->markers;
seq->scene->markers.first= seq->scene->markers.last= NULL;
oldmarkers= scene->markers;
scene->markers.first= scene->markers.last= NULL;
#endif
if(sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (seq->scene == context.scene || have_seq==0) && seq->scene->camera) {
if(sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (scene == context.scene || have_seq==0) && camera) {
char err_out[256]= "unknown";
/* for old scened this can be uninitialized, should probably be added to do_versions at some point if the functionality stays */
if(context.scene->r.seq_prev_type==0)
context.scene->r.seq_prev_type = 3 /* ==OB_SOLID */;
/* opengl offscreen render */
scene_update_for_newframe(context.bmain, seq->scene, seq->scene->lay);
ibuf= sequencer_view3d_cb(seq->scene, context.rectx, context.recty, IB_rect, context.scene->r.seq_prev_type, err_out);
scene_update_for_newframe(context.bmain, scene, scene->lay);
ibuf= sequencer_view3d_cb(scene, camera, context.rectx, context.recty, IB_rect, context.scene->r.seq_prev_type, err_out);
if(ibuf == NULL) {
fprintf(stderr, "seq_render_scene_strip_impl failed to get opengl buffer: %s\n", err_out);
}
}
else {
Render *re = RE_GetRender(sce->id.name);
Render *re = RE_GetRender(scene->id.name);
RenderResult rres;
/* XXX: this if can be removed when sequence preview rendering uses the job system */
if(rendering || context.scene != sce) {
if(rendering || context.scene != scene) {
if(re==NULL)
re= RE_NewRender(sce->id.name);
re= RE_NewRender(scene->id.name);
RE_BlenderFrame(re, context.bmain, sce, NULL, sce->lay, frame, FALSE);
RE_BlenderFrame(re, context.bmain, scene, NULL, camera, scene->lay, frame, FALSE);
/* restore previous state after it was toggled on & off by RE_BlenderFrame */
G.rendering = rendering;
@ -1981,14 +1987,14 @@ static ImBuf * seq_render_scene_strip_impl(
/* restore */
context.scene->r.scemode |= doseq;
seq->scene->r.cfra = oldcfra;
seq->scene->camera= oldcamera;
scene->r.cfra = oldcfra;
if(frame != oldcfra)
scene_update_for_newframe(context.bmain, seq->scene, seq->scene->lay);
scene_update_for_newframe(context.bmain, scene, scene->lay);
#ifdef DURIAN_CAMERA_SWITCH
/* stooping to new low's in hackyness :( */
seq->scene->markers= oldmarkers;
scene->markers= oldmarkers;
#endif
return ibuf;

@ -1541,8 +1541,10 @@ static void ccgDM_drawFacesColored(DerivedMesh *dm, int UNUSED(useTwoSided), uns
}
glShadeModel(GL_SMOOTH);
if(col1 && col2)
if(col2) {
glEnable(GL_CULL_FACE);
}
glBegin(GL_QUADS);
for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {

@ -2068,6 +2068,7 @@ void txt_do_redo(Text *text)
linep= linep+(text->undo_buf[text->undo_pos]<<8); text->undo_pos++;
linep= linep+(text->undo_buf[text->undo_pos]<<16); text->undo_pos++;
linep= linep+(text->undo_buf[text->undo_pos]<<24); text->undo_pos++;
(void)linep;
break;
case UNDO_INDENT:

@ -73,7 +73,7 @@
#include "BKE_icons.h"
#include "BKE_node.h"
#include "BKE_animsys.h"
#include "BKE_colortools.h"
/* ------------------------------------------------------------------------- */
@ -762,9 +762,8 @@ Tex *copy_texture(Tex *tex)
if(texn->coba) texn->coba= MEM_dupallocN(texn->coba);
if(texn->env) texn->env= BKE_copy_envmap(texn->env);
if(texn->pd) texn->pd= MEM_dupallocN(texn->pd);
if(texn->pd) texn->pd= BKE_copy_pointdensity(texn->pd);
if(texn->vd) texn->vd= MEM_dupallocN(texn->vd);
if(tex->preview) texn->preview = BKE_previewimg_copy(tex->preview);
if(tex->nodetree) {
@ -795,14 +794,7 @@ Tex *localize_texture(Tex *tex)
texn->env= BKE_copy_envmap(texn->env);
id_us_min(&texn->env->ima->id);
}
if(texn->pd) {
texn->pd= MEM_dupallocN(texn->pd);
if(texn->pd->coba) {
texn->pd->point_tree = NULL;
texn->pd->coba= MEM_dupallocN(texn->pd->coba);
}
}
if(texn->pd) texn->pd= BKE_copy_pointdensity(texn->pd);
if(texn->vd) {
texn->vd= MEM_dupallocN(texn->vd);
if(texn->vd->dataset)
@ -843,13 +835,13 @@ void make_local_texture(Tex *tex)
if(tex->ima) {
tex->ima->id.lib= NULL;
tex->ima->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)tex->ima, NULL);
new_id(&bmain->image, (ID *)tex->ima, NULL);
}
if(tex->id.us==1) {
tex->id.lib= NULL;
tex->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)tex, NULL);
new_id(&bmain->tex, (ID *)tex, NULL);
return;
}
@ -906,7 +898,7 @@ void make_local_texture(Tex *tex)
if(local && lib==0) {
tex->id.lib= NULL;
tex->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)tex, NULL);
new_id(&bmain->tex, (ID *)tex, NULL);
}
else if(local && lib) {
texn= copy_texture(tex);
@ -1367,6 +1359,13 @@ PointDensity *BKE_add_pointdensity(void)
pd->object = NULL;
pd->psys = 0;
pd->psys_cache_space= TEX_PD_WORLDSPACE;
pd->falloff_curve = curvemapping_add(1, 0, 0, 1, 1);
pd->falloff_curve->preset = CURVE_PRESET_LINE;
pd->falloff_curve->cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
curvemap_reset(pd->falloff_curve->cm, &pd->falloff_curve->clipr, pd->falloff_curve->preset, CURVEMAP_SLOPE_POSITIVE);
curvemapping_changed(pd->falloff_curve, 0);
return pd;
}
@ -1378,7 +1377,7 @@ PointDensity *BKE_copy_pointdensity(PointDensity *pd)
pdn->point_tree = NULL;
pdn->point_data = NULL;
if(pdn->coba) pdn->coba= MEM_dupallocN(pdn->coba);
pdn->falloff_curve = curvemapping_copy(pdn->falloff_curve); /* can be NULL */
return pdn;
}
@ -1396,6 +1395,8 @@ void BKE_free_pointdensitydata(PointDensity *pd)
MEM_freeN(pd->coba);
pd->coba = NULL;
}
curvemapping_free(pd->falloff_curve); /* can be NULL */
}
void BKE_free_pointdensity(PointDensity *pd)

@ -43,6 +43,8 @@
#include "DNA_scene_types.h"
#include "DNA_texture_types.h"
#include "BLI_utildefines.h"
#include "BKE_world.h"
#include "BKE_library.h"
#include "BKE_animsys.h"
@ -134,7 +136,6 @@ void make_local_world(World *wrld)
{
Main *bmain= G.main;
Scene *sce;
World *wrldn;
int local=0, lib=0;
/* - only lib users: do nothing
@ -150,34 +151,30 @@ void make_local_world(World *wrld)
return;
}
sce= bmain->scene.first;
while(sce) {
if(sce->world==wrld) {
for(sce= bmain->scene.first; sce && ELEM(0, lib, local); sce= sce->id.next) {
if(sce->world == wrld) {
if(sce->id.lib) lib= 1;
else local= 1;
}
sce= sce->id.next;
}
if(local && lib==0) {
wrld->id.lib= NULL;
wrld->id.flag= LIB_LOCAL;
new_id(NULL, (ID *)wrld, NULL);
}
else if(local && lib) {
wrldn= copy_world(wrld);
World *wrldn= copy_world(wrld);
wrldn->id.us= 0;
sce= bmain->scene.first;
while(sce) {
if(sce->world==wrld) {
for(sce= bmain->scene.first; sce; sce= sce->id.next) {
if(sce->world == wrld) {
if(sce->id.lib==NULL) {
sce->world= wrldn;
wrldn->id.us++;
wrld->id.us--;
}
}
sce= sce->id.next;
}
}
}

@ -424,14 +424,14 @@ MINLINE float normalize_v3(float n[3])
return normalize_v3_v3(n, n);
}
MINLINE void normal_short_to_float_v3(float *out, const short *in)
MINLINE void normal_short_to_float_v3(float out[3], const short in[3])
{
out[0] = in[0]*(1.0f/32767.0f);
out[1] = in[1]*(1.0f/32767.0f);
out[2] = in[2]*(1.0f/32767.0f);
}
MINLINE void normal_float_to_short_v3(short *out, const float *in)
MINLINE void normal_float_to_short_v3(short out[3], const float in[3])
{
out[0] = (short)(in[0]*32767.0f);
out[1] = (short)(in[1]*32767.0f);

@ -148,7 +148,7 @@ BLO_blendhandle_from_memory(
*
* @param bh The blendhandle to access.
* @param ofblocktype The type of names to get.
* @param totnames The length of the returned list.
* @param tot_names The length of the returned list.
* @return A BLI_linklist of strings. The string links
* should be freed with malloc.
*/
@ -156,7 +156,7 @@ BLO_blendhandle_from_memory(
BLO_blendhandle_get_datablock_names(
BlendHandle *bh,
int ofblocktype,
int *totnames);
int *tot_names);
/**
* Gets the previews of all the datablocks in a file
@ -165,13 +165,15 @@ BLO_blendhandle_get_datablock_names(
*
* @param bh The blendhandle to access.
* @param ofblocktype The type of names to get.
* @param tot_prev The length of the returned list.
* @return A BLI_linklist of PreviewImage. The PreviewImage links
* should be freed with malloc.
*/
struct LinkNode*
BLO_blendhandle_get_previews(
BlendHandle *bh,
int ofblocktype);
int ofblocktype,
int *tot_prev);
/**
* Gets the names of all the datablock groups in a

@ -144,7 +144,7 @@ LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype,
return names;
}
LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype)
LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *tot_prev)
{
FileData *fd= (FileData*) bh;
LinkNode *previews= NULL;
@ -153,6 +153,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype)
int npreviews = 0;
PreviewImage* prv = NULL;
PreviewImage* new_prv = NULL;
int tot= 0;
for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
if (bhead->code==ofblocktype) {
@ -166,6 +167,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype)
case ID_LA: /* fall through */
new_prv = MEM_callocN(sizeof(PreviewImage), "newpreview");
BLI_linklist_prepend(&previews, new_prv);
tot++;
looking = 1;
break;
default:
@ -213,7 +215,8 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype)
}
}
*tot_prev= tot;
return previews;
}

@ -2964,6 +2964,10 @@ static void direct_link_texture(FileData *fd, Tex *tex)
if(tex->pd) {
tex->pd->point_tree = NULL;
tex->pd->coba= newdataadr(fd, tex->pd->coba);
tex->pd->falloff_curve= newdataadr(fd, tex->pd->falloff_curve);
if(tex->pd->falloff_curve) {
direct_link_curvemapping(fd, tex->pd->falloff_curve);
}
}
tex->vd= newdataadr(fd, tex->vd);
@ -11741,7 +11745,57 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* put compatibility code here until next subversion bump */
{
/* screen view2d settings were not properly initialized [#27164]
* v2d->scroll caused the bug but best reset other values too which are in old blend files only.
* need to make less ugly - possibly an iterator? */
bScreen *screen;
for(screen= main->screen.first; screen; screen= screen->id.next) {
ScrArea *sa;
/* add regions */
for(sa= screen->areabase.first; sa; sa= sa->next) {
SpaceLink *sl= sa->spacedata.first;
if(sl->spacetype==SPACE_IMAGE) {
ARegion *ar;
for (ar=sa->regionbase.first; ar; ar= ar->next) {
if(ar->regiontype == RGN_TYPE_WINDOW) {
View2D *v2d= &ar->v2d;
v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0;
}
}
}
for (sl= sa->spacedata.first; sl; sl= sl->next) {
if(sl->spacetype==SPACE_IMAGE) {
ARegion *ar;
for (ar=sl->regionbase.first; ar; ar= ar->next) {
if(ar->regiontype == RGN_TYPE_WINDOW) {
View2D *v2d= &ar->v2d;
v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0;
}
}
}
}
}
}
{
/* Initialize texture point density curve falloff */
Tex *tex;
for(tex= main->tex.first; tex; tex= tex->id.next) {
if(tex->pd) {
if (tex->pd->falloff_speed_scale == 0.0)
tex->pd->falloff_speed_scale = 100.0;
if (!tex->pd->falloff_curve) {
tex->pd->falloff_curve = curvemapping_add(1, 0, 0, 1, 1);
tex->pd->falloff_curve->preset = CURVE_PRESET_LINE;
tex->pd->falloff_curve->cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
curvemap_reset(tex->pd->falloff_curve->cm, &tex->pd->falloff_curve->clipr, tex->pd->falloff_curve->preset, CURVEMAP_SLOPE_POSITIVE);
curvemapping_changed(tex->pd->falloff_curve, 0);
}
}
}
}
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */

@ -1699,6 +1699,7 @@ static void write_textures(WriteData *wd, ListBase *idbase)
if(tex->type == TEX_POINTDENSITY && tex->pd) {
writestruct(wd, DATA, "PointDensity", 1, tex->pd);
if(tex->pd->coba) writestruct(wd, DATA, "ColorBand", 1, tex->pd->coba);
if(tex->pd->falloff_curve) write_curvemapping(wd, tex->pd->falloff_curve);
}
if(tex->type == TEX_VOXELDATA && tex->vd) writestruct(wd, DATA, "VoxelData", 1, tex->vd);

@ -38,6 +38,11 @@ extern "C"
#include "BKE_scene.h"
#include "BKE_context.h"
/* make dummy file */
#include "BLI_storage.h"
#include "BLI_path_util.h"
#include "BLI_fileops.h"
int collada_import(bContext *C, const char *filepath)
{
DocumentImporter imp (C, filepath);
@ -48,8 +53,17 @@ extern "C"
int collada_export(Scene *sce, const char *filepath)
{
DocumentExporter exp;
/* annoying, collada crashes if file cant be created! [#27162] */
if(!BLI_exist(filepath)) {
BLI_make_existing_file(filepath); /* makes the dir if its not there */
if(BLI_touch(filepath) == 0) {
return 0;
}
}
/* end! */
exp.exportCurrentScene(sce, filepath);
return 1;

@ -3353,6 +3353,7 @@ void ANIM_channel_draw_widgets (bAnimContext *ac, bAnimListElem *ale, uiBlock *b
draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_SOLO);
offset += ICON_WIDTH;
}
(void)offset;
}
/* step 4) draw text... */

@ -169,9 +169,9 @@ void ANIM_set_active_channel (bAnimContext *ac, void *data, short datatype, int
case ANIMTYPE_DSLAT:
{
/* need to verify that this data is valid for now */
// XXX: ale may be null!
if (ale->adt)
if (ale && ale->adt) {
ale->adt->flag |= ADT_UI_ACTIVE;
}
}
break;
}
@ -1003,7 +1003,7 @@ static void rearrange_action_channels (bAnimContext *ac, bAction *act, short mod
for (agrp= act->groups.first; agrp; agrp= agrp->next) {
/* only consider F-Curves if they're visible (group expanded) */
if (EXPANDED_AGRP(agrp)) {
if (EXPANDED_AGRP(ac, agrp)) {
rearrange_animchannel_islands(&agrp->channels, rearrange_func, mode, ANIMTYPE_FCURVE);
}
}

@ -1031,7 +1031,7 @@ static int animdata_filter_action (bAnimContext *ac, ListBase *anim_data, bDopeS
* but the group isn't expanded...
*/
if ( (filter_mode & (ANIMFILTER_SEL|ANIMFILTER_UNSEL)) && /* care about selection status */
(EXPANDED_AGRP(agrp)==0) ) /* group isn't expanded */
(EXPANDED_AGRP(ac, agrp)==0) ) /* group isn't expanded */
{
/* if the group itself isn't selected appropriately, we shouldn't consider it's children either */
if (ANIMCHANNEL_SELOK(SEL_AGRP(agrp)) == 0)
@ -1090,7 +1090,7 @@ static int animdata_filter_action (bAnimContext *ac, ListBase *anim_data, bDopeS
* - group is expanded
* - we just need the F-Curves present
*/
if ( (!(filter_mode & ANIMFILTER_VISIBLE) || EXPANDED_AGRP(agrp)) || (filter_mode & ANIMFILTER_CURVESONLY) )
if ( (!(filter_mode & ANIMFILTER_VISIBLE) || EXPANDED_AGRP(ac, agrp)) || (filter_mode & ANIMFILTER_CURVESONLY) )
{
/* for the Graph Editor, curves may be set to not be visible in the view to lessen clutter,
* but to do this, we need to check that the group doesn't have it's not-visible flag set preventing

@ -804,7 +804,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann
for (ct= targets.first; ct; ct= ct->next) {
if (ct->tar == srcArm) {
if (strcmp(ct->subtarget, "")==0) {
if (ct->subtarget[0] == '\0') {
ct->tar = tarArm;
}
else if (strcmp(ct->subtarget, pchan->name)==0) {
@ -851,7 +851,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann
for (ct= targets.first; ct; ct= ct->next) {
if (ct->tar == srcArm) {
if (strcmp(ct->subtarget, "")==0) {
if (ct->subtarget[0] == '\0') {
ct->tar = tarArm;
}
else if (strcmp(ct->subtarget, pchan->name)==0) {

@ -951,7 +951,7 @@ static void calc_shapeKeys(Object *obedit)
++i;
}
fp+= 3; curofp+= 3; /* alphas */
fp+= 3; /* alphas */
} else {
for (j= 0; j < 3; ++j, ++i) {
VECCOPY(fp, bezt->vec[j]);
@ -1234,7 +1234,6 @@ void make_editNurb(Object *obedit)
Nurb *nu, *newnu, *nu_act= NULL;
KeyBlock *actkey;
if(obedit==NULL) return;
set_actNurb(obedit, NULL);
@ -1591,7 +1590,7 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
BPoint *bp, *bpn, *newbp;
int a, b, newu, newv, sel;
if(obedit && obedit->type==OB_SURF);
if(obedit->type==OB_SURF);
else return OPERATOR_CANCELLED;
cu->lastsel= NULL;
@ -5662,7 +5661,7 @@ static int delete_exec(bContext *C, wmOperator *op)
Curve *cu= obedit->data;
EditNurb *editnurb= cu->editnurb;
ListBase *nubase= &editnurb->nurbs;
Nurb *nu, *next, *nu1;
Nurb *nu, *nu1;
BezTriple *bezt, *bezt1, *bezt2;
BPoint *bp, *bp1, *bp2;
int a, cut= 0, type= RNA_enum_get(op->ptr, "type");
@ -5687,6 +5686,7 @@ static int delete_exec(bContext *C, wmOperator *op)
if(type==0) {
/* first loop, can we remove entire pieces? */
Nurb *next;
nu= nubase->first;
while(nu) {
next= nu->next;
@ -5815,7 +5815,6 @@ static int delete_exec(bContext *C, wmOperator *op)
nu1= NULL;
nuindex= 0;
for(nu= nubase->first; nu; nu= nu->next) {
next= nu->next;
if(nu->type == CU_BEZIER) {
bezt= nu->bezt;
for(a=0; a<nu->pntsu-1; a++) {

@ -253,7 +253,7 @@ typedef enum eAnimFilter_Flags {
/* Actions (also used for Dopesheet) */
/* Action Channel Group */
#define EDITABLE_AGRP(agrp) ((agrp->flag & AGRP_PROTECTED)==0)
#define EXPANDED_AGRP(agrp) \
#define EXPANDED_AGRP(ac, agrp) \
( ( ((ac)->spacetype == SPACE_IPO) && (agrp->flag & AGRP_EXPANDED_G) ) || \
( ((ac)->spacetype != SPACE_IPO) && (agrp->flag & AGRP_EXPANDED) ) )
#define SEL_AGRP(agrp) ((agrp->flag & AGRP_SELECTED) || (agrp->flag & AGRP_ACTIVE))

@ -163,6 +163,8 @@ int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, in
/* get 3d region from context, also if mouse is in header or toolbar */
struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C);
struct ARegion *ED_view3d_context_region_unlock(struct bContext *C);
int ED_operator_rv3d_unlock_poll(struct bContext *C);
void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d);
@ -173,7 +175,7 @@ void ED_view3d_draw_offscreen(struct Scene *scene, struct View3D *v3d, struct AR
int winx, int winy, float viewmat[][4], float winmat[][4]);
struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, unsigned int flag, char err_out[256]);
struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype, char err_out[256]);
struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, struct Object *camera, int width, int height, unsigned int flag, int drawtype, char err_out[256]);
Base *ED_view3d_give_base_under_cursor(struct bContext *C, const short mval[2]);
@ -183,5 +185,11 @@ int ED_view3d_lock(struct RegionView3D *rv3d);
unsigned int ED_view3d_datamask(struct Scene *scene, struct View3D *v3d);
unsigned int ED_viewedit_datamask(struct bScreen *screen);
/* assigning view matrix */
void view3d_apply_mat4(float mat[][4], float *ofs, float *quat, float *dist);
void view3d_apply_ob(struct Object *ob, float *ofs, float *quat, float *dist, float *lens);
int view3d_is_ortho(struct View3D *v3d, struct RegionView3D *rv3d);
#endif /* ED_VIEW3D_H */

@ -765,8 +765,6 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol)
//float alpha;
GLint scissor[4];
if (hist==NULL) { printf("hist is null \n"); return; }
rect.xmin = (float)recti->xmin+1;
rect.xmax = (float)recti->xmax-1;
rect.ymin = (float)recti->ymin+SCOPE_RESIZE_PAD+2;

@ -362,6 +362,16 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
/* create tooltip data */
data= MEM_callocN(sizeof(uiTooltipData), "uiTooltipData");
/* special case, enum rna buttons only have enum item description, use general enum description too before the spesific one */
if(but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) {
const char *descr= RNA_property_description(but->rnaprop);
if(descr && descr[0]) {
BLI_strncpy(data->lines[data->totline], descr, sizeof(data->lines[0]));
data->color[data->totline]= 0xFFFFFF;
data->totline++;
}
}
if(but->tip && strlen(but->tip)) {
BLI_strncpy(data->lines[data->totline], but->tip, sizeof(data->lines[0]));
data->color[data->totline]= 0xFFFFFF;

@ -673,6 +673,22 @@ static int modifier_can_delete(ModifierData *md)
return 1;
}
// Check wheter Modifier is a simulation or not, this is used for switching to the physics/particles context tab
static int modifier_is_simulation(ModifierData *md)
{
// Physic Tab
if(ELEM6(md->type, eModifierType_Cloth, eModifierType_Collision, eModifierType_Fluidsim, eModifierType_Smoke, eModifierType_Softbody, eModifierType_Surface)) {
return 1;
}
// Particle Tab
else if (md->type == eModifierType_ParticleSystem) {
return 2;
}
else {
return 0;
}
}
static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, ModifierData *md, int index, int cageIndex, int lastCageIndex)
{
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
@ -765,8 +781,13 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, Modif
uiBlockEndAlign(block);
uiBlockSetEmboss(block, UI_EMBOSSN);
if (modifier_can_delete(md))
// When Modifier is a simulation, show button to switch to context rather than the delete button.
if (modifier_can_delete(md) && !modifier_is_simulation(md))
uiItemO(row, "", ICON_X, "OBJECT_OT_modifier_remove");
if (modifier_is_simulation(md) == 1)
uiItemStringO(row, "", ICON_BUTS, "WM_OT_properties_context_change", "context", "PHYSICS");
else if (modifier_is_simulation(md) == 2)
uiItemStringO(row, "", ICON_BUTS, "WM_OT_properties_context_change", "context", "PARTICLES");
uiBlockSetEmboss(block, UI_EMBOSS);
}

@ -575,19 +575,17 @@ static void shadecolors4(char *coltop, char *coldown, const char *color, short s
coldown[3]= color[3];
}
static void round_box_shade_col4(const char *col1, const char *col2, float fac)
static void round_box_shade_col4(const char col1[4], const char col2[4], const float fac)
{
int faci, facm;
unsigned char col[4];
faci= floor(255.1f*fac);
facm= 255-faci;
const int faci= FTOCHAR(fac);
const int facm= 255-faci;
col[0]= (faci*col1[0] + facm*col2[0])>>8;
col[1]= (faci*col1[1] + facm*col2[1])>>8;
col[2]= (faci*col1[2] + facm*col2[2])>>8;
col[3]= (faci*col1[3] + facm*col2[3])>>8;
glColor4ubv(col);
}
@ -2316,7 +2314,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
double value;
float offs, toffs, fac;
char outline[3];
widget_init(&wtb);
widget_init(&wtb1);

@ -90,21 +90,21 @@ static float icovert[12][3] = {
{0.0f,0.0f,200.0f}
};
static short icoface[20][3] = {
{1,0,2},
{2,0,1},
{1,0,5},
{2,0,3},
{3,0,4},
{4,0,5},
{3,0,2},
{4,0,3},
{5,0,4},
{1,5,10},
{2,1,6},
{3,2,7},
{4,3,8},
{5,4,9},
{10,1,6},
{6,2,7},
{7,3,8},
{8,4,9},
{9,5,10},
{6,1,10},
{7,2,6},
{8,3,7},
{9,4,8},
{10,5,9},
{6,10,11},
{7,6,11},
{8,7,11},
@ -1081,6 +1081,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
}
eve= eve->next;
}
recalc_editnormals(em);
break;
case PRIM_UVSPHERE: /* UVsphere */
@ -1102,7 +1103,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
eve= addvertlist(em, vec, NULL);
eve->f= 1+2+4;
if(a==0) v1= eve;
else addedgelist(em, eve->prev, eve, NULL);
else addedgelist(em, eve, eve->prev, NULL);
phi+= phid;
}
@ -1128,6 +1129,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
}
eve= eve->next;
}
recalc_editnormals(em);
break;
case PRIM_ICOSPHERE: /* Icosphere */
{
@ -1320,9 +1322,9 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se
EM_stats_update(em);
/* simple selection flush OK, based on fact it's a single model */
EM_select_flush(em); /* flushes vertex -> edge -> face selection */
if(type!=PRIM_PLANE && type!=PRIM_MONKEY)
EM_recalc_normal_direction(em, 0, 0); /* otherwise monkey has eyes in wrong direction */
if(!ELEM5(type, PRIM_GRID, PRIM_PLANE, PRIM_ICOSPHERE, PRIM_UVSPHERE, PRIM_MONKEY))
EM_recalc_normal_direction(em, FALSE, TRUE); /* otherwise monkey has eyes in wrong direction */
BKE_mesh_end_editmesh(obedit->data, em);
}

@ -891,13 +891,11 @@ void MESH_OT_split(wmOperatorType *ot)
}
static int extrude_repeat_mesh(bContext *C, wmOperator *op)
static int extrude_repeat_mesh_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
RegionView3D *rv3d = ED_view3d_context_rv3d(C);
int steps = RNA_int_get(op->ptr,"steps");
float offs = RNA_float_get(op->ptr,"offset");
@ -906,9 +904,7 @@ static int extrude_repeat_mesh(bContext *C, wmOperator *op)
short a;
/* dvec */
dvec[0]= rv3d->persinv[2][0];
dvec[1]= rv3d->persinv[2][1];
dvec[2]= rv3d->persinv[2][2];
RNA_float_get_array(op->ptr, "direction", dvec);
normalize_v3(dvec);
dvec[0]*= offs;
dvec[1]*= offs;
@ -935,6 +931,17 @@ static int extrude_repeat_mesh(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
/* get center and axis, in global coords */
static int extrude_repeat_mesh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
RegionView3D *rv3d= ED_view3d_context_rv3d(C);
if(rv3d)
RNA_float_set_array(op->ptr, "direction", rv3d->persinv[2]);
return extrude_repeat_mesh_exec(C, op);
}
void MESH_OT_extrude_repeat(wmOperatorType *ot)
{
/* identifiers */
@ -943,15 +950,17 @@ void MESH_OT_extrude_repeat(wmOperatorType *ot)
ot->idname= "MESH_OT_extrude_repeat";
/* api callbacks */
ot->exec= extrude_repeat_mesh;
ot->poll= ED_operator_editmesh_region_view3d;
ot->invoke= extrude_repeat_mesh_invoke;
ot->exec= extrude_repeat_mesh_exec;
ot->poll= ED_operator_editmesh;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* props */
RNA_def_float(ot->srna, "offset", 2.0f, 0.0f, 100.0f, "Offset", "", 0.0f, FLT_MAX);
RNA_def_int(ot->srna, "steps", 10, 0, 180, "Steps", "", 0, INT_MAX);
RNA_def_float(ot->srna, "offset", 2.0f, 0.0f, 100.0f, "Offset", "", 0.0f, 100.0f);
RNA_def_int(ot->srna, "steps", 10, 0, 180, "Steps", "", 0, 180);
RNA_def_float_vector(ot->srna, "direction", 3, NULL, -FLT_MAX, FLT_MAX, "Direction", "Direction of extrude", -FLT_MAX, FLT_MAX);
}
/* ************************** spin operator ******************** */

@ -163,6 +163,17 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
}
}
static void copy_editface_active_customdata(EditMesh *em, int type, int index)
{
EditFace *efa;
int n= CustomData_get_active_layer(&em->fdata, type);
for(efa= em->faces.first; efa; efa= efa->next) {
void *data= CustomData_em_get_n(&em->fdata, efa->data, type, n);
CustomData_em_set_n(&em->fdata, efa->data, type, index, data);
}
}
int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_set)
{
EditMesh *em;
@ -176,6 +187,10 @@ int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_s
return 0;
EM_add_data_layer(em, &em->fdata, CD_MTFACE, name);
if(layernum) /* copy data from active UV */
copy_editface_active_customdata(em, CD_MTFACE, layernum);
if(active_set || layernum==0)
CustomData_set_layer_active(&em->fdata, CD_MTFACE, layernum);
}
@ -234,6 +249,10 @@ int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me, const cha
return 0;
EM_add_data_layer(em, &em->fdata, CD_MCOL, name);
if(layernum) /* copy data from active vertex color layer */
copy_editface_active_customdata(em, CD_MCOL, layernum);
if(active_set || layernum==0)
CustomData_set_layer_active(&em->fdata, CD_MCOL, layernum);
}

@ -226,8 +226,9 @@ int join_mesh_exec(bContext *C, wmOperator *op)
}
if(b==totcol) {
matar[b]= ma;
if(ma)
ma->id.us++;
if(ma) {
id_us_plus(&ma->id);
}
totcol++;
}
if(totcol>=MAXMAT-1)

@ -421,6 +421,7 @@ static int screen_render_exec(bContext *C, wmOperator *op)
unsigned int lay= (v3d)? v3d->lay: scene->lay;
const short is_animation= RNA_boolean_get(op->ptr, "animation");
const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
struct Object *camera_override= v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.imtype)) {
BKE_report(op->reports, RPT_ERROR, "Can't write a single file with an animation format selected.");
@ -446,9 +447,9 @@ static int screen_render_exec(bContext *C, wmOperator *op)
seq_stripelem_cache_cleanup();
if(is_animation)
RE_BlenderAnim(re, mainp, scene, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step, op->reports);
RE_BlenderAnim(re, mainp, scene, camera_override, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step, op->reports);
else
RE_BlenderFrame(re, mainp, scene, NULL, lay, scene->r.cfra, is_write_still);
RE_BlenderFrame(re, mainp, scene, NULL, camera_override, lay, scene->r.cfra, is_write_still);
// no redraw needed, we leave state as we entered it
ED_update_for_newframe(mainp, scene, CTX_wm_screen(C), 1);
@ -464,6 +465,7 @@ typedef struct RenderJob {
Render *re;
wmWindow *win;
SceneRenderLayer *srl;
struct Object *camera_override;
int lay;
short anim, write_still;
Image *image;
@ -590,9 +592,9 @@ static void render_startjob(void *rjv, short *stop, short *do_update, float *pro
rj->progress= progress;
if(rj->anim)
RE_BlenderAnim(rj->re, rj->main, rj->scene, rj->lay, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step, rj->reports);
RE_BlenderAnim(rj->re, rj->main, rj->scene, rj->camera_override, rj->lay, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step, rj->reports);
else
RE_BlenderFrame(rj->re, rj->main, rj->scene, rj->srl, rj->lay, rj->scene->r.cfra, rj->write_still);
RE_BlenderFrame(rj->re, rj->main, rj->scene, rj->srl, rj->camera_override, rj->lay, rj->scene->r.cfra, rj->write_still);
}
static void render_endjob(void *rjv)
@ -679,12 +681,13 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
int jobflag;
const short is_animation= RNA_boolean_get(op->ptr, "animation");
const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
struct Object *camera_override= v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
/* only one render job at a time */
if(WM_jobs_test(CTX_wm_manager(C), scene))
return OPERATOR_CANCELLED;
if(!RE_is_rendering_allowed(scene, op->reports, render_error_reports)) {
if(!RE_is_rendering_allowed(scene, camera_override, op->reports, render_error_reports)) {
return OPERATOR_CANCELLED;
}
@ -761,6 +764,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
rj->scene= scene;
rj->win= CTX_wm_window(C);
rj->srl = srl;
rj->camera_override = camera_override;
rj->lay = (v3d)? v3d->lay: scene->lay;
rj->anim= is_animation;
rj->write_still= is_write_still && !is_animation;

@ -114,6 +114,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
View3D *v3d= oglrender->v3d;
RegionView3D *rv3d= oglrender->rv3d;
RenderResult *rr;
Object *camera= NULL;
ImBuf *ibuf;
void *lock;
float winmat[4][4];
@ -140,7 +141,8 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
/* render 3d view */
if(rv3d->persp==RV3D_CAMOB && v3d->camera) {
/*int is_ortho= scene->r.mode & R_ORTHO;*/
RE_GetCameraWindow(oglrender->re, v3d->camera, scene->r.cfra, winmat);
camera= v3d->camera;
RE_GetCameraWindow(oglrender->re, camera, scene->r.cfra, winmat);
}
else {
@ -190,7 +192,8 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
else {
/* shouldnt suddenly give errors mid-render but possible */
char err_out[256]= "unknown";
ImBuf *ibuf_view= ED_view3d_draw_offscreen_imbuf_simple(scene, oglrender->sizex, oglrender->sizey, IB_rectfloat, OB_SOLID, err_out);
ImBuf *ibuf_view= ED_view3d_draw_offscreen_imbuf_simple(scene, scene->camera, oglrender->sizex, oglrender->sizey, IB_rectfloat, OB_SOLID, err_out);
camera= scene->camera;
if(ibuf_view) {
memcpy(rr->rectf, ibuf_view->rect_float, sizeof(float) * 4 * oglrender->sizex * oglrender->sizey);
@ -204,7 +207,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
/* rr->rectf is now filled with image data */
if((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW))
BKE_stamp_buf(scene, NULL, rr->rectf, rr->rectx, rr->recty, 4);
BKE_stamp_buf(scene, camera, NULL, rr->rectf, rr->rectx, rr->recty, 4);
RE_ReleaseResult(oglrender->re);
@ -218,7 +221,7 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
char name[FILE_MAX];
int ok;
BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, FALSE);
ok= BKE_write_ibuf(scene, ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality);
ok= BKE_write_ibuf(ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality); /* no need to stamp here */
if(ok) printf("OpenGL Render written to '%s'\n", name);
else printf("OpenGL Render failed to write '%s'\n", name);
}
@ -387,6 +390,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
char name[FILE_MAXDIR+FILE_MAXFILE];
int ok= 0;
const short view_context= (oglrender->v3d != NULL);
Object *camera= NULL;
/* update animated image textures for gpu, etc,
* call before scene_update_for_newframe so modifiers with textuers dont lag 1 frame */
@ -409,12 +413,17 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
if(oglrender->rv3d->persp==RV3D_CAMOB && oglrender->v3d->camera && oglrender->v3d->scenelock) {
/* since scene_update_for_newframe() is used rather
* then ED_update_for_newframe() the camera needs to be set */
if(scene_camera_switch_update(scene))
if(scene_camera_switch_update(scene)) {
oglrender->v3d->camera= scene->camera;
}
camera= oglrender->v3d->camera;
}
}
else {
scene_camera_switch_update(scene);
camera= scene->camera;
}
/* render into offscreen buffer */
@ -433,7 +442,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
}
else {
BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, TRUE);
ok= BKE_write_ibuf(scene, ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality);
ok= BKE_write_ibuf_stamp(scene, camera, ibuf, name, scene->r.imtype, scene->r.subimtype, scene->r.quality);
if(ok==0) {
printf("Write error: cannot save %s\n", name);

@ -135,14 +135,15 @@ ImBuf* get_brush_icon(Brush *brush)
if (path[0])
brush->icon_imbuf= IMB_loadiffname(path, flags);
}
if (brush->icon_imbuf)
BKE_icon_changed(BKE_icon_getid(&brush->id));
}
}
}
if (!(brush->icon_imbuf))
brush->id.icon_id = 0;
else
BKE_icon_changed(BKE_icon_getid(&(brush->id)));
return brush->icon_imbuf;
}
@ -313,15 +314,6 @@ void ED_preview_free_dbase(void)
free_main(pr_main);
}
static Object *find_object(ListBase *lb, const char *name)
{
Object *ob;
for(ob= lb->first; ob; ob= ob->id.next)
if(strcmp(ob->id.name+2, name)==0)
break;
return ob;
}
static int preview_mat_has_sss(Material *mat, bNodeTree *ntree)
{
if(mat) {
@ -528,12 +520,12 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
if(la && la->type==LA_SUN && (la->sun_effect_type & LA_SUN_EFFECT_SKY)) {
sce->lay= 1<<MA_ATMOS;
sce->world= scene->world;
sce->camera= (Object *)find_object(&pr_main->object, "CameraAtmo");
sce->camera= (Object *)BLI_findstring(&pr_main->object, "CameraAtmo", offsetof(ID, name)+2);
}
else {
sce->lay= 1<<MA_LAMP;
sce->world= NULL;
sce->camera= (Object *)find_object(&pr_main->object, "Camera");
sce->camera= (Object *)BLI_findstring(&pr_main->object, "Camera", offsetof(ID, name)+2);
}
sce->r.mode &= ~R_SHADOW;
@ -1256,10 +1248,11 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat
br->icon_imbuf= get_brush_icon(br);
memset(sp->pr_rect, 0x888888, sp->sizex*sp->sizey*sizeof(unsigned int));
if(!(br->icon_imbuf) || !(br->icon_imbuf->rect))
return;
memset(sp->pr_rect, 0x888888, sp->sizex*sp->sizey*sizeof(unsigned int));
icon_copy_rect(br->icon_imbuf, sp->sizex, sp->sizey, sp->pr_rect);
*do_update= 1;

@ -1337,7 +1337,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *str, int
/* to save, we first get absolute path */
BLI_path_abs(str, G.main->name);
if (BKE_write_ibuf(scene, ibuf, str, imtype, scene->r.subimtype, scene->r.quality)) {
if (BKE_write_ibuf(ibuf, str, imtype, scene->r.subimtype, scene->r.quality)) {
retval = OPERATOR_FINISHED;
}
else {

@ -1133,7 +1133,10 @@ void ED_area_exit(bContext *C, ScrArea *sa)
ARegion *ar;
if (sa->spacetype == SPACE_FILE) {
ED_fileselect_exit(C, (SpaceFile*)(sa) ? sa->spacedata.first : CTX_wm_space_data(C));
SpaceLink *sl= sa->spacedata.first;
if(sl && sl->spacetype == SPACE_FILE) {
ED_fileselect_exit(C, (SpaceFile *)sl);
}
}
CTX_wm_area_set(C, sa);

@ -1871,6 +1871,8 @@ static void SCREEN_OT_keyframe_jump(wmOperatorType *ot)
static int screen_set_exec(bContext *C, wmOperator *op)
{
bScreen *screen= CTX_wm_screen(C);
bScreen *screen_prev= screen;
ScrArea *sa= CTX_wm_area(C);
int tot= BLI_countlist(&CTX_data_main(C)->screen);
int delta= RNA_int_get(op->ptr, "delta");
@ -1879,15 +1881,11 @@ static int screen_set_exec(bContext *C, wmOperator *op)
if(screen->temp)
return OPERATOR_CANCELLED;
/* return to previous state before switching screens */
if(sa && sa->full)
ED_screen_full_restore(C, sa);
if(delta==1) {
while(tot--) {
screen= screen->id.next;
if(screen==NULL) screen= CTX_data_main(C)->screen.first;
if(screen->winid==0 && screen->full==0)
if(screen->winid==0 && screen->full==0 && screen != screen_prev)
break;
}
}
@ -1895,7 +1893,7 @@ static int screen_set_exec(bContext *C, wmOperator *op)
while(tot--) {
screen= screen->id.prev;
if(screen==NULL) screen= CTX_data_main(C)->screen.last;
if(screen->winid==0 && screen->full==0)
if(screen->winid==0 && screen->full==0 && screen != screen_prev)
break;
}
}
@ -1903,7 +1901,12 @@ static int screen_set_exec(bContext *C, wmOperator *op)
screen= NULL;
}
if(screen) {
if(screen && screen_prev != screen) {
/* return to previous state before switching screens */
if(sa && sa->full) {
ED_screen_full_restore(C, sa); /* may free 'screen_prev' */
}
ED_screen_set(C, screen);
return OPERATOR_FINISHED;
}

@ -95,7 +95,7 @@ static int screenshot_exec(bContext *C, wmOperator *op)
ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0);
ibuf->rect= scd->dumprect;
BKE_write_ibuf(scene, ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality);
BKE_write_ibuf(ibuf, path, scene->r.imtype, scene->r.subimtype, scene->r.quality);
IMB_freeImBuf(ibuf);
@ -280,7 +280,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
BKE_makepicstring(name, rd.pic, cfra, rd.imtype, rd.scemode & R_EXTENSION, TRUE);
ibuf->rect= sj->dumprect;
ok= BKE_write_ibuf(sj->scene, ibuf, name, rd.imtype, rd.subimtype, rd.quality);
ok= BKE_write_ibuf(ibuf, name, rd.imtype, rd.subimtype, rd.quality);
if(ok==0) {
printf("Write error: cannot save %s\n", name);

@ -517,9 +517,6 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", RKEY, KM_PRESS, 0, 0);
RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush.use_rake");
kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", AKEY, KM_PRESS, KM_SHIFT, 0);
RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush.use_airbrush");
/* Vertex Paint mode */
keymap= WM_keymap_find(keyconf, "Vertex Paint", 0, 0);
keymap->poll= vertex_paint_mode_poll;

@ -854,7 +854,7 @@ int file_next_exec(bContext *C, wmOperator *UNUSED(unused))
folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
folderlist_popdir(sfile->folders_next, sfile->params->dir);
// update folder_prev so we can check for it in folderlist_clear_next()
// update folders_prev so we can check for it in folderlist_clear_next()
folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
file_change_dir(C, 1);

@ -469,13 +469,12 @@ int folderlist_clear_next(struct SpaceFile *sfile)
/* not listbase itself */
void folderlist_free(ListBase* folderlist)
{
FolderList *folder;
if (folderlist){
FolderList *folder;
for(folder= folderlist->first; folder; folder= folder->next)
MEM_freeN(folder->foldername);
BLI_freelistN(folderlist);
}
folderlist= NULL;
}
ListBase *folderlist_duplicate(ListBase* folderlist)
@ -1007,7 +1006,7 @@ void filelist_from_library(struct FileList* filelist)
{
LinkNode *l, *names, *previews;
struct ImBuf* ima;
int ok, i, nnames, idcode;
int ok, i, nprevs, nnames, idcode;
char filename[FILE_MAXDIR+FILE_MAXFILE];
char dir[FILE_MAX], group[GROUP_MAX];
@ -1031,17 +1030,18 @@ void filelist_from_library(struct FileList* filelist)
idcode= groupname_to_code(group);
// memory for strings is passed into filelist[i].relname
// and free'd in freefilelist
previews = NULL;
/* memory for strings is passed into filelist[i].relname
* and free'd in freefilelist */
if (idcode) {
previews= BLO_blendhandle_get_previews(filelist->libfiledata, idcode);
previews= BLO_blendhandle_get_previews(filelist->libfiledata, idcode, &nprevs);
names= BLO_blendhandle_get_datablock_names(filelist->libfiledata, idcode, &nnames);
/* ugh, no rewind, need to reopen */
BLO_blendhandle_close(filelist->libfiledata);
filelist->libfiledata= BLO_blendhandle_from_file(dir, NULL);
} else {
previews= NULL;
nprevs= 0;
names= BLO_blendhandle_get_linkable_groups(filelist->libfiledata);
nnames= BLI_linklist_length(names);
}
@ -1064,7 +1064,10 @@ void filelist_from_library(struct FileList* filelist)
}
}
if(previews) {
if(previews && (nnames != nprevs)) {
printf("filelist_from_library: error, found %d items, %d previews\n", nnames, nprevs);
}
else if(previews) {
for (i=0, l= previews; i<nnames; i++, l= l->next) {
PreviewImage *img= l->link;

@ -655,9 +655,10 @@ void ED_fileselect_clear(struct bContext *C, struct SpaceFile *sfile)
void ED_fileselect_exit(struct bContext *C, struct SpaceFile *sfile)
{
if(!sfile) return;
if(sfile->op)
if(sfile->op) {
WM_event_fileselect_event(C, sfile->op, EVT_FILESELECT_EXTERNAL_CANCEL);
sfile->op = NULL;
sfile->op = NULL;
}
folderlist_free(sfile->folders_prev);
folderlist_free(sfile->folders_next);

@ -484,11 +484,8 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode)
*/
for (ce= ked.list.first; ce; ce= ce->next) {
/* set frame for validation callback to refer to */
if (ale)
ked.f1= BKE_nla_tweakedit_remap(adt, ce->cfra, NLATIME_CONVERT_UNMAP);
else
ked.f1= ce->cfra;
ked.f1= BKE_nla_tweakedit_remap(adt, ce->cfra, NLATIME_CONVERT_UNMAP);
/* select elements with frame number matching cfraelem */
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, ok_cb, select_cb, NULL);
}

@ -925,7 +925,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera
}
BKE_image_release_renderresult(scene, ima);
}
else if (BKE_write_ibuf(scene, ibuf, path, sima->imtypenr, scene->r.subimtype, scene->r.quality)) {
else if (BKE_write_ibuf(ibuf, path, sima->imtypenr, scene->r.subimtype, scene->r.quality)) {
ok= TRUE;
}

@ -1643,6 +1643,8 @@ void draw_nodespace_color_info(ARegion *ar, int color_manage, int channels, int
BLF_draw_ascii(blf_mono_font, str, sizeof(str));
dx += BLF_width(blf_mono_font, str);
}
(void)dx;
}
#if 0

@ -49,15 +49,15 @@
#include "time_intern.h"
/* ****************** Start/End Frame Operators *******************************/
static int time_set_sfra_exec (bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
int frame= CFRA;
int frame;
if (scene == NULL)
return OPERATOR_CANCELLED;
frame= CFRA;
/* if 'end frame' (Preview Range or Actual) is less than 'frame',
* clamp 'frame' to 'end frame'
*/
@ -93,11 +93,13 @@ static void TIME_OT_start_frame_set (wmOperatorType *ot)
static int time_set_efra_exec (bContext *C, wmOperator *UNUSED(op))
{
Scene *scene= CTX_data_scene(C);
int frame= CFRA;
int frame;
if (scene == NULL)
return OPERATOR_CANCELLED;
frame= CFRA;
/* if 'start frame' (Preview Range or Actual) is greater than 'frame',
* clamp 'frame' to 'end frame'
*/

@ -1537,7 +1537,7 @@ static void draw_pose_dofs(Object *ob)
}
if (pchan->ikflag & BONE_IK_XLIMIT) {
/* OpenGL requires rotations in degrees; so we're taking the average angle here */
/* OpenGL requires rotations in degrees; so we're taking the average angle here */
theta= RAD2DEGF(0.5f * (pchan->limitmin[0] + pchan->limitmax[0]));
glRotatef(theta, 1.0f, 0.0f, 0.0f);
@ -1615,10 +1615,17 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
bone= pchan->bone;
if (bone && !(bone->flag & (BONE_HIDDEN_P|BONE_NO_DEFORM|BONE_HIDDEN_PG))) {
if (bone->flag & (BONE_SELECTED)) {
if (bone->layer & arm->layer)
draw_sphere_bone_dist(smat, imat, pchan, NULL);
if (bone) {
/* 1) bone must be visible, 2) for OpenGL select-drawing cannot have unselectable [#27194]
* NOTE: this is the only case with NO_DEFORM==0 flag, as this is for envelope influence drawing
*/
if ( (bone->flag & (BONE_HIDDEN_P|BONE_NO_DEFORM|BONE_HIDDEN_PG))==0 &&
((G.f & G_PICKSEL)==0 || (bone->flag & BONE_UNSELECTABLE)==0) )
{
if (bone->flag & (BONE_SELECTED)) {
if (bone->layer & arm->layer)
draw_sphere_bone_dist(smat, imat, pchan, NULL);
}
}
}
}
@ -1642,14 +1649,18 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
bone= pchan->bone;
arm->layer_used |= bone->layer;
if ( (bone) && !(bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG)) ) {
/* 1) bone must be visible, 2) for OpenGL select-drawing cannot have unselectable [#27194] */
if ( (bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))==0 &&
((G.f & G_PICKSEL)==0 || (bone->flag & BONE_UNSELECTABLE)==0) )
{
if (bone->layer & arm->layer) {
int use_custom = (pchan->custom) && !(arm->flag & ARM_NO_CUSTOM);
glPushMatrix();
if(use_custom && pchan->custom_tx) {
glMultMatrixf(pchan->custom_tx->pose_mat);
} else {
}
else {
glMultMatrixf(pchan->pose_mat);
}
@ -1710,15 +1721,19 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
bone= pchan->bone;
if ((bone) && !(bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))) {
/* 1) bone must be visible, 2) for OpenGL select-drawing cannot have unselectable [#27194] */
if ( (bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))==0 &&
((G.f & G_PICKSEL)==0 || (bone->flag & BONE_UNSELECTABLE)==0) )
{
if (bone->layer & arm->layer) {
if (pchan->custom) {
if ((dt < OB_SOLID) || (bone->flag & BONE_DRAWWIRE)) {
glPushMatrix();
if(pchan->custom_tx) {
glMultMatrixf(pchan->custom_tx->pose_mat);
} else {
}
else {
glMultMatrixf(pchan->pose_mat);
}
@ -1788,7 +1803,10 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
bone= pchan->bone;
arm->layer_used |= bone->layer;
if ((bone) && !(bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))) {
/* 1) bone must be visible, 2) for OpenGL select-drawing cannot have unselectable [#27194] */
if ( (bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))==0 &&
((G.f & G_PICKSEL)==0 || (bone->flag & BONE_UNSELECTABLE)==0) )
{
if (bone->layer & arm->layer) {
if ((do_dashed & 1) && (pchan->parent)) {
/* Draw a line from our root to the parent's tip
@ -1892,7 +1910,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
/* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */
if ((G.f & G_PICKSEL) == 0) {
float vec[3];
unsigned char col[4];
float col_f[4];
glGetFloatv(GL_CURRENT_COLOR, col_f); /* incase this is not set below */
@ -1911,7 +1929,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
else if (dt > OB_WIRE) {
UI_GetThemeColor3ubv(TH_TEXT, col);
}
/* Draw names of bone */
if (arm->flag & ARM_DRAWNAMES) {
mid_v3_v3v3(vec, pchan->pose_head, pchan->pose_tail);
@ -1924,10 +1942,10 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
copy_m4_m4(bmat, pchan->pose_mat);
bone_matrix_translate_y(bmat, pchan->bone->length);
glMultMatrixf(bmat);
glColor3ubv(col);
drawaxes(pchan->bone->length*0.25f, OB_ARROWS);
glPopMatrix();
}
}
@ -2440,7 +2458,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in
/* we use color for solid lighting */
glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
glEnable(GL_COLOR_MATERIAL);
glColor3ub(255,0,255); // clear spec
glColor3ub(255,255,255); // clear spec
glDisable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);

@ -156,6 +156,44 @@ RegionView3D *ED_view3d_context_rv3d(bContext *C)
return rv3d;
}
/* ideally would return an rv3d but in some cases the region is needed too
* so return that, the caller can then access the ar->regiondata */
ARegion *ED_view3d_context_region_unlock(bContext *C)
{
ScrArea *sa= CTX_wm_area(C);
if(sa && sa->spacetype==SPACE_VIEW3D) {
ARegion *ar= CTX_wm_region(C);
if(ar) {
RegionView3D *rv3d= ar->regiondata;
if(rv3d && rv3d->viewlock == 0) {
return ar;
}
else {
ARegion *ar_unlock_user= NULL;
ARegion *ar_unlock= NULL;
for(ar= sa->regionbase.first; ar; ar= ar->next) {
/* find the first unlocked rv3d */
if(ar->regiondata && ar->regiontype == RGN_TYPE_WINDOW) {
rv3d= ar->regiondata;
if(rv3d->viewlock == 0) {
ar_unlock= ar;
if(rv3d->persp==RV3D_PERSP || rv3d->persp==RV3D_CAMOB) {
ar_unlock_user= ar;
break;
}
}
}
}
/* camera/perspective view get priority when the active region is locked */
if(ar_unlock_user) return ar_unlock_user;
if(ar_unlock) return ar_unlock;
}
}
}
return NULL;
}
/* Most of the time this isn't needed since you could assume the view matrix was
* set while drawing, however when functions like mesh_foreachScreenVert are
* called by selection tools, we can't be sure this object was the last.

@ -2212,7 +2212,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
}
/* creates own 3d views, used by the sequencer */
ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype, char err_out[256])
ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int width, int height, unsigned int flag, int drawtype, char err_out[256])
{
View3D v3d= {NULL};
ARegion ar= {NULL};
@ -2223,7 +2223,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height
ar.regiondata= &rv3d;
ar.regiontype= RGN_TYPE_WINDOW;
v3d.camera= scene->camera;
v3d.camera= camera;
v3d.lay= scene->lay;
v3d.drawtype = drawtype;
v3d.flag2 = V3D_RENDER_OVERRIDE;

@ -790,7 +790,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
View3D *v3d = vod->sa->spacedata.first;
if(v3d->camera) {
view3d_settings_from_ob(v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
view3d_apply_ob(v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
}
if(rv3d->persp==RV3D_CAMOB) {
@ -1635,10 +1635,10 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
if (rv3d->persp==RV3D_CAMOB) {
rv3d->persp= RV3D_PERSP;
smooth_view(C, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
}
else {
smooth_view(C, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
}
}
// XXX BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
@ -1778,10 +1778,10 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op)) /* like a loca
if (rv3d->persp==RV3D_CAMOB) {
rv3d->persp= RV3D_PERSP;
smooth_view(C, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
}
else {
smooth_view(C, NULL, NULL, new_ofs, NULL, ok_dist ? &new_dist : NULL, NULL);
smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, ok_dist ? &new_dist : NULL, NULL);
}
/* smooth view does viewlock RV3D_BOXVIEW copy */
@ -1814,10 +1814,12 @@ static int viewcenter_cursor_exec(bContext *C, wmOperator *UNUSED(op))
Scene *scene= CTX_data_scene(C);
if (rv3d) {
ARegion *ar= CTX_wm_region(C);
/* non camera center */
float new_ofs[3];
negate_v3_v3(new_ofs, give_cursor(scene, v3d));
smooth_view(C, NULL, NULL, new_ofs, NULL, NULL, NULL);
smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, NULL, NULL);
/* smooth view does viewlock RV3D_BOXVIEW copy */
}
@ -2047,7 +2049,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
new_dist = ((new_dist*scale) >= 0.001f * v3d->grid)? new_dist*scale:0.001f * v3d->grid;
}
smooth_view(C, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
if(rv3d->viewlock & RV3D_BOXVIEW)
view3d_boxview_sync(CTX_wm_area(C), ar);
@ -2146,14 +2148,14 @@ static EnumPropertyItem prop_view_items[] = {
/* would like to make this a generic function - outside of transform */
static void axis_set_view(bContext *C, float q1, float q2, float q3, float q4, short view, int perspo, int align_active)
static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar, float q1, float q2, float q3, float q4, short view, int perspo, int align_active)
{
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
RegionView3D *rv3d= ar->regiondata; /* no NULL check is needed, poll checks */
float new_quat[4];
new_quat[0]= q1; new_quat[1]= q2;
new_quat[2]= q3; new_quat[3]= q4;
normalize_qt(new_quat);
if(align_active) {
/* align to active object */
@ -2194,7 +2196,7 @@ static void axis_set_view(bContext *C, float q1, float q2, float q3, float q4, s
}
if(rv3d->viewlock) {
ED_region_tag_redraw(CTX_wm_region(C));
ED_region_tag_redraw(ar);
return;
}
@ -2203,14 +2205,14 @@ static void axis_set_view(bContext *C, float q1, float q2, float q3, float q4, s
if (U.uiflag & USER_AUTOPERSP) rv3d->persp= view ? RV3D_ORTHO : RV3D_PERSP;
else if(rv3d->persp==RV3D_CAMOB) rv3d->persp= perspo;
smooth_view(C, v3d->camera, NULL, rv3d->ofs, new_quat, NULL, NULL);
smooth_view(C, v3d, ar, v3d->camera, NULL, rv3d->ofs, new_quat, NULL, NULL);
}
else {
if (U.uiflag & USER_AUTOPERSP) rv3d->persp= view ? RV3D_ORTHO : RV3D_PERSP;
else if(rv3d->persp==RV3D_CAMOB) rv3d->persp= perspo;
smooth_view(C, NULL, NULL, NULL, new_quat, NULL, NULL);
smooth_view(C, v3d, ar, NULL, NULL, NULL, new_quat, NULL, NULL);
}
}
@ -2218,7 +2220,8 @@ static void axis_set_view(bContext *C, float q1, float q2, float q3, float q4, s
static int viewnumpad_exec(bContext *C, wmOperator *op)
{
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
ARegion *ar= ED_view3d_context_region_unlock(C);
RegionView3D *rv3d= ar->regiondata; /* no NULL check is needed, poll checks */
Scene *scene= CTX_data_scene(C);
static int perspo=RV3D_PERSP;
int viewnum, align_active, nextperspo;
@ -2240,27 +2243,27 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
switch (viewnum) {
case RV3D_VIEW_BOTTOM :
axis_set_view(C, 0.0, -1.0, 0.0, 0.0, viewnum, nextperspo, align_active);
axis_set_view(C, v3d, ar, 0.0, -1.0, 0.0, 0.0, viewnum, nextperspo, align_active);
break;
case RV3D_VIEW_BACK:
axis_set_view(C, 0.0, 0.0, (float)-cos(M_PI/4.0), (float)-cos(M_PI/4.0), viewnum, nextperspo, align_active);
axis_set_view(C, v3d, ar, 0.0, 0.0, (float)-cos(M_PI/4.0), (float)-cos(M_PI/4.0), viewnum, nextperspo, align_active);
break;
case RV3D_VIEW_LEFT:
axis_set_view(C, 0.5, -0.5, 0.5, 0.5, viewnum, nextperspo, align_active);
axis_set_view(C, v3d, ar, 0.5, -0.5, 0.5, 0.5, viewnum, nextperspo, align_active);
break;
case RV3D_VIEW_TOP:
axis_set_view(C, 1.0, 0.0, 0.0, 0.0, viewnum, nextperspo, align_active);
axis_set_view(C, v3d, ar, 1.0, 0.0, 0.0, 0.0, viewnum, nextperspo, align_active);
break;
case RV3D_VIEW_FRONT:
axis_set_view(C, (float)cos(M_PI/4.0), (float)-sin(M_PI/4.0), 0.0, 0.0, viewnum, nextperspo, align_active);
axis_set_view(C, v3d, ar, (float)cos(M_PI/4.0), (float)-sin(M_PI/4.0), 0.0, 0.0, viewnum, nextperspo, align_active);
break;
case RV3D_VIEW_RIGHT:
axis_set_view(C, 0.5, -0.5, -0.5, -0.5, viewnum, nextperspo, align_active);
axis_set_view(C, v3d, ar, 0.5, -0.5, -0.5, -0.5, viewnum, nextperspo, align_active);
break;
case RV3D_VIEW_CAMERA:
@ -2316,13 +2319,13 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
/* finally do snazzy view zooming */
rv3d->persp= RV3D_CAMOB;
smooth_view(C, NULL, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);
smooth_view(C, v3d, ar, NULL, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);
}
else{
/* return to settings of last view */
/* does smooth_view too */
axis_set_view(C, rv3d->lviewquat[0], rv3d->lviewquat[1], rv3d->lviewquat[2], rv3d->lviewquat[3], rv3d->lview, rv3d->lpersp, 0);
axis_set_view(C, v3d, ar, rv3d->lviewquat[0], rv3d->lviewquat[1], rv3d->lviewquat[2], rv3d->lviewquat[3], rv3d->lview, rv3d->lpersp, 0);
}
}
break;
@ -2346,7 +2349,7 @@ void VIEW3D_OT_viewnumpad(wmOperatorType *ot)
/* api callbacks */
ot->exec= viewnumpad_exec;
ot->poll= ED_operator_region_view3d_active;
ot->poll= ED_operator_rv3d_unlock_poll;
/* flags */
ot->flag= 0;
@ -2364,7 +2367,8 @@ static EnumPropertyItem prop_view_orbit_items[] = {
static int vieworbit_exec(bContext *C, wmOperator *op)
{
RegionView3D *rv3d= CTX_wm_region_view3d(C);
ARegion *ar= ED_view3d_context_region_unlock(C);
RegionView3D *rv3d= ar->regiondata; /* no NULL check is needed, poll checks */
float phi, q1[4], new_quat[4];
int orbitdir;
@ -2398,7 +2402,7 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
rv3d->view= 0;
}
smooth_view(C, NULL, NULL, NULL, new_quat, NULL, NULL);
smooth_view(C, CTX_wm_view3d(C), ar, NULL, NULL, NULL, new_quat, NULL, NULL);
}
}
@ -2414,7 +2418,7 @@ void VIEW3D_OT_view_orbit(wmOperatorType *ot)
/* api callbacks */
ot->exec= vieworbit_exec;
ot->poll= ED_operator_region_view3d_active;
ot->poll= ED_operator_rv3d_unlock_poll;
/* flags */
ot->flag= 0;
@ -2470,8 +2474,8 @@ void VIEW3D_OT_view_pan(wmOperatorType *ot)
static int viewpersportho_exec(bContext *C, wmOperator *UNUSED(op))
{
ARegion *ar= CTX_wm_region(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
ARegion *ar= ED_view3d_context_region_unlock(C);
RegionView3D *rv3d= ar->regiondata; /* no NULL check is needed, poll checks */
if(rv3d->viewlock==0) {
if(rv3d->persp!=RV3D_ORTHO)
@ -2493,12 +2497,13 @@ void VIEW3D_OT_view_persportho(wmOperatorType *ot)
/* api callbacks */
ot->exec= viewpersportho_exec;
ot->poll= ED_operator_region_view3d_active;
ot->poll= ED_operator_rv3d_unlock_poll;
/* flags */
ot->flag= 0;
}
/* ******************** add background image operator **************** */
static BGpic *background_image_add(bContext *C)

@ -540,7 +540,7 @@ static int flyApply(bContext *C, FlyInfo *fly)
{
#define FLY_ROTATE_FAC 2.5f /* more is faster */
#define FLY_ZUP_CORRECT_FAC 0.1f /* ammount to correct per step */
#define FLY_ZUP_CORRECT_FAC 0.1f /* amount to correct per step */
#define FLY_ZUP_CORRECT_ACCEL 0.05f /* increase upright momentum each step */
/*

@ -147,10 +147,6 @@ void VIEW3D_OT_select_circle(struct wmOperatorType *ot);
void VIEW3D_OT_select_border(struct wmOperatorType *ot);
void VIEW3D_OT_select_lasso(struct wmOperatorType *ot);
/* view3d_view.c */
void view3d_settings_from_ob(struct Object *ob, float *ofs, float *quat, float *dist, float *lens);
int view3d_is_ortho(View3D *v3d, RegionView3D *rv3d);
void VIEW3D_OT_smoothview(struct wmOperatorType *ot);
void VIEW3D_OT_setcameratoview(struct wmOperatorType *ot);
void VIEW3D_OT_object_as_camera(struct wmOperatorType *ot);
@ -162,7 +158,7 @@ int boundbox_clip(RegionView3D *rv3d, float obmat[][4], struct BoundBox *bb);
void centerview(struct ARegion *ar, View3D *v3d);
void smooth_view(struct bContext *C, struct Object *, struct Object *, float *ofs, float *quat, float *dist, float *lens);
void smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *ar, struct Object *, struct Object *, float *ofs, float *quat, float *dist, float *lens);
void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect); /* rect: for picking */
void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d);

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