Merging with trunk up to r38631.

This commit is contained in:
Joerg Mueller 2011-07-23 16:34:30 +00:00
commit 682cc63161
25 changed files with 353 additions and 53 deletions

@ -155,6 +155,7 @@ option(WITH_IMAGE_DDS "Enable DDS Image Support" ON)
option(WITH_IMAGE_CINEON "Enable CINEON and DPX Image Support" ON)
option(WITH_IMAGE_HDR "Enable HDR Image Support" ON)
option(WITH_IMAGE_REDCODE "Enable RedCode Image Support" OFF)
option(WITH_IMAGE_FRAMESERVER "Enable image FrameServer Support for rendering" ON)
# Audio/Video format support
option(WITH_CODEC_FFMPEG "Enable FFMPeg Support (http://ffmpeg.org)" OFF)

@ -340,7 +340,7 @@ class AlignObjects(bpy.types.Operator):
bb_quality = BoolProperty(
name="High Quality",
description="Enables high quality calculation of the bounding box for perfect results on complex shape meshes with rotation/scale (Slow)",
default=False)
default=True)
align_mode = EnumProperty(items=(
('OPT_1', "Negative Sides", ""),
@ -380,4 +380,4 @@ class AlignObjects(bpy.types.Operator):
self.report({'WARNING'}, "No objects with bound-box selected")
return {'CANCELLED'}
else:
return {'FINISHED'}
return {'FINISHED'}

@ -198,6 +198,10 @@ class IMAGE_MT_uvs_transform(bpy.types.Menu):
layout.operator("transform.rotate")
layout.operator("transform.resize")
layout.separator()
layout.operator("transform.shear")
class IMAGE_MT_uvs_snap(bpy.types.Menu):
bl_label = "Snap"

@ -60,8 +60,10 @@ class INFO_HT_header(bpy.types.Header):
layout.template_running_jobs()
layout.template_reports_banner()
layout.label(text=scene.statistics())
row = layout.row(align=True)
row.operator("wm.splash", text="", icon='BLENDER', emboss=False)
row.label(text=scene.statistics())
# XXX: this should be right-aligned to the RHS of the region
layout.operator("wm.window_fullscreen_toggle", icon='FULLSCREEN_ENTER', text="")

@ -68,7 +68,7 @@ class VIEW3D_HT_header(bpy.types.Header):
if obj:
# Particle edit
if obj.mode == 'PARTICLE_EDIT':
row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True, toggle=True)
row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True)
# Occlude geometry
if view.viewport_shade in {'SOLID', 'SHADED', 'TEXTURED'} and (obj.mode == 'PARTICLE_EDIT' or (obj.mode == 'EDIT' and obj.type == 'MESH')):

@ -279,6 +279,10 @@ if(WITH_IMAGE_CINEON)
add_definitions(-DWITH_CINEON)
endif()
if(WITH_IMAGE_FRAMESERVER)
add_definitions(-DWITH_FRAMESERVER)
endif()
if(WITH_IMAGE_HDR)
add_definitions(-DWITH_HDR)
endif()

@ -22,6 +22,7 @@ incs += ' ' + env['BF_ZLIB_INC']
defs = [ 'GLEW_STATIC' ]
defs.append('WITH_SMOKE') # TODO, make optional
defs.append('WITH_FRAMESERVER') # TODO, make optional
if env['WITH_BF_PYTHON']:
incs += ' ../python'

@ -105,13 +105,18 @@ bMovieHandle *BKE_get_movie_handle(int imtype)
mh.get_movie_path = filepath_ffmpeg;
}
#endif
#ifdef WITH_FRAMESERVER
if (imtype == R_FRAMESERVER) {
mh.start_movie = start_frameserver;
mh.append_movie = append_frameserver;
mh.end_movie = end_frameserver;
mh.get_next_frame = frameserver_loop;
}
#endif
/* incase all above are disabled */
(void)imtype;
return &mh;
}

