Sunday sync of Orange with bf-blender

This commit is contained in:
Ton Roosendaal
2005-12-04 17:22:36 +00:00
11 changed files with 109 additions and 42 deletions

View File

@@ -1511,7 +1511,14 @@ static void mesh_calc_modifiers(Object *ob, float (*inputVertexCos)[3], DerivedM
*/
if (deform_r) *deform_r = getMeshDerivedMesh(me, ob, deformedVerts);
} else {
deformedVerts = inputVertexCos;
if(!fluidsimMeshUsed) {
// default behaviour for meshes
deformedVerts = inputVertexCos;
} else {
// the fluid sim mesh might have more vertices than the original
// one, so inputVertexCos shouldnt be used
deformedVerts = mesh_getVertexCos(me, &numVerts);
}
}

View File

@@ -196,8 +196,8 @@ void initglobals(void)
{
memset(&G, 0, sizeof(Global));
memset(&theEditMesh, 0, sizeof(theEditMesh));
G.editMesh = &theEditMesh;
memset(G.editMesh, 0, sizeof(G.editMesh));
U.savetime= 1;

View File

@@ -76,8 +76,9 @@ void libtiff_loadlibtiff(void)
char *filename;
libtiff = NULL;
#ifndef __APPLE__ /* no standard location of libtiff in MacOS X */
/* declare env var if you want to use that */
filename = getenv("BF_TIFF_LIB");
if (filename) libtiff = PIL_dynlib_open(filename);
if (libtiff != NULL) return;
/* Try to find libtiff in a couple of standard places */
libtiff = PIL_dynlib_open("libtiff.so");
@@ -93,12 +94,7 @@ void libtiff_loadlibtiff(void)
if (libtiff != NULL) return;
/* For solaris */
libtiff = PIL_dynlib_open("/usr/openwin/lib/libtiff.so");
if (libtiff != NULL) return;
#endif
filename = getenv("BF_TIFF_LIB");
if (filename) libtiff = PIL_dynlib_open(filename);
}
void *libtiff_findsymbol(char *name)

View File

