Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Mueller <nexyon@gmail.com>2010-08-13 14:50:29 +0400
committerJoerg Mueller <nexyon@gmail.com>2010-08-13 14:50:29 +0400
commit47d38dbd207bc5dcc5d0965fcf36ea37c366ba35 (patch)
tree38ffad02c03ea80f3e22e8ef1108f54cc9a20d16 /source/blender/blenkernel
parentfd2a9a0ed07ee82a5409f09b864d8b0a900035aa (diff)
parent9ce2086506dcf16ecc0d5dce7851439ae8818e78 (diff)
svn merge -r 31211:31313 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_idcode.h75
-rw-r--r--source/blender/blenkernel/Makefile2
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c11
-rw-r--r--source/blender/blenkernel/intern/Makefile2
-rw-r--r--source/blender/blenkernel/intern/curve.c4
-rw-r--r--source/blender/blenkernel/intern/idcode.c128
-rw-r--r--source/blender/blenkernel/intern/idprop.c53
-rw-r--r--source/blender/blenkernel/intern/key.c7
-rw-r--r--source/blender/blenkernel/intern/nla.c4
-rw-r--r--source/blender/blenkernel/intern/node.c5
-rw-r--r--source/blender/blenkernel/intern/object.c2
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c4
12 files changed, 250 insertions, 47 deletions
diff --git a/source/blender/blenkernel/BKE_idcode.h b/source/blender/blenkernel/BKE_idcode.h
new file mode 100644
index 00000000000..b624e34e1cb
--- /dev/null
+++ b/source/blender/blenkernel/BKE_idcode.h
@@ -0,0 +1,75 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef BKE_ID_INFO_H
+#define BKE_ID_INFO_H
+
+/**
+ * Convert an idcode into a name.
+ *
+ * @param code The code to convert.
+ * @return A static string representing the name of
+ * the code.
+ */
+const char *BKE_idcode_to_name(int code);
+
+/**
+ * Convert an idcode into a name (plural).
+ *
+ * @param code The code to convert.
+ * @return A static string representing the name of
+ * the code.
+ */
+const char *BKE_idcode_to_name_plural(int code);
+
+/**
+ * Convert a name into an idcode (ie. ID_SCE)
+ *
+ * @param name The name to convert.
+ * @return The code for the name, or 0 if invalid.
+ */
+int BKE_idcode_from_name(const char *name);
+
+/**
+ * Return non-zero when an ID type is linkable.
+ *
+ * @param code The code to check.
+ * @return Boolean, 0 when non linkable.
+ */
+int BKE_idcode_is_linkable(int code);
+
+/**
+ * Return if the ID code is a valid ID code.
+ *
+ * @param code The code to check.
+ * @return Boolean, 0 when invalid.
+ */
+int BKE_idcode_is_valid(int code);
+
+#endif
diff --git a/source/blender/blenkernel/Makefile b/source/blender/blenkernel/Makefile
index f0476bbf026..dc5f0a91da6 100644
--- a/source/blender/blenkernel/Makefile
+++ b/source/blender/blenkernel/Makefile
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 8b1443403a3..663fbb89b4e 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1189,10 +1189,15 @@ static void emDM_getFace(DerivedMesh *dm, int index, MFace *face_r)
static void emDM_copyVertArray(DerivedMesh *dm, MVert *vert_r)
{
- EditVert *ev = ((EditMeshDerivedMesh *)dm)->em->verts.first;
+ EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
+ EditVert *ev = emdm->em->verts.first;
+ int i;
- for( ; ev; ev = ev->next, ++vert_r) {
- VECCOPY(vert_r->co, ev->co);
+ for(i=0; ev; ev = ev->next, ++vert_r, ++i) {
+ if(emdm->vertexCos)
+ copy_v3_v3(vert_r->co, emdm->vertexCos[i]);
+ else
+ copy_v3_v3(vert_r->co, ev->co);
vert_r->no[0] = ev->no[0] * 32767.0;
vert_r->no[1] = ev->no[1] * 32767.0;
diff --git a/source/blender/blenkernel/intern/Makefile b/source/blender/blenkernel/intern/Makefile
index eb14914c7ba..53a9999758c 100644
--- a/source/blender/blenkernel/intern/Makefile
+++ b/source/blender/blenkernel/intern/Makefile
@@ -15,7 +15,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
# All rights reserved.
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 841bd635acf..358dd1914e7 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -1573,7 +1573,7 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
for(a=0; a<resolu; a++, fac+= dfac) {
if (tilt_array) {
- if (nu->tilt_interp==3) { /* May as well support for tilt also 2.47 ease interp */
+ if (nu->tilt_interp==KEY_CU_EASE) { /* May as well support for tilt also 2.47 ease interp */
*tilt_array = prevbezt->alfa + (bezt->alfa - prevbezt->alfa)*(3.0f*fac*fac - 2.0f*fac*fac*fac);
} else {
key_curve_position_weights(fac, t, nu->tilt_interp);
@@ -1584,7 +1584,7 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
}
if (radius_array) {
- if (nu->radius_interp==3) {
+ if (nu->radius_interp==KEY_CU_EASE) {
/* Support 2.47 ease interp
* Note! - this only takes the 2 points into account,
* giving much more localized results to changes in radius, sometimes you want that */
diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c
new file mode 100644
index 00000000000..3e8f400967e
--- /dev/null
+++ b/source/blender/blenkernel/intern/idcode.c
@@ -0,0 +1,128 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ * return info about ID types
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "DNA_ID.h"
+
+typedef struct {
+ unsigned short code;
+ char *name, *plural;
+
+ int flags;
+#define IDTYPE_FLAGS_ISLINKABLE (1<<0)
+} IDType;
+
+/* plural need to match rna_main.c's MainCollectionDef */
+static IDType idtypes[]= {
+ { ID_AC, "Action", "actions", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_AR, "Armature", "armatures", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_BR, "Brush", "brushes", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_CA, "Camera", "cameras", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_CU, "Curve", "curves", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_GD, "GPencil", "gpencil", IDTYPE_FLAGS_ISLINKABLE}, /* rename gpencil */
+ { ID_GR, "Group", "groups", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_ID, "ID", "ids", 0}, /* plural is fake */
+ { ID_IM, "Image", "images", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_IP, "Ipo", "ipos", IDTYPE_FLAGS_ISLINKABLE}, /* deprecated */
+ { ID_KE, "Key", "keys", 0},
+ { ID_LA, "Lamp", "lamps", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_LI, "Library", "libraries", 0},
+ { ID_LT, "Lattice", "lattices", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_MA, "Material", "materials", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_MB, "Metaball", "metaballs", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_ME, "Mesh", "meshes", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_NT, "NodeTree", "node_groups", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_OB, "Object", "objects", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_PA, "ParticleSettings", "particles", 0},
+ { ID_SCE, "Scene", "scenes", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_SCR, "Screen", "screens", 0},
+ { ID_SEQ, "Sequence", "sequences", 0}, /* not actually ID data */
+ { ID_SO, "Sound", "sounds", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_TE, "Texture", "textures", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_TXT, "Text", "texts", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_VF, "VFont", "fonts", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_WO, "World", "worlds", IDTYPE_FLAGS_ISLINKABLE},
+ { ID_WM, "WindowManager", "window_managers", 0},
+};
+static int nidtypes= sizeof(idtypes)/sizeof(idtypes[0]);
+
+static IDType *idtype_from_name(const char *str)
+{
+ int i= nidtypes;
+
+ while (i--)
+ if (strcmp(str, idtypes[i].name)==0)
+ return &idtypes[i];
+
+ return NULL;
+}
+static IDType *idtype_from_code(int code)
+{
+ int i= nidtypes;
+
+ while (i--)
+ if (code==idtypes[i].code)
+ return &idtypes[i];
+
+ return NULL;
+}
+
+int BKE_idcode_is_valid(int code)
+{
+ return idtype_from_code(code)?1:0;
+}
+
+int BKE_idcode_is_linkable(int code) {
+ IDType *idt= idtype_from_code(code);
+ return idt?(idt->flags&IDTYPE_FLAGS_ISLINKABLE):0;
+}
+
+const char *BKE_idcode_to_name(int code)
+{
+ IDType *idt= idtype_from_code(code);
+
+ return idt?idt->name:NULL;
+}
+
+int BKE_idcode_from_name(const char *name)
+{
+ IDType *idt= idtype_from_name(name);
+
+ return idt?idt->code:0;
+}
+
+const char *BKE_idcode_to_name_plural(int code)
+{
+ IDType *idt= idtype_from_code(code);
+
+ return idt?idt->plural:NULL;
+}
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 2ccb33b088a..a0df73d6c42 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <stddef.h>
#include <string.h>
#include "BKE_idprop.h"
@@ -491,47 +492,41 @@ void IDP_ReplaceGroupInGroup(IDProperty *dest, IDProperty *src)
void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
{
IDProperty *loop;
- for (loop=group->data.group.first; loop; loop=loop->next) {
- if (BSTR_EQ(loop->name, prop->name)) {
- BLI_insertlink(&group->data.group, loop, prop);
-
- BLI_remlink(&group->data.group, loop);
- IDP_FreeProperty(loop);
- MEM_freeN(loop);
- return;
- }
+ if((loop= IDP_GetPropertyFromGroup(group, prop->name))) {
+ BLI_insertlink(&group->data.group, loop, prop);
+
+ BLI_remlink(&group->data.group, loop);
+ IDP_FreeProperty(loop);
+ MEM_freeN(loop);
+ }
+ else {
+ group->len++;
+ BLI_addtail(&group->data.group, prop);
}
-
- group->len++;
- BLI_addtail(&group->data.group, prop);
}
/*returns 0 if an id property with the same name exists and it failed,
or 1 if it succeeded in adding to the group.*/
int IDP_AddToGroup(IDProperty *group, IDProperty *prop)
{
- IDProperty *loop;
- for (loop=group->data.group.first; loop; loop=loop->next) {
- if (BSTR_EQ(loop->name, prop->name)) return 0;
+ if(IDP_GetPropertyFromGroup(group, prop->name) == NULL) {
+ group->len++;
+ BLI_addtail(&group->data.group, prop);
+ return 1;
}
- group->len++;
- BLI_addtail(&group->data.group, prop);
-
- return 1;
+ return 0;
}
int IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew)
{
- IDProperty *loop;
- for (loop=group->data.group.first; loop; loop=loop->next) {
- if (BSTR_EQ(loop->name, pnew->name)) return 0;
+ if(IDP_GetPropertyFromGroup(group, pnew->name) == NULL) {
+ group->len++;
+ BLI_insertlink(&group->data.group, previous, pnew);
+ return 1;
}
-
- group->len++;
- BLI_insertlink(&group->data.group, previous, pnew);
- return 1;
+ return 0;
}
void IDP_RemFromGroup(IDProperty *group, IDProperty *prop)
@@ -542,11 +537,7 @@ void IDP_RemFromGroup(IDProperty *group, IDProperty *prop)
IDProperty *IDP_GetPropertyFromGroup(IDProperty *prop, const char *name)
{
- IDProperty *loop;
- for (loop=prop->data.group.first; loop; loop=loop->next) {
- if (strcmp(loop->name, name)==0) return loop;
- }
- return NULL;
+ return (IDProperty *)BLI_findstring(&prop->data.group, name, offsetof(IDProperty, name));
}
typedef struct IDPIter {
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 354b3b0e7d8..f4b931ec52b 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -1850,9 +1850,12 @@ void vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
tot= count_curveverts(&cu->nurb);
}
- fp= kb->data= MEM_callocN(tot*elemsize, "key_to_vertcos vertCos");
+ if (tot == 0) {
+ kb->data= NULL;
+ return;
+ }
- if (tot == 0) return;
+ fp= kb->data= MEM_callocN(tot*elemsize, "key_to_vertcos vertCos");
/* Copy coords to keyblock */
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 8d2ad49e7bf..b053d615756 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -1265,13 +1265,13 @@ void BKE_nlastrip_validate_name (AnimData *adt, NlaStrip *strip)
char *dot;
/* Strip off the suffix */
- dot = strchr(strip->name, '.');
+ dot = strrchr(strip->name, '.');
if (dot) *dot=0;
/* Try different possibilities */
for (number = 1; number <= 999; number++) {
/* assemble alternative name */
- BLI_snprintf(tempname, 128, "%s%c%03d", strip->name, ".", number);
+ BLI_snprintf(tempname, 128, "%s.%03d", strip->name, number);
/* if hash doesn't have this, set it */
if (BLI_ghash_haskey(gh, tempname) == 0) {
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 36c23216585..ea30b33655f 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1855,9 +1855,8 @@ static void node_group_execute(bNodeStack *stack, void *data, bNode *gnode, bNod
/* for groups, only execute outputs for edited group */
if(node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
- if(gnode->flag & NODE_GROUP_EDIT)
- if(node->flag & NODE_DO_OUTPUT)
- node->typeinfo->execfunc(data, node, nsin, nsout);
+ if(node->type==CMP_NODE_OUTPUT_FILE || (gnode->flag & NODE_GROUP_EDIT))
+ node->typeinfo->execfunc(data, node, nsin, nsout);
}
else
node->typeinfo->execfunc(data, node, nsin, nsout);
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 18eedd63906..115cfac7627 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2501,7 +2501,7 @@ void object_handle_update(Scene *scene, Object *ob)
/* includes all keys and modifiers */
if(ob->type==OB_MESH) {
- EditMesh *em = BKE_mesh_get_editmesh(ob->data);
+ EditMesh *em = (ob == scene->obedit)? BKE_mesh_get_editmesh(ob->data): NULL;
/* evaluate drivers */
// XXX: should we push this to derivedmesh instead?
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 0d7738353df..4c85656dd91 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -69,6 +69,8 @@ static int ccgDM_getVertMapIndex(CCGSubSurf *ss, CCGVert *v);
static int ccgDM_getEdgeMapIndex(CCGSubSurf *ss, CCGEdge *e);
static int ccgDM_getFaceMapIndex(CCGSubSurf *ss, CCGFace *f);
+static int ccgDM_use_grid_pbvh(CCGDerivedMesh *ccgdm);
+
///
static void *arena_alloc(CCGAllocatorHDL a, int numBytes) {
@@ -1249,7 +1251,7 @@ static void ccgDM_glNormalFast(float *a, float *b, float *c, float *d)
static void ccgdm_pbvh_update(CCGDerivedMesh *ccgdm)
{
- if(ccgdm->pbvh && ccgdm->multires.mmd) {
+ if(ccgdm->pbvh && ccgDM_use_grid_pbvh(ccgdm)) {
CCGFace **faces;
int totface;