@ -22,6 +22,7 @@
*
*/
#ifdef WITH_FRAMESERVER
#include <string.h>
#include <stdio.h>
@ -381,3 +382,4 @@ void end_frameserver(void)
shutdown_socket_system();
}
#endif /* WITH_FRAMESERVER */

@ -39,6 +39,7 @@ struct Tex;
struct bContext;
struct bNode;
struct ID;
struct ScrArea;
/* drawnode.c */
void ED_init_node_butfuncs(void);
@ -51,6 +52,8 @@ void ED_node_generic_update(struct Main *bmain, struct bNodeTree *ntree, struct
void ED_node_shader_default(struct Material *ma);
void ED_node_composit_default(struct Scene *sce);
void ED_node_texture_default(struct Tex *tex);
void ED_node_link_intersect_test(struct ScrArea *sa, int test);
void ED_node_link_insert(struct ScrArea *sa);
/* node ops.c */
void ED_operatormacros_node(void);

@ -108,7 +108,7 @@ void OBJECT_OT_material_slot_add(wmOperatorType *ot)
/* identifiers */
ot->name= "Add Material Slot";
ot->idname= "OBJECT_OT_material_slot_add";
ot->description="Add a new material slot or duplicate the selected one";
ot->description="Add a new material slot";
/* api callbacks */
ot->exec= material_slot_add_exec;

@ -1869,10 +1869,17 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link)
else {
/* check cyclic */
if(link->fromnode->level >= link->tonode->level && link->tonode->level!=0xFFF) {
if(link->fromnode->flag & SELECT)
th_col1= TH_EDGE_SELECT;
if(link->tonode->flag & SELECT)
th_col2= TH_EDGE_SELECT;
/* special indicated link, on drop-node */
if(link->flag & NODE_LINKFLAG_HILITE) {
th_col1= th_col2= TH_ACTIVE;
}
else {
/* regular link */
if(link->fromnode->flag & SELECT)
th_col1= TH_EDGE_SELECT;
if(link->tonode->flag & SELECT)
th_col2= TH_EDGE_SELECT;
}
do_shaded= 1;
do_triple= 1;
}

@ -2492,6 +2492,151 @@ void NODE_OT_links_cut(wmOperatorType *ot)
RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX);
}
/* ********************* automatic node insert on dragging ******************* */
/* assumes sockets in list */
static bNodeSocket *socket_best_match(ListBase *sockets, int type)
{
bNodeSocket *sock;
/* first, match type */
for(sock= sockets->first; sock; sock= sock->next)
if(!(sock->flag & SOCK_HIDDEN))
if(type == sock->type)
return sock;
/* then just use first unhidden socket */
for(sock= sockets->first; sock; sock= sock->next)
if(!(sock->flag & SOCK_HIDDEN))
return sock;
/* OK, let's unhide proper one */
for(sock= sockets->first; sock; sock= sock->next) {
if(type == sock->type) {
sock->flag &= ~SOCK_HIDDEN;
return sock;
}
}
/* just the first */
sock= sockets->first;
sock->flag &= ~SOCK_HIDDEN;
return sockets->first;
}
/* prevent duplicate testing code below */
static SpaceNode *ed_node_link_conditions(ScrArea *sa, bNode **select)
{
SpaceNode *snode= sa?sa->spacedata.first:NULL;
bNode *node;
bNodeLink *link;
/* no unlucky accidents */
if(sa==NULL || sa->spacetype!=SPACE_NODE) return NULL;
*select= NULL;
for(node= snode->edittree->nodes.first; node; node= node->next) {
if(node->flag & SELECT) {
if(*select)
break;
else
*select= node;
}
}
/* only one selected */
if(node || *select==NULL) return NULL;
/* correct node */
if((*select)->inputs.first==NULL || (*select)->outputs.first==NULL) return NULL;
/* test node for links */
for(link= snode->edittree->links.first; link; link=link->next) {
if(link->tonode == *select || link->fromnode == *select)
return NULL;
}
return snode;
}
/* assumes link with NODE_LINKFLAG_HILITE set */
void ED_node_link_insert(ScrArea *sa)
{
bNode *node, *select;
SpaceNode *snode= ed_node_link_conditions(sa, &select);
bNodeLink *link;
bNodeSocket *sockto;
if(snode==NULL) return;
/* get the link */
for(link= snode->edittree->links.first; link; link=link->next)
if(link->flag & NODE_LINKFLAG_HILITE)
break;
if(link) {
node= link->tonode;
sockto= link->tosock;
link->tonode= select;
link->tosock= socket_best_match(&select->inputs, link->fromsock->type);
link->flag &= ~NODE_LINKFLAG_HILITE;
nodeAddLink(snode->edittree, select, socket_best_match(&select->outputs, sockto->type), node, sockto);
ntreeSolveOrder(snode->edittree); /* needed for pointers */
snode_tag_changed(snode, select);
ED_node_changed_update(snode->id, select);
}
}
/* test == 0, clear all intersect flags */
void ED_node_link_intersect_test(ScrArea *sa, int test)
{
bNode *select;
SpaceNode *snode= ed_node_link_conditions(sa, &select);
bNodeLink *link, *selink=NULL;
float mcoords[6][2];
if(snode==NULL) return;
/* clear flags */
for(link= snode->edittree->links.first; link; link=link->next)
link->flag &= ~NODE_LINKFLAG_HILITE;
if(test==0) return;
/* okay, there's 1 node, without links, now intersect */
mcoords[0][0]= select->totr.xmin;
mcoords[0][1]= select->totr.ymin;
mcoords[1][0]= select->totr.xmax;
mcoords[1][1]= select->totr.ymin;
mcoords[2][0]= select->totr.xmax;
mcoords[2][1]= select->totr.ymax;
mcoords[3][0]= select->totr.xmin;
mcoords[3][1]= select->totr.ymax;
mcoords[4][0]= select->totr.xmin;
mcoords[4][1]= select->totr.ymin;
mcoords[5][0]= select->totr.xmax;
mcoords[5][1]= select->totr.ymax;
/* we only tag a single link for intersect now */
/* idea; use header dist when more? */
for(link= snode->edittree->links.first; link; link=link->next) {
if(cut_links_intersect(link, mcoords, 5)) { /* intersect code wants edges */
if(selink)
break;
selink= link;
}
}
if(link==NULL && selink)
selink->flag |= NODE_LINKFLAG_HILITE;
}
/* ******************************** */
// XXX some code needing updating to operators...
@ -2914,7 +3059,8 @@ void NODE_OT_delete(wmOperatorType *ot)
/* note: in cmp_util.c is similar code, for node_compo_pass_on() */
/* used for disabling node (similar code in node_draw.c for disable line) */
static void node_delete_reconnect(bNodeTree* tree, bNode* node) {
static void node_delete_reconnect(bNodeTree* tree, bNode* node)
{
bNodeLink *link, *next;
bNodeSocket *valsocket= NULL, *colsocket= NULL, *vecsocket= NULL;
bNodeSocket *deliveringvalsocket= NULL, *deliveringcolsocket= NULL, *deliveringvecsocket= NULL;
@ -3142,3 +3288,5 @@ void NODE_OT_add_file(wmOperatorType *ot)
RNA_def_string(ot->srna, "name", "Image", 24, "Name", "Datablock name to assign.");
}

@ -969,7 +969,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
break;
case OKEY:
if (t->flag & T_PROP_EDIT && event->shift) {
t->prop_mode = (t->prop_mode + 1) % 6;
t->prop_mode = (t->prop_mode + 1) % PROP_MODE_MAX;
calculatePropRatio(t);
t->redraw |= TREDRAW_HARD;
}

@ -87,6 +87,7 @@
#include "ED_object.h"
#include "ED_markers.h"
#include "ED_mesh.h"
#include "ED_node.h"
#include "ED_types.h"
#include "ED_uvedit.h"
#include "ED_curve.h" /* for ED_curve_editnurbs */
@ -2182,6 +2183,12 @@ void flushTransNodes(TransInfo *t)
td->loc2d[0]= td->loc[0];
td->loc2d[1]= td->loc[1];
}
/* handle intersection with noodles */
if(t->total==1) {
ED_node_link_intersect_test(t->sa, 1);
}
}
/* *** SEQUENCE EDITOR *** */
@ -4764,7 +4771,12 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
}
else if (t->spacetype == SPACE_NODE) {
/* pass */
if(cancelled == 0)
ED_node_link_insert(t->sa);
/* clear link line */
ED_node_link_intersect_test(t->sa, 0);
}
else if (t->spacetype == SPACE_ACTION) {
SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;

@ -954,6 +954,8 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, OP_SHEAR, SKEY, KM_PRESS, KM_ALT|KM_CTRL|KM_SHIFT, 0);
WM_keymap_add_item(keymap, "TRANSFORM_OT_mirror", MKEY, KM_PRESS, KM_CTRL, 0);
km = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0);