@@ -104,20 +104,24 @@ C_EXTRA = \
* LOCAL DEFINITIONS *
*********************/
PILdynlib *libtiff = NULL;
void libtiff_loadlibtiff();
void libtiff_loadlibtiff(void);
void* libtiff_findsymbol(char*);
int libtiff_load_symbols();
int libtiff_load_symbols(void);
/**************************
* LIBRARY INITIALIZATION *
**************************/
void libtiff_loadlibtiff()
void libtiff_loadlibtiff(void)
{
char *filename;
libtiff = NULL;
filename = getenv("BF_TIFF_LIB");
if (filename) libtiff = PIL_dynlib_open(filename);
if (libtiff != NULL) return;
/* Try to find libtiff in a couple of standard places */
libtiff = PIL_dynlib_open("libtiff.so");
if (libtiff != NULL) return;
@@ -132,10 +136,7 @@ void libtiff_loadlibtiff()
if (libtiff != NULL) return;
/* For solaris */
libtiff = PIL_dynlib_open("/usr/openwin/lib/libtiff.so");
if (libtiff != NULL) return;
filename = getenv("BF_TIFF_LIB");
if (filename) libtiff = PIL_dynlib_open(filename);
}
void *libtiff_findsymbol(char *name)
@@ -153,7 +154,7 @@ void *libtiff_findsymbol(char *name)
return symbol;
}
void libtiff_init()
void libtiff_init(void)
{
if (libtiff != NULL) {
printf("libtiff_init: Attempted to load libtiff twice!\\n");
@@ -163,7 +164,7 @@ void libtiff_init()
G.have_libtiff = ((libtiff != NULL) && (libtiff_load_symbols()));
}
void libtiff_exit()
void libtiff_exit(void)
{
if (libtiff != NULL) {
PIL_dynlib_close(libtiff);
@@ -220,7 +221,7 @@ def outputDynCFile(outfile, header_file_name):
outfile.write(COMMENT)
outfile.write('#include "%s"\n' % header_file_name)
outfile.write(C_EXTRA)
outfile.write('int libtiff_load_symbols()\n')
outfile.write('int libtiff_load_symbols(void)\n')
outfile.write('{\n')
for function in tiff_functions:
outfile.write(function.getLoadSymbol())

View File

@@ -49,6 +49,8 @@
#include "imbuf.h"
#include "imbuf_patch.h"
#include "BKE_global.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
@@ -69,6 +71,10 @@ tsize_t imb_tiff_WriteProc(thandle_t handle, tdata_t data, tsize_t n);
toff_t imb_tiff_SeekProc(thandle_t handle, toff_t ofs, int whence);
int imb_tiff_CloseProc(thandle_t handle);
toff_t imb_tiff_SizeProc(thandle_t handle);
int imb_tiff_DummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize);
void imb_tiff_DummyUnmapProc(thandle_t fd, tdata_t base, toff_t size);
/* Structure for in-memory TIFF file. */
struct ImbTIFFMemFile {
unsigned char *mem; /* Location of first byte of TIFF file. */
@@ -84,6 +90,14 @@ struct ImbTIFFMemFile {
*****************************/
void imb_tiff_DummyUnmapProc(thandle_t fd, tdata_t base, toff_t size)
{
}
int imb_tiff_DummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
{
return (0);
}
/**
* Reads data from an in-memory TIFF file.
@@ -308,8 +322,7 @@ struct ImBuf *imb_loadtiff(unsigned char *mem, int size, int flags)
"r", (thandle_t)(&memFile),
imb_tiff_ReadProc, imb_tiff_WriteProc,
imb_tiff_SeekProc, imb_tiff_CloseProc,
imb_tiff_SizeProc, (TIFFMapFileProc)NULL,
(TIFFUnmapFileProc)NULL);
imb_tiff_SizeProc, imb_tiff_DummyMapProc, imb_tiff_DummyUnmapProc);
if (image == NULL) {
printf("imb_loadtiff: could not open TIFF IO layer.\n");
return NULL;
@@ -382,6 +395,8 @@ struct ImBuf *imb_loadtiff(unsigned char *mem, int size, int flags)
/* close the client layer interface to the in-memory file */
libtiff_TIFFClose(image);
if (G.order == B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf->x*ibuf->y, ibuf->rect);
/* return successfully */
return (ibuf);
}

View File

@@ -30,7 +30,10 @@ source/blender/src/toets.c
source/blender/src/writeimage.c
Step 5:
edit blender/source/blender/imbuf/intern/util.c
edit the following files:
blender/source/blender/imbuf/intern/util.c
blender/source/blender/src/filesel.c
blender/source/blender/src/screendump.c
and add your extension so that your format gets recognized in the thumbnails.
Step 6:

View File

@@ -141,4 +141,4 @@ int updateBoneData( BPy_Bone * self, Bone * parent );
#endif
*/
*/

View File

@@ -228,9 +228,9 @@ Introduction:
evt = Blender.event
return_it = False
if evt == DRAW.LEFTMOUSE:
if evt == Draw.LEFTMOUSE:
print "Swallowing the left mouse button press"
elif evt == DRAW.AKEY:
elif evt == Draw.AKEY:
print "Swallowing an 'a' character"
else:
print "Let the 3D View itself process this event:", evt

View File

@@ -12,7 +12,9 @@ A Blender Curve can consist of multiple curves. Try converting a Text object to
type Bezier or Nurb. The underlying curves can be accessed with
the [] operator. Operator [] returns an object of type CurNurb.
The Curve module also supports the Python iterator interface. This means you can access the curves in a Curve or the control points in a CurNurb using a python for statement.
The Curve module also supports the Python iterator interface. This means you
can access the curves in a Curve and the control points in a CurNurb using a
Python B{for} statement.
Add a Curve to a Scene Example::
@@ -61,20 +63,34 @@ class Curve:
This object gives access to Curve-specific data in Blender.
@ivar name: The Curve Data name.
@type name: string
@ivar pathlen: The Curve Data path length.
@type pathlen: int
@ivar totcol: The Curve Data maximal number of linked materials.
@ivar flag: The Curve Data flag value; see function getFlag for the semantics.
@type totcol: int
@ivar flag: The Curve Data flag value; see L{getFlag()} for the semantics.
@ivar bevresol: The Curve Data bevel resolution.
@type bevresol: float
@ivar resolu: The Curve Data U-resolution.
@type resolu: float
@ivar resolv: The Curve Data V-resolution.
@type resolv: float
@ivar width: The Curve Data width.
@type width: float
@ivar ext1: The Curve Data extent 1(for bevels).
@type ext1: float
@ivar ext2: The Curve Data extent2 (for bevels).
@type ext2: float
@ivar loc: The Curve Data location(from the center).
@type loc: list of 3 floats
@ivar rot: The Curve Data rotation(from the center).
@type rot: list of 3 floats
@ivar size: The Curve Data size(from the center).
@type size: list of 3 floats
@ivar bevob: The Curve Bevel Object
@cvar key: The L{Key.Key} object associated with this Curve, if any.
@type bevob: Blender L{Object<Object.Object>} or PyNone
@ivar key: The Key object associated with this Curve, if any.
@type key: Blender L{Key<Key.Key>}
"""
def getName():
@@ -228,13 +244,22 @@ class Curve:
def getControlPoint(numcurve,numpoint):
"""
Get the curve's control point value. The numpoint arg is an index into the list of points and starts with 0.
Get the curve's control point value (B{deprecated}). The numpoint arg
is an index into the list of points and starts with 0. B{Note}: new
scripts should use the [] operator on Curves and CurNurbs. Example::
curve = Blender.Curve.Get('Curve')
p0 = curve[0][0] # get first point from first nurb
# -- OR --
nurb = curve[0] # get first nurb
p0 = nurb[0] # get nurb's first point
@type numcurve: int
@type numpoint: int
@rtype: list of floats
@return: depends upon the curve's type.
- type Bezier : a list of nine floats. Values are x, y, z for handle-1, vertex and handle-2
- type Nurb : a list of 4 floats. Values are x, y, z, w.
"""
def setControlPoint( numcurve, numpoint, controlpoint):
@@ -252,14 +277,15 @@ class Curve:
def appendPoint( numcurve, new_control_point ):
"""
add a new control point to the indicated curve.
Add a new control point to the indicated curve (B{deprecated}).
New scripts should use L{CurNurb.append()}.
@rtype: PyNone
@type numcurve: int
@type new_control_point: list xyzw or BezTriple
@type new_control_point: list of floats or BezTriple
@param numcurve: index for spline in Curve, starting from 0
@param new_control_point: depends on curve's type.
- type Bezier: a BezTriple
- type Nurb: a list of four floats for the xyzw values
- type Nurb: a list of four or five floats for the xyzwt values
@raise AttributeError: throws exception if numcurve is out of range.
"""
@@ -359,7 +385,6 @@ class Curve:
"""
Updates display list for a Curve.
Used after making changes to control points.
You B{must} use this if you want to see your changes!
@rtype: PyNone
@return: PyNone
@@ -367,9 +392,11 @@ class Curve:
def isNurb( curve_num ):
"""
method used to determine whether a CurNurb is of type Bezier or of type Nurb.
Tells type of a CurNurb (B{deprecated}).
New scripts should use L{CurNurb.isNurb()}.
@rtype: integer
@return: Zero if curve is type Bezier, One if curve is of type Nurb.
@return: Zero if curve is type Bezier, one if curve is of type Nurb.
@type curve_num: integer
@param curve_num: zero-based index into list of curves in this Curve.
@raise AttributeError: throws exception if curve_num is out of range.
@@ -377,7 +404,8 @@ class Curve:
def isCyclic( curve_num ):
"""
Boolean method checks whether the curve is cyclic (closed) or not.
Tells whether or not a CurNurb is cyclic (closed) (B{deprecated}).
New scripts should use L{CurNurb.isCyclic()}.
@rtype: boolean
@return: True if is cyclic, False if not
@@ -394,7 +422,8 @@ class Curve:
def getNumPoints( curve_num ):
"""
Get the number of control points in the curve.
Get the number of control points in the curve (B{deprecated}).
New scripts should use the len operator (I{len(curve)}).
@type curve_num: integer
@param curve_num: zero-based index into list of curves in this Curve
@rtype: integer
@@ -402,9 +431,9 @@ class Curve:
def getKey():
"""
Return the L{Key.Key} object containing the keyframes for this
Return the L{Key<Key.Key>} object containing the keyframes for this
curve, if any.
@rtype: L{Key.Key} object or None
@rtype: L{Key<Key.Key>} object or None
"""
@@ -419,8 +448,11 @@ class CurNurb:
The CurNurb also supports the sequence protocol which means you can access the control points of a CurNurb using the [] operator.
@ivar flagU: The CurNurb knot flag U. See L{setFlagU} for description.
@type flagU: int
@ivar flagV: The CurNurb knot flag V. See L{setFlagU} for description.
@type flagV: int
@ivar type: The type of the curve (Poly: 0, Bezier: 1, NURBS: 4)
@type type: int
"""
def __setitem__( n, point ):
@@ -521,7 +553,7 @@ class CurNurb:
def getType():
"""
Get the type of the curve
Get the type of the curve.
@rtype: integer
@return: 0 - Poly, 1 - Bezier, 4 - NURBS
"""

View File

@@ -343,9 +343,13 @@ void fluidsimBake(struct Object *ob)
strcpy(targetFile, targetDir);
strcat(targetFile, suffixConfig);
// make sure all directories exist
// as the bobjs use the same dir, this only needs to be checked
// for the cfg output
RE_make_existing_file(targetFile);
// check selected directory
// simply try to open cfg file for writing to test validity of settings
ADD_CREATEDFILE(targetFile);
fileCfg = fopen(targetFile, "w");
if(fileCfg) { dirExist = 1; fclose(fileCfg); }
@@ -362,7 +366,7 @@ void fluidsimBake(struct Object *ob)
}
}
// todo... strip .blend ?
snprintf(newSurfdataPath,FILE_MAXFILE+FILE_MAXDIR,"//%s_%s_", blendFile, fsDomain->id.name);
snprintf(newSurfdataPath,FILE_MAXFILE+FILE_MAXDIR,"//fluidsimdata/%s_%s_", blendFile, fsDomain->id.name);
snprintf(debugStrBuffer,256,"fluidsimBake::error - warning resetting output dir to '%s'\n", newSurfdataPath);
elbeemDebugOut(debugStrBuffer);
@@ -391,6 +395,10 @@ void fluidsimBake(struct Object *ob)
// start writing
strcpy(targetFile, targetDir);
strcat(targetFile, suffixConfig);
// make sure these directories exist as well
if(outStringsChanged) {
RE_make_existing_file(targetFile);
}
fileCfg = fopen(targetFile, "w");
if(!fileCfg) {
snprintf(debugStrBuffer,256,"fluidsimBake::error - Unable to open file for writing '%s'\n", targetFile);
@@ -399,6 +407,7 @@ void fluidsimBake(struct Object *ob)
pupmenu("Fluidsim Bake Error%t|Unable to output files... Aborted%x0");
return;
}
ADD_CREATEDFILE(targetFile);
fprintf(fileCfg, "# Blender ElBeem File , Source %s , Frame %d, to %s \n\n\n", G.sce, -1, targetFile );
// file open -> valid settings -> store

View File

@@ -620,7 +620,10 @@ void calc_renderwin_rectangle(int posmask, int renderpos_r[2], int rendersize_r[
rendersize_r[1]*= G.scene->r.yparts;
}
for (y=-1; y<=1; y++) {
rendersize_r[0]= CLAMPIS(rendersize_r[0], 0, scr_w);
rendersize_r[1]= CLAMPIS(rendersize_r[1], 0, scr_h-RW_HEADERY);
for (y=-1; y<=1; y++) {
for (x=-1; x<=1; x++) {
if (posmask & (1<<((y+1)*3 + (x+1)))) {
ndc_x+= x;
@@ -638,6 +641,7 @@ void calc_renderwin_rectangle(int posmask, int renderpos_r[2], int rendersize_r[
renderpos_r[0]= (scr_w-rendersize_r[0])*(ndc_x*0.5 + 0.5);
#ifdef __APPLE__
/* 44 pixels is topbar and window header... awaiting better fixes in ghost :) */
rendersize_r[1]= CLAMPIS(rendersize_r[1], 0, scr_h-44-RW_HEADERY);
renderpos_r[1]= -44-RW_HEADERY+(scr_h-rendersize_r[1])*(ndc_y*0.5 + 0.5);
#else
renderpos_r[1]= (scr_h-rendersize_r[1])*(ndc_y*0.5 + 0.5);