diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-17 18:10:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-17 18:10:19 +0300 |
commit | 06a1a66a9b6f120867d3bbebe3928744ec8e3495 (patch) | |
tree | 42e827a3cf58eb76474e479206b02a8d97dd3bf7 | |
parent | 61d27db35967710421ab92748e09624db068258d (diff) | |
parent | a24b4e6090057479796e914bc603119b12f6ca06 (diff) |
Merge branch 'master' into blender2.8
565 files changed, 8423 insertions, 8423 deletions
diff --git a/source/blender/alembic/intern/abc_exporter.cc b/source/blender/alembic/intern/abc_exporter.cc index c766720d6cd..45e2b68f94d 100644 --- a/source/blender/alembic/intern/abc_exporter.cc +++ b/source/blender/alembic/intern/abc_exporter.cc @@ -401,7 +401,7 @@ void AbcExporter::exploreTransform(Base *ob_base, Object *parent, Object *dupliO DupliObject *link = static_cast<DupliObject *>(lb->first); Object *dupli_ob = NULL; Object *dupli_parent = NULL; - + for (; link; link = link->next) { /* This skips things like custom bone shapes. */ if (m_settings.renderable_only && link->no_draw) { @@ -568,7 +568,7 @@ void AbcExporter::createShapeWriter(Object *ob, Object *dupliObParent) else { name = get_object_dag_path_name(ob, dupliObParent); } - + AbcTransformWriter *xform = getXForm(name); if (!xform) { diff --git a/source/blender/alembic/intern/abc_mesh.h b/source/blender/alembic/intern/abc_mesh.h index e1507bedd01..fd6de1001ae 100644 --- a/source/blender/alembic/intern/abc_mesh.h +++ b/source/blender/alembic/intern/abc_mesh.h @@ -78,7 +78,7 @@ private: void writeArbGeoParams(struct Mesh *mesh); void getGeoGroups(struct Mesh *mesh, std::map<std::string, std::vector<int32_t> > &geoGroups); - + /* fluid surfaces support */ void getVelocities(struct Mesh *mesh, std::vector<Imath::V3f> &vels); diff --git a/source/blender/avi/AVI_avi.h b/source/blender/avi/AVI_avi.h index 5e9fe378c38..210195234be 100644 --- a/source/blender/avi/AVI_avi.h +++ b/source/blender/avi/AVI_avi.h @@ -68,7 +68,7 @@ typedef struct _AviList { typedef struct _AviMainHeader { int fcc; - int size; + int size; int MicroSecPerFrame; /* MicroSecPerFrame - timing between frames */ int MaxBytesPerSec; /* MaxBytesPerSec - approx bps system must handle */ int PaddingGranularity; @@ -79,7 +79,7 @@ typedef struct _AviMainHeader { #define AVIF_TRUSTCKTYPE 0x00000800 #define AVIF_WASCAPTUREFILE 0x00010000 /* specially allocated used for capturing real time video */ #define AVIF_COPYRIGHTED 0x00020000 /* contains copyrighted data */ - + int TotalFrames; int InitialFrames; /* InitialFrames - initial frame before interleaving */ int Streams; @@ -91,18 +91,18 @@ typedef struct _AviMainHeader { typedef struct _AviStreamHeader { int fcc; - int size; + int size; int Type; #define AVIST_VIDEO FCC("vids") #define AVIST_AUDIO FCC("auds") #define AVIST_MIDI FCC("mids") #define AVIST_TEXT FCC("txts") - + int Handler; int Flags; #define AVISF_DISABLED 0x00000001 #define AVISF_VIDEO_PALCHANGES 0x00010000 - + short Priority; short Language; int InitialFrames; @@ -121,7 +121,7 @@ typedef struct _AviStreamHeader { typedef struct _AviBitmapInfoHeader { int fcc; - int size; + int size; int Size; int Width; int Height; @@ -149,7 +149,7 @@ typedef struct _AviIndexEntry { int ChunkId; int Flags; #define AVIIF_LIST 0x00000001 -#define AVIIF_KEYFRAME 0x00000010 +#define AVIIF_KEYFRAME 0x00000010 #define AVIIF_NO_TIME 0x00000100 #define AVIIF_COMPRESSOR 0x0FFF0000 int Offset; @@ -178,22 +178,22 @@ typedef struct _AviStreamRec { typedef struct _AviMovie { FILE *fp; - + int type; #define AVI_MOVIE_READ 0 #define AVI_MOVIE_WRITE 1 - + int64_t size; AviMainHeader *header; AviStreamRec *streams; AviIndexEntry *entries; int index_entries; - + int64_t movi_offset; int64_t read_offset; int64_t *offset_table; - + /* Local data goes here */ int interlace; int odd_fields; @@ -214,7 +214,7 @@ typedef enum { /* belongs to the option-setting function. */ typedef enum { AVI_OPTION_WIDTH = 0, - AVI_OPTION_HEIGHT, + AVI_OPTION_HEIGHT, AVI_OPTION_QUALITY, AVI_OPTION_FRAMERATE } AviOption; diff --git a/source/blender/avi/CMakeLists.txt b/source/blender/avi/CMakeLists.txt index 5009bd2a30b..d019863faa5 100644 --- a/source/blender/avi/CMakeLists.txt +++ b/source/blender/avi/CMakeLists.txt @@ -23,7 +23,7 @@ # # ***** END GPL LICENSE BLOCK ***** -set(INC +set(INC . ../blenlib ../imbuf diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c index 6695998fd35..2d8a0b0038f 100644 --- a/source/blender/avi/intern/avi.c +++ b/source/blender/avi/intern/avi.c @@ -210,7 +210,7 @@ bool AVI_is_avi(char *name) { FILE *fp; int ret; - + fp = BLI_fopen(name, "rb"); if (fp == NULL) return 0; @@ -237,7 +237,7 @@ bool AVI_is_avi(const char *name) AviMainHeader header; AviBitmapInfoHeader bheader; int movie_tracks = 0; - + DEBUG_PRINT("opening movie\n"); movie.type = AVI_MOVIE_READ; @@ -267,7 +267,7 @@ bool AVI_is_avi(const char *name) fclose(movie.fp); return 0; } - + movie.header->MicroSecPerFrame = GET_FCC(movie.fp); movie.header->MaxBytesPerSec = GET_FCC(movie.fp); movie.header->PaddingGranularity = GET_FCC(movie.fp); @@ -292,7 +292,7 @@ bool AVI_is_avi(const char *name) fclose(movie.fp); return 0; } - + movie.streams = (AviStreamRec *) MEM_calloc_arrayN(movie.header->Streams, sizeof(AviStreamRec), "moviestreams"); for (temp = 0; temp < movie.header->Streams; temp++) { @@ -304,7 +304,7 @@ bool AVI_is_avi(const char *name) !(movie.streams[temp].sh.size = GET_FCC(movie.fp))) { DEBUG_PRINT("bad stream header information\n"); - + MEM_freeN(movie.streams); fclose(movie.fp); return 0; @@ -314,7 +314,7 @@ bool AVI_is_avi(const char *name) movie.streams[temp].sh.Handler = GET_FCC(movie.fp); fcca = movie.streams[temp].sh.Handler; - + if (movie.streams[temp].sh.Type == FCC("vids")) { if (fcca == FCC("DIB ") || fcca == FCC("RGB ") || @@ -334,7 +334,7 @@ bool AVI_is_avi(const char *name) } movie_tracks++; } - + movie.streams[temp].sh.Flags = GET_FCC(movie.fp); movie.streams[temp].sh.Priority = GET_TCC(movie.fp); movie.streams[temp].sh.Language = GET_TCC(movie.fp); @@ -365,10 +365,10 @@ bool AVI_is_avi(const char *name) j = movie.streams[temp].sf_size - (sizeof(AviBitmapInfoHeader) - 8); if (j >= 0) { AviBitmapInfoHeader *bi; - + movie.streams[temp].sf = &bheader; bi = (AviBitmapInfoHeader *) movie.streams[temp].sf; - + bi->fcc = FCC("strf"); bi->size = movie.streams[temp].sf_size; bi->Size = GET_FCC(movie.fp); @@ -382,7 +382,7 @@ bool AVI_is_avi(const char *name) bi->YPelsPerMeter = GET_FCC(movie.fp); bi->ClrUsed = GET_FCC(movie.fp); bi->ClrImportant = GET_FCC(movie.fp); - + fcca = bi->Compression; if (movie.streams[temp].format == AVI_FORMAT_AVI_RGB) { @@ -418,7 +418,7 @@ bool AVI_is_avi(const char *name) temp = GET_FCC(movie.fp); if (temp < 0 || ftell(movie.fp) > movie.size) { DEBUG_PRINT("incorrect size in header or error in AVI\n"); - + MEM_freeN(movie.streams); fclose(movie.fp); return 0; @@ -428,19 +428,19 @@ bool AVI_is_avi(const char *name) fseek(movie.fp, -4L, SEEK_CUR); } - + MEM_freeN(movie.streams); fclose(movie.fp); /* at least one video track is needed */ - return (movie_tracks != 0); + return (movie_tracks != 0); } AviError AVI_open_movie(const char *name, AviMovie *movie) { int temp, fcca, size, j; - + DEBUG_PRINT("opening movie\n"); memset(movie, 0, sizeof(AviMovie)); @@ -470,7 +470,7 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) DEBUG_PRINT("bad initial header info\n"); return AVI_ERROR_FORMAT; } - + movie->header->MicroSecPerFrame = GET_FCC(movie->fp); movie->header->MaxBytesPerSec = GET_FCC(movie->fp); movie->header->PaddingGranularity = GET_FCC(movie->fp); @@ -494,7 +494,7 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) DEBUG_PRINT("Number of streams should be in range 1-65536\n"); return AVI_ERROR_FORMAT; } - + movie->streams = (AviStreamRec *) MEM_calloc_arrayN(movie->header->Streams, sizeof(AviStreamRec), "moviestreams"); for (temp = 0; temp < movie->header->Streams; temp++) { @@ -513,7 +513,7 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) movie->streams[temp].sh.Handler = GET_FCC(movie->fp); fcca = movie->streams[temp].sh.Handler; - + if (movie->streams[temp].sh.Type == FCC("vids")) { if (fcca == FCC("DIB ") || fcca == FCC("RGB ") || @@ -530,7 +530,7 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) return AVI_ERROR_COMPRESSION; } } - + movie->streams[temp].sh.Flags = GET_FCC(movie->fp); movie->streams[temp].sh.Priority = GET_TCC(movie->fp); movie->streams[temp].sh.Language = GET_TCC(movie->fp); @@ -559,11 +559,11 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) j = movie->streams[temp].sf_size - (sizeof(AviBitmapInfoHeader) - 8); if (j >= 0) { AviBitmapInfoHeader *bi; - + movie->streams[temp].sf = MEM_mallocN(sizeof(AviBitmapInfoHeader), "streamformat"); - + bi = (AviBitmapInfoHeader *) movie->streams[temp].sf; - + bi->fcc = FCC("strf"); bi->size = movie->streams[temp].sf_size; bi->Size = GET_FCC(movie->fp); @@ -577,7 +577,7 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) bi->YPelsPerMeter = GET_FCC(movie->fp); bi->ClrUsed = GET_FCC(movie->fp); bi->ClrImportant = GET_FCC(movie->fp); - + fcca = bi->Compression; if (movie->streams[temp].format == @@ -617,7 +617,7 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) } fseek(movie->fp, temp, SEEK_CUR); } - + fseek(movie->fp, -4L, SEEK_CUR); } @@ -645,7 +645,7 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) movie->movi_offset = ftell(movie->fp); movie->read_offset = movie->movi_offset; - + /* Read in the index if the file has one, otherwise create one */ if (movie->header->Flags & AVIF_HASINDEX) { fseek(movie->fp, size - 4, SEEK_CUR); @@ -668,7 +668,7 @@ AviError AVI_open_movie(const char *name, AviMovie *movie) movie->entries[temp].Flags = GET_FCC(movie->fp); movie->entries[temp].Offset = GET_FCC(movie->fp); movie->entries[temp].Size = GET_FCC(movie->fp); - + if (AVI_DEBUG) { printf("Index entry %04d: ChunkId:%s Flags:%d Offset:%d Size:%d\n", temp, fcc_to_char(movie->entries[temp].ChunkId), movie->entries[temp].Flags, @@ -696,7 +696,7 @@ void *AVI_read_frame(AviMovie *movie, AviFormat format, int frame, int stream) int cur_frame = -1, i = 0, rewind = 1; void *buffer; - /* Retrieve the record number of the desired frame in the index + /* Retrieve the record number of the desired frame in the index * If a chunk has Size 0 we need to rewind to previous frame */ while (rewind && frame > -1) { i = 0; @@ -732,7 +732,7 @@ void *AVI_read_frame(AviMovie *movie, AviFormat format, int frame, int stream) return NULL; } - + buffer = avi_format_convert(movie, stream, buffer, movie->streams[stream].format, format, &size); return buffer; @@ -780,7 +780,7 @@ AviError AVI_open_compress(char *name, AviMovie *movie, int streams, ...) return AVI_ERROR_OPEN; movie->offset_table = (int64_t *) MEM_mallocN((1 + streams * 2) * sizeof(int64_t), "offsettable"); - + for (i = 0; i < 1 + streams * 2; i++) movie->offset_table[i] = -1L; @@ -1009,7 +1009,7 @@ AviError AVI_write_frame(AviMovie *movie, int frame_num, ...) for (stream = 0; stream < movie->header->Streams; stream++) { unsigned int tbuf = 0; - + format = va_arg(ap, AviFormat); buffer = va_arg(ap, void *); size_t size = va_arg(ap, int); @@ -1023,9 +1023,9 @@ AviError AVI_write_frame(AviMovie *movie, int frame_num, ...) chunk.fcc = avi_get_data_id(format, stream); chunk.size = size; - + if (size % 4) chunk.size += 4 - size % 4; - + awrite(movie, &chunk, 1, sizeof(AviChunk), movie->fp, AVI_CHUNK); /* Write the index entry for this data chunk */ diff --git a/source/blender/avi/intern/avi_mjpeg.c b/source/blender/avi/intern/avi_mjpeg.c index 258426809fb..3146aebb0d0 100644 --- a/source/blender/avi/intern/avi_mjpeg.c +++ b/source/blender/avi/intern/avi_mjpeg.c @@ -157,7 +157,7 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign { struct jpeg_decompress_struct dinfo; struct jpeg_error_mgr jerr; - + (void)width; /* unused */ numbytes = 0; @@ -182,7 +182,7 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign jpeg_finish_decompress(&dinfo); if (dinfo.output_height >= height) return 0; - + inBuffer += numbytes; jpegmemsrcmgr_build(&dinfo, inBuffer, bufsize - numbytes); @@ -200,7 +200,7 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign } jpeg_finish_decompress(&dinfo); jpeg_destroy_decompress(&dinfo); - + return 1; } @@ -221,7 +221,7 @@ static void Compress_JPEG(int quality, unsigned char *outbuffer, const unsigned jpeg_set_defaults(&cinfo); jpeg_set_colorspace(&cinfo, JCS_YCbCr); - + jpeg_set_quality(&cinfo, quality, true); cinfo.dc_huff_tbl_ptrs[0]->sent_table = true; @@ -267,11 +267,11 @@ static void Compress_JPEG(int quality, unsigned char *outbuffer, const unsigned static void interlace(unsigned char *to, unsigned char *from, int width, int height) { size_t i, rowstride = width * 3; - + for (i = 0; i < height; i++) { if (i & 1) memcpy(&to[i * rowstride], &from[(i / 2 + height / 2) * rowstride], rowstride); - else + else memcpy(&to[i * rowstride], &from[(i / 2) * rowstride], rowstride); } } @@ -279,11 +279,11 @@ static void interlace(unsigned char *to, unsigned char *from, int width, int hei static void deinterlace(int odd, unsigned char *to, unsigned char *from, int width, int height) { size_t i, rowstride = width * 3; - + for (i = 0; i < height; i++) { if ((i & 1) == odd) memcpy(&to[(i / 2 + height / 2) * rowstride], &from[i * rowstride], rowstride); - else + else memcpy(&to[(i / 2) * rowstride], &from[i * rowstride], rowstride); } } @@ -301,19 +301,19 @@ void *avi_converter_from_mjpeg(AviMovie *movie, int stream, unsigned char *buffe } deint = Decode_JPEG(buffer, buf, movie->header->Width, movie->header->Height, *size); - + MEM_freeN(buffer); - + if (deint) { buffer = imb_alloc_pixels(movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "avi.avi_converter_from_mjpeg 2"); if (buffer) { interlace(buffer, buf, movie->header->Width, movie->header->Height); } MEM_freeN(buf); - + buf = buffer; } - + return buf; } @@ -321,7 +321,7 @@ void *avi_converter_to_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, { unsigned char *buf; size_t bufsize = *size; - + numbytes = 0; *size = 0; @@ -341,7 +341,7 @@ void *avi_converter_to_mjpeg(AviMovie *movie, int stream, unsigned char *buffer, else { deinterlace(movie->odd_fields, buf, buffer, movie->header->Width, movie->header->Height); MEM_freeN(buffer); - + buffer = buf; buf = imb_alloc_pixels(movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "avi.avi_converter_to_mjpeg 1"); @@ -390,14 +390,14 @@ static void jpegmemdestmgr_term_destination(j_compress_ptr cinfo) static void jpegmemdestmgr_build(j_compress_ptr cinfo, unsigned char *buffer, size_t bufsize) { cinfo->dest = MEM_mallocN(sizeof(*(cinfo->dest)), "avi.jpegmemdestmgr_build"); - + cinfo->dest->init_destination = jpegmemdestmgr_init_destination; cinfo->dest->empty_output_buffer = jpegmemdestmgr_empty_output_buffer; cinfo->dest->term_destination = jpegmemdestmgr_term_destination; cinfo->dest->next_output_byte = buffer; cinfo->dest->free_in_buffer = bufsize; - + numbytes = bufsize; } @@ -411,16 +411,16 @@ static void jpegmemsrcmgr_init_source(j_decompress_ptr dinfo) static boolean jpegmemsrcmgr_fill_input_buffer(j_decompress_ptr dinfo) { unsigned char *buf = (unsigned char *) dinfo->src->next_input_byte - 2; - + /* if we get called, must have run out of data */ WARNMS(dinfo, JWRN_JPEG_EOF); - + buf[0] = (JOCTET) 0xFF; buf[1] = (JOCTET) JPEG_EOI; - + dinfo->src->next_input_byte = buf; dinfo->src->bytes_in_buffer = 2; - + return true; } @@ -436,20 +436,20 @@ static void jpegmemsrcmgr_skip_input_data(j_decompress_ptr dinfo, long skipcnt) static void jpegmemsrcmgr_term_source(j_decompress_ptr dinfo) { numbytes -= dinfo->src->bytes_in_buffer; - + MEM_freeN(dinfo->src); } static void jpegmemsrcmgr_build(j_decompress_ptr dinfo, unsigned char *buffer, size_t bufsize) { dinfo->src = MEM_mallocN(sizeof(*(dinfo->src)), "avi.jpegmemsrcmgr_build"); - + dinfo->src->init_source = jpegmemsrcmgr_init_source; dinfo->src->fill_input_buffer = jpegmemsrcmgr_fill_input_buffer; dinfo->src->skip_input_data = jpegmemsrcmgr_skip_input_data; dinfo->src->resync_to_restart = jpeg_resync_to_restart; dinfo->src->term_source = jpegmemsrcmgr_term_source; - + dinfo->src->bytes_in_buffer = bufsize; dinfo->src->next_input_byte = buffer; diff --git a/source/blender/avi/intern/avi_options.c b/source/blender/avi/intern/avi_options.c index 47c18831cbd..f6da824a9f7 100644 --- a/source/blender/avi/intern/avi_options.c +++ b/source/blender/avi/intern/avi_options.c @@ -49,7 +49,7 @@ AviError AVI_set_compress_option(AviMovie *movie, int option_type, int stream, A int useconds; (void)stream; /* unused */ - + if (movie->header->TotalFrames != 0) /* Can't change params after we have already started writing frames */ return AVI_ERROR_OPTION; diff --git a/source/blender/avi/intern/avi_rgb.c b/source/blender/avi/intern/avi_rgb.c index f0baf7c6c14..6997a0d8be4 100644 --- a/source/blender/avi/intern/avi_rgb.c +++ b/source/blender/avi/intern/avi_rgb.c @@ -49,7 +49,7 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, unsigned char *buf unsigned char *buf; AviBitmapInfoHeader *bi; short bits = 32; - + (void)size; /* unused */ bi = (AviBitmapInfoHeader *) movie->streams[stream].sf; @@ -70,7 +70,7 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, unsigned char *buf while (y--) { pxl = (unsigned short *) (buffer + y * movie->header->Width * 2); - + #ifdef __BIG_ENDIAN__ pxla = (unsigned char *)pxl; #endif @@ -94,12 +94,12 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, unsigned char *buf } MEM_freeN(buffer); - + return buf; } else { buf = imb_alloc_pixels(movie->header->Height, movie->header->Width, 3, sizeof(unsigned char), "fromavirgbbuf"); - + if (buf) { size_t rowstride = movie->header->Width * 3; if ((bits != 16) && (movie->header->Width % 2)) rowstride++; diff --git a/source/blender/avi/intern/avi_rgb32.c b/source/blender/avi/intern/avi_rgb32.c index 051fdba1cd2..f5f48b9eeb4 100644 --- a/source/blender/avi/intern/avi_rgb32.c +++ b/source/blender/avi/intern/avi_rgb32.c @@ -87,7 +87,7 @@ void *avi_converter_to_rgb32(AviMovie *movie, int stream, unsigned char *buffer, to = buf; from = buffer; size_t i = (size_t)movie->header->Height * (size_t)movie->header->Width; - + while (i--) { memcpy(to, from, 3); to += 4; from += 3; diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 79b0e5eb95f..02410f624da 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -264,12 +264,12 @@ struct DerivedMesh { CustomData *(*getTessFaceDataLayout)(DerivedMesh * dm); CustomData *(*getLoopDataLayout)(DerivedMesh * dm); CustomData *(*getPolyDataLayout)(DerivedMesh * dm); - + /** Copies all customdata for an element source into dst at index dest */ void (*copyFromVertCData)(DerivedMesh *dm, int source, CustomData *dst, int dest); void (*copyFromEdgeCData)(DerivedMesh *dm, int source, CustomData *dst, int dest); void (*copyFromFaceCData)(DerivedMesh *dm, int source, CustomData *dst, int dest); - + /** Optional grid access for subsurf */ int (*getNumGrids)(DerivedMesh *dm); int (*getGridSize)(DerivedMesh *dm); @@ -278,7 +278,7 @@ struct DerivedMesh { void (*getGridKey)(DerivedMesh *dm, struct CCGKey *key); DMFlagMat *(*getGridFlagMats)(DerivedMesh * dm); unsigned int **(*getGridHidden)(DerivedMesh * dm); - + /** Iterate over each mapped vertex in the derived mesh, calling the * given function with the original vert and the mapped vert's new diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 8ec75bda538..7567adc50dc 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -69,7 +69,7 @@ void BKE_action_make_local(struct Main *bmain, struct bAction *act, const bool l /* Action API ----------------- */ -/* types of transforms applied to the given item +/* types of transforms applied to the given item * - these are the return falgs for action_get_item_transforms() */ typedef enum eAction_TransformFlags { @@ -79,21 +79,21 @@ typedef enum eAction_TransformFlags { ACT_TRANS_ROT = (1 << 1), /* scaling */ ACT_TRANS_SCALE = (1 << 2), - + /* bbone shape - for all the parameters, provided one is set */ ACT_TRANS_BBONE = (1 << 3), - + /* strictly not a transform, but custom properties are also * quite often used in modern rigs */ ACT_TRANS_PROP = (1 << 4), - + /* all flags */ ACT_TRANS_ONLY = (ACT_TRANS_LOC | ACT_TRANS_ROT | ACT_TRANS_SCALE), ACT_TRANS_ALL = (ACT_TRANS_ONLY | ACT_TRANS_PROP) } eAction_TransformFlags; -/* Return flags indicating which transforms the given object/posechannel has +/* Return flags indicating which transforms the given object/posechannel has * - if 'curves' is provided, a list of links to these curves are also returned * whose nodes WILL NEED FREEING */ @@ -132,7 +132,7 @@ struct bActionGroup *BKE_action_group_find_name(struct bAction *act, const char /* Clear all 'temp' flags on all groups */ void action_groups_clear_tempflags(struct bAction *act); -/* Pose API ----------------- */ +/* Pose API ----------------- */ void BKE_pose_channel_free(struct bPoseChannel *pchan); void BKE_pose_channel_free_ex(struct bPoseChannel *pchan, bool do_id_user); @@ -185,7 +185,7 @@ bool BKE_pose_channel_in_IK_chain(struct Object *ob, struct bPoseChannel *pchan) // XXX to be deprecated for a more general solution in animsys... void framechange_poses_clear_unkeyed(struct Main *bmain); -/* Bone Groups API --------------------- */ +/* Bone Groups API --------------------- */ /* Adds a new bone-group */ struct bActionGroup *BKE_pose_add_group(struct bPose *pose, const char *name); @@ -195,7 +195,7 @@ void BKE_pose_remove_group(struct bPose *pose, struct bActionGroup *grp, const i /* Remove the matching bone-group from its index */ void BKE_pose_remove_group_index(struct bPose *pose, const int index); -/* Assorted Evaluation ----------------- */ +/* Assorted Evaluation ----------------- */ /* Used for the Action Constraint */ void what_does_obaction(struct Object *ob, struct Object *workob, struct bPose *pose, struct bAction *act, char groupname[], float cframe); diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index 7ae9527b2f7..b16e8c17a12 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -82,10 +82,10 @@ void BKE_animdata_copy_id_action(struct Main *bmain, struct ID *id, const bool s typedef enum eAnimData_MergeCopy_Modes { /* Keep destination action */ ADT_MERGECOPY_KEEP_DST = 0, - + /* Use src action (make a new copy) */ ADT_MERGECOPY_SRC_COPY = 1, - + /* Use src action (but just reference the existing version) */ ADT_MERGECOPY_SRC_REF = 2 } eAnimData_MergeCopy_Modes; diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index 57d70afcb8b..23014accc3f 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -55,10 +55,10 @@ typedef struct PoseTarget { typedef struct PoseTree { struct PoseTree *next, *prev; - + int type; /* type of IK that this serves (CONSTRAINT_TYPE_KINEMATIC or ..._SPLINEIK) */ int totchannel; /* number of pose channels */ - + struct ListBase targets; /* list of targets of the tree */ struct bPoseChannel **pchan; /* array of pose channels */ int *parent; /* and their parents */ diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h index d598923edbc..f0d8e1a1d84 100644 --- a/source/blender/blenkernel/BKE_cloth.h +++ b/source/blender/blenkernel/BKE_cloth.h @@ -68,7 +68,7 @@ typedef struct ClothHairData { typedef struct ClothSolverResult { int status; - + int max_iterations, min_iterations; float avg_iterations; float max_error, min_error, avg_error; @@ -139,7 +139,7 @@ typedef struct ClothSpring { int flags; /* defined in BKE_cloth.h, e.g. deactivated due to tearing */ float stiffness; /* stiffness factor from the vertex groups */ float editrestlen; - + /* angular bending spring target and derivatives */ float target[3]; } @@ -204,7 +204,7 @@ struct CollPair; typedef struct ColliderContacts { struct Object *ob; struct CollisionModifierData *collmd; - + struct CollPair *collisions; int totcollisions; } ColliderContacts; diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h index 98ba0f6f2a4..2bc71c114b7 100644 --- a/source/blender/blenkernel/BKE_constraint.h +++ b/source/blender/blenkernel/BKE_constraint.h @@ -53,10 +53,10 @@ typedef struct bConstraintOb { struct Scene *scene; /* for system time, part of deglobalization, code nicer later with local time (ton) */ struct Object *ob; /* if pchan, then armature that it comes from, otherwise constraint owner */ struct bPoseChannel *pchan; /* pose channel that owns the constraints being evaluated */ - + float matrix[4][4]; /* matrix where constraints are accumulated + solved */ float startmat[4][4]; /* original matrix (before constraint solving) */ - + short type; /* type of owner */ short rotOrder; /* rotation order for constraint owner (as defined in eEulerRotationOrders in BLI_math.h) */ } bConstraintOb; @@ -85,7 +85,7 @@ typedef struct bConstraintTypeInfo { short size; /* size in bytes of the struct */ char name[32]; /* name of constraint in interface */ char structName[32]; /* name of struct for SDNA */ - + /* data management function pointers - special handling */ /* free any data that is allocated separately (optional) */ void (*free_data)(struct bConstraint *con); @@ -95,13 +95,13 @@ typedef struct bConstraintTypeInfo { void (*copy_data)(struct bConstraint *con, struct bConstraint *src); /* set settings for data that will be used for bConstraint.data (memory already allocated using MEM_callocN) */ void (*new_data)(void *cdata); - + /* target handling function pointers */ /* for multi-target constraints: return that list; otherwise make a temporary list (returns number of targets) */ int (*get_constraint_targets)(struct bConstraint *con, struct ListBase *list); /* for single-target constraints only: flush data back to source data, and the free memory used */ void (*flush_constraint_targets)(struct bConstraint *con, struct ListBase *list, bool no_copy); - + /* evaluation */ /* set the ct->matrix for the given constraint target (at the given ctime) */ void (*get_target_matrix)(struct Depsgraph *depsgraph, struct bConstraint *con, struct bConstraintOb *cob, struct bConstraintTarget *ct, float ctime); diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index e224863a27f..2ea940b8fee 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -330,6 +330,6 @@ struct Depsgraph *CTX_data_depsgraph_on_load(const bContext *C); #ifdef __cplusplus } #endif - + #endif diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index 85c894864d5..dc9bbf9336e 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -227,8 +227,8 @@ void CustomData_copy_data_named(const struct CustomData *source, struct CustomData *dest, int source_index, int dest_index, int count); void CustomData_copy_elements(int type, void *src_data_ofs, void *dst_data_ofs, int count); -void CustomData_bmesh_copy_data(const struct CustomData *source, - struct CustomData *dest, void *src_block, +void CustomData_bmesh_copy_data(const struct CustomData *source, + struct CustomData *dest, void *src_block, void **dest_block); /* frees data in a CustomData object @@ -354,9 +354,9 @@ void CustomData_bmesh_free_block_data(struct CustomData *data, void *block); /* copy custom data to/from layers as in mesh/derivedmesh, to editmesh * blocks of data. the CustomData's must not be compatible */ -void CustomData_to_bmesh_block(const struct CustomData *source, +void CustomData_to_bmesh_block(const struct CustomData *source, struct CustomData *dest, int src_index, void **dest_block, bool use_default_init); -void CustomData_from_bmesh_block(const struct CustomData *source, +void CustomData_from_bmesh_block(const struct CustomData *source, struct CustomData *dest, void *src_block, int dest_index); void CustomData_file_write_prepare( diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h index 6dd40b7a651..034f9b2b6a8 100644 --- a/source/blender/blenkernel/BKE_displist.h +++ b/source/blender/blenkernel/BKE_displist.h @@ -1,4 +1,4 @@ -/* +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or diff --git a/source/blender/blenkernel/BKE_dynamicpaint.h b/source/blender/blenkernel/BKE_dynamicpaint.h index 0a759629930..acb5e63d32f 100644 --- a/source/blender/blenkernel/BKE_dynamicpaint.h +++ b/source/blender/blenkernel/BKE_dynamicpaint.h @@ -55,7 +55,7 @@ typedef struct PaintPoint { } PaintPoint; /* heigh field waves */ -typedef struct PaintWavePoint { +typedef struct PaintWavePoint { float height; float velocity; diff --git a/source/blender/blenkernel/BKE_editmesh.h b/source/blender/blenkernel/BKE_editmesh.h index 5e456fea64f..14a754b708e 100644 --- a/source/blender/blenkernel/BKE_editmesh.h +++ b/source/blender/blenkernel/BKE_editmesh.h @@ -57,7 +57,7 @@ typedef struct BMEditMesh { /*this is for undoing failed operations*/ struct BMEditMesh *emcopy; int emcopyusers; - + /* we store tessellations as triplets of three loops, * which each define a triangle.*/ struct BMLoop *(*looptris)[3]; diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h index d45ecf9e3d8..379ab3e81b5 100644 --- a/source/blender/blenkernel/BKE_effect.h +++ b/source/blender/blenkernel/BKE_effect.h @@ -99,7 +99,7 @@ typedef struct EffectorCache { struct Object *ob; struct ParticleSystem *psys; struct SurfaceModifierData *surmd; - + struct PartDeflect *pd; /* precalculated for guides */ @@ -171,10 +171,10 @@ unsigned int BKE_sim_debug_data_hash_combine(unsigned int kx, unsigned int ky); typedef struct SimDebugElement { unsigned int category_hash; unsigned int hash; - + int type; float color[3]; - + float v1[3], v2[3]; char str[64]; } SimDebugElement; diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index dbe325b2056..c0bbf146afd 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -66,7 +66,7 @@ void bezt_add_to_cfra_elem(ListBase *lb, struct BezTriple *bezt); /* ************** F-Curve Drivers ***************** */ -/* With these iterators for convenience, the variables "tarIndex" and "dtar" can be +/* With these iterators for convenience, the variables "tarIndex" and "dtar" can be * accessed directly from the code using them, but it is not recommended that their * values be changed to point at other slots... */ @@ -77,14 +77,14 @@ void bezt_add_to_cfra_elem(ListBase *lb, struct BezTriple *bezt); DriverTarget *dtar = &dvar->targets[0]; \ int tarIndex = 0; \ for (; tarIndex < MAX_DRIVER_TARGETS; tarIndex++, dtar++) - + /* convenience looper over USED driver targets only */ #define DRIVER_TARGETS_USED_LOOPER(dvar) \ { \ DriverTarget *dtar = &dvar->targets[0]; \ int tarIndex = 0; \ for (; tarIndex < dvar->num_targets; tarIndex++, dtar++) - + /* tidy up for driver targets loopers */ #define DRIVER_TARGETS_LOOPER_END \ } @@ -134,7 +134,7 @@ typedef struct FModifierTypeInfo { short requires; /* eFMI_Requirement_Flags */ char name[64]; /* name of modifier in interface */ char structName[64]; /* name of struct for SDNA */ - + /* data management function pointers - special handling */ /* free any data that is allocated separately (optional) */ void (*free_data)(struct FModifier *fcm); @@ -144,7 +144,7 @@ typedef struct FModifierTypeInfo { void (*new_data)(void *mdata); /* verifies that the modifier settings are valid */ void (*verify_data)(struct FModifier *fcm); - + /* evaluation */ /* evaluate time that the modifier requires the F-Curve to be evaluated at */ float (*evaluate_modifier_time)(struct FCurve *fcu, struct FModifier *fcm, float cvalue, float evaltime); @@ -230,7 +230,7 @@ struct FCurve *iter_step_fcurve(struct FCurve *fcu_iter, const char rna_path[]); /* high level function to get an fcurve from C without having the rna */ struct FCurve *id_data_find_fcurve(ID *id, void *data, struct StructRNA *type, const char *prop_name, int index, bool *r_driven); -/* Get list of LinkData's containing pointers to the F-Curves which control the types of data indicated +/* Get list of LinkData's containing pointers to the F-Curves which control the types of data indicated * e.g. numMatches = list_find_data_fcurves(matches, &act->curves, "pose.bones[", "MyFancyBone"); */ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix, const char *dataName); @@ -292,7 +292,7 @@ float calculate_fcurve(struct PathResolvedRNA *anim_rna, struct FCurve *fcu, flo /* -------- Defines -------- */ -/* Basic signature for F-Curve sample-creation function +/* Basic signature for F-Curve sample-creation function * - fcu: the F-Curve being operated on * - data: pointer to some specific data that may be used by one of the callbacks */ @@ -305,7 +305,7 @@ float fcurve_samplingcb_evalcurve(struct FCurve *fcu, void *data, float evaltime /* -------- Main Methods -------- */ -/* Main API function for creating a set of sampled curve data, given some callback function +/* Main API function for creating a set of sampled curve data, given some callback function * used to retrieve the values to store. */ void fcurve_store_samples(struct FCurve *fcu, void *data, int start, int end, FcuSampleFunc sample_cb); diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h index bb1f97e83e6..d13cd4adff9 100644 --- a/source/blender/blenkernel/BKE_font.h +++ b/source/blender/blenkernel/BKE_font.h @@ -58,7 +58,7 @@ typedef struct EditFontSelBox { typedef struct EditFont { wchar_t *textbuf; struct CharInfo *textbufinfo; - + /* array of rectangles & rotation */ float textcurs[4][2]; EditFontSelBox *selboxes; @@ -68,7 +68,7 @@ typedef struct EditFont { * a copy of these is kept in Curve, but use these in editmode */ int len, pos; int selstart, selend; - + } EditFont; @@ -76,7 +76,7 @@ bool BKE_vfont_is_builtin(struct VFont *vfont); void BKE_vfont_builtin_register(void *mem, int size); void BKE_vfont_free_data(struct VFont *vfont); -void BKE_vfont_free(struct VFont *sc); +void BKE_vfont_free(struct VFont *sc); void BKE_vfont_init(struct VFont *vfont); void BKE_vfont_copy_data(struct Main *bmain, struct VFont *vfont_dst, const struct VFont *vfont_src, const int flag); struct VFont *BKE_vfont_builtin_get(void); diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index c5ad91c81fd..82afbdefeab 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -50,7 +50,7 @@ typedef struct Global { /* active pointers */ struct Main *main; - + /* strings: lastsaved */ char ima[1024], lib[1024]; /* 1024 = FILE_MAX */ @@ -218,5 +218,5 @@ extern Global G; #ifdef __cplusplus } #endif - + #endif diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h index c7ea73463e3..3a951b7860d 100644 --- a/source/blender/blenkernel/BKE_gpencil.h +++ b/source/blender/blenkernel/BKE_gpencil.h @@ -88,7 +88,7 @@ bool gpencil_layer_is_editable(const struct bGPDlayer *gpl); typedef enum eGP_GetFrame_Mode { /* Use the preceeding gp-frame (i.e. don't add anything) */ GP_GETFRAME_USE_PREV = 0, - + /* Add a new empty/blank frame */ GP_GETFRAME_ADD_NEW = 1, /* Make a copy of the active frame */ diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h index 94630eaa7b0..6df31db7b83 100644 --- a/source/blender/blenkernel/BKE_idprop.h +++ b/source/blender/blenkernel/BKE_idprop.h @@ -19,7 +19,7 @@ * * ***** END GPL LICENSE BLOCK ***** */ - + #ifndef __BKE_IDPROP_H__ #define __BKE_IDPROP_H__ diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index a7d7806997c..badcd5012de 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -216,7 +216,7 @@ void BKE_image_verify_viewer_views(const struct RenderData *rd, struct Image *im void BKE_image_user_frame_calc(struct ImageUser *iuser, int cfra, int fieldnr); void BKE_image_user_check_frame_calc(struct ImageUser *iuser, int cfra, int fieldnr); int BKE_image_user_frame_get(const struct ImageUser *iuser, int cfra, int fieldnr, bool *r_is_in_range); -void BKE_image_user_file_path(struct ImageUser *iuser, struct Image *ima, char *path); +void BKE_image_user_file_path(struct ImageUser *iuser, struct Image *ima, char *path); void BKE_image_update_frame(const struct Main *bmain, int cfra); /* sets index offset for multilayer files */ diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index b40d32203f6..8a9e2f44604 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -202,7 +202,7 @@ typedef struct ModifierTypeInfo { * * The derivedData argument should always be non-NULL; the modifier * should read the object data from the derived object instead of the - * actual object data. + * actual object data. * * The modifier may reuse the derivedData argument (i.e. return it in * modified form), but must not release it. @@ -212,7 +212,7 @@ typedef struct ModifierTypeInfo { /* Like applyModifier but called during editmode (for supporting * modifiers). - * + * * The derived object that is returned must support the operations that * are expected from editmode objects. The same qualifications regarding * derivedData apply as for applyModifier. @@ -253,7 +253,7 @@ typedef struct ModifierTypeInfo { * * The mesh argument should always be non-NULL; the modifier * should read the object data from the mesh object instead of the - * actual object data. + * actual object data. * * The modifier may reuse the mesh argument (i.e. return it in * modified form), but must not release it. @@ -263,7 +263,7 @@ typedef struct ModifierTypeInfo { /* Like applyModifier but called during editmode (for supporting * modifiers). - * + * * The mesh object that is returned must support the operations that * are expected from editmode objects. The same qualifications regarding * mesh apply as for applyModifier. @@ -277,7 +277,7 @@ typedef struct ModifierTypeInfo { /* Initialize new instance data for this modifier type, this function * should set modifier variables to their default values. - * + * * This function is optional. */ void (*initData)(struct ModifierData *md); @@ -323,7 +323,7 @@ typedef struct ModifierTypeInfo { */ void (*updateDepsgraph)(struct ModifierData *md, const ModifierUpdateDepsgraphContext *ctx); - + /* Should return true if the modifier needs to be recalculated on time * changes. * @@ -335,7 +335,7 @@ typedef struct ModifierTypeInfo { /* True when a deform modifier uses normals, the requiredDataMask * cant be used here because that refers to a normal layer where as * in this case we need to know if the deform modifier uses normals. - * + * * this is needed because applying 2 deform modifiers will give the * second modifier bogus normals. * */ diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index d271252ceef..63398ec9f5e 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -100,7 +100,7 @@ typedef struct bNodeSocketTemplate { float min, max; int subtype; /* would use PropertySubType but this is a bad level include to use RNA */ int flag; - + /* after this line is used internal only */ struct bNodeSocket *sock; /* used to hold verified socket */ char identifier[64]; /* generated from name */ @@ -111,21 +111,21 @@ typedef struct bNodeSocketTemplate { */ typedef struct bNodeSocketType { char idname[64]; /* identifier name */ - + void (*draw)(struct bContext *C, struct uiLayout *layout, struct PointerRNA *ptr, struct PointerRNA *node_ptr, const char *text); void (*draw_color)(struct bContext *C, struct PointerRNA *ptr, struct PointerRNA *node_ptr, float *r_color); - + void (*interface_draw)(struct bContext *C, struct uiLayout *layout, struct PointerRNA *ptr); void (*interface_draw_color)(struct bContext *C, struct PointerRNA *ptr, float *r_color); void (*interface_register_properties)(struct bNodeTree *ntree, struct bNodeSocket *stemp, struct StructRNA *data_srna); void (*interface_init_socket)(struct bNodeTree *ntree, struct bNodeSocket *stemp, struct bNode *node, struct bNodeSocket *sock, const char *data_path); void (*interface_verify_socket)(struct bNodeTree *ntree, struct bNodeSocket *stemp, struct bNode *node, struct bNodeSocket *sock, const char *data_path); void (*interface_from_socket)(struct bNodeTree *ntree, struct bNodeSocket *stemp, struct bNode *node, struct bNodeSocket *sock); - + /* RNA integration */ ExtensionRNA ext_socket; ExtensionRNA ext_interface; - + /* for standard socket types in C */ int type, subtype; } bNodeSocketType; @@ -142,23 +142,23 @@ typedef int (*NodeGPUExecFunction)(struct GPUMaterial *mat, struct bNode *node, typedef struct bNodeType { void *next, *prev; short needs_free; /* set for allocated types that need to be freed */ - + char idname[64]; /* identifier name */ int type; char ui_name[64]; /* MAX_NAME */ char ui_description[256]; int ui_icon; - + float width, minwidth, maxwidth; float height, minheight, maxheight; short nclass, flag, compatibility; - + /* templates for static sockets */ bNodeSocketTemplate *inputs, *outputs; - + char storagename[64]; /* struct name for DNA */ - + /* Main draw function for the node */ void (*draw_nodetype)(const struct bContext *C, struct ARegion *ar, struct SpaceNode *snode, struct bNodeTree *ntree, struct bNode *node, bNodeInstanceKey key); @@ -184,41 +184,41 @@ typedef struct bNodeType { int (*select_area_func)(struct bNode *node, int x, int y); /// Optional tweak area polling (for grabbing). int (*tweak_area_func)(struct bNode *node, int x, int y); - + /// Called when the node is updated in the editor. void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node); /// Check and update if internal ID data has changed. void (*verifyfunc)(struct bNodeTree *ntree, struct bNode *node, struct ID *id); - + /// Initialize a new node instance of this type after creation. void (*initfunc)(struct bNodeTree *ntree, struct bNode *node); /// Free the node instance. void (*freefunc)(struct bNode *node); /// Make a copy of the node instance. void (*copyfunc)(struct bNodeTree *dest_ntree, struct bNode *dest_node, struct bNode *src_node); - + /* Registerable API callback versions, called in addition to C callbacks */ void (*initfunc_api)(const struct bContext *C, struct PointerRNA *ptr); void (*freefunc_api)(struct PointerRNA *ptr); void (*copyfunc_api)(struct PointerRNA *ptr, struct bNode *src_node); - + /* can this node type be added to a node tree */ int (*poll)(struct bNodeType *ntype, struct bNodeTree *nodetree); /* can this node be added to a node tree */ int (*poll_instance)(struct bNode *node, struct bNodeTree *nodetree); - + /* optional handling of link insertion */ void (*insert_link)(struct bNodeTree *ntree, struct bNode *node, struct bNodeLink *link); /* Update the internal links list, for muting and disconnect operators. */ void (*update_internal_links)(struct bNodeTree *, struct bNode *node); - + /* **** execution callbacks **** */ NodeInitExecFunction initexecfunc; NodeFreeExecFunction freeexecfunc; NodeExecFunction execfunc; /* gpu */ NodeGPUExecFunction gpufunc; - + /* RNA integration */ ExtensionRNA ext; } bNodeType; @@ -279,7 +279,7 @@ typedef struct bNodeTreeType { char ui_name[64]; char ui_description[256]; int ui_icon; - + /* callbacks */ void (*free_cache)(struct bNodeTree *ntree); void (*free_node_cache)(struct bNodeTree *ntree, struct bNode *node); @@ -297,11 +297,11 @@ typedef struct bNodeTreeType { /* Tree update. Overrides nodetype->updatetreefunc! */ void (*update)(struct bNodeTree *ntree); - + int (*validate_link)(struct bNodeTree *ntree, struct bNodeLink *link); void (*node_add_init)(struct bNodeTree *ntree, struct bNode *bnode); - + /* RNA integration */ ExtensionRNA ext; } bNodeTreeType; diff --git a/source/blender/blenkernel/BKE_ocean.h b/source/blender/blenkernel/BKE_ocean.h index 7a4c7d67040..3ea104e656a 100644 --- a/source/blender/blenkernel/BKE_ocean.h +++ b/source/blender/blenkernel/BKE_ocean.h @@ -1,4 +1,4 @@ -/* +/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or @@ -35,7 +35,7 @@ typedef struct OceanResult { float disp[3]; float normal[3]; float foam; - + /* raw eigenvalues/vectors */ float Jminus; float Jplus; @@ -47,25 +47,25 @@ typedef struct OceanCache { struct ImBuf **ibufs_disp; struct ImBuf **ibufs_foam; struct ImBuf **ibufs_norm; - + const char *bakepath; const char *relbase; - + /* precalculated for time range */ float *time; - + /* constant for time range */ float wave_scale; float chop_amount; float foam_coverage; float foam_fade; - + int start; int end; int duration; int resolution_x; int resolution_y; - + int baked; } OceanCache; @@ -93,7 +93,7 @@ struct OceanCache *BKE_ocean_init_cache( int start, int end, float wave_scale, float chop_amount, float foam_coverage, float foam_fade, int resolution); void BKE_ocean_simulate_cache(struct OceanCache *och, int frame); - + void BKE_ocean_bake(struct Ocean *o, struct OceanCache *och, void (*update_cb)(void *, float progress, int *cancel), void *update_cb_data); void BKE_ocean_cache_eval_uv(struct OceanCache *och, struct OceanResult *ocr, int f, float u, float v); void BKE_ocean_cache_eval_ij(struct OceanCache *och, struct OceanResult *ocr, int f, int i, int j); diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 2ba6446c18f..6ade14b275c 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -184,7 +184,7 @@ typedef struct SculptSession { int totvert, totpoly; struct KeyBlock *kb; float *vmask; - + /* Mesh connectivity */ struct MeshElemMap *pmap; int *pmap_mem; @@ -210,7 +210,7 @@ typedef struct SculptSession { /* Partial redraw */ bool partial_redraw; - + /* Used to cache the render of the active texture */ unsigned int texcache_side, *texcache, texcache_actual; struct ImagePool *tex_pool; diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index dcc9c366b44..64cf7e8402e 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -61,7 +61,7 @@ struct LinkNode; struct KDTree; struct RNG; struct BVHTreeRay; -struct BVHTreeRayHit; +struct BVHTreeRayHit; struct EdgeHash; struct Depsgraph; struct ViewLayer; @@ -198,7 +198,7 @@ typedef struct ParticleCollisionElement { /* values interpolated from original data*/ float x0[3], x1[3], x2[3], p[3]; - + /* results for found intersection point */ float nor[3], vel[3], uv[2]; diff --git a/source/blender/blenkernel/BKE_report.h b/source/blender/blenkernel/BKE_report.h index 70feff17151..2a79c7f5d58 100644 --- a/source/blender/blenkernel/BKE_report.h +++ b/source/blender/blenkernel/BKE_report.h @@ -74,6 +74,6 @@ bool BKE_report_write_file(const char *filepath, ReportList *reports, const char #ifdef __cplusplus } #endif - + #endif diff --git a/source/blender/blenkernel/BKE_rigidbody.h b/source/blender/blenkernel/BKE_rigidbody.h index 016a531db95..cea0eb12f0f 100644 --- a/source/blender/blenkernel/BKE_rigidbody.h +++ b/source/blender/blenkernel/BKE_rigidbody.h @@ -29,7 +29,7 @@ * \ingroup blenkernel * \brief API for Blender-side Rigid Body stuff */ - + #ifndef __BKE_RIGIDBODY_H__ #define __BKE_RIGIDBODY_H__ diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index a541120638b..51f61c8352c 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -138,38 +138,38 @@ struct SeqEffectHandle { /* constructors & destructor */ /* init is _only_ called on first creation */ void (*init)(struct Sequence *seq); - - /* number of input strips needed + + /* number of input strips needed * (called directly after construction) */ int (*num_inputs)(void); - + /* load is called first time after readblenfile in * get_sequence_effect automatically */ void (*load)(struct Sequence *seq); - + /* duplicate */ void (*copy)(struct Sequence *dst, struct Sequence *src); - + /* destruct */ void (*free)(struct Sequence *seq); - + /* returns: -1: no input needed, * 0: no early out, * 1: out = ibuf1, * 2: out = ibuf2 */ - int (*early_out)(struct Sequence *seq, float facf0, float facf1); - + int (*early_out)(struct Sequence *seq, float facf0, float facf1); + /* stores the y-range of the effect IPO */ void (*store_icu_yrange)(struct Sequence *seq, short adrcode, float *ymin, float *ymax); - + /* stores the default facf0 and facf1 if no IPO is present */ void (*get_default_fac)(struct Sequence *seq, float cfra, float *facf0, float *facf1); - + /* execute the effect * sequence effects are only required to either support * float-rects or byte-rects * (mixed cases are handled one layer up...) */ - + struct ImBuf * (*execute)(const SeqRenderData *context, struct Sequence *seq, float cfra, float facf0, float facf1, struct ImBuf *ibuf1, struct ImBuf *ibuf2, struct ImBuf *ibuf3); @@ -276,7 +276,7 @@ void BKE_sequencer_cache_cleanup(void); /* returned ImBuf is properly refed and has to be freed */ struct ImBuf *BKE_sequencer_cache_get(const SeqRenderData *context, struct Sequence *seq, float cfra, eSeqStripElemIBuf type); -/* passed ImBuf is properly refed, so ownership is *not* +/* passed ImBuf is properly refed, so ownership is *not* * transferred to the cache. * you can pass the same ImBuf multiple times to the cache without problems. */ diff --git a/source/blender/blenkernel/BKE_writeavi.h b/source/blender/blenkernel/BKE_writeavi.h index ca295c51f5d..3bd0689a93a 100644 --- a/source/blender/blenkernel/BKE_writeavi.h +++ b/source/blender/blenkernel/BKE_writeavi.h @@ -38,7 +38,7 @@ extern "C" { /* generic blender movie support, could move to own module */ -struct RenderData; +struct RenderData; struct ReportList; struct Scene; diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index 68bcfa878ac..81b1afa3621 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -277,7 +277,7 @@ CCGSubSurf *ccgSubSurf_new(CCGMeshIFC *ifc, int subdivLevels, CCGAllocatorIFC *a ss->fMap = ccg_ehash_new(0, &ss->allocatorIFC, ss->allocator); ss->meshIFC = *ifc; - + ss->subdivLevels = subdivLevels; ss->numGrids = 0; ss->allowEdgeCreation = 0; @@ -489,8 +489,8 @@ CCGError ccgSubSurf_initFullSync(CCGSubSurf *ss) ss->currentAge++; - ss->oldVMap = ss->vMap; - ss->oldEMap = ss->eMap; + ss->oldVMap = ss->vMap; + ss->oldEMap = ss->eMap; ss->oldFMap = ss->fMap; ss->vMap = ccg_ehash_new(0, &ss->allocatorIFC, ss->allocator); @@ -592,7 +592,7 @@ CCGError ccgSubSurf_syncVert(CCGSubSurf *ss, CCGVertHDL vHDL, const void *vertDa void **prevp; CCGVert *v = NULL; short seamflag = (seam) ? Vert_eSeam : 0; - + if (ss->syncState == eSyncState_Partial) { v = ccg_ehash_lookupWithPrev(ss->vMap, vHDL, &prevp); if (!v) { @@ -937,7 +937,7 @@ void ccgSubSurf__effectedFaceNeighbours(CCGSubSurf *ss, CCGFace **faces, int num for (j = 0; j < v->numFaces; j++) if (!(v->faces[j]->flags & Face_eEffected)) break; - + if (j == v->numFaces) { arrayV[numV++] = v; v->flags |= Vert_eEffected; @@ -952,7 +952,7 @@ void ccgSubSurf__effectedFaceNeighbours(CCGSubSurf *ss, CCGFace **faces, int num for (j = 0; j < e->numFaces; j++) if (!(e->faces[j]->flags & Face_eEffected)) break; - + if (j == e->numFaces) { e->flags |= Edge_eEffected; arrayE[numE++] = e; @@ -1550,11 +1550,11 @@ int ccgSubSurf_getNumFinalFaces(const CCGSubSurf *ss) void CCG_key(CCGKey *key, const CCGSubSurf *ss, int level) { key->level = level; - + key->elem_size = ss->meshIFC.vertDataSize; key->has_normals = ss->calcVertNormals; key->num_layers = ss->meshIFC.numLayers; - + /* if normals are present, always the last three floats of an * element */ if (key->has_normals) diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index c4904fcaa7c..ebf19a99e58 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -136,7 +136,7 @@ static MFace *dm_getTessFaceArray(DerivedMesh *dm) if (!mface) { int numTessFaces = dm->getNumTessFaces(dm); - + if (!numTessFaces) { /* Do not add layer if there's no elements in it, this leads to issues later when * this layer is needed with non-zero size, but currently CD stuff does not check @@ -144,7 +144,7 @@ static MFace *dm_getTessFaceArray(DerivedMesh *dm) * added (sergey) */ return NULL; } - + mface = CustomData_add_layer(&dm->faceData, CD_MFACE, CD_CALLOC, NULL, numTessFaces); CustomData_set_layer_flag(&dm->faceData, CD_MFACE, CD_FLAG_TEMPORARY); dm->copyTessFaceArray(dm, mface); @@ -346,7 +346,7 @@ void DM_init( dm->numPolyData = numPolys; DM_init_funcs(dm); - + dm->needsFree = 1; dm->dirty = 0; @@ -754,7 +754,7 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask, bool if (CustomData_has_layer(&dm->vertData, CD_SHAPEKEY)) { KeyBlock *kb; int uid; - + if (ob) { kb = BLI_findlink(&me->key->block, ob->shapenr - 1); if (kb) { @@ -780,7 +780,7 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask, bool if (ob) { BKE_mesh_texspace_copy_from_object(&tmp, ob); } - + /* not all DerivedMeshes store their verts/edges/faces in CustomData, so * we set them here in case they are missing */ if (!CustomData_has_layer(&tmp.vdata, CD_MVERT)) { @@ -861,18 +861,18 @@ void DM_to_meshkey(DerivedMesh *dm, Mesh *me, KeyBlock *kb) int a, totvert = dm->getNumVerts(dm); float *fp; MVert *mvert; - + if (totvert == 0 || me->totvert == 0 || me->totvert != totvert) { return; } - + if (kb->data) MEM_freeN(kb->data); kb->data = MEM_malloc_arrayN(me->key->elemsize, me->totvert, "kb->data"); kb->totelem = totvert; - + fp = kb->data; mvert = dm->getVertDataArray(dm, CD_MVERT); - + for (a = 0; a < kb->totelem; a++, fp += 3, mvert++) { copy_v3_v3(fp, mvert->co); } @@ -1146,10 +1146,10 @@ void DM_interp_poly_data( DerivedMesh *mesh_create_derived(Mesh *me, float (*vertCos)[3]) { DerivedMesh *dm = CDDM_from_mesh(me); - + if (!dm) return NULL; - + if (vertCos) { CDDM_apply_vert_coords(dm, vertCos); } @@ -1170,7 +1170,7 @@ DerivedMesh *mesh_create_derived_for_modifier( ModifierEvalContext mectx = {depsgraph, ob, 0}; md->scene = scene; - + if (!(md->mode & eModifierMode_Realtime)) { return NULL; } @@ -1178,11 +1178,11 @@ DerivedMesh *mesh_create_derived_for_modifier( if (mti->isDisabled && mti->isDisabled(md, 0)) { return NULL; } - + if (build_shapekey_layers && me->key && (kb = BLI_findlink(&me->key->block, ob->shapenr - 1))) { BKE_keyblock_convert_to_mesh(kb, me); } - + if (mti->type == eModifierTypeType_OnlyDeform) { int numVerts; float (*deformedVerts)[3] = BKE_mesh_vertexCos_get(me, &numVerts); @@ -1192,7 +1192,7 @@ DerivedMesh *mesh_create_derived_for_modifier( if (build_shapekey_layers) add_shapekey_layers(dm, me, ob); - + MEM_freeN(deformedVerts); } else { @@ -1200,7 +1200,7 @@ DerivedMesh *mesh_create_derived_for_modifier( if (build_shapekey_layers) add_shapekey_layers(tdm, me, ob); - + dm = modwrap_applyModifier(md, &mectx, tdm); ASSERT_IS_VALID_DM(dm); @@ -1220,13 +1220,13 @@ static float (*get_editbmesh_orco_verts(BMEditMesh *em))[3] /* these may not really be the orco's, but it's only for preview. * could be solver better once, but isn't simple */ - + orco = MEM_malloc_arrayN(em->bm->totvert, sizeof(float) * 3, "BMEditMesh Orco"); BM_ITER_MESH_INDEX (eve, &iter, em->bm, BM_VERTS_OF_MESH, i) { copy_v3_v3(orco[i], eve->co); } - + return orco; } @@ -1490,7 +1490,7 @@ static void calc_weightpaint_vert_color( const int draw_flag) { float input = 0.0f; - + bool show_alert_color = false; if ((defbase_sel_tot > 1) && (draw_flag & CALC_WP_MULTIPAINT)) { @@ -1871,35 +1871,35 @@ static void shapekey_layers_to_keyblocks(DerivedMesh *dm, Mesh *me, int actshape { KeyBlock *kb; int i, j, tot; - + if (!me->key) return; - + tot = CustomData_number_of_layers(&dm->vertData, CD_SHAPEKEY); for (i = 0; i < tot; i++) { CustomDataLayer *layer = &dm->vertData.layers[CustomData_get_layer_index_n(&dm->vertData, CD_SHAPEKEY, i)]; float (*cos)[3], (*kbcos)[3]; - + for (kb = me->key->block.first; kb; kb = kb->next) { if (kb->uid == layer->uid) break; } - + if (!kb) { kb = BKE_keyblock_add(me->key, layer->name); kb->uid = layer->uid; } - + if (kb->data) MEM_freeN(kb->data); - + cos = CustomData_get_layer_n(&dm->vertData, CD_SHAPEKEY, i); kb->totelem = dm->numVertData; kb->data = kbcos = MEM_malloc_arrayN(kb->totelem, 3 * sizeof(float), "kbcos DerivedMesh.c"); if (kb->uid == actshape_uid) { MVert *mvert = dm->getVertArray(dm); - + for (j = 0; j < dm->numVertData; j++, kbcos++, mvert++) { copy_v3_v3(*kbcos, mvert->co); } @@ -1910,12 +1910,12 @@ static void shapekey_layers_to_keyblocks(DerivedMesh *dm, Mesh *me, int actshape } } } - + for (kb = me->key->block.first; kb; kb = kb->next) { if (kb->totelem != dm->numVertData) { if (kb->data) MEM_freeN(kb->data); - + kb->totelem = dm->numVertData; kb->data = MEM_calloc_arrayN(kb->totelem, 3 * sizeof(float), "kb->data derivedmesh.c"); fprintf(stderr, "%s: lost a shapekey layer: '%s'! (bmesh internal error)\n", __func__, kb->name); @@ -2096,13 +2096,13 @@ static void mesh_calc_modifiers( if (useDeform) { if (inputVertexCos) deformedVerts = inputVertexCos; - + /* Apply all leading deforming modifiers */ for (; md; md = md->next, curr = curr->next) { const ModifierTypeInfo *mti = modifierType_getInfo(md->type); md->scene = scene; - + if (!modifier_isEnabled(scene, md, required_mode)) { continue; } @@ -2120,7 +2120,7 @@ static void mesh_calc_modifiers( else { break; } - + /* grab modifiers until index i */ if ((index != -1) && (BLI_findindex(&ob->modifiers, md) >= index)) break; @@ -2143,7 +2143,7 @@ static void mesh_calc_modifiers( BLI_assert(!build_shapekey_layers); //if (build_shapekey_layers) // add_shapekey_layers(*r_deform_mesh, me, ob); - + if (deformedVerts) { BKE_mesh_apply_vert_coords(*r_deform_mesh, deformedVerts); } @@ -2159,7 +2159,7 @@ static void mesh_calc_modifiers( /* Now apply all remaining modifiers. If useDeform is off then skip - * OnlyDeform ones. + * OnlyDeform ones. */ Mesh *mesh = NULL; Mesh *orco_mesh = NULL; @@ -2318,7 +2318,7 @@ static void mesh_calc_modifiers( } } - + /* set the Mesh to only copy needed data */ mask = curr->mask; /* needMapping check here fixes bug [#28112], otherwise it's @@ -2585,7 +2585,7 @@ bool editbmesh_modifier_is_enabled(Scene *scene, ModifierData *md, DerivedMesh * modifier_setError(md, "Modifier requires original data, bad stack position"); return false; } - + return true; } @@ -2647,7 +2647,7 @@ static void editbmesh_calc_modifiers( const ModifierTypeInfo *mti = modifierType_getInfo(md->type); md->scene = scene; - + if (!editbmesh_modifier_is_enabled(scene, md, dm)) { continue; } @@ -3194,7 +3194,7 @@ Mesh *mesh_get_eval_deform(struct Depsgraph *depsgraph, Scene *scene, Object *ob DerivedMesh *mesh_create_derived_render(struct Depsgraph *depsgraph, Scene *scene, Object *ob, CustomDataMask dataMask) { DerivedMesh *final; - + mesh_calc_modifiers_dm( depsgraph, scene, ob, NULL, 1, false, dataMask, -1, false, false, false, NULL, &final); @@ -3239,7 +3239,7 @@ DerivedMesh *mesh_create_derived_no_deform( float (*vertCos)[3], CustomDataMask dataMask) { DerivedMesh *final; - + mesh_calc_modifiers_dm( depsgraph, scene, ob, vertCos, 0, false, dataMask, -1, false, false, false, NULL, &final); @@ -3353,13 +3353,13 @@ DMCoNo *mesh_get_mapped_verts_nors(Scene *scene, Object *ob) Mesh *me = ob->data; DerivedMesh *dm; DMCoNo *vertexcosnos; - + /* lets prevent crashing... */ if (ob->type != OB_MESH || me->totvert == 0) return NULL; - + dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX); - + if (dm->foreachMappedVert) { vertexcosnos = MEM_calloc_arrayN(me->totvert, sizeof(DMCoNo), "vertexcosnos map"); dm->foreachMappedVert(dm, make_vertexcosnos__mapFunc, vertexcosnos); @@ -3372,7 +3372,7 @@ DMCoNo *mesh_get_mapped_verts_nors(Scene *scene, Object *ob) dm->getVertNo(dm, a, v_co_no->no); } } - + dm->release(dm); return vertexcosnos; } diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 28534fc9783..9f5b81a8915 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -32,7 +32,7 @@ #include <string.h> #include <math.h> #include <stdlib.h> -#include <stddef.h> +#include <stddef.h> #include "MEM_guardedalloc.h" @@ -88,11 +88,11 @@ bAction *BKE_action_add(Main *bmain, const char name[]) { bAction *act; - + act = BKE_libblock_alloc(bmain, ID_AC, name, 0); - + return act; -} +} /* .................................. */ @@ -106,15 +106,15 @@ void BKE_action_make_local(Main *bmain, bAction *act, const bool lib_local) /** Free (or release) any data used by this action (does not free the action itself). */ void BKE_action_free(bAction *act) -{ +{ /* No animdata here. */ /* Free F-Curves */ free_fcurves(&act->curves); - + /* Free groups */ BLI_freelistN(&act->groups); - + /* Free pose-references (aka local markers) */ BLI_freelistN(&act->markers); } @@ -179,14 +179,14 @@ bAction *BKE_action_copy(Main *bmain, const bAction *act_src) bActionGroup *get_active_actiongroup(bAction *act) { bActionGroup *agrp = NULL; - + if (act && act->groups.first) { for (agrp = act->groups.first; agrp; agrp = agrp->next) { if (agrp->flag & AGRP_ACTIVE) break; } } - + return agrp; } @@ -194,11 +194,11 @@ bActionGroup *get_active_actiongroup(bAction *act) void set_active_action_group(bAction *act, bActionGroup *agrp, short select) { bActionGroup *grp; - + /* sanity checks */ if (act == NULL) return; - + /* Deactive all others */ for (grp = act->groups.first; grp; grp = grp->next) { if ((grp == agrp) && (select)) @@ -217,7 +217,7 @@ void action_group_colors_sync(bActionGroup *grp, const bActionGroup *ref_grp) /* copy theme colors on-to group's custom color in case user tries to edit color */ bTheme *btheme = U.themes.first; ThemeWireColor *col_set = &btheme->tarm[(grp->customCol - 1)]; - + memcpy(&grp->cs, col_set, sizeof(ThemeWireColor)); } else { @@ -243,69 +243,69 @@ void action_group_colors_sync(bActionGroup *grp, const bActionGroup *ref_grp) bActionGroup *action_groups_add_new(bAction *act, const char name[]) { bActionGroup *agrp; - + /* sanity check: must have action and name */ if (ELEM(NULL, act, name)) return NULL; - + /* allocate a new one */ agrp = MEM_callocN(sizeof(bActionGroup), "bActionGroup"); - + /* make it selected, with default name */ agrp->flag = AGRP_SELECTED; BLI_strncpy(agrp->name, name[0] ? name : DATA_("Group"), sizeof(agrp->name)); - + /* add to action, and validate */ BLI_addtail(&act->groups, agrp); BLI_uniquename(&act->groups, agrp, DATA_("Group"), '.', offsetof(bActionGroup, name), sizeof(agrp->name)); - + /* return the new group */ return agrp; } -/* Add given channel into (active) group +/* Add given channel into (active) group * - assumes that channel is not linked to anything anymore * - always adds at the end of the group */ void action_groups_add_channel(bAction *act, bActionGroup *agrp, FCurve *fcurve) -{ +{ /* sanity checks */ if (ELEM(NULL, act, agrp, fcurve)) return; - + /* if no channels anywhere, just add to two lists at the same time */ if (BLI_listbase_is_empty(&act->curves)) { fcurve->next = fcurve->prev = NULL; - + agrp->channels.first = agrp->channels.last = fcurve; act->curves.first = act->curves.last = fcurve; } - - /* if the group already has channels, the F-Curve can simply be added to the list + + /* if the group already has channels, the F-Curve can simply be added to the list * (i.e. as the last channel in the group) */ else if (agrp->channels.first) { - /* if the group's last F-Curve is the action's last F-Curve too, + /* if the group's last F-Curve is the action's last F-Curve too, * then set the F-Curve as the last for the action first so that * the lists will be in sync after linking */ if (agrp->channels.last == act->curves.last) act->curves.last = fcurve; - + /* link in the given F-Curve after the last F-Curve in the group, * which means that it should be able to fit in with the rest of the * list seamlessly */ BLI_insertlinkafter(&agrp->channels, agrp->channels.last, fcurve); } - + /* otherwise, need to find the nearest F-Curve in group before/after current to link with */ else { bActionGroup *grp; - + /* firstly, link this F-Curve to the group */ agrp->channels.first = agrp->channels.last = fcurve; - + /* step through the groups preceding this one, finding the F-Curve there to attach this one after */ for (grp = agrp->prev; grp; grp = grp->prev) { /* if this group has F-Curves, we want weave the given one in right after the last channel there, @@ -319,18 +319,18 @@ void action_groups_add_channel(bAction *act, bActionGroup *agrp, FCurve *fcurve) break; } } - + /* if grp is NULL, that means we fell through, and this F-Curve should be added as the new first - * since group is (effectively) the first group. Thus, the existing first F-Curve becomes the + * since group is (effectively) the first group. Thus, the existing first F-Curve becomes the * second in the chain, etc. etc. */ if (grp == NULL) BLI_insertlinkbefore(&act->curves, act->curves.first, fcurve); } - + /* set the F-Curve's new group */ fcurve->grp = agrp; -} +} /* Remove the given channel from all groups */ void action_groups_remove_channel(bAction *act, FCurve *fcu) @@ -338,11 +338,11 @@ void action_groups_remove_channel(bAction *act, FCurve *fcu) /* sanity checks */ if (ELEM(NULL, act, fcu)) return; - + /* check if any group used this directly */ if (fcu->grp) { bActionGroup *agrp = fcu->grp; - + if (agrp->channels.first == agrp->channels.last) { if (agrp->channels.first == fcu) { BLI_listbase_clear(&agrp->channels); @@ -360,10 +360,10 @@ void action_groups_remove_channel(bAction *act, FCurve *fcu) else agrp->channels.last = NULL; } - + fcu->grp = NULL; } - + /* now just remove from list */ BLI_remlink(&act->curves, fcu); } @@ -374,7 +374,7 @@ bActionGroup *BKE_action_group_find_name(bAction *act, const char name[]) /* sanity checks */ if (ELEM(NULL, act, act->groups.first, name) || (name[0] == 0)) return NULL; - + /* do string comparisons */ return BLI_findstring(&act->groups, name, offsetof(bActionGroup, name)); } @@ -383,11 +383,11 @@ bActionGroup *BKE_action_group_find_name(bAction *act, const char name[]) void action_groups_clear_tempflags(bAction *act) { bActionGroup *agrp; - + /* sanity checks */ if (ELEM(NULL, act, act->groups.first)) return; - + /* flag clearing loop */ for (agrp = act->groups.first; agrp; agrp = agrp->next) agrp->flag &= ~AGRP_TEMP; @@ -403,10 +403,10 @@ bPoseChannel *BKE_pose_channel_find_name(const bPose *pose, const char *name) { if (ELEM(NULL, pose, name) || (name[0] == '\0')) return NULL; - + if (pose->chanhash) return BLI_ghash_lookup(pose->chanhash, (const void *)name); - + return BLI_findstring(&((const bPose *)pose)->chanbase, name, offsetof(bPoseChannel, name)); } @@ -421,10 +421,10 @@ bPoseChannel *BKE_pose_channel_find_name(const bPose *pose, const char *name) bPoseChannel *BKE_pose_channel_verify(bPose *pose, const char *name) { bPoseChannel *chan; - + if (pose == NULL) return NULL; - + /* See if this channel exists */ chan = BKE_pose_channel_find_name(pose, name); if (chan) { @@ -433,7 +433,7 @@ bPoseChannel *BKE_pose_channel_verify(bPose *pose, const char *name) /* If not, create it and add it */ chan = MEM_callocN(sizeof(bPoseChannel), "verifyPoseChannel"); - + BLI_strncpy(chan->name, name, sizeof(chan->name)); chan->custom_scale = 1.0f; @@ -442,22 +442,22 @@ bPoseChannel *BKE_pose_channel_verify(bPose *pose, const char *name) unit_qt(chan->quat); unit_axis_angle(chan->rotAxis, &chan->rotAngle); chan->size[0] = chan->size[1] = chan->size[2] = 1.0f; - + chan->scaleIn = chan->scaleOut = 1.0f; - + chan->limitmin[0] = chan->limitmin[1] = chan->limitmin[2] = -M_PI; chan->limitmax[0] = chan->limitmax[1] = chan->limitmax[2] = M_PI; chan->stiffness[0] = chan->stiffness[1] = chan->stiffness[2] = 0.0f; chan->ikrotweight = chan->iklinweight = 0.0f; unit_m4(chan->constinv); - + chan->protectflag = OB_LOCK_ROT4D; /* lock by components by default */ - + BLI_addtail(&pose->chanbase, chan); if (pose->chanhash) { BLI_ghash_insert(pose->chanhash, chan->name, chan); } - + return chan; } @@ -497,7 +497,7 @@ bPoseChannel *BKE_pose_channel_active(Object *ob) if ((pchan->bone) && (pchan->bone == arm->act_bone) && (pchan->bone->layer & arm->layer)) return pchan; } - + return NULL; } @@ -546,11 +546,11 @@ void BKE_pose_copy_data_ex(bPose **dst, const bPose *src, const int flag, const *dst = NULL; return; } - + outPose = MEM_callocN(sizeof(bPose), "pose"); - + BLI_duplicatelist(&outPose->chanbase, &src->chanbase); - + /* Rebuild ghash here too, so that name lookups below won't be too bad... * BUT this will have the penalty that the ghash will be built twice * if BKE_pose_rebuild() gets called after this... @@ -559,12 +559,12 @@ void BKE_pose_copy_data_ex(bPose **dst, const bPose *src, const int flag, const outPose->chanhash = NULL; BKE_pose_channels_hash_make(outPose); } - + outPose->iksolver = src->iksolver; outPose->ikdata = NULL; outPose->ikparam = MEM_dupallocN(src->ikparam); outPose->avs = src->avs; - + for (pchan = outPose->chanbase.first; pchan; pchan = pchan->next) { if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) { id_us_plus((ID *)pchan->custom); @@ -588,7 +588,7 @@ void BKE_pose_copy_data_ex(bPose **dst, const bPose *src, const int flag, const /* XXX: This is needed for motionpath drawing to work. Dunno why it was setting to null before... */ pchan->mpath = animviz_copy_motionpath(pchan->mpath); } - + if (pchan->prop) { pchan->prop = IDP_CopyProperty_ex(pchan->prop, flag); } @@ -600,7 +600,7 @@ void BKE_pose_copy_data_ex(bPose **dst, const bPose *src, const int flag, const if (copy_constraints) { BLI_duplicatelist(&outPose->agroups, &src->agroups); } - + *dst = outPose; } @@ -648,7 +648,7 @@ static bool pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan, int level) { bConstraint *con; Bone *bone; - + /* No need to check if constraint is active (has influence), * since all constraints with CONSTRAINT_IK_AUTO are active */ for (con = pchan->constraints.first; con; con = con->next) { @@ -677,18 +677,18 @@ bool BKE_pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan) * Removes the hash for quick lookup of channels, must * be done when adding/removing channels. */ -void BKE_pose_channels_hash_make(bPose *pose) +void BKE_pose_channels_hash_make(bPose *pose) { if (!pose->chanhash) { bPoseChannel *pchan; - + pose->chanhash = BLI_ghash_str_new("make_pose_chan gh"); for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) BLI_ghash_insert(pose->chanhash, pchan->name, pchan); } } -void BKE_pose_channels_hash_free(bPose *pose) +void BKE_pose_channels_hash_free(bPose *pose) { if (pose->chanhash) { BLI_ghash_free(pose->chanhash, NULL, NULL); @@ -744,7 +744,7 @@ void BKE_pose_channels_remove( cti->flush_constraint_targets(con, &targets, 0); } } - + if (pchan->bbone_prev) { if (filter_fn(pchan->bbone_prev->name, user_data)) pchan->bbone_prev = NULL; @@ -753,7 +753,7 @@ void BKE_pose_channels_remove( if (filter_fn(pchan->bbone_next->name, user_data)) pchan->bbone_next = NULL; } - + if (pchan->custom_tx) { if (filter_fn(pchan->custom_tx->name, user_data)) pchan->custom_tx = NULL; @@ -782,7 +782,7 @@ void BKE_pose_channel_free_ex(bPoseChannel *pchan, bool do_id_user) } BKE_constraints_free_ex(&pchan->constraints, do_id_user); - + if (pchan->prop) { IDP_FreeProperty(pchan->prop); MEM_freeN(pchan->prop); @@ -804,11 +804,11 @@ void BKE_pose_channel_free(bPoseChannel *pchan) void BKE_pose_channels_free_ex(bPose *pose, bool do_id_user) { bPoseChannel *pchan; - + if (pose->chanbase.first) { for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) BKE_pose_channel_free_ex(pchan, do_id_user); - + BLI_freelistN(&pose->chanbase); } @@ -885,7 +885,7 @@ void BKE_pose_channel_copy_data(bPoseChannel *pchan, const bPoseChannel *pchan_f pchan->ikstretch = pchan_from->ikstretch; pchan->ikrotweight = pchan_from->ikrotweight; pchan->iklinweight = pchan_from->iklinweight; - + /* bbone settings (typically not animated) */ pchan->bboneflag = pchan_from->bboneflag; pchan->bbone_next = pchan_from->bbone_next; @@ -923,31 +923,31 @@ void BKE_pose_update_constraint_flags(bPose *pose) { bPoseChannel *pchan, *parchan; bConstraint *con; - + /* clear */ for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { pchan->constflag = 0; } pose->flag &= ~POSE_CONSTRAINTS_TIMEDEPEND; - + /* detect */ for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { for (con = pchan->constraints.first; con; con = con->next) { if (con->type == CONSTRAINT_TYPE_KINEMATIC) { bKinematicConstraint *data = (bKinematicConstraint *)con->data; - + pchan->constflag |= PCHAN_HAS_IK; - + if (data->tar == NULL || (data->tar->type == OB_ARMATURE && data->subtarget[0] == 0)) pchan->constflag |= PCHAN_HAS_TARGET; - + /* negative rootbone = recalc rootbone index. used in do_versions */ if (data->rootbone < 0) { data->rootbone = 0; - + if (data->flag & CONSTRAINT_IK_TIP) parchan = pchan; else parchan = pchan->parent; - + while (parchan) { data->rootbone++; if ((parchan->bone->flag & BONE_CONNECTED) == 0) @@ -958,10 +958,10 @@ void BKE_pose_update_constraint_flags(bPose *pose) } else if (con->type == CONSTRAINT_TYPE_FOLLOWPATH) { bFollowPathConstraint *data = (bFollowPathConstraint *)con->data; - + /* for drawing constraint colors when color set allows this */ pchan->constflag |= PCHAN_HAS_CONST; - + /* if we have a valid target, make sure that this will get updated on frame-change * (needed for when there is no anim-data for this pose) */ @@ -970,7 +970,7 @@ void BKE_pose_update_constraint_flags(bPose *pose) } else if (con->type == CONSTRAINT_TYPE_SPLINEIK) pchan->constflag |= PCHAN_HAS_SPLINEIK; - else + else pchan->constflag |= PCHAN_HAS_CONST; } } @@ -982,7 +982,7 @@ void BKE_pose_tag_update_constraint_flags(bPose *pose) pose->flag |= POSE_CONSTRAINTS_NEED_UPDATE_FLAGS; } -/* Clears all BONE_UNKEYED flags for every pose channel in every pose +/* Clears all BONE_UNKEYED flags for every pose channel in every pose * This should only be called on frame changing, when it is acceptable to * do this. Otherwise, these flags should not get cleared as poses may get lost. */ @@ -991,14 +991,14 @@ void framechange_poses_clear_unkeyed(Main *bmain) Object *ob; bPose *pose; bPoseChannel *pchan; - + /* This needs to be done for each object that has a pose */ /* TODO: proxies may/may not be correctly handled here... (this needs checking) */ for (ob = bmain->object.first; ob; ob = ob->id.next) { /* we only need to do this on objects with a pose */ if ((pose = ob->pose)) { for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { - if (pchan->bone) + if (pchan->bone) pchan->bone->flag &= ~BONE_UNKEYED; } } @@ -1011,18 +1011,18 @@ void framechange_poses_clear_unkeyed(Main *bmain) bActionGroup *BKE_pose_add_group(bPose *pose, const char *name) { bActionGroup *grp; - + if (!name) { name = DATA_("Group"); } - + grp = MEM_callocN(sizeof(bActionGroup), "PoseGroup"); BLI_strncpy(grp->name, name, sizeof(grp->name)); BLI_addtail(&pose->agroups, grp); BLI_uniquename(&pose->agroups, grp, name, '.', offsetof(bActionGroup, name), sizeof(grp->name)); - + pose->active_group = BLI_listbase_count(&pose->agroups); - + return grp; } @@ -1032,13 +1032,13 @@ void BKE_pose_remove_group(bPose *pose, bActionGroup *grp, const int index) { bPoseChannel *pchan; int idx = index; - + if (idx < 1) { idx = BLI_findindex(&pose->agroups, grp) + 1; } - + BLI_assert(idx > 0); - + /* adjust group references (the trouble of using indices!): * - firstly, make sure nothing references it * - also, make sure that those after this item get corrected @@ -1068,7 +1068,7 @@ void BKE_pose_remove_group(bPose *pose, bActionGroup *grp, const int index) void BKE_pose_remove_group_index(bPose *pose, const int index) { bActionGroup *grp = NULL; - + /* get group to remove */ grp = BLI_findlink(&pose->agroups, index - 1); if (grp) { @@ -1082,7 +1082,7 @@ void BKE_pose_remove_group_index(bPose *pose, const int index) bool action_has_motion(const bAction *act) { FCurve *fcu; - + /* return on the first F-Curve that has some keyframes/samples defined */ if (act) { for (fcu = act->curves.first; fcu; fcu = fcu->next) { @@ -1090,7 +1090,7 @@ bool action_has_motion(const bAction *act) return true; } } - + /* nothing found */ return false; } @@ -1107,7 +1107,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_ /* if curve has keyframes, consider them first */ if (fcu->totvert) { float nmin, nmax; - + /* get extents for this curve * - no "selected only", since this is often used in the backend * - no "minimum length" (we will apply this later), otherwise @@ -1115,26 +1115,26 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_ * a phantom frame (T50354) */ calc_fcurve_range(fcu, &nmin, &nmax, false, false); - + /* compare to the running tally */ min = min_ff(min, nmin); max = max_ff(max, nmax); - + foundvert = 1; } - + /* if incl_modifiers is enabled, need to consider modifiers too * - only really care about the last modifier */ if ((incl_modifiers) && (fcu->modifiers.last)) { FModifier *fcm = fcu->modifiers.last; - + /* only use the maximum sensible limits of the modifiers if they are more extreme */ switch (fcm->type) { case FMODIFIER_TYPE_LIMITS: /* Limits F-Modifier */ { FMod_Limits *fmd = (FMod_Limits *)fcm->data; - + if (fmd->flag & FCM_LIMIT_XMIN) { min = min_ff(min, fmd->rect.xmin); } @@ -1146,7 +1146,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_ case FMODIFIER_TYPE_CYCLES: /* Cycles F-Modifier */ { FMod_Cycles *fmd = (FMod_Cycles *)fcm->data; - + if (fmd->before_mode != FCM_EXTRAPOLATE_NONE) min = MINAFRAMEF; if (fmd->after_mode != FCM_EXTRAPOLATE_NONE) @@ -1154,22 +1154,22 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_ break; } /* TODO: function modifier may need some special limits */ - + default: /* all other standard modifiers are on the infinite range... */ min = MINAFRAMEF; max = MAXFRAMEF; break; } - + foundmod = 1; } } } - + if (foundvert || foundmod) { /* ensure that action is at least 1 frame long (for NLA strips to have a valid length) */ if (min == max) max += 1.0f; - + *start = min; *end = max; } @@ -1179,7 +1179,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_ } } -/* Return flags indicating which transforms the given object/posechannel has +/* Return flags indicating which transforms the given object/posechannel has * - if 'curves' is provided, a list of links to these curves are also returned */ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan, ListBase *curves) @@ -1188,7 +1188,7 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan, FCurve *fcu; char *basePath = NULL; short flags = 0; - + /* build PointerRNA from provided data to obtain the paths to use */ if (pchan) RNA_pointer_create((ID *)ob, &RNA_PoseBone, pchan, &ptr); @@ -1196,37 +1196,37 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan, RNA_id_pointer_create((ID *)ob, &ptr); else return 0; - + /* get the basic path to the properties of interest */ basePath = RNA_path_from_ID_to_struct(&ptr); if (basePath == NULL) return 0; - - /* search F-Curves for the given properties + + /* search F-Curves for the given properties * - we cannot use the groups, since they may not be grouped in that way... */ for (fcu = act->curves.first; fcu; fcu = fcu->next) { const char *bPtr = NULL, *pPtr = NULL; - + /* if enough flags have been found, we can stop checking unless we're also getting the curves */ if ((flags == ACT_TRANS_ALL) && (curves == NULL)) break; - + /* just in case... */ if (fcu->rna_path == NULL) continue; - + /* step 1: check for matching base path */ bPtr = strstr(fcu->rna_path, basePath); - + if (bPtr) { - /* we must add len(basePath) bytes to the match so that we are at the end of the + /* we must add len(basePath) bytes to the match so that we are at the end of the * base path so that we don't get false positives with these strings in the names */ bPtr += strlen(basePath); - - /* step 2: check for some property with transforms - * - to speed things up, only check for the ones not yet found + + /* step 2: check for some property with transforms + * - to speed things up, only check for the ones not yet found * unless we're getting the curves too * - if we're getting the curves, the BLI_genericNodeN() creates a LinkData * node wrapping the F-Curve, which then gets added to the list @@ -1236,53 +1236,53 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan, pPtr = strstr(bPtr, "location"); if (pPtr) { flags |= ACT_TRANS_LOC; - - if (curves) + + if (curves) BLI_addtail(curves, BLI_genericNodeN(fcu)); continue; } } - + if ((curves) || (flags & ACT_TRANS_SCALE) == 0) { pPtr = strstr(bPtr, "scale"); if (pPtr) { flags |= ACT_TRANS_SCALE; - - if (curves) + + if (curves) BLI_addtail(curves, BLI_genericNodeN(fcu)); continue; } } - + if ((curves) || (flags & ACT_TRANS_ROT) == 0) { pPtr = strstr(bPtr, "rotation"); if (pPtr) { flags |= ACT_TRANS_ROT; - - if (curves) + + if (curves) BLI_addtail(curves, BLI_genericNodeN(fcu)); continue; } } - + if ((curves) || (flags & ACT_TRANS_BBONE) == 0) { /* bbone shape properties */ pPtr = strstr(bPtr, "bbone_"); if (pPtr) { flags |= ACT_TRANS_BBONE; - + if (curves) BLI_addtail(curves, BLI_genericNodeN(fcu)); continue; } } - + if ((curves) || (flags & ACT_TRANS_PROP) == 0) { /* custom properties only */ pPtr = strstr(bPtr, "[\""); /* extra '"' comment here to keep my texteditor functionlist working :) */ if (pPtr) { flags |= ACT_TRANS_PROP; - + if (curves) BLI_addtail(curves, BLI_genericNodeN(fcu)); continue; @@ -1290,10 +1290,10 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan, } } } - + /* free basePath */ MEM_freeN(basePath); - + /* return flags found */ return flags; } @@ -1304,26 +1304,26 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan, void BKE_pose_rest(bPose *pose) { bPoseChannel *pchan; - + if (!pose) return; - + memset(pose->stride_offset, 0, sizeof(pose->stride_offset)); memset(pose->cyclic_offset, 0, sizeof(pose->cyclic_offset)); - + for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { zero_v3(pchan->loc); zero_v3(pchan->eul); unit_qt(pchan->quat); unit_axis_angle(pchan->rotAxis, &pchan->rotAngle); pchan->size[0] = pchan->size[1] = pchan->size[2] = 1.0f; - + pchan->roll1 = pchan->roll2 = 0.0f; pchan->curveInX = pchan->curveInY = 0.0f; pchan->curveOutX = pchan->curveOutY = 0.0f; pchan->ease1 = pchan->ease2 = 0.0f; pchan->scaleIn = pchan->scaleOut = 1.0f; - + pchan->flag &= ~(POSE_LOC | POSE_ROT | POSE_SIZE | POSE_BBONE_SHAPE); } } @@ -1332,7 +1332,7 @@ void BKE_pose_rest(bPose *pose) bool BKE_pose_copy_result(bPose *to, bPose *from) { bPoseChannel *pchanto, *pchanfrom; - + if (to == NULL || from == NULL) { printf("Pose copy error, pose to:%p from:%p\n", (void *)to, (void *)from); /* debug temp */ return false; @@ -1349,16 +1349,16 @@ bool BKE_pose_copy_result(bPose *to, bPose *from) if (pchanto) { copy_m4_m4(pchanto->pose_mat, pchanfrom->pose_mat); copy_m4_m4(pchanto->chan_mat, pchanfrom->chan_mat); - + /* used for local constraints */ copy_v3_v3(pchanto->loc, pchanfrom->loc); copy_qt_qt(pchanto->quat, pchanfrom->quat); copy_v3_v3(pchanto->eul, pchanfrom->eul); copy_v3_v3(pchanto->size, pchanfrom->size); - + copy_v3_v3(pchanto->pose_head, pchanfrom->pose_head); copy_v3_v3(pchanto->pose_tail, pchanfrom->pose_tail); - + pchanto->roll1 = pchanfrom->roll1; pchanto->roll2 = pchanfrom->roll2; pchanto->curveInX = pchanfrom->curveInX; @@ -1369,7 +1369,7 @@ bool BKE_pose_copy_result(bPose *to, bPose *from) pchanto->ease2 = pchanfrom->ease2; pchanto->scaleIn = pchanfrom->scaleIn; pchanto->scaleOut = pchanfrom->scaleOut; - + pchanto->rotmode = pchanfrom->rotmode; pchanto->flag = pchanfrom->flag; pchanto->protectflag = pchanfrom->protectflag; @@ -1389,27 +1389,27 @@ void BKE_pose_tag_recalc(Main *bmain, bPose *pose) DEG_relations_tag_update(bmain); } -/* For the calculation of the effects of an Action at the given frame on an object +/* For the calculation of the effects of an Action at the given frame on an object * This is currently only used for the Action Constraint */ void what_does_obaction(Object *ob, Object *workob, bPose *pose, bAction *act, char groupname[], float cframe) { bActionGroup *agrp = BKE_action_group_find_name(act, groupname); - + /* clear workob */ BKE_object_workob_clear(workob); - + /* init workob */ copy_m4_m4(workob->obmat, ob->obmat); copy_m4_m4(workob->parentinv, ob->parentinv); copy_m4_m4(workob->constinv, ob->constinv); workob->parent = ob->parent; - + workob->rotmode = ob->rotmode; - + workob->trackflag = ob->trackflag; workob->upflag = ob->upflag; - + workob->partype = ob->partype; workob->par1 = ob->par1; workob->par2 = ob->par2; @@ -1417,7 +1417,7 @@ void what_does_obaction(Object *ob, Object *workob, bPose *pose, bAction *act, c workob->constraints.first = ob->constraints.first; workob->constraints.last = ob->constraints.last; - + workob->pose = pose; /* need to set pose too, since this is used for both types of Action Constraint */ if (pose) { /* This function is most likely to be used with a temporary pose with a single bone in there. @@ -1434,27 +1434,27 @@ void what_does_obaction(Object *ob, Object *workob, bPose *pose, bAction *act, c BLI_strncpy(workob->parsubstr, ob->parsubstr, sizeof(workob->parsubstr)); BLI_strncpy(workob->id.name, "OB<ConstrWorkOb>", sizeof(workob->id.name)); /* we don't use real object name, otherwise RNA screws with the real thing */ - + /* if we're given a group to use, it's likely to be more efficient (though a bit more dangerous) */ if (agrp) { /* specifically evaluate this group only */ PointerRNA id_ptr; - + /* get RNA-pointer for the workob's ID */ RNA_id_pointer_create(&workob->id, &id_ptr); - + /* execute action for this group only */ animsys_evaluate_action_group(&id_ptr, act, agrp, NULL, cframe); } else { AnimData adt = {NULL}; - + /* init animdata, and attach to workob */ workob->adt = &adt; - + adt.recalc = ADT_RECALC_ANIM; adt.action = act; - + /* execute effects of Action on to workob (or it's PoseChannels) */ BKE_animsys_evaluate_animdata(NULL, NULL, &workob->id, &adt, cframe, ADT_RECALC_ANIM); } diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index e2cecb32a36..07b8b69bc70 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -104,12 +104,12 @@ void animviz_settings_init(bAnimVizSettings *avs) /* ------------------- */ /* Free the given motion path's cache */ -void animviz_free_motionpath_cache(bMotionPath *mpath) +void animviz_free_motionpath_cache(bMotionPath *mpath) { /* sanity check */ - if (mpath == NULL) + if (mpath == NULL) return; - + /* free the path if necessary */ if (mpath->points) MEM_freeN(mpath->points); @@ -117,13 +117,13 @@ void animviz_free_motionpath_cache(bMotionPath *mpath) GWN_VERTBUF_DISCARD_SAFE(mpath->points_vbo); GWN_BATCH_DISCARD_SAFE(mpath->batch_line); GWN_BATCH_DISCARD_SAFE(mpath->batch_points); - + /* reset the relevant parameters */ mpath->points = NULL; mpath->length = 0; } -/* Free the given motion path instance and its data +/* Free the given motion path instance and its data * NOTE: this frees the motion path given! */ void animviz_free_motionpath(bMotionPath *mpath) @@ -131,10 +131,10 @@ void animviz_free_motionpath(bMotionPath *mpath) /* sanity check */ if (mpath == NULL) return; - + /* free the cache first */ animviz_free_motionpath_cache(mpath); - + /* now the instance itself */ MEM_freeN(mpath); } @@ -174,11 +174,11 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Objec { bAnimVizSettings *avs; bMotionPath *mpath, **dst; - + /* sanity checks */ if (ELEM(NULL, scene, ob)) return NULL; - + /* get destination data */ if (pchan) { /* paths for posechannel - assume that posechannel belongs to the object */ @@ -206,9 +206,9 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Objec */ if (*dst != NULL) { int expected_length = avs->path_ef - avs->path_sf; - + mpath = *dst; - + /* path is "valid" if length is valid, but must also be of the same length as is being requested */ if ((mpath->start_frame != mpath->end_frame) && (mpath->length > 0)) { /* outer check ensures that we have some curve data for this path */ @@ -227,13 +227,13 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Objec mpath = MEM_callocN(sizeof(bMotionPath), "bMotionPath"); *dst = mpath; } - + /* set settings from the viz settings */ mpath->start_frame = avs->path_sf; mpath->end_frame = avs->path_ef; - + mpath->length = mpath->end_frame - mpath->start_frame; - + if (avs->path_bakeflag & MOTIONPATH_BAKE_HEADS) mpath->flag |= MOTIONPATH_FLAG_BHEAD; else @@ -249,10 +249,10 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Objec /* allocate a cache */ mpath->points = MEM_callocN(sizeof(bMotionPathVert) * mpath->length, "bMotionPathVerts"); - + /* tag viz settings as currently having some path(s) which use it */ avs->path_bakeflag |= MOTIONPATH_BAKE_HAS_PATHS; - + /* return it */ return mpath; } @@ -262,15 +262,15 @@ bMotionPath *animviz_verify_motionpaths(ReportList *reports, Scene *scene, Objec /* Motion path needing to be baked (mpt) */ typedef struct MPathTarget { struct MPathTarget *next, *prev; - + bMotionPath *mpath; /* motion path in question */ DLRBT_Tree keys; /* temp, to know where the keyframes are */ - + /* Original (Source Objects) */ Object *ob; /* source object */ bPoseChannel *pchan; /* source posechannel (if applicable) */ - + /* "Evaluated" Copies (these come from the background COW copie * that provide all the coordinates we want to save off) */ @@ -286,28 +286,28 @@ typedef struct MPathTarget { void animviz_get_object_motionpaths(Object *ob, ListBase *targets) { MPathTarget *mpt; - + /* object itself first */ if ((ob->avs.recalc & ANIMVIZ_RECALC_PATHS) && (ob->mpath)) { /* new target for object */ mpt = MEM_callocN(sizeof(MPathTarget), "MPathTarget Ob"); BLI_addtail(targets, mpt); - + mpt->mpath = ob->mpath; mpt->ob = ob; } - + /* bones */ if ((ob->pose) && (ob->pose->avs.recalc & ANIMVIZ_RECALC_PATHS)) { bArmature *arm = ob->data; bPoseChannel *pchan; - + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { if ((pchan->bone) && (arm->layer & pchan->bone->layer) && (pchan->mpath)) { /* new target for bone */ mpt = MEM_callocN(sizeof(MPathTarget), "MPathTarget PoseBone"); BLI_addtail(targets, mpt); - + mpt->mpath = pchan->mpath; mpt->ob = ob; mpt->pchan = pchan; @@ -341,22 +341,22 @@ static void motionpaths_calc_update_scene(Main *bmain, static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets) { MPathTarget *mpt; - + /* for each target, check if it can be baked on the current frame */ for (mpt = targets->first; mpt; mpt = mpt->next) { bMotionPath *mpath = mpt->mpath; bMotionPathVert *mpv; - - /* current frame must be within the range the cache works for + + /* current frame must be within the range the cache works for * - is inclusive of the first frame, but not the last otherwise we get buffer overruns */ if ((CFRA < mpath->start_frame) || (CFRA >= mpath->end_frame)) { continue; } - + /* get the relevant cache vert to write to */ mpv = mpath->points + (CFRA - mpath->start_frame); - + Object *ob_eval = mpt->ob_eval; /* Lookup evaluated pose channel, here because the depsgraph @@ -375,7 +375,7 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets) else { copy_v3_v3(mpv->co, pchan_eval->pose_tail); } - + /* result must be in worldspace */ mul_m4_v3(ob_eval->obmat, mpv->co); } @@ -393,7 +393,7 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets) } } -/* Perform baking of the given object's and/or its bones' transforms to motion paths +/* Perform baking of the given object's and/or its bones' transforms to motion paths * - scene: current scene * - ob: object whose flagged motionpaths should get calculated * - recalc: whether we need to @@ -404,15 +404,15 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets) MPathTarget *mpt; int sfra, efra; int cfra; - + /* sanity check */ if (ELEM(NULL, targets, targets->first)) return; - + /* set frame values */ cfra = CFRA; sfra = efra = cfra; - + /* TODO: this method could be improved... * 1) max range for standard baking * 2) minimum range for recalc baking (i.e. between keyframes, but how?) */ @@ -422,8 +422,8 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets) efra = MAX2(efra, mpt->mpath->end_frame); } if (efra <= sfra) return; - - + + /* get copies of objects/bones to get the calculated results from * (for copy-on-write evaluation), so that we actually get some results */ @@ -471,23 +471,23 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets) /* perform baking for targets */ motionpaths_calc_bake_targets(scene, targets); } - + /* reset original environment */ // XXX: Soon to be obsolete CFRA = cfra; motionpaths_calc_update_scene(bmain, depsgraph); - + /* clear recalc flags from targets */ for (mpt = targets->first; mpt; mpt = mpt->next) { bAnimVizSettings *avs; bMotionPath *mpath = mpt->mpath; - + /* get pointer to animviz settings for each target */ if (mpt->pchan) avs = &mpt->ob->pose->avs; else avs = &mpt->ob->avs; - + /* clear the flag requesting recalculation of targets */ avs->recalc &= ~ANIMVIZ_RECALC_PATHS; @@ -504,7 +504,7 @@ static void motionpaths_calc_bake_targets(Scene *scene, ListBase *targets) /* ******************************************************************** */ /* Curve Paths - for curve deforms and/or curve following */ -/* free curve path data +/* free curve path data * NOTE: frees the path itself! * NOTE: this is increasingly inaccurate with non-uniform BevPoint subdivisions [#24633] */ @@ -514,7 +514,7 @@ void free_path(Path *path) MEM_freeN(path); } -/* calculate a curve-deform path for a curve +/* calculate a curve-deform path for a curve * - only called from displist.c -> do_makeDispListCurveTypes */ void calc_curvepath(Object *ob, ListBase *nurbs) @@ -527,17 +527,17 @@ void calc_curvepath(Object *ob, ListBase *nurbs) float *fp, *dist, *maxdist, xyz[3]; float fac, d = 0, fac1, fac2; int a, tot, cycl = 0; - + /* in a path vertices are with equal differences: path->len = number of verts */ /* NOW WITH BEVELCURVE!!! */ - + if (ob == NULL || ob->type != OB_CURVE) { return; } if (ob->curve_cache->path) free_path(ob->curve_cache->path); ob->curve_cache->path = NULL; - + /* weak! can only use first curve */ bl = ob->curve_cache->bev.first; if (bl == NULL || !bl->nr) { @@ -547,18 +547,18 @@ void calc_curvepath(Object *ob, ListBase *nurbs) nu = nurbs->first; ob->curve_cache->path = path = MEM_callocN(sizeof(Path), "calc_curvepath"); - + /* if POLY: last vertice != first vertice */ cycl = (bl->poly != -1); - + tot = cycl ? bl->nr : bl->nr - 1; - + path->len = tot + 1; /* exception: vector handle paths and polygon paths should be subdivided at least a factor resolu */ if (path->len < nu->resolu * SEGMENTSU(nu)) { path->len = nu->resolu * SEGMENTSU(nu); } - + dist = (float *)MEM_mallocN(sizeof(float) * (tot + 1), "calcpathdist"); /* all lengths in *dist */ @@ -571,13 +571,13 @@ void calc_curvepath(Object *ob, ListBase *nurbs) sub_v3_v3v3(xyz, bevpfirst->vec, bevp->vec); else sub_v3_v3v3(xyz, (bevp + 1)->vec, bevp->vec); - + *fp = *(fp - 1) + len_v3(xyz); bevp++; } - + path->totdist = *fp; - + /* the path verts in path->data */ /* now also with TILT value */ pp = path->data = (PathPoint *)MEM_callocN(sizeof(PathPoint) * path->len, "pathdata"); @@ -592,11 +592,11 @@ void calc_curvepath(Object *ob, ListBase *nurbs) maxdist = dist + tot; fac = 1.0f / ((float)path->len - 1.0f); fac = fac * path->totdist; - + for (a = 0; a < path->len; a++) { - + d = ((float)a) * fac; - + /* we're looking for location (distance) 'd' in the array */ if (LIKELY(tot > 0)) { while ((fp < maxdist) && (d >= *fp)) { @@ -622,10 +622,10 @@ void calc_curvepath(Object *ob, ListBase *nurbs) pp->weight = fac1 * bevp->weight + fac2 * bevpn->weight; interp_qt_qtqt(pp->quat, bevp->quat, bevpn->quat, fac2); normalize_qt(pp->quat); - + pp++; } - + MEM_freeN(dist); } @@ -669,7 +669,7 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua } path = ob->curve_cache->path; pp = path->data; - + /* test for cyclic */ bl = ob->curve_cache->bev.first; if (!bl) return 0; @@ -680,7 +680,7 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua BLI_assert(cycl || ctime >= 0.0f); ctime *= (path->len - 1); - + s1 = (int)floor(ctime); fac = (float)(s1 + 1) - ctime; diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index ec979623a98..fd7497f9ba1 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -105,7 +105,7 @@ bool id_type_can_have_animdata(const short id_type) case ID_GD: case ID_CF: return true; - + /* no AnimData */ default: return false; @@ -121,13 +121,13 @@ bool id_can_have_animdata(const ID *id) return id_type_can_have_animdata(GS(id->name)); } -/* Get AnimData from the given ID-block. In order for this to work, we assume that +/* Get AnimData from the given ID-block. In order for this to work, we assume that * the AnimData pointer is stored immediately after the given ID-block in the struct, * as per IdAdtTemplate. */ AnimData *BKE_animdata_from_id(ID *id) { - /* only some ID-blocks have this info for now, so we cast the + /* only some ID-blocks have this info for now, so we cast the * types that do to be of type IdAdtTemplate, and extract the * AnimData that way */ @@ -139,33 +139,33 @@ AnimData *BKE_animdata_from_id(ID *id) return NULL; } -/* Add AnimData to the given ID-block. In order for this to work, we assume that +/* Add AnimData to the given ID-block. In order for this to work, we assume that * the AnimData pointer is stored immediately after the given ID-block in the struct, * as per IdAdtTemplate. Also note that */ AnimData *BKE_animdata_add_id(ID *id) { - /* Only some ID-blocks have this info for now, so we cast the + /* Only some ID-blocks have this info for now, so we cast the * types that do to be of type IdAdtTemplate, and add the AnimData * to it using the template */ if (id_can_have_animdata(id)) { IdAdtTemplate *iat = (IdAdtTemplate *)id; - + /* check if there's already AnimData, in which case, don't add */ if (iat->adt == NULL) { AnimData *adt; - + /* add animdata */ adt = iat->adt = MEM_callocN(sizeof(AnimData), "AnimData"); - + /* set default settings */ adt->act_influence = 1.0f; } - + return iat->adt; } - else + else return NULL; } @@ -176,14 +176,14 @@ bool BKE_animdata_set_action(ReportList *reports, ID *id, bAction *act) { AnimData *adt = BKE_animdata_from_id(id); bool ok = false; - + /* animdata validity check */ if (adt == NULL) { BKE_report(reports, RPT_WARNING, "No AnimData to set action on"); return ok; } - - /* active action is only editable when it is not a tweaking strip + + /* active action is only editable when it is not a tweaking strip * see rna_AnimData_action_editable() in rna_animation.c */ if ((adt->flag & ADT_NLA_EDIT_ON) || (adt->actstrip) || (adt->tmpact)) { @@ -191,11 +191,11 @@ bool BKE_animdata_set_action(ReportList *reports, ID *id, bAction *act) BKE_report(reports, RPT_ERROR, "Cannot change action, as it is still being edited in NLA"); return ok; } - + /* manage usercount for current action */ if (adt->action) id_us_min((ID *)adt->action); - + /* assume that AnimData's action can in fact be edited... */ if (act) { /* action must have same type as owner */ @@ -218,7 +218,7 @@ bool BKE_animdata_set_action(ReportList *reports, ID *id, bAction *act) adt->action = NULL; ok = true; } - + return ok; } @@ -227,13 +227,13 @@ bool BKE_animdata_set_action(ReportList *reports, ID *id, bAction *act) /* Free AnimData used by the nominated ID-block, and clear ID-block's AnimData pointer */ void BKE_animdata_free(ID *id, const bool do_id_user) { - /* Only some ID-blocks have this info for now, so we cast the + /* Only some ID-blocks have this info for now, so we cast the * types that do to be of type IdAdtTemplate */ if (id_can_have_animdata(id)) { IdAdtTemplate *iat = (IdAdtTemplate *)id; AnimData *adt = iat->adt; - + /* check if there's any AnimData to start with */ if (adt) { if (do_id_user) { @@ -244,19 +244,19 @@ void BKE_animdata_free(ID *id, const bool do_id_user) if (adt->tmpact) id_us_min(&adt->tmpact->id); } - + /* free nla data */ BKE_nla_tracks_free(&adt->nla_tracks); - + /* free drivers - stored as a list of F-Curves */ free_fcurves(&adt->drivers); /* free driver array cache */ MEM_SAFE_FREE(adt->driver_array); - + /* free overrides */ /* TODO... */ - + /* free animdata now */ MEM_freeN(adt); iat->adt = NULL; @@ -270,12 +270,12 @@ void BKE_animdata_free(ID *id, const bool do_id_user) AnimData *BKE_animdata_copy(Main *bmain, AnimData *adt, const bool do_action, const bool do_id_user) { AnimData *dadt; - + /* sanity check before duplicating struct */ if (adt == NULL) return NULL; dadt = MEM_dupallocN(adt); - + /* make a copy of action - at worst, user has to delete copies... */ if (do_action) { BLI_assert(bmain != NULL); @@ -289,14 +289,14 @@ AnimData *BKE_animdata_copy(Main *bmain, AnimData *adt, const bool do_action, co /* duplicate NLA data */ BKE_nla_tracks_copy(bmain, &dadt->nla_tracks, &adt->nla_tracks); - + /* duplicate drivers (F-Curves) */ copy_fcurves(&dadt->drivers, &adt->drivers); dadt->driver_array = NULL; - + /* don't copy overrides */ BLI_listbase_clear(&dadt->overrides); - + /* return */ return dadt; } @@ -343,17 +343,17 @@ void BKE_animdata_merge_copy( { AnimData *src = BKE_animdata_from_id(src_id); AnimData *dst = BKE_animdata_from_id(dst_id); - + /* sanity checks */ if (ELEM(NULL, dst, src)) return; - + // TODO: we must unset all "tweakmode" flags if ((src->flag & ADT_NLA_EDIT_ON) || (dst->flag & ADT_NLA_EDIT_ON)) { printf("ERROR: Merging AnimData blocks while editing NLA is dangerous as it may cause data corruption\n"); return; } - + /* handle actions... */ if (action_mode == ADT_MERGECOPY_SRC_COPY) { /* make a copy of the actions */ @@ -364,35 +364,35 @@ void BKE_animdata_merge_copy( /* make a reference to it */ dst->action = src->action; id_us_plus((ID *)dst->action); - + dst->tmpact = src->tmpact; id_us_plus((ID *)dst->tmpact); } - + /* duplicate NLA data */ if (src->nla_tracks.first) { ListBase tracks = {NULL, NULL}; - + BKE_nla_tracks_copy(bmain, &tracks, &src->nla_tracks); BLI_movelisttolist(&dst->nla_tracks, &tracks); } - + /* duplicate drivers (F-Curves) */ if (src->drivers.first) { ListBase drivers = {NULL, NULL}; - + copy_fcurves(&drivers, &src->drivers); - + /* Fix up all driver targets using the old target id * - This assumes that the src ID is being merged into the dst ID */ if (fix_drivers) { FCurve *fcu; - + for (fcu = drivers.first; fcu; fcu = fcu->next) { ChannelDriver *driver = fcu->driver; DriverVar *dvar; - + for (dvar = driver->variables.first; dvar; dvar = dvar->next) { DRIVER_TARGETS_USED_LOOPER(dvar) { @@ -404,7 +404,7 @@ void BKE_animdata_merge_copy( } } } - + BLI_movelisttolist(&dst->drivers, &drivers); } } @@ -424,7 +424,7 @@ static bool animpath_matches_basepath(const char path[], const char basepath[]) return (path && basepath) && STRPREFIX(path, basepath); } -/* Move F-Curves in src action to dst action, setting up all the necessary groups +/* Move F-Curves in src action to dst action, setting up all the necessary groups * for this to happen, but only if the F-Curves being moved have the appropriate * "base path". * - This is used when data moves from one datablock to another, causing the @@ -433,7 +433,7 @@ static bool animpath_matches_basepath(const char path[], const char basepath[]) void action_move_fcurves_by_basepath(bAction *srcAct, bAction *dstAct, const char basepath[]) { FCurve *fcu, *fcn = NULL; - + /* sanity checks */ if (ELEM(NULL, srcAct, dstAct, basepath)) { if (G.debug & G_DEBUG) { @@ -442,56 +442,56 @@ void action_move_fcurves_by_basepath(bAction *srcAct, bAction *dstAct, const cha } return; } - - /* clear 'temp' flags on all groups in src, as we'll be needing them later + + /* clear 'temp' flags on all groups in src, as we'll be needing them later * to identify groups that we've managed to empty out here */ action_groups_clear_tempflags(srcAct); - + /* iterate over all src F-Curves, moving over the ones that need to be moved */ for (fcu = srcAct->curves.first; fcu; fcu = fcn) { /* store next pointer in case we move stuff */ fcn = fcu->next; - + /* should F-Curve be moved over? * - we only need the start of the path to match basepath */ if (animpath_matches_basepath(fcu->rna_path, basepath)) { bActionGroup *agrp = NULL; - + /* if grouped... */ if (fcu->grp) { /* make sure there will be a matching group on the other side for the migrants */ agrp = BKE_action_group_find_name(dstAct, fcu->grp->name); - + if (agrp == NULL) { /* add a new one with a similar name (usually will be the same though) */ agrp = action_groups_add_new(dstAct, fcu->grp->name); } - + /* old groups should be tagged with 'temp' flags so they can be removed later * if we remove everything from them */ fcu->grp->flag |= AGRP_TEMP; } - + /* perform the migration now */ action_groups_remove_channel(srcAct, fcu); - + if (agrp) action_groups_add_channel(dstAct, agrp, fcu); else BLI_addtail(&dstAct->curves, fcu); } } - + /* cleanup groups (if present) */ if (srcAct->groups.first) { bActionGroup *agrp, *grp = NULL; - + for (agrp = srcAct->groups.first; agrp; agrp = grp) { grp = agrp->next; - + /* only tagged groups need to be considered - clearing these tags or removing them */ if (agrp->flag & AGRP_TEMP) { /* if group is empty and tagged, then we can remove as this operation @@ -515,24 +515,24 @@ void BKE_animdata_separate_by_basepath( { AnimData *srcAdt = NULL, *dstAdt = NULL; LinkData *ld; - + /* sanity checks */ if (ELEM(NULL, srcID, dstID)) { if (G.debug & G_DEBUG) printf("ERROR: no source or destination ID to separate AnimData with\n"); return; } - + /* get animdata from src, and create for destination (if needed) */ srcAdt = BKE_animdata_from_id(srcID); dstAdt = BKE_animdata_add_id(dstID); - + if (ELEM(NULL, srcAdt, dstAdt)) { if (G.debug & G_DEBUG) printf("ERROR: no AnimData for this pair of ID's\n"); return; } - + /* active action */ if (srcAdt->action) { /* set up an action if necessary, and name it in a similar way so that it can be easily found again */ @@ -542,38 +542,38 @@ void BKE_animdata_separate_by_basepath( else if (dstAdt->action == srcAdt->action) { printf("Argh! Source and Destination share animation! ('%s' and '%s' both use '%s') Making new empty action\n", srcID->name, dstID->name, srcAdt->action->id.name); - + /* TODO: review this... */ id_us_min(&dstAdt->action->id); dstAdt->action = BKE_action_add(bmain, dstAdt->action->id.name + 2); } - + /* loop over base paths, trying to fix for each one... */ for (ld = basepaths->first; ld; ld = ld->next) { const char *basepath = (const char *)ld->data; action_move_fcurves_by_basepath(srcAdt->action, dstAdt->action, basepath); } } - + /* drivers */ if (srcAdt->drivers.first) { FCurve *fcu, *fcn = NULL; - + /* check each driver against all the base paths to see if any should go */ for (fcu = srcAdt->drivers.first; fcu; fcu = fcn) { fcn = fcu->next; - + /* try each basepath in turn, but stop on the first one which works */ for (ld = basepaths->first; ld; ld = ld->next) { const char *basepath = (const char *)ld->data; - + if (animpath_matches_basepath(fcu->rna_path, basepath)) { /* just need to change lists */ BLI_remlink(&srcAdt->drivers, fcu); BLI_addtail(&dstAdt->drivers, fcu); - + /* TODO: add depsgraph flushing calls? */ - + /* can stop now, as moved already */ break; } @@ -631,15 +631,15 @@ static bool check_rna_path_is_valid(ID *owner_id, const char *path) { PointerRNA id_ptr, ptr; PropertyRNA *prop = NULL; - + /* make initial RNA pointer to start resolving from */ RNA_id_pointer_create(owner_id, &id_ptr); - + /* try to resolve */ - return RNA_path_resolve_property(&id_ptr, path, &ptr, &prop); + return RNA_path_resolve_property(&id_ptr, path, &ptr, &prop); } -/* Check if some given RNA Path needs fixing - free the given path and set a new one as appropriate +/* Check if some given RNA Path needs fixing - free the given path and set a new one as appropriate * NOTE: we assume that oldName and newName have [" "] padding around them */ static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName, char *oldpath, bool verify_paths) @@ -648,7 +648,7 @@ static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *o char *oldNamePtr = strstr(oldpath, oldName); int prefixLen = strlen(prefix); int oldNameLen = strlen(oldName); - + /* only start fixing the path if the prefix and oldName feature in the path, * and prefix occurs immediately before oldName */ @@ -663,20 +663,20 @@ static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *o if (prefixPtr > oldpath) { BLI_dynstr_nappend(ds, oldpath, prefixPtr - oldpath); } - + /* add the prefix */ BLI_dynstr_append(ds, prefix); - + /* add the new name (complete with brackets) */ BLI_dynstr_append(ds, newName); - + /* add the postfix */ BLI_dynstr_append(ds, postfixPtr); - + /* create new path, and cleanup old data */ newPath = BLI_dynstr_get_cstring(ds); BLI_dynstr_free(ds); - + /* check if the new path will solve our problems */ /* TODO: will need to check whether this step really helps in practice */ if (!verify_paths || check_rna_path_is_valid(owner_id, newPath)) { @@ -690,31 +690,31 @@ static char *rna_path_rename_fix(ID *owner_id, const char *prefix, const char *o } } } - + /* the old path doesn't need to be changed */ return oldpath; } /* Check RNA-Paths for a list of F-Curves */ -static void fcurves_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName, +static void fcurves_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName, const char *oldKey, const char *newKey, ListBase *curves, bool verify_paths) { FCurve *fcu; - + /* we need to check every curve... */ for (fcu = curves->first; fcu; fcu = fcu->next) { if (fcu->rna_path) { const char *old_path = fcu->rna_path; - + /* firstly, handle the F-Curve's own path */ fcu->rna_path = rna_path_rename_fix(owner_id, prefix, oldKey, newKey, fcu->rna_path, verify_paths); - + /* if path changed and the F-Curve is grouped, check if its group also needs renaming * (i.e. F-Curve is first of a bone's F-Curves; hence renaming this should also trigger rename) */ if (fcu->rna_path != old_path) { bActionGroup *agrp = fcu->grp; - + if ((agrp) && STREQ(oldName, agrp->name)) { BLI_strncpy(agrp->name, newName, sizeof(agrp->name)); } @@ -728,27 +728,27 @@ static void drivers_path_rename_fix(ID *owner_id, ID *ref_id, const char *prefix const char *oldKey, const char *newKey, ListBase *curves, bool verify_paths) { FCurve *fcu; - + /* we need to check every curve - drivers are F-Curves too! */ for (fcu = curves->first; fcu; fcu = fcu->next) { /* firstly, handle the F-Curve's own path */ if (fcu->rna_path) fcu->rna_path = rna_path_rename_fix(owner_id, prefix, oldKey, newKey, fcu->rna_path, verify_paths); - + /* driver? */ if (fcu->driver) { ChannelDriver *driver = fcu->driver; DriverVar *dvar; - + /* driver variables */ for (dvar = driver->variables.first; dvar; dvar = dvar->next) { /* only change the used targets, since the others will need fixing manually anyway */ - DRIVER_TARGETS_USED_LOOPER(dvar) + DRIVER_TARGETS_USED_LOOPER(dvar) { /* rename RNA path */ if (dtar->rna_path && dtar->id) dtar->rna_path = rna_path_rename_fix(dtar->id, prefix, oldKey, newKey, dtar->rna_path, verify_paths); - + /* also fix the bone-name (if applicable) */ if (strstr(prefix, "bones")) { if ( ((dtar->id) && (GS(dtar->id->name) == ID_OB) && (!ref_id || ((Object *)(dtar->id))->data == ref_id)) && @@ -765,18 +765,18 @@ static void drivers_path_rename_fix(ID *owner_id, ID *ref_id, const char *prefix } /* Fix all RNA-Paths for Actions linked to NLA Strips */ -static void nlastrips_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName, +static void nlastrips_path_rename_fix(ID *owner_id, const char *prefix, const char *oldName, const char *newName, const char *oldKey, const char *newKey, ListBase *strips, bool verify_paths) { NlaStrip *strip; - + /* recursively check strips, fixing only actions... */ for (strip = strips->first; strip; strip = strip->next) { /* fix strip's action */ if (strip->act) fcurves_path_rename_fix(owner_id, prefix, oldName, newName, oldKey, newKey, &strip->act->curves, verify_paths); /* ignore own F-Curves, since those are local... */ - + /* check sub-strips (if metas) */ nlastrips_path_rename_fix(owner_id, prefix, oldName, newName, oldKey, newKey, &strip->strips, verify_paths); } @@ -797,13 +797,13 @@ char *BKE_animsys_fix_rna_path_rename(ID *owner_id, char *old_path, const char * { char *oldN, *newN; char *result; - + /* if no action, no need to proceed */ if (ELEM(NULL, owner_id, old_path)) { if (G.debug & G_DEBUG) printf("%s: early abort\n", __func__); return old_path; } - + /* Name sanitation logic - copied from BKE_animdata_fix_paths_rename() */ if ((oldName != NULL) && (newName != NULL)) { /* pad the names with [" "] so that only exact matches are made */ @@ -821,21 +821,21 @@ char *BKE_animsys_fix_rna_path_rename(ID *owner_id, char *old_path, const char * oldN = BLI_sprintfN("[%d]", oldSubscript); newN = BLI_sprintfN("[%d]", newSubscript); } - + /* fix given path */ if (G.debug & G_DEBUG) printf("%s | %s | oldpath = %p ", oldN, newN, old_path); result = rna_path_rename_fix(owner_id, prefix, oldN, newN, old_path, verify_paths); if (G.debug & G_DEBUG) printf("path rename result = %p\n", result); - + /* free the temp names */ MEM_freeN(oldN); MEM_freeN(newN); - + /* return the resulting path - may be the same path again if nothing changed */ return result; } -/* Fix all RNA_Paths in the given Action, relative to the given ID block +/* Fix all RNA_Paths in the given Action, relative to the given ID block * * This is just an external wrapper for the F-Curve fixing function, * with input validity checks on top of the basic method. @@ -847,11 +847,11 @@ void BKE_action_fix_paths_rename(ID *owner_id, bAction *act, const char *prefix, const char *newName, int oldSubscript, int newSubscript, bool verify_paths) { char *oldN, *newN; - + /* if no action, no need to proceed */ if (ELEM(NULL, owner_id, act)) return; - + /* Name sanitation logic - copied from BKE_animdata_fix_paths_rename() */ if ((oldName != NULL) && (newName != NULL)) { /* pad the names with [" "] so that only exact matches are made */ @@ -869,10 +869,10 @@ void BKE_action_fix_paths_rename(ID *owner_id, bAction *act, const char *prefix, oldN = BLI_sprintfN("[%d]", oldSubscript); newN = BLI_sprintfN("[%d]", newSubscript); } - + /* fix paths in action */ fcurves_path_rename_fix(owner_id, prefix, oldName, newName, oldN, newN, &act->curves, verify_paths); - + /* free the temp names */ MEM_freeN(oldN); MEM_freeN(newN); @@ -887,11 +887,11 @@ void BKE_animdata_fix_paths_rename(ID *owner_id, AnimData *adt, ID *ref_id, cons { NlaTrack *nlt; char *oldN, *newN; - + /* if no AnimData, no need to proceed */ if (ELEM(NULL, owner_id, adt)) return; - + /* Name sanitation logic - shared with BKE_action_fix_paths_rename() */ if ((oldName != NULL) && (newName != NULL)) { /* pad the names with [" "] so that only exact matches are made */ @@ -909,16 +909,16 @@ void BKE_animdata_fix_paths_rename(ID *owner_id, AnimData *adt, ID *ref_id, cons oldN = BLI_sprintfN("[%d]", oldSubscript); newN = BLI_sprintfN("[%d]", newSubscript); } - + /* Active action and temp action */ if (adt->action) fcurves_path_rename_fix(owner_id, prefix, oldName, newName, oldN, newN, &adt->action->curves, verify_paths); if (adt->tmpact) fcurves_path_rename_fix(owner_id, prefix, oldName, newName, oldN, newN, &adt->tmpact->curves, verify_paths); - + /* Drivers - Drivers are really F-Curves */ drivers_path_rename_fix(owner_id, ref_id, prefix, oldName, newName, oldN, newN, &adt->drivers, verify_paths); - + /* NLA Data - Animation Data for Strips */ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) nlastrips_path_rename_fix(owner_id, prefix, oldName, newName, oldN, newN, &nlt->strips, verify_paths); @@ -1008,7 +1008,7 @@ typedef struct AllFCurvesCbWrapper { static void fcurves_apply_cb(ID *id, ListBase *fcurves, ID_FCurve_Edit_Callback func, void *user_data) { FCurve *fcu; - + for (fcu = fcurves->first; fcu; fcu = fcu->next) { func(id, fcu, user_data); } @@ -1018,13 +1018,13 @@ static void fcurves_apply_cb(ID *id, ListBase *fcurves, ID_FCurve_Edit_Callback static void nlastrips_apply_all_curves_cb(ID *id, ListBase *strips, AllFCurvesCbWrapper *wrapper) { NlaStrip *strip; - + for (strip = strips->first; strip; strip = strip->next) { /* fix strip's action */ if (strip->act) { fcurves_apply_cb(id, &strip->act->curves, wrapper->func, wrapper->user_data); } - + /* check sub-strips (if metas) */ nlastrips_apply_all_curves_cb(id, &strip->strips, wrapper); } @@ -1035,18 +1035,18 @@ static void adt_apply_all_fcurves_cb(ID *id, AnimData *adt, void *wrapper_data) { AllFCurvesCbWrapper *wrapper = wrapper_data; NlaTrack *nlt; - + if (adt->action) { fcurves_apply_cb(id, &adt->action->curves, wrapper->func, wrapper->user_data); } - + if (adt->tmpact) { fcurves_apply_cb(id, &adt->tmpact->curves, wrapper->func, wrapper->user_data); } - + /* free drivers - stored as a list of F-Curves */ fcurves_apply_cb(id, &adt->drivers, wrapper->func, wrapper->user_data); - + /* NLA Data - Animation Data for Strips */ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) { nlastrips_apply_all_curves_cb(id, &nlt->strips, wrapper); @@ -1058,7 +1058,7 @@ void BKE_fcurves_main_cb(Main *bmain, ID_FCurve_Edit_Callback func, void *user_d { /* Wrap F-Curve operation stuff to pass to the general AnimData-level func */ AllFCurvesCbWrapper wrapper = {func, user_data}; - + /* Use the AnimData-based function so that we don't have to reimplement all that stuff */ BKE_animdata_main_cb(bmain, adt_apply_all_fcurves_cb, &wrapper); } @@ -1077,7 +1077,7 @@ void BKE_animdata_main_cb(Main *bmain, ID_AnimData_Edit_Callback func, void *use AnimData *adt = BKE_animdata_from_id(id); \ if (adt) func(id, adt, user_data); \ } (void)0 - + /* "embedded" nodetree cases (i.e. scene/material/texture->nodetree) */ #define ANIMDATA_NODETREE_IDS_CB(first, NtId_Type) \ for (id = first; id; id = id->next) { \ @@ -1089,40 +1089,40 @@ void BKE_animdata_main_cb(Main *bmain, ID_AnimData_Edit_Callback func, void *use } \ if (adt) func(id, adt, user_data); \ } (void)0 - + /* nodes */ ANIMDATA_IDS_CB(bmain->nodetree.first); - + /* textures */ ANIMDATA_NODETREE_IDS_CB(bmain->tex.first, Tex); - + /* lamps */ ANIMDATA_NODETREE_IDS_CB(bmain->lamp.first, Lamp); - + /* materials */ ANIMDATA_NODETREE_IDS_CB(bmain->mat.first, Material); - + /* cameras */ ANIMDATA_IDS_CB(bmain->camera.first); - + /* shapekeys */ ANIMDATA_IDS_CB(bmain->key.first); - + /* metaballs */ ANIMDATA_IDS_CB(bmain->mball.first); - + /* curves */ ANIMDATA_IDS_CB(bmain->curve.first); - + /* armatures */ ANIMDATA_IDS_CB(bmain->armature.first); - + /* lattices */ ANIMDATA_IDS_CB(bmain->latt.first); - + /* meshes */ ANIMDATA_IDS_CB(bmain->mesh.first); - + /* particles */ ANIMDATA_IDS_CB(bmain->particle.first); @@ -1137,7 +1137,7 @@ void BKE_animdata_main_cb(Main *bmain, ID_AnimData_Edit_Callback func, void *use /* masks */ ANIMDATA_IDS_CB(bmain->mask.first); - + /* worlds */ ANIMDATA_NODETREE_IDS_CB(bmain->world.first, World); @@ -1146,7 +1146,7 @@ void BKE_animdata_main_cb(Main *bmain, ID_AnimData_Edit_Callback func, void *use /* line styles */ ANIMDATA_IDS_CB(bmain->linestyle.first); - + /* grease pencil */ ANIMDATA_IDS_CB(bmain->gpencil.first); @@ -1163,9 +1163,9 @@ void BKE_animdata_fix_paths_rename_all(ID *ref_id, const char *prefix, const cha { Main *bmain = G.main; /* XXX UGLY! */ ID *id; - - /* macro for less typing - * - whether animdata exists is checked for by the main renaming callback, though taking + + /* macro for less typing + * - whether animdata exists is checked for by the main renaming callback, though taking * this outside of the function may make things slightly faster? */ #define RENAMEFIX_ANIM_IDS(first) \ @@ -1173,7 +1173,7 @@ void BKE_animdata_fix_paths_rename_all(ID *ref_id, const char *prefix, const cha AnimData *adt = BKE_animdata_from_id(id); \ BKE_animdata_fix_paths_rename(id, adt, ref_id, prefix, oldName, newName, 0, 0, 1); \ } (void)0 - + /* another version of this macro for nodetrees */ #define RENAMEFIX_ANIM_NODETREE_IDS(first, NtId_Type) \ for (id = first; id; id = id->next) { \ @@ -1185,40 +1185,40 @@ void BKE_animdata_fix_paths_rename_all(ID *ref_id, const char *prefix, const cha } \ BKE_animdata_fix_paths_rename(id, adt, ref_id, prefix, oldName, newName, 0, 0, 1); \ } (void)0 - + /* nodes */ RENAMEFIX_ANIM_IDS(bmain->nodetree.first); - + /* textures */ RENAMEFIX_ANIM_NODETREE_IDS(bmain->tex.first, Tex); - + /* lamps */ RENAMEFIX_ANIM_NODETREE_IDS(bmain->lamp.first, Lamp); - + /* materials */ RENAMEFIX_ANIM_NODETREE_IDS(bmain->mat.first, Material); - + /* cameras */ RENAMEFIX_ANIM_IDS(bmain->camera.first); - + /* shapekeys */ RENAMEFIX_ANIM_IDS(bmain->key.first); - + /* metaballs */ RENAMEFIX_ANIM_IDS(bmain->mball.first); - + /* curves */ RENAMEFIX_ANIM_IDS(bmain->curve.first); - + /* armatures */ RENAMEFIX_ANIM_IDS(bmain->armature.first); - + /* lattices */ RENAMEFIX_ANIM_IDS(bmain->latt.first); - + /* meshes */ RENAMEFIX_ANIM_IDS(bmain->mesh.first); - + /* particles */ RENAMEFIX_ANIM_IDS(bmain->particle.first); @@ -1233,24 +1233,24 @@ void BKE_animdata_fix_paths_rename_all(ID *ref_id, const char *prefix, const cha /* masks */ RENAMEFIX_ANIM_IDS(bmain->mask.first); - + /* worlds */ RENAMEFIX_ANIM_NODETREE_IDS(bmain->world.first, World); - + /* linestyles */ RENAMEFIX_ANIM_IDS(bmain->linestyle.first); - + /* grease pencil */ RENAMEFIX_ANIM_IDS(bmain->gpencil.first); /* cache files */ RENAMEFIX_ANIM_IDS(bmain->cachefiles.first); - + /* scenes */ RENAMEFIX_ANIM_NODETREE_IDS(bmain->scene.first, Scene); } -/* *********************************** */ +/* *********************************** */ /* KeyingSet API */ /* Finding Tools --------------------------- */ @@ -1260,50 +1260,50 @@ void BKE_animdata_fix_paths_rename_all(ID *ref_id, const char *prefix, const cha KS_Path *BKE_keyingset_find_path(KeyingSet *ks, ID *id, const char group_name[], const char rna_path[], int array_index, int UNUSED(group_mode)) { KS_Path *ksp; - + /* sanity checks */ if (ELEM(NULL, ks, rna_path, id)) return NULL; - - /* loop over paths in the current KeyingSet, finding the first one where all settings match + + /* loop over paths in the current KeyingSet, finding the first one where all settings match * (i.e. the first one where none of the checks fail and equal 0) */ for (ksp = ks->paths.first; ksp; ksp = ksp->next) { short eq_id = 1, eq_path = 1, eq_index = 1, eq_group = 1; - + /* id */ if (id != ksp->id) eq_id = 0; - + /* path */ if ((ksp->rna_path == NULL) || !STREQ(rna_path, ksp->rna_path)) eq_path = 0; - + /* index - need to compare whole-array setting too... */ if (ksp->array_index != array_index) eq_index = 0; - + /* group */ if (group_name) { /* FIXME: these checks need to be coded... for now, it's not too important though */ } - + /* if all aspects are ok, return */ if (eq_id && eq_path && eq_index && eq_group) return ksp; } - + /* none found */ return NULL; } - + /* Defining Tools --------------------------- */ /* Used to create a new 'custom' KeyingSet for the user, that will be automatically added to the stack */ KeyingSet *BKE_keyingset_add(ListBase *list, const char idname[], const char name[], short flag, short keyingflag) { KeyingSet *ks; - + /* allocate new KeyingSet */ ks = MEM_callocN(sizeof(KeyingSet), "KeyingSet"); @@ -1313,16 +1313,16 @@ KeyingSet *BKE_keyingset_add(ListBase *list, const char idname[], const char nam ks->flag = flag; ks->keyingflag = keyingflag; ks->keyingoverride = keyingflag; /* NOTE: assume that if one is set one way, the other should be too, so that it'll work */ - + /* add KeyingSet to list */ BLI_addtail(list, ks); - + /* Make sure KeyingSet has a unique idname */ BLI_uniquename(list, ks, DATA_("KeyingSet"), '.', offsetof(KeyingSet, idname), sizeof(ks->idname)); - + /* Make sure KeyingSet has a unique label (this helps with identification) */ BLI_uniquename(list, ks, DATA_("Keying Set"), '.', offsetof(KeyingSet, name), sizeof(ks->name)); - + /* return new KeyingSet for further editing */ return ks; } @@ -1333,55 +1333,55 @@ KeyingSet *BKE_keyingset_add(ListBase *list, const char idname[], const char nam KS_Path *BKE_keyingset_add_path(KeyingSet *ks, ID *id, const char group_name[], const char rna_path[], int array_index, short flag, short groupmode) { KS_Path *ksp; - + /* sanity checks */ if (ELEM(NULL, ks, rna_path)) { printf("ERROR: no Keying Set and/or RNA Path to add path with\n"); return NULL; } - + /* ID is required for all types of KeyingSets */ if (id == NULL) { printf("ERROR: No ID provided for Keying Set Path\n"); return NULL; } - + /* don't add if there is already a matching KS_Path in the KeyingSet */ if (BKE_keyingset_find_path(ks, id, group_name, rna_path, array_index, groupmode)) { if (G.debug & G_DEBUG) printf("ERROR: destination already exists in Keying Set\n"); return NULL; } - + /* allocate a new KeyingSet Path */ ksp = MEM_callocN(sizeof(KS_Path), "KeyingSet Path"); - + /* just store absolute info */ ksp->id = id; if (group_name) BLI_strncpy(ksp->group, group_name, sizeof(ksp->group)); else ksp->group[0] = '\0'; - + /* store additional info for relative paths (just in case user makes the set relative) */ if (id) ksp->idtype = GS(id->name); - + /* just copy path info */ /* TODO: should array index be checked too? */ ksp->rna_path = BLI_strdup(rna_path); ksp->array_index = array_index; - + /* store flags */ ksp->flag = flag; ksp->groupmode = groupmode; - + /* add KeyingSet path to KeyingSet */ BLI_addtail(&ks->paths, ksp); - + /* return this path */ return ksp; -} +} /* Free the given Keying Set path */ void BKE_keyingset_free_path(KeyingSet *ks, KS_Path *ksp) @@ -1403,12 +1403,12 @@ void BKE_keyingsets_copy(ListBase *newlist, const ListBase *list) { KeyingSet *ksn; KS_Path *kspn; - + BLI_duplicatelist(newlist, list); for (ksn = newlist->first; ksn; ksn = ksn->next) { BLI_duplicatelist(&ksn->paths, &ksn->paths); - + for (kspn = ksn->paths.first; kspn; kspn = kspn->next) kspn->rna_path = MEM_dupallocN(kspn->rna_path); } @@ -1420,11 +1420,11 @@ void BKE_keyingsets_copy(ListBase *newlist, const ListBase *list) void BKE_keyingset_free(KeyingSet *ks) { KS_Path *ksp, *kspn; - + /* sanity check */ if (ks == NULL) return; - + /* free each path as we go to avoid looping twice */ for (ksp = ks->paths.first; ksp; ksp = kspn) { kspn = ksp->next; @@ -1436,12 +1436,12 @@ void BKE_keyingset_free(KeyingSet *ks) void BKE_keyingsets_free(ListBase *list) { KeyingSet *ks, *ksn; - + /* sanity check */ if (list == NULL) return; - - /* loop over KeyingSets freeing them + + /* loop over KeyingSets freeing them * - BKE_keyingset_free() doesn't free the set itself, but it frees its sub-data */ for (ks = list->first; ks; ks = ksn) { @@ -1454,7 +1454,7 @@ void BKE_keyingsets_free(ListBase *list) /* ***************************************** */ /* Evaluation Data-Setting Backend */ -/* Retrieve string to act as RNA-path, adjusted using mapping-table if provided +/* Retrieve string to act as RNA-path, adjusted using mapping-table if provided * It returns whether the string needs to be freed (i.e. if it was a temp remapped one) * // FIXME: maybe it would be faster if we didn't have to alloc/free strings like this all the time, but for now it's safer * @@ -1757,14 +1757,14 @@ static void animsys_evaluate_fcurves( static void animsys_evaluate_drivers(PointerRNA *ptr, AnimData *adt, float ctime) { FCurve *fcu; - + /* drivers are stored as F-Curves, but we cannot use the standard code, as we need to check if * the depsgraph requested that this driver be evaluated... */ for (fcu = adt->drivers.first; fcu; fcu = fcu->next) { ChannelDriver *driver = fcu->driver; bool ok = false; - + /* check if this driver's curve should be skipped */ if ((fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED)) == 0) { /* check if driver itself is tagged for recalculation */ @@ -1779,13 +1779,13 @@ static void animsys_evaluate_drivers(PointerRNA *ptr, AnimData *adt, float ctime const float curval = calculate_fcurve(&anim_rna, fcu, ctime); ok = animsys_write_rna_setting(&anim_rna, curval); } - + /* clear recalc flag */ driver->flag &= ~DRIVER_FLAG_RECALC; - + /* set error-flag if evaluation failed */ if (ok == 0) - driver->flag |= DRIVER_FLAG_INVALID; + driver->flag |= DRIVER_FLAG_INVALID; } } } @@ -1801,13 +1801,13 @@ static void animsys_evaluate_drivers(PointerRNA *ptr, AnimData *adt, float ctime static void action_idcode_patch_check(ID *id, bAction *act) { int idcode = 0; - + /* just in case */ if (ELEM(NULL, id, act)) return; else idcode = GS(id->name); - + /* the actual checks... hopefully not too much of a performance hit in the long run... */ if (act->idroot == 0) { /* use the current root if not set already (i.e. newly created actions and actions from 2.50-2.57 builds) @@ -1831,17 +1831,17 @@ static void action_idcode_patch_check(ID *id, bAction *act) void animsys_evaluate_action_group(PointerRNA *ptr, bAction *act, bActionGroup *agrp, AnimMapper *remap, float ctime) { FCurve *fcu; - + /* check if mapper is appropriate for use here (we set to NULL if it's inappropriate) */ if (ELEM(NULL, act, agrp)) return; if ((remap) && (remap->target != act)) remap = NULL; - + action_idcode_patch_check(ptr->id.data, act); - + /* if group is muted, don't evaluated any of the F-Curve */ if (agrp->flag & AGRP_MUTED) return; - + /* calculate then execute each curve */ for (fcu = agrp->channels.first; (fcu) && (fcu->grp == agrp); fcu = fcu->next) { /* check if this curve should be skipped */ @@ -1862,9 +1862,9 @@ static void animsys_evaluate_action_ex( /* check if mapper is appropriate for use here (we set to NULL if it's inappropriate) */ if (act == NULL) return; if ((remap) && (remap->target != act)) remap = NULL; - + action_idcode_patch_check(ptr->id.data, act); - + /* calculate then execute each curve */ animsys_evaluate_fcurves(depsgraph, ptr, &act->curves, remap, ctime); } @@ -1883,7 +1883,7 @@ static float nlastrip_get_influence(NlaStrip *strip, float cframe) /* sanity checks - normalize the blendin/out values? */ strip->blendin = fabsf(strip->blendin); strip->blendout = fabsf(strip->blendout); - + /* result depends on where frame is in respect to blendin/out values */ if (IS_EQF(strip->blendin, 0.0f) == false && (cframe <= (strip->start + strip->blendin))) { /* there is some blend-in */ @@ -1905,14 +1905,14 @@ static void nlastrip_evaluate_controls(Depsgraph *depsgraph, NlaStrip *strip, fl /* now strip's evaluate F-Curves for these settings (if applicable) */ if (strip->fcurves.first) { PointerRNA strip_ptr; - + /* create RNA-pointer needed to set values */ RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &strip_ptr); - + /* execute these settings as per normal */ animsys_evaluate_fcurves(depsgraph, &strip_ptr, &strip->fcurves, NULL, ctime); } - + /* analytically generate values for influence and time (if applicable) * - we do this after the F-Curves have been evaluated to override the effects of those * in case the override has been turned off. @@ -1937,7 +1937,7 @@ NlaEvalStrip *nlastrips_ctime_get_strip(Depsgraph *depsgraph, ListBase *list, Li NlaStrip *strip, *estrip = NULL; NlaEvalStrip *nes; short side = 0; - + /* loop over strips, checking if they fall within the range */ for (strip = strips->first; strip; strip = strip->next) { /* check if current time occurs within this strip */ @@ -1947,53 +1947,53 @@ NlaEvalStrip *nlastrips_ctime_get_strip(Depsgraph *depsgraph, ListBase *list, Li side = NES_TIME_WITHIN; break; } - + /* if time occurred before current strip... */ if (ctime < strip->start) { if (strip == strips->first) { /* before first strip - only try to use it if it extends backwards in time too */ if (strip->extendmode == NLASTRIP_EXTEND_HOLD) estrip = strip; - + /* side is 'before' regardless of whether there's a useful strip */ side = NES_TIME_BEFORE; } else { - /* before next strip - previous strip has ended, but next hasn't begun, + /* before next strip - previous strip has ended, but next hasn't begun, * so blending mode depends on whether strip is being held or not... * - only occurs when no transition strip added, otherwise the transition would have * been picked up above... */ strip = strip->prev; - + if (strip->extendmode != NLASTRIP_EXTEND_NOTHING) estrip = strip; side = NES_TIME_AFTER; } break; } - + /* if time occurred after current strip... */ if (ctime > strip->end) { /* only if this is the last strip should we do anything, and only if that is being held */ if (strip == strips->last) { if (strip->extendmode != NLASTRIP_EXTEND_NOTHING) estrip = strip; - + side = NES_TIME_AFTER; break; } - + /* otherwise, skip... as the 'before' case will catch it more elegantly! */ } } - + /* check if a valid strip was found * - must not be muted (i.e. will have contribution */ - if ((estrip == NULL) || (estrip->flag & NLASTRIP_FLAG_MUTED)) + if ((estrip == NULL) || (estrip->flag & NLASTRIP_FLAG_MUTED)) return NULL; - + /* if ctime was not within the boundaries of the strip, clamp! */ switch (side) { case NES_TIME_BEFORE: /* extend first frame only */ @@ -2003,8 +2003,8 @@ NlaEvalStrip *nlastrips_ctime_get_strip(Depsgraph *depsgraph, ListBase *list, Li ctime = estrip->end; break; } - - /* evaluate strip's evaluation controls + + /* evaluate strip's evaluation controls * - skip if no influence (i.e. same effect as muting the strip) * - negative influence is not supported yet... how would that be defined? */ @@ -2012,12 +2012,12 @@ NlaEvalStrip *nlastrips_ctime_get_strip(Depsgraph *depsgraph, ListBase *list, Li nlastrip_evaluate_controls(depsgraph, estrip, ctime); if (estrip->influence <= 0.0f) return NULL; - + /* check if strip has valid data to evaluate, * and/or perform any additional type-specific actions */ switch (estrip->type) { - case NLASTRIP_TYPE_CLIP: + case NLASTRIP_TYPE_CLIP: /* clip must have some action to evaluate */ if (estrip->act == NULL) return NULL; @@ -2026,51 +2026,51 @@ NlaEvalStrip *nlastrips_ctime_get_strip(Depsgraph *depsgraph, ListBase *list, Li /* there must be strips to transition from and to (i.e. prev and next required) */ if (ELEM(NULL, estrip->prev, estrip->next)) return NULL; - + /* evaluate controls for the relevant extents of the bordering strips... */ nlastrip_evaluate_controls(depsgraph, estrip->prev, estrip->start); nlastrip_evaluate_controls(depsgraph, estrip->next, estrip->end); break; } - + /* add to list of strips we need to evaluate */ nes = MEM_callocN(sizeof(NlaEvalStrip), "NlaEvalStrip"); - + nes->strip = estrip; nes->strip_mode = side; nes->track_index = index; nes->strip_time = estrip->strip_time; - + if (list) BLI_addtail(list, nes); - + return nes; } /* ---------------------- */ -/* find an NlaEvalChannel that matches the given criteria +/* find an NlaEvalChannel that matches the given criteria * - ptr and prop are the RNA data to find a match for */ static NlaEvalChannel *nlaevalchan_find_match(ListBase *channels, PointerRNA *ptr, PropertyRNA *prop, int array_index) { NlaEvalChannel *nec; - + /* sanity check */ if (channels == NULL) return NULL; - + /* loop through existing channels, checking for a channel which affects the same property */ for (nec = channels->first; nec; nec = nec->next) { /* - comparing the PointerRNA's is done by comparing the pointers * to the actual struct the property resides in, since that all the - * other data stored in PointerRNA cannot allow us to definitively - * identify the data + * other data stored in PointerRNA cannot allow us to definitively + * identify the data */ if ((nec->ptr.data == ptr->data) && (nec->prop == prop) && (nec->index == array_index)) return nec; } - + /* not found */ return NULL; } @@ -2081,9 +2081,9 @@ static void nlaevalchan_value_init(NlaEvalChannel *nec) PointerRNA *ptr = &nec->ptr; PropertyRNA *prop = nec->prop; int index = nec->index; - - /* NOTE: while this doesn't work for all RNA properties as default values aren't in fact - * set properly for most of them, at least the common ones (which also happen to get used + + /* NOTE: while this doesn't work for all RNA properties as default values aren't in fact + * set properly for most of them, at least the common ones (which also happen to get used * in NLA strips a lot, e.g. scale) are set correctly. */ switch (RNA_property_type(prop)) { @@ -2122,15 +2122,15 @@ static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, ListBase *channels, N PointerRNA new_ptr; char *path = NULL; /* short free_path = 0; */ - + /* sanity checks */ if (channels == NULL) return NULL; - + /* get RNA pointer+property info from F-Curve for more convenient handling */ /* get path, remapped as appropriate to work in its new environment */ /* free_path = */ /* UNUSED */ animsys_remap_path(strip->remap, fcu->rna_path, &path); - + /* a valid property must be available, and it must be animatable */ if (RNA_path_resolve_property(ptr, path, &new_ptr, &prop) == false) { if (G.debug & G_DEBUG) printf("NLA Strip Eval: Cannot resolve path\n"); @@ -2141,27 +2141,27 @@ static NlaEvalChannel *nlaevalchan_verify(PointerRNA *ptr, ListBase *channels, N if (G.debug & G_DEBUG) printf("NLA Strip Eval: Property not animatable\n"); return NULL; } - + /* try to find a match */ nec = nlaevalchan_find_match(channels, &new_ptr, prop, fcu->array_index); - + /* allocate a new struct for this if none found */ if (nec == NULL) { nec = MEM_callocN(sizeof(NlaEvalChannel), "NlaEvalChannel"); BLI_addtail(channels, nec); - + /* store property links for writing to the property later */ nec->ptr = new_ptr; nec->prop = prop; nec->index = fcu->array_index; - + /* initialise value using default value of property [#35856] */ nlaevalchan_value_init(nec); *newChan = true; } else *newChan = false; - + /* we can now return */ return nec; } @@ -2172,7 +2172,7 @@ static void nlaevalchan_accumulate(NlaEvalChannel *nec, NlaEvalStrip *nes, float NlaStrip *strip = nes->strip; short blendmode = strip->blendmode; float inf = strip->influence; - + /* for replace blend mode, and if this is the first strip, * just replace the value regardless of the influence */ if (newChan && blendmode == NLASTRIP_MODE_REPLACE) { @@ -2183,36 +2183,36 @@ static void nlaevalchan_accumulate(NlaEvalChannel *nec, NlaEvalStrip *nes, float /* if this is being performed as part of transition evaluation, incorporate * an additional weighting factor for the influence */ - if (nes->strip_mode == NES_TIME_TRANSITION_END) + if (nes->strip_mode == NES_TIME_TRANSITION_END) inf *= nes->strip_time; - + /* optimisation: no need to try applying if there is no influence */ if (IS_EQF(inf, 0.0f)) return; - + /* perform blending */ switch (blendmode) { case NLASTRIP_MODE_ADD: /* simply add the scaled value on to the stack */ nec->value += (value * inf); break; - + case NLASTRIP_MODE_SUBTRACT: /* simply subtract the scaled value from the stack */ nec->value -= (value * inf); break; - + case NLASTRIP_MODE_MULTIPLY: /* multiply the scaled value with the stack */ - /* Formula Used: - * result = fac * (a * b) + (1 - fac) * a + /* Formula Used: + * result = fac * (a * b) + (1 - fac) * a */ nec->value = inf * (nec->value * value) + (1 - inf) * nec->value; break; - + case NLASTRIP_MODE_REPLACE: default: /* TODO: do we really want to blend by default? it seems more uses might prefer add... */ - /* do linear interpolation - * - the influence of the accumulated data (elsewhere, that is called dstweight) + /* do linear interpolation + * - the influence of the accumulated data (elsewhere, that is called dstweight) * is 1 - influence, since the strip's influence is srcweight */ nec->value = nec->value * (1.0f - inf) + (value * inf); @@ -2224,19 +2224,19 @@ static void nlaevalchan_accumulate(NlaEvalChannel *nec, NlaEvalStrip *nes, float static void nlaevalchan_buffers_accumulate(ListBase *channels, ListBase *tmp_buffer, NlaEvalStrip *nes) { NlaEvalChannel *nec, *necn, *necd; - + /* optimize - abort if no channels */ if (BLI_listbase_is_empty(tmp_buffer)) return; - + /* accumulate results in tmp_channels buffer to the accumulation buffer */ for (nec = tmp_buffer->first; nec; nec = necn) { /* get pointer to next channel in case we remove the current channel from the temp-buffer */ necn = nec->next; - + /* try to find an existing matching channel for this setting in the accumulation buffer */ necd = nlaevalchan_find_match(channels, &nec->ptr, nec->prop, nec->index); - + /* if there was a matching channel already in the buffer, accumulate to it, * otherwise, add the current channel to the buffer for efficiency */ @@ -2247,7 +2247,7 @@ static void nlaevalchan_buffers_accumulate(ListBase *channels, ListBase *tmp_buf BLI_addtail(channels, nec); } } - + /* free temp-channels that haven't been assimilated into the buffer */ BLI_freelistN(tmp_buffer); } @@ -2259,7 +2259,7 @@ static void nlaevalchan_buffers_accumulate(ListBase *channels, ListBase *tmp_buf static void nlaeval_fmodifiers_join_stacks(ListBase *result, ListBase *list1, ListBase *list2) { FModifier *fcm1, *fcm2; - + /* if list1 is invalid... */ if (ELEM(NULL, list1, list1->first)) { if (list2 && list2->first) { @@ -2273,15 +2273,15 @@ static void nlaeval_fmodifiers_join_stacks(ListBase *result, ListBase *list1, Li result->last = list1->last; } else { - /* list1 should be added first, and list2 second, with the endpoints of these being the endpoints for result + /* list1 should be added first, and list2 second, with the endpoints of these being the endpoints for result * - the original lists must be left unchanged though, as we need that fact for restoring */ result->first = list1->first; result->last = list2->last; - + fcm1 = list1->last; fcm2 = list2->first; - + fcm1->next = fcm2; fcm2->prev = fcm1; } @@ -2291,17 +2291,17 @@ static void nlaeval_fmodifiers_join_stacks(ListBase *result, ListBase *list1, Li static void nlaeval_fmodifiers_split_stacks(ListBase *list1, ListBase *list2) { FModifier *fcm1, *fcm2; - + /* if list1/2 is invalid... just skip */ if (ELEM(NULL, list1, list2)) return; if (ELEM(NULL, list1->first, list2->first)) return; - + /* get endpoints */ fcm1 = list1->last; fcm2 = list2->first; - + /* clear their links */ fcm1->next = NULL; fcm2->prev = NULL; @@ -2317,48 +2317,48 @@ static void nlastrip_evaluate_actionclip(PointerRNA *ptr, ListBase *channels, Li NlaStrip *strip = nes->strip; FCurve *fcu; float evaltime; - + /* sanity checks for action */ if (strip == NULL) return; - + if (strip->act == NULL) { printf("NLA-Strip Eval Error: Strip '%s' has no Action\n", strip->name); return; } - + action_idcode_patch_check(ptr->id.data, strip->act); - + /* join this strip's modifiers to the parent's modifiers (own modifiers first) */ nlaeval_fmodifiers_join_stacks(&tmp_modifiers, &strip->modifiers, modifiers); - + /* evaluate strip's modifiers which modify time to evaluate the base curves at */ storage = evaluate_fmodifiers_storage_new(&tmp_modifiers); evaltime = evaluate_time_fmodifiers(storage, &tmp_modifiers, NULL, 0.0f, strip->strip_time); - + /* evaluate all the F-Curves in the action, saving the relevant pointers to data that will need to be used */ for (fcu = strip->act->curves.first; fcu; fcu = fcu->next) { NlaEvalChannel *nec; float value = 0.0f; bool newChan; - + /* check if this curve should be skipped */ if (fcu->flag & (FCURVE_MUTED | FCURVE_DISABLED)) continue; if ((fcu->grp) && (fcu->grp->flag & AGRP_MUTED)) continue; - - /* evaluate the F-Curve's value for the time given in the strip - * NOTE: we use the modified time here, since strip's F-Curve Modifiers are applied on top of this + + /* evaluate the F-Curve's value for the time given in the strip + * NOTE: we use the modified time here, since strip's F-Curve Modifiers are applied on top of this */ value = evaluate_fcurve(fcu, evaltime); - - /* apply strip's F-Curve Modifiers on this value + + /* apply strip's F-Curve Modifiers on this value * NOTE: we apply the strip's original evaluation time not the modified one (as per standard F-Curve eval) */ evaluate_value_fmodifiers(storage, &tmp_modifiers, fcu, &value, strip->strip_time); - - + + /* get an NLA evaluation channel to work with, and accumulate the evaluated value with the value(s) * stored in this channel if it has been used already */ @@ -2382,11 +2382,11 @@ static void nlastrip_evaluate_transition( ListBase tmp_modifiers = {NULL, NULL}; NlaEvalStrip tmp_nes; NlaStrip *s1, *s2; - + /* join this strip's modifiers to the parent's modifiers (own modifiers first) */ nlaeval_fmodifiers_join_stacks(&tmp_modifiers, &nes->strip->modifiers, modifiers); - - /* get the two strips to operate on + + /* get the two strips to operate on * - we use the endpoints of the strips directly flanking our strip * using these as the endpoints of the transition (destination and source) * - these should have already been determined to be valid... @@ -2401,8 +2401,8 @@ static void nlastrip_evaluate_transition( s1 = nes->strip->prev; s2 = nes->strip->next; } - - /* prepare template for 'evaluation strip' + + /* prepare template for 'evaluation strip' * - based on the transition strip's evaluation strip data * - strip_mode is NES_TIME_TRANSITION_* based on which endpoint * - strip_time is the 'normalized' (i.e. in-strip) time for evaluation, @@ -2410,23 +2410,23 @@ static void nlastrip_evaluate_transition( * which allows us to appear to be 'interpolating' between the two extremes */ tmp_nes = *nes; - + /* evaluate these strips into a temp-buffer (tmp_channels) */ /* FIXME: modifier evaluation here needs some work... */ /* first strip */ tmp_nes.strip_mode = NES_TIME_TRANSITION_START; tmp_nes.strip = s1; nlastrip_evaluate(depsgraph, ptr, &tmp_channels, &tmp_modifiers, &tmp_nes); - + /* second strip */ tmp_nes.strip_mode = NES_TIME_TRANSITION_END; tmp_nes.strip = s2; nlastrip_evaluate(depsgraph, ptr, &tmp_channels, &tmp_modifiers, &tmp_nes); - - + + /* accumulate temp-buffer and full-buffer, using the 'real' strip */ nlaevalchan_buffers_accumulate(channels, &tmp_channels, nes); - + /* unlink this strip's modifiers from the parent's modifiers again */ nlaeval_fmodifiers_split_stacks(&nes->strip->modifiers, modifiers); } @@ -2439,32 +2439,32 @@ static void nlastrip_evaluate_meta( NlaStrip *strip = nes->strip; NlaEvalStrip *tmp_nes; float evaltime; - + /* meta-strip was calculated normally to have some time to be evaluated at * and here we 'look inside' the meta strip, treating it as a decorated window to - * it's child strips, which get evaluated as if they were some tracks on a strip + * it's child strips, which get evaluated as if they were some tracks on a strip * (but with some extra modifiers to apply). * * NOTE: keep this in sync with animsys_evaluate_nla() */ - + /* join this strip's modifiers to the parent's modifiers (own modifiers first) */ - nlaeval_fmodifiers_join_stacks(&tmp_modifiers, &strip->modifiers, modifiers); - + nlaeval_fmodifiers_join_stacks(&tmp_modifiers, &strip->modifiers, modifiers); + /* find the child-strip to evaluate */ evaltime = (nes->strip_time * (strip->end - strip->start)) + strip->start; tmp_nes = nlastrips_ctime_get_strip(depsgraph, NULL, &strip->strips, -1, evaltime); - - /* directly evaluate child strip into accumulation buffer... + + /* directly evaluate child strip into accumulation buffer... * - there's no need to use a temporary buffer (as it causes issues [T40082]) */ if (tmp_nes) { nlastrip_evaluate(depsgraph, ptr, channels, &tmp_modifiers, tmp_nes); - + /* free temp eval-strip */ MEM_freeN(tmp_nes); } - + /* unlink this strip's modifiers from the parent's modifiers again */ nlaeval_fmodifiers_split_stacks(&strip->modifiers, modifiers); } @@ -2473,7 +2473,7 @@ static void nlastrip_evaluate_meta( void nlastrip_evaluate(Depsgraph *depsgraph, PointerRNA *ptr, ListBase *channels, ListBase *modifiers, NlaEvalStrip *nes) { NlaStrip *strip = nes->strip; - + /* to prevent potential infinite recursion problems (i.e. transition strip, beside meta strip containing a transition * several levels deep inside it), we tag the current strip as being evaluated, and clear this when we leave */ @@ -2481,7 +2481,7 @@ void nlastrip_evaluate(Depsgraph *depsgraph, PointerRNA *ptr, ListBase *channels if (strip->flag & NLASTRIP_FLAG_EDIT_TOUCHED) return; strip->flag |= NLASTRIP_FLAG_EDIT_TOUCHED; - + /* actions to take depend on the type of strip */ switch (strip->type) { case NLASTRIP_TYPE_CLIP: /* action-clip */ @@ -2493,11 +2493,11 @@ void nlastrip_evaluate(Depsgraph *depsgraph, PointerRNA *ptr, ListBase *channels case NLASTRIP_TYPE_META: /* meta */ nlastrip_evaluate_meta(depsgraph, ptr, channels, modifiers, nes); break; - + default: /* do nothing */ break; } - + /* clear temp recursion safe-check */ strip->flag &= ~NLASTRIP_FLAG_EDIT_TOUCHED; } @@ -2506,18 +2506,18 @@ void nlastrip_evaluate(Depsgraph *depsgraph, PointerRNA *ptr, ListBase *channels void nladata_flush_channels(ListBase *channels) { NlaEvalChannel *nec; - + /* sanity checks */ if (channels == NULL) return; - + /* for each channel with accumulated values, write its value on the property it affects */ for (nec = channels->first; nec; nec = nec->next) { PointerRNA *ptr = &nec->ptr; PropertyRNA *prop = nec->prop; int array_index = nec->index; float value = nec->value; - + /* write values - see animsys_write_rna_setting() to sync the code */ switch (RNA_property_type(prop)) { case PROP_BOOLEAN: @@ -2562,19 +2562,19 @@ static void animsys_evaluate_nla(Depsgraph *depsgraph, ListBase *echannels, Poin NlaTrack *nlt; short track_index = 0; bool has_strips = false; - + ListBase estrips = {NULL, NULL}; NlaEvalStrip *nes; - + NlaStrip dummy_strip = {NULL}; /* dummy strip for active action */ - - + + /* 1. get the stack of strips to evaluate at current time (influence calculated here) */ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next, track_index++) { /* stop here if tweaking is on and this strip is the tweaking track (it will be the first one that's 'disabled')... */ if ((adt->flag & ADT_NLA_EDIT_ON) && (nlt->flag & NLATRACK_DISABLED)) break; - + /* solo and muting are mutually exclusive... */ if (adt->flag & ADT_NLA_SOLO_TRACK) { /* skip if there is a solo track, but this isn't it */ @@ -2584,24 +2584,24 @@ static void animsys_evaluate_nla(Depsgraph *depsgraph, ListBase *echannels, Poin } else { /* no solo tracks - skip track if muted */ - if (nlt->flag & NLATRACK_MUTED) + if (nlt->flag & NLATRACK_MUTED) continue; } - - /* if this track has strips (but maybe they won't be suitable), set has_strips + + /* if this track has strips (but maybe they won't be suitable), set has_strips * - used for mainly for still allowing normal action evaluation... */ if (nlt->strips.first) has_strips = true; - + /* otherwise, get strip to evaluate for this channel */ nes = nlastrips_ctime_get_strip(depsgraph, &estrips, &nlt->strips, track_index, ctime); if (nes) nes->track = nlt; } - + /* add 'active' Action (may be tweaking track) as last strip to evaluate in NLA stack * - only do this if we're not exclusively evaluating the 'solo' NLA-track - * - however, if the 'solo' track houses the current 'tweaking' strip, + * - however, if the 'solo' track houses the current 'tweaking' strip, * then we should allow this to play, otherwise nothing happens */ if ((adt->action) && ((adt->flag & ADT_NLA_SOLO_TRACK) == 0 || (adt->flag & ADT_NLA_EDIT_ON))) { @@ -2609,9 +2609,9 @@ static void animsys_evaluate_nla(Depsgraph *depsgraph, ListBase *echannels, Poin if ((has_strips) || (adt->actstrip)) { /* make dummy NLA strip, and add that to the stack */ ListBase dummy_trackslist; - + dummy_trackslist.first = dummy_trackslist.last = &dummy_strip; - + if ((nlt) && !(adt->flag & ADT_NLA_EDIT_NOMAP)) { /* edit active action in-place according to its active strip, so copy the data */ memcpy(&dummy_strip, adt->actstrip, sizeof(NlaStrip)); @@ -2621,20 +2621,20 @@ static void animsys_evaluate_nla(Depsgraph *depsgraph, ListBase *echannels, Poin /* set settings of dummy NLA strip from AnimData settings */ dummy_strip.act = adt->action; dummy_strip.remap = adt->remap; - + /* action range is calculated taking F-Modifiers into account (which making new strips doesn't do due to the troublesome nature of that) */ calc_action_range(dummy_strip.act, &dummy_strip.actstart, &dummy_strip.actend, 1); dummy_strip.start = dummy_strip.actstart; dummy_strip.end = (IS_EQF(dummy_strip.actstart, dummy_strip.actend)) ? (dummy_strip.actstart + 1.0f) : (dummy_strip.actend); - + dummy_strip.blendmode = adt->act_blendmode; dummy_strip.extendmode = adt->act_extendmode; dummy_strip.influence = adt->act_influence; - + /* NOTE: must set this, or else the default setting overrides, and this setting doesn't work */ dummy_strip.flag |= NLASTRIP_FLAG_USR_INFLUENCE; } - + /* add this to our list of evaluation strips */ nlastrips_ctime_get_strip(depsgraph, &estrips, &dummy_trackslist, -1, ctime); } @@ -2642,27 +2642,27 @@ static void animsys_evaluate_nla(Depsgraph *depsgraph, ListBase *echannels, Poin /* special case - evaluate as if there isn't any NLA data */ /* TODO: this is really just a stop-gap measure... */ if (G.debug & G_DEBUG) printf("NLA Eval: Stopgap for active action on NLA Stack - no strips case\n"); - + animsys_evaluate_action(depsgraph, ptr, adt->action, adt->remap, ctime); BLI_freelistN(&estrips); return; } } - + /* only continue if there are strips to evaluate */ if (BLI_listbase_is_empty(&estrips)) return; - - + + /* 2. for each strip, evaluate then accumulate on top of existing channels, but don't set values yet */ for (nes = estrips.first; nes; nes = nes->next) nlastrip_evaluate(depsgraph, ptr, echannels, NULL, nes); - + /* 3. free temporary evaluation data that's not used elsewhere */ BLI_freelistN(&estrips); } -/* NLA Evaluation function (mostly for use through do_animdata) +/* NLA Evaluation function (mostly for use through do_animdata) * - All channels that will be affected are not cleared anymore. Instead, we just evaluate into * some temp channels, where values can be accumulated in one go. */ @@ -2675,15 +2675,15 @@ static void animsys_calculate_nla(Depsgraph *depsgraph, PointerRNA *ptr, AnimDat /* evaluate the NLA stack, obtaining a set of values to flush */ animsys_evaluate_nla(depsgraph, &echannels, ptr, adt, ctime); - + /* flush effects of accumulating channels in NLA to the actual data they affect */ nladata_flush_channels(&echannels); - + /* free temp data */ BLI_freelistN(&echannels); } -/* ***************************************** */ +/* ***************************************** */ /* Overrides System - Public API */ /* Clear all overrides */ @@ -2703,7 +2703,7 @@ AnimOverride *BKE_animsys_validate_override(PointerRNA *UNUSED(ptr), char *UNUSE static void animsys_evaluate_overrides(PointerRNA *ptr, AnimData *adt) { AnimOverride *aor; - + /* for each override, simply execute... */ for (aor = adt->overrides.first; aor; aor = aor->next) { PathResolvedRNA anim_rna; @@ -2747,7 +2747,7 @@ static void animsys_evaluate_overrides(PointerRNA *ptr, AnimData *adt) * However, the code for this is relatively harmless, so is left in the code for now. */ -/* Evaluation loop for evaluation animation data +/* Evaluation loop for evaluation animation data * * This assumes that the animation-data provided belongs to the ID block in question, * and that the flags for which parts of the anim-data settings need to be recalculated @@ -2756,14 +2756,14 @@ static void animsys_evaluate_overrides(PointerRNA *ptr, AnimData *adt) void BKE_animsys_evaluate_animdata(Depsgraph *depsgraph, Scene *scene, ID *id, AnimData *adt, float ctime, short recalc) { PointerRNA id_ptr; - + /* sanity checks */ if (ELEM(NULL, id, adt)) return; - + /* get pointer to ID-block for RNA to use */ RNA_id_pointer_create(id, &id_ptr); - + /* recalculate keyframe data: * - NLA before Active Action, as Active Action behaves as 'tweaking track' * that overrides 'rough' work in NLA @@ -2772,7 +2772,7 @@ void BKE_animsys_evaluate_animdata(Depsgraph *depsgraph, Scene *scene, ID *id, A if ((recalc & ADT_RECALC_ANIM) || (adt->recalc & ADT_RECALC_ANIM)) { /* evaluate NLA data */ if ((adt->nla_tracks.first) && !(adt->flag & ADT_NLA_EVAL_OFF)) { - /* evaluate NLA-stack + /* evaluate NLA-stack * - active action is evaluated as part of the NLA stack as the last item */ animsys_calculate_nla(depsgraph, &id_ptr, adt, ctime); @@ -2780,13 +2780,13 @@ void BKE_animsys_evaluate_animdata(Depsgraph *depsgraph, Scene *scene, ID *id, A /* evaluate Active Action only */ else if (adt->action) animsys_evaluate_action_ex(depsgraph, &id_ptr, adt->action, adt->remap, ctime); - + /* reset tag */ adt->recalc &= ~ADT_RECALC_ANIM; } - - /* recalculate drivers - * - Drivers need to be evaluated afterwards, as they can either override + + /* recalculate drivers + * - Drivers need to be evaluated afterwards, as they can either override * or be layered on top of existing animation data. * - Drivers should be in the appropriate order to be evaluated without problems... */ @@ -2796,22 +2796,22 @@ void BKE_animsys_evaluate_animdata(Depsgraph *depsgraph, Scene *scene, ID *id, A { animsys_evaluate_drivers(&id_ptr, adt, ctime); } - - /* always execute 'overrides' + + /* always execute 'overrides' * - Overrides allow editing, by overwriting the value(s) set from animation-data, with the - * value last set by the user (and not keyframed yet). + * value last set by the user (and not keyframed yet). * - Overrides are cleared upon frame change and/or keyframing * - It is best that we execute this every time, so that no errors are likely to occur. */ animsys_evaluate_overrides(&id_ptr, adt); - + /* execute and clear all cached property update functions */ if (scene) { Main *bmain = G.main; // xxx - to get passed in! RNA_property_update_cache_flush(bmain, scene); RNA_property_update_cache_free(); } - + /* clear recalc flag now */ adt->recalc = 0; } @@ -2829,10 +2829,10 @@ void BKE_animsys_evaluate_all_animation(Main *main, Depsgraph *depsgraph, Scene if (G.debug & G_DEBUG) printf("Evaluate all animation - %f\n", ctime); - - /* macros for less typing + + /* macros for less typing * - only evaluate animation data for id if it has users (and not just fake ones) - * - whether animdata exists is checked for by the evaluation function, though taking + * - whether animdata exists is checked for by the evaluation function, though taking * this outside of the function may make things slightly faster? */ #define EVAL_ANIM_IDS(first, aflag) \ @@ -2843,8 +2843,8 @@ void BKE_animsys_evaluate_all_animation(Main *main, Depsgraph *depsgraph, Scene } \ } (void)0 - /* another macro for the "embedded" nodetree cases - * - this is like EVAL_ANIM_IDS, but this handles the case "embedded nodetrees" + /* another macro for the "embedded" nodetree cases + * - this is like EVAL_ANIM_IDS, but this handles the case "embedded nodetrees" * (i.e. scene/material/texture->nodetree) which we need a special exception * for, otherwise they'd get skipped * - ntp = "node tree parent" = datablock where node tree stuff resides @@ -2861,10 +2861,10 @@ void BKE_animsys_evaluate_all_animation(Main *main, Depsgraph *depsgraph, Scene BKE_animsys_evaluate_animdata(depsgraph, scene, id, adt, ctime, aflag); \ } \ } (void)0 - - /* optimization: - * when there are no actions, don't go over database and loop over heaps of datablocks, - * which should ultimately be empty, since it is not possible for now to have any animation + + /* optimization: + * when there are no actions, don't go over database and loop over heaps of datablocks, + * which should ultimately be empty, since it is not possible for now to have any animation * without some actions, and drivers wouldn't get affected by any state changes * * however, if there are some curves, we will need to make sure that their 'ctime' property gets @@ -2873,46 +2873,46 @@ void BKE_animsys_evaluate_all_animation(Main *main, Depsgraph *depsgraph, Scene if (BLI_listbase_is_empty(&main->action) && BLI_listbase_is_empty(&main->curve)) { if (G.debug & G_DEBUG) printf("\tNo Actions, so no animation needs to be evaluated...\n"); - + return; } - + /* nodes */ EVAL_ANIM_IDS(main->nodetree.first, ADT_RECALC_ANIM); - + /* textures */ EVAL_ANIM_NODETREE_IDS(main->tex.first, Tex, ADT_RECALC_ANIM); - + /* lamps */ EVAL_ANIM_NODETREE_IDS(main->lamp.first, Lamp, ADT_RECALC_ANIM); - + /* materials */ EVAL_ANIM_NODETREE_IDS(main->mat.first, Material, ADT_RECALC_ANIM); - + /* cameras */ EVAL_ANIM_IDS(main->camera.first, ADT_RECALC_ANIM); - + /* shapekeys */ EVAL_ANIM_IDS(main->key.first, ADT_RECALC_ANIM); - + /* metaballs */ EVAL_ANIM_IDS(main->mball.first, ADT_RECALC_ANIM); - + /* curves */ EVAL_ANIM_IDS(main->curve.first, ADT_RECALC_ANIM); - + /* armatures */ EVAL_ANIM_IDS(main->armature.first, ADT_RECALC_ANIM); - + /* lattices */ EVAL_ANIM_IDS(main->latt.first, ADT_RECALC_ANIM); - + /* meshes */ EVAL_ANIM_IDS(main->mesh.first, ADT_RECALC_ANIM); - + /* particles */ EVAL_ANIM_IDS(main->particle.first, ADT_RECALC_ANIM); - + /* speakers */ EVAL_ANIM_IDS(main->speaker.first, ADT_RECALC_ANIM); @@ -2921,31 +2921,31 @@ void BKE_animsys_evaluate_all_animation(Main *main, Depsgraph *depsgraph, Scene /* linestyles */ EVAL_ANIM_IDS(main->linestyle.first, ADT_RECALC_ANIM); - + /* grease pencil */ EVAL_ANIM_IDS(main->gpencil.first, ADT_RECALC_ANIM); /* cache files */ EVAL_ANIM_IDS(main->cachefiles.first, ADT_RECALC_ANIM); - + /* objects */ /* ADT_RECALC_ANIM doesn't need to be supplied here, since object AnimData gets * this tagged by Depsgraph on framechange. This optimization means that objects * linked from other (not-visible) scenes will not need their data calculated. */ - EVAL_ANIM_IDS(main->object.first, 0); + EVAL_ANIM_IDS(main->object.first, 0); /* masks */ EVAL_ANIM_IDS(main->mask.first, ADT_RECALC_ANIM); - + /* worlds */ EVAL_ANIM_NODETREE_IDS(main->world.first, World, ADT_RECALC_ANIM); - + /* scenes */ EVAL_ANIM_NODETREE_IDS(main->scene.first, Scene, ADT_RECALC_ANIM); } -/* ***************************************** */ +/* ***************************************** */ /* ************** */ /* Evaluation API */ diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c index 3b2534eae73..ccff6216cb3 100644 --- a/source/blender/blenkernel/intern/appdir.c +++ b/source/blender/blenkernel/intern/appdir.c @@ -83,18 +83,18 @@ const char *BKE_appdir_folder_default(void) if (uput_getenv("HOME", documentfolder, MAXPATHLEN)) { if (BLI_is_dir(documentfolder)) return documentfolder; } - + /* add user profile support for WIN 2K / NT. * This is %APPDATA%, which translates to either * %USERPROFILE%\Application Data or since Vista * to %USERPROFILE%\AppData\Roaming */ hResult = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, documentfolder); - + if (hResult == S_OK) { if (BLI_is_dir(documentfolder)) return documentfolder; } - + return NULL; #endif /* WIN32 */ } @@ -120,7 +120,7 @@ static bool test_path( const char *path_base, const char *path_sep, const char *folder_name) { char tmppath[FILE_MAX]; - + if (path_sep) { BLI_join_dirfile(tmppath, sizeof(tmppath), path_base, path_sep); } @@ -161,7 +161,7 @@ static bool test_env_path(char *path, const char *envvar) { const char *env = envvar ? getenv(envvar) : NULL; if (!env) return false; - + if (BLI_is_dir(env)) { BLI_strncpy(path, env, FILE_MAX); #ifdef PATH_DEBUG @@ -193,7 +193,7 @@ static bool get_path_local( const char *folder_name, const char *subfolder_name, const int ver) { char relfolder[FILE_MAX]; - + #ifdef PATH_DEBUG printf("%s...\n", __func__); #endif @@ -276,11 +276,11 @@ static bool get_path_user( if (!user_path[0]) return false; - + #ifdef PATH_DEBUG printf("%s: %s\n", __func__, user_path); #endif - + if (subfolder_name) { return test_path(targetpath, targetpath_len, user_path, folder_name, subfolder_name); } @@ -334,14 +334,14 @@ static bool get_path_system( system_base_path = (const char *)GHOST_getSystemDir(ver, blender_version_decimal(ver)); if (system_base_path) BLI_strncpy(system_path, system_base_path, FILE_MAX); - + if (!system_path[0]) return false; - + #ifdef PATH_DEBUG printf("%s: %s\n", __func__, system_path); #endif - + if (subfolder_name) { /* try $BLENDERPATH/folder_name/subfolder_name */ return test_path(targetpath, targetpath_len, system_path, folder_name, subfolder_name); @@ -371,16 +371,16 @@ const char *BKE_appdir_folder_id_ex( if (get_path_local(path, path_len, "datafiles", subfolder, ver)) break; if (get_path_system(path, path_len, "datafiles", subfolder, "BLENDER_SYSTEM_DATAFILES", ver)) break; return NULL; - + case BLENDER_USER_DATAFILES: if (get_path_user(path, path_len, "datafiles", subfolder, "BLENDER_USER_DATAFILES", ver)) break; return NULL; - + case BLENDER_SYSTEM_DATAFILES: if (get_path_local(path, path_len, "datafiles", subfolder, ver)) break; if (get_path_system(path, path_len, "datafiles", subfolder, "BLENDER_SYSTEM_DATAFILES", ver)) break; return NULL; - + case BLENDER_USER_AUTOSAVE: if (get_path_user(path, path_len, "autosave", subfolder, "BLENDER_USER_DATAFILES", ver)) break; return NULL; @@ -388,16 +388,16 @@ const char *BKE_appdir_folder_id_ex( case BLENDER_USER_CONFIG: if (get_path_user(path, path_len, "config", subfolder, "BLENDER_USER_CONFIG", ver)) break; return NULL; - + case BLENDER_USER_SCRIPTS: if (get_path_user(path, path_len, "scripts", subfolder, "BLENDER_USER_SCRIPTS", ver)) break; return NULL; - + case BLENDER_SYSTEM_SCRIPTS: if (get_path_local(path, path_len, "scripts", subfolder, ver)) break; if (get_path_system(path, path_len, "scripts", subfolder, "BLENDER_SYSTEM_SCRIPTS", ver)) break; return NULL; - + case BLENDER_SYSTEM_PYTHON: if (get_path_local(path, path_len, "python", subfolder, ver)) break; if (get_path_system(path, path_len, "python", subfolder, "BLENDER_SYSTEM_PYTHON", ver)) break; @@ -407,7 +407,7 @@ const char *BKE_appdir_folder_id_ex( BLI_assert(0); break; } - + return path; } @@ -460,14 +460,14 @@ const char *BKE_appdir_folder_id_create(const int folder_id, const char *subfold /* only for user folders */ if (!ELEM(folder_id, BLENDER_USER_DATAFILES, BLENDER_USER_CONFIG, BLENDER_USER_SCRIPTS, BLENDER_USER_AUTOSAVE)) return NULL; - + path = BKE_appdir_folder_id(folder_id, subfolder); - + if (!path) { path = BKE_appdir_folder_id_user_notest(folder_id, subfolder); if (path) BLI_dir_create_recursive(path); } - + return path; } @@ -739,8 +739,8 @@ static void where_is_temp(char *fullname, char *basename, const size_t maxlen, c if (userdir && BLI_is_dir(userdir)) { BLI_strncpy(fullname, userdir, maxlen); } - - + + #ifdef WIN32 if (fullname[0] == '\0') { const char *tmp = getenv("TEMP"); /* Windows */ @@ -756,7 +756,7 @@ static void where_is_temp(char *fullname, char *basename, const size_t maxlen, c BLI_strncpy(fullname, tmp, maxlen); } } - + if (fullname[0] == '\0') { const char *tmp = getenv("TMPDIR"); if (tmp && BLI_is_dir(tmp)) { @@ -764,7 +764,7 @@ static void where_is_temp(char *fullname, char *basename, const size_t maxlen, c } } #endif - + if (fullname[0] == '\0') { BLI_strncpy(fullname, "/tmp/", maxlen); } diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 8dbfc35c774..ba45b5acb5d 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -632,17 +632,17 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB /* add extra rolls */ roll1 += bone->roll1 + (!rest ? pchan->roll1 : 0.0f); roll2 += bone->roll2 + (!rest ? pchan->roll2 : 0.0f); - + if (bone->flag & BONE_ADD_PARENT_END_ROLL) { if (prev) { if (prev->bone) roll1 += prev->bone->roll2; - + if (!rest) roll1 += prev->roll2; } } - + /* extra curve x / y */ /* NOTE: Scale correction factors here are to compensate for some random floating-point glitches * when scaling up the bone or it's parent by a factor of approximately 8.15/6, which results @@ -650,14 +650,14 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB */ const float xscale_correction = (do_scale) ? scale[0] : 1.0f; const float yscale_correction = (do_scale) ? scale[2] : 1.0f; - + h1[0] += (bone->curveInX + (!rest ? pchan->curveInX : 0.0f)) * xscale_correction; h1[2] += (bone->curveInY + (!rest ? pchan->curveInY : 0.0f)) * yscale_correction; - + h2[0] += (bone->curveOutX + (!rest ? pchan->curveOutX : 0.0f)) * xscale_correction; h2[2] += (bone->curveOutY + (!rest ? pchan->curveOutY : 0.0f)) * yscale_correction; } - + /* make curve */ if (bone->segments > MAX_BBONE_SUBDIV) bone->segments = MAX_BBONE_SUBDIV; @@ -673,39 +673,39 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB for (a = 0, fp = data[0]; a < bone->segments; a++, fp += 4) { sub_v3_v3v3(h1, fp + 4, fp); vec_roll_to_mat3(h1, fp[3], mat3); /* fp[3] is roll */ - + copy_m4_m3(result_array[a].mat, mat3); copy_v3_v3(result_array[a].mat[3], fp); - + if (do_scale) { /* correct for scaling when this matrix is used in scaled space */ mul_m4_series(result_array[a].mat, iscalemat, result_array[a].mat, scalemat); } - + /* BBone scale... */ { const int num_segments = bone->segments; - + const float scaleIn = bone->scaleIn * (!rest ? pchan->scaleIn : 1.0f); const float scaleFactorIn = 1.0f + (scaleIn - 1.0f) * ((float)(num_segments - a) / (float)num_segments); - + const float scaleOut = bone->scaleOut * (!rest ? pchan->scaleOut : 1.0f); const float scaleFactorOut = 1.0f + (scaleOut - 1.0f) * ((float)(a + 1) / (float)num_segments); - + const float scalefac = scaleFactorIn * scaleFactorOut; float bscalemat[4][4], bscale[3]; - + bscale[0] = scalefac; bscale[1] = 1.0f; bscale[2] = scalefac; - + size_to_mat4(bscalemat, bscale); - + /* Note: don't multiply by inverse scale mat here, as it causes problems with scaling shearing and breaking segment chains */ /*mul_m4_series(result_array[a].mat, ibscalemat, result_array[a].mat, bscalemat);*/ mul_m4_series(result_array[a].mat, result_array[a].mat, bscalemat); } - + } } @@ -764,10 +764,10 @@ static void b_bone_deform(bPoseChanDeform *pdef_info, Bone *bone, float co[3], D float (*mat)[4] = b_bone[0].mat; float segment, y; int a; - + /* need to transform co back to bonespace, only need y */ y = mat[0][1] * co[0] + mat[1][1] * co[1] + mat[2][1] * co[2] + mat[3][1]; - + /* now calculate which of the b_bones are deforming this */ segment = bone->length / ((float)bone->segments); a = (int)(y / segment); @@ -1811,7 +1811,7 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { pchanp = BKE_pose_channel_find_name(frompose, pchan->name); - + if (UNLIKELY(pchanp == NULL)) { /* happens for proxies that become invalid because of a missing link * for regular cases it shouldn't happen at all */ @@ -1819,7 +1819,7 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected else if (pchan->bone->layer & layer_protected) { ListBase proxylocal_constraints = {NULL, NULL}; bPoseChannel pchanw; - + /* copy posechannel to temp, but restore important pointers */ pchanw = *pchanp; pchanw.bone = pchan->bone; @@ -1835,13 +1835,13 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected /* this is freed so copy a copy, else undo crashes */ if (pchanw.prop) { pchanw.prop = IDP_CopyProperty(pchanw.prop); - + /* use the values from the existing props */ if (pchan->prop) { IDP_SyncGroupValues(pchanw.prop, pchan->prop); } } - + /* constraints - proxy constraints are flushed... local ones are added after * 1. extract constraints not from proxy (CONSTRAINT_PROXY_LOCAL) from pchan's constraints * 2. copy proxy-pchan's constraints on-to new @@ -1853,29 +1853,29 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected BKE_constraints_proxylocal_extract(&proxylocal_constraints, &pchan->constraints); BKE_constraints_copy(&pchanw.constraints, &pchanp->constraints, false); BLI_movelisttolist(&pchanw.constraints, &proxylocal_constraints); - + /* constraints - set target ob pointer to own object */ for (con = pchanw.constraints.first; con; con = con->next) { const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); ListBase targets = {NULL, NULL}; bConstraintTarget *ct; - + if (cti && cti->get_constraint_targets) { cti->get_constraint_targets(con, &targets); - + for (ct = targets.first; ct; ct = ct->next) { if (ct->tar == from) ct->tar = ob; } - + if (cti->flush_constraint_targets) cti->flush_constraint_targets(con, &targets, 0); } } - + /* free stuff from current channel */ BKE_pose_channel_free(pchan); - + /* copy data in temp back over to the cleaned-out (but still allocated) original channel */ *pchan = pchanw; if (pchan->custom) { diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c index ce99da87c74..628f92c7803 100644 --- a/source/blender/blenkernel/intern/armature_update.c +++ b/source/blender/blenkernel/intern/armature_update.c @@ -117,7 +117,7 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPos /* only happens on reload file, but violates depsgraph still... fix! */ if (ELEM(NULL, ikData->tar->curve_cache, ikData->tar->curve_cache->path, ikData->tar->curve_cache->path->data)) { BKE_displist_make_curveTypes(depsgraph, scene, ikData->tar, 0); - + /* path building may fail in EditMode after removing verts [#33268]*/ if (ELEM(NULL, ikData->tar->curve_cache->path, ikData->tar->curve_cache->path->data)) { /* BLI_assert(cu->path != NULL); */ @@ -427,21 +427,21 @@ static void splineik_evaluate_bone( { /* improved volume preservation based on the Stretch To constraint */ float final_scale; - + /* as the basis for volume preservation, we use the inverse scale factor... */ if (fabsf(scaleFac) != 0.0f) { /* NOTE: The method here is taken wholesale from the Stretch To constraint */ float bulge = powf(1.0f / fabsf(scaleFac), ikData->bulge); - + if (bulge > 1.0f) { if (ikData->flag & CONSTRAINT_SPLINEIK_USE_BULGE_MAX) { float bulge_max = max_ff(ikData->bulge_max, 1.0f); float hard = min_ff(bulge, bulge_max); - + float range = bulge_max - 1.0f; float scale = (range > 0.0f) ? 1.0f / range : 0.0f; float soft = 1.0f + range * atanf((bulge - 1.0f) * scale) / (float)M_PI_2; - + bulge = interpf(soft, hard, ikData->bulge_smooth); } } @@ -449,15 +449,15 @@ static void splineik_evaluate_bone( if (ikData->flag & CONSTRAINT_SPLINEIK_USE_BULGE_MIN) { float bulge_min = CLAMPIS(ikData->bulge_min, 0.0f, 1.0f); float hard = max_ff(bulge, bulge_min); - + float range = 1.0f - bulge_min; float scale = (range > 0.0f) ? 1.0f / range : 0.0f; float soft = 1.0f - range * atanf((1.0f - bulge) * scale) / (float)M_PI_2; - + bulge = interpf(soft, hard, ikData->bulge_smooth); } } - + /* compute scale factor for xz axes from this value */ final_scale = sqrtf(bulge); } @@ -465,7 +465,7 @@ static void splineik_evaluate_bone( /* no scaling, so scale factor is simple */ final_scale = 1.0f; } - + /* apply the scaling (assuming normalised scale) */ mul_v3_fl(poseMat[0], final_scale); mul_v3_fl(poseMat[2], final_scale); diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 1ec5b347168..006cf8275a7 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -90,14 +90,14 @@ void BKE_blender_free(void) } BKE_spacetypes_free(); /* after free main, it uses space callbacks */ - + IMB_exit(); BKE_cachefiles_exit(); BKE_images_exit(); DEG_free_node_types(); BKE_brush_system_exit(); - RE_texture_rng_exit(); + RE_texture_rng_exit(); BLI_callback_global_finalize(); @@ -122,7 +122,7 @@ void BKE_blender_version_string(char *version_str, size_t maxncpy, short version void BKE_blender_globals_init(void) { memset(&G, 0, sizeof(Global)); - + U.savetime = 1; G_MAIN = BKE_main_new(); @@ -325,7 +325,7 @@ int BKE_blender_test_break(void) if (blender_test_break_cb) blender_test_break_cb(); } - + return (G.is_break == true); } diff --git a/source/blender/blenkernel/intern/bmfont.c b/source/blender/blenkernel/intern/bmfont.c index 8018629ef2a..c99894bfbaf 100644 --- a/source/blender/blenkernel/intern/bmfont.c +++ b/source/blender/blenkernel/intern/bmfont.c @@ -71,7 +71,7 @@ void calcAlpha(ImBuf *ibuf) { int i; char *rect; - + if (ibuf) { rect = (char *) ibuf->rect; for (i = ibuf->x * ibuf->y; i > 0; i--) { @@ -86,21 +86,21 @@ void readBitmapFontVersion0(ImBuf *ibuf, unsigned char *rect, int step) int glyphcount, bytes, i, index, linelength, ysize; unsigned char *buffer; bmFont * bmfont; - + linelength = ibuf->x * step; - + glyphcount = (rect[6 * step] << 8) | rect[7 * step]; bytes = ((glyphcount - 1) * sizeof(bmGlyph)) + sizeof(bmFont); - + ysize = (bytes + (ibuf->x - 1)) / ibuf->x; - + if (ysize < ibuf->y) { /* we're first going to copy all data into a linear buffer. * step can be 4 or 1 bytes, and the data is not sequential because * the bitmap was flipped vertically. */ - + buffer = MEM_mallocN(bytes, "readBitmapFontVersion0:buffer"); - + index = 0; for (i = 0; i < bytes; i++) { buffer[i] = rect[index]; @@ -111,12 +111,12 @@ void readBitmapFontVersion0(ImBuf *ibuf, unsigned char *rect, int step) index -= linelength; } } - + /* we're now going to endian convert the data */ - + bmfont = MEM_mallocN(bytes, "readBitmapFontVersion0:bmfont"); index = 0; - + /* first read the header */ bmfont->magic[0] = buffer[index++]; bmfont->magic[1] = buffer[index++]; @@ -126,7 +126,7 @@ void readBitmapFontVersion0(ImBuf *ibuf, unsigned char *rect, int step) bmfont->glyphcount = (buffer[index] << 8) | buffer[index + 1]; index += 2; bmfont->xsize = (buffer[index] << 8) | buffer[index + 1]; index += 2; bmfont->ysize = (buffer[index] << 8) | buffer[index + 1]; index += 2; - + for (i = 0; i < bmfont->glyphcount; i++) { bmfont->glyphs[i].unicode = (buffer[index] << 8) | buffer[index + 1]; index += 2; bmfont->glyphs[i].locx = (buffer[index] << 8) | buffer[index + 1]; index += 2; @@ -141,9 +141,9 @@ void readBitmapFontVersion0(ImBuf *ibuf, unsigned char *rect, int step) printfGlyph(&bmfont->glyphs[i]); } } - + MEM_freeN(buffer); - + if (G.debug & G_DEBUG) { printf("Oldy = %d Newy = %d\n", ibuf->y, ibuf->y - ysize); printf("glyphcount = %d\n", glyphcount); @@ -173,7 +173,7 @@ void detectBitmapFont(ImBuf *ibuf) unsigned char *rect; unsigned short version; int i; - + if (ibuf != NULL && ibuf->rect != NULL) { /* bitmap must have an x size that is a power of two */ if (is_power_of_two(ibuf->x)) { @@ -215,7 +215,7 @@ void detectBitmapFont(ImBuf *ibuf) int locateGlyph(bmFont *bmfont, unsigned short unicode) { int min, max, current = 0; - + if (bmfont) { min = 0; max = bmfont->glyphcount; @@ -242,7 +242,7 @@ int locateGlyph(bmFont *bmfont, unsigned short unicode) } } } - + return(current); } @@ -256,19 +256,19 @@ void matrixGlyph( { int index; bmFont *bmfont; - + *centerx = *centery = 0.0; *sizex = *sizey = 1.0; *transx = *transy = 0.0; *movex = *movey = 0.0; *advance = 1.0; - + if (ibuf) { bmfont = ibuf->userdata; if (bmfont && (ibuf->userflags & IB_BITMAPFONT)) { index = locateGlyph(bmfont, unicode); if (index) { - + *sizex = (bmfont->glyphs[index].sizex) / (float) (bmfont->glyphs[0].sizex); *sizey = (bmfont->glyphs[index].sizey) / (float) (bmfont->glyphs[0].sizey); @@ -279,10 +279,10 @@ void matrixGlyph( *centery = (ibuf->y - bmfont->glyphs[0].locy) / (float) ibuf->y; /* 2.0 units is the default size of an object */ - + *movey = 1.0f - *sizey + 2.0f * (bmfont->glyphs[index].ofsy - bmfont->glyphs[0].ofsy) / (float) bmfont->glyphs[0].sizey; *movex = *sizex - 1.0f + 2.0f * (bmfont->glyphs[index].ofsx - bmfont->glyphs[0].ofsx) / (float) bmfont->glyphs[0].sizex; - + *advance = 2.0f * bmfont->glyphs[index].advance / (float) bmfont->glyphs[0].advance; // printfGlyph(&bmfont->glyphs[index]); diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index eb5cdd02fe5..8fdaf183b06 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -277,7 +277,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues * sub_v3_v3v3(loc, co1, co2); sub_v3_v3v3(vec, vel1, vel2); - + inp = dot_v3v3(vec, vec); /* velocities not parallel */ @@ -287,7 +287,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues * if (t > 0.0f && t < t_min) { madd_v3_v3fl(co1, vel1, t); madd_v3_v3fl(co2, vel2, t); - + sub_v3_v3v3(vec, co2, co1); len = normalize_v3(vec); @@ -327,7 +327,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues * sub_v3_v3v3(loc, co1, co2); sub_v3_v3v3(vec, vel1, vel2); - + inp = dot_v3v3(vec, vec); /* velocities not parallel */ @@ -337,7 +337,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues * if (t > 0.0f && t < t_min) { madd_v3_v3fl(co1, vel1, t); madd_v3_v3fl(co2, vel2, t); - + sub_v3_v3v3(vec, co2, co1); len = normalize_v3(vec); @@ -395,7 +395,7 @@ static int rule_separate(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues neighbors = BLI_kdtree_range_search( epsys->tree, pa->prev_state.co, &ptn, 2.0f * val->personal_space * pa->size); - + if (neighbors > 0 && ptn[0].dist < len) { sub_v3_v3v3(vec, pa->prev_state.co, ptn[0].co); mul_v3_fl(vec, (2.0f * val->personal_space * pa->size - ptn[0].dist) / ptn[1].dist); @@ -497,13 +497,13 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va sub_v3_v3v3(vec, flbr->loc, flbr->oloc); mul_v3_fl(vec, 1.0f/bbd->timestep); } - + /* fac is seconds behind leader */ madd_v3_v3fl(loc, vec, -flbr->distance); sub_v3_v3v3(bbd->wanted_co, loc, pa->prev_state.co); bbd->wanted_speed = len_v3(bbd->wanted_co); - + ret = 1; } else if (p % n) { @@ -560,13 +560,13 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va copy_v3_v3(vec, bbd->sim->psys->particles[p - p%n].prev_state.vel); copy_v3_v3(loc, bbd->sim->psys->particles[p - p%n].prev_state.co); } - + /* fac is seconds behind leader */ madd_v3_v3fl(loc, vec, -flbr->distance); sub_v3_v3v3(bbd->wanted_co, loc, pa->prev_state.co); bbd->wanted_speed = len_v3(bbd->wanted_co); - + ret = 1; } @@ -612,7 +612,7 @@ static int rule_average_speed(BoidRule *rule, BoidBrainData *bbd, BoidValues *va bbd->wanted_co[1] = 2.0f*(0.5f - BLI_rng_get_float(bbd->rng)); bbd->wanted_co[2] = 2.0f*(0.5f - BLI_rng_get_float(bbd->rng)); } - + /* leveling */ if (asbr->level > 0.0f && psys_uses_gravity(bbd->sim)) { project_v3_v3v3(vec, bbd->wanted_co, bbd->sim->scene->physics_settings.gravity); @@ -622,7 +622,7 @@ static int rule_average_speed(BoidRule *rule, BoidBrainData *bbd, BoidValues *va } bbd->wanted_speed = asbr->speed * val->max_speed; - + return 1; } static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, ParticleData *pa) @@ -662,7 +662,7 @@ static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti neighbors = BLI_kdtree_range_search( epsys->tree, pa->prev_state.co, &ptn, fbr->distance); - + health = 0.0f; for (n=0; n<neighbors; n++) { @@ -776,7 +776,7 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float grou if (bpa->data.mode == eBoidMode_Climbing) { SurfaceModifierData *surmd = NULL; float x[3], v[3]; - + surmd = (SurfaceModifierData *)modifiers_findByType(bpa->ground, eModifierType_Surface ); /* take surface velocity into account */ @@ -869,10 +869,10 @@ static int boid_rule_applies(ParticleData *pa, BoidSettings *UNUSED(boids), Boid if (rule==NULL) return 0; - + if (ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing) && rule->flag & BOIDRULE_ON_LAND) return 1; - + if (bpa->data.mode==eBoidMode_InAir && rule->flag & BOIDRULE_IN_AIR) return 1; @@ -1050,7 +1050,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa) if (bpa->data.mode == eBoidMode_OnLand) { /* fuzziness makes boids capable of misjudgement */ float mul = 1.0f + state->rule_fuzziness; - + if (boids->options & BOID_ALLOW_FLIGHT && bbd->wanted_co[2] > 0.0f) { float cvel[3], dir[3]; @@ -1166,7 +1166,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) /* auto-leveling & landing if close to ground */ bpa->ground = boid_find_ground(bbd, pa, ground_co, ground_nor); - + /* level = how many particle sizes above ground */ level = (pa->prev_state.co[2] - ground_co[2])/(2.0f * pa->size) - 0.5f; @@ -1227,7 +1227,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) /* constrain speed with maximum acceleration */ old_speed = len_v3(pa->prev_state.vel); - + if (bbd->wanted_speed < old_speed) new_speed = MAX2(bbd->wanted_speed, old_speed - val.max_acc); else @@ -1274,7 +1274,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) mul_v3_fl(force, length); } - + add_v3_v3(acc, force); /* store smoothed acceleration for nice banking etc. */ @@ -1289,7 +1289,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) copy_v3_v3(dvec, acc); mul_v3_fl(dvec, dtime*dtime*0.5f); - + copy_v3_v3(bvec, pa->prev_state.vel); mul_v3_fl(bvec, dtime); add_v3_v3(dvec, bvec); @@ -1468,7 +1468,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) } negate_v3(mat[2]); cross_v3_v3v3(mat[1], mat[2], mat[0]); - + /* apply rotation */ mat3_to_quat_is_ok(q, mat); copy_qt_qt(pa->state.rot, q); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 7f50e521e63..42cd7968321 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -271,7 +271,7 @@ void BKE_brush_debug_print_state(Brush *br) /* create a fake brush and set it to the defaults */ Brush def = {{NULL}}; brush_defaults(&def); - + #define BR_TEST(field, t) \ if (br->field != def.field) \ printf("br->" #field " = %" #t ";\n", br->field) @@ -281,7 +281,7 @@ void BKE_brush_debug_print_state(Brush *br) printf("br->flag |= " #_f ";\n"); \ else if (!(br->flag & _f) && (def.flag & _f)) \ printf("br->flag &= ~" #_f ";\n") - + #define BR_TEST_FLAG_OVERLAY(_f) \ if ((br->overlay_flags & _f) && !(def.overlay_flags & _f)) \ printf("br->overlay_flags |= " #_f ";\n"); \ @@ -355,7 +355,7 @@ void BKE_brush_debug_print_state(Brush *br) BR_TEST(sub_col[2], f); printf("\n"); - + #undef BR_TEST #undef BR_TEST_FLAG } @@ -757,7 +757,7 @@ int BKE_brush_size_get(const Scene *scene, const Brush *brush) { UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; int size = (ups->flag & UNIFIED_PAINT_SIZE) ? ups->size : brush->size; - + return size; } diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index e8328139d64..1a7c4e2a4a0 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -79,7 +79,7 @@ float bvhtree_sphereray_tri_intersection( const BVHTreeRay *ray, float radius, const float m_dist, const float v0[3], const float v1[3], const float v2[3]) { - + float idist; float p1[3]; float hit_point[3]; @@ -110,7 +110,7 @@ static void mesh_faces_nearest_point(void *userdata, int index, const float co[3 t2 = vert[face->v3].co; t3 = face->v4 ? vert[face->v4].co : NULL; - + do { float nearest_tmp[3], dist_sq; @@ -194,7 +194,7 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r t2 = vert[face->v3].co; t3 = face->v4 ? vert[face->v4].co : NULL; - + do { float dist; if (ray->radius == 0.0f) @@ -287,7 +287,7 @@ static void mesh_edges_nearest_point(void *userdata, int index, const float co[3 closest_to_line_segment_v3(nearest_tmp, co, t0, t1); dist_sq = len_squared_v3v3(nearest_tmp, co); - + if (dist_sq < nearest->dist_sq) { nearest->index = index; nearest->dist_sq = dist_sq; diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index b1b4f18a6d5..d1ab559515b 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -161,7 +161,7 @@ void BKE_camera_object_mode(RenderData *rd, Object *cam_ob) /* get the camera's dof value, takes the dof object into account */ float BKE_camera_object_dof_distance(Object *ob) { - Camera *cam = (Camera *)ob->data; + Camera *cam = (Camera *)ob->data; if (ob->type != OB_CAMERA) return 0.0f; if (cam->dof_ob) { diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 7bcc05b0e37..72a1f941c26 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -284,7 +284,7 @@ static PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm) pbvh_show_diffuse_color_set(cddm->pbvh, ob->sculpt->show_diffuse_color); pbvh_show_mask_set(cddm->pbvh, ob->sculpt->show_mask); } - + /* always build pbvh from original mesh, and only use it for drawing if * this derivedmesh is just original mesh. it's the multires subsurf dm @@ -305,7 +305,7 @@ static PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm) me->mvert, me->totloop, me->totpoly, looptri); - + BKE_pbvh_build_mesh( cddm->pbvh, me->mpoly, me->mloop, @@ -434,7 +434,7 @@ static void cdDM_foreachMappedFaceCenter( else { orig = i; } - + ml = &cddm->mloop[mp->loopstart]; BKE_mesh_calc_poly_center(mp, ml, mvert, cent); @@ -723,7 +723,7 @@ static void loops_to_customdata_corners( for (i = 0; i < numUV; i++) { texface = CustomData_get_n(facedata, CD_MTFACE, cdindex, i); - + for (j = 0; j < 3; j++) { l = l3[j]; mloopuv = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPUV, i); @@ -733,7 +733,7 @@ static void loops_to_customdata_corners( for (i = 0; i < numCol; i++) { mcol = CustomData_get_n(facedata, CD_MCOL, cdindex, i); - + for (j = 0; j < 3; j++) { l = l3[j]; mloopcol = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPCOL, i); @@ -780,18 +780,18 @@ static DerivedMesh *cddm_from_bmesh_ex( int *index, add_orig; CustomDataMask mask; unsigned int i, j; - + const int cd_vert_bweight_offset = CustomData_get_offset(&bm->vdata, CD_BWEIGHT); const int cd_edge_bweight_offset = CustomData_get_offset(&bm->edata, CD_BWEIGHT); const int cd_edge_crease_offset = CustomData_get_offset(&bm->edata, CD_CREASE); - + dm->deformedOnly = 1; - + /* don't add origindex layer if one already exists */ add_orig = !CustomData_has_layer(&bm->pdata, CD_ORIGINDEX); mask = use_mdisps ? CD_MASK_DERIVEDMESH | CD_MASK_MDISPS : CD_MASK_DERIVEDMESH; - + /* don't process shapekeys, we only feed them through the modifier stack as needed, * e.g. for applying modifiers or the like*/ mask &= ~CD_MASK_SHAPEKEY; @@ -882,7 +882,7 @@ static DerivedMesh *cddm_from_bmesh_ex( test_index_face(mf, &dm->faceData, i, 3); } } - + index = CustomData_get_layer(&dm->polyData, CD_ORIGINDEX); j = 0; BM_ITER_MESH_INDEX (efa, &iter, bm, BM_FACES_OF_MESH, i) { @@ -1585,7 +1585,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int newv[i] = 0; } } - + /* now link target vertices to destination indices */ for (i = 0; i < totvert; i++) { if (vtargetmap[i] != -1) { @@ -1622,7 +1622,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int newe[i] = -1; } } - + if (merge_mode == CDDM_MERGE_VERTS_DUMP_IF_EQUAL) { /* In this mode, we need to determine, whenever a poly' vertices are all mapped */ /* if the targets already make up a poly, in which case the new poly is dropped */ @@ -1663,7 +1663,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int mv = cddm->mvert; for (i = 0; i < totpoly; i++, mp++) { MPoly *mp_new; - + ml = cddm->mloop + mp->loopstart; /* check faces with all vertices merged */ @@ -1867,7 +1867,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int mp_new->totloop = c; BLI_assert(mp_new->totloop >= 3); mp_new->loopstart = STACK_SIZE(mloop) - c; - + STACK_PUSH(oldp, i); } /* end of the loop that tests polys */ @@ -1878,11 +1878,11 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int BLI_gset_free(poly_gset, NULL); MEM_freeN(poly_keys); } - + /*create new cddm*/ cddm2 = (CDDerivedMesh *)CDDM_from_template( (DerivedMesh *)cddm, STACK_SIZE(mvert), STACK_SIZE(medge), 0, STACK_SIZE(mloop), STACK_SIZE(mpoly)); - + /*update edge indices and copy customdata*/ med = medge; for (i = 0; i < cddm2->dm.numEdgeData; i++, med++) { @@ -1896,7 +1896,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int CustomData_copy_data(&dm->edgeData, &cddm2->dm.edgeData, olde[i], i, 1); } - + /*update loop indices and copy customdata*/ ml = mloop; for (i = 0; i < cddm2->dm.numLoopData; i++, ml++) { @@ -1906,19 +1906,19 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int CustomData_copy_data(&dm->loopData, &cddm2->dm.loopData, oldl[i], i, 1); } - + /*copy vertex customdata*/ mv = mvert; for (i = 0; i < cddm2->dm.numVertData; i++, mv++) { CustomData_copy_data(&dm->vertData, &cddm2->dm.vertData, oldv[i], i, 1); } - + /*copy poly customdata*/ mp = mpoly; for (i = 0; i < cddm2->dm.numPolyData; i++, mp++) { CustomData_copy_data(&dm->polyData, &cddm2->dm.polyData, oldp[i], i, 1); } - + /*copy over data. CustomData_add_layer can do this, need to look it up.*/ memcpy(cddm2->mvert, mvert, sizeof(MVert) * STACK_SIZE(mvert)); memcpy(cddm2->medge, medge, sizeof(MEdge) * STACK_SIZE(medge)); @@ -1946,7 +1946,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int /*free old derivedmesh*/ dm->needsFree = 1; dm->release(dm); - + return (DerivedMesh *)cddm2; } #endif @@ -1966,7 +1966,7 @@ void CDDM_calc_edges_tessface(DerivedMesh *dm) for (i = 0; i < numFaces; i++, mf++) { BLI_edgeset_add(eh, mf->v1, mf->v2); BLI_edgeset_add(eh, mf->v2, mf->v3); - + if (mf->v4) { BLI_edgeset_add(eh, mf->v3, mf->v4); BLI_edgeset_add(eh, mf->v4, mf->v1); @@ -2212,7 +2212,7 @@ void CDDM_tessfaces_to_faces(DerivedMesh *dm) void CDDM_set_mvert(DerivedMesh *dm, MVert *mvert) { CDDerivedMesh *cddm = (CDDerivedMesh *)dm; - + if (!CustomData_has_layer(&dm->vertData, CD_MVERT)) CustomData_add_layer(&dm->vertData, CD_MVERT, CD_ASSIGN, mvert, dm->numVertData); diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index cc1c7260cbc..c5d9472ca4b 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -80,7 +80,7 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, Mesh *mesh ); * 2. fill object with standard values or with the GUI settings if given */ void cloth_init(ClothModifierData *clmd ) -{ +{ /* Initialize our new data structure to reasonable values. */ clmd->sim_parms->gravity[0] = 0.0; clmd->sim_parms->gravity[1] = 0.0; @@ -91,7 +91,7 @@ void cloth_init(ClothModifierData *clmd ) clmd->sim_parms->bending = 0.5; clmd->sim_parms->max_bend = 0.5; clmd->sim_parms->bending_damping = 0.5; - clmd->sim_parms->Cdis = 5.0; + clmd->sim_parms->Cdis = 5.0; clmd->sim_parms->Cvi = 1.0; clmd->sim_parms->mass = 0.3f; clmd->sim_parms->stepsPerFrame = 5; @@ -107,7 +107,7 @@ void cloth_init(ClothModifierData *clmd ) clmd->sim_parms->time_scale = 1.0f; /* multiplies cloth speed */ clmd->sim_parms->reset = 0; clmd->sim_parms->vel_damping = 1.0f; /* 1.0 = no damping, 0.0 = fully dampened */ - + clmd->coll_parms->self_friction = 5.0; clmd->coll_parms->friction = 5.0; clmd->coll_parms->loop_count = 2; @@ -155,27 +155,27 @@ static BVHTree *bvhselftree_build_from_cloth (ClothModifierData *clmd, float eps if (!cloth) return NULL; - + verts = cloth->verts; - + /* in the moment, return zero if no faces there */ if (!cloth->mvert_num) return NULL; - + /* create quadtree with k=26 */ bvhtree = BLI_bvhtree_new(cloth->mvert_num, epsilon, 4, 6); - + /* fill tree */ for (i = 0; i < cloth->mvert_num; i++, verts++) { const float *co; co = verts->xold; - + BLI_bvhtree_insert(bvhtree, i, co, 1); } - + /* balance tree */ BLI_bvhtree_balance(bvhtree); - + return bvhtree; } @@ -194,10 +194,10 @@ static BVHTree *bvhtree_build_from_cloth (ClothModifierData *clmd, float epsilon if (!cloth) return NULL; - + verts = cloth->verts; vt = cloth->tri; - + /* in the moment, return zero if no faces there */ if (!cloth->tri_num) return NULL; @@ -218,23 +218,23 @@ static BVHTree *bvhtree_build_from_cloth (ClothModifierData *clmd, float epsilon /* balance tree */ BLI_bvhtree_balance(bvhtree); - + return bvhtree; } void bvhtree_update_from_cloth(ClothModifierData *clmd, bool moving) -{ +{ unsigned int i = 0; Cloth *cloth = clmd->clothObject; BVHTree *bvhtree = cloth->bvhtree; ClothVertex *verts = cloth->verts; const MVertTri *vt; - + if (!bvhtree) return; - + vt = cloth->tri; - + /* update vertex position in bvh tree */ if (verts && vt) { for (i = 0; i < cloth->tri_num; i++, vt++) { @@ -257,25 +257,25 @@ void bvhtree_update_from_cloth(ClothModifierData *clmd, bool moving) else { ret = BLI_bvhtree_update_node(bvhtree, i, co[0], NULL, 3); } - + /* check if tree is already full */ if (ret == false) { break; } } - + BLI_bvhtree_update_tree(bvhtree); } } void bvhselftree_update_from_cloth(ClothModifierData *clmd, bool moving) -{ +{ unsigned int i = 0; Cloth *cloth = clmd->clothObject; BVHTree *bvhtree = cloth->bvhselftree; ClothVertex *verts = cloth->verts; const MVertTri *vt; - + if (!bvhtree) return; @@ -304,7 +304,7 @@ void bvhselftree_update_from_cloth(ClothModifierData *clmd, bool moving) break; } } - + BLI_bvhtree_update_tree(bvhtree); } } @@ -312,13 +312,13 @@ void bvhselftree_update_from_cloth(ClothModifierData *clmd, bool moving) void cloth_clear_cache(Object *ob, ClothModifierData *clmd, float framenr) { PTCacheID pid; - + BKE_ptcache_id_from_cloth(&pid, ob, clmd); // don't do anything as long as we're in editmode! if (pid.cache->edit && ob->mode & OB_MODE_PARTICLE_EDIT) return; - + BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_AFTER, framenr); } @@ -335,13 +335,13 @@ static int do_init_cloth(Object *ob, ClothModifierData *clmd, Mesh *result, int modifier_setError(&(clmd->modifier), "Can't initialize cloth"); return 0; } - + if (clmd->clothObject == NULL) { BKE_ptcache_invalidate(cache); modifier_setError(&(clmd->modifier), "Null cloth object"); return 0; } - + BKE_cloth_solver_set_positions(clmd); clmd->clothObject->last_frame= MINFRAME-1; @@ -387,7 +387,7 @@ static int do_step_cloth(struct Depsgraph *depsgraph, Object *ob, ClothModifierD cloth_update_spring_lengths ( clmd, result ); cloth_update_springs( clmd ); - + // TIMEIT_START(cloth_step) /* call the solver. */ @@ -398,7 +398,7 @@ static int do_step_cloth(struct Depsgraph *depsgraph, Object *ob, ClothModifierD pdEndEffectors(&effectors); // printf ( "%f\n", ( float ) tval() ); - + return ret; } @@ -429,7 +429,7 @@ void clothModifier_do(ClothModifierData *clmd, struct Depsgraph *depsgraph, Scen cache->last_exact= 0; cache->flag &= ~PTCACHE_REDO_NEEDED; } - + // unused in the moment, calculated separately in implicit.c clmd->sim_parms->dt = clmd->sim_parms->timescale / clmd->sim_parms->stepsPerFrame; @@ -507,13 +507,13 @@ void clothModifier_do(ClothModifierData *clmd, struct Depsgraph *depsgraph, Scen void cloth_free_modifier(ClothModifierData *clmd ) { Cloth *cloth = NULL; - + if ( !clmd ) return; cloth = clmd->clothObject; - + if ( cloth ) { BPH_cloth_solver_free(clmd); @@ -529,12 +529,12 @@ void cloth_free_modifier(ClothModifierData *clmd ) LinkNode *search = cloth->springs; while (search) { ClothSpring *spring = search->link; - + MEM_freeN ( spring ); search = search->next; } BLI_linklist_free(cloth->springs, NULL); - + cloth->springs = NULL; } @@ -544,7 +544,7 @@ void cloth_free_modifier(ClothModifierData *clmd ) // free BVH collision tree if ( cloth->bvhtree ) BLI_bvhtree_free ( cloth->bvhtree ); - + if ( cloth->bvhselftree ) BLI_bvhtree_free ( cloth->bvhselftree ); @@ -554,8 +554,8 @@ void cloth_free_modifier(ClothModifierData *clmd ) if (cloth->edgeset) BLI_edgeset_free(cloth->edgeset); - - + + /* if (clmd->clothObject->facemarks) MEM_freeN(clmd->clothObject->facemarks); @@ -571,12 +571,12 @@ void cloth_free_modifier_extern(ClothModifierData *clmd ) Cloth *cloth = NULL; if (G.debug_value > 0) printf("cloth_free_modifier_extern\n"); - + if ( !clmd ) return; cloth = clmd->clothObject; - + if ( cloth ) { if (G.debug_value > 0) printf("cloth_free_modifier_extern in\n"); @@ -610,7 +610,7 @@ void cloth_free_modifier_extern(ClothModifierData *clmd ) // free BVH collision tree if ( cloth->bvhtree ) BLI_bvhtree_free ( cloth->bvhtree ); - + if ( cloth->bvhselftree ) BLI_bvhtree_free ( cloth->bvhselftree ); @@ -660,11 +660,11 @@ static void cloth_to_object (Object *ob, ClothModifierData *clmd, float (*verte int cloth_uses_vgroup(ClothModifierData *clmd) { - return (((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING ) || + return (((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING ) || (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL ) || (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SEW) || - (clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_SELF)) && - ((clmd->sim_parms->vgroup_mass>0) || + (clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_SELF)) && + ((clmd->sim_parms->vgroup_mass>0) || (clmd->sim_parms->vgroup_struct>0)|| (clmd->sim_parms->vgroup_bend>0) || (clmd->sim_parms->vgroup_shrink>0) || @@ -693,7 +693,7 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, Mesh *mesh ) mvert_num = mesh->totvert; verts = clothObj->verts; - + if (cloth_uses_vgroup(clmd)) { for (i = 0; i < mvert_num; i++, verts++) { @@ -717,21 +717,21 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, Mesh *mesh ) verts->goal = dvert->dw [j].weight; /* goalfac= 1.0f; */ /* UNUSED */ - + // Kicking goal factor to simplify things...who uses that anyway? // ABS ( clmd->sim_parms->maxgoal - clmd->sim_parms->mingoal ); - + verts->goal = pow4f(verts->goal); if ( verts->goal >= SOFTGOALSNAP ) verts->flags |= CLOTH_VERT_FLAG_PINNED; } - + if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING ) { if ( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_struct-1)) { verts->struct_stiff = dvert->dw [j].weight; verts->shear_stiff = dvert->dw [j].weight; } - + if ( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_bend-1)) { verts->bend_stiff = dvert->dw [j].weight; } @@ -786,7 +786,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, Mesh *mesh, fl Cloth *cloth = NULL; float maxdist = 0; - // If we have a clothObject, free it. + // If we have a clothObject, free it. if ( clmd->clothObject != NULL ) { cloth_free_modifier ( clmd ); if (G.debug_value > 0) @@ -837,9 +837,9 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, Mesh *mesh, fl else copy_v3_v3(verts->xrest, verts->x); } - + /* no GUI interface yet */ - verts->mass = clmd->sim_parms->mass; + verts->mass = clmd->sim_parms->mass; verts->impulse_count = 0; if ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL ) @@ -859,7 +859,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, Mesh *mesh, fl verts->impulse_count = 0; copy_v3_v3 ( verts->impulse, tnull ); } - + // apply / set vertex groups // has to be happen before springs are build! cloth_apply_vgroup (clmd, mesh); @@ -870,19 +870,19 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, Mesh *mesh, fl printf("cloth_free_modifier cloth_build_springs\n"); return 0; } - + // init our solver BPH_cloth_solver_init(ob, clmd); - + if (!first) BKE_cloth_solver_set_positions(clmd); clmd->clothObject->bvhtree = bvhtree_build_from_cloth ( clmd, MAX2(clmd->coll_parms->epsilon, clmd->coll_parms->distance_repel) ); - + for (i = 0; i < mesh->totvert; i++) { maxdist = MAX2(maxdist, clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len*2.0f)); } - + clmd->clothObject->bvhselftree = bvhselftree_build_from_cloth ( clmd, maxdist ); return 1; @@ -958,17 +958,17 @@ static void cloth_free_errorsprings(Cloth *cloth, LinkNodePair *edgelist) LinkNode *search = cloth->springs; while (search) { ClothSpring *spring = search->link; - + MEM_freeN ( spring ); search = search->next; } BLI_linklist_free(cloth->springs, NULL); - + cloth->springs = NULL; } cloth_free_edgelist(edgelist, cloth->mvert_num); - + if (cloth->edgeset) { BLI_edgeset_free(cloth->edgeset); cloth->edgeset = NULL; @@ -981,10 +981,10 @@ static void cloth_hair_update_bending_targets(ClothModifierData *clmd) LinkNode *search = NULL; float hair_frame[3][3], dir_old[3], dir_new[3]; int prev_mn; /* to find hair chains */ - + if (!clmd->hairdata) return; - + /* XXX Note: we need to propagate frames from the root up, * but structural hair springs are stored in reverse order. * The bending springs however are then inserted in the same @@ -992,17 +992,17 @@ static void cloth_hair_update_bending_targets(ClothModifierData *clmd) * This messy situation can be resolved when solver data is * generated directly from a dedicated hair system. */ - + prev_mn = -1; for (search = cloth->springs; search; search = search->next) { ClothSpring *spring = search->link; ClothHairData *hair_ij, *hair_kl; bool is_root = spring->kl != prev_mn; - + if (spring->type != CLOTH_SPRING_TYPE_BENDING_ANG) { continue; } - + hair_ij = &clmd->hairdata[spring->ij]; hair_kl = &clmd->hairdata[spring->kl]; if (is_root) { @@ -1013,39 +1013,39 @@ static void cloth_hair_update_bending_targets(ClothModifierData *clmd) */ copy_v3_v3(dir_new, hair_frame[2]); } - + copy_v3_v3(dir_old, dir_new); sub_v3_v3v3(dir_new, cloth->verts[spring->mn].x, cloth->verts[spring->kl].x); normalize_v3(dir_new); - + #if 0 if (clmd->debug_data && (spring->ij == 0 || spring->ij == 1)) { float a[3], b[3]; - + copy_v3_v3(a, cloth->verts[spring->kl].x); // BKE_sim_debug_data_add_dot(clmd->debug_data, cloth_vert ? cloth_vert->x : key->co, 1, 1, 0, "frames", 8246, p, k); - + mul_v3_v3fl(b, hair_frame[0], clmd->sim_parms->avg_spring_len); BKE_sim_debug_data_add_vector(clmd->debug_data, a, b, 1, 0, 0, "frames", 8247, spring->kl, spring->mn); - + mul_v3_v3fl(b, hair_frame[1], clmd->sim_parms->avg_spring_len); BKE_sim_debug_data_add_vector(clmd->debug_data, a, b, 0, 1, 0, "frames", 8248, spring->kl, spring->mn); - + mul_v3_v3fl(b, hair_frame[2], clmd->sim_parms->avg_spring_len); BKE_sim_debug_data_add_vector(clmd->debug_data, a, b, 0, 0, 1, "frames", 8249, spring->kl, spring->mn); } #endif - + /* get local targets for kl/mn vertices by putting rest targets into the current frame, * then multiply with the rest length to get the actual goals */ - + mul_v3_m3v3(spring->target, hair_frame, hair_kl->rest_target); mul_v3_fl(spring->target, spring->restlen); - + /* move frame to next hair segment */ cloth_parallel_transport_hair_frame(hair_frame, dir_old, dir_new); - + prev_mn = spring->mn; } } @@ -1056,10 +1056,10 @@ static void cloth_hair_update_bending_rest_targets(ClothModifierData *clmd) LinkNode *search = NULL; float hair_frame[3][3], dir_old[3], dir_new[3]; int prev_mn; /* to find hair roots */ - + if (!clmd->hairdata) return; - + /* XXX Note: we need to propagate frames from the root up, * but structural hair springs are stored in reverse order. * The bending springs however are then inserted in the same @@ -1067,17 +1067,17 @@ static void cloth_hair_update_bending_rest_targets(ClothModifierData *clmd) * This messy situation can be resolved when solver data is * generated directly from a dedicated hair system. */ - + prev_mn = -1; for (search = cloth->springs; search; search = search->next) { ClothSpring *spring = search->link; ClothHairData *hair_ij, *hair_kl; bool is_root = spring->kl != prev_mn; - + if (spring->type != CLOTH_SPRING_TYPE_BENDING_ANG) { continue; } - + hair_ij = &clmd->hairdata[spring->ij]; hair_kl = &clmd->hairdata[spring->kl]; if (is_root) { @@ -1088,18 +1088,18 @@ static void cloth_hair_update_bending_rest_targets(ClothModifierData *clmd) */ copy_v3_v3(dir_new, hair_frame[2]); } - + copy_v3_v3(dir_old, dir_new); sub_v3_v3v3(dir_new, cloth->verts[spring->mn].xrest, cloth->verts[spring->kl].xrest); normalize_v3(dir_new); - + /* dir expressed in the hair frame defines the rest target direction */ copy_v3_v3(hair_kl->rest_target, dir_new); mul_transposed_m3_v3(hair_frame, hair_kl->rest_target); - + /* move frame to next hair segment */ cloth_parallel_transport_hair_frame(hair_frame, dir_old, dir_new); - + prev_mn = spring->mn; } } @@ -1148,10 +1148,10 @@ static void cloth_update_springs( ClothModifierData *clmd ) spring->flags |= CLOTH_SPRING_FLAG_DEACTIVATE; } } - + search = search->next; } - + cloth_hair_update_bending_targets(clmd); } @@ -1243,10 +1243,10 @@ BLI_INLINE void madd_m3_m3fl(float r[3][3], float m[3][3], float f) void cloth_parallel_transport_hair_frame(float mat[3][3], const float dir_old[3], const float dir_new[3]) { float rot[3][3]; - + /* rotation between segments */ rotation_between_vecs_to_mat3(rot, dir_old, dir_new); - + /* rotate the frame */ mul_m3_m3m3(mat, rot, mat); } @@ -1268,7 +1268,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, Mesh *mesh ) LinkNodePair *edgelist; EdgeSet *edgeset = NULL; LinkNode *search = NULL, *search2 = NULL; - + // error handling if ( numedges==0 ) return 0; @@ -1282,7 +1282,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, Mesh *mesh ) cloth->edgeset = NULL; edgelist = MEM_callocN(sizeof(*edgelist) * mvert_num, "cloth_edgelist_alloc" ); - + if (!edgelist) return 0; @@ -1314,7 +1314,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, Mesh *mesh ) spring->flags = 0; struct_springs++; - + BLI_linklist_prepend ( &cloth->springs, spring ); } else { @@ -1325,7 +1325,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, Mesh *mesh ) if (struct_springs_real > 0) clmd->sim_parms->avg_spring_len /= struct_springs_real; - + for (i = 0; i < mvert_num; i++) { if (cloth->verts[i].spring_count > 0) cloth->verts[i].avg_spring_len = cloth->verts[i].avg_spring_len * 0.49f / ((float)cloth->verts[i].spring_count); @@ -1415,15 +1415,15 @@ static int cloth_build_springs ( ClothModifierData *clmd, Mesh *mesh ) while (search && search2) { tspring = search->link; tspring2 = search2->link; - + if (tspring->ij == tspring2->kl) { spring = (ClothSpring *)MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" ); - + if (!spring) { cloth_free_errorsprings(cloth, edgelist); return 0; } - + spring->ij = tspring2->ij; spring->kl = tspring->ij; spring->mn = tspring->kl; @@ -1431,10 +1431,10 @@ static int cloth_build_springs ( ClothModifierData *clmd, Mesh *mesh ) spring->type = CLOTH_SPRING_TYPE_BENDING_ANG; spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0f; bend_springs++; - + BLI_linklist_prepend ( &cloth->springs, spring ); } - + search = search->next; search2 = search2->next; } @@ -1452,33 +1452,33 @@ static int cloth_build_springs ( ClothModifierData *clmd, Mesh *mesh ) while (search && search2) { tspring = search->link; tspring2 = search2->link; - + if (tspring->ij == tspring2->kl) { spring = (ClothSpring *)MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" ); - + if (!spring) { cloth_free_errorsprings(cloth, edgelist); return 0; } - + spring->ij = tspring2->ij; spring->kl = tspring->kl; spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest); spring->type = CLOTH_SPRING_TYPE_BENDING; spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0f; bend_springs++; - + BLI_linklist_prepend ( &cloth->springs, spring ); } - + search = search->next; search2 = search2->next; } } - + cloth_hair_update_bending_rest_targets(clmd); } - + /* note: the edges may already exist so run reinsert */ /* insert other near springs in edgeset AFTER bending springs are calculated (for selfcolls) */ @@ -1492,10 +1492,10 @@ static int cloth_build_springs ( ClothModifierData *clmd, Mesh *mesh ) BLI_edgeset_add(edgeset, mloop[mpoly[i].loopstart + 1].v, mloop[mpoly[i].loopstart + 3].v); } } - - + + cloth->numsprings = struct_springs + shear_springs + bend_springs; - + cloth_free_edgelist(edgelist, mvert_num); #if 0 diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index b23b1b2dbed..38cb1a1de16 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -446,7 +446,7 @@ static CollPair* cloth_collision(ModifierData *md1, ModifierData *md2, float v1[3], v2[3], relativeVelocity[3]; // calc relative velocity - + // compute barycentric coordinates for both collision points collision_compute_barycentric ( collpair->pa, verts1[collpair->ap1].txold, @@ -489,14 +489,14 @@ static void add_collision_object(Object ***objs, unsigned int *numobj, unsigned /* only get objects with collision modifier */ if (((modifier_type == eModifierType_Collision) && ob->pd && ob->pd->deflect) || (modifier_type != eModifierType_Collision)) cmd= (CollisionModifierData *)modifiers_findByType(ob, modifier_type); - + if (cmd) { /* extend array */ if (*numobj >= *maxobj) { *maxobj *= 2; *objs= MEM_reallocN(*objs, sizeof(Object *)*(*maxobj)); } - + (*objs)[*numobj] = ob; (*numobj)++; } @@ -515,13 +515,13 @@ static void add_collision_object(Object ***objs, unsigned int *numobj, unsigned } // return all collision objects in scene -// collision object will exclude self +// collision object will exclude self Object **get_collisionobjects_ext(Scene *scene, Object *self, Collection *collection, unsigned int *numcollobj, unsigned int modifier_type, bool dupli) { Object **objs; unsigned int numobj= 0, maxobj= 100; int level = dupli ? 0 : 1; - + objs= MEM_callocN(sizeof(Object *)*maxobj, "CollisionObjectsArray"); /* gather all collision objects */ @@ -566,7 +566,7 @@ static void add_collider_cache_object(ListBase **objs, Object *ob, Object *self, if (ob->pd && ob->pd->deflect) cmd =(CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision); - + if (cmd && cmd->bvhtree) { if (*objs == NULL) *objs = MEM_callocN(sizeof(ListBase), "ColliderCache array"); @@ -595,7 +595,7 @@ static void add_collider_cache_object(ListBase **objs, Object *ob, Object *self, ListBase *get_collider_cache(Scene *scene, Object *self, Collection *collection) { ListBase *objs= NULL; - + /* add object in same layer in scene */ if (collection) { FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(collection, object) @@ -633,7 +633,7 @@ static void cloth_bvh_objcollisions_nearcheck ( ClothModifierData * clmd, Collis CollPair **collisions, CollPair **collisions_index, int numresult, BVHTreeOverlap *overlap, double dt) { int i; - + *collisions = (CollPair *) MEM_mallocN(sizeof(CollPair) * numresult * 4, "collision array" ); // * 4 since cloth_collision_static can return more than 1 collision *collisions_index = *collisions; @@ -650,10 +650,10 @@ static int cloth_bvh_objcollisions_resolve ( ClothModifierData * clmd, Collision ClothVertex *verts = NULL; int ret = 0; int result = 0; - + mvert_num = clmd->clothObject->mvert_num; verts = cloth->verts; - + // process all collisions (calculate impulses, TODO: also repulses if distance too short) result = 1; for ( j = 0; j < 2; j++ ) { /* 5 is just a value that ensures convergence */ @@ -699,7 +699,7 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_COLLOBJ) || cloth_bvh==NULL) return 0; - + verts = cloth->verts; /* numfaces = cloth->numfaces; */ /* UNUSED */ mvert_num = cloth->mvert_num; @@ -711,9 +711,9 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa // update cloth bvh bvhtree_update_from_cloth ( clmd, 1 ); // 0 means STATIC, 1 means MOVING (see later in this function) bvhselftree_update_from_cloth ( clmd, 0 ); // 0 means STATIC, 1 means MOVING (see later in this function) - + collobjs = get_collisionobjects(clmd->scene, ob, clmd->coll_parms->group, &numcollobj, eModifierType_Collision); - + if (!collobjs) return 0; @@ -731,31 +731,31 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa do { CollPair **collisions, **collisions_index; - + ret2 = 0; collisions = MEM_callocN(sizeof(CollPair *) *numcollobj, "CollPair"); collisions_index = MEM_callocN(sizeof(CollPair *) *numcollobj, "CollPair"); - + // check all collision objects for (i = 0; i < numcollobj; i++) { Object *collob= collobjs[i]; CollisionModifierData *collmd = (CollisionModifierData *)modifiers_findByType(collob, eModifierType_Collision); BVHTreeOverlap *overlap = NULL; unsigned int result = 0; - + if (!collmd->bvhtree) continue; - + /* search for overlapping collision pairs */ overlap = BLI_bvhtree_overlap(cloth_bvh, collmd->bvhtree, &result, NULL, NULL); - + // go to next object if no overlap is there if ( result && overlap ) { /* check if collisions really happen (costly near check) */ - cloth_bvh_objcollisions_nearcheck ( clmd, collmd, &collisions[i], + cloth_bvh_objcollisions_nearcheck ( clmd, collmd, &collisions[i], &collisions_index[i], result, overlap, dt/(float)clmd->coll_parms->loop_count); - + // resolve nearby collisions ret += cloth_bvh_objcollisions_resolve ( clmd, collmd, collisions[i], collisions_index[i]); ret2 += ret; @@ -765,11 +765,11 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa MEM_freeN ( overlap ); } rounds++; - + for (i = 0; i < numcollobj; i++) { if ( collisions[i] ) MEM_freeN ( collisions[i] ); } - + MEM_freeN(collisions); MEM_freeN(collisions_index); @@ -789,8 +789,8 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa VECADD ( verts[i].tx, verts[i].txold, verts[i].tv ); } //////////////////////////////////////////////////////////// - - + + //////////////////////////////////////////////////////////// // Test on *simple* selfcollisions //////////////////////////////////////////////////////////// @@ -799,15 +799,15 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa /* TODO: add coll quality rounds again */ BVHTreeOverlap *overlap = NULL; unsigned int result = 0; - + // collisions = 1; verts = cloth->verts; // needed for openMP - + /* numfaces = cloth->numfaces; */ /* UNUSED */ mvert_num = cloth->mvert_num; - + verts = cloth->verts; - + if ( cloth->bvhselftree ) { // search for overlapping collision pairs overlap = BLI_bvhtree_overlap(cloth->bvhselftree, cloth->bvhselftree, &result, NULL, NULL); @@ -817,12 +817,12 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa float temp[3]; float length = 0; float mindistance; - + i = overlap[k].indexA; j = overlap[k].indexB; - + mindistance = clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len + cloth->verts[j].avg_spring_len ); - + if ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL ) { if ( ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED ) && ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED ) ) @@ -836,20 +836,20 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa { continue; } - + sub_v3_v3v3(temp, verts[i].tx, verts[j].tx); - + if ( ( ABS ( temp[0] ) > mindistance ) || ( ABS ( temp[1] ) > mindistance ) || ( ABS ( temp[2] ) > mindistance ) ) continue; - + if (BLI_edgeset_haskey(cloth->edgeset, i, j)) { continue; } - + length = normalize_v3(temp ); - + if ( length < mindistance ) { float correction = mindistance - length; - + if ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED ) { mul_v3_fl(temp, -correction); VECADD ( verts[j].tx, verts[j].tx, temp ); @@ -861,7 +861,7 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa else { mul_v3_fl(temp, correction * -0.5f); VECADD ( verts[j].tx, verts[j].tx, temp ); - + sub_v3_v3v3(verts[i].tx, verts[i].tx, temp); } ret = 1; @@ -871,10 +871,10 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa // check for approximated time collisions } } - + if ( overlap ) MEM_freeN ( overlap ); - + } } //////////////////////////////////////////////////////////// @@ -893,7 +893,7 @@ int cloth_bvh_objcollision(Object *ob, ClothModifierData *clmd, float step, floa } } while ( ret2 && ( clmd->coll_parms->loop_count>rounds ) ); - + if (collobjs) MEM_freeN(collobjs); @@ -910,14 +910,14 @@ BLI_INLINE void max_v3_v3v3(float r[3], const float a[3], const float b[3]) void collision_get_collider_velocity(float vel_old[3], float vel_new[3], CollisionModifierData *collmd, CollPair *collpair) { float u1, u2, u3; - + /* compute barycentric coordinates */ collision_compute_barycentric(collpair->pb, collmd->current_x[collpair->bp1].co, collmd->current_x[collpair->bp2].co, collmd->current_x[collpair->bp3].co, &u1, &u2, &u3); - + collision_interpolateOnTriangle(vel_new, collmd->current_v[collpair->bp1].co, collmd->current_v[collpair->bp2].co, collmd->current_v[collpair->bp3].co, u1, u2, u3); /* XXX assume constant velocity of the collider for now */ copy_v3_v3(vel_old, vel_new); @@ -930,7 +930,7 @@ static bool cloth_points_collision_response_static(ClothModifierData *clmd, Coll float restitution = (1.0f - clmd->coll_parms->damping) * (1.0f - pd->pdef_sbdamp); float inv_dt = 1.0f / dt; Cloth *cloth1 = clmd->clothObject; - + // float w1, w2; float u1, u2, u3; float v1[3], v2_old[3], v2_new[3], v_rel_old[3], v_rel_new[3]; @@ -984,20 +984,20 @@ static bool cloth_points_collision_response_static(ClothModifierData *clmd, Coll float v_nor_old, v_nor_new; float v_tan_old[3], v_tan_new[3]; float bounce, repulse; - + /* Collision response based on * "Simulating Complex Hair with Robust Collision Handling" (Choe, Choi, Ko, ACM SIGGRAPH 2005) * http://graphics.snu.ac.kr/publications/2005-choe-HairSim/Choe_2005_SCA.pdf */ - + v_nor_old = mag_v_rel; v_nor_new = dot_v3v3(v_rel_new, collpair->normal); - + madd_v3_v3v3fl(v_tan_old, v_rel_old, collpair->normal, -v_nor_old); madd_v3_v3v3fl(v_tan_new, v_rel_new, collpair->normal, -v_nor_new); - + repulse = -margin_distance * inv_dt + dot_v3v3(v1, collpair->normal); - + if (margin_distance < -epsilon2) { bounce = -v_nor_new + v_nor_old * restitution; mul_v3_v3fl(impulse, collpair->normal, max_ff(repulse, bounce)); @@ -1007,10 +1007,10 @@ static bool cloth_points_collision_response_static(ClothModifierData *clmd, Coll mul_v3_v3fl(impulse, collpair->normal, repulse); } cloth1->verts[collpair->ap1].impulse_count++; - + result = true; } - + if (result) { int i = 0; @@ -1028,21 +1028,21 @@ BLI_INLINE bool cloth_point_face_collision_params(const float p1[3], const float { float edge1[3], edge2[3], p2face[3], p1p2[3], v0p2[3]; float nor_v0p2, nor_p1p2; - + sub_v3_v3v3(edge1, v1, v0); sub_v3_v3v3(edge2, v2, v0); cross_v3_v3v3(r_nor, edge1, edge2); normalize_v3(r_nor); - + nor_v0p2 = dot_v3v3(v0p2, r_nor); madd_v3_v3v3fl(p2face, p2, r_nor, -nor_v0p2); interp_weights_tri_v3(r_w, v0, v1, v2, p2face); - + sub_v3_v3v3(p1p2, p2, p1); sub_v3_v3v3(v0p2, p2, v0); nor_p1p2 = dot_v3v3(p1p2, r_nor); *r_lambda = (nor_p1p2 != 0.0f ? nor_v0p2 / nor_p1p2 : 0.0f); - + return r_w[1] >= 0.0f && r_w[2] >= 0.0f && r_w[1] + r_w[2] <= 1.0f; #if 0 /* XXX this method uses the intersection point, but is broken and doesn't work well in general */ @@ -1099,7 +1099,7 @@ static CollPair *cloth_point_collpair( if (!cloth_point_face_collision_params(p1, p2, co1, co2, co3, facenor, &lambda, w)) return collpair; - + sub_v3_v3v3(v1p1, p1, co1); // distance1 = dot_v3v3(v1p1, facenor); sub_v3_v3v3(v1p2, p2, co1); @@ -1107,7 +1107,7 @@ static CollPair *cloth_point_collpair( // if (distance2 > epsilon || (distance1 < 0.0f && distance2 < 0.0f)) if (distance2 > epsilon) return collpair; - + collpair->face1 = index_cloth; /* XXX actually not a face, but equivalent index for point */ collpair->face2 = index_coll; collpair->ap1 = index_cloth; @@ -1115,20 +1115,20 @@ static CollPair *cloth_point_collpair( collpair->bp1 = bp1; collpair->bp2 = bp2; collpair->bp3 = bp3; - + /* note: using the second point here, which is * the current updated position that needs to be corrected */ copy_v3_v3(collpair->pa, p2); collpair->distance = distance2; mul_v3_v3fl(collpair->vector, facenor, -distance2); - + interp_v3_v3v3v3(collpair->pb, co1, co2, co3, w); - + copy_v3_v3(collpair->normal, facenor); collpair->time = lambda; collpair->flag = 0; - + collpair++; return collpair; } @@ -1163,7 +1163,7 @@ static void cloth_points_objcollisions_nearcheck( int numresult, BVHTreeOverlap *overlap, float epsilon, double dt) { int i; - + /* can return 2 collisions in total */ *collisions = (CollPair *) MEM_mallocN(sizeof(CollPair) * numresult * 2, "collision array" ); *collisions_index = *collisions; @@ -1182,11 +1182,11 @@ static int cloth_points_objcollisions_resolve( int i = 0, mvert_num = clmd->clothObject->mvert_num; ClothVertex *verts = cloth->verts; int ret = 0; - + // process all collisions if ( collmd->bvhtree ) { bool result = cloth_points_collision_response_static(clmd, collmd, pd, collisions, collisions_index, dt); - + // apply impulses in parallel if (result) { for (i = 0; i < mvert_num; i++) { @@ -1196,13 +1196,13 @@ static int cloth_points_objcollisions_resolve( VECADD ( verts[i].tv, verts[i].tv, verts[i].impulse); zero_v3(verts[i].impulse); verts[i].impulse_count = 0; - + ret++; } } } } - + return ret; } @@ -1218,32 +1218,32 @@ int cloth_points_objcollision(Object *ob, ClothModifierData *clmd, float step, f int ret = 0, ret2 = 0; Object **collobjs = NULL; unsigned int numcollobj = 0; - + verts = cloth->verts; mvert_num = cloth->mvert_num; - + //////////////////////////////////////////////////////////// // static collisions //////////////////////////////////////////////////////////// - + // create temporary cloth points bvh cloth_bvh = BLI_bvhtree_new(mvert_num, max_ff(clmd->coll_parms->epsilon, clmd->coll_parms->distance_repel), 4, 6); /* fill tree */ for (i = 0; i < mvert_num; i++) { float co[2][3]; - + copy_v3_v3(co[0], verts[i].x); copy_v3_v3(co[1], verts[i].tx); - + BLI_bvhtree_insert(cloth_bvh, i, co[0], 2); } /* balance tree */ BLI_bvhtree_balance(cloth_bvh); - + collobjs = get_collisionobjects(clmd->scene, ob, clmd->coll_parms->group, &numcollobj, eModifierType_Collision); if (!collobjs) return 0; - + /* move object to position (step) in time */ for (i = 0; i < numcollobj; i++) { Object *collob= collobjs[i]; @@ -1257,12 +1257,12 @@ int cloth_points_objcollision(Object *ob, ClothModifierData *clmd, float step, f do { CollPair **collisions, **collisions_index; - + ret2 = 0; - + collisions = MEM_callocN(sizeof(CollPair *) *numcollobj, "CollPair"); collisions_index = MEM_callocN(sizeof(CollPair *) *numcollobj, "CollPair"); - + // check all collision objects for (i = 0; i < numcollobj; i++) { Object *collob= collobjs[i]; @@ -1270,35 +1270,35 @@ int cloth_points_objcollision(Object *ob, ClothModifierData *clmd, float step, f BVHTreeOverlap *overlap = NULL; unsigned int result = 0; float epsilon; - + if (!collmd->bvhtree) continue; - + /* search for overlapping collision pairs */ overlap = BLI_bvhtree_overlap(cloth_bvh, collmd->bvhtree, &result, NULL, NULL); epsilon = BLI_bvhtree_get_epsilon(collmd->bvhtree); - + // go to next object if no overlap is there if (result && overlap) { /* check if collisions really happen (costly near check) */ cloth_points_objcollisions_nearcheck(clmd, collmd, &collisions[i], &collisions_index[i], result, overlap, epsilon, round_dt); - + // resolve nearby collisions ret += cloth_points_objcollisions_resolve(clmd, collmd, collob->pd, collisions[i], collisions_index[i], round_dt); ret2 += ret; } - + if (overlap) MEM_freeN ( overlap ); } rounds++; - + for (i = 0; i < numcollobj; i++) { if (collisions[i]) MEM_freeN(collisions[i]); } - + MEM_freeN(collisions); MEM_freeN(collisions_index); @@ -1320,7 +1320,7 @@ int cloth_points_objcollision(Object *ob, ClothModifierData *clmd, float step, f //////////////////////////////////////////////////////////// } while ( ret2 && ( clmd->coll_parms->loop_count>rounds ) ); - + if (collobjs) MEM_freeN(collobjs); @@ -1336,53 +1336,53 @@ void cloth_find_point_contacts(Object *ob, ClothModifierData *clmd, float step, BVHTree *cloth_bvh; unsigned int i = 0, mvert_num = 0; ClothVertex *verts = NULL; - + ColliderContacts *collider_contacts; - + Object **collobjs = NULL; unsigned int numcollobj = 0; - + verts = cloth->verts; mvert_num = cloth->mvert_num; - + //////////////////////////////////////////////////////////// // static collisions //////////////////////////////////////////////////////////// - + // create temporary cloth points bvh cloth_bvh = BLI_bvhtree_new(mvert_num, max_ff(clmd->coll_parms->epsilon, clmd->coll_parms->distance_repel), 4, 6); /* fill tree */ for (i = 0; i < mvert_num; i++) { float co[6]; - + copy_v3_v3(&co[0*3], verts[i].x); copy_v3_v3(&co[1*3], verts[i].tx); - + BLI_bvhtree_insert(cloth_bvh, i, co, 2); } /* balance tree */ BLI_bvhtree_balance(cloth_bvh); - + collobjs = get_collisionobjects(clmd->scene, ob, clmd->coll_parms->group, &numcollobj, eModifierType_Collision); if (!collobjs) { *r_collider_contacts = NULL; *r_totcolliders = 0; return; } - + /* move object to position (step) in time */ for (i = 0; i < numcollobj; i++) { Object *collob= collobjs[i]; CollisionModifierData *collmd = (CollisionModifierData *)modifiers_findByType(collob, eModifierType_Collision); if (!collmd->bvhtree) continue; - + /* move object to position (step) in time */ collision_move_object ( collmd, step + dt, step ); } - + collider_contacts = MEM_callocN(sizeof(ColliderContacts) * numcollobj, "CollPair"); - + // check all collision objects for (i = 0; i < numcollobj; i++) { ColliderContacts *ct = collider_contacts + i; @@ -1391,46 +1391,46 @@ void cloth_find_point_contacts(Object *ob, ClothModifierData *clmd, float step, BVHTreeOverlap *overlap; unsigned int result = 0; float epsilon; - + ct->ob = collob; ct->collmd = collmd; ct->collisions = NULL; ct->totcollisions = 0; - + if (!collmd->bvhtree) continue; - + /* search for overlapping collision pairs */ overlap = BLI_bvhtree_overlap(cloth_bvh, collmd->bvhtree, &result, NULL, NULL); epsilon = BLI_bvhtree_get_epsilon(collmd->bvhtree); - + // go to next object if no overlap is there if (result && overlap) { CollPair *collisions_index; - + /* check if collisions really happen (costly near check) */ cloth_points_objcollisions_nearcheck(clmd, collmd, &ct->collisions, &collisions_index, result, overlap, epsilon, dt); ct->totcollisions = (int)(collisions_index - ct->collisions); - + // resolve nearby collisions // ret += cloth_points_objcollisions_resolve(clmd, collmd, collob->pd, collisions[i], collisions_index[i], dt); } - + if (overlap) MEM_freeN(overlap); } - + if (collobjs) MEM_freeN(collobjs); BLI_bvhtree_free(cloth_bvh); - + //////////////////////////////////////////////////////////// // update positions // this is needed for bvh_calc_DOP_hull_moving() [kdop.c] //////////////////////////////////////////////////////////// - + // verts come from clmd for (i = 0; i < mvert_num; i++) { if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) { @@ -1438,11 +1438,11 @@ void cloth_find_point_contacts(Object *ob, ClothModifierData *clmd, float step, continue; } } - + VECADD(verts[i].tx, verts[i].txold, verts[i].tv); } //////////////////////////////////////////////////////////// - + *r_collider_contacts = collider_contacts; *r_totcolliders = numcollobj; } diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 6c97380b9ca..ff4795afe87 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -62,21 +62,21 @@ void curvemapping_set_defaults(CurveMapping *cumap, int tot, float minx, float m { int a; float clipminx, clipminy, clipmaxx, clipmaxy; - + cumap->flag = CUMA_DO_CLIP; if (tot == 4) cumap->cur = 3; /* rhms, hack for 'col' curve? */ - + clipminx = min_ff(minx, maxx); clipminy = min_ff(miny, maxy); clipmaxx = max_ff(minx, maxx); clipmaxy = max_ff(miny, maxy); - + BLI_rctf_init(&cumap->curr, clipminx, clipmaxx, clipminy, clipmaxy); cumap->clipr = cumap->curr; - + cumap->white[0] = cumap->white[1] = cumap->white[2] = 1.0f; cumap->bwmul[0] = cumap->bwmul[1] = cumap->bwmul[2] = 1.0f; - + for (a = 0; a < tot; a++) { cumap->cm[a].flag = CUMA_EXTEND_EXTRAPOLATE; cumap->cm[a].totpoint = 2; @@ -187,7 +187,7 @@ bool curvemap_remove_point(CurveMap *cuma, CurveMapPoint *point) { CurveMapPoint *cmp; int a, b, removed = 0; - + /* must have 2 points minimum */ if (cuma->totpoint <= 2) return false; @@ -204,7 +204,7 @@ bool curvemap_remove_point(CurveMap *cuma, CurveMapPoint *point) removed++; } } - + MEM_freeN(cuma->curve); cuma->curve = cmp; cuma->totpoint -= removed; @@ -216,7 +216,7 @@ void curvemap_remove(CurveMap *cuma, const short flag) { CurveMapPoint *cmp = MEM_mallocN((cuma->totpoint) * sizeof(CurveMapPoint), "curve points"); int a, b, removed = 0; - + /* well, lets keep the two outer points! */ cmp[0] = cuma->curve[0]; for (a = 1, b = 1; a < cuma->totpoint - 1; a++) { @@ -229,7 +229,7 @@ void curvemap_remove(CurveMap *cuma, const short flag) } } cmp[b] = cuma->curve[a]; - + MEM_freeN(cuma->curve); cuma->curve = cmp; cuma->totpoint -= removed; @@ -359,11 +359,11 @@ void curvemap_reset(CurveMap *cuma, const rctf *clipr, int preset, int slope) if (slope == CURVEMAP_SLOPE_POSITIVE) { int i, last = cuma->totpoint - 1; CurveMapPoint *newpoints = MEM_dupallocN(cuma->curve); - + for (i = 0; i < cuma->totpoint; i++) { newpoints[i].y = cuma->curve[last - i].y; } - + MEM_freeN(cuma->curve); cuma->curve = newpoints; } @@ -397,7 +397,7 @@ void curvemap_reset(CurveMap *cuma, const rctf *clipr, int preset, int slope) void curvemap_handle_set(CurveMap *cuma, int type) { int a; - + for (a = 0; a < cuma->totpoint; a++) { if (cuma->curve[a].flag & CUMA_SELECT) { cuma->curve[a].flag &= ~(CUMA_HANDLE_VECTOR | CUMA_HANDLE_AUTO_ANIM); @@ -435,9 +435,9 @@ static void calchandle_curvemap( if (bezt->h1 == 0 && bezt->h2 == 0) { return; } - + p2 = bezt->vec[1]; - + if (prev == NULL) { p3 = next->vec[1]; pt[0] = 2.0f * p2[0] - p3[0]; @@ -447,7 +447,7 @@ static void calchandle_curvemap( else { p1 = prev->vec[1]; } - + if (next == NULL) { p1 = prev->vec[1]; pt[0] = 2.0f * p2[0] - p1[0]; @@ -474,7 +474,7 @@ static void calchandle_curvemap( len = len_v2(tvec) * 2.5614f; if (len != 0.0f) { - + if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM)) { len_a /= len; madd_v2_v2v2fl(p2_h1, p2, tvec, -len_a); @@ -541,7 +541,7 @@ static void calchandle_curvemap( #undef p2_h2 } -/* in X, out Y. +/* in X, out Y. * X is presumed to be outside first or last */ static float curvemap_calc_extend(const CurveMap *cuma, float x, const float first[2], const float last[2]) { @@ -579,16 +579,16 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr) BezTriple *bezt; float *fp, *allpoints, *lastpoint, curf, range; int a, totpoint; - + if (cuma->curve == NULL) return; - + /* default rect also is table range */ cuma->mintable = clipr->xmin; cuma->maxtable = clipr->xmax; - + /* hrmf... we now rely on blender ipo beziers, these are more advanced */ bezt = MEM_callocN(cuma->totpoint * sizeof(BezTriple), "beztarr"); - + for (a = 0; a < cuma->totpoint; a++) { cuma->mintable = min_ff(cuma->mintable, cmp[a].x); cuma->maxtable = max_ff(cuma->maxtable, cmp[a].x); @@ -604,27 +604,27 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr) bezt[a].h1 = bezt[a].h2 = HD_AUTO; } } - + const BezTriple *bezt_prev = NULL; for (a = 0; a < cuma->totpoint; a++) { const BezTriple *bezt_next = (a != cuma->totpoint - 1) ? &bezt[a + 1] : NULL; calchandle_curvemap(&bezt[a], bezt_prev, bezt_next); bezt_prev = &bezt[a]; } - - /* first and last handle need correction, instead of pointing to center of next/prev, + + /* first and last handle need correction, instead of pointing to center of next/prev, * we let it point to the closest handle */ if (cuma->totpoint > 2) { float hlen, nlen, vec[3]; - + if (bezt[0].h2 == HD_AUTO) { - + hlen = len_v3v3(bezt[0].vec[1], bezt[0].vec[2]); /* original handle length */ /* clip handle point */ copy_v3_v3(vec, bezt[1].vec[0]); if (vec[0] < bezt[0].vec[1][0]) vec[0] = bezt[0].vec[1][0]; - + sub_v3_v3(vec, bezt[0].vec[1]); nlen = len_v3(vec); if (nlen > FLT_EPSILON) { @@ -635,13 +635,13 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr) } a = cuma->totpoint - 1; if (bezt[a].h2 == HD_AUTO) { - + hlen = len_v3v3(bezt[a].vec[1], bezt[a].vec[0]); /* original handle length */ /* clip handle point */ copy_v3_v3(vec, bezt[a - 1].vec[2]); if (vec[0] > bezt[a].vec[1][0]) vec[0] = bezt[a].vec[1][0]; - + sub_v3_v3(vec, bezt[a].vec[1]); nlen = len_v3(vec); if (nlen > FLT_EPSILON) { @@ -656,13 +656,13 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr) MEM_freeN(cuma->table); totpoint = (cuma->totpoint - 1) * CM_RESOL; fp = allpoints = MEM_callocN(totpoint * 2 * sizeof(float), "table"); - + for (a = 0; a < cuma->totpoint - 1; a++, fp += 2 * CM_RESOL) { correct_bezpart(bezt[a].vec[1], bezt[a].vec[2], bezt[a + 1].vec[0], bezt[a + 1].vec[1]); BKE_curve_forward_diff_bezier(bezt[a].vec[1][0], bezt[a].vec[2][0], bezt[a + 1].vec[0][0], bezt[a + 1].vec[1][0], fp, CM_RESOL - 1, 2 * sizeof(float)); BKE_curve_forward_diff_bezier(bezt[a].vec[1][1], bezt[a].vec[2][1], bezt[a + 1].vec[0][1], bezt[a + 1].vec[1][1], fp + 1, CM_RESOL - 1, 2 * sizeof(float)); } - + /* store first and last handle for extrapolation, unit length */ cuma->ext_in[0] = bezt[0].vec[0][0] - bezt[0].vec[1][0]; cuma->ext_in[1] = bezt[0].vec[0][1] - bezt[0].vec[1][1]; @@ -676,13 +676,13 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr) range = sqrtf(cuma->ext_out[0] * cuma->ext_out[0] + cuma->ext_out[1] * cuma->ext_out[1]); cuma->ext_out[0] /= range; cuma->ext_out[1] /= range; - + /* cleanup */ MEM_freeN(bezt); range = CM_TABLEDIV * (cuma->maxtable - cuma->mintable); cuma->range = 1.0f / range; - + /* now make a table with CM_TABLE equal x distances */ fp = allpoints; lastpoint = allpoints + 2 * (totpoint - 1); @@ -691,7 +691,7 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr) for (a = 0; a <= CM_TABLE; a++) { curf = cuma->mintable + range * (float)a; cmp[a].x = curf; - + /* get the first x coordinate larger than curf */ while (curf >= fp[0] && fp != lastpoint) { fp += 2; @@ -708,7 +708,7 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr) cmp[a].y = fac1 * fp[-1] + (1.0f - fac1) * fp[1]; } } - + MEM_freeN(allpoints); cuma->table = cmp; } @@ -718,7 +718,7 @@ static void curvemap_make_table(CurveMap *cuma, const rctf *clipr) void curvemapping_premultiply(CurveMapping *cumap, int restore) { int a; - + if (restore) { if (cumap->flag & CUMA_PREMULLED) { for (a = 0; a < 3; a++) { @@ -731,7 +731,7 @@ void curvemapping_premultiply(CurveMapping *cumap, int restore) zero_v2(cumap->cm[a].premul_ext_in); zero_v2(cumap->cm[a].premul_ext_out); } - + cumap->flag &= ~CUMA_PREMULLED; } } @@ -745,10 +745,10 @@ void curvemapping_premultiply(CurveMapping *cumap, int restore) cumap->cm[a].table = MEM_mallocN((CM_TABLE + 1) * sizeof(CurveMapPoint), "premul table"); memcpy(cumap->cm[a].table, cumap->cm[a].premultable, (CM_TABLE + 1) * sizeof(CurveMapPoint)); } - + if (cumap->cm[3].table == NULL) curvemap_make_table(cumap->cm + 3, &cumap->clipr); - + /* premul */ for (a = 0; a < 3; a++) { int b; @@ -761,7 +761,7 @@ void curvemapping_premultiply(CurveMapping *cumap, int restore) mul_v2_v2(cumap->cm[a].ext_in, cumap->cm[3].ext_in); mul_v2_v2(cumap->cm[a].ext_out, cumap->cm[3].ext_out); } - + cumap->flag |= CUMA_PREMULLED; } } @@ -770,7 +770,7 @@ void curvemapping_premultiply(CurveMapping *cumap, int restore) static int sort_curvepoints(const void *a1, const void *a2) { const struct CurveMapPoint *x1 = a1, *x2 = a2; - + if (x1->x > x2->x) return 1; else if (x1->x < x2->x) return -1; return 0; @@ -821,10 +821,10 @@ void curvemapping_changed(CurveMapping *cumap, const bool rem_doubles) cumap->curr.ymax = cumap->clipr.ymax; } } - - + + qsort(cmp, cuma->totpoint, sizeof(CurveMapPoint), sort_curvepoints); - + /* remove doubles, threshold set on 1% of default range */ if (rem_doubles && cuma->totpoint > 2) { for (a = 0; a < cuma->totpoint - 1; a++) { @@ -873,14 +873,14 @@ float curvemap_evaluateF(const CurveMap *cuma, float value) /* index in table */ fi = (value - cuma->mintable) * cuma->range; i = (int)fi; - + /* fi is table float index and should check against table range i.e. [0.0 CM_TABLE] */ if (fi < 0.0f || fi > CM_TABLE) return curvemap_calc_extend(cuma, value, &cuma->table[0].x, &cuma->table[CM_TABLE].x); else { if (i < 0) return cuma->table[0].y; if (i >= CM_TABLE) return cuma->table[CM_TABLE].y; - + fi = fi - (float)i; return (1.0f - fi) * cuma->table[i].y + (fi) * cuma->table[i + 1].y; } @@ -963,18 +963,18 @@ void curvemapping_evaluate_premulRGB(const CurveMapping *cumap, unsigned char ve int curvemapping_RGBA_does_something(const CurveMapping *cumap) { int a; - + if (cumap->black[0] != 0.0f) return 1; if (cumap->black[1] != 0.0f) return 1; if (cumap->black[2] != 0.0f) return 1; if (cumap->white[0] != 1.0f) return 1; if (cumap->white[1] != 1.0f) return 1; if (cumap->white[2] != 1.0f) return 1; - + for (a = 0; a < CM_TOT; a++) { if (cumap->cm[a].curve) { if (cumap->cm[a].totpoint != 2) return 1; - + if (cumap->cm[a].curve[0].x != 0.0f) return 1; if (cumap->cm[a].curve[0].y != 0.0f) return 1; if (cumap->cm[a].curve[1].x != 1.0f) return 1; @@ -987,9 +987,9 @@ int curvemapping_RGBA_does_something(const CurveMapping *cumap) void curvemapping_initialize(CurveMapping *cumap) { int a; - + if (cumap == NULL) return; - + for (a = 0; a < CM_TOT; a++) { if (cumap->cm[a].table == NULL) curvemap_make_table(cumap->cm + a, &cumap->clipr); @@ -999,7 +999,7 @@ void curvemapping_initialize(CurveMapping *cumap) void curvemapping_table_RGBA(const CurveMapping *cumap, float **array, int *size) { int a; - + *size = CM_TABLE + 1; *array = MEM_callocN(sizeof(float) * (*size) * 4, "CurveMapping"); @@ -1165,7 +1165,7 @@ typedef struct ScopesUpdateDataChunk { float min[3], max[3]; } ScopesUpdateDataChunk; -static void scopes_update_cb(void *__restrict userdata, +static void scopes_update_cb(void *__restrict userdata, const int y, const ParallelRangeTLS *__restrict tls) { @@ -1347,7 +1347,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * /* convert to number of lines with logarithmic scale */ scopes->sample_lines = (scopes->accuracy * 0.01f) * (scopes->accuracy * 0.01f) * ibuf->y; CLAMP_MIN(scopes->sample_lines, 1); - + if (scopes->sample_full) scopes->sample_lines = ibuf->y; @@ -1356,9 +1356,9 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * scopes->minmax[a][0] = 25500.0f; scopes->minmax[a][1] = -25500.0f; } - + scopes->waveform_tot = ibuf->x * scopes->sample_lines; - + if (scopes->waveform_1) MEM_freeN(scopes->waveform_1); if (scopes->waveform_2) @@ -1367,12 +1367,12 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * MEM_freeN(scopes->waveform_3); if (scopes->vecscope) MEM_freeN(scopes->vecscope); - + scopes->waveform_1 = MEM_callocN(scopes->waveform_tot * 2 * sizeof(float), "waveform point channel 1"); scopes->waveform_2 = MEM_callocN(scopes->waveform_tot * 2 * sizeof(float), "waveform point channel 2"); scopes->waveform_3 = MEM_callocN(scopes->waveform_tot * 2 * sizeof(float), "waveform point channel 3"); scopes->vecscope = MEM_callocN(scopes->waveform_tot * 2 * sizeof(float), "vectorscope point channel"); - + if (ibuf->rect_float) { cm_processor = IMB_colormanagement_display_processor_new(view_settings, display_settings); } @@ -1411,7 +1411,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * bin_a[a] = sqrt(bin_a[a]); } #endif - + /* convert hist data to float (proportional to max count) */ nl = na = nr = nb = ng = 0; for (a = 0; a < 256; a++) { @@ -1426,7 +1426,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * divr = nr ? 1.0 / (double)nr : 1.0; divg = ng ? 1.0 / (double)ng : 1.0; divb = nb ? 1.0 / (double)nb : 1.0; - + for (a = 0; a < 256; a++) { scopes->hist.data_luma[a] = bin_lum[a] * divl; scopes->hist.data_r[a] = bin_r[a] * divr; @@ -1439,7 +1439,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, const ColorManagedViewSettings * IMB_colormanagement_processor_free(cm_processor); if (cache_handle) IMB_display_buffer_release(cache_handle); - + scopes->ok = 1; } diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index fe60d53a9a2..ac47a9e0756 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -30,7 +30,7 @@ */ -#include <stdio.h> +#include <stdio.h> #include <stddef.h> #include <string.h> #include <math.h> @@ -122,14 +122,14 @@ void BKE_constraint_unique_name(bConstraint *con, ListBase *list) bConstraintOb *BKE_constraints_make_evalob(Depsgraph *depsgraph, Scene *scene, Object *ob, void *subdata, short datatype) { bConstraintOb *cob; - + /* create regardless of whether we have any data! */ cob = MEM_callocN(sizeof(bConstraintOb), "bConstraintOb"); - + /* for system time, part of deglobalization, code nicer later with local time (ton) */ cob->scene = scene; cob->depsgraph = depsgraph; - + /* based on type of available data */ switch (datatype) { case CONSTRAINT_OBTYPE_OBJECT: @@ -138,7 +138,7 @@ bConstraintOb *BKE_constraints_make_evalob(Depsgraph *depsgraph, Scene *scene, O if (ob) { cob->ob = ob; cob->type = datatype; - + if (cob->ob->rotmode > 0) { /* Should be some kind of Euler order, so use it */ /* NOTE: Versions <= 2.76 assumed that "default" order @@ -156,7 +156,7 @@ bConstraintOb *BKE_constraints_make_evalob(Depsgraph *depsgraph, Scene *scene, O } else unit_m4(cob->matrix); - + copy_m4_m4(cob->startmat, cob->matrix); break; } @@ -167,7 +167,7 @@ bConstraintOb *BKE_constraints_make_evalob(Depsgraph *depsgraph, Scene *scene, O cob->ob = ob; cob->pchan = (bPoseChannel *)subdata; cob->type = datatype; - + if (cob->pchan->rotmode > 0) { /* should be some type of Euler order */ cob->rotOrder = cob->pchan->rotmode; @@ -176,13 +176,13 @@ bConstraintOb *BKE_constraints_make_evalob(Depsgraph *depsgraph, Scene *scene, O /* Quats, so eulers should just use default order */ cob->rotOrder = EULER_ORDER_DEFAULT; } - + /* matrix in world-space */ mul_m4_m4m4(cob->matrix, ob->obmat, cob->pchan->pose_mat); } else unit_m4(cob->matrix); - + copy_m4_m4(cob->startmat, cob->matrix); break; } @@ -199,11 +199,11 @@ bConstraintOb *BKE_constraints_make_evalob(Depsgraph *depsgraph, Scene *scene, O void BKE_constraints_clear_evalob(bConstraintOb *cob) { float delta[4][4], imat[4][4]; - + /* prevent crashes */ - if (cob == NULL) + if (cob == NULL) return; - + /* calculate delta of constraints evaluation */ invert_m4_m4(imat, cob->startmat); /* XXX This would seem to be in wrong order. However, it does not work in 'right' order - would be nice to @@ -211,7 +211,7 @@ void BKE_constraints_clear_evalob(bConstraintOb *cob) * In any case, we **do not get a delta** here (e.g. startmat & matrix having same location, still gives * a 'delta' with non-null translation component :/ ).*/ mul_m4_m4m4(delta, cob->matrix, imat); - + /* copy matrices back to source */ switch (cob->type) { case CONSTRAINT_OBTYPE_OBJECT: @@ -220,7 +220,7 @@ void BKE_constraints_clear_evalob(bConstraintOb *cob) if (cob->ob) { /* copy new ob-matrix back to owner */ copy_m4_m4(cob->ob->obmat, cob->matrix); - + /* copy inverse of delta back to owner */ invert_m4_m4(cob->ob->constinv, delta); } @@ -232,21 +232,21 @@ void BKE_constraints_clear_evalob(bConstraintOb *cob) if (cob->ob && cob->pchan) { /* copy new pose-matrix back to owner */ mul_m4_m4m4(cob->pchan->pose_mat, cob->ob->imat, cob->matrix); - + /* copy inverse of delta back to owner */ invert_m4_m4(cob->pchan->constinv, delta); } break; } } - + /* free tempolary struct */ MEM_freeN(cob); } /* -------------- Space-Conversion API -------------- */ -/* This function is responsible for the correct transformations/conversions +/* This function is responsible for the correct transformations/conversions * of a matrix from one space to another for constraint evaluation. * For now, this is only implemented for Objects and PoseChannels. */ @@ -255,12 +255,12 @@ void BKE_constraint_mat_convertspace( { float diff_mat[4][4]; float imat[4][4]; - + /* prevent crashes in these unlikely events */ if (ob == NULL || mat == NULL) return; /* optimize trick - check if need to do anything */ if (from == to) return; - + /* are we dealing with pose-channels or objects */ if (pchan) { /* pose channels */ @@ -270,7 +270,7 @@ void BKE_constraint_mat_convertspace( /* world to pose */ invert_m4_m4(imat, ob->obmat); mul_m4_m4m4(mat, imat, mat); - + /* use pose-space as stepping stone for other spaces... */ if (ELEM(to, CONSTRAINT_SPACE_LOCAL, CONSTRAINT_SPACE_PARLOCAL)) { /* call self with slightly different values */ @@ -306,7 +306,7 @@ void BKE_constraint_mat_convertspace( /* we need the posespace_matrix = local_matrix + (parent_posespace_matrix + restpos) */ BKE_armature_mat_bone_to_pose(pchan, mat, mat); } - + /* use pose-space as stepping stone for other spaces */ if (ELEM(to, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_PARLOCAL)) { /* call self with slightly different values */ @@ -321,7 +321,7 @@ void BKE_constraint_mat_convertspace( copy_m4_m4(diff_mat, pchan->bone->arm_mat); mul_m4_m4m4(mat, mat, diff_mat); } - + /* use pose-space as stepping stone for other spaces */ if (ELEM(to, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL)) { /* call self with slightly different values */ @@ -342,7 +342,7 @@ void BKE_constraint_mat_convertspace( mul_m4_m4m4(mat, imat, mat); } else { - /* Local space in this case will have to be defined as local to the owner's + /* Local space in this case will have to be defined as local to the owner's * transform-property-rotated axes. So subtract this rotation component. */ /* XXX This is actually an ugly hack, local space of a parent-less object *is* the same as @@ -357,7 +357,7 @@ void BKE_constraint_mat_convertspace( normalize_m4(diff_mat); } zero_v3(diff_mat[3]); - + invert_m4_m4_safe(imat, diff_mat); mul_m4_m4m4(mat, imat, mat); } @@ -370,7 +370,7 @@ void BKE_constraint_mat_convertspace( mul_m4_m4m4(mat, diff_mat, mat); } else { - /* Local space in this case will have to be defined as local to the owner's + /* Local space in this case will have to be defined as local to the owner's * transform-property-rotated axes. So add back this rotation component. */ /* XXX See comment above for world->local case... */ @@ -379,7 +379,7 @@ void BKE_constraint_mat_convertspace( normalize_m4(diff_mat); } zero_v3(diff_mat[3]); - + mul_m4_m4m4(mat, diff_mat, mat); } } @@ -398,10 +398,10 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[ float imat[3][3], tmat[3][3]; const int defgroup = defgroup_name_index(ob, substring); short freeDM = 0; - + /* initialize target matrix using target matrix */ copy_m4_m4(mat, ob->obmat); - + /* get index of vertex group */ if (defgroup == -1) return; @@ -413,18 +413,18 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[ } else { /* when not in EditMode, use the 'final' derived mesh, depsgraph - * ensures we build with CD_MDEFORMVERT layer + * ensures we build with CD_MDEFORMVERT layer */ dm = (DerivedMesh *)ob->derivedFinal; } - + /* only continue if there's a valid DerivedMesh */ if (dm) { MDeformVert *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT); int numVerts = dm->getNumVerts(dm); int i; float co[3], nor[3]; - + /* check that dvert is a valid pointers (just in case) */ if (dvert) { MDeformVert *dv = dvert; @@ -448,22 +448,22 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[ mul_v3_fl(vec, 1.0f / weightsum); mul_v3_fl(normal, 1.0f / weightsum); } - - - /* derive the rotation from the average normal: - * - code taken from transform_manipulator.c, + + + /* derive the rotation from the average normal: + * - code taken from transform_manipulator.c, * calc_manipulator_stats, V3D_MANIP_NORMAL case */ /* we need the transpose of the inverse for a normal... */ copy_m3_m4(imat, ob->obmat); - + invert_m3_m3(tmat, imat); transpose_m3(tmat); mul_m3_v3(tmat, normal); - + normalize_v3(normal); copy_v3_v3(plane, tmat[1]); - + cross_v3_v3v3(mat[0], normal, plane); if (len_squared_v3(mat[0]) < SQUARE(1e-3f)) { copy_v3_v3(plane, tmat[0]); @@ -475,12 +475,12 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[ normalize_m4(mat); - + /* apply the average coordinate as the new location */ mul_v3_m4v3(mat[3], ob->obmat, vec); } } - + /* free temporary DerivedMesh created (in EditMode case) */ if (dm && freeDM) dm->release(dm); @@ -490,25 +490,25 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[ static void contarget_get_lattice_mat(Object *ob, const char *substring, float mat[4][4]) { Lattice *lt = (Lattice *)ob->data; - + DispList *dl = ob->curve_cache ? BKE_displist_find(&ob->curve_cache->disp, DL_VERTS) : NULL; const float *co = dl ? dl->verts : NULL; BPoint *bp = lt->def; - + MDeformVert *dv = lt->dvert; int tot_verts = lt->pntsu * lt->pntsv * lt->pntsw; float vec[3] = {0.0f, 0.0f, 0.0f}, tvec[3]; int grouped = 0; int i, n; const int defgroup = defgroup_name_index(ob, substring); - + /* initialize target matrix using target matrix */ copy_m4_m4(mat, ob->obmat); /* get index of vertex group */ if (defgroup == -1) return; if (dv == NULL) return; - + /* 1. Loop through control-points checking if in nominated vertex-group. * 2. If it is, add it to vec to find the average point. */ @@ -523,17 +523,17 @@ static void contarget_get_lattice_mat(Object *ob, const char *substring, float m grouped++; } } - + /* advance pointer to coordinate data */ if (co) co += 3; else bp++; } - + /* find average location, then multiply by ob->obmat to find world-space location */ if (grouped) mul_v3_fl(vec, 1.0f / grouped); mul_v3_m4v3(tvec, ob->obmat, vec); - + /* copy new location to matrix */ copy_v3_v3(mat[3], tvec); } @@ -549,7 +549,7 @@ static void constraint_target_to_mat4(Object *ob, const char *substring, float m } /* Case VERTEXGROUP */ /* Current method just takes the average location of all the points in the - * VertexGroup, and uses that as the location value of the targets. Where + * VertexGroup, and uses that as the location value of the targets. Where * possible, the orientation will also be calculated, by calculating an * 'average' vertex normal, and deriving the rotation from that. * @@ -567,7 +567,7 @@ static void constraint_target_to_mat4(Object *ob, const char *substring, float m /* Case BONE */ else { bPoseChannel *pchan; - + pchan = BKE_pose_channel_find_name(ob->pose, substring); if (pchan) { /* Multiply the PoseSpace accumulation/final matrix for this @@ -583,22 +583,22 @@ static void constraint_target_to_mat4(Object *ob, const char *substring, float m Mat4 bbone[MAX_BBONE_SUBDIV]; float tempmat[4][4]; float loc[3], fac; - + /* get bbone segments */ b_bone_spline_setup(pchan, 0, bbone); - + /* figure out which segment(s) the headtail value falls in */ fac = (float)pchan->bone->segments * headtail; - + if (fac >= pchan->bone->segments - 1) { /* special case: end segment doesn't get created properly... */ float pt[3], sfac; int index; - + /* bbone points are in bonespace, so need to move to posespace first */ index = pchan->bone->segments - 1; mul_v3_m4v3(pt, pchan->pose_mat, bbone[index].mat[3]); - + /* interpolate between last segment point and the endpoint */ sfac = fac - (float)(pchan->bone->segments - 1); /* fac is just the "leftover" between penultimate and last points */ interp_v3_v3v3(loc, pt, pchan->pose_tail, sfac); @@ -607,45 +607,45 @@ static void constraint_target_to_mat4(Object *ob, const char *substring, float m /* get indices for finding interpolating between points along the bbone */ float pt_a[3], pt_b[3], pt[3]; int index_a, index_b; - + index_a = floorf(fac); CLAMP(index_a, 0, MAX_BBONE_SUBDIV - 1); - + index_b = ceilf(fac); CLAMP(index_b, 0, MAX_BBONE_SUBDIV - 1); - + /* interpolate between these points */ copy_v3_v3(pt_a, bbone[index_a].mat[3]); copy_v3_v3(pt_b, bbone[index_b].mat[3]); - + interp_v3_v3v3(pt, pt_a, pt_b, fac - floorf(fac)); - + /* move the point from bone local space to pose space... */ mul_v3_m4v3(loc, pchan->pose_mat, pt); } - + /* use interpolated distance for subtarget */ copy_m4_m4(tempmat, pchan->pose_mat); copy_v3_v3(tempmat[3], loc); - + mul_m4_m4m4(mat, ob->obmat, tempmat); } else { float tempmat[4][4], loc[3]; - + /* interpolate along length of bone */ interp_v3_v3v3(loc, pchan->pose_head, pchan->pose_tail, headtail); - + /* use interpolated distance for subtarget */ copy_m4_m4(tempmat, pchan->pose_mat); copy_v3_v3(tempmat[3], loc); - + mul_m4_m4m4(mat, ob->obmat, tempmat); } } else copy_m4_m4(mat, ob->obmat); - + /* convert matrix space as required */ BKE_constraint_mat_convertspace(ob, pchan, mat, from, to, false); } @@ -656,7 +656,7 @@ static void constraint_target_to_mat4(Object *ob, const char *substring, float m * times. In addition to this, each constraint should have a type-info struct, where * its functions are attached for use. */ - + /* Template for type-info data: * - make a copy of this when creating new constraints, and just change the functions * pointed to as necessary @@ -685,7 +685,7 @@ static bConstraintTypeInfo CTI_CONSTRNAME = { }; #endif -/* This function should be used for the get_target_matrix member of all +/* This function should be used for the get_target_matrix member of all * constraints that are not picky about what happens to their target matrix. */ static void default_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint *con, bConstraintOb *UNUSED(cob), bConstraintTarget *ct, float UNUSED(ctime)) @@ -696,7 +696,7 @@ static void default_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint unit_m4(ct->matrix); } -/* This following macro should be used for all standard single-target *_get_tars functions +/* This following macro should be used for all standard single-target *_get_tars functions * to save typing and reduce maintenance woes. * (Hopefully all compilers will be happy with the lines with just a space on them. Those are * really just to help this code easier to read) @@ -729,8 +729,8 @@ static void default_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint \ BLI_addtail(list, ct); \ } (void)0 - -/* This following macro should be used for all standard single-target *_get_tars functions + +/* This following macro should be used for all standard single-target *_get_tars functions * to save typing and reduce maintenance woes. It does not do the subtarget related operations * (Hopefully all compilers will be happy with the lines with just a space on them. Those are * really just to help this code easier to read) @@ -769,7 +769,7 @@ static void default_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint ct = ctn; \ } \ } (void)0 - + /* This following macro should be used for all standard single-target *_flush_tars functions * to save typing and reduce maintenance woes. It does not do the subtarget related operations. * Note: the pointer to ct will be changed to point to the next in the list (as it gets removed) @@ -795,7 +795,7 @@ static void default_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint static void childof_new_data(void *cdata) { bChildOfConstraint *data = (bChildOfConstraint *)cdata; - + data->flag = (CHILDOF_LOCX | CHILDOF_LOCY | CHILDOF_LOCZ | CHILDOF_ROTX | CHILDOF_ROTY | CHILDOF_ROTZ | CHILDOF_SIZEX | CHILDOF_SIZEY | CHILDOF_SIZEZ); @@ -805,7 +805,7 @@ static void childof_new_data(void *cdata) static void childof_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bChildOfConstraint *data = con->data; - + /* target only */ func(con, (ID **)&data->tar, false, userdata); } @@ -815,13 +815,13 @@ static int childof_get_tars(bConstraint *con, ListBase *list) if (con && list) { bChildOfConstraint *data = con->data; bConstraintTarget *ct; - + /* standard target-getting macro for single-target constraints */ SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); - + return 1; } - + return 0; } @@ -830,7 +830,7 @@ static void childof_flush_tars(bConstraint *con, ListBase *list, bool no_copy) if (con && list) { bChildOfConstraint *data = con->data; bConstraintTarget *ct = list->first; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } @@ -844,16 +844,16 @@ static void childof_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar /* only evaluate if there is a target */ if (VALID_CONS_TARGET(ct)) { float parmat[4][4]; - + /* simple matrix parenting */ if (data->flag == CHILDOF_ALL) { - - /* multiply target (parent matrix) by offset (parent inverse) to get + + /* multiply target (parent matrix) by offset (parent inverse) to get * the effect of the parent that will be exerted on the owner */ mul_m4_m4m4(parmat, ct->matrix, data->invmat); - - /* now multiply the parent matrix by the owner matrix to get the + + /* now multiply the parent matrix by the owner matrix to get the * the effect of this constraint (i.e. owner is 'parented' to parent) */ mul_m4_m4m4(cob->matrix, parmat, cob->matrix); @@ -862,19 +862,19 @@ static void childof_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar float invmat[4][4], tempmat[4][4]; float loc[3], eul[3], size[3]; float loco[3], eulo[3], sizo[3]; - + /* get offset (parent-inverse) matrix */ copy_m4_m4(invmat, data->invmat); - + /* extract components of both matrices */ copy_v3_v3(loc, ct->matrix[3]); mat4_to_eulO(eul, ct->rotOrder, ct->matrix); mat4_to_size(size, ct->matrix); - + copy_v3_v3(loco, invmat[3]); mat4_to_eulO(eulo, cob->rotOrder, invmat); mat4_to_size(sizo, invmat); - + /* disable channels not enabled */ if (!(data->flag & CHILDOF_LOCX)) loc[0] = loco[0] = 0.0f; if (!(data->flag & CHILDOF_LOCY)) loc[1] = loco[1] = 0.0f; @@ -885,22 +885,22 @@ static void childof_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar if (!(data->flag & CHILDOF_SIZEX)) size[0] = sizo[0] = 1.0f; if (!(data->flag & CHILDOF_SIZEY)) size[1] = sizo[1] = 1.0f; if (!(data->flag & CHILDOF_SIZEZ)) size[2] = sizo[2] = 1.0f; - + /* make new target mat and offset mat */ loc_eulO_size_to_mat4(ct->matrix, loc, eul, size, ct->rotOrder); loc_eulO_size_to_mat4(invmat, loco, eulo, sizo, cob->rotOrder); - - /* multiply target (parent matrix) by offset (parent inverse) to get + + /* multiply target (parent matrix) by offset (parent inverse) to get * the effect of the parent that will be exerted on the owner */ mul_m4_m4m4(parmat, ct->matrix, invmat); - - /* now multiply the parent matrix by the owner matrix to get the + + /* now multiply the parent matrix by the owner matrix to get the * the effect of this constraint (i.e. owner is 'parented' to parent) */ copy_m4_m4(tempmat, cob->matrix); mul_m4_m4m4(cob->matrix, parmat, tempmat); - + /* without this, changes to scale and rotation can change location * of a parentless bone or a disconnected bone. Even though its set * to zero above. */ @@ -932,15 +932,15 @@ static bConstraintTypeInfo CTI_CHILDOF = { static void trackto_new_data(void *cdata) { bTrackToConstraint *data = (bTrackToConstraint *)cdata; - + data->reserved1 = TRACK_Y; data->reserved2 = UP_Z; -} +} static void trackto_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bTrackToConstraint *data = con->data; - + /* target only */ func(con, (ID **)&data->tar, false, userdata); } @@ -950,13 +950,13 @@ static int trackto_get_tars(bConstraint *con, ListBase *list) if (con && list) { bTrackToConstraint *data = con->data; bConstraintTarget *ct; - + /* standard target-getting macro for single-target constraints */ SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); - + return 1; } - + return 0; } @@ -965,7 +965,7 @@ static void trackto_flush_tars(bConstraint *con, ListBase *list, bool no_copy) if (con && list) { bTrackToConstraint *data = con->data; bConstraintTarget *ct = list->first; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } @@ -975,14 +975,14 @@ static void trackto_flush_tars(bConstraint *con, ListBase *list, bool no_copy) static int basis_cross(int n, int m) { switch (n - m) { - case 1: + case 1: case -2: return 1; - - case -1: + + case -1: case 2: return -1; - + default: return 0; } @@ -1038,14 +1038,14 @@ static void vectomat(const float vec[3], const float target_up[3], short axis, s if (axis != upflag) { right_index = 3 - axis - upflag; neg = (float)basis_cross(axis, upflag); - + /* account for up direction, track direction */ m[right_index][0] = neg * right[0]; m[right_index][1] = neg * right[1]; m[right_index][2] = neg * right[2]; - + copy_v3_v3(m[upflag], proj); - + copy_v3_v3(m[axis], n); } /* identity matrix - don't do anything if the two axes are the same */ @@ -1059,14 +1059,14 @@ static void trackto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar { bTrackToConstraint *data = con->data; bConstraintTarget *ct = targets->first; - + if (VALID_CONS_TARGET(ct)) { float size[3], vec[3]; float totmat[3][3]; - + /* Get size property, since ob->size is only the object's own relative size, not its global one */ mat4_to_size(size, cob->matrix); - + /* Clear the object's rotation */ cob->matrix[0][0] = size[0]; cob->matrix[0][1] = 0; @@ -1077,12 +1077,12 @@ static void trackto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar cob->matrix[2][0] = 0; cob->matrix[2][1] = 0; cob->matrix[2][2] = size[2]; - + /* targetmat[2] instead of ownermat[2] is passed to vectomat * for backwards compatibility it seems... (Aligorith) */ sub_v3_v3v3(vec, cob->matrix[3], ct->matrix[3]); - vectomat(vec, ct->matrix[2], + vectomat(vec, ct->matrix[2], (short)data->reserved1, (short)data->reserved2, data->flags, totmat); @@ -1110,7 +1110,7 @@ static bConstraintTypeInfo CTI_TRACKTO = { static void kinematic_new_data(void *cdata) { bKinematicConstraint *data = (bKinematicConstraint *)cdata; - + data->weight = 1.0f; data->orientweight = 1.0f; data->iterations = 500; @@ -1121,10 +1121,10 @@ static void kinematic_new_data(void *cdata) static void kinematic_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bKinematicConstraint *data = con->data; - + /* chain target */ func(con, (ID **)&data->tar, false, userdata); - + /* poletarget */ func(con, (ID **)&data->poletar, false, userdata); } @@ -1134,14 +1134,14 @@ static int kinematic_get_tars(bConstraint *con, ListBase *list) if (con && list) { bKinematicConstraint *data = con->data; bConstraintTarget *ct; - + /* standard target-getting macro for single-target constraints is used twice here */ SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); SINGLETARGET_GET_TARS(con, data->poletar, data->polesubtarget, ct, list); - + return 2; } - + return 0; } @@ -1150,7 +1150,7 @@ static void kinematic_flush_tars(bConstraint *con, ListBase *list, bool no_copy) if (con && list) { bKinematicConstraint *data = con->data; bConstraintTarget *ct = list->first; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); SINGLETARGET_FLUSH_TARS(con, data->poletar, data->polesubtarget, ct, list, no_copy); @@ -1160,13 +1160,13 @@ static void kinematic_flush_tars(bConstraint *con, ListBase *list, bool no_copy) static void kinematic_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { bKinematicConstraint *data = con->data; - - if (VALID_CONS_TARGET(ct)) + + if (VALID_CONS_TARGET(ct)) constraint_target_to_mat4(ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->flag, con->headtail); else if (ct) { if (data->flag & CONSTRAINT_IK_AUTO) { Object *ob = cob->ob; - + if (ob == NULL) { unit_m4(ct->matrix); } @@ -1203,7 +1203,7 @@ static bConstraintTypeInfo CTI_KINEMATIC = { static void followpath_new_data(void *cdata) { bFollowPathConstraint *data = (bFollowPathConstraint *)cdata; - + data->trackflag = TRACK_Y; data->upflag = UP_Z; data->offset = 0; @@ -1213,7 +1213,7 @@ static void followpath_new_data(void *cdata) static void followpath_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bFollowPathConstraint *data = con->data; - + /* target only */ func(con, (ID **)&data->tar, false, userdata); } @@ -1223,13 +1223,13 @@ static int followpath_get_tars(bConstraint *con, ListBase *list) if (con && list) { bFollowPathConstraint *data = con->data; bConstraintTarget *ct; - + /* standard target-getting macro for single-target constraints without subtargets */ SINGLETARGETNS_GET_TARS(con, data->tar, ct, list); - + return 1; } - + return 0; } @@ -1238,7 +1238,7 @@ static void followpath_flush_tars(bConstraint *con, ListBase *list, bool no_copy if (con && list) { bFollowPathConstraint *data = con->data; bConstraintTarget *ct = list->first; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, no_copy); } @@ -1249,7 +1249,7 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraintTarget *ct, float UNUSED(ctime)) { bFollowPathConstraint *data = con->data; - + if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_CURVE)) { Curve *cu = ct->tar->data; float vec[4], dir[3], radius; @@ -1258,7 +1258,7 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph), unit_m4(ct->matrix); /* note: when creating constraints that follow path, the curve gets the CU_PATH set now, - * currently for paths to work it needs to go through the bevlist/displist system (ton) + * currently for paths to work it needs to go through the bevlist/displist system (ton) */ if (ct->tar->curve_cache && ct->tar->curve_cache->path && ct->tar->curve_cache->path->data) { @@ -1267,9 +1267,9 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph), /* animated position along curve depending on time */ Nurb *nu = cu->nurb.first; curvetime = cu->ctime - data->offset; - + /* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated, - * but this will only work if it actually is animated... + * but this will only work if it actually is animated... * * we divide the curvetime calculated in the previous step by the length of the path, to get a time * factor, which then gets clamped to lie within 0.0 - 1.0 range @@ -1292,7 +1292,7 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph), /* fixed position along curve */ curvetime = data->offset_fac; } - + if (where_on_path(ct->tar, curvetime, vec, dir, (data->followflag & FOLLOWPATH_FOLLOW) ? quat : NULL, &radius, NULL) ) { /* quat_pt is quat or NULL*/ float totmat[4][4]; unit_m4(totmat); @@ -1301,7 +1301,7 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph), #if 0 float x1, q[4]; vec_to_quat(quat, dir, (short)data->trackflag, (short)data->upflag); - + normalize_v3(dir); q[0] = cosf(0.5 * vec[3]); x1 = sinf(0.5 * vec[3]); @@ -1322,9 +1322,9 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph), mul_m4_m4m4(rmat, tmat, totmat); copy_m4_m4(totmat, rmat); } - + copy_v3_v3(totmat[3], vec); - + mul_m4_m4m4(ct->matrix, ct->tar->obmat, totmat); } } @@ -1336,27 +1336,27 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph), static void followpath_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targets) { bConstraintTarget *ct = targets->first; - + /* only evaluate if there is a target */ if (VALID_CONS_TARGET(ct)) { float obmat[4][4]; float size[3]; bFollowPathConstraint *data = con->data; - + /* get Object transform (loc/rot/size) to determine transformation from path */ /* TODO: this used to be local at one point, but is probably more useful as-is */ copy_m4_m4(obmat, cob->matrix); - + /* get scaling of object before applying constraint */ mat4_to_size(size, cob->matrix); - + /* apply targetmat - containing location on path, and rotation */ mul_m4_m4m4(cob->matrix, ct->matrix, obmat); - + /* un-apply scaling caused by path */ if ((data->followflag & FOLLOWPATH_RADIUS) == 0) { /* XXX - assume that scale correction means that radius will have some scale error in it - Campbell */ float obsize[3]; - + mat4_to_size(obsize, cob->matrix); if (obsize[0]) mul_v3_fl(cob->matrix[0], size[0] / obsize[0]); @@ -1389,7 +1389,7 @@ static bConstraintTypeInfo CTI_FOLLOWPATH = { static void loclimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets)) { bLocLimitConstraint *data = con->data; - + if (data->flag & LIMIT_XMIN) { if (cob->matrix[3][0] < data->xmin) cob->matrix[3][0] = data->xmin; @@ -1407,7 +1407,7 @@ static void loclimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UN cob->matrix[3][1] = data->ymax; } if (data->flag & LIMIT_ZMIN) { - if (cob->matrix[3][2] < data->zmin) + if (cob->matrix[3][2] < data->zmin) cob->matrix[3][2] = data->zmin; } if (data->flag & LIMIT_ZMAX) { @@ -1439,37 +1439,37 @@ static void rotlimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UN float loc[3]; float eul[3]; float size[3]; - + copy_v3_v3(loc, cob->matrix[3]); mat4_to_size(size, cob->matrix); mat4_to_eulO(eul, cob->rotOrder, cob->matrix); /* constraint data uses radians internally */ - + /* limiting of euler values... */ if (data->flag & LIMIT_XROT) { - if (eul[0] < data->xmin) + if (eul[0] < data->xmin) eul[0] = data->xmin; - + if (eul[0] > data->xmax) eul[0] = data->xmax; } if (data->flag & LIMIT_YROT) { if (eul[1] < data->ymin) eul[1] = data->ymin; - + if (eul[1] > data->ymax) eul[1] = data->ymax; } if (data->flag & LIMIT_ZROT) { if (eul[2] < data->zmin) eul[2] = data->zmin; - + if (eul[2] > data->zmax) eul[2] = data->zmax; } - + loc_eulO_size_to_mat4(cob->matrix, loc, eul, size, cob->rotOrder); } @@ -1495,40 +1495,40 @@ static void sizelimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *U { bSizeLimitConstraint *data = con->data; float obsize[3], size[3]; - + mat4_to_size(size, cob->matrix); mat4_to_size(obsize, cob->matrix); - + if (data->flag & LIMIT_XMIN) { - if (size[0] < data->xmin) + if (size[0] < data->xmin) size[0] = data->xmin; } if (data->flag & LIMIT_XMAX) { - if (size[0] > data->xmax) + if (size[0] > data->xmax) size[0] = data->xmax; } if (data->flag & LIMIT_YMIN) { - if (size[1] < data->ymin) + if (size[1] < data->ymin) size[1] = data->ymin; } if (data->flag & LIMIT_YMAX) { - if (size[1] > data->ymax) + if (size[1] > data->ymax) size[1] = data->ymax; } if (data->flag & LIMIT_ZMIN) { - if (size[2] < data->zmin) + if (size[2] < data->zmin) size[2] = data->zmin; } if (data->flag & LIMIT_ZMAX) { - if (size[2] > data->zmax) + if (size[2] > data->zmax) size[2] = data->zmax; } - - if (obsize[0]) + + if (obsize[0]) mul_v3_fl(cob->matrix[0], size[0] / obsize[0]); - if (obsize[1]) + if (obsize[1]) mul_v3_fl(cob->matrix[1], size[1] / obsize[1]); - if (obsize[2]) + if (obsize[2]) mul_v3_fl(cob->matrix[2], size[2] / obsize[2]); } @@ -1552,14 +1552,14 @@ static bConstraintTypeInfo CTI_SIZELIMIT = { static void loclike_new_data(void *cdata) { bLocateLikeConstraint *data = (bLocateLikeConstraint *)cdata; - + data->flag = LOCLIKE_X | LOCLIKE_Y | LOCLIKE_Z; } static void loclike_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bLocateLikeConstraint *data = con->data; - + /* target only */ func(con, (ID **)&data->tar, false, userdata); } @@ -1569,13 +1569,13 @@ static int loclike_get_tars(bConstraint *con, ListBase *list) if (con && list) { bLocateLikeConstraint *data = con->data; bConstraintTarget *ct; - + /* standard target-getting macro for single-target constraints */ SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); - + return 1; } - + return 0; } @@ -1584,7 +1584,7 @@ static void loclike_flush_tars(bConstraint *con, ListBase *list, bool no_copy) if (con && list) { bLocateLikeConstraint *data = con->data; bConstraintTarget *ct = list->first; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } @@ -1594,28 +1594,28 @@ static void loclike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar { bLocateLikeConstraint *data = con->data; bConstraintTarget *ct = targets->first; - + if (VALID_CONS_TARGET(ct)) { float offset[3] = {0.0f, 0.0f, 0.0f}; - + if (data->flag & LOCLIKE_OFFSET) copy_v3_v3(offset, cob->matrix[3]); - + if (data->flag & LOCLIKE_X) { cob->matrix[3][0] = ct->matrix[3][0]; - + if (data->flag & LOCLIKE_X_INVERT) cob->matrix[3][0] *= -1; cob->matrix[3][0] += offset[0]; } if (data->flag & LOCLIKE_Y) { cob->matrix[3][1] = ct->matrix[3][1]; - + if (data->flag & LOCLIKE_Y_INVERT) cob->matrix[3][1] *= -1; cob->matrix[3][1] += offset[1]; } if (data->flag & LOCLIKE_Z) { cob->matrix[3][2] = ct->matrix[3][2]; - + if (data->flag & LOCLIKE_Z_INVERT) cob->matrix[3][2] *= -1; cob->matrix[3][2] += offset[2]; } @@ -1642,14 +1642,14 @@ static bConstraintTypeInfo CTI_LOCLIKE = { static void rotlike_new_data(void *cdata) { bRotateLikeConstraint *data = (bRotateLikeConstraint *)cdata; - + data->flag = ROTLIKE_X | ROTLIKE_Y | ROTLIKE_Z; } static void rotlike_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bRotateLikeConstraint *data = con->data; - + /* target only */ func(con, (ID **)&data->tar, false, userdata); } @@ -1659,13 +1659,13 @@ static int rotlike_get_tars(bConstraint *con, ListBase *list) if (con && list) { bRotateLikeConstraint *data = con->data; bConstraintTarget *ct; - + /* standard target-getting macro for single-target constraints */ SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); - + return 1; } - + return 0; } @@ -1674,7 +1674,7 @@ static void rotlike_flush_tars(bConstraint *con, ListBase *list, bool no_copy) if (con && list) { bRotateLikeConstraint *data = con->data; bConstraintTarget *ct = list->first; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } @@ -1684,50 +1684,50 @@ static void rotlike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar { bRotateLikeConstraint *data = con->data; bConstraintTarget *ct = targets->first; - + if (VALID_CONS_TARGET(ct)) { float loc[3]; float eul[3], obeul[3]; float size[3]; - + copy_v3_v3(loc, cob->matrix[3]); mat4_to_size(size, cob->matrix); - + /* to allow compatible rotations, must get both rotations in the order of the owner... */ mat4_to_eulO(obeul, cob->rotOrder, cob->matrix); /* we must get compatible eulers from the beginning because some of them can be modified below (see bug #21875) */ mat4_to_compatible_eulO(eul, obeul, cob->rotOrder, ct->matrix); - + if ((data->flag & ROTLIKE_X) == 0) eul[0] = obeul[0]; else { if (data->flag & ROTLIKE_OFFSET) rotate_eulO(eul, cob->rotOrder, 'X', obeul[0]); - + if (data->flag & ROTLIKE_X_INVERT) eul[0] *= -1; } - + if ((data->flag & ROTLIKE_Y) == 0) eul[1] = obeul[1]; else { if (data->flag & ROTLIKE_OFFSET) rotate_eulO(eul, cob->rotOrder, 'Y', obeul[1]); - + if (data->flag & ROTLIKE_Y_INVERT) eul[1] *= -1; } - + if ((data->flag & ROTLIKE_Z) == 0) eul[2] = obeul[2]; else { if (data->flag & ROTLIKE_OFFSET) rotate_eulO(eul, cob->rotOrder, 'Z', obeul[2]); - + if (data->flag & ROTLIKE_Z_INVERT) eul[2] *= -1; } - + /* good to make eulers compatible again, since we don't know how much they were changed above */ compatible_eul(eul, obeul); loc_eulO_size_to_mat4(cob->matrix, loc, eul, size, cob->rotOrder); @@ -1754,14 +1754,14 @@ static bConstraintTypeInfo CTI_ROTLIKE = { static void sizelike_new_data(void *cdata) { bSizeLikeConstraint *data = (bSizeLikeConstraint *)cdata; - + data->flag = SIZELIKE_X | SIZELIKE_Y | SIZELIKE_Z; } static void sizelike_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bSizeLikeConstraint *data = con->data; - + /* target only */ func(con, (ID **)&data->tar, false, userdata); } @@ -1771,13 +1771,13 @@ static int sizelike_get_tars(bConstraint *con, ListBase *list) if (con && list) { bSizeLikeConstraint *data = con->data; bConstraintTarget *ct; - + /* standard target-getting macro for single-target constraints */ SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); - + return 1; } - + return 0; } @@ -1786,7 +1786,7 @@ static void sizelike_flush_tars(bConstraint *con, ListBase *list, bool no_copy) if (con && list) { bSizeLikeConstraint *data = con->data; bConstraintTarget *ct = list->first; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } @@ -1796,13 +1796,13 @@ static void sizelike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *ta { bSizeLikeConstraint *data = con->data; bConstraintTarget *ct = targets->first; - + if (VALID_CONS_TARGET(ct)) { float obsize[3], size[3]; - + mat4_to_size(size, ct->matrix); mat4_to_size(obsize, cob->matrix); - + if ((data->flag & SIZELIKE_X) && (obsize[0] != 0)) { if (data->flag & SIZELIKE_OFFSET) { size[0] += (obsize[0] - 1.0f); @@ -1850,7 +1850,7 @@ static bConstraintTypeInfo CTI_SIZELIKE = { static void translike_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bTransLikeConstraint *data = con->data; - + /* target only */ func(con, (ID **)&data->tar, false, userdata); } @@ -1860,13 +1860,13 @@ static int translike_get_tars(bConstraint *con, ListBase *list) if (con && list) { bTransLikeConstraint *data = con->data; bConstraintTarget *ct; - + /* standard target-getting macro for single-target constraints */ SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); - + return 1; } - + return 0; } @@ -1875,7 +1875,7 @@ static void translike_flush_tars(bConstraint *con, ListBase *list, bool no_copy) if (con && list) { bTransLikeConstraint *data = con->data; bConstraintTarget *ct = list->first; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } @@ -1884,7 +1884,7 @@ static void translike_flush_tars(bConstraint *con, ListBase *list, bool no_copy) static void translike_evaluate(bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets) { bConstraintTarget *ct = targets->first; - + if (VALID_CONS_TARGET(ct)) { /* just copy the entire transform matrix of the target */ copy_m4_m4(cob->matrix, ct->matrix); @@ -1925,12 +1925,12 @@ static void samevolume_evaluate(bConstraint *con, bConstraintOb *cob, ListBase * float obsize[3]; mat4_to_size(obsize, cob->matrix); - + /* calculate normalizing scale factor for non-essential values */ total_scale = obsize[0] * obsize[1] * obsize[2]; if (total_scale != 0) fac = sqrtf(volume / total_scale); - + /* apply scaling factor to the channels not being kept */ switch (data->flag) { case SAMEVOL_X: @@ -1968,20 +1968,20 @@ static bConstraintTypeInfo CTI_SAMEVOL = { static void pycon_free(bConstraint *con) { bPythonConstraint *data = con->data; - + /* id-properties */ IDP_FreeProperty(data->prop); MEM_freeN(data->prop); - + /* multiple targets */ BLI_freelistN(&data->targets); -} +} static void pycon_copy(bConstraint *con, bConstraint *srccon) { bPythonConstraint *pycon = (bPythonConstraint *)con->data; bPythonConstraint *opycon = (bPythonConstraint *)srccon->data; - + pycon->prop = IDP_CopyProperty(opycon->prop); BLI_duplicatelist(&pycon->targets, &opycon->targets); } @@ -1989,7 +1989,7 @@ static void pycon_copy(bConstraint *con, bConstraint *srccon) static void pycon_new_data(void *cdata) { bPythonConstraint *data = (bPythonConstraint *)cdata; - + /* everything should be set correctly by calloc, except for the prop->type constant.*/ data->prop = MEM_callocN(sizeof(IDProperty), "PyConstraintProps"); data->prop->type = IDP_GROUP; @@ -1999,13 +1999,13 @@ static int pycon_get_tars(bConstraint *con, ListBase *list) { if (con && list) { bPythonConstraint *data = con->data; - + list->first = data->targets.first; list->last = data->targets.last; - + return data->tarnum; } - + return 0; } @@ -2013,11 +2013,11 @@ static void pycon_id_looper(bConstraint *con, ConstraintIDFunc func, void *userd { bPythonConstraint *data = con->data; bConstraintTarget *ct; - + /* targets */ for (ct = data->targets.first; ct; ct = ct->next) func(con, (ID **)&ct->tar, false, userdata); - + /* script */ func(con, (ID **)&data->text, true, userdata); } @@ -2041,7 +2041,7 @@ static void pycon_get_tarmat(struct Depsgraph *UNUSED(depsgraph), * this matrix if it needs to do so */ constraint_target_to_mat4(ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->flag, con->headtail); - + /* only execute target calculation if allowed */ #ifdef WITH_PYTHON if (G.f & G_SCRIPT_AUTOEXEC) @@ -2059,19 +2059,19 @@ static void pycon_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targe return; #else bPythonConstraint *data = con->data; - + /* only evaluate in python if we're allowed to do so */ if ((G.f & G_SCRIPT_AUTOEXEC) == 0) return; - + /* currently removed, until I this can be re-implemented for multiple targets */ #if 0 - /* Firstly, run the 'driver' function which has direct access to the objects involved + /* Firstly, run the 'driver' function which has direct access to the objects involved * Technically, this is potentially dangerous as users may abuse this and cause dependency-problems, * but it also allows certain 'clever' rigging hacks to work. */ BPY_pyconstraint_driver(data, cob, targets); #endif - + /* Now, run the actual 'constraint' function, which should only access the matrices */ BPY_pyconstraint_exec(data, cob, targets); #endif /* WITH_PYTHON */ @@ -2097,7 +2097,7 @@ static bConstraintTypeInfo CTI_PYTHON = { static void actcon_new_data(void *cdata) { bActionConstraint *data = (bActionConstraint *)cdata; - + /* set type to 20 (Loc X), as 0 is Rot X for backwards compatibility */ data->type = 20; } @@ -2105,10 +2105,10 @@ static void actcon_new_data(void *cdata) static void actcon_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bActionConstraint *data = con->data; - + /* target */ func(con, (ID **)&data->tar, false, userdata); - + /* action */ func(con, (ID **)&data->act, true, userdata); } @@ -2118,13 +2118,13 @@ static int actcon_get_tars(bConstraint *con, ListBase *list) if (con && list) { bActionConstraint *data = con->data; bConstraintTarget *ct; - + /* standard target-getting macro for single-target constraints */ SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); - + return 1; } - + return 0; } @@ -2133,7 +2133,7 @@ static void actcon_flush_tars(bConstraint *con, ListBase *list, bool no_copy) if (con && list) { bActionConstraint *data = con->data; bConstraintTarget *ct = list->first; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } @@ -2142,18 +2142,18 @@ static void actcon_flush_tars(bConstraint *con, ListBase *list, bool no_copy) static void actcon_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { bActionConstraint *data = con->data; - + if (VALID_CONS_TARGET(ct)) { float tempmat[4][4], vec[3]; float s, t; short axis; - + /* initialize return matrix */ unit_m4(ct->matrix); - + /* get the transform matrix of the target */ constraint_target_to_mat4(ct->tar, ct->subtarget, tempmat, CONSTRAINT_SPACE_WORLD, ct->space, con->flag, con->headtail); - + /* determine where in transform range target is */ /* data->type is mapped as follows for backwards compatibility: * 00,01,02 - rotation (it used to be like this) @@ -2176,21 +2176,21 @@ static void actcon_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint * copy_v3_v3(vec, tempmat[3]); axis = data->type - 20; } - + BLI_assert((unsigned int)axis < 3); /* Target defines the animation */ s = (vec[axis] - data->min) / (data->max - data->min); CLAMP(s, 0, 1); t = (s * (data->end - data->start)) + data->start; - + if (G.debug & G_DEBUG) printf("do Action Constraint %s - Ob %s Pchan %s\n", con->name, cob->ob->id.name + 2, (cob->pchan) ? cob->pchan->name : NULL); - + /* Get the appropriate information from the action */ if (cob->type == CONSTRAINT_OBTYPE_OBJECT || (data->flag & ACTCON_BONE_USE_OBJECT_ACTION)) { Object workob; - + /* evaluate using workob */ /* FIXME: we don't have any consistent standards on limiting effects on object... */ what_does_obaction(cob->ob, &workob, NULL, data->act, NULL, t); @@ -2201,21 +2201,21 @@ static void actcon_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint * bPose pose = {{0}}; bPoseChannel *pchan, *tchan; - /* make a copy of the bone of interest in the temp pose before evaluating action, so that it can get set + /* make a copy of the bone of interest in the temp pose before evaluating action, so that it can get set * - we need to manually copy over a few settings, including rotation order, otherwise this fails */ pchan = cob->pchan; - + tchan = BKE_pose_channel_verify(&pose, pchan->name); tchan->rotmode = pchan->rotmode; - + /* evaluate action using workob (it will only set the PoseChannel in question) */ what_does_obaction(cob->ob, &workob, &pose, data->act, pchan->name, t); - + /* convert animation to matrices for use here */ BKE_pchan_calc_mat(tchan); copy_m4_m4(ct->matrix, tchan->chan_mat); - + /* Clean up */ BKE_pose_free_data(&pose); } @@ -2229,10 +2229,10 @@ static void actcon_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint * static void actcon_evaluate(bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets) { bConstraintTarget *ct = targets->first; - + if (VALID_CONS_TARGET(ct)) { float temp[4][4]; - + /* Nice and simple... we just need to multiply the matrices, as the get_target_matrix * function has already taken care of everything else. */ @@ -2261,15 +2261,15 @@ static bConstraintTypeInfo CTI_ACTION = { static void locktrack_new_data(void *cdata) { bLockTrackConstraint *data = (bLockTrackConstraint *)cdata; - + data->trackflag = TRACK_Y; data->lockflag = LOCK_Z; -} +} static void locktrack_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bLockTrackConstraint *data = con->data; - + /* target only */ func(con, (ID **)&data->tar, false, userdata); } @@ -2279,13 +2279,13 @@ static int locktrack_get_tars(bConstraint *con, ListBase *list) if (con && list) { bLockTrackConstraint *data = con->data; bConstraintTarget *ct; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); - + return 1; } - + return 0; } @@ -2294,7 +2294,7 @@ static void locktrack_flush_tars(bConstraint *con, ListBase *list, bool no_copy) if (con && list) { bLockTrackConstraint *data = con->data; bConstraintTarget *ct = list->first; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } @@ -2304,14 +2304,14 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t { bLockTrackConstraint *data = con->data; bConstraintTarget *ct = targets->first; - + if (VALID_CONS_TARGET(ct)) { float vec[3], vec2[3]; float totmat[3][3]; float tmpmat[3][3]; float invmat[3][3]; float mdet; - + /* Vector object -> target */ sub_v3_v3v3(vec, ct->matrix[3], cob->matrix[3]); switch (data->lockflag) { @@ -2324,10 +2324,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t project_v3_v3v3(vec2, vec, cob->matrix[0]); sub_v3_v3v3(totmat[1], vec, vec2); normalize_v3(totmat[1]); - + /* the x axis is fixed */ normalize_v3_v3(totmat[0], cob->matrix[0]); - + /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[2], totmat[0], totmat[1]); break; @@ -2338,10 +2338,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t project_v3_v3v3(vec2, vec, cob->matrix[0]); sub_v3_v3v3(totmat[2], vec, vec2); normalize_v3(totmat[2]); - + /* the x axis is fixed */ normalize_v3_v3(totmat[0], cob->matrix[0]); - + /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[1], totmat[2], totmat[0]); break; @@ -2353,10 +2353,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t sub_v3_v3v3(totmat[1], vec, vec2); normalize_v3(totmat[1]); negate_v3(totmat[1]); - + /* the x axis is fixed */ normalize_v3_v3(totmat[0], cob->matrix[0]); - + /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[2], totmat[0], totmat[1]); break; @@ -2368,10 +2368,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t sub_v3_v3v3(totmat[2], vec, vec2); normalize_v3(totmat[2]); negate_v3(totmat[2]); - + /* the x axis is fixed */ normalize_v3_v3(totmat[0], cob->matrix[0]); - + /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[1], totmat[2], totmat[0]); break; @@ -2393,7 +2393,7 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t project_v3_v3v3(vec2, vec, cob->matrix[1]); sub_v3_v3v3(totmat[0], vec, vec2); normalize_v3(totmat[0]); - + /* the y axis is fixed */ normalize_v3_v3(totmat[1], cob->matrix[1]); @@ -2407,10 +2407,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t project_v3_v3v3(vec2, vec, cob->matrix[1]); sub_v3_v3v3(totmat[2], vec, vec2); normalize_v3(totmat[2]); - + /* the y axis is fixed */ normalize_v3_v3(totmat[1], cob->matrix[1]); - + /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[0], totmat[1], totmat[2]); break; @@ -2422,10 +2422,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t sub_v3_v3v3(totmat[0], vec, vec2); normalize_v3(totmat[0]); negate_v3(totmat[0]); - + /* the y axis is fixed */ normalize_v3_v3(totmat[1], cob->matrix[1]); - + /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[2], totmat[0], totmat[1]); break; @@ -2437,10 +2437,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t sub_v3_v3v3(totmat[2], vec, vec2); normalize_v3(totmat[2]); negate_v3(totmat[2]); - + /* the y axis is fixed */ normalize_v3_v3(totmat[1], cob->matrix[1]); - + /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[0], totmat[1], totmat[2]); break; @@ -2462,10 +2462,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t project_v3_v3v3(vec2, vec, cob->matrix[2]); sub_v3_v3v3(totmat[0], vec, vec2); normalize_v3(totmat[0]); - + /* the z axis is fixed */ normalize_v3_v3(totmat[2], cob->matrix[2]); - + /* the x axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[1], totmat[2], totmat[0]); break; @@ -2476,10 +2476,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t project_v3_v3v3(vec2, vec, cob->matrix[2]); sub_v3_v3v3(totmat[1], vec, vec2); normalize_v3(totmat[1]); - + /* the z axis is fixed */ normalize_v3_v3(totmat[2], cob->matrix[2]); - + /* the x axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[0], totmat[1], totmat[2]); break; @@ -2491,10 +2491,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t sub_v3_v3v3(totmat[0], vec, vec2); normalize_v3(totmat[0]); negate_v3(totmat[0]); - + /* the z axis is fixed */ normalize_v3_v3(totmat[2], cob->matrix[2]); - + /* the x axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[1], totmat[2], totmat[0]); break; @@ -2506,10 +2506,10 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t sub_v3_v3v3(totmat[1], vec, vec2); normalize_v3(totmat[1]); negate_v3(totmat[1]); - + /* the z axis is fixed */ normalize_v3_v3(totmat[2], cob->matrix[2]); - + /* the x axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[0], totmat[1], totmat[2]); break; @@ -2536,14 +2536,14 @@ static void locktrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t totmat[0][0] = tmpmat[0][0]; totmat[0][1] = tmpmat[0][1]; totmat[0][2] = tmpmat[0][2]; totmat[1][0] = tmpmat[1][0]; totmat[1][1] = tmpmat[1][1]; totmat[1][2] = tmpmat[1][2]; totmat[2][0] = tmpmat[2][0]; totmat[2][1] = tmpmat[2][1]; totmat[2][2] = tmpmat[2][2]; - + mdet = determinant_m3(totmat[0][0], totmat[0][1], totmat[0][2], totmat[1][0], totmat[1][1], totmat[1][2], totmat[2][0], totmat[2][1], totmat[2][2]); if (mdet == 0) { unit_m3(totmat); } - + /* apply out transformaton to the object */ mul_m4_m3m4(cob->matrix, totmat, cob->matrix); } @@ -2569,14 +2569,14 @@ static bConstraintTypeInfo CTI_LOCKTRACK = { static void distlimit_new_data(void *cdata) { bDistLimitConstraint *data = (bDistLimitConstraint *)cdata; - + data->dist = 0.0f; } static void distlimit_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bDistLimitConstraint *data = con->data; - + /* target only */ func(con, (ID **)&data->tar, false, userdata); } @@ -2586,13 +2586,13 @@ static int distlimit_get_tars(bConstraint *con, ListBase *list) if (con && list) { bDistLimitConstraint *data = con->data; bConstraintTarget *ct; - + /* standard target-getting macro for single-target constraints */ SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); - + return 1; } - + return 0; } @@ -2601,7 +2601,7 @@ static void distlimit_flush_tars(bConstraint *con, ListBase *list, bool no_copy) if (con && list) { bDistLimitConstraint *data = con->data; bConstraintTarget *ct = list->first; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } @@ -2611,19 +2611,19 @@ static void distlimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t { bDistLimitConstraint *data = con->data; bConstraintTarget *ct = targets->first; - + /* only evaluate if there is a target */ if (VALID_CONS_TARGET(ct)) { float dvec[3], dist, sfac = 1.0f; short clamp_surf = 0; - + /* calculate our current distance from the target */ dist = len_v3v3(cob->matrix[3], ct->matrix[3]); - + /* set distance (flag is only set when user demands it) */ if (data->dist == 0) data->dist = dist; - + /* check if we're which way to clamp from, and calculate interpolation factor (if needed) */ if (data->mode == LIMITDIST_OUTSIDE) { /* if inside, then move to surface */ @@ -2650,7 +2650,7 @@ static void distlimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t if (dist >= (data->dist - data->soft)) { sfac = (float)(data->soft * (1.0f - expf(-(dist - data->dist) / data->soft)) + data->dist); if (dist != 0.0f) sfac /= dist; - + clamp_surf = 1; } } @@ -2661,12 +2661,12 @@ static void distlimit_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t if (dist != 0.0f) sfac = data->dist / dist; } } - + /* clamp to 'surface' (i.e. move owner so that dist == data->dist) */ if (clamp_surf) { /* simply interpolate along line formed by target -> owner */ interp_v3_v3v3(dvec, ct->matrix[3], cob->matrix[3], sfac); - + /* copy new vector onto owner */ copy_v3_v3(cob->matrix[3], dvec); } @@ -2693,10 +2693,10 @@ static bConstraintTypeInfo CTI_DISTLIMIT = { static void stretchto_new_data(void *cdata) { bStretchToConstraint *data = (bStretchToConstraint *)cdata; - + data->volmode = 0; data->plane = 0; - data->orglength = 0.0; + data->orglength = 0.0; data->bulge = 1.0; data->bulge_max = 1.0f; data->bulge_min = 1.0f; @@ -2705,7 +2705,7 @@ static void stretchto_new_data(void *cdata) static void stretchto_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bStretchToConstraint *data = con->data; - + /* target only */ func(con, (ID **)&data->tar, false, userdata); } @@ -2715,13 +2715,13 @@ static int stretchto_get_tars(bConstraint *con, ListBase *list) if (con && list) { bStretchToConstraint *data = con->data; bConstraintTarget *ct; - + /* standard target-getting macro for single-target constraints */ SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); - + return 1; } - + return 0; } @@ -2730,7 +2730,7 @@ static void stretchto_flush_tars(bConstraint *con, ListBase *list, bool no_copy) if (con && list) { bStretchToConstraint *data = con->data; bConstraintTarget *ct = list->first; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } @@ -2740,51 +2740,51 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t { bStretchToConstraint *data = con->data; bConstraintTarget *ct = targets->first; - + /* only evaluate if there is a target */ if (VALID_CONS_TARGET(ct)) { float size[3], scale[3], vec[3], xx[3], zz[3], orth[3]; float totmat[3][3]; float dist, bulge; - + /* store scaling before destroying obmat */ mat4_to_size(size, cob->matrix); - + /* store X orientation before destroying obmat */ normalize_v3_v3(xx, cob->matrix[0]); - + /* store Z orientation before destroying obmat */ normalize_v3_v3(zz, cob->matrix[2]); - + /* XXX That makes the constraint buggy with asymmetrically scaled objects, see #29940. */ /* sub_v3_v3v3(vec, cob->matrix[3], ct->matrix[3]);*/ /* vec[0] /= size[0];*/ /* vec[1] /= size[1];*/ /* vec[2] /= size[2];*/ - + /* dist = normalize_v3(vec);*/ dist = len_v3v3(cob->matrix[3], ct->matrix[3]); /* Only Y constrained object axis scale should be used, to keep same length when scaling it. */ dist /= size[1]; - + /* data->orglength==0 occurs on first run, and after 'R' button is clicked */ if (data->orglength == 0) data->orglength = dist; scale[1] = dist / data->orglength; - + bulge = powf(data->orglength / dist, data->bulge); - + if (bulge > 1.0f) { if (data->flag & STRETCHTOCON_USE_BULGE_MAX) { float bulge_max = max_ff(data->bulge_max, 1.0f); float hard = min_ff(bulge, bulge_max); - + float range = bulge_max - 1.0f; float scale_fac = (range > 0.0f) ? 1.0f / range : 0.0f; float soft = 1.0f + range * atanf((bulge - 1.0f) * scale_fac) / (float)M_PI_2; - + bulge = interpf(soft, hard, data->bulge_smooth); } } @@ -2792,15 +2792,15 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t if (data->flag & STRETCHTOCON_USE_BULGE_MIN) { float bulge_min = CLAMPIS(data->bulge_min, 0.0f, 1.0f); float hard = max_ff(bulge, bulge_min); - + float range = 1.0f - bulge_min; float scale_fac = (range > 0.0f) ? 1.0f / range : 0.0f; float soft = 1.0f - range * atanf((1.0f - bulge) * scale_fac) / (float)M_PI_2; - + bulge = interpf(soft, hard, data->bulge_smooth); } } - + switch (data->volmode) { /* volume preserving scaling */ case VOLUME_XZ: @@ -2823,7 +2823,7 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t default: /* should not happen, but in case*/ return; } /* switch (data->volmode) */ - + /* Clear the object's rotation and scale */ cob->matrix[0][0] = size[0] * scale[0]; cob->matrix[0][1] = 0; @@ -2834,10 +2834,10 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t cob->matrix[2][0] = 0; cob->matrix[2][1] = 0; cob->matrix[2][2] = size[2] * scale[2]; - + sub_v3_v3v3(vec, cob->matrix[3], ct->matrix[3]); normalize_v3(vec); - + /* new Y aligns object target connection*/ negate_v3_v3(totmat[1], vec); switch (data->plane) { @@ -2846,10 +2846,10 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t /* othogonal to "new Y" "old X! plane */ cross_v3_v3v3(orth, vec, xx); normalize_v3(orth); - + /* new Z*/ copy_v3_v3(totmat[2], orth); - + /* we decided to keep X plane*/ cross_v3_v3v3(xx, orth, vec); normalize_v3_v3(totmat[0], xx); @@ -2859,16 +2859,16 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t /* othogonal to "new Y" "old Z! plane */ cross_v3_v3v3(orth, vec, zz); normalize_v3(orth); - + /* new X */ negate_v3_v3(totmat[0], orth); - + /* we decided to keep Z */ cross_v3_v3v3(zz, orth, vec); normalize_v3_v3(totmat[2], zz); break; } /* switch (data->plane) */ - + mul_m4_m3m4(cob->matrix, totmat, cob->matrix); } } @@ -2893,7 +2893,7 @@ static bConstraintTypeInfo CTI_STRETCHTO = { static void minmax_new_data(void *cdata) { bMinMaxConstraint *data = (bMinMaxConstraint *)cdata; - + data->minmaxflag = TRACK_Z; data->offset = 0.0f; zero_v3(data->cache); @@ -2903,7 +2903,7 @@ static void minmax_new_data(void *cdata) static void minmax_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bMinMaxConstraint *data = con->data; - + /* target only */ func(con, (ID **)&data->tar, false, userdata); } @@ -2913,13 +2913,13 @@ static int minmax_get_tars(bConstraint *con, ListBase *list) if (con && list) { bMinMaxConstraint *data = con->data; bConstraintTarget *ct; - + /* standard target-getting macro for single-target constraints */ SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); - + return 1; } - + return 0; } @@ -2928,7 +2928,7 @@ static void minmax_flush_tars(bConstraint *con, ListBase *list, bool no_copy) if (con && list) { bMinMaxConstraint *data = con->data; bConstraintTarget *ct = list->first; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } @@ -2938,16 +2938,16 @@ static void minmax_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targ { bMinMaxConstraint *data = con->data; bConstraintTarget *ct = targets->first; - + /* only evaluate if there is a target */ if (VALID_CONS_TARGET(ct)) { float obmat[4][4], imat[4][4], tarmat[4][4], tmat[4][4]; float val1, val2; int index; - + copy_m4_m4(obmat, cob->matrix); copy_m4_m4(tarmat, ct->matrix); - + if (data->flag & MINMAX_USEROT) { /* take rotation of target into account by doing the transaction in target's localspace */ invert_m4_m4(imat, tarmat); @@ -2955,7 +2955,7 @@ static void minmax_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targ copy_m4_m4(obmat, tmat); unit_m4(tarmat); } - + switch (data->minmaxflag) { case TRACK_Z: val1 = tarmat[3][2]; @@ -2990,7 +2990,7 @@ static void minmax_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targ default: return; } - + if (val1 > val2) { obmat[3][index] = tarmat[3][index] + data->offset; if (data->flag & MINMAX_STICKY) { @@ -3037,7 +3037,7 @@ static bConstraintTypeInfo CTI_MINMAX = { static void clampto_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bClampToConstraint *data = con->data; - + /* target only */ func(con, (ID **)&data->tar, false, userdata); } @@ -3047,13 +3047,13 @@ static int clampto_get_tars(bConstraint *con, ListBase *list) if (con && list) { bClampToConstraint *data = con->data; bConstraintTarget *ct; - + /* standard target-getting macro for single-target constraints without subtargets */ SINGLETARGETNS_GET_TARS(con, data->tar, ct, list); - + return 1; } - + return 0; } @@ -3062,7 +3062,7 @@ static void clampto_flush_tars(bConstraint *con, ListBase *list, bool no_copy) if (con && list) { bClampToConstraint *data = con->data; bConstraintTarget *ct = list->first; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, no_copy); } @@ -3083,33 +3083,33 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar { bClampToConstraint *data = con->data; bConstraintTarget *ct = targets->first; - + /* only evaluate if there is a target and it is a curve */ if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_CURVE)) { float obmat[4][4], ownLoc[3]; float curveMin[3], curveMax[3]; float targetMatrix[4][4]; - + copy_m4_m4(obmat, cob->matrix); copy_v3_v3(ownLoc, obmat[3]); - + unit_m4(targetMatrix); INIT_MINMAX(curveMin, curveMax); /* XXX - don't think this is good calling this here - campbell */ BKE_object_minmax(ct->tar, curveMin, curveMax, true); - + /* get targetmatrix */ if (data->tar->curve_cache && data->tar->curve_cache->path && data->tar->curve_cache->path->data) { float vec[4], dir[3], totmat[4][4]; float curvetime; short clamp_axis; - + /* find best position on curve */ /* 1. determine which axis to sample on? */ if (data->flag == CLAMPTO_AUTO) { float size[3]; sub_v3_v3v3(size, curveMax, curveMin); - + /* find axis along which the bounding box has the greatest * extent. Otherwise, default to the x-axis, as that is quite * frequently used. @@ -3121,15 +3121,15 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar else clamp_axis = CLAMPTO_X - 1; } - else + else clamp_axis = data->flag - 1; - + /* 2. determine position relative to curve on a 0-1 scale based on bounding box */ if (data->flag2 & CLAMPTO_CYCLIC) { /* cyclic, so offset within relative bounding box is used */ float len = (curveMax[clamp_axis] - curveMin[clamp_axis]); float offset; - + /* check to make sure len is not so close to zero that it'll cause errors */ if (IS_EQF(len, 0.0f) == false) { /* find bounding-box range where target is located */ @@ -3165,19 +3165,19 @@ static void clampto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *tar curvetime = 1.0f; else if (IS_EQF((curveMax[clamp_axis] - curveMin[clamp_axis]), 0.0f) == false) curvetime = (ownLoc[clamp_axis] - curveMin[clamp_axis]) / (curveMax[clamp_axis] - curveMin[clamp_axis]); - else + else curvetime = 0.0f; } - + /* 3. position on curve */ if (where_on_path(ct->tar, curvetime, vec, dir, NULL, NULL, NULL) ) { unit_m4(totmat); copy_v3_v3(totmat[3], vec); - + mul_m4_m4m4(targetMatrix, ct->tar->obmat, totmat); } } - + /* obtain final object position */ copy_v3_v3(cob->matrix[3], targetMatrix[3]); } @@ -3203,7 +3203,7 @@ static bConstraintTypeInfo CTI_CLAMPTO = { static void transform_new_data(void *cdata) { bTransformConstraint *data = (bTransformConstraint *)cdata; - + data->map[0] = 0; data->map[1] = 1; data->map[2] = 2; @@ -3212,7 +3212,7 @@ static void transform_new_data(void *cdata) static void transform_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bTransformConstraint *data = con->data; - + /* target only */ func(con, (ID **)&data->tar, false, userdata); } @@ -3222,13 +3222,13 @@ static int transform_get_tars(bConstraint *con, ListBase *list) if (con && list) { bTransformConstraint *data = con->data; bConstraintTarget *ct; - + /* standard target-getting macro for single-target constraints */ SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); - + return 1; } - + return 0; } @@ -3237,7 +3237,7 @@ static void transform_flush_tars(bConstraint *con, ListBase *list, bool no_copy) if (con && list) { bTransformConstraint *data = con->data; bConstraintTarget *ct = list->first; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } @@ -3247,21 +3247,21 @@ static void transform_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t { bTransformConstraint *data = con->data; bConstraintTarget *ct = targets->first; - + /* only evaluate if there is a target */ if (VALID_CONS_TARGET(ct)) { float *from_min, *from_max, *to_min, *to_max; float loc[3], eul[3], size[3]; float dvec[3], sval[3]; int i; - + /* obtain target effect */ switch (data->from) { case TRANS_SCALE: mat4_to_size(dvec, ct->matrix); - + if (is_negative_m4(ct->matrix)) { - /* Bugfix [#27886] + /* Bugfix [#27886] * We can't be sure which axis/axes are negative, though we know that something is negative. * Assume we don't care about negativity of separate axes. <--- This is a limitation that * riggers will have to live with for now. @@ -3283,12 +3283,12 @@ static void transform_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t from_max = data->from_max; break; } - + /* extract components of owner's matrix */ copy_v3_v3(loc, cob->matrix[3]); mat4_to_eulO(eul, cob->rotOrder, cob->matrix); mat4_to_size(size, cob->matrix); - + /* determine where in range current transforms lie */ if (data->expo) { for (i = 0; i < 3; i++) { @@ -3308,8 +3308,8 @@ static void transform_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t sval[i] = 0.0f; } } - - + + /* apply transforms */ switch (data->to) { case TRANS_SCALE: @@ -3340,7 +3340,7 @@ static void transform_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t } break; } - + /* apply to matrix */ loc_eulO_size_to_mat4(cob->matrix, loc, eul, size, cob->rotOrder); } @@ -3366,7 +3366,7 @@ static bConstraintTypeInfo CTI_TRANSFORM = { static void shrinkwrap_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bShrinkwrapConstraint *data = con->data; - + /* target only */ func(con, (ID **)&data->target, false, userdata); } @@ -3384,12 +3384,12 @@ static int shrinkwrap_get_tars(bConstraint *con, ListBase *list) if (con && list) { bShrinkwrapConstraint *data = con->data; bConstraintTarget *ct; - + SINGLETARGETNS_GET_TARS(con, data->target, ct, list); - + return 1; } - + return 0; } @@ -3399,7 +3399,7 @@ static void shrinkwrap_flush_tars(bConstraint *con, ListBase *list, bool no_copy if (con && list) { bShrinkwrapConstraint *data = con->data; bConstraintTarget *ct = list->first; - + SINGLETARGETNS_FLUSH_TARS(con, data->target, ct, list, no_copy); } } @@ -3408,22 +3408,22 @@ static void shrinkwrap_flush_tars(bConstraint *con, ListBase *list, bool no_copy static void shrinkwrap_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstraint *con, bConstraintOb *cob, bConstraintTarget *ct, float UNUSED(ctime)) { bShrinkwrapConstraint *scon = (bShrinkwrapConstraint *) con->data; - + if (VALID_CONS_TARGET(ct) && (ct->tar->type == OB_MESH) ) { bool fail = false; float co[3] = {0.0f, 0.0f, 0.0f}; - + SpaceTransform transform; /* TODO(sergey): use proper for_render flag here when known. */ DerivedMesh *target = object_get_derived_final(ct->tar, false); - + BVHTreeFromMesh treeData = {NULL}; - + unit_m4(ct->matrix); - + if (target != NULL) { BLI_space_transform_from_matrices(&transform, cob->matrix, ct->tar->obmat); - + switch (scon->shrinkType) { case MOD_SHRINKWRAP_NEAREST_SURFACE: case MOD_SHRINKWRAP_NEAREST_VERTEX: @@ -3438,16 +3438,16 @@ static void shrinkwrap_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstrai bvhtree_from_mesh_get(&treeData, target, BVHTREE_FROM_VERTS, 2); else bvhtree_from_mesh_get(&treeData, target, BVHTREE_FROM_LOOPTRI, 2); - + if (treeData.tree == NULL) { fail = true; break; } - + BLI_space_transform_apply(&transform, co); - + BLI_bvhtree_find_nearest(treeData.tree, co, &nearest, treeData.nearest_callback, &treeData); - + dist = len_v3v3(co, nearest.co); if (dist != 0.0f) { interp_v3_v3v3(co, co, nearest.co, (dist - scon->dist) / dist); /* linear interpolation */ @@ -3474,7 +3474,7 @@ static void shrinkwrap_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstrai no[scon->projAxis - OB_NEGX] = -1.0f; break; } - + /* transform normal into requested space */ /* Note that in this specific case, we need to keep scaling in non-parented 'local2world' object * case, because SpaceTransform also takes it into account when handling normals. See T42447. */ @@ -3505,14 +3505,14 @@ static void shrinkwrap_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstrai break; } } - + free_bvhtree_from_mesh(&treeData); - + if (fail == true) { /* Don't move the point */ zero_v3(co); } - + /* co is in local object coordinates, change it to global and update target position */ mul_m4_v3(cob->matrix, co); copy_v3_v3(ct->matrix[3], co); @@ -3523,7 +3523,7 @@ static void shrinkwrap_get_tarmat(struct Depsgraph *UNUSED(depsgraph), bConstrai static void shrinkwrap_evaluate(bConstraint *UNUSED(con), bConstraintOb *cob, ListBase *targets) { bConstraintTarget *ct = targets->first; - + /* only evaluate if there is a target */ if (VALID_CONS_TARGET(ct)) { copy_v3_v3(cob->matrix[3], ct->matrix[3]); @@ -3550,14 +3550,14 @@ static bConstraintTypeInfo CTI_SHRINKWRAP = { static void damptrack_new_data(void *cdata) { bDampTrackConstraint *data = (bDampTrackConstraint *)cdata; - + data->trackflag = TRACK_Y; -} +} static void damptrack_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bDampTrackConstraint *data = con->data; - + /* target only */ func(con, (ID **)&data->tar, false, userdata); } @@ -3567,13 +3567,13 @@ static int damptrack_get_tars(bConstraint *con, ListBase *list) if (con && list) { bDampTrackConstraint *data = con->data; bConstraintTarget *ct; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); - + return 1; } - + return 0; } @@ -3582,7 +3582,7 @@ static void damptrack_flush_tars(bConstraint *con, ListBase *list, bool no_copy) if (con && list) { bDampTrackConstraint *data = con->data; bConstraintTarget *ct = list->first; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } @@ -3598,60 +3598,60 @@ static void damptrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t { bDampTrackConstraint *data = con->data; bConstraintTarget *ct = targets->first; - + if (VALID_CONS_TARGET(ct)) { float obvec[3], tarvec[3], obloc[3]; float raxis[3], rangle; float rmat[3][3], tmat[4][4]; - - /* find the (unit) direction that the axis we're interested in currently points - * - mul_mat3_m4_v3() only takes the 3x3 (rotation+scaling) components of the 4x4 matrix + + /* find the (unit) direction that the axis we're interested in currently points + * - mul_mat3_m4_v3() only takes the 3x3 (rotation+scaling) components of the 4x4 matrix * - the normalization step at the end should take care of any unwanted scaling * left over in the 3x3 matrix we used */ copy_v3_v3(obvec, track_dir_vecs[data->trackflag]); mul_mat3_m4_v3(cob->matrix, obvec); - + if (normalize_v3(obvec) == 0.0f) { /* exceptional case - just use the track vector as appropriate */ copy_v3_v3(obvec, track_dir_vecs[data->trackflag]); } - + /* find the (unit) direction vector going from the owner to the target */ copy_v3_v3(obloc, cob->matrix[3]); sub_v3_v3v3(tarvec, ct->matrix[3], obloc); - + if (normalize_v3(tarvec) == 0.0f) { /* the target is sitting on the owner, so just make them use the same direction vectors */ /* FIXME: or would it be better to use the pure direction vector? */ copy_v3_v3(tarvec, obvec); //copy_v3_v3(tarvec, track_dir_vecs[data->trackflag]); } - + /* determine the axis-angle rotation, which represents the smallest possible rotation * between the two rotation vectors (i.e. the 'damping' referred to in the name) * - we take this to be the rotation around the normal axis/vector to the plane defined - * by the current and destination vectors, which will 'map' the current axis to the + * by the current and destination vectors, which will 'map' the current axis to the * destination vector * - the min/max wrappers around (obvec . tarvec) result (stored temporarily in rangle) * are used to ensure that the smallest angle is chosen */ cross_v3_v3v3(raxis, obvec, tarvec); - + rangle = dot_v3v3(obvec, tarvec); rangle = acosf(max_ff(-1.0f, min_ff(1.0f, rangle))); - - /* construct rotation matrix from the axis-angle rotation found above + + /* construct rotation matrix from the axis-angle rotation found above * - this call takes care to make sure that the axis provided is a unit vector first */ axis_angle_to_mat3(rmat, raxis, rangle); - + /* rotate the owner in the way defined by this rotation matrix, then reapply the location since * we may have destroyed that in the process of multiplying the matrix */ unit_m4(tmat); mul_m4_m3m4(tmat, rmat, cob->matrix); // m1, m3, m2 - + copy_m4_m4(cob->matrix, tmat); copy_v3_v3(cob->matrix[3], obloc); } @@ -3677,17 +3677,17 @@ static bConstraintTypeInfo CTI_DAMPTRACK = { static void splineik_free(bConstraint *con) { bSplineIKConstraint *data = con->data; - + /* binding array */ if (data->points) MEM_freeN(data->points); -} +} static void splineik_copy(bConstraint *con, bConstraint *srccon) { bSplineIKConstraint *src = srccon->data; bSplineIKConstraint *dst = con->data; - + /* copy the binding array */ dst->points = MEM_dupallocN(src->points); } @@ -3705,7 +3705,7 @@ static void splineik_new_data(void *cdata) static void splineik_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bSplineIKConstraint *data = con->data; - + /* target only */ func(con, (ID **)&data->tar, false, userdata); } @@ -3715,13 +3715,13 @@ static int splineik_get_tars(bConstraint *con, ListBase *list) if (con && list) { bSplineIKConstraint *data = con->data; bConstraintTarget *ct; - + /* standard target-getting macro for single-target constraints without subtargets */ SINGLETARGETNS_GET_TARS(con, data->tar, ct, list); - + return 1; } - + return 0; } @@ -3730,7 +3730,7 @@ static void splineik_flush_tars(bConstraint *con, ListBase *list, bool no_copy) if (con && list) { bSplineIKConstraint *data = con->data; bConstraintTarget *ct = list->first; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGETNS_FLUSH_TARS(con, data->tar, ct, list, no_copy); } @@ -3767,7 +3767,7 @@ static bConstraintTypeInfo CTI_SPLINEIK = { static void pivotcon_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata) { bPivotConstraint *data = con->data; - + /* target only */ func(con, (ID **)&data->tar, false, userdata); } @@ -3777,13 +3777,13 @@ static int pivotcon_get_tars(bConstraint *con, ListBase *list) if (con && list) { bPivotConstraint *data = con->data; bConstraintTarget *ct; - + /* standard target-getting macro for single-target constraints */ SINGLETARGET_GET_TARS(con, data->tar, data->subtarget, ct, list); - + return 1; } - + return 0; } @@ -3792,7 +3792,7 @@ static void pivotcon_flush_tars(bConstraint *con, ListBase *list, bool no_copy) if (con && list) { bPivotConstraint *data = con->data; bConstraintTarget *ct = list->first; - + /* the following macro is used for all standard single-target constraints */ SINGLETARGET_FLUSH_TARS(con, data->tar, data->subtarget, ct, list, no_copy); } @@ -3802,20 +3802,20 @@ static void pivotcon_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *ta { bPivotConstraint *data = con->data; bConstraintTarget *ct = targets->first; - + float pivot[3], vec[3]; float rotMat[3][3]; /* pivot correction */ float axis[3], angle; - + /* firstly, check if pivoting should take place based on the current rotation */ if (data->rotAxis != PIVOTCON_AXIS_NONE) { float rot[3]; - + /* extract euler-rotation of target */ mat4_to_eulO(rot, cob->rotOrder, cob->matrix); - + /* check which range might be violated */ if (data->rotAxis < PIVOTCON_AXIS_X) { /* negative rotations (data->rotAxis = 0 -> 2) */ @@ -3828,7 +3828,7 @@ static void pivotcon_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *ta return; } } - + /* find the pivot-point to use */ if (VALID_CONS_TARGET(ct)) { /* apply offset to target location */ @@ -3845,7 +3845,7 @@ static void pivotcon_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *ta copy_v3_v3(pivot, data->offset); } } - + /* get rotation matrix representing the rotation of the owner */ /* TODO: perhaps we might want to include scaling based on the pivot too? */ copy_m3_m4(rotMat, cob->matrix); @@ -4413,7 +4413,7 @@ const bConstraintTypeInfo *BKE_constraint_typeinfo_from_type(int type) constraints_init_typeinfo(); CTI_INIT = 0; } - + /* only return for valid types */ if ((type >= CONSTRAINT_TYPE_NULL) && (type < NUM_CONSTRAINT_TYPES)) @@ -4424,10 +4424,10 @@ const bConstraintTypeInfo *BKE_constraint_typeinfo_from_type(int type) else { printf("No valid constraint type-info data available. Type = %i\n", type); } - + return NULL; -} - +} + /* This function should always be used to get the appropriate type-info, as it * has checks which prevent segfaults in some weird cases. */ @@ -4444,7 +4444,7 @@ const bConstraintTypeInfo *BKE_constraint_typeinfo_get(bConstraint *con) /* The functions here are called by various parts of Blender. Very few (should be none if possible) * constraint-specific code should occur here. */ - + /* ---------- Data Management ------- */ /* helper function for BKE_constraint_free_data() - unlinks references */ @@ -4462,17 +4462,17 @@ void BKE_constraint_free_data_ex(bConstraint *con, bool do_id_user) { if (con->data) { const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); - + if (cti) { /* perform any special freeing constraint may have */ if (cti->free_data) cti->free_data(con); - + /* unlink the referenced resources it uses */ if (do_id_user && cti->id_looper) cti->id_looper(con, con_unlink_refs_cb, NULL); } - + /* free constraint data now */ MEM_freeN(con->data); } @@ -4487,11 +4487,11 @@ void BKE_constraint_free_data(bConstraint *con) void BKE_constraints_free_ex(ListBase *list, bool do_id_user) { bConstraint *con; - + /* Free constraint data and also any extra data */ for (con = list->first; con; con = con->next) BKE_constraint_free_data_ex(con, do_id_user); - + /* Free the whole list */ BLI_freelistN(list); } @@ -4547,11 +4547,11 @@ static bConstraint *add_new_constraint_internal(const char *name, short type) if (cti) { /* initialize constraint data */ con->data = MEM_callocN(cti->size, cti->structName); - + /* only constraints that change any settings need this */ if (cti->new_data) cti->new_data(con->data); - + /* if no name is provided, use the type of the constraint as the name */ newName = (name && name[0]) ? name : DATA_(cti->name); } @@ -4560,10 +4560,10 @@ static bConstraint *add_new_constraint_internal(const char *name, short type) /* NOTE: any constraint type that gets here really shouldn't get added... */ newName = (name && name[0]) ? name : DATA_("Const"); } - + /* copy the name */ BLI_strncpy(con->name, newName, sizeof(con->name)); - + /* return the new constraint */ return con; } @@ -4573,27 +4573,27 @@ static bConstraint *add_new_constraint(Object *ob, bPoseChannel *pchan, const ch { bConstraint *con; ListBase *list; - + /* add the constraint */ con = add_new_constraint_internal(name, type); - + /* find the constraint stack - bone or object? */ list = (pchan) ? (&pchan->constraints) : (&ob->constraints); - + if (list) { /* add new constraint to end of list of constraints before ensuring that it has a unique name * (otherwise unique-naming code will fail, since it assumes element exists in list) */ BLI_addtail(list, con); BKE_constraint_unique_name(con, list); - + /* if the target list is a list on some PoseChannel belonging to a proxy-protected * Armature layer, we must tag newly added constraints with a flag which allows them * to persist after proxy syncing has been done */ if (BKE_constraints_proxylocked_owner(ob, pchan)) con->flag |= CONSTRAINT_PROXY_LOCAL; - + /* make this constraint the active one */ BKE_constraints_active_set(list, con); } @@ -4612,7 +4612,7 @@ static bConstraint *add_new_constraint(Object *ob, bPoseChannel *pchan, const ch break; } } - + return con; } @@ -4623,7 +4623,7 @@ bConstraint *BKE_constraint_add_for_pose(Object *ob, bPoseChannel *pchan, const { if (pchan == NULL) return NULL; - + return add_new_constraint(ob, pchan, name, type); } @@ -4639,10 +4639,10 @@ bConstraint *BKE_constraint_add_for_object(Object *ob, const char *name, short t void BKE_constraints_id_loop(ListBase *conlist, ConstraintIDFunc func, void *userdata) { bConstraint *con; - + for (con = conlist->first; con; con = con->next) { const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); - + if (cti) { if (cti->id_looper) cti->id_looper(con, func, userdata); @@ -4733,7 +4733,7 @@ bConstraint *BKE_constraints_find_name(ListBase *list, const char *name) bConstraint *BKE_constraints_active_get(ListBase *list) { bConstraint *con; - + /* search for the first constraint with the 'active' flag set */ if (list) { for (con = list->first; con; con = con->next) { @@ -4741,7 +4741,7 @@ bConstraint *BKE_constraints_active_get(ListBase *list) return con; } } - + /* no active constraint found */ return NULL; } @@ -4750,12 +4750,12 @@ bConstraint *BKE_constraints_active_get(ListBase *list) void BKE_constraints_active_set(ListBase *list, bConstraint *con) { bConstraint *c; - + if (list) { for (c = list->first; c; c = c->next) { - if (c == con) + if (c == con) c->flag |= CONSTRAINT_ACTIVE; - else + else c->flag &= ~CONSTRAINT_ACTIVE; } } @@ -4767,11 +4767,11 @@ void BKE_constraints_active_set(ListBase *list, bConstraint *con) void BKE_constraints_proxylocal_extract(ListBase *dst, ListBase *src) { bConstraint *con, *next; - + /* for each tagged constraint, remove from src and move to dst */ for (con = src->first; con; con = next) { next = con->next; - + /* check if tagged */ if (con->flag & CONSTRAINT_PROXY_LOCAL) { BLI_remlink(src, con); @@ -4787,7 +4787,7 @@ bool BKE_constraints_proxylocked_owner(Object *ob, bPoseChannel *pchan) if (ob && ob->proxy) { if (ob->pose && pchan) { bArmature *arm = ob->data; - + /* On bone-level, check if bone is on proxy-protected layer */ if ((pchan->bone) && (pchan->bone->layer & arm->layer_protected)) return true; @@ -4797,7 +4797,7 @@ bool BKE_constraints_proxylocked_owner(Object *ob, bPoseChannel *pchan) return true; } } - + return false; } @@ -4816,7 +4816,7 @@ void BKE_constraint_target_matrix_get(struct Depsgraph *depsgraph, Scene *scene, ListBase targets = {NULL, NULL}; bConstraintOb *cob; bConstraintTarget *ct; - + if (cti && cti->get_constraint_targets) { /* make 'constraint-ob' */ cob = MEM_callocN(sizeof(bConstraintOb), "tempConstraintOb"); @@ -4853,19 +4853,19 @@ void BKE_constraint_target_matrix_get(struct Depsgraph *depsgraph, Scene *scene, break; } } - + /* get targets - we only need the first one though (and there should only be one) */ cti->get_constraint_targets(con, &targets); - + /* only calculate the target matrix on the first target */ ct = (bConstraintTarget *)BLI_findlink(&targets, index); - + if (ct) { if (cti->get_target_matrix) cti->get_target_matrix(depsgraph, con, cob, ct, ctime); copy_m4_m4(mat, ct->matrix); } - + /* free targets + 'constraint-ob' */ if (cti->flush_constraint_targets) cti->flush_constraint_targets(con, &targets, 1); @@ -4881,17 +4881,17 @@ void BKE_constraint_target_matrix_get(struct Depsgraph *depsgraph, Scene *scene, void BKE_constraint_targets_for_solving_get(struct Depsgraph *depsgraph, bConstraint *con, bConstraintOb *cob, ListBase *targets, float ctime) { const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); - + if (cti && cti->get_constraint_targets) { bConstraintTarget *ct; - - /* get targets + + /* get targets * - constraints should use ct->matrix, not directly accessing values - * - ct->matrix members have not yet been calculated here! + * - ct->matrix members have not yet been calculated here! */ cti->get_constraint_targets(con, targets); - - /* set matrices + + /* set matrices * - calculate if possible, otherwise just initialize as identity matrix */ if (cti->get_target_matrix) { @@ -4904,7 +4904,7 @@ void BKE_constraint_targets_for_solving_get(struct Depsgraph *depsgraph, bConstr } } } - + /* ---------- Evaluation ----------- */ /* This function is called whenever constraints need to be evaluated. Currently, all @@ -4922,12 +4922,12 @@ void BKE_constraints_solve(struct Depsgraph *depsgraph, ListBase *conlist, bCons /* check that there is a valid constraint object to evaluate */ if (cob == NULL) return; - + /* loop over available constraints, solving and blending them */ for (con = conlist->first; con; con = con->next) { const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); ListBase targets = {NULL, NULL}; - + /* these we can skip completely (invalid constraints...) */ if (cti == NULL) continue; if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) continue; @@ -4935,37 +4935,37 @@ void BKE_constraints_solve(struct Depsgraph *depsgraph, ListBase *conlist, bCons if (cti->evaluate_constraint == NULL) continue; /* influence == 0 should be ignored */ if (con->enforce == 0.0f) continue; - + /* influence of constraint * - value should have been set from animation data already */ enf = con->enforce; - + /* make copy of worldspace matrix pre-constraint for use with blending later */ copy_m4_m4(oldmat, cob->matrix); - + /* move owner matrix into right space */ BKE_constraint_mat_convertspace(cob->ob, cob->pchan, cob->matrix, CONSTRAINT_SPACE_WORLD, con->ownspace, false); - + /* prepare targets for constraint solving */ BKE_constraint_targets_for_solving_get(depsgraph, con, cob, &targets, ctime); - + /* Solve the constraint and put result in cob->matrix */ cti->evaluate_constraint(con, cob, &targets); - - /* clear targets after use + + /* clear targets after use * - this should free temp targets but no data should be copied back * as constraints may have done some nasty things to it... */ if (cti->flush_constraint_targets) { cti->flush_constraint_targets(con, &targets, 1); } - + /* move owner back into worldspace for next constraint/other business */ - if ((con->flag & CONSTRAINT_SPACEONCE) == 0) + if ((con->flag & CONSTRAINT_SPACEONCE) == 0) BKE_constraint_mat_convertspace(cob->ob, cob->pchan, cob->matrix, con->ownspace, CONSTRAINT_SPACE_WORLD, false); - - /* Interpolate the enforcement, to blend result of constraint into final owner transform + + /* Interpolate the enforcement, to blend result of constraint into final owner transform * - all this happens in worldspace to prevent any weirdness creeping in ([#26014] and [#25725]), * since some constraints may not convert the solution back to the input space before blending * but all are guaranteed to end up in good "worldspace" result diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 6314486d809..ee907fa496f 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -84,7 +84,7 @@ struct bContext { struct bContextStore *store; const char *operator_poll_msg; /* reason for poll failing */ } wm; - + /* data context */ struct { struct Main *main; @@ -94,7 +94,7 @@ struct bContext { int py_init; /* true if python is initialized */ void *py_context; } data; - + /* data evaluation */ #if 0 struct { @@ -108,7 +108,7 @@ struct bContext { bContext *CTX_create(void) { bContext *C; - + C = MEM_callocN(sizeof(bContext), "bContext"); return C; @@ -424,7 +424,7 @@ PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, Stru __func__, member, RNA_struct_identifier(ptr.type), RNA_struct_identifier(type)); } } - + return PointerRNA_NULL; } @@ -465,13 +465,13 @@ int CTX_data_get(const bContext *C, const char *member, PointerRNA *r_ptr, ListB static void data_dir_add(ListBase *lb, const char *member, const bool use_all) { LinkData *link; - + if ((use_all == false) && STREQ(member, "scene")) /* exception */ return; if (BLI_findstring(lb, member, offsetof(LinkData, data))) return; - + link = MEM_callocN(sizeof(LinkData), "LinkData"); link->data = (void *)member; BLI_addtail(lb, link); diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 504999b0b10..f6dd630e077 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1028,7 +1028,7 @@ static void basisNurb(float t, short order, int pnts, float *knots, float *basis /* this is for float inaccuracy */ if (t < knots[0]) t = knots[0]; - else if (t > knots[opp2]) + else if (t > knots[opp2]) t = knots[opp2]; /* this part is order '1' */ @@ -2138,7 +2138,7 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float * if (tilt_array == NULL || nu->tilt_interp != nu->radius_interp) { key_curve_position_weights(fac, t, nu->radius_interp); } - *radius_array = + *radius_array = t[0] * pprev->radius + t[1] * prevbezt->radius + t[2] * bezt->radius + t[3] * next->radius; } @@ -2148,7 +2148,7 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float * if (weight_array) { /* basic interpolation for now, could copy tilt interp too */ - *weight_array = + *weight_array = prevbezt->weight + (bezt->weight - prevbezt->weight) * (3.0f * fac * fac - 2.0f * fac * fac * fac); @@ -2683,10 +2683,10 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render) } for (; nu; nu = nu->next) { - + if (nu->hide && is_editmode) continue; - + /* check if we will calculate tilt data */ do_tilt = CU_DO_TILT(cu, nu); do_radius = CU_DO_RADIUS(cu, nu); /* normal display uses the radius, better just to calculate them */ diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 2f33ca3210d..b9328051699 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -526,7 +526,7 @@ static void layerSwap_mdisps(void *data, const int *ci) for (S = 0; S < corners; S++) memcpy(d + cornersize * S, s->disps + cornersize * ci[S], cornersize * 3 * sizeof(float)); - + MEM_freeN(s->disps); s->disps = d; } @@ -631,7 +631,7 @@ static void layerCopy_grid_paint_mask(const void *source, void *dest, int count) d[i].data = NULL; d[i].level = 0; } - + } } @@ -742,7 +742,7 @@ static void layerDoMinMax_mloopcol(const void *data, void *vmin, void *vmax) if (m->g < min->g) min->g = m->g; if (m->b < min->b) min->b = m->b; if (m->a < min->a) min->a = m->a; - + if (m->r > max->r) max->r = m->r; if (m->g > max->g) max->g = m->g; if (m->b > max->b) max->b = m->b; @@ -1005,7 +1005,7 @@ static void layerInterp_mcol( const float *sub_weight; if (count <= 0) return; - + sub_weight = sub_weights; for (i = 0; i < count; ++i) { float weight = weights ? weights[i] : 1; @@ -1033,7 +1033,7 @@ static void layerInterp_mcol( /* delay writing to the destination incase dest is in sources */ for (j = 0; j < 4; ++j) { - + /* Subdivide smooth or fractal can cause problems without clamping * although weights should also not cause this situation */ mc[j].a = round_fl_to_uchar_clamp(col[j].a); @@ -1078,7 +1078,7 @@ static void layerInterp_bweight( float f; float **in = (float **)sources; int i; - + if (count <= 0) return; f = 0.0f; @@ -1129,7 +1129,7 @@ static void layerDefault_mvert_skin(void *data, int count) { MVertSkin *vs = data; int i; - + for (i = 0; i < count; i++) { copy_v3_fl(vs[i].radius, 0.25f); vs[i].flag = 0; @@ -1224,18 +1224,18 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { {sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, /* 16: CD_MLOOPUV */ {sizeof(MLoopUV), "MLoopUV", 1, N_("UVMap"), NULL, NULL, layerInterp_mloopuv, NULL, NULL, - layerEqual_mloopuv, layerMultiply_mloopuv, layerInitMinMax_mloopuv, + layerEqual_mloopuv, layerMultiply_mloopuv, layerInitMinMax_mloopuv, layerAdd_mloopuv, layerDoMinMax_mloopuv, layerCopyValue_mloopuv, NULL, NULL, NULL, layerMaxNum_tface}, /* 17: CD_MLOOPCOL */ {sizeof(MLoopCol), "MLoopCol", 1, N_("Col"), NULL, NULL, layerInterp_mloopcol, NULL, - layerDefault_mloopcol, layerEqual_mloopcol, layerMultiply_mloopcol, layerInitMinMax_mloopcol, + layerDefault_mloopcol, layerEqual_mloopcol, layerMultiply_mloopcol, layerInitMinMax_mloopcol, layerAdd_mloopcol, layerDoMinMax_mloopcol, layerCopyValue_mloopcol, NULL, NULL, NULL, layerMaxNum_mloopcol}, /* 18: CD_TANGENT */ {sizeof(float) * 4 * 4, "", 0, N_("Tangent"), NULL, NULL, NULL, NULL, NULL}, /* 19: CD_MDISPS */ {sizeof(MDisps), "MDisps", 1, NULL, layerCopy_mdisps, layerFree_mdisps, NULL, layerSwap_mdisps, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, layerRead_mdisps, layerWrite_mdisps, layerFilesize_mdisps}, /* 20: CD_PREVIEW_MCOL */ {sizeof(MCol) * 4, "MCol", 4, N_("PreviewCol"), NULL, NULL, layerInterp_mcol, @@ -1480,10 +1480,10 @@ bool CustomData_merge( else { newlayer = customData_add_layer__internal(dest, type, alloctype, data, totelem, layer->name); } - + if (newlayer) { newlayer->uid = layer->uid; - + newlayer->active = lastactive; newlayer->active_rnd = lastrender; newlayer->active_clone = lastclone; @@ -1562,7 +1562,7 @@ void CustomData_free(CustomData *data, int totelem) if (data->layers) MEM_freeN(data->layers); - + CustomData_external_free(data); CustomData_reset(data); } @@ -1866,7 +1866,7 @@ static CustomDataLayer *customData_add_layer__internal( return NULL; } } - + data->totlayer++; /* keep layers ordered by type */ @@ -1896,7 +1896,7 @@ static CustomDataLayer *customData_add_layer__internal( data->layers[index].active_clone = 0; data->layers[index].active_mask = 0; } - + customData_update_offsets(data); return &data->layers[index]; @@ -1908,7 +1908,7 @@ void *CustomData_add_layer( { CustomDataLayer *layer; const LayerTypeInfo *typeInfo = layerType_getInfo(type); - + layer = customData_add_layer__internal(data, type, alloctype, layerdata, totelem, typeInfo->defaultname); CustomData_update_typemap(data); @@ -1925,7 +1925,7 @@ void *CustomData_add_layer_named( void *layerdata, int totelem, const char *name) { CustomDataLayer *layer; - + layer = customData_add_layer__internal(data, type, alloctype, layerdata, totelem, name); CustomData_update_typemap(data); @@ -2010,7 +2010,7 @@ int CustomData_number_of_layers(const CustomData *data, int type) for (i = 0; i < data->totlayer; i++) if (data->layers[i].type == type) number++; - + return number; } @@ -2229,7 +2229,7 @@ void CustomData_copy_data(const CustomData *source, CustomData *dest, /* if we found a matching layer, copy the data */ if (dest->layers[dest_i].type == source->layers[src_i].type) { CustomData_copy_data_layer(source, dest, src_i, dest_i, source_index, dest_index, count); - + /* if there are multiple source & dest layers of the same type, * we don't want to copy all source layers to the same dest, so * increment dest_i @@ -2367,7 +2367,7 @@ void CustomData_swap(struct CustomData *data, const int index_a, const int index void *CustomData_get(const CustomData *data, int index, int type) { int layer_index; - + BLI_assert(index >= 0); /* get the layer index of the active layer of type */ @@ -2446,9 +2446,9 @@ bool CustomData_set_layer_name(const CustomData *data, int type, int n, const ch if ((layer_index == -1) || !name) return false; - + BLI_strncpy(data->layers[layer_index].name, name, sizeof(data->layers[layer_index].name)); - + return true; } @@ -2836,7 +2836,7 @@ void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest, if (*dest_block) memset(*dest_block, 0, dest->totsize); } - + /* copies a layer at a time */ dest_i = 0; for (src_i = 0; src_i < source->totlayer; ++src_i) { @@ -2878,7 +2878,7 @@ void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest, void *CustomData_bmesh_get(const CustomData *data, void *block, int type) { int layer_index; - + /* get the layer index of the first layer of type */ layer_index = CustomData_get_active_layer_index(data, type); if (layer_index == -1) return NULL; @@ -2889,7 +2889,7 @@ void *CustomData_bmesh_get(const CustomData *data, void *block, int type) void *CustomData_bmesh_get_n(const CustomData *data, void *block, int type, int n) { int layer_index; - + /* get the layer index of the first layer of type */ layer_index = CustomData_get_layer_index(data, type); if (layer_index == -1) return NULL; @@ -2908,13 +2908,13 @@ void *CustomData_bmesh_get_layer_n(const CustomData *data, void *block, int n) bool CustomData_layer_has_math(const struct CustomData *data, int layer_n) { const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[layer_n].type); - - if (typeInfo->equal && typeInfo->add && typeInfo->multiply && + + if (typeInfo->equal && typeInfo->add && typeInfo->multiply && typeInfo->initminmax && typeInfo->dominmax) { return true; } - + return false; } @@ -3187,7 +3187,7 @@ void CustomData_to_bmesh_block(const CustomData *source, CustomData *dest, if (*dest_block == NULL) CustomData_bmesh_alloc_block(dest, dest_block); - + /* copies a layer at a time */ dest_i = 0; for (src_i = 0; src_i < source->totlayer; ++src_i) { @@ -3389,7 +3389,7 @@ static bool cd_layer_find_dupe(CustomData *data, const char *name, int type, int for (i = 0; i < data->totlayer; i++) { if (i != index) { CustomDataLayer *layer = &data->layers[i]; - + if (CustomData_is_property_layer(type)) { if (CustomData_is_property_layer(layer->type) && STREQ(layer->name, name)) { return true; @@ -3402,7 +3402,7 @@ static bool cd_layer_find_dupe(CustomData *data, const char *name, int type, int } } } - + return false; } @@ -3413,7 +3413,7 @@ static bool customdata_unique_check(void *arg, const char *name) } void CustomData_set_layer_unique_name(CustomData *data, int index) -{ +{ CustomDataLayer *nlayer = &data->layers[index]; const LayerTypeInfo *typeInfo = layerType_getInfo(nlayer->type); @@ -3519,7 +3519,7 @@ void CustomData_external_read(CustomData *data, ID *id, CustomDataMask mask, int if (!external) return; - + for (i = 0; i < data->totlayer; i++) { layer = &data->layers[i]; typeInfo = layerType_getInfo(layer->type); diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c index d17c9ef5cc6..aa762865a2a 100644 --- a/source/blender/blenkernel/intern/customdata_file.c +++ b/source/blender/blenkernel/intern/customdata_file.c @@ -115,7 +115,7 @@ static int cdf_data_type_size(int datatype) { if (datatype == CDF_DATA_FLOAT) return sizeof(float); - + return 0; } #endif @@ -156,7 +156,7 @@ static int cdf_read_header(CDataFile *cdf) if (!fread(header, sizeof(CDataFileHeader), 1, cdf->readf)) return 0; - + if (memcmp(header->ID, "BCDF", sizeof(header->ID)) != 0) return 0; if (header->version > CDF_VERSION) @@ -179,7 +179,7 @@ static int cdf_read_header(CDataFile *cdf) if (fseek(f, offset, SEEK_SET) != 0) return 0; - + if (header->type == CDF_TYPE_IMAGE) { image = &cdf->btype.image; if (!fread(image, sizeof(CDataFileImageHeader), 1, f)) @@ -258,7 +258,7 @@ static int cdf_write_header(CDataFile *cdf) if (!fwrite(header, sizeof(CDataFileHeader), 1, f)) return 0; - + if (header->type == CDF_TYPE_IMAGE) { image = &cdf->btype.image; if (!fwrite(image, sizeof(CDataFileImageHeader), 1, f)) @@ -287,7 +287,7 @@ bool cdf_read_open(CDataFile *cdf, const char *filename) f = BLI_fopen(filename, "rb"); if (!f) return 0; - + cdf->readf = f; if (!cdf_read_header(cdf)) { @@ -352,7 +352,7 @@ bool cdf_write_open(CDataFile *cdf, const char *filename) f = BLI_fopen(filename, "wb"); if (!f) return 0; - + cdf->writef = f; /* fill header */ @@ -424,7 +424,7 @@ CDataFileLayer *cdf_layer_find(CDataFile *cdf, int type, const char *name) if (layer->type == type && STREQ(layer->name, name)) return layer; } - + return NULL; } diff --git a/source/blender/blenkernel/intern/editmesh_bvh.c b/source/blender/blenkernel/intern/editmesh_bvh.c index e68f11f6274..c1121d5b1ea 100644 --- a/source/blender/blenkernel/intern/editmesh_bvh.c +++ b/source/blender/blenkernel/intern/editmesh_bvh.c @@ -147,9 +147,9 @@ BMBVHTree *BKE_bmbvh_new_ex( BLI_bvhtree_insert(bmtree->tree, i, (float *)cos, 3); } - + BLI_bvhtree_balance(bmtree->tree); - + return bmtree; } @@ -188,11 +188,11 @@ BMBVHTree *BKE_bmbvh_new( void BKE_bmbvh_free(BMBVHTree *bmtree) { BLI_bvhtree_free(bmtree->tree); - + if (bmtree->cos_cage && bmtree->cos_cage_free) { MEM_freeN((void *)bmtree->cos_cage); } - + MEM_freeN(bmtree); } @@ -313,7 +313,7 @@ BMFace *BKE_bmbvh_ray_cast(BMBVHTree *bmtree, const float co[3], const float dir /* ok to leave 'uv' uninitialized */ bmcb_data.looptris = (const BMLoop *(*)[3])bmtree->looptris; bmcb_data.cos_cage = (const float (*)[3])bmtree->cos_cage; - + BLI_bvhtree_ray_cast(bmtree->tree, co, dir, radius, &hit, bmbvh_ray_cast_cb, &bmcb_data); if (hit.index != -1 && hit.dist != dist) { diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 3bf58b8886a..7e506570b7e 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -314,7 +314,7 @@ void pd_point_from_particle(ParticleSimulationData *sim, ParticleData *pa, Parti point->index = pa - sim->psys->particles; point->size = pa->size; point->charge = 0.0f; - + if (part->pd && part->pd->forcefield == PFIELD_CHARGE) point->charge += part->pd->f_strength; @@ -373,7 +373,7 @@ void pd_point_from_soft(Scene *scene, float *loc, float *vel, int index, Effecte // triangle - ray callback function static void eff_tri_ray_hit(void *UNUSED(userData), int UNUSED(index), const BVHTreeRay *UNUSED(ray), BVHTreeRayHit *hit) -{ +{ /* whenever we hit a bounding box, we don't check further */ hit->dist = -1; hit->index = 1; @@ -387,7 +387,7 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect ColliderCache *col; float norm[3], len = 0.0; float visibility = 1.0, absorption = 0.0; - + if (!(eff->pd->flag & PFIELD_VISIBILITY)) return visibility; @@ -399,7 +399,7 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect negate_v3_v3(norm, efd->vec_to_point); len = normalize_v3(norm); - + /* check all collision objects */ for (col = colls->first; col; col = col->next) { CollisionModifierData *collmd = col->collmd; @@ -422,7 +422,7 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect /* visibility is only between 0 and 1, calculated from 1-absorption */ visibility *= CLAMPIS(1.0f-absorption, 0.0f, 1.0f); - + if (visibility <= 0.0f) break; } @@ -431,7 +431,7 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect if (!colliders) free_collider_cache(&colls); - + return visibility; } @@ -442,11 +442,11 @@ static float wind_func(struct RNG *rng, float strength) float force = BLI_rng_get_float(rng) + 1.0f; float ret; float sign = 0; - + sign = ((float)random > 64.0f) ? 1.0f: -1.0f; // dividing by 2 is not giving equal sign distribution - + ret = sign*((float)random / force)*strength/128.0f; - + return ret; } @@ -539,7 +539,7 @@ int closest_point_on_surface(SurfaceModifierData *surmd, const float co[3], floa if (surface_vel) { const MLoop *mloop = surmd->bvhtree->loop; const MLoopTri *lt = &surmd->bvhtree->looptri[nearest.index]; - + copy_v3_v3(surface_vel, surmd->v[mloop[lt->tri[0]].v].co); add_v3_v3(surface_vel, surmd->v[mloop[lt->tri[1]].v].co); add_v3_v3(surface_vel, surmd->v[mloop[lt->tri[2]].v].co); @@ -621,7 +621,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin efd->nor[0] = 1.f; efd->nor[1] = efd->nor[2] = 0.f; mul_qt_v3(state.rot, efd->nor); - + if (real_velocity) copy_v3_v3(efd->vel, state.vel); @@ -694,9 +694,9 @@ static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoin } else if (eff->psys) { *tot = eff->psys->totpart; - + if (eff->pd->forcefield == PFIELD_CHARGE) { - /* Only the charge of the effected particle is used for + /* Only the charge of the effected particle is used for * interaction, not fall-offs. If the fall-offs aren't the * same this will be unphysical, but for animation this * could be the wanted behavior. If you want physical @@ -858,10 +858,10 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected /* new vortex force */ cross_v3_v3v3(temp, efd->nor2, efd->vec_to_point2); mul_v3_fl(temp, strength * efd->falloff); - + cross_v3_v3v3(force, efd->nor2, temp); mul_v3_fl(force, strength * efd->falloff); - + madd_v3_v3fl(temp, point->vel, -point->vel_to_sec); add_v3_v3(force, temp); } @@ -889,7 +889,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected break; case PFIELD_LENNARDJ: fac = pow((efd->size + point->size) / efd->distance, 6.0); - + fac = - fac * (1.0f - fac) / efd->distance; /* limit the repulsive term drastically to avoid huge forces */ @@ -994,7 +994,7 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we /* Cycle through collected objects, get total of (1/(gravity_strength * dist^gravity_power)) */ /* Check for min distance here? (yes would be cool to add that, ton) */ - + if (effectors) for (eff = effectors->first; eff; eff=eff->next) { /* object effectors were fully checked to be OK to evaluate! */ @@ -1003,7 +1003,7 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we for (; p<tot; p+=step) { if (get_effector_data(eff, &efd, point, 0)) { efd.falloff= effector_falloff(eff, &efd, point, weights); - + if (efd.falloff > 0.0f) efd.falloff *= eff_calc_visibility(colliders, eff, &efd, point); @@ -1018,7 +1018,7 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we copy_v3_v3(temp1, force); do_physical_effector(eff, &efd, point, force); - + /* for softbody backward compatibility */ if (point->flag & PE_WIND_AS_SPEED && impulse) { sub_v3_v3v3(temp2, force, temp1); @@ -1131,14 +1131,14 @@ void BKE_sim_debug_data_add_element(int type, const float v1[3], const float v2[ { unsigned int category_hash = BLI_ghashutil_strhash_p(category); SimDebugElement *elem; - + if (!_sim_debug_data) { if (G.debug & G_DEBUG_SIMDATA) BKE_sim_debug_data_set_enabled(true); else return; } - + elem = MEM_callocN(sizeof(SimDebugElement), "sim debug data element"); elem->type = type; elem->category_hash = category_hash; @@ -1158,7 +1158,7 @@ void BKE_sim_debug_data_add_element(int type, const float v1[3], const float v2[ BLI_strncpy(elem->str, str, sizeof(elem->str)); else elem->str[0] = '\0'; - + debug_data_insert(_sim_debug_data, elem); } @@ -1167,7 +1167,7 @@ void BKE_sim_debug_data_remove_element(unsigned int hash) SimDebugElement dummy; if (!_sim_debug_data) return; - + dummy.hash = hash; BLI_ghash_remove(_sim_debug_data->gh, &dummy, NULL, debug_element_free); } @@ -1176,7 +1176,7 @@ void BKE_sim_debug_data_clear(void) { if (!_sim_debug_data) return; - + if (_sim_debug_data->gh) BLI_ghash_clear(_sim_debug_data->gh, NULL, debug_element_free); } @@ -1184,17 +1184,17 @@ void BKE_sim_debug_data_clear(void) void BKE_sim_debug_data_clear_category(const char *category) { int category_hash = (int)BLI_ghashutil_strhash_p(category); - + if (!_sim_debug_data) return; - + if (_sim_debug_data->gh) { GHashIterator iter; BLI_ghashIterator_init(&iter, _sim_debug_data->gh); while (!BLI_ghashIterator_done(&iter)) { const SimDebugElement *elem = BLI_ghashIterator_getValue(&iter); BLI_ghashIterator_step(&iter); /* removing invalidates the current iterator, so step before removing */ - + if (elem->category_hash == category_hash) BLI_ghash_remove(_sim_debug_data->gh, elem, NULL, debug_element_free); } diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 0ffc9054ddd..e63d99a35ee 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -29,7 +29,7 @@ * \ingroup bke */ - + #include <math.h> #include <stdio.h> @@ -58,7 +58,7 @@ #include "BKE_armature.h" #include "BKE_constraint.h" #include "BKE_context.h" -#include "BKE_curve.h" +#include "BKE_curve.h" #include "BKE_global.h" #include "BKE_object.h" #include "BKE_nla.h" @@ -66,7 +66,7 @@ #include "RNA_access.h" #ifdef WITH_PYTHON -#include "BPY_extern.h" +#include "BPY_extern.h" #endif #define SMALL -1.0e-10 @@ -83,20 +83,20 @@ static ThreadMutex python_driver_lock = BLI_MUTEX_INITIALIZER; /* Frees the F-Curve itself too, so make sure BLI_remlink is called before calling this... */ void free_fcurve(FCurve *fcu) { - if (fcu == NULL) + if (fcu == NULL) return; /* free curve data */ MEM_SAFE_FREE(fcu->bezt); MEM_SAFE_FREE(fcu->fpt); - + /* free RNA-path, as this were allocated when getting the path string */ MEM_SAFE_FREE(fcu->rna_path); - + /* free extra data - i.e. modifiers, and driver */ fcurve_free_driver(fcu); free_fmodifiers(&fcu->modifiers); - + /* free f-curve itself */ MEM_freeN(fcu); } @@ -105,12 +105,12 @@ void free_fcurve(FCurve *fcu) void free_fcurves(ListBase *list) { FCurve *fcu, *fcn; - + /* sanity check */ if (list == NULL) return; - - /* free data - no need to call remlink before freeing each curve, + + /* free data - no need to call remlink before freeing each curve, * as we store reference to next, and freeing only touches the curve * it's given */ @@ -118,10 +118,10 @@ void free_fcurves(ListBase *list) fcn = fcu->next; free_fcurve(fcu); } - + /* clear pointers just in case */ BLI_listbase_clear(list); -} +} /* ---------------------- Copy --------------------------- */ @@ -129,30 +129,30 @@ void free_fcurves(ListBase *list) FCurve *copy_fcurve(const FCurve *fcu) { FCurve *fcu_d; - + /* sanity check */ if (fcu == NULL) return NULL; - + /* make a copy */ fcu_d = MEM_dupallocN(fcu); - + fcu_d->next = fcu_d->prev = NULL; fcu_d->grp = NULL; - + /* copy curve data */ fcu_d->bezt = MEM_dupallocN(fcu_d->bezt); fcu_d->fpt = MEM_dupallocN(fcu_d->fpt); - + /* copy rna-path */ fcu_d->rna_path = MEM_dupallocN(fcu_d->rna_path); - + /* copy driver */ fcu_d->driver = fcurve_copy_driver(fcu_d->driver); - + /* copy modifiers */ copy_fmodifiers(&fcu_d->modifiers, &fcu->modifiers); - + /* return new data */ return fcu_d; } @@ -161,14 +161,14 @@ FCurve *copy_fcurve(const FCurve *fcu) void copy_fcurves(ListBase *dst, ListBase *src) { FCurve *dfcu, *sfcu; - + /* sanity checks */ if (ELEM(NULL, dst, src)) return; - + /* clear destination list first */ BLI_listbase_clear(dst); - + /* copy one-by-one */ for (sfcu = src->first; sfcu; sfcu = sfcu->next) { dfcu = copy_fcurve(sfcu); @@ -192,22 +192,22 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro if (r_driven) *r_driven = false; - + /* only use the current action ??? */ if (ELEM(NULL, adt, adt->action)) return NULL; - + RNA_pointer_create(id, type, data, &ptr); prop = RNA_struct_find_property(&ptr, prop_name); - + if (prop) { path = RNA_path_from_ID_to_property(&ptr, prop); - + if (path) { /* animation takes priority over drivers */ if ((adt->action) && (adt->action->curves.first)) fcu = list_find_fcurve(&adt->action->curves, path, index); - + /* if not animated, check if driven */ if ((fcu == NULL) && (adt->drivers.first)) { fcu = list_find_fcurve(&adt->drivers, path, index); @@ -215,7 +215,7 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro *r_driven = true; fcu = NULL; } - + MEM_freeN(path); } } @@ -228,11 +228,11 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro FCurve *list_find_fcurve(ListBase *list, const char rna_path[], const int array_index) { FCurve *fcu; - + /* sanity checks */ if (ELEM(NULL, list, rna_path) || (array_index < 0) ) return NULL; - + /* check paths of curves, then array indices... */ for (fcu = list->first; fcu; fcu = fcu->next) { /* simple string-compare (this assumes that they have the same root...) */ @@ -242,7 +242,7 @@ FCurve *list_find_fcurve(ListBase *list, const char rna_path[], const int array_ return fcu; } } - + /* return */ return NULL; } @@ -251,7 +251,7 @@ FCurve *list_find_fcurve(ListBase *list, const char rna_path[], const int array_ FCurve *iter_step_fcurve(FCurve *fcu_iter, const char rna_path[]) { FCurve *fcu; - + /* sanity checks */ if (ELEM(NULL, fcu_iter, rna_path)) return NULL; @@ -268,7 +268,7 @@ FCurve *iter_step_fcurve(FCurve *fcu_iter, const char rna_path[]) return NULL; } -/* Get list of LinkData's containing pointers to the F-Curves which control the types of data indicated +/* Get list of LinkData's containing pointers to the F-Curves which control the types of data indicated * Lists... * - dst: list of LinkData's matching the criteria returned. * List must be freed after use, and is assumed to be empty when passed. @@ -281,36 +281,36 @@ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix, { FCurve *fcu; int matches = 0; - + /* sanity checks */ if (ELEM(NULL, dst, src, dataPrefix, dataName)) return 0; else if ((dataPrefix[0] == 0) || (dataName[0] == 0)) return 0; - + /* search each F-Curve one by one */ for (fcu = src->first; fcu; fcu = fcu->next) { /* check if quoted string matches the path */ if ((fcu->rna_path) && strstr(fcu->rna_path, dataPrefix)) { char *quotedName = BLI_str_quoted_substrN(fcu->rna_path, dataPrefix); - + if (quotedName) { /* check if the quoted name matches the required name */ if (STREQ(quotedName, dataName)) { LinkData *ld = MEM_callocN(sizeof(LinkData), __func__); - + ld->data = fcu; BLI_addtail(dst, ld); - + matches++; } - + /* always free the quoted string, since it needs freeing */ MEM_freeN(quotedName); } } } - + /* return the number of matches */ return matches; } @@ -328,39 +328,39 @@ FCurve *rna_get_fcurve_context_ui( { FCurve *fcu = NULL; PointerRNA tptr = *ptr; - + *r_driven = false; *r_special = false; - + if (r_animdata) *r_animdata = NULL; if (r_action) *r_action = NULL; - + /* Special case for NLA Control Curves... */ if (BKE_nlastrip_has_curves_for_property(ptr, prop)) { NlaStrip *strip = (NlaStrip *)ptr->data; - + /* Set the special flag, since it cannot be a normal action/driver * if we've been told to start looking here... */ *r_special = true; - + /* The F-Curve either exists or it doesn't here... */ fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), rnaindex); return fcu; } - + /* there must be some RNA-pointer + property combon */ if (prop && tptr.id.data && RNA_property_animateable(&tptr, prop)) { AnimData *adt = BKE_animdata_from_id(tptr.id.data); int step = C ? 2 : 1; /* Always 1 in case we have no context (can't check in 'ancestors' of given RNA ptr). */ char *path = NULL; - + if (!adt && C) { path = BKE_animdata_driver_path_hack(C, &tptr, prop, NULL); adt = BKE_animdata_from_id(tptr.id.data); step--; } - + /* Standard F-Curve - Animation (Action) or Drivers */ while (adt && step--) { if ((adt->action && adt->action->curves.first) || (adt->drivers.first)) { @@ -368,27 +368,27 @@ FCurve *rna_get_fcurve_context_ui( if (step) { path = RNA_path_from_ID_to_property(&tptr, prop); } - + // XXX: the logic here is duplicated with a function up above if (path) { /* animation takes priority over drivers */ if (adt->action && adt->action->curves.first) { fcu = list_find_fcurve(&adt->action->curves, path, rnaindex); - + if (fcu && r_action) *r_action = adt->action; } - + /* if not animated, check if driven */ if (!fcu && (adt->drivers.first)) { fcu = list_find_fcurve(&adt->drivers, path, rnaindex); - + if (fcu) { if (r_animdata) *r_animdata = adt; *r_driven = true; } } - + if (fcu && r_action) { if (r_animdata) *r_animdata = adt; *r_action = adt->action; @@ -410,7 +410,7 @@ FCurve *rna_get_fcurve_context_ui( } MEM_SAFE_FREE(path); } - + return fcu; } @@ -423,10 +423,10 @@ static int binarysearch_bezt_index_ex(BezTriple array[], float frame, int arrayl { int start = 0, end = arraylen; int loopbreaker = 0, maxloop = arraylen * 2; - + /* initialize replace-flag first */ *r_replace = false; - + /* sneaky optimizations (don't go through searching process if...): * - keyframe to be added is to be added out of current bounds * - keyframe to be added would replace one of the existing ones on bounds @@ -438,7 +438,7 @@ static int binarysearch_bezt_index_ex(BezTriple array[], float frame, int arrayl else { /* check whether to add before/after/on */ float framenum; - + /* 'First' Keyframe (when only one keyframe, this case is used) */ framenum = array[0].vec[1][0]; if (IS_EQT(frame, framenum, threshold)) { @@ -447,7 +447,7 @@ static int binarysearch_bezt_index_ex(BezTriple array[], float frame, int arrayl } else if (frame < framenum) return 0; - + /* 'Last' Keyframe */ framenum = array[(arraylen - 1)].vec[1][0]; if (IS_EQT(frame, framenum, threshold)) { @@ -457,37 +457,37 @@ static int binarysearch_bezt_index_ex(BezTriple array[], float frame, int arrayl else if (frame > framenum) return arraylen; } - - + + /* most of the time, this loop is just to find where to put it - * 'loopbreaker' is just here to prevent infinite loops + * 'loopbreaker' is just here to prevent infinite loops */ for (loopbreaker = 0; (start <= end) && (loopbreaker < maxloop); loopbreaker++) { /* compute and get midpoint */ int mid = start + ((end - start) / 2); /* we calculate the midpoint this way to avoid int overflows... */ float midfra = array[mid].vec[1][0]; - + /* check if exactly equal to midpoint */ if (IS_EQT(frame, midfra, threshold)) { *r_replace = true; return mid; } - + /* repeat in upper/lower half */ if (frame > midfra) start = mid + 1; else if (frame < midfra) end = mid - 1; } - + /* print error if loop-limit exceeded */ if (loopbreaker == (maxloop - 1)) { printf("Error: binarysearch_bezt_index() was taking too long\n"); - + /* include debug info */ printf("\tround = %d: start = %d, end = %d, arraylen = %d\n", loopbreaker, start, end, arraylen); } - + /* not found, so return where to place it */ return start; } @@ -509,20 +509,20 @@ static short get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple const bool do_sel_only) { bool found = false; - + /* init outputs */ *first = NULL; *last = NULL; - + /* sanity checks */ if (fcu->bezt == NULL) return found; - + /* only include selected items? */ if (do_sel_only) { BezTriple *bezt; unsigned int i; - + /* find first selected */ bezt = fcu->bezt; for (i = 0; i < fcu->totvert; bezt++, i++) { @@ -532,7 +532,7 @@ static short get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple break; } } - + /* find last selected */ bezt = ARRAY_LAST_ITEM(fcu->bezt, BezTriple, fcu->totvert); for (i = 0; i < fcu->totvert; bezt--, i++) { @@ -549,7 +549,7 @@ static short get_fcurve_end_keyframes(FCurve *fcu, BezTriple **first, BezTriple *last = ARRAY_LAST_ITEM(fcu->bezt, BezTriple, fcu->totvert); found = true; } - + return found; } @@ -562,18 +562,18 @@ bool calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa float yminv = 999999999.0f, ymaxv = -999999999.0f; bool foundvert = false; unsigned int i; - + if (fcu->totvert) { if (fcu->bezt) { BezTriple *bezt_first = NULL, *bezt_last = NULL; - + if (xmin || xmax) { /* get endpoint keyframes */ foundvert = get_fcurve_end_keyframes(fcu, &bezt_first, &bezt_last, do_sel_only); - + if (bezt_first) { BLI_assert(bezt_last != NULL); - + if (include_handles) { xminv = min_fff(xminv, bezt_first->vec[0][0], bezt_first->vec[1][0]); xmaxv = max_fff(xmaxv, bezt_last->vec[1][0], bezt_last->vec[2][0]); @@ -584,33 +584,33 @@ bool calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa } } } - + /* only loop over keyframes to find extents for values if needed */ if (ymin || ymax) { BezTriple *bezt, *prevbezt = NULL; - + for (bezt = fcu->bezt, i = 0; i < fcu->totvert; prevbezt = bezt, bezt++, i++) { if ((do_sel_only == false) || BEZT_ISSEL_ANY(bezt)) { /* keyframe itself */ yminv = min_ff(yminv, bezt->vec[1][1]); ymaxv = max_ff(ymaxv, bezt->vec[1][1]); - + if (include_handles) { - /* left handle - only if applicable + /* left handle - only if applicable * NOTE: for the very first keyframe, the left handle actually has no bearings on anything */ if (prevbezt && (prevbezt->ipo == BEZT_IPO_BEZ)) { yminv = min_ff(yminv, bezt->vec[0][1]); ymaxv = max_ff(ymaxv, bezt->vec[0][1]); } - + /* right handle - only if applicable */ if (bezt->ipo == BEZT_IPO_BEZ) { yminv = min_ff(yminv, bezt->vec[2][1]); ymaxv = max_ff(ymaxv, bezt->vec[2][1]); } } - + foundvert = true; } } @@ -622,41 +622,41 @@ bool calc_fcurve_bounds(FCurve *fcu, float *xmin, float *xmax, float *ymin, floa xminv = min_ff(xminv, fcu->fpt[0].vec[0]); xmaxv = max_ff(xmaxv, fcu->fpt[fcu->totvert - 1].vec[0]); } - + /* only loop over keyframes to find extents for values if needed */ if (ymin || ymax) { FPoint *fpt; - + for (fpt = fcu->fpt, i = 0; i < fcu->totvert; fpt++, i++) { if (fpt->vec[1] < yminv) yminv = fpt->vec[1]; if (fpt->vec[1] > ymaxv) ymaxv = fpt->vec[1]; - + foundvert = true; } } } } - + if (foundvert) { if (xmin) *xmin = xminv; if (xmax) *xmax = xmaxv; - + if (ymin) *ymin = yminv; if (ymax) *ymax = ymaxv; } else { if (G.debug & G_DEBUG) printf("F-Curve calc bounds didn't find anything, so assuming minimum bounds of 1.0\n"); - + if (xmin) *xmin = 0.0f; if (xmax) *xmax = 1.0f; - + if (ymin) *ymin = 0.0f; if (ymax) *ymax = 1.0f; } - + return foundvert; } @@ -670,28 +670,28 @@ bool calc_fcurve_range(FCurve *fcu, float *start, float *end, if (fcu->totvert) { if (fcu->bezt) { BezTriple *bezt_first = NULL, *bezt_last = NULL; - + /* get endpoint keyframes */ get_fcurve_end_keyframes(fcu, &bezt_first, &bezt_last, do_sel_only); - + if (bezt_first) { BLI_assert(bezt_last != NULL); - + min = min_ff(min, bezt_first->vec[1][0]); max = max_ff(max, bezt_last->vec[1][0]); - + foundvert = true; } } else if (fcu->fpt) { min = min_ff(min, fcu->fpt[0].vec[0]); max = max_ff(max, fcu->fpt[fcu->totvert - 1].vec[0]); - + foundvert = true; } - + } - + if (foundvert == false) { min = max = 0.0f; } @@ -711,7 +711,7 @@ bool calc_fcurve_range(FCurve *fcu, float *start, float *end, /* ----------------- Status Checks -------------------------- */ -/* Are keyframes on F-Curve of any use? +/* Are keyframes on F-Curve of any use? * Usability of keyframes refers to whether they should be displayed, * and also whether they will have any influence on the final result. */ @@ -720,11 +720,11 @@ bool fcurve_are_keyframes_usable(FCurve *fcu) /* F-Curve must exist */ if (fcu == NULL) return false; - + /* F-Curve must not have samples - samples are mutually exclusive of keyframes */ if (fcu->fpt) return false; - + /* if it has modifiers, none of these should "drastically" alter the curve */ if (fcu->modifiers.first) { FModifier *fcm; @@ -735,7 +735,7 @@ bool fcurve_are_keyframes_usable(FCurve *fcu) /* ignore if muted/disabled */ if (fcm->flag & (FMODIFIER_FLAG_DISABLED | FMODIFIER_FLAG_MUTED)) continue; - + /* type checks */ switch (fcm->type) { /* clearly harmless - do nothing */ @@ -743,12 +743,12 @@ bool fcurve_are_keyframes_usable(FCurve *fcu) case FMODIFIER_TYPE_STEPPED: case FMODIFIER_TYPE_NOISE: break; - + /* sometimes harmful - depending on whether they're "additive" or not */ case FMODIFIER_TYPE_GENERATOR: { FMod_Generator *data = (FMod_Generator *)fcm->data; - + if ((data->flag & FCM_GENERATOR_ADDITIVE) == 0) return false; break; @@ -756,7 +756,7 @@ bool fcurve_are_keyframes_usable(FCurve *fcu) case FMODIFIER_TYPE_FN_GENERATOR: { FMod_FunctionGenerator *data = (FMod_FunctionGenerator *)fcm->data; - + if ((data->flag & FCM_GENERATOR_ADDITIVE) == 0) return false; break; @@ -767,7 +767,7 @@ bool fcurve_are_keyframes_usable(FCurve *fcu) } } } - + /* keyframes are usable */ return true; } @@ -778,7 +778,7 @@ bool BKE_fcurve_is_protected(FCurve *fcu) ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED))); } -/* Can keyframes be added to F-Curve? +/* Can keyframes be added to F-Curve? * Keyframes can only be added if they are already visible */ bool fcurve_is_keyframable(FCurve *fcu) @@ -786,11 +786,11 @@ bool fcurve_is_keyframable(FCurve *fcu) /* F-Curve's keyframes must be "usable" (i.e. visible + have an effect on final result) */ if (fcurve_are_keyframes_usable(fcu) == 0) return false; - + /* F-Curve must currently be editable too */ if (BKE_fcurve_is_protected(fcu)) return false; - + /* F-Curve is keyframable */ return true; } @@ -801,7 +801,7 @@ bool fcurve_is_keyframable(FCurve *fcu) void bezt_add_to_cfra_elem(ListBase *lb, BezTriple *bezt) { CfraElem *ce, *cen; - + for (ce = lb->first; ce; ce = ce->next) { /* double key? */ if (IS_EQT(ce->cfra, bezt->vec[1][0], BEZT_BINARYSEARCH_THRESH)) { @@ -811,7 +811,7 @@ void bezt_add_to_cfra_elem(ListBase *lb, BezTriple *bezt) /* should key be inserted before this column? */ else if (ce->cfra > bezt->vec[1][0]) break; } - + /* create a new column */ cen = MEM_callocN(sizeof(CfraElem), "add_to_cfra_elem"); if (ce) BLI_insertlinkbefore(lb, ce, cen); @@ -826,26 +826,26 @@ void bezt_add_to_cfra_elem(ListBase *lb, BezTriple *bezt) * data imported from BVH/Mocap files), which are specialized for use with high density datasets, * which BezTriples/Keyframe data are ill equipped to do. */ - - -/* Basic sampling callback which acts as a wrapper for evaluate_fcurve() + + +/* Basic sampling callback which acts as a wrapper for evaluate_fcurve() * 'data' arg here is unneeded here... */ float fcurve_samplingcb_evalcurve(FCurve *fcu, void *UNUSED(data), float evaltime) { /* assume any interference from drivers on the curve is intended... */ return evaluate_fcurve(fcu, evaltime); -} +} - -/* Main API function for creating a set of sampled curve data, given some callback function + +/* Main API function for creating a set of sampled curve data, given some callback function * used to retrieve the values to store. */ void fcurve_store_samples(FCurve *fcu, void *data, int start, int end, FcuSampleFunc sample_cb) { FPoint *fpt, *new_fpt; int cfra; - + /* sanity checks */ /* TODO: make these tests report errors using reports not printf's */ if (ELEM(NULL, fcu, sample_cb)) { @@ -856,20 +856,20 @@ void fcurve_store_samples(FCurve *fcu, void *data, int start, int end, FcuSample printf("Error: Frame range for Sampled F-Curve creation is inappropriate\n"); return; } - + /* set up sample data */ fpt = new_fpt = MEM_callocN(sizeof(FPoint) * (end - start + 1), "FPoint Samples"); - + /* use the sampling callback at 1-frame intervals from start to end frames */ for (cfra = start; cfra <= end; cfra++, fpt++) { fpt->vec[0] = (float)cfra; fpt->vec[1] = sample_cb(fcu, data, (float)cfra); } - + /* free any existing sample/keyframe data on curve */ if (fcu->bezt) MEM_freeN(fcu->bezt); if (fcu->fpt) MEM_freeN(fcu->fpt); - + /* store the samples */ fcu->bezt = NULL; fcu->fpt = new_fpt; @@ -922,7 +922,7 @@ static BezTriple *cycle_offset_triple(bool cycle, BezTriple *out, const BezTripl return out; } -/* This function recalculates the handles of an F-Curve +/* This function recalculates the handles of an F-Curve * If the BezTriples have been rearranged, sort them first before using this. */ void calchandles_fcurve(FCurve *fcu) @@ -935,7 +935,7 @@ void calchandles_fcurve(FCurve *fcu) * - need bezier keys * - only bezier-interpolation has handles (for now) */ - if (ELEM(NULL, fcu, fcu->bezt) || (a < 2) /*|| ELEM(fcu->ipo, BEZT_IPO_CONST, BEZT_IPO_LIN)*/) + if (ELEM(NULL, fcu, fcu->bezt) || (a < 2) /*|| ELEM(fcu->ipo, BEZT_IPO_CONST, BEZT_IPO_LIN)*/) return; /* if the first modifier is Cycles, smooth the curve through the cycle */ @@ -948,16 +948,16 @@ void calchandles_fcurve(FCurve *fcu) bezt = fcu->bezt; prev = cycle_offset_triple(cycle, &tmp, &fcu->bezt[fcu->totvert - 2], last, first); next = (bezt + 1); - + /* loop over all beztriples, adjusting handles */ while (a--) { /* clamp timing of handles to be on either side of beztriple */ if (bezt->vec[0][0] > bezt->vec[1][0]) bezt->vec[0][0] = bezt->vec[1][0]; if (bezt->vec[2][0] < bezt->vec[1][0]) bezt->vec[2][0] = bezt->vec[1][0]; - + /* calculate auto-handles */ BKE_nurb_handle_calc(bezt, prev, next, true, fcu->auto_smoothing); - + /* for automatic ease in and out */ if (BEZT_IS_AUTOH(bezt) && !cycle) { /* only do this on first or last beztriple */ @@ -975,7 +975,7 @@ void calchandles_fcurve(FCurve *fcu) if (prev && prev->vec[1][0] >= bezt->vec[1][0]) { prev->f5 = bezt->f5 = HD_AUTOTYPE_SPECIAL; } - + /* advance pointers for next iteration */ prev = bezt; @@ -1026,16 +1026,16 @@ void testhandles_fcurve(FCurve *fcu, const bool use_handle) void sort_time_fcurve(FCurve *fcu) { bool ok = true; - + /* keep adjusting order of beztriples until nothing moves (bubble-sort) */ while (ok) { ok = 0; - + /* currently, will only be needed when there are beztriples */ if (fcu->bezt) { BezTriple *bezt; unsigned int a; - + /* loop over ALL points to adjust position in array and recalculate handles */ for (a = 0, bezt = fcu->bezt; a < fcu->totvert; a++, bezt++) { /* check if thee's a next beztriple which we could try to swap with current */ @@ -1045,7 +1045,7 @@ void sort_time_fcurve(FCurve *fcu) SWAP(BezTriple, *bezt, *(bezt + 1)); ok = 1; } - + /* if either one of both of the points exceeds crosses over the keyframe time... */ if ( (bezt->vec[0][0] > bezt->vec[1][0]) && (bezt->vec[2][0] < bezt->vec[1][0]) ) { /* swap handles if they have switched sides for some reason */ @@ -1066,15 +1066,15 @@ void sort_time_fcurve(FCurve *fcu) short test_time_fcurve(FCurve *fcu) { unsigned int a; - + /* sanity checks */ if (fcu == NULL) return 0; - + /* currently, only need to test beztriples */ if (fcu->bezt) { BezTriple *bezt; - + /* loop through all BezTriples, stopping when one exceeds the one after it */ for (a = 0, bezt = fcu->bezt; a < (fcu->totvert - 1); a++, bezt++) { if (bezt->vec[1][0] > (bezt + 1)->vec[1][0]) @@ -1083,14 +1083,14 @@ short test_time_fcurve(FCurve *fcu) } else if (fcu->fpt) { FPoint *fpt; - + /* loop through all FPoints, stopping when one exceeds the one after it */ for (a = 0, fpt = fcu->fpt; a < (fcu->totvert - 1); a++, fpt++) { if (fpt->vec[0] > (fpt + 1)->vec[0]) return 1; } } - + /* none need any swapping */ return 0; } @@ -1103,7 +1103,7 @@ short test_time_fcurve(FCurve *fcu) typedef struct DriverVarTypeInfo { /* evaluation callback */ float (*get_value)(ChannelDriver *driver, DriverVar *dvar); - + /* allocation of target slots */ int num_targets; /* number of target slots required */ const char *target_names[MAX_DRIVER_TARGETS]; /* UI names that should be given to the slots */ @@ -1113,7 +1113,7 @@ typedef struct DriverVarTypeInfo { /* Macro to begin definitions */ #define BEGIN_DVAR_TYPEDEF(type) \ { - + /* Macro to end definitions */ #define END_DVAR_TYPEDEF \ } @@ -1135,27 +1135,27 @@ static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar) ID *id; int index = -1; float value = 0.0f; - + /* sanity check */ if (ELEM(NULL, driver, dtar)) return 0.0f; - + id = dtar_id_ensure_proxy_from(dtar->id); - + /* error check for missing pointer... */ if (id == NULL) { if (G.debug & G_DEBUG) { printf("Error: driver has an invalid target to use (path = %s)\n", dtar->rna_path); } - + driver->flag |= DRIVER_FLAG_INVALID; dtar->flag |= DTAR_FLAG_INVALID; return 0.0f; } - + /* get RNA-pointer for the ID-block given in target */ RNA_id_pointer_create(id, &id_ptr); - + /* get property to read from, and get value as appropriate */ if (RNA_path_resolve_property_full(&id_ptr, dtar->rna_path, &ptr, &prop, &index)) { if (RNA_property_array_check(prop)) { @@ -1178,10 +1178,10 @@ static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar) else { /* out of bounds */ if (G.debug & G_DEBUG) { - printf("Driver Evaluation Error: array index is out of bounds for %s -> %s (%d)", + printf("Driver Evaluation Error: array index is out of bounds for %s -> %s (%d)", id->name, dtar->rna_path, index); } - + driver->flag |= DRIVER_FLAG_INVALID; dtar->flag |= DTAR_FLAG_INVALID; return 0.0f; @@ -1212,12 +1212,12 @@ static float dtar_get_prop_val(ChannelDriver *driver, DriverTarget *dtar) if (G.debug & G_DEBUG) { printf("Driver Evaluation Error: cannot resolve target for %s -> %s\n", id->name, dtar->rna_path); } - + driver->flag |= DRIVER_FLAG_INVALID; dtar->flag |= DTAR_FLAG_INVALID; return 0.0f; } - + /* if we're still here, we should be ok... */ dtar->flag &= ~DTAR_FLAG_INVALID; return value; @@ -1302,7 +1302,7 @@ static bPoseChannel *dtar_get_pchan_ptr(ChannelDriver *driver, DriverTarget *dta /* check if the ID here is a valid object */ if (id && GS(id->name)) { Object *ob = (Object *)id; - + /* get pose, and subsequently, posechannel */ return BKE_pose_channel_find_name(ob->pose, dtar->pchan_name); } @@ -1426,24 +1426,24 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar) Object *ob = (Object *)dtar_id_ensure_proxy_from(dtar->id); bPoseChannel *pchan; float tmp_loc[3]; - + /* after the checks above, the targets should be valid here... */ BLI_assert((ob != NULL) && (GS(ob->id.name) == ID_OB)); - + /* try to get posechannel */ pchan = BKE_pose_channel_find_name(ob->pose, dtar->pchan_name); - + /* check if object or bone */ if (pchan) { /* bone */ if (dtar->flag & DTAR_FLAG_LOCALSPACE) { if (dtar->flag & DTAR_FLAG_LOCAL_CONSTS) { float mat[4][4]; - + /* extract transform just like how the constraints do it! */ copy_m4_m4(mat, pchan->pose_mat); BKE_constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_LOCAL, false); - + /* ... and from that, we get our transform */ copy_v3_v3(tmp_loc, mat[3]); } @@ -1464,11 +1464,11 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar) if (dtar->flag & DTAR_FLAG_LOCAL_CONSTS) { /* XXX: this should practically be the same as transform space... */ float mat[4][4]; - + /* extract transform just like how the constraints do it! */ copy_m4_m4(mat, ob->obmat); BKE_constraint_mat_convertspace(ob, NULL, mat, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL, false); - + /* ... and from that, we get our transform */ copy_v3_v3(tmp_loc, mat[3]); } @@ -1482,7 +1482,7 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar) copy_v3_v3(tmp_loc, ob->obmat[3]); } } - + /* copy the location to the right place */ if (tarIndex) { copy_v3_v3(loc2, tmp_loc); @@ -1492,10 +1492,10 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar) } } DRIVER_TARGETS_LOOPER_END - - + + /* if we're still here, there should now be two targets to use, - * so just take the length of the vector between these points + * so just take the length of the vector between these points */ return len_v3v3(loc1, loc2); } @@ -1510,7 +1510,7 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar) float oldEul[3] = {0.0f, 0.0f, 0.0f}; bool use_eulers = false; short rot_order = ROT_MODE_EUL; - + /* check if this target has valid data */ if ((ob == NULL) || (GS(ob->id.name) != ID_OB)) { /* invalid target, so will not have enough targets */ @@ -1522,11 +1522,11 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar) /* target should be valid now */ dtar->flag &= ~DTAR_FLAG_INVALID; } - + /* try to get posechannel */ pchan = BKE_pose_channel_find_name(ob->pose, dtar->pchan_name); - - /* check if object or bone, and get transform matrix accordingly + + /* check if object or bone, and get transform matrix accordingly * - "useEulers" code is used to prevent the problems associated with non-uniqueness * of euler decomposition from matrices [#20870] * - localspace is for [#21384], where parent results are not wanted @@ -1539,7 +1539,7 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar) rot_order = pchan->rotmode; use_eulers = true; } - + if (dtar->flag & DTAR_FLAG_LOCALSPACE) { if (dtar->flag & DTAR_FLAG_LOCAL_CONSTS) { /* just like how the constraints do it! */ @@ -1547,7 +1547,7 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar) BKE_constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_LOCAL, false); } else { - /* specially calculate local matrix, since chan_mat is not valid + /* specially calculate local matrix, since chan_mat is not valid * since it stores delta transform of pose_mat so that deforms work * so it cannot be used here for "transform" space */ @@ -1566,7 +1566,7 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar) rot_order = ob->rotmode; use_eulers = true; } - + if (dtar->flag & DTAR_FLAG_LOCALSPACE) { if (dtar->flag & DTAR_FLAG_LOCAL_CONSTS) { /* just like how the constraints do it! */ @@ -1583,7 +1583,7 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar) copy_m4_m4(mat, ob->obmat); } } - + /* check which transform */ if (dtar->transChan >= MAX_DTAR_TRANSCHAN_TYPES) { /* not valid channel */ @@ -1595,22 +1595,22 @@ static float dvar_eval_transChan(ChannelDriver *driver, DriverVar *dvar) return len_v3(mat[dtar->transChan - DTAR_TRANSCHAN_SCALEX]); } else if (dtar->transChan >= DTAR_TRANSCHAN_ROTX) { - /* extract rotation as eulers (if needed) + /* extract rotation as eulers (if needed) * - definitely if rotation order isn't eulers already * - if eulers, then we have 2 options: * a) decompose transform matrix as required, then try to make eulers from * there compatible with original values - * b) [NOT USED] directly use the original values (no decomposition) + * b) [NOT USED] directly use the original values (no decomposition) * - only an option for "transform space", if quality is really bad with a) */ float eul[3]; - + mat4_to_eulO(eul, rot_order, mat); - + if (use_eulers) { compatible_eul(eul, oldEul); } - + return eul[dtar->transChan - DTAR_TRANSCHAN_ROTX]; } else { @@ -1629,21 +1629,21 @@ static DriverVarTypeInfo dvar_types[MAX_DVAR_TYPES] = { {"Property"}, /* UI names for targets */ {0} /* flags */ END_DVAR_TYPEDEF, - + BEGIN_DVAR_TYPEDEF(DVAR_TYPE_ROT_DIFF) dvar_eval_rotDiff, /* eval callback */ 2, /* number of targets used */ {"Object/Bone 1", "Object/Bone 2"}, /* UI names for targets */ {DTAR_FLAG_STRUCT_REF | DTAR_FLAG_ID_OB_ONLY, DTAR_FLAG_STRUCT_REF | DTAR_FLAG_ID_OB_ONLY} /* flags */ END_DVAR_TYPEDEF, - + BEGIN_DVAR_TYPEDEF(DVAR_TYPE_LOC_DIFF) dvar_eval_locDiff, /* eval callback */ 2, /* number of targets used */ {"Object/Bone 1", "Object/Bone 2"}, /* UI names for targets */ {DTAR_FLAG_STRUCT_REF | DTAR_FLAG_ID_OB_ONLY, DTAR_FLAG_STRUCT_REF | DTAR_FLAG_ID_OB_ONLY} /* flags */ END_DVAR_TYPEDEF, - + BEGIN_DVAR_TYPEDEF(DVAR_TYPE_TRANSFORM_CHAN) dvar_eval_transChan, /* eval callback */ 1, /* number of targets used */ @@ -1670,20 +1670,20 @@ void driver_free_variable(ListBase *variables, DriverVar *dvar) /* sanity checks */ if (dvar == NULL) return; - - /* free target vars + + /* free target vars * - need to go over all of them, not just up to the ones that are used - * currently, since there may be some lingering RNA paths from + * currently, since there may be some lingering RNA paths from * previous users needing freeing */ - DRIVER_TARGETS_LOOPER(dvar) + DRIVER_TARGETS_LOOPER(dvar) { /* free RNA path if applicable */ if (dtar->rna_path) MEM_freeN(dtar->rna_path); } DRIVER_TARGETS_LOOPER_END - + /* remove the variable from the driver */ BLI_freelinkN(variables, dvar); } @@ -1693,7 +1693,7 @@ void driver_free_variable_ex(ChannelDriver *driver, DriverVar *dvar) { /* remove and free the driver variable */ driver_free_variable(&driver->variables, dvar); - + #ifdef WITH_PYTHON /* since driver variables are cached, the expression needs re-compiling too */ if (driver->type == DRIVER_TYPE_PYTHON) @@ -1706,10 +1706,10 @@ void driver_variables_copy(ListBase *dst_vars, const ListBase *src_vars) { BLI_assert(BLI_listbase_is_empty(dst_vars)); BLI_duplicatelist(dst_vars, src_vars); - + for (DriverVar *dvar = dst_vars->first; dvar; dvar = dvar->next) { /* need to go over all targets so that we don't leave any dangling paths */ - DRIVER_TARGETS_LOOPER(dvar) + DRIVER_TARGETS_LOOPER(dvar) { /* make a copy of target's rna path if available */ if (dtar->rna_path) @@ -1723,25 +1723,25 @@ void driver_variables_copy(ListBase *dst_vars, const ListBase *src_vars) void driver_change_variable_type(DriverVar *dvar, int type) { const DriverVarTypeInfo *dvti = get_dvar_typeinfo(type); - + /* sanity check */ if (ELEM(NULL, dvar, dvti)) return; - + /* set the new settings */ dvar->type = type; dvar->num_targets = dvti->num_targets; - - /* make changes to the targets based on the defines for these types + + /* make changes to the targets based on the defines for these types * NOTE: only need to make sure the ones we're using here are valid... */ DRIVER_TARGETS_USED_LOOPER(dvar) { short flags = dvti->target_flags[tarIndex]; - + /* store the flags */ dtar->flag = flags; - + /* object ID types only, or idtype not yet initialized */ if ((flags & DTAR_FLAG_ID_OB_ONLY) || (dtar->idtype == 0)) dtar->idtype = ID_OB; @@ -1758,19 +1758,19 @@ void driver_variable_name_validate(DriverVar *dvar) '/', '\\', '?', ':', ';', '<', '>', '{', '}', '[', ']', '|', ' ', '.', '\t', '\n', '\r' }; - + /* sanity checks */ if (dvar == NULL) return; - + /* clear all invalid-name flags */ dvar->flag &= ~DVAR_ALL_INVALID_FLAGS; - + /* 0) Zero-length identifiers are not allowed */ if (dvar->name[0] == '\0') { dvar->flag |= DVAR_FLAG_INVALID_EMPTY; } - + /* 1) Must start with a letter */ /* XXX: We assume that valid unicode letters in other languages are ok too, hence the blacklisting */ if (IN_RANGE_INCL(dvar->name[0], '0', '9')) { @@ -1780,7 +1780,7 @@ void driver_variable_name_validate(DriverVar *dvar) /* NOTE: We don't allow names to start with underscores (i.e. it helps when ruling out security risks) */ dvar->flag |= DVAR_FLAG_INVALID_START_CHAR; } - + /* 2) Must not contain invalid stuff in the middle of the string */ if (strchr(dvar->name, ' ')) { dvar->flag |= DVAR_FLAG_INVALID_HAS_SPACE; @@ -1788,17 +1788,17 @@ void driver_variable_name_validate(DriverVar *dvar) if (strchr(dvar->name, '.')) { dvar->flag |= DVAR_FLAG_INVALID_HAS_DOT; } - + /* 3) Check for special characters - Either at start, or in the middle */ for (int i = 0; i < sizeof(special_char_blacklist); i++) { char *match = strchr(dvar->name, special_char_blacklist[i]); - + if (match == dvar->name) dvar->flag |= DVAR_FLAG_INVALID_START_CHAR; else if (match != NULL) dvar->flag |= DVAR_FLAG_INVALID_HAS_SPECIAL; } - + /* 4) Check if the name is a reserved keyword * NOTE: These won't confuse Python, but it will be impossible to use the variable * in an expression without Python misinterpreting what these are for @@ -1818,29 +1818,29 @@ void driver_variable_name_validate(DriverVar *dvar) DriverVar *driver_add_new_variable(ChannelDriver *driver) { DriverVar *dvar; - + /* sanity checks */ if (driver == NULL) return NULL; - + /* make a new variable */ dvar = MEM_callocN(sizeof(DriverVar), "DriverVar"); BLI_addtail(&driver->variables, dvar); - + /* give the variable a 'unique' name */ strcpy(dvar->name, CTX_DATA_(BLT_I18NCONTEXT_ID_ACTION, "var")); BLI_uniquename(&driver->variables, dvar, CTX_DATA_(BLT_I18NCONTEXT_ID_ACTION, "var"), '_', offsetof(DriverVar, name), sizeof(dvar->name)); - + /* set the default type to 'single prop' */ driver_change_variable_type(dvar, DVAR_TYPE_SINGLE_PROP); - + #ifdef WITH_PYTHON /* since driver variables are cached, the expression needs re-compiling too */ if (driver->type == DRIVER_TYPE_PYTHON) driver->flag |= DRIVER_FLAG_RENAMEVAR; #endif - + /* return the target */ return dvar; } @@ -1850,12 +1850,12 @@ void fcurve_free_driver(FCurve *fcu) { ChannelDriver *driver; DriverVar *dvar, *dvarn; - + /* sanity checks */ if (ELEM(NULL, fcu, fcu->driver)) return; driver = fcu->driver; - + /* free driver targets */ for (dvar = driver->variables.first; dvar; dvar = dvarn) { dvarn = dvar->next; @@ -1877,19 +1877,19 @@ void fcurve_free_driver(FCurve *fcu) ChannelDriver *fcurve_copy_driver(const ChannelDriver *driver) { ChannelDriver *ndriver; - + /* sanity checks */ if (driver == NULL) return NULL; - + /* copy all data */ ndriver = MEM_dupallocN(driver); ndriver->expr_comp = NULL; - + /* copy variables */ - BLI_listbase_clear(&ndriver->variables); /* to get rid of refs to non-copied data (that's still used on original) */ + BLI_listbase_clear(&ndriver->variables); /* to get rid of refs to non-copied data (that's still used on original) */ driver_variables_copy(&ndriver->variables, &driver->variables); - + /* return the new driver */ return ndriver; } @@ -1904,18 +1904,18 @@ float driver_get_variable_value(ChannelDriver *driver, DriverVar *dvar) /* sanity check */ if (ELEM(NULL, driver, dvar)) return 0.0f; - - /* call the relevant callbacks to get the variable value + + /* call the relevant callbacks to get the variable value * using the variable type info, storing the obtained value * in dvar->curval so that drivers can be debugged */ dvti = get_dvar_typeinfo(dvar->type); - + if (dvti && dvti->get_value) dvar->curval = dvti->get_value(driver, dvar); else dvar->curval = 0.0f; - + return dvar->curval; } @@ -1927,11 +1927,11 @@ float driver_get_variable_value(ChannelDriver *driver, DriverVar *dvar) float evaluate_driver(PathResolvedRNA *anim_rna, ChannelDriver *driver, ChannelDriver *driver_orig, const float evaltime) { DriverVar *dvar; - + /* check if driver can be evaluated */ if (driver_orig->flag & DRIVER_FLAG_INVALID) return 0.0f; - + switch (driver->type) { case DRIVER_TYPE_AVERAGE: /* average values of driver targets */ case DRIVER_TYPE_SUM: /* sum values of driver targets */ @@ -1946,13 +1946,13 @@ float evaluate_driver(PathResolvedRNA *anim_rna, ChannelDriver *driver, ChannelD /* more than one target, so average the values of the targets */ float value = 0.0f; int tot = 0; - + /* loop through targets, adding (hopefully we don't get any overflow!) */ for (dvar = driver->variables.first; dvar; dvar = dvar->next) { value += driver_get_variable_value(driver, dvar); tot++; } - + /* perform operations on the total if appropriate */ if (driver->type == DRIVER_TYPE_AVERAGE) driver->curval = tot ? (value / (float)tot) : 0.0f; @@ -1965,23 +1965,23 @@ float evaluate_driver(PathResolvedRNA *anim_rna, ChannelDriver *driver, ChannelD case DRIVER_TYPE_MAX: /* largest value */ { float value = 0.0f; - + /* loop through the variables, getting the values and comparing them to existing ones */ for (dvar = driver->variables.first; dvar; dvar = dvar->next) { /* get value */ float tmp_val = driver_get_variable_value(driver, dvar); - + /* store this value if appropriate */ if (dvar->prev) { /* check if greater/smaller than the baseline */ if (driver->type == DRIVER_TYPE_MAX) { /* max? */ - if (tmp_val > value) + if (tmp_val > value) value = tmp_val; } else { /* min? */ - if (tmp_val < value) + if (tmp_val < value) value = tmp_val; } } @@ -1990,7 +1990,7 @@ float evaluate_driver(PathResolvedRNA *anim_rna, ChannelDriver *driver, ChannelD value = tmp_val; } } - + /* store value in driver */ driver->curval = value; break; @@ -2021,14 +2021,14 @@ float evaluate_driver(PathResolvedRNA *anim_rna, ChannelDriver *driver, ChannelD } default: { - /* special 'hack' - just use stored value + /* special 'hack' - just use stored value * This is currently used as the mechanism which allows animated settings to be able * to be changed via the UI. */ break; } } - + /* return value for driver */ return driver->curval; } @@ -2042,15 +2042,15 @@ float evaluate_driver(PathResolvedRNA *anim_rna, ChannelDriver *driver, ChannelD void correct_bezpart(float v1[2], float v2[2], float v3[2], float v4[2]) { float h1[2], h2[2], len1, len2, len, fac; - + /* calculate handle deltas */ h1[0] = v1[0] - v2[0]; h1[1] = v1[1] - v2[1]; - + h2[0] = v4[0] - v3[0]; h2[1] = v4[1] - v3[1]; - - /* calculate distances: + + /* calculate distances: * - len = span of time between keyframes * - len1 = length of handle of start key * - len2 = length of handle of end key @@ -2058,20 +2058,20 @@ void correct_bezpart(float v1[2], float v2[2], float v3[2], float v4[2]) len = v4[0] - v1[0]; len1 = fabsf(h1[0]); len2 = fabsf(h2[0]); - + /* if the handles have no length, no need to do any corrections */ if ((len1 + len2) == 0.0f) return; - + /* the two handles cross over each other, so force them - * apart using the proportion they overlap + * apart using the proportion they overlap */ if ((len1 + len2) > len) { fac = len / (len1 + len2); - + v2[0] = (v1[0] - fac * h1[0]); v2[1] = (v1[1] - fac * h1[1]); - + v3[0] = (v4[0] - fac * h2[0]); v3[1] = (v4[1] - fac * h2[1]); } @@ -2087,7 +2087,7 @@ static int findzero(float x, float q0, float q1, float q2, float q3, float *o) c1 = 3.0f * (q1 - q0); c2 = 3.0f * (q0 - 2.0f * q1 + q2); c3 = q3 - q0 + 3.0f * (q1 - q2); - + if (c3 != 0.0) { a = c2 / c3; b = c1 / c3; @@ -2097,21 +2097,21 @@ static int findzero(float x, float q0, float q1, float q2, float q3, float *o) p = b / 3 - a * a; q = (2 * a * a * a - a * b + c) / 2; d = q * q + p * p * p; - + if (d > 0.0) { t = sqrt(d); o[0] = (float)(sqrt3d(-q + t) + sqrt3d(-q - t) - a); - + if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) return 1; else return 0; } else if (d == 0.0) { t = sqrt3d(-q); o[0] = (float)(2 * t - a); - + if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) nr++; o[nr] = (float)(-t - a); - + if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) return nr + 1; else return nr; } @@ -2121,13 +2121,13 @@ static int findzero(float x, float q0, float q1, float q2, float q3, float *o) p = cos(phi / 3); q = sqrt(3 - 3 * p * p); o[0] = (float)(2 * t * p - a); - + if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) nr++; o[nr] = (float)(-t * (p + q) - a); - + if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) nr++; o[nr] = (float)(-t * (p - q) - a); - + if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) return nr + 1; else return nr; } @@ -2136,18 +2136,18 @@ static int findzero(float x, float q0, float q1, float q2, float q3, float *o) a = c2; b = c1; c = c0; - + if (a != 0.0) { /* discriminant */ p = b * b - 4 * a * c; - + if (p > 0) { p = sqrt(p); o[0] = (float)((-b - p) / (2 * a)); - + if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) nr++; o[nr] = (float)((-b + p) / (2 * a)); - + if ((o[nr] >= (float)SMALL) && (o[nr] <= 1.000001f)) return nr + 1; else return nr; } @@ -2159,7 +2159,7 @@ static int findzero(float x, float q0, float q1, float q2, float q3, float *o) } else if (b != 0.0) { o[0] = (float)(-c / b); - + if ((o[0] >= (float)SMALL) && (o[0] <= 1.000001f)) return 1; else return 0; } @@ -2167,7 +2167,7 @@ static int findzero(float x, float q0, float q1, float q2, float q3, float *o) o[0] = 0.0; return 1; } - + return 0; } } @@ -2218,13 +2218,13 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime unsigned int a; int b; float cvalue = 0.0f; - + /* get pointers */ a = fcu->totvert - 1; prevbezt = bezts; bezt = prevbezt + 1; lastbezt = prevbezt + a; - + /* evaluation time at or past endpoints? */ if (prevbezt->vec[1][0] >= evaltime) { /* before or on first keyframe */ @@ -2234,7 +2234,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime /* linear or bezier interpolation */ if (prevbezt->ipo == BEZT_IPO_LIN) { /* Use the next center point instead of our own handle for - * linear interpolated extrapolate + * linear interpolated extrapolate */ if (fcu->totvert == 1) { cvalue = prevbezt->vec[1][1]; @@ -2243,7 +2243,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime bezt = prevbezt + 1; dx = prevbezt->vec[1][0] - evaltime; fac = bezt->vec[1][0] - prevbezt->vec[1][0]; - + /* prevent division by zero */ if (fac) { fac = (bezt->vec[1][1] - prevbezt->vec[1][1]) / fac; @@ -2260,7 +2260,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime */ dx = prevbezt->vec[1][0] - evaltime; fac = prevbezt->vec[1][0] - prevbezt->vec[0][0]; - + /* prevent division by zero */ if (fac) { fac = (prevbezt->vec[1][1] - prevbezt->vec[0][1]) / fac; @@ -2272,8 +2272,8 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime } } else { - /* constant (BEZT_IPO_HORIZ) extrapolation or constant interpolation, - * so just extend first keyframe's value + /* constant (BEZT_IPO_HORIZ) extrapolation or constant interpolation, + * so just extend first keyframe's value */ cvalue = prevbezt->vec[1][1]; } @@ -2286,7 +2286,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime /* linear or bezier interpolation */ if (lastbezt->ipo == BEZT_IPO_LIN) { /* Use the next center point instead of our own handle for - * linear interpolated extrapolate + * linear interpolated extrapolate */ if (fcu->totvert == 1) { cvalue = lastbezt->vec[1][1]; @@ -2295,7 +2295,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime prevbezt = lastbezt - 1; dx = evaltime - lastbezt->vec[1][0]; fac = lastbezt->vec[1][0] - prevbezt->vec[1][0]; - + /* prevent division by zero */ if (fac) { fac = (lastbezt->vec[1][1] - prevbezt->vec[1][1]) / fac; @@ -2312,7 +2312,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime */ dx = evaltime - lastbezt->vec[1][0]; fac = lastbezt->vec[2][0] - lastbezt->vec[1][0]; - + /* prevent division by zero */ if (fac) { fac = (lastbezt->vec[2][1] - lastbezt->vec[1][1]) / fac; @@ -2324,8 +2324,8 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime } } else { - /* constant (BEZT_IPO_HORIZ) extrapolation or constant interpolation, - * so just extend last keyframe's value + /* constant (BEZT_IPO_HORIZ) extrapolation or constant interpolation, + * so just extend last keyframe's value */ cvalue = lastbezt->vec[1][1]; } @@ -2333,9 +2333,9 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime else { /* evaltime occurs somewhere in the middle of the curve */ bool exact = false; - + /* Use binary search to find appropriate keyframes... - * + * * The threshold here has the following constraints: * - 0.001 is too coarse -> We get artifacts with 2cm driver movements at 1BU = 1m (see T40332) * - 0.00001 is too fine -> Weird errors, like selecting the wrong keyframe range (see T39207), occur. @@ -2343,9 +2343,9 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime */ a = binarysearch_bezt_index_ex(bezts, evaltime, fcu->totvert, 0.0001, &exact); if (G.debug & G_DEBUG) printf("eval fcurve '%s' - %f => %u/%u, %d\n", fcu->rna_path, evaltime, a, fcu->totvert, exact); - + if (exact) { - /* index returned must be interpreted differently when it sits on top of an existing keyframe + /* index returned must be interpreted differently when it sits on top of an existing keyframe * - that keyframe is the start of the segment we need (see action_bug_2.blend in T39207) */ prevbezt = bezts + a; @@ -2358,7 +2358,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime bezt = bezts + a; prevbezt = (a > 0) ? (bezt - 1) : bezt; } - + /* use if the key is directly on the frame, rare cases this is needed else we get 0.0 instead. */ /* XXX: consult T39207 for examples of files where failure of these checks can cause issues */ if (exact) { @@ -2375,7 +2375,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime const float time = evaltime - prevbezt->vec[1][0]; const float amplitude = prevbezt->amplitude; const float period = prevbezt->period; - + /* value depends on interpolation mode */ if ((prevbezt->ipo == BEZT_IPO_CONST) || (fcu->flag & FCURVE_DISCRETE_VALUES) || (duration == 0)) { /* constant (evaltime not relevant, so no interpolation needed) */ @@ -2396,7 +2396,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime v3[1] = bezt->vec[0][1]; v4[0] = bezt->vec[1][0]; v4[1] = bezt->vec[1][1]; - + if (fabsf(v1[1] - v4[1]) < FLT_EPSILON && fabsf(v2[1] - v3[1]) < FLT_EPSILON && fabsf(v3[1] - v4[1]) < FLT_EPSILON) @@ -2409,7 +2409,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime else { /* adjust handles so that they don't overlap (forming a loop) */ correct_bezpart(v1, v2, v3, v4); - + /* try to get a value for this position - if failure, try another set of points */ b = findzero(evaltime, v1[0], v2[0], v3[0], v4[0], opl); if (b) { @@ -2422,12 +2422,12 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime } } break; - + case BEZT_IPO_LIN: /* linear - simply linearly interpolate between values of the two keyframes */ cvalue = BLI_easing_linear_ease(time, begin, change, duration); break; - + /* easing ............................................ */ case BEZT_IPO_BACK: switch (prevbezt->easing) { @@ -2440,13 +2440,13 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime case BEZT_IPO_EASE_IN_OUT: cvalue = BLI_easing_back_ease_in_out(time, begin, change, duration, prevbezt->back); break; - + default: /* default/auto: same as ease out */ cvalue = BLI_easing_back_ease_out(time, begin, change, duration, prevbezt->back); break; } break; - + case BEZT_IPO_BOUNCE: switch (prevbezt->easing) { case BEZT_IPO_EASE_IN: @@ -2458,13 +2458,13 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime case BEZT_IPO_EASE_IN_OUT: cvalue = BLI_easing_bounce_ease_in_out(time, begin, change, duration); break; - + default: /* default/auto: same as ease out */ cvalue = BLI_easing_bounce_ease_out(time, begin, change, duration); break; } break; - + case BEZT_IPO_CIRC: switch (prevbezt->easing) { case BEZT_IPO_EASE_IN: @@ -2476,7 +2476,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime case BEZT_IPO_EASE_IN_OUT: cvalue = BLI_easing_circ_ease_in_out(time, begin, change, duration); break; - + default: /* default/auto: same as ease in */ cvalue = BLI_easing_circ_ease_in(time, begin, change, duration); break; @@ -2494,13 +2494,13 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime case BEZT_IPO_EASE_IN_OUT: cvalue = BLI_easing_cubic_ease_in_out(time, begin, change, duration); break; - + default: /* default/auto: same as ease in */ cvalue = BLI_easing_cubic_ease_in(time, begin, change, duration); break; } break; - + case BEZT_IPO_ELASTIC: switch (prevbezt->easing) { case BEZT_IPO_EASE_IN: @@ -2512,13 +2512,13 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime case BEZT_IPO_EASE_IN_OUT: cvalue = BLI_easing_elastic_ease_in_out(time, begin, change, duration, amplitude, period); break; - + default: /* default/auto: same as ease out */ cvalue = BLI_easing_elastic_ease_out(time, begin, change, duration, amplitude, period); break; } break; - + case BEZT_IPO_EXPO: switch (prevbezt->easing) { case BEZT_IPO_EASE_IN: @@ -2530,13 +2530,13 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime case BEZT_IPO_EASE_IN_OUT: cvalue = BLI_easing_expo_ease_in_out(time, begin, change, duration); break; - + default: /* default/auto: same as ease in */ cvalue = BLI_easing_expo_ease_in(time, begin, change, duration); break; } break; - + case BEZT_IPO_QUAD: switch (prevbezt->easing) { case BEZT_IPO_EASE_IN: @@ -2548,13 +2548,13 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime case BEZT_IPO_EASE_IN_OUT: cvalue = BLI_easing_quad_ease_in_out(time, begin, change, duration); break; - + default: /* default/auto: same as ease in */ cvalue = BLI_easing_quad_ease_in(time, begin, change, duration); break; } break; - + case BEZT_IPO_QUART: switch (prevbezt->easing) { case BEZT_IPO_EASE_IN: @@ -2566,13 +2566,13 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime case BEZT_IPO_EASE_IN_OUT: cvalue = BLI_easing_quart_ease_in_out(time, begin, change, duration); break; - + default: /* default/auto: same as ease in */ cvalue = BLI_easing_quart_ease_in(time, begin, change, duration); break; } break; - + case BEZT_IPO_QUINT: switch (prevbezt->easing) { case BEZT_IPO_EASE_IN: @@ -2584,13 +2584,13 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime case BEZT_IPO_EASE_IN_OUT: cvalue = BLI_easing_quint_ease_in_out(time, begin, change, duration); break; - + default: /* default/auto: same as ease in */ cvalue = BLI_easing_quint_ease_in(time, begin, change, duration); break; } break; - + case BEZT_IPO_SINE: switch (prevbezt->easing) { case BEZT_IPO_EASE_IN: @@ -2602,14 +2602,14 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime case BEZT_IPO_EASE_IN_OUT: cvalue = BLI_easing_sine_ease_in_out(time, begin, change, duration); break; - + default: /* default/auto: same as ease in */ cvalue = BLI_easing_sine_ease_in(time, begin, change, duration); break; } break; - - + + default: cvalue = prevbezt->vec[1][1]; break; @@ -2620,7 +2620,7 @@ static float fcurve_eval_keyframes(FCurve *fcu, BezTriple *bezts, float evaltime if (G.debug & G_DEBUG) printf(" ERROR: failed eval - p=%f b=%f, t=%f (%f)\n", prevbezt->vec[1][0], bezt->vec[1][0], evaltime, fabsf(bezt->vec[1][0] - evaltime)); } } - + /* return value */ return cvalue; } @@ -2630,11 +2630,11 @@ static float fcurve_eval_samples(FCurve *fcu, FPoint *fpts, float evaltime) { FPoint *prevfpt, *lastfpt, *fpt; float cvalue = 0.0f; - + /* get pointers */ prevfpt = fpts; lastfpt = prevfpt + fcu->totvert - 1; - + /* evaluation time at or past endpoints? */ if (prevfpt->vec[0] >= evaltime) { /* before or on first sample, so just extend value */ @@ -2646,24 +2646,24 @@ static float fcurve_eval_samples(FCurve *fcu, FPoint *fpts, float evaltime) } else { float t = fabsf(evaltime - floorf(evaltime)); - + /* find the one on the right frame (assume that these are spaced on 1-frame intervals) */ fpt = prevfpt + ((int)evaltime - (int)prevfpt->vec[0]); - + /* if not exactly on the frame, perform linear interpolation with the next one */ if ((t != 0.0f) && (t < 1.0f)) cvalue = interpf(fpt->vec[1], (fpt + 1)->vec[1], 1.0f - t); else cvalue = fpt->vec[1]; } - + /* return value */ return cvalue; } /* ***************************** F-Curve - Evaluation ********************************* */ -/* Evaluate and return the value of the given F-Curve at the specified frame ("evaltime") +/* Evaluate and return the value of the given F-Curve at the specified frame ("evaltime") * Note: this is also used for drivers */ static float evaluate_fcurve_ex(FCurve *fcu, float evaltime, float cvalue) @@ -2674,16 +2674,16 @@ static float evaluate_fcurve_ex(FCurve *fcu, float evaltime, float cvalue) /* evaluate modifiers which modify time to evaluate the base curve at */ storage = evaluate_fmodifiers_storage_new(&fcu->modifiers); devaltime = evaluate_time_fmodifiers(storage, &fcu->modifiers, fcu, cvalue, evaltime); - - /* evaluate curve-data - * - 'devaltime' instead of 'evaltime', as this is the time that the last time-modifying + + /* evaluate curve-data + * - 'devaltime' instead of 'evaltime', as this is the time that the last time-modifying * F-Curve modifier on the stack requested the curve to be evaluated at */ if (fcu->bezt) cvalue = fcurve_eval_keyframes(fcu, fcu->bezt, devaltime); else if (fcu->fpt) cvalue = fcurve_eval_samples(fcu, fcu->fpt, devaltime); - + /* evaluate modifiers */ evaluate_value_fmodifiers(storage, &fcu->modifiers, fcu, &cvalue, devaltime); @@ -2694,7 +2694,7 @@ static float evaluate_fcurve_ex(FCurve *fcu, float evaltime, float cvalue) */ if (fcu->flag & FCURVE_INT_VALUES) cvalue = floorf(cvalue + 0.5f); - + /* return evaluated value */ return cvalue; } @@ -2754,7 +2754,7 @@ float evaluate_fcurve_driver(PathResolvedRNA *anim_rna, FCurve *fcu, ChannelDriv /* Calculate the value of the given F-Curve at the given frame, and set its curval */ float calculate_fcurve(PathResolvedRNA *anim_rna, FCurve *fcu, float evaltime) { - /* only calculate + set curval (overriding the existing value) if curve has + /* only calculate + set curval (overriding the existing value) if curve has * any data which warrants this... */ if ((fcu->totvert) || (fcu->driver && !(fcu->driver->flag & DRIVER_FLAG_INVALID)) || diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index f3d0a5fe085..b69bce088d2 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -67,7 +67,7 @@ void *fmodifiers_storage_get(FModifierStackStorage *storage, FModifier *fcm); * times. In addition to this, each modifier should have a type-info struct, where * its functions are attached for use. */ - + /* Template for type-info data: * - make a copy of this when creating new modifiers, and just change the functions * pointed to as necessary @@ -110,7 +110,7 @@ static FModifierTypeInfo FMI_MODNAME = { static void fcm_generator_free(FModifier *fcm) { FMod_Generator *data = (FMod_Generator *)fcm->data; - + /* free polynomial coefficients array */ if (data->coefficients) MEM_freeN(data->coefficients); @@ -120,7 +120,7 @@ static void fcm_generator_copy(FModifier *fcm, const FModifier *src) { FMod_Generator *gen = (FMod_Generator *)fcm->data; FMod_Generator *ogen = (FMod_Generator *)src->data; - + /* copy coefficients array? */ if (ogen->coefficients) gen->coefficients = MEM_dupallocN(ogen->coefficients); @@ -130,19 +130,19 @@ static void fcm_generator_new_data(void *mdata) { FMod_Generator *data = (FMod_Generator *)mdata; float *cp; - + /* set default generator to be linear 0-1 (gradient = 1, y-offset = 0) */ data->poly_order = 1; data->arraysize = 2; cp = data->coefficients = MEM_callocN(sizeof(float) * 2, "FMod_Generator_Coefs"); - cp[0] = 0; // y-offset + cp[0] = 0; // y-offset cp[1] = 1; // gradient } static void fcm_generator_verify(FModifier *fcm) { FMod_Generator *data = (FMod_Generator *)fcm->data; - + /* requirements depend on mode */ switch (data->mode) { case FCM_GENERATOR_POLYNOMIAL: /* expanded polynomial expression */ @@ -173,8 +173,8 @@ static void fcm_generator_verify(FModifier *fcm) static void fcm_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float evaltime) { FMod_Generator *data = (FMod_Generator *)fcm->data; - - /* behavior depends on mode + + /* behavior depends on mode * NOTE: the data in its default state is fine too */ switch (data->mode) { @@ -184,8 +184,8 @@ static void fcm_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *c float *powers = MEM_callocN(sizeof(float) * data->arraysize, "Poly Powers"); float value = 0.0f; unsigned int i; - - /* for each x^n, precalculate value based on previous one first... this should be + + /* for each x^n, precalculate value based on previous one first... this should be * faster that calling pow() for each entry */ for (i = 0; i < data->arraysize; i++) { @@ -195,11 +195,11 @@ static void fcm_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *c else powers[0] = 1; } - + /* for each coefficient, add to value, which we'll write to *cvalue in one go */ for (i = 0; i < data->arraysize; i++) value += data->coefficients[i] * powers[i]; - + /* only if something changed, write *cvalue in one go */ if (data->poly_order) { if (data->flag & FCM_GENERATOR_ADDITIVE) @@ -207,9 +207,9 @@ static void fcm_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *c else *cvalue = value; } - + /* cleanup */ - if (powers) + if (powers) MEM_freeN(powers); break; } @@ -217,11 +217,11 @@ static void fcm_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *c { float value = 1.0f, *cp = NULL; unsigned int i; - + /* for each coefficient pair, solve for that bracket before accumulating in value by multiplying */ for (cp = data->coefficients, i = 0; (cp) && (i < (unsigned int)data->poly_order); cp += 2, i++) value *= (cp[0] * evaltime + cp[1]); - + /* only if something changed, write *cvalue in one go */ if (data->poly_order) { if (data->flag & FCM_GENERATOR_ADDITIVE) @@ -266,7 +266,7 @@ static FModifierTypeInfo FMI_GENERATOR = { static void fcm_fn_generator_new_data(void *mdata) { FMod_FunctionGenerator *data = (FMod_FunctionGenerator *)mdata; - + /* set amplitude and phase multiplier to 1.0f so that something is generated */ data->amplitude = 1.0f; data->phase_multiplier = 1.0f; @@ -289,9 +289,9 @@ static void fcm_fn_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float FMod_FunctionGenerator *data = (FMod_FunctionGenerator *)fcm->data; double arg = data->phase_multiplier * evaltime + data->phase_offset; double (*fn)(double v) = NULL; - + /* get function pointer to the func to use: - * WARNING: must perform special argument validation hereto guard against crashes + * WARNING: must perform special argument validation hereto guard against crashes */ switch (data->type) { /* simple ones */ @@ -304,7 +304,7 @@ static void fcm_fn_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float case FCM_GENERATOR_FN_SINC: /* normalized sine wave */ fn = sinc; break; - + /* validation required */ case FCM_GENERATOR_FN_TAN: /* tangent wave */ { @@ -346,11 +346,11 @@ static void fcm_fn_generator_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float break; } - + /* execute function callback to set value if appropriate */ if (fn) { float value = (float)(data->amplitude * (float)fn(arg) + data->value_offset); - + if (data->flag & FCM_GENERATOR_ADDITIVE) *cvalue += value; else @@ -380,7 +380,7 @@ static FModifierTypeInfo FMI_FN_GENERATOR = { static void fcm_envelope_free(FModifier *fcm) { FMod_Envelope *env = (FMod_Envelope *)fcm->data; - + /* free envelope data array */ if (env->data) MEM_freeN(env->data); @@ -390,7 +390,7 @@ static void fcm_envelope_copy(FModifier *fcm, const FModifier *src) { FMod_Envelope *env = (FMod_Envelope *)fcm->data; FMod_Envelope *oenv = (FMod_Envelope *)src->data; - + /* copy envelope data array */ if (oenv->data) env->data = MEM_dupallocN(oenv->data); @@ -399,7 +399,7 @@ static void fcm_envelope_copy(FModifier *fcm, const FModifier *src) static void fcm_envelope_new_data(void *mdata) { FMod_Envelope *env = (FMod_Envelope *)mdata; - + /* set default min/max ranges */ env->min = -1.0f; env->max = 1.0f; @@ -408,7 +408,7 @@ static void fcm_envelope_new_data(void *mdata) static void fcm_envelope_verify(FModifier *fcm) { FMod_Envelope *env = (FMod_Envelope *)fcm->data; - + /* if the are points, perform bubble-sort on them, as user may have changed the order */ if (env->data) { /* XXX todo... */ @@ -421,13 +421,13 @@ static void fcm_envelope_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *cv FCM_EnvelopeData *fed, *prevfed, *lastfed; float min = 0.0f, max = 0.0f, fac = 0.0f; int a; - + /* get pointers */ if (env->data == NULL) return; prevfed = env->data; fed = prevfed + 1; lastfed = prevfed + (env->totvert - 1); - + /* get min/max values for envelope at evaluation time (relative to mid-value) */ if (prevfed->time >= evaltime) { /* before or on first sample, so just extend value */ @@ -446,20 +446,20 @@ static void fcm_envelope_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *cv /* evaltime occurs within the interval defined by these two envelope points */ if ((prevfed->time <= evaltime) && (fed->time >= evaltime)) { float afac, bfac, diff; - + diff = fed->time - prevfed->time; afac = (evaltime - prevfed->time) / diff; bfac = (fed->time - evaltime) / diff; - + min = bfac * prevfed->min + afac * fed->min; max = bfac * prevfed->max + afac * fed->max; - + break; } } } - - /* adjust *cvalue + + /* adjust *cvalue * - fac is the ratio of how the current y-value corresponds to the reference range * - thus, the new value is found by mapping the old range to the new! */ @@ -572,7 +572,7 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int array /* Cycles F-Curve Modifier --------------------------- */ -/* This modifier changes evaltime to something that exists within the curve's frame-range, +/* This modifier changes evaltime to something that exists within the curve's frame-range, * then re-evaluates modifier stack up to this point using the new time. This re-entrant behavior * is very likely to be more time-consuming than the original approach... (which was tightly integrated into * the calculation code...). @@ -588,11 +588,11 @@ int BKE_fcm_envelope_find_index(FCM_EnvelopeData array[], float frame, int array typedef struct tFCMED_Cycles { float cycyofs; /* y-offset to apply */ } tFCMED_Cycles; - + static void fcm_cycles_new_data(void *mdata) { FMod_Cycles *data = (FMod_Cycles *)mdata; - + /* turn on cycles by default */ data->before_mode = data->after_mode = FCM_EXTRAPOLATE_CYCLIC; } @@ -605,38 +605,38 @@ static float fcm_cycles_time(FModifierStackStorage *storage, FCurve *fcu, FModif short side = 0, mode = 0; int cycles = 0; float ofs = 0; - + /* check if modifier is first in stack, otherwise disable ourself... */ /* FIXME... */ if (fcm->prev) { fcm->flag |= FMODIFIER_FLAG_DISABLED; return evaltime; } - + /* calculate new evaltime due to cyclic interpolation */ if (fcu && fcu->bezt) { BezTriple *prevbezt = fcu->bezt; BezTriple *lastbezt = prevbezt + fcu->totvert - 1; - + prevkey[0] = prevbezt->vec[1][0]; prevkey[1] = prevbezt->vec[1][1]; - + lastkey[0] = lastbezt->vec[1][0]; lastkey[1] = lastbezt->vec[1][1]; } else if (fcu && fcu->fpt) { FPoint *prevfpt = fcu->fpt; FPoint *lastfpt = prevfpt + fcu->totvert - 1; - + prevkey[0] = prevfpt->vec[0]; prevkey[1] = prevfpt->vec[1]; - + lastkey[0] = lastfpt->vec[0]; lastkey[1] = lastfpt->vec[1]; } else return evaltime; - + /* check if modifier will do anything * 1) if in data range, definitely don't do anything * 2) if before first frame or after last frame, make sure some cycling is in use @@ -659,26 +659,26 @@ static float fcm_cycles_time(FModifierStackStorage *storage, FCurve *fcu, FModif } if ((ELEM(0, side, mode))) return evaltime; - + /* find relative place within a cycle */ { float cycdx = 0, cycdy = 0; float cycle = 0, cyct = 0; - + /* calculate period and amplitude (total height) of a cycle */ cycdx = lastkey[0] - prevkey[0]; cycdy = lastkey[1] - prevkey[1]; - + /* check if cycle is infinitely small, to be point of being impossible to use */ if (cycdx == 0) return evaltime; - + /* calculate the 'number' of the cycle */ cycle = ((float)side * (evaltime - ofs) / cycdx); - + /* calculate the time inside the cycle */ cyct = fmod(evaltime - ofs, cycdx); - + /* check that cyclic is still enabled for the specified time */ if (cycles == 0) { /* catch this case so that we don't exit when we have (cycles = 0) @@ -687,11 +687,11 @@ static float fcm_cycles_time(FModifierStackStorage *storage, FCurve *fcu, FModif } else if (cycle > cycles) { /* we are too far away from range to evaluate - * TODO: but we should still hold last value... + * TODO: but we should still hold last value... */ return evaltime; } - + /* check if 'cyclic extrapolation', and thus calculate y-offset for this cycle */ if (mode == FCM_EXTRAPOLATE_CYCLIC_OFFSET) { if (side < 0) @@ -700,17 +700,17 @@ static float fcm_cycles_time(FModifierStackStorage *storage, FCurve *fcu, FModif cycyofs = (float)ceil((evaltime - ofs) / cycdx); cycyofs *= cycdy; } - + /* special case for cycle start/end */ if (cyct == 0.0f) { evaltime = (side == 1 ? lastkey[0] : prevkey[0]); - + if ((mode == FCM_EXTRAPOLATE_MIRROR) && ((int)cycle % 2)) evaltime = (side == 1 ? prevkey[0] : lastkey[0]); } /* calculate where in the cycle we are (overwrite evaltime to reflect this) */ else if ((mode == FCM_EXTRAPOLATE_MIRROR) && ((int)(cycle + 1) % 2)) { - /* when 'mirror' option is used and cycle number is odd, this cycle is played in reverse + /* when 'mirror' option is used and cycle number is odd, this cycle is played in reverse * - for 'before' extrapolation, we need to flip in a different way, otherwise values past * then end of the curve get referenced (result of fmod will be negative, and with different phase) */ @@ -725,22 +725,22 @@ static float fcm_cycles_time(FModifierStackStorage *storage, FCurve *fcu, FModif } if (evaltime < prevkey[0]) evaltime += cycdx; } - + /* store temp data if needed */ if (mode == FCM_EXTRAPOLATE_CYCLIC_OFFSET) { tFCMED_Cycles *edata; - + /* for now, this is just a float, but we could get more stuff... */ edata = MEM_callocN(sizeof(tFCMED_Cycles), "tFCMED_Cycles"); edata->cycyofs = cycyofs; fmodifiers_storage_put(storage, fcm, edata); } - + /* return the new frame to evaluate */ return evaltime; } - + static void fcm_cycles_evaluate(FModifierStackStorage *storage, FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float UNUSED(evaltime)) { @@ -750,7 +750,7 @@ static void fcm_cycles_evaluate(FModifierStackStorage *storage, FCurve *UNUSED(f if (edata) { /* add cyclic offset - no need to check for now, otherwise the data wouldn't exist! */ *cvalue += edata->cycyofs; - + /* free temp data */ MEM_freeN(edata); fmodifiers_storage_remove(storage, fcm); @@ -779,7 +779,7 @@ static FModifierTypeInfo FMI_CYCLES = { static void fcm_noise_new_data(void *mdata) { FMod_Noise *data = (FMod_Noise *)mdata; - + /* defaults */ data->size = 1.0f; data->strength = 1.0f; @@ -788,18 +788,18 @@ static void fcm_noise_new_data(void *mdata) data->depth = 0; data->modification = FCM_NOISE_MODIF_REPLACE; } - + static void fcm_noise_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float evaltime) { FMod_Noise *data = (FMod_Noise *)fcm->data; float noise; - + /* generate noise using good ol' Blender Noise * - 0.1 is passed as the 'z' value, otherwise evaluation fails for size = phase = 1 * with evaltime being an integer (which happens when evaluating on frame by frame basis) */ noise = BLI_turbulence(data->size, evaltime - data->offset, data->phase, 0.1f, data->depth); - + /* combine the noise with existing motion data */ switch (data->modification) { case FCM_NOISE_MODIF_ADD: @@ -837,7 +837,7 @@ static FModifierTypeInfo FMI_NOISE = { /* Filter F-Curve Modifier --------------------------- */ -#if 0 // XXX not yet implemented +#if 0 // XXX not yet implemented static FModifierTypeInfo FMI_FILTER = { FMODIFIER_TYPE_FILTER, /* type */ sizeof(FMod_Filter), /* size */ @@ -862,7 +862,7 @@ static FModifierTypeInfo FMI_FILTER = { static void fcm_python_free(FModifier *fcm) { FMod_Python *data = (FMod_Python *)fcm->data; - + /* id-properties */ IDP_FreeProperty(data->prop); MEM_freeN(data->prop); @@ -871,7 +871,7 @@ static void fcm_python_free(FModifier *fcm) static void fcm_python_new_data(void *mdata) { FMod_Python *data = (FMod_Python *)mdata; - + /* everything should be set correctly by calloc, except for the prop->type constant.*/ data->prop = MEM_callocN(sizeof(IDProperty), "PyFModifierProps"); data->prop->type = IDP_GROUP; @@ -881,7 +881,7 @@ static void fcm_python_copy(FModifier *fcm, const FModifier *src) { FMod_Python *pymod = (FMod_Python *)fcm->data; FMod_Python *opymod = (FMod_Python *)src->data; - + pymod->prop = IDP_CopyProperty(opymod->prop); } @@ -889,9 +889,9 @@ static void fcm_python_evaluate(FCurve *UNUSED(fcu), FModifier *UNUSED(fcm), flo { #ifdef WITH_PYTHON //FMod_Python *data = (FMod_Python *)fcm->data; - + /* FIXME... need to implement this modifier... - * It will need it execute a script using the custom properties + * It will need it execute a script using the custom properties */ #endif /* WITH_PYTHON */ } @@ -919,13 +919,13 @@ static FModifierTypeInfo FMI_PYTHON = { static float fcm_limits_time(FCurve *UNUSED(fcu), FModifier *fcm, float UNUSED(cvalue), float evaltime) { FMod_Limits *data = (FMod_Limits *)fcm->data; - + /* check for the time limits */ if ((data->flag & FCM_LIMIT_XMIN) && (evaltime < data->rect.xmin)) return data->rect.xmin; if ((data->flag & FCM_LIMIT_XMAX) && (evaltime > data->rect.xmax)) return data->rect.xmax; - + /* modifier doesn't change time */ return evaltime; } @@ -933,7 +933,7 @@ static float fcm_limits_time(FCurve *UNUSED(fcu), FModifier *fcm, float UNUSED(c static void fcm_limits_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *cvalue, float UNUSED(evaltime)) { FMod_Limits *data = (FMod_Limits *)fcm->data; - + /* value limits now */ if ((data->flag & FCM_LIMIT_YMIN) && (*cvalue < data->rect.ymin)) *cvalue = data->rect.ymin; @@ -944,7 +944,7 @@ static void fcm_limits_evaluate(FCurve *UNUSED(fcu), FModifier *fcm, float *cval static FModifierTypeInfo FMI_LIMITS = { FMODIFIER_TYPE_LIMITS, /* type */ sizeof(FMod_Limits), /* size */ - FMI_TYPE_GENERATE_CURVE, /* action type */ /* XXX... err... */ + FMI_TYPE_GENERATE_CURVE, /* action type */ /* XXX... err... */ FMI_REQUIRES_RUNTIME_CHECK, /* requirements */ N_("Limits"), /* name */ "FMod_Limits", /* struct name */ @@ -963,7 +963,7 @@ static FModifierTypeInfo FMI_LIMITS = { static void fcm_stepped_new_data(void *mdata) { FMod_Stepped *data = (FMod_Stepped *)mdata; - + /* just need to set the step-size to 2-frames by default */ /* XXX: or would 5 be more normal? */ data->step_size = 2.0f; @@ -973,7 +973,7 @@ static float fcm_stepped_time(FCurve *UNUSED(fcu), FModifier *fcm, float UNUSED( { FMod_Stepped *data = (FMod_Stepped *)fcm->data; int snapblock; - + /* check range clamping to see if we should alter the timing to achieve the desired results */ if (data->flag & FCM_STEPPED_NO_BEFORE) { if (evaltime < data->start_frame) @@ -983,15 +983,15 @@ static float fcm_stepped_time(FCurve *UNUSED(fcu), FModifier *fcm, float UNUSED( if (evaltime > data->end_frame) return evaltime; } - - /* we snap to the start of the previous closest block of 'step_size' frames - * after the start offset has been discarded + + /* we snap to the start of the previous closest block of 'step_size' frames + * after the start offset has been discarded * - i.e. round down */ snapblock = (int)((evaltime - data->offset) / data->step_size); - - /* reapply the offset, and multiple the snapblock by the size of the steps to get - * the new time to evaluate at + + /* reapply the offset, and multiple the snapblock by the size of the steps to get + * the new time to evaluate at */ return ((float)snapblock * data->step_size) + data->offset; } @@ -999,7 +999,7 @@ static float fcm_stepped_time(FCurve *UNUSED(fcu), FModifier *fcm, float UNUSED( static FModifierTypeInfo FMI_STEPPED = { FMODIFIER_TYPE_STEPPED, /* type */ sizeof(FMod_Limits), /* size */ - FMI_TYPE_GENERATE_CURVE, /* action type */ /* XXX... err... */ + FMI_TYPE_GENERATE_CURVE, /* action type */ /* XXX... err... */ FMI_REQUIRES_RUNTIME_CHECK, /* requirements */ N_("Stepped"), /* name */ "FMod_Stepped", /* struct name */ @@ -1047,7 +1047,7 @@ const FModifierTypeInfo *get_fmodifier_typeinfo(const int type) fmods_init_typeinfo(); FMI_INIT = 0; } - + /* only return for valid types */ if ((type >= FMODIFIER_TYPE_NULL) && (type < FMODIFIER_NUM_TYPES)) @@ -1058,10 +1058,10 @@ const FModifierTypeInfo *get_fmodifier_typeinfo(const int type) else { printf("No valid F-Curve Modifier type-info data available. Type = %i\n", type); } - + return NULL; -} - +} + /* This function should always be used to get the appropriate type-info, as it * has checks which prevent segfaults in some weird cases. */ @@ -1081,11 +1081,11 @@ FModifier *add_fmodifier(ListBase *modifiers, int type, FCurve *owner_fcu) { const FModifierTypeInfo *fmi = get_fmodifier_typeinfo(type); FModifier *fcm; - + /* sanity checks */ if (ELEM(NULL, modifiers, fmi)) return NULL; - + /* special checks for whether modifier can be added */ if ((modifiers->first) && (type == FMODIFIER_TYPE_CYCLES)) { /* cycles modifier must be first in stack, so for now, don't add if it can't be */ @@ -1093,7 +1093,7 @@ FModifier *add_fmodifier(ListBase *modifiers, int type, FCurve *owner_fcu) printf("Error: Cannot add 'Cycles' modifier to F-Curve, as 'Cycles' modifier can only be first in stack.\n"); return NULL; } - + /* add modifier itself */ fcm = MEM_callocN(sizeof(FModifier), "F-Curve Modifier"); fcm->type = type; @@ -1101,14 +1101,14 @@ FModifier *add_fmodifier(ListBase *modifiers, int type, FCurve *owner_fcu) fcm->curve = owner_fcu; fcm->influence = 1.0f; BLI_addtail(modifiers, fcm); - + /* tag modifier as "active" if no other modifiers exist in the stack yet */ if (BLI_listbase_is_single(modifiers)) fcm->flag |= FMODIFIER_FLAG_ACTIVE; - + /* add modifier's data */ fcm->data = MEM_callocN(fmi->size, fmi->structName); - + /* init custom settings if necessary */ if (fmi->new_data) fmi->new_data(fcm->data); @@ -1116,7 +1116,7 @@ FModifier *add_fmodifier(ListBase *modifiers, int type, FCurve *owner_fcu) /* update the fcurve if the Cycles modifier is added */ if ((owner_fcu) && (type == FMODIFIER_TYPE_CYCLES)) calchandles_fcurve(owner_fcu); - + /* return modifier for further editing */ return fcm; } @@ -1126,23 +1126,23 @@ FModifier *copy_fmodifier(const FModifier *src) { const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(src); FModifier *dst; - + /* sanity check */ if (src == NULL) return NULL; - + /* copy the base data, clearing the links */ dst = MEM_dupallocN(src); dst->next = dst->prev = NULL; dst->curve = NULL; - + /* make a new copy of the F-Modifier's data */ dst->data = MEM_dupallocN(src->data); - + /* only do specific constraints if required */ if (fmi && fmi->copy_data) fmi->copy_data(dst, src); - + /* return the new modifier */ return dst; } @@ -1151,20 +1151,20 @@ FModifier *copy_fmodifier(const FModifier *src) void copy_fmodifiers(ListBase *dst, const ListBase *src) { FModifier *fcm, *srcfcm; - + if (ELEM(NULL, dst, src)) return; - + BLI_listbase_clear(dst); BLI_duplicatelist(dst, src); - + for (fcm = dst->first, srcfcm = src->first; fcm && srcfcm; srcfcm = srcfcm->next, fcm = fcm->next) { const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm); - + /* make a new copy of the F-Modifier's data */ fcm->data = MEM_dupallocN(fcm->data); fcm->curve = NULL; - + /* only do specific constraints if required */ if (fmi && fmi->copy_data) fmi->copy_data(fcm, srcfcm); @@ -1175,11 +1175,11 @@ void copy_fmodifiers(ListBase *dst, const ListBase *src) bool remove_fmodifier(ListBase *modifiers, FModifier *fcm) { const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm); - + /* sanity check */ if (fcm == NULL) return false; - + /* removing the cycles modifier requires a handle update */ FCurve *update_fcu = (fcm->type == FMODIFIER_TYPE_CYCLES) ? fcm->curve : NULL; @@ -1187,11 +1187,11 @@ bool remove_fmodifier(ListBase *modifiers, FModifier *fcm) if (fcm->data) { if (fmi && fmi->free_data) fmi->free_data(fcm); - + /* free modifier's data (fcm->data) */ MEM_freeN(fcm->data); } - + /* remove modifier from stack */ if (modifiers) { BLI_freelinkN(modifiers, fcm); @@ -1214,11 +1214,11 @@ bool remove_fmodifier(ListBase *modifiers, FModifier *fcm) void free_fmodifiers(ListBase *modifiers) { FModifier *fcm, *fmn; - + /* sanity check */ if (modifiers == NULL) return; - + /* free each modifier in order - modifier is unlinked from list and freed */ for (fcm = modifiers->first; fcm; fcm = fmn) { fmn = fcm->next; @@ -1230,17 +1230,17 @@ void free_fmodifiers(ListBase *modifiers) FModifier *find_active_fmodifier(ListBase *modifiers) { FModifier *fcm; - + /* sanity checks */ if (ELEM(NULL, modifiers, modifiers->first)) return NULL; - + /* loop over modifiers until 'active' one is found */ for (fcm = modifiers->first; fcm; fcm = fcm->next) { if (fcm->flag & FMODIFIER_FLAG_ACTIVE) return fcm; } - + /* no modifier is active */ return NULL; } @@ -1249,55 +1249,55 @@ FModifier *find_active_fmodifier(ListBase *modifiers) void set_active_fmodifier(ListBase *modifiers, FModifier *fcm) { FModifier *fm; - + /* sanity checks */ if (ELEM(NULL, modifiers, modifiers->first)) return; - + /* deactivate all, and set current one active */ for (fm = modifiers->first; fm; fm = fm->next) fm->flag &= ~FMODIFIER_FLAG_ACTIVE; - + /* make given modifier active */ if (fcm) fcm->flag |= FMODIFIER_FLAG_ACTIVE; } -/* Do we have any modifiers which match certain criteria +/* Do we have any modifiers which match certain criteria * - mtype - type of modifier (if 0, doesn't matter) * - acttype - type of action to perform (if -1, doesn't matter) */ bool list_has_suitable_fmodifier(ListBase *modifiers, int mtype, short acttype) { FModifier *fcm; - + /* if there are no specific filtering criteria, just skip */ if ((mtype == 0) && (acttype == 0)) return (modifiers && modifiers->first); - + /* sanity checks */ if (ELEM(NULL, modifiers, modifiers->first)) return false; - + /* find the first mdifier fitting these criteria */ for (fcm = modifiers->first; fcm; fcm = fcm->next) { const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm); short mOk = 1, aOk = 1; /* by default 1, so that when only one test, won't fail */ - + /* check if applicable ones are fullfilled */ if (mtype) mOk = (fcm->type == mtype); if (acttype > -1) aOk = (fmi->acttype == acttype); - + /* if both are ok, we've found a hit */ if (mOk && aOk) return true; } - + /* no matches */ return false; -} +} /* Evaluation API --------------------------- */ @@ -1359,19 +1359,19 @@ void *fmodifiers_storage_get(FModifierStackStorage *storage, FModifier *fcm) static float eval_fmodifier_influence(FModifier *fcm, float evaltime) { float influence; - + /* sanity check */ - if (fcm == NULL) + if (fcm == NULL) return 0.0f; - - /* should we use influence stored in modifier or not + + /* should we use influence stored in modifier or not * NOTE: this is really just a hack so that we don't need to version patch old files ;) */ if (fcm->flag & FMODIFIER_FLAG_USEINFLUENCE) influence = fcm->influence; else influence = 1.0f; - + /* restricted range or full range? */ if (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) { if ((evaltime <= fcm->sfra) || (evaltime >= fcm->efra)) { @@ -1391,7 +1391,7 @@ static float eval_fmodifier_influence(FModifier *fcm, float evaltime) return influence * (evaltime - a) / (b - a); } } - + /* just return the influence of the modifier */ return influence; } @@ -1411,7 +1411,7 @@ float evaluate_time_fmodifiers(FModifierStackStorage *storage, ListBase *modifie FCurve *fcu, float cvalue, float evaltime) { FModifier *fcm; - + /* sanity checks */ if (ELEM(NULL, modifiers, modifiers->last)) return evaltime; @@ -1419,22 +1419,22 @@ float evaluate_time_fmodifiers(FModifierStackStorage *storage, ListBase *modifie if (fcu && fcu->flag & FCURVE_MOD_OFF) return evaltime; - /* Starting from the end of the stack, calculate the time effects of various stacked modifiers - * on the time the F-Curve should be evaluated at. + /* Starting from the end of the stack, calculate the time effects of various stacked modifiers + * on the time the F-Curve should be evaluated at. * * This is done in reverse order to standard evaluation, as when this is done in standard * order, each modifier would cause jumps to other points in the curve, forcing all - * previous ones to be evaluated again for them to be correct. However, if we did in the + * previous ones to be evaluated again for them to be correct. However, if we did in the * reverse order as we have here, we can consider them a macro to micro type of waterfall * effect, which should get us the desired effects when using layered time manipulations * (such as multiple 'stepped' modifiers in sequence, causing different stepping rates) */ for (fcm = modifiers->last; fcm; fcm = fcm->prev) { const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm); - - if (fmi == NULL) + + if (fmi == NULL) continue; - + /* if modifier cannot be applied on this frame (whatever scale it is on, it won't affect the results) * hence we shouldn't bother seeing what it would do given the chance */ @@ -1453,13 +1453,13 @@ float evaluate_time_fmodifiers(FModifierStackStorage *storage, ListBase *modifie else { nval = fmi->evaluate_modifier_time_storage(storage, fcu, fcm, cvalue, evaltime); } - + evaltime = interpf(nval, evaltime, influence); } } } } - + /* return the modified evaltime */ return evaltime; } @@ -1471,21 +1471,21 @@ void evaluate_value_fmodifiers(FModifierStackStorage *storage, ListBase *modifie FCurve *fcu, float *cvalue, float evaltime) { FModifier *fcm; - + /* sanity checks */ if (ELEM(NULL, modifiers, modifiers->first)) return; if (fcu->flag & FCURVE_MOD_OFF) return; - + /* evaluate modifiers */ for (fcm = modifiers->first; fcm; fcm = fcm->next) { const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm); - - if (fmi == NULL) + + if (fmi == NULL) continue; - + /* only evaluate if there's a callback for this, and if F-Modifier can be evaluated on this frame */ if ((fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) == 0 || ((fcm->sfra <= evaltime) && (fcm->efra >= evaltime)) ) @@ -1507,7 +1507,7 @@ void evaluate_value_fmodifiers(FModifierStackStorage *storage, ListBase *modifie } } } -} +} /* ---------- */ @@ -1517,24 +1517,24 @@ void evaluate_value_fmodifiers(FModifierStackStorage *storage, ListBase *modifie void fcurve_bake_modifiers(FCurve *fcu, int start, int end) { ChannelDriver *driver; - + /* sanity checks */ /* TODO: make these tests report errors using reports not printf's */ if (ELEM(NULL, fcu, fcu->modifiers.first)) { printf("Error: No F-Curve with F-Curve Modifiers to Bake\n"); return; } - + /* temporarily, disable driver while we sample, so that they don't influence the outcome */ driver = fcu->driver; fcu->driver = NULL; - + /* bake the modifiers, by sampling the curve at each frame */ fcurve_store_samples(fcu, NULL, start, end, fcurve_samplingcb_evalcurve); - + /* free the modifiers now */ free_fmodifiers(&fcu->modifiers); - + /* restore driver */ fcu->driver = driver; } diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 29767efa71f..36633663f9d 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -148,7 +148,7 @@ static PackedFile *get_builtin_packedfile(void) void *mem = MEM_mallocN(builtin_font_size, "vfd_builtin"); memcpy(mem, builtin_font_data, builtin_font_size); - + return newPackedFileMemory(mem, builtin_font_size); } } @@ -205,7 +205,7 @@ static VFontData *vfont_get_data(VFont *vfont) pf = get_builtin_packedfile(); } } - + if (pf) { vfont->data = BLI_vfontdata_from_freetypefont(pf); if (pf != vfont->packedfile) { @@ -246,10 +246,10 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath) PackedFile *pf; PackedFile *temp_pf = NULL; bool is_builtin; - + if (STREQ(filepath, FO_BUILTIN_NAME)) { BLI_strncpy(filename, filepath, sizeof(filename)); - + pf = get_builtin_packedfile(); is_builtin = true; } @@ -257,7 +257,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath) BLI_split_file_part(filepath, filename, sizeof(filename)); pf = newPackedFile(NULL, filepath, BKE_main_blendfile_path(bmain)); temp_pf = newPackedFile(NULL, filepath, BKE_main_blendfile_path(bmain)); - + is_builtin = false; } @@ -291,7 +291,7 @@ VFont *BKE_vfont_load(Main *bmain, const char *filepath) freePackedFile(pf); } } - + return vfont; } @@ -348,13 +348,13 @@ static VFont *which_vfont(Curve *cu, CharInfo *info) VFont *BKE_vfont_builtin_get(void) { VFont *vfont; - + for (vfont = G_MAIN->vfont.first; vfont; vfont = vfont->id.next) { if (BKE_vfont_is_builtin(vfont)) { return vfont; } } - + return BKE_vfont_load(G_MAIN, FO_BUILTIN_NAME); } @@ -368,7 +368,7 @@ static void build_underline(Curve *cu, ListBase *nubase, const rctf *rect, { Nurb *nu2; BPoint *bp; - + nu2 = (Nurb *) MEM_callocN(sizeof(Nurb), "underline_nurb"); nu2->resolu = cu->resolu; nu2->bezt = NULL; @@ -454,7 +454,7 @@ static void buildchar(Curve *cu, ListBase *nubase, unsigned int character, CharI co = cosf(rot); che = find_vfont_char(vfd, character); - + /* Select the glyph data */ if (che) nu1 = che->nurbsbase.first; @@ -488,10 +488,10 @@ static void buildchar(Curve *cu, ListBase *nubase, unsigned int character, CharI } memcpy(bezt2, bezt1, i * sizeof(struct BezTriple)); nu2->bezt = bezt2; - + if (shear != 0.0f) { bezt2 = nu2->bezt; - + for (i = nu2->pntsu; i > 0; i--) { bezt2->vec[0][0] += shear * bezt2->vec[0][1]; bezt2->vec[1][0] += shear * bezt2->vec[1][1]; @@ -544,10 +544,10 @@ static void buildchar(Curve *cu, ListBase *nubase, unsigned int character, CharI fp[7] = (fp[7] + ofsy) * fsize; bezt2++; } - + BLI_addtail(nubase, nu2); } - + nu1 = nu1->next; } } @@ -557,7 +557,7 @@ int BKE_vfont_select_get(Object *ob, int *r_start, int *r_end) Curve *cu = ob->data; EditFont *ef = cu->editfont; int start, end, direction; - + if ((ob->type != OB_FONT) || (ef == NULL)) return 0; BLI_assert(ef->len >= 0); @@ -681,7 +681,7 @@ bool BKE_vfont_to_curve_ex(Object *ob, Curve *cu, int mode, ListBase *r_nubase, /* The VFont Data can not be found */ if (!vfd) return ok; - + if (ef) { slen = ef->len; mem = ef->textbuf; @@ -734,9 +734,9 @@ bool BKE_vfont_to_curve_ex(Object *ob, Curve *cu, int mode, ListBase *r_nubase, /* We assume the worst case: 1 character per line (is freed at end anyway) */ lineinfo = MEM_malloc_arrayN((slen * 2 + 1), sizeof(*lineinfo), "lineinfo"); - + linedist = cu->linedist; - + curbox = 0; textbox_scale(&tb_scale, &cu->tb[curbox], 1.0f / cu->fsize); use_textbox = (tb_scale.w != 0.0f); @@ -886,7 +886,7 @@ makebreak: } else if (ascii == 9) { /* TAB */ float tabfac; - + ct->xof = xof; ct->yof = yof; ct->linenr = lnr; @@ -911,27 +911,27 @@ makebreak: sb->h = linedist * cu->fsize; sb->w = xof * cu->fsize; } - + if (ascii == 32) { - wsfac = cu->wordspace; + wsfac = cu->wordspace; wsnr++; } else { wsfac = 1.0f; } - + /* Set the width of the character */ twidth = char_width(cu, che, info); xof += (twidth * wsfac * (1.0f + (info->kern / 40.0f)) ) + xtrax; - + if (sb) { sb->w = (xof * cu->fsize) - sb->w; } } ct++; } - + cu->lines = 1; for (i = 0; i <= slen; i++) { ascii = mem[i]; @@ -1092,7 +1092,7 @@ makebreak: copy_m3_m4(cmat, cu->textoncurve->obmat); mul_m3_m3m3(cmat, cmat, imat3); sizefac = normalize_v3(cmat[0]) / cu->fsize; - + minx = miny = 1.0e20f; maxx = maxy = -1.0e20f; ct = chartransdata; @@ -1102,17 +1102,17 @@ makebreak: if (miny > ct->yof) miny = ct->yof; if (maxy < ct->yof) maxy = ct->yof; } - + /* we put the x-coordinaat exact at the curve, the y is rotated */ - + /* length correction */ distfac = sizefac * cu->textoncurve->curve_cache->path->totdist / (maxx - minx); timeofs = 0.0f; - + if (distfac > 1.0f) { /* path longer than text: spacemode involves */ distfac = 1.0f / distfac; - + if (cu->spacemode == CU_ALIGN_X_RIGHT) { timeofs = 1.0f - distfac; } @@ -1128,14 +1128,14 @@ makebreak: } distfac /= (maxx - minx); - + timeofs += distfac * cu->xof; /* not cyclic */ - + ct = chartransdata; for (i = 0; i < slen; i++, ct++) { float ctime, dtime, vec[4], tvec[4], rotvec[3]; float si, co; - + /* rotate around center character */ info = &custrinfo[i]; ascii = mem[i]; @@ -1144,7 +1144,7 @@ makebreak: } che = find_vfont_char(vfd, ascii); - + twidth = char_width(cu, che, info); dtime = distfac * 0.5f * twidth; @@ -1156,16 +1156,16 @@ makebreak: /* vec, tvec need 4 items */ where_on_path(cu->textoncurve, ctime, vec, tvec, NULL, NULL, NULL); where_on_path(cu->textoncurve, ctime + dtime, tvec, rotvec, NULL, NULL, NULL); - + mul_v3_fl(vec, sizefac); - + ct->rot = (float)M_PI - atan2f(rotvec[1], rotvec[0]); si = sinf(ct->rot); co = cosf(ct->rot); yof = ct->yof; - + ct->xof = vec[0] + si * yof; ct->yof = vec[1] + co * yof; @@ -1224,29 +1224,29 @@ makebreak: } } } - + /* cursor first */ if (ef) { float si, co; - + ct = &chartransdata[ef->pos]; si = sinf(ct->rot); co = cosf(ct->rot); f = ef->textcurs[0]; - + f[0] = cu->fsize * (-0.1f * co + ct->xof); f[1] = cu->fsize * ( 0.1f * si + ct->yof); - + f[2] = cu->fsize * ( 0.1f * co + ct->xof); f[3] = cu->fsize * (-0.1f * si + ct->yof); - + f[4] = cu->fsize * ( 0.1f * co + 0.8f * si + ct->xof); f[5] = cu->fsize * (-0.1f * si + 0.8f * co + ct->yof); - + f[6] = cu->fsize * (-0.1f * co + 0.8f * si + ct->xof); f[7] = cu->fsize * ( 0.1f * si + 0.8f * co + ct->yof); - + } if (mode == FO_SELCHANGE) { @@ -1258,7 +1258,7 @@ makebreak: if (mode == FO_EDIT) { /* make nurbdata */ BKE_nurbList_free(r_nubase); - + ct = chartransdata; for (i = 0; i < slen; i++) { unsigned int cha = (unsigned int) mem[i]; diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 6a59ea4439f..e89508fd6c0 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -27,7 +27,7 @@ * \ingroup bke */ - + #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -96,14 +96,14 @@ bool BKE_gpencil_free_strokes(bGPDframe *gpf) void BKE_gpencil_free_frames(bGPDlayer *gpl) { bGPDframe *gpf_next; - + /* error checking */ if (gpl == NULL) return; - + /* free frames */ for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf_next) { gpf_next = gpf->next; - + /* free strokes and their associated memory */ BKE_gpencil_free_strokes(gpf); BLI_freelinkN(&gpl->frames, gpf); @@ -177,14 +177,14 @@ void BKE_gpencil_free_brushes(ListBase *list) void BKE_gpencil_free_layers(ListBase *list) { bGPDlayer *gpl_next; - + /* error checking */ if (list == NULL) return; - + /* delete layers */ for (bGPDlayer *gpl = list->first; gpl; gpl = gpl_next) { gpl_next = gpl->next; - + /* free layers and their data */ BKE_gpencil_free_frames(gpl); BLI_freelinkN(list, gpl); @@ -212,15 +212,15 @@ bGPDframe *BKE_gpencil_frame_addnew(bGPDlayer *gpl, int cframe) { bGPDframe *gpf = NULL, *gf = NULL; short state = 0; - + /* error checking */ if (gpl == NULL) return NULL; - + /* allocate memory for this frame */ gpf = MEM_callocN(sizeof(bGPDframe), "bGPDframe"); gpf->framenum = cframe; - + /* find appropriate place to add frame */ if (gpl->frames.first) { for (gf = gpl->frames.first; gf; gf = gf->next) { @@ -229,7 +229,7 @@ bGPDframe *BKE_gpencil_frame_addnew(bGPDlayer *gpl, int cframe) state = -1; break; } - + /* if current frame has already exceeded the frame to add, add before */ if (gf->framenum > cframe) { BLI_insertlinkbefore(&gpl->frames, gf, gpf); @@ -238,14 +238,14 @@ bGPDframe *BKE_gpencil_frame_addnew(bGPDlayer *gpl, int cframe) } } } - + /* check whether frame was added successfully */ if (state == -1) { printf("Error: Frame (%d) existed already for this layer. Using existing frame\n", cframe); - + /* free the newly created one, and use the old one instead */ MEM_freeN(gpf); - + /* return existing frame instead... */ BLI_assert(gf != NULL); gpf = gf; @@ -254,7 +254,7 @@ bGPDframe *BKE_gpencil_frame_addnew(bGPDlayer *gpl, int cframe) /* add to end then! */ BLI_addtail(&gpl->frames, gpf); } - + /* return frame */ return gpf; } @@ -264,7 +264,7 @@ bGPDframe *BKE_gpencil_frame_addcopy(bGPDlayer *gpl, int cframe) { bGPDframe *new_frame; bool found = false; - + /* Error checking/handling */ if (gpl == NULL) { /* no layer */ @@ -274,16 +274,16 @@ bGPDframe *BKE_gpencil_frame_addcopy(bGPDlayer *gpl, int cframe) /* no active frame, so just create a new one from scratch */ return BKE_gpencil_frame_addnew(gpl, cframe); } - + /* Create a copy of the frame */ new_frame = BKE_gpencil_frame_duplicate(gpl->actframe); - + /* Find frame to insert it before */ for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) { if (gpf->framenum > cframe) { /* Add it here */ BLI_insertlinkbefore(&gpl->frames, gpf, new_frame); - + found = true; break; } @@ -294,23 +294,23 @@ bGPDframe *BKE_gpencil_frame_addcopy(bGPDlayer *gpl, int cframe) BKE_gpencil_free_strokes(new_frame); MEM_freeN(new_frame); new_frame = NULL; - + found = true; break; } } - + if (found == false) { /* Add new frame to the end */ BLI_addtail(&gpl->frames, new_frame); } - + /* Ensure that frame is set up correctly, and return it */ if (new_frame) { new_frame->framenum = cframe; gpl->actframe = new_frame; } - + return new_frame; } @@ -318,17 +318,17 @@ bGPDframe *BKE_gpencil_frame_addcopy(bGPDlayer *gpl, int cframe) bGPDlayer *BKE_gpencil_layer_addnew(bGPdata *gpd, const char *name, bool setactive) { bGPDlayer *gpl; - + /* check that list is ok */ if (gpd == NULL) return NULL; - + /* allocate memory for frame and add to end of list */ gpl = MEM_callocN(sizeof(bGPDlayer), "bGPDlayer"); - + /* add to datablock */ BLI_addtail(&gpd->layers, gpl); - + /* set basic settings */ copy_v4_v4(gpl->color, U.gpencil_new_layer_col); /* Since GPv2 thickness must be 0 */ @@ -339,23 +339,23 @@ bGPDlayer *BKE_gpencil_layer_addnew(bGPdata *gpd, const char *name, bool setacti /* onion-skinning settings */ if (gpd->flag & GP_DATA_SHOW_ONIONSKINS) gpl->flag |= GP_LAYER_ONIONSKIN; - + gpl->flag |= (GP_LAYER_GHOST_PREVCOL | GP_LAYER_GHOST_NEXTCOL); - + ARRAY_SET_ITEMS(gpl->gcolor_prev, 0.145098f, 0.419608f, 0.137255f); /* green */ ARRAY_SET_ITEMS(gpl->gcolor_next, 0.125490f, 0.082353f, 0.529412f); /* blue */ - + /* high quality fill by default */ gpl->flag |= GP_LAYER_HQ_FILL; - + /* auto-name */ BLI_strncpy(gpl->info, name, sizeof(gpl->info)); BLI_uniquename(&gpd->layers, gpl, DATA_("GP_Layer"), '.', offsetof(bGPDlayer, info), sizeof(gpl->info)); - + /* make this one the active one */ if (setactive) BKE_gpencil_layer_setactive(gpd, gpl); - + /* return layer */ return gpl; } @@ -625,18 +625,18 @@ bGPDpalettecolor *BKE_gpencil_palettecolor_addnew(bGPDpalette *palette, const ch bGPdata *BKE_gpencil_data_addnew(Main *bmain, const char name[]) { bGPdata *gpd; - + /* allocate memory for a new block */ gpd = BKE_libblock_alloc(bmain, ID_GD, name, 0); - + /* initial settings */ gpd->flag = (GP_DATA_DISPINFO | GP_DATA_EXPAND); - + /* for now, stick to view is also enabled by default * since this is more useful... */ gpd->flag |= GP_DATA_VIEWALIGN; - + return gpd; } @@ -647,16 +647,16 @@ bGPDframe *BKE_gpencil_frame_duplicate(const bGPDframe *gpf_src) { bGPDstroke *gps_dst; bGPDframe *gpf_dst; - + /* error checking */ if (gpf_src == NULL) { return NULL; } - + /* make a copy of the source frame */ gpf_dst = MEM_dupallocN(gpf_src); gpf_dst->prev = gpf_dst->next = NULL; - + /* copy strokes */ BLI_listbase_clear(&gpf_dst->strokes); for (bGPDstroke *gps_src = gpf_src->strokes.first; gps_src; gps_src = gps_src->next) { @@ -667,7 +667,7 @@ bGPDframe *BKE_gpencil_frame_duplicate(const bGPDframe *gpf_src) gps_dst->flag |= GP_STROKE_RECALC_CACHES; BLI_addtail(&gpf_dst->strokes, gps_dst); } - + /* return new frame */ return gpf_dst; } @@ -727,28 +727,28 @@ bGPDlayer *BKE_gpencil_layer_duplicate(const bGPDlayer *gpl_src) const bGPDframe *gpf_src; bGPDframe *gpf_dst; bGPDlayer *gpl_dst; - + /* error checking */ if (gpl_src == NULL) { return NULL; } - + /* make a copy of source layer */ gpl_dst = MEM_dupallocN(gpl_src); gpl_dst->prev = gpl_dst->next = NULL; - + /* copy frames */ BLI_listbase_clear(&gpl_dst->frames); for (gpf_src = gpl_src->frames.first; gpf_src; gpf_src = gpf_src->next) { /* make a copy of source frame */ gpf_dst = BKE_gpencil_frame_duplicate(gpf_src); BLI_addtail(&gpl_dst->frames, gpf_dst); - + /* if source frame was the current layer's 'active' frame, reassign that too */ if (gpf_src == gpl_dst->actframe) gpl_dst->actframe = gpf_dst; } - + /* return new layer */ return gpl_dst; } @@ -824,16 +824,16 @@ void BKE_gpencil_stroke_sync_selection(bGPDstroke *gps) { bGPDspoint *pt; int i; - + /* error checking */ if (gps == NULL) return; - + /* we'll stop when we find the first selected point, * so initially, we must deselect */ gps->flag &= ~GP_STROKE_SELECT; - + for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { if (pt->flag & GP_SPOINT_SELECT) { gps->flag |= GP_STROKE_SELECT; @@ -849,16 +849,16 @@ void BKE_gpencil_frame_delete_laststroke(bGPDlayer *gpl, bGPDframe *gpf) { bGPDstroke *gps = (gpf) ? gpf->strokes.last : NULL; int cfra = (gpf) ? gpf->framenum : 0; /* assume that the current frame was not locked */ - + /* error checking */ if (ELEM(NULL, gpf, gps)) return; - + /* free the stroke and its data */ MEM_freeN(gps->points); MEM_freeN(gps->triangles); BLI_freelinkN(&gpf->strokes, gps); - + /* if frame has no strokes after this, delete it */ if (BLI_listbase_is_empty(&gpf->strokes)) { BKE_gpencil_layer_delframe(gpl, gpf); @@ -874,7 +874,7 @@ bool gpencil_layer_is_editable(const bGPDlayer *gpl) /* Sanity check */ if (gpl == NULL) return false; - + /* Layer must be: Visible + Editable */ if ((gpl->flag & (GP_LAYER_HIDE | GP_LAYER_LOCKED)) == 0) { /* Opacity must be sufficiently high that it is still "visible" @@ -884,7 +884,7 @@ bool gpencil_layer_is_editable(const bGPDlayer *gpl) return true; } } - + /* Something failed */ return false; } @@ -893,7 +893,7 @@ bool gpencil_layer_is_editable(const bGPDlayer *gpl) bGPDframe *BKE_gpencil_layer_find_frame(bGPDlayer *gpl, int cframe) { bGPDframe *gpf; - + /* Search in reverse order, since this is often used for playback/adding, * where it's less likely that we're interested in the earlier frames */ @@ -902,7 +902,7 @@ bGPDframe *BKE_gpencil_layer_find_frame(bGPDlayer *gpl, int cframe) return gpf; } } - + return NULL; } @@ -914,23 +914,23 @@ bGPDframe *BKE_gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_M { bGPDframe *gpf = NULL; short found = 0; - + /* error checking */ if (gpl == NULL) return NULL; - + /* check if there is already an active frame */ if (gpl->actframe) { gpf = gpl->actframe; - + /* do not allow any changes to layer's active frame if layer is locked from changes * or if the layer has been set to stay on the current frame */ if (gpl->flag & GP_LAYER_FRAMELOCK) return gpf; /* do not allow any changes to actframe if frame has painting tag attached to it */ - if (gpf->flag & GP_FRAME_PAINT) + if (gpf->flag & GP_FRAME_PAINT) return gpf; - + /* try to find matching frame */ if (gpf->framenum < cframe) { for (; gpf; gpf = gpf->next) { @@ -943,7 +943,7 @@ bGPDframe *BKE_gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_M break; } } - + /* set the appropriate frame */ if (addnew) { if ((found) && (gpf->framenum == cframe)) @@ -965,7 +965,7 @@ bGPDframe *BKE_gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_M break; } } - + /* set the appropriate frame */ if (addnew) { if ((found) && (gpf->framenum == cframe)) @@ -985,7 +985,7 @@ bGPDframe *BKE_gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_M /* check which of the ends to start checking from */ const int first = ((bGPDframe *)(gpl->frames.first))->framenum; const int last = ((bGPDframe *)(gpl->frames.last))->framenum; - + if (abs(cframe - first) > abs(cframe - last)) { /* find gp-frame which is less than or equal to cframe */ for (gpf = gpl->frames.last; gpf; gpf = gpf->prev) { @@ -1004,7 +1004,7 @@ bGPDframe *BKE_gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_M } } } - + /* set the appropriate frame */ if (addnew) { if ((found) && (gpf->framenum == cframe)) @@ -1029,7 +1029,7 @@ bGPDframe *BKE_gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_M /* gpl->actframe should still be NULL */ } } - + /* return */ return gpl->actframe; } @@ -1038,23 +1038,23 @@ bGPDframe *BKE_gpencil_layer_getframe(bGPDlayer *gpl, int cframe, eGP_GetFrame_M bool BKE_gpencil_layer_delframe(bGPDlayer *gpl, bGPDframe *gpf) { bool changed = false; - + /* error checking */ if (ELEM(NULL, gpl, gpf)) return false; - - /* if this frame was active, make the previous frame active instead + + /* if this frame was active, make the previous frame active instead * since it's tricky to set active frame otherwise */ if (gpl->actframe == gpf) gpl->actframe = gpf->prev; else gpl->actframe = NULL; - + /* free the frame and its data */ changed = BKE_gpencil_free_strokes(gpf); BLI_freelinkN(&gpl->frames, gpf); - + return changed; } @@ -1062,17 +1062,17 @@ bool BKE_gpencil_layer_delframe(bGPDlayer *gpl, bGPDframe *gpf) bGPDlayer *BKE_gpencil_layer_getactive(bGPdata *gpd) { bGPDlayer *gpl; - + /* error checking */ if (ELEM(NULL, gpd, gpd->layers.first)) return NULL; - + /* loop over layers until found (assume only one active) */ for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { if (gpl->flag & GP_LAYER_ACTIVE) return gpl; } - + /* no active layer found */ return NULL; } @@ -1081,15 +1081,15 @@ bGPDlayer *BKE_gpencil_layer_getactive(bGPdata *gpd) void BKE_gpencil_layer_setactive(bGPdata *gpd, bGPDlayer *active) { bGPDlayer *gpl; - + /* error checking */ if (ELEM(NULL, gpd, gpd->layers.first, active)) return; - + /* loop over layers deactivating all */ for (gpl = gpd->layers.first; gpl; gpl = gpl->next) gpl->flag &= ~GP_LAYER_ACTIVE; - + /* set as active one */ active->flag |= GP_LAYER_ACTIVE; } @@ -1098,9 +1098,9 @@ void BKE_gpencil_layer_setactive(bGPdata *gpd, bGPDlayer *active) void BKE_gpencil_layer_delete(bGPdata *gpd, bGPDlayer *gpl) { /* error checking */ - if (ELEM(NULL, gpd, gpl)) + if (ELEM(NULL, gpd, gpl)) return; - + /* free layer */ BKE_gpencil_free_frames(gpl); BLI_freelinkN(&gpd->layers, gpl); @@ -1281,11 +1281,11 @@ void BKE_gpencil_palettecolor_changename(bGPdata *gpd, char *oldname, const char bGPDlayer *gpl; bGPDframe *gpf; bGPDstroke *gps; - + /* Sanity checks (gpd may not be set in the RNA pointers sometimes) */ if (ELEM(NULL, gpd, oldname, newname)) return; - + for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { for (gpf = gpl->frames.first; gpf; gpf = gpf->next) { for (gps = gpf->strokes.first; gps; gps = gps->next) { @@ -1295,7 +1295,7 @@ void BKE_gpencil_palettecolor_changename(bGPdata *gpd, char *oldname, const char } } } - + } /* Delete all strokes of the color */ @@ -1304,11 +1304,11 @@ void BKE_gpencil_palettecolor_delete_strokes(struct bGPdata *gpd, char *name) bGPDlayer *gpl; bGPDframe *gpf; bGPDstroke *gps, *gpsn; - + /* Sanity checks (gpd may not be set in the RNA pointers sometimes) */ if (ELEM(NULL, gpd, name)) return; - + for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { for (gpf = gpl->frames.first; gpf; gpf = gpf->next) { for (gps = gpf->strokes.first; gps; gps = gpsn) { diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c index e409f8c91f0..e6afe08e19a 100644 --- a/source/blender/blenkernel/intern/icons.c +++ b/source/blender/blenkernel/intern/icons.c @@ -145,7 +145,7 @@ static int get_next_free_id(void) /* if we haven't used up the int number range, we just return the next int */ if (gNextIconId >= gFirstIconId) return gNextIconId++; - + /* now we try to find the smallest icon id not stored in the gIcons hash */ while (BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(startId)) && startId >= gFirstIconId) startId++; @@ -243,7 +243,7 @@ void BKE_previewimg_freefunc(void *link) if (prv->gputexture[i]) GPU_texture_free(prv->gputexture[i]); } - + MEM_freeN(prv); } } @@ -509,11 +509,11 @@ void BKE_icon_changed(const int icon_id) BLI_assert(BLI_thread_is_main()); Icon *icon = NULL; - + if (!icon_id || G.background) return; icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(icon_id)); - + if (icon) { /* We *only* expect ID-tied icons here, not non-ID icon/preview! */ BLI_assert(icon->id_type != 0); @@ -640,7 +640,7 @@ Icon *BKE_icon_get(const int icon_id) Icon *icon = NULL; icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(icon_id)); - + if (!icon) { printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id); return NULL; diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c index 4860f5a896d..0edeaab8900 100644 --- a/source/blender/blenkernel/intern/idcode.c +++ b/source/blender/blenkernel/intern/idcode.c @@ -47,7 +47,7 @@ typedef struct { const char *name, *plural; const char *i18n_context; - + int flags; #define IDTYPE_FLAGS_ISLINKABLE (1 << 0) } IDType; @@ -101,7 +101,7 @@ static IDType idtypes[] = { /* -1 for ID_ID */ BLI_STATIC_ASSERT((ARRAY_SIZE(idtypes) - 1 == MAX_LIBARRAY), "Missing IDType"); -static IDType *idtype_from_name(const char *str) +static IDType *idtype_from_name(const char *str) { int i = ARRAY_SIZE(idtypes); @@ -120,7 +120,7 @@ static IDType *idtype_from_code(short idcode) while (i--) if (idcode == idtypes[i].code) return &idtypes[i]; - + return NULL; } diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 0c5078e3e36..ae9236e35fe 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -86,7 +86,7 @@ IDProperty *IDP_NewIDPArray(const char *name) prop->type = IDP_IDPARRAY; prop->len = 0; BLI_strncpy(prop->name, name, MAX_IDPROP_NAME); - + return prop; } @@ -113,14 +113,14 @@ IDProperty *IDP_CopyIDPArray(const IDProperty *array, const int flag) memcpy(GETPROP(narray, i), tmp, sizeof(IDProperty)); MEM_freeN(tmp); } - + return narray; } static void IDP_FreeIDPArray(IDProperty *prop, const bool do_id_user) { int i; - + BLI_assert(prop->type == IDP_IDPARRAY); for (i = 0; i < prop->len; i++) @@ -472,7 +472,7 @@ static IDProperty *IDP_CopyID(const IDProperty *prop, const int flag) static IDProperty *IDP_CopyGroup(const IDProperty *prop, const int flag) { IDProperty *newp, *link; - + BLI_assert(prop->type == IDP_GROUP); newp = idp_generic_copy(prop, flag); newp->len = prop->len; @@ -1051,7 +1051,7 @@ IDProperty *IDP_New(const char type, const IDPropertyTemplate *val, const char * prop->type = type; BLI_strncpy(prop->name, name, MAX_IDPROP_NAME); - + return prop; } diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index f3f690b92da..eeb09931211 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -37,7 +37,7 @@ * * -- Joshua Leung, Jan 2009 */ - + #include <math.h> #include <stdio.h> #include <string.h> @@ -92,18 +92,18 @@ void BKE_ipo_free(Ipo *ipo) { IpoCurve *icu, *icn; int n = 0; - + for (icu = ipo->curve.first; icu; icu = icn) { icn = icu->next; n++; - + if (icu->bezt) MEM_freeN(icu->bezt); if (icu->bp) MEM_freeN(icu->bp); if (icu->driver) MEM_freeN(icu->driver); - + BLI_freelinkN(&ipo->curve, icu); } - + if (G.debug & G_DEBUG) printf("Freed %d (Unconverted) Ipo-Curves from IPO '%s'\n", n, ipo->id.name + 2); } @@ -162,7 +162,7 @@ static AdrBit2Path *adrcode_bitmaps_to_paths(int blocktype, int adrcode, int *to RET_ABP(ob_layer_bits); } // XXX TODO: add other types... - + /* Normal curve */ return NULL; } @@ -176,7 +176,7 @@ static const char *ob_adrcodes_to_paths(int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index = 0; - + /* result depends on adrcode */ switch (adrcode) { case OB_LOC_X: @@ -191,7 +191,7 @@ static const char *ob_adrcodes_to_paths(int adrcode, int *array_index) *array_index = 1; return "delta_location"; case OB_DLOC_Z: *array_index = 2; return "delta_location"; - + case OB_ROT_X: *array_index = 0; return "rotation_euler"; case OB_ROT_Y: @@ -204,7 +204,7 @@ static const char *ob_adrcodes_to_paths(int adrcode, int *array_index) *array_index = 1; return "delta_rotation_euler"; case OB_DROT_Z: *array_index = 2; return "delta_rotation_euler"; - + case OB_SIZE_X: *array_index = 0; return "scale"; case OB_SIZE_Y: @@ -246,18 +246,18 @@ static const char *ob_adrcodes_to_paths(int adrcode, int *array_index) break; #endif } - + return NULL; } -/* PoseChannel types +/* PoseChannel types * NOTE: pchan name comes from 'actname' added earlier... */ static const char *pchan_adrcodes_to_paths(int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index = 0; - + /* result depends on adrcode */ switch (adrcode) { case AC_QUAT_W: @@ -268,21 +268,21 @@ static const char *pchan_adrcodes_to_paths(int adrcode, int *array_index) *array_index = 2; return "rotation_quaternion"; case AC_QUAT_Z: *array_index = 3; return "rotation_quaternion"; - + case AC_EUL_X: *array_index = 0; return "rotation_euler"; case AC_EUL_Y: *array_index = 1; return "rotation_euler"; case AC_EUL_Z: *array_index = 2; return "rotation_euler"; - + case AC_LOC_X: *array_index = 0; return "location"; case AC_LOC_Y: *array_index = 1; return "location"; case AC_LOC_Z: *array_index = 2; return "location"; - + case AC_SIZE_X: *array_index = 0; return "scale"; case AC_SIZE_Y: @@ -290,7 +290,7 @@ static const char *pchan_adrcodes_to_paths(int adrcode, int *array_index) case AC_SIZE_Z: *array_index = 2; return "scale"; } - + /* for debugging only */ printf("ERROR: unmatched PoseChannel setting (code %d)\n", adrcode); return NULL; @@ -301,7 +301,7 @@ static const char *constraint_adrcodes_to_paths(int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index = 0; - + /* result depends on adrcode */ switch (adrcode) { case CO_ENFORCE: @@ -309,18 +309,18 @@ static const char *constraint_adrcodes_to_paths(int adrcode, int *array_index) case CO_HEADTAIL: // XXX this needs to be wrapped in RNA.. probably then this path will be invalid return "data.head_tail"; } - + return NULL; } -/* ShapeKey types +/* ShapeKey types * NOTE: as we don't have access to the keyblock where the data comes from (for now), * we'll just use numerical indices for now... */ static char *shapekey_adrcodes_to_paths(ID *id, int adrcode, int *UNUSED(array_index)) { static char buf[128]; - + /* block will be attached to ID_KE block... */ if (adrcode == 0) { /* adrcode=0 was the misnamed "speed" curve (now "evaluation time") */ @@ -330,7 +330,7 @@ static char *shapekey_adrcodes_to_paths(ID *id, int adrcode, int *UNUSED(array_i /* Find the name of the ShapeKey (i.e. KeyBlock) to look for */ Key *key = (Key *)id; KeyBlock *kb = BKE_keyblock_from_key(key, adrcode); - + /* setting that we alter is the "value" (i.e. keyblock.curval) */ if (kb) { /* Use the keyblock name, escaped, so that path lookups for this will work */ @@ -349,7 +349,7 @@ static const char *mtex_adrcodes_to_paths(int adrcode, int *UNUSED(array_index)) { const char *base = NULL, *prop = NULL; static char buf[128]; - + /* base part of path */ if (adrcode & MA_MAP1) base = "textures[0]"; else if (adrcode & MA_MAP2) base = "textures[1]"; @@ -369,7 +369,7 @@ static const char *mtex_adrcodes_to_paths(int adrcode, int *UNUSED(array_index)) else if (adrcode & MA_MAP16) base = "textures[15]"; else if (adrcode & MA_MAP17) base = "textures[16]"; else if (adrcode & MA_MAP18) base = "textures[17]"; - + /* property identifier for path */ adrcode = (adrcode & (MA_MAP1 - 1)); switch (adrcode) { @@ -404,7 +404,7 @@ static const char *mtex_adrcodes_to_paths(int adrcode, int *UNUSED(array_index)) case MAP_DISP: prop = "warp_factor"; break; } - + /* only build and return path if there's a property */ if (prop) { BLI_snprintf(buf, 128, "%s.%s", base, prop); @@ -419,26 +419,26 @@ static const char *texture_adrcodes_to_paths(int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index = 0; - + /* result depends on adrcode */ switch (adrcode) { case TE_NSIZE: return "noise_size"; case TE_TURB: return "turbulence"; - + case TE_NDEPTH: // XXX texture RNA undefined //poin= &(tex->noisedepth); *type= IPO_SHORT; break; break; case TE_NTYPE: // XXX texture RNA undefined //poin= &(tex->noisetype); *type= IPO_SHORT; break; break; - + case TE_N_BAS1: return "noise_basis"; case TE_N_BAS2: return "noise_basis"; // XXX this is not yet defined in RNA... - + /* voronoi */ case TE_VNW1: *array_index = 0; return "feature_weights"; @@ -454,15 +454,15 @@ static const char *texture_adrcodes_to_paths(int adrcode, int *array_index) return "distance_metric"; case TE_VN_COLT: return "color_type"; - + /* distorted noise / voronoi */ case TE_ISCA: return "noise_intensity"; - + /* distorted noise */ case TE_DISTA: return "distortion_amount"; - + /* musgrave */ case TE_MG_TYP: // XXX texture RNA undefined // poin= &(tex->stype); *type= IPO_SHORT; break; @@ -477,20 +477,20 @@ static const char *texture_adrcodes_to_paths(int adrcode, int *array_index) return "offset"; case TE_MG_GAIN: return "gain"; - + case TE_COL_R: *array_index = 0; return "rgb_factor"; case TE_COL_G: *array_index = 1; return "rgb_factor"; case TE_COL_B: *array_index = 2; return "rgb_factor"; - + case TE_BRIGHT: return "brightness"; case TE_CONTRA: return "constrast"; } - + return NULL; } @@ -499,7 +499,7 @@ static const char *material_adrcodes_to_paths(int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index = 0; - + /* result depends on adrcode */ switch (adrcode) { case MA_COL_R: @@ -508,73 +508,73 @@ static const char *material_adrcodes_to_paths(int adrcode, int *array_index) *array_index = 1; return "diffuse_color"; case MA_COL_B: *array_index = 2; return "diffuse_color"; - + case MA_SPEC_R: *array_index = 0; return "specular_color"; case MA_SPEC_G: *array_index = 1; return "specular_color"; case MA_SPEC_B: *array_index = 2; return "specular_color"; - + case MA_MIR_R: *array_index = 0; return "mirror_color"; case MA_MIR_G: *array_index = 1; return "mirror_color"; case MA_MIR_B: *array_index = 2; return "mirror_color"; - + case MA_ALPHA: return "alpha"; - + case MA_REF: return "diffuse_intensity"; - + case MA_EMIT: return "emit"; - + case MA_AMB: return "ambient"; - + case MA_SPEC: return "specular_intensity"; - + case MA_HARD: return "specular_hardness"; - + case MA_SPTR: return "specular_opacity"; - + case MA_IOR: return "ior"; - + case MA_HASIZE: return "halo.size"; - + case MA_TRANSLU: return "translucency"; - + case MA_RAYM: return "raytrace_mirror.reflect"; - + case MA_FRESMIR: return "raytrace_mirror.fresnel"; - + case MA_FRESMIRI: return "raytrace_mirror.fresnel_factor"; - + case MA_FRESTRA: return "raytrace_transparency.fresnel"; - + case MA_FRESTRAI: return "raytrace_transparency.fresnel_factor"; - + case MA_ADD: return "halo.add"; - + default: /* for now, we assume that the others were MTex channels */ return mtex_adrcodes_to_paths(adrcode, array_index); } - + return NULL; } @@ -583,7 +583,7 @@ static const char *camera_adrcodes_to_paths(int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index = 0; - + /* result depends on adrcode */ switch (adrcode) { case CAM_LENS: @@ -591,29 +591,29 @@ static const char *camera_adrcodes_to_paths(int adrcode, int *array_index) if (ca->type == CAM_ORTHO) return "ortho_scale"; else - return "lens"; + return "lens"; #else // XXX lazy hack for now... return "lens"; #endif // XXX this cannot be resolved easily - + case CAM_STA: return "clip_start"; case CAM_END: return "clip_end"; - + #if 0 // XXX these are not defined in RNA case CAM_YF_APERT: poin = &(ca->YF_aperture); break; case CAM_YF_FDIST: poin = &(ca->YF_dofdist); break; #endif // XXX these are not defined in RNA - + case CAM_SHIFT_X: return "shift_x"; case CAM_SHIFT_Y: return "shift_y"; } - + /* unrecognised adrcode, or not-yet-handled ones! */ return NULL; } @@ -623,39 +623,39 @@ static const char *lamp_adrcodes_to_paths(int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index = 0; - + /* result depends on adrcode */ switch (adrcode) { case LA_ENERGY: return "energy"; - + case LA_COL_R: *array_index = 0; return "color"; case LA_COL_G: *array_index = 1; return "color"; case LA_COL_B: *array_index = 2; return "color"; - + case LA_DIST: return "distance"; - + case LA_SPOTSI: return "spot_size"; case LA_SPOTBL: return "spot_blend"; - + case LA_QUAD1: return "linear_attenuation"; case LA_QUAD2: return "quadratic_attenuation"; - + case LA_HALOINT: return "halo_intensity"; - + default: /* for now, we assume that the others were MTex channels */ return mtex_adrcodes_to_paths(adrcode, array_index); } - + /* unrecognised adrcode, or not-yet-handled ones! */ return NULL; } @@ -665,7 +665,7 @@ static const char *sound_adrcodes_to_paths(int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index = 0; - + /* result depends on adrcode */ switch (adrcode) { case SND_VOLUME: @@ -680,7 +680,7 @@ static const char *sound_adrcodes_to_paths(int adrcode, int *array_index) case SND_ATTEN: return "attenuation"; } - + /* unrecognised adrcode, or not-yet-handled ones! */ return NULL; } @@ -690,7 +690,7 @@ static const char *world_adrcodes_to_paths(int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index = 0; - + /* result depends on adrcode */ switch (adrcode) { case WO_HOR_R: @@ -705,10 +705,10 @@ static const char *world_adrcodes_to_paths(int adrcode, int *array_index) *array_index = 1; return "zenith_color"; case WO_ZEN_B: *array_index = 2; return "zenith_color"; - + case WO_EXPOS: return "exposure"; - + case WO_MISI: return "mist.intensity"; case WO_MISTDI: @@ -717,11 +717,11 @@ static const char *world_adrcodes_to_paths(int adrcode, int *array_index) return "mist.start"; case WO_MISTHI: return "mist.height"; - + default: /* for now, we assume that the others were MTex channels */ return mtex_adrcodes_to_paths(adrcode, array_index); } - + return NULL; } @@ -730,7 +730,7 @@ static const char *particle_adrcodes_to_paths(int adrcode, int *array_index) { /* set array index like this in-case nothing sets it correctly */ *array_index = 0; - + /* result depends on adrcode */ switch (adrcode) { case PART_CLUMP: @@ -761,7 +761,7 @@ static const char *particle_adrcodes_to_paths(int adrcode, int *array_index) return "settings.kink_shape"; case PART_BB_TILT: return "settings.billboard_tilt"; - + /* PartDeflect needs to be sorted out properly in rna_object_force; * If anyone else works on this, but is unfamiliar, these particular * settings reference the particles of the system themselves @@ -811,64 +811,64 @@ static char *get_rna_access(ID *id, int blocktype, int adrcode, char actname[], char *rpath = NULL; char buf[512]; int dummy_index = 0; - + /* hack: if constname is set, we can only be dealing with an Constraint curve */ if (constname) blocktype = ID_CO; - + /* get property name based on blocktype */ switch (blocktype) { case ID_OB: /* object */ propname = ob_adrcodes_to_paths(adrcode, &dummy_index); break; - + case ID_PO: /* pose channel */ propname = pchan_adrcodes_to_paths(adrcode, &dummy_index); break; - + case ID_KE: /* shapekeys */ propname = shapekey_adrcodes_to_paths(id, adrcode, &dummy_index); break; - + case ID_CO: /* constraint */ propname = constraint_adrcodes_to_paths(adrcode, &dummy_index); break; - + case ID_TE: /* texture */ propname = texture_adrcodes_to_paths(adrcode, &dummy_index); break; - + case ID_MA: /* material */ propname = material_adrcodes_to_paths(adrcode, &dummy_index); break; - + case ID_CA: /* camera */ propname = camera_adrcodes_to_paths(adrcode, &dummy_index); break; - + case ID_LA: /* lamp */ propname = lamp_adrcodes_to_paths(adrcode, &dummy_index); break; - + case ID_SO: /* sound */ propname = sound_adrcodes_to_paths(adrcode, &dummy_index); break; - + case ID_WO: /* world */ propname = world_adrcodes_to_paths(adrcode, &dummy_index); break; - + case ID_PA: /* particle */ propname = particle_adrcodes_to_paths(adrcode, &dummy_index); break; - + case ID_CU: /* curve */ - /* this used to be a 'dummy' curve which got evaluated on the fly... + /* this used to be a 'dummy' curve which got evaluated on the fly... * now we've got real var for this! */ propname = "eval_time"; break; - + /* XXX problematic blocktypes */ case ID_SEQ: /* sequencer strip */ //SEQ_FAC1: @@ -885,28 +885,28 @@ static char *get_rna_access(ID *id, int blocktype, int adrcode, char actname[], } // poin= &(seq->facf0); // XXX this doesn't seem to be included anywhere in sequencer RNA... break; - + /* special hacks */ case -1: /* special case for rotdiff drivers... we don't need a property for this... */ break; - + /* TODO... add other blocktypes... */ default: printf("IPO2ANIMATO WARNING: No path for blocktype %d, adrcode %d yet\n", blocktype, adrcode); break; } - - /* check if any property found + + /* check if any property found * - blocktype < 0 is special case for a specific type of driver, where we don't need a property name... */ if ((propname == NULL) && (blocktype > 0)) { /* nothing was found, so exit */ - if (array_index) + if (array_index) *array_index = 0; - + BLI_dynstr_free(path); - + return NULL; } else { @@ -948,24 +948,24 @@ static char *get_rna_access(ID *id, int blocktype, int adrcode, char actname[], } BLI_dynstr_append(path, buf); - + /* need to add dot before property if there was anything precceding this */ if (buf[0]) BLI_dynstr_append(path, "."); - + /* now write name of property */ BLI_dynstr_append(path, propname); - + /* if there was no array index pointer provided, add it to the path */ if (array_index == NULL) { BLI_snprintf(buf, sizeof(buf), "[\"%d\"]", dummy_index); BLI_dynstr_append(path, buf); } - + /* convert to normal MEM_malloc'd string */ rpath = BLI_dynstr_get_cstring(path); BLI_dynstr_free(path); - + /* return path... */ return rpath; } @@ -983,21 +983,21 @@ static short adrcode_to_dtar_transchan(short adrcode) return DTAR_TRANSCHAN_LOCY; case OB_LOC_Z: return DTAR_TRANSCHAN_LOCZ; - + case OB_ROT_X: return DTAR_TRANSCHAN_ROTX; case OB_ROT_Y: return DTAR_TRANSCHAN_ROTY; case OB_ROT_Z: return DTAR_TRANSCHAN_ROTZ; - + case OB_SIZE_X: return DTAR_TRANSCHAN_SCALEX; case OB_SIZE_Y: return DTAR_TRANSCHAN_SCALEX; case OB_SIZE_Z: return DTAR_TRANSCHAN_SCALEX; - + default: return 0; } @@ -1007,10 +1007,10 @@ static short adrcode_to_dtar_transchan(short adrcode) static ChannelDriver *idriver_to_cdriver(IpoDriver *idriver) { ChannelDriver *cdriver; - + /* allocate memory for new driver */ cdriver = MEM_callocN(sizeof(ChannelDriver), "ChannelDriver"); - + /* if 'pydriver', just copy data across */ if (idriver->type == IPO_DRIVER_TYPE_PYTHON) { /* PyDriver only requires the expression to be copied */ @@ -1022,24 +1022,24 @@ static ChannelDriver *idriver_to_cdriver(IpoDriver *idriver) else { DriverVar *dvar = NULL; DriverTarget *dtar = NULL; - + /* this should be ok for all types here... */ cdriver->type = DRIVER_TYPE_AVERAGE; - + /* what to store depends on the 'blocktype' - object or posechannel */ if (idriver->blocktype == ID_AR) { /* PoseChannel */ if (idriver->adrcode == OB_ROT_DIFF) { /* Rotational Difference requires a special type of variable */ dvar = driver_add_new_variable(cdriver); driver_change_variable_type(dvar, DVAR_TYPE_ROT_DIFF); - + /* first bone target */ dtar = &dvar->targets[0]; dtar->id = (ID *)idriver->ob; dtar->idtype = ID_OB; if (idriver->name[0]) BLI_strncpy(dtar->pchan_name, idriver->name, sizeof(dtar->pchan_name)); - + /* second bone target (name was stored in same var as the first one) */ dtar = &dvar->targets[1]; dtar->id = (ID *)idriver->ob; @@ -1051,7 +1051,7 @@ static ChannelDriver *idriver_to_cdriver(IpoDriver *idriver) /* only a single variable, of type 'transform channel' */ dvar = driver_add_new_variable(cdriver); driver_change_variable_type(dvar, DVAR_TYPE_TRANSFORM_CHAN); - + /* only requires a single target */ dtar = &dvar->targets[0]; dtar->id = (ID *)idriver->ob; @@ -1066,7 +1066,7 @@ static ChannelDriver *idriver_to_cdriver(IpoDriver *idriver) /* only a single variable, of type 'transform channel' */ dvar = driver_add_new_variable(cdriver); driver_change_variable_type(dvar, DVAR_TYPE_TRANSFORM_CHAN); - + /* only requires single target */ dtar = &dvar->targets[0]; dtar->id = (ID *)idriver->ob; @@ -1074,12 +1074,12 @@ static ChannelDriver *idriver_to_cdriver(IpoDriver *idriver) dtar->transChan = adrcode_to_dtar_transchan(idriver->adrcode); } } - + /* return the new one */ return cdriver; } -/* Add F-Curve to the correct list +/* Add F-Curve to the correct list * - grpname is needed to be used as group name where relevant, and is usually derived from actname */ static void fcurve_add_to_list(ListBase *groups, ListBase *list, FCurve *fcu, char *grpname, int muteipo) @@ -1091,7 +1091,7 @@ static void fcurve_add_to_list(ListBase *groups, ListBase *list, FCurve *fcu, ch */ bAction tmp_act; bActionGroup *agrp = NULL; - + /* init the temp action */ memset(&tmp_act, 0, sizeof(bAction)); // XXX only enable this line if we get errors tmp_act.groups.first = groups->first; @@ -1099,7 +1099,7 @@ static void fcurve_add_to_list(ListBase *groups, ListBase *list, FCurve *fcu, ch tmp_act.curves.first = list->first; tmp_act.curves.last = list->last; /* ... xxx, the other vars don't need to be filled in */ - + /* get the group to use */ agrp = BKE_action_group_find_name(&tmp_act, grpname); /* no matching group, so add one */ @@ -1116,14 +1116,14 @@ static void fcurve_add_to_list(ListBase *groups, ListBase *list, FCurve *fcu, ch BLI_uniquename(&tmp_act.groups, agrp, DATA_("Group"), '.', offsetof(bActionGroup, name), sizeof(agrp->name)); } - + /* add F-Curve to group */ /* WARNING: this func should only need to look at the stuff we initialized, if not, things may crash */ action_groups_add_channel(&tmp_act, agrp, fcu); - + if (agrp->flag & AGRP_MUTED) /* flush down */ fcu->flag |= FCURVE_MUTED; - + /* set the output lists based on the ones in the temp action */ groups->first = tmp_act.groups.first; groups->last = tmp_act.groups.last; @@ -1136,7 +1136,7 @@ static void fcurve_add_to_list(ListBase *groups, ListBase *list, FCurve *fcu, ch } } -/* Convert IPO-Curve to F-Curve (including Driver data), and free any of the old data that +/* Convert IPO-Curve to F-Curve (including Driver data), and free any of the old data that * is not relevant, BUT do not free the IPO-Curve itself... * actname: name of Action-Channel (if applicable) that IPO-Curve's IPO-block belonged to * constname: name of Constraint-Channel (if applicable) that IPO-Curve's IPO-block belonged to @@ -1147,21 +1147,21 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i AdrBit2Path *abp; FCurve *fcu; int totbits; - + /* allocate memory for a new F-Curve */ fcu = MEM_callocN(sizeof(FCurve), "FCurve"); - + /* convert driver */ if (icu->driver) fcu->driver = idriver_to_cdriver(icu->driver); - + /* copy flags */ if (icu->flag & IPO_VISIBLE) fcu->flag |= FCURVE_VISIBLE; if (icu->flag & IPO_SELECT) fcu->flag |= FCURVE_SELECTED; if (icu->flag & IPO_ACTIVE) fcu->flag |= FCURVE_ACTIVE; if (icu->flag & IPO_MUTE) fcu->flag |= FCURVE_MUTED; if (icu->flag & IPO_PROTECT) fcu->flag |= FCURVE_PROTECTED; - + /* set extrapolation */ switch (icu->extrap) { case IPO_HORIZ: /* constant extrapolation */ @@ -1174,12 +1174,12 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i case IPO_CYCL: /* cyclic extrapolation */ case IPO_CYCLX: /* cyclic extrapolation + offset */ { - /* Add a new FModifier (Cyclic) instead of setting extend value + /* Add a new FModifier (Cyclic) instead of setting extend value * as that's the new equivalent of that option. */ FModifier *fcm = add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES, fcu); FMod_Cycles *data = (FMod_Cycles *)fcm->data; - + /* if 'offset' one is in use, set appropriate settings */ if (icu->extrap == IPO_CYCLX) data->before_mode = data->after_mode = FCM_EXTRAPOLATE_CYCLIC_OFFSET; @@ -1188,20 +1188,20 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i break; } } - + /* -------- */ - + /* get adrcode <-> bitflags mapping to handle nasty bitflag curves? */ abp = adrcode_bitmaps_to_paths(icu->blocktype, icu->adrcode, &totbits); if (abp && totbits) { FCurve *fcurve; int b; - + if (G.debug & G_DEBUG) printf("\tconvert bitflag ipocurve, totbits = %d\n", totbits); - + /* add the 'only int values' flag */ fcu->flag |= (FCURVE_INT_VALUES | FCURVE_DISCRETE_VALUES); - + /* for each bit we have to remap + check for: * 1) we need to make copy the existing F-Curve data (fcu -> fcurve), * except for the last one which will use the original @@ -1210,46 +1210,46 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i */ for (b = 0; b < totbits; b++, abp++) { unsigned int i = 0; - + /* make a copy of existing base-data if not the last curve */ if (b < (totbits - 1)) fcurve = copy_fcurve(fcu); else fcurve = fcu; - + /* set path */ fcurve->rna_path = BLI_strdup(abp->path); fcurve->array_index = abp->array_index; - - /* convert keyframes + + /* convert keyframes * - beztriples and bpoints are mutually exclusive, so we won't have both at the same time * - beztriples are more likely to be encountered as they are keyframes (the other type wasn't used yet) */ fcurve->totvert = icu->totvert; - + if (icu->bezt) { BezTriple *dst, *src; - + /* allocate new array for keyframes/beztriples */ fcurve->bezt = MEM_callocN(sizeof(BezTriple) * fcurve->totvert, "BezTriples"); - + /* loop through copying all BezTriples individually, as we need to modify a few things */ for (dst = fcurve->bezt, src = icu->bezt, i = 0; i < fcurve->totvert; i++, dst++, src++) { /* firstly, copy BezTriple data */ *dst = *src; - + /* interpolation can only be constant... */ dst->ipo = BEZT_IPO_CONST; - + /* 'hide' flag is now used for keytype - only 'keyframes' existed before */ dst->hide = BEZT_KEYTYPE_KEYFRAME; - + /* auto-handles - per curve to per handle */ if (icu->flag & IPO_AUTO_HORIZ) { if (dst->h1 == HD_AUTO) dst->h1 = HD_AUTO_ANIM; if (dst->h2 == HD_AUTO) dst->h2 = HD_AUTO_ANIM; } - + /* correct values, by checking if the flag of interest is set */ if ( ((int)(dst->vec[1][1])) & (abp->bit) ) dst->vec[0][1] = dst->vec[1][1] = dst->vec[2][1] = 1.0f; @@ -1262,80 +1262,80 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i //BPoint *bp; //FPoint *fpt; } - + /* add new F-Curve to list */ fcurve_add_to_list(groups, list, fcurve, actname, muteipo); } } else { unsigned int i = 0; - + /* get rna-path * - we will need to set the 'disabled' flag if no path is able to be made (for now) */ fcu->rna_path = get_rna_access(id, icu->blocktype, icu->adrcode, actname, constname, seq, &fcu->array_index); if (fcu->rna_path == NULL) fcu->flag |= FCURVE_DISABLED; - - /* convert keyframes + + /* convert keyframes * - beztriples and bpoints are mutually exclusive, so we won't have both at the same time * - beztriples are more likely to be encountered as they are keyframes (the other type wasn't used yet) */ fcu->totvert = icu->totvert; - + if (icu->bezt) { BezTriple *dst, *src; - + /* allocate new array for keyframes/beztriples */ fcu->bezt = MEM_callocN(sizeof(BezTriple) * fcu->totvert, "BezTriples"); - + /* loop through copying all BezTriples individually, as we need to modify a few things */ for (dst = fcu->bezt, src = icu->bezt, i = 0; i < fcu->totvert; i++, dst++, src++) { /* firstly, copy BezTriple data */ *dst = *src; - + /* now copy interpolation from curve (if not already set) */ if (icu->ipo != IPO_MIXED) dst->ipo = icu->ipo; - + /* 'hide' flag is now used for keytype - only 'keyframes' existed before */ dst->hide = BEZT_KEYTYPE_KEYFRAME; - + /* auto-handles - per curve to per handle */ if (icu->flag & IPO_AUTO_HORIZ) { if (dst->h1 == HD_AUTO) dst->h1 = HD_AUTO_ANIM; if (dst->h2 == HD_AUTO) dst->h2 = HD_AUTO_ANIM; } - - /* correct values for euler rotation curves - * - they were degrees/10 + + /* correct values for euler rotation curves + * - they were degrees/10 * - we need radians for RNA to do the right thing */ if ( ((icu->blocktype == ID_OB) && ELEM(icu->adrcode, OB_ROT_X, OB_ROT_Y, OB_ROT_Z)) || ((icu->blocktype == ID_PO) && ELEM(icu->adrcode, AC_EUL_X, AC_EUL_Y, AC_EUL_Z)) ) { const float fac = (float)M_PI / 18.0f; //10.0f * M_PI/180.0f; - + dst->vec[0][1] *= fac; dst->vec[1][1] *= fac; dst->vec[2][1] *= fac; } - - /* correct values for path speed curves + + /* correct values for path speed curves * - their values were 0-1 * - we now need as 'frames' */ - if ( (id) && (icu->blocktype == GS(id->name)) && + if ( (id) && (icu->blocktype == GS(id->name)) && (fcu->rna_path && STREQ(fcu->rna_path, "eval_time")) ) { Curve *cu = (Curve *)id; - + dst->vec[0][1] *= cu->pathlen; dst->vec[1][1] *= cu->pathlen; dst->vec[2][1] *= cu->pathlen; } - - /* correct times for rotation drivers + + /* correct times for rotation drivers * - need to go from degrees to radians... * - there's only really 1 target to worry about * - were also degrees/10 @@ -1343,27 +1343,27 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i if (fcu->driver && fcu->driver->variables.first) { DriverVar *dvar = fcu->driver->variables.first; DriverTarget *dtar = &dvar->targets[0]; - + if (ELEM(dtar->transChan, DTAR_TRANSCHAN_ROTX, DTAR_TRANSCHAN_ROTY, DTAR_TRANSCHAN_ROTZ)) { const float fac = (float)M_PI / 18.0f; - + dst->vec[0][0] *= fac; dst->vec[1][0] *= fac; dst->vec[2][0] *= fac; } } - + /* correct values for sequencer curves, that were not locked to frame */ if (seq && (seq->flag & SEQ_IPO_FRAME_LOCKED) == 0) { const float mul = (seq->enddisp - seq->startdisp) / 100.0f; const float offset = seq->startdisp; - + dst->vec[0][0] *= mul; dst->vec[0][0] += offset; - + dst->vec[1][0] *= mul; dst->vec[1][0] += offset; - + dst->vec[2][0] *= mul; dst->vec[2][0] += offset; } @@ -1374,7 +1374,7 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i //BPoint *bp; //FPoint *fpt; } - + /* add new F-Curve to list */ fcurve_add_to_list(groups, list, fcu, actname, muteipo); } @@ -1389,16 +1389,16 @@ static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *i static void ipo_to_animato(ID *id, Ipo *ipo, char actname[], char constname[], Sequence *seq, ListBase *animgroups, ListBase *anim, ListBase *drivers) { IpoCurve *icu; - + /* sanity check */ if (ELEM(NULL, ipo, anim, drivers)) return; - + if (G.debug & G_DEBUG) printf("ipo_to_animato\n"); - - /* validate actname and constname + + /* validate actname and constname * - clear actname if it was one of the generic <builtin> ones (i.e. 'Object', or 'Shapes') - * - actname can then be used to assign F-Curves in Action to Action Groups + * - actname can then be used to assign F-Curves in Action to Action Groups * (i.e. thus keeping the benefits that used to be provided by Action Channels for grouping * F-Curves for bones). This may be added later... for now let's just dump without them... */ @@ -1408,10 +1408,10 @@ static void ipo_to_animato(ID *id, Ipo *ipo, char actname[], char constname[], S else if ((ipo->blocktype == ID_OB) && STREQ(actname, "Shape")) actname = NULL; } - + /* loop over IPO-Curves, freeing as we progress */ for (icu = ipo->curve.first; icu; icu = icu->next) { - /* Since an IPO-Curve may end up being made into many F-Curves (i.e. bitflag curves), + /* Since an IPO-Curve may end up being made into many F-Curves (i.e. bitflag curves), * we figure out the best place to put the channel, then tell the curve-converter to just dump there */ if (icu->driver) { @@ -1427,23 +1427,23 @@ static void ipo_to_animato(ID *id, Ipo *ipo, char actname[], char constname[], S else icu_to_fcurves(id, animgroups, anim, icu, actname, constname, seq, ipo->muteipo); } - + /* if this IPO block doesn't have any users after this one, free... */ id_us_min(&ipo->id); if (ID_REAL_USERS(ipo) <= 0) { IpoCurve *icn; - + for (icu = ipo->curve.first; icu; icu = icn) { icn = icu->next; - + /* free driver */ if (icu->driver) MEM_freeN(icu->driver); - + /* free old data of curve now that it's no longer needed for converting any more curves */ if (icu->bezt) MEM_freeN(icu->bezt); if (icu->bp) MEM_freeN(icu->bezt); - + /* free this IPO-Curve */ BLI_freelinkN(&ipo->curve, icu); } @@ -1459,44 +1459,44 @@ static void action_to_animato(ID *id, bAction *act, ListBase *groups, ListBase * { bActionChannel *achan, *achann; bConstraintChannel *conchan, *conchann; - + /* only continue if there are Action Channels (indicating unconverted data) */ if (BLI_listbase_is_empty(&act->chanbase)) return; - + /* get rid of all Action Groups */ // XXX this is risky if there's some old + some new data in the Action... - if (act->groups.first) + if (act->groups.first) BLI_freelistN(&act->groups); - + /* loop through Action-Channels, converting data, freeing as we go */ for (achan = act->chanbase.first; achan; achan = achann) { /* get pointer to next Action Channel */ achann = achan->next; - + /* convert Action Channel's IPO data */ if (achan->ipo) { ipo_to_animato(id, achan->ipo, achan->name, NULL, NULL, groups, curves, drivers); id_us_min(&achan->ipo->id); achan->ipo = NULL; } - + /* convert constraint channel IPO-data */ for (conchan = achan->constraintChannels.first; conchan; conchan = conchann) { /* get pointer to next Constraint Channel */ conchann = conchan->next; - + /* convert Constraint Channel's IPO data */ if (conchan->ipo) { ipo_to_animato(id, conchan->ipo, achan->name, conchan->name, NULL, groups, curves, drivers); id_us_min(&conchan->ipo->id); conchan->ipo = NULL; } - + /* free Constraint Channel */ BLI_freelinkN(&achan->constraintChannels, conchan); } - + /* free Action Channel */ BLI_freelinkN(&act->chanbase, achan); } @@ -1514,7 +1514,7 @@ static void ipo_to_animdata(Main *bmain, ID *id, Ipo *ipo, char actname[], char AnimData *adt = BKE_animdata_from_id(id); ListBase anim = {NULL, NULL}; ListBase drivers = {NULL, NULL}; - + /* sanity check */ if (ELEM(NULL, id, ipo)) return; @@ -1522,36 +1522,36 @@ static void ipo_to_animdata(Main *bmain, ID *id, Ipo *ipo, char actname[], char printf("ERROR ipo_to_animdata(): adt invalid\n"); return; } - + if (G.debug & G_DEBUG) { printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s seqname:%s curves:%d\n", id->name + 2, ipo->id.name + 2, (actname) ? actname : "<None>", (constname) ? constname : "<None>", (seq) ? (seq->name + 2) : "<None>", BLI_listbase_count(&ipo->curve)); } - + /* Convert curves to animato system (separated into separate lists of F-Curves for animation and drivers), * and the try to put these lists in the right places, but do not free the lists here */ - // XXX there shouldn't be any need for the groups, so don't supply pointer for that now... + // XXX there shouldn't be any need for the groups, so don't supply pointer for that now... ipo_to_animato(id, ipo, actname, constname, seq, NULL, &anim, &drivers); - + /* deal with animation first */ if (anim.first) { if (G.debug & G_DEBUG) printf("\thas anim\n"); /* try to get action */ if (adt->action == NULL) { char nameBuf[MAX_ID_NAME]; - + BLI_snprintf(nameBuf, sizeof(nameBuf), "CDA:%s", ipo->id.name + 2); - + adt->action = BKE_action_add(bmain, nameBuf); if (G.debug & G_DEBUG) printf("\t\tadded new action - '%s'\n", nameBuf); } - + /* add F-Curves to action */ BLI_movelisttolist(&adt->action->curves, &anim); } - + /* deal with drivers */ if (drivers.first) { if (G.debug & G_DEBUG) printf("\thas drivers\n"); @@ -1566,18 +1566,18 @@ static void ipo_to_animdata(Main *bmain, ID *id, Ipo *ipo, char actname[], char static void action_to_animdata(ID *id, bAction *act) { AnimData *adt = BKE_animdata_from_id(id); - + /* only continue if there are Action Channels (indicating unconverted data) */ if (ELEM(NULL, adt, act->chanbase.first)) return; - + /* check if we need to set this Action as the AnimData's action */ if (adt->action == NULL) { /* set this Action as AnimData's Action */ if (G.debug & G_DEBUG) printf("act_to_adt - set adt action to act\n"); adt->action = act; } - + /* convert Action data */ action_to_animato(id, act, &adt->action->groups, &adt->action->curves, &adt->drivers); } @@ -1595,25 +1595,25 @@ static void nlastrips_to_animdata(ID *id, ListBase *strips) NlaTrack *nlt = NULL; NlaStrip *strip; bActionStrip *as, *asn; - + /* for each one of the original strips, convert to a new strip and free the old... */ for (as = strips->first; as; as = asn) { asn = as->next; - + /* this old strip is only worth something if it had an action... */ if (as->act) { /* convert Action data (if not yet converted), storing the results in the same Action */ action_to_animato(id, as->act, &as->act->groups, &as->act->curves, &adt->drivers); - + /* create a new-style NLA-strip which references this Action, then copy over relevant settings */ { - /* init a new strip, and assign the action to it - * - no need to muck around with the user-counts, since this is just + /* init a new strip, and assign the action to it + * - no need to muck around with the user-counts, since this is just * passing over the ref to the new owner, not creating an additional ref */ strip = MEM_callocN(sizeof(NlaStrip), "NlaStrip"); strip->act = as->act; - + /* endpoints */ strip->start = as->start; strip->end = as->end; @@ -1642,25 +1642,25 @@ static void nlastrips_to_animdata(ID *id, ListBase *strips) if ((as->flag & ACTSTRIP_HOLDLASTFRAME) == 0) strip->extendmode = NLASTRIP_EXTEND_NOTHING; } - + /* try to add this strip to the current NLA-Track (i.e. the 'last' one on the stack atm) */ if (BKE_nlatrack_add_strip(nlt, strip) == 0) { - /* trying to add to the current failed (no space), + /* trying to add to the current failed (no space), * so add a new track to the stack, and add to that... */ nlt = BKE_nlatrack_add(adt, NULL); BKE_nlatrack_add_strip(nlt, strip); } - + /* ensure that strip has a name */ BKE_nlastrip_validate_name(adt, strip); } - + /* modifiers */ // FIXME: for now, we just free them... if (as->modifiers.first) BLI_freelistN(&as->modifiers); - + /* free the old strip */ BLI_freelinkN(strips, as); } @@ -1679,17 +1679,17 @@ static void nlastrips_to_animdata(ID *id, ListBase *strips) * Data that has been converted should be freed immediately, which means that it is immediately * clear which datablocks have yet to be converted, and also prevent freeing errors when we exit. */ -// XXX currently done after all file reading... +// XXX currently done after all file reading... void do_versions_ipos_to_animato(Main *bmain) { ListBase drivers = {NULL, NULL}; ID *id; - + if (bmain == NULL) { printf("Argh! Main is NULL in do_versions_ipos_to_animato()\n"); return; } - + /* only convert if version is right */ if (bmain->versionfile >= 250) { printf("WARNING: Animation data too new to convert (Version %d)\n", bmain->versionfile); @@ -1697,57 +1697,57 @@ void do_versions_ipos_to_animato(Main *bmain) } else if (G.debug & G_DEBUG) printf("INFO: Converting to Animato...\n"); - + /* ----------- Animation Attached to Data -------------- */ - + /* objects */ for (id = bmain->object.first; id; id = id->next) { Object *ob = (Object *)id; bPoseChannel *pchan; bConstraint *con; bConstraintChannel *conchan, *conchann; - + if (G.debug & G_DEBUG) printf("\tconverting ob %s\n", id->name + 2); - + /* check if object has any animation data */ if (ob->nlastrips.first) { /* Add AnimData block */ BKE_animdata_add_id(id); - + /* IPO first to take into any non-NLA'd Object Animation */ if (ob->ipo) { ipo_to_animdata(bmain, id, ob->ipo, NULL, NULL, NULL); - + id_us_min(&ob->ipo->id); ob->ipo = NULL; } - - /* Action is skipped since it'll be used by some strip in the NLA anyway, + + /* Action is skipped since it'll be used by some strip in the NLA anyway, * causing errors with evaluation in the new evaluation pipeline */ if (ob->action) { id_us_min(&ob->action->id); ob->action = NULL; } - + /* finally NLA */ nlastrips_to_animdata(id, &ob->nlastrips); } else if ((ob->ipo) || (ob->action)) { /* Add AnimData block */ AnimData *adt = BKE_animdata_add_id(id); - + /* Action first - so that Action name get conserved */ if (ob->action) { action_to_animdata(id, ob->action); - + /* only decrease usercount if this Action isn't now being used by AnimData */ if (ob->action != adt->action) { id_us_min(&ob->action->id); ob->action = NULL; } } - + /* IPO second... */ if (ob->ipo) { ipo_to_animdata(bmain, id, ob->ipo, NULL, NULL, NULL); @@ -1755,19 +1755,19 @@ void do_versions_ipos_to_animato(Main *bmain) ob->ipo = NULL; } } - + /* check PoseChannels for constraints with local data */ if (ob->pose) { /* Verify if there's AnimData block */ BKE_animdata_add_id(id); - + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { for (con = pchan->constraints.first; con; con = con->next) { - /* if constraint has own IPO, convert add these to Object - * (NOTE: they're most likely to be drivers too) + /* if constraint has own IPO, convert add these to Object + * (NOTE: they're most likely to be drivers too) */ if (con->ipo) { - /* although this was the constraint's local IPO, we still need to provide pchan + con + /* although this was the constraint's local IPO, we still need to provide pchan + con * so that drivers can be added properly... */ ipo_to_animdata(bmain, id, con->ipo, pchan->name, con->name, NULL); @@ -1777,49 +1777,49 @@ void do_versions_ipos_to_animato(Main *bmain) } } } - + /* check constraints for local IPO's */ for (con = ob->constraints.first; con; con = con->next) { - /* if constraint has own IPO, convert add these to Object - * (NOTE: they're most likely to be drivers too) + /* if constraint has own IPO, convert add these to Object + * (NOTE: they're most likely to be drivers too) */ if (con->ipo) { /* Verify if there's AnimData block, just in case */ BKE_animdata_add_id(id); - - /* although this was the constraint's local IPO, we still need to provide con + + /* although this was the constraint's local IPO, we still need to provide con * so that drivers can be added properly... */ ipo_to_animdata(bmain, id, con->ipo, NULL, con->name, NULL); id_us_min(&con->ipo->id); con->ipo = NULL; } - + /* check for Action Constraint */ // XXX do we really want to do this here? } - + /* check constraint channels - we need to remove them anyway... */ if (ob->constraintChannels.first) { /* Verify if there's AnimData block */ BKE_animdata_add_id(id); - + for (conchan = ob->constraintChannels.first; conchan; conchan = conchann) { /* get pointer to next Constraint Channel */ conchann = conchan->next; - + /* convert Constraint Channel's IPO data */ if (conchan->ipo) { ipo_to_animdata(bmain, id, conchan->ipo, NULL, conchan->name, NULL); id_us_min(&conchan->ipo->id); conchan->ipo = NULL; } - + /* free Constraint Channel */ BLI_freelinkN(&ob->constraintChannels, conchan); } } - + /* object's action will always be object-rooted */ { AnimData *adt = BKE_animdata_from_id(id); @@ -1827,100 +1827,100 @@ void do_versions_ipos_to_animato(Main *bmain) adt->action->idroot = ID_OB; } } - + /* shapekeys */ for (id = bmain->key.first; id; id = id->next) { Key *key = (Key *)id; - + if (G.debug & G_DEBUG) printf("\tconverting key %s\n", id->name + 2); - - /* we're only interested in the IPO + + /* we're only interested in the IPO * NOTE: for later, it might be good to port these over to Object instead, as many of these * are likely to be drivers, but it's hard to trace that from here, so move this to Ob loop? */ if (key->ipo) { /* Add AnimData block */ AnimData *adt = BKE_animdata_add_id(id); - + /* Convert Shapekey data... */ ipo_to_animdata(bmain, id, key->ipo, NULL, NULL, NULL); - + if (adt->action) adt->action->idroot = key->ipo->blocktype; - + id_us_min(&key->ipo->id); key->ipo = NULL; } } - + /* materials */ for (id = bmain->mat.first; id; id = id->next) { Material *ma = (Material *)id; - + if (G.debug & G_DEBUG) printf("\tconverting material %s\n", id->name + 2); - + /* we're only interested in the IPO */ if (ma->ipo) { /* Add AnimData block */ AnimData *adt = BKE_animdata_add_id(id); - + /* Convert Material data... */ ipo_to_animdata(bmain, id, ma->ipo, NULL, NULL, NULL); - + if (adt->action) adt->action->idroot = ma->ipo->blocktype; - + id_us_min(&ma->ipo->id); ma->ipo = NULL; } } - + /* worlds */ for (id = bmain->world.first; id; id = id->next) { World *wo = (World *)id; - + if (G.debug & G_DEBUG) printf("\tconverting world %s\n", id->name + 2); - + /* we're only interested in the IPO */ if (wo->ipo) { /* Add AnimData block */ AnimData *adt = BKE_animdata_add_id(id); - + /* Convert World data... */ ipo_to_animdata(bmain, id, wo->ipo, NULL, NULL, NULL); - + if (adt->action) adt->action->idroot = wo->ipo->blocktype; - + id_us_min(&wo->ipo->id); wo->ipo = NULL; } } - + /* sequence strips */ for (id = bmain->scene.first; id; id = id->next) { Scene *scene = (Scene *)id; Editing *ed = scene->ed; if (ed && ed->seqbasep) { Sequence *seq; - + AnimData *adt = BKE_animdata_add_id(id); - + SEQ_BEGIN(ed, seq) { IpoCurve *icu = (seq->ipo) ? seq->ipo->curve.first : NULL; short adrcode = SEQ_FAC1; - + if (G.debug & G_DEBUG) printf("\tconverting sequence strip %s\n", seq->name + 2); - + if (ELEM(NULL, seq->ipo, icu)) { seq->flag |= SEQ_USE_EFFECT_DEFAULT_FADE; continue; } - + /* patch adrcode, so that we can map - * to different DNA variables later + * to different DNA variables later * (semi-hack (tm) ) */ switch (seq->type) { @@ -1936,13 +1936,13 @@ void do_versions_ipos_to_animato(Main *bmain) break; } icu->adrcode = adrcode; - + /* convert IPO */ ipo_to_animdata(bmain, (ID *)scene, seq->ipo, NULL, NULL, seq); - + if (adt->action) adt->action->idroot = ID_SCE; /* scene-rooted */ - + id_us_min(&seq->ipo->id); seq->ipo = NULL; } @@ -1954,140 +1954,140 @@ void do_versions_ipos_to_animato(Main *bmain) /* textures */ for (id = bmain->tex.first; id; id = id->next) { Tex *te = (Tex *)id; - + if (G.debug & G_DEBUG) printf("\tconverting texture %s\n", id->name + 2); - + /* we're only interested in the IPO */ if (te->ipo) { /* Add AnimData block */ AnimData *adt = BKE_animdata_add_id(id); - + /* Convert Texture data... */ ipo_to_animdata(bmain, id, te->ipo, NULL, NULL, NULL); - + if (adt->action) adt->action->idroot = te->ipo->blocktype; - + id_us_min(&te->ipo->id); te->ipo = NULL; } } - + /* cameras */ for (id = bmain->camera.first; id; id = id->next) { Camera *ca = (Camera *)id; - + if (G.debug & G_DEBUG) printf("\tconverting camera %s\n", id->name + 2); - + /* we're only interested in the IPO */ if (ca->ipo) { /* Add AnimData block */ AnimData *adt = BKE_animdata_add_id(id); - + /* Convert Camera data... */ ipo_to_animdata(bmain, id, ca->ipo, NULL, NULL, NULL); - + if (adt->action) adt->action->idroot = ca->ipo->blocktype; - + id_us_min(&ca->ipo->id); ca->ipo = NULL; } } - + /* lamps */ for (id = bmain->lamp.first; id; id = id->next) { Lamp *la = (Lamp *)id; - + if (G.debug & G_DEBUG) printf("\tconverting lamp %s\n", id->name + 2); - + /* we're only interested in the IPO */ if (la->ipo) { /* Add AnimData block */ AnimData *adt = BKE_animdata_add_id(id); - + /* Convert Lamp data... */ ipo_to_animdata(bmain, id, la->ipo, NULL, NULL, NULL); - + if (adt->action) adt->action->idroot = la->ipo->blocktype; - + id_us_min(&la->ipo->id); la->ipo = NULL; } } - + /* curves */ for (id = bmain->curve.first; id; id = id->next) { Curve *cu = (Curve *)id; - + if (G.debug & G_DEBUG) printf("\tconverting curve %s\n", id->name + 2); - + /* we're only interested in the IPO */ if (cu->ipo) { /* Add AnimData block */ AnimData *adt = BKE_animdata_add_id(id); - + /* Convert Curve data... */ ipo_to_animdata(bmain, id, cu->ipo, NULL, NULL, NULL); - + if (adt->action) adt->action->idroot = cu->ipo->blocktype; - + id_us_min(&cu->ipo->id); cu->ipo = NULL; } } - + /* --------- Unconverted Animation Data ------------------ */ - /* For Animation data which may not be directly connected (i.e. not linked) to any other + /* For Animation data which may not be directly connected (i.e. not linked) to any other * data, we need to perform a separate pass to make sure that they are converted to standalone * Actions which may then be able to be reused. This does mean that we will be going over data that's * already been converted, but there are no problems with that. * - * The most common case for this will be Action Constraints, or IPO's with Fake-Users. - * We collect all drivers that were found into a temporary collection, and free them in one go, as they're + * The most common case for this will be Action Constraints, or IPO's with Fake-Users. + * We collect all drivers that were found into a temporary collection, and free them in one go, as they're * impossible to resolve. */ - + /* actions */ for (id = bmain->action.first; id; id = id->next) { bAction *act = (bAction *)id; - + if (G.debug & G_DEBUG) printf("\tconverting action %s\n", id->name + 2); - + /* if old action, it will be object-only... */ if (act->chanbase.first) act->idroot = ID_OB; - + /* be careful! some of the actions we encounter will be converted ones... */ action_to_animato(NULL, act, &act->groups, &act->curves, &drivers); } - + /* ipo's */ for (id = bmain->ipo.first; id; id = id->next) { Ipo *ipo = (Ipo *)id; - + if (G.debug & G_DEBUG) printf("\tconverting ipo %s\n", id->name + 2); - + /* most likely this IPO has already been processed, so check if any curves left to convert */ if (ipo->curve.first) { bAction *new_act; - + /* add a new action for this, and convert all data into that action */ new_act = BKE_action_add(bmain, id->name + 2); ipo_to_animato(NULL, ipo, NULL, NULL, NULL, NULL, &new_act->curves, &drivers); new_act->idroot = ipo->blocktype; } - + /* clear fake-users, and set user-count to zero to make sure it is cleared on file-save */ ipo->id.us = 0; ipo->id.flag &= ~LIB_FAKEUSER; } - + /* free unused drivers from actions + ipos */ free_fcurves(&drivers); - + if (G.debug & G_DEBUG) printf("INFO: Animato convert done\n"); } diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index e63f7d7cefe..4689575655e 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -106,14 +106,14 @@ Key *BKE_key_add(Main *bmain, ID *id) /* common function */ { Key *key; char *el; - + key = BKE_libblock_alloc(bmain, ID_KE, "Key", 0); - + key->type = KEY_NORMAL; key->from = id; key->uidgen = 1; - + /* XXX the code here uses some defines which will soon be deprecated... */ switch (GS(id->name)) { case ID_ME: @@ -150,7 +150,7 @@ Key *BKE_key_add(Main *bmain, ID *id) /* common function */ default: break; } - + return key; } @@ -192,24 +192,24 @@ Key *BKE_key_copy_nolib(Key *key) { Key *keyn; KeyBlock *kbn, *kb; - + keyn = MEM_dupallocN(key); keyn->adt = NULL; BLI_duplicatelist(&keyn->block, &key->block); - + kb = key->block.first; kbn = keyn->block.first; while (kbn) { - + if (kbn->data) kbn->data = MEM_dupallocN(kbn->data); if (kb == key->refkey) keyn->refkey = kbn; - + kbn = kbn->next; kb = kb->next; } - + return keyn; } @@ -223,7 +223,7 @@ void BKE_key_sort(Key *key) KeyBlock *kb; KeyBlock *kb2; - /* locate the key which is out of position */ + /* locate the key which is out of position */ for (kb = key->block.first; kb; kb = kb->next) if ((kb->next) && (kb->pos > kb->next->pos)) break; @@ -232,7 +232,7 @@ void BKE_key_sort(Key *key) if (kb) { kb = kb->next; /* next key is the out-of-order one */ BLI_remlink(&key->block, kb); - + /* find the right location and insert before */ for (kb2 = key->block.first; kb2; kb2 = kb2->next) { if (kb2->pos > kb->pos) { @@ -251,7 +251,7 @@ void BKE_key_sort(Key *key) void key_curve_position_weights(float t, float data[4], int type) { float t2, t3, fc; - + if (type == KEY_LINEAR) { data[0] = 0.0f; data[1] = -t + 1.0f; @@ -293,7 +293,7 @@ void key_curve_position_weights(float t, float data[4], int type) void key_curve_tangent_weights(float t, float data[4], int type) { float t2, fc; - + if (type == KEY_LINEAR) { data[0] = 0.0f; data[1] = -1.0f; @@ -332,7 +332,7 @@ void key_curve_tangent_weights(float t, float data[4], int type) void key_curve_normal_weights(float t, float data[4], int type) { float fc; - + if (type == KEY_LINEAR) { data[0] = 0.0f; data[1] = 0.0f; @@ -415,7 +415,7 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float t[4], int cycl) t[3] = k[3]->pos; k1 = k[3]; } - + while (t[2] < fac) { /* find correct location */ if (k1->next == NULL) { if (cycl) { @@ -441,7 +441,7 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float t[4], int cycl) if (ofs > 2.1f + lastpos) break; } - + bsplinetype = 0; if (k[1]->type == KEY_BSPLINE || k[2]->type == KEY_BSPLINE) bsplinetype = 1; @@ -499,7 +499,7 @@ static void flerp(int tot, float *in, float *f0, float *f1, float *f2, float *f3 static void rel_flerp(int tot, float *in, float *ref, float *out, float fac) { int a; - + for (a = 0; a < tot; a++) { in[a] -= fac * (ref[a] - out[a]); } @@ -588,7 +588,7 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key return; if (end > tot) end = tot; - + if (tot != kb->totelem) { ktot = 0.0; flagflo = 1; @@ -605,9 +605,9 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key /* this exception is needed curves with multiple splines */ if (start != 0) { - + poin += poinsize * start; - + if (flagflo) { ktot += start * kd; a = (int)floor(ktot); @@ -620,13 +620,13 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key k1 += start * key->elemsize; } } - + if (mode == KEY_MODE_BEZTRIPLE) { elemstr[0] = 1; elemstr[1] = IPO_BEZTRIPLE; elemstr[2] = 0; } - + /* just do it here, not above! */ elemsize = key->elemsize; if (mode == KEY_MODE_BEZTRIPLE) elemsize *= 3; @@ -668,7 +668,7 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key poin += *ofsp; cp += 2; ofsp++; } - + /* are we going to be nasty? */ if (flagflo) { ktot += kd; @@ -682,7 +682,7 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key k1 += elemsize; kref += elemsize; } - + if (mode == KEY_MODE_BEZTRIPLE) { a += 2; } @@ -748,13 +748,13 @@ void BKE_key_evaluate_relative(const int start, int end, const int tot, char *ba /* step 1 init */ cp_key(start, end, tot, basispoin, key, actkb, key->refkey, NULL, mode); - + /* step 2: do it */ - + for (kb = key->block.first, keyblock_index = 0; kb; kb = kb->next, keyblock_index++) { if (kb != key->refkey) { float icuval = kb->curval; - + /* only with value, and no difference allowed */ if (!(kb->flag & KEYBLOCK_MUTE) && icuval != 0.0f && kb->totelem == tot) { KeyBlock *refb; @@ -764,7 +764,7 @@ void BKE_key_evaluate_relative(const int start, int end, const int tot, char *ba /* reference now can be any block */ refb = BLI_findlink(&key->block, kb->relative); if (refb == NULL) continue; - + poin = basispoin; from = key_block_get_data(key, actkb, kb, &freefrom); reffrom = key_block_get_data(key, actkb, refb, &freereffrom); @@ -772,18 +772,18 @@ void BKE_key_evaluate_relative(const int start, int end, const int tot, char *ba poin += start * poinsize; reffrom += key->elemsize * start; // key elemsize yes! from += key->elemsize * start; - + for (b = start; b < end; b++) { - + weight = weights ? (*weights * icuval) : icuval; - + cp = key->elemstr; if (mode == KEY_MODE_BEZTRIPLE) cp = elemstr; - + ofsp = ofs; - + while (cp[0]) { /* (cp[0] == amount) */ - + switch (cp[1]) { case IPO_FLOAT: rel_flerp(3, (float *)poin, (float *)reffrom, (float *)from, weight); @@ -803,14 +803,14 @@ void BKE_key_evaluate_relative(const int start, int end, const int tot, char *ba } poin += *ofsp; - + cp += 2; ofsp++; } - + reffrom += elemsize; from += elemsize; - + if (mode == KEY_MODE_BEZTRIPLE) b += 2; if (weights) weights++; } @@ -837,7 +837,7 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key if (!key_pointer_size(key, mode, &poinsize, &ofs[0])) return; - + if (end > tot) end = tot; k1 = key_block_get_data(key, actkb, k[0], &freek1); @@ -891,7 +891,7 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key if (start != 0) { poin += poinsize * start; - + if (flagdo & 1) { if (flagflo & 1) { k1tot += start * k1d; @@ -957,10 +957,10 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key if (mode == KEY_MODE_BEZTRIPLE) elemsize *= 3; for (a = start; a < end; a++) { - + cp = key->elemstr; if (mode == KEY_MODE_BEZTRIPLE) cp = elemstr; - + ofsp = ofs; while (cp[0]) { /* (cp[0] == amount) */ @@ -984,7 +984,7 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key BLI_assert(!"invalid 'cp[1]'"); return; } - + poin += *ofsp; cp += 2; ofsp++; @@ -1038,7 +1038,7 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key k4 += elemsize; } } - + if (mode == KEY_MODE_BEZTRIPLE) a += 2; } @@ -1055,10 +1055,10 @@ static float *get_weights_array(Object *ob, char *vgroup, WeightsArrayCache *cac BMIter iter; BMVert *eve; int totvert = 0, defgrp_index = 0; - + /* no vgroup string set? */ if (vgroup[0] == 0) return NULL; - + /* gather dvert and totvert */ if (ob->type == OB_MESH) { Mesh *me = ob->data; @@ -1073,9 +1073,9 @@ static float *get_weights_array(Object *ob, char *vgroup, WeightsArrayCache *cac dvert = lt->dvert; totvert = lt->pntsu * lt->pntsv * lt->pntsw; } - + if (dvert == NULL) return NULL; - + /* find the group (weak loop-in-loop) */ defgrp_index = defgroup_name_index(ob, vgroup); if (defgrp_index != -1) { @@ -1197,7 +1197,7 @@ static void do_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock **k, float { Nurb *nu; int a, step; - + for (a = 0, nu = cu->nurb.first; nu; nu = nu->next, a += step) { if (nu->bp) { step = nu->pntsu * nu->pntsv; @@ -1217,7 +1217,7 @@ static void do_rel_cu_key(Curve *cu, Key *key, KeyBlock *actkb, char *out, const { Nurb *nu; int a, step; - + for (a = 0, nu = cu->nurb.first; nu; nu = nu->next, a += step) { if (nu->bp) { step = nu->pntsu * nu->pntsv; @@ -1263,7 +1263,7 @@ static void do_latt_key(Object *ob, Key *key, char *out, const int tot) KeyBlock *k[4], *actkb = BKE_keyblock_from_object(ob); float t[4]; int flag; - + if (key->type == KEY_RELATIVE) { float **per_keyblock_weights; per_keyblock_weights = BKE_keyblock_get_per_block_weights(ob, key, NULL); @@ -1272,7 +1272,7 @@ static void do_latt_key(Object *ob, Key *key, char *out, const int tot) } else { const float ctime_scaled = key->ctime / 100.0f; - + flag = setkeys(ctime_scaled, &key->block, k, t, 0); if (flag == 0) { @@ -1331,7 +1331,7 @@ float *BKE_key_evaluate_object_ex( /* if nothing to interpolate, cancel */ if (tot == 0 || size == 0) return NULL; - + /* allocate array */ if (arr == NULL) { out = MEM_callocN(size, "BKE_key_evaluate_object out"); @@ -1346,11 +1346,11 @@ float *BKE_key_evaluate_object_ex( /* prevent python from screwing this up? anyhoo, the from pointer could be dropped */ key->from = (ID *)ob->data; - + if (ob->shapeflag & OB_SHAPE_LOCK) { /* shape locked, copy the locked shape instead of blending */ KeyBlock *kb = BLI_findlink(&key->block, ob->shapenr - 1); - + if (kb && (kb->flag & KEYBLOCK_MUTE)) kb = key->refkey; @@ -1358,7 +1358,7 @@ float *BKE_key_evaluate_object_ex( kb = key->block.first; ob->shapenr = 1; } - + if (OB_TYPE_SUPPORT_VGROUP(ob->type)) { float *weights = get_weights_array(ob, kb->vgroup, NULL); @@ -1370,13 +1370,13 @@ float *BKE_key_evaluate_object_ex( cp_cu_key(ob->data, key, actkb, kb, 0, tot, out, tot); } else { - + if (ob->type == OB_MESH) do_mesh_key(ob, key, out, tot); else if (ob->type == OB_LATTICE) do_latt_key(ob, key, out, tot); else if (ob->type == OB_CURVE) do_curve_key(ob, key, out, tot); else if (ob->type == OB_SURF) do_curve_key(ob, key, out, tot); } - + if (r_totelem) { *r_totelem = tot; } @@ -1451,14 +1451,14 @@ KeyBlock *BKE_keyblock_add(Key *key, const char *name) KeyBlock *kb; float curpos = -0.1; int tot; - + kb = key->block.last; if (kb) curpos = kb->pos; - + kb = MEM_callocN(sizeof(KeyBlock), "Keyblock"); BLI_addtail(&key->block, kb); kb->type = KEY_CARDINAL; - + tot = BLI_listbase_count(&key->block); if (name) { BLI_strncpy(kb->name, name, sizeof(kb->name)); @@ -1476,7 +1476,7 @@ KeyBlock *BKE_keyblock_add(Key *key, const char *name) key->totkey++; if (key->totkey == 1) key->refkey = kb; - + kb->slidermin = 0.0f; kb->slidermax = 1.0f; @@ -1523,10 +1523,10 @@ KeyBlock *BKE_keyblock_add_ctime(Key *key, const char *name, const bool do_force } /* only the active keyblock */ -KeyBlock *BKE_keyblock_from_object(Object *ob) +KeyBlock *BKE_keyblock_from_object(Object *ob) { Key *key = BKE_key_from_object(ob); - + if (key) { KeyBlock *kb = BLI_findlink(&key->block, ob->shapenr - 1); return kb; @@ -1538,7 +1538,7 @@ KeyBlock *BKE_keyblock_from_object(Object *ob) KeyBlock *BKE_keyblock_from_object_reference(Object *ob) { Key *key = BKE_key_from_object(ob); - + if (key) return key->refkey; @@ -1550,18 +1550,18 @@ KeyBlock *BKE_keyblock_from_key(Key *key, int index) { KeyBlock *kb; int i; - + if (key) { kb = key->block.first; - + for (i = 1; i < key->totkey; i++) { kb = kb->next; - + if (index == i) return kb; } } - + return NULL; } @@ -1585,23 +1585,23 @@ void BKE_keyblock_copy_settings(KeyBlock *kb_dst, const KeyBlock *kb_src) kb_dst->slidermax = kb_src->slidermax; } -/* Get RNA-Path for 'value' setting of the given ShapeKey +/* Get RNA-Path for 'value' setting of the given ShapeKey * NOTE: the user needs to free the returned string once they're finish with it */ char *BKE_keyblock_curval_rnapath_get(Key *key, KeyBlock *kb) { PointerRNA ptr; PropertyRNA *prop; - + /* sanity checks */ if (ELEM(NULL, key, kb)) return NULL; - + /* create the RNA pointer */ RNA_pointer_create(&key->id, &RNA_ShapeKey, kb, &ptr); /* get pointer to the property too */ prop = RNA_struct_find_property(&ptr, "value"); - + /* return the path */ return RNA_path_from_ID_to_property(&ptr, prop); } @@ -1689,7 +1689,7 @@ void BKE_keyblock_update_from_curve(Curve *UNUSED(cu), KeyBlock *kb, ListBase *n } } else { - + ; for (a = nu->pntsu * nu->pntsv, bp = nu->bp; a; a--, fp += 4, bp++) { copy_v3_v3(fp, bp->vec); diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c index 158d2954100..0e81e6570e2 100644 --- a/source/blender/blenkernel/intern/lamp.c +++ b/source/blender/blenkernel/intern/lamp.c @@ -89,7 +89,7 @@ void BKE_lamp_init(Lamp *la) la->contact_spread = 0.2f; la->contact_thickness = 0.5f; la->spec_fac = 1.0f; - + curvemapping_initialize(la->curfalloff); } @@ -152,7 +152,7 @@ Lamp *BKE_lamp_localize(Lamp *la) if (la->nodetree) lan->nodetree = ntreeLocalize(la->nodetree); - + lan->preview = NULL; return lan; @@ -175,7 +175,7 @@ void BKE_lamp_free(Lamp *la) MEM_freeN(la->nodetree); la->nodetree = NULL; } - + BKE_previewimg_free(&la->preview); BKE_icon_id_delete(&la->id); la->id.icon_id = 0; diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index b5b62de57ec..a885495f2bf 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -152,13 +152,13 @@ void BKE_lattice_resize(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb) int i, u, v, w; float fu, fv, fw, uc, vc, wc, du = 0.0, dv = 0.0, dw = 0.0; float *co, (*vertexCos)[3] = NULL; - + /* vertex weight groups are just freed all for now */ if (lt->dvert) { BKE_defvert_array_free(lt->dvert, lt->pntsu * lt->pntsv * lt->pntsw); lt->dvert = NULL; } - + while (uNew * vNew * wNew > 32000) { if (uNew >= vNew && uNew >= wNew) uNew--; else if (vNew >= uNew && vNew >= wNew) vNew--; @@ -203,7 +203,7 @@ void BKE_lattice_resize(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb) } } } - + if (ltOb) { float mat[4][4]; int typeu = lt->typeu, typev = lt->typev, typew = lt->typew; @@ -240,9 +240,9 @@ void BKE_lattice_resize(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb) lt->actbp = LT_ACTBP_NONE; MEM_freeN(lt->def); lt->def = MEM_callocN(lt->pntsu * lt->pntsv * lt->pntsw * sizeof(BPoint), "lattice bp"); - + bp = lt->def; - + for (i = 0; i < lt->pntsu * lt->pntsv * lt->pntsw; i++, bp++) { copy_v3_v3(bp->vec, vertexCos[i]); } @@ -255,9 +255,9 @@ void BKE_lattice_init(Lattice *lt) BLI_assert(MEMCMP_STRUCT_OFS_IS_ZERO(lt, id)); lt->flag = LT_GRID; - + lt->typeu = lt->typev = lt->typew = KEY_BSPLINE; - + lt->def = MEM_callocN(sizeof(BPoint), "lattvert"); /* temporary */ BKE_lattice_resize(lt, 2, 2, 2, NULL); /* creates a uniform lattice */ lt->actbp = LT_ACTBP_NONE; @@ -360,14 +360,14 @@ LatticeDeformData *init_latt_deform(Object *oblatt, Object *ob) if (lt->editlatt) lt = lt->editlatt->latt; bp = lt->def; - + fp = latticedata = MEM_mallocN(sizeof(float) * 3 * lt->pntsu * lt->pntsv * lt->pntsw, "latticedata"); - + /* for example with a particle system: (ob == NULL) */ if (ob == NULL) { /* in deformspace, calc matrix */ invert_m4_m4(latmat, oblatt->obmat); - + /* back: put in deform array */ invert_m4_m4(imat, latmat); } @@ -375,11 +375,11 @@ LatticeDeformData *init_latt_deform(Object *oblatt, Object *ob) /* in deformspace, calc matrix */ invert_m4_m4(imat, oblatt->obmat); mul_m4_m4m4(latmat, imat, ob->obmat); - + /* back: put in deform array */ invert_m4_m4(imat, latmat); } - + for (w = 0, fw = lt->fw; w < lt->pntsw; w++, fw += lt->dw) { for (v = 0, fv = lt->fv; v < lt->pntsv; v++, fv += lt->dv) { for (u = 0, fu = lt->fu; u < lt->pntsu; u++, bp++, co += 3, fp += 3, fu += lt->du) { @@ -556,7 +556,7 @@ static bool where_on_path_deform(Object *ob, float ctime, float vec[4], float di BevList *bl; float ctime1; int cycl = 0; - + /* test for cyclic */ bl = ob->curve_cache->bev.first; if (!bl->nr) return false; @@ -568,14 +568,14 @@ static bool where_on_path_deform(Object *ob, float ctime, float vec[4], float di else { ctime1 = ctime; } - + /* vec needs 4 items */ if (where_on_path(ob, ctime1, vec, dir, quat, radius, NULL)) { - + if (cycl == 0) { Path *path = ob->curve_cache->path; float dvec[3]; - + if (ctime < 0.0f) { sub_v3_v3v3(dvec, path->data[1].vec, path->data[0].vec); mul_v3_fl(dvec, ctime * (float)path->len); @@ -641,7 +641,7 @@ static bool calc_curve_deform(Object *par, float co[3], } } } - + if (where_on_path_deform(par, fac, loc, dir, new_quat, &radius)) { /* returns OK */ float quat[4], cent[3]; @@ -687,7 +687,7 @@ static bool calc_curve_deform(Object *par, float co[3], /* scale if enabled */ if (cu->flag & CU_PATH_RADIUS) mul_v3_fl(cent, radius); - + /* local rotation */ normalize_qt(quat); mul_qt_v3(quat, cent); @@ -731,7 +731,7 @@ void curve_deform_verts( cd.dmin[0] = cd.dmin[1] = cd.dmin[2] = -1.0f; cd.dmax[0] = cd.dmax[1] = cd.dmax[2] = 0.0f; } - + /* Check whether to use vertex groups (only possible if target is a Mesh or Lattice). * We want either a Mesh/Lattice with no derived data, or derived data with deformverts. */ @@ -804,12 +804,12 @@ void curve_deform_verts( else { /* set mesh min max bounds */ INIT_MINMAX(cd.dmin, cd.dmax); - + for (a = 0; a < numVerts; a++) { mul_m4_v3(cd.curvespace, vertexCos[a]); minmax_v3v3_v3(cd.dmin, cd.dmax, vertexCos[a]); } - + for (a = 0; a < numVerts; a++) { /* already in 'cd.curvespace', prev for loop */ calc_curve_deform(cuOb, vertexCos[a], defaxis, &cd, NULL); @@ -827,7 +827,7 @@ void curve_deform_vector(Object *cuOb, Object *target, { CurveDeform cd; float quat[4]; - + if (cuOb->type != OB_CURVE) { unit_m3(mat); return; @@ -835,21 +835,21 @@ void curve_deform_vector(Object *cuOb, Object *target, init_curve_deform(cuOb, target, &cd); cd.no_rot_axis = no_rot_axis; /* option to only rotate for XY, for example */ - + copy_v3_v3(cd.dmin, orco); copy_v3_v3(cd.dmax, orco); mul_m4_v3(cd.curvespace, vec); - + if (calc_curve_deform(cuOb, vec, target->trackflag, &cd, quat)) { float qmat[3][3]; - + quat_to_mat3(qmat, quat); mul_m3_m3m3(mat, qmat, cd.objectspace3); } else unit_m3(mat); - + mul_m4_v3(cd.objectspace, vec); } @@ -937,11 +937,11 @@ void outside_lattice(Lattice *lt) if (lt->pntsu > 1) du = 1.0f / ((float)lt->pntsu - 1); if (lt->pntsv > 1) dv = 1.0f / ((float)lt->pntsv - 1); if (lt->pntsw > 1) dw = 1.0f / ((float)lt->pntsw - 1); - + for (w = 0; w < lt->pntsw; w++) { - + for (v = 0; v < lt->pntsv; v++) { - + for (u = 0; u < lt->pntsu; u++, bp++) { if (u == 0 || v == 0 || w == 0 || u == lt->pntsu - 1 || v == lt->pntsv - 1 || w == lt->pntsw - 1) { /* pass */ @@ -949,41 +949,41 @@ void outside_lattice(Lattice *lt) else { bp->hide = 1; bp->f1 &= ~SELECT; - + /* u extrema */ bp1 = latt_bp(lt, 0, v, w); bp2 = latt_bp(lt, lt->pntsu - 1, v, w); - + fac1 = du * u; bp->vec[0] = (1.0f - fac1) * bp1->vec[0] + fac1 * bp2->vec[0]; bp->vec[1] = (1.0f - fac1) * bp1->vec[1] + fac1 * bp2->vec[1]; bp->vec[2] = (1.0f - fac1) * bp1->vec[2] + fac1 * bp2->vec[2]; - + /* v extrema */ bp1 = latt_bp(lt, u, 0, w); bp2 = latt_bp(lt, u, lt->pntsv - 1, w); - + fac1 = dv * v; bp->vec[0] += (1.0f - fac1) * bp1->vec[0] + fac1 * bp2->vec[0]; bp->vec[1] += (1.0f - fac1) * bp1->vec[1] + fac1 * bp2->vec[1]; bp->vec[2] += (1.0f - fac1) * bp1->vec[2] + fac1 * bp2->vec[2]; - + /* w extrema */ bp1 = latt_bp(lt, u, v, 0); bp2 = latt_bp(lt, u, v, lt->pntsw - 1); - + fac1 = dw * w; bp->vec[0] += (1.0f - fac1) * bp1->vec[0] + fac1 * bp2->vec[0]; bp->vec[1] += (1.0f - fac1) * bp1->vec[1] + fac1 * bp2->vec[1]; bp->vec[2] += (1.0f - fac1) * bp1->vec[2] + fac1 * bp2->vec[2]; - + mul_v3_fl(bp->vec, 1.0f / 3.0f); - + } } - + } - + } } else { @@ -1004,9 +1004,9 @@ float (*BKE_lattice_vertexcos_get(struct Object *ob, int *r_numVerts))[3] if (lt->editlatt) lt = lt->editlatt->latt; numVerts = *r_numVerts = lt->pntsu * lt->pntsv * lt->pntsw; - + vertexCos = MEM_mallocN(sizeof(*vertexCos) * numVerts, "lt_vcos"); - + for (i = 0; i < numVerts; i++) { copy_v3_v3(vertexCos[i], lt->def[i].vec); } @@ -1046,7 +1046,7 @@ void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph, Scene *scene, Objec const ModifierTypeInfo *mti = modifierType_getInfo(md->type); md->scene = scene; - + if (!(mti->flags & eModifierTypeFlag_AcceptsLattice)) continue; if (!(md->mode & eModifierMode_Realtime)) continue; if (editmode && !(md->mode & eModifierMode_Editmode)) continue; @@ -1072,7 +1072,7 @@ void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph, Scene *scene, Objec dl->parts = 1; dl->nr = numVerts; dl->verts = (float *) vertexCos; - + BLI_addtail(&ob->curve_cache->disp, dl); } } @@ -1154,7 +1154,7 @@ void BKE_lattice_minmax_dl(Object *ob, Lattice *lt, float min[3], float max[3]) } else { int i, numVerts; - + if (lt->editlatt) lt = lt->editlatt->latt; numVerts = lt->pntsu * lt->pntsv * lt->pntsw; diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index 2327da82615..c45903aa1fa 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -142,7 +142,7 @@ # include "PIL_time_utildefines.h" #endif -/* GS reads the memory pointed at in a specific ordering. +/* GS reads the memory pointed at in a specific ordering. * only use this definition, makes little and big endian systems * work fine, in conjunction with MAKE_ID */ @@ -768,7 +768,7 @@ bool id_single_user(bContext *C, ID *id, PointerRNA *ptr, PropertyRNA *prop) { ID *newid = NULL; PointerRNA idptr; - + if (id) { /* if property isn't editable, we're going to have an extra block hanging around until we save */ if (RNA_property_editable(ptr, prop)) { @@ -784,12 +784,12 @@ bool id_single_user(bContext *C, ID *id, PointerRNA *ptr, PropertyRNA *prop) RNA_id_pointer_create(newid, &idptr); RNA_property_pointer_set(ptr, prop, idptr); RNA_property_update(C, ptr, prop); - + return true; } } } - + return false; } @@ -1079,9 +1079,9 @@ int set_listbasepointers(Main *main, ListBase **lb) lb[INDEX_ID_TE] = &(main->tex); lb[INDEX_ID_MA] = &(main->mat); lb[INDEX_ID_VF] = &(main->vfont); - + /* Important!: When adding a new object type, - * the specific data should be inserted here + * the specific data should be inserted here */ lb[INDEX_ID_AR] = &(main->armature); @@ -1114,7 +1114,7 @@ int set_listbasepointers(Main *main, ListBase **lb) lb[INDEX_ID_WS] = &(main->workspaces); /* before wm, so it's freed after it! */ lb[INDEX_ID_WM] = &(main->wm); lb[INDEX_ID_MSK] = &(main->mask); - + lb[INDEX_ID_NULL] = NULL; return (MAX_LIBARRAY - 1); @@ -1409,7 +1409,7 @@ void *BKE_id_new_nomain(const short type, const char *name) static void id_copy_animdata(Main *bmain, ID *id, const bool do_action) { AnimData *adt = BKE_animdata_from_id(id); - + if (adt) { IdAdtTemplate *iat = (IdAdtTemplate *)id; iat->adt = BKE_animdata_copy(bmain, iat->adt, do_action, true); /* could be set to false, need to investigate */ @@ -1528,7 +1528,7 @@ void BKE_main_free(Main *mainvar) while (a--) { ListBase *lb = lbarray[a]; ID *id; - + while ( (id = lb->first) ) { #if 1 BKE_libblock_free_ex(mainvar, id, false, false); @@ -1767,11 +1767,11 @@ ID *BKE_libblock_find_name(struct Main *bmain, const short type, const char *nam void id_sort_by_name(ListBase *lb, ID *id) { ID *idtest; - + /* insert alphabetically */ if (lb->first != lb->last) { BLI_remlink(lb, id); - + idtest = lb->first; while (idtest) { if (BLI_strcasecmp(idtest->name, id->name) > 0 || (idtest->lib && !id->lib)) { @@ -1785,7 +1785,7 @@ void id_sort_by_name(ListBase *lb, ID *id) BLI_addtail(lb, id); } } - + } /** @@ -1795,9 +1795,9 @@ void id_sort_by_name(ListBase *lb, ID *id) static ID *is_dupid(ListBase *lb, ID *id, const char *name) { ID *idtest = NULL; - + for (idtest = lb->first; idtest; idtest = idtest->next) { - /* if idtest is not a lib */ + /* if idtest is not a lib */ if (id != idtest && !ID_IS_LINKED(idtest)) { /* do not test alphabetic! */ /* optimized */ @@ -1806,7 +1806,7 @@ static ID *is_dupid(ListBase *lb, ID *id, const char *name) } } } - + return idtest; } @@ -1895,8 +1895,8 @@ static bool check_for_dupid(ListBase *lb, ID *id, char *name) * or 1 greater than the largest used number if all those low ones are taken. * We can't be bothered to look for the lowest unused number beyond (MAX_IN_USE - 1). */ - /* If the original name has no numeric suffix, - * rather than just chopping and adding numbers, + /* If the original name has no numeric suffix, + * rather than just chopping and adding numbers, * shave off the end chars until we have a unique name. * Check the null terminators match as well so we don't get Cube.000 -> Cube.00 */ if (nr == 0 && name[left_len] == '\0') { @@ -1907,7 +1907,7 @@ static bool check_for_dupid(ListBase *lb, ID *id, char *name) len = left_len - 1; idtest = is_dupid(lb, id, name); - + while (idtest && len > 1) { name[len--] = '\0'; idtest = is_dupid(lb, id, name); @@ -1915,7 +1915,7 @@ static bool check_for_dupid(ListBase *lb, ID *id, char *name) if (idtest == NULL) return true; /* otherwise just continue and use a number suffix */ } - + if (nr > 999 && left_len > (MAX_ID_NAME - 8)) { /* this would overflow name buffer */ left[MAX_ID_NAME - 8] = 0; @@ -1978,7 +1978,7 @@ bool new_id(ListBase *lb, ID *id, const char *tname) #endif id_sort_by_name(lb, id); - + return result; } @@ -2493,7 +2493,7 @@ void BLI_libblock_ensure_unique_name(Main *bmain, const char *name) lb = which_libbase(bmain, GS(name)); if (lb == NULL) return; - + /* search for id */ idtest = BLI_findstring(lb, name + 2, offsetof(ID, name) + 2); diff --git a/source/blender/blenkernel/intern/library_remap.c b/source/blender/blenkernel/intern/library_remap.c index e3c10175feb..c01e0fef571 100644 --- a/source/blender/blenkernel/intern/library_remap.c +++ b/source/blender/blenkernel/intern/library_remap.c @@ -1015,7 +1015,7 @@ void BKE_libblock_free(Main *bmain, void *idv) void BKE_libblock_free_us(Main *bmain, void *idv) /* test users */ { ID *id = idv; - + id_us_min(id); /* XXX This is a temp (2.77) hack so that we keep same behavior as in 2.76 regarding collections when deleting an object. @@ -1031,7 +1031,7 @@ void BKE_libblock_free_us(Main *bmain, void *idv) /* test users */ if (id->us == 0) { BKE_libblock_unlink(bmain, id, false, false); - + BKE_libblock_free(bmain, id); } } diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 1ea2f170922..21b2ab6b454 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -49,8 +49,8 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" -#include "BLI_math.h" -#include "BLI_listbase.h" +#include "BLI_math.h" +#include "BLI_listbase.h" #include "BLI_utildefines.h" #include "BLI_string.h" #include "BLI_array_utils.h" @@ -90,10 +90,10 @@ void init_def_material(void) void BKE_material_free(Material *ma) { BKE_animdata_free((ID *)ma, false); - + /* Free gpu material before the ntree */ GPU_material_free(&ma->gpumaterial); - + /* is no lib link block, but material extension */ if (ma->nodetree) { ntreeFreeTree(ma->nodetree); @@ -117,7 +117,7 @@ void BKE_material_init(Material *ma) ma->spec = 0.5; ma->roughness = 0.25f; - + ma->pr_lamp = 3; /* two lamps, is bits */ ma->pr_type = MA_SPHERE; @@ -131,9 +131,9 @@ Material *BKE_material_add(Main *bmain, const char *name) Material *ma; ma = BKE_libblock_alloc(bmain, ID_MA, name, 0); - + BKE_material_init(ma); - + return ma; } @@ -218,7 +218,7 @@ Material ***give_matarar(Object *ob) Mesh *me; Curve *cu; MetaBall *mb; - + if (ob->type == OB_MESH) { me = ob->data; return &(me->mat); @@ -239,7 +239,7 @@ short *give_totcolp(Object *ob) Mesh *me; Curve *cu; MetaBall *mb; - + if (ob->type == OB_MESH) { me = ob->data; return &(me->totcol); @@ -413,7 +413,7 @@ Material *BKE_material_pop_id(Main *bmain, ID *id, int index_i, bool update_data DEG_relations_tag_update(bmain); } } - + return ret; } @@ -447,7 +447,7 @@ Material *give_current_material(Object *ob, short act) const short *totcolp; if (ob == NULL) return NULL; - + /* if object cannot have material, (totcolp == NULL) */ totcolp = give_totcolp(ob); if (totcolp == NULL || ob->totcol == 0) return NULL; @@ -473,12 +473,12 @@ Material *give_current_material(Object *ob, short act) if (act > ob->totcol) act = ob->totcol; matarar = give_matarar(ob); - + if (matarar && *matarar) ma = (*matarar)[act - 1]; else ma = NULL; - + } - + return ma; } @@ -621,18 +621,18 @@ void assign_material(Main *bmain, Object *ob, Material *ma, short act, int assig if (act > MAXMAT) return; if (act < 1) act = 1; - + /* prevent crashing when using accidentally */ BLI_assert(!ID_IS_LINKED(ob)); if (ID_IS_LINKED(ob)) return; - + /* test arraylens */ - + totcolp = give_totcolp(ob); matarar = give_matarar(ob); - + if (totcolp == NULL || matarar == NULL) return; - + if (act > *totcolp) { matar = MEM_callocN(sizeof(void *) * act, "matarray1"); @@ -676,7 +676,7 @@ void assign_material(Main *bmain, Object *ob, Material *ma, short act, int assig break; } } - + /* do it */ ob->matbits[act - 1] = bit; @@ -811,14 +811,14 @@ short BKE_object_material_slot_find_index(Object *ob, Material *ma) { Material ***matarar; short a, *totcolp; - + if (ma == NULL) return 0; - + totcolp = give_totcolp(ob); matarar = give_matarar(ob); - + if (totcolp == NULL || matarar == NULL) return 0; - + for (a = 0; a < *totcolp; a++) if ((*matarar)[a] == ma) break; @@ -831,7 +831,7 @@ bool BKE_object_material_slot_add(Main *bmain, Object *ob) { if (ob == NULL) return false; if (ob->totcol >= MAXMAT) return false; - + assign_material(bmain, ob, NULL, ob->totcol + 1, BKE_MAT_ASSIGN_USERPREF); ob->actcol = ob->totcol; return true; @@ -844,7 +844,7 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob) Material *mao, ***matarar; short *totcolp; short a, actcol; - + if (ob == NULL || ob->totcol == 0) { return false; } @@ -858,10 +858,10 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob) /* take a mesh/curve/mball as starting point, remove 1 index, * AND with all objects that share the ob->data - * + * * after that check indices in mesh/curve/mball!!! */ - + totcolp = give_totcolp(ob); matarar = give_matarar(ob); @@ -873,21 +873,21 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob) if (ob->actcol > ob->totcol) { ob->actcol = ob->totcol; } - + /* we delete the actcol */ mao = (*matarar)[ob->actcol - 1]; if (mao) id_us_min(&mao->id); - + for (a = ob->actcol; a < ob->totcol; a++) (*matarar)[a - 1] = (*matarar)[a]; (*totcolp)--; - + if (*totcolp == 0) { MEM_freeN(*matarar); *matarar = NULL; } - + actcol = ob->actcol; for (Object *obt = bmain->object.first; obt; obt = obt->id.next) { @@ -900,14 +900,14 @@ bool BKE_object_material_slot_remove(Main *bmain, Object *ob) mao = obt->mat[actcol - 1]; if (mao) id_us_min(&mao->id); - + for (a = actcol; a < obt->totcol; a++) { obt->mat[a - 1] = obt->mat[a]; obt->matbits[a - 1] = obt->matbits[a]; } obt->totcol--; if (obt->actcol > obt->totcol) obt->actcol = obt->totcol; - + if (obt->totcol == 0) { MEM_freeN(obt->mat); MEM_freeN(obt->matbits); @@ -932,7 +932,7 @@ static bNode *nodetree_uv_node_recursive(bNode *node) { bNode *inode; bNodeSocket *sock; - + for (sock = node->inputs.first; sock; sock = sock->next) { if (sock->link) { inode = sock->link->fromnode; @@ -944,7 +944,7 @@ static bNode *nodetree_uv_node_recursive(bNode *node) } } } - + return NULL; } @@ -967,7 +967,7 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma) ma->paint_clone_slot = 0; return; } - + bNode *node, *active_node; if (!(ma->nodetree)) { @@ -995,10 +995,10 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma) if (active_node == node) ma->paint_active_slot = index; ma->texpaintslot[index].ima = (Image *)node->id; - + /* for new renderer, we need to traverse the treeback in search of a UV node */ bNode *uvnode = nodetree_uv_node_recursive(node); - + if (uvnode) { NodeShaderUVMap *storage = (NodeShaderUVMap *)uvnode->storage; ma->texpaintslot[index].uvname = storage->uv_map; @@ -1014,8 +1014,8 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, Material *ma) } ma->tot_slots = count; - - + + if (ma->paint_active_slot >= count) { ma->paint_active_slot = count - 1; } @@ -1042,7 +1042,7 @@ void BKE_texpaint_slots_refresh_object(Scene *scene, struct Object *ob) void ramp_blend(int type, float r_col[3], const float fac, const float col[3]) { float tmp, facm = 1.0f - fac; - + switch (type) { case MA_RAMP_BLEND: r_col[0] = facm * (r_col[0]) + fac * col[0]; diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 3afaf2d569e..2ff69c5ee6d 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -89,7 +89,7 @@ void BKE_mball_init(MetaBall *mb) mb->size[0] = mb->size[1] = mb->size[2] = 1.0; mb->texflag = MB_AUTOSPACE; - + mb->wiresize = 0.4f; mb->rendersize = 0.2f; mb->thresh = 0.6f; @@ -201,7 +201,7 @@ void BKE_mball_texspace_calc(Object *ob) if (ob->bb == NULL) ob->bb = MEM_callocN(sizeof(BoundBox), "mb boundbox"); bb = ob->bb; - + /* Weird one, this. */ /* INIT_MINMAX(min, max); */ (min)[0] = (min)[1] = (min)[2] = 1.0e30f; diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index e83f2d92dd9..f502d7e394f 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -107,7 +107,7 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2 const float thresh_sq = thresh * thresh; CustomDataLayer *l1, *l2; int i, i1 = 0, i2 = 0, tot, j; - + for (i = 0; i < c1->totlayer; i++) { if (ELEM(c1->layers[i].type, CD_MVERT, CD_MEDGE, CD_MPOLY, CD_MLOOPUV, CD_MLOOPCOL, CD_MDEFORMVERT)) @@ -126,7 +126,7 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2 if (i1 != i2) return MESHCMP_CDLAYERS_MISMATCH; - + l1 = c1->layers; l2 = c2->layers; tot = i1; i1 = 0; i2 = 0; @@ -144,52 +144,52 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2 i2++; l2++; } - + if (l1->type == CD_MVERT) { MVert *v1 = l1->data; MVert *v2 = l2->data; int vtot = m1->totvert; - + for (j = 0; j < vtot; j++, v1++, v2++) { if (len_squared_v3v3(v1->co, v2->co) > thresh_sq) return MESHCMP_VERTCOMISMATCH; /* I don't care about normals, let's just do coodinates */ } } - + /*we're order-agnostic for edges here*/ if (l1->type == CD_MEDGE) { MEdge *e1 = l1->data; MEdge *e2 = l2->data; int etot = m1->totedge; EdgeHash *eh = BLI_edgehash_new_ex(__func__, etot); - + for (j = 0; j < etot; j++, e1++) { BLI_edgehash_insert(eh, e1->v1, e1->v2, e1); } - + for (j = 0; j < etot; j++, e2++) { if (!BLI_edgehash_lookup(eh, e2->v1, e2->v2)) return MESHCMP_EDGEUNKNOWN; } BLI_edgehash_free(eh, NULL); } - + if (l1->type == CD_MPOLY) { MPoly *p1 = l1->data; MPoly *p2 = l2->data; int ptot = m1->totpoly; - + for (j = 0; j < ptot; j++, p1++, p2++) { MLoop *lp1, *lp2; int k; - + if (p1->totloop != p2->totloop) return MESHCMP_POLYMISMATCH; - + lp1 = m1->mloop + p1->loopstart; lp2 = m2->mloop + p2->loopstart; - + for (k = 0; k < p1->totloop; k++, lp1++, lp2++) { if (lp1->v != lp2->v) return MESHCMP_POLYVERTMISMATCH; @@ -200,7 +200,7 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2 MLoop *lp1 = l1->data; MLoop *lp2 = l2->data; int ltot = m1->totloop; - + for (j = 0; j < ltot; j++, lp1++, lp2++) { if (lp1->v != lp2->v) return MESHCMP_LOOPMISMATCH; @@ -210,22 +210,22 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2 MLoopUV *lp1 = l1->data; MLoopUV *lp2 = l2->data; int ltot = m1->totloop; - + for (j = 0; j < ltot; j++, lp1++, lp2++) { if (len_squared_v2v2(lp1->uv, lp2->uv) > thresh_sq) return MESHCMP_LOOPUVMISMATCH; } } - + if (l1->type == CD_MLOOPCOL) { MLoopCol *lp1 = l1->data; MLoopCol *lp2 = l2->data; int ltot = m1->totloop; - + for (j = 0; j < ltot; j++, lp1++, lp2++) { - if (ABS(lp1->r - lp2->r) > thresh || - ABS(lp1->g - lp2->g) > thresh || - ABS(lp1->b - lp2->b) > thresh || + if (ABS(lp1->r - lp2->r) > thresh || + ABS(lp1->g - lp2->g) > thresh || + ABS(lp1->b - lp2->b) > thresh || ABS(lp1->a - lp2->a) > thresh) { return MESHCMP_LOOPCOLMISMATCH; @@ -237,14 +237,14 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2 MDeformVert *dv1 = l1->data; MDeformVert *dv2 = l2->data; int dvtot = m1->totvert; - + for (j = 0; j < dvtot; j++, dv1++, dv2++) { int k; MDeformWeight *dw1 = dv1->dw, *dw2 = dv2->dw; - + if (dv1->totweight != dv2->totweight) return MESHCMP_DVERT_TOTGROUPMISMATCH; - + for (k = 0; k < dv1->totweight; k++, dw1++, dw2++) { if (dw1->def_nr != dw2->def_nr) return MESHCMP_DVERT_GROUPMISMATCH; @@ -254,7 +254,7 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2 } } } - + return 0; } @@ -267,22 +267,22 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2 const char *BKE_mesh_cmp(Mesh *me1, Mesh *me2, float thresh) { int c; - + if (!me1 || !me2) return "Requires two input meshes"; - - if (me1->totvert != me2->totvert) + + if (me1->totvert != me2->totvert) return "Number of verts don't match"; - + if (me1->totedge != me2->totedge) return "Number of edges don't match"; - + if (me1->totpoly != me2->totpoly) return "Number of faces don't match"; - + if (me1->totloop != me2->totloop) return "Number of loops don't match"; - + if ((c = customdata_compare(&me1->vdata, &me2->vdata, me1, me2, thresh))) return cmpcode_to_str(c); @@ -294,7 +294,7 @@ const char *BKE_mesh_cmp(Mesh *me1, Mesh *me2, float thresh) if ((c = customdata_compare(&me1->pdata, &me2->pdata, me1, me2, thresh))) return cmpcode_to_str(c); - + return NULL; } @@ -440,7 +440,7 @@ void BKE_mesh_update_customdata_pointers(Mesh *me, const bool do_ensure_tess_cd) me->mface = CustomData_get_layer(&me->fdata, CD_MFACE); me->mcol = CustomData_get_layer(&me->fdata, CD_MCOL); me->mtface = CustomData_get_layer(&me->fdata, CD_MTFACE); - + me->mpoly = CustomData_get_layer(&me->pdata, CD_MPOLY); me->mloop = CustomData_get_layer(&me->ldata, CD_MLOOP); @@ -824,13 +824,13 @@ void BKE_mesh_boundbox_calc(Mesh *me, float r_loc[3], float r_size[3]) BoundBox *bb; float min[3], max[3]; float mloc[3], msize[3]; - + if (me->bb == NULL) me->bb = MEM_callocN(sizeof(BoundBox), "boundbox"); bb = me->bb; if (!r_loc) r_loc = mloc; if (!r_size) r_size = msize; - + INIT_MINMAX(min, max); if (!BKE_mesh_minmax(me, min, max)) { min[0] = min[1] = min[2] = -1.0f; @@ -838,11 +838,11 @@ void BKE_mesh_boundbox_calc(Mesh *me, float r_loc[3], float r_size[3]) } mid_v3_v3v3(r_loc, min, max); - + r_size[0] = (max[0] - min[0]) / 2.0f; r_size[1] = (max[1] - min[1]) / 2.0f; r_size[2] = (max[2] - min[2]) / 2.0f; - + BKE_boundbox_init_from_minmax(bb, min, max); bb->flag &= ~BOUNDBOX_DIRTY; @@ -1037,7 +1037,7 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr) Mesh *BKE_mesh_from_object(Object *ob) { - + if (ob == NULL) return NULL; if (ob->type == OB_MESH) return ob->data; else return NULL; @@ -1048,9 +1048,9 @@ void BKE_mesh_assign_object(Main *bmain, Object *ob, Mesh *me) Mesh *old = NULL; multires_force_update(ob); - + if (ob == NULL) return; - + if (ob->type == OB_MESH) { old = ob->data; if (old) @@ -1058,7 +1058,7 @@ void BKE_mesh_assign_object(Main *bmain, Object *ob, Mesh *me) ob->data = me; id_us_plus((ID *)me); } - + test_object_materials(bmain, ob, (ID *)me); test_object_modifiers(ob); @@ -1128,7 +1128,7 @@ void BKE_mesh_material_remap(Mesh *me, const unsigned int *remap, unsigned int r } -void BKE_mesh_smooth_flag_set(Object *meshOb, int enableSmooth) +void BKE_mesh_smooth_flag_set(Object *meshOb, int enableSmooth) { Mesh *me = meshOb->data; int i; @@ -1143,7 +1143,7 @@ void BKE_mesh_smooth_flag_set(Object *meshOb, int enableSmooth) mp->flag &= ~ME_SMOOTH; } } - + for (i = 0; i < me->totface; i++) { MFace *mf = &me->mface[i]; @@ -1185,7 +1185,7 @@ int poly_find_loop_from_vert( if (loopstart->v == vert) return j; } - + return -1; } @@ -1202,7 +1202,7 @@ int poly_get_adj_loops_from_vert( int corner = poly_find_loop_from_vert(poly, &mloop[poly->loopstart], vert); - + if (corner != -1) { #if 0 /* unused - this loop */ const MLoop *ml = &mloop[poly->loopstart + corner]; @@ -1238,7 +1238,7 @@ bool BKE_mesh_minmax(const Mesh *me, float r_min[3], float r_max[3]) for (mvert = me->mvert; i--; mvert++) { minmax_v3v3_v3(r_min, r_max, mvert->co); } - + return (me->totvert != 0); } @@ -1281,7 +1281,7 @@ void BKE_mesh_translate(Mesh *me, const float offset[3], const bool do_keys) for (mvert = me->mvert; i--; mvert++) { add_v3_v3(mvert->co, offset); } - + if (do_keys && me->key) { KeyBlock *kb; for (kb = me->key->block.first; kb; kb = kb->next) { diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index 2d8476d6f02..8194e21cbb1 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -179,7 +179,7 @@ void BKE_mesh_calc_normals_mapping_ex( /* if (fnors != r_faceNors) MEM_freeN(fnors); */ /* NO NEED TO ALLOC YET */ fnors = pnors = NULL; - + } typedef struct MeshCalcNormalsData { @@ -192,7 +192,7 @@ typedef struct MeshCalcNormalsData { } MeshCalcNormalsData; static void mesh_calc_normals_poly_cb( - void *__restrict userdata, + void *__restrict userdata, const int pidx, const ParallelRangeTLS *__restrict UNUSED(tls)) { @@ -203,7 +203,7 @@ static void mesh_calc_normals_poly_cb( } static void mesh_calc_normals_poly_prepare_cb( - void *__restrict userdata, + void *__restrict userdata, const int pidx, const ParallelRangeTLS *__restrict UNUSED(tls)) { @@ -402,14 +402,14 @@ void BKE_mesh_calc_normals_tessface( for (i = 0; i < numVerts; i++) { MVert *mv = &mverts[i]; float *no = tnorms[i]; - + if (UNLIKELY(normalize_v3(no) == 0.0f)) { normalize_v3_v3(no, mv->co); } normal_float_to_short_v3(mv->no, no); } - + cleanup: MEM_freeN(tnorms); @@ -2320,19 +2320,19 @@ static bool mesh_calc_center_centroid_ex( const MLoopTri *lt; float totweight; int i; - + zero_v3(r_center); - + if (looptri_num == 0) return false; - + totweight = 0.0f; for (i = 0, lt = looptri; i < looptri_num; i++, lt++) { const MVert *v1 = &mverts[mloop[lt->tri[0]].v]; const MVert *v2 = &mverts[mloop[lt->tri[1]].v]; const MVert *v3 = &mverts[mloop[lt->tri[2]].v]; float area; - + area = area_tri_v3(v1->co, v2->co, v3->co); madd_v3_v3fl(r_center, v1->co, area); madd_v3_v3fl(r_center, v2->co, area); @@ -2341,9 +2341,9 @@ static bool mesh_calc_center_centroid_ex( } if (totweight == 0.0f) return false; - + mul_v3_fl(r_center, 1.0f / (3.0f * totweight)); - + return true; } @@ -2363,18 +2363,18 @@ void BKE_mesh_calc_volume( float center[3]; float totvol; int i; - + if (r_volume) *r_volume = 0.0f; if (r_center) zero_v3(r_center); - + if (looptri_num == 0) return; - + if (!mesh_calc_center_centroid_ex(mverts, mverts_num, looptri, looptri_num, mloop, center)) return; - + totvol = 0.0f; for (i = 0, lt = looptri; i < looptri_num; i++, lt++) { @@ -2382,7 +2382,7 @@ void BKE_mesh_calc_volume( const MVert *v2 = &mverts[mloop[lt->tri[1]].v]; const MVert *v3 = &mverts[mloop[lt->tri[2]].v]; float vol; - + vol = volume_tetrahedron_signed_v3(center, v1->co, v2->co, v3->co); if (r_volume) { totvol += vol; @@ -2394,7 +2394,7 @@ void BKE_mesh_calc_volume( madd_v3_v3fl(r_center, v3->co, vol); } } - + /* Note: Depending on arbitrary centroid position, * totvol can become negative even for a valid mesh. * The true value is always the positive value. diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 0b904caf375..835b78e2a78 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -130,7 +130,7 @@ ModifierData *modifier_new(int type) { const ModifierTypeInfo *mti = modifierType_getInfo(type); ModifierData *md = MEM_callocN(mti->structSize, mti->structName); - + /* note, this name must be made unique later */ BLI_strncpy(md->name, DATA_(mti->name), sizeof(md->name)); @@ -489,7 +489,7 @@ bool modifier_isEnabled(struct Scene *scene, ModifierData *md, int required_mode if (scene != NULL && mti->isDisabled && mti->isDisabled(md, required_mode == eModifierMode_Render)) return false; if (md->mode & eModifierMode_DisableTemporary) return false; if ((required_mode & eModifierMode_Editmode) && !(mti->flags & eModifierTypeFlag_SupportsEditmode)) return false; - + return true; } @@ -505,7 +505,7 @@ CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, Object *ob, ModifierDat const ModifierTypeInfo *mti = modifierType_getInfo(md->type); curr = MEM_callocN(sizeof(CDMaskLink), "CDMaskLink"); - + if (modifier_isEnabled(scene, md, required_mode)) { if (mti->requiredDataMask) curr->mask = mti->requiredDataMask(ob, md); @@ -614,7 +614,7 @@ Object *modifiers_isDeformedByArmature(Object *ob) VirtualModifierData virtualModifierData; ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData); ArmatureModifierData *amd = NULL; - + /* return the first selected armature, this lets us use multiple armatures */ for (; md; md = md->next) { if (md->type == eModifierType_Armature) { @@ -623,10 +623,10 @@ Object *modifiers_isDeformedByArmature(Object *ob) return amd->object; } } - + if (amd) /* if were still here then return the last armature */ return amd->object; - + return NULL; } @@ -659,7 +659,7 @@ Object *modifiers_isDeformedByLattice(Object *ob) VirtualModifierData virtualModifierData; ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData); LatticeModifierData *lmd = NULL; - + /* return the first selected lattice, this lets us use multiple lattices */ for (; md; md = md->next) { if (md->type == eModifierType_Lattice) { @@ -668,10 +668,10 @@ Object *modifiers_isDeformedByLattice(Object *ob) return lmd->object; } } - + if (lmd) /* if were still here then return the last lattice */ return lmd->object; - + return NULL; } @@ -683,7 +683,7 @@ Object *modifiers_isDeformedByCurve(Object *ob) VirtualModifierData virtualModifierData; ModifierData *md = modifiers_getVirtualModifierList(ob, &virtualModifierData); CurveModifierData *cmd = NULL; - + /* return the first selected curve, this lets us use multiple curves */ for (; md; md = md->next) { if (md->type == eModifierType_Curve) { @@ -692,10 +692,10 @@ Object *modifiers_isDeformedByCurve(Object *ob) return cmd->object; } } - + if (cmd) /* if were still here then return the last curve */ return cmd->object; - + return NULL; } diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 39a472241bc..a9fded4a074 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -190,7 +190,7 @@ static BLI_bitmap *multires_mdisps_downsample_hidden(BLI_bitmap *old_hidden, for (x = 0; x < new_gridsize; x++) { old_value = BLI_BITMAP_TEST(old_hidden, factor * y * old_gridsize + x * factor); - + BLI_BITMAP_SET(new_hidden, y * new_gridsize + x, old_value); } } @@ -205,7 +205,7 @@ static void multires_output_hidden_to_ccgdm(CCGDerivedMesh *ccgdm, BLI_bitmap **grid_hidden = ccgdm->gridHidden; int *gridOffset; int i, j; - + gridOffset = ccgdm->dm.getGridOffset(&ccgdm->dm); for (i = 0; i < me->totpoly; i++) { @@ -213,7 +213,7 @@ static void multires_output_hidden_to_ccgdm(CCGDerivedMesh *ccgdm, int g = gridOffset[i] + j; const MDisps *md = &mdisps[g]; BLI_bitmap *gh = md->hidden; - + if (gh) { grid_hidden[g] = multires_mdisps_downsample_hidden(gh, md->level, level); @@ -227,7 +227,7 @@ static void multires_output_hidden_to_ccgdm(CCGDerivedMesh *ccgdm, static void multires_mdisps_subdivide_hidden(MDisps *md, int new_level) { BLI_bitmap *subd; - + BLI_assert(md->hidden); /* nothing to do if already subdivided enough */ @@ -238,7 +238,7 @@ static void multires_mdisps_subdivide_hidden(MDisps *md, int new_level) md->level, new_level, NULL); - + /* swap in the subdivided data */ MEM_freeN(md->hidden); md->hidden = subd; @@ -251,7 +251,7 @@ static MDisps *multires_mdisps_initialize_hidden(Mesh *me, int level) int gridsize = BKE_ccg_gridsize(level); int gridarea = SQUARE(gridsize); int i, j; - + for (i = 0; i < me->totpoly; i++) { bool hide = false; @@ -475,7 +475,7 @@ static int get_levels_from_disps(Object *ob) for (j = 0; j < me->mpoly[i].totloop; j++, md++) { if (md->totdisp == 0) continue; - + while (1) { int side = (1 << (totlvl - 1)) + 1; int lvl_totdisp = side * side; @@ -485,9 +485,9 @@ static int get_levels_from_disps(Object *ob) totlvl--; else totlvl++; - + } - + break; } } @@ -538,7 +538,7 @@ static void multires_reallocate_mdisps(int totloop, MDisps *mdisps, int lvl) if (mdisps[i].disps) MEM_freeN(mdisps[i].disps); - + if (mdisps[i].level && mdisps[i].hidden) multires_mdisps_subdivide_hidden(&mdisps[i], lvl); @@ -736,7 +736,7 @@ static DerivedMesh *subsurf_dm_create_local(Object *ob, DerivedMesh *dm, int lvl if (alloc_paint_mask) flags |= SUBSURF_ALLOC_PAINT_MASK; - + return subsurf_make_derived_from_derived(dm, &smd, NULL, flags); } @@ -802,7 +802,7 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob) /* find center */ for (j = 0; j < pmap[i].count; j++) { const MPoly *p = &me->mpoly[pmap[i].indices[j]]; - + /* this double counts, not sure if that's bad or good */ for (k = 0; k < p->totloop; ++k) { int vndx = me->mloop[p->loopstart + k].v; @@ -828,18 +828,18 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob) fake_poly.loopstart = 0; fake_loops = MEM_malloc_arrayN(p->totloop, sizeof(MLoop), "fake_loops"); fake_co = MEM_malloc_arrayN(p->totloop, 3 * sizeof(float), "fake_co"); - + for (k = 0; k < p->totloop; ++k) { int vndx = me->mloop[p->loopstart + k].v; - + fake_loops[k].v = k; - + if (vndx == i) copy_v3_v3(fake_co[k], center); else copy_v3_v3(fake_co[k], origco[vndx]); } - + BKE_mesh_calc_poly_normal_coords(&fake_poly, fake_loops, (const float(*)[3])fake_co, no); MEM_freeN(fake_loops); @@ -854,7 +854,7 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob) copy_v3_v3(push, avg_no); mul_v3_fl(push, dist); add_v3_v3(me->mvert[i].co, push); - + } MEM_freeN(origco); @@ -943,7 +943,7 @@ static void multires_subdivide(MultiresModifierData *mmd, Object *ob, int totlvl ccgSubSurf_updateLevels(ss, lvl, NULL, 0); /* reallocate displacements */ - multires_reallocate_mdisps(me->totloop, mdisps, totlvl); + multires_reallocate_mdisps(me->totloop, mdisps, totlvl); /* compute displacements */ multiresModifier_disp_run(highdm, me, NULL, CALC_DISPLACEMENTS, subGridData, totlvl); @@ -956,7 +956,7 @@ static void multires_subdivide(MultiresModifierData *mmd, Object *ob, int totlvl } else { /* only reallocate, nothing to upsample */ - multires_reallocate_mdisps(me->totloop, mdisps, totlvl); + multires_reallocate_mdisps(me->totloop, mdisps, totlvl); } multires_set_tot_level(ob, mmd, totlvl); @@ -1129,7 +1129,7 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm int *gridOffset; int i, gridSize, dGridSize, dSkip; int totloop, totpoly; - + /* this happens in the dm made by bmesh_mdisps_space_set */ if (dm2 && CustomData_has_layer(&dm2->loopData, CD_MDISPS)) { mpoly = CustomData_get_layer(&dm2->polyData, CD_MPOLY); @@ -1141,7 +1141,7 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm totloop = me->totloop; totpoly = me->totpoly; } - + if (!mdisps) { if (op == CALC_DISPLACEMENTS) mdisps = CustomData_add_layer(&me->ldata, CD_MDISPS, CD_DEFAULT, NULL, me->totloop); @@ -1215,7 +1215,7 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm) if (mdisps) { int lvl = ccgdm->multires.lvl; int totlvl = ccgdm->multires.totlvl; - + if (lvl < totlvl) { DerivedMesh *lowdm, *cddm, *highdm; CCGElem **highGridData, **lowGridData, **subGridData, **gridData, *diffGrid; @@ -1312,7 +1312,7 @@ void multires_modifier_update_hidden(DerivedMesh *dm) if (mdisps) { int i; - + for (i = 0; i < me->totloop; i++) { MDisps *md = &mdisps[i]; BLI_bitmap *gh = grid_hidden[i]; @@ -1326,7 +1326,7 @@ void multires_modifier_update_hidden(DerivedMesh *dm) md->hidden); if (md->hidden) MEM_freeN(md->hidden); - + md->hidden = gh; } } @@ -1343,10 +1343,10 @@ void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to) MultiresModifierData *mmd = get_multires_modifier(NULL, ob, 1); int *gridOffset, totlvl; int i, k, numGrids, gridSize, dGridSize, dSkip; - + if (!mmd) return; - + mdisps = CustomData_get_layer(&dm->loopData, CD_MDISPS); if (!mdisps) { @@ -1355,7 +1355,7 @@ void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to) totlvl = mmd->totlvl; ccgdm = multires_dm_create_local(ob, dm, totlvl, totlvl, mmd->simple, false); - + subsurf = subsurf_dm_create_local(ob, dm, totlvl, mmd->simple, mmd->flags & eMultiresModifierFlag_ControlEdges, mmd->flags & eMultiresModifierFlag_PlainUv, 0); @@ -1370,7 +1370,7 @@ void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to) subGridData[i] = MEM_calloc_arrayN(key.elem_size, gridSize * gridSize, "subGridData"); memcpy(subGridData[i], gridData[i], key.elem_size * gridSize * gridSize); } - + /* numGrids = ccgdm->dm->getNumGrids((DerivedMesh *)ccgdm); */ /*UNUSED*/ gridSize = ccgdm->getGridSize((DerivedMesh *)ccgdm); gridData = ccgdm->getGridData((DerivedMesh *)ccgdm); @@ -1385,7 +1385,7 @@ void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to) for (i = 0; i < dm->numPolyData; ++i) { const int numVerts = mpoly[i].totloop; int S, x, y, gIndex = gridOffset[i]; - + for (S = 0; S < numVerts; ++S, ++gIndex, ++k) { MDisps *mdisp = &mdisps[mpoly[i].loopstart + S]; /* CCGElem *grid = gridData[gIndex]; */ /* UNUSED */ @@ -1406,7 +1406,7 @@ void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to) float *data = dispgrid[dGridSize * y * dSkip + x * dSkip]; float *co = CCG_grid_elem_co(&key, subgrid, x, y); float mat[3][3], dco[3]; - + /* construct tangent space matrix */ grid_tangent_matrix(mat, &key, x, y, subgrid); @@ -1421,7 +1421,7 @@ void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to) else if (from == MULTIRES_SPACE_ABSOLUTE) { copy_v3_v3(dco, data); } - + /*now, convert to desired displacement type*/ if (to == MULTIRES_SPACE_TANGENT) { invert_m3(mat); @@ -1545,10 +1545,10 @@ void old_mdisps_bilinear(float out[3], float (*disps)[3], const int st, float u, const int st_max = st - 1; float urat, vrat, uopp; float d[4][3], d2[2][3]; - + if (!disps || isnan(u) || isnan(v)) return; - + if (u < 0) u = 0; else if (u >= st) @@ -1565,7 +1565,7 @@ void old_mdisps_bilinear(float out[3], float (*disps)[3], const int st, float u, if (x2 >= st) x2 = st_max; if (y2 >= st) y2 = st_max; - + urat = u - x; vrat = v - y; uopp = 1 - urat; @@ -1640,7 +1640,7 @@ void multires_load_old_250(Mesh *me) for (i = 0; i < me->totface; i++) if (mdisps[i].totdisp) old_mdisps_convert(&me->mface[i], &mdisps[i]); - + CustomData_add_layer(&me->ldata, CD_MDISPS, CD_CALLOC, NULL, me->totloop); mdisps2 = CustomData_get_layer(&me->ldata, CD_MDISPS); @@ -1649,7 +1649,7 @@ void multires_load_old_250(Mesh *me) for (i = 0; i < me->totface; i++, mf++) { int nvert = mf->v4 ? 4 : 3; int totdisp = mdisps[i].totdisp / nvert; - + for (j = 0; j < nvert; j++, k++) { mdisps2[k].disps = MEM_calloc_arrayN(totdisp, 3 * sizeof(float), "multires disp in conversion"); mdisps2[k].totdisp = totdisp; @@ -1710,11 +1710,11 @@ static void create_old_vert_face_map(ListBase **map, IndexNode **mem, const Mult { int i, j; IndexNode *node = NULL; - + (*map) = MEM_calloc_arrayN(totvert, sizeof(ListBase), "vert face map"); (*mem) = MEM_calloc_arrayN(totface, 4 * sizeof(IndexNode), "vert face map mem"); node = *mem; - + /* Find the users */ for (i = 0; i < totface; ++i) { for (j = 0; j < (mface[i].v[3] ? 4 : 3); ++j, ++node) { @@ -1729,11 +1729,11 @@ static void create_old_vert_edge_map(ListBase **map, IndexNode **mem, const Mult { int i, j; IndexNode *node = NULL; - + (*map) = MEM_calloc_arrayN(totvert, sizeof(ListBase), "vert edge map"); (*mem) = MEM_calloc_arrayN(totedge, 2 * sizeof(IndexNode), "vert edge map mem"); node = *mem; - + /* Find the users */ for (i = 0; i < totedge; ++i) { for (j = 0; j < 2; ++j, ++node) { @@ -1854,7 +1854,7 @@ static void multires_mvert_to_ss(DerivedMesh *dm, MVert *mvert) vd = ccgSubSurf_getFaceCenterData(f); copy_v3_v3(CCG_elem_co(&key, vd), mvert[i].co); i++; - + for (S = 0; S < numVerts; S++) { for (x = 1; x < gridSize - 1; x++, i++) { vd = ccgSubSurf_getFaceGridEdgeData(ss, f, S, x); @@ -2085,7 +2085,7 @@ static void multires_load_old_vcols(Mesh *me) * so we can assume the active vcol layer is the correct one */ if (!(mcol = CustomData_get_layer(&me->fdata, CD_MCOL))) return; - + for (i = 0; i < me->totface; ++i) { for (j = 0; j < 4; ++j) { mcol[i * 4 + j].a = colface[i].col[j].a; @@ -2164,7 +2164,7 @@ void multires_load_old(Object *ob, Mesh *me) /* Add a multires modifier to the object */ md = ob->modifiers.first; while (md && modifierType_getInfo(md->type)->type == eModifierTypeType_OnlyDeform) - md = md->next; + md = md->next; mmd = (MultiresModifierData *)modifier_new(eModifierType_Multires); BLI_insertlinkbefore(&ob->modifiers, md, mmd); diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 56705c834d5..91340997532 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -79,31 +79,31 @@ void BKE_nlastrip_free(ListBase *strips, NlaStrip *strip) { NlaStrip *cs, *csn; - + /* sanity checks */ if (strip == NULL) return; - + /* free child-strips */ for (cs = strip->strips.first; cs; cs = csn) { csn = cs->next; BKE_nlastrip_free(&strip->strips, cs); } - + /* remove reference to action */ if (strip->act) id_us_min(&strip->act->id); - + /* free remapping info */ //if (strip->remap) // BKE_animremap_free(); - + /* free own F-Curves */ free_fcurves(&strip->fcurves); - + /* free own F-Modifiers */ free_fmodifiers(&strip->modifiers); - + /* free the strip itself */ if (strips) BLI_freelinkN(strips, strip); @@ -117,17 +117,17 @@ void BKE_nlastrip_free(ListBase *strips, NlaStrip *strip) void BKE_nlatrack_free(ListBase *tracks, NlaTrack *nlt) { NlaStrip *strip, *stripn; - + /* sanity checks */ if (nlt == NULL) return; - + /* free strips */ for (strip = nlt->strips.first; strip; strip = stripn) { stripn = strip->next; BKE_nlastrip_free(&nlt->strips, strip); } - + /* free NLA track itself now */ if (tracks) BLI_freelinkN(tracks, nlt); @@ -141,17 +141,17 @@ void BKE_nlatrack_free(ListBase *tracks, NlaTrack *nlt) void BKE_nla_tracks_free(ListBase *tracks) { NlaTrack *nlt, *nltn; - + /* sanity checks */ if (ELEM(NULL, tracks, tracks->first)) return; - + /* free tracks one by one */ for (nlt = tracks->first; nlt; nlt = nltn) { nltn = nlt->next; BKE_nlatrack_free(tracks, nlt); } - + /* clear the list's pointers to be safe */ BLI_listbase_clear(tracks); } @@ -167,15 +167,15 @@ NlaStrip *BKE_nlastrip_copy(Main *bmain, NlaStrip *strip, const bool use_same_ac { NlaStrip *strip_d; NlaStrip *cs, *cs_d; - + /* sanity check */ if (strip == NULL) return NULL; - + /* make a copy */ strip_d = MEM_dupallocN(strip); strip_d->next = strip_d->prev = NULL; - + /* handle action */ if (strip_d->act) { if (use_same_action) { @@ -187,19 +187,19 @@ NlaStrip *BKE_nlastrip_copy(Main *bmain, NlaStrip *strip, const bool use_same_ac strip_d->act = BKE_action_copy(bmain, strip_d->act); } } - + /* copy F-Curves and modifiers */ copy_fcurves(&strip_d->fcurves, &strip->fcurves); copy_fmodifiers(&strip_d->modifiers, &strip->modifiers); - + /* make a copy of all the child-strips, one at a time */ BLI_listbase_clear(&strip_d->strips); - + for (cs = strip->strips.first; cs; cs = cs->next) { cs_d = BKE_nlastrip_copy(bmain, cs, use_same_action); BLI_addtail(&strip_d->strips, cs_d); } - + /* return the strip */ return strip_d; } @@ -209,23 +209,23 @@ NlaTrack *BKE_nlatrack_copy(Main *bmain, NlaTrack *nlt, const bool use_same_acti { NlaStrip *strip, *strip_d; NlaTrack *nlt_d; - + /* sanity check */ if (nlt == NULL) return NULL; - + /* make a copy */ nlt_d = MEM_dupallocN(nlt); nlt_d->next = nlt_d->prev = NULL; - + /* make a copy of all the strips, one at a time */ BLI_listbase_clear(&nlt_d->strips); - + for (strip = nlt->strips.first; strip; strip = strip->next) { strip_d = BKE_nlastrip_copy(bmain, strip, use_same_actions); BLI_addtail(&nlt_d->strips, strip_d); } - + /* return the copy */ return nlt_d; } @@ -234,14 +234,14 @@ NlaTrack *BKE_nlatrack_copy(Main *bmain, NlaTrack *nlt, const bool use_same_acti void BKE_nla_tracks_copy(Main *bmain, ListBase *dst, ListBase *src) { NlaTrack *nlt, *nlt_d; - + /* sanity checks */ if (ELEM(NULL, dst, src)) return; - + /* clear out the destination list first for precautions... */ BLI_listbase_clear(dst); - + /* copy each NLA-track, one at a time */ for (nlt = src->first; nlt; nlt = nlt->next) { /* make a copy, and add the copy to the destination list */ @@ -253,35 +253,35 @@ void BKE_nla_tracks_copy(Main *bmain, ListBase *dst, ListBase *src) /* Adding ------------------------------------------- */ -/* Add a NLA Track to the given AnimData +/* Add a NLA Track to the given AnimData * - prev: NLA-Track to add the new one after */ NlaTrack *BKE_nlatrack_add(AnimData *adt, NlaTrack *prev) { NlaTrack *nlt; - + /* sanity checks */ if (adt == NULL) return NULL; - + /* allocate new track */ nlt = MEM_callocN(sizeof(NlaTrack), "NlaTrack"); - + /* set settings requiring the track to not be part of the stack yet */ nlt->flag = NLATRACK_SELECTED; nlt->index = BLI_listbase_count(&adt->nla_tracks); - + /* add track to stack, and make it the active one */ if (prev) BLI_insertlinkafter(&adt->nla_tracks, prev, nlt); else BLI_addtail(&adt->nla_tracks, nlt); BKE_nlatrack_set_active(&adt->nla_tracks, nlt); - + /* must have unique name, but we need to seed this */ strcpy(nlt->name, "NlaTrack"); BLI_uniquename(&adt->nla_tracks, nlt, DATA_("NlaTrack"), '.', offsetof(NlaTrack, name), sizeof(nlt->name)); - + /* return the new track */ return nlt; } @@ -290,15 +290,15 @@ NlaTrack *BKE_nlatrack_add(AnimData *adt, NlaTrack *prev) NlaStrip *BKE_nlastrip_new(bAction *act) { NlaStrip *strip; - + /* sanity checks */ if (act == NULL) return NULL; - + /* allocate new strip */ strip = MEM_callocN(sizeof(NlaStrip), "NlaStrip"); - - /* generic settings + + /* generic settings * - selected flag to highlight this to the user * - (XXX) disabled Auto-Blends, as this was often causing some unwanted effects * - (XXX) synchronization of strip-length in accordance with changes to action-length @@ -306,23 +306,23 @@ NlaStrip *BKE_nlastrip_new(bAction *act) * though this decision is still subject to further review... */ strip->flag = NLASTRIP_FLAG_SELECT; - + /* assign the action reference */ strip->act = act; id_us_plus(&act->id); - - /* determine initial range + + /* determine initial range * - strip length cannot be 0... ever... */ calc_action_range(strip->act, &strip->actstart, &strip->actend, 0); - + strip->start = strip->actstart; strip->end = (IS_EQF(strip->actstart, strip->actend)) ? (strip->actstart + 1.0f) : (strip->actend); - + /* strip should be referenced as-is */ strip->scale = 1.0f; strip->repeat = 1.0f; - + /* return the new strip */ return strip; } @@ -332,28 +332,28 @@ NlaStrip *BKE_nlastack_add_strip(AnimData *adt, bAction *act) { NlaStrip *strip; NlaTrack *nlt; - + /* sanity checks */ if (ELEM(NULL, adt, act)) return NULL; - + /* create a new NLA strip */ strip = BKE_nlastrip_new(act); if (strip == NULL) return NULL; - + /* firstly try adding strip to last track, but if that fails, add to a new track */ if (BKE_nlatrack_add_strip(adt->nla_tracks.last, strip) == 0) { - /* trying to add to the last track failed (no track or no space), + /* trying to add to the last track failed (no track or no space), * so add a new track to the stack, and add to that... */ nlt = BKE_nlatrack_add(adt, NULL); BKE_nlatrack_add_strip(nlt, strip); } - + /* automatically name it too */ BKE_nlastrip_validate_name(adt, strip); - + /* returns the strip added */ return strip; } @@ -362,14 +362,14 @@ NlaStrip *BKE_nlastack_add_strip(AnimData *adt, bAction *act) NlaStrip *BKE_nla_add_soundstrip(Scene *scene, Speaker *speaker) { NlaStrip *strip = MEM_callocN(sizeof(NlaStrip), "NlaSoundStrip"); - + /* if speaker has a sound, set the strip length to the length of the sound, * otherwise default to length of 10 frames */ #ifdef WITH_AUDASPACE if (speaker->sound) { AUD_SoundInfo info = AUD_getInfo(speaker->sound->playback_handle); - + strip->end = (float)ceil((double)info.length * FPS); } else @@ -380,17 +380,17 @@ NlaStrip *BKE_nla_add_soundstrip(Scene *scene, Speaker *speaker) (void)scene; (void)speaker; } - + /* general settings */ strip->type = NLASTRIP_TYPE_SOUND; - + strip->flag = NLASTRIP_FLAG_SELECT; strip->extendmode = NLASTRIP_EXTEND_NOTHING; /* nothing to extend... */ - + /* strip should be referenced as-is */ strip->scale = 1.0f; strip->repeat = 1.0f; - + /* return this strip */ return strip; } @@ -407,19 +407,19 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short { float actlength, scale; // float repeat; // UNUSED - + /* get number of repeats */ if (IS_EQF(strip->repeat, 0.0f)) strip->repeat = 1.0f; // repeat = strip->repeat; // UNUSED - + /* scaling */ if (IS_EQF(strip->scale, 0.0f)) strip->scale = 1.0f; scale = fabsf(strip->scale); /* scale must be positive - we've got a special flag for reversing */ - + /* length of referenced action */ actlength = strip->actend - strip->actstart; if (IS_EQF(actlength, 0.0f)) actlength = 1.0f; - + /* reversed = play strip backwards */ if (strip->flag & NLASTRIP_FLAG_REVERSE) { /* FIXME: this won't work right with Graph Editor? */ @@ -431,7 +431,7 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short } else { /* if (mode == NLATIME_CONVERT_EVAL) */ if (IS_EQF((float)cframe, strip->end) && IS_EQF(strip->repeat, floorf(strip->repeat))) { - /* this case prevents the motion snapping back to the first frame at the end of the strip + /* this case prevents the motion snapping back to the first frame at the end of the strip * by catching the case where repeats is a whole number, which means that the end of the strip * could also be interpreted as the end of the start of a repeat */ @@ -454,7 +454,7 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short } else { /* if (mode == NLATIME_CONVERT_EVAL) */ if (IS_EQF(cframe, strip->end) && IS_EQF(strip->repeat, floorf(strip->repeat))) { - /* this case prevents the motion snapping back to the first frame at the end of the strip + /* this case prevents the motion snapping back to the first frame at the end of the strip * by catching the case where repeats is a whole number, which means that the end of the strip * could also be interpreted as the end of the start of a repeat */ @@ -476,10 +476,10 @@ static float nlastrip_get_frame_actionclip(NlaStrip *strip, float cframe, short static float nlastrip_get_frame_transition(NlaStrip *strip, float cframe, short mode) { float length; - + /* length of strip */ length = strip->end - strip->start; - + /* reversed = play strip backwards */ if (strip->flag & NLASTRIP_FLAG_REVERSE) { if (mode == NLATIME_CONVERT_MAP) @@ -507,7 +507,7 @@ float nlastrip_get_frame(NlaStrip *strip, float cframe, short mode) case NLASTRIP_TYPE_META: /* meta - for now, does the same as transition (is really just an empty container) */ case NLASTRIP_TYPE_TRANSITION: /* transition */ return nlastrip_get_frame_transition(strip, cframe, mode); - + case NLASTRIP_TYPE_CLIP: /* action-clip (default) */ default: return nlastrip_get_frame_actionclip(strip, cframe, mode); @@ -524,15 +524,15 @@ float nlastrip_get_frame(NlaStrip *strip, float cframe, short mode) float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, short mode) { NlaStrip *strip; - - /* sanity checks + + /* sanity checks * - obviously we've got to have some starting data * - when not in tweakmode, the active Action does not have any scaling applied :) * - when in tweakmode, if the no-mapping flag is set, do not map */ if ((adt == NULL) || (adt->flag & ADT_NLA_EDIT_ON) == 0 || (adt->flag & ADT_NLA_EDIT_NOMAP)) return cframe; - + /* if the active-strip info has been stored already, access this, otherwise look this up * and store for (very probable) future usage */ @@ -546,15 +546,15 @@ float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, short mode) adt->actstrip = BKE_nlastrip_find_active(adt->act_track); } strip = adt->actstrip; - - /* sanity checks + + /* sanity checks * - in rare cases, we may not be able to find this strip for some reason (internal error) * - for now, if the user has defined a curve to control the time, this correction cannot be performed * reliably... */ if ((strip == NULL) || (strip->flag & NLASTRIP_FLAG_USR_TIME)) return cframe; - + /* perform the correction now... */ return nlastrip_get_frame(strip, cframe, mode); } @@ -569,7 +569,7 @@ float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, short mode) bool BKE_nlastrips_has_space(ListBase *strips, float start, float end) { NlaStrip *strip; - + /* sanity checks */ if ((strips == NULL) || IS_EQF(start, end)) return false; @@ -577,7 +577,7 @@ bool BKE_nlastrips_has_space(ListBase *strips, float start, float end) puts("BKE_nlastrips_has_space() error... start and end arguments swapped"); SWAP(float, start, end); } - + /* loop over NLA strips checking for any overlaps with this area... */ for (strip = strips->first; strip; strip = strip->next) { /* if start frame of strip is past the target end-frame, that means that @@ -585,43 +585,43 @@ bool BKE_nlastrips_has_space(ListBase *strips, float start, float end) */ if (strip->start >= end) return true; - + /* if the end of the strip is greater than either of the boundaries, the range * must fall within the extents of the strip */ if ((strip->end > start) || (strip->end > end)) return false; } - + /* if we are still here, we haven't encountered any overlapping strips */ return true; } -/* Rearrange the strips in the track so that they are always in order +/* Rearrange the strips in the track so that they are always in order * (usually only needed after a strip has been moved) */ void BKE_nlastrips_sort_strips(ListBase *strips) { ListBase tmp = {NULL, NULL}; NlaStrip *strip, *sstrip, *stripn; - + /* sanity checks */ if (ELEM(NULL, strips, strips->first)) return; - + /* we simply perform insertion sort on this list, since it is assumed that per track, * there are only likely to be at most 5-10 strips */ for (strip = strips->first; strip; strip = stripn) { short not_added = 1; - + stripn = strip->next; - - /* remove this strip from the list, and add it to the new list, searching from the end of - * the list, assuming that the lists are in order + + /* remove this strip from the list, and add it to the new list, searching from the end of + * the list, assuming that the lists are in order */ BLI_remlink(strips, strip); - + for (sstrip = tmp.last; sstrip; sstrip = sstrip->prev) { /* check if add after */ if (sstrip->end <= strip->start) { @@ -630,33 +630,33 @@ void BKE_nlastrips_sort_strips(ListBase *strips) break; } } - + /* add before first? */ if (not_added) BLI_addhead(&tmp, strip); } - + /* reassign the start and end points of the strips */ strips->first = tmp.first; strips->last = tmp.last; } -/* Add the given NLA-Strip to the given list of strips, assuming that it +/* Add the given NLA-Strip to the given list of strips, assuming that it * isn't currently a member of another list */ bool BKE_nlastrips_add_strip(ListBase *strips, NlaStrip *strip) { NlaStrip *ns; bool not_added = true; - + /* sanity checks */ if (ELEM(NULL, strips, strip)) return false; - + /* check if any space to add */ if (BKE_nlastrips_has_space(strips, strip->start, strip->end) == 0) return false; - + /* find the right place to add the strip to the nominated track */ for (ns = strips->first; ns; ns = ns->next) { /* if current strip occurs after the new strip, add it before */ @@ -670,7 +670,7 @@ bool BKE_nlastrips_add_strip(ListBase *strips, NlaStrip *strip) /* just add to the end of the list of the strips then... */ BLI_addtail(strips, strip); } - + /* added... */ return true; } @@ -686,15 +686,15 @@ void BKE_nlastrips_make_metas(ListBase *strips, bool is_temp) { NlaStrip *mstrip = NULL; NlaStrip *strip, *stripn; - + /* sanity checks */ if (ELEM(NULL, strips, strips->first)) return; - + /* group all continuous chains of selected strips into meta-strips */ for (strip = strips->first; strip; strip = stripn) { stripn = strip->next; - + if (strip->flag & NLASTRIP_FLAG_SELECT) { /* if there is an existing meta-strip, add this strip to it, otherwise, create a new one */ if (mstrip == NULL) { @@ -702,25 +702,25 @@ void BKE_nlastrips_make_metas(ListBase *strips, bool is_temp) mstrip = MEM_callocN(sizeof(NlaStrip), "Meta-NlaStrip"); mstrip->type = NLASTRIP_TYPE_META; BLI_insertlinkbefore(strips, strip, mstrip); - + /* set flags */ mstrip->flag = NLASTRIP_FLAG_SELECT; - + /* set temp flag if appropriate (i.e. for transform-type editing) */ if (is_temp) mstrip->flag |= NLASTRIP_FLAG_TEMP_META; - + /* set default repeat/scale values to prevent warnings */ mstrip->repeat = mstrip->scale = 1.0f; - + /* make its start frame be set to the start frame of the current strip */ mstrip->start = strip->start; } - + /* remove the selected strips from the track, and add to the meta */ BLI_remlink(strips, strip); BLI_addtail(&mstrip->strips, strip); - + /* expand the meta's dimensions to include the newly added strip- i.e. its last frame */ mstrip->end = strip->end; } @@ -737,11 +737,11 @@ void BKE_nlastrips_make_metas(ListBase *strips, bool is_temp) void BKE_nlastrips_clear_metastrip(ListBase *strips, NlaStrip *strip) { NlaStrip *cs, *csn; - + /* sanity check */ if (ELEM(NULL, strips, strip)) return; - + /* move each one of the meta-strip's children before the meta-strip * in the list of strips after unlinking them from the meta-strip */ @@ -750,7 +750,7 @@ void BKE_nlastrips_clear_metastrip(ListBase *strips, NlaStrip *strip) BLI_remlink(&strip->strips, cs); BLI_insertlinkbefore(strips, strip, cs); } - + /* free the meta-strip now */ BKE_nlastrip_free(strips, strip); } @@ -762,15 +762,15 @@ void BKE_nlastrips_clear_metastrip(ListBase *strips, NlaStrip *strip) void BKE_nlastrips_clear_metas(ListBase *strips, bool only_sel, bool only_temp) { NlaStrip *strip, *stripn; - + /* sanity checks */ if (ELEM(NULL, strips, strips->first)) return; - + /* remove meta-strips fitting the criteria of the arguments */ for (strip = strips->first; strip; strip = stripn) { stripn = strip->next; - + /* check if strip is a meta-strip */ if (strip->type == NLASTRIP_TYPE_META) { /* if check if selection and 'temporary-only' considerations are met */ @@ -791,37 +791,37 @@ bool BKE_nlameta_add_strip(NlaStrip *mstrip, NlaStrip *strip) /* sanity checks */ if (ELEM(NULL, mstrip, strip)) return false; - + /* firstly, check if the meta-strip has space for this */ if (BKE_nlastrips_has_space(&mstrip->strips, strip->start, strip->end) == 0) return false; - + /* check if this would need to be added to the ends of the meta, * and subsequently, if the neighboring strips allow us enough room */ if (strip->start < mstrip->start) { - /* check if strip to the left (if it exists) ends before the - * start of the strip we're trying to add + /* check if strip to the left (if it exists) ends before the + * start of the strip we're trying to add */ if ((mstrip->prev == NULL) || (mstrip->prev->end <= strip->start)) { /* add strip to start of meta's list, and expand dimensions */ BLI_addhead(&mstrip->strips, strip); mstrip->start = strip->start; - + return true; } else /* failed... no room before */ return false; } else if (strip->end > mstrip->end) { - /* check if strip to the right (if it exists) starts before the - * end of the strip we're trying to add + /* check if strip to the right (if it exists) starts before the + * end of the strip we're trying to add */ if ((mstrip->next == NULL) || (mstrip->next->start >= strip->end)) { /* add strip to end of meta's list, and expand dimensions */ BLI_addtail(&mstrip->strips, strip); mstrip->end = strip->end; - + return true; } else /* failed... no room after */ @@ -833,7 +833,7 @@ bool BKE_nlameta_add_strip(NlaStrip *mstrip, NlaStrip *strip) } } -/* Adjust the settings of NLA-Strips contained within a Meta-Strip (recursively), +/* Adjust the settings of NLA-Strips contained within a Meta-Strip (recursively), * until the Meta-Strips children all fit within the Meta-Strip's new dimensions */ void BKE_nlameta_flush_transforms(NlaStrip *mstrip) @@ -842,8 +842,8 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip) float oStart, oEnd, offset; float oLen, nLen; short scaleChanged = 0; - - /* sanity checks + + /* sanity checks * - strip must exist * - strip must be a meta-strip with some contents */ @@ -851,37 +851,37 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip) return; if (mstrip->type != NLASTRIP_TYPE_META) return; - + /* get the original start/end points, and calculate the start-frame offset - * - these are simply the start/end frames of the child strips, + * - these are simply the start/end frames of the child strips, * since we assume they weren't transformed yet */ oStart = ((NlaStrip *)mstrip->strips.first)->start; oEnd = ((NlaStrip *)mstrip->strips.last)->end; offset = mstrip->start - oStart; - + /* optimization: * don't flush if nothing changed yet * TODO: maybe we need a flag to say always flush? */ if (IS_EQF(oStart, mstrip->start) && IS_EQF(oEnd, mstrip->end)) return; - + /* check if scale changed */ oLen = oEnd - oStart; nLen = mstrip->end - mstrip->start; if (IS_EQF(nLen, oLen) == 0) scaleChanged = 1; - + /* for each child-strip, calculate new start/end points based on this new info */ for (strip = mstrip->strips.first; strip; strip = strip->next) { if (scaleChanged) { float p1, p2; - + /* compute positions of endpoints relative to old extents of strip */ p1 = (strip->start - oStart) / oLen; p2 = (strip->end - oStart) / oLen; - + /* apply new strip endpoints using the proportions, then wait for second pass to flush scale properly */ strip->start = (p1 * nLen) + mstrip->start; strip->end = (p2 * nLen) + mstrip->start; @@ -892,20 +892,20 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip) strip->end += offset; } } - + /* apply a second pass over child strips, to finish up unfinished business */ for (strip = mstrip->strips.first; strip; strip = strip->next) { /* only if scale changed, need to perform RNA updates */ if (scaleChanged) { PointerRNA ptr; - + /* use RNA updates to compute scale properly */ RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &ptr); - + RNA_float_set(&ptr, "frame_start", strip->start); RNA_float_set(&ptr, "frame_end", strip->end); } - + /* finally, make sure the strip's children (if it is a meta-itself), get updated */ BKE_nlameta_flush_transforms(strip); } @@ -917,17 +917,17 @@ void BKE_nlameta_flush_transforms(NlaStrip *mstrip) NlaTrack *BKE_nlatrack_find_active(ListBase *tracks) { NlaTrack *nlt; - + /* sanity check */ if (ELEM(NULL, tracks, tracks->first)) return NULL; - + /* try to find the first active track */ for (nlt = tracks->first; nlt; nlt = nlt->next) { if (nlt->flag & NLATRACK_ACTIVE) return nlt; } - + /* none found */ return NULL; } @@ -940,11 +940,11 @@ NlaTrack *BKE_nlatrack_find_active(ListBase *tracks) NlaTrack *BKE_nlatrack_find_tweaked(AnimData *adt) { NlaTrack *nlt; - + /* sanity check */ if (adt == NULL) return NULL; - + /* Since the track itself gets disabled, we want the first disabled... */ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) { if (nlt->flag & (NLATRACK_ACTIVE | NLATRACK_DISABLED)) { @@ -954,13 +954,13 @@ NlaTrack *BKE_nlatrack_find_tweaked(AnimData *adt) } else if (G.debug & G_DEBUG) { printf("%s: Active strip (%p, %s) not in NLA track found (%p, %s)\n", - __func__, + __func__, adt->actstrip, (adt->actstrip) ? adt->actstrip->name : "<None>", nlt, nlt->name); } } } - + /* Not found! */ return NULL; } @@ -971,22 +971,22 @@ NlaTrack *BKE_nlatrack_find_tweaked(AnimData *adt) void BKE_nlatrack_solo_toggle(AnimData *adt, NlaTrack *nlt) { NlaTrack *nt; - + /* sanity check */ if (ELEM(NULL, adt, adt->nla_tracks.first)) return; - + /* firstly, make sure 'solo' flag for all tracks is disabled */ for (nt = adt->nla_tracks.first; nt; nt = nt->next) { if (nt != nlt) nt->flag &= ~NLATRACK_SOLO; } - + /* now, enable 'solo' for the given track if appropriate */ if (nlt) { /* toggle solo status */ nlt->flag ^= NLATRACK_SOLO; - + /* set or clear solo-status on AnimData */ if (nlt->flag & NLATRACK_SOLO) adt->flag |= ADT_NLA_SOLO_TRACK; @@ -997,21 +997,21 @@ void BKE_nlatrack_solo_toggle(AnimData *adt, NlaTrack *nlt) adt->flag &= ~ADT_NLA_SOLO_TRACK; } -/* Make the given NLA-track the active one for the given stack. If no track is provided, +/* Make the given NLA-track the active one for the given stack. If no track is provided, * this function can be used to simply deactivate all the NLA tracks in the given stack too. */ void BKE_nlatrack_set_active(ListBase *tracks, NlaTrack *nlt_a) { NlaTrack *nlt; - + /* sanity check */ if (ELEM(NULL, tracks, tracks->first)) return; - + /* deactive all the rest */ for (nlt = tracks->first; nlt; nlt = nlt->next) nlt->flag &= ~NLATRACK_ACTIVE; - + /* set the given one as the active one */ if (nlt_a) nlt_a->flag |= NLATRACK_ACTIVE; @@ -1020,24 +1020,24 @@ void BKE_nlatrack_set_active(ListBase *tracks, NlaTrack *nlt_a) /* Check if there is any space in the given track to add a strip of the given length */ bool BKE_nlatrack_has_space(NlaTrack *nlt, float start, float end) { - /* sanity checks + /* sanity checks * - track must exist * - track must be editable * - bounds cannot be equal (0-length is nasty) */ if ((nlt == NULL) || (nlt->flag & NLATRACK_PROTECTED) || IS_EQF(start, end)) return false; - + if (start > end) { puts("BKE_nlatrack_has_space() error... start and end arguments swapped"); SWAP(float, start, end); } - + /* check if there's any space left in the track for a strip of the given length */ return BKE_nlastrips_has_space(&nlt->strips, start, end); } -/* Rearrange the strips in the track so that they are always in order +/* Rearrange the strips in the track so that they are always in order * (usually only needed after a strip has been moved) */ void BKE_nlatrack_sort_strips(NlaTrack *nlt) @@ -1045,12 +1045,12 @@ void BKE_nlatrack_sort_strips(NlaTrack *nlt) /* sanity checks */ if (ELEM(NULL, nlt, nlt->strips.first)) return; - + /* sort the strips with a more generic function */ BKE_nlastrips_sort_strips(&nlt->strips); } -/* Add the given NLA-Strip to the given NLA-Track, assuming that it +/* Add the given NLA-Strip to the given NLA-Track, assuming that it * isn't currently attached to another one */ bool BKE_nlatrack_add_strip(NlaTrack *nlt, NlaStrip *strip) @@ -1058,11 +1058,11 @@ bool BKE_nlatrack_add_strip(NlaTrack *nlt, NlaStrip *strip) /* sanity checks */ if (ELEM(NULL, nlt, strip)) return false; - + /* do not allow adding strips if this track is locked */ if (nlt->flag & NLATRACK_PROTECTED) return false; - + /* try to add the strip to the track using a more generic function */ return BKE_nlastrips_add_strip(&nlt->strips, strip); } @@ -1073,25 +1073,25 @@ bool BKE_nlatrack_add_strip(NlaTrack *nlt, NlaStrip *strip) bool BKE_nlatrack_get_bounds(NlaTrack *nlt, float bounds[2]) { NlaStrip *strip; - + /* initialize bounds */ if (bounds) bounds[0] = bounds[1] = 0.0f; else return false; - + /* sanity checks */ if (ELEM(NULL, nlt, nlt->strips.first)) return false; - + /* lower bound is first strip's start frame */ strip = nlt->strips.first; bounds[0] = strip->start; - + /* upper bound is last strip's end frame */ strip = nlt->strips.last; bounds[1] = strip->end; - + /* done */ return true; } @@ -1102,17 +1102,17 @@ bool BKE_nlatrack_get_bounds(NlaTrack *nlt, float bounds[2]) NlaStrip *BKE_nlastrip_find_active(NlaTrack *nlt) { NlaStrip *strip; - + /* sanity check */ if (ELEM(NULL, nlt, nlt->strips.first)) return NULL; - + /* try to find the first active strip */ for (strip = nlt->strips.first; strip; strip = strip->next) { if (strip->flag & NLASTRIP_FLAG_ACTIVE) return strip; } - + /* none found */ return NULL; } @@ -1122,11 +1122,11 @@ void BKE_nlastrip_set_active(AnimData *adt, NlaStrip *strip) { NlaTrack *nlt; NlaStrip *nls; - + /* sanity checks */ if (adt == NULL) return; - + /* loop over tracks, deactivating*/ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) { for (nls = nlt->strips.first; nls; nls = nls->next) { @@ -1144,11 +1144,11 @@ bool BKE_nlastrip_within_bounds(NlaStrip *strip, float min, float max) { const float stripLen = (strip) ? strip->end - strip->start : 0.0f; const float boundsLen = fabsf(max - min); - + /* sanity checks */ if ((strip == NULL) || IS_EQF(stripLen, 0.0f) || IS_EQF(boundsLen, 0.0f)) return false; - + /* only ok if at least part of the strip is within the bounding window * - first 2 cases cover when the strip length is less than the bounding area * - second 2 cases cover when the strip length is greater than the bounding area @@ -1165,7 +1165,7 @@ bool BKE_nlastrip_within_bounds(NlaStrip *strip, float min, float max) { return false; } - + /* should be ok! */ return true; } @@ -1178,7 +1178,7 @@ static void nlastrip_fix_resize_overlaps(NlaStrip *strip) if (strip->next) { NlaStrip *nls = strip->next; float offset = 0.0f; - + if (nls->type == NLASTRIP_TYPE_TRANSITION) { /* transition strips should grow/shrink to accomodate the resized strip, * but if the strip's bounds now exceed the transition, we're forced to @@ -1198,7 +1198,7 @@ static void nlastrip_fix_resize_overlaps(NlaStrip *strip) */ nls->start = nls->end - 1.0f; offset = ceilf(strip->end - nls->start); /* XXX: review whether preventing fractionals is good here... */ - + /* apply necessary offset to ensure that the strip has enough space */ for (; nls; nls = nls->next) { nls->start += offset; @@ -1211,7 +1211,7 @@ static void nlastrip_fix_resize_overlaps(NlaStrip *strip) * otherwise it will be very hard to get rid of later */ offset = ceilf(strip->end - nls->start); - + /* apply to times of all strips in this direction */ for (; nls; nls = nls->next) { nls->start += offset; @@ -1219,13 +1219,13 @@ static void nlastrip_fix_resize_overlaps(NlaStrip *strip) } } } - + /* previous strips - same routine as before */ /* NOTE: when strip bounds are recalculated, this is not considered! */ if (strip->prev) { NlaStrip *nls = strip->prev; float offset = 0.0f; - + if (nls->type == NLASTRIP_TYPE_TRANSITION) { /* transition strips should grow/shrink to accomodate the resized strip, * but if the strip's bounds now exceed the transition, we're forced to @@ -1245,7 +1245,7 @@ static void nlastrip_fix_resize_overlaps(NlaStrip *strip) */ nls->end = nls->start + 1.0f; offset = ceilf(nls->end - strip->start); /* XXX: review whether preventing fractionals is good here... */ - + /* apply necessary offset to ensure that the strip has enough space */ for (; nls; nls = nls->next) { nls->start -= offset; @@ -1258,7 +1258,7 @@ static void nlastrip_fix_resize_overlaps(NlaStrip *strip) * otherwise it will be very hard to get rid of later */ offset = ceilf(nls->end - strip->start); - + /* apply to times of all strips in this direction */ for (; nls; nls = nls->prev) { nls->start -= offset; @@ -1274,24 +1274,24 @@ static void nlastrip_fix_resize_overlaps(NlaStrip *strip) void BKE_nlastrip_recalculate_bounds(NlaStrip *strip) { float actlen, mapping; - + /* sanity checks * - must have a strip * - can only be done for action clips */ if ((strip == NULL) || (strip->type != NLASTRIP_TYPE_CLIP)) return; - + /* calculate new length factors */ actlen = strip->actend - strip->actstart; if (IS_EQF(actlen, 0.0f)) actlen = 1.0f; - + mapping = strip->scale * strip->repeat; - + /* adjust endpoint of strip in response to this */ if (IS_EQF(mapping, 0.0f) == 0) strip->end = (actlen * mapping) + strip->start; - + /* make sure we don't overlap our neighbors */ nlastrip_fix_resize_overlaps(strip); } @@ -1302,15 +1302,15 @@ static bool nlastrip_is_first(AnimData *adt, NlaStrip *strip) { NlaTrack *nlt; NlaStrip *ns; - + /* sanity checks */ if (ELEM(NULL, adt, strip)) return false; - + /* check if strip has any strips before it */ if (strip->prev) return false; - + /* check other tracks to see if they have a strip that's earlier */ /* TODO: or should we check that the strip's track is also the first? */ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) { @@ -1321,7 +1321,7 @@ static bool nlastrip_is_first(AnimData *adt, NlaStrip *strip) return false; } } - + /* should be first now */ return true; } @@ -1332,17 +1332,17 @@ static bool nlastrip_is_first(AnimData *adt, NlaStrip *strip) bool BKE_nlatrack_has_animated_strips(NlaTrack *nlt) { NlaStrip *strip; - + /* sanity checks */ if (ELEM(NULL, nlt, nlt->strips.first)) return false; - + /* check each strip for F-Curves only (don't care about whether the flags are set) */ for (strip = nlt->strips.first; strip; strip = strip->next) { if (strip->fcurves.first) return true; } - + /* none found */ return false; } @@ -1351,17 +1351,17 @@ bool BKE_nlatrack_has_animated_strips(NlaTrack *nlt) bool BKE_nlatracks_have_animated_strips(ListBase *tracks) { NlaTrack *nlt; - + /* sanity checks */ if (ELEM(NULL, tracks, tracks->first)) return false; - + /* check each track, stopping on the first hit */ for (nlt = tracks->first; nlt; nlt = nlt->next) { if (BKE_nlatrack_has_animated_strips(nlt)) return true; } - + /* none found */ return false; } @@ -1370,56 +1370,56 @@ bool BKE_nlatracks_have_animated_strips(ListBase *tracks) void BKE_nlastrip_validate_fcurves(NlaStrip *strip) { FCurve *fcu; - + /* sanity checks */ if (strip == NULL) return; - + /* if controlling influence... */ if (strip->flag & NLASTRIP_FLAG_USR_INFLUENCE) { /* try to get F-Curve */ fcu = list_find_fcurve(&strip->fcurves, "influence", 0); - + /* add one if not found */ if (fcu == NULL) { /* make new F-Curve */ fcu = MEM_callocN(sizeof(FCurve), "NlaStrip FCurve"); BLI_addtail(&strip->fcurves, fcu); - + /* set default flags */ fcu->flag = (FCURVE_VISIBLE | FCURVE_SELECTED); fcu->auto_smoothing = FCURVE_SMOOTH_CONT_ACCEL; - + /* store path - make copy, and store that */ fcu->rna_path = BLI_strdupn("influence", 9); - + /* insert keyframe to ensure current value stays on first refresh */ fcu->bezt = MEM_callocN(sizeof(BezTriple), "nlastrip influence bezt"); fcu->totvert = 1; - + fcu->bezt->vec[1][0] = strip->start; fcu->bezt->vec[1][1] = strip->influence; } } - + /* if controlling time... */ if (strip->flag & NLASTRIP_FLAG_USR_TIME) { /* try to get F-Curve */ fcu = list_find_fcurve(&strip->fcurves, "strip_time", 0); - + /* add one if not found */ if (fcu == NULL) { /* make new F-Curve */ fcu = MEM_callocN(sizeof(FCurve), "NlaStrip FCurve"); BLI_addtail(&strip->fcurves, fcu); - + /* set default flags */ fcu->flag = (FCURVE_VISIBLE | FCURVE_SELECTED); fcu->auto_smoothing = FCURVE_SMOOTH_CONT_ACCEL; - + /* store path - make copy, and store that */ fcu->rna_path = BLI_strdupn("strip_time", 10); - + /* TODO: insert a few keyframes to ensure default behavior? */ } } @@ -1433,28 +1433,28 @@ bool BKE_nlastrip_has_curves_for_property(const PointerRNA *ptr, const PropertyR /* sanity checks */ if (ELEM(NULL, ptr, prop)) return false; - + /* 1) Must be NLA strip */ if (ptr->type == &RNA_NlaStrip) { /* 2) Must be one of the predefined properties */ - static PropertyRNA *prop_influence = NULL; + static PropertyRNA *prop_influence = NULL; static PropertyRNA *prop_time = NULL; static bool needs_init = true; - + /* Init the properties on first use */ if (needs_init) { prop_influence = RNA_struct_type_find_property(&RNA_NlaStrip, "influence"); prop_time = RNA_struct_type_find_property(&RNA_NlaStrip, "strip_time"); - + needs_init = false; } - + /* Check if match */ if (ELEM(prop, prop_influence, prop_time)) { return true; } } - + /* No criteria met */ return false; } @@ -1466,7 +1466,7 @@ static bool nla_editbone_name_check(void *arg, const char *name) return BLI_ghash_haskey((GHash *)arg, (const void *)name); } -/* Find (and set) a unique name for a strip from the whole AnimData block +/* Find (and set) a unique name for a strip from the whole AnimData block * Uses a similar method to the BLI method, but is implemented differently * as we need to ensure that the name is unique over several lists of tracks, * not just a single track. @@ -1476,11 +1476,11 @@ void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip) GHash *gh; NlaStrip *tstrip; NlaTrack *nlt; - + /* sanity checks */ if (ELEM(NULL, adt, strip)) return; - + /* give strip a default name if none already */ if (strip->name[0] == 0) { switch (strip->type) { @@ -1498,25 +1498,25 @@ void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip) break; } } - - /* build a hash-table of all the strips in the tracks + + /* build a hash-table of all the strips in the tracks * - this is easier than iterating over all the tracks+strips hierarchy every time * (and probably faster) */ gh = BLI_ghash_str_new("nlastrip_validate_name gh"); - + for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) { for (tstrip = nlt->strips.first; tstrip; tstrip = tstrip->next) { /* don't add the strip of interest */ - if (tstrip == strip) + if (tstrip == strip) continue; - + /* use the name of the strip as the key, and the strip as the value, since we're mostly interested in the keys */ BLI_ghash_insert(gh, tstrip->name, tstrip); } } - - /* if the hash-table has a match for this name, try other names... + + /* if the hash-table has a match for this name, try other names... * - in an extreme case, it might not be able to find a name, but then everything else in Blender would fail too :) */ BLI_uniquename_cb(nla_editbone_name_check, (void *)gh, DATA_("NlaStrip"), '.', strip->name, sizeof(strip->name)); @@ -1527,7 +1527,7 @@ void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip) /* ---- */ -/* Get strips which overlap the given one at the start/end of its range +/* Get strips which overlap the given one at the start/end of its range * - strip: strip that we're finding overlaps for * - track: nla-track that the overlapping strips should be found from * - start, end: frames for the offending endpoints @@ -1535,9 +1535,9 @@ void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip) static void nlastrip_get_endpoint_overlaps(NlaStrip *strip, NlaTrack *track, float **start, float **end) { NlaStrip *nls; - + /* find strips that overlap over the start/end of the given strip, - * but which don't cover the entire length + * but which don't cover the entire length */ /* TODO: this scheme could get quite slow for doing this on many strips... */ for (nls = track->strips.first; nls; nls = nls->next) { @@ -1547,13 +1547,13 @@ static void nlastrip_get_endpoint_overlaps(NlaStrip *strip, NlaTrack *track, flo *end = NULL; return; } - + /* check if strip doesn't even occur anywhere near... */ if (nls->end < strip->start) continue; /* skip checking this strip... not worthy of mention */ if (nls->start > strip->end) return; /* the range we're after has already passed */ - + /* if this strip is not part of an island of continuous strips, it can be used * - this check needs to be done for each end of the strip we try and use... */ @@ -1573,7 +1573,7 @@ static void BKE_nlastrip_validate_autoblends(NlaTrack *nlt, NlaStrip *nls) { float *ps = NULL, *pe = NULL; float *ns = NULL, *ne = NULL; - + /* sanity checks */ if (ELEM(NULL, nls, nlt)) return; @@ -1581,16 +1581,16 @@ static void BKE_nlastrip_validate_autoblends(NlaTrack *nlt, NlaStrip *nls) return; if ((nls->flag & NLASTRIP_FLAG_AUTO_BLENDS) == 0) return; - + /* get test ranges */ if (nlt->prev) nlastrip_get_endpoint_overlaps(nls, nlt->prev, &ps, &pe); if (nlt->next) nlastrip_get_endpoint_overlaps(nls, nlt->next, &ns, &ne); - - /* set overlaps for this strip - * - don't use the values obtained though if the end in question - * is directly followed/preceded by another strip, forming an + + /* set overlaps for this strip + * - don't use the values obtained though if the end in question + * is directly followed/preceded by another strip, forming an * 'island' of continuous strips */ if ((ps || ns) && ((nls->prev == NULL) || IS_EQF(nls->prev->end, nls->start) == 0)) { @@ -1602,7 +1602,7 @@ static void BKE_nlastrip_validate_autoblends(NlaTrack *nlt, NlaStrip *nls) } else /* no overlap allowed/needed */ nls->blendin = 0.0f; - + if ((pe || ne) && ((nls->next == NULL) || IS_EQF(nls->next->start, nls->end) == 0)) { /* end overlaps - pick the largest overlap */ if ( ((pe && ne) && (*pe > *ne)) || (pe) ) @@ -1619,33 +1619,33 @@ void BKE_nla_validate_state(AnimData *adt) { NlaStrip *strip, *fstrip = NULL; NlaTrack *nlt; - + /* sanity checks */ if (ELEM(NULL, adt, adt->nla_tracks.first)) return; - + /* adjust blending values for auto-blending, and also do an initial pass to find the earliest strip */ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) { for (strip = nlt->strips.first; strip; strip = strip->next) { /* auto-blending first */ BKE_nlastrip_validate_autoblends(nlt, strip); - + /* extend mode - find first strip */ if ((fstrip == NULL) || (strip->start < fstrip->start)) fstrip = strip; } } - + /* second pass over the strips to adjust the extend-mode to fix any problems */ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) { for (strip = nlt->strips.first; strip; strip = strip->next) { - /* apart from 'nothing' option which user has to explicitly choose, we don't really know if + /* apart from 'nothing' option which user has to explicitly choose, we don't really know if * we should be overwriting the extend setting (but assume that's what the user wanted) */ /* TODO: 1 solution is to tie this in with auto-blending... */ if (strip->extendmode != NLASTRIP_EXTEND_NOTHING) { /* 1) First strip must be set to extend hold, otherwise, stuff before acts dodgy - * 2) Only overwrite extend mode if *not* changing it will most probably result in + * 2) Only overwrite extend mode if *not* changing it will most probably result in * occlusion problems, which will occur if... * - blendmode = REPLACE * - all channels the same (this is fiddly to test, so is currently assumed) @@ -1676,7 +1676,7 @@ bool BKE_nla_action_is_stashed(AnimData *adt, bAction *act) { NlaTrack *nlt; NlaStrip *strip; - + for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) { if (strstr(nlt->name, STASH_TRACK_NAME)) { for (strip = nlt->strips.first; strip; strip = strip->next) { @@ -1685,7 +1685,7 @@ bool BKE_nla_action_is_stashed(AnimData *adt, bAction *act) } } } - + return false; } @@ -1697,60 +1697,60 @@ bool BKE_nla_action_stash(AnimData *adt) NlaTrack *prev_track = NULL; NlaTrack *nlt; NlaStrip *strip; - + /* sanity check */ if (ELEM(NULL, adt, adt->action)) { printf("%s: Invalid argument - %p %p\n", __func__, adt, adt->action); return false; } - + /* do not add if it is already stashed */ if (BKE_nla_action_is_stashed(adt, adt->action)) return false; - + /* create a new track, and add this immediately above the previous stashing track */ for (prev_track = adt->nla_tracks.last; prev_track; prev_track = prev_track->prev) { if (strstr(prev_track->name, STASH_TRACK_NAME)) { break; } } - + nlt = BKE_nlatrack_add(adt, prev_track); BLI_assert(nlt != NULL); - + /* we need to ensure that if there wasn't any previous instance, it must go to tbe bottom of the stack */ if (prev_track == NULL) { BLI_remlink(&adt->nla_tracks, nlt); BLI_addhead(&adt->nla_tracks, nlt); } - + BLI_strncpy(nlt->name, STASH_TRACK_NAME, sizeof(nlt->name)); BLI_uniquename(&adt->nla_tracks, nlt, STASH_TRACK_NAME, '.', offsetof(NlaTrack, name), sizeof(nlt->name)); - + /* add the action as a strip in this new track * NOTE: a new user is created here */ strip = BKE_nlastrip_new(adt->action); BLI_assert(strip != NULL); - + BKE_nlatrack_add_strip(nlt, strip); BKE_nlastrip_validate_name(adt, strip); - + /* mark the stash track and strip so that they doesn't disturb the stack animation, * and are unlikely to draw attention to itself (or be accidentally bumped around) - * + * * NOTE: this must be done *after* adding the strip to the track, or else * the strip locking will prevent the strip from getting added */ nlt->flag = (NLATRACK_MUTED | NLATRACK_PROTECTED); strip->flag &= ~(NLASTRIP_FLAG_SELECT | NLASTRIP_FLAG_ACTIVE); - + /* also mark the strip for auto syncing the length, so that the strips accurately * reflect the length of the action * XXX: we could do with some extra flags here to prevent repeats/scaling options from working! */ strip->flag |= NLASTRIP_FLAG_SYNC_LENGTH; - + /* succeeded */ return true; } @@ -1767,7 +1767,7 @@ void BKE_nla_action_pushdown(AnimData *adt) { NlaStrip *strip; const bool is_first = (adt) && (adt->nla_tracks.first == NULL); - + /* sanity checks */ /* TODO: need to report the error for this */ if (ELEM(NULL, adt, adt->action)) @@ -1781,16 +1781,16 @@ void BKE_nla_action_pushdown(AnimData *adt) printf("BKE_nla_action_pushdown(): action has no data\n"); return; } - + /* add a new NLA strip to the track, which references the active action */ strip = BKE_nlastack_add_strip(adt, adt->action); - + /* do other necessary work on strip */ if (strip) { /* clear reference to action now that we've pushed it onto the stack */ id_us_min(&adt->action->id); adt->action = NULL; - + /* copy current "action blending" settings from adt to the strip, * as it was keyframed with these settings, so omitting them will * change the effect [T54233] @@ -1801,7 +1801,7 @@ void BKE_nla_action_pushdown(AnimData *adt) strip->blendmode = adt->act_blendmode; strip->influence = adt->act_influence; strip->extendmode = adt->act_extendmode; - + if (adt->act_influence < 1.0f) { /* enable "user-controlled" influence (which will insert a default keyframe) * so that the influence doesn't get lost on the new update @@ -1816,7 +1816,7 @@ void BKE_nla_action_pushdown(AnimData *adt) BKE_nlastrip_validate_fcurves(strip); } } - + /* if the strip is the first one in the track it lives in, check if there * are strips in any other tracks that may be before this, and set the extend * mode accordingly @@ -1829,7 +1829,7 @@ void BKE_nla_action_pushdown(AnimData *adt) if (strip->extendmode == NLASTRIP_EXTEND_HOLD) strip->extendmode = NLASTRIP_EXTEND_HOLD_FORWARD; } - + /* make strip the active one... */ BKE_nlastrip_set_active(adt, strip); } @@ -1842,17 +1842,17 @@ bool BKE_nla_tweakmode_enter(AnimData *adt) { NlaTrack *nlt, *activeTrack = NULL; NlaStrip *strip, *activeStrip = NULL; - + /* verify that data is valid */ if (ELEM(NULL, adt, adt->nla_tracks.first)) return false; - - /* if block is already in tweakmode, just leave, but we should report + + /* if block is already in tweakmode, just leave, but we should report * that this block is in tweakmode (as our returncode) */ if (adt->flag & ADT_NLA_EDIT_ON) return true; - + /* go over the tracks, finding the active one, and its active strip * - if we cannot find both, then there's nothing to do */ @@ -1861,16 +1861,16 @@ bool BKE_nla_tweakmode_enter(AnimData *adt) if (nlt->flag & NLATRACK_ACTIVE) { /* store reference to this active track */ activeTrack = nlt; - + /* now try to find active strip */ activeStrip = BKE_nlastrip_find_active(nlt); break; } } - - /* There are situations where we may have multiple strips selected and we want to enter tweakmode on all - * of those at once. Usually in those cases, it will usually just be a single strip per AnimData. - * In such cases, compromise and take the last selected track and/or last selected strip [#28468] + + /* There are situations where we may have multiple strips selected and we want to enter tweakmode on all + * of those at once. Usually in those cases, it will usually just be a single strip per AnimData. + * In such cases, compromise and take the last selected track and/or last selected strip [#28468] */ if (activeTrack == NULL) { /* try last selected track for active strip */ @@ -1878,7 +1878,7 @@ bool BKE_nla_tweakmode_enter(AnimData *adt) if (nlt->flag & NLATRACK_SELECTED) { /* assume this is the active track */ activeTrack = nlt; - + /* try to find active strip */ activeStrip = BKE_nlastrip_find_active(nlt); break; @@ -1894,7 +1894,7 @@ bool BKE_nla_tweakmode_enter(AnimData *adt) } } } - + if (ELEM(NULL, activeTrack, activeStrip, activeStrip->act)) { if (G.debug & G_DEBUG) { printf("NLA tweakmode enter - neither active requirement found\n"); @@ -1902,8 +1902,8 @@ bool BKE_nla_tweakmode_enter(AnimData *adt) } return false; } - - /* go over all the tracks up to the active one, tagging each strip that uses the same + + /* go over all the tracks up to the active one, tagging each strip that uses the same * action as the active strip, but leaving everything else alone */ for (nlt = activeTrack->prev; nlt; nlt = nlt->prev) { @@ -1914,7 +1914,7 @@ bool BKE_nla_tweakmode_enter(AnimData *adt) strip->flag &= ~NLASTRIP_FLAG_TWEAKUSER; } } - + /* tag all other strips in active track that uses the same action as the active strip */ for (strip = activeTrack->strips.first; strip; strip = strip->next) { if ((strip->act == activeStrip->act) && (strip != activeStrip)) @@ -1922,13 +1922,13 @@ bool BKE_nla_tweakmode_enter(AnimData *adt) else strip->flag &= ~NLASTRIP_FLAG_TWEAKUSER; } - - /* go over all the tracks after AND INCLUDING the active one, tagging them as being disabled + + /* go over all the tracks after AND INCLUDING the active one, tagging them as being disabled * - the active track needs to also be tagged, otherwise, it'll overlap with the tweaks going on */ for (nlt = activeTrack; nlt; nlt = nlt->next) nlt->flag |= NLATRACK_DISABLED; - + /* handle AnimData level changes: * - 'real' active action to temp storage (no need to change user-counts) * - action of active strip set to be the 'active action', and have its usercount incremented @@ -1941,7 +1941,7 @@ bool BKE_nla_tweakmode_enter(AnimData *adt) adt->actstrip = activeStrip; id_us_plus(&activeStrip->act->id); adt->flag |= ADT_NLA_EDIT_ON; - + /* done! */ return true; } @@ -1951,27 +1951,27 @@ void BKE_nla_tweakmode_exit(AnimData *adt) { NlaStrip *strip; NlaTrack *nlt; - + /* verify that data is valid */ if (ELEM(NULL, adt, adt->nla_tracks.first)) return; - + /* hopefully the flag is correct - skip if not on */ if ((adt->flag & ADT_NLA_EDIT_ON) == 0) return; - + /* sync the length of the user-strip with the new state of the action * but only if the user has explicitly asked for this to happen * (see [#34645] for things to be careful about) */ if ((adt->actstrip) && (adt->actstrip->flag & NLASTRIP_FLAG_SYNC_LENGTH)) { strip = adt->actstrip; - + /* must be action-clip only (transitions don't have scale) */ if ((strip->type == NLASTRIP_TYPE_CLIP) && (strip->act)) { /* recalculate the length of the action */ calc_action_range(strip->act, &strip->actstart, &strip->actend, 0); - + /* adjust the strip extents in response to this */ BKE_nlastrip_recalculate_bounds(strip); } @@ -1982,22 +1982,22 @@ void BKE_nla_tweakmode_exit(AnimData *adt) */ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) { nlt->flag &= ~NLATRACK_DISABLED; - + for (strip = nlt->strips.first; strip; strip = strip->next) { /* sync strip extents if this strip uses the same action */ if ((adt->actstrip) && (adt->actstrip->act == strip->act) && (strip->flag & NLASTRIP_FLAG_SYNC_LENGTH)) { /* recalculate the length of the action */ calc_action_range(strip->act, &strip->actstart, &strip->actend, 0); - + /* adjust the strip extents in response to this */ BKE_nlastrip_recalculate_bounds(strip); } - + /* clear tweakuser flag */ strip->flag &= ~NLASTRIP_FLAG_TWEAKUSER; } } - + /* handle AnimData level changes: * - 'temporary' active action needs its usercount decreased, since we're removing this reference * - 'real' active action is restored from storage @@ -2019,23 +2019,23 @@ void BKE_nla_tweakmode_exit(AnimData *adt) static void UNUSED_FUNCTION(BKE_nla_bake) (Scene *scene, ID *UNUSED(id), AnimData *adt, int UNUSED(flag)) { - /* verify that data is valid - * 1) Scene and AnimData must be provided + /* verify that data is valid + * 1) Scene and AnimData must be provided * 2) there must be tracks to merge... */ if (ELEM(NULL, scene, adt, adt->nla_tracks.first)) return; - + /* if animdata currently has an action, 'push down' this onto the stack first */ if (adt->action) BKE_nla_action_pushdown(adt); - + /* get range of motion to bake, and the channels involved... */ - + /* temporarily mute the action, and start keying to it */ - + /* start keying... */ - + /* unmute the action */ } diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 72a34d35715..6695d145a9a 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -94,7 +94,7 @@ static void node_add_sockets_from_type(bNodeTree *ntree, bNode *node, bNodeType sockdef = ntype->inputs; while (sockdef->type != -1) { /* sock = */ node_add_socket_from_template(ntree, node, sockdef, SOCK_IN); - + sockdef++; } } @@ -102,7 +102,7 @@ static void node_add_sockets_from_type(bNodeTree *ntree, bNode *node, bNodeType sockdef = ntype->outputs; while (sockdef->type != -1) { /* sock = */ node_add_socket_from_template(ntree, node, sockdef, SOCK_OUT); - + sockdef++; } } @@ -117,11 +117,11 @@ static void node_init(const struct bContext *C, bNodeTree *ntree, bNode *node) bNodeType *ntype = node->typeinfo; if (ntype == &NodeTypeUndefined) return; - + /* only do this once */ if (node->flag & NODE_INIT) return; - + node->flag = NODE_SELECT | NODE_OPTIONS | ntype->flag; node->width = ntype->width; node->miniwidth = 42.0f; @@ -136,7 +136,7 @@ static void node_init(const struct bContext *C, bNodeTree *ntree, bNode *node) * than adding "do_translate" flags to this func (and labelfunc() as well). */ BLI_strncpy(node->name, DATA_(ntype->ui_name), NODE_MAXSTR); nodeUniqueName(ntree, node); - + node_add_sockets_from_type(ntree, node, ntype); if (ntype->initfunc != NULL) @@ -149,17 +149,17 @@ static void node_init(const struct bContext *C, bNodeTree *ntree, bNode *node) if (ntype->initfunc_api) { PointerRNA ptr; RNA_pointer_create((ID *)ntree, &RNA_Node, node, &ptr); - + /* XXX Warning: context can be NULL in case nodes are added in do_versions. * Delayed init is not supported for nodes with context-based initfunc_api atm. */ BLI_assert(C != NULL); ntype->initfunc_api(C, &ptr); } - + if (node->id) id_us_plus(node->id); - + node->flag |= NODE_INIT; } @@ -167,13 +167,13 @@ static void ntree_set_typeinfo(bNodeTree *ntree, bNodeTreeType *typeinfo) { if (typeinfo) { ntree->typeinfo = typeinfo; - + /* deprecated integer type */ ntree->type = typeinfo->type; } else { ntree->typeinfo = &NodeTreeTypeUndefined; - + ntree->init &= ~NTREE_TYPE_INIT; } } @@ -185,19 +185,19 @@ static void node_set_typeinfo(const struct bContext *C, bNodeTree *ntree, bNode if (typeinfo && typeinfo->storagename[0] && !node->storage) typeinfo = NULL; } - + if (typeinfo) { node->typeinfo = typeinfo; - + /* deprecated integer type */ node->type = typeinfo->type; - + /* initialize the node if necessary */ node_init(C, ntree, node); } else { node->typeinfo = &NodeTypeUndefined; - + ntree->init &= ~NTREE_TYPE_INIT; } } @@ -206,10 +206,10 @@ static void node_socket_set_typeinfo(bNodeTree *ntree, bNodeSocket *sock, bNodeS { if (typeinfo) { sock->typeinfo = typeinfo; - + /* deprecated integer type */ sock->type = typeinfo->type; - + if (sock->default_value == NULL) { /* initialize the default_value pointer used by standard socket types */ node_socket_init_default_value(sock); @@ -217,7 +217,7 @@ static void node_socket_set_typeinfo(bNodeTree *ntree, bNodeSocket *sock, bNodeS } else { sock->typeinfo = &NodeSocketTypeUndefined; - + ntree->init &= ~NTREE_TYPE_INIT; } } @@ -227,21 +227,21 @@ static void update_typeinfo(Main *bmain, const struct bContext *C, bNodeTreeType { if (!bmain) return; - + FOREACH_NODETREE(bmain, ntree, id) { bNode *node; bNodeSocket *sock; - + ntree->init |= NTREE_TYPE_INIT; - + if (treetype && STREQ(ntree->idname, treetype->idname)) ntree_set_typeinfo(ntree, unregister ? NULL : treetype); - + /* initialize nodes */ for (node = ntree->nodes.first; node; node = node->next) { if (nodetype && STREQ(node->idname, nodetype->idname)) node_set_typeinfo(C, ntree, node, unregister ? NULL : nodetype); - + /* initialize node sockets */ for (sock = node->inputs.first; sock; sock = sock->next) if (socktype && STREQ(sock->idname, socktype->idname)) @@ -250,7 +250,7 @@ static void update_typeinfo(Main *bmain, const struct bContext *C, bNodeTreeType if (socktype && STREQ(sock->idname, socktype->idname)) node_socket_set_typeinfo(ntree, sock, unregister ? NULL : socktype); } - + /* initialize tree sockets */ for (sock = ntree->inputs.first; sock; sock = sock->next) if (socktype && STREQ(sock->idname, socktype->idname)) @@ -271,20 +271,20 @@ void ntreeSetTypes(const struct bContext *C, bNodeTree *ntree) { bNode *node; bNodeSocket *sock; - + ntree->init |= NTREE_TYPE_INIT; - + ntree_set_typeinfo(ntree, ntreeTypeFind(ntree->idname)); - + for (node = ntree->nodes.first; node; node = node->next) { node_set_typeinfo(C, ntree, node, nodeTypeFind(node->idname)); - + for (sock = node->inputs.first; sock; sock = sock->next) node_socket_set_typeinfo(ntree, sock, nodeSocketTypeFind(sock->idname)); for (sock = node->outputs.first; sock; sock = sock->next) node_socket_set_typeinfo(ntree, sock, nodeSocketTypeFind(sock->idname)); } - + for (sock = ntree->inputs.first; sock; sock = sock->next) node_socket_set_typeinfo(ntree, sock, nodeSocketTypeFind(sock->idname)); for (sock = ntree->outputs.first; sock; sock = sock->next) @@ -372,11 +372,11 @@ static void node_free_type(void *nodetype_v) bNodeType *nodetype = nodetype_v; /* XXX pass Main to unregister function? */ update_typeinfo(G.main, NULL, NULL, nodetype, NULL, true); - + /* XXX deprecated */ if (nodetype->type == NODE_DYNAMIC) free_dynamic_typeinfo(nodetype); - + if (nodetype->needs_free) MEM_freeN(nodetype); } @@ -386,7 +386,7 @@ void nodeRegisterType(bNodeType *nt) /* debug only: basic verification of registered types */ BLI_assert(nt->idname[0] != '\0'); BLI_assert(nt->poll != NULL); - + BLI_ghash_insert(nodetypes_hash, nt->idname, nt); /* XXX pass Main to register function? */ update_typeinfo(G.main, NULL, NULL, nt, NULL, false); @@ -426,7 +426,7 @@ static void node_free_socket_type(void *socktype_v) bNodeSocketType *socktype = socktype_v; /* XXX pass Main to unregister function? */ update_typeinfo(G.main, NULL, NULL, NULL, socktype, true); - + MEM_freeN(socktype); } @@ -479,7 +479,7 @@ static bNodeSocket *make_socket(bNodeTree *ntree, bNode *UNUSED(node), int in_ou { bNodeSocket *sock; char auto_identifier[MAX_NAME]; - + if (identifier && identifier[0] != '\0') { /* use explicit identifier */ BLI_strncpy(auto_identifier, identifier, sizeof(auto_identifier)); @@ -490,21 +490,21 @@ static bNodeSocket *make_socket(bNodeTree *ntree, bNode *UNUSED(node), int in_ou } /* make the identifier unique */ BLI_uniquename_cb(unique_identifier_check, lb, "socket", '.', auto_identifier, sizeof(auto_identifier)); - + sock = MEM_callocN(sizeof(bNodeSocket), "sock"); sock->in_out = in_out; - + BLI_strncpy(sock->identifier, auto_identifier, NODE_MAXSTR); sock->limit = (in_out == SOCK_IN ? 1 : 0xFFF); - + BLI_strncpy(sock->name, name, NODE_MAXSTR); sock->storage = NULL; sock->flag |= SOCK_COLLAPSED; sock->type = SOCK_CUSTOM; /* int type undefined by default */ - + BLI_strncpy(sock->idname, idname, sizeof(sock->idname)); node_socket_set_typeinfo(ntree, sock, nodeSocketTypeFind(idname)); - + return sock; } @@ -533,12 +533,12 @@ bNodeSocket *nodeAddSocket(bNodeTree *ntree, bNode *node, int in_out, const char { ListBase *lb = (in_out == SOCK_IN ? &node->inputs : &node->outputs); bNodeSocket *sock = make_socket(ntree, node, in_out, lb, idname, identifier, name); - + BLI_remlink(lb, sock); /* does nothing for new socket */ BLI_addtail(lb, sock); - + node->update |= NODE_UPDATE; - + return sock; } @@ -547,12 +547,12 @@ bNodeSocket *nodeInsertSocket(bNodeTree *ntree, bNode *node, int in_out, const c { ListBase *lb = (in_out == SOCK_IN ? &node->inputs : &node->outputs); bNodeSocket *sock = make_socket(ntree, node, in_out, lb, idname, identifier, name); - + BLI_remlink(lb, sock); /* does nothing for new socket */ BLI_insertlinkbefore(lb, next_sock, sock); - + node->update |= NODE_UPDATE; - + return sock; } @@ -683,12 +683,12 @@ bNodeSocket *nodeAddStaticSocket(bNodeTree *ntree, bNode *node, int in_out, int { const char *idname = nodeStaticSocketType(type, subtype); bNodeSocket *sock; - + if (!idname) { printf("Error: static node socket type %d undefined\n", type); return NULL; } - + sock = nodeAddSocket(ntree, node, in_out, idname, identifier, name); sock->type = type; return sock; @@ -699,12 +699,12 @@ bNodeSocket *nodeInsertStaticSocket(bNodeTree *ntree, bNode *node, int in_out, i { const char *idname = nodeStaticSocketType(type, subtype); bNodeSocket *sock; - + if (!idname) { printf("Error: static node socket type %d undefined\n", type); return NULL; } - + sock = nodeInsertSocket(ntree, node, in_out, idname, next_sock, identifier, name); sock->type = type; return sock; @@ -716,7 +716,7 @@ static void node_socket_free(bNodeTree *UNUSED(ntree), bNodeSocket *sock, bNode IDP_FreeProperty(sock->prop); MEM_freeN(sock->prop); } - + if (sock->default_value) MEM_freeN(sock->default_value); } @@ -724,21 +724,21 @@ static void node_socket_free(bNodeTree *UNUSED(ntree), bNodeSocket *sock, bNode void nodeRemoveSocket(bNodeTree *ntree, bNode *node, bNodeSocket *sock) { bNodeLink *link, *next; - + for (link = ntree->links.first; link; link = next) { next = link->next; if (link->fromsock == sock || link->tosock == sock) { nodeRemLink(ntree, link); } } - + /* this is fast, this way we don't need an in_out argument */ BLI_remlink(&node->inputs, sock); BLI_remlink(&node->outputs, sock); - + node_socket_free(ntree, sock, node); MEM_freeN(sock); - + node->update |= NODE_UPDATE; } @@ -746,14 +746,14 @@ void nodeRemoveAllSockets(bNodeTree *ntree, bNode *node) { bNodeSocket *sock, *sock_next; bNodeLink *link, *next; - + for (link = ntree->links.first; link; link = next) { next = link->next; if (link->fromnode == node || link->tonode == node) { nodeRemLink(ntree, link); } } - + for (sock = node->inputs.first; sock; sock = sock_next) { sock_next = sock->next; node_socket_free(ntree, sock, node); @@ -767,7 +767,7 @@ void nodeRemoveAllSockets(bNodeTree *ntree, bNode *node) MEM_freeN(sock); } BLI_listbase_clear(&node->outputs); - + node->update |= NODE_UPDATE; } @@ -784,7 +784,7 @@ int nodeFindNode(bNodeTree *ntree, bNodeSocket *sock, bNode **nodep, int *sockin bNode *node; bNodeSocket *tsock; int index = 0; - + for (node = ntree->nodes.first; node; node = node->next) { tsock = (in_out == SOCK_IN ? node->inputs.first : node->outputs.first); for (index = 0; tsock; tsock = tsock->next, index++) { @@ -800,7 +800,7 @@ int nodeFindNode(bNodeTree *ntree, bNodeSocket *sock, bNode **nodep, int *sockin if (sockindex) *sockindex = index; return 1; } - + *nodep = NULL; return 0; } @@ -892,22 +892,22 @@ void nodeUniqueName(bNodeTree *ntree, bNode *node) bNode *nodeAddNode(const struct bContext *C, bNodeTree *ntree, const char *idname) { bNode *node; - + node = MEM_callocN(sizeof(bNode), "new node"); BLI_addtail(&ntree->nodes, node); - + BLI_strncpy(node->idname, idname, sizeof(node->idname)); node_set_typeinfo(C, ntree, node, nodeTypeFind(idname)); - + ntree->update |= NTREE_UPDATE_NODES; - + return node; } bNode *nodeAddStaticNode(const struct bContext *C, bNodeTree *ntree, int type) { const char *idname = NULL; - + NODE_TYPES_BEGIN(ntype) /* do an extra poll here, because some int types are used * for multiple node types, this helps find the desired type @@ -1024,11 +1024,11 @@ bNode *nodeCopyNode(bNodeTree *ntree, bNode *node) bNodeLink *nodeAddLink(bNodeTree *ntree, bNode *fromnode, bNodeSocket *fromsock, bNode *tonode, bNodeSocket *tosock) { bNodeLink *link = NULL; - + /* test valid input */ BLI_assert(fromnode); BLI_assert(tonode); - + if (fromsock->in_out == SOCK_OUT && tosock->in_out == SOCK_IN) { link = MEM_callocN(sizeof(bNodeLink), "link"); if (ntree) @@ -1048,10 +1048,10 @@ bNodeLink *nodeAddLink(bNodeTree *ntree, bNode *fromnode, bNodeSocket *fromsock, link->tonode = fromnode; link->tosock = fromsock; } - + if (ntree) ntree->update |= NTREE_UPDATE_LINKS; - + return link; } @@ -1064,7 +1064,7 @@ void nodeRemLink(bNodeTree *ntree, bNodeLink *link) if (link->tosock) link->tosock->link = NULL; MEM_freeN(link); - + if (ntree) ntree->update |= NTREE_UPDATE_LINKS; } @@ -1072,14 +1072,14 @@ void nodeRemLink(bNodeTree *ntree, bNodeLink *link) void nodeRemSocketLinks(bNodeTree *ntree, bNodeSocket *sock) { bNodeLink *link, *next; - + for (link = ntree->links.first; link; link = next) { next = link->next; if (link->fromsock == sock || link->tosock == sock) { nodeRemLink(ntree, link); } } - + ntree->update |= NTREE_UPDATE_LINKS; } @@ -1091,15 +1091,15 @@ bool nodeLinkIsHidden(bNodeLink *link) void nodeInternalRelink(bNodeTree *ntree, bNode *node) { bNodeLink *link, *link_next; - + /* store link pointers in output sockets, for efficient lookup */ for (link = node->internal_links.first; link; link = link->next) link->tosock->link = link; - + /* redirect downstream links */ for (link = ntree->links.first; link; link = link_next) { link_next = link->next; - + /* do we have internal link? */ if (link->fromnode == node) { if (link->fromsock->link) { @@ -1109,13 +1109,13 @@ void nodeInternalRelink(bNodeTree *ntree, bNode *node) if (fromlink) { link->fromnode = fromlink->fromnode; link->fromsock = fromlink->fromsock; - + /* if the up- or downstream link is invalid, * the replacement link will be invalid too. */ if (!(fromlink->flag & NODE_LINK_VALID)) link->flag &= ~NODE_LINK_VALID; - + ntree->update |= NTREE_UPDATE_LINKS; } else @@ -1125,11 +1125,11 @@ void nodeInternalRelink(bNodeTree *ntree, bNode *node) nodeRemLink(ntree, link); } } - + /* remove remaining upstream links */ for (link = ntree->links.first; link; link = link_next) { link_next = link->next; - + if (link->tonode == node) nodeRemLink(ntree, link); } @@ -1179,7 +1179,7 @@ void nodeAttachNode(bNode *node, bNode *parent) BLI_assert(nodeAttachNodeCheck(parent, node) == false); nodeToView(node, 0.0f, 0.0f, &locx, &locy); - + node->parent = parent; /* transform to parent space */ nodeFromView(parent, locx, locy, &node->locx, &node->locy); @@ -1188,7 +1188,7 @@ void nodeAttachNode(bNode *node, bNode *parent) void nodeDetachNode(struct bNode *node) { float locx, locy; - + if (node->parent) { BLI_assert(node->parent->type == NODE_FRAME); @@ -1209,7 +1209,7 @@ void ntreeInitDefault(bNodeTree *ntree) bNodeTree *ntreeAddTree(Main *bmain, const char *name, const char *idname) { bNodeTree *ntree; - + /* trees are created as local trees for compositor, material or texture nodes, * node groups and other tree types are created as library data. */ @@ -1221,15 +1221,15 @@ bNodeTree *ntreeAddTree(Main *bmain, const char *name, const char *idname) *( (short *)ntree->id.name ) = ID_NT; BLI_strncpy(ntree->id.name + 2, name, sizeof(ntree->id.name)); } - + /* Types are fully initialized at this point, * if an undefined node is added later this will be reset. */ ntree->init |= NTREE_TYPE_INIT; - + BLI_strncpy(ntree->idname, idname, sizeof(ntree->idname)); ntree_set_typeinfo(ntree, ntreeTypeFind(idname)); - + return ntree; } @@ -1360,7 +1360,7 @@ int BKE_node_preview_used(bNode *node) bNodePreview *BKE_node_preview_verify(bNodeInstanceHash *previews, bNodeInstanceKey key, int xsize, int ysize, bool create) { bNodePreview *preview; - + preview = BKE_node_instance_hash_lookup(previews, key); if (!preview) { if (create) { @@ -1370,11 +1370,11 @@ bNodePreview *BKE_node_preview_verify(bNodeInstanceHash *previews, bNodeInstance else return NULL; } - + /* node previews can get added with variable size this way */ if (xsize == 0 || ysize == 0) return preview; - + /* sanity checks & initialize */ if (preview->rect) { if (preview->xsize != xsize || preview->ysize != ysize) { @@ -1382,14 +1382,14 @@ bNodePreview *BKE_node_preview_verify(bNodeInstanceHash *previews, bNodeInstance preview->rect = NULL; } } - + if (preview->rect == NULL) { preview->rect = MEM_callocN(4 * xsize + xsize * ysize * sizeof(char) * 4, "node preview rect"); preview->xsize = xsize; preview->ysize = ysize; } /* no clear, makes nicer previews */ - + return preview; } @@ -1413,14 +1413,14 @@ static void node_preview_init_tree_recursive(bNodeInstanceHash *previews, bNodeT bNode *node; for (node = ntree->nodes.first; node; node = node->next) { bNodeInstanceKey key = BKE_node_instance_key(parent_key, ntree, node); - + if (BKE_node_preview_used(node)) { node->preview_xsize = xsize; node->preview_ysize = ysize; - + BKE_node_preview_verify(previews, key, xsize, ysize, create); } - + if (node->type == NODE_GROUP && node->id) node_preview_init_tree_recursive(previews, (bNodeTree *)node->id, key, xsize, ysize, create); } @@ -1430,10 +1430,10 @@ void BKE_node_preview_init_tree(bNodeTree *ntree, int xsize, int ysize, int crea { if (!ntree) return; - + if (!ntree->previews) ntree->previews = BKE_node_instance_hash_new("node previews"); - + node_preview_init_tree_recursive(ntree->previews, ntree, NODE_INSTANCE_KEY_BASE, xsize, ysize, create_previews); } @@ -1442,10 +1442,10 @@ static void node_preview_tag_used_recursive(bNodeInstanceHash *previews, bNodeTr bNode *node; for (node = ntree->nodes.first; node; node = node->next) { bNodeInstanceKey key = BKE_node_instance_key(parent_key, ntree, node); - + if (BKE_node_preview_used(node)) BKE_node_instance_hash_tag_key(previews, key); - + if (node->type == NODE_GROUP && node->id) node_preview_tag_used_recursive(previews, (bNodeTree *)node->id, key); } @@ -1455,11 +1455,11 @@ void BKE_node_preview_remove_unused(bNodeTree *ntree) { if (!ntree || !ntree->previews) return; - + /* use the instance hash functions for tagging and removing unused previews */ BKE_node_instance_hash_clear_tags(ntree->previews); node_preview_tag_used_recursive(ntree->previews, ntree, NODE_INSTANCE_KEY_BASE); - + BKE_node_instance_hash_remove_untagged(ntree->previews, (bNodeInstanceValueFP)BKE_node_preview_free); } @@ -1467,7 +1467,7 @@ void BKE_node_preview_free_tree(bNodeTree *ntree) { if (!ntree) return; - + if (ntree->previews) { BKE_node_instance_hash_free(ntree->previews, (bNodeInstanceValueFP)BKE_node_preview_free); ntree->previews = NULL; @@ -1483,10 +1483,10 @@ void BKE_node_preview_clear(bNodePreview *preview) void BKE_node_preview_clear_tree(bNodeTree *ntree) { bNodeInstanceHashIterator iter; - + if (!ntree || !ntree->previews) return; - + NODE_INSTANCE_HASH_ITER(iter, ntree->previews) { bNodePreview *preview = BKE_node_instance_hash_iterator_get_value(&iter); BKE_node_preview_clear(preview); @@ -1497,7 +1497,7 @@ static void node_preview_sync(bNodePreview *to, bNodePreview *from) { /* sizes should have been initialized by BKE_node_preview_init_tree */ BLI_assert(to->xsize == from->xsize && to->ysize == from->ysize); - + /* copy over contents of previews */ if (to->rect && from->rect) { int xsize = to->xsize; @@ -1511,15 +1511,15 @@ void BKE_node_preview_sync_tree(bNodeTree *to_ntree, bNodeTree *from_ntree) bNodeInstanceHash *from_previews = from_ntree->previews; bNodeInstanceHash *to_previews = to_ntree->previews; bNodeInstanceHashIterator iter; - + if (!from_previews || !to_previews) return; - + NODE_INSTANCE_HASH_ITER(iter, from_previews) { bNodeInstanceKey key = BKE_node_instance_hash_iterator_get_key(&iter); bNodePreview *from = BKE_node_instance_hash_iterator_get_value(&iter); bNodePreview *to = BKE_node_instance_hash_lookup(to_previews, key); - + if (from && to) node_preview_sync(to, from); } @@ -1531,27 +1531,27 @@ void BKE_node_preview_merge_tree(bNodeTree *to_ntree, bNodeTree *from_ntree, boo /* free old previews */ if (to_ntree->previews) BKE_node_instance_hash_free(to_ntree->previews, (bNodeInstanceValueFP)BKE_node_preview_free); - + /* transfer previews */ to_ntree->previews = from_ntree->previews; from_ntree->previews = NULL; - + /* clean up, in case any to_ntree nodes have been removed */ BKE_node_preview_remove_unused(to_ntree); } else { bNodeInstanceHashIterator iter; - + if (from_ntree->previews) { NODE_INSTANCE_HASH_ITER(iter, from_ntree->previews) { bNodeInstanceKey key = BKE_node_instance_hash_iterator_get_key(&iter); bNodePreview *preview = BKE_node_instance_hash_iterator_get_value(&iter); - + /* replace existing previews */ BKE_node_instance_hash_remove(to_ntree->previews, key, (bNodeInstanceValueFP)BKE_node_preview_free); BKE_node_instance_hash_insert(to_ntree->previews, key, preview); } - + /* Note: NULL free function here, because pointers have already been moved over to to_ntree->previews! */ BKE_node_instance_hash_free(from_ntree->previews, NULL); from_ntree->previews = NULL; @@ -1559,7 +1559,7 @@ void BKE_node_preview_merge_tree(bNodeTree *to_ntree, bNodeTree *from_ntree, boo } } -/* hack warning! this function is only used for shader previews, and +/* hack warning! this function is only used for shader previews, and * since it gets called multiple times per pixel for Ztransp we only * add the color once. Preview gets cleared before it starts render though */ void BKE_node_preview_set_pixel(bNodePreview *preview, const float col[4], int x, int y, bool do_manage) @@ -1568,7 +1568,7 @@ void BKE_node_preview_set_pixel(bNodePreview *preview, const float col[4], int x if (x >= 0 && y >= 0) { if (x < preview->xsize && y < preview->ysize) { unsigned char *tar = preview->rect + 4 * ((preview->xsize * y) + x); - + if (do_manage) { linearrgb_to_srgb_uchar4(tar, col); } @@ -1593,10 +1593,10 @@ static void nodeClearPreview(bNode *node) void ntreeClearPreview(bNodeTree *ntree) { bNode *node; - + if (ntree == NULL) return; - + for (node = ntree->nodes.first; node; node = node->next) { if (node->typeinfo->flag & NODE_PREVIEW) nodeClearPreview(node); @@ -1605,7 +1605,7 @@ void ntreeClearPreview(bNodeTree *ntree) } } -/* hack warning! this function is only used for shader previews, and +/* hack warning! this function is only used for shader previews, and * since it gets called multiple times per pixel for Ztransp we only * add the color once. Preview gets cleared before it starts render though */ void nodeAddToPreview(bNode *node, const float col[4], int x, int y, int do_manage) @@ -1615,7 +1615,7 @@ void nodeAddToPreview(bNode *node, const float col[4], int x, int y, int do_mana if (x >= 0 && y >= 0) { if (x < preview->xsize && y < preview->ysize) { unsigned char *tar = preview->rect + 4 * ((preview->xsize * y) + x); - + if (do_manage) { linearrgb_to_srgb_uchar4(tar, col); } @@ -1638,10 +1638,10 @@ void nodeUnlinkNode(bNodeTree *ntree, bNode *node) bNodeLink *link, *next; bNodeSocket *sock; ListBase *lb; - + for (link = ntree->links.first; link; link = next) { next = link->next; - + if (link->fromnode == node) { lb = &node->outputs; if (link->tonode) @@ -1677,30 +1677,30 @@ static void node_unlink_attached(bNodeTree *ntree, bNode *parent) static void node_free_node_ex(bNodeTree *ntree, bNode *node, bool remove_animdata, bool use_api_free_cb) { bNodeSocket *sock, *nextsock; - + /* don't remove node animdata if the tree is localized, * Action is shared with the original tree (T38221) */ remove_animdata &= ntree && !(ntree->flag & NTREE_IS_LOCALIZED); - + /* extra free callback */ if (use_api_free_cb && node->typeinfo->freefunc_api) { PointerRNA ptr; RNA_pointer_create((ID *)ntree, &RNA_Node, node, &ptr); - + node->typeinfo->freefunc_api(&ptr); } - + /* since it is called while free database, node->id is undefined */ - + /* can be called for nodes outside a node tree (e.g. clipboard) */ if (ntree) { /* remove all references to this node */ nodeUnlinkNode(ntree, node); node_unlink_attached(ntree, node); - + BLI_remlink(&ntree->nodes, node); - + if (remove_animdata) { char propname_esc[MAX_IDPROP_NAME * 2]; char prefix[MAX_IDPROP_NAME * 2]; @@ -1713,7 +1713,7 @@ static void node_free_node_ex(bNodeTree *ntree, bNode *node, bool remove_animdat if (ntree->typeinfo->free_node_cache) ntree->typeinfo->free_node_cache(ntree, node); - + /* texture node has bad habit of keeping exec data around */ if (ntree->type == NTREE_TEXTURE && ntree->execdata) { ntreeTexEndExecTree(ntree->execdata); @@ -1744,7 +1744,7 @@ static void node_free_node_ex(bNodeTree *ntree, bNode *node, bool remove_animdat } MEM_freeN(node); - + if (ntree) ntree->update |= NTREE_UPDATE_NODES; } @@ -1760,7 +1760,7 @@ static void node_socket_interface_free(bNodeTree *UNUSED(ntree), bNodeSocket *so IDP_FreeProperty(sock->prop); MEM_freeN(sock->prop); } - + if (sock->default_value) MEM_freeN(sock->default_value); } @@ -1768,7 +1768,7 @@ static void node_socket_interface_free(bNodeTree *UNUSED(ntree), bNodeSocket *so static void free_localized_node_groups(bNodeTree *ntree) { bNode *node; - + /* Only localized node trees store a copy for each node group tree. * Each node group tree in a localized node tree can be freed, * since it is a localized copy itself (no risk of accessing free'd @@ -1776,7 +1776,7 @@ static void free_localized_node_groups(bNodeTree *ntree) */ if (!(ntree->flag & NTREE_IS_LOCALIZED)) return; - + for (node = ntree->nodes.first; node; node = node->next) { if (node->type == NODE_GROUP && node->id) { bNodeTree *ngroup = (bNodeTree *)node->id; @@ -1811,15 +1811,15 @@ void ntreeFreeTree(bNodeTree *ntree) break; } } - + /* XXX not nice, but needed to free localized node groups properly */ free_localized_node_groups(ntree); - + /* unregister associated RNA types */ ntreeInterfaceTypeFree(ntree); - + BLI_freelistN(&ntree->links); /* do first, then unlink_node goes fast */ - + for (node = ntree->nodes.first; node; node = next) { next = node->next; node_free_node_ex(ntree, node, false, false); @@ -1836,7 +1836,7 @@ void ntreeFreeTree(bNodeTree *ntree) node_socket_interface_free(ntree, sock); MEM_freeN(sock); } - + /* free preview hash */ if (ntree->previews) { BKE_node_instance_hash_free(ntree->previews, (bNodeInstanceValueFP)BKE_node_preview_free); @@ -1844,7 +1844,7 @@ void ntreeFreeTree(bNodeTree *ntree) if (ntree->duplilock) BLI_mutex_free(ntree->duplilock); - + /* if ntree is not part of library, free the libblock data explicitly */ for (tntree = G.main->nodetree.first; tntree; tntree = tntree->id.next) if (tntree == ntree) @@ -1857,7 +1857,7 @@ void ntreeFreeTree(bNodeTree *ntree) void ntreeFreeCache(bNodeTree *ntree) { if (ntree == NULL) return; - + if (ntree->typeinfo->free_cache) ntree->typeinfo->free_cache(ntree); } @@ -1871,7 +1871,7 @@ void ntreeSetOutput(bNodeTree *ntree) if (node->typeinfo->nclass == NODE_CLASS_OUTPUT) { bNode *tnode; int output = 0; - + /* we need a check for which output node should be tagged like this, below an exception */ if (node->type == CMP_NODE_OUTPUT_FILE) continue; @@ -1879,9 +1879,9 @@ void ntreeSetOutput(bNodeTree *ntree) /* there is more types having output class, each one is checked */ for (tnode = ntree->nodes.first; tnode; tnode = tnode->next) { if (tnode->typeinfo->nclass == NODE_CLASS_OUTPUT) { - + if (ntree->type == NTREE_COMPOSIT) { - + /* same type, exception for viewer */ if (tnode->type == node->type || (ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER) && @@ -1909,12 +1909,12 @@ void ntreeSetOutput(bNodeTree *ntree) if (output == 0) node->flag |= NODE_DO_OUTPUT; } - + /* group node outputs use this flag too */ if (node->type == NODE_GROUP_OUTPUT) { bNode *tnode; int output = 0; - + for (tnode = ntree->nodes.first; tnode; tnode = tnode->next) { if (tnode->type == NODE_GROUP_OUTPUT) { if (tnode->flag & NODE_DO_OUTPUT) { @@ -1928,7 +1928,7 @@ void ntreeSetOutput(bNodeTree *ntree) node->flag |= NODE_DO_OUTPUT; } } - + /* here we could recursively set which nodes have to be done, * might be different for editor or for "real" use... */ } @@ -2055,7 +2055,7 @@ void ntreeLocalMerge(Main *bmain, bNodeTree *localtree, bNodeTree *ntree) if (ntree && localtree) { if (ntree->typeinfo->local_merge) ntree->typeinfo->local_merge(bmain, localtree, ntree); - + ntreeFreeTree(localtree); MEM_freeN(localtree); } @@ -2080,7 +2080,7 @@ static bNodeSocket *make_socket_interface(bNodeTree *ntree, int in_out, node_socket_set_typeinfo(ntree, sock, stype); sock->in_out = in_out; sock->type = SOCK_CUSTOM; /* int type undefined by default */ - + /* assign new unique index */ own_index = ntree->cur_index++; /* use the own_index as socket identifier */ @@ -2107,13 +2107,13 @@ static bNodeSocket *make_socket_interface(bNodeTree *ntree, int in_out, #endif #endif /* USE_NODE_COMPAT_CUSTOMNODES */ - + sock->limit = (in_out == SOCK_IN ? 1 : 0xFFF); - + BLI_strncpy(sock->name, name, NODE_MAXSTR); sock->storage = NULL; sock->flag |= SOCK_COLLAPSED; - + return sock; } @@ -2129,7 +2129,7 @@ bNodeSocket *ntreeFindSocketInterface(bNodeTree *ntree, int in_out, const char * bNodeSocket *ntreeAddSocketInterface(bNodeTree *ntree, int in_out, const char *idname, const char *name) { bNodeSocket *iosock; - + iosock = make_socket_interface(ntree, in_out, idname, name); if (in_out == SOCK_IN) { BLI_addtail(&ntree->inputs, iosock); @@ -2139,7 +2139,7 @@ bNodeSocket *ntreeAddSocketInterface(bNodeTree *ntree, int in_out, const char *i BLI_addtail(&ntree->outputs, iosock); ntree->update |= NTREE_UPDATE_GROUP_OUT; } - + return iosock; } @@ -2147,7 +2147,7 @@ bNodeSocket *ntreeInsertSocketInterface(bNodeTree *ntree, int in_out, const char bNodeSocket *next_sock, const char *name) { bNodeSocket *iosock; - + iosock = make_socket_interface(ntree, in_out, idname, name); if (in_out == SOCK_IN) { BLI_insertlinkbefore(&ntree->inputs, next_sock, iosock); @@ -2157,7 +2157,7 @@ bNodeSocket *ntreeInsertSocketInterface(bNodeTree *ntree, int in_out, const char BLI_insertlinkbefore(&ntree->outputs, next_sock, iosock); ntree->update |= NTREE_UPDATE_GROUP_OUT; } - + return iosock; } @@ -2186,10 +2186,10 @@ void ntreeRemoveSocketInterface(bNodeTree *ntree, bNodeSocket *sock) /* this is fast, this way we don't need an in_out argument */ BLI_remlink(&ntree->inputs, sock); BLI_remlink(&ntree->outputs, sock); - + node_socket_interface_free(ntree, sock); MEM_freeN(sock); - + ntree->update |= NTREE_UPDATE_GROUP; } @@ -2216,7 +2216,7 @@ static void ntree_interface_identifier(bNodeTree *ntree, const char *base, char */ identifier[0] = '\0'; BLI_uniquename_cb(ntree_interface_unique_identifier_check, NULL, base, '_', identifier, maxlen); - + sprintf(name, "Node Tree %s Interface", ntree->id.name + 2); sprintf(description, "Interface properties of node group %s", ntree->id.name + 2); } @@ -2227,20 +2227,20 @@ static void ntree_interface_type_create(bNodeTree *ntree) bNodeSocket *sock; /* strings are generated from base string + ID name, sizes are sufficient */ char base[MAX_ID_NAME + 64], identifier[MAX_ID_NAME + 64], name[MAX_ID_NAME + 64], description[MAX_ID_NAME + 64]; - + /* generate a valid RNA identifier */ ntree_interface_identifier_base(ntree, base); ntree_interface_identifier(ntree, base, identifier, sizeof(identifier), name, description); - + /* register a subtype of PropertyGroup */ srna = RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_PropertyGroup); RNA_def_struct_ui_text(srna, name, description); RNA_def_struct_duplicate_pointers(&BLENDER_RNA, srna); - + /* associate the RNA type with the node tree */ ntree->interface_type = srna; RNA_struct_blender_type_set(srna, ntree); - + /* add socket properties */ for (sock = ntree->inputs.first; sock; sock = sock->next) { bNodeSocketType *stype = sock->typeinfo; @@ -2259,20 +2259,20 @@ StructRNA *ntreeInterfaceTypeGet(bNodeTree *ntree, int create) if (ntree->interface_type) { /* strings are generated from base string + ID name, sizes are sufficient */ char base[MAX_ID_NAME + 64], identifier[MAX_ID_NAME + 64], name[MAX_ID_NAME + 64], description[MAX_ID_NAME + 64]; - + /* A bit of a hack: when changing the ID name, update the RNA type identifier too, * so that the names match. This is not strictly necessary to keep it working, * but better for identifying associated NodeTree blocks and RNA types. */ StructRNA *srna = ntree->interface_type; - + ntree_interface_identifier_base(ntree, base); - + /* RNA identifier may have a number suffix, but should start with the idbase string */ if (!STREQLEN(RNA_struct_identifier(srna), base, sizeof(base))) { /* generate new unique RNA identifier from the ID name */ ntree_interface_identifier(ntree, base, identifier, sizeof(identifier), name, description); - + /* rename the RNA type */ RNA_def_struct_free_pointers(&BLENDER_RNA, srna); RNA_def_struct_identifier(&BLENDER_RNA, srna, identifier); @@ -2283,7 +2283,7 @@ StructRNA *ntreeInterfaceTypeGet(bNodeTree *ntree, int create) else if (create) { ntree_interface_type_create(ntree); } - + return ntree->interface_type; } @@ -2344,7 +2344,7 @@ bool ntreeHasTree(const bNodeTree *ntree, const bNodeTree *lookup) bNodeLink *nodeFindLink(bNodeTree *ntree, bNodeSocket *from, bNodeSocket *to) { bNodeLink *link; - + for (link = ntree->links.first; link; link = link->next) { if (link->fromsock == from && link->tosock == to) return link; @@ -2358,7 +2358,7 @@ int nodeCountSocketLinks(bNodeTree *ntree, bNodeSocket *sock) { bNodeLink *link; int tot = 0; - + for (link = ntree->links.first; link; link = link->next) { if (link->fromsock == sock || link->tosock == sock) tot++; @@ -2369,9 +2369,9 @@ int nodeCountSocketLinks(bNodeTree *ntree, bNodeSocket *sock) bNode *nodeGetActive(bNodeTree *ntree) { bNode *node; - + if (ntree == NULL) return NULL; - + for (node = ntree->nodes.first; node; node = node->next) if (node->flag & NODE_ACTIVE) break; @@ -2402,7 +2402,7 @@ static bNode *node_get_active_id_recursive(bNodeInstanceKey active_key, bNodeIns } } } - + return NULL; } @@ -2451,9 +2451,9 @@ bool nodeSetActiveID(bNodeTree *ntree, short idtype, ID *id) void nodeClearActiveID(bNodeTree *ntree, short idtype) { bNode *node; - + if (ntree == NULL) return; - + for (node = ntree->nodes.first; node; node = node->next) if (node->id && GS(node->id->name) == idtype) node->flag &= ~NODE_ACTIVE_ID; @@ -2466,9 +2466,9 @@ void nodeSetSelected(bNode *node, bool select) } else { bNodeSocket *sock; - + node->flag &= ~NODE_SELECT; - + /* deselect sockets too */ for (sock = node->inputs.first; sock; sock = sock->next) sock->flag &= ~NODE_SELECT; @@ -2491,11 +2491,11 @@ void nodeClearActive(bNodeTree *ntree) void nodeSetActive(bNodeTree *ntree, bNode *node) { bNode *tnode; - + /* make sure only one node is active, and only one per ID type */ for (tnode = ntree->nodes.first; tnode; tnode = tnode->next) { tnode->flag &= ~NODE_ACTIVE; - + if (node->id && tnode->id) { if (GS(node->id->name) == GS(tnode->id->name)) tnode->flag &= ~NODE_ACTIVE_ID; @@ -2503,7 +2503,7 @@ void nodeSetActive(bNodeTree *ntree, bNode *node) if (node->typeinfo->nclass == NODE_CLASS_TEXTURE) tnode->flag &= ~NODE_ACTIVE_TEXTURE; } - + node->flag |= NODE_ACTIVE; if (node->id) node->flag |= NODE_ACTIVE_ID; @@ -2559,13 +2559,13 @@ void BKE_node_clipboard_clear(void) { bNode *node, *node_next; bNodeLink *link, *link_next; - + for (link = node_clipboard.links.first; link; link = link_next) { link_next = link->next; nodeRemLink(NULL, link); } BLI_listbase_clear(&node_clipboard.links); - + for (node = node_clipboard.nodes.first; node; node = node_next) { node_next = node->next; node_free_node_ex(NULL, node, false, false); @@ -2684,25 +2684,25 @@ const bNodeInstanceKey NODE_INSTANCE_KEY_NONE = {0}; static bNodeInstanceKey node_hash_int_str(bNodeInstanceKey hash, const char *str) { char c; - + while ((c = *str++)) hash.value = ((hash.value << 5) + hash.value) ^ c; /* (hash * 33) ^ c */ - + /* separator '\0' character, to avoid ambiguity from concatenated strings */ hash.value = (hash.value << 5) + hash.value; /* hash * 33 */ - + return hash; } bNodeInstanceKey BKE_node_instance_key(bNodeInstanceKey parent_key, bNodeTree *ntree, bNode *node) { bNodeInstanceKey key; - + key = node_hash_int_str(parent_key, ntree->id.name + 2); - + if (node) key = node_hash_int_str(key, node->name); - + return key; } @@ -2773,10 +2773,10 @@ int BKE_node_instance_hash_size(bNodeInstanceHash *hash) void BKE_node_instance_hash_clear_tags(bNodeInstanceHash *hash) { bNodeInstanceHashIterator iter; - + NODE_INSTANCE_HASH_ITER(iter, hash) { bNodeInstanceHashEntry *value = BKE_node_instance_hash_iterator_get_value(&iter); - + value->tag = 0; } } @@ -2790,7 +2790,7 @@ void BKE_node_instance_hash_tag(bNodeInstanceHash *UNUSED(hash), void *value) bool BKE_node_instance_hash_tag_key(bNodeInstanceHash *hash, bNodeInstanceKey key) { bNodeInstanceHashEntry *entry = BKE_node_instance_hash_lookup(hash, key); - + if (entry) { entry->tag = 1; return true; @@ -2807,19 +2807,19 @@ void BKE_node_instance_hash_remove_untagged(bNodeInstanceHash *hash, bNodeInstan bNodeInstanceKey *untagged = MEM_mallocN(sizeof(bNodeInstanceKey) * BKE_node_instance_hash_size(hash), "temporary node instance key list"); bNodeInstanceHashIterator iter; int num_untagged, i; - + num_untagged = 0; NODE_INSTANCE_HASH_ITER(iter, hash) { bNodeInstanceHashEntry *value = BKE_node_instance_hash_iterator_get_value(&iter); - + if (!value->tag) untagged[num_untagged++] = BKE_node_instance_hash_iterator_get_key(&iter); } - + for (i = 0; i < num_untagged; ++i) { BKE_node_instance_hash_remove(hash, untagged[i], valfreefp); } - + MEM_freeN(untagged); } @@ -2832,9 +2832,9 @@ static int node_get_deplist_recurs(bNodeTree *ntree, bNode *node, bNode ***nsort bNode *fromnode; bNodeLink *link; int level = 0xFFF; - + node->done = true; - + /* check linked nodes */ for (link = ntree->links.first; link; link = link->next) { if (link->tonode == node) { @@ -2845,7 +2845,7 @@ static int node_get_deplist_recurs(bNodeTree *ntree, bNode *node, bNode ***nsort level = fromnode->level - 1; } } - + /* check parent node */ if (node->parent) { if (node->parent->done == 0) @@ -2853,21 +2853,21 @@ static int node_get_deplist_recurs(bNodeTree *ntree, bNode *node, bNode ***nsort if (node->parent->level <= level) level = node->parent->level - 1; } - + if (nsort) { **nsort = node; (*nsort)++; } - + return level; } void ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***deplist, int *totnodes) { bNode *node, **nsort; - + *totnodes = 0; - + /* first clear data */ for (node = ntree->nodes.first; node; node = node->next) { node->done = false; @@ -2877,9 +2877,9 @@ void ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***deplist, in *deplist = NULL; return; } - + nsort = *deplist = MEM_callocN((*totnodes) * sizeof(bNode *), "sorted node array"); - + /* recursive check */ for (node = ntree->nodes.first; node; node = node->next) { if (node->done == 0) { @@ -2892,12 +2892,12 @@ void ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***deplist, in static void ntree_update_node_level(bNodeTree *ntree) { bNode *node; - + /* first clear tag */ for (node = ntree->nodes.first; node; node = node->next) { node->done = false; } - + /* recursive check */ for (node = ntree->nodes.first; node; node = node->next) { if (node->done == 0) { @@ -2911,7 +2911,7 @@ void ntreeTagUsedSockets(bNodeTree *ntree) bNode *node; bNodeSocket *sock; bNodeLink *link; - + /* first clear data */ for (node = ntree->nodes.first; node; node = node->next) { for (sock = node->inputs.first; sock; sock = sock->next) { @@ -2921,12 +2921,12 @@ void ntreeTagUsedSockets(bNodeTree *ntree) sock->flag &= ~SOCK_IN_USE; } } - + for (link = ntree->links.first; link; link = link->next) { /* link is unused if either side is disabled */ if ((link->fromsock->flag & SOCK_UNAVAIL) || (link->tosock->flag & SOCK_UNAVAIL)) continue; - + link->fromsock->flag |= SOCK_IN_USE; link->tosock->flag |= SOCK_IN_USE; } @@ -2937,7 +2937,7 @@ static void ntree_update_link_pointers(bNodeTree *ntree) bNode *node; bNodeSocket *sock; bNodeLink *link; - + /* first clear data */ for (node = ntree->nodes.first; node; node = node->next) { for (sock = node->inputs.first; sock; sock = sock->next) { @@ -2948,14 +2948,14 @@ static void ntree_update_link_pointers(bNodeTree *ntree) for (link = ntree->links.first; link; link = link->next) { link->tosock->link = link; } - + ntreeTagUsedSockets(ntree); } static void ntree_validate_links(bNodeTree *ntree) { bNodeLink *link; - + for (link = ntree->links.first; link; link = link->next) { link->flag |= NODE_LINK_VALID; if (link->fromnode && link->tonode && link->fromnode->level <= link->tonode->level) @@ -2971,7 +2971,7 @@ void ntreeVerifyNodes(struct Main *main, struct ID *id) { FOREACH_NODETREE(main, ntree, owner_id) { bNode *node; - + for (node = ntree->nodes.first; node; node = node->next) if (node->typeinfo->verifyfunc) node->typeinfo->verifyfunc(ntree, node, id); @@ -2981,31 +2981,31 @@ void ntreeVerifyNodes(struct Main *main, struct ID *id) void ntreeUpdateTree(Main *bmain, bNodeTree *ntree) { bNode *node; - + if (!ntree) return; - + /* avoid reentrant updates, can be caused by RNA update callbacks */ if (ntree->is_updating) return; ntree->is_updating = true; - + if (ntree->update & (NTREE_UPDATE_LINKS | NTREE_UPDATE_NODES)) { /* set the bNodeSocket->link pointers */ ntree_update_link_pointers(ntree); } - + /* update individual nodes */ for (node = ntree->nodes.first; node; node = node->next) { /* node tree update tags override individual node update flags */ if ((node->update & NODE_UPDATE) || (ntree->update & NTREE_UPDATE)) { if (node->typeinfo->updatefunc) node->typeinfo->updatefunc(ntree, node); - + nodeUpdateInternalLinks(ntree, node); } } - + /* generic tree update callback */ if (ntree->typeinfo->update) ntree->typeinfo->update(ntree); @@ -3014,28 +3014,28 @@ void ntreeUpdateTree(Main *bmain, bNodeTree *ntree) */ if (ntree->update & NTREE_UPDATE_GROUP) ntreeInterfaceTypeUpdate(ntree); - + /* XXX hack, should be done by depsgraph!! */ if (bmain) ntreeVerifyNodes(bmain, &ntree->id); - + if (ntree->update & (NTREE_UPDATE_LINKS | NTREE_UPDATE_NODES)) { /* node updates can change sockets or links, repeat link pointer update afterward */ ntree_update_link_pointers(ntree); - + /* update the node level from link dependencies */ ntree_update_node_level(ntree); - + /* check link validity */ ntree_validate_links(ntree); } - + /* clear update flags */ for (node = ntree->nodes.first; node; node = node->next) { node->update = 0; } ntree->update = 0; - + ntree->is_updating = false; } @@ -3045,15 +3045,15 @@ void nodeUpdate(bNodeTree *ntree, bNode *node) if (ntree->is_updating) return; ntree->is_updating = true; - + if (node->typeinfo->updatefunc) node->typeinfo->updatefunc(ntree, node); - + nodeUpdateInternalLinks(ntree, node); - + /* clear update flag */ node->update = 0; - + ntree->is_updating = false; } @@ -3061,15 +3061,15 @@ bool nodeUpdateID(bNodeTree *ntree, ID *id) { bNode *node; bool changed = false; - + if (ELEM(NULL, id, ntree)) return changed; - + /* avoid reentrant updates, can be caused by RNA update callbacks */ if (ntree->is_updating) return changed; ntree->is_updating = true; - + for (node = ntree->nodes.first; node; node = node->next) { if (node->id == id) { changed = true; @@ -3080,11 +3080,11 @@ bool nodeUpdateID(bNodeTree *ntree, ID *id) node->update = 0; } } - + for (node = ntree->nodes.first; node; node = node->next) { nodeUpdateInternalLinks(ntree, node); } - + ntree->is_updating = false; return changed; } @@ -3092,7 +3092,7 @@ bool nodeUpdateID(bNodeTree *ntree, ID *id) void nodeUpdateInternalLinks(bNodeTree *ntree, bNode *node) { BLI_freelistN(&node->internal_links); - + if (node->typeinfo && node->typeinfo->update_internal_links) node->typeinfo->update_internal_links(ntree, node); } @@ -3159,14 +3159,14 @@ void node_type_base(bNodeType *ntype, int type, const char *name, short nclass, BLI_assert(ntype->ext.srna != NULL); \ RNA_struct_blender_type_set(ntype->ext.srna, ntype); \ break; - + switch (type) { #include "NOD_static_types.h" } - + /* make sure we have a valid type (everything registered) */ BLI_assert(ntype->idname[0] != '\0'); - + ntype->type = type; BLI_strncpy(ntype->ui_name, name, sizeof(ntype->ui_name)); ntype->nclass = nclass; @@ -3193,7 +3193,7 @@ static bool unique_socket_template_identifier_check(void *arg, const char *name) { bNodeSocketTemplate *ntemp; struct {bNodeSocketTemplate *list; bNodeSocketTemplate *ntemp;} *data = arg; - + for (ntemp = data->list; ntemp->type >= 0; ++ntemp) { if (ntemp != data->ntemp) { if (STREQ(ntemp->identifier, name)) { @@ -3201,7 +3201,7 @@ static bool unique_socket_template_identifier_check(void *arg, const char *name) } } } - + return false; } @@ -3217,16 +3217,16 @@ static void unique_socket_template_identifier(bNodeSocketTemplate *list, bNodeSo void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs) { bNodeSocketTemplate *ntemp; - + ntype->inputs = inputs; ntype->outputs = outputs; - + /* automatically generate unique identifiers */ if (inputs) { /* clear identifier strings (uninitialized memory) */ for (ntemp = inputs; ntemp->type >= 0; ++ntemp) ntemp->identifier[0] = '\0'; - + for (ntemp = inputs; ntemp->type >= 0; ++ntemp) { BLI_strncpy(ntemp->identifier, ntemp->name, sizeof(ntemp->identifier)); unique_socket_template_identifier(inputs, ntemp, ntemp->identifier, '_'); @@ -3236,7 +3236,7 @@ void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTempl /* clear identifier strings (uninitialized memory) */ for (ntemp = outputs; ntemp->type >= 0; ++ntemp) ntemp->identifier[0] = '\0'; - + for (ntemp = outputs; ntemp->type >= 0; ++ntemp) { BLI_strncpy(ntemp->identifier, ntemp->name, sizeof(ntemp->identifier)); unique_socket_template_identifier(outputs, ntemp, ntemp->identifier, '_'); @@ -3343,14 +3343,14 @@ static void register_undefined_types(void) /* Note: these types are not registered in the type hashes, * they are just used as placeholders in case the actual types are not registered. */ - + strcpy(NodeTreeTypeUndefined.idname, "NodeTreeUndefined"); strcpy(NodeTreeTypeUndefined.ui_name, "Undefined"); strcpy(NodeTreeTypeUndefined.ui_description, "Undefined Node Tree Type"); - + node_type_base_custom(&NodeTypeUndefined, "NodeUndefined", "Undefined", 0, 0); NodeTypeUndefined.poll = node_undefined_poll; - + BLI_strncpy(NodeSocketTypeUndefined.idname, "NodeSocketUndefined", sizeof(NodeSocketTypeUndefined.idname)); /* extra type info for standard socket types */ NodeSocketTypeUndefined.type = SOCK_CUSTOM; @@ -3360,7 +3360,7 @@ static void register_undefined_types(void) static void registerCompositNodes(void) { register_node_type_cmp_group(); - + register_node_type_cmp_rlayers(); register_node_type_cmp_image(); register_node_type_cmp_texture(); @@ -3368,13 +3368,13 @@ static void registerCompositNodes(void) register_node_type_cmp_rgb(); register_node_type_cmp_curve_time(); register_node_type_cmp_movieclip(); - + register_node_type_cmp_composite(); register_node_type_cmp_viewer(); register_node_type_cmp_splitviewer(); register_node_type_cmp_output_file(); register_node_type_cmp_view_levels(); - + register_node_type_cmp_curve_rgb(); register_node_type_cmp_mix_rgb(); register_node_type_cmp_hue_sat(); @@ -3385,13 +3385,13 @@ static void registerCompositNodes(void) register_node_type_cmp_zcombine(); register_node_type_cmp_colorbalance(); register_node_type_cmp_huecorrect(); - + register_node_type_cmp_normal(); register_node_type_cmp_curve_vec(); register_node_type_cmp_map_value(); register_node_type_cmp_map_range(); register_node_type_cmp_normalize(); - + register_node_type_cmp_filter(); register_node_type_cmp_blur(); register_node_type_cmp_dblur(); @@ -3402,7 +3402,7 @@ static void registerCompositNodes(void) register_node_type_cmp_despeckle(); register_node_type_cmp_defocus(); register_node_type_cmp_sunbeams(); - + register_node_type_cmp_valtorgb(); register_node_type_cmp_rgbtobw(); register_node_type_cmp_setalpha(); @@ -3417,7 +3417,7 @@ static void registerCompositNodes(void) register_node_type_cmp_sepycca(); register_node_type_cmp_combycca(); register_node_type_cmp_premulkey(); - + register_node_type_cmp_diff_matte(); register_node_type_cmp_distance_matte(); register_node_type_cmp_chroma_matte(); @@ -3458,7 +3458,7 @@ static void registerCompositNodes(void) register_node_type_cmp_cornerpin(); } -static void registerShaderNodes(void) +static void registerShaderNodes(void) { register_node_type_sh_group(); @@ -3552,7 +3552,7 @@ static void registerTextureNodes(void) { register_node_type_tex_group(); - + register_node_type_tex_math(); register_node_type_tex_mix_rgb(); register_node_type_tex_valtorgb(); @@ -3566,26 +3566,26 @@ static void registerTextureNodes(void) register_node_type_tex_distance(); register_node_type_tex_compose(); register_node_type_tex_decompose(); - + register_node_type_tex_output(); register_node_type_tex_viewer(); register_node_type_sh_script(); register_node_type_sh_tangent(); register_node_type_sh_normal_map(); register_node_type_sh_hair_info(); - + register_node_type_tex_checker(); register_node_type_tex_texture(); register_node_type_tex_bricks(); register_node_type_tex_image(); register_node_type_sh_bsdf_refraction(); register_node_type_sh_ambient_occlusion(); - + register_node_type_tex_rotate(); register_node_type_tex_translate(); register_node_type_tex_scale(); register_node_type_tex_at(); - + register_node_type_tex_proc_voronoi(); register_node_type_tex_proc_blend(); register_node_type_tex_proc_magic(); @@ -3598,7 +3598,7 @@ static void registerTextureNodes(void) register_node_type_tex_proc_distnoise(); } -void init_nodesystem(void) +void init_nodesystem(void) { nodetreetypes_hash = BLI_ghash_str_new("nodetreetypes_hash gh"); nodetypes_hash = BLI_ghash_str_new("nodetypes_hash gh"); @@ -3617,13 +3617,13 @@ void init_nodesystem(void) register_node_type_reroute(); register_node_type_group_input(); register_node_type_group_output(); - + registerCompositNodes(); registerShaderNodes(); registerTextureNodes(); } -void free_nodesystem(void) +void free_nodesystem(void) { if (nodetypes_hash) { NODE_TYPES_BEGIN(nt) diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 2db9e2f6b5e..ac47fcec6b4 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -148,7 +148,7 @@ static ThreadMutex vparent_lock = BLI_MUTEX_INITIALIZER; void BKE_object_workob_clear(Object *workob) { memset(workob, 0, sizeof(Object)); - + workob->size[0] = workob->size[1] = workob->size[2] = 1.0f; workob->dscale[0] = workob->dscale[1] = workob->dscale[2] = 1.0f; workob->rotmode = ROT_MODE_EUL; @@ -436,9 +436,9 @@ void BKE_object_free(Object *ob) animviz_free_motionpath(ob->mpath); ob->mpath = NULL; } - + BKE_constraints_free_ex(&ob->constraints, false); - + free_partdeflect(ob->pd); BKE_rigidbody_free_object(ob); BKE_rigidbody_free_constraint(ob); @@ -478,7 +478,7 @@ bool BKE_object_is_in_editmode(const Object *ob) { if (ob->data == NULL) return false; - + if (ob->type == OB_MESH) { Mesh *me = ob->data; if (me->edit_btmesh) @@ -486,25 +486,25 @@ bool BKE_object_is_in_editmode(const Object *ob) } else if (ob->type == OB_ARMATURE) { bArmature *arm = ob->data; - + if (arm->edbo) return true; } else if (ob->type == OB_FONT) { Curve *cu = ob->data; - + if (cu->editfont) return true; } else if (ob->type == OB_MBALL) { MetaBall *mb = ob->data; - + if (mb->editelems) return true; } else if (ob->type == OB_LATTICE) { Lattice *lt = ob->data; - + if (lt->editlatt) return true; } @@ -628,9 +628,9 @@ bool BKE_object_is_visible(Object *ob, const eObjectVisibilityCheck mode) bool BKE_object_exists_check(Main *bmain, const Object *obtest) { Object *ob; - + if (obtest == NULL) return false; - + ob = bmain->object.first; while (ob) { if (ob == obtest) return true; @@ -692,12 +692,12 @@ void BKE_object_init(Object *ob) ob->col[0] = ob->col[1] = ob->col[2] = 1.0; ob->col[3] = 1.0; - + ob->size[0] = ob->size[1] = ob->size[2] = 1.0; ob->dscale[0] = ob->dscale[1] = ob->dscale[2] = 1.0; - - /* objects should default to having Euler XYZ rotations, - * but rotations default to quaternions + + /* objects should default to having Euler XYZ rotations, + * but rotations default to quaternions */ ob->rotmode = ROT_MODE_EUL; @@ -709,7 +709,7 @@ void BKE_object_init(Object *ob) /* rotation locks should be 4D for 4 component rotations by default... */ ob->protectflag = OB_LOCK_ROT4D; - + unit_m4(ob->constinv); unit_m4(ob->parentinv); unit_m4(ob->obmat); @@ -725,7 +725,7 @@ void BKE_object_init(Object *ob) ob->trackflag = OB_POSY; ob->upflag = OB_POSZ; } - + ob->dupon = 1; ob->dupoff = 0; ob->dupsta = 1; ob->dupend = 100; ob->dupfacesca = 1.0; @@ -739,7 +739,7 @@ void BKE_object_init(Object *ob) ob->fluidsimSettings = NULL; BLI_listbase_clear(&ob->pc_ids); - + /* Animation Visualization defaults */ animviz_settings_init(&ob->avs); @@ -830,9 +830,9 @@ Object *BKE_object_add_from( SoftBody *copy_softbody(const SoftBody *sb, const int flag) { SoftBody *sbn; - + if (sb == NULL) return(NULL); - + sbn = MEM_dupallocN(sb); if ((flag & LIB_ID_COPY_CACHES) == 0) { @@ -858,10 +858,10 @@ SoftBody *copy_softbody(const SoftBody *sb, const int flag) if (sb->bspring) sbn->bspring = MEM_dupallocN(sb->bspring); } - + sbn->keys = NULL; sbn->totkey = sbn->totpointkey = 0; - + sbn->scratch = NULL; sbn->pointcache = BKE_ptcache_copy_list(&sbn->ptcaches, &sb->ptcaches, flag); @@ -893,10 +893,10 @@ ParticleSystem *BKE_object_copy_particlesystem(ParticleSystem *psys, const int f if (key) key = MEM_dupallocN(key); - + if (boid) boid = MEM_dupallocN(boid); - + for (p = 0, pa = psysn->particles; p < psysn->totpart; p++, pa++) { if (boid) pa->boid = boid++; @@ -923,10 +923,10 @@ ParticleSystem *BKE_object_copy_particlesystem(ParticleSystem *psys, const int f psysn->tree = NULL; psysn->bvhtree = NULL; psysn->batch_cache = NULL; - + BLI_listbase_clear(&psysn->pathcachebufs); BLI_listbase_clear(&psysn->childcachebufs); - + psysn->pointcache = BKE_ptcache_copy_list(&psysn->ptcaches, &psys->ptcaches, flag); /* XXX - from reading existing code this seems correct but intended usage of @@ -975,7 +975,7 @@ void BKE_object_copy_particlesystems(Object *ob_dst, const Object *ob_src, const } else if (md->type == eModifierType_Smoke) { SmokeModifierData *smd = (SmokeModifierData *) md; - + if (smd->type == MOD_SMOKE_TYPE_FLOW) { if (smd->flow) { if (smd->flow->psys == psys) @@ -998,31 +998,31 @@ void BKE_object_copy_softbody(Object *ob_dst, const Object *ob_src) static void copy_object_pose(Object *obn, const Object *ob, const int flag) { bPoseChannel *chan; - + /* note: need to clear obn->pose pointer first, so that BKE_pose_copy_data works (otherwise there's a crash) */ obn->pose = NULL; BKE_pose_copy_data_ex(&obn->pose, ob->pose, flag, true); /* true = copy constraints */ for (chan = obn->pose->chanbase.first; chan; chan = chan->next) { bConstraint *con; - + chan->flag &= ~(POSE_LOC | POSE_ROT | POSE_SIZE); - + /* XXX Remapping object pointing onto itself should be handled by generic BKE_library_remap stuff, but... * the flush_constraint_targets callback am not sure about, so will delay that for now. */ for (con = chan->constraints.first; con; con = con->next) { const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); ListBase targets = {NULL, NULL}; bConstraintTarget *ct; - + if (cti && cti->get_constraint_targets) { cti->get_constraint_targets(con, &targets); - + for (ct = targets.first; ct; ct = ct->next) { if (ct->tar == ob) ct->tar = obn; } - + if (cti->flush_constraint_targets) cti->flush_constraint_targets(con, &targets, 0); } @@ -1191,11 +1191,11 @@ void BKE_object_copy_data(Main *UNUSED(bmain), Object *ob_dst, const Object *ob_ } if (ob_src->iuser) ob_dst->iuser = MEM_dupallocN(ob_src->iuser); - + if (ob_src->bb) ob_dst->bb = MEM_dupallocN(ob_src->bb); - + BLI_listbase_clear(&ob_dst->modifiers); - + for (md = ob_src->modifiers.first; md; md = md->next) { ModifierData *nmd = modifier_new(md->type); BLI_strncpy(nmd->name, md->name, sizeof(nmd->name)); @@ -1227,7 +1227,7 @@ void BKE_object_copy_data(Main *UNUSED(bmain), Object *ob_dst, const Object *ob_ ob_dst->rigidbody_constraint = BKE_rigidbody_copy_constraint(ob_src, flag_subdata); BKE_object_copy_particlesystems(ob_dst, ob_src, flag_subdata); - + ob_dst->derivedDeform = NULL; ob_dst->derivedFinal = NULL; @@ -1239,7 +1239,7 @@ void BKE_object_copy_data(Main *UNUSED(bmain), Object *ob_dst, const Object *ob_ ob_dst->mpath = animviz_copy_motionpath(ob_src->mpath); copy_object_lod(ob_dst, ob_src, flag_subdata); - + /* Do not copy runtime curve data. */ ob_dst->curve_cache = NULL; @@ -1335,34 +1335,34 @@ static void armature_set_id_extern(Object *ob) bArmature *arm = ob->data; bPoseChannel *pchan; unsigned int lay = arm->layer_protected; - + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { if (!(pchan->bone->layer & lay)) id_lib_extern((ID *)pchan->custom); } - + } void BKE_object_copy_proxy_drivers(Object *ob, Object *target) { if ((target->adt) && (target->adt->drivers.first)) { FCurve *fcu; - + /* add new animdata block */ if (!ob->adt) ob->adt = BKE_animdata_add_id(&ob->id); - + /* make a copy of all the drivers (for now), then correct any links that need fixing */ free_fcurves(&ob->adt->drivers); copy_fcurves(&ob->adt->drivers, &target->adt->drivers); - + for (fcu = ob->adt->drivers.first; fcu; fcu = fcu->next) { ChannelDriver *driver = fcu->driver; DriverVar *dvar; - + for (dvar = driver->variables.first; dvar; dvar = dvar->next) { /* all drivers */ - DRIVER_TARGETS_LOOPER(dvar) + DRIVER_TARGETS_LOOPER(dvar) { if (dtar->id) { if ((Object *)dtar->id == target) @@ -1393,14 +1393,14 @@ void BKE_object_make_proxy(Object *ob, Object *target, Object *cob) printf("cannot make proxy\n"); return; } - + ob->proxy = target; ob->proxy_group = cob; id_lib_extern(&target->id); - + DEG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); DEG_id_tag_update(&target->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); - + /* copy transform * - cob means this proxy comes from a collection, just apply the matrix * so the object wont move from its dupli-transform. @@ -1422,13 +1422,13 @@ void BKE_object_make_proxy(Object *ob, Object *target, Object *cob) ob->parent = target->parent; /* libdata */ copy_m4_m4(ob->parentinv, target->parentinv); } - + /* copy animdata stuff - drivers only for now... */ BKE_object_copy_proxy_drivers(ob, target); /* skip constraints? */ /* FIXME: this is considered by many as a bug */ - + /* set object type and link to data */ ob->type = target->type; ob->data = target->data; @@ -1445,24 +1445,24 @@ void BKE_object_make_proxy(Object *ob, Object *target, Object *cob) ob->matbits = NULL; if ((target->totcol) && (target->mat) && OB_TYPE_SUPPORT_MATERIAL(ob->type)) { int i; - + ob->actcol = target->actcol; ob->totcol = target->totcol; - + ob->mat = MEM_dupallocN(target->mat); ob->matbits = MEM_dupallocN(target->matbits); for (i = 0; i < target->totcol; i++) { /* don't need to run test_object_materials since we know this object is new and not used elsewhere */ - id_us_plus((ID *)ob->mat[i]); + id_us_plus((ID *)ob->mat[i]); } } - + /* type conversions */ if (target->type == OB_ARMATURE) { copy_object_pose(ob, target, 0); /* data copy, object pointers in constraints */ BKE_pose_rest(ob->pose); /* clear all transforms in channels */ BKE_pose_rebuild(ob, ob->data); /* set all internal links */ - + armature_set_id_extern(ob); } else if (target->type == OB_EMPTY) { @@ -1546,7 +1546,7 @@ void BKE_object_scale_to_mat3(Object *ob, float mat[3][3]) void BKE_object_rot_to_mat3(Object *ob, float mat[3][3], bool use_drot) { float rmat[3][3], dmat[3][3]; - + /* 'dmat' is the delta-rotation matrix, which will get (pre)multiplied * with the rotation matrix to yield the appropriate rotation */ @@ -1565,14 +1565,14 @@ void BKE_object_rot_to_mat3(Object *ob, float mat[3][3], bool use_drot) else { /* quats are normalized before use to eliminate scaling issues */ float tquat[4]; - + normalize_qt_qt(tquat, ob->quat); quat_to_mat3(rmat, tquat); - + normalize_qt_qt(tquat, ob->dquat); quat_to_mat3(dmat, tquat); } - + /* combine these rotations */ if (use_drot) mul_m3_m3m3(mat, dmat, rmat); @@ -1696,7 +1696,7 @@ void BKE_object_to_mat3(Object *ob, float mat[3][3]) /* no parent */ float smat[3][3]; float rmat[3][3]; /*float q1[4];*/ - + /* size */ BKE_object_scale_to_mat3(ob, smat); @@ -1708,9 +1708,9 @@ void BKE_object_to_mat3(Object *ob, float mat[3][3]) /* no parent */ void BKE_object_to_mat4(Object *ob, float mat[4][4]) { float tmat[3][3]; - + BKE_object_to_mat3(ob, tmat); - + copy_m4_m3(mat, tmat); add_v3_v3v3(mat[3], ob->loc, ob->dloc); @@ -1760,7 +1760,7 @@ static bool ob_parcurve(Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, /* catch exceptions: curve paths used as a duplicator */ if (enable_cu_speed) { /* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated, - * but this will only work if it actually is animated... + * but this will only work if it actually is animated... * * we divide the curvetime calculated in the previous step by the length of the path, to get a time * factor, which then gets clamped to lie within 0.0 - 1.0 range @@ -1784,10 +1784,10 @@ static bool ob_parcurve(Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, if (cu->pathlen) { ctime /= cu->pathlen; } - + CLAMP(ctime, 0.0f, 1.0f); } - + unit_m4(mat); /* vec: 4 items! */ @@ -1797,7 +1797,7 @@ static bool ob_parcurve(Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, #if 0 float si, q[4]; vec_to_quat(quat, dir, ob->trackflag, ob->upflag); - + /* the tilt */ normalize_v3(dir); q[0] = cosf(0.5 * vec[3]); @@ -1812,7 +1812,7 @@ static bool ob_parcurve(Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, normalize_qt(quat); quat_to_mat4(mat, quat); } - + if (cu->flag & CU_PATH_RADIUS) { float tmat[4][4], rmat[4][4]; scale_m4_fl(tmat, radius); @@ -1821,22 +1821,22 @@ static bool ob_parcurve(Depsgraph *depsgraph, Scene *UNUSED(scene), Object *ob, } copy_v3_v3(mat[3], vec); - + } return true; } static void ob_parbone(Object *ob, Object *par, float mat[4][4]) -{ +{ bPoseChannel *pchan; float vec[3]; - + if (par->type != OB_ARMATURE) { unit_m4(mat); return; } - + /* Make sure the bone is still valid */ pchan = BKE_pose_channel_find_name(par->pose, ob->parsubstr); if (!pchan || !pchan->bone) { @@ -1864,14 +1864,14 @@ static void ob_parbone(Object *ob, Object *par, float mat[4][4]) static void give_parvert(Object *par, int nr, float vec[3]) { zero_v3(vec); - + if (par->type == OB_MESH) { Mesh *me = par->data; BMEditMesh *em = me->edit_btmesh; DerivedMesh *dm; dm = (em) ? em->derivedFinal : par->derivedFinal; - + if (dm) { int count = 0; int numVerts = dm->getNumVerts(dm); @@ -2047,16 +2047,16 @@ void BKE_object_get_parent_matrix(Depsgraph *depsgraph, Scene *scene, Object *ob ok = 1; } } - + if (ok) mul_m4_m4m4(parentmat, par->obmat, tmat); else copy_m4_m4(parentmat, par->obmat); - + break; case PARBONE: ob_parbone(ob, par, tmat); mul_m4_m4m4(parentmat, par->obmat, tmat); break; - + case PARVERT1: unit_m4(parentmat); give_parvert(par, ob->par1, vec); @@ -2064,10 +2064,10 @@ void BKE_object_get_parent_matrix(Depsgraph *depsgraph, Scene *scene, Object *ob break; case PARVERT3: ob_parvert3(ob, par, tmat); - + mul_m4_m4m4(parentmat, par->obmat, tmat); break; - + case PARSKEL: copy_m4_m4(parentmat, par->obmat); break; @@ -2085,22 +2085,22 @@ static void solve_parenting(Depsgraph *depsgraph, float totmat[4][4]; float tmat[4][4]; float locmat[4][4]; - + BKE_object_to_mat4(ob, locmat); - + if (ob->partype & PARSLOW) copy_m4_m4(slowmat, obmat); BKE_object_get_parent_matrix(depsgraph, scene, ob, par, totmat); - + /* total */ mul_m4_m4m4(tmat, totmat, ob->parentinv); mul_m4_m4m4(obmat, tmat, locmat); - + if (r_originmat) { /* usable originmat */ copy_m3_m4(r_originmat, tmat); } - + /* origin, for help line */ if (set_origin) { if ((ob->partype & PARTYPE) == PARSKEL) { @@ -2138,18 +2138,18 @@ void BKE_object_where_is_calc_time_ex( RigidBodyWorld *rbw, float r_originmat[3][3]) { if (ob == NULL) return; - + /* execute drivers only, as animation has already been done */ BKE_animsys_evaluate_animdata(depsgraph, scene, &ob->id, ob->adt, ctime, ADT_RECALC_DRIVERS); - + if (ob->parent) { Object *par = ob->parent; float slowmat[4][4]; - + /* calculate parent matrix */ solve_parenting(depsgraph, scene, ob, par, ob->obmat, slowmat, r_originmat, true); - - /* "slow parent" is definitely not threadsafe, and may also give bad results jumping around + + /* "slow parent" is definitely not threadsafe, and may also give bad results jumping around * An old-fashioned hack which probably doesn't really cut it anymore */ if (ob->partype & PARSLOW) { @@ -2165,7 +2165,7 @@ void BKE_object_where_is_calc_time_ex( rbw = rbw ? rbw : scene->rigidbody_world; /* read values pushed into RBO from sim/cache... */ BKE_rigidbody_sync_transforms(rbw, ob, ctime); - + /* solve constraints */ if (ob->constraints.first && !(ob->transflag & OB_NO_CONSTRAINTS)) { bConstraintOb *cob; @@ -2173,7 +2173,7 @@ void BKE_object_where_is_calc_time_ex( BKE_constraints_solve(depsgraph, &ob->constraints, cob, ctime); BKE_constraints_clear_evalob(cob); } - + /* set negative scale flag in object */ if (is_negative_m4(ob->obmat)) ob->transflag |= OB_NEG_SCALE; else ob->transflag &= ~OB_NEG_SCALE; @@ -2195,9 +2195,9 @@ void BKE_object_where_is_calc_mat4(Depsgraph *depsgraph, Scene *scene, Object *o float slowmat[4][4]; Object *par = ob->parent; - + solve_parenting(depsgraph, scene, ob, par, obmat, slowmat, NULL, false); - + if (ob->partype & PARSLOW) where_is_object_parslow(ob, obmat, slowmat); } @@ -2227,7 +2227,7 @@ void BKE_object_workob_calc_parent(Depsgraph *depsgraph, Scene *scene, Object *o { Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); BKE_object_workob_clear(workob); - + unit_m4(workob->obmat); unit_m4(workob->parentinv); unit_m4(workob->constinv); @@ -2237,7 +2237,7 @@ void BKE_object_workob_calc_parent(Depsgraph *depsgraph, Scene *scene, Object *o workob->trackflag = ob_eval->trackflag; workob->upflag = ob_eval->upflag; - + workob->partype = ob_eval->partype; workob->par1 = ob_eval->par1; workob->par2 = ob_eval->par2; @@ -2303,7 +2303,7 @@ BoundBox *BKE_boundbox_alloc_unit(void) bb = MEM_callocN(sizeof(BoundBox), "OB-BoundBox"); BKE_boundbox_init_from_minmax(bb, min, max); - + return bb; } @@ -2311,7 +2311,7 @@ void BKE_boundbox_init_from_minmax(BoundBox *bb, const float min[3], const float { bb->vec[0][0] = bb->vec[1][0] = bb->vec[2][0] = bb->vec[3][0] = min[0]; bb->vec[4][0] = bb->vec[5][0] = bb->vec[6][0] = bb->vec[7][0] = max[0]; - + bb->vec[0][1] = bb->vec[1][1] = bb->vec[4][1] = bb->vec[5][1] = min[1]; bb->vec[2][1] = bb->vec[3][1] = bb->vec[6][1] = bb->vec[7][1] = max[1]; @@ -2346,7 +2346,7 @@ void BKE_boundbox_minmax(const BoundBox *bb, float obmat[4][4], float r_min[3], BoundBox *BKE_object_boundbox_get(Object *ob) { BoundBox *bb = NULL; - + if (ob->type == OB_MESH) { bb = BKE_mesh_boundbox_get(ob); } @@ -2378,13 +2378,13 @@ void BKE_object_boundbox_flag(Object *ob, int flag, const bool set) void BKE_object_dimensions_get(Object *ob, float vec[3]) { BoundBox *bb = NULL; - + bb = BKE_object_boundbox_get(ob); if (bb) { float scale[3]; - + mat4_to_size(scale, ob->obmat); - + vec[0] = fabsf(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]); vec[1] = fabsf(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]); vec[2] = fabsf(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]); @@ -2397,17 +2397,17 @@ void BKE_object_dimensions_get(Object *ob, float vec[3]) void BKE_object_dimensions_set(Object *ob, const float value[3]) { BoundBox *bb = NULL; - + bb = BKE_object_boundbox_get(ob); if (bb) { float scale[3], len[3]; - + mat4_to_size(scale, ob->obmat); - + len[0] = bb->vec[4][0] - bb->vec[0][0]; len[1] = bb->vec[2][1] - bb->vec[0][1]; len[2] = bb->vec[1][2] - bb->vec[0][2]; - + if (len[0] > 0.f) ob->size[0] = value[0] / len[0]; if (len[1] > 0.f) ob->size[1] = value[1] / len[1]; if (len[2] > 0.f) ob->size[2] = value[2] / len[2]; @@ -2419,7 +2419,7 @@ void BKE_object_minmax(Object *ob, float min_r[3], float max_r[3], const bool us BoundBox bb; float vec[3]; bool changed = false; - + switch (ob->type) { case OB_CURVE: case OB_FONT: @@ -2767,7 +2767,7 @@ void BKE_object_handle_update_ex(Depsgraph *depsgraph, object_handle_update_proxy(depsgraph, scene, ob, do_proxy_update); } -/* WARNING: "scene" here may not be the scene object actually resides in. +/* WARNING: "scene" here may not be the scene object actually resides in. * When dealing with background-sets, "scene" is actually the active scene. * e.g. "scene" <-- set 1 <-- set 2 ("ob" lives here) <-- set 3 <-- ... <-- set n * rigid bodies depend on their world so use BKE_object_handle_update_ex() to also pass along the corrent rigid body world @@ -2812,10 +2812,10 @@ void BKE_object_sculpt_modifiers_changed(Object *ob) int BKE_object_obdata_texspace_get(Object *ob, short **r_texflag, float **r_loc, float **r_size, float **r_rot) { - + if (ob->data == NULL) return 0; - + switch (GS(((ID *)ob->data)->name)) { case ID_ME: { @@ -2919,7 +2919,7 @@ static int pc_cmp(const void *a, const void *b) else return 0; } -int BKE_object_insert_ptcache(Object *ob) +int BKE_object_insert_ptcache(Object *ob) { LinkData *link = NULL; int i = 0; @@ -2944,18 +2944,18 @@ static int pc_findindex(ListBase *listbase, int index) { LinkData *link = NULL; int number = 0; - + if (listbase == NULL) return -1; - + link = listbase->first; while (link) { if (GET_INT_FROM_POINTER(link->data) == index) return number; - + number++; link = link->next; } - + return -1; } @@ -3080,7 +3080,7 @@ static KeyBlock *insert_curvekey(Main *bmain, Object *ob, const char *name, cons } KeyBlock *BKE_object_shapekey_insert(Main *bmain, Object *ob, const char *name, const bool from_mix) -{ +{ switch (ob->type) { case OB_MESH: return insert_meshkey(bmain, ob, name, from_mix); diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c index fb2e824b299..2de81864512 100644 --- a/source/blender/blenkernel/intern/object_deform.c +++ b/source/blender/blenkernel/intern/object_deform.c @@ -133,7 +133,7 @@ bDeformGroup *BKE_object_defgroup_add_name(Object *ob, const char *name) /** * Add a vgroup of default name to object. *Does not* handle MDeformVert data at all! */ -bDeformGroup *BKE_object_defgroup_add(Object *ob) +bDeformGroup *BKE_object_defgroup_add(Object *ob) { return BKE_object_defgroup_add_name(ob, DATA_("Group")); } diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index e48a04c5726..b7748039f62 100644 --- a/source/blender/blenkernel/intern/object_dupli.c +++ b/source/blender/blenkernel/intern/object_dupli.c @@ -124,7 +124,7 @@ static void init_context( static void copy_dupli_context(DupliContext *r_ctx, const DupliContext *ctx, Object *ob, float mat[4][4], int index) { *r_ctx = *ctx; - + /* XXX annoying, previously was done by passing an ID* argument, this at least is more explicit */ if (ctx->gen->type == OB_DUPLICOLLECTION) r_ctx->collection = ctx->object->dup_group; @@ -1253,7 +1253,7 @@ DupliApplyData *duplilist_apply(Depsgraph *depsgraph, Object *ob, Scene *scene, { DupliApplyData *apply_data = NULL; int num_objects = BLI_listbase_count(duplilist); - + if (num_objects > 0) { DupliObject *dob; int i; @@ -1274,7 +1274,7 @@ DupliApplyData *duplilist_apply(Depsgraph *depsgraph, Object *ob, Scene *scene, /* copy obmat from duplis */ copy_m4_m4(apply_data->extra[i].obmat, dob->ob->obmat); copy_m4_m4(dob->ob->obmat, dob->mat); - + /* copy layers from the main duplicator object */ apply_data->extra[i].lay = dob->ob->lay; dob->ob->lay = ob->lay; @@ -1294,7 +1294,7 @@ void duplilist_restore(ListBase *duplilist, DupliApplyData *apply_data) for (dob = duplilist->last, i = apply_data->num_objects - 1; dob; dob = dob->prev, --i) { copy_m4_m4(dob->ob->obmat, apply_data->extra[i].obmat); dob->ob->transflag &= ~OB_DUPLICALCDERIVED; - + dob->ob->lay = apply_data->extra[i].lay; } } diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index 2d8527f23d6..7f3f916964a 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -156,7 +156,7 @@ static float gaussRand(RNG *rng) { /* Note: to avoid numerical problems with very small numbers, we make these variables singe-precision floats, * but later we call the double-precision log() and sqrt() functions instead of logf() and sqrtf(). - */ + */ float x; float y; float length2; diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 07cd28da556..da455faaa86 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -34,7 +34,7 @@ #include <fcntl.h> #include <sys/stat.h> -#ifndef WIN32 +#ifndef WIN32 #include <unistd.h> #else #include <io.h> @@ -90,14 +90,14 @@ int seekPackedFile(PackedFile *pf, int offset, int whence) return(oldseek); } - + void rewindPackedFile(PackedFile *pf) { seekPackedFile(pf, 0, SEEK_SET); } int readPackedFile(PackedFile *pf, void *data, int size) -{ +{ if ((pf != NULL) && (size >= 0) && (data != NULL)) { if (size + pf->seek > pf->size) { size = pf->size - pf->seek; @@ -125,7 +125,7 @@ int countPackedFiles(Main *bmain) VFont *vf; bSound *sound; int count = 0; - + /* let's check if there are packed files... */ for (ima = bmain->image.first; ima; ima = ima->id.next) if (BKE_image_has_packedfile(ima)) @@ -167,7 +167,7 @@ PackedFile *newPackedFileMemory(void *mem, int memlen) PackedFile *pf = MEM_callocN(sizeof(*pf), "PackedFile"); pf->data = mem; pf->size = memlen; - + return pf; } @@ -177,14 +177,14 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char int file, filelen; char name[FILE_MAX]; void *data; - + /* render result has no filename and can be ignored * any other files with no name can be ignored too */ if (filename[0] == '\0') return NULL; //XXX waitcursor(1); - + /* convert relative filenames to absolute filenames */ BLI_strncpy(name, filename, sizeof(name)); @@ -219,7 +219,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char } //XXX waitcursor(0); - + return (pf); } @@ -230,7 +230,7 @@ void packAll(Main *bmain, ReportList *reports, bool verbose) VFont *vfont; bSound *sound; int tot = 0; - + for (ima = bmain->image.first; ima; ima = ima->id.next) { if (BKE_image_has_packedfile(ima) == false && !ID_IS_LINKED(ima)) { if (ima->source == IMA_SRC_FILE) { @@ -257,7 +257,7 @@ void packAll(Main *bmain, ReportList *reports, bool verbose) tot++; } } - + if (tot > 0) BKE_reportf(reports, RPT_INFO, "Packed %d files", tot); else if (verbose) @@ -275,7 +275,7 @@ static char *find_new_name(char *name) char tempname[FILE_MAX]; char *newname; size_t len; - + if (fop_exists(name)) { for (number = 1; number <= 999; number++) { BLI_snprintf(tempname, sizeof(tempname), "%s.%03d", name, number); @@ -300,12 +300,12 @@ int writePackedFile( char name[FILE_MAX]; char tempname[FILE_MAX]; /* void *data; */ - + if (guimode) {} //XXX waitcursor(1); - + BLI_strncpy(name, filename, sizeof(name)); BLI_path_abs(name, ref_file_name); - + if (BLI_exists(name)) { for (number = 1; number <= 999; number++) { BLI_snprintf(tempname, sizeof(tempname), "%s.%03d_", name, number); @@ -317,10 +317,10 @@ int writePackedFile( } } } - + /* make sure the path to the file exists... */ BLI_make_existing_file(name); - + file = BLI_open(name, O_BINARY + O_WRONLY + O_CREAT + O_TRUNC, 0666); if (file == -1) { BKE_reportf(reports, RPT_ERROR, "Error creating file '%s'", name); @@ -334,10 +334,10 @@ int writePackedFile( else { BKE_reportf(reports, RPT_INFO, "Saved packed file to: %s", name); } - + close(file); } - + if (remove_tmp) { if (ret_value == RET_ERROR) { if (BLI_rename(tempname, name) != 0) { @@ -350,7 +350,7 @@ int writePackedFile( } } } - + if (guimode) {} //XXX waitcursor(0); return (ret_value); @@ -370,10 +370,10 @@ int checkPackedFile(const char *ref_file_name, const char *filename, PackedFile int ret_val, i, len, file; char buf[4096]; char name[FILE_MAX]; - + BLI_strncpy(name, filename, sizeof(name)); BLI_path_abs(name, ref_file_name); - + if (BLI_stat(name, &st) == -1) { ret_val = PF_NOFILE; } @@ -408,11 +408,11 @@ int checkPackedFile(const char *ref_file_name, const char *filename, PackedFile } } } - + close(file); } } - + return(ret_val); } @@ -430,7 +430,7 @@ char *unpackFile( { char *newname = NULL; const char *temp = NULL; - + if (pf != NULL) { switch (how) { case -1: @@ -484,12 +484,12 @@ char *unpackFile( printf("unpackFile: unknown return_value %d\n", how); break; } - + if (temp) { newname = BLI_strdup(temp); } } - + return newname; } @@ -539,7 +539,7 @@ int unpackVFont(Main *bmain, ReportList *reports, VFont *vfont, int how) char localname[FILE_MAX], absname[FILE_MAX]; char *newname; int ret_value = RET_ERROR; - + if (vfont != NULL) { unpack_generate_paths(vfont->name, (ID *)vfont, absname, localname, sizeof(absname), sizeof(localname)); newname = unpackFile(reports, BKE_main_blendfile_path(bmain), absname, localname, vfont->packedfile, how); @@ -551,7 +551,7 @@ int unpackVFont(Main *bmain, ReportList *reports, VFont *vfont, int how) MEM_freeN(newname); } } - + return (ret_value); } @@ -576,7 +576,7 @@ int unpackSound(Main *bmain, ReportList *reports, bSound *sound, int how) ret_value = RET_OK; } } - + return(ret_value); } @@ -633,16 +633,16 @@ int unpackLibraries(Main *bmain, ReportList *reports) Library *lib; char *newname; int ret_value = RET_ERROR; - + for (lib = bmain->library.first; lib; lib = lib->id.next) { if (lib->packedfile && lib->name[0]) { - + newname = unpackFile(reports, BKE_main_blendfile_path(bmain), lib->filepath, lib->filepath, lib->packedfile, PF_WRITE_ORIGINAL); if (newname != NULL) { ret_value = RET_OK; - + printf("Unpacked .blend library: %s\n", newname); - + freePackedFile(lib->packedfile); lib->packedfile = NULL; @@ -650,24 +650,24 @@ int unpackLibraries(Main *bmain, ReportList *reports) } } } - + return(ret_value); } void packLibraries(Main *bmain, ReportList *reports) { Library *lib; - + /* test for relativenss */ for (lib = bmain->library.first; lib; lib = lib->id.next) if (!BLI_path_is_rel(lib->name)) break; - + if (lib) { BKE_reportf(reports, RPT_ERROR, "Cannot pack absolute file: '%s'", lib->name); return; } - + for (lib = bmain->library.first; lib; lib = lib->id.next) if (lib->packedfile == NULL) lib->packedfile = newPackedFile(reports, lib->name, BKE_main_blendfile_path(bmain)); diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 7403f458c49..c1c3cbf1ca3 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -164,7 +164,7 @@ Paint *BKE_paint_get_active(Scene *sce, ViewLayer *view_layer) { if (sce && view_layer) { ToolSettings *ts = sce->toolsettings; - + if (view_layer->basact && view_layer->basact->object) { switch (view_layer->basact->object->mode) { case OB_MODE_SCULPT: @@ -607,7 +607,7 @@ float paint_grid_paint_mask(const GridPaintMask *gpm, unsigned level, { int factor = BKE_ccg_factor(level, gpm->level); int gridsize = BKE_ccg_gridsize(gpm->level); - + return gpm->data[(y * factor) * gridsize + (x * factor)]; } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 0ae6d2a3f2d..41445492c04 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -201,7 +201,7 @@ ParticleSystem *psys_get_current(Object *ob) if (psys->flag & PSYS_CURRENT) return psys; } - + return NULL; } short psys_get_current_num(Object *ob) @@ -214,7 +214,7 @@ short psys_get_current_num(Object *ob) for (psys = ob->particlesystem.first, i = 0; psys; psys = psys->next, i++) if (psys->flag & PSYS_CURRENT) return i; - + return i; } void psys_set_current_num(Object *ob, int index) @@ -426,7 +426,7 @@ int psys_uses_gravity(ParticleSimulationData *sim) static void fluid_free_settings(SPHFluidSettings *fluid) { if (fluid) - MEM_freeN(fluid); + MEM_freeN(fluid); } /** Free (or release) any data used by this particle settings (does not free the partsett itself). */ @@ -435,7 +435,7 @@ void BKE_particlesettings_free(ParticleSettings *part) int a; BKE_animdata_free((ID *)part, false); - + for (a = 0; a < MAX_MTEX; a++) { MEM_SAFE_FREE(part->mtex[a]); } @@ -446,7 +446,7 @@ void BKE_particlesettings_free(ParticleSettings *part) curvemapping_free(part->roughcurve); if (part->twistcurve) curvemapping_free(part->twistcurve); - + free_partdeflect(part->pd); free_partdeflect(part->pd2); @@ -477,7 +477,7 @@ void free_hair(Object *UNUSED(ob), ParticleSystem *psys, int dynamics) psys->pointcache = NULL; modifier_free((ModifierData *)psys->clmd); - + psys->clmd = NULL; psys->pointcache = BKE_ptcache_add(&psys->ptcaches); } @@ -556,10 +556,10 @@ void psys_free_particles(ParticleSystem *psys) MEM_freeN(pa->hair); } } - + if (psys->particles->keys) MEM_freeN(psys->particles->keys); - + if (psys->particles->boid) MEM_freeN(psys->particles->boid); @@ -594,11 +594,11 @@ void psys_free_pdd(ParticleSystem *psys) } /* free everything */ void psys_free(Object *ob, ParticleSystem *psys) -{ +{ if (psys) { int nr = 0; ParticleSystem *tpsys; - + psys_free_path_cache(psys, NULL); free_hair(ob, psys, 1); @@ -613,7 +613,7 @@ void psys_free(Object *ob, ParticleSystem *psys) psys->child = NULL; psys->totchild = 0; } - + /* check if we are last non-visible particle system */ for (tpsys = ob->particlesystem.first; tpsys; tpsys = tpsys->next) { if (tpsys->part) { @@ -631,7 +631,7 @@ void psys_free(Object *ob, ParticleSystem *psys) BKE_ptcache_free_list(&psys->ptcaches); psys->pointcache = NULL; - + BLI_freelistN(&psys->targets); BLI_bvhtree_free(psys->bvhtree); @@ -665,7 +665,7 @@ static float interpolate_particle_value(float v1, float v2, float v3, float v4, value += w[3] * v4; CLAMP(value, 0.f, 1.f); - + return value; } @@ -918,7 +918,7 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData while (pind->kkey[1]->time < real_t) pind->kkey[1]++; - + pind->kkey[0] = pind->kkey[1] - 1; } else if (pind->cache) { @@ -1079,7 +1079,7 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or if (mface->v4) { v4 = mvert[mface->v4].co; normal_short_to_float_v3(n4, mvert[mface->v4].no); - + interp_v3_v3v3v3v3(vec, v1, v2, v3, v4, w); if (nor) { @@ -1099,7 +1099,7 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or normal_tri_v3(nor, v1, v2, v3); } } - + /* calculate tangent vectors */ if (utan && vtan) { if (tface) { @@ -1199,7 +1199,7 @@ void psys_interpolate_mcol(const MCol *mcol, int quad, const float w[4], MCol *m cp1 = (const char *)&mcol[0]; cp2 = (const char *)&mcol[1]; cp3 = (const char *)&mcol[2]; - + if (quad) { cp4 = (char *)&mcol[3]; @@ -1230,7 +1230,7 @@ static float psys_interpolate_value_from_verts(Mesh *mesh, short from, int index MFace *mf = &mesh->mface[index]; return interpolate_particle_value(values[mf->v1], values[mf->v2], values[mf->v3], values[mf->v4], fw, mf->v4); } - + } return 0.0f; } @@ -1253,7 +1253,7 @@ static void psys_origspace_to_w(OrigSpaceFace *osface, int quad, const float w[4 psys_w_to_origspace(w, co); co[2] = 0.0f; - + if (quad) { v[3][0] = osface->uv[3][0]; v[3][1] = osface->uv[3][1]; v[3][2] = 0.0f; interp_weights_poly_v3(neww, v, 4, co); @@ -1336,7 +1336,7 @@ int psys_particle_dm_face_lookup( } psys_w_to_origspace(fw, uv); - + if (poly_nodes) { /* we can have a restricted linked list of faces to check, faster! */ LinkNode *tessface_node = poly_nodes[pindex_orig]; @@ -1516,7 +1516,7 @@ float psys_particle_value_from_verts(Mesh *mesh, short from, ParticleData *pa, f if (!psys_map_index_on_dm(mesh, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, &mapindex, mapfw)) return 0.0f; - + return psys_interpolate_value_from_verts(mesh, from, mapindex, mapfw, values); } @@ -1590,13 +1590,13 @@ CustomDataMask psys_emitter_customdata_mask(ParticleSystem *psys) break; } } - + /* particles only need this if they are after a non deform modifier, and * the modifier stack will only create them in that case. */ dataMask |= CD_MASK_ORIGSPACE_MLOOP | CD_MASK_ORIGINDEX; dataMask |= CD_MASK_ORCO; - + return dataMask; } @@ -1640,10 +1640,10 @@ void precalc_guides(ParticleSimulationData *sim, ListBase *effectors) LOOP_PARTICLES { psys_particle_on_emitter(sim->psmd, sim->psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, state.co, 0, 0, 0, 0); - + mul_m4_v3(sim->ob->obmat, state.co); mul_mat3_m4_v3(sim->ob->obmat, state.vel); - + pd_point_from_particle(sim, pa, &state, &point); for (eff = effectors->first; eff; eff = eff->next) { @@ -1681,22 +1681,22 @@ int do_guides(Depsgraph *depsgraph, ParticleSettings *part, ListBase *effectors, if (effectors) for (eff = effectors->first; eff; eff = eff->next) { pd = eff->pd; - + if (pd->forcefield != PFIELD_GUIDE) continue; - + data = eff->guide_data + index; - + if (data->strength <= 0.0f) continue; - + guidetime = time / (1.0f - pd->free_end); - + if (guidetime > 1.0f) continue; - + cu = (Curve *)eff->ob->data; - + if (pd->flag & PFIELD_GUIDE_PATH_ADD) { if (where_on_path(eff->ob, data->strength * guidetime, guidevec, guidedir, NULL, &radius, &weight) == 0) return 0; @@ -1705,14 +1705,14 @@ int do_guides(Depsgraph *depsgraph, ParticleSettings *part, ListBase *effectors, if (where_on_path(eff->ob, guidetime, guidevec, guidedir, NULL, &radius, &weight) == 0) return 0; } - + mul_m4_v3(eff->ob->obmat, guidevec); mul_mat3_m4_v3(eff->ob->obmat, guidedir); - + normalize_v3(guidedir); - + copy_v3_v3(vec_to_point, data->vec_to_point); - + if (guidetime != 0.0f) { /* curve direction */ cross_v3_v3v3(temp, eff->guide_dir, guidedir); @@ -1720,52 +1720,52 @@ int do_guides(Depsgraph *depsgraph, ParticleSettings *part, ListBase *effectors, angle = saacos(angle); axis_angle_to_quat(rot2, temp, angle); mul_qt_v3(rot2, vec_to_point); - + /* curve tilt */ axis_angle_to_quat(rot2, guidedir, guidevec[3] - eff->guide_loc[3]); mul_qt_v3(rot2, vec_to_point); } - + /* curve taper */ if (cu->taperobj) mul_v3_fl(vec_to_point, BKE_displist_calc_taper(depsgraph, eff->scene, cu->taperobj, (int)(data->strength * guidetime * 100.0f), 100)); - + else { /* curve size*/ if (cu->flag & CU_PATH_RADIUS) { mul_v3_fl(vec_to_point, radius); } } - + if (clumpcurve) curvemapping_changed_all(clumpcurve); if (roughcurve) curvemapping_changed_all(roughcurve); - + { ParticleKey key; float par_co[3] = {0.0f, 0.0f, 0.0f}; float par_vel[3] = {0.0f, 0.0f, 0.0f}; float par_rot[4] = {1.0f, 0.0f, 0.0f, 0.0f}; float orco_offset[3] = {0.0f, 0.0f, 0.0f}; - + copy_v3_v3(key.co, vec_to_point); do_kink(&key, par_co, par_vel, par_rot, guidetime, pd->kink_freq, pd->kink_shape, pd->kink_amp, 0.f, pd->kink, pd->kink_axis, 0, 0); do_clump(&key, par_co, guidetime, orco_offset, pd->clump_fac, pd->clump_pow, 1.0f, part->child_flag & PART_CHILD_USE_CLUMP_NOISE, part->clump_noise_size, clumpcurve); copy_v3_v3(vec_to_point, key.co); } - + add_v3_v3(vec_to_point, guidevec); - + //sub_v3_v3v3(pa_loc, pa_loc, pa_zero); madd_v3_v3fl(effect, vec_to_point, data->strength); madd_v3_v3fl(veffect, guidedir, data->strength); totstrength += data->strength; - + if (pd->flag & PFIELD_GUIDE_PATH_WEIGHT) totstrength *= weight; } - + if (totstrength != 0.0f) { if (totstrength > 1.0f) mul_v3_fl(effect, 1.0f / totstrength); @@ -1922,7 +1922,7 @@ static bool psys_thread_context_init_path( if (totchild && part->childtype == PART_CHILD_FACES) { totparent = (int)(totchild * part->parents * 0.3f); - + if (use_render_params && part->child_nbr && part->ren_child_nbr) totparent *= (float)part->child_nbr / (float)part->ren_child_nbr; @@ -1996,7 +1996,7 @@ static void psys_task_init_path(ParticleTask *task, ParticleSimulationData *sim) { /* init random number generator */ int seed = 31415926 + sim->psys->seed; - + task->rng_path = BLI_rng_new(seed); } @@ -2104,7 +2104,7 @@ static void psys_thread_create_path(ParticleTask *task, struct ChildParticle *cp /* get the original coordinates (orco) for texture usage */ cpa_num = cpa->num; - + foffset = cpa->foffset; cpa_fuv = cpa->fuv; cpa_from = PART_FROM_FACE; @@ -2253,14 +2253,14 @@ static void psys_thread_create_path(ParticleTask *task, struct ChildParticle *cp if (pa->flag & PARS_UNEXIST) pa = NULL; } - + if (pa) { ListBase modifiers; BLI_listbase_clear(&modifiers); - + psys_particle_on_emitter(ctx->sim.psmd, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, par_co, NULL, NULL, NULL, par_orco); - + psys_apply_child_modifiers(ctx, &modifiers, cpa, &ptex, orco, hairmat, child_keys, par, par_orco); } else @@ -2298,57 +2298,57 @@ void psys_cache_child_paths( ParticleTask *tasks_parent, *tasks_child; int numtasks_parent, numtasks_child; int i, totchild, totparent; - + if (sim->psys->flag & PSYS_GLOBAL_HAIR) return; - + /* create a task pool for child path tasks */ if (!psys_thread_context_init_path(&ctx, sim, sim->scene, cfra, editupdate, use_render_params)) return; - + task_scheduler = BLI_task_scheduler_get(); task_pool = BLI_task_pool_create(task_scheduler, &ctx); totchild = ctx.totchild; totparent = ctx.totparent; - + if (editupdate && sim->psys->childcache && totchild == sim->psys->totchildcache) { ; /* just overwrite the existing cache */ } else { /* clear out old and create new empty path cache */ free_child_path_cache(sim->psys); - + sim->psys->childcache = psys_alloc_path_cache_buffers(&sim->psys->childcachebufs, totchild, ctx.segments + ctx.extra_segments + 1); sim->psys->totchildcache = totchild; } - + /* cache parent paths */ ctx.parent_pass = 1; psys_tasks_create(&ctx, 0, totparent, &tasks_parent, &numtasks_parent); for (i = 0; i < numtasks_parent; ++i) { ParticleTask *task = &tasks_parent[i]; - + psys_task_init_path(task, sim); BLI_task_pool_push(task_pool, exec_child_path_cache, task, false, TASK_PRIORITY_LOW); } BLI_task_pool_work_and_wait(task_pool); - + /* cache child paths */ ctx.parent_pass = 0; psys_tasks_create(&ctx, totparent, totchild, &tasks_child, &numtasks_child); for (i = 0; i < numtasks_child; ++i) { ParticleTask *task = &tasks_child[i]; - + psys_task_init_path(task, sim); BLI_task_pool_push(task_pool, exec_child_path_cache, task, false, TASK_PRIORITY_LOW); } BLI_task_pool_work_and_wait(task_pool); BLI_task_pool_free(task_pool); - + psys_tasks_free(tasks_parent, numtasks_parent); psys_tasks_free(tasks_child, numtasks_child); - + psys_thread_context_free(&ctx); } @@ -2404,15 +2404,15 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re ParticleCacheKey *ca, **cache; Mesh *hair_mesh = (psys->part->type == PART_HAIR && psys->flag & PSYS_HAIR_DYNAMICS) ? psys->hair_out_mesh : NULL; - + ParticleKey result; - + Material *ma; ParticleInterpolationData pind; ParticleTexture ptex; PARTICLE_P; - + float birthtime = 0.0, dietime = 0.0; float t, time = 0.0, dfra = 1.0 /* , frs_sec = sim->scene->r.frs_sec*/ /*UNUSED*/; float col[4] = {0.5f, 0.5f, 0.5f, 1.0f}; @@ -2449,7 +2449,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re if ((psys->flag & PSYS_GLOBAL_HAIR) == 0) { if ((psys->part->flag & PART_CHILD_EFFECT) == 0) vg_effector = psys_cache_vgroup(psmd->mesh_final, psys, PSYS_VG_EFFECTOR); - + if (!psys->totchild) vg_length = psys_cache_vgroup(psmd->mesh_final, psys, PSYS_VG_LENGTH); } @@ -2524,7 +2524,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra, const bool use_re if (part->type == PART_HAIR) { HairKey *hkey; - + for (k = 0, hkey = pa->hair; k < pa->totkey; ++k, ++hkey) { mul_v3_m4v3(hkey->world_co, hairmat, hkey->co); } @@ -2777,7 +2777,7 @@ void psys_cache_edit_paths(Depsgraph *depsgraph, Scene *scene, Object *ob, PTCac { ParticleCacheKey **cache = edit->pathcache; ParticleEditSettings *pset = &scene->toolsettings->particle; - + ParticleSystem *psys = edit->psys; ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys); @@ -2924,7 +2924,7 @@ static void triatomat(float *v1, float *v2, float *v3, float (*uv)[2], float mat sub_v3_v3v3(mat[1], v2, v1); normalize_v3(mat[1]); } - + /* third as a cross product */ cross_v3_v3v3(mat[0], mat[1], mat[2]); } @@ -2941,7 +2941,7 @@ static void psys_face_mat(Object *ob, Mesh *mesh, ParticleData *pa, float mat[4] mface = &mesh->mface[i]; osface = CustomData_get(&mesh->fdata, i, CD_ORIGSPACE); - + if (orco && (orcodata = CustomData_get_layer(&mesh->vdata, CD_ORCO))) { copy_v3_v3(v[0], orcodata[mface->v1]); copy_v3_v3(v[1], orcodata[mface->v2]); @@ -2970,7 +2970,7 @@ void psys_mat_hair_to_object(Object *UNUSED(ob), Mesh *mesh, short from, Particl unit_m4(hairmat); return; } - + psys_face_mat(0, mesh, pa, hairmat, 0); psys_particle_on_dm(mesh, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, vec, 0, 0, 0, 0); copy_v3_v3(hairmat[3], vec); @@ -3098,7 +3098,7 @@ void object_remove_particle_system(Main *bmain, Scene *UNUSED(scene), Object *ob DEG_relations_tag_update(bmain); DEG_id_tag_update(&ob->id, OB_RECALC_DATA); - + /* Flush object mode. */ DEG_id_tag_update(&ob->id, DEG_TAG_COPY_ON_WRITE); } @@ -3122,7 +3122,7 @@ static void default_particle_settings(ParticleSettings *part) part->grid_res = 10; part->timetweak = 1.0; part->courant_target = 0.2; - + part->integrator = PART_INT_MIDPOINT; part->phystype = PART_PHYS_NEWTON; part->hair_step = 5; @@ -3195,7 +3195,7 @@ ParticleSettings *BKE_particlesettings_add(Main *bmain, const char *name) ParticleSettings *part; part = BKE_libblock_alloc(bmain, ID_PA, name, 0); - + default_particle_settings(part); return part; @@ -3204,24 +3204,24 @@ ParticleSettings *BKE_particlesettings_add(Main *bmain, const char *name) void BKE_particlesettings_clump_curve_init(ParticleSettings *part) { CurveMapping *cumap = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); - + cumap->cm[0].curve[0].x = 0.0f; cumap->cm[0].curve[0].y = 1.0f; cumap->cm[0].curve[1].x = 1.0f; cumap->cm[0].curve[1].y = 1.0f; - + part->clumpcurve = cumap; } void BKE_particlesettings_rough_curve_init(ParticleSettings *part) { CurveMapping *cumap = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); - + cumap->cm[0].curve[0].x = 0.0f; cumap->cm[0].curve[0].y = 1.0f; cumap->cm[0].curve[1].x = 1.0f; cumap->cm[0].curve[1].y = 1.0f; - + part->roughcurve = cumap; } @@ -3296,7 +3296,7 @@ static int get_particle_uv(Mesh *mesh, ParticleData *pa, int index, const float MFace *mf; MTFace *tf; int i; - + tf = CustomData_get_layer_named(&mesh->fdata, CD_MTFACE, name); if (tf == NULL) @@ -3493,7 +3493,7 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex ATTR_FALLTHROUGH; case TEXCO_ORCO: psys_particle_on_emitter(sim->psmd, sim->psys->part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, 0, 0, 0, texvec); - + if (me->bb == NULL || (me->bb->flag & BOUNDBOX_DIRTY)) { BKE_mesh_texspace_calc(me); } @@ -3589,7 +3589,7 @@ float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float UNUSED { ParticleSettings *part = psys->part; float size; // time XXX - + if (part->childtype == PART_CHILD_FACES) { int w = 0; size = 0.0; @@ -3726,7 +3726,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey * } else { float par_co[3], par_orco[3]; - + cpa = psys->child + p - totpart; if (state->time < 0.0f) @@ -4003,9 +4003,9 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta /* convert velocity to timestep size */ mul_v3_fl(keys[1].vel, dfra * timestep); mul_v3_fl(keys[2].vel, dfra * timestep); - + psys_interpolate_particle(-1, keys, keytime, state, 1); - + /* convert back to real velocity */ mul_v3_fl(state->vel, 1.f / (dfra * timestep)); @@ -4031,7 +4031,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta if (sim->psys->lattice_deform_data) calc_latt_deform(sim->psys->lattice_deform_data, state->co, psys->lattice_strength); } - + return 1; } } @@ -4069,7 +4069,7 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, mtface += cpa->num; psys_interpolate_uvs(mtface, mface->v4, cpa->fuv, uv); } - + psys_particle_on_emitter(psmd, PART_FROM_FACE, cpa->num, DMCACHE_ISCHILD, cpa->fuv, cpa->foffset, loc, 0, 0, 0, orco); return; } @@ -4281,7 +4281,7 @@ void psys_apply_hair_lattice(Depsgraph *depsgraph, Scene *scene, Object *ob, Par mul_m4_v3(imat, hkey->co); } } - + end_latt_deform(psys->lattice_deform_data); psys->lattice_deform_data = NULL; diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c index 05ce45e3900..2e056aa7a3f 100644 --- a/source/blender/blenkernel/intern/particle_distribute.c +++ b/source/blender/blenkernel/intern/particle_distribute.c @@ -94,7 +94,7 @@ static void distribute_simple_children(Scene *scene, Object *ob, Mesh *final_mes for (p=0; p<psys->totpart; p++,cpa++) { float length=2.0; cpa->parent=p; - + /* create even spherical distribution inside unit sphere */ while (length>=1.0f) { cpa->fuv[0]=2.0f*BLI_rng_get_float(rng)-1.0f; @@ -138,7 +138,7 @@ static void distribute_grid(Mesh *mesh, ParticleSystem *psys) /* determine major axis */ axis = axis_dominant_v3_single(delta); - + d = delta[axis]/(float)res; size[axis] = res; @@ -200,7 +200,7 @@ static void distribute_grid(Mesh *mesh, ParticleSystem *psys) totface = mesh->totface; mface = mface_array = mesh->mface; - + for (a=0; a<amax; a++) { if (a==0) { a0mul=res*res; a1mul=res; a2mul=1; } else if (a==1) { a0mul=res; a1mul=1; a2mul=res*res; } @@ -349,13 +349,13 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount) x= 0; num2 = 2 * num; for (i=0; i<num2; i+=2) { - + jit[i] = x + amount*rad1*(0.5f - BLI_rng_get_float(rng)); jit[i+1] = i/(2.0f*num) + amount*rad1*(0.5f - BLI_rng_get_float(rng)); - + jit[i]-= (float)floor(jit[i]); jit[i+1]-= (float)floor(jit[i+1]); - + x+= rad3; x -= (float)floor(x); } @@ -416,10 +416,10 @@ static int distribute_binary_search(float *sum, int n, float value) while (low < high) { mid = (low + high) / 2; - + if ((sum[mid] >= value) && (sum[mid - 1] < value)) return mid; - + if (sum[mid] > value) { high = mid - 1; } @@ -471,22 +471,22 @@ static void distribute_from_verts_exec(ParticleTask *thread, ParticleData *pa, i } } } - + #if ONLY_WORKING_WITH_PA_VERTS if (ctx->tree) { KDTreeNearest ptn[3]; int w, maxw; - + psys_particle_on_dm(ctx->mesh,from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co1,0,0,0,orco1,0); BKE_mesh_orco_verts_transform((Mesh*)ob->data, &orco1, 1, 1); maxw = BLI_kdtree_find_nearest_n(ctx->tree,orco1,ptn,3); - + for (w=0; w<maxw; w++) { pa->verts[w]=ptn->num; } } #endif - + BLI_assert(rng_skip_tot > 0); /* should never be below zero */ if (rng_skip_tot > 0) { BLI_rng_skip(thread->rng, rng_skip_tot); @@ -502,10 +502,10 @@ static void distribute_from_faces_exec(ParticleTask *thread, ParticleData *pa, i int rng_skip_tot= PSYS_RND_DIST_SKIP; /* count how many rng_* calls wont need skipping */ MFace *mface; - + pa->num = i = ctx->index[p]; mface = &mesh->mface[i]; - + switch (distr) { case PART_DISTR_JIT: if (ctx->jitlevel == 1) { @@ -525,7 +525,7 @@ static void distribute_from_faces_exec(ParticleTask *thread, ParticleData *pa, i randu= BLI_rng_get_float(thread->rng); randv= BLI_rng_get_float(thread->rng); rng_skip_tot -= 2; - + psys_uv_to_w(randu, randv, mface->v4, pa->fuv); break; } @@ -545,13 +545,13 @@ static void distribute_from_volume_exec(ParticleTask *thread, ParticleData *pa, int distr= ctx->distr; int i, intersect, tot; int rng_skip_tot= PSYS_RND_DIST_SKIP; /* count how many rng_* calls wont need skipping */ - + MFace *mface; MVert *mvert = mesh->mvert; - + pa->num = i = ctx->index[p]; mface = &mesh->mface[i]; - + switch (distr) { case PART_DISTR_JIT: if (ctx->jitlevel == 1) { @@ -571,30 +571,30 @@ static void distribute_from_volume_exec(ParticleTask *thread, ParticleData *pa, randu= BLI_rng_get_float(thread->rng); randv= BLI_rng_get_float(thread->rng); rng_skip_tot -= 2; - + psys_uv_to_w(randu, randv, mface->v4, pa->fuv); break; } pa->foffset= 0.0f; - + /* experimental */ tot = mesh->totface; - + psys_interpolate_face(mvert,mface,0,0,pa->fuv,co,nor,0,0,0); - + normalize_v3(nor); negate_v3(nor); - + min_d=FLT_MAX; intersect=0; - + for (i=0, mface=mesh->mface; i<tot; i++,mface++) { if (i==pa->num) continue; - + v1=mvert[mface->v1].co; v2=mvert[mface->v2].co; v3=mvert[mface->v3].co; - + if (isect_ray_tri_v3(co, nor, v2, v3, v1, &cur_d, NULL)) { if (cur_d<min_d) { min_d=cur_d; @@ -604,7 +604,7 @@ static void distribute_from_volume_exec(ParticleTask *thread, ParticleData *pa, } if (mface->v4) { v4=mvert[mface->v4].co; - + if (isect_ray_tri_v3(co, nor, v4, v1, v3, &cur_d, NULL)) { if (cur_d<min_d) { min_d=cur_d; @@ -627,7 +627,7 @@ static void distribute_from_volume_exec(ParticleTask *thread, ParticleData *pa, break; } } - + BLI_assert(rng_skip_tot > 0); /* should never be below zero */ if (rng_skip_tot > 0) { BLI_rng_skip(thread->rng, rng_skip_tot); @@ -643,40 +643,40 @@ static void distribute_children_exec(ParticleTask *thread, ChildParticle *cpa, i int cfrom= ctx->cfrom; int i; int rng_skip_tot= PSYS_RND_DIST_SKIP; /* count how many rng_* calls wont need skipping */ - + MFace *mf; - + if (ctx->index[p] < 0) { cpa->num=0; cpa->fuv[0]=cpa->fuv[1]=cpa->fuv[2]=cpa->fuv[3]=0.0f; cpa->pa[0]=cpa->pa[1]=cpa->pa[2]=cpa->pa[3]=0; return; } - + mf = &mesh->mface[ctx->index[p]]; - + randu= BLI_rng_get_float(thread->rng); randv= BLI_rng_get_float(thread->rng); rng_skip_tot -= 2; - + psys_uv_to_w(randu, randv, mf->v4, cpa->fuv); - + cpa->num = ctx->index[p]; - + if (ctx->tree) { KDTreeNearest ptn[10]; int w,maxw;//, do_seams; float maxd /*, mind,dd */, totw= 0.0f; int parent[10]; float pweight[10]; - + psys_particle_on_dm(mesh,cfrom,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co1,nor1,NULL,NULL,orco1); BKE_mesh_orco_verts_transform((Mesh*)ob->data, &orco1, 1, 1); maxw = BLI_kdtree_find_nearest_n(ctx->tree,orco1,ptn,3); - + maxd=ptn[maxw-1].dist; /* mind=ptn[0].dist; */ /* UNUSED */ - + /* the weights here could be done better */ for (w=0; w<maxw; w++) { parent[w]=ptn[w].index; @@ -686,7 +686,7 @@ static void distribute_children_exec(ParticleTask *thread, ChildParticle *cpa, i parent[w]=-1; pweight[w]=0.0f; } - + for (w=0,i=0; w<maxw && i<4; w++) { if (parent[w]>=0) { cpa->pa[i]=parent[w]; @@ -699,13 +699,13 @@ static void distribute_children_exec(ParticleTask *thread, ChildParticle *cpa, i cpa->pa[i]=-1; cpa->w[i]=0.0f; } - + if (totw > 0.0f) { for (w = 0; w < 4; w++) { cpa->w[w] /= totw; } } - + cpa->parent=cpa->pa[0]; } @@ -721,7 +721,7 @@ static void exec_distribute_parent(TaskPool * __restrict UNUSED(pool), void *tas int p; BLI_rng_skip(task->rng, PSYS_RND_DIST_SKIP * task->begin); - + pa= psys->particles + task->begin; switch (psys->part->from) { case PART_FROM_FACE: @@ -745,13 +745,13 @@ static void exec_distribute_child(TaskPool * __restrict UNUSED(pool), void *task ParticleSystem *psys = task->ctx->sim.psys; ChildParticle *cpa; int p; - + /* RNG skipping at the beginning */ cpa = psys->child; for (p = 0; p < task->begin; ++p, ++cpa) { BLI_rng_skip(task->rng, PSYS_RND_DIST_SKIP); } - + for (; p < task->end; ++p, ++cpa) { distribute_children_exec(task, cpa, p); } @@ -829,21 +829,21 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti float *element_weight=NULL,*jitter_offset=NULL, *vweight=NULL; float cur, maxweight=0.0, tweight, totweight, inv_totweight, co[3], nor[3], orco[3]; RNG *rng = NULL; - + if (ELEM(NULL, ob, psys, psys->part)) return 0; - + part=psys->part; totpart=psys->totpart; if (totpart==0) return 0; - + if (!final_mesh->runtime.deformed_only && !CustomData_get_layer(&final_mesh->fdata, CD_ORIGINDEX)) { printf("Can't create particles with the current modifier stack, disable destructive modifiers\n"); // XXX error("Can't paint with the current modifier stack, disable destructive modifiers"); return 0; } - + /* XXX This distribution code is totally broken in case from == PART_FROM_CHILD, it's always using finaldm * even if use_modifier_stack is unset... But making things consistent here break all existing edited * hair systems, so better wait for complete rewrite. @@ -852,7 +852,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti psys_thread_context_init(ctx, sim); const bool use_render_params = (DEG_get_mode(sim->depsgraph) == DAG_EVAL_RENDER); - + /* First handle special cases */ if (from == PART_FROM_CHILD) { /* Simple children */ @@ -887,7 +887,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti return 0; } } - + /* Create trees and original coordinates if needed */ if (from == PART_FROM_CHILD) { distr = PART_DISTR_RAND; @@ -916,7 +916,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti distr = part->distr; rng = BLI_rng_new_srandom(31415926 + psys->seed); - + if (psys->part->use_modifier_stack) mesh = final_mesh; else @@ -981,7 +981,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti MVert *v1, *v2, *v3, *v4; float totarea=0.f, co1[3], co2[3], co3[3], co4[3]; float (*orcodata)[3]; - + orcodata = CustomData_get_layer(&mesh->vdata, CD_ORCO); for (i=0; i<totelem; i++) { @@ -1013,7 +1013,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti } cur = mf->v4 ? area_quad_v3(co1, co2, co3, co4) : area_tri_v3(co1, co2, co3); - + if (cur > maxweight) maxweight = cur; @@ -1045,7 +1045,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti for (i=0;i<totelem; i++) { MFace *mf = &mesh->mface[i]; tweight = vweight[mf->v1] + vweight[mf->v2] + vweight[mf->v3]; - + if (mf->v4) { tweight += vweight[mf->v4]; tweight /= 4.0f; @@ -1118,7 +1118,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti } else { double step, pos; - + step = (totpart < 2) ? 0.5 : 1.0 / (double)totpart; /* This is to address tricky issues with vertex-emitting when user tries (and expects) exact 1-1 vert/part * distribution (see T47983 and its two example files). It allows us to consider pos as @@ -1162,17 +1162,17 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti /* Create jittering if needed */ if (distr==PART_DISTR_JIT && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) { jitlevel= part->userjit; - + if (jitlevel == 0) { jitlevel= totpart/totelem; if (part->flag & PART_EDISTR) jitlevel*= 2; /* looks better in general, not very scientific */ if (jitlevel<3) jitlevel= 3; } - + jit= MEM_callocN((2+ jitlevel*2)*sizeof(float), "jit"); /* for small amounts of particles we use regular jitter since it looks - * a bit better, for larger amounts we switch to hammersley sequence + * a bit better, for larger amounts we switch to hammersley sequence * because it is much faster */ if (jitlevel < 25) init_mv_jit(jit, jitlevel, psys->seed, part->jitfac); @@ -1210,7 +1210,7 @@ static void psys_task_init_distribute(ParticleTask *task, ParticleSimulationData { /* init random number generator */ int seed = 31415926 + sim->psys->seed; - + task->rng = BLI_rng_new(seed); } @@ -1222,19 +1222,19 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from) ParticleTask *tasks; Mesh *final_mesh = sim->psmd->mesh_final; int i, totpart, numtasks; - + /* create a task pool for distribution tasks */ if (!psys_thread_context_init_distribute(&ctx, sim, from)) return; - + task_scheduler = BLI_task_scheduler_get(); task_pool = BLI_task_pool_create(task_scheduler, &ctx); - + totpart = (from == PART_FROM_CHILD ? sim->psys->totchild : sim->psys->totpart); psys_tasks_create(&ctx, 0, totpart, &tasks, &numtasks); for (i = 0; i < numtasks; ++i) { ParticleTask *task = &tasks[i]; - + psys_task_init_distribute(task, sim); if (from == PART_FROM_CHILD) BLI_task_pool_push(task_pool, exec_distribute_child, task, false, TASK_PRIORITY_LOW); @@ -1242,16 +1242,16 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from) BLI_task_pool_push(task_pool, exec_distribute_parent, task, false, TASK_PRIORITY_LOW); } BLI_task_pool_work_and_wait(task_pool); - + BLI_task_pool_free(task_pool); - + psys_calc_dmcache(sim->ob, final_mesh, sim->psmd->mesh_original, sim->psys); - + if (ctx.mesh != final_mesh) BKE_id_free(NULL, ctx.mesh); - + psys_tasks_free(tasks, numtasks); - + psys_thread_context_free(&ctx); } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 81666936c6f..6f05e694982 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -242,7 +242,7 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart) } } } - + if (psys->particles) { totsaved=MIN2(psys->totpart,totpart); /*save old pars*/ @@ -272,7 +272,7 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart) MEM_freeN(psys->particles); psys_free_pdd(psys); } - + psys->particles=newpars; psys->totpart=totpart; @@ -317,14 +317,14 @@ void psys_calc_dmcache(Object *ob, Mesh *mesh_final, Mesh *mesh_original, Partic { /* use for building derived mesh mapping info: * - * node: the allocated links - total derived mesh element count + * node: the allocated links - total derived mesh element count * nodearray: the array of nodes aligned with the base mesh's elements, so * each original elements can reference its derived elements */ Mesh *me= (Mesh*)ob->data; bool use_modifier_stack= psys->part->use_modifier_stack; PARTICLE_P; - + /* CACHE LOCATIONS */ if (!mesh_final->runtime.deformed_only) { /* Will use later to speed up subsurf/derivedmesh */ @@ -428,7 +428,7 @@ void psys_calc_dmcache(Object *ob, Mesh *mesh_final, Mesh *mesh_original, Partic /* TODO PARTICLE, make the following line unnecessary, each function * should know to use the num or num_dmcache, set the num_dmcache to * an invalid value, just in case */ - + LOOP_PARTICLES { pa->num_dmcache = DMCACHE_NOTFOUND; } @@ -457,15 +457,15 @@ void psys_tasks_create(ParticleThreadContext *ctx, int startpart, int endpart, P int numtasks = ceil_ii((endpart - startpart), MAX_PARTICLES_PER_TASK); float particles_per_task = (float)(endpart - startpart) / (float)numtasks, p, pnext; int i; - + tasks = MEM_callocN(sizeof(ParticleTask) * numtasks, "ParticleThread"); *r_numtasks = numtasks; *r_tasks = tasks; - + p = (float)startpart; for (i = 0; i < numtasks; i++, p = pnext) { pnext = p + particles_per_task; - + tasks[i].ctx = ctx; tasks[i].begin = (int)p; tasks[i].end = min_ii((int)pnext, endpart); @@ -475,7 +475,7 @@ void psys_tasks_create(ParticleThreadContext *ctx, int startpart, int endpart, P void psys_tasks_free(ParticleTask *tasks, int numtasks) { int i; - + /* threads */ for (i = 0; i < numtasks; ++i) { if (tasks[i].rng) @@ -537,7 +537,7 @@ static void initialize_particle_texture(ParticleSimulationData *sim, ParticleDat ParticleTexture ptex; psys_get_texture(sim, pa, &ptex, PAMAP_INIT, 0.f); - + switch (part->type) { case PART_EMITTER: if (ptex.exist < psys_frand(psys, p + 125)) { @@ -561,7 +561,7 @@ void initialize_particle(ParticleSimulationData *sim, ParticleData *pa) { ParticleSettings *part = sim->psys->part; float birth_time = (float)(pa - sim->psys->particles) / (float)sim->psys->totpart; - + pa->flag &= ~PARS_UNEXIST; pa->time = part->sta + (part->end - part->sta) * birth_time; @@ -620,7 +620,7 @@ static void free_unexisting_particles(ParticleSimulationData *sim) if (psys->totunexist) { int newtotpart = psys->totpart - psys->totunexist; ParticleData *npa, *newpars; - + npa = newpars = MEM_callocN(newtotpart * sizeof(ParticleData), "particles"); for (p=0, pa=psys->particles; p<newtotpart; p++, pa++, npa++) { @@ -708,7 +708,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,utan,vtan,0); else psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,0,0,0); - + /* get possible textural influence */ psys_get_texture(sim, pa, &ptex, PAMAP_IVEL, cfra); @@ -716,7 +716,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic /* let's convert: */ /* -location */ mul_m4_v3(ob->obmat, loc); - + /* -normal */ mul_mat3_m4_v3(ob->obmat, nor); normalize_v3(nor); @@ -734,10 +734,10 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic copy_v3_v3(utan, nor); mul_v3_fl(utan,dot_v3v3(vtan,nor)); sub_v3_v3(vtan, utan); - + normalize_v3(vtan); } - + /* -velocity (boids need this even if there's no random velocity) */ if (part->randfac != 0.0f || (part->phystype==PART_PHYS_BOIDS && pa->boid)) { @@ -758,7 +758,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic mul_mat3_m4_v3(ob->obmat,r_ave); normalize_v3(r_ave); } - + /* -rotation */ if (part->randrotfac != 0.0f) { r_rot[0] = 2.0f * (psys_frand(psys, p + 16) - 0.5f); @@ -795,7 +795,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic negate_v3_v3(mat[2], r_vel); normalize_v3(mat[2]); cross_v3_v3v3(mat[1], mat[2], mat[0]); - + /* apply rotation */ mat3_to_quat_is_ok( q,mat); copy_qt_qt(state->rot, q); @@ -814,11 +814,11 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic sub_v3_v3v3(vel, loc, state->co); mul_v3_fl(vel, part->obfac/dtime); } - + /* *emitter normal */ if (part->normfac != 0.f) madd_v3_v3fl(vel, nor, part->normfac); - + /* *emitter tangent */ if (sim->psmd && part->tanfac != 0.f) madd_v3_v3fl(vel, vtan, part->tanfac); @@ -847,7 +847,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic /* *particle */ if (part->partfac != 0.f) madd_v3_v3fl(vel, p_vel, part->partfac); - + mul_v3_v3fl(state->vel, vel, ptex.ivel); /* -location from emitter */ @@ -886,7 +886,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic use_global_space = true; break; } - + /* create rotation quat */ @@ -995,7 +995,7 @@ static void evaluate_emitter_anim(struct Depsgraph *depsgraph, Scene *scene, Obj { if (ob->parent) evaluate_emitter_anim(depsgraph, scene, ob->parent, cfra); - + /* we have to force RECALC_ANIM here since where_is_objec_time only does drivers */ BKE_animsys_evaluate_animdata(depsgraph, scene, &ob->id, ob->adt, cfra, ADT_RECALC_ANIM); BKE_object_where_is_calc_time(depsgraph, scene, ob, cfra); @@ -1009,7 +1009,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, ParticleTexture ptex; int p = pa - psys->particles; part=psys->part; - + /* get precise emitter matrix if particle is born */ if (part->type != PART_HAIR && dtime > 0.f && pa->time < cfra && pa->time >= sim->psys->cfra) { evaluate_emitter_anim(sim->depsgraph, sim->scene, sim->ob, pa->time); @@ -1086,7 +1086,7 @@ static void reset_all_particles(ParticleSimulationData *sim, float dtime, float { ParticleData *pa; int p, totpart=sim->psys->totpart; - + for (p=from, pa=sim->psys->particles+from; p<totpart; p++, pa++) reset_particle(sim, pa, dtime, cfra); } @@ -1148,7 +1148,7 @@ static void set_keyed_keys(ParticleSimulationData *sim) ksim.depsgraph = sim->depsgraph; ksim.scene = sim->scene; - + /* no proper targets so let's clear and bail out */ if (psys->totkeyed==0) { free_keyed_keys(psys); @@ -1158,16 +1158,16 @@ static void set_keyed_keys(ParticleSimulationData *sim) if (totpart && psys->particles->totkey != totkeys) { free_keyed_keys(psys); - + key = MEM_callocN(totpart*totkeys*sizeof(ParticleKey), "Keyed keys"); - + LOOP_PARTICLES { pa->keys = key; pa->totkey = totkeys; key += totkeys; } } - + psys->flag &= ~PSYS_KEYED; @@ -1249,17 +1249,17 @@ static void psys_update_particle_bvhtree(ParticleSystem *psys, float cfra) BLI_rw_mutex_lock(&psys_bvhtree_rwlock, THREAD_LOCK_READ); need_rebuild = !psys->bvhtree || psys->bvhtree_frame != cfra; BLI_rw_mutex_unlock(&psys_bvhtree_rwlock); - + if (need_rebuild) { LOOP_SHOWN_PARTICLES { totpart++; } - + BLI_rw_mutex_lock(&psys_bvhtree_rwlock, THREAD_LOCK_WRITE); - + BLI_bvhtree_free(psys->bvhtree); psys->bvhtree = BLI_bvhtree_new(totpart, 0.0, 4, 6); - + LOOP_SHOWN_PARTICLES { if (pa->alive == PARS_ALIVE) { if (pa->state.time == cfra) @@ -1269,9 +1269,9 @@ static void psys_update_particle_bvhtree(ParticleSystem *psys, float cfra) } } BLI_bvhtree_balance(psys->bvhtree); - + psys->bvhtree_frame = cfra; - + BLI_rw_mutex_unlock(&psys_bvhtree_rwlock); } } @@ -1365,7 +1365,7 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d if (external_acceleration) add_v3_v3(acceleration, external_acceleration); - + /* calculate next state */ add_v3_v3(states[i].vel, impulse); @@ -1498,7 +1498,7 @@ static void sph_springs_modify(ParticleSystem *psys, float dtime) SPHFluidSettings *fluid = psys->part->fluid; ParticleData *pa1, *pa2; ParticleSpring *spring = psys->fluid_springs; - + float h, d, Rij[3], rij, Lij; int i; @@ -1591,9 +1591,9 @@ static void sph_evaluate_func(BVHTree *tree, ParticleSystem **psys, float co[3], } else { BLI_rw_mutex_lock(&psys_bvhtree_rwlock, THREAD_LOCK_READ); - + BLI_bvhtree_range_query(psys[i]->bvhtree, co, interaction_radius, callback, pfr); - + BLI_rw_mutex_unlock(&psys_bvhtree_rwlock); } } @@ -1773,7 +1773,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa } } } - + /* Artificial buoyancy force in negative gravity direction */ if (fluid->buoyancy > 0.f && gravity) madd_v3_v3fl(force, gravity, fluid->buoyancy * (density-rest_density)); @@ -2521,7 +2521,7 @@ static int collision_sphere_to_edges(ParticleCollision *col, float radius, Parti result->uv[0] = u; - + hit = cur; *t = ct; } @@ -2546,7 +2546,7 @@ static int collision_sphere_to_verts(ParticleCollision *col, float radius, Parti cur->inside = 0; ct = collision_newton_rhapson(col, radius, cur, nr_distance_to_vert); - + if (ct >= 0.f && ct < *t) { *result = *cur; @@ -2694,7 +2694,7 @@ static int collision_response(ParticleSimulationData *sim, ParticleData *pa, Par /* get exact velocity right before collision */ madd_v3_v3v3fl(v0, col->ve1, col->acc, dt1); - + /* convert collider velocity from 1/framestep to 1/s TODO: here we assume 1 frame step for collision modifier */ mul_v3_fl(pce->vel, col->inv_timestep); @@ -2711,14 +2711,14 @@ static int collision_response(ParticleSimulationData *sim, ParticleData *pa, Par /* angular <-> linear velocity */ if (dynamic_rotation) { float vr_tan[3], v1_tan[3], ave[3]; - + /* linear velocity of particle surface */ cross_v3_v3v3(vr_tan, pce->nor, pa->state.ave); mul_v3_fl(vr_tan, pa->size); /* change to coordinates that move with the collision plane */ sub_v3_v3v3(v1_tan, v0_tan, vc_tan); - + /* The resulting velocity is a weighted average of particle cm & surface * velocity. This weight (related to particle's moment of inertia) could * be made a parameter for angular <-> linear conversion. @@ -2781,7 +2781,7 @@ static int collision_response(ParticleSimulationData *sim, ParticleData *pa, Par v0[2] = 0.0f; } } - + /* re-apply acceleration to final location and velocity */ madd_v3_v3v3fl(pa->state.co, co, v0, dt2); madd_v3_v3fl(pa->state.co, col->acc, 0.5f*dt2*dt2); @@ -2790,7 +2790,7 @@ static int collision_response(ParticleSimulationData *sim, ParticleData *pa, Par /* make sure particle stays on the right side of the surface */ if (!through) { distance = collision_point_distance_with_normal(co, pce, -1.f, col, nor); - + if (distance < col->radius + COLLISION_MIN_DISTANCE) madd_v3_v3fl(co, nor, col->radius + COLLISION_MIN_DISTANCE - distance); @@ -2891,7 +2891,7 @@ static void collision_check(ParticleSimulationData *sim, int p, float dfra, floa /* 10 iterations to catch multiple collisions */ while (collision_count < PARTICLE_COLLISION_MAX_COLLISIONS) { if (collision_detect(pa, &col, &hit, sim->colliders)) { - + collision_count++; if (collision_count == PARTICLE_COLLISION_MAX_COLLISIONS) @@ -2997,19 +2997,19 @@ static bool psys_hair_use_simulation(ParticleData *pa, float max_length) * but this can happen in old files when e.g. cutting hair. */ const float min_length = 0.1f * max_length; - + HairKey *key; int k; - + if (pa->totkey < 2) return false; - + for (k=1, key=pa->hair+1; k<pa->totkey; k++,key++) { float length = len_v3v3(key->co, (key-1)->co); if (length < min_length) return false; } - + return true; } @@ -3020,7 +3020,7 @@ static MDeformVert *hair_set_pinning(MDeformVert *dvert, float weight) dvert->dw = MEM_callocN(sizeof(MDeformWeight), "deformWeight"); dvert->totweight = 1; } - + dvert->dw->weight = weight; dvert++; } @@ -3042,7 +3042,7 @@ static void hair_create_input_mesh(ParticleSimulationData *sim, int totpoint, in float hairmat[4][4]; float max_length; float hair_radius; - + mesh = *r_mesh; if (!mesh) { *r_mesh = mesh = BKE_mesh_new_nomain(totpoint, totedge, 0, 0, 0); @@ -3052,12 +3052,12 @@ static void hair_create_input_mesh(ParticleSimulationData *sim, int totpoint, in mvert = mesh->mvert; medge = mesh->medge; dvert = mesh->dvert; - + hairdata = *r_hairdata; if (!hairdata) { *r_hairdata = hairdata = MEM_mallocN(sizeof(ClothHairData) * totpoint, "hair data"); } - + /* calculate maximum segment length */ max_length = 0.0f; LOOP_PARTICLES { @@ -3069,12 +3069,12 @@ static void hair_create_input_mesh(ParticleSimulationData *sim, int totpoint, in } } } - + psys->clmd->sim_parms->vgroup_mass = 1; - + /* XXX placeholder for more flexible future hair settings */ hair_radius = part->size; - + /* make vgroup for pin roots etc.. */ hair_index = 1; LOOP_PARTICLES { @@ -3162,7 +3162,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim) int totedge; float (*deformedVerts)[3]; bool realloc_roots; - + if (!psys->clmd) { psys->clmd = (ClothModifierData*)modifier_new(eModifierType_Cloth); psys->clmd->sim_parms->goalspring = 0.0f; @@ -3170,7 +3170,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim) psys->clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_GOAL|CLOTH_SIMSETTINGS_FLAG_NO_SPRING_COMPRESS; psys->clmd->coll_parms->flags &= ~CLOTH_COLLSETTINGS_FLAG_SELF; } - + /* count simulated points */ totpoint = 0; totedge = 0; @@ -3181,7 +3181,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim) totpoint += pa->totkey + 1; /* +1 for virtual root point */ } } - + realloc_roots = false; /* whether hair root info array has to be reallocated */ if (psys->hair_in_mesh) { Mesh *mesh = psys->hair_in_mesh; @@ -3191,26 +3191,26 @@ static void do_hair_dynamics(ParticleSimulationData *sim) realloc_roots = true; } } - + if (!psys->hair_in_mesh || !psys->clmd->hairdata || realloc_roots) { if (psys->clmd->hairdata) { MEM_freeN(psys->clmd->hairdata); psys->clmd->hairdata = NULL; } } - + hair_create_input_mesh(sim, totpoint, totedge, &psys->hair_in_mesh, &psys->clmd->hairdata); - + if (psys->hair_out_mesh) BKE_id_free(NULL, psys->hair_out_mesh); - + psys->clmd->point_cache = psys->pointcache; /* for hair sim we replace the internal cloth effector weights temporarily * to use the particle settings */ clmd_effweights = psys->clmd->sim_parms->effector_weights; psys->clmd->sim_parms->effector_weights = psys->part->effector_weights; - + BKE_id_copy_ex( NULL, &psys->hair_in_mesh->id, (ID **)&psys->hair_out_mesh, LIB_ID_CREATE_NO_MAIN | @@ -3221,9 +3221,9 @@ static void do_hair_dynamics(ParticleSimulationData *sim) deformedVerts = BKE_mesh_vertexCos_get(psys->hair_out_mesh, NULL); clothModifier_do(psys->clmd, sim->depsgraph, sim->scene, sim->ob, psys->hair_in_mesh, deformedVerts); BKE_mesh_apply_vert_coords(psys->hair_out_mesh, deformedVerts); - + MEM_freeN(deformedVerts); - + /* restore cloth effector weights */ psys->clmd->sim_parms->effector_weights = clmd_effweights; } @@ -3272,11 +3272,11 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra)) PARTICLE_P; invert_m4_m4(ob->imat, ob->obmat); - + psys->lattice_deform_data= psys_create_lattice_deform_data(sim); if (psys->totpart==0) return; - + /* save new keys for elements if needed */ LOOP_PARTICLES { /* first time alloc */ @@ -3429,7 +3429,7 @@ static void dynamics_step_sph_ddr_task_cb_ex( } static void dynamics_step_sph_classical_basic_integrate_task_cb_ex( - void *__restrict userdata, + void *__restrict userdata, const int p, const ParallelRangeTLS *__restrict UNUSED(tls)) { @@ -3566,7 +3566,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) { ParticleTarget *pt = psys->targets.first; psys_update_particle_bvhtree(psys, cfra); - + for (; pt; pt=pt->next) { /* Updating others systems particle tree for fluid-fluid interaction */ if (pt->ob) psys_update_particle_bvhtree(BLI_findlink(&pt->ob->particlesystem, pt->psys-1), cfra); @@ -3623,7 +3623,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) LOOP_DYNAMIC_PARTICLES { /* do global forces & effectors */ basic_integrate(sim, p, pa->state.time, cfra); - + /* deflection */ if (sim->colliders) collision_check(sim, p, pa->state.time, cfra); @@ -3637,7 +3637,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) { LOOP_DYNAMIC_PARTICLES { bbd.goal_ob = NULL; - + boid_brain(&bbd, p, pa); if (pa->alive != PARS_DYING) { @@ -3773,7 +3773,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra, const bool use_ float disp, dietime; psys_update_effectors(sim); - + disp= psys_get_current_display_percentage(psys, use_render_params); LOOP_PARTICLES { @@ -3823,7 +3823,7 @@ static void particles_fluid_step( #ifdef WITH_MOD_FLUID { FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(sim->ob, eModifierType_Fluidsim); - + if ( fluidmd && fluidmd->fss) { FluidsimSettings *fss= fluidmd->fss; ParticleSettings *part = psys->part; @@ -3834,7 +3834,7 @@ static void particles_fluid_step( int p, j, totpart; int readMask, activeParts = 0, fileParts = 0; gzFile gzf; - + // XXX if (ob==G.obedit) // off... // return; @@ -3843,7 +3843,7 @@ static void particles_fluid_step( BLI_path_abs(filename, modifier_path_relbase(bmain, sim->ob)); - BLI_path_frame(filename, curFrame, 0); // fixed #frame-no + BLI_path_frame(filename, curFrame, 0); // fixed #frame-no gzf = BLI_gzopen(filename, "rb"); if (!gzf) { @@ -3851,46 +3851,46 @@ static void particles_fluid_step( // XXX bad level call elbeemDebugOut(debugStrBuffer); return; } - + gzread(gzf, &totpart, sizeof(totpart)); totpart = (use_render_params) ? totpart:(part->disp*totpart) / 100; - + part->totpart= totpart; part->sta=part->end = 1.0f; part->lifetime = sim->scene->r.efra + 1; - + /* allocate particles */ realloc_particles(sim, part->totpart); - + // set up reading mask readMask = fss->typeFlags; - + for (p=0, pa=psys->particles; p<totpart; p++, pa++) { int ptype=0; - - gzread(gzf, &ptype, sizeof( ptype )); + + gzread(gzf, &ptype, sizeof( ptype )); if (ptype & readMask) { activeParts++; - + gzread(gzf, &(pa->size), sizeof(float)); - + pa->size /= 10.0f; - + for (j=0; j<3; j++) { float wrf; - gzread(gzf, &wrf, sizeof( wrf )); + gzread(gzf, &wrf, sizeof( wrf )); pa->state.co[j] = wrf; //fprintf(stderr,"Rj%d ",j); } for (j=0; j<3; j++) { float wrf; - gzread(gzf, &wrf, sizeof( wrf )); + gzread(gzf, &wrf, sizeof( wrf )); pa->state.vel[j] = wrf; } - + zero_v3(pa->state.ave); unit_qt(pa->state.rot); - + pa->time = 1.f; pa->dietime = sim->scene->r.efra + 1; pa->lifetime = sim->scene->r.efra; @@ -3900,18 +3900,18 @@ static void particles_fluid_step( else { // skip... for (j=0; j<2*3+1; j++) { - float wrf; gzread(gzf, &wrf, sizeof( wrf )); + float wrf; gzread(gzf, &wrf, sizeof( wrf )); } } fileParts++; } gzclose(gzf); - + totpart = psys->totpart = activeParts; BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d\n", psys->totpart,activeParts,fileParts,readMask); // bad level call // XXX elbeemDebugOut(debugStrBuffer); - + } // fluid sim particles done } #else @@ -3957,7 +3957,7 @@ static void system_step(ParticleSimulationData *sim, float cfra, const bool use_ pid = &ptcacheid; BKE_ptcache_id_from_particles(pid, sim->ob, psys); - + BKE_ptcache_id_time(pid, sim->scene, 0.0f, &startframe, &endframe, NULL); /* clear everything on start frame, or when psys needs full reset! */ @@ -3966,7 +3966,7 @@ static void system_step(ParticleSimulationData *sim, float cfra, const bool use_ BKE_ptcache_validate(cache, startframe); cache->flag &= ~PTCACHE_REDO_NEEDED; } - + CLAMP(cache_cfra, startframe, endframe); } @@ -4075,7 +4075,7 @@ static void system_step(ParticleSimulationData *sim, float cfra, const bool use_ } } } - + /* 4. only write cache starting from second frame */ if (pid) { BKE_ptcache_validate(cache, (int)cache_cfra); diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 8cc8a8510f2..0a4cd3ec3c1 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -134,7 +134,7 @@ static void update_node_vb(PBVH *bvh, PBVHNode *node) BB vb; BB_reset(&vb); - + if (node->flag & PBVH_Leaf) { PBVHVertexIter vd; @@ -185,10 +185,10 @@ static int partition_indices(int *prim_indices, int lo, int hi, int axis, for (;; ) { for (; prim_bbc[prim_indices[i]].bcentroid[axis] < mid; i++) ; for (; mid < prim_bbc[prim_indices[j]].bcentroid[axis]; j--) ; - + if (!(i < j)) return i; - + SWAP(int, prim_indices[i], prim_indices[j]); i++; } @@ -218,7 +218,7 @@ static int partition_indices_material(PBVH *bvh, int lo, int hi) for (; grid_materials_match(first, &flagmats[indices[i]]); i++) ; for (; !grid_materials_match(first, &flagmats[indices[j]]); j--) ; } - + if (!(i < j)) return i; @@ -390,7 +390,7 @@ static void build_leaf(PBVH *bvh, int node_index, BBC *prim_bbc, /* Still need vb for searches */ update_vb(bvh, &bvh->nodes[node_index], prim_bbc, offset, count); - + if (bvh->looptri) build_mesh_leaf_node(bvh, bvh->nodes + node_index); else { @@ -1281,7 +1281,7 @@ void BKE_pbvh_get_grid_updates(PBVH *bvh, bool clear, void ***r_gridfaces, int * } pbvh_iter_end(&iter); - + const int tot = BLI_gset_len(face_set); if (tot == 0) { *r_totface = 0; @@ -1384,7 +1384,7 @@ void BKE_pbvh_node_mark_normals_update(PBVHNode *node) void BKE_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden) { BLI_assert(node->flag & PBVH_Leaf); - + if (fully_hidden) node->flag |= PBVH_FullyHidden; else @@ -1409,7 +1409,7 @@ void BKE_pbvh_node_num_verts( int *r_uniquevert, int *r_totvert) { int tot; - + switch (bvh->type) { case PBVH_GRIDS: tot = node->totprim * bvh->gridkey.grid_area; @@ -2011,7 +2011,7 @@ static PlaneAABBIsect test_planes_aabb(const float bb_min[3], { float vmin[3], vmax[3]; PlaneAABBIsect ret = ISECT_INSIDE; - + for (int i = 0; i < 4; ++i) { for (int axis = 0; axis < 3; ++axis) { if (planes[i][axis] > 0) { @@ -2023,7 +2023,7 @@ static PlaneAABBIsect test_planes_aabb(const float bb_min[3], vmax[axis] = bb_min[axis]; } } - + if (dot_v3v3(planes[i], vmin) + planes[i][3] > 0) return ISECT_OUTSIDE; else if (dot_v3v3(planes[i], vmax) + planes[i][3] >= 0) @@ -2039,7 +2039,7 @@ bool BKE_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data) /* BKE_pbvh_node_get_BB */ bb_min = node->vb.bmin; bb_max = node->vb.bmax; - + return test_planes_aabb(bb_min, bb_max, data) != ISECT_OUTSIDE; } @@ -2049,7 +2049,7 @@ bool BKE_pbvh_node_planes_exclude_AABB(PBVHNode *node, void *data) /* BKE_pbvh_node_get_BB */ bb_min = node->vb.bmin; bb_max = node->vb.bmax; - + return test_planes_aabb(bb_min, bb_max, data) != ISECT_INSIDE; } @@ -2311,22 +2311,22 @@ void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node, const int *vert_indices; int *grid_indices; int totgrid, gridsize, uniq_verts, totvert; - + vi->grid = NULL; vi->no = NULL; vi->fno = NULL; vi->mvert = NULL; - + BKE_pbvh_node_get_grids(bvh, node, &grid_indices, &totgrid, NULL, &gridsize, &grids); BKE_pbvh_node_num_verts(bvh, node, &uniq_verts, &totvert); BKE_pbvh_node_get_verts(bvh, node, &vert_indices, &verts); vi->key = &bvh->gridkey; - + vi->grids = grids; vi->grid_indices = grid_indices; vi->totgrid = (grids) ? totgrid : 1; vi->gridsize = gridsize; - + if (mode == PBVH_ITER_ALL) vi->totvert = totvert; else diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 10050e5e083..3e8e6a69dd8 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -125,7 +125,7 @@ /* could be made into a pointcache option */ #define DURIAN_POINTCACHE_LIB_OK 1 -static int ptcache_data_size[] = { +static int ptcache_data_size[] = { sizeof(unsigned int), // BPHYS_DATA_INDEX 3 * sizeof(float), // BPHYS_DATA_LOCATION 3 * sizeof(float), // BPHYS_DATA_VELOCITY @@ -155,7 +155,7 @@ static int ptcache_basic_header_read(PTCacheFile *pf) /* Custom functions should read these basic elements too! */ if (!error && !fread(&pf->totpoint, sizeof(unsigned int), 1, pf->fp)) error = 1; - + if (!error && !fread(&pf->data_types, sizeof(unsigned int), 1, pf->fp)) error = 1; @@ -166,7 +166,7 @@ static int ptcache_basic_header_write(PTCacheFile *pf) /* Custom functions should write these basic elements too! */ if (!fwrite(&pf->totpoint, sizeof(unsigned int), 1, pf->fp)) return 0; - + if (!fwrite(&pf->data_types, sizeof(unsigned int), 1, pf->fp)) return 0; @@ -244,7 +244,7 @@ void BKE_ptcache_make_particle_key(ParticleKey *key, int index, void **data, flo { PTCACHE_DATA_TO(data, BPHYS_DATA_LOCATION, index, key->co); PTCACHE_DATA_TO(data, BPHYS_DATA_VELOCITY, index, key->vel); - + /* no rotation info, so make something nice up */ if (data[BPHYS_DATA_ROTATION]==NULL) { vec_to_quat(key->rot, key->vel, OB_NEGX, OB_POSZ); @@ -320,7 +320,7 @@ static void ptcache_particle_read(int index, void *psys_v, void **data, float cf if (data[BPHYS_DATA_SIZE]) { PTCACHE_DATA_TO(data, BPHYS_DATA_SIZE, 0, &pa->size); } - + if (data[BPHYS_DATA_TIMES]) { float times[3]; PTCACHE_DATA_TO(data, BPHYS_DATA_TIMES, 0, ×); @@ -498,7 +498,7 @@ static void ptcache_cloth_read(int index, void *cloth_v, void **data, float UNUS ClothModifierData *clmd= cloth_v; Cloth *cloth= clmd->clothObject; ClothVertex *vert = cloth->verts + index; - + if (old_data) { memcpy(vert->x, data, 3 * sizeof(float)); memcpy(vert->xconst, data + 3, 3 * sizeof(float)); @@ -564,7 +564,7 @@ static int ptcache_smoke_totpoint(void *smoke_v, int UNUSED(cfra)) { SmokeModifierData *smd= (SmokeModifierData *)smoke_v; SmokeDomainSettings *sds = smd->domain; - + if (sds->fluid) { return sds->base_res[0]*sds->base_res[1]*sds->base_res[2]; } @@ -581,7 +581,7 @@ static void ptcache_smoke_error(void *smoke_v, const char *message) #define SMOKE_CACHE_VERSION "1.04" static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v) -{ +{ SmokeModifierData *smd= (SmokeModifierData *)smoke_v; SmokeDomainSettings *sds = smd->domain; int ret = 0; @@ -593,7 +593,7 @@ static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v) ptcache_file_write(pf, &sds->active_fields, 1, sizeof(int)); ptcache_file_write(pf, &sds->res, 3, sizeof(int)); ptcache_file_write(pf, &sds->dx, 1, sizeof(float)); - + if (sds->fluid) { size_t res = sds->res[0]*sds->res[1]*sds->res[2]; float dt, dx, *dens, *react, *fuel, *flame, *heat, *heatold, *vx, *vy, *vz, *r, *g, *b; @@ -640,7 +640,7 @@ static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v) ptcache_file_write(pf, &sds->active_color, 3, sizeof(float)); MEM_freeN(out); - + ret = 1; } @@ -683,7 +683,7 @@ static int ptcache_smoke_write(PTCacheFile *pf, void *smoke_v) ptcache_file_compressed_write(pf, (unsigned char *)tcv, in_len, out, mode); ptcache_file_compressed_write(pf, (unsigned char *)tcw, in_len, out, mode); MEM_freeN(out); - + ret = 1; } @@ -695,7 +695,7 @@ static int ptcache_smoke_read_old(PTCacheFile *pf, void *smoke_v) { SmokeModifierData *smd= (SmokeModifierData *)smoke_v; SmokeDomainSettings *sds = smd->domain; - + if (sds->fluid) { const size_t res = sds->res[0] * sds->res[1] * sds->res[2]; const unsigned int out_len = (unsigned int)res * sizeof(float); @@ -709,7 +709,7 @@ static int ptcache_smoke_read_old(PTCacheFile *pf, void *smoke_v) sds->active_color[0] = 0.7f; sds->active_color[1] = 0.7f; sds->active_color[2] = 0.7f; - + smoke_export(sds->fluid, &dt, &dx, &dens, NULL, NULL, NULL, &heat, &heatold, &vx, &vy, &vz, NULL, NULL, NULL, &obstacles); ptcache_file_compressed_read(pf, (unsigned char *)sds->shadow, out_len); @@ -762,7 +762,7 @@ static int ptcache_smoke_read_old(PTCacheFile *pf, void *smoke_v) } } - return 1; + return 1; } static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v) @@ -818,13 +818,13 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v) smoke_reallocate_highres_fluid(sds, ch_dx, ch_res, 1); } } - + if (sds->fluid) { size_t res = sds->res[0]*sds->res[1]*sds->res[2]; float dt, dx, *dens, *react, *fuel, *flame, *heat, *heatold, *vx, *vy, *vz, *r, *g, *b; unsigned char *obstacles; unsigned int out_len = (unsigned int)res * sizeof(float); - + smoke_export(sds->fluid, &dt, &dx, &dens, &react, &flame, &fuel, &heat, &heatold, &vx, &vy, &vz, &r, &g, &b, &obstacles); ptcache_file_compressed_read(pf, (unsigned char *)sds->shadow, out_len); @@ -1199,7 +1199,7 @@ static void ptcache_dynamicpaint_error(void *UNUSED(sd), const char *UNUSED(mess #define DPAINT_CACHE_VERSION "1.01" static int ptcache_dynamicpaint_write(PTCacheFile *pf, void *dp_v) -{ +{ DynamicPaintSurface *surface = (DynamicPaintSurface*)dp_v; int cache_compress = 1; @@ -1241,7 +1241,7 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v) { DynamicPaintSurface *surface = (DynamicPaintSurface*)dp_v; char version[4]; - + /* version header */ ptcache_file_read(pf, version, 1, sizeof(char) * 4); if (!STREQLEN(version, DPAINT_CACHE_VERSION, 4)) { @@ -1286,13 +1286,13 @@ static int ptcache_rigidbody_write(int index, void *rb_v, void **data, int UNUS { RigidBodyWorld *rbw = rb_v; Object *ob = NULL; - + if (rbw->objects) ob = rbw->objects[index]; - + if (ob && ob->rigidbody_object) { RigidBodyOb *rbo = ob->rigidbody_object; - + if (rbo->type == RBO_TYPE_ACTIVE) { #ifdef WITH_BULLET RB_body_get_position(rbo->physics_object, rbo->pos); @@ -1309,15 +1309,15 @@ static void ptcache_rigidbody_read(int index, void *rb_v, void **data, float UNU { RigidBodyWorld *rbw = rb_v; Object *ob = NULL; - + if (rbw->objects) ob = rbw->objects[index]; - + if (ob && ob->rigidbody_object) { RigidBodyOb *rbo = ob->rigidbody_object; - + if (rbo->type == RBO_TYPE_ACTIVE) { - + if (old_data) { memcpy(rbo->pos, data, 3 * sizeof(float)); memcpy(rbo->orn, data + 3, 4 * sizeof(float)); @@ -1333,23 +1333,23 @@ static void ptcache_rigidbody_interpolate(int index, void *rb_v, void **data, fl { RigidBodyWorld *rbw = rb_v; Object *ob = NULL; - + if (rbw->objects) ob = rbw->objects[index]; - + if (ob && ob->rigidbody_object) { RigidBodyOb *rbo = ob->rigidbody_object; - + if (rbo->type == RBO_TYPE_ACTIVE) { ParticleKey keys[4]; ParticleKey result; float dfra; - + memset(keys, 0, sizeof(keys)); - + copy_v3_v3(keys[1].co, rbo->pos); copy_qt_qt(keys[1].rot, rbo->orn); - + if (old_data) { memcpy(keys[2].co, data, 3 * sizeof(float)); memcpy(keys[2].rot, data + 3, 4 * sizeof(float)); @@ -1357,13 +1357,13 @@ static void ptcache_rigidbody_interpolate(int index, void *rb_v, void **data, fl else { BKE_ptcache_make_particle_key(&keys[2], 0, data, cfra2); } - + dfra = cfra2 - cfra1; - + /* note: keys[0] and keys[3] unused for type < 1 (crappy) */ psys_interpolate_particle(-1, keys, (cfra - cfra1) / dfra, &result, true); interp_qt_qtqt(result.rot, keys[1].rot, keys[2].rot, (cfra - cfra1) / dfra); - + copy_v3_v3(rbo->pos, result.co); copy_qt_qt(rbo->orn, result.rot); } @@ -1372,7 +1372,7 @@ static void ptcache_rigidbody_interpolate(int index, void *rb_v, void **data, fl static int ptcache_rigidbody_totpoint(void *rb_v, int UNUSED(cfra)) { RigidBodyWorld *rbw = rb_v; - + return rbw->numbodies; } @@ -1529,7 +1529,7 @@ void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeMo pid->ob= ob; pid->calldata= smd; - + pid->type= PTCACHE_TYPE_SMOKE_DOMAIN; pid->stack_index= sds->point_cache[0]->index; @@ -1613,9 +1613,9 @@ void BKE_ptcache_id_from_dynamicpaint(PTCacheID *pid, Object *ob, DynamicPaintSu void BKE_ptcache_id_from_rigidbody(PTCacheID *pid, Object *ob, RigidBodyWorld *rbw) { - + memset(pid, 0, sizeof(PTCacheID)); - + pid->ob= ob; pid->calldata= rbw; pid->type= PTCACHE_TYPE_RIGIDBODY; @@ -1624,29 +1624,29 @@ void BKE_ptcache_id_from_rigidbody(PTCacheID *pid, Object *ob, RigidBodyWorld *r pid->ptcaches= &rbw->ptcaches; pid->totpoint= pid->totwrite= ptcache_rigidbody_totpoint; pid->error = ptcache_rigidbody_error; - + pid->write_point = ptcache_rigidbody_write; pid->read_point = ptcache_rigidbody_read; pid->interpolate_point = ptcache_rigidbody_interpolate; - + pid->write_stream = NULL; pid->read_stream = NULL; pid->write_openvdb_stream = NULL; pid->read_openvdb_stream = NULL; - + pid->write_extra_data = NULL; pid->read_extra_data = NULL; pid->interpolate_extra_data = NULL; - + pid->write_header = ptcache_basic_header_write; pid->read_header = ptcache_basic_header_read; - + pid->data_types= (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_ROTATION); pid->info_types= 0; - + pid->stack_index = pid->cache->index; - + pid->default_step = 1; pid->max_step = 1; pid->file_type = PTCACHE_FILE_PTCACHE; @@ -1688,7 +1688,7 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup for (psys=ob->particlesystem.first; psys; psys=psys->next) { if (psys->part==NULL) continue; - + /* check to make sure point cache is actually used by the particles */ if (ELEM(psys->part->phystype, PART_PHYS_NO, PART_PHYS_KEYED)) continue; @@ -1696,7 +1696,7 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup /* hair needs to be included in id-list for cache edit mode to work */ /* if (psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DYNAMICS)==0) */ /* continue; */ - + if (psys->part->type == PART_FLUID) continue; @@ -1732,7 +1732,7 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup } } } - + if (scene && ob->rigidbody_object && scene->rigidbody_world) { pid = MEM_callocN(sizeof(PTCacheID), "PTCacheID"); BKE_ptcache_id_from_rigidbody(pid, ob, scene->rigidbody_world); @@ -1818,20 +1818,20 @@ static int ptcache_path(PTCacheID *pid, char *filename) BLI_split_file_part(blendfilename, file, sizeof(file)); i = strlen(file); - + /* remove .blend */ if (i > 6) file[i-6] = '\0'; - + BLI_snprintf(filename, MAX_PTCACHE_PATH, "//"PTCACHE_PATH"%s", file); /* add blend file name to pointcache dir */ BLI_path_abs(filename, blendfilename); return BLI_add_slash(filename); /* new strlen() */ } - + /* use the temp path. this is weak but better then not using point cache at all */ /* temporary directory is assumed to exist and ALWAYS has a trailing slash */ BLI_snprintf(filename, MAX_PTCACHE_PATH, "%s"PTCACHE_PATH, BKE_tempdir_session()); - + return BLI_add_slash(filename); /* new strlen() */ } @@ -1842,9 +1842,9 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p char *newname; filename[0] = '\0'; newname = filename; - + if (!G.relbase_valid && (pid->cache->flag & PTCACHE_EXTERNAL)==0) return 0; /* save blend file before using disk pointcache */ - + /* start with temp dir */ if (do_path) { len = ptcache_path(pid, filename); @@ -1860,8 +1860,8 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p } } else { - int temp = (int)strlen(pid->cache->name); - strcpy(newname, pid->cache->name); + int temp = (int)strlen(pid->cache->name); + strcpy(newname, pid->cache->name); newname+=temp; len += temp; } @@ -1883,7 +1883,7 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p } len += 16; } - + return len; /* make sure the above string is always 16 chars */ } @@ -1900,7 +1900,7 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra) return NULL; #endif if (!G.relbase_valid && (pid->cache->flag & PTCACHE_EXTERNAL)==0) return NULL; /* save blend file before using disk pointcache */ - + ptcache_filename(pid, filename, cfra, 1, 1); if (mode==PTCACHE_FILE_READ) { @@ -1994,7 +1994,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns out_len= LZO_OUT_LEN(in_len); if (mode == 1) { LZO_HEAP_ALLOC(wrkmem, LZO1X_MEM_COMPRESS); - + r = lzo1x_1_compress(in, (lzo_uint)in_len, out, (lzo_uint *)&out_len, wrkmem); if (!(r == LZO_E_OK) || (out_len >= in_len)) compressed = 0; @@ -2004,7 +2004,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns #endif #ifdef WITH_LZMA if (mode == 2) { - + r = LzmaCompress(out, &out_len, in, in_len, //assume sizeof(char)==1.... props, &sizeOfIt, 5, 1 << 24, 3, 0, 2, 32, 2); @@ -2014,7 +2014,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns compressed = 2; } #endif - + ptcache_file_write(pf, &compressed, 1, sizeof(unsigned char)); if (compressed) { unsigned int size = out_len; @@ -2050,18 +2050,18 @@ static int ptcache_file_data_read(PTCacheFile *pf) if ((pf->data_types & (1<<i)) && !ptcache_file_read(pf, pf->cur[i], 1, ptcache_data_size[i])) return 0; } - + return 1; } static int ptcache_file_data_write(PTCacheFile *pf) -{ +{ int i; for (i=0; i<BPHYS_TOT_DATA; i++) { if ((pf->data_types & (1<<i)) && !ptcache_file_write(pf, pf->cur[i], 1, ptcache_data_size[i])) return 0; } - + return 1; } static int ptcache_file_header_begin_read(PTCacheFile *pf) @@ -2069,12 +2069,12 @@ static int ptcache_file_header_begin_read(PTCacheFile *pf) unsigned int typeflag=0; int error=0; char bphysics[8]; - + pf->data_types = 0; - + if (fread(bphysics, sizeof(char), 8, pf->fp) != 8) error = 1; - + if (!error && !STREQLEN(bphysics, "BPHYSICS", 8)) error = 1; @@ -2083,7 +2083,7 @@ static int ptcache_file_header_begin_read(PTCacheFile *pf) pf->type = (typeflag & PTCACHE_TYPEFLAG_TYPEMASK); pf->flag = (typeflag & PTCACHE_TYPEFLAG_FLAGMASK); - + /* if there was an error set file as it was */ if (error) fseek(pf->fp, 0, SEEK_SET); @@ -2094,13 +2094,13 @@ static int ptcache_file_header_begin_write(PTCacheFile *pf) { const char *bphysics = "BPHYSICS"; unsigned int typeflag = pf->type + pf->flag; - + if (fwrite(bphysics, sizeof(char), 8, pf->fp) != 8) return 0; if (!fwrite(&typeflag, sizeof(unsigned int), 1, pf->fp)) return 0; - + return 1; } @@ -2381,14 +2381,14 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra) if (error && G.debug & G_DEBUG) printf("Error reading from disk cache\n"); - + return pm; } static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm) { PTCacheFile *pf = NULL; unsigned int i, error = 0; - + BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_FRAME, pm->frame); pf = ptcache_file_open(pid, PTCACHE_FILE_WRITE, pm->frame); @@ -2403,10 +2403,10 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm) pf->totpoint = pm->totpoint; pf->type = pid->type; pf->flag = 0; - + if (pm->extradata.first) pf->flag |= PTCACHE_TYPEFLAG_EXTRADATA; - + if (pid->cache->compression) pf->flag |= PTCACHE_TYPEFLAG_COMPRESS; @@ -2462,7 +2462,7 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm) } ptcache_file_close(pf); - + if (error && G.debug & G_DEBUG) printf("Error writing to disk cache\n"); @@ -2511,7 +2511,7 @@ static int ptcache_read_stream(PTCacheID *pid, int cfra) } ptcache_file_close(pf); - + return error == 0; } @@ -2556,7 +2556,7 @@ static int ptcache_read(PTCacheID *pid, int cfra) } else { pm = pid->cache->mem_cache.first; - + while (pm && pm->frame != cfra) pm = pm->next; } @@ -2581,7 +2581,7 @@ static int ptcache_read(PTCacheID *pid, int cfra) index = pm->cur[BPHYS_DATA_INDEX]; pid->read_point(*index, pid->calldata, pm->cur, (float)pm->frame, NULL); - + BKE_ptcache_mem_pointers_incr(pm); } @@ -2610,7 +2610,7 @@ static int ptcache_interpolate(PTCacheID *pid, float cfra, int cfra1, int cfra2) } else { pm = pid->cache->mem_cache.first; - + while (pm && pm->frame != cfra2) pm = pm->next; } @@ -2748,7 +2748,7 @@ static int ptcache_write_stream(PTCacheID *pid, int cfra, int totpoint) { PTCacheFile *pf = NULL; int error = 0; - + BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_FRAME, cfra); pf = ptcache_file_open(pid, PTCACHE_FILE_WRITE, cfra); @@ -2820,7 +2820,7 @@ static int ptcache_write(PTCacheID *pid, int cfra, int overwrite) while (fra >= cache->startframe && !BKE_ptcache_id_exist(pid, fra)) fra--; - + pm2 = ptcache_disk_frame_to_mem(pid, fra); } else @@ -2968,7 +2968,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) unsigned int sta, end; /* mode is same as fopen's modes */ - DIR *dir; + DIR *dir; struct dirent *de; char path[MAX_PTCACHE_PATH]; char filename[MAX_PTCACHE_FILE]; @@ -3001,11 +3001,11 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) case PTCACHE_CLEAR_AFTER: if (pid->cache->flag & PTCACHE_DISK_CACHE) { ptcache_path(pid, path); - + dir = opendir(path); if (dir==NULL) return; - + len = ptcache_filename(pid, filename, cfra, 0, 0); /* no path */ /* append underscore terminator to ensure we don't match similar names * from objects whose names start with the same prefix @@ -3014,9 +3014,9 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) BLI_strncpy(filename + len, "_", sizeof(filename) - 2 - len); len += 1; } - + BLI_snprintf(ext, sizeof(ext), "_%02u%s", pid->stack_index, fext); - + while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ if (STREQLEN(filename, de->d_name, len)) { /* do we have the right prefix */ @@ -3033,7 +3033,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) if ((mode == PTCACHE_CLEAR_BEFORE && frame < cfra) || (mode == PTCACHE_CLEAR_AFTER && frame > cfra)) { - + BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name); BLI_delete(path_full, false, false); if (pid->cache->cached_frames && frame >=sta && frame <= end) @@ -3062,7 +3062,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) } BLI_freelistN(&pid->cache->mem_cache); - if (pid->cache->cached_frames) + if (pid->cache->cached_frames) memset(pid->cache->cached_frames, 0, MEM_allocN_len(pid->cache->cached_frames)); } else { @@ -3084,7 +3084,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) } } break; - + case PTCACHE_CLEAR_FRAME: if (pid->cache->flag & PTCACHE_DISK_CACHE) { if (BKE_ptcache_id_exist(pid, cfra)) { @@ -3121,10 +3121,10 @@ int BKE_ptcache_id_exist(PTCacheID *pid, int cfra) if (pid->cache->cached_frames && pid->cache->cached_frames[cfra-pid->cache->startframe]==0) return 0; - + if (pid->cache->flag & PTCACHE_DISK_CACHE) { char filename[MAX_PTCACHE_FILE]; - + ptcache_filename(pid, filename, cfra, 1, 1); return BLI_exists(filename); @@ -3164,7 +3164,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra if (timescale) { time= BKE_scene_frame_get(scene); nexttime = BKE_scene_frame_get_from_ctime(scene, CFRA + 1.0f); - + *timescale= MAX2(nexttime - time, 0.0f); } @@ -3202,7 +3202,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra if (pid->cache->flag & PTCACHE_DISK_CACHE) { /* mode is same as fopen's modes */ - DIR *dir; + DIR *dir; struct dirent *de; char path[MAX_PTCACHE_PATH]; char filename[MAX_PTCACHE_FILE]; @@ -3210,9 +3210,9 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra unsigned int len; /* store the length of the string */ ptcache_path(pid, path); - + len = ptcache_filename(pid, filename, (int)cfra, 0, 0); /* no path */ - + dir = opendir(path); if (dir==NULL) return; @@ -3220,7 +3220,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra const char *fext = ptcache_file_extension(pid); BLI_snprintf(ext, sizeof(ext), "_%02u%s", pid->stack_index, fext); - + while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ if (STREQLEN(filename, de->d_name, len)) { /* do we have the right prefix */ @@ -3328,7 +3328,7 @@ int BKE_ptcache_object_reset(Scene *scene, Object *ob, int mode) /* particles or cloth in that case -jahka */ else if (psys->clmd) { BKE_ptcache_id_from_cloth(&pid, ob, psys->clmd); - if (mode == PSYS_RESET_ALL || !(psys->part->type == PART_HAIR && (pid.cache->flag & PTCACHE_BAKED))) + if (mode == PSYS_RESET_ALL || !(psys->part->type == PART_HAIR && (pid.cache->flag & PTCACHE_BAKED))) reset |= BKE_ptcache_id_reset(scene, &pid, mode); else skip = 1; @@ -3386,19 +3386,19 @@ void BKE_ptcache_remove(void) char path[MAX_PTCACHE_PATH]; char path_full[MAX_PTCACHE_PATH]; int rmdir = 1; - + ptcache_path(NULL, path); if (BLI_exists(path)) { /* The pointcache dir exists? - remove all pointcache */ - DIR *dir; + DIR *dir; struct dirent *de; dir = opendir(path); if (dir==NULL) return; - + while ((de = readdir(dir)) != NULL) { if (FILENAME_IS_CURRPAR(de->d_name)) { /* do nothing */ @@ -3417,7 +3417,7 @@ void BKE_ptcache_remove(void) else { rmdir = 0; /* path dosnt exist */ } - + if (rmdir) { BLI_delete(path, true, false); } @@ -3527,7 +3527,7 @@ PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, const ListBase *ptcach return ptcaches_new->first; } -/* Disabled this code; this is being called on scene_update_tagged, and that in turn gets called on +/* Disabled this code; this is being called on scene_update_tagged, and that in turn gets called on * every user action changing stuff, and then it runs a complete bake??? (ton) */ /* Baking */ @@ -3576,7 +3576,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker) int startframe = MAXFRAME, endframe = baker->anim_init ? scene->r.sfra : CFRA; int bake = baker->bake; int render = baker->render; - + G.is_break = false; /* set caches to baking mode and figure out start frame */ @@ -3768,7 +3768,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker) scene->r.framelen = frameleno; CFRA = cfrao; - + if (bake) { /* already on cfra unless baking */ BKE_scene_graph_update_for_newframe(depsgraph, bmain); } @@ -3850,7 +3850,7 @@ void BKE_ptcache_toggle_disk_cache(PTCacheID *pid) cache->flag ^= PTCACHE_DISK_CACHE; BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0); cache->flag ^= PTCACHE_DISK_CACHE; - + cache->last_exact = last_exact; BKE_ptcache_id_time(pid, NULL, 0.0f, NULL, NULL, NULL); @@ -3870,7 +3870,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, const char *name_src, const c char old_name[80]; int len; /* store the length of the string */ /* mode is same as fopen's modes */ - DIR *dir; + DIR *dir; struct dirent *de; char path[MAX_PTCACHE_PATH]; char old_filename[MAX_PTCACHE_FILE]; @@ -3929,7 +3929,7 @@ void BKE_ptcache_load_external(PTCacheID *pid) int end = -1; /* mode is same as fopen's modes */ - DIR *dir; + DIR *dir; struct dirent *de; char path[MAX_PTCACHE_PATH]; char filename[MAX_PTCACHE_FILE]; @@ -3939,9 +3939,9 @@ void BKE_ptcache_load_external(PTCacheID *pid) return; ptcache_path(pid, path); - + len = ptcache_filename(pid, filename, 1, 0, 0); /* no path */ - + dir = opendir(path); if (dir==NULL) return; @@ -3952,7 +3952,7 @@ void BKE_ptcache_load_external(PTCacheID *pid) BLI_snprintf(ext, sizeof(ext), "_%02d%s", cache->index, fext); else BLI_strncpy(ext, fext, sizeof(ext)); - + while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ if (STREQLEN(filename, de->d_name, len)) { /* do we have the right prefix */ @@ -4008,7 +4008,7 @@ void BKE_ptcache_load_external(PTCacheID *pid) if (pf) { while (ptcache_file_read(pf, old_data, 1, elemsize)) cache->totpoint++; - + ptcache_file_close(pf); } } @@ -4086,7 +4086,7 @@ void BKE_ptcache_update_info(PTCacheID *pid) } bytes += sizeof(PTCacheMem); - + totframes++; } diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c index 67b076c0153..a9b36a85602 100644 --- a/source/blender/blenkernel/intern/report.c +++ b/source/blender/blenkernel/intern/report.c @@ -270,10 +270,10 @@ char *BKE_reports_string(ReportList *reports, ReportType level) void BKE_reports_print(ReportList *reports, ReportType level) { char *cstring = BKE_reports_string(reports, level); - + if (cstring == NULL) return; - + puts(cstring); fflush(stdout); MEM_freeN(cstring); @@ -282,12 +282,12 @@ void BKE_reports_print(ReportList *reports, ReportType level) Report *BKE_reports_last_displayable(ReportList *reports) { Report *report; - + for (report = reports->list.last; report; report = report->prev) { if (ELEM(report->type, RPT_ERROR, RPT_WARNING, RPT_INFO)) return report; } - + return NULL; } diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 3d38f15db25..60ae37da09a 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -292,7 +292,7 @@ static rbCollisionShape *rigidbody_get_shape_trimesh_from_mesh(Object *ob) int totvert; int tottri; const MLoop *mloop; - + mesh = rigidbody_get_mesh(ob); /* ensure mesh validity, then grab data */ @@ -315,7 +315,7 @@ static rbCollisionShape *rigidbody_get_shape_trimesh_from_mesh(Object *ob) /* init mesh data for collision shape */ mdata = RB_trimesh_data_new(tottri, totvert); - + RB_trimesh_add_vertices(mdata, (float *)mvert, totvert, sizeof(MVert)); /* loop over all faces, adding them as triangles to the collision shape @@ -334,7 +334,7 @@ static rbCollisionShape *rigidbody_get_shape_trimesh_from_mesh(Object *ob) RB_trimesh_add_triangle_indices(mdata, i, UNPACK3(vtri)); } } - + RB_trimesh_finish(mdata); /* construct collision shape @@ -520,17 +520,17 @@ void BKE_rigidbody_calc_volume(Object *ob, float *r_vol) const MLoopTri *lt = NULL; int totvert, tottri = 0; const MLoop *mloop = NULL; - + /* ensure mesh validity, then grab data */ if (mesh == NULL) return; - + mvert = mesh->mvert; totvert = mesh->totvert; lt = BKE_mesh_runtime_looptri_ensure(mesh); tottri = mesh->runtime.looptris.len; mloop = mesh->mloop; - + if (totvert > 0 && tottri > 0) { BKE_mesh_calc_volume(mvert, totvert, lt, tottri, mloop, &volume, NULL); } @@ -598,17 +598,17 @@ void BKE_rigidbody_calc_center_of_mass(Object *ob, float r_center[3]) const MLoopTri *looptri; int totvert, tottri; const MLoop *mloop; - + /* ensure mesh validity, then grab data */ if (mesh == NULL) return; - + mvert = mesh->mvert; totvert = mesh->totvert; looptri = BKE_mesh_runtime_looptri_ensure(mesh); tottri = mesh->runtime.looptris.len; mloop = mesh->mloop; - + if (totvert > 0 && tottri > 0) { BKE_mesh_calc_volume(mvert, totvert, looptri, tottri, mloop, NULL, r_center); } @@ -1328,7 +1328,7 @@ static void rigidbody_update_simulation(Depsgraph *depsgraph, Scene *scene, Rigi /* XXX TODO For rebuild: remove all constraints first. * Otherwise we can end up deleting objects that are still * referenced by constraints, corrupting bullet's internal list. - * + * * Memory management needs redesign here, this is just a dirty workaround. */ if (rebuild && rbw->constraints) { @@ -1389,7 +1389,7 @@ static void rigidbody_update_simulation(Depsgraph *depsgraph, Scene *scene, Rigi } } FOREACH_COLLECTION_OBJECT_RECURSIVE_END; - + /* update constraints */ if (rbw->constraints == NULL) /* no constraints, move on */ return; diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 7e161a8dd2d..509db2b5b37 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -136,10 +136,10 @@ static void remove_sequencer_fcurves(Scene *sce) if (adt && adt->action) { FCurve *fcu, *nextfcu; - + for (fcu = adt->action->curves.first; fcu; fcu = nextfcu) { nextfcu = fcu->next; - + if ((fcu->rna_path) && strstr(fcu->rna_path, "sequences_all")) { action_groups_remove_channel(adt->action, fcu); free_fcurve(fcu); @@ -479,10 +479,10 @@ void BKE_scene_free_ex(Scene *sce, const bool do_id_user) BLI_freelistN(&sce->markers); BLI_freelistN(&sce->transform_spaces); BLI_freelistN(&sce->r.views); - + BKE_toolsettings_free(sce->toolsettings); sce->toolsettings = NULL; - + BKE_scene_free_depsgraph_hash(sce); MEM_SAFE_FREE(sce->fps_info); @@ -532,7 +532,7 @@ void BKE_scene_init(Scene *sce) BLI_assert(MEMCMP_STRUCT_OFS_IS_ZERO(sce, id)); sce->lay = sce->layact = 1; - + sce->r.mode = R_OSA; sce->r.cfra = 1; sce->r.sfra = 1; @@ -615,7 +615,7 @@ void BKE_scene_init(Scene *sce) sce->r.border.ymax = 1.0f; sce->r.preview_start_resolution = 64; - + sce->r.line_thickness_mode = R_LINE_THICKNESS_ABSOLUTE; sce->r.unit_line_thickness = 1.0f; @@ -639,7 +639,7 @@ void BKE_scene_init(Scene *sce) sce->toolsettings->uv_selectmode = UV_SELECT_VERTEX; sce->toolsettings->autokey_mode = U.autokey_mode; - + sce->toolsettings->transform_pivot_point = V3D_AROUND_CENTER_MEAN; sce->toolsettings->snap_mode = SCE_SNAP_MODE_INCREMENT; sce->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID; @@ -740,22 +740,22 @@ void BKE_scene_init(Scene *sce) copy_v2_fl2(sce->safe_areas.action_center, 15.0f / 100.0f, 5.0f / 100.0f); sce->preview = NULL; - + /* GP Sculpt brushes */ { GP_BrushEdit_Settings *gset = &sce->toolsettings->gp_sculpt; GP_EditBrush_Data *gp_brush; - + gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_SMOOTH]; gp_brush->size = 25; gp_brush->strength = 0.3f; gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF | GP_EDITBRUSH_FLAG_SMOOTH_PRESSURE; - + gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_THICKNESS]; gp_brush->size = 25; gp_brush->strength = 0.5f; gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF; - + gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_STRENGTH]; gp_brush->size = 25; gp_brush->strength = 0.5f; @@ -765,28 +765,28 @@ void BKE_scene_init(Scene *sce) gp_brush->size = 50; gp_brush->strength = 0.3f; gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF; - + gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_PUSH]; gp_brush->size = 25; gp_brush->strength = 0.3f; gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF; - + gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_TWIST]; gp_brush->size = 50; gp_brush->strength = 0.3f; // XXX? gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF; - + gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_PINCH]; gp_brush->size = 50; gp_brush->strength = 0.5f; // XXX? gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF; - + gp_brush = &gset->brush[GP_EDITBRUSH_TYPE_RANDOMIZE]; gp_brush->size = 25; gp_brush->strength = 0.5f; gp_brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF; } - + /* GP Stroke Placement */ sce->toolsettings->gpencil_v3d_align = GP_PROJECT_VIEWSPACE; sce->toolsettings->gpencil_v2d_align = GP_PROJECT_VIEWSPACE; @@ -909,10 +909,10 @@ Object *BKE_scene_object_find_by_name(Scene *scene, const char *name) void BKE_scene_set_background(Main *bmain, Scene *scene) { Object *ob; - + /* check for cyclic sets, for reading old files but also for definite security (py?) */ BKE_scene_validate_setscene(bmain, scene); - + /* deselect objects (for dataselect) */ for (ob = bmain->object.first; ob; ob = ob->id.next) ob->flag &= ~SELECT; @@ -947,7 +947,7 @@ int BKE_scene_base_iter_next(Depsgraph *depsgraph, SceneBaseIter *iter, Scene **scene, int val, Base **base, Object **ob) { bool run_again = true; - + /* init */ if (val == 0) { iter->phase = F_START; @@ -1006,19 +1006,19 @@ int BKE_scene_base_iter_next(Depsgraph *depsgraph, SceneBaseIter *iter, } } } - + if (*base == NULL) { iter->phase = F_START; } else { if (iter->phase != F_DUPLI) { if (depsgraph && (*base)->object->transflag & OB_DUPLI) { - /* collections cannot be duplicated for mballs yet, - * this enters eternal loop because of + /* collections cannot be duplicated for mballs yet, + * this enters eternal loop because of * makeDispListMBall getting called inside of collection_duplilist */ if ((*base)->object->dup_group == NULL) { iter->duplilist = object_duplilist(depsgraph, (*scene), (*base)->object); - + iter->dupob = iter->duplilist->first; if (!iter->dupob) { @@ -1051,13 +1051,13 @@ int BKE_scene_base_iter_next(Depsgraph *depsgraph, SceneBaseIter *iter, else if (iter->phase == F_DUPLI) { iter->phase = F_SCENE; (*base)->flag_legacy &= ~OB_FROMDUPLI; - + if (iter->dupli_refob) { /* Restore last object's real matrix. */ copy_m4_m4(iter->dupli_refob->obmat, iter->omat); iter->dupli_refob = NULL; } - + free_object_duplilist(iter->duplilist); iter->duplilist = NULL; run_again = true; @@ -1203,7 +1203,7 @@ bool BKE_scene_validate_setscene(Main *bmain, Scene *sce) if (sce->set == NULL) return true; totscene = BLI_listbase_count(&bmain->scene); - + for (a = 0, sce_iter = sce; sce_iter->set; sce_iter = sce_iter->set, a++) { /* more iterations than scenes means we have a cycle */ if (a > totscene) { @@ -1230,7 +1230,7 @@ float BKE_scene_frame_get_from_ctime(const Scene *scene, const float frame) float ctime = frame; ctime += scene->r.subframe; ctime *= scene->r.framelen; - + return ctime; } @@ -1610,7 +1610,7 @@ int BKE_render_num_threads(const RenderData *rd) threads = rd->threads; else threads = BLI_system_thread_count(); - + return max_ii(threads, 1); } diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 2ccb2012a76..5a6c55a9fcc 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -65,7 +65,7 @@ static void spacetype_free(SpaceType *st) ARegionType *art; PanelType *pt; HeaderType *ht; - + for (art = st->regiontypes.first; art; art = art->next) { BLI_freelistN(&art->drawcalls); @@ -86,7 +86,7 @@ static void spacetype_free(SpaceType *st) BLI_freelistN(&art->paneltypes); BLI_freelistN(&art->headertypes); } - + BLI_freelistN(&st->regiontypes); BLI_freelistN(&st->toolshelf); @@ -95,18 +95,18 @@ static void spacetype_free(SpaceType *st) void BKE_spacetypes_free(void) { SpaceType *st; - + for (st = spacetypes.first; st; st = st->next) { spacetype_free(st); } - + BLI_freelistN(&spacetypes); } SpaceType *BKE_spacetype_from_id(int spaceid) { SpaceType *st; - + for (st = spacetypes.first; st; st = st->next) { if (st->spaceid == spaceid) return st; @@ -117,11 +117,11 @@ SpaceType *BKE_spacetype_from_id(int spaceid) ARegionType *BKE_regiontype_from_id_or_first(SpaceType *st, int regionid) { ARegionType *art; - + for (art = st->regiontypes.first; art; art = art->next) if (art->regionid == regionid) return art; - + printf("Error, region type %d missing in - name:\"%s\", id:%d\n", regionid, st->name, st->spaceid); return st->regiontypes.first; } @@ -129,7 +129,7 @@ ARegionType *BKE_regiontype_from_id_or_first(SpaceType *st, int regionid) ARegionType *BKE_regiontype_from_id(SpaceType *st, int regionid) { ARegionType *art; - + for (art = st->regiontypes.first; art; art = art->next) { if (art->regionid == regionid) { return art; @@ -147,7 +147,7 @@ const ListBase *BKE_spacetypes_list(void) void BKE_spacetype_register(SpaceType *st) { SpaceType *stype; - + /* sanity check */ stype = BKE_spacetype_from_id(st->spaceid); if (stype) { @@ -155,7 +155,7 @@ void BKE_spacetype_register(SpaceType *st) spacetype_free(stype); MEM_freeN(stype); } - + BLI_addtail(&spacetypes, st); } @@ -170,20 +170,20 @@ void BKE_spacedata_freelist(ListBase *lb) { SpaceLink *sl; ARegion *ar; - + for (sl = lb->first; sl; sl = sl->next) { SpaceType *st = BKE_spacetype_from_id(sl->spacetype); - + /* free regions for pushed spaces */ for (ar = sl->regionbase.first; ar; ar = ar->next) BKE_area_region_free(st, ar); BLI_freelistN(&sl->regionbase); - - if (st && st->free) + + if (st && st->free) st->free(sl); } - + BLI_freelistN(lb); } @@ -216,7 +216,7 @@ static void panel_list_copy(ListBase *newlb, const ListBase *lb) ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar) { ARegion *newar = MEM_dupallocN(ar); - + newar->prev = newar->next = NULL; BLI_listbase_clear(&newar->handlers); BLI_listbase_clear(&newar->uiblocks); @@ -228,7 +228,7 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar) newar->regiontimer = NULL; newar->headerstr = NULL; newar->draw_buffer = NULL; - + /* use optional regiondata callback */ if (ar->regiondata) { ARegionType *art = BKE_regiontype_from_id(st, ar->regiontype); @@ -246,12 +246,12 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar) if (ar->v2d.tab_offset) newar->v2d.tab_offset = MEM_dupallocN(ar->v2d.tab_offset); - + panel_list_copy(&newar->panels, &ar->panels); BLI_listbase_clear(&newar->ui_previews); BLI_duplicatelist(&newar->ui_previews, &ar->ui_previews); - + return newar; } @@ -260,10 +260,10 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar) static void region_copylist(SpaceType *st, ListBase *lb1, ListBase *lb2) { ARegion *ar; - + /* to be sure */ BLI_listbase_clear(lb1); - + for (ar = lb2->first; ar; ar = ar->next) { ARegion *arnew = BKE_area_region_copy(st, ar); BLI_addtail(lb1, arnew); @@ -275,17 +275,17 @@ static void region_copylist(SpaceType *st, ListBase *lb1, ListBase *lb2) void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2) { SpaceLink *sl; - + BLI_listbase_clear(lb1); /* to be sure */ - + for (sl = lb2->first; sl; sl = sl->next) { SpaceType *st = BKE_spacetype_from_id(sl->spacetype); - + if (st && st->duplicate) { SpaceLink *slnew = st->duplicate(sl); - + BLI_addtail(lb1, slnew); - + region_copylist(st, &slnew->regionbase, &sl->regionbase); } } @@ -297,14 +297,14 @@ void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2) void BKE_spacedata_draw_locks(int set) { SpaceType *st; - + for (st = spacetypes.first; st; st = st->next) { ARegionType *art; - + for (art = st->regiontypes.first; art; art = art->next) { - if (set) + if (set) art->do_lock = art->lock; - else + else art->do_lock = false; } } @@ -382,16 +382,16 @@ void BKE_area_region_free(SpaceType *st, ARegion *ar) if (st) { ARegionType *art = BKE_regiontype_from_id(st, ar->regiontype); - + if (art && art->free) art->free(ar); - + if (ar->regiondata) printf("regiondata free error\n"); } else if (ar->type && ar->type->free) ar->type->free(ar); - + if (ar->v2d.tab_offset) { MEM_freeN(ar->v2d.tab_offset); ar->v2d.tab_offset = NULL; @@ -431,15 +431,15 @@ void BKE_screen_area_free(ScrArea *sa) { SpaceType *st = BKE_spacetype_from_id(sa->spacetype); ARegion *ar; - + for (ar = sa->regionbase.first; ar; ar = ar->next) BKE_area_region_free(st, ar); MEM_SAFE_FREE(sa->global); BLI_freelistN(&sa->regionbase); - + BKE_spacedata_freelist(&sa->spacedata); - + BLI_freelistN(&sa->actionzones); } @@ -461,7 +461,7 @@ void BKE_screen_free(bScreen *sc) ARegion *ar; /* No animdata here. */ - + for (ar = sc->regionbase.first; ar; ar = ar->next) BKE_area_region_free(NULL, ar); @@ -669,7 +669,7 @@ ARegion *BKE_area_find_region_type(ScrArea *sa, int type) { if (sa) { ARegion *ar; - + for (ar = sa->regionbase.first; ar; ar = ar->next) { if (ar->regiontype == type) return ar; diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 00af9721f07..9105961a3ae 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -127,7 +127,7 @@ static ImBuf *prepare_effect_imbufs(const SeqRenderData *context, ImBuf *ibuf1, else { out = IMB_allocImBuf(x, y, 32, IB_rect); } - + if (out->rect_float) { if (ibuf1 && !ibuf1->rect_float) { BKE_sequencer_imbuf_to_sequencer_space(scene, ibuf1, true); @@ -140,7 +140,7 @@ static ImBuf *prepare_effect_imbufs(const SeqRenderData *context, ImBuf *ibuf1, if (ibuf3 && !ibuf3->rect_float) { BKE_sequencer_imbuf_to_sequencer_space(scene, ibuf3, true); } - + IMB_colormanagement_assign_float_colorspace(out, scene->sequencer_colorspace_settings.name); } else { @@ -369,7 +369,7 @@ static void do_alphaunder_effect_byte( tempc[1] = (fac * rt1[1] + rt2[1]); tempc[2] = (fac * rt1[2] + rt2[2]); tempc[3] = (fac * rt1[3] + rt2[3]); - + premul_float_to_straight_uchar(rt, tempc); } } @@ -384,10 +384,10 @@ static void do_alphaunder_effect_byte( while (x--) { straight_uchar_to_premul_float(rt1, cp1); straight_uchar_to_premul_float(rt2, cp2); - + if (rt2[3] <= 0.0f && fac4 >= 1.0f) *((unsigned int *) rt) = *((unsigned int *) cp1); else if (rt2[3] >= 1.0f) *((unsigned int *) rt) = *((unsigned int *) cp2); - else { + else { fac = (fac4 * (1.0f - rt2[3])); if (fac <= 0) *((unsigned int *)rt) = *((unsigned int *)cp2); @@ -396,7 +396,7 @@ static void do_alphaunder_effect_byte( tempc[1] = (fac * rt1[1] + rt2[1]); tempc[2] = (fac * rt1[2] + rt2[2]); tempc[3] = (fac * rt1[3] + rt2[3]); - + premul_float_to_straight_uchar(rt, tempc); } } @@ -628,7 +628,7 @@ static float gamma_range_table[RE_GAMMA_TABLE_SIZE + 1]; static float gamfactor_table[RE_GAMMA_TABLE_SIZE]; static float inv_gamma_range_table[RE_GAMMA_TABLE_SIZE + 1]; static float inv_gamfactor_table[RE_GAMMA_TABLE_SIZE]; -static float color_domain_table[RE_GAMMA_TABLE_SIZE + 1]; +static float color_domain_table[RE_GAMMA_TABLE_SIZE + 1]; static float color_step; static float inv_color_step; static float valid_gamma; @@ -642,7 +642,7 @@ static void makeGammaTables(float gamma) valid_gamma = gamma; valid_inv_gamma = 1.0f / gamma; color_step = 1.0f / RE_GAMMA_TABLE_SIZE; - inv_color_step = (float) RE_GAMMA_TABLE_SIZE; + inv_color_step = (float) RE_GAMMA_TABLE_SIZE; /* We could squeeze out the two range tables to gain some memory */ for (i = 0; i < RE_GAMMA_TABLE_SIZE; i++) { @@ -674,7 +674,7 @@ static float gammaCorrect(float c) { int i; float res; - + i = floorf(c * inv_color_step); /* Clip to range [0, 1]: outside, just do the complete calculation. * We may have some performance problems here. Stretching up the LUT @@ -685,7 +685,7 @@ static float gammaCorrect(float c) else if (i >= RE_GAMMA_TABLE_SIZE) res = powf(c, valid_gamma); else res = gamma_range_table[i] + ((c - color_domain_table[i]) * gamfactor_table[i]); - + return res; } @@ -710,17 +710,17 @@ static void gamtabs(float gamma) { float val, igamma = 1.0f / gamma; int a; - + /* gamtab: in short, out short */ for (a = 0; a < 65536; a++) { val = a; val /= 65535.0f; - + if (gamma == 2.0f) val = sqrtf(val); else if (gamma != 1.0f) val = powf(val, igamma); - + gamtab[a] = (65535.99f * val); } /* inverse gamtab1 : in byte, out short */ @@ -1317,7 +1317,7 @@ BLI_INLINE void apply_blend_function_byte( rt1 = rect1; rt2 = rect2; rt = out; - while (y--) { + while (y--) { for (x = xo; x > 0; x--) { achannel = rt2[3]; rt2[3] = (unsigned int) achannel * facf0; @@ -1331,7 +1331,7 @@ BLI_INLINE void apply_blend_function_byte( if (y == 0) { break; } - y--; + y--; for (x = xo; x > 0; x--) { achannel = rt2[3]; rt2[3] = (unsigned int) achannel * facf1; @@ -1356,7 +1356,7 @@ BLI_INLINE void apply_blend_function_float( rt1 = rect1; rt2 = rect2; rt = out; - while (y--) { + while (y--) { for (x = xo; x > 0; x--) { achannel = rt2[3]; rt2[3] = achannel * facf0; @@ -1370,7 +1370,7 @@ BLI_INLINE void apply_blend_function_float( if (y == 0) { break; } - y--; + y--; for (x = xo; x > 0; x--) { achannel = rt2[3]; rt2[3] = achannel * facf1; @@ -1853,7 +1853,7 @@ static float check_zone(WipeZone *wipezone, int x, int y, Sequence *seq, float f else output = in_band(hwidth, fabsf(temp2 - pointdist), 1, 1); if (!wipe->forward) output = 1 - output; - + break; } if (output < 0) output = 0; @@ -2054,7 +2054,7 @@ static void init_transform_effect(Sequence *seq) transform->yIni = 0.0f; transform->rotIni = 0.0f; - + transform->interpolation = 1; transform->percent = 1; transform->uniform_scale = 0; @@ -2086,7 +2086,7 @@ static void transform_image( xo = x; yo = y; - + /* Rotate */ s = sinf(rotate); c = cosf(rotate); @@ -2129,7 +2129,7 @@ static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x { TransformVars *transform = (TransformVars *) seq->effectdata; float scale_x, scale_y, translate_x, translate_y, rotate_radians; - + /* Scale */ if (transform->uniform_scale) { scale_x = scale_y = transform->ScalexIni; @@ -2293,7 +2293,7 @@ static void RVBlurBitmap2_float(float *map, int width, int height, float blur, i index = (x + (height - 1 - y) * width) * 4; copy_v4_v4(temp + index, curColor2); } - + /* Do the main body */ for (y = halfWidth; y < height - halfWidth; y++) { fy = 0; @@ -2462,12 +2462,12 @@ static ImBuf *do_glow_effect( static void init_solid_color(Sequence *seq) { SolidColorVars *cv; - + if (seq->effectdata) MEM_freeN(seq->effectdata); seq->effectdata = MEM_callocN(sizeof(SolidColorVars), "solidcolor"); - + cv = (SolidColorVars *)seq->effectdata; cv->col[0] = cv->col[1] = cv->col[2] = 0.5; } @@ -2521,7 +2521,7 @@ static ImBuf *do_solid_color( col1[2] = facf1 * cv->col[2] * 255; rect = (unsigned char *)out->rect; - + for (y = 0; y < out->y; y++) { for (x = 0; x < out->x; x++, rect += 4) { rect[0] = col0[0]; @@ -2554,7 +2554,7 @@ static ImBuf *do_solid_color( col1[2] = facf1 * cv->col[2]; rect_float = out->rect_float; - + for (y = 0; y < out->y; y++) { for (x = 0; x < out->x; x++, rect_float += 4) { rect_float[0] = col0[0]; @@ -2623,7 +2623,7 @@ static ImBuf *do_multicam( else { out = i; } - + return out; } @@ -2698,7 +2698,7 @@ static ImBuf *do_adjustment( else { out = i; } - + return out; } @@ -2877,7 +2877,7 @@ void BKE_sequence_effect_speed_rebuild_map(Scene *scene, Sequence *seq, bool for facf *= seq->seq1->len; } facf *= v->globalSpeed; - + if (facf >= seq->seq1->len) { facf = seq->seq1->len - 1; } diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 7d1bb69c788..d857db7e276 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -751,10 +751,10 @@ void BKE_sequence_calc_disp(Scene *scene, Sequence *seq) seq->startstill = 0; if (seq->endofs && seq->endstill) seq->endstill = 0; - + seq->startdisp = seq->start + seq->startofs - seq->startstill; seq->enddisp = seq->start + seq->len - seq->endofs + seq->endstill; - + seq->handsize = 10.0; /* 10 frames */ if (seq->enddisp - seq->startdisp < 10) { seq->handsize = (float)(0.5 * (seq->enddisp - seq->startdisp)); @@ -1016,7 +1016,7 @@ void BKE_sequence_reload_new_file(Scene *scene, Sequence *seq, const bool lock_r BKE_sequence_tx_set_final_right(seq, prev_enddisp); BKE_sequence_single_fix(seq); } - + BKE_sequence_calc(scene, seq); } @@ -1280,7 +1280,7 @@ static void multibuf(ImBuf *ibuf, const float fmul) rt_float[1] *= fmul; rt_float[2] *= fmul; rt_float[3] *= fmul; - + rt_float += 4; } } @@ -1311,9 +1311,9 @@ static float give_stripelem_index(Sequence *seq, float cfra) else if (cfra >= end) nr = end - sta; else nr = cfra - sta; } - + if (seq->strobe < 1.0f) seq->strobe = 1.0f; - + if (seq->strobe > 1.0f) { nr -= fmodf((double)nr, (double)seq->strobe); } @@ -1334,7 +1334,7 @@ StripElem *BKE_sequencer_give_stripelem(Sequence *seq, int cfra) if (nr == -1 || se == NULL) return NULL; - + se += nr + seq->anim_startofs; } return se; @@ -1431,7 +1431,7 @@ static int get_shown_sequences(ListBase *seqbasep, int cfra, int chanshown, Sequ } } } - + chanshown = b; for (; b > 0; b--) { @@ -1662,7 +1662,7 @@ static bool seq_proxy_get_fname(Editing *ed, Sequence *seq, int cfra, int render return false; } - /* MOVIE tracks (only exception: custom files) are now handled + /* MOVIE tracks (only exception: custom files) are now handled * internally by ImBuf module for various reasons: proper time code * support, quicker index build, using one file instead * of a full directory of jpeg files, etc. Trying to support old @@ -2107,7 +2107,7 @@ void BKE_sequencer_proxy_set(struct Sequence *seq, bool value) } else { seq->flag &= ~SEQ_USE_PROXY; - } + } } /*********************** color balance *************************/ @@ -2207,7 +2207,7 @@ static void color_balance_byte_byte(StripColorBalance *cb_, unsigned char *rect, else p[c] = t; } - + premul_float_to_straight_uchar(cp, p); cp += 4; @@ -2559,7 +2559,7 @@ static ImBuf *input_preprocess(const SeqRenderData *context, Sequence *seq, floa if (seq->flag & SEQ_FLIPX) { IMB_flipx(ibuf); } - + if (seq->flag & SEQ_FLIPY) { IMB_flipy(ibuf); } @@ -3077,7 +3077,7 @@ static ImBuf *seq_render_movieclip_strip(const SeqRenderData *context, Sequence } memset(&user, 0, sizeof(MovieClipUser)); - + BKE_movieclip_user_set_frame(&user, nr + seq->anim_startofs + seq->clip->start_frame); user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL; @@ -3294,7 +3294,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq BKE_scene_camera_switch_update(scene); camera = scene->camera; } - + if (have_comp == false && camera == NULL) { goto finally; } @@ -3679,13 +3679,13 @@ static bool seq_must_swap_input_in_blend_mode(Sequence *seq) { bool swap_input = false; - /* bad hack, to fix crazy input ordering of + /* bad hack, to fix crazy input ordering of * those two effects */ if (ELEM(seq->blend_mode, SEQ_TYPE_ALPHAOVER, SEQ_TYPE_ALPHAUNDER, SEQ_TYPE_OVERDROP)) { swap_input = true; } - + return swap_input; } @@ -3762,7 +3762,7 @@ static ImBuf *seq_render_strip_stack( if (out) { return out; } - + if (count == 1) { Sequence *seq = seq_arr[0]; @@ -3887,7 +3887,7 @@ ImBuf *BKE_sequencer_give_ibuf(const SeqRenderData *context, float cfra, int cha { Editing *ed = BKE_sequencer_editing_get(context->scene, false); ListBase *seqbasep; - + if (ed == NULL) return NULL; if ((chanshown < 0) && !BLI_listbase_is_empty(&ed->metastack)) { @@ -3938,23 +3938,23 @@ static pthread_cond_t wakeup_cond = PTHREAD_COND_INITIALIZER; static pthread_mutex_t frame_done_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t frame_done_cond = PTHREAD_COND_INITIALIZER; -static volatile bool seq_thread_shutdown = true; +static volatile bool seq_thread_shutdown = true; static volatile int seq_last_given_monoton_cfra = 0; static int monoton_cfra = 0; typedef struct PrefetchThread { struct PrefetchThread *next, *prev; - + Scene *scene; struct PrefetchQueueElem *current; pthread_t pthread; int running; - + } PrefetchThread; typedef struct PrefetchQueueElem { struct PrefetchQueueElem *next, *prev; - + int rectx; int recty; float cfra; @@ -3984,7 +3984,7 @@ void BKE_sequencer_give_ibuf_prefetch_request(const SeqRenderData *context, floa pthread_mutex_lock(&queue_lock); BLI_addtail(&prefetch_wait, e); pthread_mutex_unlock(&queue_lock); - + pthread_mutex_lock(&wakeup_lock); pthread_cond_signal(&wakeup_cond); pthread_mutex_unlock(&wakeup_lock); @@ -4070,7 +4070,7 @@ ImBuf *BKE_sequencer_give_ibuf_threaded(const SeqRenderData *context, float cfra pthread_mutex_unlock(&frame_done_lock); } } - + return e ? e->ibuf : NULL; } @@ -4186,30 +4186,30 @@ void BKE_sequencer_free_imbuf(Scene *scene, ListBase *seqbase, bool for_render) BKE_sequencer_free_imbuf(scene, &seq->seqbase, for_render); } if (seq->type == SEQ_TYPE_SCENE) { - /* FIXME: recurs downwards, + /* FIXME: recurs downwards, * but do recurs protection somehow! */ } } - + } static bool update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *changed_seq, int len_change, int ibuf_change) { Sequence *subseq; bool free_imbuf = false; - + /* recurs downwards to see if this seq depends on the changed seq */ - + if (seq == NULL) return false; - + if (seq == changed_seq) free_imbuf = true; - + for (subseq = seq->seqbase.first; subseq; subseq = subseq->next) if (update_changed_seq_recurs(scene, subseq, changed_seq, len_change, ibuf_change)) free_imbuf = true; - + if (seq->seq1) if (update_changed_seq_recurs(scene, seq->seq1, changed_seq, len_change, ibuf_change)) free_imbuf = true; @@ -4219,7 +4219,7 @@ static bool update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *cha if (seq->seq3 && (seq->seq3 != seq->seq1) && (seq->seq3 != seq->seq2)) if (update_changed_seq_recurs(scene, seq->seq3, changed_seq, len_change, ibuf_change)) free_imbuf = true; - + if (free_imbuf) { if (ibuf_change) { if (seq->type == SEQ_TYPE_MOVIE) { @@ -4229,11 +4229,11 @@ static bool update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *cha BKE_sequence_effect_speed_rebuild_map(scene, seq, true); } } - + if (len_change) BKE_sequence_calc(scene, seq); } - + return free_imbuf; } @@ -4241,9 +4241,9 @@ void BKE_sequencer_update_changed_seq_and_deps(Scene *scene, Sequence *changed_s { Editing *ed = BKE_sequencer_editing_get(scene, false); Sequence *seq; - + if (ed == NULL) return; - + for (seq = ed->seqbase.first; seq; seq = seq->next) update_changed_seq_recurs(scene, seq, changed_seq, len_change, ibuf_change); } @@ -4500,9 +4500,9 @@ Sequence *BKE_sequencer_foreground_frame_get(Scene *scene, int frame) Editing *ed = BKE_sequencer_editing_get(scene, false); Sequence *seq, *best_seq = NULL; int best_machine = -1; - + if (!ed) return NULL; - + for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SEQ_MUTE || seq->startdisp > frame || seq->enddisp <= frame) continue; @@ -4961,7 +4961,7 @@ static void seq_free_animdata(Scene *scene, Sequence *seq) while (fcu) { if (STREQLEN(fcu->rna_path, str, str_len)) { FCurve *next_fcu = fcu->next; - + BLI_remlink(&scene->adt->action->curves, fcu); free_fcurve(fcu); @@ -5215,7 +5215,7 @@ Sequence *BKE_sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoad seq = BKE_sequence_alloc(seqbasep, seq_load->start_frame, seq_load->channel); seq->type = SEQ_TYPE_IMAGE; seq->blend_mode = SEQ_TYPE_CROSS; /* so alpha adjustment fade to the strip below */ - + /* basic defaults */ seq->strip = strip = MEM_callocN(sizeof(Strip), "strip"); @@ -5403,7 +5403,7 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad seq->anim_preseek = IMB_anim_get_preseek(anim_arr[0]); BLI_strncpy(seq->name + 2, "Movie", SEQ_NAME_MAXSTR - 2); BKE_sequence_base_unique_name_recursive(&scene->ed->seqbase, seq); - + /* adjust scene's frame rate settings to match */ if (seq_load->flag & SEQ_LOAD_SYNC_FPS) { IMB_anim_get_fps(anim_arr[0], &scene->r.frs_sec, &scene->r.frs_sec_base, true); diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index a7b233bc042..f8615671384 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -166,7 +166,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc) OUT_OF_MEMORY(); return; } - + /* Setup nearest */ nearest.index = -1; nearest.dist_sq = FLT_MAX; diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 738be9ded54..6bdce647bd9 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -1812,7 +1812,7 @@ static void adjustDomainResolution(SmokeDomainSettings *sds, int new_shift[3], E int zn = z - new_shift[2]; int index; float max_den; - + /* skip if cell already belongs to new area */ if (xn >= min[0] && xn <= max[0] && yn >= min[1] && yn <= max[1] && zn >= min[2] && zn <= max[2]) continue; diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index fe31222bbba..31644cc2392 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -2836,7 +2836,7 @@ static void mesh_to_softbody(Scene *scene, Object *ob) BodySpring *bs; int a, totedge; int defgroup_index, defgroup_index_mass, defgroup_index_spring; - + if (ob->softflag & OB_SB_EDGES) totedge= me->totedge; else totedge= 0; diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index a7f3fc1df9e..ebb23f8d5c6 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -144,7 +144,7 @@ void BKE_sound_free(bSound *sound) } BKE_sound_free_waveform(sound); - + #endif /* WITH_AUDASPACE */ if (sound->spinlock) { BLI_spin_end(sound->spinlock); @@ -774,7 +774,7 @@ void BKE_sound_read_waveform(bSound *sound, short *stop) if (info.length > 0) { int length = info.length * SOUND_WAVE_SAMPLES_PER_SECOND; - + waveform->data = MEM_mallocN(length * sizeof(float) * 3, "SoundWaveform.samples"); waveform->length = AUD_readSound(sound->playback_handle, waveform->data, length, SOUND_WAVE_SAMPLES_PER_SECOND, stop); } @@ -797,9 +797,9 @@ void BKE_sound_read_waveform(bSound *sound, short *stop) BLI_spin_unlock(sound->spinlock); return; } - + BKE_sound_free_waveform(sound); - + BLI_spin_lock(sound->spinlock); sound->waveform = waveform; sound->flags &= ~SOUND_FLAGS_WAVEFORM_LOADING; diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c index b116e99e63b..c20fe34b46a 100644 --- a/source/blender/blenkernel/intern/studiolight.c +++ b/source/blender/blenkernel/intern/studiolight.c @@ -77,17 +77,17 @@ static void studiolight_free(struct StudioLight *sl) GPU_texture_free(sl->equirectangular_radiance_gputexture); sl->equirectangular_radiance_gputexture = NULL; } - + if (sl->equirectangular_irradiance_gputexture) { GPU_texture_free(sl->equirectangular_irradiance_gputexture); sl->equirectangular_irradiance_gputexture = NULL; } - + if (sl->equirectangular_radiance_buffer) { IMB_freeImBuf(sl->equirectangular_radiance_buffer); sl->equirectangular_radiance_buffer = NULL; } - + if (sl->equirectangular_irradiance_buffer) { IMB_freeImBuf(sl->equirectangular_irradiance_buffer); sl->equirectangular_irradiance_buffer = NULL; @@ -398,7 +398,7 @@ static float texel_coord_solid_angle(float a_U, float a_V, int a_Size) } BLI_INLINE void studiolight_evaluate_specular_radiance_buffer( - ImBuf *radiance_buffer, const float normal[3], float color[3], + ImBuf *radiance_buffer, const float normal[3], float color[3], int xoffset, int yoffset, int zoffset, float zvalue) { if (radiance_buffer == NULL) { @@ -473,7 +473,7 @@ static void studiolight_calculate_irradiance_equirectangular_image(StudioLight * { if (sl->flag & STUDIOLIGHT_EXTERNAL_FILE) { /* check for cached irr file */ - + BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_RADIANCE_BUFFERS_CALCULATED); float *colbuf = MEM_mallocN(STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH * STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT * sizeof(float[4]), __func__); diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index d735944c93d..e4f08703dfc 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -197,7 +197,7 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, /* mask is allocated after regular layers */ ccgSubSurf_setAllocMask(ccgSS, 1, sizeof(float) * numLayers); } - + if (flags & CCG_CALC_NORMALS) ccgSubSurf_setCalcVertexNormals(ccgSS, 1, normalOffset); else @@ -315,7 +315,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, vmap = BKE_mesh_uv_vert_map_create(mpoly, mloop, mloopuv, totface, totvert, limit, false, true); if (!vmap) return 0; - + ccgSubSurf_initFullSync(ss); /* create vertices */ @@ -613,12 +613,12 @@ static float *get_ss_weights(WeightTable *wtable, int gridCuts, int faceLen) if (wtable->len <= faceLen) { void *tmp = MEM_callocN(sizeof(FaceVertWeightEntry) * (faceLen + 1), "weight table alloc 2"); - + if (wtable->len) { memcpy(tmp, wtable->weight_table, sizeof(FaceVertWeightEntry) * wtable->len); MEM_freeN(wtable->weight_table); } - + wtable->weight_table = tmp; wtable->len = faceLen + 1; } @@ -633,7 +633,7 @@ static float *get_ss_weights(WeightTable *wtable, int gridCuts, int faceLen) for (y = 0; y < gridCuts + 2; y++) { fx = 0.5f - (float)x / (float)(gridCuts + 1) / 2.0f; fy = 0.5f - (float)y / (float)(gridCuts + 1) / 2.0f; - + fac2 = faceLen - 4; w1 = (1.0f - fx) * (1.0f - fy) + (-fac2 * fx * fy * fac); w2 = (1.0f - fx + fac2 * fx * -fac) * (fy); @@ -647,7 +647,7 @@ static float *get_ss_weights(WeightTable *wtable, int gridCuts, int faceLen) w[j] = fac2; } } - + w[i] = w1; w[(i - 1 + faceLen) % faceLen] = w2; w[(i + 1) % faceLen] = w4; @@ -669,7 +669,7 @@ static void free_ss_weights(WeightTable *wtable) if (wtable->weight_table[i].valid) MEM_freeN(wtable->weight_table[i].w); } - + if (wtable->weight_table) MEM_freeN(wtable->weight_table); } @@ -1100,7 +1100,7 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med) /* numVerts = ccgSubSurf_getFaceNumVerts(f); */ /*UNUSED*/ gridSideEdges = gridSize - 1; - gridInternalEdges = (gridSideEdges - 1) * gridSideEdges * 2; + gridInternalEdges = (gridSideEdges - 1) * gridSideEdges * 2; offset = edgeNum - ccgdm->faceMap[i].startEdge; grid = offset / (gridSideEdges + gridInternalEdges); @@ -1214,7 +1214,7 @@ void subsurf_copy_grid_hidden(DerivedMesh *dm, const MPoly *mpoly, int edgeSize = ccgSubSurf_getEdgeSize(ss); int totface = ccgSubSurf_getNumFaces(ss); int i, j, x, y; - + for (i = 0; i < totface; i++) { CCGFace *f = ccgdm->faceMap[i].face; @@ -1223,14 +1223,14 @@ void subsurf_copy_grid_hidden(DerivedMesh *dm, const MPoly *mpoly, int hidden_gridsize = BKE_ccg_gridsize(md->level); int factor = BKE_ccg_factor(level, md->level); BLI_bitmap *hidden = md->hidden; - + if (!hidden) continue; - + for (y = 0; y < gridSize; y++) { for (x = 0; x < gridSize; x++) { int vndx, offset; - + vndx = getFaceIndex(ss, f, j, x, y, edgeSize, gridSize); offset = (y * factor) * hidden_gridsize + (x * factor); if (BLI_BITMAP_TEST(hidden, offset)) @@ -1254,11 +1254,11 @@ void subsurf_copy_grid_paint_mask(DerivedMesh *dm, const MPoly *mpoly, int edgeSize = ccgSubSurf_getEdgeSize(ss); int totface = ccgSubSurf_getNumFaces(ss); int i, j, x, y, factor, gpm_gridsize; - + for (i = 0; i < totface; i++) { CCGFace *f = ccgdm->faceMap[i].face; const MPoly *p = &mpoly[i]; - + for (j = 0; j < p->totloop; j++) { const GridPaintMask *gpm = &grid_paint_mask[p->loopstart + j]; if (!gpm->data) @@ -1266,11 +1266,11 @@ void subsurf_copy_grid_paint_mask(DerivedMesh *dm, const MPoly *mpoly, factor = BKE_ccg_factor(level, gpm->level); gpm_gridsize = BKE_ccg_gridsize(gpm->level); - + for (y = 0; y < gridSize; y++) { for (x = 0; x < gridSize; x++) { int vndx, offset; - + vndx = getFaceIndex(ss, f, j, x, y, edgeSize, gridSize); offset = y * factor * gpm_gridsize + x * factor; paint_mask[vndx] = gpm->data[offset]; @@ -1309,7 +1309,7 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert) vd = ccgSubSurf_getFaceCenterData(f); ccgDM_to_MVert(&mvert[i++], &key, vd); - + for (S = 0; S < numVerts; S++) { for (x = 1; x < gridSize - 1; x++) { vd = ccgSubSurf_getFaceGridEdgeData(ss, f, S, x); @@ -1626,7 +1626,7 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) CCGEdge **edgeMap2; CCGVert **vertMap2; int index, totvert, totedge, totface; - + totvert = ccgSubSurf_getNumVerts(ss); vertMap2 = MEM_mallocN(totvert * sizeof(*vertMap2), "vertmap"); for (ccgSubSurf_initVertIterator(ss, &vi); !ccgVertIterator_isStopped(&vi); ccgVertIterator_next(&vi)) { @@ -1657,7 +1657,7 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f); copy_v3_v3(cos[i++], ccgSubSurf_getFaceCenterData(f)); - + for (S = 0; S < numVerts; S++) { for (x = 1; x < gridSize - 1; x++) { copy_v3_v3(cos[i++], ccgSubSurf_getFaceGridEdgeData(ss, f, S, x)); @@ -1824,7 +1824,7 @@ static void ccgDM_release(DerivedMesh *dm) { ccgdm->multires.mmd = NULL; } - + if (ccgdm->multires.mmd) { if (ccgdm->multires.modified_flags & MULTIRES_COORDS_MODIFIED) multires_modifier_update_mdisps(dm); @@ -2117,7 +2117,7 @@ static void ccgdm_create_grids(DerivedMesh *dm) if (ccgdm->gridData) return; - + numGrids = ccgDM_getNumGrids(dm); numFaces = ccgSubSurf_getNumFaces(ss); /*gridSize = ccgDM_getGridSize(dm);*/ /*UNUSED*/ @@ -2183,7 +2183,7 @@ static void ccgDM_getGridKey(DerivedMesh *dm, CCGKey *key) static DMFlagMat *ccgDM_getGridFlagMats(DerivedMesh *dm) { CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm; - + ccgdm_create_grids(dm); return ccgdm->gridFlagMats; } @@ -2191,7 +2191,7 @@ static DMFlagMat *ccgDM_getGridFlagMats(DerivedMesh *dm) static BLI_bitmap **ccgDM_getGridHidden(DerivedMesh *dm) { CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm; - + ccgdm_create_grids(dm); return ccgdm->gridHidden; } @@ -2968,7 +2968,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived( if (levels == 0) return dm; - + ss = _getSubSurf(NULL, levels, 3, useSimple | CCG_USE_ARENA | CCG_CALC_NORMALS); ss_sync_from_derivedmesh(ss, dm, vertCos, useSimple, useSubsurfUv); @@ -3061,9 +3061,9 @@ struct DerivedMesh *subsurf_make_derived_from_derived( void subsurf_calculate_limit_positions(Mesh *me, float (*r_positions)[3]) { - /* Finds the subsurf limit positions for the verts in a mesh - * and puts them in an array of floats. Please note that the - * calculated vert positions is incorrect for the verts + /* Finds the subsurf limit positions for the verts in a mesh + * and puts them in an array of floats. Please note that the + * calculated vert positions is incorrect for the verts * on the boundary of the mesh. */ CCGSubSurf *ss = _getSubSurf(NULL, 1, 3, CCG_USE_ARENA); diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c index b74143b5c07..043fc813b95 100644 --- a/source/blender/blenkernel/intern/suggestions.c +++ b/source/blender/blenkernel/intern/suggestions.c @@ -164,7 +164,7 @@ void texttool_suggest_prefix(const char *prefix, const int prefix_len) suggestions.lastmatch = suggestions.last; return; } - + first = last = NULL; for (match = suggestions.first; match; match = match->next) { cmp = BLI_strncasecmp(prefix, match->name, prefix_len); diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 226ab33e45e..f876592c0a8 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -229,15 +229,15 @@ void BKE_text_init(Text *ta) tmp = (TextLine *) MEM_mallocN(sizeof(TextLine), "textline"); tmp->line = (char *) MEM_mallocN(1, "textline_string"); tmp->format = NULL; - + tmp->line[0] = 0; tmp->len = 0; - + tmp->next = NULL; tmp->prev = NULL; - + BLI_addhead(&ta->lines, tmp); - + ta->curl = ta->lines.first; ta->curc = 0; ta->sell = ta->lines.first; @@ -270,18 +270,18 @@ int txt_extended_ascii_as_utf8(char **str) added++; i += bad_char + 1; } - + if (added != 0) { char *newstr = MEM_mallocN(length + added + 1, "text_line"); ptrdiff_t mi = 0; i = 0; - + while ((*str)[i]) { if ((bad_char = BLI_utf8_invalid_byte((*str) + i, length - i)) == -1) { memcpy(newstr + mi, (*str) + i, length - i + 1); break; } - + memcpy(newstr + mi, (*str) + i, bad_char); BLI_str_utf8_from_unicode((*str)[i + bad_char], newstr + mi + bad_char); @@ -292,7 +292,7 @@ int txt_extended_ascii_as_utf8(char **str) MEM_freeN(*str); *str = newstr; } - + return added; } @@ -389,7 +389,7 @@ bool BKE_text_reload(Text *text) BLI_strncpy(filepath_abs, text->name, FILE_MAX); BLI_path_abs(filepath_abs, BKE_main_blendfile_path_from_global()); - + buffer = BLI_file_read_text_as_mem(filepath_abs, 0, &buffer_len); if (buffer == NULL) { return false; @@ -424,7 +424,7 @@ Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const BLI_strncpy(filepath_abs, file, FILE_MAX); if (relpath) /* can be NULL (bg mode) */ BLI_path_abs(filepath_abs, relpath); - + buffer = BLI_file_read_text_as_mem(filepath_abs, 0, &buffer_len); if (buffer == NULL) { return false; @@ -454,9 +454,9 @@ Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const else { ta->mtime = 0; } - + text_from_buf(ta, buffer, buffer_len); - + MEM_freeN(buffer); return ta; @@ -605,7 +605,7 @@ static void make_new_line(TextLine *line, char *newline) { if (line->line) MEM_freeN(line->line); if (line->format) MEM_freeN(line->format); - + line->line = newline; line->len = strlen(newline); line->format = NULL; @@ -616,16 +616,16 @@ static TextLine *txt_new_line(const char *str) TextLine *tmp; if (!str) str = ""; - + tmp = (TextLine *) MEM_mallocN(sizeof(TextLine), "textline"); tmp->line = MEM_mallocN(strlen(str) + 1, "textline_string"); tmp->format = NULL; - + strcpy(tmp->line, str); - + tmp->len = strlen(str); tmp->next = tmp->prev = NULL; - + return tmp; } @@ -636,29 +636,29 @@ static TextLine *txt_new_linen(const char *str, int n) tmp = (TextLine *) MEM_mallocN(sizeof(TextLine), "textline"); tmp->line = MEM_mallocN(n + 1, "textline_string"); tmp->format = NULL; - + BLI_strncpy(tmp->line, (str) ? str : "", n + 1); - + tmp->len = strlen(tmp->line); tmp->next = tmp->prev = NULL; - + return tmp; } void txt_clean_text(Text *text) -{ +{ TextLine **top, **bot; if (!text->lines.first) { if (text->lines.last) text->lines.first = text->lines.last; else text->lines.first = text->lines.last = txt_new_line(NULL); } - + if (!text->lines.last) text->lines.last = text->lines.first; top = (TextLine **) &text->lines.first; bot = (TextLine **) &text->lines.last; - + while ((*top)->prev) *top = (*top)->prev; while ((*bot)->next) *bot = (*bot)->next; @@ -796,7 +796,7 @@ void txt_move_up(Text *text, const bool sel) int column = txt_utf8_offset_to_column((*linep)->line, *charp); *linep = (*linep)->prev; *charp = txt_utf8_column_to_offset((*linep)->line, column); - + } else { txt_move_bol(text, sel); @@ -888,7 +888,7 @@ void txt_move_left(Text *text, const bool sel) if (text->flags & TXT_TABSTOSPACES) { tabsize = txt_calc_tab_left(*linep, *charp); } - + if (tabsize) { (*charp) -= tabsize; } @@ -924,7 +924,7 @@ void txt_move_right(Text *text, const bool sel) if (text->flags & TXT_TABSTOSPACES) { tabsize = txt_calc_tab_right(*linep, *charp); } - + if (tabsize) { (*charp) += tabsize; } @@ -932,7 +932,7 @@ void txt_move_right(Text *text, const bool sel) (*charp) += BLI_str_utf8_size((*linep)->line + *charp); } } - + if (!sel) txt_pop_sel(text); } @@ -948,7 +948,7 @@ void txt_jump_left(Text *text, const bool sel, const bool use_init_step) BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len, charp, STRCUR_DIR_PREV, STRCUR_JUMP_DELIM, use_init_step); - + if (!sel) txt_pop_sel(text); } @@ -960,11 +960,11 @@ void txt_jump_right(Text *text, const bool sel, const bool use_init_step) if (sel) txt_curs_sel(text, &linep, &charp); else { txt_pop_last(text); txt_curs_cur(text, &linep, &charp); } if (!*linep) return; - + BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len, charp, STRCUR_DIR_NEXT, STRCUR_JUMP_DELIM, use_init_step); - + if (!sel) txt_pop_sel(text); } @@ -976,7 +976,7 @@ void txt_move_bol(Text *text, const bool sel) if (sel) txt_curs_sel(text, &linep, &charp); else txt_curs_cur(text, &linep, &charp); if (!*linep) return; - + *charp = 0; if (!sel) txt_pop_sel(text); @@ -1041,7 +1041,7 @@ void txt_move_to(Text *text, unsigned int line, unsigned int ch, const bool sel) if (sel) txt_curs_sel(text, &linep, &charp); else txt_curs_cur(text, &linep, &charp); if (!*linep) return; - + *linep = text->lines.first; for (i = 0; i < line; i++) { if ((*linep)->next) *linep = (*linep)->next; @@ -1050,7 +1050,7 @@ void txt_move_to(Text *text, unsigned int line, unsigned int ch, const bool sel) if (ch > (unsigned int)((*linep)->len)) ch = (unsigned int)((*linep)->len); *charp = ch; - + if (!sel) txt_pop_sel(text); } @@ -1062,7 +1062,7 @@ static void txt_curs_swap(Text *text) { TextLine *tmpl; int tmpc; - + tmpl = text->curl; text->curl = text->sell; text->sell = tmpl; @@ -1079,7 +1079,7 @@ static void txt_pop_first(Text *text) { txt_curs_swap(text); } - + txt_pop_sel(text); } @@ -1090,7 +1090,7 @@ static void txt_pop_last(Text *text) { txt_curs_swap(text); } - + txt_pop_sel(text); } @@ -1104,7 +1104,7 @@ void txt_order_cursors(Text *text, const bool reverse) { if (!text->curl) return; if (!text->sell) return; - + /* Flip so text->curl is before/after text->sell */ if (reverse == false) { if ((txt_get_span(text->curl, text->sell) < 0) || @@ -1136,7 +1136,7 @@ static void txt_delete_sel(Text *text, TextUndoBuf *utxt) if (!text->sell) return; if (!txt_has_sel(text)) return; - + txt_order_cursors(text, false); if (!undoing) { @@ -1152,15 +1152,15 @@ static void txt_delete_sel(Text *text, TextUndoBuf *utxt) buf[text->curc + (text->sell->len - text->selc)] = 0; make_new_line(text->curl, buf); - + tmpl = text->sell; while (tmpl != text->curl) { tmpl = tmpl->prev; if (!tmpl) break; - + txt_delete_line(text, tmpl->next); } - + text->sell = text->curl; text->selc = text->curc; } @@ -1169,7 +1169,7 @@ void txt_sel_all(Text *text) { text->curl = text->lines.first; text->curc = 0; - + text->sell = text->lines.last; text->selc = text->sell->len; } @@ -1190,7 +1190,7 @@ void txt_sel_clear(Text *text) void txt_sel_line(Text *text) { if (!text->curl) return; - + text->curc = 0; text->sell = text->curl; text->selc = text->sell->len; @@ -1213,7 +1213,7 @@ char *txt_to_buf(Text *text) linef = text->lines.first; charf = 0; - + linel = text->lines.last; charl = linel->len; @@ -1221,7 +1221,7 @@ char *txt_to_buf(Text *text) length = charl - charf; buf = MEM_mallocN(length + 2, "text buffer"); - + BLI_strncpy(buf, linef->line + charf, length + 1); buf[length] = 0; } @@ -1229,37 +1229,37 @@ char *txt_to_buf(Text *text) length = linef->len - charf; length += charl; length += 2; /* For the 2 '\n' */ - + tmp = linef->next; while (tmp && tmp != linel) { length += tmp->len + 1; tmp = tmp->next; } - + buf = MEM_mallocN(length + 1, "cut buffer"); strncpy(buf, linef->line + charf, linef->len - charf); length = linef->len - charf; - + buf[length++] = '\n'; - + tmp = linef->next; while (tmp && tmp != linel) { strncpy(buf + length, tmp->line, tmp->len); length += tmp->len; - + buf[length++] = '\n'; - + tmp = tmp->next; } strncpy(buf + length, linel->line, charl); length += charl; - + /* python compiler wants an empty end line */ buf[length++] = '\n'; buf[length] = 0; } - + return buf; } @@ -1269,11 +1269,11 @@ int txt_find_string(Text *text, const char *findstr, int wrap, int match_case) const char *s = NULL; if (!text->curl || !text->sell) return 0; - + txt_order_cursors(text, false); tl = startl = text->sell; - + if (match_case) s = strstr(&tl->line[text->selc], findstr); else s = BLI_strcasestr(&tl->line[text->selc], findstr); while (!s) { @@ -1290,7 +1290,7 @@ int txt_find_string(Text *text, const char *findstr, int wrap, int match_case) if (tl == startl) break; } - + if (s) { int newl = txt_get_span(text->lines.first, tl); int newc = (int)(s - tl->line); @@ -1311,10 +1311,10 @@ char *txt_sel_to_buf(Text *text) if (!text->curl) return NULL; if (!text->sell) return NULL; - + if (text->curl == text->sell) { linef = linel = text->curl; - + if (text->curc < text->selc) { charf = text->curc; charl = text->selc; @@ -1334,7 +1334,7 @@ char *txt_sel_to_buf(Text *text) else { linef = text->curl; linel = text->sell; - + charf = text->curc; charl = text->selc; } @@ -1343,39 +1343,39 @@ char *txt_sel_to_buf(Text *text) length = charl - charf; buf = MEM_mallocN(length + 1, "sel buffer"); - + BLI_strncpy(buf, linef->line + charf, length + 1); } else { length += linef->len - charf; length += charl; length++; /* For the '\n' */ - + tmp = linef->next; while (tmp && tmp != linel) { length += tmp->len + 1; tmp = tmp->next; } - + buf = MEM_mallocN(length + 1, "sel buffer"); - + strncpy(buf, linef->line + charf, linef->len - charf); length = linef->len - charf; - + buf[length++] = '\n'; - + tmp = linef->next; while (tmp && tmp != linel) { strncpy(buf + length, tmp->line, tmp->len); length += tmp->len; - + buf[length++] = '\n'; - + tmp = tmp->next; } strncpy(buf + length, linel->line, charl); length += charl; - + buf[length] = 0; } @@ -1393,11 +1393,11 @@ void txt_insert_buf(Text *text, TextUndoBuf *utxt, const char *in_buffer) if (!in_buffer) return; txt_delete_sel(text, utxt); - + len = strlen(in_buffer); buffer = BLI_strdupn(in_buffer, len); len += txt_extended_ascii_as_utf8(&buffer); - + if (!undoing) { txt_undo_add_blockop(text, utxt, UNDO_IBLOCK, buffer); } @@ -1407,7 +1407,7 @@ void txt_insert_buf(Text *text, TextUndoBuf *utxt, const char *in_buffer) while (buffer[i] && buffer[i] != '\n') { txt_add_raw_char(text, utxt, BLI_str_utf8_as_unicode_step(buffer, &i)); } - + if (buffer[i] == '\n') { txt_split_curline(text, utxt); i++; @@ -1492,16 +1492,16 @@ void txt_print_undo(Text *text) int op; const char *ops; int linep, charp; - + dump_buffer(text); - + printf("---< Undo Buffer >---\n"); - + printf("UndoPosition is %d\n", utxt->pos); - + while (i <= utxt->pos) { op = utxt->buf[i]; - + if (op == UNDO_INSERT_1) { ops = "Insert ascii "; } @@ -1559,7 +1559,7 @@ void txt_print_undo(Text *text) else { ops = "Unknown"; } - + printf("Op (%o) at %d = %s", op, i, ops); if (op >= UNDO_INSERT_1 && op <= UNDO_DEL_4) { i++; @@ -1600,14 +1600,14 @@ void txt_print_undo(Text *text) linep = linep + (utxt->buf[i] << 8); i++; linep = linep + (utxt->buf[i] << 16); i++; linep = linep + (utxt->buf[i] << 24); i++; - + printf(" (length %d) <", linep); - + while (linep > 0) { putchar(utxt->buf[i]); linep--; i++; } - + linep = utxt->buf[i]; i++; linep = linep + (utxt->buf[i] << 8); i++; linep = linep + (utxt->buf[i] << 16); i++; @@ -1624,7 +1624,7 @@ void txt_print_undo(Text *text) linep = linep + (utxt->buf[i] << 8); i++; linep = linep + (utxt->buf[i] << 16); i++; linep = linep + (utxt->buf[i] << 24); i++; - + printf("to <%d, %d> ", linep, charp); charp = utxt->buf[i]; i++; @@ -1634,17 +1634,17 @@ void txt_print_undo(Text *text) linep = linep + (utxt->buf[i] << 8); i++; linep = linep + (utxt->buf[i] << 16); i++; linep = linep + (utxt->buf[i] << 24); i++; - + printf("from <%d, %d>", linep, charp); } - + printf(" %d\n", i); i++; } } #endif -static void txt_undo_store_uint16(char *undo_buf, int *undo_pos, unsigned short value) +static void txt_undo_store_uint16(char *undo_buf, int *undo_pos, unsigned short value) { undo_buf[*undo_pos] = (value) & 0xff; (*undo_pos)++; @@ -1652,7 +1652,7 @@ static void txt_undo_store_uint16(char *undo_buf, int *undo_pos, unsigned short (*undo_pos)++; } -static void txt_undo_store_uint32(char *undo_buf, int *undo_pos, unsigned int value) +static void txt_undo_store_uint32(char *undo_buf, int *undo_pos, unsigned int value) { undo_buf[*undo_pos] = (value) & 0xff; (*undo_pos)++; @@ -1736,7 +1736,7 @@ static void txt_undo_add_charop(Text *text, TextUndoBuf *utxt, int op_start, uns { char utf8[BLI_UTF8_MAX]; size_t i, utf8_size = BLI_str_utf8_from_unicode(c, utf8); - + if (utf8_size < 4 && 0) { if (!max_undo_test(utxt, 2 + 6 + utf8_size + 1)) { return; @@ -1770,7 +1770,7 @@ static void txt_undo_add_charop(Text *text, TextUndoBuf *utxt, int op_start, uns /* 1 byte */ utxt->buf[utxt->pos] = op_start + 3; } - + txt_undo_end(text, utxt); } @@ -1869,10 +1869,10 @@ static unsigned int txt_undo_read_unicode(const char *undo_buf, int *undo_pos, s { unsigned int unicode; char utf8[BLI_UTF8_MAX + 1]; - + switch (bytes) { case 1: /* ascii */ - unicode = undo_buf[*undo_pos]; (*undo_pos)--; + unicode = undo_buf[*undo_pos]; (*undo_pos)--; break; case 2: /* 2-byte symbol */ utf8[2] = '\0'; @@ -1896,7 +1896,7 @@ static unsigned int txt_undo_read_unicode(const char *undo_buf, int *undo_pos, s unicode = 0; break; } - + return unicode; } @@ -1945,10 +1945,10 @@ static unsigned int txt_redo_read_unicode(const char *undo_buf, int *undo_pos, s { unsigned int unicode; char utf8[BLI_UTF8_MAX + 1]; - + switch (bytes) { case 1: /* ascii */ - unicode = undo_buf[*undo_pos]; (*undo_pos)++; + unicode = undo_buf[*undo_pos]; (*undo_pos)++; break; case 2: /* 2-byte symbol */ utf8[0] = undo_buf[*undo_pos]; (*undo_pos)++; @@ -1972,7 +1972,7 @@ static unsigned int txt_redo_read_unicode(const char *undo_buf, int *undo_pos, s unicode = 0; break; } - + return unicode; } @@ -1986,7 +1986,7 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt) unsigned short curc, selc; unsigned short charp; char *buf; - + if (utxt->pos < 0) { return; } @@ -1994,21 +1994,21 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt) utxt->pos--; undoing = 1; - + switch (op) { case UNDO_INSERT_1: case UNDO_INSERT_2: case UNDO_INSERT_3: case UNDO_INSERT_4: utxt->pos -= op - UNDO_INSERT_1 + 1; - + /* get and restore the cursors */ txt_undo_read_cur(utxt->buf, &utxt->pos, &curln, &curc); txt_move_to(text, curln, curc, 0); txt_move_to(text, curln, curc, 1); - + txt_delete_char(text, utxt); - + utxt->pos--; break; @@ -2018,12 +2018,12 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt) case UNDO_BS_4: charp = op - UNDO_BS_1 + 1; uni_char = txt_undo_read_unicode(utxt->buf, &utxt->pos, charp); - + /* get and restore the cursors */ txt_undo_read_cur(utxt->buf, &utxt->pos, &curln, &curc); txt_move_to(text, curln, curc, 0); txt_move_to(text, curln, curc, 1); - + txt_add_char(text, utxt, uni_char); utxt->pos--; @@ -2069,7 +2069,7 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt) /* move cur to location that needs buff inserted */ txt_move_to(text, curln, curc, 0); - + txt_insert_buf(text, utxt, buf); MEM_freeN(buf); @@ -2078,7 +2078,7 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt) txt_move_to(text, selln, selc, 1); utxt->pos--; - + break; } case UNDO_IBLOCK: @@ -2086,7 +2086,7 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt) int i; /* length of the string in the buffer */ linep = txt_undo_read_uint32(utxt->buf, &utxt->pos); - + /* txt_backspace_char removes utf8-characters, not bytes */ buf = MEM_mallocN(linep + 1, "iblock buffer"); for (i = 0; i < linep; i++) { @@ -2096,29 +2096,29 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt) buf[i] = 0; linep = BLI_strlen_utf8(buf); MEM_freeN(buf); - + /* skip over the length that was stored again */ utxt->pos -= 4; /* get and restore the cursors */ txt_undo_read_cursors(utxt->buf, &utxt->pos, &curln, &curc, &selln, &selc); - + txt_move_to(text, curln, curc, 0); txt_move_to(text, selln, selc, 1); - + if ((curln == selln) && (curc == selc)) { /* disable tabs to spaces since moving right may involve skipping multiple spaces */ prev_flags = text->flags; text->flags &= ~TXT_TABSTOSPACES; - + for (i = 0; i < linep; i++) txt_move_right(text, 1); - + text->flags = prev_flags; } - + txt_delete_selected(text, utxt); - + utxt->pos--; break; } @@ -2131,7 +2131,7 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt) txt_undo_read_cursors(utxt->buf, &utxt->pos, &curln, &curc, &selln, &selc); txt_move_to(text, curln, curc, 0); txt_move_to(text, selln, selc, 1); - + if (op == UNDO_INDENT) { txt_unindent(text, utxt); } @@ -2147,7 +2147,7 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt) else if (op == UNDO_MOVE_LINES_DOWN) { txt_move_lines(text, utxt, TXT_MOVE_LINE_UP); } - + utxt->pos--; break; case UNDO_UNINDENT: @@ -2196,10 +2196,10 @@ void txt_do_undo(Text *text, TextUndoBuf *utxt) default: //XXX error("Undo buffer error - resetting"); utxt->pos = -1; - + break; } - + undoing = 0; } @@ -2212,15 +2212,15 @@ void txt_do_redo(Text *text, TextUndoBuf *utxt) unsigned int uni_uchar; unsigned int curln, selln; unsigned short curc, selc; - + utxt->pos++; op = utxt->buf[utxt->pos]; - + if (!op) { utxt->pos--; return; } - + undoing = 1; switch (op) { @@ -2229,12 +2229,12 @@ void txt_do_redo(Text *text, TextUndoBuf *utxt) case UNDO_INSERT_3: case UNDO_INSERT_4: utxt->pos++; - + /* get and restore the cursors */ txt_redo_read_cur(utxt->buf, &utxt->pos, &curln, &curc); txt_move_to(text, curln, curc, 0); txt_move_to(text, curln, curc, 1); - + charp = op - UNDO_INSERT_1 + 1; uni_uchar = txt_redo_read_unicode(utxt->buf, &utxt->pos, charp); @@ -2253,7 +2253,7 @@ void txt_do_redo(Text *text, TextUndoBuf *utxt) txt_move_to(text, curln, curc, 1); utxt->pos += op - UNDO_BS_1 + 1; - + /* move right so we backspace the correct char */ txt_move_right(text, 0); txt_backspace_char(text, utxt); @@ -2270,7 +2270,7 @@ void txt_do_redo(Text *text, TextUndoBuf *utxt) txt_redo_read_cur(utxt->buf, &utxt->pos, &curln, &curc); txt_move_to(text, curln, curc, 0); txt_move_to(text, curln, curc, 1); - + utxt->pos += op - UNDO_DEL_1 + 1; txt_delete_char(text, utxt); @@ -2287,12 +2287,12 @@ void txt_do_redo(Text *text, TextUndoBuf *utxt) /* length of the block */ linep = txt_redo_read_uint32(utxt->buf, &utxt->pos); - + utxt->pos += linep; /* skip over the length that was stored again */ utxt->pos += 4; - + txt_delete_sel(text, utxt); break; @@ -2312,7 +2312,7 @@ void txt_do_redo(Text *text, TextUndoBuf *utxt) memcpy(buf, &utxt->buf[utxt->pos], linep); utxt->pos += linep; buf[linep] = 0; - + txt_insert_buf(text, utxt, buf); MEM_freeN(buf); @@ -2320,7 +2320,7 @@ void txt_do_redo(Text *text, TextUndoBuf *utxt) utxt->pos += 4; break; - + case UNDO_INDENT: case UNDO_COMMENT: case UNDO_UNCOMMENT: @@ -2389,15 +2389,15 @@ void txt_do_redo(Text *text, TextUndoBuf *utxt) default: //XXX error("Undo buffer error - resetting"); utxt->pos = -1; - + break; } - + undoing = 0; } /**************************/ -/* Line editing functions */ +/* Line editing functions */ /**************************/ void txt_split_curline(Text *text, TextUndoBuf *utxt) @@ -2410,13 +2410,13 @@ void txt_split_curline(Text *text, TextUndoBuf *utxt) txt_delete_sel(text, utxt); if (!undoing) txt_undo_add_charop(text, utxt, UNDO_INSERT_1, '\n'); - + /* Make the two half strings */ left = MEM_mallocN(text->curc + 1, "textline_string"); if (text->curc) memcpy(left, text->curl->line, text->curc); left[text->curc] = 0; - + right = MEM_mallocN(text->curl->len - text->curc + 1, "textline_string"); memcpy(right, text->curl->line + text->curc, text->curl->len - text->curc + 1); @@ -2424,7 +2424,7 @@ void txt_split_curline(Text *text, TextUndoBuf *utxt) if (text->curl->format) MEM_freeN(text->curl->format); /* Make the new TextLine */ - + ins = MEM_mallocN(sizeof(TextLine), "textline"); ins->line = left; ins->format = NULL; @@ -2433,14 +2433,14 @@ void txt_split_curline(Text *text, TextUndoBuf *utxt) text->curl->line = right; text->curl->format = NULL; text->curl->len = text->curl->len - text->curc; - + BLI_insertlinkbefore(&text->lines, text->curl, ins); - + text->curc = 0; - + txt_make_dirty(text); txt_clean_text(text); - + txt_pop_sel(text); } @@ -2449,7 +2449,7 @@ static void txt_delete_line(Text *text, TextLine *line) if (!text->curl) return; BLI_remlink(&text->lines, line); - + if (line->line) MEM_freeN(line->line); if (line->format) MEM_freeN(line->format); @@ -2462,21 +2462,21 @@ static void txt_delete_line(Text *text, TextLine *line) static void txt_combine_lines(Text *text, TextLine *linea, TextLine *lineb) { char *tmp, *s; - + if (!linea || !lineb) return; tmp = MEM_mallocN(linea->len + lineb->len + 1, "textline_string"); - + s = tmp; s += BLI_strcpy_rlen(s, linea->line); s += BLI_strcpy_rlen(s, lineb->line); (void)s; make_new_line(linea, tmp); - + txt_delete_line(text, lineb); - + txt_make_dirty(text); txt_clean_text(text); } @@ -2484,16 +2484,16 @@ static void txt_combine_lines(Text *text, TextLine *linea, TextLine *lineb) void txt_duplicate_line(Text *text, TextUndoBuf *utxt) { TextLine *textline; - + if (!text->curl) return; - + if (text->curl == text->sell) { textline = txt_new_line(text->curl->line); BLI_insertlinkafter(&text->lines, text->curl, textline); - + txt_make_dirty(text); txt_clean_text(text); - + if (!undoing) txt_undo_add_op(text, utxt, UNDO_DUPLICATE); } } @@ -2520,7 +2520,7 @@ void txt_delete_char(Text *text, TextUndoBuf *utxt) else { /* Just deleting a char */ size_t c_len = 0; c = BLI_str_utf8_as_unicode_and_size(text->curl->line + text->curc, &c_len); - + memmove(text->curl->line + text->curc, text->curl->line + text->curc + c_len, text->curl->len - text->curc - c_len + 1); text->curl->len -= c_len; @@ -2530,7 +2530,7 @@ void txt_delete_char(Text *text, TextUndoBuf *utxt) txt_make_dirty(text); txt_clean_text(text); - + if (!undoing) txt_undo_add_charop(text, utxt, UNDO_DEL_1, c); } @@ -2544,9 +2544,9 @@ void txt_delete_word(Text *text, TextUndoBuf *utxt) void txt_backspace_char(Text *text, TextUndoBuf *utxt) { unsigned int c = '\n'; - + if (!text->curl) return; - + if (txt_has_sel(text)) { /* deleting a selection */ txt_delete_sel(text, utxt); txt_make_dirty(text); @@ -2554,10 +2554,10 @@ void txt_backspace_char(Text *text, TextUndoBuf *utxt) } else if (text->curc == 0) { /* Appending two lines */ if (!text->curl->prev) return; - + text->curl = text->curl->prev; text->curc = text->curl->len; - + txt_combine_lines(text, text->curl, text->curl->next); txt_pop_sel(text); } @@ -2565,7 +2565,7 @@ void txt_backspace_char(Text *text, TextUndoBuf *utxt) size_t c_len = 0; const char *prev = BLI_str_prev_char_utf8(text->curl->line + text->curc); c = BLI_str_utf8_as_unicode_and_size(prev, &c_len); - + /* source and destination overlap, don't use memcpy() */ memmove(text->curl->line + text->curc - c_len, text->curl->line + text->curc, @@ -2579,7 +2579,7 @@ void txt_backspace_char(Text *text, TextUndoBuf *utxt) txt_make_dirty(text); txt_clean_text(text); - + if (!undoing) txt_undo_add_charop(text, utxt, UNDO_BS_1, c); } @@ -2616,7 +2616,7 @@ static bool txt_add_char_intern(Text *text, TextUndoBuf *utxt, unsigned int add, txt_split_curline(text, utxt); return true; } - + /* insert spaces rather than tabs */ if (add == '\t' && replace_tabs) { txt_convert_tab_to_spaces(text, utxt); @@ -2624,23 +2624,23 @@ static bool txt_add_char_intern(Text *text, TextUndoBuf *utxt, unsigned int add, } txt_delete_sel(text, utxt); - + if (!undoing) txt_undo_add_charop(text, utxt, UNDO_INSERT_1, add); add_len = BLI_str_utf8_from_unicode(add, ch); - + tmp = MEM_mallocN(text->curl->len + add_len + 1, "textline_string"); - + memcpy(tmp, text->curl->line, text->curc); memcpy(tmp + text->curc, ch, add_len); memcpy(tmp + text->curc + add_len, text->curl->line + text->curc, text->curl->len - text->curc + 1); make_new_line(text->curl, tmp); - + text->curc += add_len; txt_pop_sel(text); - + txt_make_dirty(text); txt_clean_text(text); @@ -2675,10 +2675,10 @@ bool txt_replace_char(Text *text, TextUndoBuf *utxt, unsigned int add) if (text->curc == text->curl->len || txt_has_sel(text) || add == '\n') { return txt_add_char(text, utxt, add); } - + del = BLI_str_utf8_as_unicode_and_size(text->curl->line + text->curc, &del_size); add_size = BLI_str_utf8_from_unicode(add, ch); - + if (add_size > del_size) { char *tmp = MEM_mallocN(text->curl->len + add_size - del_size + 1, "textline_string"); memcpy(tmp, text->curl->line, text->curc); @@ -2690,11 +2690,11 @@ bool txt_replace_char(Text *text, TextUndoBuf *utxt, unsigned int add) char *tmp = text->curl->line; memmove(tmp + text->curc + add_size, tmp + text->curc + del_size, text->curl->len - text->curc - del_size + 1); } - + memcpy(text->curl->line + text->curc, ch, add_size); text->curc += add_size; text->curl->len += add_size - del_size; - + txt_pop_sel(text); txt_make_dirty(text); txt_clean_text(text); @@ -2749,7 +2749,7 @@ static void txt_select_prefix(Text *text, const char *add) txt_make_dirty(text); txt_clean_text(text); } - + if (text->curl == text->sell) { text->selc += indentlen; break; @@ -2766,7 +2766,7 @@ static void txt_select_prefix(Text *text, const char *add) text->curl = text->curl->prev; num--; } - + /* caller must handle undo */ } @@ -2816,10 +2816,10 @@ static void txt_select_unprefix( (*r_line_index_mask_len) += 1; } } - + txt_make_dirty(text); txt_clean_text(text); - + if (text->curl == text->sell) { if (changed) text->selc = MAX2(text->selc - indentlen, 0); @@ -2830,7 +2830,7 @@ static void txt_select_unprefix( num++; } - + } if (unindented_first) @@ -2898,7 +2898,7 @@ void txt_unindent(Text *text, TextUndoBuf *utxt) const char *prefix = (text->flags & TXT_TABSTOSPACES) ? tab_to_spaces : "\t"; ListBase line_index_mask; int line_index_mask_len; - + if (ELEM(NULL, text->curl, text->sell)) { return; } @@ -2919,13 +2919,13 @@ void txt_move_lines(struct Text *text, TextUndoBuf *utxt, const int direction) BLI_assert(ELEM(direction, TXT_MOVE_LINE_UP, TXT_MOVE_LINE_DOWN)); if (!text->curl || !text->sell) return; - + txt_order_cursors(text, false); line_other = (direction == TXT_MOVE_LINE_DOWN) ? text->sell->next : text->curl->prev; - + if (!line_other) return; - + BLI_remlink(&text->lines, line_other); if (direction == TXT_MOVE_LINE_DOWN) { @@ -2937,7 +2937,7 @@ void txt_move_lines(struct Text *text, TextUndoBuf *utxt, const int direction) txt_make_dirty(text); txt_clean_text(text); - + if (!undoing) { txt_undo_add_op(text, utxt, (direction == TXT_MOVE_LINE_DOWN) ? UNDO_MOVE_LINES_DOWN : UNDO_MOVE_LINES_UP); } @@ -2967,7 +2967,7 @@ int txt_setcurr_tab_spaces(Text *text, int space) /* if we find a ':' on this line, then add a tab but not if it is: * 1) in a comment * 2) within an identifier - * 3) after the cursor (text->curc), i.e. when creating space before a function def [#25414] + * 3) after the cursor (text->curc), i.e. when creating space before a function def [#25414] */ int a; bool is_indent = false; diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 2bf2fa7807b..ad60e81fe19 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -76,9 +76,9 @@ TexMapping *BKE_texture_mapping_add(int type) { TexMapping *texmap = MEM_callocN(sizeof(TexMapping), "TexMapping"); - + BKE_texture_mapping_default(texmap, type); - + return texmap; } @@ -132,7 +132,7 @@ void BKE_texture_mapping_init(TexMapping *texmap) if (fabsf(size[2]) < 1e-5f) size[2] = signf(size[2]) * 1e-5f; } - + size_to_mat4(smat, texmap->size); /* rotation */ @@ -173,9 +173,9 @@ void BKE_texture_mapping_init(TexMapping *texmap) ColorMapping *BKE_texture_colormapping_add(void) { ColorMapping *colormap = MEM_callocN(sizeof(ColorMapping), "ColorMapping"); - + BKE_texture_colormapping_default(colormap); - + return colormap; } @@ -211,7 +211,7 @@ void BKE_texture_free(Tex *tex) } MEM_SAFE_FREE(tex->coba); - + BKE_icon_id_delete((ID *)tex); BKE_previewimg_free(&tex->preview); } @@ -271,7 +271,7 @@ void BKE_texture_default(Tex *tex) tex->iuser.ok = 1; tex->iuser.frames = 100; tex->iuser.sfra = 1; - + tex->preview = NULL; } @@ -287,9 +287,9 @@ Tex *BKE_texture_add(Main *bmain, const char *name) Tex *tex; tex = BKE_libblock_alloc(bmain, ID_TE, name, 0); - + BKE_texture_default(tex); - + return tex; } @@ -369,11 +369,11 @@ void BKE_texture_mtex_default(MTex *mtex) MTex *BKE_texture_mtex_add(void) { MTex *mtex; - + mtex = MEM_callocN(sizeof(MTex), "BKE_texture_mtex_add"); - + BKE_texture_mtex_default(mtex); - + return mtex; } @@ -388,7 +388,7 @@ MTex *BKE_texture_mtex_add_id(ID *id, int slot) if (mtex_ar == NULL) { return NULL; } - + if (slot == -1) { /* find first free */ int i; @@ -474,19 +474,19 @@ Tex *BKE_texture_localize(Tex *tex) * ... Once f*** nodes are fully converted to that too :( */ Tex *texn; - + texn = BKE_libblock_copy_nolib(&tex->id, false); - + /* image texture: BKE_texture_free also doesn't decrease */ - + if (texn->coba) texn->coba = MEM_dupallocN(texn->coba); - + texn->preview = NULL; - + if (tex->nodetree) { texn->nodetree = ntreeLocalize(tex->nodetree); } - + return texn; } @@ -590,12 +590,12 @@ Tex *give_current_particle_texture(ParticleSettings *part) { MTex *mtex = NULL; Tex *tex = NULL; - + if (!part) return NULL; - + mtex = part->mtex[(int)(part->texact)]; if (mtex) tex = mtex->tex; - + return tex; } @@ -612,7 +612,7 @@ void set_current_particle_texture(ParticleSettings *part, Tex *newtex) part->mtex[act]->texco = TEXCO_ORCO; part->mtex[act]->blendtype = MTEX_MUL; } - + part->mtex[act]->tex = newtex; id_us_plus(&newtex->id); } @@ -657,7 +657,7 @@ PointDensity *BKE_texture_pointdensity_add(void) PointDensity *pd = MEM_callocN(sizeof(PointDensity), "pointdensity"); BKE_texture_pointdensity_init_data(pd); return pd; -} +} PointDensity *BKE_texture_pointdensity_copy(const PointDensity *pd, const int UNUSED(flag)) { diff --git a/source/blender/blenkernel/intern/tracking_solver.c b/source/blender/blenkernel/intern/tracking_solver.c index c21883c6eb8..a5d35449229 100644 --- a/source/blender/blenkernel/intern/tracking_solver.c +++ b/source/blender/blenkernel/intern/tracking_solver.c @@ -518,7 +518,7 @@ bool BKE_tracking_reconstruction_finish(MovieReconstructContext *context, MovieT BKE_tracking_dopesheet_tag_update(tracking); object = BKE_tracking_object_get_named(tracking, context->object_name); - + if (context->is_camera) reconstruction = &tracking->reconstruction; else diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index 1b06e7ed851..69096ad7a08 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -70,7 +70,7 @@ void BKE_world_free(World *wrld) } GPU_material_free(&wrld->gpumaterial); - + BKE_icon_id_delete((struct ID *)wrld); BKE_previewimg_free(&wrld->preview); } @@ -85,7 +85,7 @@ void BKE_world_init(World *wrld) wrld->aodist = 10.0f; wrld->aoenergy = 1.0f; - + wrld->preview = NULL; wrld->miststa = 5.0f; wrld->mistdist = 25.0f; @@ -145,16 +145,16 @@ World *BKE_world_localize(World *wrld) * ... Once f*** nodes are fully converted to that too :( */ World *wrldn; - + wrldn = BKE_libblock_copy_nolib(&wrld->id, false); - + if (wrld->nodetree) wrldn->nodetree = ntreeLocalize(wrld->nodetree); - + wrldn->preview = NULL; - + BLI_listbase_clear(&wrldn->gpumaterial); - + return wrldn; } diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c index 2c6b22f0402..994592ec307 100644 --- a/source/blender/blenkernel/intern/writeavi.c +++ b/source/blender/blenkernel/intern/writeavi.c @@ -189,7 +189,7 @@ static int start_avi(void *context_v, Scene *UNUSED(scene), RenderData *rd, int BKE_report(reports, RPT_ERROR, "Cannot open or start AVI movie file"); return 0; } - + AVI_set_compress_option(avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_WIDTH, &x); AVI_set_compress_option(avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_HEIGHT, &y); AVI_set_compress_option(avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_QUALITY, &quality); @@ -199,7 +199,7 @@ static int start_avi(void *context_v, Scene *UNUSED(scene), RenderData *rd, int avi->odd_fields = 0; /* avi->interlace = rd->mode & R_FIELDS; */ /* avi->odd_fields = (rd->mode & R_ODDFIELD) ? 1 : 0; */ - + printf("Created avi: %s\n", name); return 1; } @@ -211,7 +211,7 @@ static int append_avi(void *context_v, RenderData *UNUSED(rd), int start_frame, int x, y; char *cp, rt; AviMovie *avi = context_v; - + if (avi == NULL) return 0; @@ -222,7 +222,7 @@ static int append_avi(void *context_v, RenderData *UNUSED(rd), int start_frame, /* flip y and convert to abgr */ for (y = 0; y < recty; y++, rt1 += rectx, rt2 -= rectx) { memcpy(rt1, rt2, rectx * sizeof(int)); - + cp = (char *)rt1; for (x = rectx; x > 0; x--) { rt = cp[0]; @@ -234,7 +234,7 @@ static int append_avi(void *context_v, RenderData *UNUSED(rd), int start_frame, cp += 4; } } - + AVI_write_frame(avi, (frame - start_frame), AVI_FORMAT_RGB32, rectot, rectx * recty * 4); // printf("added frame %3d (frame %3d in avi): ", frame, frame-start_frame); diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 17c665f3bcd..394f4cc1122 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -231,7 +231,7 @@ static AVFrame *alloc_picture(int pix_fmt, int width, int height) AVFrame *f; uint8_t *buf; int size; - + /* allocate space for the struct */ f = av_frame_alloc(); if (!f) return NULL; @@ -511,7 +511,7 @@ static void set_ffmpeg_properties(RenderData *rd, AVCodecContext *c, const char if (!rd->ffcodecdata.properties) { return; } - + prop = IDP_GetPropertyFromGroup(rd->ffcodecdata.properties, prop_name); if (!prop) { return; @@ -540,13 +540,13 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int st->id = 0; /* Set up the codec context */ - + c = st->codec; c->codec_id = codec_id; c->codec_type = AVMEDIA_TYPE_VIDEO; /* Get some values from the current render settings */ - + c->width = rectx; c->height = recty; @@ -563,7 +563,7 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int c->time_base.den = rd->frs_sec * 100000; c->time_base.num = ((double) rd->frs_sec_base) * 100000; } - + c->gop_size = context->ffmpeg_gop_size; c->max_b_frames = context->ffmpeg_max_b_frames; @@ -617,11 +617,11 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int /* Deprecated and not doing anything since July 2015, deleted in recent ffmpeg */ //c->me_method = ME_EPZS; - + codec = avcodec_find_encoder(c->codec_id); if (!codec) return NULL; - + /* Be sure to use the correct pixel format(e.g. RGB, YUV) */ if (codec->pix_fmts) { @@ -643,7 +643,7 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int c->qmin = 10; c->qmax = 51; } - + /* Keep lossless encodes in the RGB domain. */ if (codec_id == AV_CODEC_ID_HUFFYUV) { if (rd->im_format.planes == R_IMF_PLANES_RGBA) { @@ -681,7 +681,7 @@ static AVStream *alloc_video_stream(FFMpegContext *context, RenderData *rd, int PRINT("Using global header\n"); c->flags |= CODEC_FLAG_GLOBAL_HEADER; } - + /* xasp & yasp got float lately... */ st->sample_aspect_ratio = c->sample_aspect_ratio = av_d2q(((double) rd->xasp / (double) rd->yasp), 255); @@ -879,7 +879,7 @@ static int start_ffmpeg_impl(FFMpegContext *context, struct RenderData *rd, int name, context->ffmpeg_type, context->ffmpeg_codec, context->ffmpeg_audio_codec, context->ffmpeg_video_bitrate, context->ffmpeg_audio_bitrate, context->ffmpeg_gop_size, context->ffmpeg_autosplit, rectx, recty); - + exts = get_file_extensions(context->ffmpeg_type); if (!exts) { BKE_report(reports, RPT_ERROR, "No valid formats found"); @@ -967,7 +967,7 @@ static int start_ffmpeg_impl(FFMpegContext *context, struct RenderData *rd, int goto fail; } } - + if (context->ffmpeg_type == FFMPEG_DV) { fmt->audio_codec = AV_CODEC_ID_PCM_S16LE; if (context->ffmpeg_audio_codec != AV_CODEC_ID_NONE && rd->ffcodecdata.audio_mixrate != 48000 && rd->ffcodecdata.audio_channels != 2) { @@ -975,7 +975,7 @@ static int start_ffmpeg_impl(FFMpegContext *context, struct RenderData *rd, int goto fail; } } - + if (fmt->video_codec != AV_CODEC_ID_NONE) { context->video_stream = alloc_video_stream(context, rd, fmt->video_codec, of, rectx, recty, error, sizeof(error)); PRINT("alloc video stream %p\n", context->video_stream); @@ -1061,14 +1061,14 @@ fail: static void flush_ffmpeg(FFMpegContext *context) { int ret = 0; - + AVCodecContext *c = context->video_stream->codec; /* get the delayed frames */ while (1) { int got_output; AVPacket packet = { 0 }; av_init_packet(&packet); - + ret = avcodec_encode_video2(c, &packet, NULL, &got_output); if (ret < 0) { fprintf(stderr, "Error encoding delayed frame %d\n", ret); @@ -1294,11 +1294,11 @@ static void end_ffmpeg_impl(FFMpegContext *context, int is_autosplit) PRINT("Flushing delayed frames...\n"); flush_ffmpeg(context); } - + if (context->outfile) { av_write_trailer(context->outfile); } - + /* Close the video codec */ if (context->video_stream != NULL && context->video_stream->codec != NULL) { @@ -1360,7 +1360,7 @@ void BKE_ffmpeg_property_del(RenderData *rd, void *type, void *prop_) { struct IDProperty *prop = (struct IDProperty *) prop_; IDProperty *group; - + if (!rd->ffcodecdata.properties) { return; } @@ -1379,17 +1379,17 @@ static IDProperty *BKE_ffmpeg_property_add(RenderData *rd, const char *type, con IDPropertyTemplate val; int idp_type; char name[256]; - + val.i = 0; avcodec_get_context_defaults3(&c, NULL); if (!rd->ffcodecdata.properties) { - rd->ffcodecdata.properties = IDP_New(IDP_GROUP, &val, "ffmpeg"); + rd->ffcodecdata.properties = IDP_New(IDP_GROUP, &val, "ffmpeg"); } group = IDP_GetPropertyFromGroup(rd->ffcodecdata.properties, type); - + if (!group) { group = IDP_New(IDP_GROUP, &val, type); IDP_AddToGroup(rd->ffcodecdata.properties, group); @@ -1449,7 +1449,7 @@ int BKE_ffmpeg_property_add_string(RenderData *rd, const char *type, const char char *name; char *param; IDProperty *prop = NULL; - + avcodec_get_context_defaults3(&c, NULL); BLI_strncpy(name_, str, sizeof(name_)); @@ -1466,7 +1466,7 @@ int BKE_ffmpeg_property_add_string(RenderData *rd, const char *type, const char *param++ = '\0'; while (*param == ' ') param++; } - + o = av_opt_find(&c, name, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ); if (!o) { PRINT("Ignoring unknown expert option %s\n", str); @@ -1487,7 +1487,7 @@ int BKE_ffmpeg_property_add_string(RenderData *rd, const char *type, const char else { prop = BKE_ffmpeg_property_add(rd, (char *) type, o, NULL); } - + if (!prop) { return 0; diff --git a/source/blender/blenkernel/nla_private.h b/source/blender/blenkernel/nla_private.h index c441f00ceaa..87f4e37e86d 100644 --- a/source/blender/blenkernel/nla_private.h +++ b/source/blender/blenkernel/nla_private.h @@ -40,13 +40,13 @@ struct Depsgraph; /* used for list of strips to accumulate at current time */ typedef struct NlaEvalStrip { struct NlaEvalStrip *next, *prev; - + NlaTrack *track; /* track that this strip belongs to */ NlaStrip *strip; /* strip that's being used */ - + short track_index; /* the index of the track within the list */ short strip_mode; /* which end of the strip are we looking at */ - + float strip_time; /* time at which which strip is being evaluated */ } NlaEvalStrip; @@ -56,7 +56,7 @@ enum eNlaEvalStrip_StripMode { NES_TIME_BEFORE = -1, NES_TIME_WITHIN, NES_TIME_AFTER, - + /* transition-strip evaluations */ NES_TIME_TRANSITION_START, NES_TIME_TRANSITION_END, @@ -67,11 +67,11 @@ enum eNlaEvalStrip_StripMode { // TODO: maybe this will be used as the 'cache' stuff needed for editable values too? typedef struct NlaEvalChannel { struct NlaEvalChannel *next, *prev; - + PointerRNA ptr; /* pointer to struct containing property to use */ PropertyRNA *prop; /* RNA-property type to use (should be in the struct given) */ int index; /* array index (where applicable) */ - + float value; /* value of this channel */ } NlaEvalChannel; diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index 8b5c64f4ecd..327812f78d5 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -164,7 +164,7 @@ struct BlendThumbnail *BLO_thumbnail_from_file(const char *filepath); struct Main *BLO_main_from_memfile(struct MemFile *memfile, struct Main *bmain, struct Scene **r_scene); #ifdef __cplusplus -} +} #endif #endif /* __BLO_READFILE_H__ */ diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt index c59232e7887..2c6f6f3edfb 100644 --- a/source/blender/blenloader/CMakeLists.txt +++ b/source/blender/blenloader/CMakeLists.txt @@ -23,7 +23,7 @@ # # ***** END GPL LICENSE BLOCK ***** -set(INC +set(INC . ../blenfont ../blenkernel diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 8d90a11f5d9..4ccdbd9e8e1 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -68,10 +68,10 @@ #endif /* local prototypes --------------------- */ -void BLO_blendhandle_print_sizes(BlendHandle *, void *); +void BLO_blendhandle_print_sizes(BlendHandle *, void *); /* Access routines used by filesel. */ - + /** * Open a blendhandle from a file path. * @@ -104,7 +104,7 @@ BlendHandle *BLO_blendhandle_from_memory(const void *mem, int memsize) return bh; } -void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp) +void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp) { FileData *fd = (FileData *) bh; BHead *bhead; @@ -117,7 +117,7 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp) const short *sp = fd->filesdna->structs[bhead->SDNAnr]; const char *name = fd->filesdna->types[sp[0]]; char buf[4]; - + buf[0] = (bhead->code >> 24) & 0xFF; buf[1] = (bhead->code >> 16) & 0xFF; buf[2] = (bhead->code >> 8) & 0xFF; @@ -127,7 +127,7 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp) buf[1] = buf[1] ? buf[1] : ' '; buf[2] = buf[2] ? buf[2] : ' '; buf[3] = buf[3] ? buf[3] : ' '; - + fprintf(fp, "['%.4s', '%s', %d, %ld ],\n", buf, name, bhead->nr, (long int)(bhead->len + sizeof(BHead))); } } @@ -225,7 +225,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to new_prv->rect[0] = NULL; new_prv->w[0] = new_prv->h[0] = 0; } - + if (prv->rect[1] && prv->w[1] && prv->h[1]) { unsigned int *rect = NULL; size_t len = new_prv->w[1] * new_prv->h[1] * sizeof(unsigned int); @@ -255,7 +255,7 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to new_prv = NULL; prv = NULL; } - + } *tot_prev = tot; @@ -274,7 +274,7 @@ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh) GSet *gathered = BLI_gset_ptr_new("linkable_groups gh"); LinkNode *names = NULL; BHead *bhead; - + for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) { if (bhead->code == ENDB) { break; @@ -289,11 +289,11 @@ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh) } } } - + BLI_gset_free(gathered, NULL); - + return names; -} +} /** * Close and free a blendhandle. The handle becomes invalid after this call. @@ -303,7 +303,7 @@ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh) void BLO_blendhandle_close(BlendHandle *bh) { FileData *fd = (FileData *) bh; - + blo_freefiledata(fd); } @@ -323,7 +323,7 @@ BlendFileData *BLO_read_from_file( { BlendFileData *bfd = NULL; FileData *fd; - + fd = blo_openblenderfile(filepath, reports); if (fd) { fd->reports = reports; @@ -350,7 +350,7 @@ BlendFileData *BLO_read_from_memory( { BlendFileData *bfd = NULL; FileData *fd; - + fd = blo_openblendermemory(mem, memsize, reports); if (fd) { fd->reports = reports; @@ -375,13 +375,13 @@ BlendFileData *BLO_read_from_memfile( BlendFileData *bfd = NULL; FileData *fd; ListBase old_mainlist; - + fd = blo_openblendermemfile(memfile, reports); if (fd) { fd->reports = reports; fd->skip_flags = skip_flags; BLI_strncpy(fd->relabase, filename, sizeof(fd->relabase)); - + /* clear ob->proxy_from pointers in old main */ blo_clear_proxy_pointers_from_lib(oldmain); @@ -389,26 +389,26 @@ BlendFileData *BLO_read_from_memfile( blo_split_main(&old_mainlist, oldmain); /* add the library pointers in oldmap lookup */ blo_add_library_pointer_map(&old_mainlist, fd); - + /* makes lookup of existing images in old main */ blo_make_image_pointer_map(fd, oldmain); - + /* makes lookup of existing video clips in old main */ blo_make_movieclip_pointer_map(fd, oldmain); /* make lookups of existing sound data in old main */ blo_make_sound_pointer_map(fd, oldmain); - + /* removed packed data from this trick - it's internal data that needs saves */ - + bfd = blo_read_file_internal(fd, filename); - + /* ensures relinked images are not freed */ blo_end_image_pointer_map(fd, oldmain); - + /* ensures relinked movie clips are not freed */ blo_end_movieclip_pointer_map(fd, oldmain); - + /* ensures relinked sounds are not freed */ blo_end_sound_pointer_map(fd, oldmain); @@ -467,7 +467,7 @@ void BLO_blendfiledata_free(BlendFileData *bfd) if (bfd->main) { BKE_main_free(bfd->main); } - + if (bfd->user) { MEM_freeN(bfd->user); } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index ebdca0cb8f7..eb9b3f61c08 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -274,17 +274,17 @@ static void expand_scene_collection(FileData *fd, Main *mainvar, SceneCollection void blo_reportf_wrap(ReportList *reports, ReportType type, const char *format, ...) { char fixed_buf[1024]; /* should be long enough */ - + va_list args; - + va_start(args, format); vsnprintf(fixed_buf, sizeof(fixed_buf), format, args); va_end(args); - + fixed_buf[sizeof(fixed_buf) - 1] = '\0'; - + BKE_report(reports, type, fixed_buf); - + if (G.background == 0) { printf("%s: %s\n", BKE_report_type_str(type), fixed_buf); } @@ -296,27 +296,27 @@ static const char *library_parent_filepath(Library *lib) return lib->parent ? lib->parent->filepath : "<direct>"; } -static OldNewMap *oldnewmap_new(void) +static OldNewMap *oldnewmap_new(void) { OldNewMap *onm= MEM_callocN(sizeof(*onm), "OldNewMap"); - + onm->entriessize = 1024; onm->entries = MEM_malloc_arrayN(onm->entriessize, sizeof(*onm->entries), "OldNewMap.entries"); - + return onm; } static int verg_oldnewmap(const void *v1, const void *v2) { const struct OldNew *x1=v1, *x2=v2; - + if (x1->old > x2->old) return 1; else if (x1->old < x2->old) return -1; return 0; } -static void oldnewmap_sort(FileData *fd) +static void oldnewmap_sort(FileData *fd) { BLI_assert(fd->libmap->sorted == false); qsort(fd->libmap->entries, fd->libmap->nentries, sizeof(OldNew), verg_oldnewmap); @@ -327,9 +327,9 @@ static void oldnewmap_sort(FileData *fd) static void oldnewmap_insert(OldNewMap *onm, const void *oldaddr, void *newaddr, int nr) { OldNew *entry; - + if (oldaddr==NULL || newaddr==NULL) return; - + if (UNLIKELY(onm->nentries == onm->entriessize)) { onm->entriessize *= 2; onm->entries = MEM_reallocN(onm->entries, sizeof(*onm->entries) * onm->entriessize); @@ -399,19 +399,19 @@ static int oldnewmap_lookup_entry_full(const OldNewMap *onm, const void *addr, i static void *oldnewmap_lookup_and_inc(OldNewMap *onm, const void *addr, bool increase_users) { int i; - + if (addr == NULL) return NULL; - + if (onm->lasthit < onm->nentries-1) { OldNew *entry = &onm->entries[++onm->lasthit]; - + if (entry->old == addr) { if (increase_users) entry->nr++; return entry->newp; } } - + i = oldnewmap_lookup_entry_full(onm, addr, onm->lasthit); if (i != -1) { OldNew *entry = &onm->entries[i]; @@ -421,7 +421,7 @@ static void *oldnewmap_lookup_and_inc(OldNewMap *onm, const void *addr, bool inc entry->nr++; return entry->newp; } - + return NULL; } @@ -460,7 +460,7 @@ static void *oldnewmap_liblookup(OldNewMap *onm, const void *addr, const void *l return NULL; } -static void oldnewmap_free_unused(OldNewMap *onm) +static void oldnewmap_free_unused(OldNewMap *onm) { int i; @@ -473,13 +473,13 @@ static void oldnewmap_free_unused(OldNewMap *onm) } } -static void oldnewmap_clear(OldNewMap *onm) +static void oldnewmap_clear(OldNewMap *onm) { onm->nentries = 0; onm->lasthit = 0; } -static void oldnewmap_free(OldNewMap *onm) +static void oldnewmap_free(OldNewMap *onm) { MEM_freeN(onm->entries); MEM_freeN(onm); @@ -495,7 +495,7 @@ static void add_main_to_main(Main *mainvar, Main *from) { ListBase *lbarray[MAX_LIBARRAY], *fromarray[MAX_LIBARRAY]; int a; - + set_listbasepointers(mainvar, lbarray); a = set_listbasepointers(from, fromarray); while (a--) { @@ -506,7 +506,7 @@ static void add_main_to_main(Main *mainvar, Main *from) void blo_join_main(ListBase *mainlist) { Main *tojoin, *mainl; - + mainl = mainlist->first; while ((tojoin = mainl->next)) { add_main_to_main(mainl, tojoin); @@ -542,10 +542,10 @@ void blo_split_main(ListBase *mainlist, Main *main) { mainlist->first = mainlist->last = main; main->next = NULL; - + if (BLI_listbase_is_empty(&main->library)) return; - + /* (Library.temp_index -> Main), lookup table */ const unsigned int lib_main_array_len = BLI_listbase_count(&main->library); Main **lib_main_array = MEM_malloc_arrayN(lib_main_array_len, sizeof(*lib_main_array), __func__); @@ -560,7 +560,7 @@ void blo_split_main(ListBase *mainlist, Main *main) lib->temp_index = i; lib_main_array[i] = libmain; } - + ListBase *lbarray[MAX_LIBARRAY]; i = set_listbasepointers(main, lbarray); while (i--) { @@ -577,7 +577,7 @@ void blo_split_main(ListBase *mainlist, Main *main) static void read_file_version(FileData *fd, Main *main) { BHead *bhead; - + for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) { if (bhead->code == GLOB) { FileGlobal *fg= read_struct(fd, bhead, "Global"); @@ -642,37 +642,37 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab Main *m; Library *lib; char name1[FILE_MAX]; - + BLI_strncpy(name1, filepath, sizeof(name1)); BLI_cleanup_path(relabase, name1); - + // printf("blo_find_main: relabase %s\n", relabase); // printf("blo_find_main: original in %s\n", filepath); // printf("blo_find_main: converted to %s\n", name1); - + for (m = mainlist->first; m; m = m->next) { const char *libname = (m->curlib) ? m->curlib->filepath : m->name; - + if (BLI_path_cmp(name1, libname) == 0) { if (G.debug & G_DEBUG) printf("blo_find_main: found library %s\n", libname); return m; } } - + m = BKE_main_new(); BLI_addtail(mainlist, m); - + /* Add library datablock itself to 'main' Main, since libraries are **never** linked data. * Fixes bug where you could end with all ID_LI datablocks having the same name... */ lib = BKE_libblock_alloc(mainlist->first, ID_LI, "Lib", 0); lib->id.us = ID_FAKE_USERS(lib); /* Important, consistency with main ID reading code from read_libblock(). */ BLI_strncpy(lib->name, filepath, sizeof(lib->name)); BLI_strncpy(lib->filepath, name1, sizeof(lib->filepath)); - + m->curlib = lib; - + read_file_version(fd, m); - + if (G.debug & G_DEBUG) printf("blo_find_main: added new lib %s\n", filepath); return m; } @@ -684,7 +684,7 @@ static void switch_endian_bh4(BHead4 *bhead) { /* the ID_.. codes */ if ((bhead->code & 0xFFFF)==0) bhead->code >>= 16; - + if (bhead->code != ENDB) { BLI_endian_switch_int32(&bhead->len); BLI_endian_switch_int32(&bhead->SDNAnr); @@ -696,7 +696,7 @@ static void switch_endian_bh8(BHead8 *bhead) { /* the ID_.. codes */ if ((bhead->code & 0xFFFF)==0) bhead->code >>= 16; - + if (bhead->code != ENDB) { BLI_endian_switch_int32(&bhead->len); BLI_endian_switch_int32(&bhead->SDNAnr); @@ -719,12 +719,12 @@ static void bh4_from_bh8(BHead *bhead, BHead8 *bhead8, int do_endian_swap) if (do_endian_swap) { BLI_endian_switch_int64(&bhead8->old); } - + /* this patch is to avoid a long long being read from not-eight aligned positions * is necessary on any modern 64bit architecture) */ memcpy(&old, &bhead8->old, 8); bhead4->old = (int) (old >> 3); - + bhead4->SDNAnr = bhead8->SDNAnr; bhead4->nr = bhead8->nr; } @@ -733,10 +733,10 @@ static void bh4_from_bh8(BHead *bhead, BHead8 *bhead8, int do_endian_swap) static void bh8_from_bh4(BHead *bhead, BHead4 *bhead4) { BHead8 *bhead8 = (BHead8 *) bhead; - + bhead8->code = bhead4->code; bhead8->len = bhead4->len; - + if (bhead8->code != ENDB) { bhead8->old = bhead4->old; bhead8->SDNAnr = bhead4->SDNAnr; @@ -748,7 +748,7 @@ static BHeadN *get_bhead(FileData *fd) { BHeadN *new_bhead = NULL; int readsize; - + if (fd) { if (!fd->eof) { /* initializing to zero isn't strictly needed but shuts valgrind up @@ -756,7 +756,7 @@ static BHeadN *get_bhead(FileData *fd) BHead8 bhead8 = {0}; BHead4 bhead4 = {0}; BHead bhead = {0}; - + /* First read the bhead structure. * Depending on the platform the file was written on this can * be a big or little endian BHead4 or BHead8 structure. @@ -767,12 +767,12 @@ static BHeadN *get_bhead(FileData *fd) if (fd->flags & FD_FLAGS_FILE_POINTSIZE_IS_4) { bhead4.code = DATA; readsize = fd->read(fd, &bhead4, sizeof(bhead4)); - + if (readsize == sizeof(bhead4) || bhead4.code == ENDB) { if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { switch_endian_bh4(&bhead4); } - + if (fd->flags & FD_FLAGS_POINTSIZE_DIFFERS) { bh8_from_bh4(&bhead, &bhead4); } @@ -790,12 +790,12 @@ static BHeadN *get_bhead(FileData *fd) else { bhead8.code = DATA; readsize = fd->read(fd, &bhead8, sizeof(bhead8)); - + if (readsize == sizeof(bhead8) || bhead8.code == ENDB) { if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { switch_endian_bh8(&bhead8); } - + if (fd->flags & FD_FLAGS_POINTSIZE_DIFFERS) { bh4_from_bh8(&bhead, &bhead8, (fd->flags & FD_FLAGS_SWITCH_ENDIAN)); } @@ -810,10 +810,10 @@ static BHeadN *get_bhead(FileData *fd) bhead.len= 0; } } - + /* make sure people are not trying to pass bad blend files */ if (bhead.len < 0) fd->eof = 1; - + /* bhead now contains the (converted) bhead structure. Now read * the associated data and put everything in a BHeadN (creative naming !) */ @@ -822,9 +822,9 @@ static BHeadN *get_bhead(FileData *fd) if (new_bhead) { new_bhead->next = new_bhead->prev = NULL; new_bhead->bhead = bhead; - + readsize = fd->read(fd, new_bhead + 1, bhead.len); - + if (readsize != bhead.len) { fd->eof = 1; MEM_freeN(new_bhead); @@ -844,7 +844,7 @@ static BHeadN *get_bhead(FileData *fd) if (new_bhead) { BLI_addtail(&fd->listbase, new_bhead); } - + return(new_bhead); } @@ -852,7 +852,7 @@ BHead *blo_firstbhead(FileData *fd) { BHeadN *new_bhead; BHead *bhead = NULL; - + /* Rewind the file * Read in a new block if necessary */ @@ -860,11 +860,11 @@ BHead *blo_firstbhead(FileData *fd) if (new_bhead == NULL) { new_bhead = get_bhead(fd); } - + if (new_bhead) { bhead = &new_bhead->bhead; } - + return(bhead); } @@ -872,7 +872,7 @@ BHead *blo_prevbhead(FileData *UNUSED(fd), BHead *thisblock) { BHeadN *bheadn = (BHeadN *)POINTER_OFFSET(thisblock, -offsetof(BHeadN, bhead)); BHeadN *prev = bheadn->prev; - + return (prev) ? &prev->bhead : NULL; } @@ -880,25 +880,25 @@ BHead *blo_nextbhead(FileData *fd, BHead *thisblock) { BHeadN *new_bhead = NULL; BHead *bhead = NULL; - + if (thisblock) { /* bhead is actually a sub part of BHeadN * We calculate the BHeadN pointer from the BHead pointer below */ new_bhead = (BHeadN *)POINTER_OFFSET(thisblock, -offsetof(BHeadN, bhead)); - + /* get the next BHeadN. If it doesn't exist we read in the next one */ new_bhead = new_bhead->next; if (new_bhead == NULL) { new_bhead = get_bhead(fd); } } - + if (new_bhead) { /* here we do the reverse: * go from the BHeadN pointer to the BHead pointer */ bhead = &new_bhead->bhead; } - + return(bhead); } @@ -957,11 +957,11 @@ static void decode_blender_header(FileData *fd) static bool read_file_dna(FileData *fd, const char **r_error_message) { BHead *bhead; - + for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) { if (bhead->code == DNA1) { const bool do_endian_swap = (fd->flags & FD_FLAGS_SWITCH_ENDIAN) != 0; - + fd->filesdna = DNA_sdna_from_data(&bhead[1], bhead->len, do_endian_swap, true, r_error_message); if (fd->filesdna) { fd->compflags = DNA_struct_get_compareflags(fd->filesdna, fd->memsdna); @@ -973,12 +973,12 @@ static bool read_file_dna(FileData *fd, const char **r_error_message) else { return false; } - + } else if (bhead->code == ENDB) break; } - + *r_error_message = "Missing DNA block"; return false; } @@ -1027,28 +1027,28 @@ static int *read_file_thumbnail(FileData *fd) static int fd_read_from_file(FileData *filedata, void *buffer, unsigned int size) { int readsize = read(filedata->filedes, buffer, size); - + if (readsize < 0) { readsize = EOF; } else { filedata->seek += readsize; } - + return readsize; } static int fd_read_gzip_from_file(FileData *filedata, void *buffer, unsigned int size) { int readsize = gzread(filedata->gzfiledes, buffer, size); - + if (readsize < 0) { readsize = EOF; } else { filedata->seek += readsize; } - + return (readsize); } @@ -1056,10 +1056,10 @@ static int fd_read_from_memory(FileData *filedata, void *buffer, unsigned int si { /* don't read more bytes then there are available in the buffer */ int readsize = (int)MIN2(size, (unsigned int)(filedata->buffersize - filedata->seek)); - + memcpy(buffer, filedata->buffer + filedata->seek, readsize); filedata->seek += readsize; - + return (readsize); } @@ -1069,13 +1069,13 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s static unsigned int offset = 0; /* size of previous chunks */ static MemFileChunk *chunk = NULL; unsigned int chunkoffset, readsize, totread; - + if (size == 0) return 0; - + if (seek != (unsigned int)filedata->seek) { chunk = filedata->memfile->chunks.first; seek = 0; - + while (chunk) { if (seek + chunk->size > (unsigned) filedata->seek) break; seek += chunk->size; @@ -1084,48 +1084,48 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s offset = seek; seek = filedata->seek; } - + if (chunk) { totread = 0; - + do { /* first check if it's on the end if current chunk */ if (seek-offset == chunk->size) { offset += chunk->size; chunk = chunk->next; } - + /* debug, should never happen */ if (chunk == NULL) { printf("illegal read, chunk zero\n"); return 0; } - + chunkoffset = seek-offset; readsize = size-totread; - + /* data can be spread over multiple chunks, so clamp size * to within this chunk, and then it will read further in * the next chunk */ if (chunkoffset+readsize > chunk->size) readsize= chunk->size-chunkoffset; - + memcpy(POINTER_OFFSET(buffer, totread), chunk->buf + chunkoffset, readsize); totread += readsize; filedata->seek += readsize; seek += readsize; } while (totread < size); - + return totread; } - + return 0; } static FileData *filedata_new(void) { FileData *fd = MEM_callocN(sizeof(FileData), "FileData"); - + fd->filedes = -1; fd->gzfiledes = NULL; @@ -1134,14 +1134,14 @@ static FileData *filedata_new(void) fd->datamap = oldnewmap_new(); fd->globmap = oldnewmap_new(); fd->libmap = oldnewmap_new(); - + return fd; } static FileData *blo_decode_and_check(FileData *fd, ReportList *reports) { decode_blender_header(fd); - + if (fd->flags & FD_FLAGS_FILE_OK) { const char *error_message = NULL; if (read_file_dna(fd, &error_message) == false) { @@ -1157,7 +1157,7 @@ static FileData *blo_decode_and_check(FileData *fd, ReportList *reports) blo_freefiledata(fd); fd = NULL; } - + return fd; } @@ -1168,7 +1168,7 @@ FileData *blo_openblenderfile(const char *filepath, ReportList *reports) gzFile gzfile; errno = 0; gzfile = BLI_gzopen(filepath, "rb"); - + if (gzfile == (gzFile)Z_NULL) { BKE_reportf(reports, RPT_WARNING, "Unable to open '%s': %s", filepath, errno ? strerror(errno) : TIP_("unknown error reading file")); @@ -1178,10 +1178,10 @@ FileData *blo_openblenderfile(const char *filepath, ReportList *reports) FileData *fd = filedata_new(); fd->gzfiledes = gzfile; fd->read = fd_read_gzip_from_file; - + /* needed for library_append and read_libraries */ BLI_strncpy(fd->relabase, filepath, sizeof(fd->relabase)); - + return blo_decode_and_check(fd, reports); } } @@ -1244,12 +1244,12 @@ static int fd_read_gzip_from_memory_init(FileData *fd) fd->strm.total_out = 0; fd->strm.zalloc = Z_NULL; fd->strm.zfree = Z_NULL; - + if (inflateInit2(&fd->strm, (16+MAX_WBITS)) != Z_OK) return 0; fd->read = fd_read_gzip_from_memory; - + return 1; } @@ -1262,10 +1262,10 @@ FileData *blo_openblendermemory(const void *mem, int memsize, ReportList *report else { FileData *fd = filedata_new(); const char *cp = mem; - + fd->buffer = mem; fd->buffersize = memsize; - + /* test if gzip */ if (cp[0] == 0x1f && cp[1] == 0x8b) { if (0 == fd_read_gzip_from_memory_init(fd)) { @@ -1275,7 +1275,7 @@ FileData *blo_openblendermemory(const void *mem, int memsize, ReportList *report } else fd->read = fd_read_from_memory; - + fd->flags |= FD_FLAGS_NOT_MY_BUFFER; return blo_decode_and_check(fd, reports); @@ -1291,10 +1291,10 @@ FileData *blo_openblendermemfile(MemFile *memfile, ReportList *reports) else { FileData *fd = filedata_new(); fd->memfile = memfile; - + fd->read = fd_read_from_memfile; fd->flags |= FD_FLAGS_NOT_MY_BUFFER; - + return blo_decode_and_check(fd, reports); } } @@ -1306,22 +1306,22 @@ void blo_freefiledata(FileData *fd) if (fd->filedes != -1) { close(fd->filedes); } - + if (fd->gzfiledes != NULL) { gzclose(fd->gzfiledes); } - + if (fd->strm.next_in) { if (inflateEnd(&fd->strm) != Z_OK) { printf("close gzip stream error\n"); } } - + if (fd->buffer && !(fd->flags & FD_FLAGS_NOT_MY_BUFFER)) { MEM_freeN((void *)fd->buffer); fd->buffer = NULL; } - + // Free all BHeadN data blocks BLI_freelistN(&fd->listbase); @@ -1329,7 +1329,7 @@ void blo_freefiledata(FileData *fd) DNA_sdna_free(fd->filesdna); if (fd->compflags) MEM_freeN((void *)fd->compflags); - + if (fd->datamap) oldnewmap_free(fd->datamap); if (fd->globmap) @@ -1346,7 +1346,7 @@ void blo_freefiledata(FileData *fd) oldnewmap_free(fd->libmap); if (fd->bheadmap) MEM_freeN(fd->bheadmap); - + #ifdef USE_GHASH_BHEAD if (fd->bhead_idname_hash) { BLI_ghash_free(fd->bhead_idname_hash, NULL, NULL); @@ -1543,7 +1543,7 @@ static void *newpackedadr(FileData *fd, const void *adr) /* used to restore { if (fd->packedmap && adr) return oldnewmap_lookup_and_inc(fd->packedmap, adr, true); - + return oldnewmap_lookup_and_inc(fd->datamap, adr, true); } @@ -1561,9 +1561,9 @@ void *blo_do_versions_newlibadr(FileData *fd, const void *lib, const void *adr) static void *newlibadr_us(FileData *fd, const void *lib, const void *adr) /* increases user number */ { ID *id = newlibadr(fd, lib, adr); - + id_us_plus_no_lib(id); - + return id; } @@ -1584,13 +1584,13 @@ static void *newlibadr_real_us(FileData *fd, const void *lib, const void *adr) / static void change_idid_adr_fd(FileData *fd, const void *old, void *new) { int i; - + /* use a binary search if we have a sorted libmap, for now it's not needed. */ BLI_assert(fd->libmap->sorted == false); for (i = 0; i < fd->libmap->nentries; i++) { OldNew *entry = &fd->libmap->entries[i]; - + if (old==entry->newp && entry->nr==ID_ID) { entry->newp = new; if (new) entry->nr = GS( ((ID *)new)->name ); @@ -1601,15 +1601,15 @@ static void change_idid_adr_fd(FileData *fd, const void *old, void *new) static void change_idid_adr(ListBase *mainlist, FileData *basefd, void *old, void *new) { Main *mainptr; - + for (mainptr = mainlist->first; mainptr; mainptr = mainptr->next) { FileData *fd; - + if (mainptr->curlib) fd = mainptr->curlib->filedata; else fd = basefd; - + if (fd) { change_idid_adr_fd(fd, old, new); } @@ -1623,7 +1623,7 @@ static void change_idid_adr(ListBase *mainlist, FileData *basefd, void *old, voi void blo_clear_proxy_pointers_from_lib(Main *oldmain) { Object *ob = oldmain->object.first; - + for (; ob; ob= ob->id.next) { if (ob->id.lib) ob->proxy_from = NULL; @@ -1635,9 +1635,9 @@ void blo_make_image_pointer_map(FileData *fd, Main *oldmain) Image *ima = oldmain->image.first; Scene *sce = oldmain->scene.first; int a; - + fd->imamap = oldnewmap_new(); - + for (; ima; ima = ima->id.next) { if (ima->cache) oldnewmap_insert(fd->imamap, ima->cache, ima->cache, 0); @@ -1669,13 +1669,13 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain) Image *ima = oldmain->image.first; Scene *sce = oldmain->scene.first; int i; - + /* used entries were restored, so we put them to zero */ for (i = 0; i < fd->imamap->nentries; i++, entry++) { if (entry->nr > 0) entry->newp = NULL; } - + for (; ima; ima = ima->id.next) { ima->cache = newimaadr(fd, ima->cache); if (ima->cache == NULL) { @@ -1687,7 +1687,7 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain) } LISTBASE_FOREACH(RenderSlot *, slot, &ima->renderslots) slot->render = newimaadr(fd, slot->render); - + for (i = 0; i < TEXTARGET_COUNT; i++) ima->gputexture[i] = newimaadr(fd, ima->gputexture[i]); ima->rr = newimaadr(fd, ima->rr); @@ -1696,7 +1696,7 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain) if (sce->nodetree && sce->nodetree->previews) { bNodeInstanceHash *new_previews = BKE_node_instance_hash_new("node previews"); bNodeInstanceHashIterator iter; - + /* reconstruct the preview hash, only using remaining pointers */ NODE_INSTANCE_HASH_ITER(iter, sce->nodetree->previews) { bNodePreview *preview = BKE_node_instance_hash_iterator_get_value(&iter); @@ -1718,17 +1718,17 @@ void blo_make_movieclip_pointer_map(FileData *fd, Main *oldmain) { MovieClip *clip = oldmain->movieclip.first; Scene *sce = oldmain->scene.first; - + fd->movieclipmap = oldnewmap_new(); - + for (; clip; clip = clip->id.next) { if (clip->cache) oldnewmap_insert(fd->movieclipmap, clip->cache, clip->cache, 0); - + if (clip->tracking.camera.intrinsics) oldnewmap_insert(fd->movieclipmap, clip->tracking.camera.intrinsics, clip->tracking.camera.intrinsics, 0); } - + for (; sce; sce = sce->id.next) { if (sce->nodetree) { bNode *node; @@ -1747,18 +1747,18 @@ void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain) MovieClip *clip = oldmain->movieclip.first; Scene *sce = oldmain->scene.first; int i; - + /* used entries were restored, so we put them to zero */ for (i=0; i < fd->movieclipmap->nentries; i++, entry++) { if (entry->nr > 0) entry->newp = NULL; } - + for (; clip; clip = clip->id.next) { clip->cache = newmclipadr(fd, clip->cache); clip->tracking.camera.intrinsics = newmclipadr(fd, clip->tracking.camera.intrinsics); } - + for (; sce; sce = sce->id.next) { if (sce->nodetree) { bNode *node; @@ -1772,12 +1772,12 @@ void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain) void blo_make_sound_pointer_map(FileData *fd, Main *oldmain) { bSound *sound = oldmain->sound.first; - + fd->soundmap = oldnewmap_new(); - + for (; sound; sound = sound->id.next) { if (sound->waveform) - oldnewmap_insert(fd->soundmap, sound->waveform, sound->waveform, 0); + oldnewmap_insert(fd->soundmap, sound->waveform, sound->waveform, 0); } } @@ -1788,13 +1788,13 @@ void blo_end_sound_pointer_map(FileData *fd, Main *oldmain) OldNew *entry = fd->soundmap->entries; bSound *sound = oldmain->sound.first; int i; - + /* used entries were restored, so we put them to zero */ for (i = 0; i < fd->soundmap->nentries; i++, entry++) { if (entry->nr > 0) entry->newp = NULL; } - + for (; sound; sound = sound->id.next) { sound->waveform = newsoundadr(fd, sound->waveform); } @@ -1814,9 +1814,9 @@ void blo_make_packed_pointer_map(FileData *fd, Main *oldmain) VFont *vfont; bSound *sound; Library *lib; - + fd->packedmap = oldnewmap_new(); - + for (ima = oldmain->image.first; ima; ima = ima->id.next) { ImagePackedFile *imapf; @@ -1827,15 +1827,15 @@ void blo_make_packed_pointer_map(FileData *fd, Main *oldmain) if (imapf->packedfile) insert_packedmap(fd, imapf->packedfile); } - + for (vfont = oldmain->vfont.first; vfont; vfont = vfont->id.next) if (vfont->packedfile) insert_packedmap(fd, vfont->packedfile); - + for (sound = oldmain->sound.first; sound; sound = sound->id.next) if (sound->packedfile) insert_packedmap(fd, sound->packedfile); - + for (lib = oldmain->library.first; lib; lib = lib->id.next) if (lib->packedfile) insert_packedmap(fd, lib->packedfile); @@ -1852,13 +1852,13 @@ void blo_end_packed_pointer_map(FileData *fd, Main *oldmain) Library *lib; OldNew *entry = fd->packedmap->entries; int i; - + /* used entries were restored, so we put them to zero */ for (i=0; i < fd->packedmap->nentries; i++, entry++) { if (entry->nr > 0) entry->newp = NULL; } - + for (ima = oldmain->image.first; ima; ima = ima->id.next) { ImagePackedFile *imapf; @@ -1867,13 +1867,13 @@ void blo_end_packed_pointer_map(FileData *fd, Main *oldmain) for (imapf = ima->packedfiles.first; imapf; imapf = imapf->next) imapf->packedfile = newpackedadr(fd, imapf->packedfile); } - + for (vfont = oldmain->vfont.first; vfont; vfont = vfont->id.next) vfont->packedfile = newpackedadr(fd, vfont->packedfile); for (sound = oldmain->sound.first; sound; sound = sound->id.next) sound->packedfile = newpackedadr(fd, sound->packedfile); - + for (lib = oldmain->library.first; lib; lib = lib->id.next) lib->packedfile = newpackedadr(fd, lib->packedfile); } @@ -1884,7 +1884,7 @@ void blo_add_library_pointer_map(ListBase *old_mainlist, FileData *fd) { Main *ptr = old_mainlist->first; ListBase *lbarray[MAX_LIBARRAY]; - + for (ptr = ptr->next; ptr; ptr = ptr->next) { int i = set_listbasepointers(ptr, lbarray); while (i--) { @@ -1905,14 +1905,14 @@ static void switch_endian_structs(const struct SDNA *filesdna, BHead *bhead) { int blocksize, nblocks; char *data; - + data = (char *)(bhead+1); blocksize = filesdna->typelens[ filesdna->structs[bhead->SDNAnr][0] ]; - + nblocks = bhead->nr; while (nblocks--) { DNA_struct_switch_endian(filesdna, bhead->SDNAnr, data); - + data += blocksize; } } @@ -1920,12 +1920,12 @@ static void switch_endian_structs(const struct SDNA *filesdna, BHead *bhead) static void *read_struct(FileData *fd, BHead *bh, const char *blockname) { void *temp = NULL; - + if (bh->len) { /* switch is based on file dna */ if (bh->SDNAnr && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) switch_endian_structs(fd->filesdna, bh); - + if (fd->compflags[bh->SDNAnr] != SDNA_CMP_REMOVED) { if (fd->compflags[bh->SDNAnr] == SDNA_CMP_NOT_EQUAL) { temp = DNA_struct_reconstruct(fd->memsdna, fd->filesdna, fd->compflags, bh->SDNAnr, bh->nr, (bh+1)); @@ -1946,9 +1946,9 @@ typedef void (*link_list_cb)(FileData *fd, void *data); static void link_list_ex(FileData *fd, ListBase *lb, link_list_cb callback) /* only direct data */ { Link *ln, *prev; - + if (BLI_listbase_is_empty(lb)) return; - + lb->first = newdataadr(fd, lb->first); if (callback != NULL) { callback(fd, lb->first); @@ -1983,7 +1983,7 @@ static void link_glob_list(FileData *fd, ListBase *lb) /* for glob data */ oldnewmap_insert(fd->globmap, lb->first, poin, 0); } lb->first = poin; - + ln = lb->first; prev = NULL; while (ln) { @@ -2011,11 +2011,11 @@ static void test_pointer_array(FileData *fd, void **mat) */ if (*mat) { len = MEM_allocN_len(*mat)/fd->filesdna->pointerlen; - + if (fd->filesdna->pointerlen==8 && fd->memsdna->pointerlen==4) { ipoin=imat= MEM_malloc_arrayN(len, 4, "newmatar"); lpoin= *mat; - + while (len-- > 0) { if ((fd->flags & FD_FLAGS_SWITCH_ENDIAN)) BLI_endian_switch_int64(lpoin); @@ -2026,11 +2026,11 @@ static void test_pointer_array(FileData *fd, void **mat) MEM_freeN(*mat); *mat = imat; } - + if (fd->filesdna->pointerlen==4 && fd->memsdna->pointerlen==8) { lpoin = lmat = MEM_malloc_arrayN(len, 8, "newmatar"); ipoin = *mat; - + while (len-- > 0) { *lpoin = *ipoin; ipoin++; @@ -2051,21 +2051,21 @@ static void IDP_DirectLinkIDPArray(IDProperty *prop, int switch_endian, FileData { IDProperty *array; int i; - + /* since we didn't save the extra buffer, set totallen to len */ prop->totallen = prop->len; prop->data.pointer = newdataadr(fd, prop->data.pointer); array = (IDProperty *)prop->data.pointer; - + /* note!, idp-arrays didn't exist in 2.4x, so the pointer will be cleared * theres not really anything we can do to correct this, at least don't crash */ if (array == NULL) { prop->len = 0; prop->totallen = 0; } - - + + for (i = 0; i < prop->len; i++) IDP_DirectLinkProperty(&array[i], switch_endian, fd); } @@ -2074,15 +2074,15 @@ static void IDP_DirectLinkArray(IDProperty *prop, int switch_endian, FileData *f { IDProperty **array; int i; - + /* since we didn't save the extra buffer, set totallen to len */ prop->totallen = prop->len; prop->data.pointer = newdataadr(fd, prop->data.pointer); - + if (prop->subtype == IDP_GROUP) { test_pointer_array(fd, prop->data.pointer); array = prop->data.pointer; - + for (i = 0; i < prop->len; i++) IDP_DirectLinkProperty(array[i], switch_endian, fd); } @@ -2110,9 +2110,9 @@ static void IDP_DirectLinkGroup(IDProperty *prop, int switch_endian, FileData *f { ListBase *lb = &prop->data.group; IDProperty *loop; - + link_list(fd, lb); - + /*Link child id properties now*/ for (loop=prop->data.group.first; loop; loop=loop->next) { IDP_DirectLinkProperty(loop, switch_endian, fd); @@ -2144,7 +2144,7 @@ static void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData * if switch_endian is true, so we have to first unswap * them then reswap them as a single 64-bit entity. */ - + if (switch_endian) { BLI_endian_switch_int32(&prop->data.val); BLI_endian_switch_int32(&prop->data.val2); @@ -2227,7 +2227,7 @@ static void IDP_LibLinkProperty(IDProperty *prop, FileData *fd) static PreviewImage *direct_link_preview_image(FileData *fd, PreviewImage *old_prv) { PreviewImage *prv = newdataadr(fd, old_prv); - + if (prv) { int i; for (i = 0; i < NUM_ICON_SIZES; ++i) { @@ -2239,7 +2239,7 @@ static PreviewImage *direct_link_preview_image(FileData *fd, PreviewImage *old_p prv->icon_id = 0; prv->tag = 0; } - + return prv; } @@ -2308,10 +2308,10 @@ static void direct_link_id(FileData *fd, ID *id) static void direct_link_curvemapping(FileData *fd, CurveMapping *cumap) { int a; - + /* flag seems to be able to hang? Maybe old files... not bad to clear anyway */ cumap->flag &= ~CUMA_PREMULLED; - + for (a = 0; a < CM_TOT; a++) { cumap->cm[a].curve = newdataadr(fd, cumap->cm[a].curve); cumap->cm[a].table = NULL; @@ -2402,7 +2402,7 @@ static PackedFile *direct_link_packedfile(FileData *fd, PackedFile *oldpf) if (pf) { pf->data = newpackedadr(fd, pf->data); } - + return pf; } @@ -2414,7 +2414,7 @@ static PackedFile *direct_link_packedfile(FileData *fd, PackedFile *oldpf) static void lib_link_ipo(FileData *fd, Main *main) { Ipo *ipo; - + for (ipo = main->ipo.first; ipo; ipo = ipo->id.next) { if (ipo->id.tag & LIB_TAG_NEED_LINK) { IpoCurve *icu; @@ -2433,7 +2433,7 @@ static void direct_link_ipo(FileData *fd, Ipo *ipo) IpoCurve *icu; link_list(fd, &(ipo->curve)); - + for (icu = ipo->curve.first; icu; icu = icu->next) { icu->bezt = newdataadr(fd, icu->bezt); icu->bp = newdataadr(fd, icu->bp); @@ -2446,7 +2446,7 @@ static void lib_link_nlastrips(FileData *fd, ID *id, ListBase *striplist) { bActionStrip *strip; bActionModifier *amod; - + for (strip=striplist->first; strip; strip=strip->next) { strip->object = newlibadr(fd, id->lib, strip->object); strip->act = newlibadr_us(fd, id->lib, strip->act); @@ -2460,9 +2460,9 @@ static void lib_link_nlastrips(FileData *fd, ID *id, ListBase *striplist) static void direct_link_nlastrips(FileData *fd, ListBase *strips) { bActionStrip *strip; - + link_list(fd, strips); - + for (strip = strips->first; strip; strip = strip->next) link_list(fd, &strip->modifiers); } @@ -2482,7 +2482,7 @@ static void lib_link_constraint_channels(FileData *fd, ID *id, ListBase *chanbas static void lib_link_fmodifiers(FileData *fd, ID *id, ListBase *list) { FModifier *fcm; - + for (fcm = list->first; fcm; fcm = fcm->next) { /* data for specific modifiers */ switch (fcm->type) { @@ -2497,33 +2497,33 @@ static void lib_link_fmodifiers(FileData *fd, ID *id, ListBase *list) } } -static void lib_link_fcurves(FileData *fd, ID *id, ListBase *list) +static void lib_link_fcurves(FileData *fd, ID *id, ListBase *list) { FCurve *fcu; - + if (list == NULL) return; - + /* relink ID-block references... */ for (fcu = list->first; fcu; fcu = fcu->next) { /* driver data */ if (fcu->driver) { ChannelDriver *driver = fcu->driver; DriverVar *dvar; - + for (dvar= driver->variables.first; dvar; dvar= dvar->next) { DRIVER_TARGETS_LOOPER(dvar) { /* only relink if still used */ if (tarIndex < dvar->num_targets) - dtar->id = newlibadr(fd, id->lib, dtar->id); + dtar->id = newlibadr(fd, id->lib, dtar->id); else dtar->id = NULL; } DRIVER_TARGETS_LOOPER_END } } - + /* modifiers */ lib_link_fmodifiers(fd, id, &fcu->modifiers); } @@ -2534,20 +2534,20 @@ static void lib_link_fcurves(FileData *fd, ID *id, ListBase *list) static void direct_link_fmodifiers(FileData *fd, ListBase *list, FCurve *curve) { FModifier *fcm; - + for (fcm = list->first; fcm; fcm = fcm->next) { /* relink general data */ fcm->data = newdataadr(fd, fcm->data); fcm->curve = curve; - + /* do relinking of data for specific types */ switch (fcm->type) { case FMODIFIER_TYPE_GENERATOR: { FMod_Generator *data = (FMod_Generator *)fcm->data; - + data->coefficients = newdataadr(fd, data->coefficients); - + if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { BLI_endian_switch_float_array(data->coefficients, data->arraysize); } @@ -2557,7 +2557,7 @@ static void direct_link_fmodifiers(FileData *fd, ListBase *list, FCurve *curve) case FMODIFIER_TYPE_ENVELOPE: { FMod_Envelope *data= (FMod_Envelope *)fcm->data; - + data->data= newdataadr(fd, data->data); break; @@ -2565,7 +2565,7 @@ static void direct_link_fmodifiers(FileData *fd, ListBase *list, FCurve *curve) case FMODIFIER_TYPE_PYTHON: { FMod_Python *data = (FMod_Python *)fcm->data; - + data->prop = newdataadr(fd, data->prop); IDP_DirectLinkGroup_OrFree(&data->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); @@ -2579,38 +2579,38 @@ static void direct_link_fmodifiers(FileData *fd, ListBase *list, FCurve *curve) static void direct_link_fcurves(FileData *fd, ListBase *list) { FCurve *fcu; - + /* link F-Curve data to F-Curve again (non ID-libs) */ for (fcu = list->first; fcu; fcu = fcu->next) { /* curve data */ fcu->bezt = newdataadr(fd, fcu->bezt); fcu->fpt = newdataadr(fd, fcu->fpt); - + /* rna path */ fcu->rna_path = newdataadr(fd, fcu->rna_path); - + /* group */ fcu->grp = newdataadr_ex(fd, fcu->grp, false); - + /* clear disabled flag - allows disabled drivers to be tried again ([#32155]), * but also means that another method for "reviving disabled F-Curves" exists */ fcu->flag &= ~FCURVE_DISABLED; - + /* driver */ fcu->driver= newdataadr(fd, fcu->driver); if (fcu->driver) { ChannelDriver *driver= fcu->driver; DriverVar *dvar; - + /* compiled expression data will need to be regenerated (old pointer may still be set here) */ driver->expr_comp = NULL; - - /* give the driver a fresh chance - the operating environment may be different now + + /* give the driver a fresh chance - the operating environment may be different now * (addons, etc. may be different) so the driver namespace may be sane now [#32155] */ driver->flag &= ~DRIVER_FLAG_INVALID; - + /* relink variables, targets and their paths */ link_list(fd, &driver->variables); for (dvar= driver->variables.first; dvar; dvar= dvar->next) { @@ -2625,7 +2625,7 @@ static void direct_link_fcurves(FileData *fd, ListBase *list) DRIVER_TARGETS_LOOPER_END } } - + /* modifiers */ link_list(fd, &fcu->modifiers); direct_link_fmodifiers(fd, &fcu->modifiers, fcu); @@ -2638,14 +2638,14 @@ static void lib_link_action(FileData *fd, Main *main) for (bAction *act = main->action.first; act; act = act->id.next) { if (act->id.tag & LIB_TAG_NEED_LINK) { IDP_LibLinkProperty(act->id.properties, fd); - + // XXX deprecated - old animation system <<< for (bActionChannel *chan = act->chanbase.first; chan; chan = chan->next) { chan->ipo = newlibadr_us(fd, act->id.lib, chan->ipo); lib_link_constraint_channels(fd, &act->id, &chan->constraintChannels); } // >>> XXX deprecated - old animation system - + lib_link_fcurves(fd, &act->id, &act->curves); for (TimeMarker *marker = act->markers.first; marker; marker = marker->next) { @@ -2672,13 +2672,13 @@ static void direct_link_action(FileData *fd, bAction *act) // XXX deprecated - old animation system <<< for (achan = act->chanbase.first; achan; achan=achan->next) { achan->grp = newdataadr(fd, achan->grp); - + link_list(fd, &achan->constraintChannels); } // >>> XXX deprecated - old animation system direct_link_fcurves(fd, &act->curves); - + for (agrp = act->groups.first; agrp; agrp= agrp->next) { agrp->channels.first= newdataadr(fd, agrp->channels.first); agrp->channels.last= newdataadr(fd, agrp->channels.last); @@ -2688,17 +2688,17 @@ static void direct_link_action(FileData *fd, bAction *act) static void lib_link_nladata_strips(FileData *fd, ID *id, ListBase *list) { NlaStrip *strip; - + for (strip = list->first; strip; strip = strip->next) { /* check strip's children */ lib_link_nladata_strips(fd, id, &strip->strips); - + /* check strip's F-Curves */ lib_link_fcurves(fd, id, &strip->fcurves); - + /* reassign the counted-reference to action */ strip->act = newlibadr_us(fd, id->lib, strip->act); - + /* fix action id-root (i.e. if it comes from a pre 2.57 .blend file) */ if ((strip->act) && (strip->act->idroot == 0)) strip->act->idroot = GS(id->name); @@ -2708,29 +2708,29 @@ static void lib_link_nladata_strips(FileData *fd, ID *id, ListBase *list) static void lib_link_nladata(FileData *fd, ID *id, ListBase *list) { NlaTrack *nlt; - + /* we only care about the NLA strips inside the tracks */ for (nlt = list->first; nlt; nlt = nlt->next) { lib_link_nladata_strips(fd, id, &nlt->strips); } } -/* This handles Animato NLA-Strips linking +/* This handles Animato NLA-Strips linking * NOTE: this assumes that link_list has already been called on the list */ static void direct_link_nladata_strips(FileData *fd, ListBase *list) { NlaStrip *strip; - + for (strip = list->first; strip; strip = strip->next) { /* strip's child strips */ link_list(fd, &strip->strips); direct_link_nladata_strips(fd, &strip->strips); - + /* strip's F-Curves */ link_list(fd, &strip->fcurves); direct_link_fcurves(fd, &strip->fcurves); - + /* strip's F-Modifiers */ link_list(fd, &strip->modifiers); direct_link_fmodifiers(fd, &strip->modifiers, NULL); @@ -2741,11 +2741,11 @@ static void direct_link_nladata_strips(FileData *fd, ListBase *list) static void direct_link_nladata(FileData *fd, ListBase *list) { NlaTrack *nlt; - + for (nlt = list->first; nlt; nlt = nlt->next) { /* relink list of strips */ link_list(fd, &nlt->strips); - + /* relink strip data */ direct_link_nladata_strips(fd, &nlt->strips); } @@ -2757,11 +2757,11 @@ static void lib_link_keyingsets(FileData *fd, ID *id, ListBase *list) { KeyingSet *ks; KS_Path *ksp; - + /* here, we're only interested in the ID pointer stored in some of the paths */ for (ks = list->first; ks; ks = ks->next) { for (ksp = ks->paths.first; ksp; ksp = ksp->next) { - ksp->id= newlibadr(fd, id->lib, ksp->id); + ksp->id= newlibadr(fd, id->lib, ksp->id); } } } @@ -2771,12 +2771,12 @@ static void direct_link_keyingsets(FileData *fd, ListBase *list) { KeyingSet *ks; KS_Path *ksp; - + /* link KeyingSet data to KeyingSet again (non ID-libs) */ for (ks = list->first; ks; ks = ks->next) { /* paths */ link_list(fd, &ks->paths); - + for (ksp = ks->paths.first; ksp; ksp = ksp->next) { /* rna path */ ksp->rna_path= newdataadr(fd, ksp->rna_path); @@ -2790,22 +2790,22 @@ static void lib_link_animdata(FileData *fd, ID *id, AnimData *adt) { if (adt == NULL) return; - + /* link action data */ adt->action= newlibadr_us(fd, id->lib, adt->action); adt->tmpact= newlibadr_us(fd, id->lib, adt->tmpact); - + /* fix action id-roots (i.e. if they come from a pre 2.57 .blend file) */ if ((adt->action) && (adt->action->idroot == 0)) adt->action->idroot = GS(id->name); if ((adt->tmpact) && (adt->tmpact->idroot == 0)) adt->tmpact->idroot = GS(id->name); - + /* link drivers */ lib_link_fcurves(fd, id, &adt->drivers); - + /* overrides don't have lib-link for now, so no need to do anything */ - + /* link NLA-data */ lib_link_nladata(fd, id, &adt->nla_tracks); } @@ -2815,19 +2815,19 @@ static void direct_link_animdata(FileData *fd, AnimData *adt) /* NOTE: must have called newdataadr already before doing this... */ if (adt == NULL) return; - + /* link drivers */ link_list(fd, &adt->drivers); direct_link_fcurves(fd, &adt->drivers); adt->driver_array = NULL; - + /* link overrides */ // TODO... - + /* link NLA-data */ link_list(fd, &adt->nla_tracks); direct_link_nladata(fd, &adt->nla_tracks); - + /* relink active track/strip - even though strictly speaking this should only be used * if we're in 'tweaking mode', we need to be able to have this loaded back for * undo, but also since users may not exit tweakmode before saving (#24535) @@ -2836,7 +2836,7 @@ static void direct_link_animdata(FileData *fd, AnimData *adt) // state, but it's going to be too hard to enforce this single case... adt->act_track = newdataadr(fd, adt->act_track); adt->actstrip = newdataadr(fd, adt->actstrip); -} +} /* ************ READ CACHEFILES *************** */ @@ -2962,7 +2962,7 @@ static void direct_link_motionpath(FileData *fd, bMotionPath *mpath) /* sanity check */ if (mpath == NULL) return; - + /* relink points cache */ mpath->points = newdataadr(fd, mpath->points); @@ -2978,17 +2978,17 @@ static void lib_link_ntree(FileData *fd, ID *id, bNodeTree *ntree) { bNode *node; bNodeSocket *sock; - + IDP_LibLinkProperty(ntree->id.properties, fd); lib_link_animdata(fd, &ntree->id, ntree->adt); - + ntree->gpd = newlibadr_us(fd, id->lib, ntree->gpd); - + for (node = ntree->nodes.first; node; node = node->next) { /* Link ID Properties -- and copy this comment EXACTLY for easy finding * of library blocks that implement this.*/ IDP_LibLinkProperty(node->prop, fd); - + node->id = newlibadr_us(fd, id->lib, node->id); for (sock = node->inputs.first; sock; sock = sock->next) { @@ -2998,7 +2998,7 @@ static void lib_link_ntree(FileData *fd, ID *id, bNodeTree *ntree) IDP_LibLinkProperty(sock->prop, fd); } } - + for (sock = ntree->inputs.first; sock; sock = sock->next) { IDP_LibLinkProperty(sock->prop, fd); } @@ -3028,10 +3028,10 @@ static void lib_node_do_versions_group_indices(bNode *gnode) bNodeTree *ngroup = (bNodeTree*)gnode->id; bNodeSocket *sock; bNodeLink *link; - + for (sock=gnode->outputs.first; sock; sock = sock->next) { int old_index = sock->to_index; - + for (link = ngroup->links.first; link; link = link->next) { if (link->tonode == NULL && link->fromsock->own_index == old_index) { strcpy(sock->identifier, link->fromsock->identifier); @@ -3044,7 +3044,7 @@ static void lib_node_do_versions_group_indices(bNode *gnode) } for (sock=gnode->inputs.first; sock; sock = sock->next) { int old_index = sock->to_index; - + for (link = ngroup->links.first; link; link = link->next) { if (link->fromnode == NULL && link->tosock->own_index == old_index) { strcpy(sock->identifier, link->tosock->identifier); @@ -3068,19 +3068,19 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) reinit_nodesystem(); } #endif - + /* set node->typeinfo pointers */ FOREACH_NODETREE(main, ntree, id) { ntreeSetTypes(NULL, ntree); } FOREACH_NODETREE_END - + /* verify static socket templates */ FOREACH_NODETREE(main, ntree, id) { bNode *node; for (node=ntree->nodes.first; node; node=node->next) node_verify_socket_templates(ntree, node); } FOREACH_NODETREE_END - + { bool has_old_groups = false; /* XXX this should actually be part of do_versions, but since we need @@ -3093,7 +3093,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) has_old_groups = 1; } } - + if (has_old_groups) { FOREACH_NODETREE(main, ntree, id) { /* updates external links for all group nodes in a tree */ @@ -3107,12 +3107,12 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) } } FOREACH_NODETREE_END } - + for (bNodeTree *ntree = main->nodetree.first; ntree; ntree = ntree->id.next) { ntree->flag &= ~NTREE_DO_VERSIONS_GROUP_EXPOSE_2_56_2; } } - + { /* Convert the previously used ntree->inputs/ntree->outputs lists to interface nodes. * Pre 2.56.2 node trees automatically have all unlinked sockets exposed already @@ -3125,7 +3125,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) * but due to a temporary bug such links could have been added in all trees, * so have to clean up all of them ... */ - + FOREACH_NODETREE(main, ntree, id) { if (ntree->flag & NTREE_DO_VERSIONS_CUSTOMNODES_GROUP) { bNode *input_node = NULL, *output_node = NULL; @@ -3136,21 +3136,21 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) * in that case just remove the invalid links. */ const bool create_io_nodes = (ntree->flag & NTREE_DO_VERSIONS_CUSTOMNODES_GROUP_CREATE_INTERFACE) != 0; - + float input_locx = 1000000.0f, input_locy = 0.0f; float output_locx = -1000000.0f, output_locy = 0.0f; /* rough guess, not nice but we don't have access to UI constants here ... */ static const float offsetx = 42 + 3*20 + 20; /*static const float offsety = 0.0f;*/ - + if (create_io_nodes) { if (ntree->inputs.first) input_node = nodeAddStaticNode(NULL, ntree, NODE_GROUP_INPUT); - + if (ntree->outputs.first) output_node = nodeAddStaticNode(NULL, ntree, NODE_GROUP_OUTPUT); } - + /* Redirect links from/to the node tree interface to input/output node. * If the fromnode/tonode pointers are NULL, this means a link from/to * the ntree interface sockets, which need to be redirected to new interface nodes. @@ -3158,13 +3158,13 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) for (link = ntree->links.first; link; link = next_link) { bool free_link = false; next_link = link->next; - + if (link->fromnode == NULL) { if (input_node) { link->fromnode = input_node; link->fromsock = node_group_input_find_socket(input_node, link->fromsock->identifier); ++num_inputs; - + if (link->tonode) { if (input_locx > link->tonode->locx - offsetx) input_locx = link->tonode->locx - offsetx; @@ -3175,13 +3175,13 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) free_link = true; } } - + if (link->tonode == NULL) { if (output_node) { link->tonode = output_node; link->tosock = node_group_output_find_socket(output_node, link->tosock->identifier); ++num_outputs; - + if (link->fromnode) { if (output_locx < link->fromnode->locx + offsetx) output_locx = link->fromnode->locx + offsetx; @@ -3192,11 +3192,11 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) free_link = true; } } - + if (free_link) nodeRemLink(ntree, link); } - + if (num_inputs > 0) { input_locy /= num_inputs; input_node->locx = input_locx; @@ -3207,19 +3207,19 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open)) output_node->locx = output_locx; output_node->locy = output_locy; } - + /* clear do_versions flags */ ntree->flag &= ~(NTREE_DO_VERSIONS_CUSTOMNODES_GROUP | NTREE_DO_VERSIONS_CUSTOMNODES_GROUP_CREATE_INTERFACE); } } FOREACH_NODETREE_END } - + /* verify all group user nodes */ for (bNodeTree *ntree = main->nodetree.first; ntree; ntree = ntree->id.next) { ntreeVerifyNodes(main, &ntree->id); } - + /* make update calls where necessary */ { FOREACH_NODETREE(main, ntree, id) { @@ -3233,7 +3233,7 @@ static void direct_link_node_socket(FileData *fd, bNodeSocket *sock) { sock->prop = newdataadr(fd, sock->prop); IDP_DirectLinkGroup_OrFree(&sock->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); - + sock->link = newdataadr(fd, sock->link); sock->typeinfo = NULL; sock->storage = newdataadr(fd, sock->storage); @@ -3248,31 +3248,31 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) bNode *node; bNodeSocket *sock; bNodeLink *link; - + ntree->init = 0; /* to set callbacks and force setting types */ ntree->is_updating = false; ntree->typeinfo= NULL; ntree->interface_type = NULL; - + ntree->progress = NULL; ntree->execdata = NULL; ntree->duplilock = NULL; ntree->adt = newdataadr(fd, ntree->adt); direct_link_animdata(fd, ntree->adt); - + ntree->id.recalc &= ~ID_RECALC_ALL; link_list(fd, &ntree->nodes); for (node = ntree->nodes.first; node; node = node->next) { node->typeinfo = NULL; - + link_list(fd, &node->inputs); link_list(fd, &node->outputs); - + node->prop = newdataadr(fd, node->prop); IDP_DirectLinkGroup_OrFree(&node->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); - + link_list(fd, &node->internal_links); for (link = node->internal_links.first; link; link = link->next) { link->fromnode = newdataadr(fd, link->fromnode); @@ -3280,14 +3280,14 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) link->tonode = newdataadr(fd, link->tonode); link->tosock = newdataadr(fd, link->tosock); } - + if (node->type == CMP_NODE_MOVIEDISTORTION) { node->storage = newmclipadr(fd, node->storage); } else { node->storage = newdataadr(fd, node->storage); } - + if (node->storage) { /* could be handlerized at some point */ if (ntree->type==NTREE_SHADER) { @@ -3318,18 +3318,18 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) } } link_list(fd, &ntree->links); - + /* and we connect the rest */ for (node = ntree->nodes.first; node; node = node->next) { node->parent = newdataadr(fd, node->parent); node->lasty = 0; - + for (sock = node->inputs.first; sock; sock = sock->next) direct_link_node_socket(fd, sock); for (sock = node->outputs.first; sock; sock = sock->next) direct_link_node_socket(fd, sock); } - + /* interface socket lists */ link_list(fd, &ntree->inputs); link_list(fd, &ntree->outputs); @@ -3337,19 +3337,19 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) direct_link_node_socket(fd, sock); for (sock = ntree->outputs.first; sock; sock = sock->next) direct_link_node_socket(fd, sock); - + for (link = ntree->links.first; link; link= link->next) { link->fromnode = newdataadr(fd, link->fromnode); link->tonode = newdataadr(fd, link->tonode); link->fromsock = newdataadr(fd, link->fromsock); link->tosock = newdataadr(fd, link->tosock); } - + #if 0 if (ntree->previews) { bNodeInstanceHash *new_previews = BKE_node_instance_hash_new("node previews"); bNodeInstanceHashIterator iter; - + NODE_INSTANCE_HASH_ITER(iter, ntree->previews) { bNodePreview *preview = BKE_node_instance_hash_iterator_get_value(&iter); if (preview) { @@ -3367,7 +3367,7 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree) /* XXX TODO */ ntree->previews = NULL; #endif - + /* type verification is in lib-link */ } @@ -3382,7 +3382,7 @@ typedef struct tConstraintLinkData { static void lib_link_constraint_cb(bConstraint *UNUSED(con), ID **idpoin, bool is_reference, void *userdata) { tConstraintLinkData *cld= (tConstraintLinkData *)userdata; - + /* for reference types, we need to increment the usercounts on load... */ if (is_reference) { /* reference type - with usercount */ @@ -3398,7 +3398,7 @@ static void lib_link_constraints(FileData *fd, ID *id, ListBase *conlist) { tConstraintLinkData cld; bConstraint *con; - + /* legacy fixes */ for (con = conlist->first; con; con=con->next) { /* patch for error introduced by changing constraints (dunno how) */ @@ -3414,29 +3414,29 @@ static void lib_link_constraints(FileData *fd, ID *id, ListBase *conlist) con->flag &= ~CONSTRAINT_STATICOVERRIDE_LOCAL; } } - + /* relink all ID-blocks used by the constraints */ cld.fd = fd; cld.id = id; - + BKE_constraints_id_loop(conlist, lib_link_constraint_cb, &cld); } static void direct_link_constraints(FileData *fd, ListBase *lb) { bConstraint *con; - + link_list(fd, lb); for (con=lb->first; con; con=con->next) { con->data = newdataadr(fd, con->data); - + switch (con->type) { case CONSTRAINT_TYPE_PYTHON: { bPythonConstraint *data= con->data; - + link_list(fd, &data->targets); - + data->prop = newdataadr(fd, data->prop); IDP_DirectLinkGroup_OrFree(&data->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); break; @@ -3478,10 +3478,10 @@ static void direct_link_constraints(FileData *fd, ListBase *lb) static void lib_link_pose(FileData *fd, Main *bmain, Object *ob, bPose *pose) { bArmature *arm = ob->data; - + if (!pose || !arm) return; - + /* always rebuild to match proxy or lib changes, but on Undo */ bool rebuild = false; @@ -3498,7 +3498,7 @@ static void lib_link_pose(FileData *fd, Main *bmain, Object *ob, bPose *pose) /* sync proxy layer */ if (pose->proxy_layer) arm->layer = pose->proxy_layer; - + /* sync proxy active bone */ if (pose->proxy_act_bone[0]) { Bone *bone = BLI_ghash_lookup(bone_hash, pose->proxy_act_bone); @@ -3512,7 +3512,7 @@ static void lib_link_pose(FileData *fd, Main *bmain, Object *ob, bPose *pose) lib_link_constraints(fd, (ID *)ob, &pchan->constraints); pchan->bone = BLI_ghash_lookup(bone_hash, pchan->name); - + IDP_LibLinkProperty(pchan->prop, fd); pchan->custom = newlibadr_us(fd, arm->id.lib, pchan->custom); @@ -3527,7 +3527,7 @@ static void lib_link_pose(FileData *fd, Main *bmain, Object *ob, bPose *pose) } BLI_ghash_free(bone_hash, NULL, NULL); - + if (rebuild) { DEG_id_tag_update_ex(bmain, &ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME); @@ -3563,15 +3563,15 @@ static void lib_link_armature(FileData *fd, Main *main) static void direct_link_bones(FileData *fd, Bone *bone) { Bone *child; - + bone->parent = newdataadr(fd, bone->parent); bone->prop = newdataadr(fd, bone->prop); IDP_DirectLinkGroup_OrFree(&bone->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); - + bone->flag &= ~BONE_DRAW_ACTIVE; - + link_list(fd, &bone->childbase); - + for (child=bone->childbase.first; child; child=child->next) direct_link_bones(fd, child); } @@ -3579,17 +3579,17 @@ static void direct_link_bones(FileData *fd, Bone *bone) static void direct_link_armature(FileData *fd, bArmature *arm) { Bone *bone; - + link_list(fd, &arm->bonebase); arm->edbo = NULL; - + arm->adt = newdataadr(fd, arm->adt); direct_link_animdata(fd, arm->adt); - + for (bone = arm->bonebase.first; bone; bone = bone->next) { direct_link_bones(fd, bone); } - + arm->act_bone = newdataadr(fd, arm->act_bone); arm->act_edbone = NULL; } @@ -3602,11 +3602,11 @@ static void lib_link_camera(FileData *fd, Main *main) if (ca->id.tag & LIB_TAG_NEED_LINK) { IDP_LibLinkProperty(ca->id.properties, fd); lib_link_animdata(fd, &ca->id, ca->adt); - + ca->ipo = newlibadr_us(fd, ca->id.lib, ca->ipo); // XXX deprecated - old animation system ca->dof_ob = newlibadr(fd, ca->id.lib, ca->dof_ob); - + for (CameraBGImage *bgpic = ca->bg_images.first; bgpic; bgpic = bgpic->next) { bgpic->ima = newlibadr_us(fd, ca->id.lib, bgpic->ima); bgpic->clip = newlibadr_us(fd, ca->id.lib, bgpic->clip); @@ -3638,14 +3638,14 @@ static void lib_link_lamp(FileData *fd, Main *main) if (la->id.tag & LIB_TAG_NEED_LINK) { IDP_LibLinkProperty(la->id.properties, fd); lib_link_animdata(fd, &la->id, la->adt); - + la->ipo = newlibadr_us(fd, la->id.lib, la->ipo); // XXX deprecated - old animation system - + if (la->nodetree) { lib_link_ntree(fd, &la->id, la->nodetree); la->nodetree->id.lib = la->id.lib; } - + la->id.tag &= ~LIB_TAG_NEED_LINK; } } @@ -3655,7 +3655,7 @@ static void direct_link_lamp(FileData *fd, Lamp *la) { la->adt = newdataadr(fd, la->adt); direct_link_animdata(fd, la->adt); - + la->curfalloff = newdataadr(fd, la->curfalloff); if (la->curfalloff) direct_link_curvemapping(fd, la->curfalloff); @@ -3665,7 +3665,7 @@ static void direct_link_lamp(FileData *fd, Lamp *la) direct_link_id(fd, &la->nodetree->id); direct_link_nodetree(fd, la->nodetree); } - + la->preview = direct_link_preview_image(fd, la->preview); } @@ -3689,10 +3689,10 @@ static void lib_link_key(FileData *fd, Main *main) if (key->id.tag & LIB_TAG_NEED_LINK) { IDP_LibLinkProperty(key->id.properties, fd); lib_link_animdata(fd, &key->id, key->adt); - + key->ipo = newlibadr_us(fd, key->id.lib, key->ipo); // XXX deprecated - old animation system key->from = newlibadr(fd, key->id.lib, key->from); - + key->id.tag &= ~LIB_TAG_NEED_LINK; } } @@ -3702,14 +3702,14 @@ static void switch_endian_keyblock(Key *key, KeyBlock *kb) { int elemsize, a, b; char *data; - + elemsize = key->elemsize; data = kb->data; - + for (a = 0; a < kb->totelem; a++) { const char *cp = key->elemstr; char *poin = data; - + while (cp[0]) { /* cp[0] == amount */ switch (cp[1]) { /* cp[1] = type */ case IPO_FLOAT: @@ -3720,7 +3720,7 @@ static void switch_endian_keyblock(Key *key, KeyBlock *kb) poin += sizeof(float) * b; break; } - + cp += 2; } data += elemsize; @@ -3730,17 +3730,17 @@ static void switch_endian_keyblock(Key *key, KeyBlock *kb) static void direct_link_key(FileData *fd, Key *key) { KeyBlock *kb; - + link_list(fd, &(key->block)); - + key->adt = newdataadr(fd, key->adt); direct_link_animdata(fd, key->adt); - + key->refkey= newdataadr(fd, key->refkey); - + for (kb = key->block.first; kb; kb = kb->next) { kb->data = newdataadr(fd, kb->data); - + if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) switch_endian_keyblock(key, kb); } @@ -3754,13 +3754,13 @@ static void lib_link_mball(FileData *fd, Main *main) if (mb->id.tag & LIB_TAG_NEED_LINK) { IDP_LibLinkProperty(mb->id.properties, fd); lib_link_animdata(fd, &mb->id, mb->adt); - + for (int a = 0; a < mb->totcol; a++) { mb->mat[a] = newlibadr_us(fd, mb->id.lib, mb->mat[a]); } - + mb->ipo = newlibadr_us(fd, mb->id.lib, mb->ipo); // XXX deprecated - old animation system - + mb->id.tag &= ~LIB_TAG_NEED_LINK; } } @@ -3770,12 +3770,12 @@ static void direct_link_mball(FileData *fd, MetaBall *mb) { mb->adt = newdataadr(fd, mb->adt); direct_link_animdata(fd, mb->adt); - + mb->mat = newdataadr(fd, mb->mat); test_pointer_array(fd, (void **)&mb->mat); - + link_list(fd, &(mb->elems)); - + BLI_listbase_clear(&mb->disp); mb->editelems = NULL; /* mb->edit_elems.first= mb->edit_elems.last= NULL;*/ @@ -3791,14 +3791,14 @@ static void lib_link_world(FileData *fd, Main *main) if (wrld->id.tag & LIB_TAG_NEED_LINK) { IDP_LibLinkProperty(wrld->id.properties, fd); lib_link_animdata(fd, &wrld->id, wrld->adt); - + wrld->ipo = newlibadr_us(fd, wrld->id.lib, wrld->ipo); // XXX deprecated - old animation system - + if (wrld->nodetree) { lib_link_ntree(fd, &wrld->id, wrld->nodetree); wrld->nodetree->id.lib = wrld->id.lib; } - + wrld->id.tag &= ~LIB_TAG_NEED_LINK; } } @@ -3808,13 +3808,13 @@ static void direct_link_world(FileData *fd, World *wrld) { wrld->adt = newdataadr(fd, wrld->adt); direct_link_animdata(fd, wrld->adt); - + wrld->nodetree = newdataadr(fd, wrld->nodetree); if (wrld->nodetree) { direct_link_id(fd, &wrld->nodetree->id); direct_link_nodetree(fd, wrld->nodetree); } - + wrld->preview = direct_link_preview_image(fd, wrld->preview); BLI_listbase_clear(&wrld->gpumaterial); } @@ -3867,24 +3867,24 @@ static void direct_link_text(FileData *fd, Text *text) } /* else { */ #endif - + link_list(fd, &text->lines); - + text->curl = newdataadr(fd, text->curl); text->sell = newdataadr(fd, text->sell); - + for (ln = text->lines.first; ln; ln = ln->next) { ln->line = newdataadr(fd, ln->line); ln->format = NULL; - + if (ln->len != (int) strlen(ln->line)) { printf("Error loading text, line lengths differ\n"); ln->len = strlen(ln->line); } } - + text->flags = (text->flags) & ~TXT_ISEXT; - + id_us_ensure_real(&text->id); } @@ -3895,7 +3895,7 @@ static void lib_link_image(FileData *fd, Main *main) for (Image *ima = main->image.first; ima; ima = ima->id.next) { if (ima->id.tag & LIB_TAG_NEED_LINK) { IDP_LibLinkProperty(ima->id.properties, fd); - + ima->id.tag &= ~LIB_TAG_NEED_LINK; } } @@ -3919,7 +3919,7 @@ static void direct_link_image(FileData *fd, Image *ima) } ima->rr = NULL; } - + /* undo system, try to restore render buffers */ link_list(fd, &(ima->renderslots)); if (fd->imamap) { @@ -3961,11 +3961,11 @@ static void lib_link_curve(FileData *fd, Main *main) if (cu->id.tag & LIB_TAG_NEED_LINK) { IDP_LibLinkProperty(cu->id.properties, fd); lib_link_animdata(fd, &cu->id, cu->adt); - + for (int a = 0; a < cu->totcol; a++) { cu->mat[a] = newlibadr_us(fd, cu->id.lib, cu->mat[a]); } - + cu->bevobj = newlibadr(fd, cu->id.lib, cu->bevobj); cu->taperobj = newlibadr(fd, cu->id.lib, cu->taperobj); cu->textoncurve = newlibadr(fd, cu->id.lib, cu->textoncurve); @@ -3973,10 +3973,10 @@ static void lib_link_curve(FileData *fd, Main *main) cu->vfontb = newlibadr_us(fd, cu->id.lib, cu->vfontb); cu->vfonti = newlibadr_us(fd, cu->id.lib, cu->vfonti); cu->vfontbi = newlibadr_us(fd, cu->id.lib, cu->vfontbi); - + cu->ipo = newlibadr_us(fd, cu->id.lib, cu->ipo); // XXX deprecated - old animation system cu->key = newlibadr_us(fd, cu->id.lib, cu->key); - + cu->id.tag &= ~LIB_TAG_NEED_LINK; } } @@ -3997,10 +3997,10 @@ static void direct_link_curve(FileData *fd, Curve *cu) { Nurb *nu; TextBox *tb; - + cu->adt= newdataadr(fd, cu->adt); direct_link_animdata(fd, cu->adt); - + /* Protect against integer overflow vulnerability. */ CLAMP(cu->len_wchar, 0, INT_MAX - 4); @@ -4015,7 +4015,7 @@ static void direct_link_curve(FileData *fd, Curve *cu) } else { cu->nurb.first=cu->nurb.last= NULL; - + tb = MEM_calloc_arrayN(MAXTEXTBOX, sizeof(TextBox), "TextBoxread"); if (cu->tb) { memcpy(tb, cu->tb, cu->totbox*sizeof(TextBox)); @@ -4034,14 +4034,14 @@ static void direct_link_curve(FileData *fd, Curve *cu) cu->editnurb = NULL; cu->editfont = NULL; cu->batch_cache = NULL; - + for (nu = cu->nurb.first; nu; nu = nu->next) { nu->bezt = newdataadr(fd, nu->bezt); nu->bp = newdataadr(fd, nu->bp); nu->knotsu = newdataadr(fd, nu->knotsu); nu->knotsv = newdataadr(fd, nu->knotsv); if (cu->vfont == NULL) nu->charidx = 0; - + if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { switch_endian_knots(nu); } @@ -4057,15 +4057,15 @@ static void lib_link_texture(FileData *fd, Main *main) if (tex->id.tag & LIB_TAG_NEED_LINK) { IDP_LibLinkProperty(tex->id.properties, fd); lib_link_animdata(fd, &tex->id, tex->adt); - + tex->ima = newlibadr_us(fd, tex->id.lib, tex->ima); tex->ipo = newlibadr_us(fd, tex->id.lib, tex->ipo); // XXX deprecated - old animation system - + if (tex->nodetree) { lib_link_ntree(fd, &tex->id, tex->nodetree); tex->nodetree->id.lib = tex->id.lib; } - + tex->id.tag &= ~LIB_TAG_NEED_LINK; } } @@ -4083,9 +4083,9 @@ static void direct_link_texture(FileData *fd, Tex *tex) direct_link_id(fd, &tex->nodetree->id); direct_link_nodetree(fd, tex->nodetree); } - + tex->preview = direct_link_preview_image(fd, tex->preview); - + tex->iuser.ok = 1; } @@ -4099,14 +4099,14 @@ static void lib_link_material(FileData *fd, Main *main) if (ma->id.tag & LIB_TAG_NEED_LINK) { IDP_LibLinkProperty(ma->id.properties, fd); lib_link_animdata(fd, &ma->id, ma->adt); - + ma->ipo = newlibadr_us(fd, ma->id.lib, ma->ipo); // XXX deprecated - old animation system - + if (ma->nodetree) { lib_link_ntree(fd, &ma->id, ma->nodetree); ma->nodetree->id.lib = ma->id.lib; } - + ma->id.tag &= ~LIB_TAG_NEED_LINK; } } @@ -4116,15 +4116,15 @@ static void direct_link_material(FileData *fd, Material *ma) { ma->adt = newdataadr(fd, ma->adt); direct_link_animdata(fd, ma->adt); - + ma->texpaintslot = NULL; - + ma->nodetree = newdataadr(fd, ma->nodetree); if (ma->nodetree) { direct_link_id(fd, &ma->nodetree->id); direct_link_nodetree(fd, ma->nodetree); } - + ma->preview = direct_link_preview_image(fd, ma->preview); BLI_listbase_clear(&ma->gpumaterial); } @@ -4172,7 +4172,7 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache) } else BLI_listbase_clear(&cache->mem_cache); - + cache->flag &= ~PTCACHE_SIMULATION_VALID; cache->simframe = 0; cache->edit = NULL; @@ -4192,7 +4192,7 @@ static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointC cache->step = 1; } } - + *ocache = newdataadr(fd, *ocache); } else if (*ocache) { @@ -4203,7 +4203,7 @@ static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointC (*ocache)->flag |= PTCACHE_DISK_CACHE; (*ocache)->step = 1; } - + ptcaches->first = ptcaches->last = *ocache; } } @@ -4224,16 +4224,16 @@ static void lib_link_particlesettings(FileData *fd, Main *main) lib_link_animdata(fd, &part->id, part->adt); part->ipo = newlibadr_us(fd, part->id.lib, part->ipo); // XXX deprecated - old animation system - + part->dup_ob = newlibadr(fd, part->id.lib, part->dup_ob); part->dup_group = newlibadr(fd, part->id.lib, part->dup_group); part->eff_group = newlibadr(fd, part->id.lib, part->eff_group); part->bb_ob = newlibadr(fd, part->id.lib, part->bb_ob); part->collision_group = newlibadr(fd, part->id.lib, part->collision_group); - + lib_link_partdeflect(fd, &part->id, part->pd); lib_link_partdeflect(fd, &part->id, part->pd2); - + if (part->effector_weights) { part->effector_weights->group = newlibadr(fd, part->id.lib, part->effector_weights->group); } @@ -4281,7 +4281,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main) else { BLI_listbase_clear(&part->dupliweights); } - + if (part->boids) { BoidState *state = part->boids->states.first; BoidRule *rule; @@ -4314,7 +4314,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main) mtex->object = newlibadr(fd, part->id.lib, mtex->object); } } - + part->id.tag &= ~LIB_TAG_NEED_LINK; } } @@ -4328,7 +4328,7 @@ static void direct_link_partdeflect(PartDeflect *pd) static void direct_link_particlesettings(FileData *fd, ParticleSettings *part) { int a; - + part->adt = newdataadr(fd, part->adt); part->pd = newdataadr(fd, part->pd); part->pd2 = newdataadr(fd, part->pd2); @@ -4359,7 +4359,7 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part) if (part->boids) { BoidState *state; link_list(fd, &part->boids->states); - + for (state=part->boids->states.first; state; state=state->next) { link_list(fd, &state->rules); link_list(fd, &state->conditions); @@ -4380,17 +4380,17 @@ static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase for (psys=particles->first; psys; psys=psysnext) { psysnext = psys->next; - + psys->part = newlibadr_us(fd, id->lib, psys->part); if (psys->part) { ParticleTarget *pt = psys->targets.first; - + for (; pt; pt=pt->next) pt->ob=newlibadr(fd, id->lib, pt->ob); - + psys->parent = newlibadr(fd, id->lib, psys->parent); psys->target_ob = newlibadr(fd, id->lib, psys->target_ob); - + if (psys->clmd) { /* XXX - from reading existing code this seems correct but intended usage of * pointcache /w cloth should be added in 'ParticleSystem' - campbell */ @@ -4405,7 +4405,7 @@ static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys); BLI_remlink(&ob->modifiers, psmd); modifier_free((ModifierData *)psmd); - + BLI_remlink(particles, psys); MEM_freeN(psys); } @@ -4416,21 +4416,21 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) ParticleSystem *psys; ParticleData *pa; int a; - + for (psys=particles->first; psys; psys=psys->next) { psys->particles=newdataadr(fd, psys->particles); - + if (psys->particles && psys->particles->hair) { for (a=0, pa=psys->particles; a<psys->totpart; a++, pa++) pa->hair=newdataadr(fd, pa->hair); } - + if (psys->particles && psys->particles->keys) { for (a=0, pa=psys->particles; a<psys->totpart; a++, pa++) { pa->keys= NULL; pa->totkey= 0; } - + psys->flag &= ~PSYS_KEYED; } @@ -4447,14 +4447,14 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) for (a=0, pa=psys->particles; a<psys->totpart; a++, pa++) pa->boid = NULL; } - + psys->fluid_springs = newdataadr(fd, psys->fluid_springs); - + psys->child = newdataadr(fd, psys->child); psys->effectors = NULL; - + link_list(fd, &psys->targets); - + psys->edit = NULL; psys->free_edit = NULL; psys->pathcache = NULL; @@ -4462,21 +4462,21 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) BLI_listbase_clear(&psys->pathcachebufs); BLI_listbase_clear(&psys->childcachebufs); psys->pdd = NULL; - + if (psys->clmd) { psys->clmd = newdataadr(fd, psys->clmd); psys->clmd->clothObject = NULL; psys->clmd->hairdata = NULL; - + psys->clmd->sim_parms= newdataadr(fd, psys->clmd->sim_parms); psys->clmd->coll_parms= newdataadr(fd, psys->clmd->coll_parms); - + if (psys->clmd->sim_parms) { psys->clmd->sim_parms->effector_weights = NULL; if (psys->clmd->sim_parms->presets > 10) psys->clmd->sim_parms->presets = 0; } - + psys->hair_in_mesh = psys->hair_out_mesh = NULL; psys->clmd->solver_result = NULL; } @@ -4500,16 +4500,16 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) static void lib_link_mesh(FileData *fd, Main *main) { Mesh *me; - + for (me = main->mesh.first; me; me = me->id.next) { if (me->id.tag & LIB_TAG_NEED_LINK) { int i; - + /* Link ID Properties -- and copy this comment EXACTLY for easy finding * of library blocks that implement this.*/ IDP_LibLinkProperty(me->id.properties, fd); lib_link_animdata(fd, &me->id, me->adt); - + /* this check added for python created meshes */ if (me->mat) { for (i = 0; i < me->totcol; i++) { @@ -4534,9 +4534,9 @@ static void lib_link_mesh(FileData *fd, Main *main) * external CustomData works */ Main *gmain = G_MAIN; G_MAIN = main; - + BKE_mesh_do_versions_convert_mfaces_to_mpolys(me); - + G_MAIN = gmain; } @@ -4564,11 +4564,11 @@ static void lib_link_mesh(FileData *fd, Main *main) static void direct_link_dverts(FileData *fd, int count, MDeformVert *mdverts) { int i; - + if (mdverts == NULL) { return; } - + for (i = count; i > 0; i--, mdverts++) { /*convert to vgroup allocation system*/ MDeformWeight *dw; @@ -4590,11 +4590,11 @@ static void direct_link_mdisps(FileData *fd, int count, MDisps *mdisps, int exte { if (mdisps) { int i; - + for (i = 0; i < count; ++i) { mdisps[i].disps = newdataadr(fd, mdisps[i].disps); mdisps[i].hidden = newdataadr(fd, mdisps[i].hidden); - + if (mdisps[i].totdisp && !mdisps[i].level) { /* this calculation is only correct for loop mdisps; * if loading pre-BMesh face mdisps this will be @@ -4603,7 +4603,7 @@ static void direct_link_mdisps(FileData *fd, int count, MDisps *mdisps, int exte float gridsize = sqrtf(mdisps[i].totdisp); mdisps[i].level = (int)(logf(gridsize - 1.0f) / (float)M_LN2) + 1; } - + if ((fd->flags & FD_FLAGS_SWITCH_ENDIAN) && (mdisps[i].disps)) { /* DNA_struct_switch_endian doesn't do endian swap for (*disps)[] */ /* this does swap for data written at write_mdisps() - readfile.c */ @@ -4619,7 +4619,7 @@ static void direct_link_grid_paint_mask(FileData *fd, int count, GridPaintMask * { if (grid_paint_mask) { int i; - + for (i = 0; i < count; ++i) { GridPaintMask *gpm = &grid_paint_mask[i]; if (gpm->data) @@ -4632,26 +4632,26 @@ static void direct_link_grid_paint_mask(FileData *fd, int count, GridPaintMask * static void direct_link_customdata(FileData *fd, CustomData *data, int count) { int i = 0; - + data->layers = newdataadr(fd, data->layers); - + /* annoying workaround for bug [#31079] loading legacy files with * no polygons _but_ have stale customdata */ if (UNLIKELY(count == 0 && data->layers == NULL && data->totlayer != 0)) { CustomData_reset(data); return; } - + data->external = newdataadr(fd, data->external); - + while (i < data->totlayer) { CustomDataLayer *layer = &data->layers[i]; - + if (layer->flag & CD_FLAG_EXTERNAL) layer->flag &= ~CD_FLAG_IN_MEMORY; layer->flag &= ~CD_FLAG_NOFREE; - + if (CustomData_verify_versions(data, i)) { layer->data = newdataadr(fd, layer->data); if (layer->type == CD_MDISPS) @@ -4661,7 +4661,7 @@ static void direct_link_customdata(FileData *fd, CustomData *data, int count) i++; } } - + CustomData_update_typemap(data); } @@ -4669,7 +4669,7 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh) { mesh->mat= newdataadr(fd, mesh->mat); test_pointer_array(fd, (void **)&mesh->mat); - + mesh->mvert = newdataadr(fd, mesh->mvert); mesh->medge = newdataadr(fd, mesh->medge); mesh->mface = newdataadr(fd, mesh->mface); @@ -4682,15 +4682,15 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh) mesh->mloopcol = newdataadr(fd, mesh->mloopcol); mesh->mloopuv = newdataadr(fd, mesh->mloopuv); mesh->mselect = newdataadr(fd, mesh->mselect); - + /* animdata */ mesh->adt = newdataadr(fd, mesh->adt); direct_link_animdata(fd, mesh->adt); - + /* normally direct_link_dverts should be called in direct_link_customdata, * but for backwards compat in do_versions to work we do it here */ direct_link_dverts(fd, mesh->totvert, mesh->dvert); - + direct_link_customdata(fd, &mesh->vdata, mesh->totvert); direct_link_customdata(fd, &mesh->edata, mesh->totedge); direct_link_customdata(fd, &mesh->fdata, mesh->totface); @@ -4710,19 +4710,19 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh) mesh->mr= newdataadr(fd, mesh->mr); if (mesh->mr) { MultiresLevel *lvl; - + link_list(fd, &mesh->mr->levels); lvl = mesh->mr->levels.first; - + direct_link_customdata(fd, &mesh->mr->vdata, lvl->totvert); direct_link_dverts(fd, lvl->totvert, CustomData_get(&mesh->mr->vdata, 0, CD_MDEFORMVERT)); direct_link_customdata(fd, &mesh->mr->fdata, lvl->totface); - + mesh->mr->edge_flags = newdataadr(fd, mesh->mr->edge_flags); mesh->mr->edge_creases = newdataadr(fd, mesh->mr->edge_creases); - + mesh->mr->verts = newdataadr(fd, mesh->mr->verts); - + /* If mesh has the same number of vertices as the * highest multires level, load the current mesh verts * into multires and discard the old data. Needed @@ -4734,7 +4734,7 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh) MEM_freeN(mesh->mr->verts); mesh->mr->verts = MEM_dupallocN(mesh->mvert); } - + for (; lvl; lvl = lvl->next) { lvl->verts = newdataadr(fd, lvl->verts); lvl->faces = newdataadr(fd, lvl->faces); @@ -4749,11 +4749,11 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh) multires_free(mesh->mr); mesh->mr = NULL; } - + if ((fd->flags & FD_FLAGS_SWITCH_ENDIAN) && mesh->tface) { TFace *tf = mesh->tface; int i; - + for (i = 0; i < mesh->totface; i++, tf++) { BLI_endian_switch_uint32_array(tf->col, 4); } @@ -4768,10 +4768,10 @@ static void lib_link_latt(FileData *fd, Main *main) if (lt->id.tag & LIB_TAG_NEED_LINK) { IDP_LibLinkProperty(lt->id.properties, fd); lib_link_animdata(fd, <->id, lt->adt); - + lt->ipo = newlibadr_us(fd, lt->id.lib, lt->ipo); // XXX deprecated - old animation system lt->key = newlibadr_us(fd, lt->id.lib, lt->key); - + lt->id.tag &= ~LIB_TAG_NEED_LINK; } } @@ -4780,13 +4780,13 @@ static void lib_link_latt(FileData *fd, Main *main) static void direct_link_latt(FileData *fd, Lattice *lt) { lt->def = newdataadr(fd, lt->def); - + lt->dvert = newdataadr(fd, lt->dvert); direct_link_dverts(fd, lt->pntsu*lt->pntsv*lt->pntsw, lt->dvert); - + lt->editlatt = NULL; lt->batch_cache = NULL; - + lt->adt = newdataadr(fd, lt->adt); direct_link_animdata(fd, lt->adt); } @@ -4827,7 +4827,7 @@ static void lib_link_object(FileData *fd, Main *main) IDP_LibLinkProperty(ob->id.properties, fd); lib_link_animdata(fd, &ob->id, ob->adt); - + // XXX deprecated - old animation system <<< ob->ipo = newlibadr_us(fd, ob->id.lib, ob->ipo); ob->action = newlibadr_us(fd, ob->id.lib, ob->action); @@ -4845,14 +4845,14 @@ static void lib_link_object(FileData *fd, Main *main) ob->dup_group = NULL; ob->transflag &= ~OB_DUPLICOLLECTION; } - + ob->proxy = newlibadr_us(fd, ob->id.lib, ob->proxy); if (ob->proxy) { /* paranoia check, actually a proxy_from pointer should never be written... */ if (ob->proxy->id.lib == NULL) { ob->proxy->proxy_from = NULL; ob->proxy = NULL; - + if (ob->id.lib) printf("Proxy lost from object %s lib %s\n", ob->id.name + 2, ob->id.lib->name); else @@ -4864,19 +4864,19 @@ static void lib_link_object(FileData *fd, Main *main) } } ob->proxy_group = newlibadr(fd, ob->id.lib, ob->proxy_group); - + void *poin = ob->data; ob->data = newlibadr_us(fd, ob->id.lib, ob->data); - + if (ob->data == NULL && poin != NULL) { if (ob->id.lib) printf("Can't find obdata of %s lib %s\n", ob->id.name + 2, ob->id.lib->name); else printf("Object %s lost data.\n", ob->id.name + 2); - + ob->type = OB_EMPTY; warn = true; - + if (ob->pose) { /* we can't call #BKE_pose_free() here because of library linking * freeing will recurse down into every pose constraints ID pointers @@ -4892,9 +4892,9 @@ static void lib_link_object(FileData *fd, Main *main) ob->mode &= ~OB_MODE_POSE; } } - for (a=0; a < ob->totcol; a++) + for (a=0; a < ob->totcol; a++) ob->mat[a] = newlibadr_us(fd, ob->id.lib, ob->mat[a]); - + /* When the object is local and the data is library its possible * the material list size gets out of sync. [#22663] */ if (ob->data && ob->id.lib != ((ID *)ob->data)->lib) { @@ -4905,21 +4905,21 @@ static void lib_link_object(FileData *fd, Main *main) BKE_material_resize_object(main, ob, *totcol_data, false); } } - + ob->gpd = newlibadr_us(fd, ob->id.lib, ob->gpd); - + ob->id.tag &= ~LIB_TAG_NEED_LINK; /* if id.us==0 a new base will be created later on */ - + /* WARNING! Also check expand_object(), should reflect the stuff below. */ lib_link_pose(fd, main, ob, ob->pose); lib_link_constraints(fd, &ob->id, &ob->constraints); - + // XXX deprecated - old animation system <<< lib_link_constraint_channels(fd, &ob->id, &ob->constraintChannels); lib_link_nlastrips(fd, &ob->id, &ob->nlastrips); // >>> XXX deprecated - old animation system - + for (PartEff *paf = ob->effect.first; paf; paf = paf->next) { if (paf->type == EFF_PARTICLE) { paf->group = newlibadr_us(fd, ob->id.lib, paf->group); @@ -4928,29 +4928,29 @@ static void lib_link_object(FileData *fd, Main *main) { FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim); - + if (fluidmd && fluidmd->fss) fluidmd->fss->ipo = newlibadr_us(fd, ob->id.lib, fluidmd->fss->ipo); // XXX deprecated - old animation system } - + { SmokeModifierData *smd = (SmokeModifierData *)modifiers_findByType(ob, eModifierType_Smoke); - + if (smd && (smd->type == MOD_SMOKE_TYPE_DOMAIN) && smd->domain) { smd->domain->flags |= MOD_SMOKE_FILE_LOAD; /* flag for refreshing the simulation after loading */ } } - + /* texture field */ if (ob->pd) lib_link_partdeflect(fd, &ob->id, ob->pd); - + if (ob->soft) { ob->soft->collision_group = newlibadr(fd, ob->id.lib, ob->soft->collision_group); ob->soft->effector_weights->group = newlibadr(fd, ob->id.lib, ob->soft->effector_weights->group); } - + lib_link_particlesystems(fd, ob, &ob->id, &ob->particlesystem); lib_link_modifiers(fd, ob); @@ -4970,7 +4970,7 @@ static void lib_link_object(FileData *fd, Main *main) } } } - + if (warn) { BKE_report(fd->reports, RPT_WARNING, "Warning in console"); } @@ -4995,22 +4995,22 @@ static void direct_link_pose(FileData *fd, bPose *pose) pchan->parent = newdataadr(fd, pchan->parent); pchan->child = newdataadr(fd, pchan->child); pchan->custom_tx = newdataadr(fd, pchan->custom_tx); - + pchan->bbone_prev = newdataadr(fd, pchan->bbone_prev); pchan->bbone_next = newdataadr(fd, pchan->bbone_next); - + direct_link_constraints(fd, &pchan->constraints); - + pchan->prop = newdataadr(fd, pchan->prop); IDP_DirectLinkGroup_OrFree(&pchan->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); - + pchan->mpath = newdataadr(fd, pchan->mpath); if (pchan->mpath) direct_link_motionpath(fd, pchan->mpath); - + BLI_listbase_clear(&pchan->iktree); BLI_listbase_clear(&pchan->siktree); - + /* in case this value changes in future, clamp else we get undefined behavior */ CLAMP(pchan->rotmode, ROT_MODE_MIN, ROT_MODE_MAX); @@ -5025,56 +5025,56 @@ static void direct_link_pose(FileData *fd, bPose *pose) static void direct_link_modifiers(FileData *fd, ListBase *lb) { ModifierData *md; - + link_list(fd, lb); - + for (md=lb->first; md; md=md->next) { md->error = NULL; md->scene = NULL; - + /* if modifiers disappear, or for upward compatibility */ if (NULL == modifierType_getInfo(md->type)) md->type = eModifierType_None; - + if (md->type == eModifierType_Subsurf) { SubsurfModifierData *smd = (SubsurfModifierData *)md; - + smd->emCache = smd->mCache = NULL; } else if (md->type == eModifierType_Armature) { ArmatureModifierData *amd = (ArmatureModifierData *)md; - + amd->prevCos = NULL; } else if (md->type == eModifierType_Cloth) { ClothModifierData *clmd = (ClothModifierData *)md; - + clmd->clothObject = NULL; clmd->hairdata = NULL; - + clmd->sim_parms= newdataadr(fd, clmd->sim_parms); clmd->coll_parms= newdataadr(fd, clmd->coll_parms); - + direct_link_pointcache_list(fd, &clmd->ptcaches, &clmd->point_cache, 0); - + if (clmd->sim_parms) { if (clmd->sim_parms->presets > 10) clmd->sim_parms->presets = 0; - + clmd->sim_parms->reset = 0; - + clmd->sim_parms->effector_weights = newdataadr(fd, clmd->sim_parms->effector_weights); - + if (!clmd->sim_parms->effector_weights) { clmd->sim_parms->effector_weights = BKE_add_effector_weights(NULL); } } - + clmd->solver_result = NULL; } else if (md->type == eModifierType_Fluidsim) { FluidsimModifierData *fluidmd = (FluidsimModifierData *)md; - + fluidmd->fss = newdataadr(fd, fluidmd->fss); if (fluidmd->fss) { fluidmd->fss->fmd = fluidmd; @@ -5083,13 +5083,13 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) } else if (md->type == eModifierType_Smoke) { SmokeModifierData *smd = (SmokeModifierData *)md; - + if (smd->type == MOD_SMOKE_TYPE_DOMAIN) { smd->flow = NULL; smd->coll = NULL; smd->domain = newdataadr(fd, smd->domain); smd->domain->smd = smd; - + smd->domain->fluid = NULL; smd->domain->fluid_mutex = BLI_rw_mutex_alloc(); smd->domain->wt = NULL; @@ -5099,13 +5099,13 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) smd->domain->tex_flame = NULL; smd->domain->tex_wt = NULL; smd->domain->coba = newdataadr(fd, smd->domain->coba); - + smd->domain->effector_weights = newdataadr(fd, smd->domain->effector_weights); if (!smd->domain->effector_weights) smd->domain->effector_weights = BKE_add_effector_weights(NULL); - + direct_link_pointcache_list(fd, &(smd->domain->ptcaches[0]), &(smd->domain->point_cache[0]), 1); - + /* Smoke uses only one cache from now on, so store pointer convert */ if (smd->domain->ptcaches[1].first || smd->domain->point_cache[1]) { if (smd->domain->point_cache[1]) { @@ -5152,22 +5152,22 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) } else if (md->type == eModifierType_DynamicPaint) { DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md; - + if (pmd->canvas) { pmd->canvas = newdataadr(fd, pmd->canvas); pmd->canvas->pmd = pmd; pmd->canvas->dm = NULL; pmd->canvas->flags &= ~MOD_DPAINT_BAKING; /* just in case */ - + if (pmd->canvas->surfaces.first) { DynamicPaintSurface *surface; link_list(fd, &pmd->canvas->surfaces); - + for (surface=pmd->canvas->surfaces.first; surface; surface=surface->next) { surface->canvas = pmd->canvas; surface->data = NULL; direct_link_pointcache_list(fd, &(surface->ptcaches), &(surface->pointcache), 1); - + if (!(surface->effector_weights = newdataadr(fd, surface->effector_weights))) surface->effector_weights = BKE_add_effector_weights(NULL); } @@ -5185,17 +5185,17 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) else if (md->type == eModifierType_Collision) { CollisionModifierData *collmd = (CollisionModifierData *)md; #if 0 - // TODO: CollisionModifier should use pointcache + // TODO: CollisionModifier should use pointcache // + have proper reset events before enabling this collmd->x = newdataadr(fd, collmd->x); collmd->xnew = newdataadr(fd, collmd->xnew); collmd->mfaces = newdataadr(fd, collmd->mfaces); - + collmd->current_x = MEM_calloc_arrayN(collmd->numverts, sizeof(MVert), "current_x"); collmd->current_xnew = MEM_calloc_arrayN(collmd->numverts, sizeof(MVert), "current_xnew"); collmd->current_v = MEM_calloc_arrayN(collmd->numverts, sizeof(MVert), "current_v"); #endif - + collmd->x = NULL; collmd->xnew = NULL; collmd->current_x = NULL; @@ -5207,11 +5207,11 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) collmd->is_static = false; collmd->bvhtree = NULL; collmd->tri = NULL; - + } else if (md->type == eModifierType_Surface) { SurfaceModifierData *surmd = (SurfaceModifierData *)md; - + surmd->mesh = NULL; surmd->bvhtree = NULL; surmd->x = NULL; @@ -5220,7 +5220,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) } else if (md->type == eModifierType_Hook) { HookModifierData *hmd = (HookModifierData *)md; - + hmd->indexar = newdataadr(fd, hmd->indexar); if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { BLI_endian_switch_int32_array(hmd->indexar, hmd->totindex); @@ -5233,7 +5233,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) } else if (md->type == eModifierType_ParticleSystem) { ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md; - + psmd->mesh_final = NULL; psmd->mesh_original = NULL; psmd->psys= newdataadr(fd, psmd->psys); @@ -5242,22 +5242,22 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) } else if (md->type == eModifierType_Explode) { ExplodeModifierData *psmd = (ExplodeModifierData *)md; - + psmd->facepa = NULL; } else if (md->type == eModifierType_MeshDeform) { MeshDeformModifierData *mmd = (MeshDeformModifierData *)md; - + mmd->bindinfluences = newdataadr(fd, mmd->bindinfluences); mmd->bindoffsets = newdataadr(fd, mmd->bindoffsets); mmd->bindcagecos = newdataadr(fd, mmd->bindcagecos); mmd->dyngrid = newdataadr(fd, mmd->dyngrid); mmd->dyninfluences = newdataadr(fd, mmd->dyninfluences); mmd->dynverts = newdataadr(fd, mmd->dynverts); - + mmd->bindweights = newdataadr(fd, mmd->bindweights); mmd->bindcos = newdataadr(fd, mmd->bindcos); - + if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { if (mmd->bindoffsets) BLI_endian_switch_int32_array(mmd->bindoffsets, mmd->totvert + 1); if (mmd->bindcagecos) BLI_endian_switch_float_array(mmd->bindcagecos, mmd->totcagevert * 3); @@ -5274,14 +5274,14 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) } else if (md->type == eModifierType_Warp) { WarpModifierData *tmd = (WarpModifierData *)md; - + tmd->curfalloff= newdataadr(fd, tmd->curfalloff); if (tmd->curfalloff) direct_link_curvemapping(fd, tmd->curfalloff); } else if (md->type == eModifierType_WeightVGEdit) { WeightVGEditModifierData *wmd = (WeightVGEditModifierData *)md; - + wmd->cmap_curve = newdataadr(fd, wmd->cmap_curve); if (wmd->cmap_curve) direct_link_curvemapping(fd, wmd->cmap_curve); @@ -5350,7 +5350,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) static void direct_link_object(FileData *fd, Object *ob) { PartEff *paf; - + /* XXX This should not be needed - but seems like it can happen in some cases, so for now play safe... */ ob->proxy_from = NULL; @@ -5366,31 +5366,31 @@ static void direct_link_object(FileData *fd, Object *ob) ob->mode &= ~OB_MODE_POSE; } } - + ob->adt = newdataadr(fd, ob->adt); direct_link_animdata(fd, ob->adt); - + ob->pose = newdataadr(fd, ob->pose); direct_link_pose(fd, ob->pose); - + ob->mpath = newdataadr(fd, ob->mpath); if (ob->mpath) direct_link_motionpath(fd, ob->mpath); - + link_list(fd, &ob->defbase); link_list(fd, &ob->fmaps); // XXX deprecated - old animation system <<< direct_link_nlastrips(fd, &ob->nlastrips); link_list(fd, &ob->constraintChannels); // >>> XXX deprecated - old animation system - + ob->mat= newdataadr(fd, ob->mat); test_pointer_array(fd, (void **)&ob->mat); ob->matbits= newdataadr(fd, ob->matbits); - + /* do it here, below old data gets converted */ direct_link_modifiers(fd, &ob->modifiers); - + link_list(fd, &ob->effect); paf= ob->effect.first; while (paf) { @@ -5401,7 +5401,7 @@ static void direct_link_object(FileData *fd, Object *ob) WaveEff *wav = (WaveEff*) paf; PartEff *next = paf->next; WaveModifierData *wmd = (WaveModifierData*) modifier_new(eModifierType_Wave); - + wmd->damp = wav->damp; wmd->flag = wav->flag; wmd->height = wav->height; @@ -5412,12 +5412,12 @@ static void direct_link_object(FileData *fd, Object *ob) wmd->starty = wav->startx; wmd->timeoffs = wav->timeoffs; wmd->width = wav->width; - + BLI_addtail(&ob->modifiers, wmd); - + BLI_remlink(&ob->effect, paf); MEM_freeN(paf); - + paf = next; continue; } @@ -5425,29 +5425,29 @@ static void direct_link_object(FileData *fd, Object *ob) BuildEff *baf = (BuildEff*) paf; PartEff *next = paf->next; BuildModifierData *bmd = (BuildModifierData*) modifier_new(eModifierType_Build); - + bmd->start = baf->sfra; bmd->length = baf->len; bmd->randomize = 0; bmd->seed = 1; - + BLI_addtail(&ob->modifiers, bmd); - + BLI_remlink(&ob->effect, paf); MEM_freeN(paf); - + paf = next; continue; } paf = paf->next; } - + ob->pd= newdataadr(fd, ob->pd); direct_link_partdeflect(ob->pd); ob->soft= newdataadr(fd, ob->soft); if (ob->soft) { SoftBody *sb = ob->soft; - + sb->bpoint = NULL; // init pointers so it gets rebuilt nicely sb->bspring = NULL; sb->scratch = NULL; @@ -5461,21 +5461,21 @@ static void direct_link_object(FileData *fd, Object *ob) sb->keys[a] = newdataadr(fd, sb->keys[a]); } } - + sb->effector_weights = newdataadr(fd, sb->effector_weights); if (!sb->effector_weights) sb->effector_weights = BKE_add_effector_weights(NULL); - + direct_link_pointcache_list(fd, &sb->ptcaches, &sb->pointcache, 0); } ob->fluidsimSettings= newdataadr(fd, ob->fluidsimSettings); /* NT */ - + ob->rigidbody_object = newdataadr(fd, ob->rigidbody_object); if (ob->rigidbody_object) { RigidBodyOb *rbo = ob->rigidbody_object; - - /* must nullify the references to physics sim objects, since they no-longer exist - * (and will need to be recalculated) + + /* must nullify the references to physics sim objects, since they no-longer exist + * (and will need to be recalculated) */ rbo->physics_object = NULL; rbo->physics_shape = NULL; @@ -5493,12 +5493,12 @@ static void direct_link_object(FileData *fd, Object *ob) while (ob->hooks.first) { ObHook *hook = ob->hooks.first; HookModifierData *hmd = (HookModifierData *)modifier_new(eModifierType_Hook); - + hook->indexar= newdataadr(fd, hook->indexar); if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) { BLI_endian_switch_int32_array(hook->indexar, hook->totindex); } - + /* Do conversion here because if we have loaded * a hook we need to make sure it gets converted * and freed, regardless of version. @@ -5510,15 +5510,15 @@ static void direct_link_object(FileData *fd, Object *ob) hmd->object = hook->parent; memcpy(hmd->parentinv, hook->parentinv, sizeof(hmd->parentinv)); hmd->totindex = hook->totindex; - + BLI_addhead(&ob->modifiers, hmd); BLI_remlink(&ob->hooks, hook); - + modifier_unique_name(&ob->modifiers, (ModifierData*)hmd); - + MEM_freeN(hook); } - + ob->iuser = newdataadr(fd, ob->iuser); if (ob->type == OB_EMPTY && ob->empty_drawtype == OB_EMPTY_IMAGE && !ob->iuser) { BKE_object_empty_draw_type_set(ob, ob->empty_drawtype); @@ -5755,7 +5755,7 @@ static void lib_link_collection(FileData *fd, Main *main) static void composite_patch(bNodeTree *ntree, Scene *scene) { bNode *node; - + for (node = ntree->nodes.first; node; node = node->next) { if (node->id==NULL && node->type == CMP_NODE_R_LAYERS) node->id = &scene->id; @@ -5817,21 +5817,21 @@ static void lib_link_scene(FileData *fd, Main *main) bool need_check_set = false; int totscene = 0; #endif - + for (Scene *sce = main->scene.first; sce; sce = sce->id.next) { if (sce->id.tag & LIB_TAG_NEED_LINK) { /* Link ID Properties -- and copy this comment EXACTLY for easy finding * of library blocks that implement this.*/ IDP_LibLinkProperty(sce->id.properties, fd); lib_link_animdata(fd, &sce->id, sce->adt); - + lib_link_keyingsets(fd, &sce->id, &sce->keyingsets); - + sce->camera = newlibadr(fd, sce->id.lib, sce->camera); sce->world = newlibadr_us(fd, sce->id.lib, sce->world); sce->set = newlibadr(fd, sce->id.lib, sce->set); sce->gpd = newlibadr_us(fd, sce->id.lib, sce->gpd); - + link_paint(fd, sce, &sce->toolsettings->sculpt->paint); link_paint(fd, sce, &sce->toolsettings->vpaint->paint); link_paint(fd, sce, &sce->toolsettings->wpaint->paint); @@ -5853,14 +5853,14 @@ static void lib_link_scene(FileData *fd, Main *main) if (sce->toolsettings->imapaint.canvas) sce->toolsettings->imapaint.canvas = newlibadr_us(fd, sce->id.lib, sce->toolsettings->imapaint.canvas); - + sce->toolsettings->particle.shape_object = newlibadr(fd, sce->id.lib, sce->toolsettings->particle.shape_object); - + for (Base *base_legacy_next, *base_legacy = sce->base.first; base_legacy; base_legacy = base_legacy_next) { base_legacy_next = base_legacy->next; - + base_legacy->object = newlibadr_us(fd, sce->id.lib, base_legacy->object); - + if (base_legacy->object == NULL) { blo_reportf_wrap(fd->reports, RPT_WARNING, TIP_("LIB: object lost from scene: '%s'"), sce->id.name + 2); @@ -5869,7 +5869,7 @@ static void lib_link_scene(FileData *fd, Main *main) MEM_freeN(base_legacy); } } - + Sequence *seq; SEQ_BEGIN (sce->ed, seq) { @@ -5916,11 +5916,11 @@ static void lib_link_scene(FileData *fd, Main *main) marker->camera = newlibadr(fd, sce->id.lib, marker->camera); } } - + BKE_sequencer_update_muting(sce->ed); BKE_sequencer_update_sound_bounds_all(sce); - - + + /* rigidbody world relies on it's linked collections */ if (sce->rigidbody_world) { RigidBodyWorld *rbw = sce->rigidbody_world; @@ -5931,13 +5931,13 @@ static void lib_link_scene(FileData *fd, Main *main) if (rbw->effector_weights) rbw->effector_weights->group = newlibadr(fd, sce->id.lib, rbw->effector_weights->group); } - + if (sce->nodetree) { lib_link_ntree(fd, &sce->id, sce->nodetree); sce->nodetree->id.lib = sce->id.lib; composite_patch(sce->nodetree, sce); } - + for (SceneRenderLayer *srl = sce->r.layers.first; srl; srl = srl->next) { srl->mat_override = newlibadr_us(fd, sce->id.lib, srl->mat_override); for (FreestyleModuleConfig *fmc = srl->freestyleConfig.modules.first; fmc; fmc = fmc->next) { @@ -6006,9 +6006,9 @@ static void lib_link_scene(FileData *fd, Main *main) static void link_recurs_seq(FileData *fd, ListBase *lb) { Sequence *seq; - + link_list(fd, lb); - + for (seq = lb->first; seq; seq = seq->next) { if (seq->seqbase.first) link_recurs_seq(fd, &seq->seqbase); @@ -6068,34 +6068,34 @@ static void direct_link_scene(FileData *fd, Scene *sce) RigidBodyWorld *rbw; ViewLayer *view_layer; SceneRenderLayer *srl; - + sce->depsgraph_hash = NULL; sce->fps_info = NULL; sce->customdata_mask_modal = 0; sce->lay_updated = 0; - + BKE_sound_create_scene(sce); - + /* set users to one by default, not in lib-link, this will increase it for compo nodes */ id_us_ensure_real(&sce->id); - + link_list(fd, &(sce->base)); - + sce->adt = newdataadr(fd, sce->adt); direct_link_animdata(fd, sce->adt); - + link_list(fd, &sce->keyingsets); direct_link_keyingsets(fd, &sce->keyingsets); - + sce->basact = newdataadr(fd, sce->basact); - + sce->toolsettings= newdataadr(fd, sce->toolsettings); if (sce->toolsettings) { direct_link_paint_helper(fd, (Paint**)&sce->toolsettings->sculpt); direct_link_paint_helper(fd, (Paint**)&sce->toolsettings->vpaint); direct_link_paint_helper(fd, (Paint**)&sce->toolsettings->wpaint); direct_link_paint_helper(fd, (Paint**)&sce->toolsettings->uvsculpt); - + direct_link_paint(fd, &sce->toolsettings->imapaint.paint); sce->toolsettings->imapaint.paintcursor = NULL; @@ -6103,7 +6103,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) sce->toolsettings->particle.scene = NULL; sce->toolsettings->particle.object = NULL; sce->toolsettings->gp_sculpt.paintcursor = NULL; - + /* relink grease pencil drawing brushes */ link_list(fd, &sce->toolsettings->gp_brushes); for (bGPDbrush *brush = sce->toolsettings->gp_brushes.first; brush; brush = brush->next) { @@ -6120,7 +6120,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) direct_link_curvemapping(fd, brush->cur_jitter); } } - + /* relink grease pencil interpolation curves */ sce->toolsettings->gp_interpolate.custom_ipo = newdataadr(fd, sce->toolsettings->gp_interpolate.custom_ipo); if (sce->toolsettings->gp_interpolate.custom_ipo) { @@ -6130,29 +6130,29 @@ static void direct_link_scene(FileData *fd, Scene *sce) if (sce->ed) { ListBase *old_seqbasep = &sce->ed->seqbase; - + ed = sce->ed = newdataadr(fd, sce->ed); - + ed->act_seq = newdataadr(fd, ed->act_seq); - + /* recursive link sequences, lb will be correctly initialized */ link_recurs_seq(fd, &ed->seqbase); - + SEQ_BEGIN (ed, seq) { seq->seq1= newdataadr(fd, seq->seq1); seq->seq2= newdataadr(fd, seq->seq2); seq->seq3= newdataadr(fd, seq->seq3); - + /* a patch: after introduction of effects with 3 input strips */ if (seq->seq3 == NULL) seq->seq3 = seq->seq2; - + seq->effectdata = newdataadr(fd, seq->effectdata); seq->stereo3d_format = newdataadr(fd, seq->stereo3d_format); - + if (seq->type & SEQ_TYPE_EFFECT) seq->flag |= SEQ_EFFECT_NOT_LOADED; - + if (seq->type == SEQ_TYPE_SPEED) { SpeedControlVars *s = seq->effectdata; s->frameMap = NULL; @@ -6164,7 +6164,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) seq->strip = newdataadr(fd, seq->strip); if (seq->strip && seq->strip->done==0) { seq->strip->done = true; - + if (ELEM(seq->type, SEQ_TYPE_IMAGE, SEQ_TYPE_MOVIE, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD)) { seq->strip->stripdata = newdataadr(fd, seq->strip->stripdata); } @@ -6205,22 +6205,22 @@ static void direct_link_scene(FileData *fd, Scene *sce) direct_link_sequence_modifiers(fd, &seq->modifiers); } SEQ_END - + /* link metastack, slight abuse of structs here, have to restore pointer to internal part in struct */ { Sequence temp; void *poin; intptr_t offset; - + offset = ((intptr_t)&(temp.seqbase)) - ((intptr_t)&temp); - + /* root pointer */ if (ed->seqbasep == old_seqbasep) { ed->seqbasep = &ed->seqbase; } else { poin = POINTER_OFFSET(ed->seqbasep, -offset); - + poin = newdataadr(fd, poin); if (poin) ed->seqbasep = (ListBase *)POINTER_OFFSET(poin, offset); @@ -6229,24 +6229,24 @@ static void direct_link_scene(FileData *fd, Scene *sce) } /* stack */ link_list(fd, &(ed->metastack)); - + for (ms = ed->metastack.first; ms; ms= ms->next) { ms->parseq = newdataadr(fd, ms->parseq); - + if (ms->oldbasep == old_seqbasep) ms->oldbasep= &ed->seqbase; else { poin = POINTER_OFFSET(ms->oldbasep, -offset); poin = newdataadr(fd, poin); - if (poin) + if (poin) ms->oldbasep = (ListBase *)POINTER_OFFSET(poin, offset); - else + else ms->oldbasep = &ed->seqbase; } } } } - + sce->r.avicodecdata = newdataadr(fd, sce->r.avicodecdata); if (sce->r.avicodecdata) { sce->r.avicodecdata->lpFormat = newdataadr(fd, sce->r.avicodecdata->lpFormat); @@ -6256,7 +6256,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) sce->r.ffcodecdata.properties = newdataadr(fd, sce->r.ffcodecdata.properties); IDP_DirectLinkGroup_OrFree(&sce->r.ffcodecdata.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); } - + link_list(fd, &(sce->markers)); link_list(fd, &(sce->transform_spaces)); link_list(fd, &(sce->r.layers)); @@ -6269,7 +6269,7 @@ static void direct_link_scene(FileData *fd, Scene *sce) link_list(fd, &(srl->freestyleConfig.modules)); link_list(fd, &(srl->freestyleConfig.linesets)); } - + sce->nodetree = newdataadr(fd, sce->nodetree); if (sce->nodetree) { direct_link_id(fd, &sce->nodetree->id); @@ -6277,12 +6277,12 @@ static void direct_link_scene(FileData *fd, Scene *sce) } direct_link_view_settings(fd, &sce->view_settings); - + sce->rigidbody_world = newdataadr(fd, sce->rigidbody_world); rbw = sce->rigidbody_world; if (rbw) { - /* must nullify the reference to physics sim object, since it no-longer exist - * (and will need to be recalculated) + /* must nullify the reference to physics sim object, since it no-longer exist + * (and will need to be recalculated) */ rbw->physics_world = NULL; rbw->objects = NULL; @@ -6354,7 +6354,7 @@ static void direct_link_gpencil(FileData *fd, bGPdata *gpd) /* we must firstly have some grease-pencil data to link! */ if (gpd == NULL) return; - + /* relink animdata */ gpd->adt = newdataadr(fd, gpd->adt); direct_link_animdata(fd, gpd->adt); @@ -6367,21 +6367,21 @@ static void direct_link_gpencil(FileData *fd, bGPdata *gpd) /* relink layers */ link_list(fd, &gpd->layers); - + for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { /* parent */ gpl->parent = newlibadr(fd, gpd->id.lib, gpl->parent); /* relink frames */ link_list(fd, &gpl->frames); gpl->actframe = newdataadr(fd, gpl->actframe); - + for (gpf = gpl->frames.first; gpf; gpf = gpf->next) { /* relink strokes (and their points) */ link_list(fd, &gpf->strokes); - + for (gps = gpf->strokes.first; gps; gps = gps->next) { gps->points = newdataadr(fd, gps->points); - + /* the triangulation is not saved, so need to be recalculated */ gps->triangles = NULL; gps->tot_triangles = 0; @@ -6453,7 +6453,7 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype) } } } - + ar->v2d.tab_offset = NULL; ar->v2d.tab_num = 0; ar->v2d.tab_cur = 0; @@ -6595,7 +6595,7 @@ static void direct_link_area(FileData *fd, ScrArea *area) sima->scopes.vecscope = NULL; sima->scopes.ok = 0; - /* WARNING: gpencil data is no longer stored directly in sima after 2.5 + /* WARNING: gpencil data is no longer stored directly in sima after 2.5 * so sacrifice a few old files for now to avoid crashes with new files! * committed: r28002 */ #if 0 @@ -6606,12 +6606,12 @@ static void direct_link_area(FileData *fd, ScrArea *area) } else if (sl->spacetype == SPACE_NODE) { SpaceNode *snode = (SpaceNode *)sl; - + if (snode->gpd) { snode->gpd = newdataadr(fd, snode->gpd); direct_link_gpencil(fd, snode->gpd); } - + link_list(fd, &snode->treepath); snode->edittree = NULL; snode->iofsd = NULL; @@ -6619,14 +6619,14 @@ static void direct_link_area(FileData *fd, ScrArea *area) } else if (sl->spacetype == SPACE_TEXT) { SpaceText *st= (SpaceText *)sl; - + st->drawcache = NULL; st->scroll_accum[0] = 0.0f; st->scroll_accum[1] = 0.0f; } else if (sl->spacetype == SPACE_SEQ) { SpaceSeq *sseq = (SpaceSeq *)sl; - + /* grease pencil data is not a direct data and can't be linked from direct_link* * functions, it should be linked from lib_link* functions instead * @@ -6930,10 +6930,10 @@ static bool direct_link_area_map(FileData *fd, ScrAreaMap *area_map) static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm) { wmWindow *win; - + id_us_ensure_real(&wm->id); link_list(fd, &wm->windows); - + for (win = wm->windows.first; win; win = win->next) { WorkSpaceInstanceHook *hook = win->workspace_hook; @@ -6950,12 +6950,12 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm) #ifdef WIN32 win->ime_data = NULL; #endif - + BLI_listbase_clear(&win->queue); BLI_listbase_clear(&win->handlers); BLI_listbase_clear(&win->modalhandlers); BLI_listbase_clear(&win->gesture); - + win->active = 0; win->cursor = 0; @@ -6971,13 +6971,13 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm) win->stereo3d_format->display_mode = S3D_DISPLAY_ANAGLYPH; } } - + BLI_listbase_clear(&wm->timers); BLI_listbase_clear(&wm->operators); BLI_listbase_clear(&wm->paintcursors); BLI_listbase_clear(&wm->queue); BKE_reports_init(&wm->reports, RPT_STORE); - + BLI_listbase_clear(&wm->keyconfigs); wm->defaultconf = NULL; wm->addonconf = NULL; @@ -6988,7 +6988,7 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm) BLI_listbase_clear(&wm->jobs); BLI_listbase_clear(&wm->drags); - + wm->windrawable = NULL; wm->winactive = NULL; wm->initialized = 0; @@ -7000,7 +7000,7 @@ static void lib_link_windowmanager(FileData *fd, Main *main) { wmWindowManager *wm; wmWindow *win; - + for (wm = main->wm.first; wm; wm = wm->id.next) { if (wm->id.tag & LIB_TAG_NEED_LINK) { /* Note: WM IDProperties are never written to file, hence no need to read/link them here. */ @@ -7011,7 +7011,7 @@ static void lib_link_windowmanager(FileData *fd, Main *main) win->scene = newlibadr(fd, wm->id.lib, win->scene); /* deprecated, but needed for versioning (will be NULL'ed then) */ win->screen = newlibadr(fd, NULL, win->screen); - + for (ScrArea *area = win->global_areas.areabase.first; area; area = area->next) { lib_link_area(fd, &wm->id, area); } @@ -7024,7 +7024,7 @@ static void lib_link_windowmanager(FileData *fd, Main *main) /* ****************** READ SCREEN ***************** */ -/* note: file read without screens option G_FILE_NO_UI; +/* note: file read without screens option G_FILE_NO_UI; * check lib pointers in call below */ static void lib_link_screen(FileData *fd, Main *main) { @@ -7039,7 +7039,7 @@ static void lib_link_screen(FileData *fd, Main *main) sc->animtimer = NULL; /* saved in rare cases */ sc->tool_tip = NULL; sc->scrubbing = false; - + for (ScrArea *area = sc->areabase.first; area; area = area->next) { lib_link_area(fd, &sc->id, area); } @@ -7209,7 +7209,7 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main if (sl->spacetype == SPACE_VIEW3D) { View3D *v3d = (View3D *)sl; ARegion *ar; - + v3d->camera = restore_pointer_by_name(id_map, (ID *)v3d->camera, USER_REAL); v3d->ob_centre = restore_pointer_by_name(id_map, (ID *)v3d->ob_centre, USER_REAL); @@ -7230,14 +7230,14 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main else if (sl->spacetype == SPACE_IPO) { SpaceIpo *sipo = (SpaceIpo *)sl; bDopeSheet *ads = sipo->ads; - + if (ads) { ads->source = restore_pointer_by_name(id_map, (ID *)ads->source, USER_REAL); - + if (ads->filter_grp) ads->filter_grp = restore_pointer_by_name(id_map, (ID *)ads->filter_grp, USER_IGNORE); } - + /* force recalc of list of channels (i.e. includes calculating F-Curve colors) * thus preventing the "black curves" problem post-undo */ @@ -7261,28 +7261,28 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main } else if (sl->spacetype == SPACE_ACTION) { SpaceAction *saction = (SpaceAction *)sl; - + saction->action = restore_pointer_by_name(id_map, (ID *)saction->action, USER_REAL); saction->ads.source = restore_pointer_by_name(id_map, (ID *)saction->ads.source, USER_REAL); - + if (saction->ads.filter_grp) saction->ads.filter_grp = restore_pointer_by_name(id_map, (ID *)saction->ads.filter_grp, USER_IGNORE); - - - /* force recalc of list of channels, potentially updating the active action - * while we're at it (as it can only be updated that way) [#28962] + + + /* force recalc of list of channels, potentially updating the active action + * while we're at it (as it can only be updated that way) [#28962] */ saction->flag |= SACTION_TEMP_NEEDCHANSYNC; } else if (sl->spacetype == SPACE_IMAGE) { SpaceImage *sima = (SpaceImage *)sl; - + sima->image = restore_pointer_by_name(id_map, (ID *)sima->image, USER_REAL); - + /* this will be freed, not worth attempting to find same scene, * since it gets initialized later */ sima->iuser.scene = NULL; - + #if 0 /* Those are allocated and freed by space code, no need to handle them here. */ MEM_SAFE_FREE(sima->scopes.waveform_1); @@ -7291,7 +7291,7 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main MEM_SAFE_FREE(sima->scopes.vecscope); #endif sima->scopes.ok = 0; - + /* NOTE: pre-2.5, this was local data not lib data, but now we need this as lib data * so assume that here we're doing for undo only... */ @@ -7300,7 +7300,7 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main } else if (sl->spacetype == SPACE_SEQ) { SpaceSeq *sseq = (SpaceSeq *)sl; - + /* NOTE: pre-2.5, this was local data not lib data, but now we need this as lib data * so assume that here we're doing for undo only... */ @@ -7309,25 +7309,25 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main else if (sl->spacetype == SPACE_NLA) { SpaceNla *snla = (SpaceNla *)sl; bDopeSheet *ads = snla->ads; - + if (ads) { ads->source = restore_pointer_by_name(id_map, (ID *)ads->source, USER_REAL); - + if (ads->filter_grp) ads->filter_grp = restore_pointer_by_name(id_map, (ID *)ads->filter_grp, USER_IGNORE); } } else if (sl->spacetype == SPACE_TEXT) { SpaceText *st = (SpaceText *)sl; - + st->text = restore_pointer_by_name(id_map, (ID *)st->text, USER_REAL); if (st->text == NULL) st->text = newmain->text.first; } else if (sl->spacetype == SPACE_SCRIPT) { SpaceScript *scpt = (SpaceScript *)sl; - + scpt->script = restore_pointer_by_name(id_map, (ID *)scpt->script, USER_REAL); - + /*sc->script = NULL; - 2.45 set to null, better re-run the script */ if (scpt->script) { SCRIPT_SET_NULL(scpt->script); @@ -7335,9 +7335,9 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main } else if (sl->spacetype == SPACE_OUTLINER) { SpaceOops *so= (SpaceOops *)sl; - + so->search_tse.id = restore_pointer_by_name(id_map, so->search_tse.id, USER_IGNORE); - + if (so->treestore) { TreeStoreElem *tselem; BLI_mempool_iter iter; @@ -7362,14 +7362,14 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main SpaceNode *snode= (SpaceNode *)sl; bNodeTreePath *path, *path_next; bNodeTree *ntree; - + /* node tree can be stored locally in id too, link this first */ snode->id = restore_pointer_by_name(id_map, snode->id, USER_REAL); snode->from = restore_pointer_by_name(id_map, snode->from, USER_IGNORE); - + ntree = snode->id ? ntreeFromID(snode->id) : NULL; snode->nodetree = ntree ? ntree : restore_pointer_by_name(id_map, (ID *)snode->nodetree, USER_REAL); - + for (path = snode->treepath.first; path; path = path->next) { if (path == snode->treepath.first) { /* first nodetree in path is same as snode->nodetree */ @@ -7377,19 +7377,19 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main } else path->nodetree= restore_pointer_by_name(id_map, (ID*)path->nodetree, USER_REAL); - + if (!path->nodetree) break; } - + /* remaining path entries are invalid, remove */ for (; path; path = path_next) { path_next = path->next; - + BLI_remlink(&snode->treepath, path); MEM_freeN(path); } - + /* edittree is just the last in the path, * set this directly since the path may have been shortened above */ if (snode->treepath.last) { @@ -7401,10 +7401,10 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main } else if (sl->spacetype == SPACE_CLIP) { SpaceClip *sclip = (SpaceClip *)sl; - + sclip->clip = restore_pointer_by_name(id_map, (ID *)sclip->clip, USER_REAL); sclip->mask_info.mask = restore_pointer_by_name(id_map, (ID *)sclip->mask_info.mask, USER_REAL); - + sclip->scopes.ok = 0; } } @@ -7463,11 +7463,11 @@ void blo_lib_link_restore(Main *newmain, wmWindowManager *curwm, Scene *curscene void blo_do_versions_view3d_split_250(View3D *v3d, ListBase *regions) { ARegion *ar; - + for (ar = regions->first; ar; ar = ar->next) { if (ar->regiontype==RGN_TYPE_WINDOW && ar->regiondata==NULL) { RegionView3D *rv3d; - + rv3d = ar->regiondata = MEM_callocN(sizeof(RegionView3D), "region v3d patch"); rv3d->persp = (char)v3d->persp; rv3d->view = (char)v3d->view; @@ -7476,7 +7476,7 @@ void blo_do_versions_view3d_split_250(View3D *v3d, ListBase *regions) copy_qt_qt(rv3d->viewquat, v3d->viewquat); } } - + /* this was not initialized correct always */ if (v3d->gridsubdiv == 0) v3d->gridsubdiv = 10; @@ -7485,7 +7485,7 @@ void blo_do_versions_view3d_split_250(View3D *v3d, ListBase *regions) static bool direct_link_screen(FileData *fd, bScreen *sc) { bool wrong_id = false; - + sc->regionbase.first = sc->regionbase.last= NULL; sc->context = NULL; sc->active_region = NULL; @@ -7506,7 +7506,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc) static void direct_link_library(FileData *fd, Library *lib, Main *main) { Main *newmain; - + /* check if the library was already read */ for (newmain = fd->mainlist->first; newmain; newmain = newmain->next) { if (newmain->curlib) { @@ -7514,10 +7514,10 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main) blo_reportf_wrap(fd->reports, RPT_WARNING, TIP_("Library '%s', '%s' had multiple instances, save and reload!"), lib->name, lib->filepath); - + change_idid_adr(fd->mainlist, fd, lib, newmain->curlib); /* change_idid_adr_fd(fd, lib, newmain->curlib); */ - + BLI_remlink(&main->library, lib); MEM_freeN(lib); @@ -7537,17 +7537,17 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main) /* make sure we have full path in lib->filepath */ BLI_strncpy(lib->filepath, lib->name, sizeof(lib->name)); BLI_cleanup_path(fd->relabase, lib->filepath); - + // printf("direct_link_library: name %s\n", lib->name); // printf("direct_link_library: filepath %s\n", lib->filepath); - + lib->packedfile = direct_link_packedfile(fd, lib->packedfile); - + /* new main */ newmain = BKE_main_new(); BLI_addtail(fd->mainlist, newmain); newmain->curlib = lib; - + lib->parent = NULL; } @@ -7618,7 +7618,7 @@ static void lib_link_speaker(FileData *fd, Main *main) if (spk->id.tag & LIB_TAG_NEED_LINK) { IDP_LibLinkProperty(spk->id.properties, fd); lib_link_animdata(fd, &spk->id, spk->adt); - + spk->sound = newlibadr_us(fd, spk->id.lib, spk->sound); spk->id.tag &= ~LIB_TAG_NEED_LINK; @@ -7652,11 +7652,11 @@ static void direct_link_sound(FileData *fd, bSound *sound) if (fd->soundmap) { sound->waveform = newsoundadr(fd, sound->waveform); - } + } else { sound->waveform = NULL; } - + if (sound->spinlock) { sound->spinlock = MEM_mallocN(sizeof(SpinLock), "sound_spinlock"); BLI_spin_init(sound->spinlock); @@ -7675,7 +7675,7 @@ static void lib_link_sound(FileData *fd, Main *main) IDP_LibLinkProperty(sound->id.properties, fd); sound->ipo = newlibadr_us(fd, sound->id.lib, sound->ipo); // XXX deprecated - old animation system - + BKE_sound_load(main, sound); sound->id.tag &= ~LIB_TAG_NEED_LINK; @@ -7693,9 +7693,9 @@ static void direct_link_movieReconstruction(FileData *fd, MovieTrackingReconstru static void direct_link_movieTracks(FileData *fd, ListBase *tracksbase) { MovieTrackingTrack *track; - + link_list(fd, tracksbase); - + for (track = tracksbase->first; track; track = track->next) { track->markers = newdataadr(fd, track->markers); } @@ -7755,7 +7755,7 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip) BLI_listbase_clear(&clip->tracking.dopesheet.coverage_segments); link_list(fd, &tracking->objects); - + for (object = tracking->objects.first; object; object = object->next) { direct_link_movieTracks(fd, &object->tracks); direct_link_moviePlaneTracks(fd, &object->plane_tracks); @@ -7789,9 +7789,9 @@ static void lib_link_movieclip(FileData *fd, Main *main) IDP_LibLinkProperty(clip->id.properties, fd); lib_link_animdata(fd, &clip->id, clip->adt); - + clip->gpd = newlibadr_us(fd, clip->id.lib, clip->gpd); - + lib_link_movieTracks(fd, clip, &tracking->tracks); lib_link_moviePlaneTracks(fd, clip, &tracking->plane_tracks); @@ -8207,13 +8207,13 @@ static const char *dataname(short id_code) case ID_WS: return "Data from WS"; } return "Data from Lib Block"; - + } static BHead *read_data_into_oldnewmap(FileData *fd, BHead *bhead, const char *allocname) { bhead = blo_nextbhead(fd, bhead); - + while (bhead && bhead->code==DATA) { void *data; #if 0 @@ -8226,14 +8226,14 @@ static BHead *read_data_into_oldnewmap(FileData *fd, BHead *bhead, const char *a #else data = read_struct(fd, bhead, allocname); #endif - + if (data) { oldnewmap_insert(fd->datamap, bhead->old, data, 0); } - + bhead = blo_nextbhead(fd, bhead); } - + return bhead; } @@ -8322,14 +8322,14 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short *r_id = id; if (!id) return blo_nextbhead(fd, bhead); - + id->lib = main->curlib; id->us = ID_FAKE_USERS(id); id->icon_id = 0; id->newid = NULL; /* Needed because .blend may have been saved with crap value here... */ id->orig_id = NULL; id->recalc = 0; - + /* this case cannot be direct_linked: it's just the ID part */ if (bhead->code == ID_ID) { /* That way, we know which datablock needs do_versions (required currently for linking). */ @@ -8340,10 +8340,10 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short /* need a name for the mallocN, just for debugging and sane prints on leaks */ allocname = dataname(GS(id->name)); - + /* read all data into fd->datamap */ bhead = read_data_into_oldnewmap(fd, bhead, allocname); - + /* init pointers direct data */ direct_link_id(fd, id); @@ -8461,14 +8461,14 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short direct_link_workspace(fd, (WorkSpace *)id, main); break; } - + oldnewmap_free_unused(fd->datamap); oldnewmap_clear(fd->datamap); - + if (wrong_id) { BKE_libblock_free(main, id); } - + return (bhead); } @@ -8477,41 +8477,41 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, const short static BHead *read_global(BlendFileData *bfd, FileData *fd, BHead *bhead) { FileGlobal *fg = read_struct(fd, bhead, "Global"); - + /* copy to bfd handle */ bfd->main->subversionfile = fg->subversion; bfd->main->minversionfile = fg->minversion; bfd->main->minsubversionfile = fg->minsubversion; bfd->main->build_commit_timestamp = fg->build_commit_timestamp; BLI_strncpy(bfd->main->build_hash, fg->build_hash, sizeof(bfd->main->build_hash)); - + bfd->fileflags = fg->fileflags; bfd->globalf = fg->globalf; BLI_strncpy(bfd->filename, fg->filename, sizeof(bfd->filename)); - + /* error in 2.65 and older: main->name was not set if you save from startup (not after loading file) */ if (bfd->filename[0] == 0) { if (fd->fileversion < 265 || (fd->fileversion == 265 && fg->subversion < 1)) if ((G.fileflags & G_FILE_RECOVER)==0) BLI_strncpy(bfd->filename, BKE_main_blendfile_path(bfd->main), sizeof(bfd->filename)); - + /* early 2.50 version patch - filename not in FileGlobal struct at all */ if (fd->fileversion <= 250) BLI_strncpy(bfd->filename, BKE_main_blendfile_path(bfd->main), sizeof(bfd->filename)); } - + if (G.fileflags & G_FILE_RECOVER) BLI_strncpy(fd->relabase, fg->filename, sizeof(fd->relabase)); - + bfd->curscreen = fg->curscreen; bfd->curscene = fg->curscene; bfd->cur_view_layer = fg->cur_view_layer; MEM_freeN(fg); - + fd->globalf = bfd->globalf; fd->fileflags = bfd->fileflags; - + return blo_nextbhead(fd, bhead); } @@ -8533,12 +8533,12 @@ static void do_versions_userdef(FileData *fd, BlendFileData *bfd) { Main *bmain = bfd->main; UserDef *user = bfd->user; - + if (user == NULL) return; - + if (MAIN_VERSION_OLDER(bmain, 266, 4)) { bTheme *btheme; - + /* themes for Node and Sequence editor were not using grid color, but back. we copy this over then */ for (btheme = user->themes.first; btheme; btheme = btheme->next) { copy_v4_v4_char(btheme->tnode.grid, btheme->tnode.back); @@ -8559,7 +8559,7 @@ static void do_versions_userdef(FileData *fd, BlendFileData *bfd) static void do_versions(FileData *fd, Library *lib, Main *main) { /* WATCH IT!!!: pointers from libdata have not been converted */ - + if (G.debug & G_DEBUG) { char build_commit_datetime[32]; time_t temp_time = main->build_commit_timestamp; @@ -8575,7 +8575,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main) fd->relabase, main->versionfile, main->subversionfile, build_commit_datetime, main->build_hash); } - + blo_do_versions_pre250(fd, lib, main); blo_do_versions_250(fd, lib, main); blo_do_versions_260(fd, lib, main); @@ -8600,7 +8600,7 @@ static void do_versions_after_linking(Main *main) static void lib_link_all(FileData *fd, Main *main) { oldnewmap_sort(fd); - + lib_link_id(fd, main); /* No load UI for undo memfiles */ @@ -8661,22 +8661,22 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead) wmKeyMapItem *kmi; wmKeyMapDiffItem *kmdi; bAddon *addon; - + bfd->user = user= read_struct(fd, bhead, "user def"); - + /* User struct has separate do-version handling */ user->versionfile = bfd->main->versionfile; user->subversionfile = bfd->main->subversionfile; - + /* read all data into fd->datamap */ bhead = read_data_into_oldnewmap(fd, bhead, "user def"); - + if (user->keymaps.first) { /* backwards compatibility */ user->user_keymaps= user->keymaps; user->keymaps.first= user->keymaps.last= NULL; } - + link_list(fd, &user->themes); link_list(fd, &user->user_keymaps); link_list(fd, &user->addons); @@ -8686,20 +8686,20 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead) keymap->modal_items= NULL; keymap->poll = NULL; keymap->flag &= ~KEYMAP_UPDATE; - + link_list(fd, &keymap->diff_items); link_list(fd, &keymap->items); - + for (kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next) { kmdi->remove_item= newdataadr(fd, kmdi->remove_item); kmdi->add_item= newdataadr(fd, kmdi->add_item); - + if (kmdi->remove_item) direct_link_keymapitem(fd, kmdi->remove_item); if (kmdi->add_item) direct_link_keymapitem(fd, kmdi->add_item); } - + for (kmi=keymap->items.first; kmi; kmi=kmi->next) direct_link_keymapitem(fd, kmi); } @@ -8711,13 +8711,13 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead) // XXX user->uifonts.first = user->uifonts.last= NULL; - + link_list(fd, &user->uistyles); - + /* free fd->datamap again */ oldnewmap_free_unused(fd->datamap); oldnewmap_clear(fd->datamap); - + return bhead; } @@ -8726,14 +8726,14 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) BHead *bhead = blo_firstbhead(fd); BlendFileData *bfd; ListBase mainlist = {NULL, NULL}; - + bfd = MEM_callocN(sizeof(BlendFileData), "blendfiledata"); bfd->main = BKE_main_new(); BLI_addtail(&mainlist, bfd->main); fd->mainlist = &mainlist; - + bfd->main->versionfile = fd->fileversion; - + bfd->type = BLENFILETYPE_BLEND; BLI_strncpy(bfd->main->name, filepath, sizeof(bfd->main->name)); @@ -8783,7 +8783,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) case ENDB: bhead = NULL; break; - + case ID_ID: /* Always adds to the most recently loaded ID_LI block, see direct_link_library. * This is part of the file format definition. */ @@ -8808,17 +8808,17 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) } } } - + /* do before read_libraries, but skip undo case */ if (fd->memfile == NULL) { do_versions(fd, NULL, bfd->main); do_versions_userdef(fd, bfd); } - + read_libraries(fd, &mainlist); - + blo_join_main(&mainlist); - + lib_link_all(fd, bfd->main); /* Skip in undo case. */ @@ -8844,9 +8844,9 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) lib_verify_nodetree(bfd->main, true); fix_relpaths_library(fd->relabase, bfd->main); /* make all relative paths, relative to the open blend file */ - + link_global(fd, bfd); /* as last */ - + fd->mainlist = NULL; /* Safety, this is local variable, shall not be used afterward. */ return bfd; @@ -8862,7 +8862,7 @@ struct BHeadSort { static int verg_bheadsort(const void *v1, const void *v2) { const struct BHeadSort *x1=v1, *x2=v2; - + if (x1->old > x2->old) return 1; else if (x1->old < x2->old) return -1; return 0; @@ -8873,20 +8873,20 @@ static void sort_bhead_old_map(FileData *fd) BHead *bhead; struct BHeadSort *bhs; int tot = 0; - + for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) tot++; - + fd->tot_bheadmap = tot; if (tot == 0) return; - + bhs = fd->bheadmap = MEM_malloc_arrayN(tot, sizeof(struct BHeadSort), "BHeadSort"); - + for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead), bhs++) { bhs->bhead = bhead; bhs->old = bhead->old; } - + qsort(fd->bheadmap, tot, sizeof(struct BHeadSort), verg_bheadsort); } @@ -8910,19 +8910,19 @@ static BHead *find_bhead(FileData *fd, void *old) BHead *bhead; #endif struct BHeadSort *bhs, bhs_s; - + if (!old) return NULL; if (fd->bheadmap == NULL) sort_bhead_old_map(fd); - + bhs_s.old = old; bhs = bsearch(&bhs_s, fd->bheadmap, fd->tot_bheadmap, sizeof(struct BHeadSort), verg_bheadsort); if (bhs) return bhs->bhead; - + #if 0 for (bhead = blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) { if (bhead->old == old) @@ -8984,32 +8984,32 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old) BHead *bhead; FileData *fd = fdhandle; ID *id; - + bhead = find_bhead(fd, old); if (bhead) { /* from another library? */ if (bhead->code == ID_ID) { BHead *bheadlib= find_previous_lib(fd, bhead); - + if (bheadlib) { Library *lib = read_struct(fd, bheadlib, "Library"); Main *ptr = blo_find_main(fd, lib->name, fd->relabase); - + if (ptr->curlib == NULL) { const char *idname= bhead_id_name(fd, bhead); - + blo_reportf_wrap(fd->reports, RPT_WARNING, TIP_("LIB: Data refers to main .blend file: '%s' from %s"), idname, mainvar->curlib->filepath); return; } else id = is_yet_read(fd, ptr, bhead); - + if (id == NULL) { read_libblock(fd, ptr, bhead, LIB_TAG_READ | LIB_TAG_INDIRECT, NULL); // commented because this can print way too much // if (G.debug & G_DEBUG) printf("expand_doit: other lib %s\n", lib->name); - + /* for outliner dependency only */ ptr->curlib->parent = mainvar->curlib; } @@ -9020,10 +9020,10 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old) * lib_indirect.blend but lib.blend does too, linking in a Scene or Group from lib.blend can result in an * empty without the dupli group referenced. Once you save and reload the group would appear. - Campbell */ /* This crashes files, must look further into it */ - + /* Update: the issue is that in file reading, the oldnewmap is OK, but for existing data, it has to be * inserted in the map to be found! */ - + /* Update: previously it was checking for id->tag & LIB_TAG_PRE_EXISTING, however that * does not affect file reading. For file reading we may need to insert it into the libmap as well, * because you might have two files indirectly linking the same datablock, and in that case @@ -9033,11 +9033,11 @@ static void expand_doit_library(void *fdhandle, Main *mainvar, void *old) * change_idid_adr not detect the mapping was for an ID_ID datablock. */ oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code); change_idid_adr_fd(fd, bhead->old, id); - + // commented because this can print way too much // if (G.debug & G_DEBUG) printf("expand_doit: already linked: %s lib: %s\n", id->name, lib->name); } - + MEM_freeN(lib); } } @@ -9119,14 +9119,14 @@ static void expand_idprops(FileData *fd, Main *mainvar, IDProperty *prop) static void expand_fmodifiers(FileData *fd, Main *mainvar, ListBase *list) { FModifier *fcm; - + for (fcm = list->first; fcm; fcm = fcm->next) { /* library data for specific F-Modifier types */ switch (fcm->type) { case FMODIFIER_TYPE_PYTHON: { FMod_Python *data = (FMod_Python *)fcm->data; - + expand_doit(fd, mainvar, data->script); break; @@ -9138,15 +9138,15 @@ static void expand_fmodifiers(FileData *fd, Main *mainvar, ListBase *list) static void expand_fcurves(FileData *fd, Main *mainvar, ListBase *list) { FCurve *fcu; - + for (fcu = list->first; fcu; fcu = fcu->next) { /* Driver targets if there is a driver */ if (fcu->driver) { ChannelDriver *driver = fcu->driver; DriverVar *dvar; - + for (dvar = driver->variables.first; dvar; dvar = dvar->next) { - DRIVER_TARGETS_LOOPER(dvar) + DRIVER_TARGETS_LOOPER(dvar) { // TODO: only expand those that are going to get used? expand_doit(fd, mainvar, dtar->id); @@ -9154,7 +9154,7 @@ static void expand_fcurves(FileData *fd, Main *mainvar, ListBase *list) DRIVER_TARGETS_LOOPER_END } } - + /* F-Curve Modifiers */ expand_fmodifiers(fd, mainvar, &fcu->modifiers); } @@ -9163,14 +9163,14 @@ static void expand_fcurves(FileData *fd, Main *mainvar, ListBase *list) static void expand_action(FileData *fd, Main *mainvar, bAction *act) { bActionChannel *chan; - + // XXX deprecated - old animation system -------------- for (chan=act->chanbase.first; chan; chan=chan->next) { expand_doit(fd, mainvar, chan->ipo); expand_constraint_channels(fd, mainvar, &chan->constraintChannels); } // --------------------------------------------------- - + /* F-Curves in Action */ expand_fcurves(fd, mainvar, &act->curves); @@ -9185,7 +9185,7 @@ static void expand_keyingsets(FileData *fd, Main *mainvar, ListBase *list) { KeyingSet *ks; KS_Path *ksp; - + /* expand the ID-pointers in KeyingSets's paths */ for (ks = list->first; ks; ks = ks->next) { for (ksp = ks->paths.first; ksp; ksp = ksp->next) { @@ -9197,17 +9197,17 @@ static void expand_keyingsets(FileData *fd, Main *mainvar, ListBase *list) static void expand_animdata_nlastrips(FileData *fd, Main *mainvar, ListBase *list) { NlaStrip *strip; - + for (strip= list->first; strip; strip= strip->next) { /* check child strips */ expand_animdata_nlastrips(fd, mainvar, &strip->strips); - + /* check F-Curves */ expand_fcurves(fd, mainvar, &strip->fcurves); - + /* check F-Modifiers */ expand_fmodifiers(fd, mainvar, &strip->modifiers); - + /* relink referenced action */ expand_doit(fd, mainvar, strip->act); } @@ -9216,32 +9216,32 @@ static void expand_animdata_nlastrips(FileData *fd, Main *mainvar, ListBase *lis static void expand_animdata(FileData *fd, Main *mainvar, AnimData *adt) { NlaTrack *nlt; - + /* own action */ expand_doit(fd, mainvar, adt->action); expand_doit(fd, mainvar, adt->tmpact); - + /* drivers - assume that these F-Curves have driver data to be in this list... */ expand_fcurves(fd, mainvar, &adt->drivers); - + /* nla-data - referenced actions */ - for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) + for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) expand_animdata_nlastrips(fd, mainvar, &nlt->strips); -} +} static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSettings *part) { int a; - + expand_doit(fd, mainvar, part->dup_ob); expand_doit(fd, mainvar, part->dup_group); expand_doit(fd, mainvar, part->eff_group); expand_doit(fd, mainvar, part->bb_ob); expand_doit(fd, mainvar, part->collision_group); - + if (part->adt) expand_animdata(fd, mainvar, part->adt); - + for (a = 0; a < MAX_MTEX; a++) { if (part->mtex[a]) { expand_doit(fd, mainvar, part->mtex[a]->tex); @@ -9301,7 +9301,7 @@ static void expand_collection(FileData *fd, Main *mainvar, Collection *collectio static void expand_key(FileData *fd, Main *mainvar, Key *key) { expand_doit(fd, mainvar, key->ipo); // XXX deprecated - old animation system - + if (key->adt) expand_animdata(fd, mainvar, key->adt); } @@ -9310,13 +9310,13 @@ static void expand_nodetree(FileData *fd, Main *mainvar, bNodeTree *ntree) { bNode *node; bNodeSocket *sock; - + if (ntree->adt) expand_animdata(fd, mainvar, ntree->adt); - + if (ntree->gpd) expand_doit(fd, mainvar, ntree->gpd); - + for (node = ntree->nodes.first; node; node = node->next) { if (node->id && node->type != CMP_NODE_R_LAYERS) { expand_doit(fd, mainvar, node->id); @@ -9340,10 +9340,10 @@ static void expand_texture(FileData *fd, Main *mainvar, Tex *tex) { expand_doit(fd, mainvar, tex->ima); expand_doit(fd, mainvar, tex->ipo); // XXX deprecated - old animation system - + if (tex->adt) expand_animdata(fd, mainvar, tex->adt); - + if (tex->nodetree) expand_nodetree(fd, mainvar, tex->nodetree); } @@ -9359,10 +9359,10 @@ static void expand_brush(FileData *fd, Main *mainvar, Brush *brush) static void expand_material(FileData *fd, Main *mainvar, Material *ma) { expand_doit(fd, mainvar, ma->ipo); // XXX deprecated - old animation system - + if (ma->adt) expand_animdata(fd, mainvar, ma->adt); - + if (ma->nodetree) expand_nodetree(fd, mainvar, ma->nodetree); } @@ -9370,10 +9370,10 @@ static void expand_material(FileData *fd, Main *mainvar, Material *ma) static void expand_lamp(FileData *fd, Main *mainvar, Lamp *la) { expand_doit(fd, mainvar, la->ipo); // XXX deprecated - old animation system - + if (la->adt) expand_animdata(fd, mainvar, la->adt); - + if (la->nodetree) expand_nodetree(fd, mainvar, la->nodetree); } @@ -9382,7 +9382,7 @@ static void expand_lattice(FileData *fd, Main *mainvar, Lattice *lt) { expand_doit(fd, mainvar, lt->ipo); // XXX deprecated - old animation system expand_doit(fd, mainvar, lt->key); - + if (lt->adt) expand_animdata(fd, mainvar, lt->adt); } @@ -9391,10 +9391,10 @@ static void expand_lattice(FileData *fd, Main *mainvar, Lattice *lt) static void expand_world(FileData *fd, Main *mainvar, World *wrld) { expand_doit(fd, mainvar, wrld->ipo); // XXX deprecated - old animation system - + if (wrld->adt) expand_animdata(fd, mainvar, wrld->adt); - + if (wrld->nodetree) expand_nodetree(fd, mainvar, wrld->nodetree); } @@ -9403,11 +9403,11 @@ static void expand_world(FileData *fd, Main *mainvar, World *wrld) static void expand_mball(FileData *fd, Main *mainvar, MetaBall *mb) { int a; - + for (a = 0; a < mb->totcol; a++) { expand_doit(fd, mainvar, mb->mat[a]); } - + if (mb->adt) expand_animdata(fd, mainvar, mb->adt); } @@ -9415,11 +9415,11 @@ static void expand_mball(FileData *fd, Main *mainvar, MetaBall *mb) static void expand_curve(FileData *fd, Main *mainvar, Curve *cu) { int a; - + for (a = 0; a < cu->totcol; a++) { expand_doit(fd, mainvar, cu->mat[a]); } - + expand_doit(fd, mainvar, cu->vfont); expand_doit(fd, mainvar, cu->vfontb); expand_doit(fd, mainvar, cu->vfonti); @@ -9429,7 +9429,7 @@ static void expand_curve(FileData *fd, Main *mainvar, Curve *cu) expand_doit(fd, mainvar, cu->bevobj); expand_doit(fd, mainvar, cu->taperobj); expand_doit(fd, mainvar, cu->textoncurve); - + if (cu->adt) expand_animdata(fd, mainvar, cu->adt); } @@ -9437,14 +9437,14 @@ static void expand_curve(FileData *fd, Main *mainvar, Curve *cu) static void expand_mesh(FileData *fd, Main *mainvar, Mesh *me) { int a; - + if (me->adt) expand_animdata(fd, mainvar, me->adt); - + for (a = 0; a < me->totcol; a++) { expand_doit(fd, mainvar, me->mat[a]); } - + expand_doit(fd, mainvar, me->key); expand_doit(fd, mainvar, me->texcomesh); } @@ -9465,13 +9465,13 @@ static void expand_constraints(FileData *fd, Main *mainvar, ListBase *lb) { tConstraintExpandData ced; bConstraint *curcon; - + /* relink all ID-blocks used by the constraints */ ced.fd = fd; ced.mainvar = mainvar; - + BKE_constraints_id_loop(lb, expand_constraint_cb, &ced); - + /* deprecated manual expansion stuff */ for (curcon = lb->first; curcon; curcon = curcon->next) { if (curcon->ipo) @@ -9482,10 +9482,10 @@ static void expand_constraints(FileData *fd, Main *mainvar, ListBase *lb) static void expand_pose(FileData *fd, Main *mainvar, bPose *pose) { bPoseChannel *chan; - + if (!pose) return; - + for (chan = pose->chanbase.first; chan; chan = chan->next) { expand_constraints(fd, mainvar, &chan->constraints); expand_idprops(fd, mainvar, chan->prop); @@ -9516,10 +9516,10 @@ static void expand_object_expandModifiers( void *userData, Object *UNUSED(ob), ID **idpoin, int UNUSED(cb_flag)) { struct { FileData *fd; Main *mainvar; } *data= userData; - + FileData *fd = data->fd; Main *mainvar = data->mainvar; - + expand_doit(fd, mainvar, *idpoin); } @@ -9529,56 +9529,56 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob) bActionStrip *strip; PartEff *paf; int a; - + expand_doit(fd, mainvar, ob->data); - + /* expand_object_expandModifier() */ if (ob->modifiers.first) { struct { FileData *fd; Main *mainvar; } data; data.fd = fd; data.mainvar = mainvar; - + modifiers_foreachIDLink(ob, expand_object_expandModifiers, (void *)&data); } - + expand_pose(fd, mainvar, ob->pose); expand_doit(fd, mainvar, ob->poselib); expand_constraints(fd, mainvar, &ob->constraints); - + expand_doit(fd, mainvar, ob->gpd); - + // XXX deprecated - old animation system (for version patching only) expand_doit(fd, mainvar, ob->ipo); expand_doit(fd, mainvar, ob->action); - + expand_constraint_channels(fd, mainvar, &ob->constraintChannels); - + for (strip=ob->nlastrips.first; strip; strip=strip->next) { expand_doit(fd, mainvar, strip->object); expand_doit(fd, mainvar, strip->act); expand_doit(fd, mainvar, strip->ipo); } // XXX deprecated - old animation system (for version patching only) - + if (ob->adt) expand_animdata(fd, mainvar, ob->adt); - + for (a = 0; a < ob->totcol; a++) { expand_doit(fd, mainvar, ob->mat[a]); } - + paf = blo_do_version_give_parteff_245(ob); - if (paf && paf->group) + if (paf && paf->group) expand_doit(fd, mainvar, paf->group); - + if (ob->dup_group) expand_doit(fd, mainvar, ob->dup_group); - + if (ob->proxy) expand_doit(fd, mainvar, ob->proxy); if (ob->proxy_group) expand_doit(fd, mainvar, ob->proxy_group); - + for (psys = ob->particlesystem.first; psys; psys = psys->next) expand_doit(fd, mainvar, psys->part); @@ -9626,23 +9626,23 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) SceneRenderLayer *srl; FreestyleModuleConfig *module; FreestyleLineSet *lineset; - + for (Base *base_legacy = sce->base.first; base_legacy; base_legacy = base_legacy->next) { expand_doit(fd, mainvar, base_legacy->object); } expand_doit(fd, mainvar, sce->camera); expand_doit(fd, mainvar, sce->world); - + if (sce->adt) expand_animdata(fd, mainvar, sce->adt); expand_keyingsets(fd, mainvar, &sce->keyingsets); - + if (sce->set) expand_doit(fd, mainvar, sce->set); - + if (sce->nodetree) expand_nodetree(fd, mainvar, sce->nodetree); - + for (srl = sce->r.layers.first; srl; srl = srl->next) { expand_doit(fd, mainvar, srl->mat_override); for (module = srl->freestyleConfig.modules.first; module; module = module->next) { @@ -9675,10 +9675,10 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) if (sce->gpd) expand_doit(fd, mainvar, sce->gpd); - + if (sce->ed) { Sequence *seq; - + SEQ_BEGIN (sce->ed, seq) { expand_idprops(fd, mainvar, seq->prop); @@ -9691,7 +9691,7 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) } SEQ_END } - + if (sce->rigidbody_world) { expand_doit(fd, mainvar, sce->rigidbody_world->group); expand_doit(fd, mainvar, sce->rigidbody_world->constraints); @@ -9719,7 +9719,7 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) static void expand_camera(FileData *fd, Main *mainvar, Camera *ca) { expand_doit(fd, mainvar, ca->ipo); // XXX deprecated - old animation system - + if (ca->adt) expand_animdata(fd, mainvar, ca->adt); } @@ -9856,10 +9856,10 @@ void BLO_expand_main(void *fdhandle, Main *mainvar) ID *id; int a; bool do_it = true; - + while (do_it) { do_it = false; - + a = set_listbasepointers(mainvar, lbarray); while (a--) { id = lbarray[a]->first; @@ -9955,10 +9955,10 @@ void BLO_expand_main(void *fdhandle, Main *mainvar) default: break; } - + do_it = true; id->tag &= ~LIB_TAG_NEED_EXPAND; - + } id = id->next; } @@ -9968,17 +9968,17 @@ void BLO_expand_main(void *fdhandle, Main *mainvar) /* ***************************** */ - + static bool object_in_any_scene(Main *bmain, Object *ob) { Scene *sce; - + for (sce = bmain->scene.first; sce; sce = sce->id.next) { if (BKE_scene_object_find(sce, ob)) { return true; } } - + return false; } @@ -10148,10 +10148,10 @@ static ID *link_named_part( else { id = NULL; } - + /* if we found the id but the id is NULL, this is really bad */ BLI_assert(!((bhead != NULL) && (id == NULL))); - + return id; } @@ -10188,7 +10188,7 @@ void BLO_library_link_copypaste(Main *mainl, BlendHandle *bh) { FileData *fd = (FileData *)(bh); BHead *bhead; - + for (bhead = blo_firstbhead(fd); bhead; bhead = blo_nextbhead(fd, bhead)) { ID *id = NULL; @@ -10319,23 +10319,23 @@ static Main *library_link_begin(Main *mainvar, FileData **fd, const char *filepa Main *mainl; (*fd)->mainlist = MEM_callocN(sizeof(ListBase), "FileData.mainlist"); - + /* clear for collection instantiating tag */ BKE_main_id_tag_listbase(&(mainvar->collection), LIB_TAG_DOIT, false); /* make mains */ blo_split_main((*fd)->mainlist, mainvar); - + /* which one do we need? */ mainl = blo_find_main(*fd, filepath, BKE_main_blendfile_path(mainvar)); - + /* needed for do_version */ mainl->versionfile = (*fd)->fileversion; read_file_version(*fd, mainl); #ifdef USE_GHASH_BHEAD read_file_bhead_idname_map_create(*fd); #endif - + return mainl; } @@ -10485,11 +10485,11 @@ static int mainvar_id_tag_any_check(Main *mainvar, const short tag) { ListBase *lbarray[MAX_LIBARRAY]; int a; - + a = set_listbasepointers(mainvar, lbarray); while (a--) { ID *id; - + for (id = lbarray[a]->first; id; id = id->next) { if (id->tag & tag) { return true; @@ -10507,13 +10507,13 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) GHash *loaded_ids = BLI_ghash_str_new(__func__); int a; bool do_it = true; - + /* expander now is callback function */ BLO_main_expander(expand_doit_library); - + while (do_it) { do_it = false; - + /* test 1: read libdata */ mainptr= mainl->next; while (mainptr) { @@ -10521,22 +10521,22 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) // printf("found LIB_TAG_READ %s (%s)\n", mainptr->curlib->id.name, mainptr->curlib->name); FileData *fd = mainptr->curlib->filedata; - + if (fd == NULL) { - + /* printf and reports for now... its important users know this */ - + /* if packed file... */ if (mainptr->curlib->packedfile) { PackedFile *pf = mainptr->curlib->packedfile; - + blo_reportf_wrap( basefd->reports, RPT_INFO, TIP_("Read packed library: '%s', parent '%s'"), mainptr->curlib->name, library_parent_filepath(mainptr->curlib)); fd = blo_openblendermemory(pf->data, pf->size, basefd->reports); - - + + /* needed for library_append and read_libraries */ BLI_strncpy(fd->relabase, mainptr->curlib->filepath, sizeof(fd->relabase)); } @@ -10557,12 +10557,12 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) printf(" absolute lib: %s\n", mainptr->curlib->filepath); printf(" relative lib: %s\n", mainptr->curlib->name); printf(" enter a new path:\n"); - + if (scanf("%1023s", newlib_path) > 0) { /* Warning, keep length in sync with FILE_MAX! */ BLI_strncpy(mainptr->curlib->name, newlib_path, sizeof(mainptr->curlib->name)); BLI_strncpy(mainptr->curlib->filepath, newlib_path, sizeof(mainptr->curlib->filepath)); BLI_cleanup_path(BKE_main_blendfile_path_from_global(), mainptr->curlib->filepath); - + fd = blo_openblenderfile(mainptr->curlib->filepath, basefd->reports); if (fd) { @@ -10572,7 +10572,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) } } } - + if (fd) { /* share the mainlist, so all libraries are added immediately in a * single list. it used to be that all FileData's had their own list, @@ -10581,15 +10581,15 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) fd->mainlist = mainlist; fd->reports = basefd->reports; - + if (fd->libmap) oldnewmap_free(fd->libmap); - + fd->libmap = oldnewmap_new(); - + mainptr->curlib->filedata = fd; mainptr->versionfile= fd->fileversion; - + /* subversion */ read_file_version(fd, mainptr); #ifdef USE_GHASH_BHEAD @@ -10604,7 +10604,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) mainptr->versionfile = mainptr->curlib->versionfile = mainl->versionfile; mainptr->subversionfile = mainptr->curlib->subversionfile = mainl->subversionfile; } - + if (fd == NULL) { blo_reportf_wrap(basefd->reports, RPT_WARNING, TIP_("Cannot find lib '%s'"), mainptr->curlib->filepath); @@ -10651,7 +10651,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) } BLO_expand_main(fd, mainptr); } - + mainptr = mainptr->next; } } @@ -10665,7 +10665,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) a = set_listbasepointers(mainptr, lbarray); while (a--) { ID *id, *idn = NULL; - + for (id = lbarray[a]->first; id; id = idn) { idn = id->next; if (id->tag & LIB_TAG_READ) { @@ -10680,13 +10680,13 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) mainptr->curlib->filepath, library_parent_filepath(mainptr->curlib)); change_idid_adr(mainlist, basefd, id, NULL); - + MEM_freeN(id); } } } } - + /* do versions, link, and free */ Main *main_newid = BKE_main_new(); for (mainptr = mainl->next; mainptr; mainptr = mainptr->next) { @@ -10702,10 +10702,10 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) add_main_to_main(mainptr, main_newid); } - + if (mainptr->curlib->filedata) lib_link_all(mainptr->curlib->filedata, mainptr); - + if (mainptr->curlib->filedata) blo_freefiledata(mainptr->curlib->filedata); mainptr->curlib->filedata = NULL; } @@ -10722,17 +10722,17 @@ BlendFileData *blo_read_blendafterruntime(int file, const char *name, int actual fd->filedes = file; fd->buffersize = actualsize; fd->read = fd_read_from_file; - + /* needed for library_append and read_libraries */ BLI_strncpy(fd->relabase, name, sizeof(fd->relabase)); - + fd = blo_decode_and_check(fd, reports); if (!fd) return NULL; - + fd->reports = reports; bfd = blo_read_file_internal(fd, ""); blo_freefiledata(fd); - + return bfd; } diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index 7618c023882..65938c88192 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -66,23 +66,23 @@ typedef struct FileData { // now only in use for library appending char relabase[FILE_MAX]; - + // variables needed for reading from stream char headerdone; int inbuffer; - + // gzip stream for memory decompression z_stream strm; - + // general reading variables struct SDNA *filesdna; const struct SDNA *memsdna; const char *compflags; /* array of eSDNA_StructCompare */ - + int fileversion; int id_name_offs; /* used to retrieve ID names from (bhead+1) */ int globalf, fileflags; /* for do_versions patching */ - + eBLOReadSkip skip_flags; /* skip some data-blocks */ struct OldNewMap *datamap; @@ -92,13 +92,13 @@ typedef struct FileData { struct OldNewMap *movieclipmap; struct OldNewMap *soundmap; struct OldNewMap *packedmap; - + struct BHeadSort *bheadmap; int tot_bheadmap; /* see: USE_GHASH_BHEAD */ struct GHash *bhead_idname_hash; - + ListBase *mainlist; ListBase *old_mainlist; /* Used for undo. */ diff --git a/source/blender/blenloader/intern/runtime.c b/source/blender/blenloader/intern/runtime.c index ec496e1c866..ec0e8ba4738 100644 --- a/source/blender/blenloader/intern/runtime.c +++ b/source/blender/blenloader/intern/runtime.c @@ -73,9 +73,9 @@ int BLO_is_a_runtime(const char *path) if (fd == -1) goto cleanup; - + lseek(fd, -12, SEEK_END); - + datastart = handle_read_msb_int(fd); if (datastart == -1) @@ -107,7 +107,7 @@ BlendFileData *BLO_read_runtime(const char *path, ReportList *reports) BKE_reportf(reports, RPT_ERROR, "Unable to open '%s': %s", path, strerror(errno)); goto cleanup; } - + actualsize = BLI_file_descriptor_size(fd); lseek(fd, -12, SEEK_END); @@ -132,11 +132,11 @@ BlendFileData *BLO_read_runtime(const char *path, ReportList *reports) bfd = blo_read_blendafterruntime(fd, path, actualsize - datastart, reports); fd = -1; // file was closed in blo_read_blendafterruntime() } - + cleanup: if (fd != -1) close(fd); - + return bfd; } diff --git a/source/blender/blenloader/intern/undofile.c b/source/blender/blenloader/intern/undofile.c index e1ae267ea11..614a3be559b 100644 --- a/source/blender/blenloader/intern/undofile.c +++ b/source/blender/blenloader/intern/undofile.c @@ -64,7 +64,7 @@ void BLO_memfile_free(MemFile *memfile) { MemFileChunk *chunk; - + while ((chunk = BLI_pophead(&memfile->chunks))) { if (chunk->is_identical == false) { MEM_freeN((void *)chunk->buf); @@ -79,7 +79,7 @@ void BLO_memfile_free(MemFile *memfile) void BLO_memfile_merge(MemFile *first, MemFile *second) { MemFileChunk *fc, *sc; - + fc = first->chunks.first; sc = second->chunks.first; while (fc || sc) { @@ -92,7 +92,7 @@ void BLO_memfile_merge(MemFile *first, MemFile *second) if (fc) fc = fc->next; if (sc) sc = sc->next; } - + BLO_memfile_free(first); } diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index d51289bee43..973591c49da 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -582,7 +582,7 @@ static bNodeSocket *do_versions_node_group_add_socket_2_56_2(bNodeTree *ngroup, { // bNodeSocketType *stype = ntreeGetSocketType(type); bNodeSocket *gsock = MEM_callocN(sizeof(bNodeSocket), "bNodeSocket"); - + BLI_strncpy(gsock->name, name, sizeof(gsock->name)); gsock->type = type; @@ -592,14 +592,14 @@ static bNodeSocket *do_versions_node_group_add_socket_2_56_2(bNodeTree *ngroup, /* assign new unique index */ gsock->own_index = ngroup->cur_index++; gsock->limit = (in_out==SOCK_IN ? 0xFFF : 1); - + // if (stype->value_structsize > 0) // gsock->default_value = MEM_callocN(stype->value_structsize, "default socket value"); - + BLI_addtail(in_out==SOCK_IN ? &ngroup->inputs : &ngroup->outputs, gsock); - + ngroup->update |= (in_out==SOCK_IN ? NTREE_UPDATE_GROUP_IN : NTREE_UPDATE_GROUP_OUT); - + return gsock; } @@ -615,10 +615,10 @@ static void do_versions_socket_default_value_259(bNodeSocket *sock) bNodeSocketValueFloat *valfloat; bNodeSocketValueVector *valvector; bNodeSocketValueRGBA *valrgba; - + if (sock->default_value) return; - + switch (sock->type) { case SOCK_FLOAT: valfloat = sock->default_value = MEM_callocN(sizeof(bNodeSocketValueFloat), "default socket value"); @@ -1934,13 +1934,13 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) bNode *node; bNodeSocket *sock, *gsock; bNodeLink *link; - + /* node sockets are not exposed automatically any more, * this mimics the old behavior by adding all unlinked sockets to groups. */ for (ntree=bmain->nodetree.first; ntree; ntree=ntree->id.next) { /* this adds copies and links from all unlinked internal sockets to group inputs/outputs. */ - + /* first make sure the own_index for new sockets is valid */ for (node=ntree->nodes.first; node; node=node->next) { for (sock = node->inputs.first; sock; sock = sock->next) @@ -1950,17 +1950,17 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) if (sock->own_index >= ntree->cur_index) ntree->cur_index = sock->own_index+1; } - + /* add ntree->inputs/ntree->outputs sockets for all unlinked sockets in the group tree. */ for (node=ntree->nodes.first; node; node=node->next) { for (sock = node->inputs.first; sock; sock = sock->next) { if (!sock->link && !nodeSocketIsHidden(sock)) { - + gsock = do_versions_node_group_add_socket_2_56_2(ntree, sock->name, sock->type, SOCK_IN); - + /* initialize the default socket value */ copy_v4_v4(gsock->ns.vec, sock->ns.vec); - + /* XXX nodeAddLink does not work with incomplete (node==NULL) links any longer, * have to create these directly here. These links are updated again in subsequent do_version! */ @@ -1971,17 +1971,17 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) link->tonode = node; link->tosock = sock; ntree->update |= NTREE_UPDATE_LINKS; - + sock->link = link; } } for (sock = node->outputs.first; sock; sock = sock->next) { if (nodeCountSocketLinks(ntree, sock)==0 && !nodeSocketIsHidden(sock)) { gsock = do_versions_node_group_add_socket_2_56_2(ntree, sock->name, sock->type, SOCK_OUT); - + /* initialize the default socket value */ copy_v4_v4(gsock->ns.vec, sock->ns.vec); - + /* XXX nodeAddLink does not work with incomplete (node==NULL) links any longer, * have to create these directly here. These links are updated again in subsequent do_version! */ @@ -1992,12 +1992,12 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) link->tonode = NULL; link->tosock = gsock; ntree->update |= NTREE_UPDATE_LINKS; - + gsock->link = link; } } } - + /* XXX The external group node sockets needs to adjust their own_index to point at * associated ntree inputs/outputs internal sockets. However, this can only happen * after lib-linking (needs access to internal node group tree)! @@ -2203,19 +2203,19 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) FOREACH_NODETREE(bmain, ntree, id) { bNode *node; bNodeSocket *sock; - + for (node=ntree->nodes.first; node; node=node->next) { for (sock = node->inputs.first; sock; sock = sock->next) do_versions_socket_default_value_259(sock); for (sock = node->outputs.first; sock; sock = sock->next) do_versions_socket_default_value_259(sock); } - + for (sock = ntree->inputs.first; sock; sock = sock->next) do_versions_socket_default_value_259(sock); for (sock = ntree->outputs.first; sock; sock = sock->next) do_versions_socket_default_value_259(sock); - + ntree->update |= NTREE_UPDATE; } FOREACH_NODETREE_END diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index 2cded68f7ec..c405e385e9f 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -2438,10 +2438,10 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } - + if (!MAIN_VERSION_ATLEAST(bmain, 269, 9)) { Object *ob; - + for (ob = bmain->object.first; ob; ob = ob->id.next) { ModifierData *md; for (md = ob->modifiers.first; md; md = md->next) { diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 7f5646eddc2..7a106611e64 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -171,7 +171,7 @@ static void do_version_constraints_stretch_to_limits(ListBase *lb) static void do_version_action_editor_properties_region(ListBase *regionbase) { ARegion *ar; - + for (ar = regionbase->first; ar; ar = ar->next) { if (ar->regiontype == RGN_TYPE_UI) { /* already exists */ @@ -180,13 +180,13 @@ static void do_version_action_editor_properties_region(ListBase *regionbase) else if (ar->regiontype == RGN_TYPE_WINDOW) { /* add new region here */ ARegion *arnew = MEM_callocN(sizeof(ARegion), "buttons for action"); - + BLI_insertlinkbefore(regionbase, ar, arnew); - + arnew->regiontype = RGN_TYPE_UI; arnew->alignment = RGN_ALIGN_RIGHT; arnew->flag = RGN_FLAG_HIDDEN; - + return; } } @@ -197,7 +197,7 @@ static void do_version_bones_super_bbone(ListBase *lb) for (Bone *bone = lb->first; bone; bone = bone->next) { bone->scaleIn = 1.0f; bone->scaleOut = 1.0f; - + do_version_bones_super_bbone(&bone->childbase); } } @@ -289,7 +289,7 @@ static void do_versions_compositor_render_passes(bNodeTree *ntree) static char *replace_bbone_easing_rnapath(char *old_path) { char *new_path = NULL; - + /* NOTE: This will break paths for any bones/custom-properties * which happen be named after the bbone property id's */ @@ -297,7 +297,7 @@ static char *replace_bbone_easing_rnapath(char *old_path) new_path = BLI_str_replaceN(old_path, "bbone_in", "bbone_easein"); else if (strstr(old_path, "bbone_out")) new_path = BLI_str_replaceN(old_path, "bbone_out", "bbone_easeout"); - + if (new_path) { MEM_freeN(old_path); return new_path; @@ -313,7 +313,7 @@ static void do_version_bbone_easing_fcurve_fix(ID *UNUSED(id), FCurve *fcu, void if (fcu->rna_path) { fcu->rna_path = replace_bbone_easing_rnapath(fcu->rna_path); } - + /* Driver -> Driver Vars (for bbone_in/out) */ if (fcu->driver) { for (DriverVar *dvar = fcu->driver->variables.first; dvar; dvar = dvar->next) { @@ -326,13 +326,13 @@ static void do_version_bbone_easing_fcurve_fix(ID *UNUSED(id), FCurve *fcu, void DRIVER_TARGETS_LOOPER_END; } } - + /* FModifiers -> Stepped (for frame_start/end) */ if (fcu->modifiers.first) { for (FModifier *fcm = fcu->modifiers.first; fcm; fcm = fcm->next) { if (fcm->type == FMODIFIER_TYPE_STEPPED) { FMod_Stepped *data = fcm->data; - + /* Modifier doesn't work if the modifier's copy of start/end frame are both 0 * as those were only getting written to the fcm->data copy (T52009) */ @@ -656,7 +656,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } - + if (!MAIN_VERSION_ATLEAST(bmain, 273, 3)) { ParticleSettings *part; for (part = bmain->particle.first; part; part = part->id.next) { @@ -1040,63 +1040,63 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) if (!MAIN_VERSION_ATLEAST(bmain, 276, 4)) { for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) { ToolSettings *ts = scene->toolsettings; - + if (ts->gp_sculpt.brush[0].size == 0) { GP_BrushEdit_Settings *gset = &ts->gp_sculpt; GP_EditBrush_Data *brush; - + brush = &gset->brush[GP_EDITBRUSH_TYPE_SMOOTH]; brush->size = 25; brush->strength = 0.3f; brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF | GP_EDITBRUSH_FLAG_SMOOTH_PRESSURE; - + brush = &gset->brush[GP_EDITBRUSH_TYPE_THICKNESS]; brush->size = 25; brush->strength = 0.5f; brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF; - + brush = &gset->brush[GP_EDITBRUSH_TYPE_GRAB]; brush->size = 50; brush->strength = 0.3f; brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF; - + brush = &gset->brush[GP_EDITBRUSH_TYPE_PUSH]; brush->size = 25; brush->strength = 0.3f; brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF; - + brush = &gset->brush[GP_EDITBRUSH_TYPE_TWIST]; brush->size = 50; brush->strength = 0.3f; // XXX? brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF; - + brush = &gset->brush[GP_EDITBRUSH_TYPE_PINCH]; brush->size = 50; brush->strength = 0.5f; // XXX? brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF; - + brush = &gset->brush[GP_EDITBRUSH_TYPE_RANDOMIZE]; brush->size = 25; brush->strength = 0.5f; brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF; - + brush = &gset->brush[GP_EDITBRUSH_TYPE_CLONE]; brush->size = 50; brush->strength = 1.0f; } - + if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "char", "gpencil_v3d_align")) { #if 0 /* XXX: Cannot do this, as we get random crashes... */ if (scene->gpd) { bGPdata *gpd = scene->gpd; - + /* Copy over the settings stored in the GP datablock linked to the scene, for minimal disruption */ ts->gpencil_v3d_align = 0; - + if (gpd->flag & GP_DATA_VIEWALIGN) ts->gpencil_v3d_align |= GP_PROJECT_VIEWSPACE; if (gpd->flag & GP_DATA_DEPTH_VIEW) ts->gpencil_v3d_align |= GP_PROJECT_DEPTH_VIEW; if (gpd->flag & GP_DATA_DEPTH_STROKE) ts->gpencil_v3d_align |= GP_PROJECT_DEPTH_STROKE; - + if (gpd->flag & GP_DATA_DEPTH_STROKE_ENDPOINTS) ts->gpencil_v3d_align |= GP_PROJECT_DEPTH_STROKE_ENDPOINTS; } @@ -1105,17 +1105,17 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) ts->gpencil_v3d_align = GP_PROJECT_VIEWSPACE; } #endif - + ts->gpencil_v3d_align = GP_PROJECT_VIEWSPACE; ts->gpencil_v2d_align = GP_PROJECT_VIEWSPACE; ts->gpencil_seq_align = GP_PROJECT_VIEWSPACE; ts->gpencil_ima_align = GP_PROJECT_VIEWSPACE; } } - + for (bGPdata *gpd = bmain->gpencil.first; gpd; gpd = gpd->id.next) { bool enabled = false; - + /* Ensure that the datablock's onionskinning toggle flag * stays in sync with the status of the actual layers */ @@ -1124,7 +1124,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) enabled = true; } } - + if (enabled) gpd->flag |= GP_DATA_SHOW_ONIONSKINS; else @@ -1239,7 +1239,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) do_version_action_editor_properties_region(&saction->regionbase); } } - + /* active spacedata info must be handled too... */ if (sa->spacetype == SPACE_ACTION) { do_version_action_editor_properties_region(&sa->regionbase); @@ -1261,7 +1261,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) /* see do_version_bones_super_bbone()... */ pchan->scaleIn = 1.0f; pchan->scaleOut = 1.0f; - + /* also make sure some legacy (unused for over a decade) flags are unset, * so that we can reuse them for stuff that matters now... * (i.e. POSE_IK_MAT, (unknown/unused x 4), POSE_HAS_IK) @@ -1381,19 +1381,19 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) /* set color attributes */ copy_v4_v4(palcolor->color, gpl->color); copy_v4_v4(palcolor->fill, gpl->fill); - + if (gpl->flag & GP_LAYER_HIDE) palcolor->flag |= PC_COLOR_HIDE; if (gpl->flag & GP_LAYER_LOCKED) palcolor->flag |= PC_COLOR_LOCKED; if (gpl->flag & GP_LAYER_ONIONSKIN) palcolor->flag |= PC_COLOR_ONIONSKIN; if (gpl->flag & GP_LAYER_VOLUMETRIC) palcolor->flag |= PC_COLOR_VOLUMETRIC; if (gpl->flag & GP_LAYER_HQ_FILL) palcolor->flag |= PC_COLOR_HQ_FILL; - + /* set layer opacity to 1 */ gpl->opacity = 1.0f; - + /* set tint color */ ARRAY_SET_ITEMS(gpl->tintcolor, 0.0f, 0.0f, 0.0f, 0.0f); - + /* flush relevant layer-settings to strokes */ for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) { for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) { @@ -1402,7 +1402,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) gps->palcolor = NULL; gps->flag |= GP_STROKE_RECALC_COLOR; gps->thickness = gpl->thickness; - + /* set alpha strength to 1 */ for (int i = 0; i < gps->totpoints; i++) { gps->points[i].strength = 1.0f; @@ -1410,7 +1410,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } - + /* set thickness to 0 (now it is a factor to override stroke thickness) */ gpl->thickness = 0.0f; } @@ -1755,7 +1755,7 @@ void do_versions_after_linking_270(Main *bmain) } } FOREACH_NODETREE_END } - + if (!MAIN_VERSION_ATLEAST(bmain, 279, 2)) { /* B-Bones (bbone_in/out -> bbone_easein/out) + Stepped FMod Frame Start/End fix */ /* if (!DNA_struct_elem_find(fd->filesdna, "Bone", "float", "bbone_easein")) */ diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c index cbd6988655d..a500c562e20 100644 --- a/source/blender/blenloader/intern/versioning_defaults.c +++ b/source/blender/blenloader/intern/versioning_defaults.c @@ -149,7 +149,7 @@ void BLO_update_defaults_startup_blend(Main *bmain) sculpt->flags |= SCULPT_DYNTOPO_COLLAPSE; sculpt->detail_size = 12; } - + if (ts->vpaint) { VPaint *vp = ts->vpaint; vp->radial_symm[0] = vp->radial_symm[1] = vp->radial_symm[2] = 1; @@ -163,17 +163,17 @@ void BLO_update_defaults_startup_blend(Main *bmain) if (ts->gp_sculpt.brush[0].size == 0) { GP_BrushEdit_Settings *gset = &ts->gp_sculpt; GP_EditBrush_Data *brush; - + brush = &gset->brush[GP_EDITBRUSH_TYPE_SMOOTH]; brush->size = 25; brush->strength = 0.3f; brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF | GP_EDITBRUSH_FLAG_SMOOTH_PRESSURE; - + brush = &gset->brush[GP_EDITBRUSH_TYPE_THICKNESS]; brush->size = 25; brush->strength = 0.5f; brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF; - + brush = &gset->brush[GP_EDITBRUSH_TYPE_STRENGTH]; brush->size = 25; brush->strength = 0.5f; @@ -183,28 +183,28 @@ void BLO_update_defaults_startup_blend(Main *bmain) brush->size = 50; brush->strength = 0.3f; brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF; - + brush = &gset->brush[GP_EDITBRUSH_TYPE_PUSH]; brush->size = 25; brush->strength = 0.3f; brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF; - + brush = &gset->brush[GP_EDITBRUSH_TYPE_TWIST]; brush->size = 50; brush->strength = 0.3f; // XXX? brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF; - + brush = &gset->brush[GP_EDITBRUSH_TYPE_PINCH]; brush->size = 50; brush->strength = 0.5f; // XXX? brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF; - + brush = &gset->brush[GP_EDITBRUSH_TYPE_RANDOMIZE]; brush->size = 25; brush->strength = 0.5f; brush->flag = GP_EDITBRUSH_FLAG_USE_FALLOFF; } - + ts->gpencil_v3d_align = GP_PROJECT_VIEWSPACE; ts->gpencil_v2d_align = GP_PROJECT_VIEWSPACE; ts->gpencil_seq_align = GP_PROJECT_VIEWSPACE; @@ -219,7 +219,7 @@ void BLO_update_defaults_startup_blend(Main *bmain) } scene->r.ffcodecdata.audio_mixrate = 48000; - + /* set av sync by default */ scene->audio.flag |= AUDIO_SYNC; scene->flag &= ~SCE_FRAME_DROP; diff --git a/source/blender/compositor/intern/COM_ChunkOrder.h b/source/blender/compositor/intern/COM_ChunkOrder.h index 0310933e5c5..4728b771e3c 100644 --- a/source/blender/compositor/intern/COM_ChunkOrder.h +++ b/source/blender/compositor/intern/COM_ChunkOrder.h @@ -34,7 +34,7 @@ public: ChunkOrder(); void determineDistance(ChunkOrderHotspot **hotspots, unsigned int numberOfHotspots); friend bool operator<(const ChunkOrder &a, const ChunkOrder &b); - + void setChunkNumber(unsigned int chunknumber) { this->m_number = chunknumber; } void setX(int x) { this->m_x = x; } void setY(int y) { this->m_y = y; } diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h index d58e8502414..1c702503915 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.h +++ b/source/blender/compositor/intern/COM_CompositorContext.h @@ -126,7 +126,7 @@ public: * @brief get the scene of the context */ const RenderData *getRenderData() const { return this->m_rd; } - + void setScene(Scene *scene) { m_scene = scene; } Scene *getScene() const { return m_scene; } @@ -196,7 +196,7 @@ public: void setViewName(const char *viewName) { this->m_viewName = viewName; } int getChunksize() const { return this->getbNodeTree()->chunksize; } - + void setFastCalculation(bool fastCalculation) {this->m_fastCalculation = fastCalculation;} bool isFastCalculation() const { return this->m_fastCalculation; } bool isGroupnodeBufferEnabled() const { return (this->getbNodeTree()->flag & NTREE_COM_GROUPNODE_BUFFER) != 0; } diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp index 3d49443c146..58e0da04e5e 100644 --- a/source/blender/compositor/intern/COM_Converter.cpp +++ b/source/blender/compositor/intern/COM_Converter.cpp @@ -414,7 +414,7 @@ NodeOperation *Converter::convertDataType(NodeOperationOutput *from, NodeOperati { DataType fromDatatype = from->getDataType(); DataType toDatatype = to->getDataType(); - + if (fromDatatype == COM_DT_VALUE && toDatatype == COM_DT_COLOR) { return new ConvertValueToColorOperation(); } @@ -433,7 +433,7 @@ NodeOperation *Converter::convertDataType(NodeOperationOutput *from, NodeOperati else if (fromDatatype == COM_DT_VECTOR && toDatatype == COM_DT_COLOR) { return new ConvertVectorToColorOperation(); } - + return NULL; } diff --git a/source/blender/compositor/intern/COM_Converter.h b/source/blender/compositor/intern/COM_Converter.h index 7ed5616d899..b57220351e8 100644 --- a/source/blender/compositor/intern/COM_Converter.h +++ b/source/blender/compositor/intern/COM_Converter.h @@ -50,14 +50,14 @@ public: * @see Node */ static Node *convert(bNode *b_node); - + /** * @brief True if the node is considered 'fast'. * * Slow nodes will be skipped if fast execution is required. */ static bool is_fast_node(bNode *b_node); - + /** * @brief This method will add a datetype conversion rule when the to-socket does not support the from-socket actual data type. * @@ -68,7 +68,7 @@ public: * @see NodeLink - a link between two sockets */ static NodeOperation *convertDataType(NodeOperationOutput *from, NodeOperationInput *to); - + /** * @brief This method will add a resolution rule based on the settings of the NodeInput. * diff --git a/source/blender/compositor/intern/COM_Debug.cpp b/source/blender/compositor/intern/COM_Debug.cpp index b95b7500cca..6179bd26275 100644 --- a/source/blender/compositor/intern/COM_Debug.cpp +++ b/source/blender/compositor/intern/COM_Debug.cpp @@ -118,7 +118,7 @@ void DebugInfo::execution_group_finished(const ExecutionGroup *group) int DebugInfo::graphviz_operation(const ExecutionSystem *system, const NodeOperation *operation, const ExecutionGroup *group, char *str, int maxlen) { int len = 0; - + std::string fillcolor = "gainsboro"; if (operation->isViewerOperation()) { const ViewerOperation *viewer = (const ViewerOperation *)operation; @@ -141,14 +141,14 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system, const NodeOpera else if (operation->isWriteBufferOperation()) { fillcolor = "darkorange"; } - + len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "// OPERATION: %p\r\n", operation); if (group) len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "\"O_%p_%p\"", operation, group); else len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "\"O_%p\"", operation); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, " [fillcolor=%s,style=filled,shape=record,label=\"{", fillcolor.c_str()); - + int totinputs = operation->getNumberOfInputSockets(); if (totinputs != 0) { len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "{"); @@ -173,11 +173,11 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system, const NodeOpera len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "}"); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "|"); } - + len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "%s\\n(%s)", m_op_names[operation].c_str(), typeid(*operation).name()); - + len += snprintf(str + len, maxlen > len ? maxlen - len : 0, " (%u,%u)", operation->getWidth(), operation->getHeight()); - + int totoutputs = operation->getNumberOfOutputSockets(); if (totoutputs != 0) { len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "|"); @@ -204,7 +204,7 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system, const NodeOpera } len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "}\"]"); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "\r\n"); - + return len; } @@ -233,7 +233,7 @@ int DebugInfo::graphviz_legend_group(const char *name, const char *color, const int DebugInfo::graphviz_legend(char *str, int maxlen) { int len = 0; - + len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "{\r\n"); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "rank = sink;\r\n"); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "Legend [shape=none, margin=0, label=<\r\n"); @@ -266,12 +266,12 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma { char strbuf[64]; int len = 0; - + len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "digraph compositorexecution {\r\n"); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "ranksep=1.5\r\n"); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "rankdir=LR\r\n"); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "splines=false\r\n"); - + #if 0 for (ExecutionSystem::Operations::const_iterator it = system->m_operations.begin(); it != system->m_operations.end(); ++it) { @@ -279,13 +279,13 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "// OPERATION: %s\r\n", node->getbNode()->typeinfo->ui_name); } #endif - + int totops = system->m_operations.size(); int totgroups = system->m_groups.size(); std::map<NodeOperation *, std::vector<std::string> > op_groups; for (int i = 0; i < totgroups; ++i) { const ExecutionGroup *group = system->m_groups[i]; - + len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "// GROUP: %d\r\n", i); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "subgraph cluster_%d{\r\n", i); /* used as a check for executing group */ @@ -302,41 +302,41 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "color=black\r\n"); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "fillcolor=chartreuse4\r\n"); } - + for (ExecutionGroup::Operations::const_iterator it = group->m_operations.begin(); it != group->m_operations.end(); ++it) { NodeOperation *operation = *it; - + sprintf(strbuf, "_%p", group); op_groups[operation].push_back(std::string(strbuf)); - + len += graphviz_operation(system, operation, group, str + len, maxlen > len ? maxlen - len : 0); } - + // len += snprintf(str+len, maxlen>len ? maxlen-len : 0, "// OUTPUTOPERATION: %p\r\n", group->getOutputOperation()); // len += snprintf(str+len, maxlen>len ? maxlen-len : 0, " O_%p\r\n", group->getOutputOperation()); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "}\r\n"); } - + /* operations not included in any group */ for (int j = 0; j < totops; ++j) { NodeOperation *operation = system->m_operations[j]; if (op_groups.find(operation) != op_groups.end()) continue; - + op_groups[operation].push_back(std::string("")); - + len += graphviz_operation(system, operation, 0, str + len, maxlen > len ? maxlen - len : 0); } - + for (int i = 0; i < totops; i++) { NodeOperation *operation = system->m_operations[i]; - + if (operation->isReadBufferOperation()) { ReadBufferOperation *read = (ReadBufferOperation *)operation; WriteBufferOperation *write = read->getMemoryProxy()->getWriteBufferOperation(); std::vector<std::string> &read_groups = op_groups[read]; std::vector<std::string> &write_groups = op_groups[write]; - + for (int k = 0; k < write_groups.size(); ++k) { for (int l = 0; l < read_groups.size(); ++l) { len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "\"O_%p%s\" -> \"O_%p%s\" [style=dotted]\r\n", write, write_groups[k].c_str(), read, read_groups[l].c_str()); @@ -344,17 +344,17 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma } } } - + for (int i = 0; i < totops; i++) { NodeOperation *op = system->m_operations[i]; - + for (NodeOperation::Inputs::const_iterator it = op->m_inputs.begin(); it != op->m_inputs.end(); ++it) { NodeOperationInput *to = *it; NodeOperationOutput *from = to->getLink(); - + if (!from) continue; - + std::string color; switch (from->getDataType()) { case COM_DT_VALUE: @@ -367,12 +367,12 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma color = "orange"; break; } - + NodeOperation *to_op = &to->getOperation(); NodeOperation *from_op = &from->getOperation(); std::vector<std::string> &from_groups = op_groups[from_op]; std::vector<std::string> &to_groups = op_groups[to_op]; - + len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "// CONNECTION: %p.%p -> %p.%p\r\n", from_op, from, to_op, to); for (int k = 0; k < from_groups.size(); ++k) { @@ -385,11 +385,11 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma } } } - + len += graphviz_legend(str + len, maxlen > len ? maxlen - len : 0); - + len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "}\r\n"); - + return (len < maxlen); } @@ -399,11 +399,11 @@ void DebugInfo::graphviz(const ExecutionSystem *system) if (graphviz_system(system, str, sizeof(str) - 1)) { char basename[FILE_MAX]; char filename[FILE_MAX]; - + BLI_snprintf(basename, sizeof(basename), "compositor_%d.dot", m_file_index); BLI_join_dirfile(filename, sizeof(filename), BKE_tempdir_session(), basename); ++m_file_index; - + FILE *fp = BLI_fopen(filename, "wb"); fputs(str, fp); fclose(fp); diff --git a/source/blender/compositor/intern/COM_Debug.h b/source/blender/compositor/intern/COM_Debug.h index 4b4894d36cf..f5db93e8825 100644 --- a/source/blender/compositor/intern/COM_Debug.h +++ b/source/blender/compositor/intern/COM_Debug.h @@ -39,27 +39,27 @@ public: EG_RUNNING, EG_FINISHED } GroupState; - + typedef std::map<const Node *, std::string> NodeNameMap; typedef std::map<const NodeOperation *, std::string> OpNameMap; typedef std::map<const ExecutionGroup *, GroupState> GroupStateMap; - + static std::string node_name(const Node *node); static std::string operation_name(const NodeOperation *op); - + static void convert_started(); static void execute_started(const ExecutionSystem *system); - + static void node_added(const Node *node); static void node_to_operations(const Node *node); static void operation_added(const NodeOperation *operation); static void operation_read_write_buffer(const NodeOperation *operation); - + static void execution_group_started(const ExecutionGroup *group); static void execution_group_finished(const ExecutionGroup *group); - + static void graphviz(const ExecutionSystem *system); - + #ifdef COM_DEBUG protected: static int graphviz_operation(const ExecutionSystem *system, const NodeOperation *operation, const ExecutionGroup *group, char *str, int maxlen); @@ -68,7 +68,7 @@ protected: static int graphviz_legend_group(const char *name, const char *color, const char *style, char *str, int maxlen); static int graphviz_legend(char *str, int maxlen); static bool graphviz_system(const ExecutionSystem *system, char *str, int maxlen); - + private: static int m_file_index; static NodeNameMap m_node_names; /**< map nodes to usable names for debug output */ diff --git a/source/blender/compositor/intern/COM_Device.h b/source/blender/compositor/intern/COM_Device.h index 62653357fdf..4ab6e1e2f96 100644 --- a/source/blender/compositor/intern/COM_Device.h +++ b/source/blender/compositor/intern/COM_Device.h @@ -34,11 +34,11 @@ class Device { public: /** - * @brief Declaration of the virtual destructor + * @brief Declaration of the virtual destructor * @note resolve warning gcc 4.7 */ virtual ~Device() {} - + /** * @brief initialize the device */ diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp index 8a8193bcb62..5a651f07868 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp @@ -73,16 +73,16 @@ CompositorPriority ExecutionGroup::getRenderPriotrity() bool ExecutionGroup::canContainOperation(NodeOperation *operation) { if (!this->m_initialized) { return true; } - + if (operation->isReadBufferOperation()) { return true; } if (operation->isWriteBufferOperation()) { return false; } if (operation->isSetOperation()) { return true; } - + /* complex groups don't allow further ops (except read buffer and values, see above) */ if (m_complex) { return false; } /* complex ops can't be added to other groups (except their own, which they initialize, see above) */ if (operation->isComplex()) { return false; } - + return true; } @@ -90,16 +90,16 @@ bool ExecutionGroup::addOperation(NodeOperation *operation) { if (!canContainOperation(operation)) return false; - + if (!operation->isReadBufferOperation() && !operation->isWriteBufferOperation()) { m_complex = operation->isComplex(); m_openCL = operation->isOpenCL(); m_singleThreaded = operation->isSingleThreaded(); m_initialized = true; } - + m_operations.push_back(operation); - + return true; } @@ -382,7 +382,7 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo { if (this->m_chunkExecutionStates[chunkNumber] == COM_ES_SCHEDULED) this->m_chunkExecutionStates[chunkNumber] = COM_ES_EXECUTED; - + atomic_add_and_fetch_u(&this->m_chunksFinished, 1); if (memoryBuffers) { for (unsigned int index = 0; index < this->m_cachedMaxReadBufferOffset; index++) { diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h index 0f84dccb711..20ffbeaa357 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.h +++ b/source/blender/compositor/intern/COM_ExecutionGroup.h @@ -65,89 +65,89 @@ typedef enum ChunkExecutionState { class ExecutionGroup { public: typedef std::vector<NodeOperation*> Operations; - + private: // fields - + /** * @brief list of operations in this ExecutionGroup */ Operations m_operations; - + /** * @brief is this ExecutionGroup an input ExecutionGroup * an input execution group is a group that is at the end of the calculation (the output is important for the user) */ int m_isOutput; - + /** * @brief Width of the output */ unsigned int m_width; - + /** * @brief Height of the output */ unsigned int m_height; - + /** * @brief size of a single chunk, being Width or of height * a chunk is always a square, except at the edges of the MemoryBuffer */ unsigned int m_chunkSize; - + /** * @brief number of chunks in the x-axis */ unsigned int m_numberOfXChunks; - + /** * @brief number of chunks in the y-axis */ unsigned int m_numberOfYChunks; - + /** * @brief total number of chunks */ unsigned int m_numberOfChunks; - + /** * @brief contains this ExecutionGroup a complex NodeOperation. */ bool m_complex; - + /** * @brief can this ExecutionGroup be scheduled on an OpenCLDevice */ bool m_openCL; - + /** * @brief Is this Execution group SingleThreaded */ bool m_singleThreaded; - + /** * @brief what is the maximum number field of all ReadBufferOperation in this ExecutionGroup. * @note this is used to construct the MemoryBuffers that will be passed during execution. */ unsigned int m_cachedMaxReadBufferOffset; - + /** * @brief a cached vector of all read operations in the execution group. */ Operations m_cachedReadOperations; - + /** * @brief reference to the original bNodeTree, this field is only set for the 'top' execution group. * @note can only be used to call the callbacks for progress, status and break */ const bNodeTree *m_bTree; - + /** * @brief total number of chunks that have been calculated for this ExecutionGroup */ unsigned int m_chunksFinished; - + /** * @brief the chunkExecutionStates holds per chunk the execution state. this state can be * - COM_ES_NOT_SCHEDULED: not scheduled @@ -155,7 +155,7 @@ private: * - COM_ES_EXECUTED: executed */ ChunkExecutionState *m_chunkExecutionStates; - + /** * @brief indicator when this ExecutionGroup has valid Operations in its vector for Execution * @note When building the ExecutionGroup Operations are added via recursion. First a WriteBufferOperations is added, then the @@ -184,7 +184,7 @@ private: * @param operation the operation to be added */ bool canContainOperation(NodeOperation *operation); - + /** * @brief calculate the actual chunk size of this execution group. * @note A chunk size is an unsigned int that is both the height and width of a chunk. @@ -192,21 +192,21 @@ private: * @note by the calling method. */ unsigned int determineChunkSize(); - - + + /** * @brief Determine the rect (minx, maxx, miny, maxy) of a chunk at a position. * @note Only gives useful results ater the determination of the chunksize * @see determineChunkSize() */ void determineChunkRect(rcti *rect, const unsigned int xChunk, const unsigned int yChunk) const; - + /** * @brief determine the number of chunks, based on the chunkSize, width and height. * @note The result are stored in the fields numberOfChunks, numberOfXChunks, numberOfYChunks */ void determineNumberOfChunks(); - + /** * @brief try to schedule a specific chunk. * @note scheduling succeeds when all input requirements are met and the chunks hasn't been scheduled yet. @@ -236,7 +236,7 @@ private: * @param chunknumber */ bool scheduleChunk(unsigned int chunkNumber); - + /** * @brief determine the area of interest of a certain input area * @note This method only evaluates a single ReadBufferOperation @@ -250,7 +250,7 @@ private: public: // constructors ExecutionGroup(); - + // methods /** * @brief add an operation to this ExecutionGroup @@ -261,7 +261,7 @@ public: * @return True if the operation was successfully added */ bool addOperation(NodeOperation *operation); - + /** * @brief is this ExecutionGroup an output ExecutionGroup * @note An OutputExecution group are groups containing a @@ -281,47 +281,47 @@ public: * @param resolution */ void determineResolution(unsigned int resolution[2]); - + /** * @brief set the resolution of this executiongroup * @param resolution */ void setResolution(unsigned int resolution[2]) { this->m_width = resolution[0]; this->m_height = resolution[1]; } - + /** * @brief get the width of this execution group */ unsigned int getWidth() const { return m_width; } - + /** * @brief get the height of this execution group */ unsigned int getHeight() const { return m_height; } - + /** * @brief does this ExecutionGroup contains a complex NodeOperation */ bool isComplex() const { return m_complex; } - - + + /** * @brief get the output operation of this ExecutionGroup * @return NodeOperation *output operation */ NodeOperation *getOutputOperation() const; - + /** * @brief compose multiple chunks into a single chunk * @return Memorybuffer *consolidated chunk */ MemoryBuffer *constructConsolidatedMemoryBuffer(MemoryProxy *memoryProxy, rcti *output); - + /** * @brief initExecution is called just before the execution of the whole graph will be done. * @note The implementation will calculate the chunkSize of this execution group. */ void initExecution(); - + /** * @brief get all inputbuffers needed to calculate an chunk * @note all inputbuffers must be executed @@ -352,14 +352,14 @@ public: * @param memorybuffers */ void finalizeChunkExecution(int chunkNumber, MemoryBuffer **memoryBuffers); - + /** * @brief deinitExecution is called just after execution the whole graph. * @note It will release all needed resources */ void deinitExecution(); - - + + /** * @brief schedule an ExecutionGroup * @note this method will return when all chunks have been calculated, or the execution has breaked (by user) @@ -375,7 +375,7 @@ public: * @param system */ void execute(ExecutionSystem *system); - + /** * @brief this method determines the MemoryProxy's where this execution group depends on. * @note After this method determineDependingAreaOfInterest can be called to determine @@ -383,7 +383,7 @@ public: * @param memoryProxies result */ void determineDependingMemoryProxies(vector<MemoryProxy *> *memoryProxies); - + /** * @brief Determine the rect (minx, maxx, miny, maxy) of a chunk. * @note Only gives useful results ater the determination of the chunksize diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp index 8e8539e3016..07f7979629c 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp +++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp @@ -132,7 +132,7 @@ void ExecutionSystem::execute() editingtree->stats_draw(editingtree->sdh, IFACE_("Compositing | Initializing execution")); DebugInfo::execute_started(this); - + unsigned int order = 0; for (vector<NodeOperation *>::iterator iter = this->m_operations.begin(); iter != this->m_operations.end(); ++iter) { NodeOperation *operation = *iter; diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h index 2c67a5f7b7f..acde4a9b772 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.h +++ b/source/blender/compositor/intern/COM_ExecutionSystem.h @@ -114,7 +114,7 @@ class ExecutionSystem { public: typedef std::vector<NodeOperation*> Operations; typedef std::vector<ExecutionGroup*> Groups; - + private: /** * @brief the context used during execution @@ -136,7 +136,7 @@ private: //methods * find all execution group with output nodes */ void findOutputExecutionGroup(vector<ExecutionGroup *> *result, CompositorPriority priority) const; - + /** * find all execution group with output nodes */ diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h index 27baca0ab6f..be948b3e99b 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.h +++ b/source/blender/compositor/intern/COM_MemoryBuffer.h @@ -64,29 +64,29 @@ private: * @brief proxy of the memory (same for all chunks in the same buffer) */ MemoryProxy *m_memoryProxy; - + /** * @brief the type of buffer COM_DT_VALUE, COM_DT_VECTOR, COM_DT_COLOR */ DataType m_datatype; - - + + /** * @brief region of this buffer inside relative to the MemoryProxy */ rcti m_rect; - + /** * brief refers to the chunknumber within the executiongroup where related to the MemoryProxy * @see memoryProxy */ unsigned int m_chunkNumber; - + /** * @brief state of the buffer */ MemoryBufferState m_state; - + /** * @brief the actual float buffer/data */ @@ -106,7 +106,7 @@ public: * @brief construct new MemoryBuffer for a chunk */ MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti *rect); - + /** * @brief construct new temporarily MemoryBuffer for an area */ @@ -121,7 +121,7 @@ public: * @brief destructor */ ~MemoryBuffer(); - + /** * @brief read the ChunkNumber of this MemoryBuffer */ @@ -134,7 +134,7 @@ public: * @note buffer should already be available in memory */ float *getBuffer() { return this->m_buffer; } - + /** * @brief after execution the state will be set to available by calling this method */ @@ -142,14 +142,14 @@ public: { this->m_state = COM_MB_AVAILABLE; } - + inline void wrap_pixel(int &x, int &y, MemoryBufferExtend extend_x, MemoryBufferExtend extend_y) { int w = this->m_width; int h = this->m_height; x = x - m_rect.xmin; y = y - m_rect.ymin; - + switch (extend_x) { case COM_MB_CLIP: break; @@ -161,7 +161,7 @@ public: x = (x >= 0.0f ? (x % w) : (x % w) + w); break; } - + switch (extend_y) { case COM_MB_CLIP: break; @@ -174,7 +174,7 @@ public: break; } } - + inline void wrap_pixel(float &x, float &y, MemoryBufferExtend extend_x, MemoryBufferExtend extend_y) { float w = (float)this->m_width; @@ -249,7 +249,7 @@ public: float *buffer = &this->m_buffer[offset]; memcpy(result, buffer, sizeof(float) * this->m_num_channels); } - + void writePixel(int x, int y, const float color[4]); void addPixel(int x, int y, const float color[4]); inline void readBilinear(float *result, float x, float y, @@ -271,12 +271,12 @@ public: } void readEWA(float *result, const float uv[2], const float derivatives[2][2]); - + /** * @brief is this MemoryBuffer a temporarily buffer (based on an area, not on a chunk) */ inline const bool isTemporarily() const { return this->m_state == COM_MB_TEMPORARILY; } - + /** * @brief add the content from otherBuffer to this MemoryBuffer * @param otherBuffer source buffer @@ -285,29 +285,29 @@ public: * uninitialized values in areas where the buffers don't overlap. */ void copyContentFrom(MemoryBuffer *otherBuffer); - + /** * @brief get the rect of this MemoryBuffer */ rcti *getRect() { return &this->m_rect; } - + /** * @brief get the width of this MemoryBuffer */ int getWidth() const; - + /** * @brief get the height of this MemoryBuffer */ int getHeight() const; - + /** * @brief clear the buffer. Make all pixels black transparent. */ void clear(); - + MemoryBuffer *duplicate(); - + float getMaximumValue(); float getMaximumValue(rcti *rect); private: diff --git a/source/blender/compositor/intern/COM_MemoryProxy.h b/source/blender/compositor/intern/COM_MemoryProxy.h index 755d513c72f..b732db37db2 100644 --- a/source/blender/compositor/intern/COM_MemoryProxy.h +++ b/source/blender/compositor/intern/COM_MemoryProxy.h @@ -42,17 +42,17 @@ private: * @brief reference to the ouput operation of the executiongroup */ WriteBufferOperation *m_writeBufferOperation; - + /** * @brief reference to the executor. the Execution group that can fill a chunk */ ExecutionGroup *m_executor; - + /** * @brief datatype of this MemoryProxy */ /* DataType m_datatype; */ /* UNUSED */ - + /** * @brief channel information of this buffer */ @@ -70,7 +70,7 @@ private: public: MemoryProxy(DataType type); - + /** * @brief set the ExecutionGroup that can be scheduled to calculate a certain chunk. * @param group the ExecutionGroup to set diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp index a374403fef7..67b64baa26e 100644 --- a/source/blender/compositor/intern/COM_Node.cpp +++ b/source/blender/compositor/intern/COM_Node.cpp @@ -54,7 +54,7 @@ Node::Node(bNode *editorNode, bool create_sockets) : DataType dt = COM_DT_VALUE; if (input->type == SOCK_RGBA) dt = COM_DT_COLOR; if (input->type == SOCK_VECTOR) dt = COM_DT_VECTOR; - + this->addInputSocket(dt, input); input = input->next; } @@ -63,7 +63,7 @@ Node::Node(bNode *editorNode, bool create_sockets) : DataType dt = COM_DT_VALUE; if (output->type == SOCK_RGBA) dt = COM_DT_COLOR; if (output->type == SOCK_VECTOR) dt = COM_DT_VECTOR; - + this->addOutputSocket(dt, output); output = output->next; } @@ -96,7 +96,7 @@ void Node::addInputSocket(DataType datatype, bNodeSocket *bSocket) void Node::addOutputSocket(DataType datatype) { this->addOutputSocket(datatype, NULL); - + } void Node::addOutputSocket(DataType datatype, bNodeSocket *bSocket) { diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h index 1c28292fb2e..1b78e7fec6d 100644 --- a/source/blender/compositor/intern/COM_Node.h +++ b/source/blender/compositor/intern/COM_Node.h @@ -45,13 +45,13 @@ class Node { public: typedef std::vector<NodeInput *> Inputs; typedef std::vector<NodeOutput *> Outputs; - + private: /** * @brief stores the reference to the SDNA bNode struct */ bNodeTree *m_editorNodeTree; - + /** * @brief stores the reference to the SDNA bNode struct */ @@ -82,7 +82,7 @@ protected: * @brief get access to the vector of input sockets */ const Inputs &getInputSockets() const { return this->m_inputsockets; } - + /** * @brief get access to the vector of input sockets */ @@ -101,14 +101,14 @@ public: * @brief get the reference to the SDNA bNodeTree struct */ bNodeTree *getbNodeTree() const {return m_editorNodeTree;} - + /** * @brief set the reference to the bNode * @note used in Node instances to receive the storage/settings and complex node for highlight during execution * @param bNode */ void setbNode(bNode *node) {this->m_editorNode = node;} - + /** * @brief set the reference to the bNodeTree * @param bNodeTree @@ -131,35 +131,35 @@ public: * the index of the needed outputsocket */ NodeOutput *getOutputSocket(const unsigned int index) const; - + /** * get the reference to the first outputsocket * @param index * the index of the needed outputsocket */ inline NodeOutput *getOutputSocket() const { return getOutputSocket(0); } - + /** * get the reference to a certain inputsocket * @param index * the index of the needed inputsocket */ NodeInput *getInputSocket(const unsigned int index) const; - + /** Check if this is an input node * An input node is a node that only has output sockets and no input sockets */ bool isInputNode() const { return m_inputsockets.empty(); } - + /** * @brief Is this node in the active group (the group that is being edited) * @param isInActiveGroup */ void setIsInActiveGroup(bool value) { this->m_inActiveGroup = value; } - + /** * @brief Is this node part of the active group - * the active group is the group that is currently being edited. When no group is edited, + * the active group is the group that is currently being edited. When no group is edited, * the active group will be the main tree (all nodes that are not part of a group will be active) * @return bool [false:true] */ @@ -174,7 +174,7 @@ public: * @param context reference to the CompositorContext */ virtual void convertToOperations(NodeConverter &converter, const CompositorContext &context) const = 0; - + /** * Create dummy warning operation, use when we can't get the source data. */ @@ -185,10 +185,10 @@ public: * into valid outputs, without this the compositor system gets confused and crashes, see [#32490] */ void convertToOperations_invalid(NodeConverter *compiler) const; - + void setInstanceKey(bNodeInstanceKey instance_key) { m_instanceKey = instance_key; } bNodeInstanceKey getInstanceKey() const { return m_instanceKey; } - + protected: /** * @brief add an NodeInput to the collection of inputsockets @@ -197,7 +197,7 @@ protected: */ void addInputSocket(DataType datatype); void addInputSocket(DataType datatype, bNodeSocket *socket); - + /** * @brief add an NodeOutput to the collection of outputsockets * @note may only be called in an constructor @@ -205,7 +205,7 @@ protected: */ void addOutputSocket(DataType datatype); void addOutputSocket(DataType datatype, bNodeSocket *socket); - + bNodeSocket *getEditorInputSocket(int editorNodeInputSocketIndex); bNodeSocket *getEditorOutputSocket(int editorNodeOutputSocketIndex); }; @@ -219,26 +219,26 @@ class NodeInput { private: Node *m_node; bNodeSocket *m_editorSocket; - + DataType m_datatype; - + /** * @brief link connected to this NodeInput. * An input socket can only have a single link */ NodeOutput *m_link; - + public: NodeInput(Node *node, bNodeSocket *b_socket, DataType datatype); - + Node *getNode() const { return this->m_node; } DataType getDataType() const { return m_datatype; } bNodeSocket *getbNodeSocket() const { return this->m_editorSocket; } - + void setLink(NodeOutput *link); bool isLinked() const { return m_link; } NodeOutput *getLink() { return m_link; } - + float getEditorValueFloat(); void getEditorValueColor(float *value); void getEditorValueVector(float *value); @@ -253,16 +253,16 @@ class NodeOutput { private: Node *m_node; bNodeSocket *m_editorSocket; - + DataType m_datatype; - + public: NodeOutput(Node *node, bNodeSocket *b_socket, DataType datatype); - + Node *getNode() const { return this->m_node; } DataType getDataType() const { return m_datatype; } bNodeSocket *getbNodeSocket() const { return this->m_editorSocket; } - + float getEditorValueFloat(); void getEditorValueColor(float *value); void getEditorValueVector(float *value); diff --git a/source/blender/compositor/intern/COM_NodeConverter.cpp b/source/blender/compositor/intern/COM_NodeConverter.cpp index df8a7e6353c..1b62466f81f 100644 --- a/source/blender/compositor/intern/COM_NodeConverter.cpp +++ b/source/blender/compositor/intern/COM_NodeConverter.cpp @@ -73,13 +73,13 @@ NodeOperation *NodeConverter::setInvalidOutput(NodeOutput *output) { /* this is a really bad situation - bring on the pink! - so artists know this is bad */ const float warning_color[4] = {1.0f, 0.0f, 1.0f, 1.0f}; - + SetColorOperation *operation = new SetColorOperation(); operation->setChannels(warning_color); - + m_builder->addOperation(operation); m_builder->mapOutputSocket(output, operation->getOutputSocket()); - + return operation; } @@ -87,9 +87,9 @@ NodeOperationOutput *NodeConverter::addInputProxy(NodeInput *input, bool use_con { SocketProxyOperation *proxy = new SocketProxyOperation(input->getDataType(), use_conversion); m_builder->addOperation(proxy); - + m_builder->mapInputSocket(input, proxy->getInputSocket(0)); - + return proxy->getOutputSocket(); } @@ -97,9 +97,9 @@ NodeOperationInput *NodeConverter::addOutputProxy(NodeOutput *output, bool use_c { SocketProxyOperation *proxy = new SocketProxyOperation(output->getDataType(), use_conversion); m_builder->addOperation(proxy); - + m_builder->mapOutputSocket(output, proxy->getOutputSocket()); - + return proxy->getInputSocket(0); } @@ -107,7 +107,7 @@ void NodeConverter::addInputValue(NodeOperationInput *input, float value) { SetValueOperation *operation = new SetValueOperation(); operation->setValue(value); - + m_builder->addOperation(operation); m_builder->addLink(operation->getOutputSocket(), input); } @@ -116,7 +116,7 @@ void NodeConverter::addInputColor(NodeOperationInput *input, const float value[4 { SetColorOperation *operation = new SetColorOperation(); operation->setChannels(value); - + m_builder->addOperation(operation); m_builder->addLink(operation->getOutputSocket(), input); } @@ -125,7 +125,7 @@ void NodeConverter::addInputVector(NodeOperationInput *input, const float value[ { SetVectorOperation *operation = new SetVectorOperation(); operation->setVector(value); - + m_builder->addOperation(operation); m_builder->addLink(operation->getOutputSocket(), input); } @@ -134,7 +134,7 @@ void NodeConverter::addOutputValue(NodeOutput *output, float value) { SetValueOperation *operation = new SetValueOperation(); operation->setValue(value); - + m_builder->addOperation(operation); m_builder->mapOutputSocket(output, operation->getOutputSocket()); } @@ -143,7 +143,7 @@ void NodeConverter::addOutputColor(NodeOutput *output, const float value[4]) { SetColorOperation *operation = new SetColorOperation(); operation->setChannels(value); - + m_builder->addOperation(operation); m_builder->mapOutputSocket(output, operation->getOutputSocket()); } @@ -152,7 +152,7 @@ void NodeConverter::addOutputVector(NodeOutput *output, const float value[3]) { SetVectorOperation *operation = new SetVectorOperation(); operation->setVector(value); - + m_builder->addOperation(operation); m_builder->mapOutputSocket(output, operation->getOutputSocket()); } diff --git a/source/blender/compositor/intern/COM_NodeConverter.h b/source/blender/compositor/intern/COM_NodeConverter.h index fb7529ae2a7..825c26bb7af 100644 --- a/source/blender/compositor/intern/COM_NodeConverter.h +++ b/source/blender/compositor/intern/COM_NodeConverter.h @@ -44,28 +44,28 @@ class ViewerOperation; class NodeConverter { public: NodeConverter(NodeOperationBuilder *builder); - + /** Insert a new operation into the operations graph. * The operation must be created by the node. */ void addOperation(NodeOperation *operation); - + /** Map input socket of the node to an operation socket. * Links between nodes will then generate equivalent links between * the mapped operation sockets. - * + * * \note A \a Node input can be mapped to multiple \a NodeOperation inputs. */ void mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket); /** Map output socket of the node to an operation socket. * Links between nodes will then generate equivalent links between * the mapped operation sockets. - * + * * \note A \a Node output can only be mapped to one \a NodeOperation output. * Any existing operation output mapping will be replaced. */ void mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket); - + /** Create a proxy operation for a node input. * This operation will be removed later and replaced * by direct links between the connected operations. @@ -76,39 +76,39 @@ public: * by direct links between the connected operations. */ NodeOperationInput *addOutputProxy(NodeOutput *output, bool use_conversion); - + /** Define a constant input value. */ void addInputValue(NodeOperationInput *input, float value); /** Define a constant input color. */ void addInputColor(NodeOperationInput *input, const float value[4]); /** Define a constant input vector. */ void addInputVector(NodeOperationInput *input, const float value[3]); - + /** Define a constant output value. */ void addOutputValue(NodeOutput *output, float value); /** Define a constant output color. */ void addOutputColor(NodeOutput *output, const float value[4]); /** Define a constant output vector. */ void addOutputVector(NodeOutput *output, const float value[3]); - + /** Add an explicit link between two operations. */ void addLink(NodeOperationOutput *from, NodeOperationInput *to); - + /** Add a preview operation for a operation output. */ void addPreview(NodeOperationOutput *output); /** Add a preview operation for a node input. */ void addNodeInputPreview(NodeInput *input); - + /** When a node has no valid data * @note missing image / group pointer, or missing renderlayer from EXR */ NodeOperation *setInvalidOutput(NodeOutput *output); - + /** Define a viewer operation as the active output, if possible */ void registerViewer(ViewerOperation *viewer); /** The currently active viewer output operation */ ViewerOperation *active_viewer() const; - + private: /** The internal builder for storing the results of the graph construction. */ NodeOperationBuilder *m_builder; diff --git a/source/blender/compositor/intern/COM_NodeGraph.cpp b/source/blender/compositor/intern/COM_NodeGraph.cpp index 5196108818b..d78450074ed 100644 --- a/source/blender/compositor/intern/COM_NodeGraph.cpp +++ b/source/blender/compositor/intern/COM_NodeGraph.cpp @@ -82,16 +82,16 @@ void NodeGraph::add_node(Node *node, bNodeTree *b_ntree, bNodeInstanceKey key, b node->setbNodeTree(b_ntree); node->setInstanceKey(key); node->setIsInActiveGroup(is_active_group); - + m_nodes.push_back(node); - + DebugInfo::node_added(node); } void NodeGraph::add_link(NodeOutput *fromSocket, NodeInput *toSocket) { m_links.push_back(Link(fromSocket, toSocket)); - + /* register with the input */ toSocket->setLink(fromSocket); } @@ -99,10 +99,10 @@ void NodeGraph::add_link(NodeOutput *fromSocket, NodeInput *toSocket) void NodeGraph::add_bNodeTree(const CompositorContext &context, int nodes_start, bNodeTree *tree, bNodeInstanceKey parent_key) { const bNodeTree *basetree = context.getbNodeTree(); - + /* update viewers in the active edittree as well the base tree (for backdrop) */ bool is_active_group = (parent_key.value == basetree->active_viewer_key.value); - + /* add all nodes of the tree to the node list */ for (bNode *node = (bNode *)tree->nodes.first; node; node = node->next) { bNodeInstanceKey key = BKE_node_instance_key(parent_key, tree, node); @@ -123,13 +123,13 @@ void NodeGraph::add_bNode(const CompositorContext &context, bNodeTree *b_ntree, add_proxies_mute(b_ntree, b_node, key, is_active_group); return; } - + /* replace slow nodes with proxies for fast execution */ if (context.isFastCalculation() && !Converter::is_fast_node(b_node)) { add_proxies_skip(b_ntree, b_node, key, is_active_group); return; } - + /* special node types */ if (b_node->type == NODE_GROUP) { add_proxies_group(context, b_node, key); @@ -181,15 +181,15 @@ void NodeGraph::add_bNodeLink(const NodeRange &node_range, bNodeLink *b_nodelink return; if ((b_nodelink->fromsock->flag & SOCK_UNAVAIL) || (b_nodelink->tosock->flag & SOCK_UNAVAIL)) return; - + /* Note: a DNA input socket can have multiple NodeInput in the compositor tree! (proxies) * The output then gets linked to each one of them. */ - + NodeOutput *output = find_output(node_range, b_nodelink->fromsock); if (!output) return; - + NodeInputs inputs = find_inputs(node_range, b_nodelink->tosock); for (NodeInputs::const_iterator it = inputs.begin(); it != inputs.end(); ++it) { NodeInput *input = *it; @@ -213,13 +213,13 @@ void NodeGraph::add_proxies_skip(bNodeTree *b_ntree, bNode *b_node, bNodeInstanc { for (bNodeSocket *output = (bNodeSocket *)b_node->outputs.first; output; output = output->next) { bNodeSocket *input; - + /* look for first input with matching datatype for each output */ for (input = (bNodeSocket *)b_node->inputs.first; input; input = input->next) { if (input->type == output->type) break; } - + if (input) { SocketProxyNode *proxy = new SocketProxyNode(b_node, input, output, true); add_node(proxy, b_ntree, key, is_active_group); @@ -231,11 +231,11 @@ void NodeGraph::add_proxies_group_inputs(bNode *b_node, bNode *b_node_io) { bNodeTree *b_group_tree = (bNodeTree *)b_node->id; BLI_assert(b_group_tree); /* should have been checked in advance */ - + /* not important for proxies */ bNodeInstanceKey key = NODE_INSTANCE_KEY_BASE; bool is_active_group = false; - + for (bNodeSocket *b_sock_io = (bNodeSocket *)b_node_io->outputs.first; b_sock_io; b_sock_io = b_sock_io->next) { bNodeSocket *b_sock_group = find_b_node_input(b_node, b_sock_io->identifier); if (b_sock_group) { @@ -249,11 +249,11 @@ void NodeGraph::add_proxies_group_outputs(bNode *b_node, bNode *b_node_io, bool { bNodeTree *b_group_tree = (bNodeTree *)b_node->id; BLI_assert(b_group_tree); /* should have been checked in advance */ - + /* not important for proxies */ bNodeInstanceKey key = NODE_INSTANCE_KEY_BASE; bool is_active_group = false; - + for (bNodeSocket *b_sock_io = (bNodeSocket *)b_node_io->inputs.first; b_sock_io; b_sock_io = b_sock_io->next) { bNodeSocket *b_sock_group = find_b_node_output(b_node, b_sock_io->identifier); if (b_sock_group) { @@ -286,11 +286,11 @@ void NodeGraph::add_proxies_group(const CompositorContext &context, bNode *b_nod for (bNode *b_node_io = (bNode *)b_group_tree->nodes.first; b_node_io; b_node_io = b_node_io->next) { if (b_node_io->type == NODE_GROUP_INPUT) add_proxies_group_inputs(b_node, b_node_io); - + if (b_node_io->type == NODE_GROUP_OUTPUT && (b_node_io->flag & NODE_DO_OUTPUT)) add_proxies_group_outputs(b_node, b_node_io, context.isGroupnodeBufferEnabled()); } - + add_bNodeTree(context, nodes_start, b_group_tree, key); } diff --git a/source/blender/compositor/intern/COM_NodeGraph.h b/source/blender/compositor/intern/COM_NodeGraph.h index fe8740fee97..7c6322d2a42 100644 --- a/source/blender/compositor/intern/COM_NodeGraph.h +++ b/source/blender/compositor/intern/COM_NodeGraph.h @@ -48,66 +48,66 @@ public: private: NodeOutput *m_from; NodeInput *m_to; - + public: Link(NodeOutput *from, NodeInput *to) : m_from(from), m_to(to) {} - + NodeOutput *getFromSocket() const { return m_from; } NodeInput *getToSocket() const { return m_to; } }; - + typedef std::vector<Node *> Nodes; typedef Nodes::iterator NodeIterator; typedef std::vector<Link> Links; - + private: Nodes m_nodes; Links m_links; - + public: NodeGraph(); ~NodeGraph(); - + const Nodes &nodes() const { return m_nodes; } const Links &links() const { return m_links; } - + void from_bNodeTree(const CompositorContext &context, bNodeTree *tree); - + protected: typedef std::pair<NodeIterator, NodeIterator> NodeRange; typedef std::vector<NodeInput *> NodeInputs; - + static bNodeSocket *find_b_node_input(bNode *b_node, const char *identifier); static bNodeSocket *find_b_node_output(bNode *b_node, const char *identifier); - + void add_node(Node *node, bNodeTree *b_ntree, bNodeInstanceKey key, bool is_active_group); void add_link(NodeOutput *fromSocket, NodeInput *toSocket); - + void add_bNodeTree(const CompositorContext &context, int nodes_start, bNodeTree *tree, bNodeInstanceKey parent_key); - + void add_bNode(const CompositorContext &context, bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group); - + NodeInputs find_inputs(const NodeRange &node_range, bNodeSocket *b_socket); NodeOutput *find_output(const NodeRange &node_range, bNodeSocket *b_socket); void add_bNodeLink(const NodeRange &node_range, bNodeLink *bNodeLink); - + /* **** Special proxy node type conversions **** */ /* These nodes are not represented in the node graph themselves, * but converted into a number of proxy links */ - + void add_proxies_mute(bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group); void add_proxies_skip(bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group); - + void add_proxies_group_inputs(bNode *b_node, bNode *b_node_io); void add_proxies_group_outputs(bNode *b_node, bNode *b_node_io, bool use_buffer); void add_proxies_group(const CompositorContext &context, bNode *b_node, bNodeInstanceKey key); void add_proxies_reroute(bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group); - + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeGraph") #endif diff --git a/source/blender/compositor/intern/COM_NodeOperation.cpp b/source/blender/compositor/intern/COM_NodeOperation.cpp index 496a27b379c..1063386aa58 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.cpp +++ b/source/blender/compositor/intern/COM_NodeOperation.cpp @@ -83,7 +83,7 @@ void NodeOperation::determineResolution(unsigned int resolution[2], unsigned int { unsigned int temp[2]; unsigned int temp2[2]; - + for (unsigned int index = 0; index < m_inputs.size(); index++) { NodeOperationInput *input = m_inputs[index]; if (input->isConnected()) { diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h index 1f3c72a820e..5ee3cc22b53 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.h +++ b/source/blender/compositor/intern/COM_NodeOperation.h @@ -81,11 +81,11 @@ class NodeOperation : public SocketReader { public: typedef std::vector<NodeOperationInput*> Inputs; typedef std::vector<NodeOperationOutput*> Outputs; - + private: Inputs m_inputs; Outputs m_outputs; - + /** * @brief the index of the input socket that will be used to determine the resolution */ @@ -115,7 +115,7 @@ private: * @see NodeOperation.getMutex retrieve a pointer to this mutex. */ ThreadMutex m_mutex; - + /** * @brief reference to the editing bNodeTree, used for break and update callback */ @@ -125,21 +125,21 @@ private: * @brief set to truth when resolution for this operation is set */ bool m_isResolutionSet; - + public: virtual ~NodeOperation(); - + unsigned int getNumberOfInputSockets() const { return m_inputs.size(); } unsigned int getNumberOfOutputSockets() const { return m_outputs.size(); } NodeOperationOutput *getOutputSocket(unsigned int index) const; NodeOperationOutput *getOutputSocket() const { return getOutputSocket(0); } NodeOperationInput *getInputSocket(unsigned int index) const; - + /** Check if this is an input operation * An input operation is an operation that only has output sockets and no input sockets */ bool isInputOperation() const { return m_inputs.empty(); } - + /** * @brief determine the resolution of this node * @note this method will not set the resolution, this is the responsibility of the caller @@ -167,7 +167,7 @@ public: void setbNodeTree(const bNodeTree *tree) { this->m_btree = tree; } virtual void initExecution(); - + /** * @brief when a chunk is executed by a CPUDevice, this method is called * @ingroup execution @@ -231,7 +231,7 @@ public: this->m_isResolutionSet = true; } } - + void getConnectedInputSockets(Inputs *sockets); @@ -288,14 +288,14 @@ public: * @see ExecutionGroup.addOperation */ bool isOpenCL() const { return this->m_openCL; } - + virtual bool isViewerOperation() const { return false; } virtual bool isPreviewOperation() const { return false; } virtual bool isFileOutputOperation() const { return false; } virtual bool isProxyOperation() const { return false; } - + virtual bool useDatatypeConversion() const { return true; } - + inline bool isBreaked() const { return this->m_btree->test_break(this->m_btree->tbh); } @@ -319,7 +319,7 @@ protected: void initMutex(); void lockMutex(); void unlockMutex(); - + /** * @brief set whether this operation is complex * @@ -345,35 +345,35 @@ protected: class NodeOperationInput { private: NodeOperation *m_operation; - + /** Datatype of this socket. Is used for automatically data transformation. * @section data-conversion */ DataType m_datatype; - + /** Resize mode of this socket */ InputResizeMode m_resizeMode; - + /** Connected output */ NodeOperationOutput *m_link; - + public: NodeOperationInput(NodeOperation *op, DataType datatype, InputResizeMode resizeMode = COM_SC_CENTER); - + NodeOperation &getOperation() const { return *m_operation; } DataType getDataType() const { return m_datatype; } - + void setLink(NodeOperationOutput *link) { m_link = link; } NodeOperationOutput *getLink() const { return m_link; } bool isConnected() const { return m_link; } - + void setResizeMode(InputResizeMode resizeMode) { this->m_resizeMode = resizeMode; } InputResizeMode getResizeMode() const { return this->m_resizeMode; } - + SocketReader *getReader(); - + void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeOperation") #endif @@ -383,18 +383,18 @@ public: class NodeOperationOutput { private: NodeOperation *m_operation; - + /** Datatype of this socket. Is used for automatically data transformation. * @section data-conversion */ DataType m_datatype; - + public: NodeOperationOutput(NodeOperation *op, DataType datatype); - + NodeOperation &getOperation() const { return *m_operation; } DataType getDataType() const { return m_datatype; } - + /** * @brief determine the resolution of this data going through this socket * @param resolution the result of this operation diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp b/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp index fc1584e3dbb..f282037823a 100644 --- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp +++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp @@ -58,18 +58,18 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system) { /* interface handle for nodes */ NodeConverter converter(this); - + for (int index = 0; index < m_graph.nodes().size(); index++) { Node *node = (Node *)m_graph.nodes()[index]; - + m_current_node = node; - + DebugInfo::node_to_operations(node); node->convertToOperations(converter, *m_context); } - + m_current_node = NULL; - + /* The input map constructed by nodes maps operation inputs to node inputs. * Inverting yields a map of node inputs to all connected operation inputs, * so multiple operations can use the same node input. @@ -77,12 +77,12 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system) OpInputInverseMap inverse_input_map; for (InputSocketMap::const_iterator it = m_input_map.begin(); it != m_input_map.end(); ++it) inverse_input_map[it->second].push_back(it->first); - + for (NodeGraph::Links::const_iterator it = m_graph.links().begin(); it != m_graph.links().end(); ++it) { const NodeGraph::Link &link = *it; NodeOutput *from = link.getFromSocket(); NodeInput *to = link.getToSocket(); - + NodeOperationOutput *op_from = find_operation_output(m_output_map, from); const OpInputs &op_to_list = find_operation_inputs(inverse_input_map, to); if (!op_from || op_to_list.empty()) { @@ -94,36 +94,36 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system) */ continue; } - + for (OpInputs::const_iterator it = op_to_list.begin(); it != op_to_list.end(); ++it) { NodeOperationInput *op_to = *it; addLink(op_from, op_to); } } - + add_operation_input_constants(); - + resolve_proxies(); - + add_datatype_conversions(); - + determineResolutions(); - + /* surround complex ops with read/write buffer */ add_complex_operation_buffers(); - + /* links not available from here on */ /* XXX make m_links a local variable to avoid confusion! */ m_links.clear(); - + prune_operations(); - + /* ensure topological (link-based) order of nodes */ /*sort_operations();*/ /* not needed yet */ - + /* create execution groups */ group_operations(); - + /* transfer resulting operations to the system */ system->set_operations(m_operations, m_groups); } @@ -137,7 +137,7 @@ void NodeOperationBuilder::mapInputSocket(NodeInput *node_socket, NodeOperationI { BLI_assert(m_current_node); BLI_assert(node_socket->getNode() == m_current_node); - + /* note: this maps operation sockets to node sockets. * for resolving links the map will be inverted first in convertToOperations, * to get a list of links for each node input socket. @@ -149,7 +149,7 @@ void NodeOperationBuilder::mapOutputSocket(NodeOutput *node_socket, NodeOperatio { BLI_assert(m_current_node); BLI_assert(node_socket->getNode() == m_current_node); - + m_output_map[node_socket] = operation_socket; } @@ -157,9 +157,9 @@ void NodeOperationBuilder::addLink(NodeOperationOutput *from, NodeOperationInput { if (to->isConnected()) return; - + m_links.push_back(Link(from, to)); - + /* register with the input */ to->setLink(from); } @@ -171,7 +171,7 @@ void NodeOperationBuilder::removeInputLink(NodeOperationInput *to) if (link.to() == to) { /* unregister with the input */ to->setLink(NULL); - + m_links.erase(it); return; } @@ -200,7 +200,7 @@ NodeOperationOutput *NodeOperationBuilder::find_operation_output(const OutputSoc PreviewOperation *NodeOperationBuilder::make_preview_operation() const { BLI_assert(m_current_node); - + if (!(m_current_node->getbNode()->flag & NODE_PREVIEW)) return NULL; /* previews only in the active group */ @@ -209,7 +209,7 @@ PreviewOperation *NodeOperationBuilder::make_preview_operation() const /* do not calculate previews of hidden nodes */ if (m_current_node->getbNode()->flag & NODE_HIDDEN) return NULL; - + bNodeInstanceHash *previews = m_context->getPreviewHash(); if (previews) { PreviewOperation *operation = new PreviewOperation(m_context->getViewSettings(), m_context->getDisplaySettings()); @@ -217,7 +217,7 @@ PreviewOperation *NodeOperationBuilder::make_preview_operation() const operation->verifyPreview(previews, m_current_node->getInstanceKey()); return operation; } - + return NULL; } @@ -226,7 +226,7 @@ void NodeOperationBuilder::addPreview(NodeOperationOutput *output) PreviewOperation *operation = make_preview_operation(); if (operation) { addOperation(operation); - + addLink(output, operation->getInputSocket(0)); } } @@ -236,7 +236,7 @@ void NodeOperationBuilder::addNodeInputPreview(NodeInput *input) PreviewOperation *operation = make_preview_operation(); if (operation) { addOperation(operation); - + mapInputSocket(input, operation->getInputSocket(0)); } } @@ -247,7 +247,7 @@ void NodeOperationBuilder::registerViewer(ViewerOperation *viewer) if (m_current_node->isInActiveGroup()) { /* deactivate previous viewer */ m_active_viewer->setActive(false); - + m_active_viewer = viewer; viewer->setActive(true); } @@ -269,13 +269,13 @@ void NodeOperationBuilder::add_datatype_conversions() Links convert_links; for (Links::const_iterator it = m_links.begin(); it != m_links.end(); ++it) { const Link &link = *it; - + /* proxy operations can skip data type conversion */ NodeOperation *from_op = &link.from()->getOperation(); NodeOperation *to_op = &link.to()->getOperation(); if (!(from_op->useDatatypeConversion() || to_op->useDatatypeConversion())) continue; - + if (link.from()->getDataType() != link.to()->getDataType()) convert_links.push_back(link); } @@ -284,7 +284,7 @@ void NodeOperationBuilder::add_datatype_conversions() NodeOperation *converter = Converter::convertDataType(link.from(), link.to()); if (converter) { addOperation(converter); - + removeInputLink(link.to()); addLink(link.from(), converter->getInputSocket(0)); addLink(converter->getOutputSocket(0), link.to()); @@ -322,7 +322,7 @@ void NodeOperationBuilder::add_input_constant_value(NodeOperationInput *input, N value = node_input->getEditorValueFloat(); else value = 0.0f; - + SetValueOperation *op = new SetValueOperation(); op->setValue(value); addOperation(op); @@ -335,7 +335,7 @@ void NodeOperationBuilder::add_input_constant_value(NodeOperationInput *input, N node_input->getEditorValueColor(value); else zero_v4(value); - + SetColorOperation *op = new SetColorOperation(); op->setChannels(value); addOperation(op); @@ -348,7 +348,7 @@ void NodeOperationBuilder::add_input_constant_value(NodeOperationInput *input, N node_input->getEditorValueVector(value); else zero_v3(value); - + SetVectorOperation *op = new SetVectorOperation(); op->setVector(value); addOperation(op); @@ -370,17 +370,17 @@ void NodeOperationBuilder::resolve_proxies() proxy_links.push_back(link); } } - + for (Links::const_iterator it = proxy_links.begin(); it != proxy_links.end(); ++it) { const Link &link = *it; - + NodeOperationInput *to = link.to(); NodeOperationOutput *from = link.from(); do { /* walk upstream bypassing the proxy operation */ from = from->getOperation().getInputSocket(0)->getLink(); } while (from && from->getOperation().isProxyOperation()); - + removeInputLink(to); /* we may not have a final proxy input link, * in that case it just gets dropped @@ -395,7 +395,7 @@ void NodeOperationBuilder::determineResolutions() /* determine all resolutions of the operations (Width/Height) */ for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) { NodeOperation *op = *it; - + if (op->isOutputOperation(m_context->isRendering()) && !op->isPreviewOperation()) { unsigned int resolution[2] = {0, 0}; unsigned int preferredResolution[2] = {0, 0}; @@ -403,10 +403,10 @@ void NodeOperationBuilder::determineResolutions() op->setResolution(resolution); } } - + for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) { NodeOperation *op = *it; - + if (op->isOutputOperation(m_context->isRendering()) && op->isPreviewOperation()) { unsigned int resolution[2] = {0, 0}; unsigned int preferredResolution[2] = {0, 0}; @@ -414,13 +414,13 @@ void NodeOperationBuilder::determineResolutions() op->setResolution(resolution); } } - + /* add convert resolution operations when needed */ { Links convert_links; for (Links::const_iterator it = m_links.begin(); it != m_links.end(); ++it) { const Link &link = *it; - + if (link.to()->getResizeMode() != COM_SC_NO_RESIZE) { NodeOperation &from_op = link.from()->getOperation(); NodeOperation &to_op = link.to()->getOperation(); @@ -464,35 +464,35 @@ void NodeOperationBuilder::add_input_buffers(NodeOperation * /*operation*/, { if (!input->isConnected()) return; - + NodeOperationOutput *output = input->getLink(); if (output->getOperation().isReadBufferOperation()) { /* input is already buffered, no need to add another */ return; } - + /* this link will be replaced below */ removeInputLink(input); - + /* check of other end already has write operation, otherwise add a new one */ WriteBufferOperation *writeoperation = find_attached_write_buffer_operation(output); if (!writeoperation) { writeoperation = new WriteBufferOperation(output->getDataType()); writeoperation->setbNodeTree(m_context->getbNodeTree()); addOperation(writeoperation); - + addLink(output, writeoperation->getInputSocket(0)); - + writeoperation->readResolutionFromInputSocket(); } - + /* add readbuffer op for the input */ ReadBufferOperation *readoperation = new ReadBufferOperation(output->getDataType()); readoperation->setMemoryProxy(writeoperation->getMemoryProxy()); this->addOperation(readoperation); - + addLink(readoperation->getOutputSocket(), input); - + readoperation->readResolutionFromWriteBuffer(); } @@ -502,11 +502,11 @@ void NodeOperationBuilder::add_output_buffers(NodeOperation *operation, NodeOper OpInputs targets = cache_output_links(output); if (targets.empty()) return; - + WriteBufferOperation *writeOperation = NULL; for (OpInputs::const_iterator it = targets.begin(); it != targets.end(); ++it) { NodeOperationInput *target = *it; - + /* try to find existing write buffer operation */ if (target->getOperation().isWriteBufferOperation()) { BLI_assert(writeOperation == NULL); /* there should only be one write op connected */ @@ -517,30 +517,30 @@ void NodeOperationBuilder::add_output_buffers(NodeOperation *operation, NodeOper removeInputLink(target); } } - + /* if no write buffer operation exists yet, create a new one */ if (!writeOperation) { writeOperation = new WriteBufferOperation(operation->getOutputSocket()->getDataType()); writeOperation->setbNodeTree(m_context->getbNodeTree()); addOperation(writeOperation); - + addLink(output, writeOperation->getInputSocket(0)); } - + writeOperation->readResolutionFromInputSocket(); - + /* add readbuffer op for every former connected input */ for (OpInputs::const_iterator it = targets.begin(); it != targets.end(); ++it) { NodeOperationInput *target = *it; if (&target->getOperation() == writeOperation) continue; /* skip existing write op links */ - + ReadBufferOperation *readoperation = new ReadBufferOperation(operation->getOutputSocket()->getDataType()); readoperation->setMemoryProxy(writeOperation->getMemoryProxy()); addOperation(readoperation); - + addLink(readoperation->getOutputSocket(), target); - + readoperation->readResolutionFromWriteBuffer(); } } @@ -554,15 +554,15 @@ void NodeOperationBuilder::add_complex_operation_buffers() for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) if ((*it)->isComplex()) complex_ops.push_back(*it); - + for (Operations::const_iterator it = complex_ops.begin(); it != complex_ops.end(); ++it) { NodeOperation *op = *it; - + DebugInfo::operation_read_write_buffer(op); - + for (int index = 0; index < op->getNumberOfInputSockets(); index++) add_input_buffers(op, op->getInputSocket(index)); - + for (int index = 0; index < op->getNumberOfOutputSockets(); index++) add_output_buffers(op, op->getOutputSocket(index)); } @@ -575,13 +575,13 @@ static void find_reachable_operations_recursive(Tags &reachable, NodeOperation * if (reachable.find(op) != reachable.end()) return; reachable.insert(op); - + for (int i = 0; i < op->getNumberOfInputSockets(); ++i) { NodeOperationInput *input = op->getInputSocket(i); if (input->isConnected()) find_reachable_operations_recursive(reachable, &input->getLink()->getOperation()); } - + /* associated write-buffer operations are executed as well */ if (op->isReadBufferOperation()) { ReadBufferOperation *read_op = (ReadBufferOperation *)op; @@ -595,17 +595,17 @@ void NodeOperationBuilder::prune_operations() Tags reachable; for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) { NodeOperation *op = *it; - + /* output operations are primary executed operations */ if (op->isOutputOperation(m_context->isRendering())) find_reachable_operations_recursive(reachable, op); } - + /* delete unreachable operations */ Operations reachable_ops; for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) { NodeOperation *op = *it; - + if (reachable.find(op) != reachable.end()) reachable_ops.push_back(op); else @@ -621,13 +621,13 @@ static void sort_operations_recursive(NodeOperationBuilder::Operations &sorted, if (visited.find(op) != visited.end()) return; visited.insert(op); - + for (int i = 0; i < op->getNumberOfInputSockets(); ++i) { NodeOperationInput *input = op->getInputSocket(i); if (input->isConnected()) sort_operations_recursive(sorted, visited, &input->getLink()->getOperation()); } - + sorted.push_back(op); } @@ -636,10 +636,10 @@ void NodeOperationBuilder::sort_operations() Operations sorted; sorted.reserve(m_operations.size()); Tags visited; - + for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) sort_operations_recursive(sorted, visited, *it); - + m_operations = sorted; } @@ -648,10 +648,10 @@ static void add_group_operations_recursive(Tags &visited, NodeOperation *op, Exe if (visited.find(op) != visited.end()) return; visited.insert(op); - + if (!group->addOperation(op)) return; - + /* add all eligible input ops to the group */ for (int i = 0; i < op->getNumberOfInputSockets(); ++i) { NodeOperationInput *input = op->getInputSocket(i); @@ -664,10 +664,10 @@ ExecutionGroup *NodeOperationBuilder::make_group(NodeOperation *op) { ExecutionGroup *group = new ExecutionGroup(); m_groups.push_back(group); - + Tags visited; add_group_operations_recursive(visited, op, group); - + return group; } @@ -675,17 +675,17 @@ void NodeOperationBuilder::group_operations() { for (Operations::const_iterator it = m_operations.begin(); it != m_operations.end(); ++it) { NodeOperation *op = *it; - + if (op->isOutputOperation(m_context->isRendering())) { ExecutionGroup *group = make_group(op); group->setOutputExecutionGroup(true); } - + /* add new groups for associated memory proxies where needed */ if (op->isReadBufferOperation()) { ReadBufferOperation *read_op = (ReadBufferOperation *)op; MemoryProxy *memproxy = read_op->getMemoryProxy(); - + if (memproxy->getExecutor() == NULL) { ExecutionGroup *group = make_group(memproxy->getWriteBufferOperation()); memproxy->setExecutor(group); diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.h b/source/blender/compositor/intern/COM_NodeOperationBuilder.h index 2bb5b94c57f..0eafd27b46a 100644 --- a/source/blender/compositor/intern/COM_NodeOperationBuilder.h +++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.h @@ -52,48 +52,48 @@ public: private: NodeOperationOutput *m_from; NodeOperationInput *m_to; - + public: Link(NodeOperationOutput *from, NodeOperationInput *to) : m_from(from), m_to(to) {} - + NodeOperationOutput *from() const { return m_from; } NodeOperationInput *to() const { return m_to; } }; - + typedef std::vector<NodeOperation *> Operations; typedef std::vector<Link> Links; typedef std::vector<ExecutionGroup *> Groups; - + typedef std::map<NodeOperationInput *, NodeInput *> InputSocketMap; typedef std::map<NodeOutput *, NodeOperationOutput *> OutputSocketMap; - + typedef std::vector<NodeOperationInput *> OpInputs; typedef std::map<NodeInput *, OpInputs> OpInputInverseMap; - + private: const CompositorContext *m_context; NodeGraph m_graph; - + Operations m_operations; Links m_links; Groups m_groups; - + /** Maps operation inputs to node inputs */ InputSocketMap m_input_map; /** Maps node outputs to operation outputs */ OutputSocketMap m_output_map; - + Node *m_current_node; - + /** Operation that will be writing to the viewer image * Only one operation can occupy this place at a time, * to avoid race conditions */ ViewerOperation *m_active_viewer; - + public: NodeOperationBuilder(const CompositorContext *context, bNodeTree *b_nodetree); ~NodeOperationBuilder(); @@ -103,43 +103,43 @@ public: void convertToOperations(ExecutionSystem *system); void addOperation(NodeOperation *operation); - + /** Map input socket of the current node to an operation socket */ void mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket); /** Map output socket of the current node to an operation socket */ void mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket); - + void addLink(NodeOperationOutput *from, NodeOperationInput *to); void removeInputLink(NodeOperationInput *to); - + /** Add a preview operation for a operation output */ void addPreview(NodeOperationOutput *output); /** Add a preview operation for a node input */ void addNodeInputPreview(NodeInput *input); - + /** Define a viewer operation as the active output, if possible */ void registerViewer(ViewerOperation *viewer); /** The currently active viewer output operation */ ViewerOperation *active_viewer() const { return m_active_viewer; } - + protected: static NodeInput *find_node_input(const InputSocketMap &map, NodeOperationInput *op_input); static const OpInputs &find_operation_inputs(const OpInputInverseMap &map, NodeInput *node_input); static NodeOperationOutput *find_operation_output(const OutputSocketMap &map, NodeOutput *node_output); - + /** Add datatype conversion where needed */ void add_datatype_conversions(); - + /** Construct a constant value operation for every unconnected input */ void add_operation_input_constants(); void add_input_constant_value(NodeOperationInput *input, NodeInput *node_input); - + /** Replace proxy operations with direct links */ void resolve_proxies(); - + /** Calculate resolution for each operation */ void determineResolutions(); - + /** Helper function to store connected inputs for replacement */ OpInputs cache_output_links(NodeOperationOutput *output) const; /** Find a connected write buffer operation to an OpOutput */ @@ -148,17 +148,17 @@ protected: void add_complex_operation_buffers(); void add_input_buffers(NodeOperation *operation, NodeOperationInput *input); void add_output_buffers(NodeOperation *operation, NodeOperationOutput *output); - + /** Remove unreachable operations */ void prune_operations(); - + /** Sort operations by link dependencies */ void sort_operations(); - + /** Create execution groups */ void group_operations(); ExecutionGroup *make_group(NodeOperation *op); - + private: PreviewOperation *make_preview_operation() const; diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cpp b/source/blender/compositor/intern/COM_OpenCLDevice.cpp index 54044f747fb..881c7b8f49a 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.cpp +++ b/source/blender/compositor/intern/COM_OpenCLDevice.cpp @@ -74,7 +74,7 @@ void OpenCLDevice::execute(WorkPackage *work) chunkNumber, inputBuffers, outputBuffer); delete outputBuffer; - + executionGroup->finalizeChunkExecution(chunkNumber, inputBuffers); } cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex, @@ -106,7 +106,7 @@ cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, ReadBufferOperation *reader) { cl_int error; - + MemoryBuffer *result = reader->getInputMemoryBuffer(inputMemoryBuffers); const cl_image_format *imageFormat = determineImageFormat(result); diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.h b/source/blender/compositor/intern/COM_OpenCLDevice.h index 78d3c66cb5c..fa358f65ddf 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.h +++ b/source/blender/compositor/intern/COM_OpenCLDevice.h @@ -42,17 +42,17 @@ private: * @brief opencl context */ cl_context m_context; - + /** * @brief opencl device */ cl_device_id m_device; - + /** * @brief opencl program */ cl_program m_program; - + /** * @brief opencl command queue */ @@ -72,8 +72,8 @@ public: * @param vendorID */ OpenCLDevice(cl_context context, cl_device_id device, cl_program program, cl_int vendorId); - - + + /** * @brief initialize the device * During initialization the OpenCL cl_command_queue is created @@ -81,13 +81,13 @@ public: * @see queue */ bool initialize(); - + /** * @brief deinitialize the device * During deintiialization the command queue is cleared */ void deinitialize(); - + /** * @brief execute a WorkPackage * @param work the WorkPackage to execute diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp b/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp index 27d4d0951e8..9ab67a40055 100644 --- a/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp +++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp @@ -49,7 +49,7 @@ void SingleThreadedOperation::deinitExecution() void *SingleThreadedOperation::initializeTileData(rcti *rect) { if (this->m_cachedInstance) return this->m_cachedInstance; - + lockMutex(); if (this->m_cachedInstance == NULL) { // diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.h b/source/blender/compositor/intern/COM_SingleThreadedOperation.h index 82d0b04e064..e0dc06ef733 100644 --- a/source/blender/compositor/intern/COM_SingleThreadedOperation.h +++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.h @@ -27,7 +27,7 @@ class SingleThreadedOperation : public NodeOperation { private: MemoryBuffer *m_cachedInstance; - + protected: inline bool isCached() { return this->m_cachedInstance != NULL; @@ -35,17 +35,17 @@ protected: public: SingleThreadedOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ @@ -54,7 +54,7 @@ public: void *initializeTileData(rcti *rect); virtual MemoryBuffer *createMemoryBuffer(rcti *rect) = 0; - + int isSingleThreaded() { return true; } }; #endif diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp index ce45b9fdbe9..4136983e13c 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.cpp +++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp @@ -85,7 +85,7 @@ void *WorkScheduler::thread_execute_cpu(void *data) device->execute(work); delete work; } - + return NULL; } @@ -93,12 +93,12 @@ void *WorkScheduler::thread_execute_gpu(void *data) { Device *device = (Device *)data; WorkPackage *work; - + while ((work = (WorkPackage *)BLI_thread_queue_pop(g_gpuqueue))) { device->execute(work); delete work; } - + return NULL; } #endif diff --git a/source/blender/compositor/intern/COM_WorkScheduler.h b/source/blender/compositor/intern/COM_WorkScheduler.h index 7f07978a9c7..14b02e70913 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.h +++ b/source/blender/compositor/intern/COM_WorkScheduler.h @@ -53,7 +53,7 @@ class WorkScheduler { * inside this loop new work is queried and being executed */ static void *thread_execute_gpu(void *data); -#endif +#endif public: /** * @brief schedule a chunk of a group to be calculated. diff --git a/source/blender/compositor/intern/COM_compositor.cpp b/source/blender/compositor/intern/COM_compositor.cpp index 467286084f9..4599832b433 100644 --- a/source/blender/compositor/intern/COM_compositor.cpp +++ b/source/blender/compositor/intern/COM_compositor.cpp @@ -94,7 +94,7 @@ void COM_execute(RenderData *rd, Scene *scene, bNodeTree *editingtree, int rende ExecutionSystem *system = new ExecutionSystem(rd, scene, editingtree, rendering, twopass, viewSettings, displaySettings, viewName); system->execute(); delete system; - + if (editingtree->test_break(editingtree->tbh)) { // during editing multiple calls to this method can be triggered. // make sure one the last one will be doing the work. diff --git a/source/blender/compositor/nodes/COM_AlphaOverNode.cpp b/source/blender/compositor/nodes/COM_AlphaOverNode.cpp index 0c35f079a8b..3481fd1addd 100644 --- a/source/blender/compositor/nodes/COM_AlphaOverNode.cpp +++ b/source/blender/compositor/nodes/COM_AlphaOverNode.cpp @@ -35,14 +35,14 @@ void AlphaOverNode::convertToOperations(NodeConverter &converter, const Composit NodeInput *color1Socket = this->getInputSocket(1); NodeInput *color2Socket = this->getInputSocket(2); bNode *editorNode = this->getbNode(); - + MixBaseOperation *convertProg; NodeTwoFloats *ntf = (NodeTwoFloats *)editorNode->storage; if (ntf->x != 0.0f) { AlphaOverMixedOperation *mixOperation = new AlphaOverMixedOperation(); mixOperation->setX(ntf->x); convertProg = mixOperation; - + } else if (editorNode->custom1) { convertProg = new AlphaOverKeyOperation(); @@ -50,7 +50,7 @@ void AlphaOverNode::convertToOperations(NodeConverter &converter, const Composit else { convertProg = new AlphaOverPremultiplyOperation(); } - + convertProg->setUseValueAlphaMultiply(false); if (color1Socket->isLinked()) { convertProg->setResolutionInputSocketIndex(1); @@ -61,7 +61,7 @@ void AlphaOverNode::convertToOperations(NodeConverter &converter, const Composit else { convertProg->setResolutionInputSocketIndex(0); } - + converter.addOperation(convertProg); converter.mapInputSocket(getInputSocket(0), convertProg->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), convertProg->getInputSocket(1)); diff --git a/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp b/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp index fe6b447b23b..dba1a009417 100644 --- a/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BilateralBlurNode.cpp @@ -36,7 +36,7 @@ void BilateralBlurNode::convertToOperations(NodeConverter &converter, const Comp BilateralBlurOperation *operation = new BilateralBlurOperation(); operation->setQuality(context.getQuality()); operation->setData(data); - + converter.addOperation(operation); converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); diff --git a/source/blender/compositor/nodes/COM_BlurNode.cpp b/source/blender/compositor/nodes/COM_BlurNode.cpp index 66ccbaa4de8..ed1c15d15a2 100644 --- a/source/blender/compositor/nodes/COM_BlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BlurNode.cpp @@ -56,9 +56,9 @@ void BlurNode::convertToOperations(NodeConverter &converter, const CompositorCon operationfgb->setData(data); operationfgb->setExtendBounds(extend_bounds); converter.addOperation(operationfgb); - + converter.mapInputSocket(getInputSocket(1), operationfgb->getInputSocket(1)); - + input_operation = operationfgb; output_operation = operationfgb; } @@ -67,12 +67,12 @@ void BlurNode::convertToOperations(NodeConverter &converter, const CompositorCon SetValueOperation *zero = new SetValueOperation(); zero->setValue(0.0f); clamp->setUseClamp(true); - + converter.addOperation(clamp); converter.addOperation(zero); converter.mapInputSocket(getInputSocket(1), clamp->getInputSocket(0)); converter.addLink(zero->getOutputSocket(), clamp->getInputSocket(1)); - + GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation(); operationx->setData(data); operationx->setQuality(quality); @@ -80,10 +80,10 @@ void BlurNode::convertToOperations(NodeConverter &converter, const CompositorCon operationx->setFalloff(PROP_SMOOTH); operationx->setSubtract(false); operationx->setExtendBounds(extend_bounds); - + converter.addOperation(operationx); converter.addLink(clamp->getOutputSocket(), operationx->getInputSocket(0)); - + GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation(); operationy->setData(data); operationy->setQuality(quality); @@ -94,7 +94,7 @@ void BlurNode::convertToOperations(NodeConverter &converter, const CompositorCon converter.addOperation(operationy); converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0)); - + GaussianBlurReferenceOperation *operation = new GaussianBlurReferenceOperation(); operation->setData(data); operation->setQuality(quality); @@ -102,7 +102,7 @@ void BlurNode::convertToOperations(NodeConverter &converter, const CompositorCon converter.addOperation(operation); converter.addLink(operationy->getOutputSocket(), operation->getInputSocket(1)); - + output_operation = operation; input_operation = operation; } @@ -115,7 +115,7 @@ void BlurNode::convertToOperations(NodeConverter &converter, const CompositorCon converter.addOperation(operationx); converter.mapInputSocket(getInputSocket(1), operationx->getInputSocket(1)); - + GaussianYBlurOperation *operationy = new GaussianYBlurOperation(); operationy->setData(data); operationy->setQuality(quality); @@ -156,18 +156,18 @@ void BlurNode::convertToOperations(NodeConverter &converter, const CompositorCon GammaUncorrectOperation *inverse = new GammaUncorrectOperation(); converter.addOperation(correct); converter.addOperation(inverse); - + converter.mapInputSocket(getInputSocket(0), correct->getInputSocket(0)); converter.addLink(correct->getOutputSocket(), input_operation->getInputSocket(0)); converter.addLink(output_operation->getOutputSocket(), inverse->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(), inverse->getOutputSocket()); - + converter.addPreview(inverse->getOutputSocket()); } else { converter.mapInputSocket(getInputSocket(0), input_operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(), output_operation->getOutputSocket()); - + converter.addPreview(output_operation->getOutputSocket()); } } diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp index b71f2f5fa07..b36e8cc4c53 100644 --- a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp @@ -49,7 +49,7 @@ void BokehBlurNode::convertToOperations(NodeConverter &converter, const Composit operation->setThreshold(0.0f); operation->setMaxBlur(b_node->custom4); operation->setDoScaleSize(true); - + converter.addOperation(operation); converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); @@ -60,7 +60,7 @@ void BokehBlurNode::convertToOperations(NodeConverter &converter, const Composit BokehBlurOperation *operation = new BokehBlurOperation(); operation->setQuality(context.getQuality()); operation->setExtendBounds(extend_bounds); - + converter.addOperation(operation); converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); diff --git a/source/blender/compositor/nodes/COM_BokehImageNode.cpp b/source/blender/compositor/nodes/COM_BokehImageNode.cpp index 7f25a19ee37..7a388f80def 100644 --- a/source/blender/compositor/nodes/COM_BokehImageNode.cpp +++ b/source/blender/compositor/nodes/COM_BokehImageNode.cpp @@ -33,9 +33,9 @@ void BokehImageNode::convertToOperations(NodeConverter &converter, const Composi { BokehImageOperation *operation = new BokehImageOperation(); operation->setData((NodeBokehImage *)this->getbNode()->storage); - + converter.addOperation(operation); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); - + converter.addPreview(operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_BoxMaskNode.cpp b/source/blender/compositor/nodes/COM_BoxMaskNode.cpp index b3cffb90459..f798c95b1b1 100644 --- a/source/blender/compositor/nodes/COM_BoxMaskNode.cpp +++ b/source/blender/compositor/nodes/COM_BoxMaskNode.cpp @@ -36,13 +36,13 @@ void BoxMaskNode::convertToOperations(NodeConverter &converter, const Compositor { NodeInput *inputSocket = this->getInputSocket(0); NodeOutput *outputSocket = this->getOutputSocket(0); - + BoxMaskOperation *operation; operation = new BoxMaskOperation(); operation->setData((NodeBoxMask *)this->getbNode()->storage); operation->setMaskType(this->getbNode()->custom1); converter.addOperation(operation); - + if (inputSocket->isLinked()) { converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); diff --git a/source/blender/compositor/nodes/COM_BrightnessNode.cpp b/source/blender/compositor/nodes/COM_BrightnessNode.cpp index fc7294eb6b1..b2422a230cd 100644 --- a/source/blender/compositor/nodes/COM_BrightnessNode.cpp +++ b/source/blender/compositor/nodes/COM_BrightnessNode.cpp @@ -35,7 +35,7 @@ void BrightnessNode::convertToOperations(NodeConverter &converter, const Composi BrightnessOperation *operation = new BrightnessOperation(); operation->setUsePremultiply((bnode->custom1 & 1) != 0); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); diff --git a/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp b/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp index 2c985cd5bd1..d725ad135a5 100644 --- a/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_ChromaMatteNode.cpp @@ -33,35 +33,35 @@ ChromaMatteNode::ChromaMatteNode(bNode *editorNode) : Node(editorNode) void ChromaMatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const { bNode *editorsnode = getbNode(); - + NodeInput *inputSocketImage = this->getInputSocket(0); NodeInput *inputSocketKey = this->getInputSocket(1); NodeOutput *outputSocketImage = this->getOutputSocket(0); NodeOutput *outputSocketMatte = this->getOutputSocket(1); - + ConvertRGBToYCCOperation *operationRGBToYCC_Image = new ConvertRGBToYCCOperation(); ConvertRGBToYCCOperation *operationRGBToYCC_Key = new ConvertRGBToYCCOperation(); operationRGBToYCC_Image->setMode(BLI_YCC_ITU_BT709); operationRGBToYCC_Key->setMode(BLI_YCC_ITU_BT709); converter.addOperation(operationRGBToYCC_Image); converter.addOperation(operationRGBToYCC_Key); - + ChromaMatteOperation *operation = new ChromaMatteOperation(); operation->setSettings((NodeChroma *)editorsnode->storage); converter.addOperation(operation); - + SetAlphaOperation *operationAlpha = new SetAlphaOperation(); converter.addOperation(operationAlpha); - + converter.mapInputSocket(inputSocketImage, operationRGBToYCC_Image->getInputSocket(0)); converter.mapInputSocket(inputSocketKey, operationRGBToYCC_Key->getInputSocket(0)); converter.addLink(operationRGBToYCC_Image->getOutputSocket(), operation->getInputSocket(0)); converter.addLink(operationRGBToYCC_Key->getOutputSocket(), operation->getInputSocket(1)); converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket()); - + converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0)); converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1)); converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket()); - + converter.addPreview(operationAlpha->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp b/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp index 98d2e048807..28966beb4f4 100644 --- a/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp @@ -36,11 +36,11 @@ void ColorBalanceNode::convertToOperations(NodeConverter &converter, const Compo { bNode *node = this->getbNode(); NodeColorBalance *n = (NodeColorBalance *)node->storage; - + NodeInput *inputSocket = this->getInputSocket(0); NodeInput *inputImageSocket = this->getInputSocket(1); NodeOutput *outputSocket = this->getOutputSocket(0); - + NodeOperation *operation; if (node->custom1 == 0) { ColorBalanceLGGOperation *operationLGG = new ColorBalanceLGGOperation(); @@ -69,7 +69,7 @@ void ColorBalanceNode::convertToOperations(NodeConverter &converter, const Compo operation = operationCDL; } converter.addOperation(operation); - + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); converter.mapInputSocket(inputImageSocket, operation->getInputSocket(1)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); diff --git a/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp b/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp index c4eefe038a5..72943f6b53f 100644 --- a/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp @@ -32,14 +32,14 @@ ColorCorrectionNode::ColorCorrectionNode(bNode *editorNode) : Node(editorNode) void ColorCorrectionNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const { bNode *editorNode = getbNode(); - + ColorCorrectionOperation *operation = new ColorCorrectionOperation(); operation->setData((NodeColorCorrection *)editorNode->storage); operation->setRedChannelEnabled((editorNode->custom1 & 1) > 0); operation->setGreenChannelEnabled((editorNode->custom1 & 2) > 0); operation->setBlueChannelEnabled((editorNode->custom1 & 4) > 0); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); diff --git a/source/blender/compositor/nodes/COM_ColorCurveNode.cpp b/source/blender/compositor/nodes/COM_ColorCurveNode.cpp index 41052ef536d..fb8587adabb 100644 --- a/source/blender/compositor/nodes/COM_ColorCurveNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorCurveNode.cpp @@ -35,12 +35,12 @@ void ColorCurveNode::convertToOperations(NodeConverter &converter, const Composi ColorCurveOperation *operation = new ColorCurveOperation(); operation->setCurveMapping((CurveMapping *)this->getbNode()->storage); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(3)); - + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } else { @@ -52,7 +52,7 @@ void ColorCurveNode::convertToOperations(NodeConverter &converter, const Composi operation->setWhiteLevel(col); operation->setCurveMapping((CurveMapping *)this->getbNode()->storage); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); diff --git a/source/blender/compositor/nodes/COM_ColorMatteNode.cpp b/source/blender/compositor/nodes/COM_ColorMatteNode.cpp index f7c20894087..477fdddff8a 100644 --- a/source/blender/compositor/nodes/COM_ColorMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorMatteNode.cpp @@ -33,33 +33,33 @@ ColorMatteNode::ColorMatteNode(bNode *editorNode) : Node(editorNode) void ColorMatteNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const { bNode *editorsnode = getbNode(); - + NodeInput *inputSocketImage = this->getInputSocket(0); NodeInput *inputSocketKey = this->getInputSocket(1); NodeOutput *outputSocketImage = this->getOutputSocket(0); NodeOutput *outputSocketMatte = this->getOutputSocket(1); - + ConvertRGBToHSVOperation *operationRGBToHSV_Image = new ConvertRGBToHSVOperation(); ConvertRGBToHSVOperation *operationRGBToHSV_Key = new ConvertRGBToHSVOperation(); converter.addOperation(operationRGBToHSV_Image); converter.addOperation(operationRGBToHSV_Key); - + ColorMatteOperation *operation = new ColorMatteOperation(); operation->setSettings((NodeChroma *)editorsnode->storage); converter.addOperation(operation); - + SetAlphaOperation *operationAlpha = new SetAlphaOperation(); converter.addOperation(operationAlpha); - + converter.mapInputSocket(inputSocketImage, operationRGBToHSV_Image->getInputSocket(0)); converter.mapInputSocket(inputSocketKey, operationRGBToHSV_Key->getInputSocket(0)); converter.addLink(operationRGBToHSV_Image->getOutputSocket(), operation->getInputSocket(0)); converter.addLink(operationRGBToHSV_Key->getOutputSocket(), operation->getInputSocket(1)); converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket(0)); - + converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0)); converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1)); converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket()); - + converter.addPreview(operationAlpha->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_ColorNode.cpp b/source/blender/compositor/nodes/COM_ColorNode.cpp index 2c37a927e46..c9254b30e8e 100644 --- a/source/blender/compositor/nodes/COM_ColorNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorNode.cpp @@ -37,6 +37,6 @@ void ColorNode::convertToOperations(NodeConverter &converter, const CompositorCo output->getEditorValueColor(col); operation->setChannels(col); converter.addOperation(operation); - + converter.mapOutputSocket(output, operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_ColorRampNode.cpp b/source/blender/compositor/nodes/COM_ColorRampNode.cpp index 175267a3a4f..3e5128fa0fa 100644 --- a/source/blender/compositor/nodes/COM_ColorRampNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorRampNode.cpp @@ -42,14 +42,14 @@ void ColorRampNode::convertToOperations(NodeConverter &converter, const Composit ColorRampOperation *operation = new ColorRampOperation(); operation->setColorBand((ColorBand *)editorNode->storage); converter.addOperation(operation); - + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); - + SeparateChannelOperation *operation2 = new SeparateChannelOperation(); operation2->setChannel(3); converter.addOperation(operation2); - + converter.addLink(operation->getOutputSocket(), operation2->getInputSocket(0)); converter.mapOutputSocket(outputSocketAlpha, operation2->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_ColorSpillNode.cpp b/source/blender/compositor/nodes/COM_ColorSpillNode.cpp index f33f2858397..bef518bb186 100644 --- a/source/blender/compositor/nodes/COM_ColorSpillNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorSpillNode.cpp @@ -32,18 +32,18 @@ ColorSpillNode::ColorSpillNode(bNode *editorNode) : Node(editorNode) void ColorSpillNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const { bNode *editorsnode = getbNode(); - + NodeInput *inputSocketImage = this->getInputSocket(0); NodeInput *inputSocketFac = this->getInputSocket(1); NodeOutput *outputSocketImage = this->getOutputSocket(0); - + ColorSpillOperation *operation; operation = new ColorSpillOperation(); operation->setSettings((NodeColorspill *)editorsnode->storage); operation->setSpillChannel(editorsnode->custom1 - 1); // Channel for spilling operation->setSpillMethod(editorsnode->custom2); // Channel method converter.addOperation(operation); - + converter.mapInputSocket(inputSocketImage, operation->getInputSocket(0)); converter.mapInputSocket(inputSocketFac, operation->getInputSocket(1)); converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket()); diff --git a/source/blender/compositor/nodes/COM_ColorToBWNode.cpp b/source/blender/compositor/nodes/COM_ColorToBWNode.cpp index 2ce4dd5d3a8..1b26354117a 100644 --- a/source/blender/compositor/nodes/COM_ColorToBWNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorToBWNode.cpp @@ -34,10 +34,10 @@ void ColorToBWNode::convertToOperations(NodeConverter &converter, const Composit { NodeInput *colorSocket = this->getInputSocket(0); NodeOutput *valueSocket = this->getOutputSocket(0); - + ConvertColorToBWOperation *convertProg = new ConvertColorToBWOperation(); converter.addOperation(convertProg); - + converter.mapInputSocket(colorSocket, convertProg->getInputSocket(0)); converter.mapOutputSocket(valueSocket, convertProg->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_CombineColorNode.cpp b/source/blender/compositor/nodes/COM_CombineColorNode.cpp index b7b84b9986c..ad410038c65 100644 --- a/source/blender/compositor/nodes/COM_CombineColorNode.cpp +++ b/source/blender/compositor/nodes/COM_CombineColorNode.cpp @@ -38,7 +38,7 @@ void CombineColorNode::convertToOperations(NodeConverter &converter, const Compo NodeInput *inputBSocket = this->getInputSocket(2); NodeInput *inputASocket = this->getInputSocket(3); NodeOutput *outputSocket = this->getOutputSocket(0); - + CombineChannelsOperation *operation = new CombineChannelsOperation(); if (inputRSocket->isLinked()) { operation->setResolutionInputSocketIndex(0); @@ -53,16 +53,16 @@ void CombineColorNode::convertToOperations(NodeConverter &converter, const Compo operation->setResolutionInputSocketIndex(3); } converter.addOperation(operation); - + converter.mapInputSocket(inputRSocket, operation->getInputSocket(0)); converter.mapInputSocket(inputGSocket, operation->getInputSocket(1)); converter.mapInputSocket(inputBSocket, operation->getInputSocket(2)); converter.mapInputSocket(inputASocket, operation->getInputSocket(3)); - + NodeOperation *color_conv = getColorConverter(context); if (color_conv) { converter.addOperation(color_conv); - + converter.addLink(operation->getOutputSocket(), color_conv->getInputSocket(0)); converter.mapOutputSocket(outputSocket, color_conv->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_CombineColorNode.h b/source/blender/compositor/nodes/COM_CombineColorNode.h index 4cb626ea384..d5439e0056c 100644 --- a/source/blender/compositor/nodes/COM_CombineColorNode.h +++ b/source/blender/compositor/nodes/COM_CombineColorNode.h @@ -30,7 +30,7 @@ class CombineColorNode : public Node { public: CombineColorNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; - + protected: virtual NodeOperation *getColorConverter(const CompositorContext &context) const = 0; }; @@ -40,7 +40,7 @@ public: CombineRGBANode(bNode *editorNode) : CombineColorNode(editorNode) {} - + NodeOperation *getColorConverter(const CompositorContext &context) const; }; @@ -49,7 +49,7 @@ public: CombineHSVANode(bNode *editorNode) : CombineColorNode(editorNode) {} - + NodeOperation *getColorConverter(const CompositorContext &context) const; }; @@ -58,7 +58,7 @@ public: CombineYCCANode(bNode *editorNode) : CombineColorNode(editorNode) {} - + NodeOperation *getColorConverter(const CompositorContext &context) const; }; @@ -67,7 +67,7 @@ public: CombineYUVANode(bNode *editorNode) : CombineColorNode(editorNode) {} - + NodeOperation *getColorConverter(const CompositorContext &context) const; }; diff --git a/source/blender/compositor/nodes/COM_CompositorNode.cpp b/source/blender/compositor/nodes/COM_CompositorNode.cpp index b2a1df7ee9e..002f28f3135 100644 --- a/source/blender/compositor/nodes/COM_CompositorNode.cpp +++ b/source/blender/compositor/nodes/COM_CompositorNode.cpp @@ -49,7 +49,7 @@ void CompositorNode::convertToOperations(NodeConverter &converter, const Composi /* alpha socket gives either 1 or a custom alpha value if "use alpha" is enabled */ compositorOperation->setUseAlphaInput(ignore_alpha || alphaSocket->isLinked()); compositorOperation->setActive(is_active); - + converter.addOperation(compositorOperation); converter.mapInputSocket(imageSocket, compositorOperation->getInputSocket(0)); /* only use alpha link if "use alpha" is enabled */ @@ -58,6 +58,6 @@ void CompositorNode::convertToOperations(NodeConverter &converter, const Composi else converter.mapInputSocket(alphaSocket, compositorOperation->getInputSocket(1)); converter.mapInputSocket(depthSocket, compositorOperation->getInputSocket(2)); - + converter.addNodeInputPreview(imageSocket); } diff --git a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp index fbf5dbb6253..75f72669e1e 100644 --- a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp +++ b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp @@ -35,9 +35,9 @@ void ConvertAlphaNode::convertToOperations(NodeConverter &converter, const Compo else { operation = new ConvertStraightToPremulOperation(); } - + converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_CornerPinNode.cpp b/source/blender/compositor/nodes/COM_CornerPinNode.cpp index 5e4e463595a..b03a3e64f83 100644 --- a/source/blender/compositor/nodes/COM_CornerPinNode.cpp +++ b/source/blender/compositor/nodes/COM_CornerPinNode.cpp @@ -46,7 +46,7 @@ void CornerPinNode::convertToOperations(NodeConverter &converter, const Composit converter.addOperation(warp_image_operation); PlaneCornerPinMaskOperation *plane_mask_operation = new PlaneCornerPinMaskOperation(); converter.addOperation(plane_mask_operation); - + converter.mapInputSocket(input_image, warp_image_operation->getInputSocket(0)); for (int i = 0; i < 4; ++i) { NodeInput *corner_input = getInputSocket(node_corner_index[i]); diff --git a/source/blender/compositor/nodes/COM_CropNode.cpp b/source/blender/compositor/nodes/COM_CropNode.cpp index 12eb5268be4..4f80b868f3a 100644 --- a/source/blender/compositor/nodes/COM_CropNode.cpp +++ b/source/blender/compositor/nodes/COM_CropNode.cpp @@ -45,7 +45,7 @@ void CropNode::convertToOperations(NodeConverter &converter, const CompositorCon operation->setCropSettings(cropSettings); operation->setRelative(relative); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(), operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_DefocusNode.cpp b/source/blender/compositor/nodes/COM_DefocusNode.cpp index 5df246db1d2..19bb42327f5 100644 --- a/source/blender/compositor/nodes/COM_DefocusNode.cpp +++ b/source/blender/compositor/nodes/COM_DefocusNode.cpp @@ -54,17 +54,17 @@ void DefocusNode::convertToOperations(NodeConverter &converter, const Compositor SetValueOperation *maxRadius = new SetValueOperation(); maxRadius->setValue(data->maxblur); MathMinimumOperation *minimize = new MathMinimumOperation(); - + converter.addOperation(multiply); converter.addOperation(multiplier); converter.addOperation(maxRadius); converter.addOperation(minimize); - + converter.mapInputSocket(getInputSocket(1), multiply->getInputSocket(0)); converter.addLink(multiplier->getOutputSocket(), multiply->getInputSocket(1)); converter.addLink(multiply->getOutputSocket(), minimize->getInputSocket(0)); converter.addLink(maxRadius->getOutputSocket(), minimize->getInputSocket(1)); - + radiusOperation = minimize; } else { @@ -73,20 +73,20 @@ void DefocusNode::convertToOperations(NodeConverter &converter, const Compositor radius_op->setfStop(data->fstop); radius_op->setMaxRadius(data->maxblur); converter.addOperation(radius_op); - + converter.mapInputSocket(getInputSocket(1), radius_op->getInputSocket(0)); - + FastGaussianBlurValueOperation *blur = new FastGaussianBlurValueOperation(); /* maintain close pixels so far Z values don't bleed into the foreground */ blur->setOverlay(FAST_GAUSS_OVERLAY_MIN); converter.addOperation(blur); - + converter.addLink(radius_op->getOutputSocket(0), blur->getInputSocket(0)); radius_op->setPostBlur(blur); - + radiusOperation = blur; } - + NodeBokehImage *bokehdata = new NodeBokehImage(); bokehdata->angle = data->rotation; bokehdata->rounding = 0.0f; @@ -97,20 +97,20 @@ void DefocusNode::convertToOperations(NodeConverter &converter, const Compositor } bokehdata->catadioptric = 0.0f; bokehdata->lensshift = 0.0f; - + BokehImageOperation *bokeh = new BokehImageOperation(); bokeh->setData(bokehdata); bokeh->deleteDataOnFinish(); converter.addOperation(bokeh); - + #ifdef COM_DEFOCUS_SEARCH InverseSearchRadiusOperation *search = new InverseSearchRadiusOperation(); search->setMaxBlur(data->maxblur); converter.addOperation(search); - + converter.addLink(radiusOperation->getOutputSocket(0), search->getInputSocket(0)); #endif - + VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation(); if (data->preview) operation->setQuality(COM_QUALITY_LOW); @@ -119,19 +119,19 @@ void DefocusNode::convertToOperations(NodeConverter &converter, const Compositor operation->setMaxBlur(data->maxblur); operation->setThreshold(data->bthresh); converter.addOperation(operation); - + converter.addLink(bokeh->getOutputSocket(), operation->getInputSocket(1)); converter.addLink(radiusOperation->getOutputSocket(), operation->getInputSocket(2)); #ifdef COM_DEFOCUS_SEARCH converter.addLink(search->getOutputSocket(), operation->getInputSocket(3)); #endif - + if (data->gamco) { GammaCorrectOperation *correct = new GammaCorrectOperation(); converter.addOperation(correct); GammaUncorrectOperation *inverse = new GammaUncorrectOperation(); converter.addOperation(inverse); - + converter.mapInputSocket(getInputSocket(0), correct->getInputSocket(0)); converter.addLink(correct->getOutputSocket(), operation->getInputSocket(0)); converter.addLink(operation->getOutputSocket(), inverse->getInputSocket(0)); diff --git a/source/blender/compositor/nodes/COM_DespeckleNode.cpp b/source/blender/compositor/nodes/COM_DespeckleNode.cpp index a21885bf42d..d211050389e 100644 --- a/source/blender/compositor/nodes/COM_DespeckleNode.cpp +++ b/source/blender/compositor/nodes/COM_DespeckleNode.cpp @@ -35,15 +35,15 @@ void DespeckleNode::convertToOperations(NodeConverter &converter, const Composit NodeInput *inputSocket = this->getInputSocket(0); NodeInput *inputImageSocket = this->getInputSocket(1); NodeOutput *outputSocket = this->getOutputSocket(0); - + DespeckleOperation *operation = new DespeckleOperation(); operation->setThreshold(editorNode->custom3); operation->setThresholdNeighbor(editorNode->custom4); converter.addOperation(operation); - + converter.mapInputSocket(inputImageSocket, operation->getInputSocket(0)); converter.mapInputSocket(inputSocket, operation->getInputSocket(1)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); - + converter.addPreview(operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp b/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp index f19cfd443a8..3867a543063 100644 --- a/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp @@ -41,17 +41,17 @@ void DifferenceMatteNode::convertToOperations(NodeConverter &converter, const Co DifferenceMatteOperation *operationSet = new DifferenceMatteOperation(); operationSet->setSettings((NodeChroma *)editorNode->storage); converter.addOperation(operationSet); - + converter.mapInputSocket(inputSocket, operationSet->getInputSocket(0)); converter.mapInputSocket(inputSocket2, operationSet->getInputSocket(1)); converter.mapOutputSocket(outputSocketMatte, operationSet->getOutputSocket(0)); SetAlphaOperation *operation = new SetAlphaOperation(); converter.addOperation(operation); - + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); converter.addLink(operationSet->getOutputSocket(), operation->getInputSocket(1)); converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket()); - + converter.addPreview(operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp index 6e78fcb38f1..102dba3b957 100644 --- a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp +++ b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp @@ -45,20 +45,20 @@ DilateErodeNode::DilateErodeNode(bNode *editorNode) : Node(editorNode) void DilateErodeNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { - + bNode *editorNode = this->getbNode(); if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE_THRESH) { DilateErodeThresholdOperation *operation = new DilateErodeThresholdOperation(); operation->setDistance(editorNode->custom2); operation->setInset(editorNode->custom3); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - + if (editorNode->custom3 < 2.0f) { AntiAliasOperation *antiAlias = new AntiAliasOperation(); converter.addOperation(antiAlias); - + converter.addLink(operation->getOutputSocket(), antiAlias->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), antiAlias->getOutputSocket(0)); } @@ -71,7 +71,7 @@ void DilateErodeNode::convertToOperations(NodeConverter &converter, const Compos DilateDistanceOperation *operation = new DilateDistanceOperation(); operation->setDistance(editorNode->custom2); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } @@ -79,7 +79,7 @@ void DilateErodeNode::convertToOperations(NodeConverter &converter, const Compos ErodeDistanceOperation *operation = new ErodeDistanceOperation(); operation->setDistance(-editorNode->custom2); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } @@ -93,20 +93,20 @@ void DilateErodeNode::convertToOperations(NodeConverter &converter, const Compos operationx->setQuality(quality); operationx->setFalloff(PROP_SMOOTH); converter.addOperation(operationx); - + converter.mapInputSocket(getInputSocket(0), operationx->getInputSocket(0)); // converter.mapInputSocket(getInputSocket(1), operationx->getInputSocket(1)); // no size input yet - + GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation(); operationy->setData(&m_alpha_blur); operationy->setQuality(quality); operationy->setFalloff(PROP_SMOOTH); converter.addOperation(operationy); - + converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0)); // converter.mapInputSocket(getInputSocket(1), operationy->getInputSocket(1)); // no size input yet converter.mapOutputSocket(getOutputSocket(0), operationy->getOutputSocket()); - + converter.addPreview(operationy->getOutputSocket()); /* TODO? */ @@ -134,7 +134,7 @@ void DilateErodeNode::convertToOperations(NodeConverter &converter, const Compos DilateStepOperation *operation = new DilateStepOperation(); operation->setIterations(editorNode->custom2); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } @@ -142,7 +142,7 @@ void DilateErodeNode::convertToOperations(NodeConverter &converter, const Compos ErodeStepOperation *operation = new ErodeStepOperation(); operation->setIterations(-editorNode->custom2); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp b/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp index 9a4ced2bf96..9f846c67b1d 100644 --- a/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_DirectionalBlurNode.cpp @@ -37,7 +37,7 @@ void DirectionalBlurNode::convertToOperations(NodeConverter &converter, const Co operation->setQuality(context.getQuality()); operation->setData(data); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp b/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp index 52c764f2223..fc05e0564bc 100644 --- a/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_DistanceMatteNode.cpp @@ -35,27 +35,27 @@ void DistanceMatteNode::convertToOperations(NodeConverter &converter, const Comp { bNode *editorsnode = getbNode(); NodeChroma *storage = (NodeChroma *)editorsnode->storage; - + NodeInput *inputSocketImage = this->getInputSocket(0); NodeInput *inputSocketKey = this->getInputSocket(1); NodeOutput *outputSocketImage = this->getOutputSocket(0); NodeOutput *outputSocketMatte = this->getOutputSocket(1); - + SetAlphaOperation *operationAlpha = new SetAlphaOperation(); converter.addOperation(operationAlpha); - + /* work in RGB color space */ NodeOperation *operation; if (storage->channel == 1) { DistanceRGBMatteOperation *matte = new DistanceRGBMatteOperation(); matte->setSettings(storage); converter.addOperation(matte); - + converter.mapInputSocket(inputSocketImage, matte->getInputSocket(0)); converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0)); - + converter.mapInputSocket(inputSocketKey, matte->getInputSocket(1)); - + operation = matte; } /* work in YCbCr color space */ @@ -63,27 +63,27 @@ void DistanceMatteNode::convertToOperations(NodeConverter &converter, const Comp DistanceYCCMatteOperation *matte = new DistanceYCCMatteOperation(); matte->setSettings(storage); converter.addOperation(matte); - + ConvertRGBToYCCOperation *operationYCCImage = new ConvertRGBToYCCOperation(); ConvertRGBToYCCOperation *operationYCCMatte = new ConvertRGBToYCCOperation(); operationYCCImage->setMode(BLI_YCC_ITU_BT709); operationYCCMatte->setMode(BLI_YCC_ITU_BT709); converter.addOperation(operationYCCImage); converter.addOperation(operationYCCMatte); - + converter.mapInputSocket(inputSocketImage, operationYCCImage->getInputSocket(0)); converter.addLink(operationYCCImage->getOutputSocket(), matte->getInputSocket(0)); converter.addLink(operationYCCImage->getOutputSocket(), operationAlpha->getInputSocket(0)); - + converter.mapInputSocket(inputSocketKey, operationYCCMatte->getInputSocket(0)); converter.addLink(operationYCCMatte->getOutputSocket(), matte->getInputSocket(1)); - + operation = matte; } - + converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket(0)); converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1)); - + if (storage->channel != 1) { ConvertYCCToRGBOperation *inv_convert = new ConvertYCCToRGBOperation(); inv_convert->setMode(BLI_YCC_ITU_BT709); diff --git a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp index 913d97a6395..1a10b912b23 100644 --- a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp +++ b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cpp @@ -33,12 +33,12 @@ void DoubleEdgeMaskNode::convertToOperations(NodeConverter &converter, const Com { DoubleEdgeMaskOperation *operation; bNode *bnode = this->getbNode(); - + operation = new DoubleEdgeMaskOperation(); operation->setAdjecentOnly(bnode->custom1); operation->setKeepInside(bnode->custom2); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); diff --git a/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp b/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp index c0c99a2efe8..60dc377518b 100644 --- a/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp +++ b/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp @@ -36,13 +36,13 @@ void EllipseMaskNode::convertToOperations(NodeConverter &converter, const Compos { NodeInput *inputSocket = this->getInputSocket(0); NodeOutput *outputSocket = this->getOutputSocket(0); - + EllipseMaskOperation *operation; operation = new EllipseMaskOperation(); operation->setData((NodeEllipseMask *)this->getbNode()->storage); operation->setMaskType(this->getbNode()->custom1); converter.addOperation(operation); - + if (inputSocket->isLinked()) { converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); @@ -68,6 +68,6 @@ void EllipseMaskNode::convertToOperations(NodeConverter &converter, const Compos converter.addLink(scaleOperation->getOutputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); } - + converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); } diff --git a/source/blender/compositor/nodes/COM_FilterNode.cpp b/source/blender/compositor/nodes/COM_FilterNode.cpp index 627f2a30f6e..ad25894929e 100644 --- a/source/blender/compositor/nodes/COM_FilterNode.cpp +++ b/source/blender/compositor/nodes/COM_FilterNode.cpp @@ -38,7 +38,7 @@ void FilterNode::convertToOperations(NodeConverter &converter, const CompositorC NodeInput *inputImageSocket = this->getInputSocket(1); NodeOutput *outputSocket = this->getOutputSocket(0); ConvolutionFilterOperation *operation = NULL; - + switch (this->getbNode()->custom1) { case CMP_FILT_SOFT: operation = new ConvolutionFilterOperation(); @@ -74,10 +74,10 @@ void FilterNode::convertToOperations(NodeConverter &converter, const CompositorC break; } converter.addOperation(operation); - + converter.mapInputSocket(inputImageSocket, operation->getInputSocket(0)); converter.mapInputSocket(inputSocket, operation->getInputSocket(1)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); - + converter.addPreview(operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_FlipNode.cpp b/source/blender/compositor/nodes/COM_FlipNode.cpp index 4cbae9bab66..2d1b60b784e 100644 --- a/source/blender/compositor/nodes/COM_FlipNode.cpp +++ b/source/blender/compositor/nodes/COM_FlipNode.cpp @@ -49,7 +49,7 @@ void FlipNode::convertToOperations(NodeConverter &converter, const CompositorCon operation->setFlipY(true); break; } - + converter.addOperation(operation); converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); diff --git a/source/blender/compositor/nodes/COM_GammaNode.cpp b/source/blender/compositor/nodes/COM_GammaNode.cpp index 383231ff326..fdee02b2d02 100644 --- a/source/blender/compositor/nodes/COM_GammaNode.cpp +++ b/source/blender/compositor/nodes/COM_GammaNode.cpp @@ -33,7 +33,7 @@ void GammaNode::convertToOperations(NodeConverter &converter, const CompositorCo { GammaOperation *operation = new GammaOperation(); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); diff --git a/source/blender/compositor/nodes/COM_GlareNode.cpp b/source/blender/compositor/nodes/COM_GlareNode.cpp index b52ef9ebb33..2e012b097b3 100644 --- a/source/blender/compositor/nodes/COM_GlareNode.cpp +++ b/source/blender/compositor/nodes/COM_GlareNode.cpp @@ -40,7 +40,7 @@ void GlareNode::convertToOperations(NodeConverter &converter, const CompositorCo { bNode *node = this->getbNode(); NodeGlare *glare = (NodeGlare *)node->storage; - + GlareBaseOperation *glareoperation = NULL; switch (glare->type) { default: @@ -59,17 +59,17 @@ void GlareNode::convertToOperations(NodeConverter &converter, const CompositorCo } BLI_assert(glareoperation); glareoperation->setGlareSettings(glare); - + GlareThresholdOperation *thresholdOperation = new GlareThresholdOperation(); thresholdOperation->setGlareSettings(glare); - + SetValueOperation *mixvalueoperation = new SetValueOperation(); mixvalueoperation->setValue(0.5f + glare->mix * 0.5f); - + MixGlareOperation *mixoperation = new MixGlareOperation(); mixoperation->setResolutionInputSocketIndex(1); mixoperation->getInputSocket(2)->setResizeMode(COM_SC_FIT); - + converter.addOperation(glareoperation); converter.addOperation(thresholdOperation); converter.addOperation(mixvalueoperation); @@ -77,7 +77,7 @@ void GlareNode::convertToOperations(NodeConverter &converter, const CompositorCo converter.mapInputSocket(getInputSocket(0), thresholdOperation->getInputSocket(0)); converter.addLink(thresholdOperation->getOutputSocket(), glareoperation->getInputSocket(0)); - + converter.addLink(mixvalueoperation->getOutputSocket(), mixoperation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(0), mixoperation->getInputSocket(1)); converter.addLink(glareoperation->getOutputSocket(), mixoperation->getInputSocket(2)); diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp index 0c572c1ddc7..3542bc7f36e 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp +++ b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cpp @@ -42,17 +42,17 @@ void HueSaturationValueCorrectNode::convertToOperations(NodeConverter &converter NodeOutput *outputSocket = this->getOutputSocket(0); bNode *editorsnode = getbNode(); CurveMapping *storage = (CurveMapping *)editorsnode->storage; - + ConvertRGBToHSVOperation *rgbToHSV = new ConvertRGBToHSVOperation(); converter.addOperation(rgbToHSV); - + ConvertHSVToRGBOperation *hsvToRGB = new ConvertHSVToRGBOperation(); converter.addOperation(hsvToRGB); - + HueSaturationValueCorrectOperation *changeHSV = new HueSaturationValueCorrectOperation(); changeHSV->setCurveMapping(storage); converter.addOperation(changeHSV); - + MixBlendOperation *blend = new MixBlendOperation(); blend->setResolutionInputSocketIndex(1); converter.addOperation(blend); diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp index b31fe7ac030..7da8c5b3d3d 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp +++ b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp @@ -46,16 +46,16 @@ void HueSaturationValueNode::convertToOperations(NodeConverter &converter, const ConvertRGBToHSVOperation *rgbToHSV = new ConvertRGBToHSVOperation(); converter.addOperation(rgbToHSV); - + ConvertHSVToRGBOperation *hsvToRGB = new ConvertHSVToRGBOperation(); converter.addOperation(hsvToRGB); - + ChangeHSVOperation *changeHSV = new ChangeHSVOperation(); converter.mapInputSocket(hueSocket, changeHSV->getInputSocket(1)); converter.mapInputSocket(saturationSocket, changeHSV->getInputSocket(2)); converter.mapInputSocket(valueSocket, changeHSV->getInputSocket(3)); converter.addOperation(changeHSV); - + MixBlendOperation *blend = new MixBlendOperation(); blend->setResolutionInputSocketIndex(1); converter.addOperation(blend); diff --git a/source/blender/compositor/nodes/COM_IDMaskNode.cpp b/source/blender/compositor/nodes/COM_IDMaskNode.cpp index 47137352226..ab5931ea566 100644 --- a/source/blender/compositor/nodes/COM_IDMaskNode.cpp +++ b/source/blender/compositor/nodes/COM_IDMaskNode.cpp @@ -32,12 +32,12 @@ IDMaskNode::IDMaskNode(bNode *editorNode) : Node(editorNode) void IDMaskNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { bNode *bnode = this->getbNode(); - + IDMaskOperation *operation; operation = new IDMaskOperation(); operation->setObjectIndex(bnode->custom1); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); if (bnode->custom2 == 0 || context.getRenderData()->scemode & R_FULL_SAMPLE) { converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); @@ -45,7 +45,7 @@ void IDMaskNode::convertToOperations(NodeConverter &converter, const CompositorC else { AntiAliasOperation *antiAliasOperation = new AntiAliasOperation(); converter.addOperation(antiAliasOperation); - + converter.addLink(operation->getOutputSocket(), antiAliasOperation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), antiAliasOperation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp b/source/blender/compositor/nodes/COM_ImageNode.cpp index 337169ba748..36e71aa1203 100644 --- a/source/blender/compositor/nodes/COM_ImageNode.cpp +++ b/source/blender/compositor/nodes/COM_ImageNode.cpp @@ -61,10 +61,10 @@ NodeOperation *ImageNode::doMultilayerCheck(NodeConverter &converter, RenderLaye operation->setRenderLayer(rl); operation->setImageUser(user); operation->setFramenumber(framenumber); - + converter.addOperation(operation); converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); - + return operation; } @@ -189,10 +189,10 @@ void ImageNode::convertToOperations(NodeConverter &converter, const CompositorCo operation->setRenderData(context.getRenderData()); operation->setViewName(context.getViewName()); converter.addOperation(operation); - + if (outputStraightAlpha) { NodeOperation *alphaConvertOperation = new ConvertPremulToStraightOperation(); - + converter.addOperation(alphaConvertOperation); converter.mapOutputSocket(outputImage, alphaConvertOperation->getOutputSocket()); converter.addLink(operation->getOutputSocket(0), alphaConvertOperation->getInputSocket(0)); @@ -200,10 +200,10 @@ void ImageNode::convertToOperations(NodeConverter &converter, const CompositorCo else { converter.mapOutputSocket(outputImage, operation->getOutputSocket()); } - + converter.addPreview(operation->getOutputSocket()); } - + if (numberOfOutputs > 1) { NodeOutput *alphaImage = this->getOutputSocket(1); ImageAlphaOperation *alphaOperation = new ImageAlphaOperation(); @@ -213,7 +213,7 @@ void ImageNode::convertToOperations(NodeConverter &converter, const CompositorCo alphaOperation->setRenderData(context.getRenderData()); alphaOperation->setViewName(context.getViewName()); converter.addOperation(alphaOperation); - + converter.mapOutputSocket(alphaImage, alphaOperation->getOutputSocket()); } if (numberOfOutputs > 2) { @@ -225,7 +225,7 @@ void ImageNode::convertToOperations(NodeConverter &converter, const CompositorCo depthOperation->setRenderData(context.getRenderData()); depthOperation->setViewName(context.getViewName()); converter.addOperation(depthOperation); - + converter.mapOutputSocket(depthImage, depthOperation->getOutputSocket()); } if (numberOfOutputs > 3) { diff --git a/source/blender/compositor/nodes/COM_InpaintNode.cpp b/source/blender/compositor/nodes/COM_InpaintNode.cpp index 17cc2fa653e..41cc65e2fee 100644 --- a/source/blender/compositor/nodes/COM_InpaintNode.cpp +++ b/source/blender/compositor/nodes/COM_InpaintNode.cpp @@ -33,7 +33,7 @@ InpaintNode::InpaintNode(bNode *editorNode) : Node(editorNode) void InpaintNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const { - + bNode *editorNode = this->getbNode(); /* if (editorNode->custom1 == CMP_NODE_INPAINT_SIMPLE) { */ @@ -41,7 +41,7 @@ void InpaintNode::convertToOperations(NodeConverter &converter, const Compositor InpaintSimpleOperation *operation = new InpaintSimpleOperation(); operation->setIterations(editorNode->custom2); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_InvertNode.cpp b/source/blender/compositor/nodes/COM_InvertNode.cpp index ebdb2cdb7c5..c83db3fe78f 100644 --- a/source/blender/compositor/nodes/COM_InvertNode.cpp +++ b/source/blender/compositor/nodes/COM_InvertNode.cpp @@ -37,7 +37,7 @@ void InvertNode::convertToOperations(NodeConverter &converter, const CompositorC operation->setColor(node->custom1 & CMP_CHAN_RGB); operation->setAlpha(node->custom1 & CMP_CHAN_A); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); diff --git a/source/blender/compositor/nodes/COM_KeyingNode.cpp b/source/blender/compositor/nodes/COM_KeyingNode.cpp index ddfba07d9f7..261bdb93adb 100644 --- a/source/blender/compositor/nodes/COM_KeyingNode.cpp +++ b/source/blender/compositor/nodes/COM_KeyingNode.cpp @@ -52,9 +52,9 @@ NodeOperationOutput *KeyingNode::setupPreBlur(NodeConverter &converter, NodeInpu ConvertRGBToYCCOperation *convertRGBToYCCOperation = new ConvertRGBToYCCOperation(); convertRGBToYCCOperation->setMode(BLI_YCC_ITU_BT709); converter.addOperation(convertRGBToYCCOperation); - + converter.mapInputSocket(inputImage, convertRGBToYCCOperation->getInputSocket(0)); - + CombineChannelsOperation *combineOperation = new CombineChannelsOperation(); converter.addOperation(combineOperation); @@ -62,9 +62,9 @@ NodeOperationOutput *KeyingNode::setupPreBlur(NodeConverter &converter, NodeInpu SeparateChannelOperation *separateOperation = new SeparateChannelOperation(); separateOperation->setChannel(channel); converter.addOperation(separateOperation); - + converter.addLink(convertRGBToYCCOperation->getOutputSocket(0), separateOperation->getInputSocket(0)); - + if (channel == 0 || channel == 3) { converter.addLink(separateOperation->getOutputSocket(0), combineOperation->getInputSocket(channel)); } @@ -73,24 +73,24 @@ NodeOperationOutput *KeyingNode::setupPreBlur(NodeConverter &converter, NodeInpu blurXOperation->setSize(size); blurXOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_X); converter.addOperation(blurXOperation); - + KeyingBlurOperation *blurYOperation = new KeyingBlurOperation(); blurYOperation->setSize(size); blurYOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_Y); converter.addOperation(blurYOperation); - + converter.addLink(separateOperation->getOutputSocket(), blurXOperation->getInputSocket(0)); converter.addLink(blurXOperation->getOutputSocket(), blurYOperation->getInputSocket(0)); converter.addLink(blurYOperation->getOutputSocket(0), combineOperation->getInputSocket(channel)); } } - + ConvertYCCToRGBOperation *convertYCCToRGBOperation = new ConvertYCCToRGBOperation(); convertYCCToRGBOperation->setMode(BLI_YCC_ITU_BT709); converter.addOperation(convertYCCToRGBOperation); - + converter.addLink(combineOperation->getOutputSocket(0), convertYCCToRGBOperation->getInputSocket(0)); - + return convertYCCToRGBOperation->getOutputSocket(0); } @@ -100,15 +100,15 @@ NodeOperationOutput *KeyingNode::setupPostBlur(NodeConverter &converter, NodeOpe blurXOperation->setSize(size); blurXOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_X); converter.addOperation(blurXOperation); - + KeyingBlurOperation *blurYOperation = new KeyingBlurOperation(); blurYOperation->setSize(size); blurYOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_Y); converter.addOperation(blurYOperation); - + converter.addLink(postBlurInput, blurXOperation->getInputSocket(0)); converter.addLink(blurXOperation->getOutputSocket(), blurYOperation->getInputSocket(0)); - + return blurYOperation->getOutputSocket(); } @@ -124,9 +124,9 @@ NodeOperationOutput *KeyingNode::setupDilateErode(NodeConverter &converter, Node dilateErodeOperation->setDistance(-distance); } converter.addOperation(dilateErodeOperation); - + converter.addLink(dilateErodeInput, dilateErodeOperation->getInputSocket(0)); - + return dilateErodeOperation->getOutputSocket(0); } @@ -154,7 +154,7 @@ NodeOperationOutput *KeyingNode::setupFeather(NodeConverter &converter, const Co operationx->setSubtract(distance < 0); operationx->setFalloff(falloff); converter.addOperation(operationx); - + GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation(); operationy->setData(&data); operationy->setQuality(quality); @@ -176,10 +176,10 @@ NodeOperationOutput *KeyingNode::setupDespill(NodeConverter &converter, NodeOper despillOperation->setDespillFactor(factor); despillOperation->setColorBalance(colorBalance); converter.addOperation(despillOperation); - + converter.addLink(despillInput, despillOperation->getInputSocket(0)); converter.mapInputSocket(inputScreen, despillOperation->getInputSocket(1)); - + return despillOperation->getOutputSocket(0); } @@ -193,9 +193,9 @@ NodeOperationOutput *KeyingNode::setupClip(NodeConverter &converter, NodeOperati clipOperation->setClipWhite(clipWhite); clipOperation->setIsEdgeMatte(edgeMatte); converter.addOperation(clipOperation); - + converter.addLink(clipInput, clipOperation->getInputSocket(0)); - + return clipOperation->getOutputSocket(0); } @@ -203,7 +203,7 @@ void KeyingNode::convertToOperations(NodeConverter &converter, const CompositorC { bNode *editorNode = this->getbNode(); NodeKeyingData *keying_data = (NodeKeyingData *) editorNode->storage; - + NodeInput *inputImage = this->getInputSocket(0); NodeInput *inputScreen = this->getInputSocket(1); NodeInput *inputGarbageMatte = this->getInputSocket(2); @@ -212,14 +212,14 @@ void KeyingNode::convertToOperations(NodeConverter &converter, const CompositorC NodeOutput *outputMatte = this->getOutputSocket(1); NodeOutput *outputEdges = this->getOutputSocket(2); NodeOperationOutput *postprocessedMatte = NULL, *postprocessedImage = NULL, *edgesMatte = NULL; - + /* keying operation */ KeyingOperation *keyingOperation = new KeyingOperation(); keyingOperation->setScreenBalance(keying_data->screen_balance); converter.addOperation(keyingOperation); - + converter.mapInputSocket(inputScreen, keyingOperation->getInputSocket(1)); - + if (keying_data->blur_pre) { /* chroma preblur operation for input of keying operation */ NodeOperationOutput *preBluredImage = setupPreBlur(converter, inputImage, keying_data->blur_pre); @@ -228,53 +228,53 @@ void KeyingNode::convertToOperations(NodeConverter &converter, const CompositorC else { converter.mapInputSocket(inputImage, keyingOperation->getInputSocket(0)); } - + postprocessedMatte = keyingOperation->getOutputSocket(); - + /* black / white clipping */ if (keying_data->clip_black > 0.0f || keying_data->clip_white < 1.0f) { postprocessedMatte = setupClip(converter, postprocessedMatte, keying_data->edge_kernel_radius, keying_data->edge_kernel_tolerance, keying_data->clip_black, keying_data->clip_white, false); } - + /* output edge matte */ edgesMatte = setupClip(converter, postprocessedMatte, keying_data->edge_kernel_radius, keying_data->edge_kernel_tolerance, keying_data->clip_black, keying_data->clip_white, true); - + /* apply garbage matte */ if (inputGarbageMatte->isLinked()) { SetValueOperation *valueOperation = new SetValueOperation(); valueOperation->setValue(1.0f); converter.addOperation(valueOperation); - + MathSubtractOperation *subtractOperation = new MathSubtractOperation(); converter.addOperation(subtractOperation); - + MathMinimumOperation *minOperation = new MathMinimumOperation(); converter.addOperation(minOperation); - + converter.addLink(valueOperation->getOutputSocket(), subtractOperation->getInputSocket(0)); converter.mapInputSocket(inputGarbageMatte, subtractOperation->getInputSocket(1)); - + converter.addLink(subtractOperation->getOutputSocket(), minOperation->getInputSocket(0)); converter.addLink(postprocessedMatte, minOperation->getInputSocket(1)); - + postprocessedMatte = minOperation->getOutputSocket(); } - + /* apply core matte */ if (inputCoreMatte->isLinked()) { MathMaximumOperation *maxOperation = new MathMaximumOperation(); converter.addOperation(maxOperation); - + converter.mapInputSocket(inputCoreMatte, maxOperation->getInputSocket(0)); converter.addLink(postprocessedMatte, maxOperation->getInputSocket(1)); - + postprocessedMatte = maxOperation->getOutputSocket(); } - + /* apply blur on matte if needed */ if (keying_data->blur_post) postprocessedMatte = setupPostBlur(converter, postprocessedMatte, keying_data->blur_post); @@ -293,7 +293,7 @@ void KeyingNode::convertToOperations(NodeConverter &converter, const CompositorC /* set alpha channel to output image */ SetAlphaOperation *alphaOperation = new SetAlphaOperation(); converter.addOperation(alphaOperation); - + converter.mapInputSocket(inputImage, alphaOperation->getInputSocket(0)); converter.addLink(postprocessedMatte, alphaOperation->getInputSocket(1)); diff --git a/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp b/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp index 70b3b696e37..df9668883e8 100644 --- a/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp +++ b/source/blender/compositor/nodes/COM_KeyingScreenNode.cpp @@ -39,15 +39,15 @@ void KeyingScreenNode::convertToOperations(NodeConverter &converter, const Compo bNode *editorNode = this->getbNode(); MovieClip *clip = (MovieClip *) editorNode->id; NodeKeyingScreenData *keyingscreen_data = (NodeKeyingScreenData *) editorNode->storage; - + NodeOutput *outputScreen = this->getOutputSocket(0); - + // always connect the output image KeyingScreenOperation *operation = new KeyingScreenOperation(); operation->setMovieClip(clip); operation->setTrackingObject(keyingscreen_data->tracking_object); operation->setFramenumber(context.getFramenumber()); converter.addOperation(operation); - + converter.mapOutputSocket(outputScreen, operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_LensDistortionNode.cpp b/source/blender/compositor/nodes/COM_LensDistortionNode.cpp index b6cc2acb9a6..2bad80839e1 100644 --- a/source/blender/compositor/nodes/COM_LensDistortionNode.cpp +++ b/source/blender/compositor/nodes/COM_LensDistortionNode.cpp @@ -37,7 +37,7 @@ void LensDistortionNode::convertToOperations(NodeConverter &converter, const Com if (data->proj) { ProjectorLensDistortionOperation *operation = new ProjectorLensDistortionOperation(); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); @@ -51,9 +51,9 @@ void LensDistortionNode::convertToOperations(NodeConverter &converter, const Com operation->setDistortion(getInputSocket(1)->getEditorValueFloat()); if (!getInputSocket(2)->isLinked()) operation->setDispersion(getInputSocket(2)->getEditorValueFloat()); - + converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); diff --git a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp index de6ad3df030..12f3b1bc410 100644 --- a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp @@ -46,10 +46,10 @@ void LuminanceMatteNode::convertToOperations(NodeConverter &converter, const Com SetAlphaOperation *operation = new SetAlphaOperation(); converter.addOperation(operation); - + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); converter.addLink(operationSet->getOutputSocket(), operation->getInputSocket(1)); converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket()); - + converter.addPreview(operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_MapRangeNode.cpp b/source/blender/compositor/nodes/COM_MapRangeNode.cpp index 81ee4f0d7a9..6590cf04306 100644 --- a/source/blender/compositor/nodes/COM_MapRangeNode.cpp +++ b/source/blender/compositor/nodes/COM_MapRangeNode.cpp @@ -38,11 +38,11 @@ void MapRangeNode::convertToOperations(NodeConverter &converter, const Composito NodeInput *destMinSocket = this->getInputSocket(3); NodeInput *destMaxSocket = this->getInputSocket(4); NodeOutput *outputSocket = this->getOutputSocket(0); - + MapRangeOperation *operation = new MapRangeOperation(); operation->setUseClamp(this->getbNode()->custom1); converter.addOperation(operation); - + converter.mapInputSocket(valueSocket, operation->getInputSocket(0)); converter.mapInputSocket(sourceMinSocket, operation->getInputSocket(1)); converter.mapInputSocket(sourceMaxSocket, operation->getInputSocket(2)); diff --git a/source/blender/compositor/nodes/COM_MapUVNode.cpp b/source/blender/compositor/nodes/COM_MapUVNode.cpp index c593805c940..dc477ad9da0 100644 --- a/source/blender/compositor/nodes/COM_MapUVNode.cpp +++ b/source/blender/compositor/nodes/COM_MapUVNode.cpp @@ -31,7 +31,7 @@ MapUVNode::MapUVNode(bNode *editorNode) : Node(editorNode) void MapUVNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const { bNode *node = this->getbNode(); - + MapUVOperation *operation = new MapUVOperation(); operation->setAlpha((float)node->custom1); operation->setResolutionInputSocketIndex(1); diff --git a/source/blender/compositor/nodes/COM_MapValueNode.cpp b/source/blender/compositor/nodes/COM_MapValueNode.cpp index 9a4c4880b62..6276548c7a7 100644 --- a/source/blender/compositor/nodes/COM_MapValueNode.cpp +++ b/source/blender/compositor/nodes/COM_MapValueNode.cpp @@ -33,14 +33,14 @@ MapValueNode::MapValueNode(bNode *editorNode) : Node(editorNode) void MapValueNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const { TexMapping *storage = (TexMapping *)this->getbNode()->storage; - + NodeInput *colorSocket = this->getInputSocket(0); NodeOutput *valueSocket = this->getOutputSocket(0); - + MapValueOperation *convertProg = new MapValueOperation(); convertProg->setSettings(storage); converter.addOperation(convertProg); - + converter.mapInputSocket(colorSocket, convertProg->getInputSocket(0)); converter.mapOutputSocket(valueSocket, convertProg->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_MathNode.cpp b/source/blender/compositor/nodes/COM_MathNode.cpp index e9bed136a37..d16300ebff4 100644 --- a/source/blender/compositor/nodes/COM_MathNode.cpp +++ b/source/blender/compositor/nodes/COM_MathNode.cpp @@ -27,7 +27,7 @@ void MathNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const { MathBaseOperation *operation = NULL; - + switch (this->getbNode()->custom1) { case NODE_MATH_ADD: operation = new MathAddOperation(); @@ -90,12 +90,12 @@ void MathNode::convertToOperations(NodeConverter &converter, const CompositorCon operation = new MathArcTan2Operation(); break; } - + if (operation) { bool useClamp = getbNode()->custom2; operation->setUseClamp(useClamp); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); diff --git a/source/blender/compositor/nodes/COM_MixNode.cpp b/source/blender/compositor/nodes/COM_MixNode.cpp index e807365d9db..e0af0106513 100644 --- a/source/blender/compositor/nodes/COM_MixNode.cpp +++ b/source/blender/compositor/nodes/COM_MixNode.cpp @@ -43,7 +43,7 @@ void MixNode::convertToOperations(NodeConverter &converter, const CompositorCont bNode *editorNode = this->getbNode(); bool useAlphaPremultiply = (this->getbNode()->custom2 & 1) != 0; bool useClamp = (this->getbNode()->custom2 & 2) != 0; - + MixBaseOperation *convertProg; switch (editorNode->custom1) { case MA_RAMP_ADD: @@ -106,11 +106,11 @@ void MixNode::convertToOperations(NodeConverter &converter, const CompositorCont convertProg->setUseValueAlphaMultiply(useAlphaPremultiply); convertProg->setUseClamp(useClamp); converter.addOperation(convertProg); - + converter.mapInputSocket(valueSocket, convertProg->getInputSocket(0)); converter.mapInputSocket(color1Socket, convertProg->getInputSocket(1)); converter.mapInputSocket(color2Socket, convertProg->getInputSocket(2)); converter.mapOutputSocket(outputSocket, convertProg->getOutputSocket(0)); - + converter.addPreview(convertProg->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_MovieClipNode.cpp b/source/blender/compositor/nodes/COM_MovieClipNode.cpp index 269d7f2cafe..18e6f811fff 100644 --- a/source/blender/compositor/nodes/COM_MovieClipNode.cpp +++ b/source/blender/compositor/nodes/COM_MovieClipNode.cpp @@ -46,7 +46,7 @@ void MovieClipNode::convertToOperations(NodeConverter &converter, const Composit NodeOutput *offsetYMovieClip = this->getOutputSocket(3); NodeOutput *scaleMovieClip = this->getOutputSocket(4); NodeOutput *angleMovieClip = this->getOutputSocket(5); - + bNode *editorNode = this->getbNode(); MovieClip *movieClip = (MovieClip *)editorNode->id; MovieClipUser *movieClipUser = (MovieClipUser *)editorNode->storage; @@ -59,7 +59,7 @@ void MovieClipNode::convertToOperations(NodeConverter &converter, const Composit else ibuf = BKE_movieclip_get_ibuf_flag(movieClip, movieClipUser, movieClip->flag, MOVIECLIP_CACHE_SKIP); } - + // always connect the output image MovieClipOperation *operation = new MovieClipOperation(); operation->setMovieClip(movieClip); @@ -76,7 +76,7 @@ void MovieClipNode::convertToOperations(NodeConverter &converter, const Composit alphaOperation->setMovieClipUser(movieClipUser); alphaOperation->setFramenumber(context.getFramenumber()); alphaOperation->setCacheFrame(cacheFrame); - + converter.addOperation(alphaOperation); converter.mapOutputSocket(alphaMovieClip, alphaOperation->getOutputSocket()); @@ -99,7 +99,7 @@ void MovieClipNode::convertToOperations(NodeConverter &converter, const Composit converter.addOutputValue(offsetYMovieClip, loc[1]); converter.addOutputValue(scaleMovieClip, scale); converter.addOutputValue(angleMovieClip, angle); - + if (ibuf) { IMB_freeImBuf(ibuf); } diff --git a/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp b/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp index c4277354b43..e3009e068ab 100644 --- a/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp +++ b/source/blender/compositor/nodes/COM_MovieDistortionNode.cpp @@ -35,10 +35,10 @@ void MovieDistortionNode::convertToOperations(NodeConverter &converter, const Co { bNode *bnode = this->getbNode(); MovieClip *clip = (MovieClip *)bnode->id; - + NodeInput *inputSocket = this->getInputSocket(0); NodeOutput *outputSocket = this->getOutputSocket(0); - + MovieDistortionOperation *operation = new MovieDistortionOperation(bnode->custom1 == 1); operation->setMovieClip(clip); operation->setFramenumber(context.getFramenumber()); diff --git a/source/blender/compositor/nodes/COM_NormalNode.cpp b/source/blender/compositor/nodes/COM_NormalNode.cpp index bde5a126325..64231d116fa 100644 --- a/source/blender/compositor/nodes/COM_NormalNode.cpp +++ b/source/blender/compositor/nodes/COM_NormalNode.cpp @@ -36,7 +36,7 @@ void NormalNode::convertToOperations(NodeConverter &converter, const CompositorC NodeInput *inputSocket = this->getInputSocket(0); NodeOutput *outputSocket = this->getOutputSocket(0); NodeOutput *outputSocketDotproduct = this->getOutputSocket(1); - + SetVectorOperation *operationSet = new SetVectorOperation(); float normal[3]; outputSocket->getEditorValueVector(normal); @@ -47,12 +47,12 @@ void NormalNode::convertToOperations(NodeConverter &converter, const CompositorC operationSet->setZ(normal[2]); operationSet->setW(0.0f); converter.addOperation(operationSet); - + converter.mapOutputSocket(outputSocket, operationSet->getOutputSocket(0)); - + DotproductOperation *operation = new DotproductOperation(); converter.addOperation(operation); - + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); converter.addLink(operationSet->getOutputSocket(0), operation->getInputSocket(1)); converter.mapOutputSocket(outputSocketDotproduct, operation->getOutputSocket(0)); diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.cpp b/source/blender/compositor/nodes/COM_OutputFileNode.cpp index 46e7f7fe790..5a7e5e2c623 100644 --- a/source/blender/compositor/nodes/COM_OutputFileNode.cpp +++ b/source/blender/compositor/nodes/COM_OutputFileNode.cpp @@ -39,7 +39,7 @@ void OutputFileNode::convertToOperations(NodeConverter &converter, const Composi { NodeImageMultiFile *storage = (NodeImageMultiFile *)this->getbNode()->storage; const bool is_multiview = (context.getRenderData()->scemode & R_MULTIVIEW) != 0; - + if (!context.isRendering()) { /* only output files when rendering a sequence - * otherwise, it overwrites the output files just @@ -70,12 +70,12 @@ void OutputFileNode::convertToOperations(NodeConverter &converter, const Composi for (int i = 0; i < num_inputs; ++i) { NodeInput *input = getInputSocket(i); NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)input->getbNodeSocket()->storage; - + /* note: layer becomes an empty placeholder if the input is not linked */ outputOperation->add_layer(sockdata->layer, input->getDataType(), input->isLinked()); - + converter.mapInputSocket(input, outputOperation->getInputSocket(i)); - + if (!previewAdded) { converter.addNodeInputPreview(input); previewAdded = true; diff --git a/source/blender/compositor/nodes/COM_PixelateNode.cpp b/source/blender/compositor/nodes/COM_PixelateNode.cpp index fe806dbf307..2b7ab0ea4e8 100644 --- a/source/blender/compositor/nodes/COM_PixelateNode.cpp +++ b/source/blender/compositor/nodes/COM_PixelateNode.cpp @@ -35,7 +35,7 @@ void PixelateNode::convertToOperations(NodeConverter &converter, const Composito NodeInput *inputSocket = this->getInputSocket(0); NodeOutput *outputSocket = this->getOutputSocket(0); DataType datatype = inputSocket->getDataType(); - + if (inputSocket->isLinked()) { NodeOutput *link = inputSocket->getLink(); datatype = link->getDataType(); @@ -43,7 +43,7 @@ void PixelateNode::convertToOperations(NodeConverter &converter, const Composito PixelateOperation *operation = new PixelateOperation(datatype); converter.addOperation(operation); - + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cpp b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cpp index 379b9f193e8..d8e4655b84e 100644 --- a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cpp +++ b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cpp @@ -42,13 +42,13 @@ void PlaneTrackDeformNode::convertToOperations(NodeConverter &converter, const C bNode *editorNode = this->getbNode(); MovieClip *clip = (MovieClip *) editorNode->id; NodePlaneTrackDeformData *data = (NodePlaneTrackDeformData *) editorNode->storage; - + int frame_number = context.getFramenumber(); - + NodeInput *input_image = this->getInputSocket(0); NodeOutput *output_warped_image = this->getOutputSocket(0); NodeOutput *output_plane = this->getOutputSocket(1); - + PlaneTrackWarpImageOperation *warp_image_operation = new PlaneTrackWarpImageOperation(); warp_image_operation->setMovieClip(clip); warp_image_operation->setTrackingObject(data->tracking_object); @@ -59,10 +59,10 @@ void PlaneTrackDeformNode::convertToOperations(NodeConverter &converter, const C warp_image_operation->setMotionBlurShutter(data->motion_blur_shutter); } converter.addOperation(warp_image_operation); - + converter.mapInputSocket(input_image, warp_image_operation->getInputSocket(0)); converter.mapOutputSocket(output_warped_image, warp_image_operation->getOutputSocket()); - + PlaneTrackMaskOperation *plane_mask_operation = new PlaneTrackMaskOperation(); plane_mask_operation->setMovieClip(clip); plane_mask_operation->setTrackingObject(data->tracking_object); @@ -73,6 +73,6 @@ void PlaneTrackDeformNode::convertToOperations(NodeConverter &converter, const C plane_mask_operation->setMotionBlurShutter(data->motion_blur_shutter); } converter.addOperation(plane_mask_operation); - + converter.mapOutputSocket(output_plane, plane_mask_operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_RotateNode.cpp b/source/blender/compositor/nodes/COM_RotateNode.cpp index 77638d66987..fe85d5db255 100644 --- a/source/blender/compositor/nodes/COM_RotateNode.cpp +++ b/source/blender/compositor/nodes/COM_RotateNode.cpp @@ -39,10 +39,10 @@ void RotateNode::convertToOperations(NodeConverter &converter, const CompositorC RotateOperation *operation = new RotateOperation(); SetSamplerOperation *sampler = new SetSamplerOperation(); sampler->setSampler((PixelSampler)this->getbNode()->custom1); - + converter.addOperation(sampler); converter.addOperation(operation); - + converter.addLink(sampler->getOutputSocket(), operation->getInputSocket(0)); converter.mapInputSocket(inputSocket, sampler->getInputSocket(0)); converter.mapInputSocket(inputDegreeSocket, operation->getInputSocket(1)); diff --git a/source/blender/compositor/nodes/COM_ScaleNode.cpp b/source/blender/compositor/nodes/COM_ScaleNode.cpp index ef4128a78b4..dc512684ce6 100644 --- a/source/blender/compositor/nodes/COM_ScaleNode.cpp +++ b/source/blender/compositor/nodes/COM_ScaleNode.cpp @@ -36,7 +36,7 @@ ScaleNode::ScaleNode(bNode *editorNode) : Node(editorNode) void ScaleNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { bNode *bnode = this->getbNode(); - + NodeInput *inputSocket = this->getInputSocket(0); NodeInput *inputXSocket = this->getInputSocket(1); NodeInput *inputYSocket = this->getInputSocket(2); @@ -47,7 +47,7 @@ void ScaleNode::convertToOperations(NodeConverter &converter, const CompositorCo { ScaleOperation *operation = new ScaleOperation(); converter.addOperation(operation); - + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); @@ -62,10 +62,10 @@ void ScaleNode::convertToOperations(NodeConverter &converter, const CompositorCo SetValueOperation *scaleFactorOperation = new SetValueOperation(); scaleFactorOperation->setValue(context.getRenderData()->size / 100.0f); converter.addOperation(scaleFactorOperation); - + ScaleOperation *operation = new ScaleOperation(); converter.addOperation(operation); - + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); converter.addLink(scaleFactorOperation->getOutputSocket(), operation->getInputSocket(1)); converter.addLink(scaleFactorOperation->getOutputSocket(), operation->getInputSocket(2)); diff --git a/source/blender/compositor/nodes/COM_SeparateColorNode.cpp b/source/blender/compositor/nodes/COM_SeparateColorNode.cpp index 68fdaf01f5c..b3f9ab46f35 100644 --- a/source/blender/compositor/nodes/COM_SeparateColorNode.cpp +++ b/source/blender/compositor/nodes/COM_SeparateColorNode.cpp @@ -38,55 +38,55 @@ void SeparateColorNode::convertToOperations(NodeConverter &converter, const Comp NodeOutput *outputGSocket = this->getOutputSocket(1); NodeOutput *outputBSocket = this->getOutputSocket(2); NodeOutput *outputASocket = this->getOutputSocket(3); - + NodeOperation *color_conv = getColorConverter(context); if (color_conv) { converter.addOperation(color_conv); - + converter.mapInputSocket(imageSocket, color_conv->getInputSocket(0)); } - + { SeparateChannelOperation *operation = new SeparateChannelOperation(); operation->setChannel(0); converter.addOperation(operation); - + if (color_conv) converter.addLink(color_conv->getOutputSocket(), operation->getInputSocket(0)); else converter.mapInputSocket(imageSocket, operation->getInputSocket(0)); converter.mapOutputSocket(outputRSocket, operation->getOutputSocket(0)); } - + { SeparateChannelOperation *operation = new SeparateChannelOperation(); operation->setChannel(1); converter.addOperation(operation); - + if (color_conv) converter.addLink(color_conv->getOutputSocket(), operation->getInputSocket(0)); else converter.mapInputSocket(imageSocket, operation->getInputSocket(0)); converter.mapOutputSocket(outputGSocket, operation->getOutputSocket(0)); } - + { SeparateChannelOperation *operation = new SeparateChannelOperation(); operation->setChannel(2); converter.addOperation(operation); - + if (color_conv) converter.addLink(color_conv->getOutputSocket(), operation->getInputSocket(0)); else converter.mapInputSocket(imageSocket, operation->getInputSocket(0)); converter.mapOutputSocket(outputBSocket, operation->getOutputSocket(0)); } - + { SeparateChannelOperation *operation = new SeparateChannelOperation(); operation->setChannel(3); converter.addOperation(operation); - + if (color_conv) converter.addLink(color_conv->getOutputSocket(), operation->getInputSocket(0)); else diff --git a/source/blender/compositor/nodes/COM_SeparateColorNode.h b/source/blender/compositor/nodes/COM_SeparateColorNode.h index d378a311e73..0e47a98a1aa 100644 --- a/source/blender/compositor/nodes/COM_SeparateColorNode.h +++ b/source/blender/compositor/nodes/COM_SeparateColorNode.h @@ -30,7 +30,7 @@ class SeparateColorNode : public Node { public: SeparateColorNode(bNode *editorNode); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; - + protected: virtual NodeOperation *getColorConverter(const CompositorContext &context) const = 0; }; @@ -40,7 +40,7 @@ public: SeparateRGBANode(bNode *editorNode) : SeparateColorNode(editorNode) {} - + NodeOperation *getColorConverter(const CompositorContext &context) const; }; @@ -49,7 +49,7 @@ public: SeparateHSVANode(bNode *editorNode) : SeparateColorNode(editorNode) {} - + NodeOperation *getColorConverter(const CompositorContext &context) const; }; @@ -58,7 +58,7 @@ public: SeparateYCCANode(bNode *editorNode) : SeparateColorNode(editorNode) {} - + NodeOperation *getColorConverter(const CompositorContext &context) const; }; @@ -67,7 +67,7 @@ public: SeparateYUVANode(bNode *editorNode) : SeparateColorNode(editorNode) {} - + NodeOperation *getColorConverter(const CompositorContext &context) const; }; diff --git a/source/blender/compositor/nodes/COM_SetAlphaNode.cpp b/source/blender/compositor/nodes/COM_SetAlphaNode.cpp index 4c55a4bdc0a..b5d5bf9d9d9 100644 --- a/source/blender/compositor/nodes/COM_SetAlphaNode.cpp +++ b/source/blender/compositor/nodes/COM_SetAlphaNode.cpp @@ -27,13 +27,13 @@ void SetAlphaNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const { SetAlphaOperation *operation = new SetAlphaOperation(); - + if (!this->getInputSocket(0)->isLinked() && this->getInputSocket(1)->isLinked()) { operation->setResolutionInputSocketIndex(1); } - + converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); diff --git a/source/blender/compositor/nodes/COM_SocketProxyNode.cpp b/source/blender/compositor/nodes/COM_SocketProxyNode.cpp index c76b057577c..230c27dd9a0 100644 --- a/source/blender/compositor/nodes/COM_SocketProxyNode.cpp +++ b/source/blender/compositor/nodes/COM_SocketProxyNode.cpp @@ -72,14 +72,14 @@ void SocketBufferNode::convertToOperations(NodeConverter &converter, const Compo { NodeOutput *output = this->getOutputSocket(0); NodeInput *input = this->getInputSocket(0); - + DataType datatype = output->getDataType(); WriteBufferOperation *writeOperation = new WriteBufferOperation(datatype); ReadBufferOperation *readOperation = new ReadBufferOperation(datatype); readOperation->setMemoryProxy(writeOperation->getMemoryProxy()); converter.addOperation(writeOperation); converter.addOperation(readOperation); - + converter.mapInputSocket(input, writeOperation->getInputSocket(0)); converter.mapOutputSocket(output, readOperation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_SocketProxyNode.h b/source/blender/compositor/nodes/COM_SocketProxyNode.h index 410cbf94842..faa458492cb 100644 --- a/source/blender/compositor/nodes/COM_SocketProxyNode.h +++ b/source/blender/compositor/nodes/COM_SocketProxyNode.h @@ -33,10 +33,10 @@ class SocketProxyNode : public Node { public: SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput, bool use_conversion); void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; - + bool getUseConversion() const { return m_use_conversion; } void setUseConversion(bool use_conversion) { m_use_conversion = use_conversion; } - + private: /** If true, the proxy will convert input and output data to/from the proxy socket types. */ bool m_use_conversion; diff --git a/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp b/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp index a575cf65b99..38b8a466369 100644 --- a/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp +++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.cpp @@ -44,7 +44,7 @@ void Stabilize2dNode::convertToOperations(NodeConverter &converter, const Compos NodeInput *imageInput = this->getInputSocket(0); MovieClip *clip = (MovieClip *)editorNode->id; bool invert = (editorNode->custom2 & CMP_NODEFLAG_STABILIZE_INVERSE) != 0; - + ScaleOperation *scaleOperation = new ScaleOperation(); scaleOperation->setSampler((PixelSampler)editorNode->custom1); RotateOperation *rotateOperation = new RotateOperation(); @@ -85,18 +85,18 @@ void Stabilize2dNode::convertToOperations(NodeConverter &converter, const Compos converter.addOperation(translateOperation); converter.addOperation(rotateOperation); converter.addOperation(psoperation); - + converter.mapInputSocket(imageInput, scaleOperation->getInputSocket(0)); converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(1)); converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(2)); - + converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0)); converter.addLink(angleAttribute->getOutputSocket(), rotateOperation->getInputSocket(1)); converter.addLink(rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0)); converter.addLink(xAttribute->getOutputSocket(), translateOperation->getInputSocket(1)); converter.addLink(yAttribute->getOutputSocket(), translateOperation->getInputSocket(2)); - + converter.addLink(translateOperation->getOutputSocket(), psoperation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(), psoperation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_SwitchNode.cpp b/source/blender/compositor/nodes/COM_SwitchNode.cpp index e0c12e4dbea..7e1eaabc886 100644 --- a/source/blender/compositor/nodes/COM_SwitchNode.cpp +++ b/source/blender/compositor/nodes/COM_SwitchNode.cpp @@ -30,12 +30,12 @@ SwitchNode::SwitchNode(bNode *editorNode) : Node(editorNode) void SwitchNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const { bool condition = this->getbNode()->custom1; - + NodeOperationOutput *result; if (!condition) result = converter.addInputProxy(getInputSocket(0), false); else result = converter.addInputProxy(getInputSocket(1), false); - + converter.mapOutputSocket(getOutputSocket(0), result); } diff --git a/source/blender/compositor/nodes/COM_TextureNode.cpp b/source/blender/compositor/nodes/COM_TextureNode.cpp index 411dea2925f..47b32f6e04d 100644 --- a/source/blender/compositor/nodes/COM_TextureNode.cpp +++ b/source/blender/compositor/nodes/COM_TextureNode.cpp @@ -40,11 +40,11 @@ void TextureNode::convertToOperations(NodeConverter &converter, const Compositor operation->setRenderData(context.getRenderData()); operation->setSceneColorManage(sceneColorManage); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(1), operation->getOutputSocket()); - + converter.addPreview(operation->getOutputSocket()); TextureAlphaOperation *alphaOperation = new TextureAlphaOperation(); @@ -52,7 +52,7 @@ void TextureNode::convertToOperations(NodeConverter &converter, const Compositor alphaOperation->setRenderData(context.getRenderData()); alphaOperation->setSceneColorManage(sceneColorManage); converter.addOperation(alphaOperation); - + converter.mapInputSocket(getInputSocket(0), alphaOperation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), alphaOperation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), alphaOperation->getOutputSocket()); diff --git a/source/blender/compositor/nodes/COM_TimeNode.cpp b/source/blender/compositor/nodes/COM_TimeNode.cpp index 0185b85e772..883ff72229d 100644 --- a/source/blender/compositor/nodes/COM_TimeNode.cpp +++ b/source/blender/compositor/nodes/COM_TimeNode.cpp @@ -56,6 +56,6 @@ void TimeNode::convertToOperations(NodeConverter &converter, const CompositorCon fac = curvemapping_evaluateF((CurveMapping *)node->storage, 0, fac); operation->setValue(clamp_f(fac, 0.0f, 1.0f)); converter.addOperation(operation); - + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_TonemapNode.cpp b/source/blender/compositor/nodes/COM_TonemapNode.cpp index 1ecc42a0a27..a01be6acb7b 100644 --- a/source/blender/compositor/nodes/COM_TonemapNode.cpp +++ b/source/blender/compositor/nodes/COM_TonemapNode.cpp @@ -32,11 +32,11 @@ TonemapNode::TonemapNode(bNode *editorNode) : Node(editorNode) void TonemapNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const { NodeTonemap *data = (NodeTonemap *)this->getbNode()->storage; - + TonemapOperation *operation = data->type == 1 ? new PhotoreceptorTonemapOperation() : new TonemapOperation(); operation->setData(data); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } diff --git a/source/blender/compositor/nodes/COM_TrackPositionNode.cpp b/source/blender/compositor/nodes/COM_TrackPositionNode.cpp index 490f72b4aa1..cddb3557498 100644 --- a/source/blender/compositor/nodes/COM_TrackPositionNode.cpp +++ b/source/blender/compositor/nodes/COM_TrackPositionNode.cpp @@ -63,7 +63,7 @@ void TrackPositionNode::convertToOperations(NodeConverter &converter, const Comp bNode *editorNode = this->getbNode(); MovieClip *clip = (MovieClip *) editorNode->id; NodeTrackPosData *trackpos_data = (NodeTrackPosData *) editorNode->storage; - + NodeOutput *outputX = this->getOutputSocket(0); NodeOutput *outputY = this->getOutputSocket(1); NodeOutput *outputSpeed = this->getOutputSocket(2); diff --git a/source/blender/compositor/nodes/COM_TransformNode.cpp b/source/blender/compositor/nodes/COM_TransformNode.cpp index 5b772d1ce56..288f394a10f 100644 --- a/source/blender/compositor/nodes/COM_TransformNode.cpp +++ b/source/blender/compositor/nodes/COM_TransformNode.cpp @@ -40,32 +40,32 @@ void TransformNode::convertToOperations(NodeConverter &converter, const Composit NodeInput *yInput = this->getInputSocket(2); NodeInput *angleInput = this->getInputSocket(3); NodeInput *scaleInput = this->getInputSocket(4); - + ScaleOperation *scaleOperation = new ScaleOperation(); converter.addOperation(scaleOperation); - + RotateOperation *rotateOperation = new RotateOperation(); rotateOperation->setDoDegree2RadConversion(false); converter.addOperation(rotateOperation); - + TranslateOperation *translateOperation = new TranslateOperation(); converter.addOperation(translateOperation); - + SetSamplerOperation *sampler = new SetSamplerOperation(); sampler->setSampler((PixelSampler)this->getbNode()->custom1); converter.addOperation(sampler); - + converter.mapInputSocket(imageInput, sampler->getInputSocket(0)); converter.addLink(sampler->getOutputSocket(), scaleOperation->getInputSocket(0)); converter.mapInputSocket(scaleInput, scaleOperation->getInputSocket(1)); converter.mapInputSocket(scaleInput, scaleOperation->getInputSocket(2)); // xscale = yscale - + converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0)); converter.mapInputSocket(angleInput, rotateOperation->getInputSocket(1)); - + converter.addLink(rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0)); converter.mapInputSocket(xInput, translateOperation->getInputSocket(1)); converter.mapInputSocket(yInput, translateOperation->getInputSocket(2)); - + converter.mapOutputSocket(getOutputSocket(), translateOperation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_TranslateNode.cpp b/source/blender/compositor/nodes/COM_TranslateNode.cpp index 0e658e09931..ac09b38951b 100644 --- a/source/blender/compositor/nodes/COM_TranslateNode.cpp +++ b/source/blender/compositor/nodes/COM_TranslateNode.cpp @@ -36,32 +36,32 @@ void TranslateNode::convertToOperations(NodeConverter &converter, const Composit { bNode *bnode = this->getbNode(); NodeTranslateData *data = (NodeTranslateData *)bnode->storage; - + NodeInput *inputSocket = this->getInputSocket(0); NodeInput *inputXSocket = this->getInputSocket(1); NodeInput *inputYSocket = this->getInputSocket(2); NodeOutput *outputSocket = this->getOutputSocket(0); - + TranslateOperation *operation = new TranslateOperation(); if (data->relative) { const RenderData *rd = context.getRenderData(); float fx = rd->xsch * rd->size / 100.0f; float fy = rd->ysch * rd->size / 100.0f; - + operation->setFactorXY(fx, fy); } - + converter.addOperation(operation); converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); - + if (data->wrap_axis) { WriteBufferOperation *writeOperation = new WriteBufferOperation(COM_DT_COLOR); WrapOperation *wrapOperation = new WrapOperation(COM_DT_COLOR); wrapOperation->setMemoryProxy(writeOperation->getMemoryProxy()); wrapOperation->setWrapping(data->wrap_axis); - + converter.addOperation(writeOperation); converter.addOperation(wrapOperation); converter.mapInputSocket(inputSocket, writeOperation->getInputSocket(0)); diff --git a/source/blender/compositor/nodes/COM_ValueNode.cpp b/source/blender/compositor/nodes/COM_ValueNode.cpp index f2eef188861..b7484eb4ed6 100644 --- a/source/blender/compositor/nodes/COM_ValueNode.cpp +++ b/source/blender/compositor/nodes/COM_ValueNode.cpp @@ -35,6 +35,6 @@ void ValueNode::convertToOperations(NodeConverter &converter, const CompositorCo NodeOutput *output = this->getOutputSocket(0); operation->setValue(output->getEditorValueFloat()); converter.addOperation(operation); - + converter.mapOutputSocket(output, operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_VectorBlurNode.cpp b/source/blender/compositor/nodes/COM_VectorBlurNode.cpp index 5cfd83360c7..5a6b49c9bd1 100644 --- a/source/blender/compositor/nodes/COM_VectorBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_VectorBlurNode.cpp @@ -33,12 +33,12 @@ void VectorBlurNode::convertToOperations(NodeConverter &converter, const Composi { bNode *node = this->getbNode(); NodeBlurData *vectorBlurSettings = (NodeBlurData *)node->storage; - + VectorBlurOperation *operation = new VectorBlurOperation(); operation->setVectorBlurSettings(vectorBlurSettings); operation->setQuality(context.getQuality()); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); diff --git a/source/blender/compositor/nodes/COM_VectorCurveNode.cpp b/source/blender/compositor/nodes/COM_VectorCurveNode.cpp index db7e1597bf3..dc4b2f66a0a 100644 --- a/source/blender/compositor/nodes/COM_VectorCurveNode.cpp +++ b/source/blender/compositor/nodes/COM_VectorCurveNode.cpp @@ -34,7 +34,7 @@ void VectorCurveNode::convertToOperations(NodeConverter &converter, const Compos VectorCurveOperation *operation = new VectorCurveOperation(); operation->setCurveMapping((CurveMapping *)this->getbNode()->storage); converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp b/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp index b7e4c9e8a1d..134ab5628ec 100644 --- a/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp +++ b/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp @@ -36,12 +36,12 @@ void ViewLevelsNode::convertToOperations(NodeConverter &converter, const Composi NodeInput *input = this->getInputSocket(0); if (input->isLinked()) { // add preview to inputSocket; - + /* calculate mean operation */ { CalculateMeanOperation *operation = new CalculateMeanOperation(); operation->setSetting(this->getbNode()->custom1); - + converter.addOperation(operation); converter.mapInputSocket(input, operation->getInputSocket(0)); converter.mapOutputSocket(this->getOutputSocket(0), operation->getOutputSocket()); @@ -51,7 +51,7 @@ void ViewLevelsNode::convertToOperations(NodeConverter &converter, const Composi { CalculateStandardDeviationOperation *operation = new CalculateStandardDeviationOperation(); operation->setSetting(this->getbNode()->custom1); - + converter.addOperation(operation); converter.mapInputSocket(input, operation->getInputSocket(0)); converter.mapOutputSocket(this->getOutputSocket(1), operation->getOutputSocket()); diff --git a/source/blender/compositor/nodes/COM_ZCombineNode.cpp b/source/blender/compositor/nodes/COM_ZCombineNode.cpp index c77bd031824..a5d42bb0333 100644 --- a/source/blender/compositor/nodes/COM_ZCombineNode.cpp +++ b/source/blender/compositor/nodes/COM_ZCombineNode.cpp @@ -43,16 +43,16 @@ void ZCombineNode::convertToOperations(NodeConverter &converter, const Composito operation = new ZCombineOperation(); } converter.addOperation(operation); - + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(3)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); - + MathMinimumOperation *zoperation = new MathMinimumOperation(); converter.addOperation(zoperation); - + converter.mapInputSocket(getInputSocket(1), zoperation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(3), zoperation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(1), zoperation->getOutputSocket()); @@ -65,14 +65,14 @@ void ZCombineNode::convertToOperations(NodeConverter &converter, const Composito if (this->getbNode()->custom1) { maskoperation = new MathGreaterThanOperation(); converter.addOperation(maskoperation); - + converter.mapInputSocket(getInputSocket(1), maskoperation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(3), maskoperation->getInputSocket(1)); } else { maskoperation = new MathLessThanOperation(); converter.addOperation(maskoperation); - + converter.mapInputSocket(getInputSocket(1), maskoperation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(3), maskoperation->getInputSocket(1)); } @@ -80,13 +80,13 @@ void ZCombineNode::convertToOperations(NodeConverter &converter, const Composito // step 2 anti alias mask bit of an expensive operation, but does the trick AntiAliasOperation *antialiasoperation = new AntiAliasOperation(); converter.addOperation(antialiasoperation); - + converter.addLink(maskoperation->getOutputSocket(), antialiasoperation->getInputSocket(0)); // use mask to blend between the input colors. ZCombineMaskOperation *zcombineoperation = this->getbNode()->custom1 ? new ZCombineMaskAlphaOperation() : new ZCombineMaskOperation(); converter.addOperation(zcombineoperation); - + converter.addLink(antialiasoperation->getOutputSocket(), zcombineoperation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(0), zcombineoperation->getInputSocket(1)); converter.mapInputSocket(getInputSocket(2), zcombineoperation->getInputSocket(2)); @@ -94,7 +94,7 @@ void ZCombineNode::convertToOperations(NodeConverter &converter, const Composito MathMinimumOperation *zoperation = new MathMinimumOperation(); converter.addOperation(zoperation); - + converter.mapInputSocket(getInputSocket(1), zoperation->getInputSocket(0)); converter.mapInputSocket(getInputSocket(3), zoperation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(1), zoperation->getOutputSocket()); diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp index 928525f2594..e6ae9b5fc8b 100644 --- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp +++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp @@ -32,11 +32,11 @@ void AlphaOverKeyOperation::executePixelSampled(float output[4], float x, float float inputColor1[4]; float inputOverColor[4]; float value[4]; - + this->m_inputValueOperation->readSampled(value, x, y, sampler); this->m_inputColor1Operation->readSampled(inputColor1, x, y, sampler); this->m_inputColor2Operation->readSampled(inputOverColor, x, y, sampler); - + if (inputOverColor[3] <= 0.0f) { copy_v4_v4(output, inputColor1); } @@ -46,7 +46,7 @@ void AlphaOverKeyOperation::executePixelSampled(float output[4], float x, float else { float premul = value[0] * inputOverColor[3]; float mul = 1.0f - premul; - + output[0] = (mul * inputColor1[0]) + premul * inputOverColor[0]; output[1] = (mul * inputColor1[1]) + premul * inputOverColor[1]; output[2] = (mul * inputColor1[2]) + premul * inputOverColor[2]; diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h index 8e4a0c93202..144c60f2966 100644 --- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h @@ -35,7 +35,7 @@ public: * Default constructor */ AlphaOverKeyOperation(); - + /** * the inner loop of this program */ diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp index 990ec5f5370..748b5c63409 100644 --- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp +++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp @@ -32,11 +32,11 @@ void AlphaOverMixedOperation::executePixelSampled(float output[4], float x, floa float inputColor1[4]; float inputOverColor[4]; float value[4]; - + this->m_inputValueOperation->readSampled(value, x, y, sampler); this->m_inputColor1Operation->readSampled(inputColor1, x, y, sampler); this->m_inputColor2Operation->readSampled(inputOverColor, x, y, sampler); - + if (inputOverColor[3] <= 0.0f) { copy_v4_v4(output, inputColor1); } diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h index 8c97b065792..a76bf12481d 100644 --- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h @@ -37,12 +37,12 @@ public: * Default constructor */ AlphaOverMixedOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void setX(float x) { this->m_x = x; } }; #endif diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp index 1f397e8a126..b6a1ab57b14 100644 --- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp +++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp @@ -32,11 +32,11 @@ void AlphaOverPremultiplyOperation::executePixelSampled(float output[4], float x float inputColor1[4]; float inputOverColor[4]; float value[4]; - + this->m_inputValueOperation->readSampled(value, x, y, sampler); this->m_inputColor1Operation->readSampled(inputColor1, x, y, sampler); this->m_inputColor2Operation->readSampled(inputOverColor, x, y, sampler); - + /* Zero alpha values should still permit an add of RGB data */ if (inputOverColor[3] < 0.0f) { copy_v4_v4(output, inputColor1); @@ -46,7 +46,7 @@ void AlphaOverPremultiplyOperation::executePixelSampled(float output[4], float x } else { float mul = 1.0f - value[0] * inputOverColor[3]; - + output[0] = (mul * inputColor1[0]) + value[0] * inputOverColor[0]; output[1] = (mul * inputColor1[1]) + value[0] * inputOverColor[1]; output[2] = (mul * inputColor1[2]) + value[0] * inputOverColor[2]; diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h index 1dad453ca4e..8551dba7b7c 100644 --- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h @@ -35,7 +35,7 @@ public: * Default constructor */ AlphaOverPremultiplyOperation(); - + /** * the inner loop of this program */ diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.h b/source/blender/compositor/operations/COM_AntiAliasOperation.h index 13632a81084..a6f74eb214c 100644 --- a/source/blender/compositor/operations/COM_AntiAliasOperation.h +++ b/source/blender/compositor/operations/COM_AntiAliasOperation.h @@ -38,19 +38,19 @@ protected: SocketReader *m_valueReader; public: AntiAliasOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp index 4a6da3092a2..506c2181ee9 100644 --- a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp @@ -84,7 +84,7 @@ void BilateralBlurOperation::executePixel(float output[4], int x, int y, void *d } } } - + if (blurDivider > 0.0f) { mul_v4_v4fl(output, blurColor, 1.0f / blurDivider); } diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.h b/source/blender/compositor/operations/COM_BilateralBlurOperation.h index b013e357b9c..70f291d5e1c 100644 --- a/source/blender/compositor/operations/COM_BilateralBlurOperation.h +++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.h @@ -39,19 +39,19 @@ public: * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); - + void setData(NodeBilateralBlurData *data) { this->m_data = data; } }; #endif diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.h b/source/blender/compositor/operations/COM_BlurBaseOperation.h index 9fd7c017715..1a57b170c9a 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.h +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.h @@ -62,12 +62,12 @@ public: * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setData(const NodeBlurData *data); void setSize(float size) { this->m_size = size; this->m_sizeavailable = true; } diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp index c413f45cbaa..2476ab3b591 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp @@ -194,8 +194,8 @@ bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe } void BokehBlurOperation::executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, + MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, + MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> * /*clKernelsToCleanUp*/) { cl_kernel kernel = device->COM_clCreateKernel("bokehBlurKernel", NULL); @@ -205,7 +205,7 @@ void BokehBlurOperation::executeOpenCL(OpenCLDevice *device, const float max_dim = max(this->getWidth(), this->getHeight()); cl_int radius = this->m_size * max_dim / 100.0f; cl_int step = this->getStep(); - + device->COM_clAttachMemoryBufferToKernelParameter(kernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputBoundingBoxReader); device->COM_clAttachMemoryBufferToKernelParameter(kernel, 1, 4, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram); device->COM_clAttachMemoryBufferToKernelParameter(kernel, 2, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputBokehProgram); @@ -214,7 +214,7 @@ void BokehBlurOperation::executeOpenCL(OpenCLDevice *device, clSetKernelArg(kernel, 6, sizeof(cl_int), &radius); clSetKernelArg(kernel, 7, sizeof(cl_int), &step); device->COM_clAttachSizeToKernelParameter(kernel, 8, this); - + device->COM_clEnqueueRange(kernel, outputMemoryBuffer, 9, this); } diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.h b/source/blender/compositor/operations/COM_BokehBlurOperation.h index 3bfaae6617e..f1540835eaf 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.h @@ -46,21 +46,21 @@ public: * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); void setSize(float size) { this->m_size = size; this->m_sizeavailable = true; } - + void executeOpenCL(OpenCLDevice *device, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.h b/source/blender/compositor/operations/COM_BokehImageOperation.h index a2dd3b6ddb7..6f2001566ea 100644 --- a/source/blender/compositor/operations/COM_BokehImageOperation.h +++ b/source/blender/compositor/operations/COM_BokehImageOperation.h @@ -61,27 +61,27 @@ private: * @brief precalced center of the image */ float m_center[2]; - + /** * @brief 1.0-rounding */ float m_inverseRounding; - + /** * @brief distance of a full circle lens */ float m_circularDistance; - + /** * @brief radius when the first flap starts */ float m_flapRad; - + /** * @brief radians of a single flap */ float m_flapRadAdd; - + /** * @brief should the m_data field by deleted when this operation is finished */ @@ -95,7 +95,7 @@ private: * @param distance the lens distance is used to simulate lens shifts */ void detemineStartPointOfFlap(float r[2], int flapNumber, float distance); - + /** * @brief Determine if a coordinate is inside the bokeh image * @@ -112,17 +112,17 @@ public: * @brief the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * @brief Initialize the execution */ void initExecution(); - + /** * @brief Deinitialize the execution */ void deinitExecution(); - + /** * @brief determine the resolution of this operation. currently fixed at [COM_BLUR_BOKEH_PIXELS, COM_BLUR_BOKEH_PIXELS] * @param resolution @@ -135,7 +135,7 @@ public: * @param data */ void setData(NodeBokehImage *data) { this->m_data = data; } - + /** * @brief deleteDataOnFinish * diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp index e19e5bf031c..d4fe976cf26 100644 --- a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp @@ -48,25 +48,25 @@ void BoxMaskOperation::executePixelSampled(float output[4], float x, float y, Pi { float inputMask[4]; float inputValue[4]; - + float rx = x / this->getWidth(); float ry = y / this->getHeight(); - + const float dy = (ry - this->m_data->y) / this->m_aspectRatio; const float dx = rx - this->m_data->x; rx = this->m_data->x + (this->m_cosine * dx + this->m_sine * dy); ry = this->m_data->y + (-this->m_sine * dx + this->m_cosine * dy); - + this->m_inputMask->readSampled(inputMask, x, y, sampler); this->m_inputValue->readSampled(inputValue, x, y, sampler); - + float halfHeight = this->m_data->height / 2.0f; float halfWidth = this->m_data->width / 2.0f; bool inside = (rx > this->m_data->x - halfWidth && rx < this->m_data->x + halfWidth && ry > this->m_data->y - halfHeight && ry < this->m_data->y + halfHeight); - + switch (this->m_maskType) { case CMP_NODE_MASKTYPE_ADD: if (inside) { diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.h b/source/blender/compositor/operations/COM_BoxMaskOperation.h index c8b2ba14467..292e3a9391f 100644 --- a/source/blender/compositor/operations/COM_BoxMaskOperation.h +++ b/source/blender/compositor/operations/COM_BoxMaskOperation.h @@ -32,31 +32,31 @@ private: */ SocketReader *m_inputMask; SocketReader *m_inputValue; - + float m_sine; float m_cosine; float m_aspectRatio; int m_maskType; - + NodeBoxMask *m_data; public: BoxMaskOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setData(NodeBoxMask *data) { this->m_data = data; } void setMaskType(int maskType) { this->m_maskType = maskType; } diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.h b/source/blender/compositor/operations/COM_BrightnessOperation.h index 0b7656c5364..8bda13ea418 100644 --- a/source/blender/compositor/operations/COM_BrightnessOperation.h +++ b/source/blender/compositor/operations/COM_BrightnessOperation.h @@ -38,17 +38,17 @@ private: public: BrightnessOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp index 0fa8b5fa5d2..be6d2b40d7e 100644 --- a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp +++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp @@ -96,7 +96,7 @@ void CalculateMeanOperation::calculateMean(MemoryBuffer *tile) for (int i = 0, offset = 0; i < size; i++, offset += 4) { if (buffer[offset + 3] > 0) { pixels++; - + switch (this->m_setting) { case 1: { diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.h b/source/blender/compositor/operations/COM_CalculateMeanOperation.h index 4fa89290c82..d7d927791b2 100644 --- a/source/blender/compositor/operations/COM_CalculateMeanOperation.h +++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.h @@ -35,34 +35,34 @@ protected: * @brief Cached reference to the reader */ SocketReader *m_imageReader; - + bool m_iscalculated; float m_result; int m_setting; public: CalculateMeanOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); - + /** * Deinitialize the execution */ void deinitExecution(); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); void setSetting(int setting) { this->m_setting = setting; } - + protected: void calculateMean(MemoryBuffer *tile); }; diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp index ff4857b7b0f..28012cdfabf 100644 --- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp +++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp @@ -55,7 +55,7 @@ void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect) for (int i = 0, offset = 0; i < size; i++, offset += 4) { if (buffer[offset + 3] > 0) { pixels++; - + switch (this->m_setting) { case 1: /* rgb combined */ { diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp index a02c1b03006..f90e9b70053 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp @@ -52,12 +52,12 @@ void ChangeHSVOperation::executePixelSampled(float output[4], float x, float y, { float inputColor1[4]; float hue[4], saturation[4], value[4]; - + this->m_inputOperation->readSampled(inputColor1, x, y, sampler); this->m_hueOperation->readSampled(hue, x, y, sampler); this->m_saturationOperation->readSampled(saturation, x, y, sampler); this->m_valueOperation->readSampled(value, x, y, sampler); - + output[0] = inputColor1[0] + (hue[0] - 0.5f); if (output[0] > 1.0f) output[0] -= 1.0f; else if (output[0] < 0.0f) output[0] += 1.0f; diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.h b/source/blender/compositor/operations/COM_ChangeHSVOperation.h index e6f45c5ad36..9685a298607 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.h +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.h @@ -41,10 +41,10 @@ public: * Default constructor */ ChangeHSVOperation(); - + void initExecution(); void deinitExecution(); - + /** * the inner loop of this program */ diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp index 3faffc1e3ff..688cbe91cf7 100644 --- a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp @@ -101,10 +101,10 @@ void ChannelMatteOperation::executePixelSampled(float output[4], float x, float /* matte operation */ alpha = inColor[this->m_ids[0]] - max(inColor[this->m_ids[1]], inColor[this->m_ids[2]]); - + /* flip because 0.0 is transparent, not 1.0 */ alpha = 1.0f - alpha; - + /* test range */ if (alpha > limit_max) { alpha = inColor[3]; /*whatever it was prior */ @@ -119,7 +119,7 @@ void ChannelMatteOperation::executePixelSampled(float output[4], float x, float /* store matte(alpha) value in [0] to go with * COM_SetAlphaOperation and the Value output */ - + /* don't make something that was more transparent less transparent */ output[0] = min(alpha, inColor[3]); } diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp index 23390bd337d..806772417a4 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp @@ -53,14 +53,14 @@ void ColorBalanceASCCDLOperation::executePixelSampled(float output[4], float x, { float inputColor[4]; float value[4]; - + this->m_inputValueOperation->readSampled(value, x, y, sampler); this->m_inputColorOperation->readSampled(inputColor, x, y, sampler); - + float fac = value[0]; fac = min(1.0f, fac); const float mfac = 1.0f - fac; - + output[0] = mfac * inputColor[0] + fac * colorbalance_cdl(inputColor[0], this->m_offset[0], this->m_power[0], this->m_slope[0]); output[1] = mfac * inputColor[1] + fac * colorbalance_cdl(inputColor[1], this->m_offset[1], this->m_power[1], this->m_slope[1]); output[2] = mfac * inputColor[2] + fac * colorbalance_cdl(inputColor[2], this->m_offset[2], this->m_power[2], this->m_slope[2]); diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h index cc6bd894748..44981a2c957 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h +++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h @@ -35,7 +35,7 @@ protected: */ SocketReader *m_inputValueOperation; SocketReader *m_inputColorOperation; - + float m_offset[3]; float m_power[3]; float m_slope[3]; @@ -45,22 +45,22 @@ public: * Default constructor */ ColorBalanceASCCDLOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setOffset(float offset[3]) { copy_v3_v3(this->m_offset, offset); } void setPower(float power[3]) { copy_v3_v3(this->m_power, power); } void setSlope(float slope[3]) { copy_v3_v3(this->m_slope, slope); } diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp index e13fd26aed2..e264c065f47 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp @@ -58,14 +58,14 @@ void ColorBalanceLGGOperation::executePixelSampled(float output[4], float x, flo { float inputColor[4]; float value[4]; - + this->m_inputValueOperation->readSampled(value, x, y, sampler); this->m_inputColorOperation->readSampled(inputColor, x, y, sampler); - + float fac = value[0]; fac = min(1.0f, fac); const float mfac = 1.0f - fac; - + output[0] = mfac * inputColor[0] + fac * colorbalance_lgg(inputColor[0], this->m_lift[0], this->m_gamma_inv[0], this->m_gain[0]); output[1] = mfac * inputColor[1] + fac * colorbalance_lgg(inputColor[1], this->m_lift[1], this->m_gamma_inv[1], this->m_gain[1]); output[2] = mfac * inputColor[2] + fac * colorbalance_lgg(inputColor[2], this->m_lift[2], this->m_gamma_inv[2], this->m_gain[2]); diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h index 86d7abc92bc..97fc8b6f870 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h +++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h @@ -36,7 +36,7 @@ protected: */ SocketReader *m_inputValueOperation; SocketReader *m_inputColorOperation; - + float m_gain[3]; float m_lift[3]; float m_gamma_inv[3]; @@ -46,22 +46,22 @@ public: * Default constructor */ ColorBalanceLGGOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setGain(const float gain[3]) { copy_v3_v3(this->m_gain, gain); } void setLift(const float lift[3]) { copy_v3_v3(this->m_lift, lift); } void setGammaInv(const float gamma_inv[3]) { copy_v3_v3(this->m_gamma_inv, gamma_inv); } diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp index 05edaf51a25..5e08dadd635 100644 --- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp @@ -50,7 +50,7 @@ void ColorCorrectionOperation::executePixelSampled(float output[4], float x, flo float inputMask[4]; this->m_inputImage->readSampled(inputImageColor, x, y, sampler); this->m_inputMask->readSampled(inputMask, x, y, sampler); - + float level = (inputImageColor[0] + inputImageColor[1] + inputImageColor[2]) / 3.0f; float contrast = this->m_data->master.contrast; float saturation = this->m_data->master.saturation; @@ -58,11 +58,11 @@ void ColorCorrectionOperation::executePixelSampled(float output[4], float x, flo float gain = this->m_data->master.gain; float lift = this->m_data->master.lift; float r, g, b; - + float value = inputMask[0]; value = min(1.0f, value); const float mvalue = 1.0f - value; - + float levelShadows = 0.0; float levelMidtones = 0.0; float levelHighlights = 0.0; @@ -92,7 +92,7 @@ void ColorCorrectionOperation::executePixelSampled(float output[4], float x, flo gamma *= (levelShadows * this->m_data->shadows.gamma) + (levelMidtones * this->m_data->midtones.gamma) + (levelHighlights * this->m_data->highlights.gamma); gain *= (levelShadows * this->m_data->shadows.gain) + (levelMidtones * this->m_data->midtones.gain) + (levelHighlights * this->m_data->highlights.gain); lift += (levelShadows * this->m_data->shadows.lift) + (levelMidtones * this->m_data->midtones.lift) + (levelHighlights * this->m_data->highlights.lift); - + float invgamma = 1.0f / gamma; float luma = IMB_colormanagement_get_luminance(inputImageColor); @@ -103,21 +103,21 @@ void ColorCorrectionOperation::executePixelSampled(float output[4], float x, flo r = (luma + saturation * (r - luma)); g = (luma + saturation * (g - luma)); b = (luma + saturation * (b - luma)); - + r = 0.5f + ((r - 0.5f) * contrast); g = 0.5f + ((g - 0.5f) * contrast); b = 0.5f + ((b - 0.5f) * contrast); - + r = powf(r * gain + lift, invgamma); g = powf(g * gain + lift, invgamma); b = powf(b * gain + lift, invgamma); - - + + // mix with mask r = mvalue * inputImageColor[0] + value * r; g = mvalue * inputImageColor[1] + value * g; b = mvalue * inputImageColor[2] + value * b; - + if (this->m_redChannelEnabled) { output[0] = r; } diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.h b/source/blender/compositor/operations/COM_ColorCorrectionOperation.h index c386a2f3e6e..7c7ccf2db9b 100644 --- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.h +++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.h @@ -33,29 +33,29 @@ private: SocketReader *m_inputImage; SocketReader *m_inputMask; NodeColorCorrection *m_data; - + bool m_redChannelEnabled; bool m_greenChannelEnabled; bool m_blueChannelEnabled; public: ColorCorrectionOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setData(NodeColorCorrection *data) { this->m_data = data; } void setRedChannelEnabled(bool enabled) { this->m_redChannelEnabled = enabled; } void setGreenChannelEnabled(bool enabled) { this->m_greenChannelEnabled = enabled; } diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp index 5967147b3d1..4cecc53ad01 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp @@ -61,7 +61,7 @@ void ColorCurveOperation::initExecution() void ColorCurveOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) { CurveMapping *cumap = this->m_curveMapping; - + float fac[4]; float image[4]; diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.h b/source/blender/compositor/operations/COM_ColorCurveOperation.h index 3b10786fb2c..17c94feed5f 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.h +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.h @@ -37,17 +37,17 @@ private: SocketReader *m_inputWhiteProgram; public: ColorCurveOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ @@ -63,25 +63,25 @@ private: SocketReader *m_inputImageProgram; float m_black[3]; float m_white[3]; - + public: ConstantLevelColorCurveOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setBlackLevel(float black[3]) { copy_v3_v3(this->m_black, black); } void setWhiteLevel(float white[3]) { copy_v3_v3(this->m_white, white); } }; diff --git a/source/blender/compositor/operations/COM_ColorRampOperation.h b/source/blender/compositor/operations/COM_ColorRampOperation.h index 55f711165d6..2d1919bb4b5 100644 --- a/source/blender/compositor/operations/COM_ColorRampOperation.h +++ b/source/blender/compositor/operations/COM_ColorRampOperation.h @@ -34,22 +34,22 @@ private: ColorBand *m_colorBand; public: ColorRampOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setColorBand(ColorBand *colorBand) { this->m_colorBand = colorBand; } diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp index 0769e5d0b01..2f30ed83043 100644 --- a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp @@ -68,7 +68,7 @@ void ColorSpillOperation::initExecution() this->m_rmut = 1.0f; this->m_gmut = 1.0f; this->m_bmut = -1.0f; - + this->m_channel2 = 0; this->m_channel3 = 1; if (this->m_settings->unspill == 0) { diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.h b/source/blender/compositor/operations/COM_ColorSpillOperation.h index 3b94c293ec9..5971db9fa76 100644 --- a/source/blender/compositor/operations/COM_ColorSpillOperation.h +++ b/source/blender/compositor/operations/COM_ColorSpillOperation.h @@ -55,7 +55,7 @@ public: void setSettings(NodeColorspill *nodeColorSpill) { this->m_settings = nodeColorSpill; } void setSpillChannel(int channel) { this->m_spillChannel = channel; } void setSpillMethod(int method) { this->m_spillMethod = method; } - + float calculateMapValue(float fac, float *input); }; diff --git a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h index ceba2a85da0..47f9f20f393 100644 --- a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h +++ b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h @@ -35,17 +35,17 @@ private: * Cached reference to the inputProgram */ SocketReader *m_inputOperation; - + /** * @brief color profile where to convert from */ int m_fromProfile; - + /** * @brief color profile where to convert to */ int m_toProfile; - + /** * @brief is color predivided */ @@ -55,22 +55,22 @@ public: * Default constructor */ ConvertColorProfileOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setFromColorProfile(int colorProfile) { this->m_fromProfile = colorProfile; } void setToColorProfile(int colorProfile) { this->m_toProfile = colorProfile; } void setPredivided(bool predivided) { this->m_predivided = predivided; } diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp index 9057c3c92ec..111bfeadf35 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp @@ -81,7 +81,7 @@ void ConvertDepthToRadiusOperation::executePixelSampled(float output[4], float x z = inputValue[0]; if (z != 0.0f) { float iZ = (1.0f / z); - + // bug #6656 part 2b, do not rescale #if 0 bcrad = 0.5f * fabs(aperture * (dof_sp * (cam_invfdist - iZ) - 1.0f)); diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h index 697ac455702..65db1cf45d9 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h @@ -43,34 +43,34 @@ private: float m_cam_lens; float m_dof_sp; Object *m_cameraObject; - + FastGaussianBlurValueOperation *m_blurPostOperation; public: /** * Default constructor */ ConvertDepthToRadiusOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setfStop(float fStop) { this->m_fStop = fStop; } void setMaxRadius(float maxRadius) { this->m_maxRadius = maxRadius; } void setCameraObject(Object *camera) { this->m_cameraObject = camera; } float determineFocalDistance(); void setPostBlur(FastGaussianBlurValueOperation *operation) {this->m_blurPostOperation = operation;} - + }; #endif diff --git a/source/blender/compositor/operations/COM_ConvertOperation.h b/source/blender/compositor/operations/COM_ConvertOperation.h index 5dee63ea739..9c23cc9bda7 100644 --- a/source/blender/compositor/operations/COM_ConvertOperation.h +++ b/source/blender/compositor/operations/COM_ConvertOperation.h @@ -29,10 +29,10 @@ class ConvertBaseOperation : public NodeOperation { protected: SocketReader *m_inputOperation; - + public: ConvertBaseOperation(); - + void initExecution(); void deinitExecution(); }; @@ -41,7 +41,7 @@ public: class ConvertValueToColorOperation : public ConvertBaseOperation { public: ConvertValueToColorOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -49,7 +49,7 @@ public: class ConvertColorToValueOperation : public ConvertBaseOperation { public: ConvertColorToValueOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -57,7 +57,7 @@ public: class ConvertColorToBWOperation : public ConvertBaseOperation { public: ConvertColorToBWOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -65,7 +65,7 @@ public: class ConvertColorToVectorOperation : public ConvertBaseOperation { public: ConvertColorToVectorOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -73,7 +73,7 @@ public: class ConvertValueToVectorOperation : public ConvertBaseOperation { public: ConvertValueToVectorOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -81,7 +81,7 @@ public: class ConvertVectorToColorOperation : public ConvertBaseOperation { public: ConvertVectorToColorOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -89,7 +89,7 @@ public: class ConvertVectorToValueOperation : public ConvertBaseOperation { public: ConvertVectorToValueOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -114,9 +114,9 @@ private: int m_mode; public: ConvertYCCToRGBOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** Set the YCC mode */ void setMode(int mode); }; @@ -125,7 +125,7 @@ public: class ConvertRGBToYUVOperation : public ConvertBaseOperation { public: ConvertRGBToYUVOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -133,7 +133,7 @@ public: class ConvertYUVToRGBOperation : public ConvertBaseOperation { public: ConvertYUVToRGBOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -141,7 +141,7 @@ public: class ConvertRGBToHSVOperation : public ConvertBaseOperation { public: ConvertRGBToHSVOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -149,7 +149,7 @@ public: class ConvertHSVToRGBOperation : public ConvertBaseOperation { public: ConvertHSVToRGBOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -177,10 +177,10 @@ private: public: SeparateChannelOperation(); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void initExecution(); void deinitExecution(); - + void setChannel(int channel) { this->m_channel = channel; } }; @@ -194,7 +194,7 @@ private: public: CombineChannelsOperation(); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void initExecution(); void deinitExecution(); }; diff --git a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp index 56815459ee7..9eb2d1bfcc5 100644 --- a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp @@ -44,7 +44,7 @@ void ConvolutionEdgeFilterOperation::executePixel(float output[4], int x, int y, CLAMP(y1, 0, getHeight() - 1); CLAMP(y2, 0, getHeight() - 1); CLAMP(y3, 0, getHeight() - 1); - + float value[4]; this->m_inputValueOperation->read(value, x2, y2, NULL); float mval = 1.0f - value[0]; @@ -52,47 +52,47 @@ void ConvolutionEdgeFilterOperation::executePixel(float output[4], int x, int y, this->m_inputOperation->read(in1, x1, y1, NULL); madd_v3_v3fl(res1, in1, this->m_filter[0]); madd_v3_v3fl(res2, in1, this->m_filter[0]); - + this->m_inputOperation->read(in1, x2, y1, NULL); madd_v3_v3fl(res1, in1, this->m_filter[1]); madd_v3_v3fl(res2, in1, this->m_filter[3]); - + this->m_inputOperation->read(in1, x3, y1, NULL); madd_v3_v3fl(res1, in1, this->m_filter[2]); madd_v3_v3fl(res2, in1, this->m_filter[6]); - + this->m_inputOperation->read(in1, x1, y2, NULL); madd_v3_v3fl(res1, in1, this->m_filter[3]); madd_v3_v3fl(res2, in1, this->m_filter[1]); - + this->m_inputOperation->read(in2, x2, y2, NULL); madd_v3_v3fl(res1, in2, this->m_filter[4]); madd_v3_v3fl(res2, in2, this->m_filter[4]); - + this->m_inputOperation->read(in1, x3, y2, NULL); madd_v3_v3fl(res1, in1, this->m_filter[5]); madd_v3_v3fl(res2, in1, this->m_filter[7]); - + this->m_inputOperation->read(in1, x1, y3, NULL); madd_v3_v3fl(res1, in1, this->m_filter[6]); madd_v3_v3fl(res2, in1, this->m_filter[2]); - + this->m_inputOperation->read(in1, x2, y3, NULL); madd_v3_v3fl(res1, in1, this->m_filter[7]); madd_v3_v3fl(res2, in1, this->m_filter[5]); - + this->m_inputOperation->read(in1, x3, y3, NULL); madd_v3_v3fl(res1, in1, this->m_filter[8]); madd_v3_v3fl(res2, in1, this->m_filter[8]); - + output[0] = sqrt(res1[0] * res1[0] + res2[0] * res2[0]); output[1] = sqrt(res1[1] * res1[1] + res2[1] * res2[1]); output[2] = sqrt(res1[2] * res1[2] + res2[2] * res2[2]); - + output[0] = output[0] * value[0] + in2[0] * mval; output[1] = output[1] * value[0] + in2[1] * mval; output[2] = output[2] * value[0] + in2[2] * mval; - + output[3] = in2[3]; /* Make sure we don't return negative color. */ diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp index 41cc504af05..b14fdc811d4 100644 --- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp @@ -102,7 +102,7 @@ void ConvolutionFilterOperation::executePixel(float output[4], int x, int y, voi madd_v4_v4fl(output, in1, this->m_filter[7]); this->m_inputOperation->read(in1, x3, y3, NULL); madd_v4_v4fl(output, in1, this->m_filter[8]); - + output[0] = output[0] * value[0] + in2[0] * mval; output[1] = output[1] * value[0] + in2[1] * mval; output[2] = output[2] * value[0] + in2[2] * mval; @@ -124,6 +124,6 @@ bool ConvolutionFilterOperation::determineDependingAreaOfInterest(rcti *input, R newInput.xmin = input->xmin - addx; newInput.ymax = input->ymax + addy; newInput.ymin = input->ymin - addy; - + return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h index 75fba0ee1e4..99e6fc52ddc 100644 --- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h +++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h @@ -40,7 +40,7 @@ public: void set3x3Filter(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); void executePixel(float output[4], int x, int y, void *data); - + void initExecution(); void deinitExecution(); }; diff --git a/source/blender/compositor/operations/COM_CropOperation.cpp b/source/blender/compositor/operations/COM_CropOperation.cpp index 162811ac31d..af68fa09f1a 100644 --- a/source/blender/compositor/operations/COM_CropOperation.cpp +++ b/source/blender/compositor/operations/COM_CropOperation.cpp @@ -37,7 +37,7 @@ void CropBaseOperation::updateArea() float width = inputReference->getWidth(); float height = inputReference->getHeight(); NodeTwoXYs local_settings = *this->m_settings; - + if (width > 0.0f && height > 0.0f) { if (this->m_relative) { local_settings.x1 = width * local_settings.fac_x1; @@ -53,7 +53,7 @@ void CropBaseOperation::updateArea() local_settings.x2 = width - 1; if (height <= local_settings.y2 + 1) local_settings.y2 = height - 1; - + this->m_xmax = max(local_settings.x1, local_settings.x2) + 1; this->m_xmin = min(local_settings.x1, local_settings.x2); this->m_ymax = max(local_settings.y1, local_settings.y2) + 1; @@ -101,12 +101,12 @@ CropImageOperation::CropImageOperation() : CropBaseOperation() bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { rcti newInput; - + newInput.xmax = input->xmax + this->m_xmin; newInput.xmin = input->xmin + this->m_xmin; newInput.ymax = input->ymax + this->m_ymin; newInput.ymin = input->ymin + this->m_ymin; - + return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } diff --git a/source/blender/compositor/operations/COM_CropOperation.h b/source/blender/compositor/operations/COM_CropOperation.h index 7c5b995fb17..f73b4c602f6 100644 --- a/source/blender/compositor/operations/COM_CropOperation.h +++ b/source/blender/compositor/operations/COM_CropOperation.h @@ -34,7 +34,7 @@ protected: int m_xmin; int m_ymax; int m_ymin; - + void updateArea(); public: CropBaseOperation(); diff --git a/source/blender/compositor/operations/COM_CurveBaseOperation.h b/source/blender/compositor/operations/COM_CurveBaseOperation.h index 169022de5f5..191cf7f5307 100644 --- a/source/blender/compositor/operations/COM_CurveBaseOperation.h +++ b/source/blender/compositor/operations/COM_CurveBaseOperation.h @@ -34,13 +34,13 @@ protected: public: CurveBaseOperation(); ~CurveBaseOperation(); - + /** * Initialize the execution */ void initExecution(); void deinitExecution(); - + void setCurveMapping(CurveMapping *mapping); }; #endif diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.h b/source/blender/compositor/operations/COM_DifferenceMatteOperation.h index ddf6bf6f893..3766f85444d 100644 --- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.h +++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.h @@ -39,15 +39,15 @@ public: * Default constructor */ DifferenceMatteOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void initExecution(); void deinitExecution(); - + void setSettings(NodeChroma *nodeChroma) { this->m_settings = nodeChroma; } }; #endif diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp index 2ea438d070d..17f3dfeac62 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp @@ -200,7 +200,7 @@ void DilateDistanceOperation::executePixel(float output[4], int x, int y, void * const int maxy = min(y + this->m_scope, rect->ymax); const int bufferWidth = BLI_rcti_size_x(rect); int offset; - + float value = 0.0f; for (int yi = miny; yi < maxy; yi++) { @@ -244,7 +244,7 @@ void DilateDistanceOperation::executeOpenCL(OpenCLDevice *device, cl_int distanceSquared = this->m_distance * this->m_distance; cl_int scope = this->m_scope; - + device->COM_clAttachMemoryBufferToKernelParameter(dilateKernel, 0, 2, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram); device->COM_clAttachOutputMemoryBufferToKernelParameter(dilateKernel, 1, clOutputBuffer); device->COM_clAttachMemoryBufferOffsetToKernelParameter(dilateKernel, 3, outputMemoryBuffer); @@ -255,7 +255,7 @@ void DilateDistanceOperation::executeOpenCL(OpenCLDevice *device, } // Erode Distance -ErodeDistanceOperation::ErodeDistanceOperation() : DilateDistanceOperation() +ErodeDistanceOperation::ErodeDistanceOperation() : DilateDistanceOperation() { /* pass */ } @@ -274,7 +274,7 @@ void ErodeDistanceOperation::executePixel(float output[4], int x, int y, void *d const int maxy = min(y + this->m_scope, rect->ymax); const int bufferWidth = BLI_rcti_size_x(rect); int offset; - + float value = 1.0f; for (int yi = miny; yi < maxy; yi++) { @@ -301,7 +301,7 @@ void ErodeDistanceOperation::executeOpenCL(OpenCLDevice *device, cl_int distanceSquared = this->m_distance * this->m_distance; cl_int scope = this->m_scope; - + device->COM_clAttachMemoryBufferToKernelParameter(erodeKernel, 0, 2, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram); device->COM_clAttachOutputMemoryBufferToKernelParameter(erodeKernel, 1, clOutputBuffer); device->COM_clAttachMemoryBufferOffsetToKernelParameter(erodeKernel, 3, outputMemoryBuffer); diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.h b/source/blender/compositor/operations/COM_DilateErodeOperation.h index c929fcf7fec..92c453d9d85 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.h +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.h @@ -31,11 +31,11 @@ private: * Cached reference to the inputProgram */ SocketReader *m_inputProgram; - + float m_distance; float m__switch; float m_inset; - + /** * determines the area of interest to track pixels * keep this one as small as possible for speed gain. @@ -43,27 +43,27 @@ private: int m_scope; public: DilateErodeThresholdOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); /** * Deinitialize the execution */ void deinitExecution(); - + void setDistance(float distance) { this->m_distance = distance; } void setSwitch(float sw) { this->m__switch = sw; } void setInset(float inset) { this->m_inset = inset; } - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); }; @@ -79,43 +79,43 @@ protected: int m_scope; public: DilateDistanceOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); /** * Deinitialize the execution */ void deinitExecution(); - + void setDistance(float distance) { this->m_distance = distance; } bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); - + void executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, + MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp); }; class ErodeDistanceOperation : public DilateDistanceOperation { public: ErodeDistanceOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); void executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, + MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, + MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp); }; @@ -125,38 +125,38 @@ protected: * Cached reference to the inputProgram */ SocketReader *m_inputProgram; - + int m_iterations; - + public: DilateStepOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); /** * Deinitialize the execution */ void deinitExecution(); void deinitializeTileData(rcti *rect, void *data); - + void setIterations(int iterations) { this->m_iterations = iterations; } - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); }; class ErodeStepOperation : public DilateStepOperation { public: ErodeStepOperation(); - + void *initializeTileData(rcti *rect); }; diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp index 2e0be8d8410..e3dec838589 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp @@ -102,8 +102,8 @@ void DirectionalBlurOperation::executePixel(float output[4], int x, int y, void } void DirectionalBlurOperation::executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, + MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, + MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> * /*clKernelsToCleanUp*/) { cl_kernel directionalBlurKernel = device->COM_clCreateKernel("directionalBlurKernel", NULL); @@ -113,7 +113,7 @@ void DirectionalBlurOperation::executeOpenCL(OpenCLDevice *device, cl_float2 centerpix = {{this->m_center_x_pix, this->m_center_y_pix}}; cl_float lsc = this->m_sc; cl_float lrot = this->m_rot; - + device->COM_clAttachMemoryBufferToKernelParameter(directionalBlurKernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram); device->COM_clAttachOutputMemoryBufferToKernelParameter(directionalBlurKernel, 1, clOutputBuffer); device->COM_clAttachMemoryBufferOffsetToKernelParameter(directionalBlurKernel, 2, outputMemoryBuffer); @@ -122,7 +122,7 @@ void DirectionalBlurOperation::executeOpenCL(OpenCLDevice *device, clSetKernelArg(directionalBlurKernel, 5, sizeof(cl_float), &lrot); clSetKernelArg(directionalBlurKernel, 6, sizeof(cl_float2), <xy); clSetKernelArg(directionalBlurKernel, 7, sizeof(cl_float2), ¢erpix); - + device->COM_clEnqueueRange(directionalBlurKernel, outputMemoryBuffer, 8, this); } diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.h b/source/blender/compositor/operations/COM_DirectionalBlurOperation.h index a6194a0ca73..eaabf49bf74 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.h +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.h @@ -41,25 +41,25 @@ public: * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); - + void setData(NodeDBlurData *data) { this->m_data = data; } void executeOpenCL(OpenCLDevice *device, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp); - + }; #endif diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.cpp b/source/blender/compositor/operations/COM_DisplaceOperation.cpp index 9b3377e887a..0d959996be1 100644 --- a/source/blender/compositor/operations/COM_DisplaceOperation.cpp +++ b/source/blender/compositor/operations/COM_DisplaceOperation.cpp @@ -92,7 +92,7 @@ void DisplaceOperation::pixelTransform(const float xy[2], float r_uv[2], float r float xs = col[0]; m_inputScaleYProgram->readSampled(col, xy[0], xy[1], COM_PS_NEAREST); float ys = col[0]; - /* clamp x and y displacement to triple image resolution - + /* clamp x and y displacement to triple image resolution - * to prevent hangs from huge values mistakenly plugged in eg. z buffers */ CLAMP(xs, -m_width_x4, m_width_x4); CLAMP(ys, -m_height_x4, m_height_x4); @@ -102,7 +102,7 @@ void DisplaceOperation::pixelTransform(const float xy[2], float r_uv[2], float r /* Estimate partial derivatives using 1-pixel offsets */ const float epsilon[2] = { 1.0f, 1.0f }; - + zero_v2(r_deriv[0]); zero_v2(r_deriv[1]); diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.h b/source/blender/compositor/operations/COM_DisplaceOperation.h index cec7937d9d6..680f2606692 100644 --- a/source/blender/compositor/operations/COM_DisplaceOperation.h +++ b/source/blender/compositor/operations/COM_DisplaceOperation.h @@ -49,14 +49,14 @@ public: * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void pixelTransform(const float xy[2], float r_uv[2], float r_deriv[2][2]); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp index 40b4fdec28e..0d7cd129a2f 100644 --- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp +++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp @@ -66,7 +66,7 @@ void DisplaceSimpleOperation::executePixelSampled(float output[4], float x, floa this->m_inputScaleYProgram->readSampled(inScale, x, y, sampler); float ys = inScale[0]; - /* clamp x and y displacement to triple image resolution - + /* clamp x and y displacement to triple image resolution - * to prevent hangs from huge values mistakenly plugged in eg. z buffers */ CLAMP(xs, -this->m_width_x4, this->m_width_x4); CLAMP(ys, -this->m_height_x4, this->m_height_x4); diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h index 6e52dfe86e9..b3da61722ec 100644 --- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h +++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h @@ -49,12 +49,12 @@ public: * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp index b9e6864b340..adc977d014d 100644 --- a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp @@ -62,13 +62,13 @@ void DistanceRGBMatteOperation::executePixelSampled(float output[4], float x, fl this->m_inputKeyProgram->readSampled(inKey, x, y, sampler); this->m_inputImageProgram->readSampled(inImage, x, y, sampler); - + distance = this->calculateDistance(inKey, inImage); /* store matte(alpha) value in [0] to go with * COM_SetAlphaOperation and the Value output */ - + /*make 100% transparent */ if (distance < tolerance) { output[0] = 0.0f; diff --git a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h index a815caa5ef5..22bc10b7bc3 100644 --- a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h +++ b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h @@ -41,15 +41,15 @@ public: * Default constructor */ DistanceRGBMatteOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void initExecution(); void deinitExecution(); - + void setSettings(NodeChroma *nodeChroma) { this->m_settings = nodeChroma; } }; #endif diff --git a/source/blender/compositor/operations/COM_DotproductOperation.h b/source/blender/compositor/operations/COM_DotproductOperation.h index 218409cbf5b..0fbefd716eb 100644 --- a/source/blender/compositor/operations/COM_DotproductOperation.h +++ b/source/blender/compositor/operations/COM_DotproductOperation.h @@ -32,7 +32,7 @@ private: public: DotproductOperation(); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void initExecution(); void deinitExecution(); diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp index 8d2a0f3b427..ffa2f812ed7 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp @@ -108,7 +108,7 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int osz++; // increment outer edge size lres[x] = 3; // flag pixel as outer edge } - + /* Test the TOP row of pixels in buffer, except corners */ for (x = t - 1; x >= (t - rw) + 2; x--) { // test if inner mask is filled @@ -128,7 +128,7 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int lres[x] = 3; // flag pixel as outer edge } } - + /* Test the BOTTOM row of pixels in buffer, except corners */ for (x = rw - 2; x; x--) { // test if inner mask is filled @@ -167,7 +167,7 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int lres[x] = 3; // flag pixel as outer edge } } - + /* Test the RIGHT edge of pixels in buffer, except corners */ for (x = t - rw; x > rw; x -= rw) { // test if inner mask is filled @@ -187,7 +187,7 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int lres[x] = 3; // flag pixel as outer edge } } - + rsize[0] = isz; // fill in our return sizes for edges + fill rsize[1] = osz; rsize[2] = gsz; @@ -321,7 +321,7 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in } } } - + /* Test the BOTTOM row of pixels in buffer, except corners */ for (x = rw - 2; x; x--) { // test if inner mask is filled @@ -372,7 +372,7 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in } } } - + /* Test the RIGHT edge of pixels in buffer, except corners */ for (x = t - rw; x > rw; x -= rw) { // test if inner mask is filled @@ -398,7 +398,7 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in } } } - + rsize[0] = isz; // fill in our return sizes for edges + fill rsize[1] = osz; rsize[2] = gsz; @@ -479,7 +479,7 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim osz++; // increment outer edge size lres[x] = 3; // flag pixel as outer edge } - + /* Test the TOP row of pixels in buffer, except corners */ for (x = t - 1; x >= (t - rw) + 2; x--) { // test if inner mask is filled @@ -498,7 +498,7 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim lres[x] = 3; // flag pixel as outer edge } } - + /* Test the BOTTOM row of pixels in buffer, except corners */ for (x = rw - 2; x; x--) { // test if inner mask is filled @@ -535,7 +535,7 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim lres[x] = 3; // flag pixel as outer edge } } - + /* Test the RIGHT edge of pixels in buffer, except corners */ for (x = t - rw; x > rw; x -= rw) { // test if inner mask is filled @@ -554,7 +554,7 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim lres[x] = 3; // flag pixel as outer edge } } - + rsize[0] = isz; // fill in our return sizes for edges + fill rsize[1] = osz; rsize[2] = gsz; @@ -683,7 +683,7 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li } } } - + /* Test the BOTTOM row of pixels in buffer, except corners */ for (x = rw - 2; x; x--) { // test if inner mask is filled @@ -732,7 +732,7 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li } } } - + /* Test the RIGHT edge of pixels in buffer, except corners */ for (x = t - rw; x > rw; x -= rw) { // test if inner mask is filled @@ -757,7 +757,7 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li } } } - + rsize[0] = isz; // fill in our return sizes for edges + fill rsize[1] = osz; rsize[2] = gsz; @@ -801,7 +801,7 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l lres[a] = 2; // flag pixel as gradient } } - + } else { if (!limask[pix_nextCol] || !limask[pix_prevCol] || !limask[pix_nextRow] || !limask[pix_prevRow]) { @@ -819,7 +819,7 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l pix_nextCol--; } } - + rsize[0] = in_isz; // fill in our return sizes for edges + fill rsize[1] = in_osz; rsize[2] = in_gsz; @@ -863,7 +863,7 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i lres[a] = 2; // flag pixel as gradient } } - + } else { if ((!limask[pix_nextCol] && lomask[pix_nextCol]) || @@ -885,7 +885,7 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i pix_nextCol--; } } - + rsize[0] = in_isz; // fill in our return sizes for edges + fill rsize[1] = in_osz; rsize[2] = in_gsz; @@ -897,7 +897,7 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne int a; // a = temporary pixel index buffer loop counter unsigned int ud; // ud = unscaled edge distance unsigned int dmin; // dmin = minimum edge distance - + unsigned int rsl; // long used for finding fast 1.0/sqrt unsigned int gradientFillOffset; unsigned int innerAccum = 0; // for looping inner edge pixel indexes, represents current position from offset @@ -999,7 +999,7 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne } } } - + } static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *gbuf, unsigned int isz, unsigned int osz, unsigned int gsz, unsigned int innerEdgeOffset, unsigned int outerEdgeOffset) @@ -1010,7 +1010,7 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g unsigned int rsl; // long used for finding fast 1.0/sqrt float rsf; // float used for finding fast 1.0/sqrt const float rsopf = 1.5f; // constant float used for finding fast 1.0/sqrt - + unsigned int gradientFillOffset; unsigned int t; unsigned int ud; // ud = unscaled edge distance @@ -1019,7 +1019,7 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g float idist; // idist = current inner edge distance int dx; // dx = X-delta (used for distance proportion calculation) int dy; // dy = Y-delta (used for distance proportion calculation) - + /* * The general algorithm used to color each gradient pixel is: * @@ -1057,7 +1057,7 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g * G = gradient pixel * | * I = inside edge pixel - * + * * __ * *note that IO does not need to be a straight line, in fact * many cases can arise where straight lines do not work @@ -1120,14 +1120,14 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g * proportion is already the correct intensity, and does not need to be * subtracted from 1.0 like it would have if we used real distances. */ - + /* * Here we reconstruct the pixel's memory location in the CompBuf by * Pixel Index = Pixel Column + ( Pixel Row * Row Width ) */ res[gbuf[gradientFillOffset + 1] + (gbuf[gradientFillOffset] * rw)] = (idist / (idist + odist)); //set intensity } - + } // end of copy @@ -1137,31 +1137,31 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float unsigned int *lres; // lres = unsigned int pointer to output pixel buffer (for bit operations) unsigned int *limask; // limask = unsigned int pointer to inner mask (for bit operations) unsigned int *lomask; // lomask = unsigned int pointer to outer mask (for bit operations) - + int rw; // rw = pixel row width int t; // t = total number of pixels in buffer - 1 (used for loop starts) int fsz; // size of the frame - + unsigned int isz = 0; // size (in pixels) of inside edge pixel index buffer unsigned int osz = 0; // size (in pixels) of outside edge pixel index buffer unsigned int gsz = 0; // size (in pixels) of gradient pixel index buffer unsigned int rsize[3]; // size storage to pass to helper functions unsigned int innerEdgeOffset = 0; // offset into final buffer where inner edge pixel indexes start unsigned int outerEdgeOffset = 0; // offset into final buffer where outer edge pixel indexes start - + unsigned short *gbuf; // gradient/inner/outer pixel location index buffer - + if (true) { // if both input sockets have some data coming in... - + rw = this->getWidth(); // width of a row of pixels t = (rw * this->getHeight()) - 1; // determine size of the frame memset(res, 0, sizeof(float) * (t + 1)); // clear output buffer (not all pixels will be written later) - + lres = (unsigned int *)res; // unsigned int pointer to output buffer (for bit level ops) limask = (unsigned int *)imask; // unsigned int pointer to input mask (for bit level ops) lomask = (unsigned int *)omask; // unsigned int pointer to output mask (for bit level ops) - - + + /* * The whole buffer is broken up into 4 parts. The four CORNERS, the FIRST and LAST rows, the * LEFT and RIGHT edges (excluding the corner pixels), and all OTHER rows. @@ -1213,17 +1213,17 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float // detect edges in all non-border pixels in the buffer do_allEdgeDetection(t, rw, limask, lomask, lres, res, rsize, isz, osz, gsz); } - + isz = rsize[0]; // set edge and gradient buffer sizes once again... osz = rsize[1]; // the sizes in rsize[] may have been modified gsz = rsize[2]; // by the do_*EdgeDetection() function. - + fsz = gsz + isz + osz; // calculate size of pixel index buffer needed gbuf = (unsigned short *)MEM_callocN(sizeof(unsigned short) * fsz * 2, "DEM"); // allocate edge/gradient pixel index buffer - + do_createEdgeLocationBuffer(t, rw, lres, res, gbuf, &innerEdgeOffset, &outerEdgeOffset, isz, gsz); do_fillGradientBuffer(rw, res, gbuf, isz, osz, gsz, innerEdgeOffset, outerEdgeOffset); - + MEM_freeN(gbuf); // free the gradient index buffer } } @@ -1267,7 +1267,7 @@ void *DoubleEdgeMaskOperation::initializeTileData(rcti *rect) { if (this->m_cachedInstance) return this->m_cachedInstance; - + lockMutex(); if (this->m_cachedInstance == NULL) { MemoryBuffer *innerMask = (MemoryBuffer *)this->m_inputInnerMask->initializeTileData(rect); diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h index a12c44b02a1..4574454dd02 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h @@ -43,12 +43,12 @@ public: * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ @@ -57,7 +57,7 @@ public: void *initializeTileData(rcti *rect); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); - + void setAdjecentOnly(bool adjecentOnly) { this->m_adjecentOnly = adjecentOnly; } void setKeepInside(bool keepInside) { this->m_keepInside = keepInside; } }; diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp index 482473cbe1f..fac0e028c6d 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp @@ -48,18 +48,18 @@ void EllipseMaskOperation::executePixelSampled(float output[4], float x, float y { float inputMask[4]; float inputValue[4]; - + float rx = x / this->getWidth(); float ry = y / this->getHeight(); - + const float dy = (ry - this->m_data->y) / this->m_aspectRatio; const float dx = rx - this->m_data->x; rx = this->m_data->x + (this->m_cosine * dx + this->m_sine * dy); ry = this->m_data->y + (-this->m_sine * dx + this->m_cosine * dy); - + this->m_inputMask->readSampled(inputMask, x, y, sampler); this->m_inputValue->readSampled(inputValue, x, y, sampler); - + const float halfHeight = (this->m_data->height) / 2.0f; const float halfWidth = this->m_data->width / 2.0f; float sx = rx - this->m_data->x; @@ -68,9 +68,9 @@ void EllipseMaskOperation::executePixelSampled(float output[4], float x, float y float sy = ry - this->m_data->y; sy *= sy; const float ty = halfHeight * halfHeight; - + bool inside = ((sx / tx) + (sy / ty)) < 1.0f; - + switch (this->m_maskType) { case CMP_NODE_MASKTYPE_ADD: if (inside) { diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.h b/source/blender/compositor/operations/COM_EllipseMaskOperation.h index 419b2c2d63b..9de9fb3e11c 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.h +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.h @@ -32,34 +32,34 @@ private: */ SocketReader *m_inputMask; SocketReader *m_inputValue; - + float m_sine; float m_cosine; float m_aspectRatio; int m_maskType; - + NodeEllipseMask *m_data; public: EllipseMaskOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setData(NodeEllipseMask *data) { this->m_data = data; } void setMaskType(int maskType) { this->m_maskType = maskType; } - + }; #endif diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp index a223ac31e3d..11843da3634 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp @@ -70,7 +70,7 @@ void FastGaussianBlurOperation::initExecution() BlurBaseOperation::initMutex(); } -void FastGaussianBlurOperation::deinitExecution() +void FastGaussianBlurOperation::deinitExecution() { if (this->m_iirgaus) { delete this->m_iirgaus; @@ -90,7 +90,7 @@ void *FastGaussianBlurOperation::initializeTileData(rcti *rect) int c; this->m_sx = this->m_data.sizex * this->m_size / 2.0f; this->m_sy = this->m_data.sizey * this->m_size / 2.0f; - + if ((this->m_sx == this->m_sy) && (this->m_sx > 0.0f)) { for (c = 0; c < COM_NUM_CHANNELS_COLOR; ++c) IIR_gauss(copy, this->m_sx, c, 3); @@ -121,18 +121,18 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, unsign unsigned int i; float *buffer = src->getBuffer(); const unsigned int num_channels = src->get_num_channels(); - + // <0.5 not valid, though can have a possibly useful sort of sharpening effect if (sigma < 0.5f) return; - + if ((xy < 1) || (xy > 3)) xy = 3; - + // XXX The YVV macro defined below explicitly expects sources of at least 3x3 pixels, // so just skiping blur along faulty direction if src's def is below that limit! if (src_width < 3) xy &= ~1; if (src_height < 3) xy &= ~2; if (xy < 1) return; - + // see "Recursive Gabor Filtering" by Young/VanVliet // all factors here in double.prec. Required, because for single.prec it seems to blow up if sigma > ~200 if (sigma >= 3.556f) @@ -148,7 +148,7 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, unsign // 0 & 3 unchanged cf[3] = q2 * q / sc; cf[0] = 1.0 - cf[1] - cf[2] - cf[3]; - + // Triggs/Sdika border corrections, // it seems to work, not entirely sure if it is actually totally correct, // Besides J.M.Geusebroek's anigauss.c (see http://www.science.uva.nl/~mark), @@ -166,7 +166,7 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, unsign tsM[6] = sc * (cf[3] * cf[1] + cf[2] + cf[1] * cf[1] - cf[2] * cf[2]); tsM[7] = sc * (cf[1] * cf[2] + cf[3] * cf[2] * cf[2] - cf[1] * cf[3] * cf[3] - cf[3] * cf[3] * cf[3] - cf[3] * cf[2] + cf[3]); tsM[8] = sc * (cf[3] * (cf[1] + cf[3] * cf[2])); - + #define YVV(L) \ { \ W[0] = cf[0] * X[0] + cf[1] * X[0] + cf[2] * X[0] + cf[3] * X[0]; \ @@ -189,7 +189,7 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, unsign Y[i] = cf[0] * W[i] + cf[1] * Y[i + 1] + cf[2] * Y[i + 2] + cf[3] * Y[i + 3]; \ } \ } (void)0 - + // intermediate buffers sz = max(src_width, src_height); X = (double *)MEM_callocN(sz * sizeof(double), "IIR_gauss X buf"); @@ -230,12 +230,12 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, unsign } } } - + MEM_freeN(X); MEM_freeN(W); MEM_freeN(Y); #undef YVV - + } @@ -260,7 +260,7 @@ void FastGaussianBlurValueOperation::executePixel(float output[4], int x, int y, bool FastGaussianBlurValueOperation::determineDependingAreaOfInterest(rcti * /*input*/, ReadBufferOperation *readOperation, rcti *output) { rcti newInput; - + if (this->m_iirgaus) { return false; } @@ -279,7 +279,7 @@ void FastGaussianBlurValueOperation::initExecution() initMutex(); } -void FastGaussianBlurValueOperation::deinitExecution() +void FastGaussianBlurValueOperation::deinitExecution() { if (this->m_iirgaus) { delete this->m_iirgaus; diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h index 1cfaee3f537..2b02cf322ef 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h @@ -35,7 +35,7 @@ public: FastGaussianBlurOperation(); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); void executePixel(float output[4], int x, int y, void *data); - + static void IIR_gauss(MemoryBuffer *src, float sigma, unsigned int channel, unsigned int xy); void *initializeTileData(rcti *rect); void deinitExecution(); @@ -63,7 +63,7 @@ public: FastGaussianBlurValueOperation(); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); void executePixel(float output[4], int x, int y, void *data); - + void *initializeTileData(rcti *rect); void deinitExecution(); void initExecution(); diff --git a/source/blender/compositor/operations/COM_FlipOperation.cpp b/source/blender/compositor/operations/COM_FlipOperation.cpp index 80e67a7297b..c75201903eb 100644 --- a/source/blender/compositor/operations/COM_FlipOperation.cpp +++ b/source/blender/compositor/operations/COM_FlipOperation.cpp @@ -46,14 +46,14 @@ void FlipOperation::executePixelSampled(float output[4], float x, float y, Pixel { float nx = this->m_flipX ? ((int)this->getWidth() - 1) - x : x; float ny = this->m_flipY ? ((int)this->getHeight() - 1) - y : y; - + this->m_inputOperation->readSampled(output, nx, ny, sampler); } bool FlipOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { rcti newInput; - + if (this->m_flipX) { const int w = (int)this->getWidth() - 1; newInput.xmax = (w - input->xmin) + 1; @@ -72,6 +72,6 @@ bool FlipOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOper newInput.ymin = input->ymin; newInput.ymax = input->ymax; } - + return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } diff --git a/source/blender/compositor/operations/COM_FlipOperation.h b/source/blender/compositor/operations/COM_FlipOperation.h index 3a7bf77f29b..e577259fea4 100644 --- a/source/blender/compositor/operations/COM_FlipOperation.h +++ b/source/blender/compositor/operations/COM_FlipOperation.h @@ -34,7 +34,7 @@ public: FlipOperation(); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void initExecution(); void deinitExecution(); void setFlipX(bool flipX) { this->m_flipX = flipX; } diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.h b/source/blender/compositor/operations/COM_GammaCorrectOperation.h index b3f0cedce22..aabfe09fbf2 100644 --- a/source/blender/compositor/operations/COM_GammaCorrectOperation.h +++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.h @@ -34,17 +34,17 @@ private: public: GammaCorrectOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ @@ -60,17 +60,17 @@ private: public: GammaUncorrectOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_GammaOperation.cpp b/source/blender/compositor/operations/COM_GammaOperation.cpp index 79b70b5170e..0cc0cbefd46 100644 --- a/source/blender/compositor/operations/COM_GammaOperation.cpp +++ b/source/blender/compositor/operations/COM_GammaOperation.cpp @@ -41,7 +41,7 @@ void GammaOperation::executePixelSampled(float output[4], float x, float y, Pixe { float inputValue[4]; float inputGamma[4]; - + this->m_inputProgram->readSampled(inputValue, x, y, sampler); this->m_inputGammaProgram->readSampled(inputGamma, x, y, sampler); const float gamma = inputGamma[0]; @@ -49,7 +49,7 @@ void GammaOperation::executePixelSampled(float output[4], float x, float y, Pixe output[0] = inputValue[0] > 0.0f ? powf(inputValue[0], gamma) : inputValue[0]; output[1] = inputValue[1] > 0.0f ? powf(inputValue[1], gamma) : inputValue[1]; output[2] = inputValue[2] > 0.0f ? powf(inputValue[2], gamma) : inputValue[2]; - + output[3] = inputValue[3]; } diff --git a/source/blender/compositor/operations/COM_GammaOperation.h b/source/blender/compositor/operations/COM_GammaOperation.h index 9243ece6b30..ce221965eb5 100644 --- a/source/blender/compositor/operations/COM_GammaOperation.h +++ b/source/blender/compositor/operations/COM_GammaOperation.h @@ -35,17 +35,17 @@ private: public: GammaOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp index 0fab888b9d9..c560257b859 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp @@ -56,7 +56,7 @@ void GaussianAlphaXBlurOperation::initExecution() if (this->m_sizeavailable) { float rad = max_ff(m_size * m_data.sizex, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); - + m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize); m_distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, m_filtersize, m_falloff); } @@ -68,7 +68,7 @@ void GaussianAlphaXBlurOperation::updateGauss() updateSize(); float rad = max_ff(m_size * m_data.sizex, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); - + m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize); } @@ -76,7 +76,7 @@ void GaussianAlphaXBlurOperation::updateGauss() updateSize(); float rad = max_ff(m_size * m_data.sizex, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); - + m_distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, m_filtersize, m_falloff); } } diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h index fc5b3384749..651e8d9e658 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h @@ -41,7 +41,7 @@ public: * @brief the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * @brief initialize the execution */ @@ -51,7 +51,7 @@ public: * @brief Deinitialize the execution */ void deinitExecution(); - + void *initializeTileData(rcti *rect); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp index b4e535cbf20..b90320afdeb 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp @@ -56,7 +56,7 @@ void GaussianAlphaYBlurOperation::initExecution() if (this->m_sizeavailable) { float rad = max_ff(m_size * m_data.sizey, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); - + m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize); m_distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, m_filtersize, m_falloff); } @@ -68,7 +68,7 @@ void GaussianAlphaYBlurOperation::updateGauss() updateSize(); float rad = max_ff(m_size * m_data.sizey, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); - + m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize); } @@ -76,7 +76,7 @@ void GaussianAlphaYBlurOperation::updateGauss() updateSize(); float rad = max_ff(m_size * m_data.sizey, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); - + m_distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, m_filtersize, m_falloff); } } diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h index 4f2f2ec3fe4..dc9e5607ae6 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h @@ -36,12 +36,12 @@ private: void updateGauss(); public: GaussianAlphaYBlurOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * @brief initialize the execution */ @@ -51,7 +51,7 @@ public: * Deinitialize the execution */ void deinitExecution(); - + void *initializeTileData(rcti *rect); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp index c268cff557a..483ddb53344 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp @@ -70,18 +70,18 @@ void GaussianBokehBlurOperation::updateGauss() } radxf = this->m_size * (float)this->m_data.sizex; CLAMP(radxf, 0.0f, width / 2.0f); - + /* vertical */ radyf = this->m_size * (float)this->m_data.sizey; CLAMP(radyf, 0.0f, height / 2.0f); - + this->m_radx = ceil(radxf); this->m_rady = ceil(radyf); - + int ddwidth = 2 * this->m_radx + 1; int ddheight = 2 * this->m_rady + 1; n = ddwidth * ddheight; - + /* create a full filter image */ ddgauss = (float *)MEM_mallocN(sizeof(float) * n, __func__); dgauss = ddgauss; @@ -94,7 +94,7 @@ void GaussianBokehBlurOperation::updateGauss() float fi = (float)i * facx; float dist = sqrt(fj * fj + fi * fi); *dgauss = RE_filter_value(this->m_data.filtertype, dist); - + sum += *dgauss; } } @@ -109,7 +109,7 @@ void GaussianBokehBlurOperation::updateGauss() int center = m_rady * ddwidth + m_radx; ddgauss[center] = 1.0f; } - + this->m_gausstab = ddgauss; } } @@ -175,7 +175,7 @@ bool GaussianBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, R sizeInput.xmax = 5; sizeInput.ymax = 5; NodeOperation *operation = this->getInputOperation(1); - + if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { return true; } @@ -233,8 +233,8 @@ void GaussianBlurReferenceOperation::initExecution() break; } } - - + + /* horizontal */ m_filtersizex = (float)this->m_data.sizex; int imgx = getWidth() / 2; @@ -307,7 +307,7 @@ void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y, for (i = minyr; i < maxyr; i++, srcd += COM_NUM_CHANNELS_COLOR * imgx) { src = srcd; for (j = minxr; j < maxxr; j++, src += COM_NUM_CHANNELS_COLOR) { - + val = gausstabcenty[i] * gausstabcentx[j]; sum += val; rval += val * src[0]; @@ -340,7 +340,7 @@ bool GaussianBlurReferenceOperation::determineDependingAreaOfInterest(rcti *inpu { rcti newInput; NodeOperation *operation = this->getInputOperation(1); - + if (operation->determineDependingAreaOfInterest(input, readOperation, output)) { return true; } diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h index e483ffd4f2d..9089838add5 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h @@ -40,19 +40,19 @@ public: * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Deinitialize the execution */ void deinitExecution(); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); }; class GaussianBlurReferenceOperation : public BlurBaseOperation { private: float **m_maintabs; - + void updateGauss(); int m_filtersizex; int m_filtersizey; @@ -67,12 +67,12 @@ public: * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Deinitialize the execution */ void deinitExecution(); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); }; diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp index ef438e1d364..3eafc7a1bfe 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp @@ -170,7 +170,7 @@ void GaussianXBlurOperation::deinitExecution() bool GaussianXBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { rcti newInput; - + if (!this->m_sizeavailable) { rcti sizeInput; sizeInput.xmin = 0; diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h index 46a5c4e3c03..4ad57bda742 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h @@ -55,7 +55,7 @@ public: * @brief Deinitialize the execution */ void deinitExecution(); - + void *initializeTileData(rcti *rect); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp index 6f8f96a6344..45089598af5 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp @@ -172,7 +172,7 @@ void GaussianYBlurOperation::deinitExecution() bool GaussianYBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { rcti newInput; - + if (!m_sizeavailable) { rcti sizeInput; sizeInput.xmin = 0; diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h index ca3172bd505..da1adbd0ea7 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h @@ -35,7 +35,7 @@ private: void updateGauss(); public: GaussianYBlurOperation(); - + /** * the inner loop of this program */ @@ -55,7 +55,7 @@ public: * Deinitialize the execution */ void deinitExecution(); - + void *initializeTileData(rcti *rect); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp b/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp index f54e75a6b35..62ebe601d8d 100644 --- a/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp +++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp @@ -49,7 +49,7 @@ void GlareThresholdOperation::initExecution() void GlareThresholdOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) { const float threshold = this->m_settings->threshold; - + this->m_inputProgram->readSampled(output, x, y, sampler); if (IMB_colormanagement_get_luminance(output) >= threshold) { output[0] -= threshold; diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.h b/source/blender/compositor/operations/COM_GlareThresholdOperation.h index 7760a19251b..647cf74cdcf 100644 --- a/source/blender/compositor/operations/COM_GlareThresholdOperation.h +++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.h @@ -57,7 +57,7 @@ public: void setGlareSettings(NodeGlare *settings) { this->m_settings = settings; } - + void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); }; #endif diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h index 06d785f2c51..97bfc836ae2 100644 --- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h +++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h @@ -33,17 +33,17 @@ private: SocketReader *m_inputProgram; public: HueSaturationValueCorrectOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_ImageOperation.h b/source/blender/compositor/operations/COM_ImageOperation.h index 1f9a9a45af1..8ab93c2ba64 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.h +++ b/source/blender/compositor/operations/COM_ImageOperation.h @@ -57,11 +57,11 @@ protected: * Determine the output resolution. The resolution is retrieved from the Renderer */ void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - + virtual ImBuf *getImBuf(); public: - + void initExecution(); void deinitExecution(); void setImage(Image *image) { this->m_image = image; } diff --git a/source/blender/compositor/operations/COM_InpaintOperation.cpp b/source/blender/compositor/operations/COM_InpaintOperation.cpp index 11896b1d78c..da31638ff07 100644 --- a/source/blender/compositor/operations/COM_InpaintOperation.cpp +++ b/source/blender/compositor/operations/COM_InpaintOperation.cpp @@ -87,7 +87,7 @@ float *InpaintSimpleOperation::get_pixel(int x, int y) x * COM_NUM_CHANNELS_COLOR]; } -int InpaintSimpleOperation::mdist(int x, int y) +int InpaintSimpleOperation::mdist(int x, int y) { int width = this->getWidth(); @@ -103,7 +103,7 @@ bool InpaintSimpleOperation::next_pixel(int &x, int &y, int & curr, int iters) if (curr >= this->m_area_size) { return false; } - + int r = this->m_pixelorder[curr++]; x = r % width; @@ -112,11 +112,11 @@ bool InpaintSimpleOperation::next_pixel(int &x, int &y, int & curr, int iters) if (this->mdist(x, y) > iters) { return false; } - + return true; } -void InpaintSimpleOperation::calc_manhatten_distance() +void InpaintSimpleOperation::calc_manhatten_distance() { int width = this->getWidth(); int height = this->getHeight(); @@ -131,9 +131,9 @@ void InpaintSimpleOperation::calc_manhatten_distance() /* no need to clamp here */ if (this->get_pixel(i, j)[3] < 1.0f) { r = width + height; - if (i > 0) + if (i > 0) r = min_ii(r, m[j * width + i - 1] + 1); - if (j > 0) + if (j > 0) r = min_ii(r, m[(j - 1) * width + i] + 1); } m[j * width + i] = r; @@ -143,27 +143,27 @@ void InpaintSimpleOperation::calc_manhatten_distance() for (int j = height - 1; j >= 0; j--) { for (int i = width - 1; i >= 0; i--) { int r = m[j * width + i]; - - if (i + 1 < width) + + if (i + 1 < width) r = min_ii(r, m[j * width + i + 1] + 1); - if (j + 1 < height) + if (j + 1 < height) r = min_ii(r, m[(j + 1) * width + i] + 1); - + m[j * width + i] = r; - + offsets[r]++; } } - + offsets[0] = 0; - + for (int i = 1; i < width + height + 1; i++) { offsets[i] += offsets[i - 1]; } - + this->m_area_size = offsets[width + height]; this->m_pixelorder = (int *)MEM_mallocN(sizeof(int) * this->m_area_size, __func__); - + for (int i = 0; i < width * height; i++) { if (m[i] > 0) { this->m_pixelorder[offsets[m[i] - 1]++] = i; @@ -230,7 +230,7 @@ void *InpaintSimpleOperation::initializeTileData(rcti *rect) int curr = 0; int x, y; - + while (this->next_pixel(x, y, curr, this->m_iterations)) { this->pix_step(x, y); } @@ -275,12 +275,12 @@ bool InpaintSimpleOperation::determineDependingAreaOfInterest(rcti * /*input*/, } else { rcti newInput; - + newInput.xmax = getWidth(); newInput.xmin = 0; newInput.ymax = getHeight(); newInput.ymin = 0; - + return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } } diff --git a/source/blender/compositor/operations/COM_InpaintOperation.h b/source/blender/compositor/operations/COM_InpaintOperation.h index 9ddcac93c5c..fe8e2dd2a19 100644 --- a/source/blender/compositor/operations/COM_InpaintOperation.h +++ b/source/blender/compositor/operations/COM_InpaintOperation.h @@ -30,9 +30,9 @@ protected: * Cached reference to the inputProgram */ SocketReader *m_inputImageProgram; - + int m_iterations; - + float *m_cached_buffer; bool m_cached_buffer_ready; @@ -41,25 +41,25 @@ protected: short *m_manhatten_distance; public: InpaintSimpleOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); /** * Deinitialize the execution */ void deinitExecution(); - + void setIterations(int iterations) { this->m_iterations = iterations; } - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); private: diff --git a/source/blender/compositor/operations/COM_InvertOperation.cpp b/source/blender/compositor/operations/COM_InvertOperation.cpp index 833b91ac1e3..53f181cf008 100644 --- a/source/blender/compositor/operations/COM_InvertOperation.cpp +++ b/source/blender/compositor/operations/COM_InvertOperation.cpp @@ -45,10 +45,10 @@ void InvertOperation::executePixelSampled(float output[4], float x, float y, Pix float inputColor[4]; this->m_inputValueProgram->readSampled(inputValue, x, y, sampler); this->m_inputColorProgram->readSampled(inputColor, x, y, sampler); - + const float value = inputValue[0]; const float invertedValue = 1.0f - value; - + if (this->m_color) { output[0] = (1.0f - inputColor[0]) * value + inputColor[0] * invertedValue; output[1] = (1.0f - inputColor[1]) * value + inputColor[1] * invertedValue; @@ -57,7 +57,7 @@ void InvertOperation::executePixelSampled(float output[4], float x, float y, Pix else { copy_v3_v3(output, inputColor); } - + if (this->m_alpha) output[3] = (1.0f - inputColor[3]) * value + inputColor[3] * invertedValue; else diff --git a/source/blender/compositor/operations/COM_InvertOperation.h b/source/blender/compositor/operations/COM_InvertOperation.h index 977feeb87af..4528895c282 100644 --- a/source/blender/compositor/operations/COM_InvertOperation.h +++ b/source/blender/compositor/operations/COM_InvertOperation.h @@ -32,28 +32,28 @@ private: */ SocketReader *m_inputValueProgram; SocketReader *m_inputColorProgram; - + bool m_alpha; bool m_color; public: InvertOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setColor(bool color) { this->m_color = color; } void setAlpha(bool alpha) { this->m_alpha = alpha; } }; diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp index 1401ab56fbd..e07da3bd17f 100644 --- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp @@ -54,11 +54,11 @@ void LuminanceMatteOperation::executePixelSampled(float output[4], float x, floa const float luminance = IMB_colormanagement_get_luminance(inColor); float alpha; - + /* one line thread-friend algorithm: * output[0] = min(inputValue[3], min(1.0f, max(0.0f, ((luminance - low) / (high - low)))); */ - + /* test range */ if (luminance > high) { alpha = 1.0f; diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.h b/source/blender/compositor/operations/COM_LuminanceMatteOperation.h index 93051f52228..951c054d241 100644 --- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.h +++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.h @@ -37,15 +37,15 @@ public: * Default constructor */ LuminanceMatteOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void initExecution(); void deinitExecution(); - + void setSettings(NodeChroma *nodeChroma) { this->m_settings = nodeChroma; } }; #endif diff --git a/source/blender/compositor/operations/COM_MapRangeOperation.cpp b/source/blender/compositor/operations/COM_MapRangeOperation.cpp index 6124a53d5b9..f5d3b146196 100644 --- a/source/blender/compositor/operations/COM_MapRangeOperation.cpp +++ b/source/blender/compositor/operations/COM_MapRangeOperation.cpp @@ -58,7 +58,7 @@ void MapRangeOperation::executePixelSampled(float output[4], float x, float y, P this->m_sourceMaxOperation->readSampled(inputs + 2, x, y, sampler); this->m_destMinOperation->readSampled(inputs + 3, x, y, sampler); this->m_destMaxOperation->readSampled(inputs + 4, x, y, sampler); - + value = inputs[0]; source_min = inputs[1]; source_max = inputs[2]; diff --git a/source/blender/compositor/operations/COM_MapRangeOperation.h b/source/blender/compositor/operations/COM_MapRangeOperation.h index 48ecad9d226..405faf3fb2c 100644 --- a/source/blender/compositor/operations/COM_MapRangeOperation.h +++ b/source/blender/compositor/operations/COM_MapRangeOperation.h @@ -46,26 +46,26 @@ public: * Default constructor */ MapRangeOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + /** * Clamp the output */ void setUseClamp(bool value) { this->m_useClamp = value; } - + }; #endif diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cpp b/source/blender/compositor/operations/COM_MapUVOperation.cpp index 0112f4bbf21..54d63b6a12c 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.cpp +++ b/source/blender/compositor/operations/COM_MapUVOperation.cpp @@ -54,7 +54,7 @@ void MapUVOperation::executePixelSampled(float output[4], float x, float y, Pixe /* EWA filtering */ this->m_inputColorProgram->readFiltered(output, uv[0], uv[1], deriv[0], deriv[1]); - + /* UV to alpha threshold */ const float threshold = this->m_alpha * 0.05f; /* XXX alpha threshold is used to fade out pixels on boundaries with invalid derivatives. diff --git a/source/blender/compositor/operations/COM_MapUVOperation.h b/source/blender/compositor/operations/COM_MapUVOperation.h index 796ee952607..1bb26bf14f0 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.h +++ b/source/blender/compositor/operations/COM_MapUVOperation.h @@ -33,7 +33,7 @@ private: SocketReader *m_inputColorProgram; float m_alpha; - + public: MapUVOperation(); @@ -53,7 +53,7 @@ public: * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_MapValueOperation.cpp b/source/blender/compositor/operations/COM_MapValueOperation.cpp index 59d4d836b1b..afe3961dbf1 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.cpp +++ b/source/blender/compositor/operations/COM_MapValueOperation.cpp @@ -46,7 +46,7 @@ void MapValueOperation::executePixelSampled(float output[4], float x, float y, P if (texmap->flag & TEXMAP_CLIP_MAX) if (value > texmap->max[0]) value = texmap->max[0]; - + output[0] = value; } diff --git a/source/blender/compositor/operations/COM_MapValueOperation.h b/source/blender/compositor/operations/COM_MapValueOperation.h index ba19e76f4db..97528efca19 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.h +++ b/source/blender/compositor/operations/COM_MapValueOperation.h @@ -41,26 +41,26 @@ public: * Default constructor */ MapValueOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + /** * @brief set the TexMapping settings */ void setSettings(TexMapping *settings) { this->m_settings = settings; } - + }; #endif diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp index bb6e1f9da8d..0a515da1877 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp @@ -76,10 +76,10 @@ void MathAddOperation::executePixelSampled(float output[4], float x, float y, Pi { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = inputValue1[0] + inputValue2[0]; clampIfNeeded(output); @@ -89,10 +89,10 @@ void MathSubtractOperation::executePixelSampled(float output[4], float x, float { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = inputValue1[0] - inputValue2[0]; clampIfNeeded(output); @@ -102,10 +102,10 @@ void MathMultiplyOperation::executePixelSampled(float output[4], float x, float { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = inputValue1[0] * inputValue2[0]; clampIfNeeded(output); @@ -115,10 +115,10 @@ void MathDivideOperation::executePixelSampled(float output[4], float x, float y, { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + if (inputValue2[0] == 0) /* We don't want to divide by zero. */ output[0] = 0.0; else @@ -131,10 +131,10 @@ void MathSineOperation::executePixelSampled(float output[4], float x, float y, P { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = sin(inputValue1[0]); clampIfNeeded(output); @@ -144,10 +144,10 @@ void MathCosineOperation::executePixelSampled(float output[4], float x, float y, { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = cos(inputValue1[0]); clampIfNeeded(output); @@ -157,10 +157,10 @@ void MathTangentOperation::executePixelSampled(float output[4], float x, float y { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = tan(inputValue1[0]); clampIfNeeded(output); @@ -170,10 +170,10 @@ void MathArcSineOperation::executePixelSampled(float output[4], float x, float y { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + if (inputValue1[0] <= 1 && inputValue1[0] >= -1) output[0] = asin(inputValue1[0]); else @@ -186,10 +186,10 @@ void MathArcCosineOperation::executePixelSampled(float output[4], float x, float { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + if (inputValue1[0] <= 1 && inputValue1[0] >= -1) output[0] = acos(inputValue1[0]); else @@ -202,10 +202,10 @@ void MathArcTangentOperation::executePixelSampled(float output[4], float x, floa { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = atan(inputValue1[0]); clampIfNeeded(output); @@ -215,10 +215,10 @@ void MathPowerOperation::executePixelSampled(float output[4], float x, float y, { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + if (inputValue1[0] >= 0) { output[0] = pow(inputValue1[0], inputValue2[0]); } @@ -240,10 +240,10 @@ void MathLogarithmOperation::executePixelSampled(float output[4], float x, float { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + if (inputValue1[0] > 0 && inputValue2[0] > 0) output[0] = log(inputValue1[0]) / log(inputValue2[0]); else @@ -256,10 +256,10 @@ void MathMinimumOperation::executePixelSampled(float output[4], float x, float y { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = min(inputValue1[0], inputValue2[0]); clampIfNeeded(output); @@ -269,10 +269,10 @@ void MathMaximumOperation::executePixelSampled(float output[4], float x, float y { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = max(inputValue1[0], inputValue2[0]); clampIfNeeded(output); @@ -282,10 +282,10 @@ void MathRoundOperation::executePixelSampled(float output[4], float x, float y, { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = round(inputValue1[0]); clampIfNeeded(output); @@ -295,10 +295,10 @@ void MathLessThanOperation::executePixelSampled(float output[4], float x, float { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = inputValue1[0] < inputValue2[0] ? 1.0f : 0.0f; clampIfNeeded(output); @@ -308,10 +308,10 @@ void MathGreaterThanOperation::executePixelSampled(float output[4], float x, flo { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = inputValue1[0] > inputValue2[0] ? 1.0f : 0.0f; clampIfNeeded(output); @@ -321,10 +321,10 @@ void MathModuloOperation::executePixelSampled(float output[4], float x, float y, { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + if (inputValue2[0] == 0) output[0] = 0.0; else @@ -355,4 +355,4 @@ void MathArcTan2Operation::executePixelSampled(float output[4], float x, float y output[0] = atan2(inputValue1[0], inputValue2[0]); clampIfNeeded(output); -}
\ No newline at end of file +} diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.h b/source/blender/compositor/operations/COM_MathBaseOperation.h index 862783fff5d..c636117451f 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.h +++ b/source/blender/compositor/operations/COM_MathBaseOperation.h @@ -51,12 +51,12 @@ public: * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) = 0; - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_MixOperation.cpp b/source/blender/compositor/operations/COM_MixOperation.cpp index 314e16895f3..0acbe63e20e 100644 --- a/source/blender/compositor/operations/COM_MixOperation.cpp +++ b/source/blender/compositor/operations/COM_MixOperation.cpp @@ -53,11 +53,11 @@ void MixBaseOperation::executePixelSampled(float output[4], float x, float y, Pi float inputColor1[4]; float inputColor2[4]; float inputValue[4]; - + this->m_inputValueOperation->readSampled(inputValue, x, y, sampler); this->m_inputColor1Operation->readSampled(inputColor1, x, y, sampler); this->m_inputColor2Operation->readSampled(inputColor2, x, y, sampler); - + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; @@ -147,7 +147,7 @@ void MixBlendOperation::executePixelSampled(float output[4], float x, float y, P this->m_inputColor1Operation->readSampled(inputColor1, x, y, sampler); this->m_inputColor2Operation->readSampled(inputColor2, x, y, sampler); value = inputValue[0]; - + if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixOperation.h b/source/blender/compositor/operations/COM_MixOperation.h index f375a47f087..fa13a486657 100644 --- a/source/blender/compositor/operations/COM_MixOperation.h +++ b/source/blender/compositor/operations/COM_MixOperation.h @@ -50,23 +50,23 @@ protected: CLAMP(color[3], 0.0f, 1.0f); } } - + public: /** * Default constructor */ MixBaseOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ @@ -74,7 +74,7 @@ public: void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - + void setUseValueAlphaMultiply(const bool value) { this->m_valueAlphaMultiply = value; } inline bool useValueAlphaMultiply() { return this->m_valueAlphaMultiply; } void setUseClamp(bool value) { this->m_useClamp = value; } diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.h b/source/blender/compositor/operations/COM_MovieClipOperation.h index 93452752234..28e6c0d0c3a 100644 --- a/source/blender/compositor/operations/COM_MovieClipOperation.h +++ b/source/blender/compositor/operations/COM_MovieClipOperation.h @@ -41,7 +41,7 @@ protected: int m_movieClipwidth; int m_framenumber; bool m_cacheFrame; - + /** * Determine the output resolution. The resolution is retrieved from the Renderer */ @@ -49,7 +49,7 @@ protected: public: MovieClipBaseOperation(); - + void initExecution(); void deinitExecution(); void setMovieClip(MovieClip *image) { this->m_movieClip = image; } diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.cpp b/source/blender/compositor/operations/COM_NormalizeOperation.cpp index 6106a805f87..3527c874bcf 100644 --- a/source/blender/compositor/operations/COM_NormalizeOperation.cpp +++ b/source/blender/compositor/operations/COM_NormalizeOperation.cpp @@ -64,7 +64,7 @@ bool NormalizeOperation::determineDependingAreaOfInterest(rcti * /*input*/, Read { rcti imageInput; if (this->m_cachedInstance) return false; - + NodeOperation *operation = getInputOperation(0); imageInput.xmax = operation->getWidth(); imageInput.xmin = 0; diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp index 39877e35605..db2598ad6dc 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp +++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp @@ -135,11 +135,11 @@ static void write_buffer_rect(rcti *rect, const bNodeTree *tree, for (y = y1; y < y2 && (!breaked); y++) { for (x = x1; x < x2 && (!breaked); x++) { reader->readSampled(color, x, y, COM_PS_NEAREST); - + for (i = 0; i < size; ++i) buffer[offset + i] = color[i]; offset += size; - + if (tree->test_break && tree->test_break(tree->tbh)) breaked = true; } @@ -154,13 +154,13 @@ OutputSingleLayerOperation::OutputSingleLayerOperation( { this->m_rd = rd; this->m_tree = tree; - + this->addInputSocket(datatype); - + this->m_outputBuffer = NULL; this->m_datatype = datatype; this->m_imageInput = NULL; - + this->m_format = format; BLI_strncpy(this->m_path, path, sizeof(this->m_path)); @@ -183,17 +183,17 @@ void OutputSingleLayerOperation::executeRegion(rcti *rect, unsigned int /*tileNu void OutputSingleLayerOperation::deinitExecution() { if (this->getWidth() * this->getHeight() != 0) { - + int size = get_datatype_size(this->m_datatype); ImBuf *ibuf = IMB_allocImBuf(this->getWidth(), this->getHeight(), this->m_format->planes, 0); char filename[FILE_MAX]; const char *suffix; - + ibuf->channels = size; ibuf->rect_float = this->m_outputBuffer; - ibuf->mall |= IB_rectfloat; + ibuf->mall |= IB_rectfloat; ibuf->dither = this->m_rd->dither_intensity; - + IMB_colormanagement_imbuf_for_write(ibuf, true, false, m_viewSettings, m_displaySettings, this->m_format); @@ -207,7 +207,7 @@ void OutputSingleLayerOperation::deinitExecution() printf("Cannot save Node File Output to %s\n", filename); else printf("Saved: %s\n", filename); - + IMB_freeImBuf(ibuf); } this->m_outputBuffer = NULL; @@ -221,7 +221,7 @@ OutputOpenExrLayer::OutputOpenExrLayer(const char *name_, DataType datatype_, bo BLI_strncpy(this->name, name_, sizeof(this->name)); this->datatype = datatype_; this->use_layer = use_layer_; - + /* these are created in initExecution */ this->outputBuffer = 0; this->imageInput = 0; @@ -233,7 +233,7 @@ OutputOpenExrMultiLayerOperation::OutputOpenExrMultiLayerOperation( { this->m_rd = rd; this->m_tree = tree; - + BLI_strncpy(this->m_path, path, sizeof(this->m_path)); this->m_exr_codec = exr_codec; this->m_exr_half_float = exr_half_float; @@ -285,11 +285,11 @@ void OutputOpenExrMultiLayerOperation::deinitExecution() OutputOpenExrLayer &layer = this->m_layers[i]; if (!layer.imageInput) continue; /* skip unconnected sockets */ - + add_exr_channels(exrhandle, this->m_layers[i].name, this->m_layers[i].datatype, "", width, this->m_exr_half_float, this->m_layers[i].outputBuffer); } - + /* when the filename has no permissions, this can fail */ if (IMB_exr_begin_write(exrhandle, filename, width, height, this->m_exr_codec, NULL)) { IMB_exr_write_channels(exrhandle); @@ -299,14 +299,14 @@ void OutputOpenExrMultiLayerOperation::deinitExecution() /* XXX nice way to do report? */ printf("Error Writing Render Result, see console\n"); } - + IMB_exr_close(exrhandle); for (unsigned int i = 0; i < this->m_layers.size(); ++i) { if (this->m_layers[i].outputBuffer) { MEM_freeN(this->m_layers[i].outputBuffer); this->m_layers[i].outputBuffer = NULL; } - + this->m_layers[i].imageInput = NULL; } } diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.h b/source/blender/compositor/operations/COM_OutputFileOperation.h index 60862de48cb..32c9b5ab5b8 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.h +++ b/source/blender/compositor/operations/COM_OutputFileOperation.h @@ -37,10 +37,10 @@ class OutputSingleLayerOperation : public NodeOperation { protected: const RenderData *m_rd; const bNodeTree *m_tree; - + ImageFormatData *m_format; char m_path[FILE_MAX]; - + float *m_outputBuffer; DataType m_datatype; SocketReader *m_imageInput; @@ -52,7 +52,7 @@ protected: public: OutputSingleLayerOperation(const RenderData *rd, const bNodeTree *tree, DataType datatype, ImageFormatData *format, const char *path, const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings, const char *viewName); - + void executeRegion(rcti *rect, unsigned int tileNumber); bool isOutputOperation(bool /*rendering*/) const { return true; } void initExecution(); @@ -65,11 +65,11 @@ public: /* extra info for OpenEXR layers */ struct OutputOpenExrLayer { OutputOpenExrLayer(const char *name, DataType datatype, bool use_layer); - + char name[EXR_TOT_MAXNAME - 2]; DataType datatype; bool use_layer; - + /* internals */ float *outputBuffer; SocketReader *imageInput; @@ -79,22 +79,22 @@ struct OutputOpenExrLayer { class OutputOpenExrMultiLayerOperation : public NodeOperation { protected: typedef std::vector<OutputOpenExrLayer> LayerList; - + const RenderData *m_rd; const bNodeTree *m_tree; - + char m_path[FILE_MAX]; char m_exr_codec; bool m_exr_half_float; LayerList m_layers; const char *m_viewName; - + public: OutputOpenExrMultiLayerOperation(const RenderData *rd, const bNodeTree *tree, const char *path, char exr_codec, bool exr_half_float, const char *viewName); - + void add_layer(const char *name, DataType datatype, bool use_layer); - + void executeRegion(rcti *rect, unsigned int tileNumber); bool isOutputOperation(bool /*rendering*/) const { return true; } void initExecution(); diff --git a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp index d6affa6eee9..4e4e803c757 100644 --- a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp +++ b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp @@ -49,7 +49,7 @@ static bool check_corners(float corners[4][2]) cur_cross = cross_v2v2(v1, v2); if (fabsf(cur_cross) <= FLT_EPSILON) return false; - + if (cross == 0.0f) cross = cur_cross; else if (cross * cur_cross < 0.0f) @@ -67,7 +67,7 @@ static void readCornersFromSockets(rcti *rect, SocketReader *readers[4], float c corners[i][0] = result[0]; corners[i][1] = result[1]; } - + /* convexity check: * concave corners need to be prevented, otherwise * BKE_tracking_homography_between_two_quads will freeze @@ -95,7 +95,7 @@ PlaneCornerPinMaskOperation::PlaneCornerPinMaskOperation() : addInputSocket(COM_DT_VECTOR); addInputSocket(COM_DT_VECTOR); addInputSocket(COM_DT_VECTOR); - + /* XXX this is stupid: we need to make this "complex", * so we can use the initializeTileData function * to read corners from input sockets ... @@ -106,21 +106,21 @@ PlaneCornerPinMaskOperation::PlaneCornerPinMaskOperation() : void PlaneCornerPinMaskOperation::initExecution() { PlaneDistortMaskOperation::initExecution(); - + initMutex(); } void PlaneCornerPinMaskOperation::deinitExecution() { PlaneDistortMaskOperation::deinitExecution(); - + deinitMutex(); } void *PlaneCornerPinMaskOperation::initializeTileData(rcti *rect) { void *data = PlaneDistortMaskOperation::initializeTileData(rect); - + /* get corner values once, by reading inputs at (0,0) * XXX this assumes invariable values (no image inputs), * we don't have a nice generic system for that yet @@ -134,11 +134,11 @@ void *PlaneCornerPinMaskOperation::initializeTileData(rcti *rect) float corners[4][2]; readCornersFromSockets(rect, readers, corners); calculateCorners(corners, true, 0); - + m_corners_ready = true; } unlockMutex(); - + return data; } @@ -164,21 +164,21 @@ PlaneCornerPinWarpImageOperation::PlaneCornerPinWarpImageOperation() : void PlaneCornerPinWarpImageOperation::initExecution() { PlaneDistortWarpImageOperation::initExecution(); - + initMutex(); } void PlaneCornerPinWarpImageOperation::deinitExecution() { PlaneDistortWarpImageOperation::deinitExecution(); - + deinitMutex(); } void *PlaneCornerPinWarpImageOperation::initializeTileData(rcti *rect) { void *data = PlaneDistortWarpImageOperation::initializeTileData(rect); - + /* get corner values once, by reading inputs at (0,0) * XXX this assumes invariable values (no image inputs), * we don't have a nice generic system for that yet @@ -193,11 +193,11 @@ void *PlaneCornerPinWarpImageOperation::initializeTileData(rcti *rect) float corners[4][2]; readCornersFromSockets(rect, readers, corners); calculateCorners(corners, true, 0); - + m_corners_ready = true; } unlockMutex(); - + return data; } @@ -206,7 +206,7 @@ bool PlaneCornerPinWarpImageOperation::determineDependingAreaOfInterest(rcti *in for (int i = 0; i < 4; ++i) if (getInputOperation(i + 1)->determineDependingAreaOfInterest(input, readOperation, output)) return true; - + /* XXX this is bad, but unavoidable with the current design: * we don't know the actual corners and matrix at this point, * so all we can do is get the full input image diff --git a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h index ed70d9c80a3..a9bd18299eb 100644 --- a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h +++ b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h @@ -37,15 +37,15 @@ class PlaneCornerPinMaskOperation : public PlaneDistortMaskOperation { private: bool m_corners_ready; - + public: PlaneCornerPinMaskOperation(); - + void initExecution(); void deinitExecution(); - + void *initializeTileData(rcti *rect); - + void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); }; @@ -53,15 +53,15 @@ public: class PlaneCornerPinWarpImageOperation : public PlaneDistortWarpImageOperation { private: bool m_corners_ready; - + public: PlaneCornerPinWarpImageOperation(); - + void initExecution(); void deinitExecution(); - + void *initializeTileData(rcti *rect); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); }; diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cpp b/source/blender/compositor/operations/COM_PreviewOperation.cpp index d4075844f0e..90e1bba3cd9 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.cpp +++ b/source/blender/compositor/operations/COM_PreviewOperation.cpp @@ -61,7 +61,7 @@ void PreviewOperation::verifyPreview(bNodeInstanceHash *previews, bNodeInstanceK void PreviewOperation::initExecution() { this->m_input = getInputSocketReader(0); - + if (this->getWidth() == (unsigned int)this->m_preview->xsize && this->getHeight() == (unsigned int)this->m_preview->ysize) { @@ -98,7 +98,7 @@ void PreviewOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) for (int x = rect->xmin; x < rect->xmax; x++) { float rx = floor(x / this->m_divider); float ry = floor(y / this->m_divider); - + color[0] = 0.0f; color[1] = 0.0f; color[2] = 0.0f; @@ -137,7 +137,7 @@ void PreviewOperation::determineResolution(unsigned int resolution[2], unsigned } width = width * this->m_divider; height = height * this->m_divider; - + resolution[0] = width; resolution[1] = height; } diff --git a/source/blender/compositor/operations/COM_PreviewOperation.h b/source/blender/compositor/operations/COM_PreviewOperation.h index ca1d6f54cdc..907a6c8997f 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.h +++ b/source/blender/compositor/operations/COM_PreviewOperation.h @@ -44,16 +44,16 @@ protected: public: PreviewOperation(const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings); void verifyPreview(bNodeInstanceHash *previews, bNodeInstanceKey key); - + bool isOutputOperation(bool /*rendering*/) const { return !G.background; } void initExecution(); void deinitExecution(); const CompositorPriority getRenderPriority() const; - + void executeRegion(rcti *rect, unsigned int tileNumber); void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); bool isPreviewOperation() const { return true; } - + }; #endif diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp index 020bdde8c93..e135abe5f20 100644 --- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp @@ -96,7 +96,7 @@ bool ProjectorLensDistortionOperation::determineDependingAreaOfInterest(rcti *in return false; } -void ProjectorLensDistortionOperation::updateDispersion() +void ProjectorLensDistortionOperation::updateDispersion() { if (this->m_dispersionAvailable) return; this->lockMutex(); diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h index 9eb90b6006b..12efff14839 100644 --- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h +++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h @@ -31,30 +31,30 @@ private: * Cached reference to the inputProgram */ SocketReader *m_inputProgram; - + float m_dispersion; bool m_dispersionAvailable; - + float m_kr, m_kr2; public: ProjectorLensDistortionOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); /** * Deinitialize the execution */ void deinitExecution(); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); void updateDispersion(); diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp index f256d3a6aa1..6e7a32ba5a9 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp @@ -120,8 +120,8 @@ void ReadBufferOperation::readResolutionFromWriteBuffer() } } -void ReadBufferOperation::updateMemoryBuffer() +void ReadBufferOperation::updateMemoryBuffer() { this->m_buffer = this->getMemoryProxy()->getBuffer(); - + } diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.h b/source/blender/compositor/operations/COM_ReadBufferOperation.h index 898b568bb91..c42de32b9e9 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.h +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.h @@ -38,7 +38,7 @@ public: void setMemoryProxy(MemoryProxy *memoryProxy) { this->m_memoryProxy = memoryProxy; } MemoryProxy *getMemoryProxy() { return this->m_memoryProxy; } void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - + void *initializeTileData(rcti *rect); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); void executePixelExtend(float output[4], float x, float y, PixelSampler sampler, diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cpp b/source/blender/compositor/operations/COM_RenderLayersProg.cpp index ca135a650bd..e1a77158175 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersProg.cpp @@ -50,10 +50,10 @@ void RenderLayersProg::initExecution() Scene *scene = this->getScene(); Render *re = (scene) ? RE_GetSceneRender(scene) : NULL; RenderResult *rr = NULL; - + if (re) rr = RE_AcquireResultRead(re); - + if (rr) { ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&scene->view_layers, getLayerId()); if (view_layer) { @@ -181,13 +181,13 @@ void RenderLayersProg::determineResolution(unsigned int resolution[2], unsigned Scene *sce = this->getScene(); Render *re = (sce) ? RE_GetSceneRender(sce) : NULL; RenderResult *rr = NULL; - + resolution[0] = 0; resolution[1] = 0; - + if (re) rr = RE_AcquireResultRead(re); - + if (rr) { ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&sce->view_layers, getLayerId()); if (view_layer) { @@ -198,7 +198,7 @@ void RenderLayersProg::determineResolution(unsigned int resolution[2], unsigned } } } - + if (re) RE_ReleaseResult(re); diff --git a/source/blender/compositor/operations/COM_RotateOperation.cpp b/source/blender/compositor/operations/COM_RotateOperation.cpp index 2d0d5aaf8d3..4186a0e1fc8 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.cpp +++ b/source/blender/compositor/operations/COM_RotateOperation.cpp @@ -62,7 +62,7 @@ inline void RotateOperation::ensureDegree() } this->m_cosine = cos(rad); this->m_sine = sin(rad); - + this->m_isDegreeSet = true; } } @@ -82,12 +82,12 @@ bool RotateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOp { ensureDegree(); rcti newInput; - + const float dxmin = input->xmin - this->m_centerX; const float dymin = input->ymin - this->m_centerY; const float dxmax = input->xmax - this->m_centerX; const float dymax = input->ymax - this->m_centerY; - + const float x1 = this->m_centerX + (this->m_cosine * dxmin + this->m_sine * dymin); const float x2 = this->m_centerX + (this->m_cosine * dxmax + this->m_sine * dymin); const float x3 = this->m_centerX + (this->m_cosine * dxmin + this->m_sine * dymax); @@ -100,11 +100,11 @@ bool RotateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOp const float maxx = max(x1, max(x2, max(x3, x4))); const float miny = min(y1, min(y2, min(y3, y4))); const float maxy = max(y1, max(y2, max(y3, y4))); - + newInput.xmax = ceil(maxx) + 1; newInput.xmin = floor(minx) - 1; newInput.ymax = ceil(maxy) + 1; newInput.ymin = floor(miny) - 1; - + return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } diff --git a/source/blender/compositor/operations/COM_RotateOperation.h b/source/blender/compositor/operations/COM_RotateOperation.h index 7b99b6faa97..d332f7208b5 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.h +++ b/source/blender/compositor/operations/COM_RotateOperation.h @@ -42,7 +42,7 @@ public: void initExecution(); void deinitExecution(); void setDoDegree2RadConversion(bool abool) { this->m_doDegree2RadConversion = abool; } - + void ensureDegree(); }; diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp index 1ebb0f93939..f7b8d285cc2 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp @@ -64,10 +64,10 @@ void ScreenLensDistortionOperation::initExecution() uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX); rng_seed ^= (uint)GET_INT_FROM_POINTER(m_inputProgram); this->m_rng = BLI_rng_new(rng_seed); - + this->m_cx = 0.5f * (float)getWidth(); this->m_cy = 0.5f * (float)getHeight(); - + /* if both are constant, init variables once */ if (m_distortion_const && m_dispersion_const) { updateVariables(m_distortion, m_dispersion); @@ -85,7 +85,7 @@ void *ScreenLensDistortionOperation::initializeTileData(rcti * /*rect*/) */ if (!m_variables_ready) { this->lockMutex(); - + if (!m_distortion_const) { float result[4]; getInputSocketReader(1)->readSampled(result, 0, 0, COM_PS_NEAREST); @@ -96,13 +96,13 @@ void *ScreenLensDistortionOperation::initializeTileData(rcti * /*rect*/) getInputSocketReader(2)->readSampled(result, 0, 0, COM_PS_NEAREST); m_dispersion = result[0]; } - + updateVariables(m_distortion, m_dispersion); m_variables_ready = true; - + this->unlockMutex(); } - + return buffer; } @@ -128,7 +128,7 @@ bool ScreenLensDistortionOperation::get_delta(float r_sq, float k4, const float } else return false; - + } void ScreenLensDistortionOperation::accumulate(MemoryBuffer *buffer, @@ -138,7 +138,7 @@ void ScreenLensDistortionOperation::accumulate(MemoryBuffer *buffer, float sum[4], int count[3]) const { float color[4]; - + float dsf = len_v2v2(delta[a], delta[b]) + 1.0f; int ds = m_jitter ? (dsf < 4.0f ? 2 : (int)sqrtf(dsf)) : (int)dsf; float sd = 1.0f / (float)ds; @@ -149,11 +149,11 @@ void ScreenLensDistortionOperation::accumulate(MemoryBuffer *buffer, for (float z = 0; z < ds; ++z) { float tz = (z + (m_jitter ? BLI_rng_get_float(m_rng) : 0.5f)) * sd; float t = 1.0f - (k4 + tz * dk4) * r_sq; - + float xy[2]; distort_uv(uv, t, xy); buffer->readBilinear(color, xy[0], xy[1]); - + sum[a] += (1.0f - tz) * color[a]; sum[b] += (tz ) * color[b]; count[a]++; @@ -180,11 +180,11 @@ void ScreenLensDistortionOperation::executePixel(float output[4], int x, int y, if (valid_r && valid_g && valid_b) { accumulate(buffer, 0, 1, uv_dot, uv, delta, sum, count); accumulate(buffer, 1, 2, uv_dot, uv, delta, sum, count); - + if (count[0]) output[0] = 2.0f * sum[0] / (float)count[0]; if (count[1]) output[1] = 2.0f * sum[1] / (float)count[1]; if (count[2]) output[2] = 2.0f * sum[2] / (float)count[2]; - + /* set alpha */ output[3] = 1.0f; } @@ -206,7 +206,7 @@ void ScreenLensDistortionOperation::determineUV(float result[6], float x, float float uv[2]; get_uv(xy, uv); float uv_dot = len_squared_v2(uv); - + copy_v2_v2(result + 0, xy); copy_v2_v2(result + 2, xy); copy_v2_v2(result + 4, xy); @@ -222,7 +222,7 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti * /*in newInputValue.ymin = 0; newInputValue.xmax = 2; newInputValue.ymax = 2; - + NodeOperation *operation = getInputOperation(1); if (operation->determineDependingAreaOfInterest(&newInputValue, readOperation, output) ) { return true; @@ -232,7 +232,7 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti * /*in if (operation->determineDependingAreaOfInterest(&newInputValue, readOperation, output) ) { return true; } - + /* XXX the original method of estimating the area-of-interest does not work * it assumes a linear increase/decrease of mapped coordinates, which does not * yield correct results for the area and leaves uninitialized buffer areas. @@ -240,7 +240,7 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti * /*in */ #if 1 rcti imageInput; - + operation = getInputOperation(0); imageInput.xmax = operation->getWidth(); imageInput.xmin = 0; @@ -254,9 +254,9 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti * /*in #else rcti newInput; const float margin = 2; - + BLI_rcti_init_minmax(&newInput); - + if (m_dispersion_const && m_distortion_const) { /* update from fixed distortion/dispersion */ #define UPDATE_INPUT(x, y) \ @@ -290,7 +290,7 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti * /*in newInput.xmax = max_ffff(newInput.xmax, coords[0], coords[2], coords[4]); \ newInput.ymax = max_ffff(newInput.ymax, coords[1], coords[3], coords[5]); \ } (void)0 - + if (m_distortion_const) { /* update from fixed distortion */ UPDATE_INPUT(input->xmin, input->xmax, m_distortion); diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h index 71df73ebd8c..e1e276d0dc4 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h @@ -32,10 +32,10 @@ private: */ SocketReader *m_inputProgram; struct RNG *m_rng; - + bool m_fit; bool m_jitter; - + float m_dispersion; float m_distortion; bool m_dispersion_const; @@ -48,31 +48,31 @@ private: float m_sc, m_cx, m_cy; public: ScreenLensDistortionOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); /** * Deinitialize the execution */ void deinitExecution(); - + void setFit(bool fit) { m_fit = fit; } void setJitter(bool jitter) { m_jitter = jitter; } - + /** Set constant distortion value */ void setDistortion(float distortion); /** Set constant dispersion value */ void setDispersion(float dispersion); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); private: diff --git a/source/blender/compositor/operations/COM_SetAlphaOperation.cpp b/source/blender/compositor/operations/COM_SetAlphaOperation.cpp index 91933484027..e6c04a4b68c 100644 --- a/source/blender/compositor/operations/COM_SetAlphaOperation.cpp +++ b/source/blender/compositor/operations/COM_SetAlphaOperation.cpp @@ -27,7 +27,7 @@ SetAlphaOperation::SetAlphaOperation() : NodeOperation() this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); - + this->m_inputColor = NULL; this->m_inputAlpha = NULL; } @@ -41,10 +41,10 @@ void SetAlphaOperation::initExecution() void SetAlphaOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) { float alphaInput[4]; - + this->m_inputColor->readSampled(output, x, y, sampler); this->m_inputAlpha->readSampled(alphaInput, x, y, sampler); - + output[3] = alphaInput[0]; } diff --git a/source/blender/compositor/operations/COM_SetAlphaOperation.h b/source/blender/compositor/operations/COM_SetAlphaOperation.h index 12e3debf3d3..c4e12a367a5 100644 --- a/source/blender/compositor/operations/COM_SetAlphaOperation.h +++ b/source/blender/compositor/operations/COM_SetAlphaOperation.h @@ -39,12 +39,12 @@ public: * Default constructor */ SetAlphaOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void initExecution(); void deinitExecution(); }; diff --git a/source/blender/compositor/operations/COM_SetSamplerOperation.h b/source/blender/compositor/operations/COM_SetSamplerOperation.h index 903bcef95f0..6d97b20769d 100644 --- a/source/blender/compositor/operations/COM_SetSamplerOperation.h +++ b/source/blender/compositor/operations/COM_SetSamplerOperation.h @@ -38,9 +38,9 @@ public: * Default constructor */ SetSamplerOperation(); - + void setSampler(PixelSampler sampler) { this->m_sampler = sampler; } - + /** * the inner loop of this program */ diff --git a/source/blender/compositor/operations/COM_SetValueOperation.h b/source/blender/compositor/operations/COM_SetValueOperation.h index 10de8825d38..a0867a3bc9c 100644 --- a/source/blender/compositor/operations/COM_SetValueOperation.h +++ b/source/blender/compositor/operations/COM_SetValueOperation.h @@ -38,17 +38,17 @@ public: * Default constructor */ SetValueOperation(); - + const float getValue() { return this->m_value; } void setValue(float value) { this->m_value = value; } - - + + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - + bool isSetOperation() const { return true; } }; #endif diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.h b/source/blender/compositor/operations/COM_SetVectorOperation.h index b01f2f7a6b5..79b55bb7d91 100644 --- a/source/blender/compositor/operations/COM_SetVectorOperation.h +++ b/source/blender/compositor/operations/COM_SetVectorOperation.h @@ -41,7 +41,7 @@ public: * Default constructor */ SetVectorOperation(); - + const float getX() { return this->m_x; } void setX(float value) { this->m_x = value; } const float getY() { return this->m_y; } @@ -50,7 +50,7 @@ public: void setZ(float value) { this->m_z = value; } const float getW() { return this->m_w; } void setW(float value) { this->m_w = value; } - + /** * the inner loop of this program */ diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.h b/source/blender/compositor/operations/COM_SocketProxyOperation.h index 86c8b23b115..55cf6d376b7 100644 --- a/source/blender/compositor/operations/COM_SocketProxyOperation.h +++ b/source/blender/compositor/operations/COM_SocketProxyOperation.h @@ -28,13 +28,13 @@ class SocketProxyOperation : public NodeOperation { public: SocketProxyOperation(DataType type, bool use_conversion); - + bool isProxyOperation() const { return true; } bool useDatatypeConversion() const { return m_use_conversion; } - + bool getUseConversion() const { return m_use_conversion; } void setUseConversion(bool use_conversion) { m_use_conversion = use_conversion; } - + private: bool m_use_conversion; }; diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.cpp b/source/blender/compositor/operations/COM_SunBeamsOperation.cpp index 81b967bf530..964ba36d08c 100644 --- a/source/blender/compositor/operations/COM_SunBeamsOperation.cpp +++ b/source/blender/compositor/operations/COM_SunBeamsOperation.cpp @@ -61,7 +61,7 @@ template <int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator { /* utility functions implementing the matrix transform to/from sector space */ - + static inline void buffer_to_sector(const float source[2], int x, int y, int &u, int &v) { int x0 = (int)source[0]; @@ -155,9 +155,9 @@ struct BufferLineAccumulator { float v, dv; float falloff_factor; float border[4]; - + zero_v4(output); - + if ((int)(co[0] - source[0]) == 0 && (int)(co[1] - source[1]) == 0) { copy_v4_v4(output, input->getBuffer() + COM_NUM_CHANNELS_COLOR * ((int)source[0] + input->getWidth() * (int)source[1])); return; @@ -174,7 +174,7 @@ struct BufferLineAccumulator { for (int i = 0; i < num; i++) { float weight = 1.0f - (float)i * falloff_factor; weight *= weight; - + /* range check, use last valid color when running beyond the image border */ if (x >= rect.xmin && x < rect.xmax && y >= rect.ymin && y < rect.ymax) { madd_v4_v4fl(output, buffer, buffer[3] * weight); @@ -184,7 +184,7 @@ struct BufferLineAccumulator { else { madd_v4_v4fl(output, border, border[3] * weight); } - + /* TODO implement proper filtering here, see * https://en.wikipedia.org/wiki/Lanczos_resampling * https://en.wikipedia.org/wiki/Sinc_function diff --git a/source/blender/compositor/operations/COM_TextureOperation.h b/source/blender/compositor/operations/COM_TextureOperation.h index a2fb7c7501f..26d50ca1753 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.h +++ b/source/blender/compositor/operations/COM_TextureOperation.h @@ -54,7 +54,7 @@ protected: * Determine the output resolution. The resolution is retrieved from the Renderer */ void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - + /** * Constructor */ diff --git a/source/blender/compositor/operations/COM_TonemapOperation.h b/source/blender/compositor/operations/COM_TonemapOperation.h index 51ffaac8503..6fcf72c9d14 100644 --- a/source/blender/compositor/operations/COM_TonemapOperation.h +++ b/source/blender/compositor/operations/COM_TonemapOperation.h @@ -47,12 +47,12 @@ protected: * @brief Cached reference to the reader */ SocketReader *m_imageReader; - + /** * @brief settings of the Tonemap */ NodeTonemap *m_data; - + /** * @brief temporarily cache of the execution storage */ @@ -60,27 +60,27 @@ protected: public: TonemapOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); void deinitializeTileData(rcti *rect, void *data); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setData(NodeTonemap *data) { this->m_data = data; } - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); }; diff --git a/source/blender/compositor/operations/COM_TranslateOperation.h b/source/blender/compositor/operations/COM_TranslateOperation.h index e30ba7ff2d7..f3708ef3c7c 100644 --- a/source/blender/compositor/operations/COM_TranslateOperation.h +++ b/source/blender/compositor/operations/COM_TranslateOperation.h @@ -45,7 +45,7 @@ public: float getDeltaX() { return this->m_deltaX * this->m_factorX; } float getDeltaY() { return this->m_deltaY * this->m_factorY; } - + inline void ensureDelta() { if (!this->m_isDeltaSet) { float tempDelta[4]; diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp index e8dbff9b2d7..a252af053cc 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp @@ -135,7 +135,7 @@ void VariableSizeBokehBlurOperation::executePixel(float output[4], int x, int y, copy_v4_v4(color_accum, readColor); copy_v4_fl(multiplier_accum, 1.0f); float size_center = tempSize[0] * scalar; - + const int addXStepValue = QualityStepHelper::getStep(); const int addYStepValue = addXStepValue; const int addXStepColor = addXStepValue * COM_NUM_CHANNELS_COLOR; @@ -184,8 +184,8 @@ void VariableSizeBokehBlurOperation::executePixel(float output[4], int x, int y, } void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, + MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, + MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> * /*clKernelsToCleanUp*/) { cl_kernel defocusKernel = device->COM_clCreateKernel("defocusKernel", NULL); @@ -193,7 +193,7 @@ void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice *device, cl_int step = this->getStep(); cl_int maxBlur; cl_float threshold = this->m_threshold; - + MemoryBuffer *sizeMemoryBuffer = this->m_inputSizeProgram->getInputMemoryBuffer(inputMemoryBuffers); const float max_dim = max(m_width, m_height); @@ -212,7 +212,7 @@ void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice *device, clSetKernelArg(defocusKernel, 8, sizeof(cl_float), &threshold); clSetKernelArg(defocusKernel, 9, sizeof(cl_float), &scalar); device->COM_clAttachSizeToKernelParameter(defocusKernel, 10, this); - + device->COM_clEnqueueRange(defocusKernel, outputMemoryBuffer, 11, this); } @@ -243,7 +243,7 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *inpu bokehInput.xmin = 0; bokehInput.ymax = COM_BLUR_BOKEH_PIXELS; bokehInput.ymin = 0; - + NodeOperation *operation = getInputOperation(2); if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output) ) { @@ -273,7 +273,7 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *inpu #ifdef COM_DEFOCUS_SEARCH // InverseSearchRadiusOperation -InverseSearchRadiusOperation::InverseSearchRadiusOperation() : NodeOperation() +InverseSearchRadiusOperation::InverseSearchRadiusOperation() : NodeOperation() { this->addInputSocket(COM_DT_VALUE, COM_SC_NO_RESIZE); // radius this->addOutputSocket(COM_DT_COLOR); @@ -281,7 +281,7 @@ InverseSearchRadiusOperation::InverseSearchRadiusOperation() : NodeOperation() this->m_inputRadius = NULL; } -void InverseSearchRadiusOperation::initExecution() +void InverseSearchRadiusOperation::initExecution() { this->m_inputRadius = this->getInputSocketReader(0); } @@ -313,7 +313,7 @@ void *InverseSearchRadiusOperation::initializeTileData(rcti *rect) // float radius = 0.0f; // float maxx = x; // float maxy = y; - + // for (int x2 = 0 ; x2 < DIVIDER ; x2 ++) { // for (int y2 = 0 ; y2 < DIVIDER ; y2 ++) { // this->m_inputRadius->read(temp, rx+x2, ry+y2, COM_PS_NEAREST); @@ -346,7 +346,7 @@ void InverseSearchRadiusOperation::executePixelChunk(float output[4], int x, int buffer->readNoCheck(output, x, y); } -void InverseSearchRadiusOperation::deinitializeTileData(rcti *rect, void *data) +void InverseSearchRadiusOperation::deinitializeTileData(rcti *rect, void *data) { if (data) { MemoryBuffer *mb = (MemoryBuffer *)data; @@ -354,7 +354,7 @@ void InverseSearchRadiusOperation::deinitializeTileData(rcti *rect, void *data) } } -void InverseSearchRadiusOperation::deinitExecution() +void InverseSearchRadiusOperation::deinitExecution() { this->m_inputRadius = NULL; } diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h index 110bb6b4952..57ffde6d398 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h @@ -46,23 +46,23 @@ public: * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); - + void deinitializeTileData(rcti *rect, void *data); - + /** * Deinitialize the execution */ void deinitExecution(); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); - + void setMaxBlur(int maxRadius) { this->m_maxBlur = maxRadius; } void setThreshold(float threshold) { this->m_threshold = threshold; } @@ -79,29 +79,29 @@ private: SocketReader *m_inputRadius; public: static const int DIVIDER = 4; - + InverseSearchRadiusOperation(); /** * the inner loop of this program */ void executePixelChunk(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); void *initializeTileData(rcti *rect); void deinitializeTileData(rcti *rect, void *data); - + /** * Deinitialize the execution */ void deinitExecution(); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - + void setMaxBlur(int maxRadius) { this->m_maxBlur = maxRadius; } }; #endif diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.h b/source/blender/compositor/operations/COM_VectorBlurOperation.h index 05c2c3183c1..30ca2f644bb 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.h +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.h @@ -34,27 +34,27 @@ private: SocketReader *m_inputImageProgram; SocketReader *m_inputSpeedProgram; SocketReader *m_inputZProgram; - + /** * @brief settings of the glare node. */ NodeBlurData *m_settings; - + float *m_cachedInstance; public: VectorBlurOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ @@ -65,9 +65,9 @@ public: void setVectorBlurSettings(NodeBlurData *settings) { this->m_settings = settings; } bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); protected: - + void generateVectorBlur(float *data, MemoryBuffer *inputImage, MemoryBuffer *inputSpeed, MemoryBuffer *inputZ); - - + + }; #endif diff --git a/source/blender/compositor/operations/COM_VectorCurveOperation.h b/source/blender/compositor/operations/COM_VectorCurveOperation.h index 444f848cb0a..518e4713c99 100644 --- a/source/blender/compositor/operations/COM_VectorCurveOperation.h +++ b/source/blender/compositor/operations/COM_VectorCurveOperation.h @@ -33,17 +33,17 @@ private: SocketReader *m_inputProgram; public: VectorCurveOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp index 0eff52f4d9a..51fd5d4dc76 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cpp +++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp @@ -50,7 +50,7 @@ ViewerOperation::ViewerOperation() : NodeOperation() this->m_viewSettings = NULL; this->m_displaySettings = NULL; this->m_useAlphaInput = false; - + this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); @@ -69,7 +69,7 @@ void ViewerOperation::initExecution() this->m_alphaInput = getInputSocketReader(1); this->m_depthInput = getInputSocketReader(2); this->m_doDepthBuffer = (this->m_depthInput != NULL); - + if (isActiveViewerOutput()) { initImage(); } diff --git a/source/blender/compositor/operations/COM_ViewerOperation.h b/source/blender/compositor/operations/COM_ViewerOperation.h index e5eed3e8024..0e4bff2c4e8 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.h +++ b/source/blender/compositor/operations/COM_ViewerOperation.h @@ -45,7 +45,7 @@ private: const ColorManagedViewSettings *m_viewSettings; const ColorManagedDisplaySettings *m_displaySettings; - + SocketReader *m_imageInput; SocketReader *m_alphaInput; SocketReader *m_depthInput; diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp index 85602e6741c..5a34673b2bd 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp @@ -131,7 +131,7 @@ void WriteBufferOperation::executeOpenCLRegion(OpenCLDevice *device, rcti * /*re cl_mem clOutputBuffer = clCreateImage2D(device->getContext(), CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR, imageFormat, outputBufferWidth, outputBufferHeight, 0, outputFloatBuffer, &error); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } - + // STEP 2 list<cl_mem> *clMemToCleanUp = new list<cl_mem>(); clMemToCleanUp->push_back(clOutputBuffer); @@ -151,7 +151,7 @@ void WriteBufferOperation::executeOpenCLRegion(OpenCLDevice *device, rcti * /*re if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } error = clEnqueueReadImage(device->getQueue(), clOutputBuffer, CL_TRUE, origin, region, 0, 0, outputFloatBuffer, 0, NULL, NULL); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } - + this->getMemoryProxy()->getBuffer()->copyContentFrom(outputBuffer); // STEP 4 diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.h b/source/blender/compositor/operations/COM_WriteBufferOperation.h index afcdc70889b..73314c947f5 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.h +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.h @@ -41,7 +41,7 @@ public: void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); const bool isWriteBufferOperation() const { return true; } bool isSingleValue() const { return m_single_value; } - + void executeRegion(rcti *rect, unsigned int tileNumber); void initExecution(); void deinitExecution(); diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.h b/source/blender/compositor/operations/COM_ZCombineOperation.h index a89a2c7bd62..c9d26adfc46 100644 --- a/source/blender/compositor/operations/COM_ZCombineOperation.h +++ b/source/blender/compositor/operations/COM_ZCombineOperation.h @@ -40,10 +40,10 @@ public: * Default constructor */ ZCombineOperation(); - + void initExecution(); void deinitExecution(); - + /** * the inner loop of this program */ diff --git a/source/blender/freestyle/intern/application/AppCanvas.cpp b/source/blender/freestyle/intern/application/AppCanvas.cpp index f621f45ff77..aca725a0384 100644 --- a/source/blender/freestyle/intern/application/AppCanvas.cpp +++ b/source/blender/freestyle/intern/application/AppCanvas.cpp @@ -64,7 +64,7 @@ void AppCanvas::setViewer(AppView *iViewer) _pViewer = iViewer; } -int AppCanvas::width() const +int AppCanvas::width() const { return _pViewer->width(); } @@ -84,7 +84,7 @@ float AppCanvas::thickness() const return _pViewer->thickness(); } -BBox<Vec3r> AppCanvas::scene3DBBox() const +BBox<Vec3r> AppCanvas::scene3DBBox() const { return _pViewer->scene3DBBox(); } diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp index 200e3eb3b5b..b4c815f8ad0 100644 --- a/source/blender/freestyle/intern/application/Controller.cpp +++ b/source/blender/freestyle/intern/application/Controller.cpp @@ -471,11 +471,11 @@ void Controller::ComputeViewMap() // retrieve the 3D viewpoint and transformations information //---------------------------------------------------------- - // Save the viewpoint context at the view level in order + // Save the viewpoint context at the view level in order // to be able to restore it later: // Restore the context of view: - // we need to perform all these operations while the + // we need to perform all these operations while the // 3D context is on. Vec3f vp(UNPACK3(g_freestyle.viewpoint)); diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp index f41a9b58085..e57d004e503 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp @@ -596,7 +596,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id) MEM_freeN(mlooptri); - // We might have several times the same vertex. We want a clean + // We might have several times the same vertex. We want a clean // shape with no real-vertex. Here, we are making a cleaning pass. float *cleanVertices = NULL; unsigned int cvSize; diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp index 75687edd9f6..b1c5de9d621 100644 --- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp +++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp @@ -96,7 +96,7 @@ static bCallbackFuncStore load_post_callback_funcstore = { }; //======================================================= -// Initialization +// Initialization //======================================================= void FRS_initialize() @@ -133,7 +133,7 @@ void FRS_exit() } //======================================================= -// Rendering +// Rendering //======================================================= static void init_view(Render *re) diff --git a/source/blender/freestyle/intern/geometry/FastGrid.h b/source/blender/freestyle/intern/geometry/FastGrid.h index 355a6e53399..75624bb9d9c 100644 --- a/source/blender/freestyle/intern/geometry/FastGrid.h +++ b/source/blender/freestyle/intern/geometry/FastGrid.h @@ -32,7 +32,7 @@ namespace Freestyle { -/*! Class to define a regular grid used for ray casting computations +/*! Class to define a regular grid used for ray casting computations * We don't use a hashtable here. The grid is explicitly stored for faster computations. * However, this might result in significant increase in memory usage (compared to the regular grid) */ diff --git a/source/blender/freestyle/intern/geometry/FitCurve.cpp b/source/blender/freestyle/intern/geometry/FitCurve.cpp index fbfa5b331e6..fd7d63bbd28 100644 --- a/source/blender/freestyle/intern/geometry/FitCurve.cpp +++ b/source/blender/freestyle/intern/geometry/FitCurve.cpp @@ -61,7 +61,7 @@ static double V2SquaredLength(Vector2 *a) } /* returns length of input vector */ -static double V2Length(Vector2 *a) +static double V2Length(Vector2 *a) { return (sqrt(V2SquaredLength(a))); } @@ -96,7 +96,7 @@ static Vector2 *V2Add(Vector2 *a, Vector2 *b, Vector2 *c) (*c)[0] = (*a)[0] + (*b)[0]; (*c)[1] = (*a)[1] + (*b)[1]; return c; -} +} /* normalizes the input vector and returns it */ static Vector2 *V2Normalize(Vector2 *v) diff --git a/source/blender/freestyle/intern/geometry/FitCurve.h b/source/blender/freestyle/intern/geometry/FitCurve.h index 2268f6be1b7..c402f431c27 100644 --- a/source/blender/freestyle/intern/geometry/FitCurve.h +++ b/source/blender/freestyle/intern/geometry/FitCurve.h @@ -90,7 +90,7 @@ public: * Control points of the sets of bezier curve segments. * Each segment is made of 4 points (polynomial degree of curve = 3) * error - * max error tolerance between resulting curve and input data + * max error tolerance between resulting curve and input data */ void FitCurve(std::vector<Vec2d>& data, std::vector<Vec2d>& oCurve, double error); diff --git a/source/blender/freestyle/intern/geometry/GeomUtils.h b/source/blender/freestyle/intern/geometry/GeomUtils.h index 8f3abf451c9..9e7c629191f 100644 --- a/source/blender/freestyle/intern/geometry/GeomUtils.h +++ b/source/blender/freestyle/intern/geometry/GeomUtils.h @@ -174,7 +174,7 @@ void fromWorldToImage(const Vec3r& p, Vec3r& q, const real model_view_matrix[4][ */ void fromWorldToImage(const Vec3r& p, Vec3r& q, const real transform[4][4], const int viewport[4]); -/*! Projects from world coordinates to camera coordinates +/*! Projects from world coordinates to camera coordinates * Returns the point's coordinates expressed in the camera's * coordinates system. * p @@ -220,7 +220,7 @@ void fromRetinaToImage(const Vec3r& p, Vec3r& q, const int viewport[4]); */ void fromImageToRetina(const Vec3r& p, Vec3r& q, const int viewport[4]); -/*! computes the coordinates of q in the camera coordinates system, +/*! computes the coordinates of q in the camera coordinates system, * using the known z coordinates of the 3D point. * That means that this method does not inverse any matrices, * it only computes X and Y from x,y and Z) diff --git a/source/blender/freestyle/intern/geometry/Grid.cpp b/source/blender/freestyle/intern/geometry/Grid.cpp index 371c63318de..61cf70a0aa3 100644 --- a/source/blender/freestyle/intern/geometry/Grid.cpp +++ b/source/blender/freestyle/intern/geometry/Grid.cpp @@ -242,7 +242,7 @@ bool Grid::nextRayCell(Vec3u& current_cell, Vec3u& next_cell) real t_min, t; unsigned i; - t_min = FLT_MAX; // init tmin with handle of the case where one or 2 _u[i] = 0. + t_min = FLT_MAX; // init tmin with handle of the case where one or 2 _u[i] = 0. unsigned coord = 0; // predominant coord(0=x, 1=y, 2=z) diff --git a/source/blender/freestyle/intern/geometry/GridHelpers.h b/source/blender/freestyle/intern/geometry/GridHelpers.h index 22efdcf1d11..4dd345e9b07 100644 --- a/source/blender/freestyle/intern/geometry/GridHelpers.h +++ b/source/blender/freestyle/intern/geometry/GridHelpers.h @@ -73,7 +73,7 @@ T closestPointToSegment(const T& P, const T& A, const T& B, real& distance) distance = PPb.norm(); return Pb; // closest point lies on AB -} +} inline Vec3r closestPointOnPolygon(const Vec3r& point, const Polygon3r& poly) { diff --git a/source/blender/freestyle/intern/geometry/SweepLine.h b/source/blender/freestyle/intern/geometry/SweepLine.h index 039ecd7ebf4..98e860862bb 100644 --- a/source/blender/freestyle/intern/geometry/SweepLine.h +++ b/source/blender/freestyle/intern/geometry/SweepLine.h @@ -216,7 +216,7 @@ struct binary_rule template<class T, class Point> -class SweepLine +class SweepLine { public: SweepLine() {} @@ -231,7 +231,7 @@ public: } } - inline void process(Point& p, vector<Segment<T, Point>*>& segments, + inline void process(Point& p, vector<Segment<T, Point>*>& segments, #if 0 binary_rule<Segment<T, Point>,Segment<T, Point> >& binrule = \ binary_rule<Segment<T, Point>, Segment<T, Point> >(), diff --git a/source/blender/freestyle/intern/geometry/VecMat.h b/source/blender/freestyle/intern/geometry/VecMat.h index 3c3d40875d0..e7a44e00b1b 100644 --- a/source/blender/freestyle/intern/geometry/VecMat.h +++ b/source/blender/freestyle/intern/geometry/VecMat.h @@ -150,21 +150,21 @@ public: Vec<T, N> res(v); res += *this; return res; - } + } inline Vec<T, N> operator-(const Vec<T, N>& v) const { Vec<T, N> res(*this); res -= v; return res; - } + } inline Vec<T, N> operator*(const typename Vec<T, N>::value_type r) const { Vec<T, N> res(*this); res *= r; return res; - } + } inline Vec<T, N> operator/(const typename Vec<T, N>::value_type r) const { @@ -172,7 +172,7 @@ public: if (r) res /= r; return res; - } + } // dot product inline value_type operator*(const Vec<T, N>& v) const @@ -181,7 +181,7 @@ public: for (unsigned int i = 0; i < N; i++) sum += (*this)[i] * v[i]; return sum; - } + } template <class U> inline Vec<T, N>& operator=(const Vec<U, N>& v) @@ -255,7 +255,7 @@ public: if (this->_coord[i] == v[i]) continue; } - return false; + return false; } inline bool operator>(const Vec<T, N>& v) const @@ -268,7 +268,7 @@ public: if (this->_coord[i] == v[i]) continue; } - return false; + return false; } protected: diff --git a/source/blender/freestyle/intern/geometry/matrix_util.cpp b/source/blender/freestyle/intern/geometry/matrix_util.cpp index 5e585497516..40195361fe0 100644 --- a/source/blender/freestyle/intern/geometry/matrix_util.cpp +++ b/source/blender/freestyle/intern/geometry/matrix_util.cpp @@ -95,7 +95,7 @@ namespace MatrixUtil { // Ugly Fortran-porting trick: indices for v are between 1 and n v--; - // Step 3 : compute the weight of the non diagonal terms + // Step 3 : compute the weight of the non diagonal terms ij = 1; a_norm = 0.0; for (i = 1; i <= n; i++) { @@ -240,7 +240,7 @@ namespace MatrixUtil { index[i] = jj; } - // Step 7: save the eigen vectors + // Step 7: save the eigen vectors // back from Fortran to to C++ v++; diff --git a/source/blender/freestyle/intern/image/GaussianFilter.h b/source/blender/freestyle/intern/image/GaussianFilter.h index 7abd1bc18bc..fdbfd20d764 100644 --- a/source/blender/freestyle/intern/image/GaussianFilter.h +++ b/source/blender/freestyle/intern/image/GaussianFilter.h @@ -120,7 +120,7 @@ protected: }; /* - + ############################################# ############################################# ############################################# @@ -130,7 +130,7 @@ protected: ############################################# ############################################# ############################################# - + */ template<class Map> diff --git a/source/blender/freestyle/intern/python/BPy_Convert.cpp b/source/blender/freestyle/intern/python/BPy_Convert.cpp index 4e1a0a119aa..0ac116b1bd4 100644 --- a/source/blender/freestyle/intern/python/BPy_Convert.cpp +++ b/source/blender/freestyle/intern/python/BPy_Convert.cpp @@ -89,7 +89,7 @@ PyObject *Vector_from_Vec3f(Vec3f& vec) float vec_data[3]; // because vec->_coord is protected vec_data[0] = vec.x(); vec_data[1] = vec.y(); - vec_data[2] = vec.z(); + vec_data[2] = vec.z(); return Vector_CreatePyObject(vec_data, 3, NULL); } @@ -356,7 +356,7 @@ PyObject *BPy_SShape_from_SShape(SShape& ss) PyObject *py_ss = SShape_Type.tp_new(&SShape_Type, 0, 0); ((BPy_SShape *)py_ss)->ss = &ss; ((BPy_SShape *)py_ss)->borrowed = true; - return py_ss; + return py_ss; } PyObject *BPy_ViewShape_from_ViewShape(ViewShape& vs) diff --git a/source/blender/freestyle/intern/python/BPy_Convert.h b/source/blender/freestyle/intern/python/BPy_Convert.h index 35c1e58369c..a0e0b578c10 100644 --- a/source/blender/freestyle/intern/python/BPy_Convert.h +++ b/source/blender/freestyle/intern/python/BPy_Convert.h @@ -40,7 +40,7 @@ using namespace Freestyle::Geometry; #include "../geometry/BBox.h" // FEdge, FEdgeSharp, FEdgeSmooth, SShape, SVertex, FEdgeInternal::SVertexIterator -#include "../view_map/Silhouette.h" +#include "../view_map/Silhouette.h" // Id #include "../system/Id.h" diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp index 0b09a3c2442..23deb63ce36 100644 --- a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp +++ b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp @@ -486,7 +486,7 @@ static PyModuleDef module_definition = { PyObject *Freestyle_Init(void) { PyObject *module; - + // initialize modules module = PyModule_Create(&module_definition); if (!module) @@ -509,9 +509,9 @@ PyObject *Freestyle_Init(void) else { printf("Freestyle: couldn't find 'scripts/freestyle/modules', Freestyle won't work properly.\n"); } - + // attach its classes (adding the object types to the module) - + // those classes have to be initialized before the others MediumType_Init(module); Nature_Init(module); diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp index 0db25753caa..548ab529f34 100644 --- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp +++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp @@ -216,7 +216,7 @@ static PyLongObject _IntegrationType_LAST = { int IntegrationType_Init(PyObject *module) { PyObject *m, *d, *f; - + if (module == NULL) return -1; @@ -230,7 +230,7 @@ int IntegrationType_Init(PyObject *module) PyDict_SetItemString(IntegrationType_Type.tp_dict, "MAX", BPy_IntegrationType_MAX); PyDict_SetItemString(IntegrationType_Type.tp_dict, "FIRST", BPy_IntegrationType_FIRST); PyDict_SetItemString(IntegrationType_Type.tp_dict, "LAST", BPy_IntegrationType_LAST); - + m = PyModule_Create(&module_definition); if (m == NULL) return -1; diff --git a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp index 8f23800fb7a..d592aed749d 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp @@ -59,7 +59,7 @@ int Interface0D_Init(PyObject *module) if (PyType_Ready(&SVertex_Type) < 0) return -1; Py_INCREF(&SVertex_Type); - PyModule_AddObject(module, "SVertex", (PyObject *)&SVertex_Type); + PyModule_AddObject(module, "SVertex", (PyObject *)&SVertex_Type); if (PyType_Ready(&ViewVertex_Type) < 0) return -1; diff --git a/source/blender/freestyle/intern/python/BPy_MediumType.cpp b/source/blender/freestyle/intern/python/BPy_MediumType.cpp index 240f3f2d6e2..ebd9c6822a9 100644 --- a/source/blender/freestyle/intern/python/BPy_MediumType.cpp +++ b/source/blender/freestyle/intern/python/BPy_MediumType.cpp @@ -103,7 +103,7 @@ PyLongObject _BPy_MediumType_OPAQUE_MEDIUM = { //-------------------MODULE INITIALIZATION-------------------------------- int MediumType_Init(PyObject *module) -{ +{ if (module == NULL) return -1; diff --git a/source/blender/freestyle/intern/python/BPy_SShape.cpp b/source/blender/freestyle/intern/python/BPy_SShape.cpp index 9169adf4d9f..cf4880ad3f7 100644 --- a/source/blender/freestyle/intern/python/BPy_SShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_SShape.cpp @@ -232,11 +232,11 @@ static PyObject *SShape_vertices_get(BPy_SShape *self, void *UNUSED(closure)) vector< SVertex * >::iterator it; PyObject *py_vertices = PyList_New(vertices.size()); unsigned int i = 0; - + for (it = vertices.begin(); it != vertices.end(); it++) { PyList_SET_ITEM(py_vertices, i++, BPy_SVertex_from_SVertex(*(*it))); } - + return py_vertices; } @@ -252,11 +252,11 @@ static PyObject *SShape_edges_get(BPy_SShape *self, void *UNUSED(closure)) vector< FEdge * >::iterator it; PyObject *py_edges = PyList_New(edges.size()); unsigned int i = 0; - + for (it = edges.begin(); it != edges.end(); it++) { PyList_SET_ITEM(py_edges, i++, Any_BPy_FEdge_from_FEdge(*(*it))); } - + return py_edges; } diff --git a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp index 6b4a1872b61..eee48f19e1b 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp @@ -216,7 +216,7 @@ static PyObject *StrokeShader_shade(BPy_StrokeShader *self, PyObject *args, PyOb if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Stroke_Type, &py_s)) return NULL; - + if (typeid(*(self->ss)) == typeid(StrokeShader)) { PyErr_SetString(PyExc_TypeError, "shade method not properly overridden"); return NULL; diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp index fc43accabf0..87e5e7505ca 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp @@ -161,9 +161,9 @@ static PyObject *UnaryPredicate1D___call__(BPy_UnaryPredicate1D *self, PyObject if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &py_if1D)) return NULL; - + Interface1D *if1D = ((BPy_Interface1D *)py_if1D)->if1D; - + if (!if1D) { string class_name(Py_TYPE(self)->tp_name); PyErr_SetString(PyExc_RuntimeError, (class_name + " has no Interface1D").c_str()); diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp index f2f53159fcf..33c18c3ce80 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp @@ -222,7 +222,7 @@ static int ViewShape_vertices_set(BPy_ViewShape *self, PyObject *value, void *UN { PyObject *item; vector< ViewVertex *> v; - + if (!PyList_Check(value)) { PyErr_SetString(PyExc_TypeError, "value must be a list of ViewVertex objects"); return -1; diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp index 2072faa43ef..8d81e508340 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp @@ -35,7 +35,7 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- -//ViewMapGradientNormBP1D(int level, IntegrationType iType=MEAN, float sampling=2.0) +//ViewMapGradientNormBP1D(int level, IntegrationType iType=MEAN, float sampling=2.0) static char ViewMapGradientNormBP1D___doc__[] = "Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`ViewMapGradientNormBP1D`\n" diff --git a/source/blender/freestyle/intern/python/Director.cpp b/source/blender/freestyle/intern/python/Director.cpp index 9f85e84e297..f4f02a7026f 100644 --- a/source/blender/freestyle/intern/python/Director.cpp +++ b/source/blender/freestyle/intern/python/Director.cpp @@ -325,7 +325,7 @@ int Director_BPy_UnaryFunction1D___call__(void *uf1D, void *py_uf1D, Interface1D vec.push_back(b); } ((UnaryFunction1D< vector<ViewShape*> > *)uf1D)->result = vec; - } + } Py_DECREF(result); return 0; } diff --git a/source/blender/freestyle/intern/python/Director.h b/source/blender/freestyle/intern/python/Director.h index 40576c0ec2c..6a0ae7dd704 100644 --- a/source/blender/freestyle/intern/python/Director.h +++ b/source/blender/freestyle/intern/python/Director.h @@ -53,7 +53,7 @@ int Director_BPy_UnaryFunction1D___call__(void *uf1D, void *py_uf1D, Interface1D // UnaryPredicate0D: __call__ int Director_BPy_UnaryPredicate0D___call__(UnaryPredicate0D *up0D, Interface0DIterator& if0D_it); - + // UnaryPredicate1D: __call__ int Director_BPy_UnaryPredicate1D___call__(UnaryPredicate1D *up1D, Interface1D& if1D); diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp index 39919b41423..33300ea70b5 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp @@ -341,7 +341,7 @@ PyDoc_STRVAR(SVertex_normals_doc, static PyObject *SVertex_normals_get(BPy_SVertex *self, void *UNUSED(closure)) { - PyObject *py_normals; + PyObject *py_normals; set< Vec3r > normals = self->sv->normals(); set< Vec3r >::iterator it; py_normals = PyList_New(normals.size()); diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp index 5c816bdfea1..9a39db0ee7e 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp @@ -314,7 +314,7 @@ static PyObject *Stroke_stroke_vertices_size(BPy_Stroke *self) return PyLong_FromLong(self->s->strokeVerticesSize()); } -static PyMethodDef BPy_Stroke_methods[] = { +static PyMethodDef BPy_Stroke_methods[] = { {"compute_sampling", (PyCFunction)Stroke_compute_sampling, METH_VARARGS | METH_KEYWORDS, Stroke_compute_sampling_doc}, {"resample", (PyCFunction)Stroke_resample, METH_VARARGS | METH_KEYWORDS, Stroke_resample_doc}, diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp index bcae5a2c2a4..9119d8f999e 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp @@ -182,7 +182,7 @@ PyDoc_STRVAR(ViewEdge_viewshape_doc, ":type: :class:`ViewShape`"); static PyObject *ViewEdge_viewshape_get(BPy_ViewEdge *self, void *UNUSED(closure)) -{ +{ ViewShape *vs = self->ve->viewShape(); if (vs) return BPy_ViewShape_from_ViewShape(*vs); diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp index 08cfffec860..5a6e838dcc6 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp @@ -98,7 +98,7 @@ static int ChainSilhouetteIterator_init(BPy_ChainSilhouetteIterator *self, PyObj bool restrict_to_selection = (!obj1) ? true : bool_from_PyBool(obj1); ViewEdge *begin = (!obj2 || obj2 == Py_None) ? NULL : ((BPy_ViewEdge *)obj2)->ve; bool orientation = (!obj3) ? true : bool_from_PyBool(obj3); - self->cs_it = new ChainSilhouetteIterator(restrict_to_selection, begin, orientation); + self->cs_it = new ChainSilhouetteIterator(restrict_to_selection, begin, orientation); } else { PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp index e91c62c7d24..1f5444d7beb 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp @@ -161,15 +161,15 @@ static int UnaryFunction1DDouble___init__(BPy_UnaryFunction1DDouble *self, PyObj if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - + if (!obj) self->uf1D_double = new UnaryFunction1D<double>(); else { self->uf1D_double = new UnaryFunction1D<double>(IntegrationType_from_BPy_IntegrationType(obj)); } - + self->uf1D_double->py_uf1D = (PyObject *)self; - + return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp index abef3b2676f..3f0611dba84 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp @@ -83,15 +83,15 @@ static int UnaryFunction1DEdgeNature___init__(BPy_UnaryFunction1DEdgeNature *sel if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - + if (!obj) self->uf1D_edgenature = new UnaryFunction1D<Nature::EdgeNature>(); else { self->uf1D_edgenature = new UnaryFunction1D<Nature::EdgeNature>(IntegrationType_from_BPy_IntegrationType(obj)); } - + self->uf1D_edgenature->py_uf1D = (PyObject *)self; - + return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp index 13a001c585b..b3b27aabade 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp @@ -76,15 +76,15 @@ static int UnaryFunction1DFloat___init__(BPy_UnaryFunction1DFloat *self, PyObjec if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - + if (!obj) self->uf1D_float = new UnaryFunction1D<float>(); else { self->uf1D_float = new UnaryFunction1D<float>(IntegrationType_from_BPy_IntegrationType(obj)); } - + self->uf1D_float->py_uf1D = (PyObject *)self; - + return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp index 4e88020b5c8..0814eafb18e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp @@ -83,15 +83,15 @@ static int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned *self, P if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - + if (!obj) self->uf1D_unsigned = new UnaryFunction1D<unsigned int>(); else { self->uf1D_unsigned = new UnaryFunction1D<unsigned int>(IntegrationType_from_BPy_IntegrationType(obj)); } - + self->uf1D_unsigned->py_uf1D = (PyObject *)self; - + return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp index 9a864a3f579..f7f4fea02ae 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp @@ -89,15 +89,15 @@ static int UnaryFunction1DVec2f___init__(BPy_UnaryFunction1DVec2f *self, PyObjec if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - + if (!obj) self->uf1D_vec2f = new UnaryFunction1D<Vec2f>(); else { self->uf1D_vec2f = new UnaryFunction1D<Vec2f>(IntegrationType_from_BPy_IntegrationType(obj)); } - + self->uf1D_vec2f->py_uf1D = (PyObject *)self; - + return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp index 60c581ac845..980df2c2268 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp @@ -83,15 +83,15 @@ static int UnaryFunction1DVec3f___init__(BPy_UnaryFunction1DVec3f *self, PyObjec if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - + if (!obj) self->uf1D_vec3f = new UnaryFunction1D<Vec3f>(); else { self->uf1D_vec3f = new UnaryFunction1D<Vec3f>(IntegrationType_from_BPy_IntegrationType(obj)); } - + self->uf1D_vec3f->py_uf1D = (PyObject *)self; - + return 0; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp index c15d974e771..5eba1573d80 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp @@ -97,16 +97,16 @@ static int UnaryFunction1DVectorViewShape___init__(BPy_UnaryFunction1DVectorView if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - + if (!obj) { self->uf1D_vectorviewshape = new UnaryFunction1D< std::vector<ViewShape*> >(); } else { self->uf1D_vectorviewshape = new UnaryFunction1D< std::vector<ViewShape*> >(IntegrationType_from_BPy_IntegrationType(obj)); } - + self->uf1D_vectorviewshape->py_uf1D = (PyObject *)self; - + return 0; } @@ -149,7 +149,7 @@ static PyObject *UnaryFunction1DVectorViewShape___call__(BPy_UnaryFunction1DVect ViewShape *v = self->uf1D_vectorviewshape->result[i]; PyList_SET_ITEM(list, i, v ? BPy_ViewShape_from_ViewShape(*v) : (Py_INCREF(Py_None), Py_None)); } - + return list; } diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp index 4db28c0db95..7a83a49b9d2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp @@ -96,15 +96,15 @@ static int UnaryFunction1DVoid___init__(BPy_UnaryFunction1DVoid *self, PyObject if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) return -1; - + if (!obj) self->uf1D_void = new UnaryFunction1D_void(); else { self->uf1D_void = new UnaryFunction1D_void(IntegrationType_from_BPy_IntegrationType(obj)); } - + self->uf1D_void->py_uf1D = (PyObject *)self; - + return 0; } diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h index 16dea6f907e..c1a5b2a6774 100644 --- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h +++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h @@ -90,7 +90,7 @@ public: * - TRIANGLES : the face indices describe single triangles * If iCopy != 0, the array is copied; you must desallocate iFaceStyle. Else you must not. * iVIndices, - * Array of vertices indices. + * Array of vertices indices. * The integers contained in this array must be multiple of 3. * If iCopy != 0, the array is copied; you must desallocate iVIndices. Else you must not. * iVISize diff --git a/source/blender/freestyle/intern/scene_graph/LineRep.cpp b/source/blender/freestyle/intern/scene_graph/LineRep.cpp index e7d81113974..a35920a4f4c 100644 --- a/source/blender/freestyle/intern/scene_graph/LineRep.cpp +++ b/source/blender/freestyle/intern/scene_graph/LineRep.cpp @@ -39,7 +39,7 @@ void LineRep::ComputeBBox() real YMin = _vertices.front()[1]; real ZMin = _vertices.front()[2]; - // parse all the coordinates to find + // parse all the coordinates to find // the XMax, YMax, ZMax vector<Vec3r>::iterator v; for (v = _vertices.begin(); v != _vertices.end(); ++v) { diff --git a/source/blender/freestyle/intern/scene_graph/Node.h b/source/blender/freestyle/intern/scene_graph/Node.h index 546458bad48..4ddcadd3542 100644 --- a/source/blender/freestyle/intern/scene_graph/Node.h +++ b/source/blender/freestyle/intern/scene_graph/Node.h @@ -104,7 +104,7 @@ public: protected: -private: +private: BBox<Vec3r> _BBox; #ifdef WITH_CXX_GUARDEDALLOC diff --git a/source/blender/freestyle/intern/scene_graph/NodeCamera.h b/source/blender/freestyle/intern/scene_graph/NodeCamera.h index 78c34fdef6d..c2f70d514a8 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeCamera.h +++ b/source/blender/freestyle/intern/scene_graph/NodeCamera.h @@ -52,7 +52,7 @@ public: } CameraType; /*! Default matrices: Identity for both projection and modelview. */ - NodeCamera(CameraType camera_type = GENERIC); + NodeCamera(CameraType camera_type = GENERIC); #if 0 /* UNUSED, gives warning in gcc */ NodeCamera(const NodeCamera& iBrother); #endif diff --git a/source/blender/freestyle/intern/scene_graph/NodeGroup.h b/source/blender/freestyle/intern/scene_graph/NodeGroup.h index 69c8a2c8f3b..e8e58b0915e 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeGroup.h +++ b/source/blender/freestyle/intern/scene_graph/NodeGroup.h @@ -48,7 +48,7 @@ public: /*! Adds a child. Makes a addRef on the iChild reference counter */ virtual void AddChild(Node *iChild); - /*! destroys all the underlying nodes + /*! destroys all the underlying nodes * Returns the reference counter after having done a release() */ virtual int destroy(); diff --git a/source/blender/freestyle/intern/scene_graph/NodeLight.cpp b/source/blender/freestyle/intern/scene_graph/NodeLight.cpp index 5a54bc09891..9e15f6c1eee 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeLight.cpp +++ b/source/blender/freestyle/intern/scene_graph/NodeLight.cpp @@ -37,7 +37,7 @@ NodeLight::NodeLight() : Node() _number = 7; } else { - _number = numberOfLights; + _number = numberOfLights; numberOfLights++; } @@ -61,7 +61,7 @@ NodeLight::NodeLight(NodeLight& iBrother) : Node(iBrother) _number = 7; } else { - _number = numberOfLights; + _number = numberOfLights; numberOfLights++; } diff --git a/source/blender/freestyle/intern/scene_graph/NodeLight.h b/source/blender/freestyle/intern/scene_graph/NodeLight.h index c633a6bc7b8..10d6f657872 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeLight.h +++ b/source/blender/freestyle/intern/scene_graph/NodeLight.h @@ -41,7 +41,7 @@ using namespace Geometry; class NodeLight : public Node { public: - NodeLight(); + NodeLight(); NodeLight(NodeLight& iBrother); virtual ~NodeLight() {} diff --git a/source/blender/freestyle/intern/scene_graph/Rep.h b/source/blender/freestyle/intern/scene_graph/Rep.h index 773eb2d3278..4c8017e162d 100644 --- a/source/blender/freestyle/intern/scene_graph/Rep.h +++ b/source/blender/freestyle/intern/scene_graph/Rep.h @@ -97,7 +97,7 @@ public: return *this; } - virtual ~Rep() + virtual ~Rep() { if (0 != _FrsMaterial) { delete _FrsMaterial; diff --git a/source/blender/freestyle/intern/scene_graph/TriangleRep.h b/source/blender/freestyle/intern/scene_graph/TriangleRep.h index d101cfd7988..353555b2802 100644 --- a/source/blender/freestyle/intern/scene_graph/TriangleRep.h +++ b/source/blender/freestyle/intern/scene_graph/TriangleRep.h @@ -28,7 +28,7 @@ * \date 16/12/2002 */ -//! inherits from class Rep +//! inherits from class Rep #include "Rep.h" namespace Freestyle { diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h index 48d5cd4803e..87f132b1ff3 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h @@ -109,7 +109,7 @@ private: int _level; public: - /*! Builds the functor from name of the + /*! Builds the functor from name of the * Map that must be read. * \param iMapName * The name of the map. @@ -171,7 +171,7 @@ private: int _level; public: - /*! Builds the functor + /*! Builds the functor * \param level * The level of the pyramid from which the pixel must be read. */ @@ -199,7 +199,7 @@ private: float _step; public: - /*! Builds the functor + /*! Builds the functor * \param level * The level of the pyramid from which the pixel must be read. */ diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp index ed527080f36..247217791a5 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp @@ -114,7 +114,7 @@ int GetDirectionalViewMapDensityF1D::operator()(Interface1D& inter) //soc unsigned size; result = integrate(_fun, inter.pointsBegin(_sampling), inter.pointsEnd(_sampling), _integration); return 0; -} +} int GetCompleteViewMapDensityF1D::operator()(Interface1D& inter) { diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h index 9df690cf5b0..ec698ca5e68 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h @@ -135,7 +135,7 @@ class GetCompleteViewMapDensityF1D : public UnaryFunction1D<double> public: /*! Builds the functor. * \param level - * The level of the pyramid from which + * The level of the pyramid from which * the pixel must be read. * \param iType * The integration method used to compute diff --git a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h index a9ef49aa802..5ba96f31272 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h +++ b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h @@ -61,7 +61,7 @@ public: protected: real _maxThickness; real _minThickness; - Vec2f _orientation; + Vec2f _orientation; bool _clamp; }; diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h index cc935a7e311..d3d19beba95 100644 --- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h +++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h @@ -405,7 +405,7 @@ public: class BackboneStretcherShader : public StrokeShader { private: - float _amount; + float _amount; public: /*! Builds the shader. @@ -524,7 +524,7 @@ public: * The smaller, the closer the new stroke to the orinal one. * This error corresponds to the maximum distance between the new stroke and the old one. */ - PolygonalizationShader(float iError) : StrokeShader() + PolygonalizationShader(float iError) : StrokeShader() { _error = iError; } @@ -594,7 +594,7 @@ public: virtual int shade(Stroke &stroke) const; protected: - real _tipLength; + real _tipLength; }; /*! [ Texture Shader ]. diff --git a/source/blender/freestyle/intern/stroke/Canvas.h b/source/blender/freestyle/intern/stroke/Canvas.h index 5919344b6e0..6d84ff995d2 100644 --- a/source/blender/freestyle/intern/stroke/Canvas.h +++ b/source/blender/freestyle/intern/stroke/Canvas.h @@ -128,7 +128,7 @@ public: void Clear(); /* Erases the layers */ - virtual void Erase(); + virtual void Erase(); /* Reads a pixel area from the canvas */ virtual void readColorPixels(int x, int y, int w, int h, RGBImage& oImage) const = 0; diff --git a/source/blender/freestyle/intern/stroke/ChainingIterators.h b/source/blender/freestyle/intern/stroke/ChainingIterators.h index 4ece24c5ecf..310409f160f 100644 --- a/source/blender/freestyle/intern/stroke/ChainingIterators.h +++ b/source/blender/freestyle/intern/stroke/ChainingIterators.h @@ -80,7 +80,7 @@ public: { _internalIterator = iBrother._internalIterator; _restrictToSelection = iBrother._restrictToSelection; - _restrictToUnvisited = iBrother._restrictToUnvisited; + _restrictToUnvisited = iBrother._restrictToUnvisited; return *this; } @@ -289,7 +289,7 @@ public: */ virtual int traverse(const AdjacencyIterator& it); - /*! Inits the iterator context */ + /*! Inits the iterator context */ virtual int init() { return 0; diff --git a/source/blender/freestyle/intern/stroke/ContextFunctions.h b/source/blender/freestyle/intern/stroke/ContextFunctions.h index d8b780e77a0..97710437e47 100644 --- a/source/blender/freestyle/intern/stroke/ContextFunctions.h +++ b/source/blender/freestyle/intern/stroke/ContextFunctions.h @@ -64,7 +64,7 @@ BBox<Vec2i> GetBorderCF(); void LoadMapCF(const char *iFileName, const char *iMapName, unsigned iNbLevels = 4, float iSigma = 1.0f); // ReadMapPixel -/*! Reads a pixel in a user-defined map +/*! Reads a pixel in a user-defined map * \return the floating value stored for that pixel * \param iMapName * The name of the map diff --git a/source/blender/freestyle/intern/stroke/Curve.cpp b/source/blender/freestyle/intern/stroke/Curve.cpp index a8dbce84971..52fd780ee43 100644 --- a/source/blender/freestyle/intern/stroke/Curve.cpp +++ b/source/blender/freestyle/intern/stroke/Curve.cpp @@ -317,7 +317,7 @@ float CurvePoint::shape_importance() const if (__A == 0) return __B->shape_importance(); return __A->shape_importance(); -} +} const unsigned CurvePoint::qi() const diff --git a/source/blender/freestyle/intern/stroke/Curve.h b/source/blender/freestyle/intern/stroke/Curve.h index 726b238c74b..04cc2fbfd39 100644 --- a/source/blender/freestyle/intern/stroke/Curve.h +++ b/source/blender/freestyle/intern/stroke/Curve.h @@ -94,7 +94,7 @@ public: // Implementation of Interface0D return _Point3d.z(); } - /*! Returns the 3D point. */ + /*! Returns the 3D point. */ virtual Vec3r getPoint3D() const { return _Point3d; @@ -118,7 +118,7 @@ public: // Implementation of Interface0D return _Point2d.z(); } - /*! Returns the 2D point. */ + /*! Returns the 2D point. */ virtual Vec2r getPoint2D() const { return Vec2r(_Point2d.x(), _Point2d.y()); @@ -444,7 +444,7 @@ public: } /*! Adds a single vertex (SVertex) at the end of the Curve */ - inline void push_vertex_back(SVertex *iVertex) + inline void push_vertex_back(SVertex *iVertex) { if (!_Vertices.empty()) { Vec3r vec_tmp(iVertex->point2d() - _Vertices.back()->point2d()); @@ -456,7 +456,7 @@ public: } /*! Adds a single vertex (CurvePoint) at the front of the Curve */ - inline void push_vertex_front(Vertex *iVertex) + inline void push_vertex_front(Vertex *iVertex) { if (!_Vertices.empty()) { Vec3r vec_tmp(iVertex->point2d() - _Vertices.front()->point2d()); @@ -468,7 +468,7 @@ public: } /*! Adds a single vertex (SVertex) at the front of the Curve */ - inline void push_vertex_front(SVertex *iVertex) + inline void push_vertex_front(SVertex *iVertex) { if (!_Vertices.empty()) { Vec3r vec_tmp(iVertex->point2d() - _Vertices.front()->point2d()); diff --git a/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h b/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h index 4142117c361..726c80d889c 100644 --- a/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h +++ b/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h @@ -39,7 +39,7 @@ class CurvePoint_const_traits : public Const_traits<CurvePoint*> public: typedef deque<CurvePoint*> vertex_container; typedef vertex_container::const_iterator vertex_container_iterator; - typedef SVertex vertex_type; + typedef SVertex vertex_type; }; class CurvePoint_nonconst_traits : public Nonconst_traits<CurvePoint*> @@ -47,7 +47,7 @@ class CurvePoint_nonconst_traits : public Nonconst_traits<CurvePoint*> public: typedef deque<CurvePoint*> vertex_container; typedef vertex_container::iterator vertex_container_iterator; - typedef SVertex vertex_type; + typedef SVertex vertex_type; }; /**********************************/ @@ -325,7 +325,7 @@ protected: } } - virtual void decrement() + virtual void decrement() { if (_Point != 0) { delete _Point; diff --git a/source/blender/freestyle/intern/stroke/CurveIterators.h b/source/blender/freestyle/intern/stroke/CurveIterators.h index d7a79d6e788..cb33221cfd4 100644 --- a/source/blender/freestyle/intern/stroke/CurveIterators.h +++ b/source/blender/freestyle/intern/stroke/CurveIterators.h @@ -35,13 +35,13 @@ namespace Freestyle { namespace CurveInternal { -/*! iterator on a curve. Allows an iterating outside +/*! iterator on a curve. Allows an iterating outside * initial vertices. A CurvePoint is instanciated an returned * when the iterator is dereferenced. */ class CurvePointIterator : public Interface0DIteratorNested -{ +{ public: friend class Freestyle::Curve; diff --git a/source/blender/freestyle/intern/stroke/Operators.cpp b/source/blender/freestyle/intern/stroke/Operators.cpp index dfb50d903f7..151cd29ca07 100644 --- a/source/blender/freestyle/intern/stroke/Operators.cpp +++ b/source/blender/freestyle/intern/stroke/Operators.cpp @@ -704,7 +704,7 @@ static int __recursiveSplit(Chain *_curve, UnaryFunction0D<double>& func, UnaryP if (newId == 0) { newId = new Id(_curve->getId()); _curve->setSplittingId(newId); - } + } Chain *new_curve_a = new Chain(*newId); newId->setSecond(newId->getSecond() + 1); @@ -791,9 +791,9 @@ int Operators::recursiveSplit(UnaryFunction0D<double>& func, UnaryPredicate1D& p if (!splitted_chains.empty()) { for (cit = splitted_chains.begin(), citend = splitted_chains.end(); cit != citend; ++cit) { delete (*cit); - } + } splitted_chains.clear(); - } + } _current_chains_set.clear(); #if 0 @@ -1036,7 +1036,7 @@ static Stroke *createStroke(Interface1D& inter) Vec2r previous = current; SVertex *sv; CurvePoint *cp; - StrokeVertex *stroke_vertex = NULL; + StrokeVertex *stroke_vertex = NULL; bool hasSingularity = false; do { diff --git a/source/blender/freestyle/intern/stroke/Operators.h b/source/blender/freestyle/intern/stroke/Operators.h index c7b0e3f8b81..4130f9b370e 100644 --- a/source/blender/freestyle/intern/stroke/Operators.h +++ b/source/blender/freestyle/intern/stroke/Operators.h @@ -94,7 +94,7 @@ public: * \param pred * The predicate on the ViewEdge that expresses the stopping condition. */ - static int chain(ViewEdgeInternal::ViewEdgeIterator& it, UnaryPredicate1D& pred); + static int chain(ViewEdgeInternal::ViewEdgeIterator& it, UnaryPredicate1D& pred); /*! Builds a set of chains from the current set of ViewEdges. * Each ViewEdge of the current list potentially starts a new chain. The chaining operator then iterates over diff --git a/source/blender/freestyle/intern/stroke/Stroke.h b/source/blender/freestyle/intern/stroke/Stroke.h index c004d73e6fe..83e6a947917 100644 --- a/source/blender/freestyle/intern/stroke/Stroke.h +++ b/source/blender/freestyle/intern/stroke/Stroke.h @@ -564,7 +564,7 @@ public: * \param iBegin * The iterator pointing to the first vertex. * \param iEnd - * The iterator pointing to the end of the vertex list. + * The iterator pointing to the end of the vertex list. */ template<class InputVertexIterator> Stroke(InputVertexIterator iBegin, InputVertexIterator iEnd); @@ -600,7 +600,7 @@ public: * Resamples the curve with a given sampling. * If this sampling is < to the actual sampling value, no resampling is done. * \param iSampling - * The new sampling value. + * The new sampling value. */ int Resample(float iSampling); @@ -608,7 +608,7 @@ public: */ void RemoveAllVertices(); - /*! Removes the stroke vertex iVertex + /*! Removes the stroke vertex iVertex * from the stroke. * The length and curvilinear abscissa are updated * consequently. diff --git a/source/blender/freestyle/intern/stroke/StrokeRenderer.h b/source/blender/freestyle/intern/stroke/StrokeRenderer.h index 868f61224de..054182a558a 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRenderer.h +++ b/source/blender/freestyle/intern/stroke/StrokeRenderer.h @@ -112,7 +112,7 @@ protected: static string _patterns_path; static string _brushes_path; unsigned int _defaultTextureId; - + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:TextureManager") #endif diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.cpp b/source/blender/freestyle/intern/stroke/StrokeRep.cpp index 028127897ff..81ef46e5b3b 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRep.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeRep.cpp @@ -741,7 +741,7 @@ StrokeRep::StrokeRep(Stroke *iStroke) #if 0 _averageTextureAlpha = 0.5; //default value if (_strokeType == OIL_STROKE) - _averageTextureAlpha = 0.75; + _averageTextureAlpha = 0.75; if (_strokeType >= NO_BLEND_STROKE) _averageTextureAlpha = 1.0; #endif diff --git a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h index 02f7177b95c..dd0b945e4d3 100644 --- a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h +++ b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h @@ -28,7 +28,7 @@ // Purpose : Class to define the text rendering of a stroke // Format: // x y width height // bbox -// //list of vertices : +// //list of vertices : // t x y z t1 t2 r g b alpha ... // ... // Date of creation : 01/14/2005 diff --git a/source/blender/freestyle/intern/system/Id.h b/source/blender/freestyle/intern/system/Id.h index 8b028cdb3da..279730f7934 100644 --- a/source/blender/freestyle/intern/system/Id.h +++ b/source/blender/freestyle/intern/system/Id.h @@ -78,7 +78,7 @@ public: _first = iBrother._first; _second = iBrother._second; return *this; - } + } /*! Returns the first Id number */ id_type getFirst() const diff --git a/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp index 3243c4d1fb7..79de3ca497d 100644 --- a/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp +++ b/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp @@ -49,7 +49,7 @@ ArbitraryGridDensityProvider::ArbitraryGridDensityProvider(OccluderSource& sourc } ArbitraryGridDensityProvider::ArbitraryGridDensityProvider(OccluderSource& source, unsigned numCells) -: GridDensityProvider(source), numCells(numCells) +: GridDensityProvider(source), numCells(numCells) { real proscenium[4]; calculateOptimalProscenium(source, proscenium); diff --git a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp index d98a3238a25..ae0d83a3551 100644 --- a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp +++ b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp @@ -199,7 +199,7 @@ void CulledOccluderSource::cullViewEdges(ViewMap& viewMap, bool extensiveFEdgeSe fe = fe->nextEdge(); } - // If bestOccluderTarget was not found inside the occluder proscenium, + // If bestOccluderTarget was not found inside the occluder proscenium, // we need to expand the occluder proscenium to include it. if ((*ve)->isInImage() && bestOccluderTarget != NULL && ! bestOccluderTargetFound) { // Expand occluder proscenium to enclose bestOccluderTarget @@ -249,7 +249,7 @@ void CulledOccluderSource::cullViewEdges(ViewMap& viewMap, bool extensiveFEdgeSe FEdge *festart = (*ve)->fedgeA(); FEdge *fe = festart; do { - // If not (already) visible and center point inside occluder proscenium, + // If not (already) visible and center point inside occluder proscenium, if (!fe->isInImage() && insideProscenium(occluderProscenium, fe->center2d())) { // Use the feature edge for visibility determination fe->setIsInImage(true); diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp index a97e60d5f60..1eeb6805e7d 100644 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp @@ -193,7 +193,7 @@ void FEdgeXDetector::computeCurvatures(WXVertex *vertex) Vec3r e1, n, v; // one vertex curvature info : CurvatureInfo *C; - float radius = _sphereRadius * _meanEdgeSize; + float radius = _sphereRadius * _meanEdgeSize; // view independent stuff if (_computeViewIndependent) { @@ -369,7 +369,7 @@ void FEdgeXDetector::processCreaseShape(WXShape *iWShape) if (!_computeViewIndependent) return; - // Make a pass on the edges to detect the CREASE + // Make a pass on the edges to detect the CREASE vector<WEdge*>::iterator we, weend; vector<WEdge*> &wedges = iWShape->getEdgeList(); for (we = wedges.begin(), weend = wedges.end(); we != weend; ++we) { diff --git a/source/blender/freestyle/intern/view_map/Functions0D.cpp b/source/blender/freestyle/intern/view_map/Functions0D.cpp index f47e5ff16d5..15319e54f66 100644 --- a/source/blender/freestyle/intern/view_map/Functions0D.cpp +++ b/source/blender/freestyle/intern/view_map/Functions0D.cpp @@ -250,7 +250,7 @@ int Curvature2DAngleF0D::operator()(Interface0DIterator& iter) if ((N1.norm() == 0) && (N2.norm() == 0)) { Exception::raiseException(); result = 0; - return -1; + return -1; } double cosin = N1 * N2; if (cosin > 1) diff --git a/source/blender/freestyle/intern/view_map/Functions1D.h b/source/blender/freestyle/intern/view_map/Functions1D.h index d2a5870f27a..f3c8957a804 100644 --- a/source/blender/freestyle/intern/view_map/Functions1D.h +++ b/source/blender/freestyle/intern/view_map/Functions1D.h @@ -101,7 +101,7 @@ public: } /*! The operator (). - * \param inter + * \param inter * The Interface1D on which we wish to evaluate the function. * \return the result of the function of type T. */ diff --git a/source/blender/freestyle/intern/view_map/Silhouette.h b/source/blender/freestyle/intern/view_map/Silhouette.h index 9d373107bfa..44bce375a75 100644 --- a/source/blender/freestyle/intern/view_map/Silhouette.h +++ b/source/blender/freestyle/intern/view_map/Silhouette.h @@ -102,7 +102,7 @@ public: // Implementation of Interface0D return _Point3D.z(); } - /*! Returns the 3D point. */ + /*! Returns the 3D point. */ virtual Vec3r getPoint3D() const { return _Point3D; @@ -126,7 +126,7 @@ public: // Implementation of Interface0D return _Point2D.z(); } - /*! Returns the 2D point. */ + /*! Returns the 2D point. */ virtual Vec2r getPoint2D() const { return Vec2r(_Point2D.x(), _Point2D.y()); @@ -144,16 +144,16 @@ public: // Implementation of Interface0D /*! Returns the nature of the vertex .*/ virtual Nature::VertexNature getNature() const; - /*! Cast the Interface0D in SVertex if it can be. */ + /*! Cast the Interface0D in SVertex if it can be. */ virtual SVertex *castToSVertex(); - /*! Cast the Interface0D in ViewVertex if it can be. */ + /*! Cast the Interface0D in ViewVertex if it can be. */ virtual ViewVertex *castToViewVertex(); - /*! Cast the Interface0D in NonTVertex if it can be. */ + /*! Cast the Interface0D in NonTVertex if it can be. */ virtual NonTVertex *castToNonTVertex(); - /*! Cast the Interface0D in TVertex if it can be. */ + /*! Cast the Interface0D in TVertex if it can be. */ virtual TVertex *castToTVertex(); public: @@ -163,7 +163,7 @@ private: Id _Id; Vec3r _Point3D; Vec3r _Point2D; - set<Vec3r> _Normals; + set<Vec3r> _Normals; vector<FEdge*> _FEdges; // the edges containing this vertex SShape *_Shape; // the shape to which belongs the vertex ViewVertex *_pViewVertex; // The associated viewvertex, in case there is one. @@ -1291,10 +1291,10 @@ protected: unsigned _FrsMaterialIndex; #if 0 bool _hasVisibilityPoint; - Vec3r _VisibilityPointA; // The edge on which the visibility will be computed represented + Vec3r _VisibilityPointA; // The edge on which the visibility will be computed represented Vec3r _VisibilityPointB; // using its 2 extremity points A and B #endif - void *_Face; // In case of exact silhouette, Face is the WFace crossed by Fedge + void *_Face; // In case of exact silhouette, Face is the WFace crossed by Fedge // NOT HANDLED BY THE COPY CONSTRUCTEUR bool _FaceMark; @@ -1418,7 +1418,7 @@ private: const char *_Name; const char *_LibraryPath; BBox<Vec3r> _BBox; - vector<FrsMaterial> _FrsMaterials; + vector<FrsMaterial> _FrsMaterials; float _importance; diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.h b/source/blender/freestyle/intern/view_map/SphericalGrid.h index 5a94a84705d..2310f5ffe2f 100644 --- a/source/blender/freestyle/intern/view_map/SphericalGrid.h +++ b/source/blender/freestyle/intern/view_map/SphericalGrid.h @@ -173,7 +173,7 @@ public: // Accessors: bool orthographicProjection() const; const Vec3r& viewpoint() const; - bool enableQI() const; + bool enableQI() const; private: void getCellCoordinates(const Vec3r& point, unsigned& x, unsigned& y); @@ -317,7 +317,7 @@ inline void SphericalGrid::Iterator::reportDepth(Vec3r origin, Vec3r u, real t) // If the current occluder is the best occludee so far, save it. if (! _foundOccludee || _occludeeDepth > depth) { markCurrentOccludeeCandidate(depth); - } + } } else { #if SPHERICAL_GRID_LOGGING diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp index 4f5b4cba779..34d8ecb3a8d 100644 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp @@ -91,7 +91,7 @@ void SteerableViewMap::Clear() } delete[] _imagesPyramids; _imagesPyramids = 0; - } + } if (!_mapping.empty()) { for (map<unsigned int, double*>::iterator m = _mapping.begin(), mend = _mapping.end(); m != mend; ++m) { delete[] (*m).second; @@ -170,7 +170,7 @@ unsigned SteerableViewMap::getSVMNumber(unsigned id) map<unsigned int, double *>::iterator o = _mapping.find(id); if (o != _mapping.end()) { double *wvalues = (*o).second; - double maxw = 0.0; + double maxw = 0.0; unsigned winner = _nbOrientations + 1; for (unsigned i = 0; i < _nbOrientations; ++i) { double w = wvalues[i]; diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.h b/source/blender/freestyle/intern/view_map/SteerableViewMap.h index 3a660627776..0327b4a460e 100644 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.h +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.h @@ -48,7 +48,7 @@ class FEdge; class ImagePyramid; class GrayImage; -/*! This class checks for every FEdge in which steerable it belongs and stores the mapping allowing to retrieve +/*! This class checks for every FEdge in which steerable it belongs and stores the mapping allowing to retrieve * this information from the FEdge Id. */ class SteerableViewMap diff --git a/source/blender/freestyle/intern/view_map/ViewMap.cpp b/source/blender/freestyle/intern/view_map/ViewMap.cpp index 52769413e79..01a6edad973 100644 --- a/source/blender/freestyle/intern/view_map/ViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMap.cpp @@ -95,7 +95,7 @@ ViewShape *ViewMap::viewShape(unsigned id) void ViewMap::AddViewShape(ViewShape *iVShape) { - _shapeIdToIndex[iVShape->getId().getFirst()] = _VShapes.size(); + _shapeIdToIndex[iVShape->getId().getFirst()] = _VShapes.size(); _VShapes.push_back(iVShape); } @@ -305,13 +305,13 @@ static bool ViewEdgeComp(ViewVertex::directedViewEdge& dve1, ViewVertex::directe if (v1.y() > 0) { if (v2.y() < 0) return true; - else + else return (v1.x() > v2.x()); } else { if (v2.y() > 0) return false; - else + else return (v1.x() < v2.x()); } return false; @@ -387,7 +387,7 @@ void TVertex::setBackEdgeB(ViewEdge *iBackEdgeB, bool incoming) void TVertex::Replace(ViewEdge *iOld, ViewEdge *iNew) { - // theoritically, we only replace edges for which this + // theoritically, we only replace edges for which this // view vertex is the B vertex if ((iOld == _FrontEdgeA.first) && (_FrontEdgeA.first->B() == this)) { _FrontEdgeA.first = iNew; @@ -501,7 +501,7 @@ ViewVertexInternal::orientedViewEdgeIterator TVertex::edgesIterator(ViewEdge *iE /**********************************/ /* */ /* */ -/* NonTVertex */ +/* NonTVertex */ /* */ /* */ /**********************************/ diff --git a/source/blender/freestyle/intern/view_map/ViewMap.h b/source/blender/freestyle/intern/view_map/ViewMap.h index 8b73c8aac3a..06ab3183027 100644 --- a/source/blender/freestyle/intern/view_map/ViewMap.h +++ b/source/blender/freestyle/intern/view_map/ViewMap.h @@ -218,7 +218,7 @@ public: * iB2D * The x,y,z 2D coordinates of the projection of iB3D * iFEdgeB - * The second FEdge + * The second FEdge * id * The id that must be given to that TVertex */ @@ -650,7 +650,7 @@ public: /**********************************/ /* */ /* */ -/* NonTVertex */ +/* NonTVertex */ /* */ /* */ /**********************************/ @@ -1643,7 +1643,7 @@ void ViewShape::SplitEdge(FEdge *fe, const vector<TVertex*>& iViewVertices, vect ViewEdge *vEdge = fe->viewedge(); // We first need to sort the view vertices from farther to closer to fe->vertexA - SVertex *sv, *sv2; + SVertex *sv, *sv2; ViewVertex *vva, *vvb; vector<TVertex*>::const_iterator vv, vvend; for (vv = iViewVertices.begin(), vvend = iViewVertices.end(); vv != vvend; vv++) { @@ -1685,7 +1685,7 @@ void ViewShape::SplitEdge(FEdge *fe, const vector<TVertex*>& iViewVertices, vect if ((vva == 0) || (vvb == 0)) { // that means we're dealing with a closed viewedge (loop) // remove the chain that was starting by the fedge A of vEdge (which is different from fe !!!!) shape->RemoveEdgeFromChain(vEdge->fedgeA()); - // we set + // we set vEdge->setA(*vv); vEdge->setB(*vv); vEdge->setFEdgeA(newEdge); diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp index 794c782bb73..5b7576ccd3d 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp @@ -1004,7 +1004,7 @@ ViewMap *ViewMapBuilder::BuildViewMap(WingedEdge& we, visibility_algo iAlgo, rea computeInitialViewEdges(we); // Detects cusps - computeCusps(_ViewMap); + computeCusps(_ViewMap); // Compute intersections ComputeIntersections(_ViewMap, sweep_line, epsilon); @@ -1059,7 +1059,7 @@ void ViewMapBuilder::CullViewEdges(ViewMap *ioViewMap, real viewProscenium[4], r cout << "Origin: [" << prosceniumOrigin[0] << ", " << prosceniumOrigin[1] << "]"<< endl; } - // A separate occluder proscenium will also be maintained, starting out the same as the viewport proscenium, and + // A separate occluder proscenium will also be maintained, starting out the same as the viewport proscenium, and // expanding as necessary so that it encompasses the center point of at least one feature edge in each retained view // edge. // The occluder proscenium will be used later to cull occluding triangles before they are inserted into the Grid. @@ -1182,7 +1182,7 @@ void ViewMapBuilder::CullViewEdges(ViewMap *ioViewMap, real viewProscenium[4], r FEdge *festart = (*ve)->fedgeA(); FEdge *fe = festart; do { - // If not (already) visible and center point inside occluder proscenium, + // If not (already) visible and center point inside occluder proscenium, if (!fe->isInImage() && insideProscenium(occluderProscenium, fe->center2d())) { // Use the feature edge for visibility determination fe->setIsInImage(true); @@ -2286,7 +2286,7 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi for (fe = ioEdges.begin(), fend = ioEdges.end(); fe != fend; fe++) (*fe)->userdata = NULL; - // list containing the new edges resulting from splitting operations. + // list containing the new edges resulting from splitting operations. vector<FEdge*> newEdges; // retrieve the intersected edges: diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.h b/source/blender/freestyle/intern/view_map/ViewMapBuilder.h index 440ae93c7df..acde3704625 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.h +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.h @@ -159,7 +159,7 @@ public: /*! Builds the scene view map returns the list the view map * it is up to the caller to delete this ViewMap * iWRoot - * The root group node containing the WEdge structured scene + * The root group node containing the WEdge structured scene */ ViewMap *BuildViewMap(WingedEdge& we, visibility_algo iAlgo, real epsilon, const BBox<Vec3r>& bbox, unsigned int sceneNumFaces); @@ -180,7 +180,7 @@ public: /*! Computes the 2D scene silhouette edges visibility * iGrid - * For the Ray Casting algorithm. + * For the Ray Casting algorithm. */ void ComputeEdgesVisibility(ViewMap *ioViewMap, WingedEdge& we, const BBox<Vec3r>& bbox, unsigned int sceneNumFaces, visibility_algo iAlgo = ray_casting, real epsilon = 1.0e-6); diff --git a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp index 71ae68c06bc..3e80c004b5f 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp @@ -284,7 +284,7 @@ static int load(istream& in, FEdge *fe) load(in, v); fesharp->setNormalB(v); - // Materials + // Materials READ(matindex); fesharp->setaFrsMaterialIndex(matindex); READ(matindex); diff --git a/source/blender/freestyle/intern/view_map/ViewMapIterators.h b/source/blender/freestyle/intern/view_map/ViewMapIterators.h index 469c2c3b29c..b10de13cef7 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapIterators.h +++ b/source/blender/freestyle/intern/view_map/ViewMapIterators.h @@ -30,7 +30,7 @@ #include "ViewMap.h" -#include "../system/Iterator.h" //soc +#include "../system/Iterator.h" //soc namespace Freestyle { diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt index e73f227dec8..44ff53cc020 100644 --- a/source/blender/imbuf/CMakeLists.txt +++ b/source/blender/imbuf/CMakeLists.txt @@ -23,7 +23,7 @@ # # ***** END GPL LICENSE BLOCK ***** -set(INC +set(INC . ../blenkernel ../blenlib @@ -83,7 +83,7 @@ set(SRC intern/IMB_filter.h intern/IMB_indexer.h intern/imbuf.h - + # orphan include ../../../intern/ffmpeg/ffmpeg_compat.h ) diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 4289f98643d..75f8df99e63 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -217,7 +217,7 @@ void IMB_blend_color_byte(unsigned char dst[4], unsigned char src1[4], void IMB_blend_color_float(float dst[4], float src1[4], float src2[4], IMB_BlendMode mode); -void IMB_rectclip(struct ImBuf *dbuf, struct ImBuf *sbuf, int *destx, +void IMB_rectclip(struct ImBuf *dbuf, struct ImBuf *sbuf, int *destx, int *desty, int *srcx, int *srcy, int *width, int *height); void IMB_rectcpy(struct ImBuf *drect, struct ImBuf *srect, int destx, int desty, int srcx, int srcy, int width, int height); @@ -322,7 +322,7 @@ int IMB_anim_get_preseek(struct anim *anim); struct ImBuf *IMB_anim_absolute( struct anim *anim, int position, - IMB_Timecode_Type tc /* = 1 = IMB_TC_RECORD_RUN */, + IMB_Timecode_Type tc /* = 1 = IMB_TC_RECORD_RUN */, IMB_Proxy_Size preview_size /* = 0 = IMB_PROXY_NONE */); /** @@ -433,7 +433,7 @@ bool IMB_isfloat(struct ImBuf *ibuf); void IMB_de_interlace(struct ImBuf *ibuf); void IMB_interlace(struct ImBuf *ibuf); -/* create char buffer, color corrected if necessary, for ImBufs that lack one */ +/* create char buffer, color corrected if necessary, for ImBufs that lack one */ void IMB_rect_from_float(struct ImBuf *ibuf); /* Create char buffer for part of the image, color corrected if necessary, * Changed part will be stored in buffer. This is expected to be used for texture painting updates */ diff --git a/source/blender/imbuf/intern/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h index 6fa31e122cc..804095a0727 100644 --- a/source/blender/imbuf/intern/IMB_anim.h +++ b/source/blender/imbuf/intern/IMB_anim.h @@ -103,7 +103,7 @@ struct anim { int frs_sec; double frs_sec_base; int x, y; - + /* for number */ char name[1024]; /* for sequence */ @@ -113,12 +113,12 @@ struct anim { void *movie; void *track; void *params; - int orientation; + int orientation; size_t framesize; int interlacing; int preseek; int streamindex; - + /* avi */ struct _AviMovie *avi; @@ -153,7 +153,7 @@ struct anim { int proxies_tried; int indices_tried; - + struct anim *proxy_anim[IMB_PROXY_MAX_SLOT]; struct anim_index *curr_idx[IMB_TC_MAX_SLOT]; diff --git a/source/blender/imbuf/intern/IMB_indexer.h b/source/blender/imbuf/intern/IMB_indexer.h index bac46740f0f..024801cb870 100644 --- a/source/blender/imbuf/intern/IMB_indexer.h +++ b/source/blender/imbuf/intern/IMB_indexer.h @@ -109,7 +109,7 @@ unsigned long long IMB_indexer_get_seek_pos_dts( struct anim_index *idx, int frameno_index); int IMB_indexer_get_frame_index(struct anim_index *idx, int frameno); -unsigned long long IMB_indexer_get_pts(struct anim_index *idx, +unsigned long long IMB_indexer_get_pts(struct anim_index *idx, int frame_index); int IMB_indexer_get_duration(struct anim_index *idx); diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index faa0b5f7b6e..589955d2ab3 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -106,14 +106,14 @@ void imb_freemipmapImBuf(ImBuf *ibuf) void imb_freerectfloatImBuf(ImBuf *ibuf) { if (ibuf == NULL) return; - + if (ibuf->rect_float && (ibuf->mall & IB_rectfloat)) { MEM_freeN(ibuf->rect_float); ibuf->rect_float = NULL; } imb_freemipmapImBuf(ibuf); - + ibuf->rect_float = NULL; ibuf->mall &= ~IB_rectfloat; } @@ -126,7 +126,7 @@ void imb_freerectImBuf(ImBuf *ibuf) if (ibuf->rect && (ibuf->mall & IB_rect)) MEM_freeN(ibuf->rect); ibuf->rect = NULL; - + imb_freemipmapImBuf(ibuf); ibuf->mall &= ~IB_rect; @@ -266,30 +266,30 @@ ImBuf *IMB_makeSingleUser(ImBuf *ibuf) bool addzbufImBuf(ImBuf *ibuf) { if (ibuf == NULL) return false; - + IMB_freezbufImBuf(ibuf); - + if ((ibuf->zbuf = imb_alloc_pixels(ibuf->x, ibuf->y, 1, sizeof(unsigned int), __func__))) { ibuf->mall |= IB_zbuf; ibuf->flags |= IB_zbuf; return true; } - + return false; } bool addzbuffloatImBuf(ImBuf *ibuf) { if (ibuf == NULL) return false; - + IMB_freezbuffloatImBuf(ibuf); - + if ((ibuf->zbuf_float = imb_alloc_pixels(ibuf->x, ibuf->y, 1, sizeof(float), __func__))) { ibuf->mall |= IB_zbuffloat; ibuf->flags |= IB_zbuffloat; return true; } - + return false; } @@ -372,17 +372,17 @@ void *imb_alloc_pixels(unsigned int x, bool imb_addrectfloatImBuf(ImBuf *ibuf) { if (ibuf == NULL) return false; - + if (ibuf->rect_float) imb_freerectfloatImBuf(ibuf); /* frees mipmap too, hrm */ - + ibuf->channels = 4; if ((ibuf->rect_float = imb_alloc_pixels(ibuf->x, ibuf->y, 4, sizeof(float), __func__))) { ibuf->mall |= IB_rectfloat; ibuf->flags |= IB_rectfloat; return true; } - + return false; } @@ -390,12 +390,12 @@ bool imb_addrectfloatImBuf(ImBuf *ibuf) bool imb_addrectImBuf(ImBuf *ibuf) { if (ibuf == NULL) return false; - + /* don't call imb_freerectImBuf, it frees mipmaps, this call is used only too give float buffers display */ if (ibuf->rect && (ibuf->mall & IB_rect)) MEM_freeN(ibuf->rect); ibuf->rect = NULL; - + if ((ibuf->rect = imb_alloc_pixels(ibuf->x, ibuf->y, 4, sizeof(unsigned char), __func__))) { ibuf->mall |= IB_rect; ibuf->flags |= IB_rect; @@ -511,7 +511,7 @@ ImBuf *IMB_dupImBuf(const ImBuf *ibuf1) ImBuf *ibuf2, tbuf; int flags = 0; int a, x, y; - + if (ibuf1 == NULL) return NULL; if (ibuf1->rect) flags |= IB_rect; @@ -522,13 +522,13 @@ ImBuf *IMB_dupImBuf(const ImBuf *ibuf1) x = ibuf1->x; y = ibuf1->y; if (ibuf1->flags & IB_fields) y *= 2; - + ibuf2 = IMB_allocImBuf(x, y, ibuf1->planes, flags); if (ibuf2 == NULL) return NULL; if (flags & IB_rect) memcpy(ibuf2->rect, ibuf1->rect, ((size_t)x) * y * sizeof(int)); - + if (flags & IB_rectfloat) memcpy(ibuf2->rect_float, ibuf1->rect_float, ((size_t)ibuf1->channels) * x * y * sizeof(float)); @@ -550,7 +550,7 @@ ImBuf *IMB_dupImBuf(const ImBuf *ibuf1) /* silly trick to copy the entire contents of ibuf1 struct over to ibuf */ tbuf = *ibuf1; - + /* fix pointers */ tbuf.rect = ibuf2->rect; tbuf.rect_float = ibuf2->rect_float; @@ -560,7 +560,7 @@ ImBuf *IMB_dupImBuf(const ImBuf *ibuf1) for (a = 0; a < IMB_MIPMAP_LEVELS; a++) tbuf.mipmap[a] = NULL; tbuf.dds_data.data = NULL; - + /* set malloc flag */ tbuf.mall = ibuf2->mall; tbuf.c_handle = NULL; diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index f842b69418e..290226acf78 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -325,7 +325,7 @@ static int startavi(struct anim *anim) if (AVIFileGetStream(anim->pfile, &anim->pavi[i], 0L, i) != AVIERR_OK) { break; } - + AVIStreamInfo(anim->pavi[i], &avis, sizeof(avis)); if ((avis.fccType == streamtypeVIDEO) && (firstvideo == -1)) { if (streamcount > 0) { @@ -382,7 +382,7 @@ static int startavi(struct anim *anim) free_anim_avi(anim); return -1; } - + anim->duration = anim->avi->header->TotalFrames; anim->params = NULL; @@ -407,7 +407,7 @@ static ImBuf *avi_fetchibuf(struct anim *anim, int position) ImBuf *ibuf = NULL; int *tmp; int y; - + if (anim == NULL) { return NULL; } @@ -431,7 +431,7 @@ static ImBuf *avi_fetchibuf(struct anim *anim, int position) tmp = AVI_read_frame(anim->avi, AVI_FORMAT_RGB32, position, AVI_get_stream(anim->avi, AVIST_VIDEO, 0)); - + if (tmp == NULL) { printf("Error reading frame from AVI: '%s'\n", anim->name); IMB_freeImBuf(ibuf); @@ -442,10 +442,10 @@ static ImBuf *avi_fetchibuf(struct anim *anim, int position) memcpy(&(ibuf->rect)[((anim->y - y) - 1) * anim->x], &tmp[y * anim->x], anim->x * 4); } - + MEM_freeN(tmp); } - + ibuf->rect_colorspace = colormanage_colorspace_get_named(anim->colorspace); return ibuf; @@ -619,7 +619,7 @@ static int startffmpeg(struct anim *anim) anim->pCodecCtx->width, anim->pCodecCtx->height), "ffmpeg deinterlace"), - anim->pCodecCtx->pix_fmt, + anim->pCodecCtx->pix_fmt, anim->pCodecCtx->width, anim->pCodecCtx->height); } @@ -630,7 +630,7 @@ static int startffmpeg(struct anim *anim) else { anim->preseek = 0; } - + anim->img_convert_ctx = sws_getContext( anim->x, anim->y, @@ -640,7 +640,7 @@ static int startffmpeg(struct anim *anim) AV_PIX_FMT_RGBA, SWS_FAST_BILINEAR | SWS_PRINT_INFO | SWS_FULL_CHR_H_INT, NULL, NULL, NULL); - + if (!anim->img_convert_ctx) { fprintf(stderr, "Can't transform color space??? Bailing out...\n"); @@ -671,7 +671,7 @@ static int startffmpeg(struct anim *anim) fprintf(stderr, "Warning: Could not set libswscale colorspace details.\n"); } #endif - + return (0); } @@ -691,7 +691,7 @@ static void ffmpeg_postprocess(struct anim *anim) return; } - /* This means the data wasnt read properly, + /* This means the data wasnt read properly, * this check stops crashing */ if (input->data[0] == 0 && input->data[1] == 0 && input->data[2] == 0 && input->data[3] == 0) @@ -701,7 +701,7 @@ static void ffmpeg_postprocess(struct anim *anim) return; } - av_log(anim->pFormatCtx, AV_LOG_DEBUG, + av_log(anim->pFormatCtx, AV_LOG_DEBUG, " POSTPROC: anim->pFrame planes: %p %p %p %p\n", input->data[0], input->data[1], input->data[2], input->data[3]); @@ -738,7 +738,7 @@ static void ffmpeg_postprocess(struct anim *anim) int x, y, h, w; unsigned char *bottom; unsigned char *top; - + sws_scale(anim->img_convert_ctx, (const uint8_t *const *)input->data, input->linesize, @@ -746,31 +746,31 @@ static void ffmpeg_postprocess(struct anim *anim) anim->y, dst2, dstStride2); - + bottom = (unsigned char *) ibuf->rect; top = bottom + ibuf->x * (ibuf->y - 1) * 4; - + h = (ibuf->y + 1) / 2; w = ibuf->x; - + for (y = 0; y < h; y++) { unsigned char tmp[4]; unsigned int *tmp_l = (unsigned int *) tmp; - + for (x = 0; x < w; x++) { tmp[0] = bottom[0]; tmp[1] = bottom[1]; tmp[2] = bottom[2]; tmp[3] = bottom[3]; - + bottom[0] = top[0]; bottom[1] = top[1]; bottom[2] = top[2]; bottom[3] = top[3]; - + *(unsigned int *) top = *tmp_l; - + bottom += 4; top += 4; } @@ -783,7 +783,7 @@ static void ffmpeg_postprocess(struct anim *anim) int dstStride2[4] = { -dstStride[0], 0, 0, 0 }; uint8_t *dst2[4] = { dst[0] + (anim->y - 1) * dstStride[0], 0, 0, 0 }; - + sws_scale(anim->img_convert_ctx, (const uint8_t *const *)input->data, input->linesize, @@ -820,21 +820,21 @@ static int ffmpeg_decode_video_frame(struct anim *anim) av_free_packet(&anim->next_packet); anim->next_packet.stream_index = -1; } - + while ((rval = av_read_frame(anim->pFormatCtx, &anim->next_packet)) >= 0) { - av_log(anim->pFormatCtx, - AV_LOG_DEBUG, + av_log(anim->pFormatCtx, + AV_LOG_DEBUG, "%sREAD: strID=%d (VID: %d) dts=%lld pts=%lld " "%s\n", (anim->next_packet.stream_index == anim->videoStream) ? "->" : " ", - anim->next_packet.stream_index, + anim->next_packet.stream_index, anim->videoStream, (anim->next_packet.dts == AV_NOPTS_VALUE) ? -1 : (long long int)anim->next_packet.dts, (anim->next_packet.pts == AV_NOPTS_VALUE) ? -1 : (long long int)anim->next_packet.pts, - (anim->next_packet.flags & AV_PKT_FLAG_KEY) ? + (anim->next_packet.flags & AV_PKT_FLAG_KEY) ? " KEY" : ""); if (anim->next_packet.stream_index == anim->videoStream) { anim->pFrameComplete = 0; @@ -863,7 +863,7 @@ static int ffmpeg_decode_video_frame(struct anim *anim) av_free_packet(&anim->next_packet); anim->next_packet.stream_index = -1; } - + if (rval == AVERROR_EOF) { /* this sets size and data fields to zero, * which is necessary to decode the remaining data @@ -918,14 +918,14 @@ static void ffmpeg_decode_video_frame_scan( int count = 1000; av_log(anim->pFormatCtx, - AV_LOG_DEBUG, - "SCAN start: considering pts=%lld in search of %lld\n", + AV_LOG_DEBUG, + "SCAN start: considering pts=%lld in search of %lld\n", (long long int)anim->next_pts, (long long int)pts_to_search); while (count > 0 && anim->next_pts < pts_to_search) { av_log(anim->pFormatCtx, - AV_LOG_DEBUG, - " WHILE: pts=%lld in search of %lld\n", + AV_LOG_DEBUG, + " WHILE: pts=%lld in search of %lld\n", (long long int)anim->next_pts, (long long int)pts_to_search); if (!ffmpeg_decode_video_frame(anim)) { break; @@ -934,9 +934,9 @@ static void ffmpeg_decode_video_frame_scan( } if (count == 0) { av_log(anim->pFormatCtx, - AV_LOG_ERROR, + AV_LOG_ERROR, "SCAN failed: completely lost in stream, " - "bailing out at PTS=%lld, searching for PTS=%lld\n", + "bailing out at PTS=%lld, searching for PTS=%lld\n", (long long int)anim->next_pts, (long long int)pts_to_search); } if (anim->next_pts == pts_to_search) { @@ -995,7 +995,7 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, int64_t pts_to_search = 0; double frame_rate; double pts_time_base; - long long st_time; + long long st_time; struct anim_index *tc_index = 0; AVStream *v_st; int new_frame_index = 0; /* To quiet gcc barking... */ @@ -1025,7 +1025,7 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, tc_index, new_frame_index); } else { - pts_to_search = (long long) + pts_to_search = (long long) floor(((double) position) / pts_time_base / frame_rate + 0.5); @@ -1034,29 +1034,29 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, } } - av_log(anim->pFormatCtx, AV_LOG_DEBUG, + av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: looking for PTS=%lld " - "(pts_timebase=%g, frame_rate=%g, st_time=%lld)\n", + "(pts_timebase=%g, frame_rate=%g, st_time=%lld)\n", (long long int)pts_to_search, pts_time_base, frame_rate, st_time); - if (anim->last_frame && + if (anim->last_frame && anim->last_pts <= pts_to_search && anim->next_pts > pts_to_search) { - av_log(anim->pFormatCtx, AV_LOG_DEBUG, + av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: frame repeat: last: %lld next: %lld\n", - (long long int)anim->last_pts, + (long long int)anim->last_pts, (long long int)anim->next_pts); IMB_refImBuf(anim->last_frame); anim->curposition = position; return anim->last_frame; } - + if (position > anim->curposition + 1 && anim->preseek && !tc_index && position - (anim->curposition + 1) < anim->preseek) { - av_log(anim->pFormatCtx, AV_LOG_DEBUG, + av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: within preseek interval (no index)\n"); ffmpeg_decode_video_frame_scan(anim, pts_to_search); @@ -1065,7 +1065,7 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, IMB_indexer_can_scan(tc_index, old_frame_index, new_frame_index)) { - av_log(anim->pFormatCtx, AV_LOG_DEBUG, + av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: within preseek interval " "(index tells us)\n"); @@ -1083,24 +1083,24 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, dts = IMB_indexer_get_seek_pos_dts( tc_index, new_frame_index); - av_log(anim->pFormatCtx, AV_LOG_DEBUG, + av_log(anim->pFormatCtx, AV_LOG_DEBUG, "TC INDEX seek pos = %lld\n", pos); - av_log(anim->pFormatCtx, AV_LOG_DEBUG, + av_log(anim->pFormatCtx, AV_LOG_DEBUG, "TC INDEX seek dts = %llu\n", dts); if (ffmpeg_seek_by_byte(anim->pFormatCtx)) { - av_log(anim->pFormatCtx, AV_LOG_DEBUG, + av_log(anim->pFormatCtx, AV_LOG_DEBUG, "... using BYTE pos\n"); - ret = av_seek_frame(anim->pFormatCtx, + ret = av_seek_frame(anim->pFormatCtx, -1, pos, AVSEEK_FLAG_BYTE); av_update_cur_dts(anim->pFormatCtx, v_st, dts); } else { - av_log(anim->pFormatCtx, AV_LOG_DEBUG, + av_log(anim->pFormatCtx, AV_LOG_DEBUG, "... using DTS pos\n"); - ret = av_seek_frame(anim->pFormatCtx, + ret = av_seek_frame(anim->pFormatCtx, anim->videoStream, dts, AVSEEK_FLAG_BACKWARD); } @@ -1109,22 +1109,22 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, pos = (long long) (position - anim->preseek) * AV_TIME_BASE / frame_rate; - av_log(anim->pFormatCtx, AV_LOG_DEBUG, - "NO INDEX seek pos = %lld, st_time = %lld\n", + av_log(anim->pFormatCtx, AV_LOG_DEBUG, + "NO INDEX seek pos = %lld, st_time = %lld\n", pos, (st_time != AV_NOPTS_VALUE) ? st_time : 0); if (pos < 0) { pos = 0; } - + if (st_time != AV_NOPTS_VALUE) { pos += st_time; } - av_log(anim->pFormatCtx, AV_LOG_DEBUG, + av_log(anim->pFormatCtx, AV_LOG_DEBUG, "NO INDEX final seek pos = %lld\n", pos); - ret = av_seek_frame(anim->pFormatCtx, -1, + ret = av_seek_frame(anim->pFormatCtx, -1, pos, AVSEEK_FLAG_BACKWARD); } @@ -1156,7 +1156,7 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, ffmpeg_decode_video_frame(anim); } else { - av_log(anim->pFormatCtx, AV_LOG_DEBUG, + av_log(anim->pFormatCtx, AV_LOG_DEBUG, "FETCH: no seek necessary, just continue...\n"); } @@ -1167,11 +1167,11 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, ffmpeg_postprocess(anim); anim->last_pts = anim->next_pts; - + ffmpeg_decode_video_frame(anim); - + anim->curposition = position; - + IMB_refImBuf(anim->last_frame); return anim->last_frame; @@ -1275,7 +1275,7 @@ struct ImBuf *IMB_anim_previewframe(struct anim *anim) { struct ImBuf *ibuf = NULL; int position = 0; - + ibuf = IMB_anim_absolute(anim, 0, IMB_TC_NONE, IMB_PROXY_NONE); if (ibuf) { IMB_freeImBuf(ibuf); @@ -1363,7 +1363,7 @@ struct ImBuf *IMB_anim_absolute(struct anim *anim, int position, if (ibuf) { if (filter_y) IMB_filtery(ibuf); BLI_snprintf(ibuf->name, sizeof(ibuf->name), "%s.%04d", anim->name, anim->curposition + 1); - + } return(ibuf); } @@ -1376,7 +1376,7 @@ int IMB_anim_get_duration(struct anim *anim, IMB_Timecode_Type tc) if (tc == IMB_TC_NONE) { return anim->duration; } - + idx = IMB_anim_open_index(anim, tc); if (!idx) { return anim->duration; diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index e63699ea5ba..edaa57eedf2 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -130,7 +130,7 @@ struct ImBuf *imb_bmp_decode(const unsigned char *mem, size_t size, int flags, c unsigned short col; double xppm, yppm; bool top_to_bottom = false; - + (void)size; /* unused */ if (checkbmp(mem) == 0) return(NULL); @@ -248,7 +248,7 @@ struct ImBuf *imb_bmp_decode(const unsigned char *mem, size_t size, int flags, c rect[0] = bmp[2]; rect[1] = bmp[1]; rect[2] = bmp[0]; - + rect[3] = 255; rect += 4; bmp += 3; } @@ -277,7 +277,7 @@ struct ImBuf *imb_bmp_decode(const unsigned char *mem, size_t size, int flags, c ibuf->ppm[1] = yppm; ibuf->ftype = IMB_FTYPE_BMP; } - + return(ibuf); } @@ -297,7 +297,7 @@ static int putShortLSB(unsigned short us, FILE *ofile) { putc((us >> 0) & 0xFF, ofile); return putc((us >> 8) & 0xFF, ofile); -} +} /* Found write info at http://users.ece.gatech.edu/~slabaugh/personal/c/bitmapUnix.c */ int imb_savebmp(struct ImBuf *ibuf, const char *name, int flags) @@ -306,7 +306,7 @@ int imb_savebmp(struct ImBuf *ibuf, const char *name, int flags) size_t bytesize, extrabytes, ptr; uchar *data; FILE *ofile; - + (void)flags; /* unused */ extrabytes = (4 - ibuf->x * 3 % 4) % 4; diff --git a/source/blender/imbuf/intern/cache.c b/source/blender/imbuf/intern/cache.c index 759f8cc82c2..a36d82be7c7 100644 --- a/source/blender/imbuf/intern/cache.c +++ b/source/blender/imbuf/intern/cache.c @@ -280,7 +280,7 @@ static ImGlobalTile *imb_global_cache_get_tile(ImBuf *ibuf, int tx, int ty, ImGl lookuptile.tx = tx; lookuptile.ty = ty; gtile = BLI_ghash_lookup(GLOBAL_CACHE.tilehash, &lookuptile); - + if (gtile) { /* found tile. however it may be in the process of being loaded * by another thread, in that case we do stupid busy loop waiting diff --git a/source/blender/imbuf/intern/cineon/CMakeLists.txt b/source/blender/imbuf/intern/cineon/CMakeLists.txt index c96db4e4a3d..0a3c440d9a7 100644 --- a/source/blender/imbuf/intern/cineon/CMakeLists.txt +++ b/source/blender/imbuf/intern/cineon/CMakeLists.txt @@ -23,7 +23,7 @@ # # ***** END GPL LICENSE BLOCK ***** -set(INC +set(INC . .. ../.. diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c index 1d2ebf88a32..c116d32b2f0 100644 --- a/source/blender/imbuf/intern/cineon/cineon_dpx.c +++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c @@ -106,7 +106,7 @@ static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon printf("DPX/Cineon: saving in memory is not supported.\n"); return 0; } - + logImageSetVerbose((G.debug & G_DEBUG) ? 1 : 0); depth = (ibuf->planes + 7) >> 3; diff --git a/source/blender/imbuf/intern/cineon/logImageCore.c b/source/blender/imbuf/intern/cineon/logImageCore.c index bb72f675cb8..614323d0d11 100644 --- a/source/blender/imbuf/intern/cineon/logImageCore.c +++ b/source/blender/imbuf/intern/cineon/logImageCore.c @@ -917,7 +917,7 @@ static float *getLinToLogLut(LogImageFile *logImage, LogImageElement logElement) float gain, negativeFilmGamma, offset, step; unsigned int lutsize = (unsigned int)(logElement.maxValue + 1); unsigned int i; - + lut = MEM_mallocN(sizeof(float) * lutsize, "getLinToLogLut"); negativeFilmGamma = 0.6; @@ -927,7 +927,7 @@ static float *getLinToLogLut(LogImageFile *logImage, LogImageElement logElement) for (i = 0; i < lutsize; i++) lut[i] = (logImage->referenceWhite + log10f(powf((i + offset) / gain, 1.7f / logImage->gamma)) / (step / negativeFilmGamma)) / logElement.maxValue; - + return lut; } @@ -938,7 +938,7 @@ static float *getLogToLinLut(LogImageFile *logImage, LogImageElement logElement) /* float filmGamma; unused */ unsigned int lutsize = (unsigned int)(logElement.maxValue + 1); unsigned int i; - + lut = MEM_mallocN(sizeof(float) * lutsize, "getLogToLinLut"); /* Building the Log -> Lin LUT */ diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 7c7c3a7ba45..86c0dd69930 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -2448,7 +2448,7 @@ const char *IMB_colormanagement_view_get_default_name(const char *display_name) { ColorManagedDisplay *display = colormanage_display_get_named(display_name); ColorManagedView *view = NULL; - + if (display) view = colormanage_view_get_default(display); diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp index 8e571483e08..170cf620701 100644 --- a/source/blender/imbuf/intern/dds/BlockDXT.cpp +++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp @@ -33,7 +33,7 @@ */ // Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com> -// +// // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without @@ -42,10 +42,10 @@ // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: -// +// // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -71,37 +71,37 @@ uint BlockDXT1::evaluatePalette(Color32 color_array[4]) const color_array[0].g = (col0.g << 2) | (col0.g >> 4); color_array[0].r = (col0.r << 3) | (col0.r >> 2); color_array[0].a = 0xFF; - + // @@ Same as above, but faster? // Color32 c; // c.u = ((col0.u << 3) & 0xf8) | ((col0.u << 5) & 0xfc00) | ((col0.u << 8) & 0xf80000); // c.u |= (c.u >> 5) & 0x070007; // c.u |= (c.u >> 6) & 0x000300; // color_array[0].u = c.u; - + color_array[1].r = (col1.r << 3) | (col1.r >> 2); color_array[1].g = (col1.g << 2) | (col1.g >> 4); color_array[1].b = (col1.b << 3) | (col1.b >> 2); color_array[1].a = 0xFF; - + // @@ Same as above, but faster? // c.u = ((col1.u << 3) & 0xf8) | ((col1.u << 5) & 0xfc00) | ((col1.u << 8) & 0xf80000); // c.u |= (c.u >> 5) & 0x070007; // c.u |= (c.u >> 6) & 0x000300; // color_array[1].u = c.u; - + if ( col0.u > col1.u ) { // Four-color block: derive the other two colors. color_array[2].r = (2 * color_array[0].r + color_array[1].r) / 3; color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3; color_array[2].b = (2 * color_array[0].b + color_array[1].b) / 3; color_array[2].a = 0xFF; - + color_array[3].r = (2 * color_array[1].r + color_array[0].r) / 3; color_array[3].g = (2 * color_array[1].g + color_array[0].g) / 3; color_array[3].b = (2 * color_array[1].b + color_array[0].b) / 3; color_array[3].a = 0xFF; - + return 4; } else { @@ -110,13 +110,13 @@ uint BlockDXT1::evaluatePalette(Color32 color_array[4]) const color_array[2].g = (color_array[0].g + color_array[1].g) / 2; color_array[2].b = (color_array[0].b + color_array[1].b) / 2; color_array[2].a = 0xFF; - + // Set all components to 0 to match DXT specs. color_array[3].r = 0x00; // color_array[2].r; color_array[3].g = 0x00; // color_array[2].g; color_array[3].b = 0x00; // color_array[2].b; color_array[3].a = 0x00; - + return 3; } } @@ -134,7 +134,7 @@ uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const color_array[1].g = (col1.g << 2) | (col1.g >> 4); color_array[1].b = (3 * col1.b * 22) / 8; color_array[1].a = 0xFF; - + int gdiff = color_array[1].g - color_array[0].g; if ( col0.u > col1.u ) { @@ -143,7 +143,7 @@ uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 80) / 256; color_array[2].b = ((2 * col0.b + col1.b) * 22) / 8; color_array[2].a = 0xFF; - + color_array[3].r = ((2 * col1.r + col0.r) * 22) / 8; color_array[3].g = (256 * color_array[1].g - gdiff / 4 + 128 - gdiff * 80) / 256; color_array[3].b = ((2 * col1.b + col0.b) * 22) / 8; @@ -157,13 +157,13 @@ uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 128) / 256; color_array[2].b = ((col0.b + col1.b) * 33) / 8; color_array[2].a = 0xFF; - + // Set all components to 0 to match DXT specs. color_array[3].r = 0x00; // color_array[2].r; color_array[3].g = 0x00; // color_array[2].g; color_array[3].b = 0x00; // color_array[2].b; color_array[3].a = 0x00; - + return 3; } } @@ -175,18 +175,18 @@ void BlockDXT1::evaluatePalette3(Color32 color_array[4]) const color_array[0].g = (col0.g << 2) | (col0.g >> 4); color_array[0].r = (col0.r << 3) | (col0.r >> 2); color_array[0].a = 0xFF; - + color_array[1].r = (col1.r << 3) | (col1.r >> 2); color_array[1].g = (col1.g << 2) | (col1.g >> 4); color_array[1].b = (col1.b << 3) | (col1.b >> 2); color_array[1].a = 0xFF; - + // Three-color block: derive the other color. color_array[2].r = (color_array[0].r + color_array[1].r) / 2; color_array[2].g = (color_array[0].g + color_array[1].g) / 2; color_array[2].b = (color_array[0].b + color_array[1].b) / 2; color_array[2].a = 0xFF; - + // Set all components to 0 to match DXT specs. color_array[3].r = 0x00; // color_array[2].r; color_array[3].g = 0x00; // color_array[2].g; @@ -201,18 +201,18 @@ void BlockDXT1::evaluatePalette4(Color32 color_array[4]) const color_array[0].g = (col0.g << 2) | (col0.g >> 4); color_array[0].r = (col0.r << 3) | (col0.r >> 2); color_array[0].a = 0xFF; - + color_array[1].r = (col1.r << 3) | (col1.r >> 2); color_array[1].g = (col1.g << 2) | (col1.g >> 4); color_array[1].b = (col1.b << 3) | (col1.b >> 2); color_array[1].a = 0xFF; - + // Four-color block: derive the other two colors. color_array[2].r = (2 * color_array[0].r + color_array[1].r) / 3; color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3; color_array[2].b = (2 * color_array[0].b + color_array[1].b) / 3; color_array[2].a = 0xFF; - + color_array[3].r = (2 * color_array[1].r + color_array[0].r) / 3; color_array[3].g = (2 * color_array[1].g + color_array[0].g) / 3; color_array[3].b = (2 * color_array[1].b + color_array[0].b) / 3; @@ -225,7 +225,7 @@ void BlockDXT1::decodeBlock(ColorBlock *block) const // Decode color block. Color32 color_array[4]; evaluatePalette(color_array); - + // Write color block. for ( uint j = 0; j < 4; j++ ) { for ( uint i = 0; i < 4; i++ ) { @@ -281,7 +281,7 @@ void BlockDXT3::decodeBlock(ColorBlock *block) const { // Decode color. color.decodeBlock(block); - + // Decode alpha. alpha.decodeBlock(block); } @@ -419,10 +419,10 @@ void AlphaBlockDXT5::decodeBlock(ColorBlock *block) const { uint8 alpha_array[8]; evaluatePalette(alpha_array); - + uint8 index_array[16]; indices(index_array); - + for (uint i = 0; i < 16; i++) { block->color(i).a = alpha_array[index_array[i]]; } @@ -431,26 +431,26 @@ void AlphaBlockDXT5::decodeBlock(ColorBlock *block) const void AlphaBlockDXT5::flip4() { uint64 * b = (uint64 *)this; - + // @@ The masks might have to be byte swapped. uint64 tmp = (*b & (uint64)(0x000000000000FFFFLL)); tmp |= (*b & (uint64)(0x000000000FFF0000LL)) << 36; tmp |= (*b & (uint64)(0x000000FFF0000000LL)) << 12; tmp |= (*b & (uint64)(0x000FFF0000000000LL)) >> 12; tmp |= (*b & (uint64)(0xFFF0000000000000LL)) >> 36; - + *b = tmp; } void AlphaBlockDXT5::flip2() { uint * b = (uint *)this; - + // @@ The masks might have to be byte swapped. uint tmp = (*b & 0xFF000000); tmp |= (*b & 0x00000FFF) << 12; tmp |= (*b & 0x00FFF000) >> 12; - + *b = tmp; } @@ -458,7 +458,7 @@ void BlockDXT5::decodeBlock(ColorBlock *block) const { // Decode color. color.decodeBlock(block); - + // Decode alpha. alpha.decodeBlock(block); } @@ -467,7 +467,7 @@ void BlockDXT5::decodeBlockNV5x(ColorBlock *block) const { // Decode color. color.decodeBlockNV5x(block); - + // Decode alpha. alpha.decodeBlock(block); } @@ -492,10 +492,10 @@ void BlockATI1::decodeBlock(ColorBlock *block) const { uint8 alpha_array[8]; alpha.evaluatePalette(alpha_array); - + uint8 index_array[16]; alpha.indices(index_array); - + for (uint i = 0; i < 16; i++) { Color32 & c = block->color(i); c.b = c.g = c.r = alpha_array[index_array[i]]; @@ -521,10 +521,10 @@ void BlockATI2::decodeBlock(ColorBlock *block) const { uint8 alpha_array[8]; uint8 index_array[16]; - + x.evaluatePalette(alpha_array); x.indices(index_array); - + for (uint i = 0; i < 16; i++) { Color32 & c = block->color(i); c.r = alpha_array[index_array[i]]; @@ -532,7 +532,7 @@ void BlockATI2::decodeBlock(ColorBlock *block) const y.evaluatePalette(alpha_array); y.indices(index_array); - + for (uint i = 0; i < 16; i++) { Color32 & c = block->color(i); c.g = alpha_array[index_array[i]]; @@ -563,17 +563,17 @@ void BlockCTX1::evaluatePalette(Color32 color_array[4]) const color_array[0].g = col0[1]; color_array[0].r = col0[0]; color_array[0].a = 0xFF; - + color_array[1].r = 0x00; color_array[1].g = col0[1]; color_array[1].b = col1[0]; color_array[1].a = 0xFF; - + color_array[2].r = 0x00; color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3; color_array[2].b = (2 * color_array[0].b + color_array[1].b) / 3; color_array[2].a = 0xFF; - + color_array[3].r = 0x00; color_array[3].g = (2 * color_array[1].g + color_array[0].g) / 3; color_array[3].b = (2 * color_array[1].b + color_array[0].b) / 3; @@ -585,7 +585,7 @@ void BlockCTX1::decodeBlock(ColorBlock *block) const // Decode color block. Color32 color_array[4]; evaluatePalette(color_array); - + // Write color block. for ( uint j = 0; j < 4; j++ ) { for ( uint i = 0; i < 4; i++ ) { diff --git a/source/blender/imbuf/intern/dds/BlockDXT.h b/source/blender/imbuf/intern/dds/BlockDXT.h index 6aae9c9817c..7371d72ea4a 100644 --- a/source/blender/imbuf/intern/dds/BlockDXT.h +++ b/source/blender/imbuf/intern/dds/BlockDXT.h @@ -33,7 +33,7 @@ */ // Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com> -// +// // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without @@ -42,10 +42,10 @@ // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: -// +// // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -79,10 +79,10 @@ struct BlockDXT1 { void evaluatePalette3(Color32 color_array[4]) const; void evaluatePalette4(Color32 color_array[4]) const; - + void decodeBlock(ColorBlock * block) const; void decodeBlockNV5x(ColorBlock * block) const; - + void setIndices(int * idx); void flip4(); @@ -119,9 +119,9 @@ struct AlphaBlockDXT3 { }; uint16 row[4]; }; - + void decodeBlock(ColorBlock * block) const; - + void flip4(); void flip2(); }; @@ -131,10 +131,10 @@ struct AlphaBlockDXT3 { struct BlockDXT3 { AlphaBlockDXT3 alpha; BlockDXT1 color; - + void decodeBlock(ColorBlock * block) const; void decodeBlockNV5x(ColorBlock * block) const; - + void flip4(); void flip2(); }; @@ -187,7 +187,7 @@ struct AlphaBlockDXT5 { uint8 bitsD() const { return (u >> 55) & 0x7LL; } uint8 bitsE() const { return (u >> 58) & 0x7LL; } uint8 bitsF() const { return (u >> 61) & 0x7LL; } - + void evaluatePalette(uint8 alpha[8]) const; void evaluatePalette8(uint8 alpha[8]) const; void evaluatePalette6(uint8 alpha[8]) const; @@ -195,9 +195,9 @@ struct AlphaBlockDXT5 { uint index(uint index) const; void setIndex(uint index, uint value); - + void decodeBlock(ColorBlock * block) const; - + void flip4(); void flip2(); }; @@ -207,10 +207,10 @@ struct AlphaBlockDXT5 { struct BlockDXT5 { AlphaBlockDXT5 alpha; BlockDXT1 color; - + void decodeBlock(ColorBlock * block) const; void decodeBlockNV5x(ColorBlock * block) const; - + void flip4(); void flip2(); }; @@ -218,9 +218,9 @@ struct BlockDXT5 { /// ATI1 block. struct BlockATI1 { AlphaBlockDXT5 alpha; - + void decodeBlock(ColorBlock * block) const; - + void flip4(); void flip2(); }; @@ -229,9 +229,9 @@ struct BlockATI1 { struct BlockATI2 { AlphaBlockDXT5 x; AlphaBlockDXT5 y; - + void decodeBlock(ColorBlock * block) const; - + void flip4(); void flip2(); }; @@ -249,7 +249,7 @@ struct BlockCTX1 { void setIndices(int * idx); void decodeBlock(ColorBlock * block) const; - + void flip4(); void flip2(); }; diff --git a/source/blender/imbuf/intern/dds/CMakeLists.txt b/source/blender/imbuf/intern/dds/CMakeLists.txt index 57603725ce1..8c95695f356 100644 --- a/source/blender/imbuf/intern/dds/CMakeLists.txt +++ b/source/blender/imbuf/intern/dds/CMakeLists.txt @@ -19,11 +19,11 @@ # # The Original Code is: all of this file. # -# Contributor(s): +# Contributor(s): # # ***** END GPL LICENSE BLOCK ***** -set(INC +set(INC . .. ../.. diff --git a/source/blender/imbuf/intern/dds/Color.h b/source/blender/imbuf/intern/dds/Color.h index 6676057d710..51939a6ea4c 100644 --- a/source/blender/imbuf/intern/dds/Color.h +++ b/source/blender/imbuf/intern/dds/Color.h @@ -69,7 +69,7 @@ public: operator unsigned int () const { return u; } - + union { struct { unsigned char b, g, r, a; @@ -85,7 +85,7 @@ public: Color16() { } Color16(const Color16 & c) : u(c.u) { } explicit Color16(unsigned short U) : u(U) { } - + union { struct { unsigned short b : 5; diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp index dd4ae3e518e..2cee4c984dd 100644 --- a/source/blender/imbuf/intern/dds/ColorBlock.cpp +++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp @@ -44,14 +44,14 @@ { return c.r + c.g + c.b; } - + // Get the euclidean distance between the given colors. inline static uint colorDistance(Color32 c0, Color32 c1) { return (c0.r - c1.r) * (c0.r - c1.r) + (c0.g - c1.g) * (c0.g - c1.g) + (c0.b - c1.b) * (c0.b - c1.b); } #endif - + /// Default constructor. ColorBlock::ColorBlock() @@ -120,11 +120,11 @@ void ColorBlock::init(uint w, uint h, const float *data, uint x, uint y) for (uint i = 0; i < 4; i++) { const uint by = i % bh; - + for (uint e = 0; e < 4; e++) { const uint bx = e % bw; const uint idx = ((y + by) * w + x + bx); - + Color32 & c = color(e, i); c.r = uint8(255 * CLAMP(data[idx + 0 * srcPlane], 0.0f, 1.0f)); // @@ Is this the right way to quantize floats to bytes? c.g = uint8(255 * CLAMP(data[idx + 1 * srcPlane], 0.0f, 1.0f)); @@ -160,13 +160,13 @@ void ColorBlock::swizzle(uint x, uint y, uint z, uint w) bool ColorBlock::isSingleColor(Color32 mask/*= Color32(0xFF, 0xFF, 0xFF, 0x00)*/) const { uint u = m_color[0].u & mask.u; - + for (int i = 1; i < 16; i++) { if (u != (m_color[i].u & mask.u)) { return false; } } - + return true; } @@ -191,7 +191,7 @@ bool ColorBlock::isSingleColorNoAlpha() const return false; } } - + return true; } */ @@ -210,12 +210,12 @@ bool ColorBlock::isSingleColorNoAlpha() const unique = false; } } - + if ( unique ) { count++; } } - + return count; }*/ @@ -231,7 +231,7 @@ Color32 ColorBlock::averageColor() const b += m_color[i].b; a += m_color[i].a; } - + return Color32(uint8(r / 16), uint8(g / 16), uint8(b / 16), uint8(a / 16)); }*/ @@ -251,7 +251,7 @@ void ColorBlock::diameterRange(Color32 *start, Color32 *end) const { Color32 c0, c1; uint best_dist = 0; - + for (int i = 0; i < 16; i++) { for (int j = i+1; j < 16; j++) { uint dist = colorDistance(m_color[i], m_color[j]); @@ -262,7 +262,7 @@ void ColorBlock::diameterRange(Color32 *start, Color32 *end) const } } } - + *start = c0; *end = c1; } @@ -272,13 +272,13 @@ void ColorBlock::luminanceRange(Color32 *start, Color32 *end) const { Color32 minColor, maxColor; uint minLuminance, maxLuminance; - + maxLuminance = minLuminance = colorLuminance(m_color[0]); - + for (uint i = 1; i < 16; i++) { uint luminance = colorLuminance(m_color[i]); - + if (luminance > maxLuminance) { maxLuminance = luminance; maxColor = m_color[i]; @@ -293,7 +293,7 @@ void ColorBlock::luminanceRange(Color32 *start, Color32 *end) const *end = maxColor; } -/// Get color range based on the bounding box. +/// Get color range based on the bounding box. void ColorBlock::boundsRange(Color32 *start, Color32 *end) const { Color32 minColor(255, 255, 255); @@ -327,7 +327,7 @@ void ColorBlock::boundsRange(Color32 *start, Color32 *end) const *end = maxColor; } -/// Get color range based on the bounding box. +/// Get color range based on the bounding box. void ColorBlock::boundsRangeAlpha(Color32 *start, Color32 *end) const { Color32 minColor(255, 255, 255, 255); @@ -361,7 +361,7 @@ void ColorBlock::boundsRangeAlpha(Color32 *start, Color32 *end) const maxColor.g = (maxColor.g >= inset.g) ? maxColor.g - inset.g : 0; maxColor.b = (maxColor.b >= inset.b) ? maxColor.b - inset.b : 0; maxColor.a = (maxColor.a >= inset.a) ? maxColor.a - inset.a : 0; - + *start = minColor; *end = maxColor; } @@ -374,10 +374,10 @@ void ColorBlock::sortColorsByAbsoluteValue() for ( uint a = 0; a < 16; a++ ) { uint max = a; Color16 cmax(m_color[a]); - + for ( uint b = a+1; b < 16; b++ ) { Color16 cb(m_color[b]); - + if ( cb.u > cmax.u ) { max = b; cmax = cb; @@ -391,17 +391,17 @@ void ColorBlock::sortColorsByAbsoluteValue() /*/// Find extreme colors in the given axis. void ColorBlock::computeRange(Vector3::Arg axis, Color32 *start, Color32 *end) const { - + int mini, maxi; mini = maxi = 0; - + float min, max; min = max = dot(Vector3(m_color[0].r, m_color[0].g, m_color[0].b), axis); for (uint i = 1; i < 16; i++) { const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b); - + float val = dot(vec, axis); if ( val < min ) { mini = i; @@ -412,7 +412,7 @@ void ColorBlock::computeRange(Vector3::Arg axis, Color32 *start, Color32 *end) c max = val; } } - + *start = m_color[mini]; *end = m_color[maxi]; }*/ @@ -422,12 +422,12 @@ void ColorBlock::computeRange(Vector3::Arg axis, Color32 *start, Color32 *end) c void ColorBlock::sortColors(const Vector3 & axis) { float luma_array[16]; - + for (uint i = 0; i < 16; i++) { const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b); luma_array[i] = dot(vec, axis); } - + // Dummy selection sort. for ( uint a = 0; a < 16; a++ ) { uint min = a; @@ -447,12 +447,12 @@ float ColorBlock::volume() const { Box bounds; bounds.clearBounds(); - + for (int i = 0; i < 16; i++) { const Vector3 point(m_color[i].r, m_color[i].g, m_color[i].b); bounds.addPointToBounds(point); } - + return bounds.volume(); } */ diff --git a/source/blender/imbuf/intern/dds/ColorBlock.h b/source/blender/imbuf/intern/dds/ColorBlock.h index 8d5031aa603..7b5291cf976 100644 --- a/source/blender/imbuf/intern/dds/ColorBlock.h +++ b/source/blender/imbuf/intern/dds/ColorBlock.h @@ -46,30 +46,30 @@ struct ColorBlock { ColorBlock(const uint * linearImage); ColorBlock(const ColorBlock & block); ColorBlock(const Image * img, uint x, uint y); - + void init(const Image * img, uint x, uint y); void init(uint w, uint h, const uint * data, uint x, uint y); void init(uint w, uint h, const float * data, uint x, uint y); - + void swizzle(uint x, uint y, uint z, uint w); // 0=r, 1=g, 2=b, 3=a, 4=0xFF, 5=0 - + bool isSingleColor(Color32 mask = Color32(0xFF, 0xFF, 0xFF, 0x00)) const; bool hasAlpha() const; - - + + // Accessors const Color32 * colors() const; Color32 color(uint i) const; Color32 & color(uint i); - + Color32 color(uint x, uint y) const; Color32 & color(uint x, uint y); - + private: - + Color32 m_color[4 * 4]; - + }; diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp index 7c11fca3c34..97ce5b90fa0 100644 --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp @@ -33,7 +33,7 @@ */ // Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com> -// +// // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without @@ -42,10 +42,10 @@ // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: -// +// // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -84,7 +84,7 @@ static const uint FOURCC_ATI1 = DDS_MAKEFOURCC('A', 'T', 'I', '1'); static const uint FOURCC_ATI2 = DDS_MAKEFOURCC('A', 'T', 'I', '2'); //static const uint FOURCC_A2XY = DDS_MAKEFOURCC('A', '2', 'X', 'Y'); - + static const uint FOURCC_DX10 = DDS_MAKEFOURCC('D', 'X', '1', '0'); static const uint FOURCC_UVER = DDS_MAKEFOURCC('U', 'V', 'E', 'R'); @@ -112,7 +112,7 @@ static const uint D3DFMT_A2R10G10B10 = 35; // Palette formats. //static const uint D3DFMT_A8P8 = 40; //static const uint D3DFMT_P8 = 41; - + // Luminance formats. static const uint D3DFMT_L8 = 50; //static const uint D3DFMT_A8L8 = 51; @@ -126,7 +126,7 @@ static const uint D3DFMT_L16 = 81; //static const uint D3DFMT_R32F = 114; //static const uint D3DFMT_G32R32F = 115; //static const uint D3DFMT_A32B32G32R32F = 116; - + static const uint DDSD_CAPS = 0x00000001U; static const uint DDSD_PIXELFORMAT = 0x00001000U; static const uint DDSD_WIDTH = 0x00000004U; @@ -135,7 +135,7 @@ static const uint DDSD_PITCH = 0x00000008U; static const uint DDSD_MIPMAPCOUNT = 0x00020000U; static const uint DDSD_LINEARSIZE = 0x00080000U; static const uint DDSD_DEPTH = 0x00800000U; - + static const uint DDSCAPS_COMPLEX = 0x00000008U; static const uint DDSCAPS_TEXTURE = 0x00001000U; static const uint DDSCAPS_MIPMAP = 0x00400000U; @@ -162,78 +162,78 @@ static const uint DDPF_LUMINANCE = 0x00020000U; static const uint DDPF_ALPHAPREMULT = 0x00008000U; // Custom NVTT flags. -static const uint DDPF_NORMAL = 0x80000000U; +static const uint DDPF_NORMAL = 0x80000000U; static const uint DDPF_SRGB = 0x40000000U; // DX10 formats. enum DXGI_FORMAT { DXGI_FORMAT_UNKNOWN = 0, - + DXGI_FORMAT_R32G32B32A32_TYPELESS = 1, DXGI_FORMAT_R32G32B32A32_FLOAT = 2, DXGI_FORMAT_R32G32B32A32_UINT = 3, DXGI_FORMAT_R32G32B32A32_SINT = 4, - + DXGI_FORMAT_R32G32B32_TYPELESS = 5, DXGI_FORMAT_R32G32B32_FLOAT = 6, DXGI_FORMAT_R32G32B32_UINT = 7, DXGI_FORMAT_R32G32B32_SINT = 8, - + DXGI_FORMAT_R16G16B16A16_TYPELESS = 9, DXGI_FORMAT_R16G16B16A16_FLOAT = 10, DXGI_FORMAT_R16G16B16A16_UNORM = 11, DXGI_FORMAT_R16G16B16A16_UINT = 12, DXGI_FORMAT_R16G16B16A16_SNORM = 13, DXGI_FORMAT_R16G16B16A16_SINT = 14, - + DXGI_FORMAT_R32G32_TYPELESS = 15, DXGI_FORMAT_R32G32_FLOAT = 16, DXGI_FORMAT_R32G32_UINT = 17, DXGI_FORMAT_R32G32_SINT = 18, - + DXGI_FORMAT_R32G8X24_TYPELESS = 19, DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20, DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21, DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22, - + DXGI_FORMAT_R10G10B10A2_TYPELESS = 23, DXGI_FORMAT_R10G10B10A2_UNORM = 24, DXGI_FORMAT_R10G10B10A2_UINT = 25, - + DXGI_FORMAT_R11G11B10_FLOAT = 26, - + DXGI_FORMAT_R8G8B8A8_TYPELESS = 27, DXGI_FORMAT_R8G8B8A8_UNORM = 28, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29, DXGI_FORMAT_R8G8B8A8_UINT = 30, DXGI_FORMAT_R8G8B8A8_SNORM = 31, DXGI_FORMAT_R8G8B8A8_SINT = 32, - + DXGI_FORMAT_R16G16_TYPELESS = 33, DXGI_FORMAT_R16G16_FLOAT = 34, DXGI_FORMAT_R16G16_UNORM = 35, DXGI_FORMAT_R16G16_UINT = 36, DXGI_FORMAT_R16G16_SNORM = 37, DXGI_FORMAT_R16G16_SINT = 38, - + DXGI_FORMAT_R32_TYPELESS = 39, DXGI_FORMAT_D32_FLOAT = 40, DXGI_FORMAT_R32_FLOAT = 41, DXGI_FORMAT_R32_UINT = 42, DXGI_FORMAT_R32_SINT = 43, - + DXGI_FORMAT_R24G8_TYPELESS = 44, DXGI_FORMAT_D24_UNORM_S8_UINT = 45, DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46, DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47, - + DXGI_FORMAT_R8G8_TYPELESS = 48, DXGI_FORMAT_R8G8_UNORM = 49, DXGI_FORMAT_R8G8_UINT = 50, DXGI_FORMAT_R8G8_SNORM = 51, DXGI_FORMAT_R8G8_SINT = 52, - + DXGI_FORMAT_R16_TYPELESS = 53, DXGI_FORMAT_R16_FLOAT = 54, DXGI_FORMAT_D16_UNORM = 55, @@ -241,41 +241,41 @@ static const uint DDPF_SRGB = 0x40000000U; DXGI_FORMAT_R16_UINT = 57, DXGI_FORMAT_R16_SNORM = 58, DXGI_FORMAT_R16_SINT = 59, - + DXGI_FORMAT_R8_TYPELESS = 60, DXGI_FORMAT_R8_UNORM = 61, DXGI_FORMAT_R8_UINT = 62, DXGI_FORMAT_R8_SNORM = 63, DXGI_FORMAT_R8_SINT = 64, DXGI_FORMAT_A8_UNORM = 65, - + DXGI_FORMAT_R1_UNORM = 66, - + DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67, - + DXGI_FORMAT_R8G8_B8G8_UNORM = 68, DXGI_FORMAT_G8R8_G8B8_UNORM = 69, - + DXGI_FORMAT_BC1_TYPELESS = 70, DXGI_FORMAT_BC1_UNORM = 71, DXGI_FORMAT_BC1_UNORM_SRGB = 72, - + DXGI_FORMAT_BC2_TYPELESS = 73, DXGI_FORMAT_BC2_UNORM = 74, DXGI_FORMAT_BC2_UNORM_SRGB = 75, - + DXGI_FORMAT_BC3_TYPELESS = 76, DXGI_FORMAT_BC3_UNORM = 77, DXGI_FORMAT_BC3_UNORM_SRGB = 78, - + DXGI_FORMAT_BC4_TYPELESS = 79, DXGI_FORMAT_BC4_UNORM = 80, DXGI_FORMAT_BC4_SNORM = 81, - + DXGI_FORMAT_BC5_TYPELESS = 82, DXGI_FORMAT_BC5_UNORM = 83, DXGI_FORMAT_BC5_SNORM = 84, - + DXGI_FORMAT_B5G6R5_UNORM = 85, DXGI_FORMAT_B5G5R5A1_UNORM = 86, DXGI_FORMAT_B8G8R8A8_UNORM = 87, @@ -312,71 +312,71 @@ static const uint DDPF_SRGB = 0x40000000U; switch (dxgiFormat) { CASE(UNKNOWN); - + CASE(R32G32B32A32_TYPELESS); CASE(R32G32B32A32_FLOAT); CASE(R32G32B32A32_UINT); CASE(R32G32B32A32_SINT); - + CASE(R32G32B32_TYPELESS); CASE(R32G32B32_FLOAT); CASE(R32G32B32_UINT); CASE(R32G32B32_SINT); - + CASE(R16G16B16A16_TYPELESS); CASE(R16G16B16A16_FLOAT); CASE(R16G16B16A16_UNORM); CASE(R16G16B16A16_UINT); CASE(R16G16B16A16_SNORM); CASE(R16G16B16A16_SINT); - + CASE(R32G32_TYPELESS); CASE(R32G32_FLOAT); CASE(R32G32_UINT); CASE(R32G32_SINT); - + CASE(R32G8X24_TYPELESS); CASE(D32_FLOAT_S8X24_UINT); CASE(R32_FLOAT_X8X24_TYPELESS); CASE(X32_TYPELESS_G8X24_UINT); - + CASE(R10G10B10A2_TYPELESS); CASE(R10G10B10A2_UNORM); CASE(R10G10B10A2_UINT); - + CASE(R11G11B10_FLOAT); - + CASE(R8G8B8A8_TYPELESS); CASE(R8G8B8A8_UNORM); CASE(R8G8B8A8_UNORM_SRGB); CASE(R8G8B8A8_UINT); CASE(R8G8B8A8_SNORM); CASE(R8G8B8A8_SINT); - + CASE(R16G16_TYPELESS); CASE(R16G16_FLOAT); CASE(R16G16_UNORM); CASE(R16G16_UINT); CASE(R16G16_SNORM); CASE(R16G16_SINT); - + CASE(R32_TYPELESS); CASE(D32_FLOAT); CASE(R32_FLOAT); CASE(R32_UINT); CASE(R32_SINT); - + CASE(R24G8_TYPELESS); CASE(D24_UNORM_S8_UINT); CASE(R24_UNORM_X8_TYPELESS); CASE(X24_TYPELESS_G8_UINT); - + CASE(R8G8_TYPELESS); CASE(R8G8_UNORM); CASE(R8G8_UINT); CASE(R8G8_SNORM); CASE(R8G8_SINT); - + CASE(R16_TYPELESS); CASE(R16_FLOAT); CASE(D16_UNORM); @@ -384,7 +384,7 @@ static const uint DDPF_SRGB = 0x40000000U; CASE(R16_UINT); CASE(R16_SNORM); CASE(R16_SINT); - + CASE(R8_TYPELESS); CASE(R8_UNORM); CASE(R8_UINT); @@ -393,28 +393,28 @@ static const uint DDPF_SRGB = 0x40000000U; CASE(A8_UNORM); CASE(R1_UNORM); - + CASE(R9G9B9E5_SHAREDEXP); - + CASE(R8G8_B8G8_UNORM); CASE(G8R8_G8B8_UNORM); CASE(BC1_TYPELESS); CASE(BC1_UNORM); CASE(BC1_UNORM_SRGB); - + CASE(BC2_TYPELESS); CASE(BC2_UNORM); CASE(BC2_UNORM_SRGB); - + CASE(BC3_TYPELESS); CASE(BC3_UNORM); CASE(BC3_UNORM_SRGB); - + CASE(BC4_TYPELESS); CASE(BC4_UNORM); CASE(BC4_SNORM); - + CASE(BC5_TYPELESS); CASE(BC5_UNORM); CASE(BC5_SNORM); @@ -424,12 +424,12 @@ static const uint DDPF_SRGB = 0x40000000U; CASE(B8G8R8A8_UNORM); CASE(B8G8R8X8_UNORM); - default: + default: return "UNKNOWN"; } #undef CASE } - + static const char * getD3d10ResourceDimensionString(D3D10_RESOURCE_DIMENSION resourceDimension) { switch (resourceDimension) @@ -686,7 +686,7 @@ void DDSHeader::setFormatCode(uint32 code) // set fourcc pixel format. this->pf.flags = DDPF_FOURCC; this->pf.fourcc = code; - + this->pf.bitcount = 0; this->pf.rmask = 0; this->pf.gmask = 0; @@ -803,7 +803,7 @@ void DDSHeader::swapBytes() this->pitch = POSH_LittleU32(this->pitch); this->depth = POSH_LittleU32(this->depth); this->mipmapcount = POSH_LittleU32(this->mipmapcount); - + for (int i = 0; i < 11; i++) { this->reserved[i] = POSH_LittleU32(this->reserved[i]); } @@ -898,12 +898,12 @@ bool DirectDrawSurface::isValid() const { return false; } - + const uint required = (DDSD_WIDTH|DDSD_HEIGHT/*|DDSD_CAPS|DDSD_PIXELFORMAT*/); if ( (header.flags & required) != required ) { return false; } - + if (header.pf.size != 32) { return false; } @@ -958,20 +958,20 @@ bool DirectDrawSurface::isSupported() const { return false; } - + if (isTextureCube() && (header.caps.caps2 & DDSCAPS2_CUBEMAP_ALL_FACES) != DDSCAPS2_CUBEMAP_ALL_FACES) { // Cubemaps must contain all faces. return false; } - + if (isTexture3D()) { // @@ 3D textures not supported yet. return false; } } - + return true; } @@ -980,14 +980,14 @@ bool DirectDrawSurface::hasAlpha() const if (header.hasDX10Header()) { /* TODO: Update hasAlpha to handle all DX10 formats. */ - return + return header.header10.dxgiFormat == DXGI_FORMAT_BC1_UNORM || header.header10.dxgiFormat == DXGI_FORMAT_BC2_UNORM || header.header10.dxgiFormat == DXGI_FORMAT_BC3_UNORM; } else { - if (header.pf.flags & DDPF_RGB) + if (header.pf.flags & DDPF_RGB) { return header.pf.amask != 0; } @@ -1096,19 +1096,19 @@ void DirectDrawSurface::setUserVersion(int version) void DirectDrawSurface::mipmap(Image *img, uint face, uint mipmap) { stream.seek(offset(face, mipmap)); - + uint w = width(); uint h = height(); - + // Compute width and height. for (uint m = 0; m < mipmap; m++) { w = MAX(1U, w / 2); h = MAX(1U, h / 2); } - + img->allocate(w, h); - + if (hasAlpha()) { img->setFormat(Image::Format_ARGB); @@ -1125,7 +1125,7 @@ void DirectDrawSurface::mipmap(Image *img, uint face, uint mipmap) } else { - if (header.pf.flags & DDPF_RGB) + if (header.pf.flags & DDPF_RGB) { readLinearImage(img); } @@ -1161,19 +1161,19 @@ void* DirectDrawSurface::readData(uint &rsize) void DirectDrawSurface::readLinearImage(Image *img) { - + const uint w = img->width(); const uint h = img->height(); - + uint rshift, rsize; PixelFormat::maskShiftAndSize(header.pf.rmask, &rshift, &rsize); - + uint gshift, gsize; PixelFormat::maskShiftAndSize(header.pf.gmask, &gshift, &gsize); - + uint bshift, bsize; PixelFormat::maskShiftAndSize(header.pf.bmask, &bshift, &bsize); - + uint ashift, asize; PixelFormat::maskShiftAndSize(header.pf.amask, &ashift, &asize); @@ -1210,19 +1210,19 @@ void DirectDrawSurface::readBlockImage(Image *img) const uint w = img->width(); const uint h = img->height(); - + const uint bw = (w + 3) / 4; const uint bh = (h + 3) / 4; - + for (uint by = 0; by < bh; by++) { for (uint bx = 0; bx < bw; bx++) { ColorBlock block; - + // Read color block. readBlock(&block); - + // Write color block. for (uint y = 0; y < MIN(4U, h-4*by); y++) { @@ -1242,7 +1242,7 @@ static Color32 buildNormal(uint8 x, uint8 y) float nz = 0.0f; if (1 - nx*nx - ny*ny > 0) nz = sqrt(1 - nx*nx - ny*ny); uint8 z = CLAMP(int(255.0f * (nz + 1) / 2.0f), 0, 255); - + return Color32(x, y, z); } @@ -1282,7 +1282,7 @@ void DirectDrawSurface::readBlock(ColorBlock *rgba) BlockDXT5 block; mem_read(stream, block); block.decodeBlock(rgba); - + if (fourcc == FOURCC_RXGB) { // Swap R & A. @@ -1307,7 +1307,7 @@ void DirectDrawSurface::readBlock(ColorBlock *rgba) mem_read(stream, block); block.decodeBlock(rgba); } - + // If normal flag set, convert to normal. if (header.pf.flags & DDPF_NORMAL) { @@ -1377,7 +1377,7 @@ uint DirectDrawSurface::mipmapSize(uint mipmap) const uint w = width(); uint h = height(); uint d = depth(); - + for (uint m = 0; m < mipmap; m++) { w = MAX(1U, w / 2); @@ -1408,19 +1408,19 @@ uint DirectDrawSurface::faceSize() const { const uint count = mipmapCount(); uint size = 0; - + for (uint m = 0; m < count; m++) { size += mipmapSize(m); } - + return size; } uint DirectDrawSurface::offset(const uint face, const uint mipmap) { uint size = 128; // sizeof(DDSHeader); - + if (header.hasDX10Header()) { size += 20; // sizeof(DDSHeader10); @@ -1430,12 +1430,12 @@ uint DirectDrawSurface::offset(const uint face, const uint mipmap) { size += face * faceSize(); } - + for (uint m = 0; m < mipmap; m++) { size += mipmapSize(m); } - + return size; } @@ -1458,7 +1458,7 @@ void DirectDrawSurface::printInfo() const if (header.flags & DDSD_PITCH) printf("Pitch: %u\n", header.pitch); else if (header.flags & DDSD_LINEARSIZE) printf("Linear size: %u\n", header.pitch); printf("Mipmap count: %u\n", header.mipmapcount); - + printf("Pixel Format:\n"); printf("\tFlags: 0x%.8X\n", header.pf.flags); if (header.pf.flags & DDPF_RGB) printf("\t\tDDPF_RGB\n"); @@ -1472,7 +1472,7 @@ void DirectDrawSurface::printInfo() const if (header.pf.flags & DDPF_PALETTEINDEXED8) printf("\t\tDDPF_PALETTEINDEXED8\n"); if (header.pf.flags & DDPF_ALPHAPREMULT) printf("\t\tDDPF_ALPHAPREMULT\n"); if (header.pf.flags & DDPF_NORMAL) printf("\t\tDDPF_NORMAL\n"); - + if (header.pf.fourcc != 0) { // Display fourcc code even when DDPF_FOURCC flag not set. printf("\tFourCC: '%c%c%c%c' (0x%.8X)\n", @@ -1541,7 +1541,7 @@ void DirectDrawSurface::printInfo() const int major = (header.reserved[10] >> 16) & 0xFF; int minor = (header.reserved[10] >> 8) & 0xFF; int revision= header.reserved[10] & 0xFF; - + printf("Version:\n"); printf("\tNVIDIA Texture Tools %d.%d.%d\n", major, minor, revision); } diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.h b/source/blender/imbuf/intern/dds/DirectDrawSurface.h index 44c27a98c1d..b7bcb8303bf 100644 --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.h +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.h @@ -33,7 +33,7 @@ */ // Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com> -// +// // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without @@ -42,10 +42,10 @@ // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: -// +// // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -109,7 +109,7 @@ struct DDSHeader { // Helper methods. DDSHeader(); - + void setWidth(uint w); void setHeight(uint h); void setDepth(uint d); @@ -128,9 +128,9 @@ struct DDSHeader { void setSrgbFlag(bool b); void setHasAlphaFlag(bool b); void setUserVersion(int version); - + /*void swapBytes();*/ - + bool hasDX10Header() const; uint signature() const; uint toolVersion() const; @@ -147,12 +147,12 @@ class DirectDrawSurface public: DirectDrawSurface(unsigned char *mem, uint size); ~DirectDrawSurface(); - + bool isValid() const; bool isSupported() const; bool hasAlpha() const; - + uint mipmapCount() const; uint fourCC() const; uint width() const; @@ -166,26 +166,26 @@ public: void setNormalFlag(bool b); void setHasAlphaFlag(bool b); void setUserVersion(int version); - + void mipmap(Image *img, uint f, uint m); void *readData(uint &size); // void mipmap(FloatImage *img, uint f, uint m); - + void printInfo() const; private: - + uint blockSize() const; uint faceSize() const; uint mipmapSize(uint m) const; - + uint offset(uint f, uint m); - + void readLinearImage(Image * img); void readBlockImage(Image * img); void readBlock(ColorBlock * rgba); - - + + private: Stream stream; // memory where DDS file resides DDSHeader header; diff --git a/source/blender/imbuf/intern/dds/Image.h b/source/blender/imbuf/intern/dds/Image.h index 658f01deaec..bb74a9d5d15 100644 --- a/source/blender/imbuf/intern/dds/Image.h +++ b/source/blender/imbuf/intern/dds/Image.h @@ -44,45 +44,45 @@ class Image { public: - - enum Format + + enum Format { Format_RGB, Format_ARGB, }; - + Image(); ~Image(); - + void allocate(uint w, uint h); #if 0 bool load(const char *name); - + void wrap(void *data, uint w, uint h); void unwrap(); #endif - + uint width() const; uint height() const; - + const Color32 * scanline(uint h) const; Color32 * scanline(uint h); - + const Color32 * pixels() const; Color32 * pixels(); - + const Color32 & pixel(uint idx) const; Color32 & pixel(uint idx); - + const Color32 & pixel(uint x, uint y) const; Color32 & pixel(uint x, uint y); - + Format format() const; void setFormat(Format f); - + private: void free(); - + private: uint m_width; uint m_height; diff --git a/source/blender/imbuf/intern/dds/PixelFormat.h b/source/blender/imbuf/intern/dds/PixelFormat.h index e841e696833..e37e09dd661 100644 --- a/source/blender/imbuf/intern/dds/PixelFormat.h +++ b/source/blender/imbuf/intern/dds/PixelFormat.h @@ -33,7 +33,7 @@ */ // Copyright NVIDIA Corporation 2007 -- Ignacio Castano <icastano@nvidia.com> -// +// // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without @@ -42,10 +42,10 @@ // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: -// +// // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -93,7 +93,7 @@ ++(*shift); mask >>= 1; } - + *size = 0; while ((mask & 1) == 1) { ++(*size); diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp index 67a0b0ffd00..c038407c0a6 100644 --- a/source/blender/imbuf/intern/dds/dds_api.cpp +++ b/source/blender/imbuf/intern/dds/dds_api.cpp @@ -143,7 +143,7 @@ struct ImBuf *imb_load_dds(const unsigned char *mem, size_t size, int flags, cha } } } - ibuf = IMB_allocImBuf(dds.width(), dds.height(), bits_per_pixel, 0); + ibuf = IMB_allocImBuf(dds.width(), dds.height(), bits_per_pixel, 0); if (ibuf == 0) return(0); /* memory allocation failed */ ibuf->ftype = IMB_FTYPE_DDS; diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index 769d53a44ef..2b6fa573e63 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -50,24 +50,24 @@ void IMB_de_interlace(ImBuf *ibuf) { ImBuf *tbuf1, *tbuf2; - + if (ibuf == NULL) return; if (ibuf->flags & IB_fields) return; ibuf->flags |= IB_fields; - + if (ibuf->rect) { /* make copies */ tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect); tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect); - + ibuf->x *= 2; IMB_rectcpy(tbuf1, ibuf, 0, 0, 0, 0, ibuf->x, ibuf->y); IMB_rectcpy(tbuf2, ibuf, 0, 0, tbuf2->x, 0, ibuf->x, ibuf->y); - + ibuf->x /= 2; IMB_rectcpy(ibuf, tbuf1, 0, 0, 0, 0, tbuf1->x, tbuf1->y); IMB_rectcpy(ibuf, tbuf2, 0, tbuf2->y, 0, 0, tbuf2->x, tbuf2->y); - + IMB_freeImBuf(tbuf1); IMB_freeImBuf(tbuf2); } diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index 902fc6482da..decbfd6d5b9 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -69,7 +69,7 @@ static void filtrow(unsigned char *point, int x) static void filtrowf(float *point, int x) { float c1, c2, c3; - + if (x > 1) { c1 = c2 = *point; for (x--; x > 0; x--) { @@ -112,7 +112,7 @@ static void filtcolum(unsigned char *point, int y, int skip) static void filtcolumf(float *point, int y, int skip) { float c1, c2, c3, *point2; - + if (y > 1) { c1 = c2 = *point; point2 = point; @@ -211,7 +211,7 @@ static void imb_filterN(ImBuf *out, ImBuf *in) const int channels = in->channels; const int rowlen = in->x; - + if (in->rect && out->rect) { for (int y = 0; y < in->y; y++) { /* setup rows */ @@ -515,13 +515,13 @@ void IMB_remakemipmap(ImBuf *ibuf, int use_filter) { ImBuf *hbuf = ibuf; int curmap = 0; - + ibuf->miptot = 1; - + while (curmap < IMB_MIPMAP_LEVELS) { - + if (ibuf->mipmap[curmap]) { - + if (use_filter) { ImBuf *nbuf = IMB_allocImBuf(hbuf->x, hbuf->y, hbuf->planes, hbuf->flags); imb_filterN(nbuf, hbuf); @@ -531,15 +531,15 @@ void IMB_remakemipmap(ImBuf *ibuf, int use_filter) else imb_onehalf_no_alloc(ibuf->mipmap[curmap], hbuf); } - + ibuf->miptot = curmap + 2; hbuf = ibuf->mipmap[curmap]; if (hbuf) hbuf->miplevel = curmap + 1; - + if (!hbuf || (hbuf->x <= 2 && hbuf->y <= 2)) break; - + curmap++; } } @@ -551,11 +551,11 @@ void IMB_makemipmap(ImBuf *ibuf, int use_filter) int curmap = 0; imb_freemipmapImBuf(ibuf); - + /* no mipmap for non RGBA images */ if (ibuf->rect_float && ibuf->channels < 4) return; - + ibuf->miptot = 1; while (curmap < IMB_MIPMAP_LEVELS) { diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c index 0f5fd6518fb..2eec5da7bc4 100644 --- a/source/blender/imbuf/intern/imageprocess.c +++ b/source/blender/imbuf/intern/imageprocess.c @@ -87,10 +87,10 @@ static void pixel_from_buffer(struct ImBuf *ibuf, unsigned char **outI, float ** { size_t offset = ((size_t)ibuf->x) * y * 4 + 4 * x; - + if (ibuf->rect) *outI = (unsigned char *)ibuf->rect + offset; - + if (ibuf->rect_float) *outF = ibuf->rect_float + offset; } @@ -112,13 +112,13 @@ void bicubic_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, in { unsigned char *outI = NULL; float *outF = NULL; - + if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) { return; } - + pixel_from_buffer(out, &outI, &outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */ - + bicubic_interpolation_color(in, outI, outF, u, v); } @@ -145,8 +145,8 @@ void bilinear_interpolation_color_wrap(struct ImBuf *in, unsigned char outI[4], unsigned char *row1I, *row2I, *row3I, *row4I; float a_b, ma_b, a_mb, ma_mb; int y1, y2, x1, x2; - - + + /* ImBuf in must have a valid rect or rect_float, assume this is already checked */ x1 = (int)floor(u); @@ -194,7 +194,7 @@ void bilinear_interpolation_color_wrap(struct ImBuf *in, unsigned char outI[4], row2I = (unsigned char *)in->rect + ((size_t)in->x) * y2 * 4 + 4 * x1; row3I = (unsigned char *)in->rect + ((size_t)in->x) * y1 * 4 + 4 * x2; row4I = (unsigned char *)in->rect + ((size_t)in->x) * y2 * 4 + 4 * x2; - + /* need to add 0.5 to avoid rounding down (causes darken with the smear brush) * tested with white images and this should not wrap back to zero */ outI[0] = (ma_mb * row1I[0] + a_mb * row3I[0] + ma_b * row2I[0] + a_b * row4I[0]) + 0.5f; @@ -208,13 +208,13 @@ void bilinear_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, i { unsigned char *outI = NULL; float *outF = NULL; - + if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) { return; } - + pixel_from_buffer(out, &outI, &outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */ - + bilinear_interpolation_color(in, outI, outF, u, v); } @@ -227,7 +227,7 @@ void nearest_interpolation_color(struct ImBuf *in, unsigned char outI[4], float int y1, x1; /* ImBuf in must have a valid rect or rect_float, assume this is already checked */ - + x1 = (int)(u); y1 = (int)(v); @@ -316,9 +316,9 @@ void nearest_interpolation(ImBuf *in, ImBuf *out, float x, float y, int xout, in if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) { return; } - + pixel_from_buffer(out, &outI, &outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */ - + nearest_interpolation_color(in, outI, outF, x, y); } diff --git a/source/blender/imbuf/intern/imbuf.h b/source/blender/imbuf/intern/imbuf.h index 90dad70fa61..7c455edd916 100644 --- a/source/blender/imbuf/intern/imbuf.h +++ b/source/blender/imbuf/intern/imbuf.h @@ -34,7 +34,7 @@ #include <stdlib.h> #include <sys/types.h> -#include <stdio.h> +#include <stdio.h> #ifndef WIN32 # include <unistd.h> diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 2bda07bdbbe..56f90d39850 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -142,7 +142,7 @@ void IMB_index_builder_finish(anim_index_builder *fp, int rollback) } fclose(fp->fp); - + if (rollback) { unlink(fp->temp_name); } @@ -185,7 +185,7 @@ struct anim_index *IMB_indexer_open(const char *name) idx = MEM_callocN(sizeof(struct anim_index), "anim_index"); BLI_strncpy(idx->name, name, sizeof(idx->name)); - + fseek(fp, 0, SEEK_END); idx->num_entries = (ftell(fp) - 12) / @@ -257,7 +257,7 @@ int IMB_indexer_get_frame_index(struct anim_index *idx, int frameno) int first = 0; /* bsearch (lower bound) the right index */ - + while (len > 0) { half = len >> 1; middle = first; @@ -389,7 +389,7 @@ static void get_proxy_filename(struct anim *anim, IMB_Proxy_Size preview_size, char proxy_name[256]; char stream_suffix[20]; const char *name = (temp) ? "proxy_%d%s_part.avi" : "proxy_%d%s.avi"; - + stream_suffix[0] = 0; if (anim->streamindex > 0) { @@ -418,18 +418,18 @@ static void get_tc_filename(struct anim *anim, IMB_Timecode_Type tc, char stream_suffix[20]; char index_name[256]; - + stream_suffix[0] = 0; if (anim->streamindex > 0) { BLI_snprintf(stream_suffix, 20, "_st%d", anim->streamindex); } - + BLI_snprintf(index_name, 256, index_names[i], stream_suffix, anim->suffix); get_index_dir(anim, index_dir, sizeof(index_dir)); - - BLI_join_dirfile(fname, FILE_MAXFILE + FILE_MAXDIR, + + BLI_join_dirfile(fname, FILE_MAXFILE + FILE_MAXDIR, index_dir, index_name); } @@ -475,7 +475,7 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg( { struct proxy_output_ctx *rv = MEM_callocN( sizeof(struct proxy_output_ctx), "alloc_proxy_output"); - + char fname[FILE_MAX]; int ffmpeg_quality; @@ -491,7 +491,7 @@ static struct proxy_output_ctx *alloc_proxy_output_ffmpeg( rv->of = avformat_alloc_context(); rv->of->oformat = av_guess_format("avi", NULL, NULL); - + BLI_strncpy(rv->of->filename, fname, sizeof(rv->of->filename)); fprintf(stderr, "Starting work on proxy: %s\n", rv->of->filename); @@ -611,7 +611,7 @@ static int add_to_proxy_output_ffmpeg( ret = avcodec_encode_video2(ctx->c, &packet, frame, &got_output); if (ret < 0) { - fprintf(stderr, "Error encoding proxy frame %d for '%s'\n", + fprintf(stderr, "Error encoding proxy frame %d for '%s'\n", ctx->cfra - 1, ctx->of->filename); return 0; } @@ -661,9 +661,9 @@ static void free_proxy_output_ffmpeg(struct proxy_output_ctx *ctx, avcodec_flush_buffers(ctx->c); av_write_trailer(ctx->of); - + avcodec_close(ctx->c); - + if (ctx->of->oformat) { if (!(ctx->of->oformat->flags & AVFMT_NOFILE)) { avio_close(ctx->of->pb); @@ -678,19 +678,19 @@ static void free_proxy_output_ffmpeg(struct proxy_output_ctx *ctx, av_free(ctx->frame); } - get_proxy_filename(ctx->anim, ctx->proxy_size, + get_proxy_filename(ctx->anim, ctx->proxy_size, fname_tmp, true); if (rollback) { unlink(fname_tmp); } else { - get_proxy_filename(ctx->anim, ctx->proxy_size, + get_proxy_filename(ctx->anim, ctx->proxy_size, fname, false); unlink(fname); BLI_rename(fname_tmp, fname); } - + MEM_freeN(ctx); } @@ -883,7 +883,7 @@ static void index_rebuild_ffmpeg_proc_decoded_frame( if (tc_types[i] == IMB_TC_RECORD_RUN_NO_GAPS) tc_frameno = context->frameno_gapless; - + IMB_index_builder_proc_frame( context->indexer[i], curr_packet->data, @@ -892,7 +892,7 @@ static void index_rebuild_ffmpeg_proc_decoded_frame( s_pos, s_dts, pts); } } - + context->frameno_gapless++; } @@ -1006,12 +1006,12 @@ static AviMovie *alloc_proxy_output_avi( float frs_sec_base = 1.0; IMB_anim_get_fps(anim, &frs_sec, &frs_sec_base, false); - + x = width; y = height; framerate = (double) frs_sec / (double) frs_sec_base; - + avi = MEM_mallocN(sizeof(AviMovie), "avimovie"); format = AVI_FORMAT_MJPEG; @@ -1020,7 +1020,7 @@ static AviMovie *alloc_proxy_output_avi( MEM_freeN(avi); return NULL; } - + AVI_set_compress_option(avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_WIDTH, &x); AVI_set_compress_option(avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_HEIGHT, &y); AVI_set_compress_option(avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_QUALITY, &quality); @@ -1111,7 +1111,7 @@ static void index_rebuild_fallback(FallbackIndexBuilderContext *context, *progress = next_progress; *do_update = true; } - + if (*stop) { break; } @@ -1128,7 +1128,7 @@ static void index_rebuild_fallback(FallbackIndexBuilderContext *context, IMB_scalefastImBuf(s_ibuf, x, y); IMB_convert_rgba_to_abgr(s_ibuf); - + AVI_write_frame(context->proxy_ctx[i], pos, AVI_FORMAT_RGB32, s_ibuf->rect, x * y * 4); @@ -1178,7 +1178,7 @@ IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim, IMB_Timecod } } } - + if (!overwrite) { IMB_Proxy_Size built_proxies = IMB_anim_proxy_get_existing(anim); if (built_proxies != 0) { @@ -1194,13 +1194,13 @@ IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim, IMB_Timecod } proxy_sizes_to_build &= ~built_proxies; } - + fflush(stdout); if (proxy_sizes_to_build == 0) { return NULL; } - + switch (anim->curtype) { #ifdef WITH_FFMPEG @@ -1313,7 +1313,7 @@ struct anim *IMB_anim_open_proxy( /* proxies are generated in the same color space as animation itself */ anim->proxy_anim[i] = IMB_open_anim(fname, 0, 0, anim->colorspace); - + anim->proxies_tried |= preview_size; return anim->proxy_anim[i]; @@ -1336,7 +1336,7 @@ struct anim_index *IMB_anim_open_index( get_tc_filename(anim, tc, fname); anim->curr_idx[i] = IMB_indexer_open(fname); - + anim->indices_tried |= tc; return anim->curr_idx[i]; diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index 11b1fd7b1c2..61326218d4a 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -141,7 +141,7 @@ static ushort getshort(MFileOffset *inf) static uint getlong(MFileOffset *mofs) { const uchar *buf; - + buf = MFILE_DATA(mofs); MFILE_STEP(mofs, 4); @@ -220,13 +220,13 @@ static void test_endian_zbuf(struct ImBuf *ibuf) { int len; int *zval; - + if (BIG_LONG(1) == 1) return; if (ibuf->zbuf == NULL) return; - + len = ibuf->x * ibuf->y; zval = ibuf->zbuf; - + while (len--) { zval[0] = BIG_LONG(zval[0]); zval++; @@ -301,7 +301,7 @@ struct ImBuf *imb_loadiris(const uchar *mem, size_t size, int flags, char colors if (ibuf) ibuf->ftype = IMB_FTYPE_IMAGIC; return(ibuf); } - + if (rle) { size_t tablen = (size_t)ysize * (size_t)zsize * sizeof(int); MFILE_SEEK(inf, HEADER_SIZE); @@ -316,7 +316,7 @@ struct ImBuf *imb_loadiris(const uchar *mem, size_t size, int flags, char colors readtab(inf, starttab, tablen); readtab(inf, lengthtab, tablen); - + /* check data order */ cur = 0; badorder = 0; @@ -331,9 +331,9 @@ struct ImBuf *imb_loadiris(const uchar *mem, size_t size, int flags, char colors if (badorder) break; } - + if (bpp == 1) { - + ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect); if (!ibuf) { goto fail_rle; @@ -341,7 +341,7 @@ struct ImBuf *imb_loadiris(const uchar *mem, size_t size, int flags, char colors if (ibuf->planes > 32) ibuf->planes = 32; base = ibuf->rect; zbase = (uint *)ibuf->zbuf; - + if (badorder) { for (size_t z = 0; z < zsize; z++) { lptr = base; @@ -382,18 +382,18 @@ struct ImBuf *imb_loadiris(const uchar *mem, size_t size, int flags, char colors zptr = zptr_next; } } - + } else { /* bpp == 2 */ - + ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect) | IB_rectfloat); if (!ibuf) { goto fail_rle; } fbase = ibuf->rect_float; - + if (badorder) { for (size_t z = 0; z < zsize; z++) { fptr = fbase; @@ -414,7 +414,7 @@ struct ImBuf *imb_loadiris(const uchar *mem, size_t size, int flags, char colors float *fptr_next = fptr + (xsize * 4); for (size_t y = 0; y < ysize; y++) { - + for (size_t z = 0; z < zsize; z++) { MFILE_SEEK(inf, starttab[y + z * ysize]); rledat = MFILE_DATA(inf); @@ -442,7 +442,7 @@ fail_rle: if (UNLIKELY((p) > mem_end)) { dirty_flag |= DIRTY_FLAG_EOF; goto fail_uncompressed; } ((void)0) if (bpp == 1) { - + ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect); if (!ibuf) { goto fail_uncompressed; @@ -451,12 +451,12 @@ fail_rle: base = ibuf->rect; zbase = (uint *)ibuf->zbuf; - + MFILE_SEEK(inf, HEADER_SIZE); rledat = MFILE_DATA(inf); - + for (size_t z = 0; z < zsize; z++) { - + if (z < 4) lptr = base; else if (z < 8) lptr = zbase; @@ -469,10 +469,10 @@ fail_rle: lptr += xsize; } } - + } else { /* bpp == 2 */ - + ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect) | IB_rectfloat); if (!ibuf) { goto fail_uncompressed; @@ -482,9 +482,9 @@ fail_rle: MFILE_SEEK(inf, HEADER_SIZE); rledat = MFILE_DATA(inf); - + for (size_t z = 0; z < zsize; z++) { - + fptr = fbase; for (size_t y = 0; y < ysize; y++) { @@ -496,7 +496,7 @@ fail_rle: fptr += xsize * 4; } } - + } #undef MFILE_CAPACITY_AT_PTR_OK_OR_FAIL fail_uncompressed: @@ -507,7 +507,7 @@ fail_uncompressed: if (bpp == 1) { uchar *rect; - + if (image.zsize == 1) { rect = (uchar *) ibuf->rect; for (size_t x = (size_t)ibuf->x * (size_t)ibuf->y; x > 0; x--) { @@ -533,10 +533,10 @@ fail_uncompressed: rect += 4; } } - + } else { /* bpp == 2 */ - + if (image.zsize == 1) { fbase = ibuf->rect_float; for (size_t x = (size_t)ibuf->x * (size_t)ibuf->y; x > 0; x--) { @@ -562,11 +562,11 @@ fail_uncompressed: fbase += 4; } } - + if (flags & IB_rect) { IMB_rect_from_float(ibuf); } - + } if (dirty_flag) { @@ -816,10 +816,10 @@ static int output_iris(uint *lptr, int xsize, int ysize, int zsize, const char * goodwrite *= writeheader(outf, image); fseek(outf, HEADER_SIZE + (2 * tablen), SEEK_SET); pos = HEADER_SIZE + (2 * tablen); - + for (y = 0; y < ysize; y++) { for (z = 0; z < zsize; z++) { - + if (zsize == 1) { lumrow((uchar *)lptr, (uchar *)lumbuf, xsize); len = compressrow((uchar *)lumbuf, rlebuf, CHANOFFSET(z), xsize); @@ -939,7 +939,7 @@ int imb_saveiris(struct ImBuf *ibuf, const char *name, int flags) zsize = (ibuf->planes + 7) >> 3; if (flags & IB_zbuf && ibuf->zbuf != NULL) zsize = 8; - + IMB_convert_rgba_to_abgr(ibuf); test_endian_zbuf(ibuf); diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index 30a0fdf4e55..753b5276222 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -126,7 +126,7 @@ struct ImBuf *imb_jp2_decode(const unsigned char *mem, size_t size, int flags, c struct ImBuf *ibuf = NULL; bool use_float = false; /* for precision higher then 8 use float */ bool use_alpha = false; - + long signed_offsets[4] = {0, 0, 0, 0}; int float_divs[4] = {1, 1, 1, 1}; @@ -134,9 +134,9 @@ struct ImBuf *imb_jp2_decode(const unsigned char *mem, size_t size, int flags, c unsigned int y; int *r, *g, *b, *a; /* matching 'opj_image_comp.data' type */ bool is_jp2, is_j2k; - + opj_dparameters_t parameters; /* decompression parameters */ - + opj_event_mgr_t event_mgr; /* event manager */ opj_image_t *image = NULL; @@ -180,7 +180,7 @@ struct ImBuf *imb_jp2_decode(const unsigned char *mem, size_t size, int flags, c /* decode the stream and fill the image structure */ image = opj_decode(dinfo, cio); - + if (!image) { fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n"); opj_destroy_decompress(dinfo); @@ -196,10 +196,10 @@ struct ImBuf *imb_jp2_decode(const unsigned char *mem, size_t size, int flags, c fprintf(stderr, "\nError: invalid raw image parameters\n"); return NULL; } - + w = image->comps[0].w; h = image->comps[0].h; - + switch (image->numcomps) { case 1: /* Grayscale */ case 3: /* Color */ @@ -211,38 +211,38 @@ struct ImBuf *imb_jp2_decode(const unsigned char *mem, size_t size, int flags, c use_alpha = true; break; } - - + + i = image->numcomps; if (i > 4) i = 4; - + while (i) { i--; - + if (image->comps[i].prec > 8) use_float = true; - + if (image->comps[i].sgnd) signed_offsets[i] = 1 << (image->comps[i].prec - 1); - + /* only needed for float images but dosnt hurt to calc this */ float_divs[i] = (1 << image->comps[i].prec) - 1; } - + ibuf = IMB_allocImBuf(w, h, planes, use_float ? IB_rectfloat : IB_rect); - + if (ibuf == NULL) { if (dinfo) opj_destroy_decompress(dinfo); return NULL; } - + ibuf->ftype = IMB_FTYPE_JP2; if (is_jp2) ibuf->foptions.flag |= JP2_JP2; else ibuf->foptions.flag |= JP2_J2K; - + if (use_float) { float *rect_float = ibuf->rect_float; @@ -293,7 +293,7 @@ struct ImBuf *imb_jp2_decode(const unsigned char *mem, size_t size, int flags, c PIXEL_LOOPER_END; } } - + } else { unsigned char *rect_uchar = (unsigned char *)ibuf->rect; @@ -346,19 +346,19 @@ struct ImBuf *imb_jp2_decode(const unsigned char *mem, size_t size, int flags, c } } } - + /* free remaining structures */ if (dinfo) { opj_destroy_decompress(dinfo); } - + /* free image data structure */ opj_image_destroy(image); - + if (flags & IB_rect) { IMB_rect_from_float(ibuf); } - + return(ibuf); } @@ -416,8 +416,8 @@ BLI_INLINE int DOWNSAMPLE_FLOAT_TO_16BIT(const float _val) static int initialise_4K_poc(opj_poc_t *POC, int numres) { - POC[0].tile = 1; - POC[0].resno0 = 0; + POC[0].tile = 1; + POC[0].resno0 = 0; POC[0].compno0 = 0; POC[0].layno1 = 1; POC[0].resno1 = numres - 1; @@ -438,7 +438,7 @@ static void cinema_parameters(opj_cparameters_t *parameters) parameters->tile_size_on = 0; /* false */ parameters->cp_tdx = 1; parameters->cp_tdy = 1; - + /*Tile part*/ parameters->tp_flag = 'C'; parameters->tp_on = 1; @@ -487,7 +487,7 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters, opj_image_t *ima parameters->cp_rsiz = DCP_CINEMA2K; } break; - + case CINEMA4K_24: if (parameters->numresolution < 1) { parameters->numresolution = 1; @@ -534,7 +534,7 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters, opj_image_t *ima } parameters->max_comp_size = COMP_24_CS; break; - + case CINEMA2K_48: for (i = 0; i < parameters->tcp_numlayers; i++) { temp_rate = 0; @@ -572,22 +572,22 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) { unsigned char *rect_uchar; float *rect_float, from_straight[4]; - + unsigned int subsampling_dx = parameters->subsampling_dx; unsigned int subsampling_dy = parameters->subsampling_dy; - + unsigned int i, i_next, numcomps, w, h, prec; unsigned int y; int *r, *g, *b, *a; /* matching 'opj_image_comp.data' type */ OPJ_COLOR_SPACE color_space; opj_image_cmptparm_t cmptparm[4]; /* maximum of 4 components */ opj_image_t *image = NULL; - + float (*chanel_colormanage_cb)(float); - + img_fol_t img_fol; /* only needed for cinema presets */ memset(&img_fol, 0, sizeof(img_fol_t)); - + if (ibuf->float_colorspace || (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA)) { /* float buffer was managed already, no need in color space conversion */ chanel_colormanage_cb = channel_colormanage_noop; @@ -596,9 +596,9 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) /* standard linear-to-srgb conversion if float buffer wasn't managed */ chanel_colormanage_cb = linearrgb_to_srgb; } - + if (ibuf->foptions.flag & JP2_CINE) { - + if (ibuf->x == 4096 || ibuf->y == 2160) parameters->cp_cinema = CINEMA4K_24; else { @@ -616,7 +616,7 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) } cinema_parameters(parameters); } - + color_space = (ibuf->foptions.flag & JP2_YCC) ? CLRSPC_SYCC : CLRSPC_SRGB; prec = 12; numcomps = 3; @@ -624,20 +624,20 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) else { /* Get settings from the imbuf */ color_space = (ibuf->foptions.flag & JP2_YCC) ? CLRSPC_SYCC : CLRSPC_SRGB; - + if (ibuf->foptions.flag & JP2_16BIT) prec = 16; else if (ibuf->foptions.flag & JP2_12BIT) prec = 12; else prec = 8; - + /* 32bit images == alpha channel */ /* grayscale not supported yet */ numcomps = (ibuf->planes == 32) ? 4 : 3; } - + w = ibuf->x; h = ibuf->y; - - + + /* initialize image components */ memset(&cmptparm, 0, 4 * sizeof(opj_image_cmptparm_t)); for (i = 0; i < numcomps; i++) { @@ -665,7 +665,7 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) /* set image data */ rect_uchar = (unsigned char *) ibuf->rect; rect_float = ibuf->rect_float; - + /* set the destination channels */ r = image->comps[0].data; g = image->comps[1].data; @@ -676,7 +676,7 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) /* No need to use the floating point buffer, just write the 8 bits from the char buffer */ rect_float = NULL; } - + if (rect_float) { int channels_in_float = ibuf->channels ? ibuf->channels : 4; @@ -744,7 +744,7 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) } } break; - + case 12: if (numcomps == 4) { if (channels_in_float == 4) { @@ -898,7 +898,7 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) PIXEL_LOOPER_END; } break; - + case 12: /* Up Sampling, a bit pointless but best write the bit depth requested */ if (numcomps == 4) { PIXEL_LOOPER_BEGIN(rect_uchar) @@ -944,17 +944,17 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) break; } } - + /* Decide if MCT should be used */ parameters->tcp_mct = image->numcomps == 3 ? 1 : 0; - + if (parameters->cp_cinema) { cinema_setup_encoder(parameters, image, &img_fol); } - + if (img_fol.rates) MEM_freeN(img_fol.rates); - + return image; } @@ -963,14 +963,14 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags) { int quality = ibuf->foptions.quality; - + int bSuccess; opj_cparameters_t parameters; /* compression parameters */ opj_event_mgr_t event_mgr; /* event manager */ opj_image_t *image = NULL; - + (void)flags; /* unused */ - + /* * configure the event callbacks (not required) * setting of each callback is optional @@ -979,22 +979,22 @@ int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags) event_mgr.error_handler = error_callback; event_mgr.warning_handler = warning_callback; event_mgr.info_handler = info_callback; - + /* set encoding parameters to default values */ opj_set_default_encoder_parameters(¶meters); - + /* compression ratio */ /* invert range, from 10-100, 100-1 * where jpeg see's 1 and highest quality (lossless) and 100 is very low quality*/ parameters.tcp_rates[0] = ((100 - quality) / 90.0f * 99.0f) + 1; - + parameters.tcp_numlayers = 1; /* only one resolution */ parameters.cp_disto_alloc = 1; image = ibuftoimage(ibuf, ¶meters); - - + + { /* JP2 format output */ int codestream_length; opj_cio_t *cio = NULL; @@ -1021,7 +1021,7 @@ int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags) /* encode the image */ bSuccess = opj_encode(cinfo, cio, image, NULL); /* last arg used to be parameters.index but this deprecated */ - + if (!bSuccess) { opj_cio_close(cio); fprintf(stderr, "failed to encode image\n"); @@ -1031,7 +1031,7 @@ int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags) /* write the buffer to disk */ f = BLI_fopen(name, "wb"); - + if (!f) { fprintf(stderr, "failed to open %s for writing\n", name); return 1; @@ -1041,13 +1041,13 @@ int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags) fprintf(stderr, "Generated outfile %s\n", name); /* close and free the byte stream */ opj_cio_close(cio); - + /* free remaining compression structures */ opj_destroy_compress(cinfo); } /* free image data */ opj_image_destroy(image); - + return 1; } diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c index ef9217fbc8c..2febbb1f861 100644 --- a/source/blender/imbuf/intern/jpeg.c +++ b/source/blender/imbuf/intern/jpeg.c @@ -48,7 +48,7 @@ #include "IMB_imbuf.h" #include "IMB_metadata.h" #include "IMB_filetype.h" -#include "jpeglib.h" +#include "jpeglib.h" #include "jerror.h" #include "IMB_colormanagement.h" @@ -247,12 +247,12 @@ static boolean handle_app1(j_decompress_ptr cinfo) INT32 length; /* initialized by the macro */ INT32 i; char neogeo[128]; - + INPUT_VARS(cinfo); INPUT_2BYTES(cinfo, length, return false); length -= 2; - + if (length < 16) { for (i = 0; i < length; i++) { INPUT_BYTE(cinfo, neogeo[i], return false); @@ -308,12 +308,12 @@ static ImBuf *ibJpegImageFromCinfo(struct jpeg_decompress_struct *cinfo, int fla row_stride = cinfo->output_width * depth; row_pointer = (*cinfo->mem->alloc_sarray)((j_common_ptr) cinfo, JPOOL_IMAGE, row_stride, 1); - + for (y = ibuf->y - 1; y >= 0; y--) { jpeg_read_scanlines(cinfo, row_pointer, 1); rect = (uchar *) (ibuf->rect + y * ibuf->x); buffer = row_pointer[0]; - + switch (depth) { case 1: for (x = ibuf->x; x > 0; x--) { @@ -419,7 +419,7 @@ next_stamp_marker: jpeg_finish_decompress(cinfo); } - + jpeg_destroy((j_common_ptr) cinfo); if (ibuf) { ibuf->ftype = IMB_FTYPE_JPG; @@ -456,7 +456,7 @@ ImBuf *imb_load_jpeg(const unsigned char *buffer, size_t size, int flags, char c memory_source(cinfo, buffer, size); ibuf = ibJpegImageFromCinfo(cinfo, flags); - + return(ibuf); } @@ -584,7 +584,7 @@ static int init_jpeg(FILE *outfile, struct jpeg_compress_struct *cinfo, struct I break; } jpeg_set_defaults(cinfo); - + /* own settings */ cinfo->dct_method = JDCT_FLOAT; @@ -629,7 +629,7 @@ static int save_stdjpeg(const char *name, struct ImBuf *ibuf) int imb_savejpeg(struct ImBuf *ibuf, const char *name, int flags) { - + ibuf->flags = flags; return save_stdjpeg(name, ibuf); } diff --git a/source/blender/imbuf/intern/openexr/CMakeLists.txt b/source/blender/imbuf/intern/openexr/CMakeLists.txt index d5cb8e8a3b6..d4e6e9dc670 100644 --- a/source/blender/imbuf/intern/openexr/CMakeLists.txt +++ b/source/blender/imbuf/intern/openexr/CMakeLists.txt @@ -23,7 +23,7 @@ # # ***** END GPL LICENSE BLOCK ***** -set(INC +set(INC . .. ../.. diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index ad04f1fb78d..a52ae75e87b 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -912,7 +912,7 @@ int IMB_exr_begin_read(void *handle, const char *filename, int *width, int *heig for (size_t i = 0; i < channels.size(); i++) { IMB_exr_add_channel(data, NULL, channels[i].name.c_str(), channels[i].view.c_str(), 0, 0, NULL, false); - + echan = (ExrChannel *)data->channels.last; echan->m->name = channels[i].name; echan->m->view = channels[i].view; @@ -1274,7 +1274,7 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa const char *token; char tokenbuf[EXR_TOT_MAXNAME]; int len; - + /* some multilayers have the combined buffer with names A B G R saved */ if (name[1] == 0) { echan->chan_id = name[0]; diff --git a/source/blender/imbuf/intern/openexr/openexr_api.h b/source/blender/imbuf/intern/openexr/openexr_api.h index 165cc968701..92bbeecfd5d 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.h +++ b/source/blender/imbuf/intern/openexr/openexr_api.h @@ -42,7 +42,7 @@ extern "C" { void imb_initopenexr (void); int imb_is_a_openexr (const unsigned char *mem); - + int imb_save_openexr (struct ImBuf *ibuf, const char *name, int flags); struct ImBuf *imb_load_openexr (const unsigned char *mem, size_t size, int flags, char *colorspace); diff --git a/source/blender/imbuf/intern/png.c b/source/blender/imbuf/intern/png.c index 8ac206a97ea..71b7cb2f567 100644 --- a/source/blender/imbuf/intern/png.c +++ b/source/blender/imbuf/intern/png.c @@ -82,7 +82,7 @@ int imb_is_a_png(const unsigned char *mem) return(ret_val); } -static void Flush(png_structp png_ptr) +static void Flush(png_structp png_ptr) { (void)png_ptr; } @@ -415,7 +415,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) num_text++; } } - + metadata = MEM_callocN(num_text * sizeof(png_text), "png_metadata"); num_text = 0; for (prop = ibuf->metadata->data.group.first; prop; prop = prop->next) { @@ -426,7 +426,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags) num_text++; } } - + png_set_text(png_ptr, info_ptr, metadata, num_text); MEM_freeN(metadata); @@ -544,7 +544,7 @@ ImBuf *imb_loadpng(const unsigned char *mem, size_t size, int flags, char colors info_ptr = png_create_info_struct(png_ptr); if (info_ptr == NULL) { - png_destroy_read_struct(&png_ptr, (png_infopp)NULL, + png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL); printf("Cannot png_create_info_struct\n"); return NULL; @@ -568,7 +568,7 @@ ImBuf *imb_loadpng(const unsigned char *mem, size_t size, int flags, char colors // png_set_sig_bytes(png_ptr, 8); png_read_info(png_ptr, info_ptr); - png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, NULL, NULL, NULL); channels = png_get_channels(png_ptr, info_ptr); @@ -601,7 +601,7 @@ ImBuf *imb_loadpng(const unsigned char *mem, size_t size, int flags, char colors printf("PNG format not supported\n"); longjmp(png_jmpbuf(png_ptr), 1); } - + ibuf = IMB_allocImBuf(width, height, 8 * channels, 0); if (ibuf) { diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c index 8d822a314f5..be33c16c8ae 100644 --- a/source/blender/imbuf/intern/radiance_hdr.c +++ b/source/blender/imbuf/intern/radiance_hdr.c @@ -256,7 +256,7 @@ struct ImBuf *imb_loadhdr(const unsigned char *mem, size_t size, int flags, char /* read in and decode the actual data */ sline = (RGBE *)MEM_mallocN(sizeof(*sline) * width, __func__); rect_float = ibuf->rect_float; - + for (size_t y = 0; y < height; y++) { ptr = freadcolrs(sline, ptr, width, mem_eof); if (ptr == NULL) { @@ -274,11 +274,11 @@ struct ImBuf *imb_loadhdr(const unsigned char *mem, size_t size, int flags, char } MEM_freeN(sline); if (oriY[0] == '-') IMB_flipy(ibuf); - + if (flags & IB_rect) { IMB_rect_from_float(ibuf); } - + return ibuf; } //else printf("Data not found!\n"); @@ -385,9 +385,9 @@ int imb_savehdr(struct ImBuf *ibuf, const char *name, int flags) float *fp = NULL; size_t width = ibuf->x, height = ibuf->y; unsigned char *cp = NULL; - + (void)flags; /* unused */ - + if (file == NULL) { return 0; } @@ -398,7 +398,7 @@ int imb_savehdr(struct ImBuf *ibuf, const char *name, int flags) cp = (unsigned char *)ibuf->rect + ibuf->channels * (height - 1) * width; if (ibuf->rect_float) fp = ibuf->rect_float + ibuf->channels * (height - 1) * width; - + for (size_t y = 0; y < height; y++) { if (fwritecolrs(file, width, ibuf->channels, cp, fp) < 0) { fclose(file); diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c index 2fe17ee56c6..a762e3780dc 100644 --- a/source/blender/imbuf/intern/rectop.c +++ b/source/blender/imbuf/intern/rectop.c @@ -167,13 +167,13 @@ void IMB_blend_color_float(float dst[4], float src1[4], float src2[4], IMB_Blend /* clipping */ -void IMB_rectclip(ImBuf *dbuf, ImBuf *sbuf, int *destx, +void IMB_rectclip(ImBuf *dbuf, ImBuf *sbuf, int *destx, int *desty, int *srcx, int *srcy, int *width, int *height) { int tmp; if (dbuf == NULL) return; - + if (*destx < 0) { *srcx -= *destx; *width += *destx; @@ -213,14 +213,14 @@ void IMB_rectclip(ImBuf *dbuf, ImBuf *sbuf, int *destx, } } -static void imb_rectclip3(ImBuf *dbuf, ImBuf *obuf, ImBuf *sbuf, int *destx, +static void imb_rectclip3(ImBuf *dbuf, ImBuf *obuf, ImBuf *sbuf, int *destx, int *desty, int *origx, int *origy, int *srcx, int *srcy, int *width, int *height) { int tmp; if (dbuf == NULL) return; - + if (*destx < 0) { *srcx -= *destx; *origx -= *destx; @@ -286,7 +286,7 @@ static void imb_rectclip3(ImBuf *dbuf, ImBuf *obuf, ImBuf *sbuf, int *destx, /* copy and blend */ -void IMB_rectcpy(ImBuf *dbuf, ImBuf *sbuf, int destx, +void IMB_rectcpy(ImBuf *dbuf, ImBuf *sbuf, int destx, int desty, int srcx, int srcy, int width, int height) { IMB_rectblend(dbuf, dbuf, sbuf, NULL, NULL, NULL, 0, destx, desty, destx, desty, srcx, srcy, width, height, IMB_BLEND_COPY, false); @@ -786,20 +786,20 @@ void IMB_rectfill(ImBuf *drect, const float col[4]) if (drect->rect) { unsigned int *rrect = drect->rect; char ccol[4]; - + ccol[0] = (int)(col[0] * 255); ccol[1] = (int)(col[1] * 255); ccol[2] = (int)(col[2] * 255); ccol[3] = (int)(col[3] * 255); - + num = drect->x * drect->y; for (; num > 0; num--) *rrect++ = *((unsigned int *)ccol); } - + if (drect->rect_float) { float *rrectf = drect->rect_float; - + num = drect->x * drect->y; for (; num > 0; num--) { *rrectf++ = col[0]; @@ -821,7 +821,7 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float aich; /* alpha, inverted, ai/255.0 - Convert char to float at the same time */ if ((!rect && !rectf) || (!col) || col[3] == 0.0f) return; - + /* sanity checks for coords */ CLAMP(x1, 0, width); CLAMP(x2, 0, width); @@ -831,18 +831,18 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, if (x1 > x2) SWAP(int, x1, x2); if (y1 > y2) SWAP(int, y1, y2); if (x1 == x2 || y1 == y2) return; - + a = col[3]; ai = 1 - a; aich = ai / 255.0f; if (rect) { - unsigned char *pixel; + unsigned char *pixel; unsigned char chr = 0, chg = 0, chb = 0; float fr = 0, fg = 0, fb = 0; const int alphaint = unit_float_to_uchar_clamp(a); - + if (a == 1.0f) { chr = unit_float_to_uchar_clamp(col[0]); chg = unit_float_to_uchar_clamp(col[1]); @@ -874,7 +874,7 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, } } } - + if (rectf) { float col_conv[4]; float *pixel; diff --git a/source/blender/imbuf/intern/rotate.c b/source/blender/imbuf/intern/rotate.c index 886944f6190..f00745f0052 100644 --- a/source/blender/imbuf/intern/rotate.c +++ b/source/blender/imbuf/intern/rotate.c @@ -54,7 +54,7 @@ void IMB_flipy(struct ImBuf *ibuf) top = ibuf->rect; bottom = top + ((y - 1) * x); line = MEM_mallocN(x * sizeof(int), "linebuf"); - + y >>= 1; for (; y > 0; y--) { @@ -96,7 +96,7 @@ void IMB_flipx(struct ImBuf *ibuf) { int x, y, xr, xl, yi; float px_f[4]; - + if (ibuf == NULL) return; x = ibuf->x; @@ -109,7 +109,7 @@ void IMB_flipx(struct ImBuf *ibuf) } } } - + if (ibuf->rect_float) { for (yi = y - 1; yi >= 0; yi--) { for (xr = x - 1, xl = 0; xr >= xl; xr--, xl++) { diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c index 4b528160fb7..43c5a9d3597 100644 --- a/source/blender/imbuf/intern/scaling.c +++ b/source/blender/imbuf/intern/scaling.c @@ -60,7 +60,7 @@ static void imb_half_x_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1) do_rect = (ibuf1->rect != NULL); do_float = (ibuf1->rect_float != NULL && ibuf2->rect_float != NULL); - + _p1 = (uchar *) ibuf1->rect; dest = (uchar *) ibuf2->rect; @@ -113,12 +113,12 @@ struct ImBuf *IMB_half_x(struct ImBuf *ibuf1) if (ibuf1->rect == NULL && ibuf1->rect_float == NULL) return (NULL); if (ibuf1->x <= 1) return(IMB_dupImBuf(ibuf1)); - + ibuf2 = IMB_allocImBuf((ibuf1->x) / 2, ibuf1->y, ibuf1->planes, ibuf1->flags); if (ibuf2 == NULL) return (NULL); imb_half_x_no_alloc(ibuf2, ibuf1); - + return (ibuf2); } @@ -133,7 +133,7 @@ struct ImBuf *IMB_double_fast_x(struct ImBuf *ibuf1) do_rect = (ibuf1->rect != NULL); do_float = (ibuf1->rect_float != NULL); - + ibuf2 = IMB_allocImBuf(2 * ibuf1->x, ibuf1->y, ibuf1->planes, ibuf1->flags); if (ibuf2 == NULL) return (NULL); @@ -245,14 +245,14 @@ struct ImBuf *IMB_half_y(struct ImBuf *ibuf1) if (ibuf1 == NULL) return (NULL); if (ibuf1->rect == NULL && ibuf1->rect_float == NULL) return (NULL); - + if (ibuf1->y <= 1) return(IMB_dupImBuf(ibuf1)); ibuf2 = IMB_allocImBuf(ibuf1->x, (ibuf1->y) / 2, ibuf1->planes, ibuf1->flags); if (ibuf2 == NULL) return (NULL); imb_half_y_no_alloc(ibuf2, ibuf1); - + return (ibuf2); } @@ -303,7 +303,7 @@ struct ImBuf *IMB_double_y(struct ImBuf *ibuf1) if (ibuf1->rect == NULL) return (NULL); ibuf2 = IMB_double_fast_y(ibuf1); - + IMB_filtery(ibuf2); return (ibuf2); } @@ -358,30 +358,30 @@ void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1) imb_half_x_no_alloc(ibuf2, ibuf1); return; } - + if (do_rect) { unsigned char *cp1, *cp2, *dest; - + cp1 = (unsigned char *) ibuf1->rect; dest = (unsigned char *) ibuf2->rect; - + for (y = ibuf2->y; y > 0; y--) { cp2 = cp1 + (ibuf1->x << 2); for (x = ibuf2->x; x > 0; x--) { unsigned short p1i[8], p2i[8], desti[4]; - + straight_uchar_to_premul_ushort(p1i, cp1); straight_uchar_to_premul_ushort(p2i, cp2); straight_uchar_to_premul_ushort(p1i + 4, cp1 + 4); straight_uchar_to_premul_ushort(p2i + 4, cp2 + 4); - + desti[0] = ((unsigned int) p1i[0] + p2i[0] + p1i[4] + p2i[4]) >> 2; desti[1] = ((unsigned int) p1i[1] + p2i[1] + p1i[5] + p2i[5]) >> 2; desti[2] = ((unsigned int) p1i[2] + p2i[2] + p1i[6] + p2i[6]) >> 2; desti[3] = ((unsigned int) p1i[3] + p2i[3] + p1i[7] + p2i[7]) >> 2; - + premul_ushort_to_straight_uchar(dest, desti); - + cp1 += 8; cp2 += 8; dest += 4; @@ -390,10 +390,10 @@ void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1) if (ibuf1->x & 1) cp1 += 4; } } - + if (do_float) { float *p1f, *p2f, *destf; - + p1f = ibuf1->rect_float; destf = ibuf2->rect_float; for (y = ibuf2->y; y > 0; y--) { @@ -419,15 +419,15 @@ ImBuf *IMB_onehalf(struct ImBuf *ibuf1) if (ibuf1 == NULL) return (NULL); if (ibuf1->rect == NULL && ibuf1->rect_float == NULL) return (NULL); - + if (ibuf1->x <= 1) return(IMB_half_y(ibuf1)); if (ibuf1->y <= 1) return(IMB_half_x(ibuf1)); - + ibuf2 = IMB_allocImBuf((ibuf1->x) / 2, (ibuf1->y) / 2, ibuf1->planes, ibuf1->flags); if (ibuf2 == NULL) return (NULL); - + imb_onehalf_no_alloc(ibuf2, ibuf1); - + return (ibuf2); } @@ -582,7 +582,7 @@ static void shrink_picture_byte( struct scale_outpix_byte *temp; y_counter += 65536; - + for (x = 0; x < dst_width; x++) { uintptr_t f = 0x80000000UL / dst_line1[x].weight; *dst++ = (val = (dst_line1[x].r * f) >> 15) > 255 ? 255 : val; @@ -782,7 +782,7 @@ static void shrink_picture_float( struct scale_outpix_float *temp; y_counter += 1.0f; - + for (x = 0; x < dst_width; x++) { float f = 1.0f / dst_line1[x].weight; *dst++ = dst_line1[x].r * f; @@ -921,7 +921,7 @@ static ImBuf *scaledownx(struct ImBuf *ibuf, int newx) rectf = ibuf->rect_float; newrectf = _newrectf; } - + for (y = ibuf->y; y > 0; y--) { sample = 0.0f; val[0] = val[1] = val[2] = val[3] = 0.0f; @@ -940,12 +940,12 @@ static ImBuf *scaledownx(struct ImBuf *ibuf, int newx) nvalf[2] = -valf[2] * sample; nvalf[3] = -valf[3] * sample; } - + sample += add; while (sample >= 1.0f) { sample -= 1.0f; - + if (do_rect) { nval[0] += rect[0]; nval[1] += rect[1]; @@ -961,31 +961,31 @@ static ImBuf *scaledownx(struct ImBuf *ibuf, int newx) rectf += 4; } } - + if (do_rect) { val[0] = rect[0]; val[1] = rect[1]; val[2] = rect[2]; val[3] = rect[3]; rect += 4; - + newrect[0] = ((nval[0] + sample * val[0]) / add + 0.5f); newrect[1] = ((nval[1] + sample * val[1]) / add + 0.5f); newrect[2] = ((nval[2] + sample * val[2]) / add + 0.5f); newrect[3] = ((nval[3] + sample * val[3]) / add + 0.5f); - + newrect += 4; } if (do_float) { - + valf[0] = rectf[0]; valf[1] = rectf[1]; valf[2] = rectf[2]; valf[3] = rectf[3]; rectf += 4; - + newrectf[0] = ((nvalf[0] + sample * valf[0]) / add); newrectf[1] = ((nvalf[1] + sample * valf[1]) / add); newrectf[2] = ((nvalf[2] + sample * valf[2]) / add); newrectf[3] = ((nvalf[3] + sample * valf[3]) / add); - + newrectf += 4; } - + sample -= 1.0f; } } @@ -1005,7 +1005,7 @@ static ImBuf *scaledownx(struct ImBuf *ibuf, int newx) ibuf->rect_float = _newrectf; } (void)rect_size; /* UNUSED in release builds */ - + ibuf->x = newx; return(ibuf); } @@ -1053,7 +1053,7 @@ static ImBuf *scaledowny(struct ImBuf *ibuf, int newy) rectf = ibuf->rect_float + x; newrectf = _newrectf + x; } - + sample = 0.0f; val[0] = val[1] = val[2] = val[3] = 0.0f; valf[0] = valf[1] = valf[2] = valf[3] = 0.0f; @@ -1071,12 +1071,12 @@ static ImBuf *scaledowny(struct ImBuf *ibuf, int newy) nvalf[2] = -valf[2] * sample; nvalf[3] = -valf[3] * sample; } - + sample += add; while (sample >= 1.0f) { sample -= 1.0f; - + if (do_rect) { nval[0] += rect[0]; nval[1] += rect[1]; @@ -1096,27 +1096,27 @@ static ImBuf *scaledowny(struct ImBuf *ibuf, int newy) if (do_rect) { val[0] = rect[0]; val[1] = rect[1]; val[2] = rect[2]; val[3] = rect[3]; rect += skipx; - + newrect[0] = ((nval[0] + sample * val[0]) / add + 0.5f); newrect[1] = ((nval[1] + sample * val[1]) / add + 0.5f); newrect[2] = ((nval[2] + sample * val[2]) / add + 0.5f); newrect[3] = ((nval[3] + sample * val[3]) / add + 0.5f); - + newrect += skipx; } if (do_float) { - + valf[0] = rectf[0]; valf[1] = rectf[1]; valf[2] = rectf[2]; valf[3] = rectf[3]; rectf += skipx; - + newrectf[0] = ((nvalf[0] + sample * valf[0]) / add); newrectf[1] = ((nvalf[1] + sample * valf[1]) / add); newrectf[2] = ((nvalf[2] + sample * valf[2]) / add); newrectf[3] = ((nvalf[3] + sample * valf[3]) / add); - + newrectf += skipx; } - + sample -= 1.0f; } } @@ -1136,7 +1136,7 @@ static ImBuf *scaledowny(struct ImBuf *ibuf, int newy) ibuf->rect_float = (float *) _newrectf; } (void)rect_size; /* UNUSED in release builds */ - + ibuf->y = newy; return(ibuf); } @@ -1189,7 +1189,7 @@ static ImBuf *scaleupx(struct ImBuf *ibuf, int newx) for (y = ibuf->y; y > 0; y--) { sample = 0; - + if (do_rect) { val_a = rect[0]; nval_a = rect[4]; @@ -1217,7 +1217,7 @@ static ImBuf *scaleupx(struct ImBuf *ibuf, int newx) val_af = rectf[0]; nval_af = rectf[4]; diff_af = nval_af - val_af; - + val_bf = rectf[1]; nval_bf = rectf[5]; diff_bf = nval_bf - val_bf; @@ -1262,7 +1262,7 @@ static ImBuf *scaleupx(struct ImBuf *ibuf, int newx) val_af = nval_af; nval_af = rectf[0]; diff_af = nval_af - val_af; - + val_bf = nval_bf; nval_bf = rectf[1]; diff_bf = nval_bf - val_bf; @@ -1305,7 +1305,7 @@ static ImBuf *scaleupx(struct ImBuf *ibuf, int newx) ibuf->mall |= IB_rectfloat; ibuf->rect_float = (float *) _newrectf; } - + ibuf->x = newx; return(ibuf); } @@ -1391,7 +1391,7 @@ static ImBuf *scaleupy(struct ImBuf *ibuf, int newy) val_af = rectf[0]; nval_af = rectf[skipx]; diff_af = nval_af - val_af; - + val_bf = rectf[1]; nval_bf = rectf[skipx + 1]; diff_bf = nval_bf - val_bf; @@ -1406,7 +1406,7 @@ static ImBuf *scaleupy(struct ImBuf *ibuf, int newy) rectf += 2 * skipx; } - + for (y = newy; y > 0; y--) { if (sample >= 1.0f) { sample -= 1.0f; @@ -1437,7 +1437,7 @@ static ImBuf *scaleupy(struct ImBuf *ibuf, int newy) val_af = nval_af; nval_af = rectf[0]; diff_af = nval_af - val_af; - + val_bf = nval_bf; nval_bf = rectf[1]; diff_bf = nval_bf - val_bf; @@ -1480,7 +1480,7 @@ static ImBuf *scaleupy(struct ImBuf *ibuf, int newy) ibuf->mall |= IB_rectfloat; ibuf->rect_float = (float *) _newrectf; } - + ibuf->y = newy; return(ibuf); } @@ -1557,7 +1557,7 @@ bool IMB_scaleImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy) { if (ibuf == NULL) return false; if (ibuf->rect == NULL && ibuf->rect_float == NULL) return false; - + if (newx == ibuf->x && newy == ibuf->y) { return false; } @@ -1576,7 +1576,7 @@ bool IMB_scaleImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy) if (newy && (newy < ibuf->y)) scaledowny(ibuf, newy); if (newx && (newx > ibuf->x)) scaleupx(ibuf, newx); if (newy && (newy > ibuf->y)) scaleupy(ibuf, newy); - + return true; } @@ -1602,15 +1602,15 @@ bool IMB_scalefastImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy if (ibuf->rect) do_rect = true; if (ibuf->rect_float) do_float = true; if (do_rect == false && do_float == false) return false; - + if (newx == ibuf->x && newy == ibuf->y) return false; - + if (do_rect) { _newrect = MEM_mallocN(newx * newy * sizeof(int), "scalefastimbuf"); if (_newrect == NULL) return false; newrect = _newrect; } - + if (do_float) { _newrectf = MEM_mallocN(newx * newy * sizeof(float) * 4, "scalefastimbuf f"); if (_newrectf == NULL) { diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index 0949a431293..9d92d146f50 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -122,7 +122,7 @@ static bool makebody_tga(ImBuf *ibuf, FILE *file, int (*out)(unsigned int, FILE register int copy, bytes; register unsigned int *rect, *rectstart, *temp; int y; - + for (y = 0; y < ibuf->y; y++) { bytes = ibuf->x - 1; rectstart = rect = ibuf->rect + (y * ibuf->x); @@ -253,7 +253,7 @@ int imb_savetarga(struct ImBuf *ibuf, const char *name, int flags) char buf[20] = {0}; FILE *fildes; bool ok = false; - + (void)flags; /* unused */ buf[16] = (ibuf->planes + 0x7) & ~0x7; @@ -265,7 +265,7 @@ int imb_savetarga(struct ImBuf *ibuf, const char *name, int flags) } if (ibuf->foptions.flag & RAWTGA) buf[2] &= ~8; - + buf[8] = 0; buf[9] = 0; buf[10] = 0; @@ -308,7 +308,7 @@ int imb_savetarga(struct ImBuf *ibuf, const char *name, int flags) break; } } - + fclose(fildes); return ok; } @@ -353,7 +353,7 @@ static int checktarga(TARGA *tga, const unsigned char *mem) int imb_is_a_targa(const unsigned char *buf) { TARGA tga; - + return checktarga(&tga, buf); } @@ -378,13 +378,13 @@ static void decodetarga(struct ImBuf *ibuf, const unsigned char *mem, size_t mem int count, col, size; unsigned int *rect; uchar *cp = (uchar *) &col; - + if (ibuf == NULL) return; if (ibuf->rect == NULL) return; size = ibuf->x * ibuf->y; rect = ibuf->rect; - + /* set alpha */ cp[0] = 0xff; cp[1] = cp[2] = 0; @@ -573,10 +573,10 @@ ImBuf *imb_loadtarga(const unsigned char *mem, size_t mem_size, int flags, char if (tga.imgtyp < 4) ibuf->foptions.flag |= RAWTGA; mem = mem + 18 + tga.numid; - + cp[0] = 0xff; cp[1] = cp[2] = 0; - + if (tga.mapsize) { /* load color map */ /*mincol = tga.maporig;*/ /*UNUSED*/ @@ -609,7 +609,7 @@ ImBuf *imb_loadtarga(const unsigned char *mem, size_t mem_size, int flags, char } cmap[count] = cp_data; } - + size = 0; for (int cmap_index = cmap_max - 1; cmap_index > 0; cmap_index >>= 1) { size++; @@ -620,7 +620,7 @@ ImBuf *imb_loadtarga(const unsigned char *mem, size_t mem_size, int flags, char cmap[0] &= BIG_LONG(0x00ffffffl); } } - + if (flags & IB_test) { if (cmap) { MEM_freeN(cmap); @@ -630,7 +630,7 @@ ImBuf *imb_loadtarga(const unsigned char *mem, size_t mem_size, int flags, char if (tga.imgtyp != 1 && tga.imgtyp != 9) { /* happens sometimes (beuh) */ if (cmap) { - MEM_freeN(cmap); + MEM_freeN(cmap); cmap = NULL; } } @@ -653,7 +653,7 @@ ImBuf *imb_loadtarga(const unsigned char *mem, size_t mem_size, int flags, char else if (tga.pixsize <= 32) decodetarga(ibuf, mem, mem_size, 3); break; } - + if (cmap) { /* apply color map */ rect = ibuf->rect; @@ -666,7 +666,7 @@ ImBuf *imb_loadtarga(const unsigned char *mem, size_t mem_size, int flags, char MEM_freeN(cmap); } - + if (tga.pixsize == 16) { unsigned int col; rect = ibuf->rect; @@ -685,29 +685,29 @@ ImBuf *imb_loadtarga(const unsigned char *mem, size_t mem_size, int flags, char } ibuf->planes = 24; } - + if (tga.imgtyp == 3 || tga.imgtyp == 11) { uchar *crect; unsigned int *lrect, col; - + crect = (uchar *) ibuf->rect; lrect = (unsigned int *) ibuf->rect; - + for (size = ibuf->x * ibuf->y; size > 0; size--) { col = *lrect++; - + crect[0] = 255; crect[1] = crect[2] = crect[3] = col; crect += 4; } } - + if (tga.imgdes & 0x20) { IMB_flipy(ibuf); } if (ibuf->rect) IMB_convert_rgba_to_abgr(ibuf); - + return ibuf; } diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 831924b780a..a35ca7f0c47 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -223,7 +223,7 @@ static bool uri_from_filename(const char *path, char *uri) { char orig_uri[URI_MAX]; const char *dirstart = path; - + #ifdef WIN32 { char vol[3]; diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c index 7ed725ae163..9cf1b96635b 100644 --- a/source/blender/imbuf/intern/thumbs_blend.c +++ b/source/blender/imbuf/intern/thumbs_blend.c @@ -145,7 +145,7 @@ void IMB_thumb_overlay_blend(unsigned int *thumb, int width, int height, float a { int x, y; int stride_x = (margin_r - margin_l) - 2; - + for (y = 0; y < height; y++) { for (x = 0; x < width; x++, px += 4) { int hline = 0, vline = 0; diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 914fcc4e847..0d650daa1c9 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -47,7 +47,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" - + #include "BKE_global.h" #include "IMB_imbuf_types.h" @@ -137,10 +137,10 @@ static tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n) nRemaining = 0; else nRemaining = mfile->size - mfile->offset; - + if (nCopy > nRemaining) nCopy = nRemaining; - + /* on EOF, return immediately and read (copy) nothing */ if (nCopy <= 0) return (0); @@ -165,7 +165,7 @@ static tsize_t imb_tiff_WriteProc(thandle_t handle, tdata_t data, tsize_t n) (void)handle; (void)data; (void)n; - + printf("imb_tiff_WriteProc: this function should not be called.\n"); return (-1); } @@ -208,7 +208,7 @@ static toff_t imb_tiff_SeekProc(thandle_t handle, toff_t ofs, int whence) break; default: /* no other types are supported - return an error */ - fprintf(stderr, + fprintf(stderr, "imb_tiff_SeekProc: " "Unsupported TIFF SEEK type.\n"); return (-1); @@ -243,12 +243,12 @@ static int imb_tiff_CloseProc(thandle_t handle) fprintf(stderr, "imb_tiff_CloseProc: !mfile || !mfile->mem!\n"); return (0); } - + /* virtually close the file */ mfile->mem = NULL; mfile->offset = 0; mfile->size = 0; - + return (0); } @@ -281,7 +281,7 @@ static TIFF *imb_tiff_client_open(ImbTIFFMemFile *memFile, const unsigned char * memFile->offset = 0; memFile->size = size; - return TIFFClientOpen("(Blender TIFF Interface Layer)", + return TIFFClientOpen("(Blender TIFF Interface Layer)", "r", (thandle_t)(memFile), imb_tiff_ReadProc, imb_tiff_WriteProc, imb_tiff_SeekProc, imb_tiff_CloseProc, @@ -369,7 +369,7 @@ static void imb_read_tiff_resolution(ImBuf *ibuf, TIFF *image) } } -/* +/* * Use the libTIFF scanline API to read a TIFF image. * This method is most flexible and can handle multiple different bit depths * and RGB channel orderings. @@ -408,7 +408,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image) imb_read_tiff_resolution(ibuf, image); scanline = TIFFScanlineSize(image); - + if (bitspersample == 32) { ib_flag = IB_rectfloat; fbuf = (float *)_TIFFmalloc(scanline); @@ -426,12 +426,12 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image) else { ib_flag = IB_rect; } - + tmpibuf = IMB_allocImBuf(ibuf->x, ibuf->y, ibuf->planes, ib_flag); if (!tmpibuf) { goto cleanup; } - + /* simple RGBA image */ if (!(bitspersample == 32 || bitspersample == 16)) { success |= TIFFReadRGBAImage(image, ibuf->x, ibuf->y, tmpibuf->rect, 0); @@ -440,11 +440,11 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image) else if (config == PLANARCONFIG_CONTIG) { for (row = 0; row < ibuf->y; row++) { size_t ib_offset = (size_t)ibuf->x * 4 * ((size_t)ibuf->y - ((size_t)row + 1)); - + if (bitspersample == 32) { success |= TIFFReadScanline(image, fbuf, row, 0); scanline_contig_32bit(tmpibuf->rect_float + ib_offset, fbuf, ibuf->x, spp); - + } else if (bitspersample == 16) { success |= TIFFReadScanline(image, sbuf, row, 0); @@ -454,13 +454,13 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image) /* separate channels: RRRGGGBBB */ } else if (config == PLANARCONFIG_SEPARATE) { - + /* imbufs always have 4 channels of data, so we iterate over all of them * but only fill in from the TIFF scanline where necessary. */ for (chan = 0; chan < 4; chan++) { for (row = 0; row < ibuf->y; row++) { size_t ib_offset = (size_t)ibuf->x * 4 * ((size_t)ibuf->y - ((size_t)row + 1)); - + if (bitspersample == 32) { if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */ copy_vn_fl(fbuf, ibuf->x, 1.0f); @@ -469,7 +469,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image) else success |= TIFFReadScanline(image, fbuf, row, chan); scanline_separate_32bit(tmpibuf->rect_float + ib_offset, fbuf, ibuf->x, chan); - + } else if (bitspersample == 16) { if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */ @@ -479,7 +479,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image) else success |= TIFFReadScanline(image, sbuf, row, chan); scanline_separate_16bit(tmpibuf->rect_float + ib_offset, sbuf, ibuf->x, chan); - + } } } @@ -490,7 +490,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image) if (bitspersample < 16) if (ENDIAN_ORDER == B_ENDIAN) IMB_convert_rgba_to_abgr(tmpibuf); - + /* assign rect last */ if (tmpibuf->rect_float) ibuf->rect_float = tmpibuf->rect_float; @@ -498,7 +498,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image) ibuf->rect = tmpibuf->rect; ibuf->mall |= ib_flag; ibuf->flags |= ib_flag; - + tmpibuf->mall &= ~ib_flag; } @@ -509,7 +509,7 @@ cleanup: _TIFFfree(sbuf); IMB_freeImBuf(tmpibuf); - + return success; } @@ -564,15 +564,15 @@ ImBuf *imb_loadtiff(const unsigned char *mem, size_t size, int flags, char color TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &width); TIFFGetField(image, TIFFTAG_IMAGELENGTH, &height); TIFFGetField(image, TIFFTAG_SAMPLESPERPIXEL, &spp); - + ib_depth = (spp == 3) ? 24 : 32; - + ibuf = IMB_allocImBuf(width, height, ib_depth, 0); if (ibuf) { ibuf->ftype = IMB_FTYPE_TIF; } else { - fprintf(stderr, + fprintf(stderr, "imb_loadtiff: could not allocate memory for TIFF " "image.\n"); TIFFClose(image); @@ -808,7 +808,7 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags) /* RGBA images */ TIFFSetField(image, TIFFTAG_EXTRASAMPLES, 1, extraSampleTypes); - TIFFSetField(image, TIFFTAG_PHOTOMETRIC, + TIFFSetField(image, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB); } else if (samplesperpixel == 3) { diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c index db57023500d..6a095b2da1f 100644 --- a/source/blender/imbuf/intern/util.c +++ b/source/blender/imbuf/intern/util.c @@ -166,7 +166,7 @@ int IMB_ispic_type(const char *name) BLI_assert(!BLI_path_is_rel(name)); if (UTIL_DEBUG) printf("%s: loading %s\n", __func__, name); - + if (BLI_stat(name, &st) == -1) return false; if (((st.st_mode) & S_IFMT) != S_IFREG) @@ -378,13 +378,13 @@ int imb_get_anim_type(const char *name) return ANIM_NONE; } - + bool IMB_isanim(const char *filename) { int type; type = imb_get_anim_type(filename); - + return (type && type != ANIM_SEQUENCE); } diff --git a/source/blender/imbuf/readme.txt b/source/blender/imbuf/readme.txt index d50cb8c781d..855f6229420 100644 --- a/source/blender/imbuf/readme.txt +++ b/source/blender/imbuf/readme.txt @@ -15,11 +15,11 @@ short imb_saveopenexr(struct ImBuf *ibuf, char *myfile, int flags); /* Used to test if its the correct format int IMB_is_openexr(void *buf); -Step 2: +Step 2: Add your hooks to read and write the image format these go in writeimage.c and readimage.c just look at how the others are done -Step 3: +Step 3: Add in IS_openexr to blender/source/blender/imbuf/IMB_imbuf_types.h Add in R_openexr to source/blender/makesdna/DNA_scene_types.h @@ -36,11 +36,11 @@ 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: +Step 6: Alter the build process: For cmake you need to edit blender/source/blender/imbuf/CMakeLists.txt and add in your additional files to source_files. -If you have any external library info you will also need to add that +If you have any external library info you will also need to add that to the various build processes. Step 7: diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 8043e01a147..62f8f1395c5 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -250,7 +250,7 @@ typedef struct Library { char filepath[1024]; struct Library *parent; /* set for indirectly linked libs, used in the outliner and while reading */ - + struct PackedFile *packedfile; /* Temp data needed by read/write code. */ diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 2266390d348..dac96b6ce5a 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -73,10 +73,10 @@ typedef enum eMotionPathVert_Flag { typedef struct bMotionPath { bMotionPathVert *points; /* path samples */ int length; /* the number of cached verts */ - + int start_frame; /* for drawing paths, the start frame number */ int end_frame; /* for drawing paths, the end frame number */ - + float color[3]; /* optional custom color */ int line_thickness; /* line thickness */ int flag; /* baking settings - eMotionPath_Flag */ @@ -97,7 +97,7 @@ typedef enum eMotionPath_Flag { /* Custom colors */ MOTIONPATH_FLAG_CUSTOM = (1 << 2), /* Draw lines or only points */ - MOTIONPATH_FLAG_LINES = (1 << 3) + MOTIONPATH_FLAG_LINES = (1 << 3) } eMotionPath_Flag; /* Visualization General --------------------------- */ @@ -108,22 +108,22 @@ typedef struct bAnimVizSettings { /* Onion-Skinning Settings ----------------- */ int ghost_sf, ghost_ef; /* start and end frames of ghost-drawing range (only used for GHOST_TYPE_RANGE) */ int ghost_bc, ghost_ac; /* number of frames before/after current frame to show */ - + short ghost_type; /* eOnionSkin_Types */ short ghost_step; /* number of frames between each ghost shown (not for GHOST_TYPE_KEYS) */ - + short ghost_flag; /* eOnionSkin_Flag */ - + /* General Settings ------------------------ */ short recalc; /* eAnimViz_RecalcFlags */ - + /* Motion Path Settings ------------------- */ short path_type; /* eMotionPath_Types */ short path_step; /* number of frames between points indicated on the paths */ - + short path_viewflag; /* eMotionPaths_ViewFlag */ short path_bakeflag; /* eMotionPaths_BakeFlag */ - + int path_sf, path_ef; /* start and end frames of path-calculation range */ int path_bc, path_ac; /* number of frames before/after current frame to show */ } bAnimVizSettings; @@ -204,19 +204,19 @@ typedef struct bPoseChannelDrawData { /* PoseChannel ------------------------------------ */ -/* PoseChannel +/* PoseChannel * * A PoseChannel stores the results of Actions and transform information * with respect to the restposition of Armature bones */ typedef struct bPoseChannel { struct bPoseChannel *next, *prev; - + IDProperty *prop; /* User-Defined Properties on this PoseChannel */ - + ListBase constraints; /* Constraints that act on this PoseChannel */ char name[64]; /* need to match bone name length: MAXBONENAME */ - + short flag; /* dynamic, for detecting transform changes */ short ikflag; /* settings for IK bones */ short protectflag; /* protect channels from being transformed */ @@ -253,7 +253,7 @@ typedef struct bPoseChannel { float rotAxis[3], rotAngle; /* axis-angle rotation */ short rotmode; /* eRotationModes - rotation representation to use */ short pad; - + float chan_mat[4][4]; /* matrix result of loc/quat/size, and where we put deform in, see next line */ float pose_mat[4][4]; /* constraints accumulate here. in the end, pose_mat = bone->arm_mat * chan_mat * this matrix is object space */ @@ -261,23 +261,23 @@ typedef struct bPoseChannel { float disp_tail_mat[4][4]; /* for display, pose_mat with bone length applied and translated to tail*/ float constinv[4][4]; /* inverse result of constraints. * doesn't include effect of restposition, parent, and local transform*/ - + float pose_head[3]; /* actually pose_mat[3] */ float pose_tail[3]; /* also used for drawing help lines... */ - + float limitmin[3], limitmax[3]; /* DOF constraint, note! - these are stored in degrees, not radians */ float stiffness[3]; /* DOF stiffness */ float ikstretch; float ikrotweight; /* weight of joint rotation constraint */ float iklinweight; /* weight of joint stretch constraint */ - + /* curved bones settings - these are for animating, and are applied on top of the copies in pchan->bone */ float roll1, roll2; float curveInX, curveInY; float curveOutX, curveOutY; float ease1, ease2; float scaleIn, scaleOut; - + struct bPoseChannel *bbone_prev; /* next/prev bones to use as handle references when calculating bbones (optional) */ struct bPoseChannel *bbone_next; @@ -296,16 +296,16 @@ typedef enum ePchan_Flag { POSE_LOC = (1 << 0), POSE_ROT = (1 << 1), POSE_SIZE = (1 << 2), - + /* old IK/cache stuff - * - used to be here from (1 << 3) to (1 << 8) + * - used to be here from (1 << 3) to (1 << 8) * but has been repurposed since 2.77.2 * as they haven't been used in over 10 years */ - + /* has BBone deforms */ POSE_BBONE_SHAPE = (1 << 3), - + /* IK/Pose solving */ POSE_CHAIN = (1 << 9), POSE_DONE = (1 << 10), @@ -383,8 +383,8 @@ typedef enum eRotationModes { ROT_MODE_YZX = 4, ROT_MODE_ZXY = 5, ROT_MODE_ZYX = 6, - /* NOTE: space is reserved here for 18 other possible - * euler rotation orders not implemented + /* NOTE: space is reserved here for 18 other possible + * euler rotation orders not implemented */ /* axis angle rotations */ ROT_MODE_AXISANGLE = -1, @@ -395,7 +395,7 @@ typedef enum eRotationModes { /* Pose ------------------------------------ */ -/* Pose-Object. +/* Pose-Object. * * It is only found under ob->pose. It is not library data, even * though there is a define for it (hack for the outliner). @@ -412,19 +412,19 @@ typedef struct bPose { short flag, pad; unsigned int proxy_layer; /* proxy layer: copy from armature, gets synced */ int pad1; - + float ctime; /* local action time of this pose */ float stride_offset[3]; /* applied to object */ float cyclic_offset[3]; /* result of match and cycles, applied in BKE_pose_where_is() */ - - + + ListBase agroups; /* list of bActionGroups */ - + int active_group; /* index of active group (starts from 1) */ int iksolver; /* ik solver to use, see ePose_IKSolverType */ void *ikdata; /* temporary IK data, depends on the IK solver. Not saved in file */ void *ikparam; /* IK solver parameters, structure depends on iksolver */ - + bAnimVizSettings avs; /* settings for visualization of bone animation */ char proxy_act_bone[64]; /* proxy active bone name, MAXBONENAME */ } bPose; @@ -514,13 +514,13 @@ typedef enum eItasc_Solver { */ typedef struct bActionGroup { struct bActionGroup *next, *prev; - + ListBase channels; /* Note: this must not be touched by standard listbase functions which would clear links to other channels */ - + int flag; /* settings for this action-group */ int customCol; /* index of custom color set to use when used for bones (0=default - used for all old files, -1=custom set) */ char name[64]; /* name of the group */ - + ThemeWireColor cs; /* color set to use when customCol == -1 */ } bActionGroup; @@ -543,7 +543,7 @@ typedef enum eActionGroup_Flag { /* sub channel modifiers off */ AGRP_MODIFIERS_OFF = (1 << 7), - + AGRP_TEMP = (1 << 30), AGRP_MOVED = (1u << 31) } eActionGroup_Flag; @@ -551,7 +551,7 @@ typedef enum eActionGroup_Flag { /* Actions -------------------------------------- */ -/* Action - reusable F-Curve 'bag' (act) +/* Action - reusable F-Curve 'bag' (act) * * This contains F-Curves that may affect settings from more than one ID blocktype and/or * datablock (i.e. sub-data linked/used directly to the ID block that the animation data is linked to), @@ -563,15 +563,15 @@ typedef enum eActionGroup_Flag { */ typedef struct bAction { ID id; /* ID-serialisation for relinking */ - + ListBase curves; /* function-curves (FCurve) */ ListBase chanbase DNA_DEPRECATED; /* legacy data - Action Channels (bActionChannel) in pre-2.5 animation system */ ListBase groups; /* groups of function-curves (bActionGroup) */ ListBase markers; /* markers local to the Action (used to provide Pose-Libraries) */ - + int flag; /* settings for this action */ int active_marker; /* index of the active marker */ - + int idroot; /* type of ID-blocks that action can be assigned to (if 0, will be set to whatever ID first evaluates it) */ int pad; } bAction; @@ -597,13 +597,13 @@ typedef enum eAction_Flags { typedef struct bDopeSheet { ID *source; /* currently ID_SCE (for Dopesheet), and ID_SC (for Grease Pencil) */ ListBase chanbase; /* cache for channels (only initialized when pinned) */ // XXX not used! - + struct Collection *filter_grp; /* object group for ADS_FILTER_ONLYOBGROUP filtering option */ char searchstr[64]; /* string to search for in displayed names of F-Curves for ADS_FILTER_BY_FCU_NAME filtering option */ - + int filterflag; /* flags to use for filtering data */ int flag; /* standard flags */ - + int renameIndex; /* index+1 of channel to rename - only gets set by renaming operator */ int pad; } bDopeSheet; @@ -613,7 +613,7 @@ typedef struct bDopeSheet { typedef enum eDopeSheet_FilterFlag { /* general filtering */ ADS_FILTER_ONLYSEL = (1 << 0), /* only include channels relating to selected data */ - + /* temporary filters */ ADS_FILTER_ONLYDRIVERS = (1 << 1), /* for 'Drivers' editor - only include Driver data from AnimData */ ADS_FILTER_ONLYNLA = (1 << 2), /* for 'NLA' editor - only include NLA data from AnimData */ @@ -652,22 +652,22 @@ typedef enum eDopeSheet_FilterFlag { ADS_FILTER_INCL_HIDDEN = (1 << 26), /* include 'hidden' channels too (i.e. those from hidden Objects/Bones) */ ADS_FILTER_BY_FCU_NAME = (1 << 27), /* for F-Curves, filter by the displayed name (i.e. to isolate all Location curves only) */ ADS_FILTER_ONLY_ERRORS = (1 << 28), /* show only F-Curves which are disabled/have errors - for debugging drivers */ - + /* GPencil Mode */ ADS_FILTER_GP_3DONLY = (1 << 29), /* GP Mode - Only show datablocks used in the scene */ - + /* combination filters (some only used at runtime) */ ADS_FILTER_NOOBDATA = (ADS_FILTER_NOCAM | ADS_FILTER_NOMAT | ADS_FILTER_NOLAM | ADS_FILTER_NOCUR | ADS_FILTER_NOPART | ADS_FILTER_NOARM | ADS_FILTER_NOSPK | ADS_FILTER_NOMODIFIERS) -} eDopeSheet_FilterFlag; +} eDopeSheet_FilterFlag; /* DopeSheet general flags */ typedef enum eDopeSheet_Flag { ADS_FLAG_SUMMARY_COLLAPSED = (1 << 0), /* when summary is shown, it is collapsed, so all other channels get hidden */ ADS_FLAG_SHOW_DBFILTERS = (1 << 1), /* show filters for datablocks */ - + ADS_FLAG_FUZZY_NAMES = (1 << 2), /* use fuzzy/partial string matches when ADS_FILTER_BY_FCU_NAME is enabled (WARNING: expensive operation) */ ADS_FLAG_NO_DB_SORT = (1 << 3), /* do not sort datablocks (mostly objects) by name (NOTE: potentially expensive operation) */ - + /* NOTE: datablock filter flags continued (1 << 10) onwards... */ } eDopeSheet_Flag; @@ -683,14 +683,14 @@ typedef struct SpaceAction { /* End 'SpaceLink' header. */ View2D v2d DNA_DEPRECATED; /* copied to region */ - + bAction *action; /* the currently active action */ bDopeSheet ads; /* the currently active context (when not showing action) */ - + char mode, autosnap; /* mode: editing context; autosnap: automatic keyframe snapping mode */ short flag; /* flag: bitmapped settings; */ float timeslide; /* for Time-Slide transform mode drawing - current frame? */ - + int cache_display; /* (eTimeline_Cache_Flag) */ int pad; } SpaceAction; @@ -721,7 +721,7 @@ typedef enum eSAction_Flag { SACTION_NOREALTIMEUPDATES = (1 << 10), /* move markers as well as keyframes */ SACTION_MARKERS_MOVE = (1 << 11) -} eSAction_Flag; +} eSAction_Flag; /* SpaceAction Mode Settings */ typedef enum eAnimEdit_Context { @@ -786,10 +786,10 @@ typedef enum eTimeline_Cache_Flag { typedef struct bActionChannel { struct bActionChannel *next, *prev; bActionGroup *grp; /* Action Group this Action Channel belongs to */ - + struct Ipo *ipo; /* IPO block this action channel references */ ListBase constraintChannels; /* Constraint Channels (when Action Channel represents an Object or Bone) */ - + int flag; /* settings accessed via bitmapping */ char name[64]; /* channel name, MAX_NAME */ int temp; /* temporary setting - may be used to indicate group that channel belongs to during syncing */ diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index 63dc8920a4b..22067b87ff8 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -44,30 +44,30 @@ extern "C" { /* Modifiers -------------------------------------- */ -/* F-Curve Modifiers (fcm) +/* F-Curve Modifiers (fcm) * * These alter the way F-Curves behave, by altering the value that is returned * when evaluating the curve's data at some time (t). */ typedef struct FModifier { struct FModifier *next, *prev; - + struct FCurve *curve; /* containing curve, only used for updates to CYCLES */ void *data; /* pointer to modifier data */ - + char name[64]; /* user-defined description for the modifier - MAX_ID_NAME-2 */ short type; /* type of f-curve modifier */ short flag; /* settings for the modifier */ - + float influence; /* the amount that the modifier should influence the value */ - + float sfra; /* start frame of restricted frame-range */ float efra; /* end frame of restricted frame-range */ float blendin; /* number of frames from sfra before modifier takes full influence */ float blendout; /* number of frames from efra before modifier fades out */ } FModifier; -/* Types of F-Curve modifier +/* Types of F-Curve modifier * WARNING: order here is important! */ typedef enum eFModifier_Types { @@ -81,7 +81,7 @@ typedef enum eFModifier_Types { FMODIFIER_TYPE_PYTHON = 7, FMODIFIER_TYPE_LIMITS = 8, FMODIFIER_TYPE_STEPPED = 9, - + /* NOTE: all new modifiers must be added above this line */ FMODIFIER_NUM_TYPES } eFModifier_Types; @@ -100,7 +100,7 @@ typedef enum eFModifier_Flags { FMODIFIER_FLAG_RANGERESTRICT = (1<<4), /* use influence control */ FMODIFIER_FLAG_USEINFLUENCE = (1<<5) -} eFModifier_Flags; +} eFModifier_Flags; /* --- */ @@ -109,10 +109,10 @@ typedef struct FMod_Generator { /* general generator information */ float *coefficients; /* coefficients array */ unsigned int arraysize; /* size of the coefficients array */ - + int poly_order; /* order of polynomial generated (i.e. 1 for linear, 2 for quadratic) */ int mode; /* which 'generator' to use eFMod_Generator_Modes */ - + /* settings */ int flag; /* settings */ } FMod_Generator; @@ -124,7 +124,7 @@ typedef enum eFMod_Generator_Modes { } eFMod_Generator_Modes; -/* generator flags +/* generator flags * - shared by Generator and Function Generator */ typedef enum eFMod_Generator_Flags { @@ -147,7 +147,7 @@ typedef struct FMod_FunctionGenerator { float phase_multiplier; float phase_offset; float value_offset; - + /* flags */ int type; /* eFMod_Generator_Functions */ int flag; /* eFMod_Generator_flags */ @@ -168,7 +168,7 @@ typedef enum eFMod_Generator_Functions { typedef struct FCM_EnvelopeData { float min, max; /* min/max values for envelope at this point (absolute values) */ float time; /* time for that this sample-point occurs */ - + short f1; /* settings for 'min' control point */ short f2; /* settings for 'max' control point */ } FCM_EnvelopeData; @@ -177,7 +177,7 @@ typedef struct FCM_EnvelopeData { typedef struct FMod_Envelope { FCM_EnvelopeData *data; /* data-points defining envelope to apply (array) */ int totvert; /* number of envelope points */ - + float midval; /* value that envelope's influence is centered around / based on */ float min, max; /* distances from 'middle-value' for 1:1 envelope influence */ } FMod_Envelope; @@ -230,11 +230,11 @@ typedef struct FMod_Noise { float strength; float phase; float offset; - + short depth; short modification; } FMod_Noise; - + /* modification modes */ typedef enum eFMod_Noise_Modifications { FCM_NOISE_MODIF_REPLACE = 0, /* Modify existing curve, matching it's shape */ @@ -269,31 +269,31 @@ typedef enum eFMod_Stepped_Flags { */ typedef struct DriverTarget { ID *id; /* ID-block which owns the target, no user count */ - + char *rna_path; /* RNA path defining the setting to use (for DVAR_TYPE_SINGLE_PROP) */ - + char pchan_name[64]; /* name of the posebone to use (for vars where DTAR_FLAG_STRUCT_REF is used) - MAX_ID_NAME-2 */ short transChan; /* transform channel index (for DVAR_TYPE_TRANSFORM_CHAN)*/ - + short flag; /* flags for the validity of the target (NOTE: these get reset every time the types change) */ int idtype; /* type of ID-block that this target can use */ } DriverTarget; /* Driver Target flags */ typedef enum eDriverTarget_Flag { - /* used for targets that use the pchan_name instead of RNA path - * (i.e. rotation difference) + /* used for targets that use the pchan_name instead of RNA path + * (i.e. rotation difference) */ DTAR_FLAG_STRUCT_REF = (1 << 0), /* idtype can only be 'Object' */ DTAR_FLAG_ID_OB_ONLY = (1 << 1), - + /* "localspace" flags */ /* base flag - basically "pre parent+constraints" */ DTAR_FLAG_LOCALSPACE = (1 << 2), /* include constraints transformed to space including parents */ DTAR_FLAG_LOCAL_CONSTS = (1 << 3), - + /* error flags */ DTAR_FLAG_INVALID = (1 << 4), } eDriverTarget_Flag; @@ -309,7 +309,7 @@ typedef enum eDriverTarget_TransformChannels { DTAR_TRANSCHAN_SCALEX, DTAR_TRANSCHAN_SCALEY, DTAR_TRANSCHAN_SCALEZ, - + MAX_DTAR_TRANSCHAN_TYPES } eDriverTarget_TransformChannels; @@ -328,14 +328,14 @@ typedef enum eDriverTarget_TransformChannels { */ typedef struct DriverVar { struct DriverVar *next, *prev; - + char name[64]; /* name of the variable to use in py-expression (must be valid python identifier) - MAX_ID_NAME-2 */ - + DriverTarget targets[8]; /* MAX_DRIVER_TARGETS, target slots */ - + char num_targets; /* number of targets actually used by this variable */ char type; /* type of driver variable (eDriverVar_Types) */ - + short flag; /* validation tags, etc. (eDriverVar_Flags) */ float curval; /* result of previous evaluation */ } DriverVar; @@ -350,8 +350,8 @@ typedef enum eDriverVar_Types { DVAR_TYPE_LOC_DIFF, /* 'final' transform for object/bones */ DVAR_TYPE_TRANSFORM_CHAN, - - /* maximum number of variable types + + /* maximum number of variable types * NOTE: this must always be th last item in this list, * so add new types above this line */ @@ -362,7 +362,7 @@ typedef enum eDriverVar_Types { typedef enum eDriverVar_Flags { /* variable is not set up correctly */ DVAR_FLAG_ERROR = (1 << 0), - + /* variable name doesn't pass the validation tests */ DVAR_FLAG_INVALID_NAME = (1 << 1), /* name starts with a number */ @@ -408,16 +408,16 @@ typedef enum eDriverVar_Flags { */ typedef struct ChannelDriver { ListBase variables; /* targets for this driver (i.e. list of DriverVar) */ - - /* python expression to execute (may call functions defined in an accessory file) + + /* python expression to execute (may call functions defined in an accessory file) * which relates the target 'variables' in some way to yield a single usable value */ char expression[256]; /* expression to compile for evaluation */ void *expr_comp; /* PyObject - compiled expression, don't save this */ - + float curval; /* result of previous evaluation */ float influence; /* influence of driver on result */ // XXX to be implemented... this is like the constraint influence setting - + /* general settings */ int type; /* type of driver */ int flag; /* settings of driver */ @@ -471,20 +471,20 @@ typedef struct FPoint { /* 'Function-Curve' - defines values over time for a given setting (fcu) */ typedef struct FCurve { struct FCurve *next, *prev; - + /* group */ bActionGroup *grp; /* group that F-Curve belongs to */ - + /* driver settings */ ChannelDriver *driver; /* only valid for drivers (i.e. stored in AnimData not Actions) */ /* evaluation settings */ ListBase modifiers; /* FCurve Modifiers */ - + /* motion data */ BezTriple *bezt; /* user-editable keyframes (array) */ FPoint *fpt; /* 'baked/imported' motion samples (array) */ unsigned int totvert; /* total number of points which define the curve (i.e. size of arrays in FPoints) */ - + /* value cache + settings */ float curval; /* value stored from last time curve was evaluated (not threadsafe, debug display only!) */ /* Value which comes from original DNA ddatablock at a time f-curve was evaluated. */ @@ -492,13 +492,13 @@ typedef struct FCurve { short flag; /* user-editable settings for this curve */ short extend; /* value-extending mode for this curve (does not cover */ char auto_smoothing; /* auto-handle smoothing mode */ - + char pad[3]; /* RNA - data link */ int array_index; /* if applicable, the index of the RNA-array item to get */ char *rna_path; /* RNA-path to resolve data-access */ - + /* curve coloring (for editor) */ int color_mode; /* coloring method to use (eFCurve_Coloring) */ float color[3]; /* the last-color this curve took */ @@ -519,7 +519,7 @@ typedef enum eFCurve_Flags { FCURVE_PROTECTED = (1<<3), /* fcurve will not be evaluated for the next round */ FCURVE_MUTED = (1<<4), - + /* fcurve uses 'auto-handles', which stay horizontal... */ // DEPRECATED FCURVE_AUTO_HANDLES = (1<<5), @@ -530,7 +530,7 @@ typedef enum eFCurve_Flags { FCURVE_INT_VALUES = (1<<11), /* curve can only have certain discrete-number values (no interpolation at all, for enums/booleans) */ FCURVE_DISCRETE_VALUES = (1<<12), - + /* temporary tag for editing */ FCURVE_TAGGED = (1<<15) } eFCurve_Flags; @@ -562,7 +562,7 @@ typedef enum eFCurve_Smoothing { * they are not stored here... see DNA_action_types.h instead */ - + /* ************************************************ */ /* Animation Reuse - i.e. users of Actions */ @@ -581,7 +581,7 @@ typedef struct AnimMapPair { char to[128]; /* part of path to replace with */ } AnimMapPair; -/* Retargetting Information for Actions +/* Retargetting Information for Actions * * This should only be used if it is strictly necessary (i.e. user will need to explicitly * add this when they find that some channels do not match, or motion is not going to right @@ -594,7 +594,7 @@ typedef struct AnimMapPair { // such consequences... typedef struct AnimMapper { struct AnimMapper *next, *prev; - + bAction *target; /* target action */ ListBase mappings; /* remapping table (bAnimMapPair) */ } AnimMapper; @@ -700,14 +700,14 @@ typedef enum eNlaStrip_Flag { } eNlaStrip_Flag; /* NLA Strip Type */ -typedef enum eNlaStrip_Type { +typedef enum eNlaStrip_Type { /* 'clip' - references an Action */ NLASTRIP_TYPE_CLIP = 0, /* 'transition' - blends between the adjacent strips */ NLASTRIP_TYPE_TRANSITION, /* 'meta' - a strip which acts as a container for a few others */ NLASTRIP_TYPE_META, - + /* 'emit sound' - a strip which is used for timing when speaker emits sounds */ NLASTRIP_TYPE_SOUND } eNlaStrip_Type; @@ -723,12 +723,12 @@ typedef enum eNlaStrip_Type { */ typedef struct NlaTrack { struct NlaTrack *next, *prev; - + ListBase strips; /* bActionStrips in this track */ - + int flag; /* settings for this track */ int index; /* index of the track in the stack (NOTE: not really useful, but we need a pad var anyways!) */ - + char name[64]; /* short user-description of this track - MAX_ID_NAME-2 */ } NlaTrack; @@ -744,7 +744,7 @@ typedef enum eNlaTrack_Flag { NLATRACK_SOLO = (1<<3), /* track's settings (and strips) cannot be edited (to guard against unwanted changes) */ NLATRACK_PROTECTED = (1<<4), - + /* track is not allowed to execute, usually as result of tweaking being enabled (internal flag) */ NLATRACK_DISABLED = (1<<10) } eNlaTrack_Flag; @@ -753,7 +753,7 @@ typedef enum eNlaTrack_Flag { /* ************************************ */ /* KeyingSet Datatypes */ -/* Path for use in KeyingSet definitions (ksp) +/* Path for use in KeyingSet definitions (ksp) * * Paths may be either specific (specifying the exact sub-ID * dynamic data-block - such as PoseChannels - to act upon, ala @@ -763,18 +763,18 @@ typedef enum eNlaTrack_Flag { */ typedef struct KS_Path { struct KS_Path *next, *prev; - + ID *id; /* ID block that keyframes are for */ char group[64]; /* name of the group to add to - MAX_ID_NAME-2 */ - + int idtype; /* ID-type that path can be used on */ - + short groupmode; /* group naming (eKSP_Grouping) */ short flag; /* various settings, etc. */ - + char *rna_path; /* dynamically (or statically in the case of predefined sets) path */ int array_index; /* index that path affects */ - + short keyingflag; /* (eInsertKeyFlags) settings to supply insertkey() with */ short keyingoverride; /* (eInsertKeyFlags) for each flag set, the relevant keyingflag bit overrides the default */ } KS_Path; @@ -793,14 +793,14 @@ typedef enum eKSP_Grouping { KSP_GROUP_NONE, /* path should be grouped using KeyingSet's name */ KSP_GROUP_KSNAME, - /* path should be grouped using name of inner-most context item from templates + /* path should be grouped using name of inner-most context item from templates * - this is most useful for relative KeyingSets only */ KSP_GROUP_TEMPLATE_ITEM } eKSP_Grouping; /* ---------------- */ - + /* KeyingSet definition (ks) * * A KeyingSet defines a group of properties that should @@ -813,21 +813,21 @@ typedef enum eKSP_Grouping { */ typedef struct KeyingSet { struct KeyingSet *next, *prev; - + ListBase paths; /* (KS_Path) paths to keyframe to */ - + char idname[64]; /* unique name (for search, etc.) - MAX_ID_NAME-2 */ char name[64]; /* user-viewable name for KeyingSet (for menus, etc.) - MAX_ID_NAME-2 */ char description[240]; /* (RNA_DYN_DESCR_MAX) short help text. */ char typeinfo[64]; /* name of the typeinfo data used for the relative paths - MAX_ID_NAME-2 */ - + int active_path; /* index of the active path */ - + short flag; /* settings for KeyingSet */ - + short keyingflag; /* (eInsertKeyFlags) settings to supply insertkey() with */ short keyingoverride; /* (eInsertKeyFlags) for each flag set, the relevant keyingflag bit overrides the default */ - + char pad[6]; } KeyingSet; @@ -860,7 +860,7 @@ typedef enum eInsertKeyFlags { /* AnimOverride ------------------------------------- */ -/* Animation Override (aor) +/* Animation Override (aor) * * This is used to as temporary storage of values which have been changed by the user, but not * yet keyframed (thus, would get overwritten by the animation system before the user had a chance @@ -871,10 +871,10 @@ typedef enum eInsertKeyFlags { */ typedef struct AnimOverride { struct AnimOverride *next, *prev; - + char *rna_path; /* RNA-path to use to resolve data-access */ int array_index; /* if applicable, the index of the RNA-array item to get */ - + float value; /* value to override setting with */ } AnimOverride; @@ -968,7 +968,7 @@ typedef enum eAnimData_Recalc { /* Base Struct for Anim ------------------------------------- */ -/* Used for BKE_animdata_from_id() +/* Used for BKE_animdata_from_id() * All ID-datablocks which have their own 'local' AnimData * should have the same arrangement in their structs. */ diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index 9e278c63904..af555fe6d83 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -67,17 +67,17 @@ typedef struct Bone { float dist, weight; /* dist, weight: for non-deformgroup deforms */ float xwidth, length, zwidth; /* width: for block bones. keep in this order, transform! */ float rad_head, rad_tail; /* radius for head/tail sphere, defining deform as well, parent->rad_tip overrides rad_head */ - + float roll1, roll2; /* curved bones settings - these define the "restpose" for a curved bone */ float curveInX, curveInY; float curveOutX, curveOutY; float ease1, ease2; /* length of bezier handles */ float scaleIn, scaleOut; - + float size[3]; /* patch for upward compat, UNUSED! */ int layer; /* layers that bone appears on */ short segments; /* for B-bones */ - + short pad1; } Bone; @@ -211,7 +211,7 @@ typedef enum eBone_Flag { BONE_NO_LOCAL_LOCATION = (1 << 22), /* bone location is in armature space */ BONE_RELATIVE_PARENTING = (1 << 23), /* object child will use relative transform (like deform) */ BONE_ADD_PARENT_END_ROLL = (1 << 24) /* it will add the parent end roll to the inroll */ - + } eBone_Flag; #define MAXBONENAME 64 diff --git a/source/blender/makesdna/DNA_boid_types.h b/source/blender/makesdna/DNA_boid_types.h index 44764eb012e..a161fde119e 100644 --- a/source/blender/makesdna/DNA_boid_types.h +++ b/source/blender/makesdna/DNA_boid_types.h @@ -154,7 +154,7 @@ typedef struct BoidState { ListBase actions; char name[32]; int id, flag; - + /* rules */ int ruleset_type; float rule_fuzziness; diff --git a/source/blender/makesdna/DNA_camera_types.h b/source/blender/makesdna/DNA_camera_types.h index b3c568fab98..7bf89887d8c 100644 --- a/source/blender/makesdna/DNA_camera_types.h +++ b/source/blender/makesdna/DNA_camera_types.h @@ -77,8 +77,8 @@ typedef struct CameraBGImage { typedef struct Camera { ID id; - struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ - + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ + char type; /* CAM_PERSP, CAM_ORTHO or CAM_PANO */ char dtx; /* draw type extra */ short flag; @@ -94,7 +94,7 @@ typedef struct Camera { float YF_dofdist; struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */ - + struct Object *dof_ob; struct GPUDOFSettings gpu_dof; diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h index 00995bcf290..940872fd08d 100644 --- a/source/blender/makesdna/DNA_cloth_types.h +++ b/source/blender/makesdna/DNA_cloth_types.h @@ -78,7 +78,7 @@ typedef struct ClothSimSettings { float vel_damping; /* damp the velocity to speed up getting to the resting position */ float shrink_min; /* min amount to shrink cloth by 0.0f (no shrink) - 1.0f (shrink to nothing) */ float shrink_max; /* max amount to shrink cloth by 0.0f (no shrink) - 1.0f (shrink to nothing) */ - + /* XXX various hair stuff * should really be separate, this struct is a horrible mess already */ diff --git a/source/blender/makesdna/DNA_color_types.h b/source/blender/makesdna/DNA_color_types.h index 6f9c407c6c6..8ed38b0b05d 100644 --- a/source/blender/makesdna/DNA_color_types.h +++ b/source/blender/makesdna/DNA_color_types.h @@ -55,7 +55,7 @@ enum { typedef struct CurveMap { short totpoint, flag; - + float range; /* quick multiply value for reading table */ float mintable, maxtable; /* the x-axis range for the table */ float ext_in[2], ext_out[2]; /* for extrapolated curves, the direction vector */ @@ -74,13 +74,13 @@ typedef struct CurveMapping { int flag, cur; /* cur; for buttons, to show active curve */ int preset; int changed_timestamp; - + rctf curr, clipr; /* current rect, clip rect (is default rect too) */ - + CurveMap cm[4]; /* max 4 builtin curves per mapping struct now */ float black[3], white[3]; /* black/white point (black[0] abused for current frame) */ float bwmul[3]; /* black/white point multiply value, for speed */ - + float sample[3]; /* sample values, if flag set it draws line and intersection */ } CurveMapping; diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index 6f6ce7d08db..ada4073f51f 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -53,23 +53,23 @@ typedef struct bConstraintChannel { /* A Constraint */ typedef struct bConstraint { struct bConstraint *next, *prev; - + void *data; /* Constraint data (a valid constraint type) */ short type; /* Constraint type */ short flag; /* Flag - General Settings */ - + char ownspace; /* Space that owner should be evaluated in */ char tarspace; /* Space that target should be evaluated in (only used if 1 target) */ - + char name[64]; /* Constraint name, MAX_NAME */ - + short pad; - + float enforce; /* Amount of influence exherted by constraint (0.0-1.0) */ float headtail; /* Point along subtarget bone where the actual target is. 0=head (default for all), 1=tail*/ - + struct Ipo *ipo DNA_DEPRECATED; /* local influence ipo or driver */ /* old animation system, deprecated for 2.5 */ - + /* below are readonly fields that are set at runtime by the solver for use in the GE (only IK atm) */ float lin_error; /* residual error on constraint expressed in blender unit*/ float rot_error; /* residual error on constraint expressed in radiant */ @@ -87,9 +87,9 @@ typedef struct bConstraintTarget { struct Object *tar; /* object to use as target */ char subtarget[64]; /* subtarget - pchan or vgroup name, MAX_ID_NAME-2 */ - + float matrix[4][4]; /* matrix used during constraint solving - should be cleared before each use */ - + short space; /* space that target should be evaluated in (overrides bConstraint->tarspace) */ short flag; /* runtime settings (for editor, etc.) */ short type; /* type of target (eConstraintObType) */ @@ -111,15 +111,15 @@ typedef enum eConstraintObType { /* Python Script Constraint */ -typedef struct bPythonConstraint { +typedef struct bPythonConstraint { struct Text *text; /* text-buffer (containing script) to execute */ IDProperty *prop; /* 'id-properties' used to store custom properties for constraint */ - + int flag; /* general settings/state indicators accessed by bitmapping */ int tarnum; /* number of targets - usually only 1-3 are needed */ - + ListBase targets; /* a list of targets that this constraint has (bConstraintTarget-s) */ - + struct Object *tar; /* target from previous implementation (version-patch sets this to NULL on file-load) */ char subtarget[64]; /* subtarger from previous implentation (version-patch sets this to "" on file-load), MAX_ID_NAME-2 */ } bPythonConstraint; @@ -155,7 +155,7 @@ typedef enum eConstraint_IK_Type { } eConstraint_IK_Type; -/* Spline IK Constraint +/* Spline IK Constraint * Aligns 'n' bones to the curvature defined by the curve, * with the chain ending on the bone that owns this constraint, * and starting on the nth parent. @@ -163,16 +163,16 @@ typedef enum eConstraint_IK_Type { typedef struct bSplineIKConstraint { /* target(s) */ struct Object *tar; /* curve object (with follow path enabled) which drives the bone chain */ - + /* binding details */ float *points; /* array of numpoints items, denoting parametric positions along curve that joints should follow */ short numpoints; /* number of points to bound in points array */ short chainlen; /* number of bones ('n') that are in the chain */ - + /* settings */ short flag; /* general settings for constraint */ short xzScaleMode; /* method used for determining the x & z scaling of the bones */ - + /* volume preservation settings */ float bulge; float bulge_min; @@ -276,12 +276,12 @@ typedef struct bDampTrackConstraint { /* Follow Path constraints */ typedef struct bFollowPathConstraint { struct Object *tar; /* Must be path object */ - + float offset; /* Offset in time on the path (in frames), when NOT using 'fixed position' */ float offset_fac; /* Parametric offset factor defining position along path, when using 'fixed position' */ - + int followflag; - + short trackflag; short upflag; } bFollowPathConstraint; @@ -290,7 +290,7 @@ typedef struct bFollowPathConstraint { typedef struct bStretchToConstraint { struct Object *tar; int flag; - int volmode; + int volmode; int plane; float orglength; float bulge; @@ -340,11 +340,11 @@ typedef struct bChildOfConstraint { typedef struct bTransformConstraint { struct Object *tar; /* target (i.e. 'driver' object/bone) */ char subtarget[64]; /* MAX_ID_NAME-2 */ - + short from, to; /* can be loc(0), rot(1) or size(2) */ char map[3]; /* defines which target-axis deform is copied by each owner-axis */ char expo; /* extrapolate motion? if 0, confine to ranges */ - + float from_min[3]; /* from_min/max defines range of target transform */ float from_max[3]; /* to map on to to_min/max range. */ float to_min[3]; /* range of motion on owner caused by target */ @@ -369,12 +369,12 @@ typedef struct bPivotConstraint { struct Object *tar; /* target object (optional) */ char subtarget[64]; /* subtarget name (optional), MAX_ID_NAME-2 */ float offset[3]; /* offset from the target to use, regardless of whether it exists */ - + /* Rotation-driven activation: * This option provides easier one-stop setups for footrolls */ short rotAxis; /* rotation axes to consider for this (ePivotConstraint_Axis) */ - + /* General flags */ short flag; /* ePivotConstraint_Flag */ } bPivotConstraint; @@ -411,10 +411,10 @@ typedef struct bSizeLimitConstraint { typedef struct bDistLimitConstraint { struct Object *tar; char subtarget[64]; /* MAX_ID_NAME-2 */ - + float dist; /* distance (radius of clamping sphere) from target */ float soft; /* distance from clamping-sphere to start applying 'fade' */ - + short flag; /* settings */ short mode; /* how to limit in relation to clamping sphere */ int pad; @@ -466,7 +466,7 @@ typedef struct bTransformCacheConstraint { /* ------------------------------------------ */ -/* bConstraint->type +/* bConstraint->type * - Do not ever change the order of these, or else files could get * broken as their correct value cannot be resolved */ @@ -486,7 +486,7 @@ typedef enum eBConstraint_Types { CONSTRAINT_TYPE_ACTION = 12, CONSTRAINT_TYPE_LOCKTRACK = 13, /* New Tracking constraint that locks an axis in place - theeth */ CONSTRAINT_TYPE_DISTLIMIT = 14, /* limit distance */ - CONSTRAINT_TYPE_STRETCHTO = 15, /* claiming this to be mine :) is in tuhopuu bjornmose */ + CONSTRAINT_TYPE_STRETCHTO = 15, /* claiming this to be mine :) is in tuhopuu bjornmose */ CONSTRAINT_TYPE_MINMAX = 16, /* floor constraint */ /* CONSTRAINT_TYPE_DEPRECATED = 17 */ CONSTRAINT_TYPE_CLAMPTO = 18, /* clampto constraint */ @@ -501,21 +501,21 @@ typedef enum eBConstraint_Types { CONSTRAINT_TYPE_CAMERASOLVER = 27, /* Camera Solver Constraint */ CONSTRAINT_TYPE_OBJECTSOLVER = 28, /* Object Solver Constraint */ CONSTRAINT_TYPE_TRANSFORM_CACHE = 29, /* Transform Cache Constraint */ - + /* NOTE: no constraints are allowed to be added after this */ NUM_CONSTRAINT_TYPES -} eBConstraint_Types; +} eBConstraint_Types; /* bConstraint->flag */ /* flags 0x2 (1<<1) and 0x8 (1<<3) were used in past */ /* flag 0x20 (1<<5) was used to indicate that a constraint was evaluated using a 'local' hack for posebones only */ typedef enum eBConstraint_Flags { /* expand for UI */ - CONSTRAINT_EXPAND = (1<<0), + CONSTRAINT_EXPAND = (1<<0), /* pre-check for illegal object name or bone name */ - CONSTRAINT_DISABLE = (1<<2), + CONSTRAINT_DISABLE = (1<<2), /* to indicate which Ipo should be shown, maybe for 3d access later too */ - CONSTRAINT_ACTIVE = (1<<4), + CONSTRAINT_ACTIVE = (1<<4), /* to indicate that the owner's space should only be changed into ownspace, but not out of it */ CONSTRAINT_SPACEONCE = (1<<6), /* influence ipo is on constraint itself, not in action channel */ @@ -534,8 +534,8 @@ typedef enum eBConstraint_Flags { typedef enum eBConstraint_SpaceTypes { /* default for all - worldspace */ CONSTRAINT_SPACE_WORLD = 0, - /* for objects (relative to parent/without parent influence), - * for bones (along normals of bone, without parent/restpositions) + /* for objects (relative to parent/without parent influence), + * for bones (along normals of bone, without parent/restpositions) */ CONSTRAINT_SPACE_LOCAL = 1, /* for posechannels - pose space */ @@ -578,12 +578,12 @@ typedef enum eCopyLocation_Flags { LOCLIKE_Z_INVERT = (1<<6), LOCLIKE_OFFSET = (1<<7) } eCopyLocation_Flags; - + /* bSizeLikeConstraint.flag */ typedef enum eCopyScale_Flags { SIZELIKE_X = (1<<0), SIZELIKE_Y = (1<<1), - SIZELIKE_Z = (1<<2), + SIZELIKE_Z = (1<<2), SIZELIKE_OFFSET = (1<<3) } eCopyScale_Flags; @@ -604,7 +604,7 @@ typedef enum eSameVolume_Modes { /* bActionConstraint.flag */ typedef enum eActionConstraint_Flags { /* Bones use "object" part of target action, instead of "same bone name" part */ - ACTCON_BONE_USE_OBJECT_ACTION = (1 << 0), + ACTCON_BONE_USE_OBJECT_ACTION = (1 << 0), } eActionConstraint_Flags; /* Locked-Axis Values (Locked Track) */ @@ -706,7 +706,7 @@ typedef enum eSplineIK_Flags { CONSTRAINT_SPLINEIK_EVENSPLITS = (1 << 3), /* don't adjust the x and z scaling of the bones by the curve radius */ CONSTRAINT_SPLINEIK_NO_CURVERAD = (1 << 4), - + /* for "volumetric" xz scale mode, limit the minimum or maximum scale values */ CONSTRAINT_SPLINEIK_USE_BULGE_MIN = (1 << 5), CONSTRAINT_SPLINEIK_USE_BULGE_MAX = (1 << 6), @@ -771,7 +771,7 @@ typedef enum eDistLimit_Modes { LIMITDIST_OUTSIDE = 1, LIMITDIST_ONSURFACE = 2 } eDistLimit_Modes; - + /* python constraint -> flag */ typedef enum ePyConstraint_Flags { PYCON_USETARGETS = (1<<0), @@ -797,14 +797,14 @@ typedef enum eChildOf_Flags { typedef enum ePivotConstraint_Axis { /* do not consider this activity-clamping */ PIVOTCON_AXIS_NONE = -1, - + /* consider -ve x-axis rotations */ PIVOTCON_AXIS_X_NEG = 0, /* consider -ve y-axis rotations */ PIVOTCON_AXIS_Y_NEG = 1, /* consider -ve z-axis rotations */ PIVOTCON_AXIS_Z_NEG = 2, - + /* consider +ve x-axis rotations */ PIVOTCON_AXIS_X = 3, /* consider +ve y-axis rotations */ diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index f1b0c32e53b..e590780f1ff 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -110,14 +110,14 @@ typedef struct BevList { typedef struct BezTriple { float vec[3][3]; float alfa, weight, radius; /* alfa: tilt in 3D View, weight: used for softbody goal weight, radius: for bevel tapering */ - + char ipo; /* ipo: interpolation mode for segment from this BezTriple to the next */ - + char h1, h2; /* h1, h2: the handle type of the two handles */ char f1, f2, f3; /* f1, f2, f3: used for selection status */ - + char hide; /* hide: used to indicate whether BezTriple is hidden (3D), type of keyframe (eBezTriple_KeyframeType) */ - + char easing; /* easing: easing type for interpolation mode (eBezTriple_Easing) */ float back; /* BEZT_IPO_BACK */ float amplitude, period; /* BEZT_IPO_ELASTIC */ @@ -148,14 +148,14 @@ typedef struct Nurb { short resolu, resolv; /* tessellation resolution in the U or V directions */ short orderu, orderv; short flagu, flagv; - + float *knotsu, *knotsv; BPoint *bp; BezTriple *bezt; short tilt_interp; /* KEY_LINEAR, KEY_CARDINAL, KEY_BSPLINE */ short radius_interp; - + /* only used for dynamically generated Nurbs created from OB_FONT's */ int charidx; } Nurb; @@ -187,19 +187,19 @@ typedef struct EditNurb { typedef struct Curve { ID id; - struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ - + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ + struct BoundBox *bb; - + ListBase nurb; /* actual data, called splines in rna */ - + EditNurb *editnurb; /* edited data, not in file, use pointer so we can check for it */ - + struct Object *bevobj, *taperobj, *textoncurve; struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */ struct Key *key; struct Material **mat; - + /* texture space, copied as one block in editobject.c */ float loc[3]; float size[3]; @@ -215,7 +215,7 @@ typedef struct Curve { short bevresol, totcol; int flag; float width, ext1, ext2; - + /* default */ short resolu, resolv; short resolu_ren, resolv_ren; @@ -250,10 +250,10 @@ typedef struct Curve { struct VFont *vfontb; struct VFont *vfonti; struct VFont *vfontbi; - + struct TextBox *tb; int totbox, actbox; - + struct CharInfo *strinfo; struct CharInfo curinfo; /* font part end */ @@ -407,7 +407,7 @@ typedef enum eBezTriple_Interpolation { BEZT_IPO_CONST = 0, /* constant interpolation */ BEZT_IPO_LIN = 1, /* linear interpolation */ BEZT_IPO_BEZ = 2, /* bezier interpolation */ - + /* easing equations */ BEZT_IPO_BACK = 3, BEZT_IPO_BOUNCE = 4, @@ -424,7 +424,7 @@ typedef enum eBezTriple_Interpolation { /* easing modes (used only for Keyframes - BezTriple->easing) */ typedef enum eBezTriple_Easing { BEZT_IPO_EASE_AUTO = 0, - + BEZT_IPO_EASE_IN = 1, BEZT_IPO_EASE_OUT = 2, BEZT_IPO_EASE_IN_OUT = 3, diff --git a/source/blender/makesdna/DNA_dynamicpaint_types.h b/source/blender/makesdna/DNA_dynamicpaint_types.h index b341c2841e2..d8caec4da40 100644 --- a/source/blender/makesdna/DNA_dynamicpaint_types.h +++ b/source/blender/makesdna/DNA_dynamicpaint_types.h @@ -99,7 +99,7 @@ enum { }; typedef struct DynamicPaintSurface { - + struct DynamicPaintSurface *next, *prev; struct DynamicPaintCanvasSettings *canvas; /* for fast RNA access */ struct PaintSurfaceData *data; diff --git a/source/blender/makesdna/DNA_effect_types.h b/source/blender/makesdna/DNA_effect_types.h index 3455feea1a9..964b330a452 100644 --- a/source/blender/makesdna/DNA_effect_types.h +++ b/source/blender/makesdna/DNA_effect_types.h @@ -46,7 +46,7 @@ /* emit only from faces*/ #define PAF_OFACE 64 /* show emitter (don't hide actual mesh)*/ -#define PAF_SHOWE 128 +#define PAF_SHOWE 128 /* true random emit from faces (not just ordered jitter)*/ #define PAF_TRAND 256 /* even distribution in face emission based on face areas*/ @@ -78,15 +78,15 @@ typedef struct Effect { struct Effect *next, *prev; short type, flag, buttype, rt; - + } Effect; typedef struct BuildEff { struct BuildEff *next, *prev; short type, flag, buttype, rt; - + float len, sfra; - + } BuildEff; # @@ -102,40 +102,40 @@ struct Collection; typedef struct PartEff { struct PartEff *next, *prev; short type, flag, buttype, stype, vertgroup, userjit; - + float sta, end, lifetime; int totpart, totkey, seed; - + float normfac, obfac, randfac, texfac, randlife; float force[3]; float damp; - + float nabla, vectsize, maxlen, pad, defvec[3]; - + float mult[4], life[4]; short child[4], mat[4]; short texmap, curmult; short staticstep, omat, timetex, speedtex, flag2, flag2neg; short disp, vertgroup_v; - + char vgroupname[64], vgroupname_v[64]; /* MAX_VGROUP_NAME */ float imat[4][4]; /* inverse matrix of parent Object */ - + Particle *keys; struct Collection *group; - + } PartEff; typedef struct WaveEff { struct WaveEff *next, *prev; short type, flag, buttype, stype; - + float startx, starty, height, width; float narrow, speed, minfac, damp; - + float timeoffs, lifetime; - + } WaveEff; #endif diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h index c7ca92ba5cc..e2ee561de7f 100644 --- a/source/blender/makesdna/DNA_gpencil_types.h +++ b/source/blender/makesdna/DNA_gpencil_types.h @@ -54,7 +54,7 @@ typedef struct bGPDspoint { typedef enum eGPDspoint_Flag { /* stroke point is selected (for editing) */ GP_SPOINT_SELECT = (1 << 0), - + /* stroke point is tagged (for some editing operation) */ GP_SPOINT_TAG = (1 << 1), } eGPSPoint_Flag; @@ -168,7 +168,7 @@ typedef struct bGPDstroke { short flag, pad[2]; /* various settings about this stroke */ double inittime; /* Init time of stroke */ - /* The pointer to color is only used during drawing, but not saved + /* The pointer to color is only used during drawing, but not saved * colorname is the join with the palette, but when draw, the pointer is update if the value is NULL * to speed up the drawing */ @@ -203,11 +203,11 @@ typedef enum eGPDstroke_Flag { */ typedef struct bGPDframe { struct bGPDframe *next, *prev; - + ListBase strokes; /* list of the simplified 'strokes' that make up the frame's data */ - + int framenum; /* frame number of this frame */ - + short flag; /* temp settings */ short key_type; /* keyframe type (eBezTriple_KeyframeType) */ } bGPDframe; @@ -223,30 +223,30 @@ typedef enum eGPDframe_Flag { /* Grease-Pencil Annotations - 'Layer' */ typedef struct bGPDlayer { struct bGPDlayer *next, *prev; - + ListBase frames; /* list of annotations to display for frames (bGPDframe list) */ bGPDframe *actframe; /* active frame (should be the frame that is currently being displayed) */ - + short flag; /* settings for layer */ short thickness; /* current thickness to apply to strokes */ - + short gstep; /* Ghosts Before: max number of ghost frames to show between active frame and the one before it (0 = only the ghost itself) */ short gstep_next; /* Ghosts After: max number of ghost frames to show after active frame and the following it (0 = only the ghost itself) */ - + float gcolor_prev[3]; /* optional color for ghosts before the active frame */ float gcolor_next[3]; /* optional color for ghosts after the active frame */ - + float color[4]; /* Color for strokes in layers (replaced by palettecolor). Only used for ruler (which uses GPencil internally) */ float fill[4]; /* Fill color for strokes in layers. Not used and replaced by palettecolor fill */ - + char info[128]; /* optional reference info about this layer (i.e. "director's comments, 12/3") * this is used for the name of the layer too and kept unique. */ - + struct Object *parent; /* parent object */ float inverse[4][4]; /* inverse matrix (only used if parented) */ char parsubstr[64]; /* String describing subobject info, MAX_ID_NAME-2 */ short partype, pad; - + float tintcolor[4]; /* Color used to tint layer, alpha value is used as factor */ float opacity; /* Opacity of the layer */ } bGPDlayer; @@ -287,13 +287,13 @@ typedef enum eGPDlayer_Flag { typedef struct bGPdata { ID id; /* Grease Pencil data is a datablock */ struct AnimData *adt; /* animation data - for animating draw settings */ - + /* saved Grease-Pencil data */ ListBase layers; /* bGPDlayers */ int flag; /* settings for this datablock */ - /* not-saved stroke buffer data (only used during paint-session) - * - buffer must be initialized before use, but freed after + /* not-saved stroke buffer data (only used during paint-session) + * - buffer must be initialized before use, but freed after * whole paint operation is over */ short sbuffer_size; /* number of elements currently in cache */ @@ -316,29 +316,29 @@ typedef struct bGPdata { typedef enum eGPdata_Flag { /* don't allow painting to occur at all */ /* GP_DATA_LMBPLOCK = (1 << 0), */ - + /* show debugging info in viewport (i.e. status print) */ GP_DATA_DISPINFO = (1 << 1), /* in Action Editor, show as expanded channel */ GP_DATA_EXPAND = (1 << 2), - + /* is the block overriding all clicks? */ /* GP_DATA_EDITPAINT = (1 << 3), */ - + /* ------------------------------------------------ DEPRECATED */ /* new strokes are added in viewport space */ GP_DATA_VIEWALIGN = (1 << 4), - + /* Project into the screen's Z values */ GP_DATA_DEPTH_VIEW = (1 << 5), GP_DATA_DEPTH_STROKE = (1 << 6), GP_DATA_DEPTH_STROKE_ENDPOINTS = (1 << 7), /* ------------------------------------------------ DEPRECATED */ - + /* Stroke Editing Mode - Toggle to enable alternative keymap for easier editing of stroke points */ GP_DATA_STROKE_EDITMODE = (1 << 8), - + /* Convenience/cache flag to make it easier to quickly toggle onion skinning on/off */ GP_DATA_SHOW_ONIONSKINS = (1 << 9), /* Draw a green and red point to indicate start and end of the stroke */ diff --git a/source/blender/makesdna/DNA_group_types.h b/source/blender/makesdna/DNA_group_types.h index 3b947caf59c..b5208a81510 100644 --- a/source/blender/makesdna/DNA_group_types.h +++ b/source/blender/makesdna/DNA_group_types.h @@ -55,7 +55,7 @@ typedef struct CollectionChild { typedef struct Collection { ID id; - + ListBase gobject; /* CollectionObject */ ListBase children; /* CollectionChild */ diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h index 40fa9d40072..26d7f089f8b 100644 --- a/source/blender/makesdna/DNA_image_types.h +++ b/source/blender/makesdna/DNA_image_types.h @@ -100,12 +100,12 @@ enum { typedef struct Image { ID id; - + char name[1024]; /* file path, 1024 = FILE_MAX */ - + struct MovieCache *cache; /* not written in file */ struct GPUTexture *gputexture[2]; /* not written in file 2 = TEXTARGET_COUNT */ - + /* sources from: */ ListBase anims; struct RenderResult *rr; @@ -129,13 +129,13 @@ typedef struct Image { int lastused; short ok; short pad4[3]; - + /* for generated images */ int gen_x, gen_y; char gen_type, gen_flag; short gen_depth; float gen_color[4]; - + /* display aspect - for UV editing images resized for faster openGL display */ float aspx, aspy; diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h index 5ba822616eb..f97935a09a1 100644 --- a/source/blender/makesdna/DNA_ipo_types.h +++ b/source/blender/makesdna/DNA_ipo_types.h @@ -24,7 +24,7 @@ * * ***** END GPL LICENSE BLOCK ***** */ - + /** \file DNA_ipo_types.h * \ingroup DNA * \deprecated @@ -32,7 +32,7 @@ * which has (as of 2.50) been replaced with a completely new system by Joshua Leung (aligorith). All defines, * etc. are only still maintained to provide backwards compatibility for old files. */ - + #ifndef __DNA_IPO_TYPES_H__ #define __DNA_IPO_TYPES_H__ @@ -53,7 +53,7 @@ typedef struct IpoDriver { struct Object *ob; /* target/driver ob */ short blocktype, adrcode; /* sub-channel to use */ - + short type, flag; /* driver settings */ char name[128]; /* bone, or python expression here */ } IpoDriver; @@ -63,7 +63,7 @@ typedef struct IpoDriver { /* IPO Curve */ typedef struct IpoCurve { struct IpoCurve *next, *prev; - + struct BPoint *bp; /* array of BPoints (sizeof(BPoint) * totvert) - i.e. baked/imported data */ struct BezTriple *bezt; /* array of BezTriples (sizeof(BezTriple) * totvert) - i.e. user-editable keyframes */ @@ -75,10 +75,10 @@ typedef struct IpoCurve { short flag, rt; /* flag= settings; rt= ??? */ float ymin, ymax; /* minimum/maximum y-extents for curve */ unsigned int bitmask; /* ??? */ - + float slide_min, slide_max; /* minimum/maximum values for sliders (in action editor) */ float curval; /* value of ipo-curve for current frame */ - + IpoDriver *driver; /* pointer to ipo-driver for this curve */ } IpoCurve; @@ -87,10 +87,10 @@ typedef struct IpoCurve { /* IPO Data-Block */ typedef struct Ipo { ID id; - + ListBase curve; /* A list of IpoCurve structs in a linked list. */ rctf cur; /* Rect defining extents of keyframes? */ - + short blocktype, showkey; /* blocktype: self-explanatory; showkey: either 0 or 1 (show vertical yellow lines for editing) */ short muteipo, pad; /* muteipo: either 0 or 1 (whether ipo block is muted) */ } Ipo; @@ -475,7 +475,7 @@ typedef struct Ipo { #define IPO_LIN 1 #define IPO_BEZ 2 /* not used yet */ -#define IPO_MIXED 3 +#define IPO_MIXED 3 /* icu->extrap */ #define IPO_HORIZ 0 @@ -496,7 +496,7 @@ typedef struct Ipo { /* ---------- IPO Drivers ----------- */ /* offset in driver->name for finding second posechannel for rot-diff */ -#define DRIVER_NAME_OFFS 32 +#define DRIVER_NAME_OFFS 32 /* driver->type */ #define IPO_DRIVER_TYPE_NORMAL 0 diff --git a/source/blender/makesdna/DNA_key_types.h b/source/blender/makesdna/DNA_key_types.h index 60ab01c901b..2b097092bc4 100644 --- a/source/blender/makesdna/DNA_key_types.h +++ b/source/blender/makesdna/DNA_key_types.h @@ -58,7 +58,7 @@ typedef struct KeyBlock { int totelem; /* total number if items in the keyblock (compare with mesh/curve verts to check we match) */ int uid; /* for meshes only, match the unique number with the customdata layer */ - + void *data; /* array of shape key values, size is (Key->elemsize * KeyBlock->totelem) */ char name[64]; /* MAX_NAME (unique name, user assigned) */ char vgroup[64]; /* MAX_VGROUP_NAME (optional vertex group), array gets allocated into 'weights' when set */ @@ -72,7 +72,7 @@ typedef struct KeyBlock { typedef struct Key { ID id; - struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ /* commonly called 'Basis', (Key->type == KEY_RELATIVE) only. * Looks like this is _always_ 'key->block.first', @@ -85,7 +85,7 @@ typedef struct Key { char elemstr[32]; int elemsize; /* size of each element in #KeyBlock.data, use for allocation and stride */ int pad; - + ListBase block; /* list of KeyBlock's */ struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */ diff --git a/source/blender/makesdna/DNA_lamp_types.h b/source/blender/makesdna/DNA_lamp_types.h index 3a4b07cc791..e1ab56a0206 100644 --- a/source/blender/makesdna/DNA_lamp_types.h +++ b/source/blender/makesdna/DNA_lamp_types.h @@ -47,14 +47,14 @@ struct MTex; typedef struct Lamp { ID id; - struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ - + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ + short type, flag; int mode; float r, g, b, k; float shdwr, shdwg, shdwb, shdwpad; - + float energy, dist, spotsize, spotblend; float att1, att2; /* Quad1 and Quad2 attenuation */ @@ -62,18 +62,18 @@ typedef struct Lamp { struct CurveMapping *curfalloff; short falloff_type; short pad2; - + float clipsta, clipend; float bias, soft, bleedbias, bleedexp; short bufsize, samp, buffers, filtertype; char bufflag, buftype; - + short area_shape; float area_size, area_sizey, area_sizez; - + /* texact is for buttons */ short texact, shadhalostep; - + struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */ short pr_texture, use_nodes; char pad6[4]; @@ -99,7 +99,7 @@ typedef struct Lamp { /* flag */ #define LA_DS_EXPAND 1 - /* NOTE: this must have the same value as MA_DS_SHOW_TEXS, + /* NOTE: this must have the same value as MA_DS_SHOW_TEXS, * otherwise anim-editors will not read correctly */ #define LA_DS_SHOW_TEXS 4 diff --git a/source/blender/makesdna/DNA_lattice_types.h b/source/blender/makesdna/DNA_lattice_types.h index 28a401676fc..e329743cce7 100644 --- a/source/blender/makesdna/DNA_lattice_types.h +++ b/source/blender/makesdna/DNA_lattice_types.h @@ -52,22 +52,22 @@ typedef struct EditLatt { typedef struct Lattice { ID id; struct AnimData *adt; - + short pntsu, pntsv, pntsw, flag; short opntsu, opntsv, opntsw, pad2; char typeu, typev, typew, pad3; int actbp; /* active element index, unset with LT_ACTBP_NONE */ float fu, fv, fw, du, dv, dw; - + struct BPoint *def; - + struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */ struct Key *key; - + struct MDeformVert *dvert; char vgroup[64]; /* multiply the influence, MAX_VGROUP_NAME */ - + struct EditLatt *editlatt; void *batch_cache; } Lattice; diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h index 5ebc41a184f..9401f591b66 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -56,8 +56,8 @@ typedef struct TexPaintSlot { typedef struct Material { ID id; - struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ - + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ + short flag, pad1[7]; /* Colors from Blender Internal that we are still using. */ @@ -123,7 +123,7 @@ typedef struct Material { /* for dopesheet */ #define MA_DS_EXPAND 2 /* for dopesheet (texture stack expander) - * NOTE: this must have the same value as other texture stacks, + * NOTE: this must have the same value as other texture stacks, * otherwise anim-editors will not read correctly */ #define MA_DS_SHOW_TEXS 4 @@ -145,8 +145,8 @@ typedef struct Material { #define MA_RAMP_SAT 13 #define MA_RAMP_VAL 14 #define MA_RAMP_COLOR 15 -#define MA_RAMP_SOFT 16 -#define MA_RAMP_LINEAR 17 +#define MA_RAMP_SOFT 16 +#define MA_RAMP_LINEAR 17 /* texco */ #define TEXCO_ORCO 1 diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index 48c39d439dd..247ffa4d865 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -103,7 +103,7 @@ typedef struct Mesh { struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ struct BoundBox *bb; - + struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */ struct Key *key; struct Material **mat; @@ -150,7 +150,7 @@ typedef struct Mesh { * this means the active face must always be selected, this is to keep track * of the last selected face and is similar to the old active face flag where * the face does not need to be selected, -1 is inactive */ - int act_face; + int act_face; /* texture space, copied as one block in editobject.c */ float loc[3]; diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h index 4014db72adf..551ba945253 100644 --- a/source/blender/makesdna/DNA_meshdata_types.h +++ b/source/blender/makesdna/DNA_meshdata_types.h @@ -421,7 +421,7 @@ enum { enum { ME_SMOOTH = (1 << 0), ME_FACE_SEL = (1 << 1), -/* ME_HIDE = (1 << 4), */ +/* ME_HIDE = (1 << 4), */ }; #define ME_POLY_LOOP_PREV(mloop, mp, i) (&(mloop)[(mp)->loopstart + (((i) + (mp)->totloop - 1) % (mp)->totloop)]) diff --git a/source/blender/makesdna/DNA_meta_types.h b/source/blender/makesdna/DNA_meta_types.h index fade313e29e..c312d45567f 100644 --- a/source/blender/makesdna/DNA_meta_types.h +++ b/source/blender/makesdna/DNA_meta_types.h @@ -57,33 +57,33 @@ typedef struct MetaElem { float rad2; /* temp field, used only while processing */ float s; /* stiffness, how much of the element to fill */ float len; /* old, only used for backwards compat. use dimensions now */ - + float *mat, *imat; /* matrix and inverted matrix */ } MetaElem; typedef struct MetaBall { ID id; struct AnimData *adt; - + ListBase elems; ListBase disp; ListBase *editelems; /* not saved in files, note we use pointer for editmode check */ struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */ /* material of the mother ball will define the material used of all others */ - struct Material **mat; + struct Material **mat; char flag, flag2; /* flag is enum for updates, flag2 is bitflags for settings */ short totcol; short texflag, pad; /* used to store MB_AUTOSPACE */ - + /* texture space, copied as one block in editobject.c */ float loc[3]; float size[3]; float rot[3]; - + float wiresize, rendersize; /* display and render res */ - + /* bias elements to have an offset volume. * mother ball changes will effect other objects thresholds, * but these may also have their own thresh as an offset */ diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index fd05f5584ec..d9792faf0cb 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -183,7 +183,7 @@ typedef struct BuildModifierData { float start, length; short flag; - + short randomize; /* (bool) whether order of vertices is randomized - legacy files (for readfile conversion) */ int seed; /* (int) random seed */ } BuildModifierData; @@ -620,7 +620,7 @@ typedef struct ClothModifierData { float hair_grid_max[3]; int hair_grid_res[3]; float hair_grid_cellsize; - + struct ClothSolverResult *solver_result; } ClothModifierData; @@ -968,7 +968,7 @@ typedef struct OceanModifierData { struct Ocean *ocean; struct OceanCache *oceancache; - + int resolution; int spatial_size; diff --git a/source/blender/makesdna/DNA_nla_types.h b/source/blender/makesdna/DNA_nla_types.h index 16af3bb1be4..c5e14374fb3 100644 --- a/source/blender/makesdna/DNA_nla_types.h +++ b/source/blender/makesdna/DNA_nla_types.h @@ -43,11 +43,11 @@ typedef struct bActionModifier { struct bActionModifier *next, *prev; short type, flag; char channel[32]; - + /* noise modifier */ float noisesize, turbul; short channels; - + /* path deform modifier */ short no_rot_axis; struct Object *ob; @@ -74,10 +74,10 @@ typedef struct bActionStrip { float scale; /* The amount the action range is scaled by */ float blendin, blendout; /* The number of frames on either end of the strip's length to fade in/out */ - + char stridechannel[32]; /* Instead of stridelen, it uses an action channel */ char offs_bone[32]; /* if repeat, use this bone/channel for defining offset */ - + ListBase modifiers; /* modifier stack */ } bActionStrip; diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 4dd2579883b..f38ae61421b 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -85,36 +85,36 @@ typedef struct bNodeStack { typedef struct bNodeSocket { struct bNodeSocket *next, *prev, *new_sock; - + IDProperty *prop; /* user-defined properties */ - + char identifier[64]; /* unique identifier for mapping */ - + char name[64]; /* MAX_NAME */ - + /* XXX deprecated, only used for the Image and OutputFile nodes, * should be removed at some point. */ void *storage; /* custom storage */ - + short type, flag; short limit; /* max. number of links */ short in_out; /* input/output type */ struct bNodeSocketType *typeinfo; /* runtime type information */ char idname[64]; /* runtime type identifier */ - + float locx, locy; - + void *default_value; /* default input value used for unlinked sockets */ - + /* execution data */ short stack_index; /* local stack index */ /* XXX deprecated, kept for forward compatibility */ short stack_type DNA_DEPRECATED; char draw_shape, pad[3]; - + void *cache; /* cached data from execution */ - + /* internal data to retrieve relations and groups * DEPRECATED, now uses the generic identifier string instead */ @@ -123,7 +123,7 @@ typedef struct bNodeSocket { int to_index DNA_DEPRECATED; /* XXX deprecated, still forward compatible since verification restores pointer from matching own_index. */ struct bNodeSocket *groupsock DNA_DEPRECATED; - + struct bNodeLink *link; /* a link pointer, set in ntreeUpdateTree */ /* XXX deprecated, socket input values are stored in default_value now. kept for forward compatibility */ @@ -174,10 +174,10 @@ typedef struct bNode { struct bNode *next, *prev, *new_node; IDProperty *prop; /* user-defined properties */ - + struct bNodeType *typeinfo; /* runtime type information */ char idname[64]; /* runtime type identifier */ - + char name[64]; /* MAX_NAME */ int flag; short type, pad; @@ -186,23 +186,23 @@ typedef struct bNode { short stack_index; /* for groupnode, offset in global caller stack */ short nr; /* number of this node in list, used for UI exec events */ float color[3]; /* custom user-defined color */ - + ListBase inputs, outputs; struct bNode *parent; /* parent node */ struct ID *id; /* optional link to libdata */ void *storage; /* custom data, must be struct, for storage in file */ struct bNode *original; /* the original node in the tree (for localized tree) */ ListBase internal_links; /* list of cached internal links (input to output), for muted nodes and operators */ - + float locx, locy; /* root offset for drawing (parent space) */ float width, height; /* node custom width and height */ float miniwidth; /* node width if hidden */ float offsetx, offsety; /* additional offset from loc */ float anim_init_locx; /* initial locx for insert offset animation */ float anim_ofsx; /* offset that will be added to locx for insert offset animation */ - + int update; /* update flags */ - + char label[64]; /* custom user-defined label, MAX_NAME */ short custom1, custom2; /* to be abused for buttons */ float custom3, custom4; @@ -290,7 +290,7 @@ typedef struct bNodeInstanceKey { */ typedef struct bNodeInstanceHashEntry { bNodeInstanceKey key; - + /* tags for cleaning the cache */ short tag; short pad; @@ -299,7 +299,7 @@ typedef struct bNodeInstanceHashEntry { typedef struct bNodePreview { bNodeInstanceHashEntry hash_entry; /* must be first */ - + unsigned char *rect; short xsize, ysize; int pad; @@ -308,10 +308,10 @@ typedef struct bNodePreview { typedef struct bNodeLink { struct bNodeLink *next, *prev; - + bNode *fromnode, *tonode; bNodeSocket *fromsock, *tosock; - + int flag; int pad; } bNodeLink; @@ -338,41 +338,41 @@ typedef struct bNodeLink { /* only re-usable node trees are in the library though, materials and textures allocate own tree struct */ typedef struct bNodeTree { ID id; - struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ - + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ + struct bNodeTreeType *typeinfo; /* runtime type information */ char idname[64]; /* runtime type identifier */ - + struct StructRNA *interface_type; /* runtime RNA type of the group interface */ - + struct bGPdata *gpd; /* grease pencil data */ float view_center[2]; /* node tree stores own offset for consistent editor view */ - + ListBase nodes, links; - + int type, init; /* set init on fileread */ - int cur_index; /* sockets in groups have unique identifiers, adding new sockets always + int cur_index; /* sockets in groups have unique identifiers, adding new sockets always * will increase this counter */ int flag; int update; /* update flags */ short is_updating; /* flag to prevent reentrant update calls */ short done; /* generic temporary flag for recursion check (DFS/BFS) */ int pad2; - + int nodetype DNA_DEPRECATED; /* specific node type this tree is used for */ short edit_quality; /* Quality setting when editing */ short render_quality; /* Quality setting when rendering */ int chunksize; /* tile size for compositor engine */ - + rctf viewer_border; - + /* Lists of bNodeSocket to hold default values and own_index. * Warning! Don't make links to these sockets, input/output nodes are used for that. * These sockets are used only for generating external interfaces. */ ListBase inputs, outputs; - + /* Node preview hash table * Only available in base node trees (e.g. scene->node_tree) */ @@ -382,7 +382,7 @@ typedef struct bNodeTree { */ bNodeInstanceKey active_viewer_key; int pad; - + /* execution data */ /* XXX It would be preferable to completely move this data out of the underlying node tree, * so node tree execution could finally run independent of the tree itself. This would allow node trees @@ -391,7 +391,7 @@ typedef struct bNodeTree { * as long as necessary, even while the tree is being modified. */ struct bNodeTreeExec *execdata; - + /* callbacks */ void (*progress)(void *, float progress); /** \warning may be called by different threads */ @@ -401,7 +401,7 @@ typedef struct bNodeTree { void *tbh, *prh, *sdh, *udh; void *duplilock; - + } bNodeTree; /* ntree->type, index */ @@ -631,7 +631,7 @@ typedef struct NodeImageMultiFileSocket { int pad1; char path[1024]; /* 1024 = FILE_MAX */ ImageFormatData format; - + /* multilayer output */ char layer[30]; /* EXR_TOT_MAXNAME-2 ('.' and channel char are appended) */ char pad2[2]; @@ -698,7 +698,7 @@ typedef struct NodeColorBalance { float power[3]; float offset_basis; char _pad[4]; - + /* LGG parameters */ float lift[3]; float gamma[3]; diff --git a/source/blender/makesdna/DNA_object_fluidsim_types.h b/source/blender/makesdna/DNA_object_fluidsim_types.h index b305235083a..b8927613a59 100644 --- a/source/blender/makesdna/DNA_object_fluidsim_types.h +++ b/source/blender/makesdna/DNA_object_fluidsim_types.h @@ -38,14 +38,14 @@ #ifdef __cplusplus extern "C" { #endif - + struct Mesh; struct Ipo; typedef struct FluidVertexVelocity { float vel[3]; } FluidVertexVelocity; - + typedef struct FluidsimSettings { struct FluidsimModifierData *fmd; /* for fast RNA access */ /* threadcont the calculation is done with */ @@ -83,7 +83,7 @@ typedef struct FluidsimSettings { float gstar; /* activate refinement? */ int maxRefine; - + /* fluid object type settings */ /* gravity strength */ float iniVelx, iniVely, iniVelz; @@ -127,19 +127,19 @@ typedef struct FluidsimSettings { struct FluidVertexVelocity *meshVelocities; /* number of vertices in simulated fluid mesh */ int totvert; - + /* Fluid control settings */ float cpsTimeStart; float cpsTimeEnd; float cpsQuality; - + float attractforceStrength; float attractforceRadius; float velocityforceStrength; float velocityforceRadius; int lastgoodframe; - + /* Simulation/flow rate control (i.e. old "Fac-Time") */ float animRate; } FluidsimSettings; diff --git a/source/blender/makesdna/DNA_object_force_types.h b/source/blender/makesdna/DNA_object_force_types.h index a83517e4eb4..6d38e56f19a 100644 --- a/source/blender/makesdna/DNA_object_force_types.h +++ b/source/blender/makesdna/DNA_object_force_types.h @@ -67,7 +67,7 @@ typedef struct PartDeflect { short tex_mode; /* texture effector */ short kink, kink_axis; /* for curve guide */ short zdir; - + /* Main effector values */ float f_strength; /* The strength of the force (+ or - ) */ float f_damp; /* Damping ratio of the harmonic effector. */ @@ -93,7 +93,7 @@ typedef struct PartDeflect { float pdef_stickness;/* surface particle stickiness */ float absorption; /* used for forces */ - + /* softbody collisions */ float pdef_sbdamp; /* Damping factor for softbody deflection */ float pdef_sbift; /* inner face thickness for softbody deflection */ @@ -123,7 +123,7 @@ typedef struct PartDeflect { typedef struct EffectorWeights { struct Collection *group; /* only use effectors from this group of objects */ - + float weight[14]; /* effector type specific weights */ float global_gravity; short flag, rt[3]; @@ -176,7 +176,7 @@ typedef struct PTCacheMem { typedef struct PointCache { struct PointCache *next, *prev; int flag; /* generic flag */ - + int step; /* The number of frames between cached frames. * This should probably be an upper bound for a per point adaptive step in the future, * buf for now it's the same for all points. Without adaptivity this can effect the perceived @@ -201,7 +201,7 @@ typedef struct PointCache { int totpoint; /* number of cached points */ int index; /* modifier stack index */ short compression, rt; - + char name[64]; char prev_name[64]; char info[64]; @@ -226,9 +226,9 @@ typedef struct SoftBody { char pad; char msg_lock; short msg_value; - + /* part of UI: */ - + /* general options */ float nodemass; /* softbody mass of *vertex* */ char namedVG_Mass[64]; /* MAX_VGROUP_NAME */ @@ -239,7 +239,7 @@ typedef struct SoftBody { float mediafrict; /* friction to env */ float rklimit; /* error limit for ODE solver */ float physics_speed;/* user control over simulation speed */ - + /* goal */ float goalspring; /* softbody goal springs */ float goalfrict; /* softbody goal springs friction */ @@ -252,7 +252,7 @@ typedef struct SoftBody { * rather find them by name tag to find it -> jow20090613 */ short fuzzyness; /* */ - + /* springs */ float inspring; /* softbody inner springs */ float infrict; /* softbody inner springs friction */ @@ -260,12 +260,12 @@ typedef struct SoftBody { /* along with it introduce Spring_K painting * starting to fix old bug .. nastiness that VG are indexes * rather find them by name tag to find it -> jow20090613 */ - + /* baking */ int sfra, efra; int interval; short local, solverflags; /* local==1: use local coords for baking */ - + /* -- these must be kept for backwards compatibility -- */ SBVertex **keys; /* array of size totpointkey */ int totpointkey, totkey; /* if totpointkey != totpoint or totkey!- (efra-sfra)/interval -> free keys */ @@ -295,7 +295,7 @@ typedef struct SoftBody { struct Collection *collision_group; struct EffectorWeights *effector_weights; - /* reverse esimated obmatrix .. no need to store in blend file .. how ever who cares */ + /* reverse esimated obmatrix .. no need to store in blend file .. how ever who cares */ float lcom[3]; float lrot[3][3]; float lscale[3][3]; @@ -391,9 +391,9 @@ typedef struct SoftBody { #define OB_SB_AERO_ANGLE 16384 /* sb->solverflags */ -#define SBSO_MONITOR 1 -#define SBSO_OLDERR 2 -#define SBSO_ESTIMATEIPO 4 +#define SBSO_MONITOR 1 +#define SBSO_OLDERR 2 +#define SBSO_ESTIMATEIPO 4 /* sb->sbc_mode */ #define SBC_MODE_MANUAL 0 diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index f37bccbfe4e..45029e8d412 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -162,10 +162,10 @@ typedef struct Object_Runtime { typedef struct Object { ID id; - struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ struct SculptSession *sculpt; - + short type, partype; int par1, par2, par3; /* can be vertexnrs */ char parsubstr[64]; /* String describing subobject info, MAX_ID_NAME-2 */ @@ -180,13 +180,13 @@ typedef struct Object { struct bAction *poselib; struct bPose *pose; /* pose data, armature objects only */ void *data; /* pointer to objects data - an 'ID' or NULL */ - + struct bGPdata *gpd; /* Grease Pencil data */ - + bAnimVizSettings avs; /* settings for visualization of object-transform animation */ bMotionPath *mpath; /* motion path cache for this object */ void *pad1; - + ListBase constraintChannels DNA_DEPRECATED; // XXX deprecated... old animation system ListBase effect DNA_DEPRECATED; // XXX deprecated... keep for readfile ListBase defbase; /* list of bDeformGroup (vertex groups) names and flag only */ @@ -201,7 +201,7 @@ typedef struct Object { char *matbits; /* a boolean field, with each byte 1 if corresponding material is linked to object */ int totcol; /* copy of mesh, curve & meta struct member of same name (keep in sync) */ int actcol; /* currently selected material in the UI */ - + /* rot en drot have to be together! (transform('r' en 's')) */ float loc[3], dloc[3], orig[3]; float size[3]; /* scale in fact */ @@ -218,18 +218,18 @@ typedef struct Object { /* note: this isn't assured to be valid as with 'obmat', * before using this value you should do... * invert_m4_m4(ob->imat, ob->obmat); */ - + /* Previously 'imat' was used at render time, but as other places use it too * the interactive ui of 2.5 creates problems. So now only 'imat_ren' should * be used when ever the inverse of ob->obmat * re->viewmat is needed! - jahka */ float imat_ren[4][4]; - + unsigned int lay; /* copy of Base's layer in the scene */ short flag; /* copy of Base */ short colbits DNA_DEPRECATED; /* deprecated, use 'matbits' */ - + short transflag, protectflag; /* transformation settings and transform locks */ short trackflag, upflag; short nlaflag; /* used for DopeSheet filtering settings (expanded/collapsed) */ @@ -277,7 +277,7 @@ typedef struct Object { ListBase nlastrips DNA_DEPRECATED; // XXX deprecated... old animation system ListBase hooks DNA_DEPRECATED; // XXX deprecated... old animation system ListBase particlesystem; /* particle systems */ - + struct PartDeflect *pd; /* particle deflector/attractor/collision data */ struct SoftBody *soft; /* if exists, saved in file */ struct Collection *dup_group; /* object duplicator for group */ @@ -300,7 +300,7 @@ typedef struct Object { ListBase gpulamp; /* runtime, for glsl lamp display only */ ListBase pc_ids; - + struct RigidBodyOb *rigidbody_object; /* settings for Bullet rigid body */ struct RigidBodyCon *rigidbody_constraint; /* settings for Bullet constraint */ @@ -327,13 +327,13 @@ typedef struct Object { /* Warning, this is not used anymore because hooks are now modifiers */ typedef struct ObHook { struct ObHook *next, *prev; - + struct Object *parent; float parentinv[4][4]; /* matrix making current transform unmodified */ float mat[4][4]; /* temp matrix while hooking */ float cent[3]; /* visualization of hook */ float falloff; /* if not zero, falloff is distance where influence zero */ - + char name[64]; /* MAX_NAME */ int *indexar; diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index 8437c93a722..a7f212a0694 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -97,7 +97,7 @@ typedef struct ParticleData { ParticleKey state; /* current global coordinates */ ParticleKey prev_state; /* previous state */ - + HairKey *hair; /* hair vertices */ ParticleKey *keys; /* keyed keys */ @@ -301,7 +301,7 @@ typedef struct ParticleSystem { struct ListBase targets; /* used for keyed and boid physics */ char name[64]; /* particle system name, MAX_NAME */ - + float imat[4][4]; /* used for duplicators */ float cfra, tree_frame, bvhtree_frame; int seed, child_seed; @@ -387,7 +387,7 @@ typedef enum eParticleDrawFlag { #define PART_UNBORN 32 /*show unborn particles*/ #define PART_DIED 64 /*show died particles*/ -#define PART_TRAND 128 +#define PART_TRAND 128 #define PART_EDISTR 256 /* particle/face from face areas */ #define PART_ROTATIONS 512 /* calculate particle rotations (and store them in pointcache) */ @@ -422,7 +422,7 @@ typedef enum eParticleDrawFlag { #define PART_FROM_VERT 0 #define PART_FROM_FACE 1 #define PART_FROM_VOLUME 2 -/* #define PART_FROM_PARTICLE 3 deprecated! */ +/* #define PART_FROM_PARTICLE 3 deprecated! */ #define PART_FROM_CHILD 4 /* part->distr */ diff --git a/source/blender/makesdna/DNA_rigidbody_types.h b/source/blender/makesdna/DNA_rigidbody_types.h index 42286044970..5a7e7c92380 100644 --- a/source/blender/makesdna/DNA_rigidbody_types.h +++ b/source/blender/makesdna/DNA_rigidbody_types.h @@ -52,23 +52,23 @@ typedef struct RigidBodyWorld { struct Collection *group; /* Group containing objects to use for Rigid Bodies */ struct Object **objects; /* Array to access group objects by index, only used at runtime */ - + struct Collection *constraints; /* Group containing objects to use for Rigid Body Constraints*/ int pad; float ltime; /* last frame world was evaluated for (internal) */ - + /* cache */ struct PointCache *pointcache; struct ListBase ptcaches; int numbodies; /* number of objects in rigid body group */ - + short steps_per_second; /* number of simulation steps thaken per second */ short num_solver_iterations;/* number of constraint solver iterations made per simulation step */ - + int flag; /* (eRigidBodyWorld_Flag) settings for this RigidBodyWorld */ float time_scale; /* used to speed up or slow down the simulation */ - + /* References to Physics Sim objects. Exist at runtime only ---------------------- */ void *physics_world; /* Physics sim world (i.e. btDiscreteDynamicsWorld) */ } RigidBodyWorld; @@ -96,30 +96,30 @@ typedef struct RigidBodyOb { /* References to Physics Sim objects. Exist at runtime only */ void *physics_object; /* Physics object representation (i.e. btRigidBody) */ void *physics_shape; /* Collision shape used by physics sim (i.e. btCollisionShape) */ - + /* General Settings for this RigidBodyOb */ short type; /* (eRigidBodyOb_Type) role of RigidBody in sim */ - short shape; /* (eRigidBody_Shape) collision shape to use */ - + short shape; /* (eRigidBody_Shape) collision shape to use */ + int flag; /* (eRigidBodyOb_Flag) */ int col_groups; /* Collision groups that determines wich rigid bodies can collide with each other */ short mesh_source; /* (eRigidBody_MeshSource) mesh source for mesh based collision shapes */ short pad; - + /* Physics Parameters */ float mass; /* how much object 'weighs' (i.e. absolute 'amount of stuff' it holds) */ - + float friction; /* resistance of object to movement */ float restitution; /* how 'bouncy' object is when it collides */ - - float margin; /* tolerance for detecting collisions */ - + + float margin; /* tolerance for detecting collisions */ + float lin_damping; /* damping for linear velocities */ float ang_damping; /* damping for angular velocities */ - + float lin_sleep_thresh; /* deactivation threshold for linear velocities */ float ang_sleep_thresh; /* deactivation threshold for angular velocities */ - + float orn[4]; /* rigid body orientation */ float pos[3]; /* rigid body position */ float pad1; @@ -166,12 +166,12 @@ typedef enum eRigidBody_Shape { RB_SHAPE_CYLINDER, /* cone (i.e. party hat) */ RB_SHAPE_CONE, - + /* convex hull (minimal shrinkwrap encompassing all verts) */ RB_SHAPE_CONVEXH, /* triangulated mesh */ RB_SHAPE_TRIMESH, - + /* concave mesh approximated using primitives */ //RB_SHAPE_COMPOUND, } eRigidBody_Shape; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index fd45eb52a60..f1c07f5b121 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -184,11 +184,11 @@ typedef struct AudioData { /* Render Layer */ typedef struct SceneRenderLayer { struct SceneRenderLayer *next, *prev; - + char name[64] DNA_DEPRECATED; /* MAX_NAME */ - + struct Material *mat_override DNA_DEPRECATED; /* Converted to ViewLayer override. */ - + unsigned int lay DNA_DEPRECATED; /* Converted to LayerCollection cycles camera visibility override. */ unsigned int lay_zmask DNA_DEPRECATED; /* Converted to LayerCollection cycles holdout override. */ unsigned int lay_exclude DNA_DEPRECATED; @@ -560,7 +560,7 @@ typedef enum ClayFlagSettings { typedef struct RenderData { struct ImageFormatData im_format; - + struct AviCodecData *avicodecdata; struct FFMpegCodecData ffcodecdata; @@ -576,11 +576,11 @@ typedef struct RenderData { int frame_step; /* frames to jump during render/playback */ short stereomode DNA_DEPRECATED; /* standalone player stereo settings */ // XXX deprecated since 2.5 - + short dimensionspreset; /* for the dimensions presets menu */ short size; /* size in % */ - + short pad6; /* from buttons: */ @@ -599,7 +599,7 @@ typedef struct RenderData { int tilex, tiley; short planes DNA_DEPRECATED, imtype DNA_DEPRECATED, subimtype DNA_DEPRECATED, quality DNA_DEPRECATED; /*deprecated!*/ - + /** * Render to image editor, fullscreen or to new window. */ @@ -630,34 +630,34 @@ typedef struct RenderData { short frs_sec, pad[7]; - + /* safety, border and display rect */ rctf safety, border; rcti disprect; - + /* information on different layers to be rendered */ ListBase layers DNA_DEPRECATED; /* Converted to Scene->view_layers. */ short actlay DNA_DEPRECATED; /* Converted to Scene->active_layer. */ short pad1; - + /** * Adjustment factors for the aspect ratio in the x direction, was a short in 2.45 */ float xasp, yasp; float frs_sec_base; - + /** * Value used to define filter size for all filter options */ float gauss; - - + + /* color management settings - color profiles, gamma correction, etc */ int color_mgt_flag; - + /* Dither noise intensity */ float dither_intensity; - + /* Bake Render options */ short bake_mode, bake_flag; short bake_filter, bake_samples; @@ -735,14 +735,14 @@ typedef enum eHairType { typedef struct RenderProfile { struct RenderProfile *next, *prev; char name[32]; - + short particle_perc; short subsurf_max; short shadbufsample_max; short pad1; - + float ao_error, pad2; - + } RenderProfile; /* UV Paint */ @@ -805,7 +805,7 @@ typedef struct Paint { /* Paint stroke can use up to PAINT_MAX_INPUT_SAMPLES inputs to * smooth the stroke */ int num_input_samples; - + /* flags used for symmetry */ int symmetry_flags; @@ -821,7 +821,7 @@ typedef struct ImagePaintSettings { Paint paint; short flag, missing_data; - + /* for projection painting only */ short seam_bleed, normal_angle; short screen_grab_size[2]; /* capture size for re-projection */ @@ -964,10 +964,10 @@ typedef enum eGP_EditBrush_Flag { GP_EDITBRUSH_FLAG_INVERT = (1 << 0), /* adjust strength using pen pressure */ GP_EDITBRUSH_FLAG_USE_PRESSURE = (1 << 1), - + /* strength of brush falls off with distance from cursor */ GP_EDITBRUSH_FLAG_USE_FALLOFF = (1 << 2), - + /* smooth brush affects pressure values as well */ GP_EDITBRUSH_FLAG_SMOOTH_PRESSURE = (1 << 3) } eGP_EditBrush_Flag; @@ -978,7 +978,7 @@ typedef enum eGP_EditBrush_Flag { typedef struct GP_BrushEdit_Settings { GP_EditBrush_Data brush[11]; /* TOT_GP_EDITBRUSH_TYPES */ void *paintcursor; /* runtime */ - + int brushtype; /* eGP_EditBrush_Types */ int flag; /* eGP_BrushEdit_SettingsFlag */ int lock_axis; /* eGP_Lockaxis_Types lock drawing to one axis */ @@ -1001,13 +1001,13 @@ typedef enum eGP_BrushEdit_SettingsFlag { /* Settings for GP Interpolation Operators */ typedef struct GP_Interpolate_Settings { short flag; /* eGP_Interpolate_SettingsFlag */ - - char type; /* eGP_Interpolate_Type - Interpolation Mode */ + + char type; /* eGP_Interpolate_Type - Interpolation Mode */ char easing; /* eBezTriple_Easing - Easing mode (if easing equation used) */ - + float back; /* BEZT_IPO_BACK */ float amplitude, period; /* BEZT_IPO_ELASTIC */ - + struct CurveMapping *custom_ipo; /* custom interpolation curve (for use with GP_IPO_CURVEMAP) */ } GP_Interpolate_Settings; @@ -1023,10 +1023,10 @@ typedef enum eGP_Interpolate_SettingsFlag { typedef enum eGP_Interpolate_Type { /* Traditional Linear Interpolation */ GP_IPO_LINEAR = 0, - + /* CurveMap Defined Interpolation */ GP_IPO_CURVEMAP = 1, - + /* Easing Equations */ GP_IPO_BACK = 3, GP_IPO_BOUNCE = 4, @@ -1073,11 +1073,11 @@ typedef struct UnifiedPaintSettings { /* record movement of mouse so that rake can start at an intuitive angle */ float last_rake[2]; float last_rake_angle; - + int last_stroke_valid; float average_stroke_accum[3]; int average_stroke_counter; - + float brush_rotation; float brush_rotation_sec; @@ -1213,7 +1213,7 @@ typedef struct ToolSettings { VPaint *wpaint; /* weight paint */ Sculpt *sculpt; UvSculpt *uvsculpt; /* uv smooth */ - + /* Vertex group weight - used only for editmode, not weight * paint */ float vgroup_weight; @@ -1245,22 +1245,22 @@ typedef struct ToolSettings { char gpencil_ima_align; /* : Image Editor */ char _pad3[4]; - + /* Grease Pencil Sculpt */ struct GP_BrushEdit_Settings gp_sculpt; - + /* Grease Pencil Interpolation Tool(s) */ struct GP_Interpolate_Settings gp_interpolate; - + /* Grease Pencil Drawing Brushes (bGPDbrush) */ - ListBase gp_brushes; + ListBase gp_brushes; /* Image Paint (8 byttse aligned please!) */ struct ImagePaintSettings imapaint; /* Particle Editing */ struct ParticleEditSettings particle; - + /* Transform Proportional Area of Effect */ float proportional_size; @@ -1431,32 +1431,32 @@ typedef struct SceneEEVEE { typedef struct Scene { ID id; - struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ - + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ + struct Object *camera; struct World *world; - + struct Scene *set; - + ListBase base DNA_DEPRECATED; struct Base *basact DNA_DEPRECATED; /* active base */ void *_pad1; - + View3DCursor cursor; /* 3d cursor location */ - + unsigned int lay; /* bitflags for layer visibility */ int layact; /* active layer */ unsigned int lay_updated; /* runtime flag, has layer ever been updated since load? */ - + short flag; /* various settings */ - + char use_nodes; char pad[1]; - + struct bNodeTree *nodetree; - + struct Editing *ed; /* sequence editor data is allocated here */ - + struct ToolSettings *toolsettings; /* default allocated now */ void *pad2; struct DisplaySafeAreas safe_areas; @@ -1476,9 +1476,9 @@ typedef struct Scene { void *playback_handle; void *sound_scrub_handle; void *speaker_handles; - + void *fps_info; /* (runtime) info/cache used for presenting playback framerate info to the user */ - + /* none of the dependency graph vars is mean to be saved */ struct GHash *depsgraph_hash; int pad7; @@ -1489,7 +1489,7 @@ typedef struct Scene { /* Units */ struct UnitSettings unit; - + /* Grease Pencil */ struct bGPdata *gpd; @@ -1506,7 +1506,7 @@ typedef struct Scene { ColorManagedViewSettings view_settings; ColorManagedDisplaySettings display_settings; ColorManagedColorspaceSettings sequencer_colorspace_settings; - + /* RigidBody simulation world+settings */ struct RigidBodyWorld *rigidbody_world; @@ -1536,7 +1536,7 @@ typedef struct Scene { #define R_OSA 0x0001 /* #define R_SHADOW 0x0002 */ /* #define R_GAMMA 0x0004 */ -#define R_ORTHO 0x0008 +#define R_ORTHO 0x0008 /* #define R_ENVMAP 0x0010 */ /* #define R_EDGE 0x0020 */ /* #define R_FIELDS 0x0040 */ @@ -1558,7 +1558,7 @@ typedef struct Scene { /* threads obsolete... is there for old files, now use for autodetect threads */ #define R_THREADS 0x80000 /* Use the same flag for autothreads */ -#define R_FIXED_THREADS 0x80000 +#define R_FIXED_THREADS 0x80000 /* #define R_SPEED 0x100000 */ /* #define R_SSS 0x200000 */ @@ -2014,14 +2014,14 @@ typedef enum eGPencil_Source_3D { typedef enum eGPencil_Placement_Flags { /* New strokes are added in viewport/data space (i.e. not screen space) */ GP_PROJECT_VIEWSPACE = (1 << 0), - + /* Viewport space, but relative to render canvas (Sequencer Preview Only) */ GP_PROJECT_CANVAS = (1 << 1), - + /* Project into the screen's Z values */ GP_PROJECT_DEPTH_VIEW = (1 << 2), GP_PROJECT_DEPTH_STROKE = (1 << 3), - + /* "Use Endpoints" */ GP_PROJECT_DEPTH_STROKE_ENDPOINTS = (1 << 4), } eGPencil_Placement_Flags; diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 7fd0dbeb156..500d198fa74 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -79,7 +79,7 @@ typedef struct bScreen { char skip_handling; /* set to delay screen handling after switching back from maximized area */ char scrubbing; /* set when scrubbing to avoid some costly updates */ char pad[3]; - + struct ARegion *active_region; /* active region that has mouse focus */ struct wmTimer *animtimer; /* if set, screen has timer handler added in window */ @@ -266,7 +266,7 @@ typedef struct ScrArea_Runtime { typedef struct ScrArea { struct ScrArea *next, *prev; - + ScrVert *v1, *v2, *v3, *v4; /* ordered (bl, tl, tr, br) */ bScreen *full; /* if area==full, this is the parent */ @@ -287,7 +287,7 @@ typedef struct ScrArea { short region_active_win; /* index of last used region of 'RGN_TYPE_WINDOW' * runtime variable, updated by executing operators */ char temp, pad; - + struct SpaceType *type; /* callbacks for this space type */ /* Non-NULL if this area is global. */ @@ -317,28 +317,28 @@ typedef struct ARegion_Runtime { typedef struct ARegion { struct ARegion *next, *prev; - + View2D v2d; /* 2D-View scrolling/zoom info (most regions are 2d anyways) */ rcti winrct; /* coordinates of region */ rcti drawrct; /* runtime for partial redraw, same or smaller than winrct */ short winx, winy; /* size */ - + short visible; /* region is currently visible on screen */ short regiontype; /* window, header, etc. identifier for drawing */ short alignment; /* how it should split */ short flag; /* hide, ... */ - + float fsize; /* current split size in float (unused) */ short sizex, sizey; /* current split size in pixels (if zero it uses regiontype) */ - + short do_draw; /* private, cached notifier events */ short do_draw_overlay; /* private, cached notifier events */ short overlap; /* private, set for indicate drawing overlapped */ short flagfullscreen; /* temporary copy of flag settings for clean fullscreen */ short pad1, pad2; - + struct ARegionType *type; /* callbacks for this region type */ - + ListBase uiblocks; /* uiBlock */ ListBase panels; /* Panel */ ListBase panels_category_active; /* Stack of panel categories */ diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index b7e118d2053..ef076c98b5f 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -215,7 +215,7 @@ typedef struct Editing { ListBase *seqbasep; /* pointer to the current list of seq's being edited (can be within a meta strip) */ ListBase seqbase; /* pointer to the top-most seq's */ ListBase metastack; - + /* Context vars, used to be static */ Sequence *act_seq; char act_imagedir[1024]; /* 1024 = FILE_MAX */ @@ -233,7 +233,7 @@ typedef struct WipeVars { short forward, wipetype; } WipeVars; -typedef struct GlowVars { +typedef struct GlowVars { float fMini; /* Minimum intensity to trigger a glow */ float fClamp; float fBoost; /* Amount to multiply glow intensity */ @@ -439,7 +439,7 @@ enum { SEQ_AUDIO_PITCH_ANIMATED = (1 << 25), SEQ_AUDIO_PAN_ANIMATED = (1 << 26), SEQ_AUDIO_DRAW_WAVEFORM = (1 << 27), - + /* don't include Grease Pencil in OpenGL previews of Scene strips */ SEQ_SCENE_NO_GPENCIL = (1 << 28), SEQ_USE_VIEWS = (1 << 29), diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h index 47f73c6ac22..76b609b0c6c 100644 --- a/source/blender/makesdna/DNA_smoke_types.h +++ b/source/blender/makesdna/DNA_smoke_types.h @@ -174,7 +174,7 @@ typedef struct SmokeDomainSettings { int flags; /* show up-res or low res, etc */ int viewsettings; short noise; /* noise type: wave, curl, anisotropic */ - short diss_percent; + short diss_percent; int diss_speed;/* in frames */ float strength; int res_wt[3]; diff --git a/source/blender/makesdna/DNA_speaker_types.h b/source/blender/makesdna/DNA_speaker_types.h index 8ad987818ae..f7bc3b41e55 100644 --- a/source/blender/makesdna/DNA_speaker_types.h +++ b/source/blender/makesdna/DNA_speaker_types.h @@ -34,7 +34,7 @@ struct bSound; typedef struct Speaker { ID id; - struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ struct bSound *sound; diff --git a/source/blender/makesdna/DNA_text_types.h b/source/blender/makesdna/DNA_text_types.h index 163dda678d9..78902598fdb 100644 --- a/source/blender/makesdna/DNA_text_types.h +++ b/source/blender/makesdna/DNA_text_types.h @@ -49,16 +49,16 @@ typedef struct TextLine { typedef struct Text { ID id; - + char *name; void *compiled; int flags, nlines; - + ListBase lines; TextLine *curl, *sell; int curc, selc; - + double mtime; } Text; diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h index f5267f20d2c..bc0b3609a09 100644 --- a/source/blender/makesdna/DNA_texture_types.h +++ b/source/blender/makesdna/DNA_texture_types.h @@ -58,7 +58,7 @@ typedef struct MTex { struct Object *object; struct Tex *tex; char uvname[64]; /* MAX_CUSTOMDATA_LAYER_NAME */ - + char projx, projy, projz, mapping; char brush_map_mode, brush_angle_mode; char pad[2]; @@ -68,10 +68,10 @@ typedef struct MTex { short normapspace, which_output; float r, g, b, k; float def_var, rt; - + /* common */ float colfac, varfac; - + /* material */ float norfac, dispfac, warpfac; float colspecfac, mirrfac, alphafac; @@ -127,10 +127,10 @@ typedef struct PointDensity { float radius; short source; short pad0; - + short color_source; /* psys_color_source */ short ob_color_source; - + int totpoints; struct Object *object; /* for 'Object' or 'Particle system' type - source object */ @@ -138,27 +138,27 @@ typedef struct PointDensity { short psys_cache_space; /* cache points in worldspace, object space, ... ? */ short ob_cache_space; /* cache points in worldspace, object space, ... ? */ char vertex_attribute_name[64]; /* vertex attribute layer for color source, MAX_CUSTOMDATA_LAYER_NAME */ - + void *point_tree; /* the acceleration tree containing points */ float *point_data; /* dynamically allocated extra for extra information, like particle age */ - + float noise_size; short noise_depth; short noise_influence; short noise_basis; short pad1[3]; float noise_fac; - + float speed_scale, falloff_speed_scale, pad2; struct ColorBand *coba; /* for time -> color */ - + struct CurveMapping *falloff_curve; /* falloff density curve */ } PointDensity; typedef struct Tex { ID id; - struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ - + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ + float noisesize, turbul; float bright, contrast, saturation, rfac, gfac, bfac; float filtersize, pad2; @@ -184,7 +184,7 @@ typedef struct Tex { short imaflag, flag; short type, stype; - + float cropxmin, cropymin, cropxmax, cropymax; int texfilter; int afmax; // anisotropic filter maximum value, ewa -> max eccentricity, feline -> max probes @@ -195,21 +195,21 @@ typedef struct Tex { short fie_ima; int len; int frames, offset, sfra; - + float checkerdist, nabla; float pad1; - + struct ImageUser iuser; - + struct bNodeTree *nodetree; struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */ struct Image *ima; struct ColorBand *coba; struct PreviewImage *preview; - + char use_nodes; char pad[7]; - + } Tex; /* used for mapping and texture nodes. note: rot is now in radians */ @@ -219,7 +219,7 @@ typedef struct TexMapping { int flag; char projx, projy, projz, mapping; int type; - + float mat[4][4]; float min[3], max[3]; struct Object *ob; @@ -337,7 +337,7 @@ typedef struct ColorMapping { #define TEX_PRV_NOR 64 #define TEX_REPEAT_XMIR 128 #define TEX_REPEAT_YMIR 256 -#define TEX_FLAG_MASK ( TEX_COLORBAND | TEX_FLIPBLEND | TEX_NEGALPHA | TEX_CHECKER_ODD | TEX_CHECKER_EVEN | TEX_PRV_ALPHA | TEX_PRV_NOR | TEX_REPEAT_XMIR | TEX_REPEAT_YMIR ) +#define TEX_FLAG_MASK ( TEX_COLORBAND | TEX_FLIPBLEND | TEX_NEGALPHA | TEX_CHECKER_ODD | TEX_CHECKER_EVEN | TEX_PRV_ALPHA | TEX_PRV_NOR | TEX_REPEAT_XMIR | TEX_REPEAT_YMIR ) #define TEX_DS_EXPAND 512 #define TEX_NO_CLAMP 1024 @@ -455,7 +455,7 @@ typedef struct ColorMapping { #define MTEX_BLEND_SAT 11 #define MTEX_BLEND_VAL 12 #define MTEX_BLEND_COLOR 13 -#define MTEX_SOFT_LIGHT 15 +#define MTEX_SOFT_LIGHT 15 #define MTEX_LIN_LIGHT 16 /* brush_map_mode */ diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 7315c84070c..71821804ab7 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -53,7 +53,7 @@ struct ColorBand; typedef enum eUIFont_ID { UIFONT_DEFAULT = 0, /* UIFONT_BITMAP = 1 */ /* UNUSED */ - + /* free slots */ UIFONT_CUSTOM1 = 2, UIFONT_CUSTOM2 = 3 @@ -97,16 +97,16 @@ typedef enum eFontStyle_Align { typedef struct uiStyle { struct uiStyle *next, *prev; - + char name[64]; /* MAX_STYLE_NAME */ - + uiFontStyle paneltitle; uiFontStyle grouplabel; uiFontStyle widgetlabel; uiFontStyle widget; - + float panelzoom; - + short minlabelchars; /* in characters */ short minwidgetchars; /* in characters */ @@ -169,7 +169,7 @@ typedef struct ThemeUI { uiWidgetColors wcol_num, wcol_numslider, wcol_tab; uiWidgetColors wcol_menu, wcol_pulldown, wcol_menu_back, wcol_menu_item, wcol_tooltip; uiWidgetColors wcol_box, wcol_scroll, wcol_progress, wcol_list_item, wcol_pie_menu; - + uiWidgetStateColors wcol_state; uiPanelColors panel; /* depricated, but we keep it for do_versions (2.66.1) */ @@ -179,10 +179,10 @@ typedef struct ThemeUI { /* fac: 0 - 1 for blend factor, width in pixels */ float menu_shadow_fac; short menu_shadow_width; - + char editor_outline[4]; short pad[1]; - + char iconfile[256]; // FILE_MAXFILE length float icon_alpha; float icon_saturation; @@ -209,7 +209,7 @@ typedef struct ThemeSpace { char title[4]; /* panel title */ char text[4]; char text_hi[4]; - + /* header colors */ char header[4]; /* region background */ char header_title[4]; /* unused */ @@ -227,19 +227,19 @@ typedef struct ThemeSpace { char button_title[4]; /* panel title */ char button_text[4]; char button_text_hi[4]; - + /* listview regions */ char list[4]; /* region background */ char list_title[4]; /* panel title */ char list_text[4]; char list_text_hi[4]; - + /* float panel */ /* char panel[4]; unused */ /* char panel_title[4]; unused */ /* char panel_text[4]; unused */ /* char panel_text_hi[4]; unused */ - + /* note, cannot use name 'panel' because of DNA mapping old files */ uiPanelColors panelcolors; @@ -247,10 +247,10 @@ typedef struct ThemeSpace { char shade1[4]; char shade2[4]; - + char hilite[4]; - char grid[4]; - + char grid[4]; + char view_overlay[4]; char wire[4], wire_edit[4], wire_inactive[4], select[4]; @@ -270,58 +270,58 @@ typedef struct ThemeSpace { char cframe[4]; char time_keyframe[4], time_gp_keyframe[4]; char freestyle_edge_mark[4], freestyle_face_mark[4]; - + char nurb_uline[4], nurb_vline[4]; char act_spline[4], nurb_sel_uline[4], nurb_sel_vline[4], lastsel_point[4]; - + char handle_free[4], handle_auto[4], handle_vect[4], handle_align[4], handle_auto_clamped[4]; char handle_sel_free[4], handle_sel_auto[4], handle_sel_vect[4], handle_sel_align[4], handle_sel_auto_clamped[4]; - + char ds_channel[4], ds_subchannel[4]; /* dopesheet */ char keytype_keyframe[4], keytype_extreme[4], keytype_breakdown[4], keytype_jitter[4]; /* keytypes */ char keytype_keyframe_select[4], keytype_extreme_select[4], keytype_breakdown_select[4], keytype_jitter_select[4]; /* keytypes */ char keyborder[4], keyborder_select[4]; - + char console_output[4], console_input[4], console_info[4], console_error[4]; char console_cursor[4], console_select[4]; - + char vertex_size, outline_width, facedot_size; char noodle_curving; /* syntax for textwindow and nodes */ - char syntaxl[4], syntaxs[4]; // in nodespace used for backdrop matte + char syntaxl[4], syntaxs[4]; // in nodespace used for backdrop matte char syntaxb[4], syntaxn[4]; // in nodespace used for color input char syntaxv[4], syntaxc[4]; // in nodespace used for converter group - char syntaxd[4], syntaxr[4]; // in nodespace used for distort + char syntaxd[4], syntaxr[4]; // in nodespace used for distort char nodeclass_output[4], nodeclass_filter[4]; char nodeclass_vector[4], nodeclass_texture[4]; char nodeclass_shader[4], nodeclass_script[4]; char nodeclass_pattern[4], nodeclass_layout[4]; - + char movie[4], movieclip[4], mask[4], image[4], scene[4], audio[4]; /* for sequence editor */ char effect[4], transition[4], meta[4], text_strip[4]; - + float keyframe_scale_fac; /* for dopesheet - scale factor for size of keyframes (i.e. height of channels) */ - - char editmesh_active[4]; + + char editmesh_active[4]; char handle_vertex[4]; char handle_vertex_select[4]; - + char handle_vertex_size; char clipping_border_3d[4]; - + char marker_outline[4], marker[4], act_marker[4], sel_marker[4], dis_marker[4], lock_marker[4]; char bundle_solid[4]; char path_before[4], path_after[4]; char camera_path[4]; char hpad[2]; - + char gp_vertex_size; char gp_vertex[4], gp_vertex_select[4]; - + char preview_back[4]; char preview_stitch_face[4]; char preview_stitch_edge[4]; @@ -329,7 +329,7 @@ typedef struct ThemeSpace { char preview_stitch_stitchable[4]; char preview_stitch_unstitchable[4]; char preview_stitch_active[4]; - + char uv_shadow[4]; /* two uses, for uvs with modifier applied on mesh and uvs during painting */ char uv_others[4]; /* uvs of other objects */ @@ -337,14 +337,14 @@ typedef struct ThemeSpace { char selected_highlight[4]; /* outliner - selected item */ char skin_root[4]; /* Skin modifier root color */ - + /* NLA */ char anim_active[4]; /* Active Action + Summary Channel */ char anim_non_active[4]; /* Active Action = NULL */ - + char nla_tweaking[4]; /* NLA 'Tweaking' action/strip */ char nla_tweakdupli[4]; /* NLA - warning color for duplicate instances of tweaking strip */ - + char nla_transition[4], nla_transition_sel[4]; /* NLA "Transition" strips */ char nla_meta[4], nla_meta_sel[4]; /* NLA "Meta" strips */ char nla_sound[4], nla_sound_sel[4]; /* NLA "Sound" strips */ @@ -370,10 +370,10 @@ typedef struct ThemeWireColor { char solid[4]; char select[4]; char active[4]; - + short flag; /* eWireColor_Flags */ short pad; -} ThemeWireColor; +} ThemeWireColor; /* ThemeWireColor.flag */ typedef enum eWireColor_Flags { @@ -385,9 +385,9 @@ typedef enum eWireColor_Flags { typedef struct bTheme { struct bTheme *next, *prev; char name[32]; - + ThemeUI tui; - + /* Individual Spacetypes */ /* note: ensure UI_THEMESPACE_END is updated when adding */ ThemeSpace tbuts; @@ -412,7 +412,7 @@ typedef struct bTheme { /* 20 sets of bone colors for this theme */ ThemeWireColor tarm[20]; /*ThemeWireColor tobj[20];*/ - + int active_theme_area, pad; } bTheme; @@ -450,7 +450,7 @@ typedef struct WalkNavigation { typedef struct UserDef { /* UserDef has separate do-version handling, and can be read from other files */ int versionfile, subversionfile; - + int flag; /* eUserPref_Flag */ int dupflag; /* eDupli_ID_Flags */ int savetime; @@ -466,13 +466,13 @@ typedef struct UserDef { char image_editor[1024]; /* 1024 = FILE_MAX */ char anim_player[1024]; /* 1024 = FILE_MAX */ int anim_player_preset; - + short v2d_min_gridsize; /* minimum spacing between gridlines in View2D grids */ short timecode_style; /* eTimecodeStyles, style of timecode display */ - + short versions; short dbl_click_time; - + short pad; short wheellinescroll; int uiflag; /* eUserpref_UI_Flag */ @@ -482,7 +482,7 @@ typedef struct UserDef { short app_flag; short language; short userpref, viewzoom; - + int mixbufsize; int audiodevice; int audiorate; @@ -513,7 +513,7 @@ typedef struct UserDef { struct ListBase addons; struct ListBase autoexec_paths; char keyconfigstr[64]; - + short undosteps; short pad1; int undomemory; @@ -550,7 +550,7 @@ typedef struct UserDef { short scrcastfps; /* frame rate for screencast to be played back */ short scrcastwait; /* milliseconds between screencast snapshots */ - + short widget_unit; /* private, defaults to 20 for 72 DPI setting */ short anisotropic_filter; short use_16bit_textures, use_gpu_mipmap; @@ -564,12 +564,12 @@ typedef struct UserDef { /* eImageDrawMethod, Method to be used to draw the images (AUTO, GLSL, Textures or DrawPixels) */ short image_draw_method; - + float glalphaclip; - + short autokey_mode; /* eAutokey_Mode, autokeying mode */ short autokey_flag; /* flags for autokeying */ - + short text_render, pad9; /* options for text rendering */ struct ColorBand coba_weight; /* from texture.h */ @@ -587,7 +587,7 @@ typedef struct UserDef { int compute_device_type; int compute_device_id; - + float fcu_inactive_alpha; /* opacity of inactive F-Curves in F-Curve Editor */ short pie_interaction_type; /* if keeping a pie menu spawn button pressed after this time, it turns into @@ -737,7 +737,7 @@ typedef enum eUserpref_APP_Flag { typedef enum eAutokey_Mode { /* AUTOKEY_ON is a bitflag */ AUTOKEY_ON = 1, - + /* AUTOKEY_ON + 2**n... (i.e. AUTOKEY_MODE_NORMAL = AUTOKEY_ON + 2) to preserve setting, even when autokey turned off */ AUTOKEY_MODE_NORMAL = 3, AUTOKEY_MODE_EDITKEYS = 5 @@ -760,7 +760,7 @@ typedef enum eAutokey_Flag { AUTOKEY_FLAG_INSERTNEEDED = (1 << 1), AUTOKEY_FLAG_AUTOMATKEY = (1 << 2), AUTOKEY_FLAG_XYZ2RGB = (1 << 3), - + /* toolsettings->autokey_flag */ AUTOKEY_FLAG_ONLYKEYINGSET = (1 << 6), AUTOKEY_FLAG_NOWARNING = (1 << 7), @@ -838,7 +838,7 @@ typedef enum eColorPicker_Types { * UserDef.timecode_style */ typedef enum eTimecodeStyles { /* as little info as is necessary to show relevant info - * with '+' to denote the frames + * with '+' to denote the frames * i.e. HH:MM:SS+FF, MM:SS+FF, SS+FF, or MM:SS */ USER_TIMECODE_MINIMAL = 0, diff --git a/source/blender/makesdna/DNA_vfont_types.h b/source/blender/makesdna/DNA_vfont_types.h index 7025a5767c4..721a97742b9 100644 --- a/source/blender/makesdna/DNA_vfont_types.h +++ b/source/blender/makesdna/DNA_vfont_types.h @@ -44,9 +44,9 @@ struct VFontData; typedef struct VFont { ID id; - + char name[1024]; /* 1024 = FILE_MAX */ - + struct VFontData *data; struct PackedFile *packedfile; diff --git a/source/blender/makesdna/DNA_view2d_types.h b/source/blender/makesdna/DNA_view2d_types.h index a0480aa361b..dce78638328 100644 --- a/source/blender/makesdna/DNA_view2d_types.h +++ b/source/blender/makesdna/DNA_view2d_types.h @@ -41,23 +41,23 @@ typedef struct View2D { rctf tot, cur; /* tot - area that data can be drawn in; cur - region of tot that is visible in viewport */ rcti vert, hor; /* vert - vertical scrollbar region; hor - horizontal scrollbar region */ rcti mask; /* mask - region (in screenspace) within which 'cur' can be viewed */ - + float min[2], max[2]; /* min/max sizes of 'cur' rect (only when keepzoom not set) */ float minzoom, maxzoom; /* allowable zoom factor range (only when (keepzoom & V2D_LIMITZOOM)) is set */ - + short scroll; /* scroll - scrollbars to display (bitflag) */ short scroll_ui; /* scroll_ui - temp settings used for UI drawing of scrollers */ - + short keeptot; /* keeptot - 'cur' rect cannot move outside the 'tot' rect? */ short keepzoom; /* keepzoom - axes that zooming cannot occur on, and also clamp within zoom-limits */ short keepofs; /* keepofs - axes that translation is not allowed to occur on */ - + short flag; /* settings */ short align; /* alignment of content in totrect */ - + short winx, winy; /* storage of current winx/winy values, set in UI_view2d_size_update */ short oldwinx, oldwiny; /* storage of previous winx/winy values encountered by UI_view2d_curRect_validate(), for keepaspect */ - + short around; /* pivot point for transforms (rotate and scale) */ float *tab_offset; /* different offset per tab, for buttons */ diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index b7d12a3cf1d..ef1c9db183d 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -62,7 +62,7 @@ struct GPUViewport; #endif typedef struct RegionView3D { - + float winmat[4][4]; /* GL_PROJECTION matrix */ float viewmat[4][4]; /* GL_MODELVIEW matrix */ float viewinv[4][4]; /* inverse of viewmat */ @@ -193,24 +193,24 @@ typedef struct View3D { unsigned int lay_prev; /* for active layer toggle */ unsigned int lay_used; /* used while drawing */ - + short persp DNA_DEPRECATED; short view DNA_DEPRECATED; - + struct Object *camera, *ob_centre; rctf render_border; struct View3D *localvd; /* allocated backup of its self while in localview */ - + char ob_centre_bone[64]; /* optional string for armature bone to define center, MAXBONENAME */ - + unsigned int lay; int layact; - + short ob_centre_cursor; /* optional bool for 3d cursor to define center */ short scenelock, _pad1; short flag, flag2, pad2; - + float lens, grid; float near, far; float ofs[3] DNA_DEPRECATED; /* XXX deprecated */ @@ -227,7 +227,7 @@ typedef struct View3D { /* transform manipulator info */ char twtype, _pad5, twflag; - + short flag3; /* drawflags, denoting state */ diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index a0c764d3771..19d4ab10165 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -239,7 +239,7 @@ typedef struct wmWindow { #endif /* These two Lines with # tell makesdna this struct can be excluded. */ -/* should be something like DNA_EXCLUDE +/* should be something like DNA_EXCLUDE * but the preprocessor first removes all comments, spaces etc */ # # diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h index 84050894faa..38bfb20581b 100644 --- a/source/blender/makesdna/DNA_world_types.h +++ b/source/blender/makesdna/DNA_world_types.h @@ -50,7 +50,7 @@ struct MTex; * gravity, color model etc. It mixes rendering data and modeling data. */ typedef struct World { ID id; - struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ + struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */ char _pad0[4]; short texact, mistype; @@ -64,7 +64,7 @@ typedef struct World { */ float exposure, exp, range; float linfac, logfac; - + /** * Some world modes * bit 0: Do mist @@ -76,10 +76,10 @@ typedef struct World { /* ambient occlusion */ float aodist, aoenergy; - + /* assorted settings */ short flag, pad3[3]; - + struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */ short pr_texture, use_nodes, pad; short update_flag; /* XXX temporary flag waiting for depsgraph proper tagging */ @@ -114,7 +114,7 @@ enum { /* flag */ #define WO_DS_EXPAND (1<<0) - /* NOTE: this must have the same value as MA_DS_SHOW_TEXS, + /* NOTE: this must have the same value as MA_DS_SHOW_TEXS, * otherwise anim-editors will not read correctly */ #define WO_DS_SHOW_TEXS (1<<2) diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index 9c44d60b7c2..257c57e5a9a 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -201,10 +201,10 @@ static int elementsize(const SDNA *sdna, short type, short name) { int mul, namelen, len; const char *cp; - + cp = sdna->names[name]; len = 0; - + namelen = strlen(cp); /* is it a pointer or function pointer? */ if (ispointer(cp)) { @@ -213,7 +213,7 @@ static int elementsize(const SDNA *sdna, short type, short name) if (cp[namelen - 1] == ']') { mul = DNA_elem_array_size(cp); } - + len = sdna->pointerlen * mul; } else if (sdna->typelens[type]) { @@ -222,11 +222,11 @@ static int elementsize(const SDNA *sdna, short type, short name) if (cp[namelen - 1] == ']') { mul = DNA_elem_array_size(cp); } - + len = mul * sdna->typelens[type]; - + } - + return len; } @@ -236,13 +236,13 @@ static void printstruct(SDNA *sdna, short strnr) /* is for debug */ int b, nr; short *sp; - + sp = sdna->structs[strnr]; - + printf("struct %s\n", sdna->types[sp[0]]); nr = sp[1]; sp += 2; - + for (b = 0; b < nr; b++, sp += 2) { printf(" %s %s\n", sdna->types[sp[0]], sdna->names[sp[1]]); } @@ -364,7 +364,7 @@ static bool init_structDNA( int *data, *verg, gravity_fix = -1; short *sp; char str[8]; - + verg = (int *)str; data = (int *)sdna->data; @@ -385,17 +385,17 @@ static bool init_structDNA( const char *cp; data++; - + /* load names array */ strcpy(str, "NAME"); if (*data == *verg) { data++; - + sdna->nr_names = *data; if (do_endian_swap) { BLI_endian_switch_int32(&sdna->nr_names); } - + data++; sdna->names = MEM_callocN(sizeof(void *) * sdna->nr_names, "sdnanames"); } @@ -407,7 +407,7 @@ static bool init_structDNA( /* Temporary DNA doversion for files that were created with Blender 2.80 * between 280.0 and 280.2. */ const bool doversion_280 = need_doversion_280(sdna, data, data_alloc); - + cp = (char *)data; for (int nr = 0; nr < sdna->nr_names; nr++) { sdna->names[nr] = cp; @@ -449,7 +449,7 @@ static bool init_structDNA( } cp = pad_up_4(cp); - + /* load type names array */ data = (int *)cp; strcpy(str, "TYPE"); @@ -460,7 +460,7 @@ static bool init_structDNA( if (do_endian_swap) { BLI_endian_switch_int32(&sdna->nr_types); } - + data++; sdna->types = MEM_callocN(sizeof(void *) * sdna->nr_types, "sdnatypes"); } @@ -468,14 +468,14 @@ static bool init_structDNA( *r_error_message = "TYPE error in SDNA file"; return false; } - + cp = (char *)data; for (int nr = 0; nr < sdna->nr_types; nr++) { sdna->types[nr] = cp; - + /* this is a patch, to change struct names without a conflict with SDNA */ /* be careful to use it, in this case for a system-struct (opengl/X) */ - + /* struct Screen was already used by X, 'bScreen' replaces the old IrisGL 'Screen' struct */ if (strcmp("bScreen", cp) == 0) { sdna->types[nr] = cp + 1; @@ -495,13 +495,13 @@ static bool init_structDNA( sdna->types[nr] = "ViewLayerEngineData"; } } - + while (*cp) cp++; cp++; } cp = pad_up_4(cp); - + /* load typelen array */ data = (int *)cp; strcpy(str, "TLEN"); @@ -509,11 +509,11 @@ static bool init_structDNA( data++; sp = (short *)data; sdna->typelens = sp; - + if (do_endian_swap) { BLI_endian_switch_int16_array(sp, sdna->nr_types); } - + sp += sdna->nr_types; } else { @@ -527,12 +527,12 @@ static bool init_structDNA( strcpy(str, "STRC"); if (*data == *verg) { data++; - + sdna->nr_structs = *data; if (do_endian_swap) { BLI_endian_switch_int32(&sdna->nr_structs); } - + data++; sdna->structs = MEM_callocN(sizeof(void *) * sdna->nr_structs, "sdnastrcs"); } @@ -540,17 +540,17 @@ static bool init_structDNA( *r_error_message = "STRC error in SDNA file"; return false; } - + sp = (short *)data; for (int nr = 0; nr < sdna->nr_structs; nr++) { sdna->structs[nr] = sp; - + if (do_endian_swap) { short a; - + BLI_endian_switch_int16(&sp[0]); BLI_endian_switch_int16(&sp[1]); - + a = sp[1]; sp += 2; while (a--) { @@ -635,7 +635,7 @@ SDNA *DNA_sdna_from_data( sdna->data = data; } sdna->data_alloc = data_alloc; - + if (init_structDNA(sdna, do_endian_swap, data_alloc, &error_message)) { return sdna; @@ -689,11 +689,11 @@ static void recurs_test_compflags(const SDNA *sdna, char *compflags, int structn int a, b, typenr, elems; const short *sp; const char *cp; - + /* check all structs, test if it's inside another struct */ sp = sdna->structs[structnr]; typenr = sp[0]; - + for (a = 0; a < sdna->nr_structs; a++) { if ((a != structnr) && (compflags[a] == SDNA_CMP_EQUAL)) { sp = sdna->structs[a]; @@ -710,7 +710,7 @@ static void recurs_test_compflags(const SDNA *sdna, char *compflags, int structn } } } - + } @@ -724,7 +724,7 @@ const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna const short *sp_old, *sp_new; const char *str1, *str2; char *compflags; - + if (oldsdna->nr_structs == 0) { printf("error: file without SDNA\n"); return NULL; @@ -732,14 +732,14 @@ const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna compflags = MEM_callocN(oldsdna->nr_structs, "compflags"); - /* we check all structs in 'oldsdna' and compare them with + /* we check all structs in 'oldsdna' and compare them with * the structs in 'newsdna' */ unsigned int newsdna_index_last = 0; - + for (a = 0; a < oldsdna->nr_structs; a++) { sp_old = oldsdna->structs[a]; - + /* search for type in cur */ int sp_new_index = DNA_struct_find_nr_ex(newsdna, oldsdna->types[sp_old[0]], &newsdna_index_last); @@ -750,7 +750,7 @@ const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna sp_new = newsdna->structs[sp_new_index]; /* initial assumption */ compflags[a] = SDNA_CMP_NOT_EQUAL; - + /* compare length and amount of elems */ if (sp_new[1] == sp_old[1]) { if (newsdna->typelens[sp_new[0]] == oldsdna->typelens[sp_old[0]]) { @@ -784,7 +784,7 @@ const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna } } - + } } @@ -801,7 +801,7 @@ const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna recurs_test_compflags(oldsdna, compflags, a); } } - + #if 0 for (a = 0; a < oldsdna->nr_structs; a++) { if (compflags[a] == SDNA_CMP_NOT_EQUAL) { @@ -884,7 +884,7 @@ static void cast_elem( case SDNA_TYPE_UINT64: val = *( (uint64_t *)olddata); break; } - + switch (ctypenr) { case SDNA_TYPE_CHAR: *curdata = val; break; @@ -929,11 +929,11 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata { int64_t lval; int arrlen; - + arrlen = DNA_elem_array_size(name); - + while (arrlen > 0) { - + if (curlen == oldlen) { memcpy(curdata, olddata, curlen); } @@ -952,7 +952,7 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata /* for debug */ printf("errpr: illegal pointersize!\n"); } - + olddata += oldlen; curdata += curlen; arrlen--; @@ -966,7 +966,7 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata static int elem_strcmp(const char *name, const char *oname) { int a = 0; - + while (1) { if (name[a] != oname[a]) return 1; if (name[a] == '[' || oname[a] == '[') break; @@ -999,9 +999,9 @@ static const char *find_elem( { int a, elemcount, len; const char *otype, *oname; - + /* without arraypart, so names can differ: return old namenr and type */ - + /* in old is the old struct */ elemcount = old[1]; old += 2; @@ -1017,10 +1017,10 @@ static const char *find_elem( if (sppo) *sppo = old; return olddata; } - + return NULL; } - + olddata += len; } return NULL; @@ -1058,7 +1058,7 @@ static void reconstruct_elem( */ int a, elemcount, len, countpos, oldsize, cursize, mul; const char *otype, *oname, *cp; - + /* is 'name' an array? */ cp = name; countpos = 0; @@ -1066,7 +1066,7 @@ static void reconstruct_elem( cp++; countpos++; } if (*cp != '[') countpos = 0; - + /* in old is the old struct */ elemcount = old[1]; old += 2; @@ -1074,9 +1074,9 @@ static void reconstruct_elem( otype = oldsdna->types[old[0]]; oname = oldsdna->names[old[1]]; len = elementsize(oldsdna, old[0], old[1]); - + if (strcmp(name, oname) == 0) { /* name equal */ - + if (ispointer(name)) { /* pointer of functionpointer afhandelen */ cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, name, curdata, olddata); } @@ -1092,7 +1092,7 @@ static void reconstruct_elem( else if (countpos != 0) { /* name is an array */ if (oname[countpos] == '[' && strncmp(name, oname, countpos) == 0) { /* basis equal */ - + cursize = DNA_elem_array_size(name); oldsize = DNA_elem_array_size(oname); @@ -1105,7 +1105,7 @@ static void reconstruct_elem( mul = len / oldsize; /* size of single old array element */ mul *= (cursize < oldsize) ? cursize : oldsize; /* smaller of sizes of old and new arrays */ memcpy(curdata, olddata, mul); - + if (oldsize > cursize && strcmp(type, "char") == 0) { /* string had to be truncated, ensure it's still null-terminated */ curdata[mul - 1] = '\0'; @@ -1169,7 +1169,7 @@ static void reconstruct_struct( spo = oldsdna->structs[oldSDNAnr]; elen = oldsdna->typelens[spo[0]]; memcpy(cur, data, elen); - + return; } @@ -1185,7 +1185,7 @@ static void reconstruct_struct( for (a = 0; a < elemcount; a++, spc += 2) { /* convert each field */ type = newsdna->types[spc[0]]; name = newsdna->names[spc[1]]; - + elen = elementsize(newsdna, spc[0], spc[1]); /* test: is type a struct? */ @@ -1193,26 +1193,26 @@ static void reconstruct_struct( /* struct field type */ /* where does the old struct data start (and is there an old one?) */ cpo = (char *)find_elem(oldsdna, type, name, spo, data, &sppo); - + if (cpo) { oldSDNAnr = DNA_struct_find_nr_ex(oldsdna, type, &oldsdna_index_last); curSDNAnr = DNA_struct_find_nr_ex(newsdna, type, &cursdna_index_last); - + /* array! */ mul = DNA_elem_array_size(name); nameo = oldsdna->names[sppo[1]]; mulo = DNA_elem_array_size(nameo); - + eleno = elementsize(oldsdna, sppo[0], sppo[1]); - + elen /= mul; eleno /= mulo; - + while (mul--) { reconstruct_struct(newsdna, oldsdna, compflags, oldSDNAnr, cpo, curSDNAnr, cpc); cpo += eleno; cpc += elen; - + /* new struct array larger than old */ mulo--; if (mulo <= 0) break; @@ -1250,18 +1250,18 @@ void DNA_struct_switch_endian(const SDNA *oldsdna, int oldSDNAnr, char *data) if (oldSDNAnr == -1) return; firststructtypenr = *(oldsdna->structs[0]); - + spo = spc = oldsdna->structs[oldSDNAnr]; elemcount = spo[1]; spc += 2; cur = data; - + for (a = 0; a < elemcount; a++, spc += 2) { type = oldsdna->types[spc[0]]; name = oldsdna->names[spc[1]]; - + /* elementsize = including arraysize */ elen = elementsize(oldsdna, spc[0], spc[1]); @@ -1272,7 +1272,7 @@ void DNA_struct_switch_endian(const SDNA *oldsdna, int oldSDNAnr, char *data) char *cpo = (char *)find_elem(oldsdna, type, name, spo, data, NULL); if (cpo) { oldSDNAnr = DNA_struct_find_nr_ex(oldsdna, type, &oldsdna_index_last); - + mul = DNA_elem_array_size(name); elena = elen / mul; @@ -1338,7 +1338,7 @@ void *DNA_struct_reconstruct( char *cur, *cpc; const char *cpo; const char *type; - + /* oldSDNAnr == structnr, we're looking for the corresponding 'cur' number */ spo = oldsdna->structs[oldSDNAnr]; type = oldsdna->types[spo[0]]; @@ -1387,11 +1387,11 @@ bool DNA_struct_find(const SDNA *sdna, const char *stype) bool DNA_struct_elem_find(const SDNA *sdna, const char *stype, const char *vartype, const char *name) { const int SDNAnr = DNA_struct_find_nr(sdna, stype); - + if (SDNAnr != -1) { const short * const spo = sdna->structs[SDNAnr]; const char * const cp = find_elem(sdna, vartype, name, spo, NULL, NULL); - + if (cp) { return true; } diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index b0da028127c..a1bfac66115 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -226,7 +226,7 @@ static int add_type(const char *str, int len) { int nr; char *cp; - + /* first do validity check */ if (str[0] == 0) { return -1; @@ -236,7 +236,7 @@ static int add_type(const char *str, int len) * 'struct SomeStruct* somevar;' <-- correct but we cant handle right now. */ return -1; } - + /* search through type array */ for (nr = 0; nr < nr_types; nr++) { if (strcmp(str, types[nr]) == 0) { @@ -248,7 +248,7 @@ static int add_type(const char *str, int len) return nr; } } - + /* append new type */ if (nr_types == 0) { cp = typedata; @@ -261,13 +261,13 @@ static int add_type(const char *str, int len) typelens_native[nr_types] = len; typelens_32[nr_types] = len; typelens_64[nr_types] = len; - + if (nr_types >= maxnr) { printf("too many types\n"); return nr_types - 1; } nr_types++; - + return nr_types - 1; } @@ -288,7 +288,7 @@ static int add_name(const char *str) const char *name; additional_slen_offset = 0; - + if (str[0] == 0 /* || (str[1] == 0) */) return -1; if (str[0] == '(' && str[1] == '*') { @@ -306,7 +306,7 @@ static int add_name(const char *str) buf[i] = str[i]; i++; } - + /* Another number we need is the extra slen offset. This extra * offset is the overshoot after a space. If there is no * space, no overshoot should be calculated. */ @@ -322,7 +322,7 @@ static int add_name(const char *str) if (debugSDNA > 3) printf("seen %c ( %d)\n" "special after offset%d\n", str[j], str[j], j); - + if (!isfuncptr) { /* multidimensional array pointer case */ if (str[j] == 0) { @@ -332,7 +332,7 @@ static int add_name(const char *str) printf("Error during tokening multidim array pointer\n"); } else if (str[j] == 0) { - if (debugSDNA > 3) printf("offsetting for space\n"); + if (debugSDNA > 3) printf("offsetting for space\n"); /* get additional offset */ k = 0; while (str[j] != ')') { @@ -349,7 +349,7 @@ static int add_name(const char *str) else { printf("Error during tokening function pointer argument list\n"); } - + /* * Put )(void) at the end? Maybe )(). Should check this with * old sdna. Actually, sometimes )(), sometimes )(void...) @@ -363,7 +363,7 @@ static int add_name(const char *str) * * */ buf[i] = 0; - if (debugSDNA > 3) printf("Name before chomping: %s\n", buf); + if (debugSDNA > 3) printf("Name before chomping: %s\n", buf); if ((strncmp(buf, "(*headdraw", 10) == 0) || (strncmp(buf, "(*windraw", 9) == 0) ) { @@ -390,14 +390,14 @@ static int add_name(const char *str) /* normal field: old code */ name = str; } - + /* search name array */ for (nr = 0; nr < nr_names; nr++) { if (strcmp(name, names[nr]) == 0) { return nr; } } - + /* append new type */ if (nr_names == 0) { cp = namedata; @@ -407,13 +407,13 @@ static int add_name(const char *str) } strcpy(cp, name); names[nr_names] = cp; - + if (nr_names >= maxnr) { printf("too many names\n"); return nr_names - 1; } nr_names++; - + return nr_names - 1; } @@ -430,16 +430,16 @@ static short *add_struct(int namecode) len = sp[1]; structs[nr_structs] = sp + 2 * len + 2; } - + sp = structs[nr_structs]; sp[0] = namecode; - + if (nr_structs >= maxnr) { printf("too many structs\n"); return sp; } nr_structs++; - + return sp; } @@ -447,14 +447,14 @@ static int preprocess_include(char *maindata, int len) { int a, newlen, comment = 0; char *cp, *temp, *md; - + /* note: len + 1, last character is a dummy to prevent * comparisons using uninitialized memory */ temp = MEM_mallocN(len + 1, "preprocess_include"); temp[len] = ' '; memcpy(temp, maindata, len); - + /* remove all c++ comments */ /* replace all enters/tabs/etc with spaces */ cp = temp; @@ -470,7 +470,7 @@ static int preprocess_include(char *maindata, int len) if (comment || *cp < 32 || *cp > 128) *cp = 32; cp++; } - + /* data from temp copy to maindata, remove comments and double spaces */ cp = temp; @@ -479,7 +479,7 @@ static int preprocess_include(char *maindata, int len) comment = 0; a = len; while (a--) { - + if (cp[0] == '/' && cp[1] == '*') { comment = 1; cp[0] = cp[1] = 32; @@ -522,7 +522,7 @@ static int preprocess_include(char *maindata, int len) } cp++; } - + MEM_freeN(temp); return newlen; } @@ -563,7 +563,7 @@ static void *read_file_data(const char *filename, int *r_len) fclose(fp); return NULL; } - + fclose(fp); return data; } @@ -577,7 +577,7 @@ static int convert_include(const char *filename) short *structpoin, *sp; char *maindata, *mainend, *md, *md1; bool skip_struct; - + md = maindata = read_file_data(filename, &filelen); if (filelen == -1) { fprintf(stderr, "Can't read file %s\n", filename); @@ -591,12 +591,12 @@ static int convert_include(const char *filename) count = 0; skip_struct = false; while (count < filelen) { - + /* code for skipping a struct: two hashes on 2 lines. (preprocess added a space) */ if (md[0] == '#' && md[1] == ' ' && md[2] == '#') { skip_struct = true; } - + if (md[0] == '{') { md[0] = 0; if (skip_struct) { @@ -607,7 +607,7 @@ static int convert_include(const char *filename) md1 = md - 2; while (*md1 != 32) md1--; /* to beginning of word */ md1++; - + /* we've got a struct name when... */ if (strncmp(md1 - 7, "struct", 6) == 0) { @@ -626,22 +626,22 @@ static int convert_include(const char *filename) md1 = md + 1; while (*md1 != '}') { if (md1 > mainend) break; - + if (*md1 == ',' || *md1 == ' ') *md1 = 0; md1++; } - + /* read types and names until first character that is not '}' */ md1 = md + 1; while (*md1 != '}') { if (md1 > mainend) break; - + /* skip when it says 'struct' or 'unsigned' or 'const' */ if (*md1) { if (strncmp(md1, "struct", 6) == 0) md1 += 7; if (strncmp(md1, "unsigned", 8) == 0) md1 += 9; if (strncmp(md1, "const", 5) == 0) md1 += 6; - + /* we've got a type! */ type = add_type(md1, 0); if (type == -1) { @@ -653,11 +653,11 @@ static int convert_include(const char *filename) md1 += strlen(md1); - + /* read until ';' */ while (*md1 != ';') { if (md1 > mainend) break; - + if (*md1) { /* We've got a name. slen needs * correction for function @@ -676,11 +676,11 @@ static int convert_include(const char *filename) structpoin[1]++; sp += 2; - + md1 += slen; break; } - + name = add_name(md1); slen += additional_slen_offset; @@ -691,7 +691,7 @@ static int convert_include(const char *filename) structpoin[1]++; sp += 2; - + md1 += slen; } md1++; @@ -708,7 +708,7 @@ static int convert_include(const char *filename) count++; md++; } - + MEM_freeN(maindata); return 0; @@ -718,7 +718,7 @@ static int arraysize(const char *str) { int a, mul = 1; const char *cp = NULL; - + for (a = 0; str[a]; a++) { if (str[a] == '[') { cp = &(str[a + 1]); @@ -729,7 +729,7 @@ static int arraysize(const char *str) mul *= atoi(cp); } } - + return mul; } @@ -763,7 +763,7 @@ static int calculate_structlens(int firststruct) while (unknown) { lastunknown = unknown; unknown = 0; - + /* check all structs... */ for (int a = 0; a < nr_structs; a++) { const short *structpoin = structs[a]; @@ -771,13 +771,13 @@ static int calculate_structlens(int firststruct) /* when length is not known... */ if (typelens_native[structtype] == 0) { - + const short *sp = structpoin + 2; int len_native = 0; int len_32 = 0; int len_64 = 0; bool has_pointer = false; - + /* check all elements in struct */ for (int b = 0; b < structpoin[1]; b++, sp += 2) { int type = sp[0]; @@ -849,7 +849,7 @@ static int calculate_structlens(int firststruct) dna_error = 1; } } - + /* Check 2-4-8 aligned. */ if (!check_field_alignment(firststruct, structtype, type, len_32, cp, "32 bit")) { dna_error = 1; @@ -861,7 +861,7 @@ static int calculate_structlens(int firststruct) len_native += mul * typelens_native[type]; len_32 += mul * typelens_32[type]; len_64 += mul * typelens_64[type]; - + } else { len_native = 0; @@ -870,7 +870,7 @@ static int calculate_structlens(int firststruct) break; } } - + if (len_native == 0) { unknown++; } @@ -887,30 +887,30 @@ static int calculate_structlens(int firststruct) dna_error = 1; } } - + if (len_native % 4) { fprintf(stderr, "Sizeerror 4 in struct: %s (add %d bytes)\n", types[structtype], len_native % 4); dna_error = 1; } - + } } } - + if (unknown == lastunknown) break; } - + if (unknown) { fprintf(stderr, "ERROR: still %d structs unknown\n", unknown); if (debugSDNA) { fprintf(stderr, "*** Known structs :\n"); - + for (int a = 0; a < nr_structs; a++) { const short *structpoin = structs[a]; const int structtype = structpoin[0]; - + /* length unknown */ if (typelens_native[structtype] != 0) { fprintf(stderr, " %s\n", types[structtype]); @@ -918,9 +918,9 @@ static int calculate_structlens(int firststruct) } } - + fprintf(stderr, "*** Unknown structs :\n"); - + for (int a = 0; a < nr_structs; a++) { const short *structpoin = structs[a]; const int structtype = structpoin[0]; @@ -946,7 +946,7 @@ static void dna_write(FILE *file, const void *pntr, const int size) const char *data; data = (const char *)pntr; - + for (i = 0; i < size; i++) { fprintf(file, "%d, ", data[i]); linelength++; @@ -967,7 +967,7 @@ void printStructLengths(void) while (unknown) { /*lastunknown = unknown;*/ /*UNUSED*/ unknown = 0; - + /* check all structs... */ for (a = 0; a < nr_structs; a++) { structpoin = structs[a]; @@ -989,17 +989,17 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs /* it a bit. Hope this is enough :) -nzc- */ char str[SDNA_MAX_FILENAME_LENGTH], *cp; int firststruct; - + if (debugSDNA > 0) { fflush(stdout); printf("Running makesdna at debug level %d\n", debugSDNA); } - + /* the longest known struct is 50k, so we assume 100k is sufficent! */ namedata = MEM_callocN(maxdata, "namedata"); typedata = MEM_callocN(maxdata, "typedata"); structdata = MEM_callocN(maxdata, "structdata"); - + /* a maximum of 5000 variables, must be sufficient? */ names = MEM_callocN(sizeof(char *) * maxnr, "names"); types = MEM_callocN(sizeof(char *) * maxnr, "types"); @@ -1034,12 +1034,12 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs /* the defines above shouldn't be output in the padding file... */ firststruct = nr_types; - + /* add all include files defined in the global array */ /* Since the internal file+path name buffer has limited length, I do a */ /* little test first... */ /* Mind the breaking condition here! */ - if (debugSDNA) printf("\tStart of header scan:\n"); + if (debugSDNA) printf("\tStart of header scan:\n"); for (i = 0; *(includefiles[i]) != '\0'; i++) { sprintf(str, "%s%s", baseDirectory, includefiles[i]); if (debugSDNA) printf("\t|-- Converting %s\n", str); @@ -1047,7 +1047,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs return (1); } } - if (debugSDNA) printf("\tFinished scanning %d headers.\n", i); + if (debugSDNA) printf("\tFinished scanning %d headers.\n", i); if (calculate_structlens(firststruct)) { /* error */ @@ -1065,13 +1065,13 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs printf(" %s\n", names[a]); } printf("\n"); - + sp = typelens_native; for (a = 0; a < nr_types; a++, sp++) { printf(" %s %d\n", types[a], *sp); } printf("\n"); - + for (a = 0; a < nr_structs; a++) { sp = structs[a]; printf(" struct %s elems: %d size: %d\n", types[sp[0]], sp[1], typelens_native[sp[0]]); @@ -1087,63 +1087,63 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs /* file writing */ if (debugSDNA > 0) printf("Writing file ... "); - + if (nr_names == 0 || nr_structs == 0) { /* pass */ } else { dna_write(file, "SDNA", 4); - + /* write names */ dna_write(file, "NAME", 4); len = nr_names; dna_write(file, &len, 4); - + /* calculate size of datablock with strings */ cp = names[nr_names - 1]; cp += strlen(names[nr_names - 1]) + 1; /* +1: null-terminator */ len = (intptr_t) (cp - (char *) names[0]); len = (len + 3) & ~3; dna_write(file, names[0], len); - + /* write TYPES */ dna_write(file, "TYPE", 4); len = nr_types; dna_write(file, &len, 4); - + /* calculate datablock size */ cp = types[nr_types - 1]; cp += strlen(types[nr_types - 1]) + 1; /* +1: null-terminator */ len = (intptr_t) (cp - (char *) types[0]); len = (len + 3) & ~3; - + dna_write(file, types[0], len); - + /* WRITE TYPELENGTHS */ dna_write(file, "TLEN", 4); - + len = 2 * nr_types; if (nr_types & 1) len += 2; dna_write(file, typelens_native, len); - + /* WRITE STRUCTS */ dna_write(file, "STRC", 4); len = nr_structs; dna_write(file, &len, 4); - + /* calc datablock size */ sp = structs[nr_structs - 1]; sp += 2 + 2 * (sp[1]); len = (intptr_t) ((char *) sp - (char *) structs[0]); len = (len + 3) & ~3; - + dna_write(file, structs[0], len); - + /* a simple dna padding test */ if (0) { FILE *fp; int a; - + fp = fopen("padding.c", "w"); if (fp == NULL) { /* pass */ @@ -1171,7 +1171,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs } /* end end padding test */ } - + /* write a simple enum with all structs offsets, * should only be accessed via SDNA_TYPE_FROM_STRUCT macro */ { @@ -1185,7 +1185,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs fprintf(file_offsets, "\tSDNA_TYPE_MAX = %d,\n", nr_structs); fprintf(file_offsets, "};\n"); } - + MEM_freeN(namedata); MEM_freeN(typedata); MEM_freeN(structdata); @@ -1197,7 +1197,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs MEM_freeN(structs); if (debugSDNA > 0) printf("done.\n"); - + return(0); } @@ -1265,7 +1265,7 @@ int main(int argc, char **argv) } } - + return(return_status); } @@ -1308,14 +1308,14 @@ int main(int argc, char **argv) #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" -#include "DNA_lattice_types.h" +#include "DNA_lattice_types.h" #include "DNA_object_types.h" #include "DNA_object_force_types.h" #include "DNA_object_fluidsim_types.h" #include "DNA_world_types.h" #include "DNA_scene_types.h" #include "DNA_view3d_types.h" -#include "DNA_view2d_types.h" +#include "DNA_view2d_types.h" #include "DNA_space_types.h" #include "DNA_userdef_types.h" #include "DNA_screen_types.h" diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 397a3263e22..84a7a7ddbe8 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -24,7 +24,7 @@ # # ***** END GPL LICENSE BLOCK ***** -set(INC +set(INC . intern ../blenkernel diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c index 8f99bc2bf39..40d568537a0 100644 --- a/source/blender/modifiers/intern/MOD_armature.c +++ b/source/blender/modifiers/intern/MOD_armature.c @@ -60,7 +60,7 @@ static void initData(ModifierData *md) { ArmatureModifierData *amd = (ArmatureModifierData *) md; - + amd->deformflag = ARM_DEF_VGROUP; } @@ -120,7 +120,7 @@ static void deformVerts( ArmatureModifierData *amd = (ArmatureModifierData *) md; modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */ - + armature_deform_verts(amd->object, ctx->object, mesh, vertexCos, NULL, numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name); diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 81a4e94386f..74cbbb65e80 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -31,7 +31,7 @@ /** \file blender/modifiers/intern/MOD_bevel.c * \ingroup modifiers */ - + #include "DNA_object_types.h" #include "DNA_mesh_types.h" diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 712b6254722..f7b16431c48 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -346,7 +346,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED( CustomDataMask dataMask = CD_MASK_MTFACE | CD_MASK_MEDGE; dataMask |= CD_MASK_MDEFORMVERT; - + return dataMask; } diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index eb32c77ca1e..9b491d4333f 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -116,7 +116,7 @@ static Mesh *applyModifier( MPoly *mpoly, *mp; MLoop *ml, *mloop; uintptr_t hash_num, hash_num_alt; - + if (bmd->flag & MOD_BUILD_FLAG_RANDOMIZE) { BLI_array_randomize(faceMap, sizeof(*faceMap), numPoly_src, bmd->seed); @@ -254,7 +254,7 @@ static Mesh *applyModifier( mpoly_dst = result->mpoly; ml_dst = result->mloop; - + /* copy the faces across, remapping indices */ k = 0; for (i = 0; i < numFaces_dst; i++) { @@ -279,7 +279,7 @@ static Mesh *applyModifier( BLI_ghash_free(vertHash, NULL, NULL); BLI_ghash_free(edgeHash, NULL, NULL); BLI_ghash_free(edgeHash2, NULL, NULL); - + MEM_freeN(vertMap); MEM_freeN(edgeMap); MEM_freeN(faceMap); diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c index 5b6ad9b8f29..4441af57c93 100644 --- a/source/blender/modifiers/intern/MOD_cast.c +++ b/source/blender/modifiers/intern/MOD_cast.c @@ -67,7 +67,7 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) { CastModifierData *cmd = (CastModifierData *) md; short flag; - + flag = cmd->flag & (MOD_CAST_X | MOD_CAST_Y | MOD_CAST_Z); if ((cmd->fac == 0.0f) || flag == 0) return true; @@ -125,7 +125,7 @@ static void sphere_do( flag = cmd->flag; type = cmd->type; /* projection type: sphere or cylinder */ - if (type == MOD_CAST_TYPE_CYLINDER) + if (type == MOD_CAST_TYPE_CYLINDER) flag &= ~MOD_CAST_Z; ctrl_ob = cmd->object; diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index 33d608aa868..19afe30acae 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -56,18 +56,18 @@ #include "MOD_util.h" -static void initData(ModifierData *md) +static void initData(ModifierData *md) { ClothModifierData *clmd = (ClothModifierData *) md; - + clmd->sim_parms = MEM_callocN(sizeof(ClothSimSettings), "cloth sim parms"); clmd->coll_parms = MEM_callocN(sizeof(ClothCollSettings), "cloth coll parms"); clmd->point_cache = BKE_ptcache_add(&clmd->ptcaches); - + /* check for alloc failing */ if (!clmd->sim_parms || !clmd->coll_parms || !clmd->point_cache) return; - + cloth_init(clmd); } @@ -78,7 +78,7 @@ static void deformVerts( { Mesh *mesh_src; ClothModifierData *clmd = (ClothModifierData *) md; - + /* check for alloc failing */ if (!clmd->sim_parms || !clmd->coll_parms) { initData(md); @@ -166,7 +166,7 @@ static void copyData(const ModifierData *md, ModifierData *target) if (tclmd->coll_parms) MEM_freeN(tclmd->coll_parms); - + BKE_ptcache_free_list(&tclmd->ptcaches); tclmd->point_cache = NULL; @@ -189,13 +189,13 @@ static bool dependsOnTime(ModifierData *UNUSED(md)) static void freeData(ModifierData *md) { ClothModifierData *clmd = (ClothModifierData *) md; - + if (clmd) { if (G.debug_value > 0) printf("clothModifier_freeData\n"); - + cloth_free_modifier_extern(clmd); - + if (clmd->sim_parms) { if (clmd->sim_parms->effector_weights) MEM_freeN(clmd->sim_parms->effector_weights); @@ -203,13 +203,13 @@ static void freeData(ModifierData *md) } if (clmd->coll_parms) MEM_freeN(clmd->coll_parms); - + BKE_ptcache_free_list(&clmd->ptcaches); clmd->point_cache = NULL; - + if (clmd->hairdata) MEM_freeN(clmd->hairdata); - + if (clmd->solver_result) MEM_freeN(clmd->solver_result); } diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c index 71022f8a4ab..7f02bbf0453 100644 --- a/source/blender/modifiers/intern/MOD_collision.c +++ b/source/blender/modifiers/intern/MOD_collision.c @@ -55,10 +55,10 @@ #include "DEG_depsgraph_query.h" -static void initData(ModifierData *md) +static void initData(ModifierData *md) { CollisionModifierData *collmd = (CollisionModifierData *) md; - + collmd->x = NULL; collmd->xnew = NULL; collmd->current_x = NULL; @@ -74,7 +74,7 @@ static void initData(ModifierData *md) static void freeData(ModifierData *md) { CollisionModifierData *collmd = (CollisionModifierData *) md; - + if (collmd) { /* Seriously? */ if (collmd->bvhtree) { BLI_bvhtree_free(collmd->bvhtree); @@ -111,7 +111,7 @@ static void deformVerts( Mesh *mesh_src; MVert *tempVert = NULL; Object *ob = ctx->object; - + if (mesh == NULL) { mesh_src = get_mesh(ob, NULL, NULL, NULL, false, false); } @@ -131,21 +131,21 @@ static void deformVerts( printf("CollisionModifier deformVerts: Should not happen!\n"); return; } - + if (mesh_src) { float current_time = 0; unsigned int mvert_num = 0; BKE_mesh_apply_vert_coords(mesh_src, vertexCos); BKE_mesh_calc_normals(mesh_src); - + current_time = DEG_get_ctime(ctx->depsgraph); - + if (G.debug_value > 0) printf("current_time %f, collmd->time_xnew %f\n", current_time, collmd->time_xnew); - + mvert_num = mesh_src->totvert; - + if (current_time > collmd->time_xnew) { unsigned int i; @@ -161,7 +161,7 @@ static void deformVerts( /* we save global positions */ mul_m4_v3(ob->obmat, collmd->x[i].co); } - + collmd->xnew = MEM_dupallocN(collmd->x); // frame end position collmd->current_x = MEM_dupallocN(collmd->x); // inter-frame collmd->current_xnew = MEM_dupallocN(collmd->x); // inter-frame @@ -218,9 +218,9 @@ static void deformVerts( collmd->tri, collmd->tri_num, ob->pd->pdef_sboft); } - + } - + /* happens on file load (ONLY when i decomment changes in readfile.c) */ if (!collmd->bvhtree) { collmd->bvhtree = bvhtree_build_from_mvert( @@ -243,7 +243,7 @@ static void deformVerts( else if (mvert_num != collmd->mvert_num) { freeData((ModifierData *)collmd); } - + } else if (current_time < collmd->time_xnew) { freeData((ModifierData *)collmd); @@ -254,7 +254,7 @@ static void deformVerts( } } } - + if (mesh_src != mesh) { BKE_id_free(NULL, mesh_src); } diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c index c7386f947ce..5ca367e342a 100644 --- a/source/blender/modifiers/intern/MOD_dynamicpaint.c +++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c @@ -47,10 +47,10 @@ #include "MOD_modifiertypes.h" -static void initData(ModifierData *md) +static void initData(ModifierData *md) { DynamicPaintModifierData *pmd = (DynamicPaintModifierData *) md; - + pmd->canvas = NULL; pmd->brush = NULL; pmd->type = MOD_DYNAMICPAINT_TYPE_CANVAS; @@ -60,7 +60,7 @@ static void copyData(const ModifierData *md, ModifierData *target) { const DynamicPaintModifierData *pmd = (const DynamicPaintModifierData *)md; DynamicPaintModifierData *tpmd = (DynamicPaintModifierData *)target; - + dynamicPaint_Modifier_copy(pmd, tpmd); } @@ -79,7 +79,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) DynamicPaintSurface *surface = pmd->canvas->surfaces.first; for (; surface; surface = surface->next) { /* tface */ - if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ || + if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ || surface->init_color_type == MOD_DPAINT_INITIAL_TEXTURE) { dataMask |= CD_MASK_MLOOPUV; diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 6688236a558..cbb15665bef 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -65,7 +65,7 @@ static void initData(ModifierData *md) static void freeData(ModifierData *md) { ExplodeModifierData *emd = (ExplodeModifierData *) md; - + MEM_SAFE_FREE(emd->facepa); } static void copyData(const ModifierData *md, ModifierData *target) @@ -192,7 +192,7 @@ static int edgecut_get(EdgeHash *edgehash, unsigned int v1, unsigned int v2) return GET_INT_FROM_POINTER(BLI_edgehash_lookup(edgehash, v1, v2)); } - + static const short add_faces[24] = { 0, 0, 0, 2, 0, 1, 2, 2, 0, 2, 1, @@ -634,7 +634,7 @@ static DerivedMesh *cutEdges(ExplodeModifierData *emd, DerivedMesh *dm) /* count new faces due to splitting */ for (i = 0, fs = facesplit; i < totface; i++, fs++) totfsplit += add_faces[*fs]; - + splitdm = CDDM_from_template_ex( dm, totesplit, 0, totface + totfsplit, 0, 0, CD_MASK_DERIVEDMESH | CD_MASK_FACECORNERS); @@ -844,7 +844,7 @@ static DerivedMesh *explodeMesh( * with BLI_edgehashIterator_getKey */ if (facepa[i] == totpart || cfra < (pars + facepa[i])->time) mindex = totvert + totpart; - else + else mindex = totvert + facepa[i]; mf = &mface[i]; @@ -935,12 +935,12 @@ static DerivedMesh *explodeMesh( dm->getTessFace(dm, i, &source); mf = CDDM_get_tessface(explode, u); - + orig_v4 = source.v4; if (facepa[i] != totpart && cfra < pa->time) mindex = totvert + totpart; - else + else mindex = totvert + facepa[i]; source.v1 = edgecut_get(vertpahash, source.v1, mindex); @@ -1021,7 +1021,7 @@ static DerivedMesh *applyModifier( { if (psmd->flag & eParticleSystemFlag_Pars) psmd->flag &= ~eParticleSystemFlag_Pars; - + if (emd->flag & eExplodeFlag_CalcFaces) emd->flag &= ~eExplodeFlag_CalcFaces; diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c index e13594e46d9..ffa74be0b33 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim.c +++ b/source/blender/modifiers/intern/MOD_fluidsim.c @@ -55,13 +55,13 @@ static void initData(ModifierData *md) { FluidsimModifierData *fluidmd = (FluidsimModifierData *) md; - + fluidsim_init(fluidmd); } static void freeData(ModifierData *md) { FluidsimModifierData *fluidmd = (FluidsimModifierData *) md; - + fluidsim_free(fluidmd); } @@ -69,7 +69,7 @@ static void copyData(const ModifierData *md, ModifierData *target) { const FluidsimModifierData *fluidmd = (const FluidsimModifierData *) md; FluidsimModifierData *tfluidmd = (FluidsimModifierData *) target; - + if (fluidmd->fss) { tfluidmd->fss = MEM_dupallocN(fluidmd->fss); if (tfluidmd->fss && (tfluidmd->fss->meshVelocities != NULL)) { @@ -91,11 +91,11 @@ static DerivedMesh *applyModifier( { FluidsimModifierData *fluidmd = (FluidsimModifierData *) md; DerivedMesh *result = NULL; - + /* check for alloc failing */ if (!fluidmd->fss) { initData(md); - + if (!fluidmd->fss) { return dm; } diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c index 4bcc14236a0..cea9e69526c 100644 --- a/source/blender/modifiers/intern/MOD_fluidsim_util.c +++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c @@ -72,10 +72,10 @@ void fluidsim_init(FluidsimModifierData *fluidmd) FluidsimSettings *fss = MEM_callocN(sizeof(FluidsimSettings), "fluidsimsettings"); fluidmd->fss = fss; - + if (!fss) return; - + fss->fmd = fluidmd; fss->type = OB_FLUIDSIM_ENABLE; fss->threads = 0; @@ -89,12 +89,12 @@ void fluidsim_init(FluidsimModifierData *fluidmd) fss->viscosityValue = 1.0; fss->viscosityExponent = 6; - + fss->grav[0] = 0.0; fss->grav[1] = 0.0; fss->grav[2] = -9.81; - fss->animStart = 0.0; + fss->animStart = 0.0; fss->animEnd = 4.0; fss->animRate = 1.0; fss->gstar = 0.005; // used as normgstar @@ -130,18 +130,18 @@ void fluidsim_init(FluidsimModifierData *fluidmd) fss->cpsTimeStart = fss->animStart; fss->cpsTimeEnd = fss->animEnd; fss->cpsQuality = 10.0; // 1.0 / 10.0 => means 0.1 width - + /* * BAD TODO: this is done in buttons_object.c in the moment * Mesh *mesh = ob->data; * // calculate bounding box * fluid_get_bb(mesh->mvert, mesh->totvert, ob->obmat, fss->bbStart, fss->bbSize); */ - + fss->meshVelocities = NULL; - + fss->lastgoodframe = -1; - + fss->flag |= OB_FLUIDSIM_ACTIVE; } @@ -163,7 +163,7 @@ void fluidsim_free(FluidsimModifierData *fluidmd) /* Seems to never be used, but for sqke of consistency... */ BLI_assert(fluidmd->point_cache == NULL); fluidmd->point_cache = NULL; - + return; } @@ -434,7 +434,7 @@ static DerivedMesh *fluidsim_read_cache( Object *ob, DerivedMesh *orgdm, FluidsimModifierData *fluidmd, int framenr, int useRenderParams) { - int curFrame = framenr /* - 1 */ /*scene->r.sfra*/; /* start with 0 at start frame */ + int curFrame = framenr /* - 1 */ /*scene->r.sfra*/; /* start with 0 at start frame */ /* why start with 0 as start frame?? Animations + time are frozen for frame 0 anyway. (See physics_fluid.c for that. - DG */ /* If we start with frame 0, we need to remap all animation channels, too, because they will all be 1 frame late if using frame-1! - DG */ @@ -530,7 +530,7 @@ DerivedMesh *fluidsimModifier_do( FluidsimSettings *fss = NULL; framenr = (int)DEG_get_ctime(depsgraph); - + /* only handle fluidsim domains */ if (fluidmd && fluidmd->fss && (fluidmd->fss->type != OB_FLUIDSIM_DOMAIN)) return dm; @@ -549,12 +549,12 @@ DerivedMesh *fluidsimModifier_do( framenr = fss->lastgoodframe - framenr + 1; CLAMP(framenr, 1, fss->lastgoodframe); } - + /* try to read from cache */ /* if the frame is there, fine, otherwise don't do anything */ if ((result = fluidsim_read_cache(ob, dm, fluidmd, framenr, useRenderParams))) return result; - + return dm; #else /* unused */ diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c index 05fb6bb43bc..76df31823a7 100644 --- a/source/blender/modifiers/intern/MOD_hook.c +++ b/source/blender/modifiers/intern/MOD_hook.c @@ -53,7 +53,7 @@ #include "MOD_util.h" -static void initData(ModifierData *md) +static void initData(ModifierData *md) { HookModifierData *hmd = (HookModifierData *) md; @@ -259,7 +259,7 @@ static void deformVerts_do( float dmat[4][4]; int i, *index_pt; struct HookData_cb hd; - + if (hmd->curfalloff == NULL) { /* should never happen, but bad lib linking could cause it */ hmd->curfalloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index 887e8f86200..fd833a2a322 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -115,17 +115,17 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes } /* Overview of Method: - * 1. Get the vertices that are in the vertexgroup of interest + * 1. Get the vertices that are in the vertexgroup of interest * 2. Filter out unwanted geometry (i.e. not in vertexgroup), by populating mappings with new vs old indices * 3. Make a new mesh containing only the mapping data */ - + /* get original number of verts, edges, and faces */ maxVerts = mesh->totvert; maxEdges = mesh->totedge; maxPolys = mesh->totpoly; - - /* check if we can just return the original mesh + + /* check if we can just return the original mesh * - must have verts and therefore verts assigned to vgroups to do anything useful */ if (!(ELEM(mmd->mode, MOD_MASK_MODE_ARM, MOD_MASK_MODE_VGROUP)) || @@ -133,7 +133,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes { return mesh; } - + /* if mode is to use selected armature bones, aggregate the bone groups */ if (mmd->mode == MOD_MASK_MODE_ARM) { /* --- using selected bones --- */ Object *oba = mmd->ob_arm; @@ -142,18 +142,18 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes bool *bone_select_array; int bone_select_tot = 0; const int defbase_tot = BLI_listbase_count(&ob->defbase); - + /* check that there is armature object with bones to use, otherwise return original mesh */ if (ELEM(NULL, oba, oba->pose, ob->defbase.first)) { return mesh; } - - /* determine whether each vertexgroup is associated with a selected bone or not + + /* determine whether each vertexgroup is associated with a selected bone or not * - each cell is a boolean saying whether bone corresponding to the ith group is selected * - groups that don't match a bone are treated as not existing (along with the corresponding ungrouped verts) */ bone_select_array = MEM_malloc_arrayN((size_t)defbase_tot, sizeof(char), "mask array"); - + for (i = 0, def = ob->defbase.first; def; def = def->next, i++) { pchan = BKE_pose_channel_find_name(oba->pose, def->name); if (pchan && pchan->bone && (pchan->bone->flag & BONE_SELECTED)) { @@ -169,8 +169,8 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes * key = oldindex, value = newindex */ vertHash = BLI_ghash_int_new_ex("mask vert gh", (unsigned int)maxVerts); - - /* add vertices which exist in vertexgroups into vertHash for filtering + + /* add vertices which exist in vertexgroups into vertHash for filtering * - dv = for each vertex, what vertexgroups does it belong to * - dw = weight that vertex was assigned to a vertexgroup it belongs to */ @@ -178,7 +178,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes MDeformWeight *dw = dv->dw; bool found = false; int j; - + /* check the groups that vertex is assigned to, and see if it was any use */ for (j = 0; j < dv->totweight; j++, dw++) { if (dw->def_nr < defbase_tot) { @@ -190,16 +190,16 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes } } } - + if (found_test != found) { continue; } - + /* add to ghash for verts (numVerts acts as counter for mapping) */ BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(i), SET_INT_IN_POINTER(numVerts)); numVerts++; } - + /* free temp hashes */ MEM_freeN(bone_select_array); } @@ -210,10 +210,10 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes if (defgrp_index == -1) { return mesh; } - + /* hashes for quickly providing a mapping from old to new - use key=oldindex, value=newindex */ vertHash = BLI_ghash_int_new_ex("mask vert2 bh", (unsigned int)maxVerts); - + /* add vertices which exist in vertexgroup into ghash for filtering */ for (i = 0, dv = dvert; i < maxVerts; i++, dv++) { const bool found = defvert_find_weight(dv, defgrp_index) != 0.0f; @@ -239,12 +239,12 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes /* overalloc, assume all polys are seen */ loop_mapping = MEM_malloc_arrayN((size_t)maxPolys, sizeof(int), "mask loopmap"); - /* loop over edges and faces, and do the same thing to - * ensure that they only reference existing verts + /* loop over edges and faces, and do the same thing to + * ensure that they only reference existing verts */ for (i = 0; i < maxEdges; i++) { const MEdge *me = &medge_src[i]; - + /* only add if both verts will be in new mesh */ if (BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v1)) && BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v2))) @@ -258,14 +258,14 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes const MLoop *ml_src = &mloop_src[mp_src->loopstart]; bool ok = true; int j; - + for (j = 0; j < mp_src->totloop; j++, ml_src++) { if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(ml_src->v))) { ok = false; break; } } - + /* all verts must be available */ if (ok) { BLI_ghash_insert(polyHash, SET_INT_IN_POINTER(i), SET_INT_IN_POINTER(numPolys)); @@ -274,13 +274,13 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes numLoops += mp_src->totloop; } } - - - /* now we know the number of verts, edges and faces, + + + /* now we know the number of verts, edges and faces, * we can create the new (reduced) mesh */ result = BKE_mesh_new_nomain_from_template(mesh, numVerts, numEdges, 0, numLoops, numPolys); - + mpoly_dst = result->mpoly; mloop_dst = result->mloop; medge_dst = result->medge; @@ -293,21 +293,21 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes MVert *v_dst; const int i_src = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter)); const int i_dst = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter)); - + v_src = &mvert_src[i_src]; v_dst = &mvert_dst[i_dst]; *v_dst = *v_src; CustomData_copy_data(&mesh->vdata, &result->vdata, i_src, i_dst, 1); } - + /* edges */ GHASH_ITER (gh_iter, edgeHash) { const MEdge *e_src; MEdge *e_dst; const int i_src = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter)); const int i_dst = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(&gh_iter)); - + e_src = &medge_src[i_src]; e_dst = &medge_dst[i_dst]; @@ -316,7 +316,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes e_dst->v1 = GET_UINT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_UINT_IN_POINTER(e_src->v1))); e_dst->v2 = GET_UINT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_UINT_IN_POINTER(e_src->v2))); } - + /* faces */ GHASH_ITER (gh_iter, polyHash) { const int i_src = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&gh_iter)); @@ -327,7 +327,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes const int i_ml_dst = loop_mapping[i_dst]; const MLoop *ml_src = &mloop_src[i_ml_src]; MLoop *ml_dst = &mloop_dst[i_ml_dst]; - + CustomData_copy_data(&mesh->pdata, &result->pdata, i_src, i_dst, 1); CustomData_copy_data(&mesh->ldata, &result->ldata, i_ml_src, i_ml_dst, mp_src->totloop); @@ -344,7 +344,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes /* why is this needed? - campbell */ /* recalculate normals */ result->runtime.cd_dirty_vert |= CD_MASK_NORMAL; - + /* free hashes */ BLI_ghash_free(vertHash, NULL, NULL); BLI_ghash_free(edgeHash, NULL, NULL); diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index 4fe8942a194..b50672e4160 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -98,7 +98,7 @@ static void copyData(const ModifierData *md, ModifierData *target) } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md) -{ +{ MeshDeformModifierData *mmd = (MeshDeformModifierData *)md; CustomDataMask dataMask = 0; @@ -305,7 +305,7 @@ static void meshdeformModifier_do( * We'll support this case once granular dependency graph is landed. */ cagemesh = BKE_modifier_get_evaluated_mesh_from_evaluated_object(mmd->object, &free_cagemesh); - + if (cagemesh == NULL) { modifier_setError(md, "Cannot get mesh from cage object"); return; @@ -444,7 +444,7 @@ void modifier_mdef_compact_influences(ModifierData *md) weights = mmd->bindweights; if (!weights) return; - + totvert = mmd->totvert; totcagevert = mmd->totcagevert; @@ -490,7 +490,7 @@ void modifier_mdef_compact_influences(ModifierData *md) } mmd->bindoffsets[b] = totinfluence; - + /* free */ MEM_freeN(mmd->bindweights); mmd->bindweights = NULL; diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index 892092f844b..4b16f165a12 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -189,7 +189,7 @@ static Mesh *doMirrorOnAxis( vtmap_b++; } } - + /* handle shape keys */ totshape = CustomData_number_of_layers(&result->vdata, CD_SHAPEKEY); for (a = 0; a < totshape; a++) { @@ -198,14 +198,14 @@ static Mesh *doMirrorOnAxis( mul_m4_v3(mtx, cos[i]); } } - + /* adjust mirrored edge vertex indices */ me = result->medge + maxEdges; for (i = 0; i < maxEdges; i++, me++) { me->v1 += maxVerts; me->v2 += maxVerts; } - + /* adjust mirrored poly loopstart indices, and reverse loop order (normals) */ mp = result->mpoly + maxPolys; ml = result->mloop; @@ -229,7 +229,7 @@ static Mesh *doMirrorOnAxis( ml2[j].e = ml2[j + 1].e; } ml2[mp->totloop - 1].e = e; - + mp->loopstart += maxLoops; } @@ -267,7 +267,7 @@ static Mesh *doMirrorOnAxis( int *flip_map = NULL, flip_map_len = 0; flip_map = defgroup_flip_map(ob, &flip_map_len, false); - + if (flip_map) { for (i = 0; i < maxVerts; dvert++, i++) { /* merged vertices get both groups, others get flipped */ diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index c263c2e3f5d..a23511ff87a 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -93,17 +93,17 @@ static DerivedMesh *applyModifier( if (useRenderParams || !(ctx->flag & MOD_APPLY_USECACHE)) { DerivedMesh *cddm; - + cddm = CDDM_copy(result); /* copy hidden/masks to vertices */ if (!useRenderParams) { struct MDisps *mdisps; struct GridPaintMask *grid_paint_mask; - + mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS); grid_paint_mask = CustomData_get_layer(&me->ldata, CD_GRID_PAINT_MASK); - + if (mdisps) { subsurf_copy_grid_hidden(result, me->mpoly, cddm->getVertArray(cddm), diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c index 72bdcc779ea..cbdeeebaa04 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.c +++ b/source/blender/modifiers/intern/MOD_particlesystem.c @@ -51,7 +51,7 @@ #include "MOD_util.h" -static void initData(ModifierData *md) +static void initData(ModifierData *md) { ParticleSystemModifierData *psmd = (ParticleSystemModifierData *) md; psmd->psys = NULL; @@ -115,7 +115,7 @@ static void deformVerts( psys = psmd->psys; else return; - + if (!psys_check_enabled(ctx->object, psys, (ctx->flag & MOD_APPLY_RENDER) != 0)) return; diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c index df607c04164..edf59f6b6b2 100644 --- a/source/blender/modifiers/intern/MOD_remesh.c +++ b/source/blender/modifiers/intern/MOD_remesh.c @@ -99,7 +99,7 @@ static void *dualcon_alloc_output(int totvert, int totquad) { return NULL; } - + output->mesh = BKE_mesh_new_nomain(totvert, 0, 0, 4 * totquad, totquad); return output; } @@ -108,9 +108,9 @@ static void dualcon_add_vert(void *output_v, const float co[3]) { DualConOutput *output = output_v; Mesh *mesh = output->mesh; - + assert(output->curvert < mesh->totvert); - + copy_v3_v3(mesh->mvert[output->curvert].co, co); output->curvert++; } @@ -122,17 +122,17 @@ static void dualcon_add_quad(void *output_v, const int vert_indices[4]) MLoop *mloop; MPoly *cur_poly; int i; - + assert(output->curface < mesh->totpoly); mloop = mesh->mloop; cur_poly = &mesh->mpoly[output->curface]; - + cur_poly->loopstart = output->curface * 4; cur_poly->totloop = 4; for (i = 0; i < 4; i++) mloop[output->curface * 4 + i].v = vert_indices[i]; - + output->curface++; } @@ -166,7 +166,7 @@ static Mesh *applyModifier( mode = DUALCON_SHARP_FEATURES; break; } - + output = dualcon(&input, dualcon_alloc_output, dualcon_add_vert, @@ -183,7 +183,7 @@ static Mesh *applyModifier( if (rmd->flag & MOD_REMESH_SMOOTH_SHADING) { MPoly *mpoly = result->mpoly; int i, totpoly = result->totpoly; - + /* Apply smooth shading to output faces */ for (i = 0; i < totpoly; i++) { mpoly[i].flag |= ME_SMOOTH; diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index 32b0894e946..96335707082 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -90,7 +90,7 @@ static void screwvert_iter_init(ScrewVertIter *iter, ScrewVertConnect *array, un iter->v_poin = NULL; iter->e = NULL; } -} +} static void screwvert_iter_step(ScrewVertIter *iter) @@ -185,7 +185,7 @@ static Mesh *applyModifier( Mesh *result; ScrewModifierData *ltmd = (ScrewModifierData *) md; const bool use_render_params = (ctx->flag & MOD_APPLY_RENDER) != 0; - + int *origindex; int mpoly_index = 0; unsigned int step; @@ -228,18 +228,18 @@ static Mesh *applyModifier( float angle = ltmd->angle; float screw_ofs = ltmd->screw_ofs; float axis_vec[3] = {0.0f, 0.0f, 0.0f}; - float tmp_vec1[3], tmp_vec2[3]; + float tmp_vec1[3], tmp_vec2[3]; float mat3[3][3]; float mtx_tx[4][4]; /* transform the coords by an object relative to this objects transformation */ float mtx_tx_inv[4][4]; /* inverted */ float mtx_tmp_a[4][4]; - + unsigned int vc_tot_linked = 0; short other_axis_1, other_axis_2; const float *tmpf1, *tmpf2; unsigned int edge_offset; - + MPoly *mpoly_orig, *mpoly_new, *mp_new; MLoop *mloop_orig, *mloop_new, *ml_new; MEdge *medge_orig, *med_orig, *med_new, *med_new_firstloop, *medge_new; @@ -354,7 +354,7 @@ static Mesh *applyModifier( close = 1; step_tot--; if (step_tot < 3) step_tot = 3; - + maxVerts = totvert * step_tot; /* -1 because we're joining back up */ maxEdges = (totvert * step_tot) + /* these are the edges between new verts */ (totedge * step_tot); /* -1 because vert edges join */ @@ -375,9 +375,9 @@ static Mesh *applyModifier( if ((ltmd->flag & MOD_SCREW_UV_STRETCH_U) == 0) { uv_u_scale = (uv_u_scale / (float)ltmd->iter) * (angle / ((float)M_PI * 2.0f)); } - + result = BKE_mesh_new_nomain_from_template(mesh, (int)maxVerts, (int)maxEdges, 0, (int)maxPolys * 4, (int)maxPolys); - + /* copy verts from mesh */ mvert_orig = mesh->mvert; medge_orig = mesh->medge; @@ -421,10 +421,10 @@ static Mesh *applyModifier( } /* Set the locations of the first set of verts */ - + mv_new = mvert_new; mv_orig = mvert_orig; - + /* Copy the first set of edges */ med_orig = medge_orig; med_new = medge_new; @@ -434,7 +434,7 @@ static Mesh *applyModifier( med_new->crease = med_orig->crease; med_new->flag = med_orig->flag & ~ME_LOOSEEDGE; } - + /* build polygon -> edge map */ if (totpoly) { MPoly *mp_orig; @@ -829,7 +829,7 @@ static Mesh *applyModifier( } } /* done with edge connectivity based normal flipping */ - + /* Add Faces */ for (step = 1; step < step_tot; step++) { const unsigned int varray_stride = totvert * step; @@ -855,7 +855,7 @@ static Mesh *applyModifier( mv_new_base = mvert_new; mv_new = &mvert_new[varray_stride]; /* advance to the next slice */ - + for (j = 0; j < totvert; j++, mv_new_base++, mv_new++) { /* set normal */ if (vert_connect) { @@ -864,13 +864,13 @@ static Mesh *applyModifier( /* set the normal now its transformed */ normal_float_to_short_v3(mv_new->no, nor_tx); } - + /* set location */ copy_v3_v3(mv_new->co, mv_new_base->co); - + /* only need to set these if using non cleared memory */ /*mv_new->mat_nr = mv_new->flag = 0;*/ - + if (ltmd->ob_axis) { sub_v3_v3(mv_new->co, mtx_tx[3]); @@ -881,7 +881,7 @@ static Mesh *applyModifier( else { mul_m4_v3(mat, mv_new->co); } - + /* add the new edge */ med_new->v1 = varray_stride + j; med_new->v2 = med_new->v1 - totvert; @@ -907,11 +907,11 @@ static Mesh *applyModifier( med_new++; } } - + mp_new = mpoly_new; ml_new = mloop_new; med_new_firstloop = medge_new; - + /* more of an offset in this case */ edge_offset = totedge + (totvert * (step_tot - (close ? 0 : 1))); @@ -1049,7 +1049,7 @@ static Mesh *applyModifier( ml_new += 4; mpoly_index++; } - + /* new vertical edge */ med_new->v1 = i1; med_new->v2 = i2; diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index 29f5815c733..da31de911e4 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -153,7 +153,7 @@ static bool dependsOnNormals(ModifierData *md) if (smd->target && smd->shrinkType == MOD_SHRINKWRAP_PROJECT) return (smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL); - + return false; } diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c index 26fd16ef167..323994e6738 100644 --- a/source/blender/modifiers/intern/MOD_skin.c +++ b/source/blender/modifiers/intern/MOD_skin.c @@ -268,7 +268,7 @@ static bool build_hull(SkinOutput *so, Frame **frames, int totframe) BMO_ITER (v, &oiter, op.slots_out, "geom_interior.out", BM_VERT) { for (i = 0; i < totframe; i++) { Frame *frame = frames[i]; - + if (!frame->detached) { for (j = 0; j < 4; j++) { if (frame->verts[j] == v) { @@ -294,7 +294,7 @@ static bool build_hull(SkinOutput *so, Frame **frames, int totframe) frame->detached = true; } } - + /* Remove triangles that would fill the original frames -- skip if * frame is partially detached */ BM_mesh_elem_hflag_disable_all(bm, BM_ALL_NOLOOP, BM_ELEM_TAG, false); @@ -449,7 +449,7 @@ static void node_frames_init(SkinNode *nf, int totframe) nf->totframe = totframe; memset(nf->frames, 0, sizeof(nf->frames)); - + nf->flag = 0; for (i = 0; i < 2; i++) nf->seam_edges[i] = -1; @@ -465,7 +465,7 @@ static void create_frame( mul_v3_v3fl(ry, mat[1], radius[0]); mul_v3_v3fl(rz, mat[2], radius[1]); - + add_v3_v3v3(frame->co[3], co, ry); add_v3_v3v3(frame->co[3], frame->co[3], rz); @@ -680,7 +680,7 @@ static void build_emats_stack( /* Mark edge as visited */ BLI_BITMAP_ENABLE(visited_e, e); - + /* Process edge */ parent_is_branch = ((emap[parent_v].count > 2) || @@ -938,14 +938,14 @@ static Mesh *subdivide_base(Mesh *orig) /* Interpolate vertex group weights */ for (k = 0; k < totvgroup; k++) { float weight; - + vg = &vgroups[k]; weight = interpf(vg->w2, vg->w1, t); if (weight > 0) defvert_add_index_notest(&outdvert[v], vg->def_nr, weight); } - + outedge->v1 = u; outedge->v2 = v; u = v; @@ -953,7 +953,7 @@ static Mesh *subdivide_base(Mesh *orig) if (vgroups) MEM_freeN(vgroups); - + /* Link up to final vertex */ outedge->v1 = u; outedge->v2 = e->v2; @@ -977,7 +977,7 @@ static void add_poly( { BMVert *verts[4] = {v1, v2, v3, v4}; BMFace *f; - + BLI_assert(v1 != v2 && v1 != v3 && v1 != v4); BLI_assert(v2 != v3 && v2 != v4); BLI_assert(v3 != v4); @@ -1064,7 +1064,7 @@ static void output_frames( dv = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_MDEFORMVERT); - + BLI_assert(dv->totweight == 0); defvert_copy(dv, input_dvert); } @@ -1094,14 +1094,14 @@ static int isect_ray_poly(const float ray_start[3], BMIter iter; float best_dist = FLT_MAX; bool hit = false; - + BM_ITER_ELEM (v, &iter, f, BM_VERTS_OF_FACE) { if (!v_first) v_first = v; else if (v_prev != v_first) { float dist; bool curhit; - + curhit = isect_ray_tri_v3(ray_start, ray_dir, v_first->co, v_prev->co, v->co, &dist, NULL); @@ -1162,7 +1162,7 @@ static BMFace *collapse_face_corners(BMesh *bm, BMFace *f, int n, f = NULL; BM_ITER_ELEM (vf, &iter, v_safe, BM_FACES_OF_VERT) { bool wrong_face = false; - + for (i = 0; i < orig_len; i++) { if (orig_verts[i] == v_merge) { orig_verts[i] = NULL; @@ -1260,7 +1260,7 @@ static void skin_choose_quad_bridge_order(BMVert *a[4], BMVert *b[4], shortest_len = FLT_MAX; for (i = 0; i < 8; i++) { float len = 0; - + /* Get total edge length for this configuration */ for (j = 0; j < 4; j++) len += len_squared_v3v3(a[j]->co, b[orders[i][j]]->co); @@ -1308,7 +1308,7 @@ static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_f /* Need at least four ring edges, so subdivide longest edge if * face is a triangle */ longest_edge = BM_face_find_longest_loop(split_face)->e; - + BM_mesh_elem_hflag_disable_all(bm, BM_EDGE, BM_ELEM_TAG, false); BM_elem_flag_enable(longest_edge, BM_ELEM_TAG); @@ -1514,7 +1514,7 @@ static void skin_merge_close_frame_verts(SkinNode *skin_nodes, int totvert, { Frame **hull_frames; int v, tothullframe; - + for (v = 0; v < totvert; v++) { /* Only check branch nodes */ if (!skin_nodes[v].totframe) { @@ -1530,11 +1530,11 @@ static void skin_merge_close_frame_verts(SkinNode *skin_nodes, int totvert, static void skin_update_merged_vertices(SkinNode *skin_nodes, int totvert) { int v; - + for (v = 0; v < totvert; ++v) { SkinNode *sn = &skin_nodes[v]; int i, j; - + for (i = 0; i < sn->totframe; i++) { Frame *f = &sn->frames[i]; @@ -1554,19 +1554,19 @@ static void skin_fix_hull_topology(BMesh *bm, SkinNode *skin_nodes, int totvert) { int v; - + for (v = 0; v < totvert; v++) { SkinNode *sn = &skin_nodes[v]; int j; - + for (j = 0; j < sn->totframe; j++) { Frame *f = &sn->frames[j]; if (f->detached) { BMFace *target_face; - + skin_hole_detach_partially_attached_frame(bm, f); - + target_face = skin_hole_target_face(bm, f); if (target_face) skin_fix_hole_no_good_verts(bm, f, target_face); @@ -1579,14 +1579,14 @@ static void skin_output_end_nodes(SkinOutput *so, SkinNode *skin_nodes, int totvert) { int v; - + for (v = 0; v < totvert; ++v) { SkinNode *sn = &skin_nodes[v]; /* Assuming here just two frames */ if (sn->flag & SEAM_FRAME) { BMVert *v_order[4]; int i, order[4]; - + skin_choose_quad_bridge_order(sn->frames[0].verts, sn->frames[1].verts, order); @@ -1631,7 +1631,7 @@ static void skin_output_connections(SkinOutput *so, SkinNode *skin_nodes, int totedge) { int e; - + for (e = 0; e < totedge; e++) { SkinNode *a, *b; a = &skin_nodes[medge[e].v1]; @@ -1647,7 +1647,7 @@ static void skin_output_connections(SkinOutput *so, SkinNode *skin_nodes, fr[0]++; if ((b->flag & SEAM_FRAME) && (e != b->seam_edges[0])) fr[1]++; - + skin_choose_quad_bridge_order(fr[0]->verts, fr[1]->verts, order); for (i = 0; i < 4; i++) v_order[i] = fr[1]->verts[order[i]]; @@ -1730,15 +1730,15 @@ static bool skin_output_branch_hulls(SkinOutput *so, SkinNode *skin_nodes, { bool result = true; int v; - + for (v = 0; v < totvert; v++) { SkinNode *sn = &skin_nodes[v]; - + /* Branch node hulls */ if (!sn->totframe) { Frame **hull_frames; int tothullframe; - + hull_frames = collect_hull_frames(v, skin_nodes, emap, medge, &tothullframe); @@ -1766,7 +1766,7 @@ static BMesh *build_skin(SkinNode *skin_nodes, &bm_mesh_allocsize_default, &((struct BMeshCreateParams){.use_toolflags = true,})); so.mat_nr = 0; - + /* BMESH_TODO: bumping up the stack level (see MOD_array.c) */ BM_mesh_elem_toolflags_ensure(so.bm); BMO_push(so.bm, NULL); @@ -1911,7 +1911,7 @@ static Mesh *final_skin(SkinModifierData *smd, Mesh *mesh) static void initData(ModifierData *md) { SkinModifierData *smd = (SkinModifierData *) md; - + /* Enable in editmode by default */ md->mode |= eModifierMode_Editmode; diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c index 44b013c2bb5..4c10df71f92 100644 --- a/source/blender/modifiers/intern/MOD_smoke.c +++ b/source/blender/modifiers/intern/MOD_smoke.c @@ -58,10 +58,10 @@ #include "MOD_modifiertypes.h" -static void initData(ModifierData *md) +static void initData(ModifierData *md) { SmokeModifierData *smd = (SmokeModifierData *) md; - + smd->domain = NULL; smd->flow = NULL; smd->coll = NULL; @@ -73,14 +73,14 @@ static void copyData(const ModifierData *md, ModifierData *target) { const SmokeModifierData *smd = (const SmokeModifierData *)md; SmokeModifierData *tsmd = (SmokeModifierData *)target; - + smokeModifier_copy(smd, tsmd); } static void freeData(ModifierData *md) { SmokeModifierData *smd = (SmokeModifierData *) md; - + smokeModifier_free(smd); } diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c index a8a1692b158..e44ead73ced 100644 --- a/source/blender/modifiers/intern/MOD_smooth.c +++ b/source/blender/modifiers/intern/MOD_smooth.c @@ -167,7 +167,7 @@ static void smoothModifier_do( /* fp is the sum of uctmp[i] verts, so must be averaged */ facw = 0.0f; - if (uctmp[i]) + if (uctmp[i]) facw = f / (float)uctmp[i]; if (flag & MOD_SMOOTH_X) @@ -188,7 +188,7 @@ static void smoothModifier_do( /* fp is the sum of uctmp[i] verts, so must be averaged */ facw = 0.0f; - if (uctmp[i]) + if (uctmp[i]) facw = fac / (float)uctmp[i]; if (flag & MOD_SMOOTH_X) diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c index 46fd3198699..d6e78c6f19b 100644 --- a/source/blender/modifiers/intern/MOD_surface.c +++ b/source/blender/modifiers/intern/MOD_surface.c @@ -54,10 +54,10 @@ #include "MEM_guardedalloc.h" -static void initData(ModifierData *md) +static void initData(ModifierData *md) { SurfaceModifierData *surmd = (SurfaceModifierData *) md; - + surmd->bvhtree = NULL; } @@ -77,7 +77,7 @@ static void freeData(ModifierData *md) } MEM_SAFE_FREE(surmd->x); - + MEM_SAFE_FREE(surmd->v); } } @@ -95,7 +95,7 @@ static void deformVerts( { SurfaceModifierData *surmd = (SurfaceModifierData *) md; const int cfra = (int)DEG_get_ctime(ctx->depsgraph); - + if (surmd->mesh) { BKE_id_free(NULL, surmd->mesh); } @@ -112,7 +112,7 @@ static void deformVerts( false); } else surmd->mesh = get_mesh(ctx->object, NULL, NULL, NULL, false, false); - + if (!ctx->object->pd) { printf("SurfaceModifier deformVerts: Should not happen!\n"); return; @@ -126,7 +126,7 @@ static void deformVerts( BKE_mesh_apply_vert_coords(surmd->mesh, vertexCos); BKE_mesh_calc_normals(surmd->mesh); - + numverts = surmd->mesh->totvert; if (numverts != surmd->numverts || @@ -160,7 +160,7 @@ static void deformVerts( v->co[0] = v->co[1] = v->co[2] = 0.0f; else sub_v3_v3v3(v->co, vec, x->co); - + copy_v3_v3(x->co, vec); } diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 7a586cd6b2e..29a3745a7e1 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -276,7 +276,7 @@ DerivedMesh *get_dm( CDDM_apply_vert_coords(dm, vertexCos); dm->dirty |= DM_DIRTY_NORMALS; } - + if (use_orco) { DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, BKE_mesh_orco_verts_get(ob)); } diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 394255ddb18..9a06d397be6 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -216,7 +216,7 @@ static Mesh *uvprojectModifier_do( /* convert coords to world space */ for (i = 0, co = coords; i < numVerts; ++i, ++co) mul_m4_v3(ob->obmat, *co); - + /* if only one projector, project coords to UVs */ if (num_projectors == 1 && projectors[0].uci == NULL) for (i = 0, co = coords; i < numVerts; ++i, ++co) diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 070d4ad80e6..1a69ae13120 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -230,7 +230,7 @@ static void get_vert2ob_distance( */ static float get_ob2ob_distance(const Object *ob, const Object *obr) { - return len_v3v3(ob->obmat[3], obr->obmat[3]); + return len_v3v3(ob->obmat[3], obr->obmat[3]); } /** diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 367180407ba..b98b917815b 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -335,7 +335,7 @@ install( if(WITH_PYTHON) # install(CODE "message(\"copying blender scripts...\")") - + # exclude addons_contrib if release if("${BLENDER_VERSION_CYCLE}" STREQUAL "release" OR "${BLENDER_VERSION_CYCLE}" STREQUAL "rc") @@ -361,7 +361,7 @@ if(WITH_PYTHON) PATTERN "${ADDON_EXCLUDE_CONDITIONAL}" EXCLUDE PATTERN "${FREESTYLE_EXCLUDE_CONDITIONAL}" EXCLUDE ) - + unset(ADDON_EXCLUDE_CONDITIONAL) unset(FREESTYLE_EXCLUDE_CONDITIONAL) endif() @@ -648,7 +648,7 @@ if(UNIX AND NOT APPLE) unset(_suffix) endif() unset(_target_LIB) - + endif() endif() elseif(WIN32) @@ -812,7 +812,7 @@ elseif(WIN32) DESTINATION "." ) endif() - + if(WITH_SYSTEM_AUDASPACE) install( FILES @@ -829,7 +829,7 @@ elseif(WIN32) DESTINATION "." ) endif() - + install( # x86 builds can run on x64 Windows, so this is required at all times FILES ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll DESTINATION "." diff --git a/source/creator/creator.c b/source/creator/creator.c index c2fd990f451..bda97fba863 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -333,7 +333,7 @@ int main( #endif main_callback_setup(); - + #if defined(__APPLE__) && !defined(WITH_PYTHON_MODULE) /* patch to ignore argument finder gives us (pid?) */ if (argc == 2 && STREQLEN(argv[1], "-psn_", 5)) { @@ -348,7 +348,7 @@ int main( } } #endif - + #ifdef __FreeBSD__ fpsetmask(0); #endif @@ -370,7 +370,7 @@ int main( BKE_brush_system_init(); RE_texture_rng_init(); - + BLI_callback_global_init(); @@ -418,7 +418,7 @@ int main( /* Initialize ffmpeg if built in, also needed for bg mode if videos are * rendered via ffmpeg */ BKE_sound_init_once(); - + init_def_material(); if (G.background == 0) { @@ -454,7 +454,7 @@ int main( #else printf("\n* WARNING * - Blender compiled without Python!\nthis is not intended for typical usage\n\n"); #endif - + CTX_py_init_set(C, 1); WM_keymap_init(C); @@ -472,7 +472,7 @@ int main( /* OK we are ready for it */ #ifndef WITH_PYTHON_MODULE main_args_setup_post(C, ba); - + if (G.background == 0) { if (!G.file_loaded) if (U.uiflag2 & USER_KEEP_SESSION) diff --git a/source/tools b/source/tools -Subproject ca3e38d89666c422d6681bb06967a59ef1a4a7d +Subproject 87f7038ee8c4b46a5e73a1a9065e2a9b7367f59 |