@ -1057,6 +1057,134 @@ static void weld_align_uv(bContext *C, int tool)
}
}
if(tool == 's' || tool == 't' || tool == 'u') {
/* pass 1&2 variables */
int i, j;
int starttmpl= -1, connectedtostarttmpl, startcorner;
int endtmpl= -1, connectedtoendtmpl, endcorner;
MTFace *startface, *endface;
int itmpl, jtmpl;
EditVert *eve;
int pass; /* first 2 passes find endpoints, 3rd pass moves middle points, 4th pass is fail-on-face-selected */
EditFace *startefa, *endefa;
/* pass 3 variables */
float startx, starty, firstm, firstb, midx, midy;
float endx, endy, secondm, secondb, midmovedx, midmovedy;
float IsVertical_check= -1;
float IsHorizontal_check= -1;
for(i= 0, eve= em->verts.first; eve; eve= eve->next, i++) /* give each point a unique name */
eve->tmp.l= i;
for(pass= 1; pass <= 3; pass++) { /* do this for each endpoint */
if(pass == 3){ /* calculate */
startx= startface->uv[startcorner][0];
starty= startface->uv[startcorner][1];
endx= endface->uv[endcorner][0];
endy= endface->uv[endcorner][1];
firstm= (endy-starty)/(endx-startx);
firstb= starty-(firstm*startx);
secondm= -1.0f/firstm;
if(startx == endx) IsVertical_check= startx;
if(starty == endy) IsHorizontal_check= starty;
}
for(efa= em->faces.first; efa; efa= efa->next) { /* for each face */
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); /* get face */
if(uvedit_face_visible(scene, ima, efa, tf)) { /* if you can see it */
if(uvedit_face_selected(scene, efa, tf)) { /* if the face is selected, get out now! */
pass= 4;
break;
}
for(i= 0; (i < 3 || (i == 3 && efa->v4)); i++) { /* for each point of the face */
itmpl= (*(&efa->v1 + i))->tmp.l; /* get unique name for points */
if(pass == 3) { /* move */
if(uvedit_uv_selected(scene, efa, tf, i)) {
if(!(itmpl == starttmpl || itmpl == endtmpl)) {
if(IsVertical_check != -1) tf->uv[i][0]= IsVertical_check;
if(IsHorizontal_check != -1) tf->uv[i][1]= IsHorizontal_check;
if((IsVertical_check == -1) && (IsHorizontal_check == -1)) {
midx= tf->uv[i][0];
midy= tf->uv[i][1];
if(tool == 's') {
secondb= midy-(secondm*midx);
midmovedx= (secondb-firstb)/(firstm-secondm);
midmovedy= (secondm*midmovedx)+secondb;
tf->uv[i][0]= midmovedx;
tf->uv[i][1]= midmovedy;
}
else if(tool == 't') {
tf->uv[i][0]= (midy-firstb)/firstm; /* midmovedx */
}
else if(tool == 'u') {
tf->uv[i][1]= (firstm*midx)+firstb; /* midmovedy */
}
}
}
}
}
else {
for(j= 0; (j < 3 || (j == 3 && efa->v4)); j++) { /* also for each point on the face */
jtmpl= (*(&efa->v1 + j))->tmp.l;
if(i != j && (!efa->v4 || ABS(i-j) != 2)) { /* if the points are connected */
/* quad (0,1,2,3) 0,1 0,3 1,0 1,2 2,1 2,3 3,0 3,2
* triangle (0,1,2) 0,1 0,2 1,0 1,2 2,0 2,1 */
if(uvedit_uv_selected(scene, efa, tf, i) && uvedit_uv_selected(scene, efa, tf, j)) {
/* if the edge is selected */
if(pass == 1) { /* if finding first endpoint */
if(starttmpl == -1) { /* if the first endpoint isn't found yet */
starttmpl= itmpl; /* set unique name for endpoint */
connectedtostarttmpl= jtmpl;
/* get point that endpoint is connected to */
startface= tf; /* get face it's on */
startcorner= i; /* what corner of the face? */
startefa= efa;
efa= em->faces.first;
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
i= -1;
break;
}
if(starttmpl == itmpl && jtmpl != connectedtostarttmpl) {
starttmpl= -1; /* not an endpoint */
efa= startefa;
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
i= startcorner;
break;
}
}
else if(pass == 2) { /* if finding second endpoint */
if(endtmpl == -1 && itmpl != starttmpl) {
endtmpl= itmpl;
connectedtoendtmpl= jtmpl;
endface= tf;
endcorner= i;
endefa= efa;
efa= em->faces.first;
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
i= -1;
break;
}
if(endtmpl == itmpl && jtmpl != connectedtoendtmpl) {
endtmpl= -1;
efa= endefa;
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
i= endcorner;
break;
}
}
}
}
}
}
}
}
}
if(pass == 2 && (starttmpl == -1 || endtmpl == -1)) {
/* if endpoints aren't found */
pass=4;
}
}
}
uvedit_live_unwrap_update(sima, scene, obedit);
DAG_id_tag_update(obedit->data, 0);
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@ -1074,6 +1202,9 @@ static int align_exec(bContext *C, wmOperator *op)
static void UV_OT_align(wmOperatorType *ot)
{
static EnumPropertyItem axis_items[] = {
{'s', "ALIGN_S", 0, "Straighten", "Align UVs along the line defined by the endpoints"},
{'t', "ALIGN_T", 0, "Straighten X", "Align UVs along the line defined by the endpoints along the X axis"},
{'u', "ALIGN_U", 0, "Straighten Y", "Align UVs along the line defined by the endpoints along the Y axis"},
{'a', "ALIGN_AUTO", 0, "Align Auto", "Automatically choose the axis on which there is most alignment already"},
{'x', "ALIGN_X", 0, "Align X", "Align UVs on X axis"},
{'y', "ALIGN_Y", 0, "Align Y", "Align UVs on Y axis"},

@ -179,6 +179,10 @@ typedef struct bNodeLink {
} bNodeLink;
/* link->flag */
#define NODE_LINKFLAG_HILITE 1
/* the basis for a Node tree, all links and nodes reside internal here */
/* only re-usable node trees are in the library though, materials and textures allocate own tree struct */
typedef struct bNodeTree {

@ -1109,7 +1109,8 @@ typedef struct Scene {
#define PROP_SHARP 3
#define PROP_LIN 4
#define PROP_CONST 5
#define PROP_RANDOM 6
#define PROP_RANDOM 6
#define PROP_MODE_MAX 7
/* toolsettings->proportional */
#define PROP_EDIT_OFF 0

@ -171,6 +171,10 @@ if(WITH_IMAGE_HDR)
add_definitions(-DWITH_HDR)
endif()
if(WITH_IMAGE_FRAMESERVER)
add_definitions(-DWITH_FRAMESERVER)
endif()
if(WITH_AUDASPACE)
add_definitions(-DWITH_AUDASPACE)
endif()

@ -54,6 +54,8 @@ if env['WITH_BF_CINEON']:
if env['WITH_BF_HDR']:
defs.append('WITH_HDR')
defs.append('WITH_FRAMESERVER') # TODO, make optional
if env['WITH_BF_FFMPEG']:
defs.append('WITH_FFMPEG')
incs += ' ' + env['BF_FFMPEG_INC']

@ -143,7 +143,9 @@ EnumPropertyItem image_type_items[] = {
#endif
{R_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, "AVI JPEG", "Output video in AVI JPEG format"},
{R_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", "Output video in AVI Raw format"},
#ifdef WITH_FRAMESERVER
{R_FRAMESERVER, "FRAMESERVER", ICON_FILE_SCRIPT, "Frame Server", "Output image to a frameserver"},
#endif
#ifdef WITH_FFMPEG
{R_H264, "H264", ICON_FILE_MOVIE, "H.264", "Output video in H.264 format"},
{R_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "MPEG", "Output video in MPEG format"},

@ -5685,7 +5685,7 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay,
Object *camera;
float mat[4][4];
float amb[3];
const short onlyselected= !ELEM3(type, RE_BAKE_LIGHT, RE_BAKE_ALL, RE_BAKE_SHADOW);
const short onlyselected= !ELEM4(type, RE_BAKE_LIGHT, RE_BAKE_ALL, RE_BAKE_SHADOW, RE_BAKE_AO);
const short nolamps= ELEM3(type, RE_BAKE_NORMALS, RE_BAKE_TEXTURE, RE_BAKE_DISPLACEMENT);
re->main= bmain;

@ -1184,46 +1184,10 @@ void PyObjectPlus::SetDeprecationWarnings(bool ignoreDeprecationWarnings)
m_ignore_deprecation_warnings = ignoreDeprecationWarnings;
}
void PyDebugLine()
{
// import sys; print '\t%s:%d' % (sys._getframe(0).f_code.co_filename, sys._getframe(0).f_lineno)
PyObject *getframe, *frame;
PyObject *f_lineno, *f_code, *co_filename;
getframe = PySys_GetObject((char *)"_getframe"); // borrowed
if (getframe) {
frame = PyObject_CallObject(getframe, NULL);
if (frame) {
f_lineno= PyObject_GetAttrString(frame, "f_lineno");
f_code= PyObject_GetAttrString(frame, "f_code");
if (f_lineno && f_code) {
co_filename= ((PyCodeObject *)f_code)->co_filename; /* borrow */
if (co_filename) {
printf("\t%s:%d\n", _PyUnicode_AsString(co_filename), (int)PyLong_AsSsize_t(f_lineno));
Py_DECREF(f_lineno);
Py_DECREF(f_code);
Py_DECREF(frame);
return;
}
}
Py_XDECREF(f_lineno);
Py_XDECREF(f_code);
Py_DECREF(frame);
}
}
PyErr_Clear();
printf("\tERROR - Could not access sys._getframe(0).f_lineno or sys._getframe().f_code.co_filename\n");
}
void PyObjectPlus::ShowDeprecationWarning_func(const char* old_way,const char* new_way)
{
printf("Method %s is deprecated, please use %s instead.\n", old_way, new_way);
PyDebugLine();
PyC_LineSpit();
}
void PyObjectPlus::ClearDeprecationWarning()

@ -55,6 +55,7 @@
#ifdef USE_MATHUTILS
extern "C" {
#include "../../blender/python/mathutils/mathutils.h" /* so we can have mathutils callbacks */
#include "../../blender/python/generic/py_capi_utils.h" /* for PyC_LineSpit only */
}
#endif