svn merge -r 13323:13357 https://svn.blender.org/svnroot/bf-blender/trunk/blender
authorDaniel Genrich <daniel.genrich@gmx.net>
Tue, 22 Jan 2008 20:35:37 +0000 (20:35 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Tue, 22 Jan 2008 20:35:37 +0000 (20:35 +0000)
65 files changed:
CMakeLists.txt
extern/CMakeLists.txt
extern/binreloc/CMakeLists.txt
projectfiles_vc7/blender/render/BRE_render.vcproj
projectfiles_vc7/blender/src/BL_src.vcproj
release/scripts/object_drop.py
release/scripts/object_timeofs_follow_act.py [new file with mode: 0644]
source/Makefile
source/blender/blenkernel/BKE_anim.h
source/blender/blenkernel/BKE_collision.h [new file with mode: 0644]
source/blender/blenkernel/BKE_group.h
source/blender/blenkernel/BKE_particle.h
source/blender/blenkernel/intern/anim.c
source/blender/blenkernel/intern/group.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenlib/BLI_blenlib.h
source/blender/blenlib/CMakeLists.txt
source/blender/blenlib/intern/bpath.c
source/blender/blenlib/intern/storage.c
source/blender/include/BIF_editaction.h
source/blender/include/BIF_editview.h
source/blender/include/BIF_poseobject.h
source/blender/include/BSE_drawipo.h
source/blender/makesdna/DNA_node_types.h
source/blender/nodes/intern/CMP_nodes/CMP_bilateralblur.c
source/blender/python/api2_2x/doc/LibData.py
source/blender/render/extern/include/RE_raytrace.h
source/blender/render/intern/include/render_types.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/occlusion.c
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/rayshade.c
source/blender/render/intern/source/raytrace.c
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/shadbuf.c
source/blender/render/intern/source/shadeoutput.c
source/blender/render/intern/source/strand.c
source/blender/render/intern/source/texture.c
source/blender/render/intern/source/zbuf.c
source/blender/src/buttons_editing.c
source/blender/src/buttons_object.c
source/blender/src/buttons_scene.c
source/blender/src/drawipo.c
source/blender/src/drawnode.c
source/blender/src/drawtime.c
source/blender/src/editaction.c
source/blender/src/editipo.c
source/blender/src/editseq.c
source/blender/src/editview.c
source/blender/src/header_view3d.c
source/blender/src/meshlaplacian.c
source/blender/src/outliner.c
source/blender/src/poseobject.c
source/blender/src/sculptmode.c
source/blender/src/space.c
source/blender/src/toolbox.c
source/blender/src/transform.c
source/blender/yafray/intern/export_File.cpp
source/blender/yafray/intern/export_File.h
source/blender/yafray/intern/export_Plugin.cpp
source/blender/yafray/intern/export_Plugin.h
source/blender/yafray/intern/yafray_Render.cpp
source/blender/yafray/intern/yafray_Render.h
source/creator/CMakeLists.txt

index 673c5e99348a22f3b5d65dbf5436b3bf54894ea2..1e17c3cc182117174689e573310bd461f3c27b12 100644 (file)
@@ -68,7 +68,6 @@ OPTION(WITH_FFMPEG            "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)"   OFF)
 OPTION(WITH_OPENAL             "Enable OpenAL Support (http://www.openal.org)"         ON)
 OPTION(YESIAMSTUPID            "Enable execution on 64-bit platforms"                  OFF)
 OPTION(WITH_OPENMP             "Enable OpenMP (has to be supported by the compiler)"   OFF)
-OPTION(WITH_BINRELOC           "Enable binreloc filepath support"                              OFF)
 
 IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
   MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
@@ -265,9 +264,6 @@ IF(WIN32)
   SET(FFMPEG_LIB avcodec-51 avformat-51 avutil-49)
   SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
 
-  SET(BINRELC ${LIBDIR}/binreloc)
-  SET(BINRELC_INC ${BINRELOC}/include)
-
   SET(LLIBS kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid ws2_32 vfw32 winmm)
   IF(WITH_OPENAL)
     SET(LLIBS ${LLIBS} dxguid)
@@ -389,6 +385,11 @@ IF(APPLE)
   SET(EXETYPE MACOSX_BUNDLE)
 ENDIF(APPLE)
 
+IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+  SET(BINRELOC ${CMAKE_SOURCE_DIR}/extern/binreloc)
+  SET(BINRELOC_INC ${BINRELOC}/include)
+ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+
 #-----------------------------------------------------------------------------
 # Common.
 SET(VERSE_INC ${CMAKE_SOURCE_DIR}/extern/verse/dist)
index 1842aa05246d28d1bd9d08367a02e8d2ecee4fff..db2584d012efc087f3213829a183efa7c0c696b9 100644 (file)
@@ -43,6 +43,6 @@ IF(WITH_VERSE)
   SUBDIRS(verse)
 ENDIF(WITH_VERSE)
 
-if(WITH_BINRELOC)
+IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
   SUBDIRS(binreloc)
-ENDIF(WITH_BINRELOC)
+ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
index ee4dccf4cdac4644aaa7be25779f96f466cf52fa..78dc65d81124e887aae49247d78964e7ffe954bd 100644 (file)
@@ -22,5 +22,5 @@ SET(INC ./include ${WINTAB_INC})
 ADD_DEFINITIONS(-DWITH_BINRELOC)
 FILE(GLOB SRC *.c)
 
-BLENDERLIB(binreloc "${SRC}" "${INC}")
+BLENDERLIB(extern_binreloc "${SRC}" "${INC}")
 #, libtype=['core','player'], priority = [25,15] ) 
index 021d8c2c82a005d682048eb3e48990148e2b2537..4869dd606f1702976081ad49390f9e9b44e23687 100644 (file)
                        <File
                                RelativePath="..\..\..\source\blender\render\intern\source\initrender.c">
                        </File>
+                       <File
+                               RelativePath="..\..\..\source\blender\render\intern\source\occlusion.c">
+                       </File>
                        <File
                                RelativePath="..\..\..\source\blender\render\intern\source\pipeline.c">
                        </File>
                        <File
                                RelativePath="..\..\..\source\blender\render\intern\include\initrender.h">
                        </File>
+                       <File
+                               RelativePath="..\..\..\source\blender\render\intern\include\occlusion.h">
+                       </File>
                        <File
                                RelativePath="..\..\..\source\blender\render\intern\include\old_zbuffer_types.h">
                        </File>
index 9d5e40b96b7ef2f138ed37fd210032f28b45e7d1..79f73e6df97113c1197d9d0a1f2d6464fe503bde 100644 (file)
                        <File
                                RelativePath="..\..\..\source\blender\src\prvicons.c">
                        </File>
+                       <File
+                               RelativePath="..\..\..\source\blender\src\radialcontrol.c">
+                       </File>
                        <File
                                RelativePath="..\..\..\source\blender\src\reeb.c">
                        </File>
                        <File
                                RelativePath="..\..\..\source\blender\include\BIF_previewrender.h">
                        </File>
+                       <File
+                               RelativePath="..\..\..\source\blender\include\BIF_radialcontrol.h">
+                       </File>
                        <File
                                RelativePath="..\..\..\source\blender\include\BIF_renderwin.h">
                        </File>
index 4ea8bde2ca86b7907df8a7a309898f67be938419..63a0bd574fb2a736c8f006dee38f3285a0cbd44c 100644 (file)
@@ -1,7 +1,7 @@
 #!BPY
 """
 Name: 'Drop Onto Ground'
-Blender: 243
+Blender: 245
 Group: 'Object'
 Tooltip: 'Drop the selected objects onto "ground" objects'
 """
@@ -221,4 +221,5 @@ def main():
 if __name__ == '__main__':
        main()
 
-GLOBALS.clear()
\ No newline at end of file
+GLOBALS.clear()
+
diff --git a/release/scripts/object_timeofs_follow_act.py b/release/scripts/object_timeofs_follow_act.py
new file mode 100644 (file)
index 0000000..83863da
--- /dev/null
@@ -0,0 +1,107 @@
+#!BPY
+"""
+Name: 'TimeOffset follow Active'
+Blender: 245
+Group: 'Object'
+Tooltip: 'ActObs animated loc sets TimeOffset on other objects at closest frame'
+"""
+__author__= "Campbell Barton"
+__url__= ["blender.org", "blenderartists.org"]
+__version__= "1.0"
+
+__bpydoc__= """
+"""
+
+# --------------------------------------------------------------------------
+# TimeOffset follow Active v1.0 by Campbell Barton (AKA Ideasman42)
+# --------------------------------------------------------------------------
+# ***** 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# ***** END GPL LICENCE BLOCK *****
+# --------------------------------------------------------------------------
+
+import Blender
+from Blender import Image, sys, Draw, Window, Scene, Group
+import bpy
+import BPyMessages
+
+
+def main():
+
+       sce = Scene.GetCurrent()
+
+       ob_act = sce.objects.active
+        
+       if not ob_act:
+               Draw.PupMenu("Error%t|no active object")
+               return
+       
+       objects = list(sce.objects.context)
+       
+       try:    objects.remove(ob_act)
+       except: pass
+       
+       if not objects:
+               Draw.PupMenu("Error%t|no objects selected")
+               return
+       
+       curframe = Blender.Get('curframe')
+       
+       FRAME_START= Draw.Create( Blender.Get('staframe') )
+       FRAME_END= Draw.Create( Blender.Get('endframe') )
+               
+       # Get USER Options
+       pup_block= [\
+       ('Start:', FRAME_START, 1, 300000, 'Use the active objects position starting at this frame'),\
+       ('End:', FRAME_END, 1, 300000, 'Use the active objects position starting at this frame'),\
+       ]
+       
+       if not Draw.PupBlock('Set timeoffset...', pup_block):
+               return
+       
+       FRAME_START = FRAME_START.val
+       FRAME_END = FRAME_END.val
+       
+       if FRAME_START >= FRAME_END:
+               Draw.PupMenu("Error%t|frames are not valid")
+       
+       
+       # Ok - all error checking 
+       locls_act = []
+       for f in xrange((FRAME_END-FRAME_START)):
+               i = FRAME_START+f
+               Blender.Set('curframe', i)
+               locls_act.append(ob_act.matrixWorld.translationPart())
+       
+       for ob in objects:
+               loc = ob.matrixWorld.translationPart()
+               best_frame = -1
+               best_dist = 100000000
+               for i, loc_act in enumerate(locls_act):
+                       dist = (loc_act-loc).length
+                       if dist < best_dist:
+                               best_dist = dist
+                               best_frame = i + FRAME_START
+               
+               ob.timeOffset = float(best_frame)
+       
+       # Set the original frame
+       Blender.Set('curframe', curframe)
+
+if __name__ == '__main__':
+       main()
+
index ef5e4ab52fbe283e5abba0e150314ff3941b937b..5c72940d9a2fa91656f21d82ff442040210b7eae 100644 (file)
@@ -103,6 +103,8 @@ COMLIB += $(OCGDIR)/blender/nodes_cmp/$(DEBUG_DIR)libnodes_cmp.a
 COMLIB += $(OCGDIR)/blender/nodes/$(DEBUG_DIR)libnodes.a
 COMLIB += $(OCGDIR)/blender/imbuf/$(DEBUG_DIR)libimbuf.a
 COMLIB += $(OCGDIR)/blender/blenlib/$(DEBUG_DIR)libblenlib.a
+COMLIB += $(NAN_OPENNL)/lib/$(DEBUG_DIR)libopennl.a
+COMLIB += $(NAN_SUPERLU)/lib/$(DEBUG_DIR)libsuperlu.a  
 COMLIB += $(OCGDIR)/blender/avi/$(DEBUG_DIR)libavi.a
 COMLIB += $(NAN_JPEG)/lib/libjpeg.a
 
index a82faa56e4018a4cb4c6aac6c978143051b6b432..54fcb19d5dc157ed2f2d4eafba02e69090158cef 100644 (file)
@@ -46,7 +46,7 @@ typedef struct DupliObject {
        struct DupliObject *next, *prev;
        struct Object *ob;
        unsigned int origlay;
-       int index, no_draw, type;
+       int index, no_draw, type, animated;
        float mat[4][4], omat[4][4];
        float orco[3], uv[2];
 } DupliObject;
diff --git a/source/blender/blenkernel/BKE_collision.h b/source/blender/blenkernel/BKE_collision.h
new file mode 100644 (file)
index 0000000..dff099c
--- /dev/null
@@ -0,0 +1,175 @@
+/**
+ * BKE_cloth.h
+ *
+ * $Id: BKE_cloth.h,v 1.1 2007/08/01 02:07:27 daniel Exp $
+ *
+ * ***** BEGIN GPL/BL DUAL 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. The Blender
+ * Foundation also sells licenses for use in proprietary software under
+ * the Blender License.  See http://www.blender.org/BL/ for information
+ * about this.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL/BL DUAL LICENSE BLOCK *****
+ */
+#ifndef BKE_COLLISIONS_H
+#define BKE_COLLISIONS_H
+
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* types */
+#include "BLI_linklist.h"
+#include "BKE_collision.h"
+#include "BKE_customdata.h"
+#include "BKE_DerivedMesh.h"
+#include "DNA_cloth_types.h"
+#include "DNA_customdata_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_modifier_types.h"
+#include "DNA_object_types.h"
+
+struct Object;
+struct Cloth;
+struct MFace;
+struct DerivedMesh;
+struct ClothModifierData;
+struct CollisionTree;
+
+
+////////////////////////////////////////
+// used in kdop.c and collision.c
+////////////////////////////////////////
+typedef struct CollisionTree
+{
+       struct CollisionTree *nodes[4]; // 4 children --> quad-tree
+       struct CollisionTree *parent;
+       struct CollisionTree *nextLeaf;
+       struct CollisionTree *prevLeaf;
+       float   bv[26]; // Bounding volume of all nodes / we have 7 axes on a 14-DOP
+       unsigned int tri_index; // this saves the index of the face
+       // int point_index[4]; // supports up to 4 points in a leaf
+       int     count_nodes; // how many nodes are used
+       int     traversed;  // how many nodes already traversed until this level?
+       int     isleaf;
+}
+CollisionTree;
+
+typedef struct BVH
+{
+       unsigned int    numfaces;
+       unsigned int    numverts;
+       MVert           *current_x; // e.g. txold in clothvertex
+       MVert           *current_xold; // e.g. tx in clothvertex
+       MFace           *mfaces; // just a pointer to the original datastructure
+       struct LinkNode *tree;
+       CollisionTree   *root; // TODO: saving the root --> is this really needed? YES!
+       CollisionTree   *leaf_tree; /* Tail of the leaf linked list.    */
+       CollisionTree   *leaf_root;     /* Head of the leaf linked list.        */
+       float           epsilon; /* epslion is used for inflation of the k-dop     */
+       int             flags; /* bvhFlags */
+}
+BVH;
+////////////////////////////////////////
+
+
+////////////////////////////////////////
+// used for collisions in kdop.c and also collision.c
+////////////////////////////////////////
+/* used for collisions in collision.c */
+typedef struct CollPair
+{
+       unsigned int face1; // cloth face
+       unsigned int face2; // object face
+       double distance; // magnitude of vector
+       float normal[3];
+       float vector[3]; // unnormalized collision vector: p2-p1
+       float pa[3], pb[3]; // collision point p1 on face1, p2 on face2
+       int lastsign; // indicates if the distance sign has changed, unused itm
+       float time; // collision time, from 0 up to 1
+       unsigned int ap1, ap2, ap3, bp1, bp2, bp3, bp4;
+       unsigned int pointsb[4];
+}
+CollPair;
+
+/* used for collisions in collision.c */
+typedef struct EdgeCollPair
+{
+       unsigned int p11, p12, p21, p22;
+       float normal[3];
+       float vector[3];
+       float time;
+       int lastsign;
+       float pa[3], pb[3]; // collision point p1 on face1, p2 on face2
+}
+EdgeCollPair;
+
+/* used for collisions in collision.c */
+typedef struct FaceCollPair
+{
+       unsigned int p11, p12, p13, p21;
+       float normal[3];
+       float vector[3];
+       float time;
+       int lastsign;
+       float pa[3], pb[3]; // collision point p1 on face1, p2 on face2
+}
+FaceCollPair;
+////////////////////////////////////////
+
+
+
+/////////////////////////////////////////////////
+// forward declarations
+/////////////////////////////////////////////////
+
+// NOTICE: mvert-routines for building + update the BVH are the most native ones
+
+// builds bounding volume hierarchy
+void bvh_build (BVH *bvh);
+BVH *bvh_build_from_mvert (MFace *mfaces, unsigned int numfaces, MVert *x, unsigned int numverts, float epsilon);
+
+// frees the same
+void bvh_free ( BVH * bvh );
+
+// checks two bounding volume hierarchies for potential collisions and returns some list with those
+
+
+// update bounding volumes, needs updated positions in bvh->x
+void bvh_update_from_mvert(BVH * bvh, MVert *x, unsigned int numverts, MVert *xnew, int moving);
+void bvh_update(BVH * bvh, int moving);
+
+LinkNode *BLI_linklist_append_fast ( LinkNode **listp, void *ptr );
+
+// move Collision modifier object inter-frame with step = [0,1]
+// defined in collisions.c
+void collision_move_object(CollisionModifierData *collmd, float step, float prevstep);
+
+// interface for collision functions
+void collisions_compute_barycentric (float pv[3], float p1[3], float p2[3], float p3[3], float *w1, float *w2, float *w3);
+void interpolateOnTriangle(float to[3], float v1[3], float v2[3], float v3[3], double w1, double w2, double w3);
+
+/////////////////////////////////////////////////
+
+#endif
+
index 1c301bb255c5ad9559dc12dc3bb349a3eb584998..bdc56b2cbd10cff70a3346b02918e014c02f9880 100644 (file)
@@ -47,6 +47,7 @@ void          add_to_group(struct Group *group, struct Object *ob);
 void           rem_from_group(struct Group *group, struct Object *ob);
 struct Group *find_group(struct Object *ob, struct Group *group);
 int                    object_in_group(struct Object *ob, struct Group *group);
+int                    group_is_animated(struct Object *parent, struct Group *group);
 
 void           group_tag_recalc(struct Group *group);
 void           group_handle_recalc_and_update(struct Object *parent, struct Group *group);
index 399f67b728896531f3efd9737f869d958b9e656e..af5713b565d88c98c7e8c0fe0343fac062ecc1a2 100644 (file)
@@ -213,6 +213,7 @@ void psys_free_path_cache(struct ParticleSystem *psys);
 void free_hair(struct ParticleSystem *psys);
 void free_keyed_keys(struct ParticleSystem *psys);
 void psys_free(struct Object * ob, struct ParticleSystem * psys);
+void psys_free_children(struct ParticleSystem *psys);
 
 void psys_render_set(struct Object *ob, struct ParticleSystem *psys, float viewmat[][4], float winmat[][4], int winx, int winy);
 void psys_render_restore(struct Object *ob, struct ParticleSystem *psys);
index a776f2eab806862cabe223a66f2493012ea5a0bb..58d0e84acd8c641ef56a206c1e58a039ae74ebb4 100644 (file)
@@ -76,7 +76,7 @@
 #include <config.h>
 #endif
 
-static void object_duplilist_recursive(ID *id, Object *ob, ListBase *duplilist, float par_space_mat[][4], int level);
+static void object_duplilist_recursive(ID *id, Object *ob, ListBase *duplilist, float par_space_mat[][4], int level, int animated);
 
 void free_path(Path *path)
 {
@@ -284,7 +284,7 @@ int where_on_path(Object *ob, float ctime, float *vec, float *dir)  /* returns OK
 
 /* ****************** DUPLICATOR ************** */
 
-static DupliObject *new_dupli_object(ListBase *lb, Object *ob, float mat[][4], int lay, int index, int type)
+static DupliObject *new_dupli_object(ListBase *lb, Object *ob, float mat[][4], int lay, int index, int type, int animated)
 {
        DupliObject *dob= MEM_callocN(sizeof(DupliObject), "dupliobject");
        
@@ -295,12 +295,13 @@ static DupliObject *new_dupli_object(ListBase *lb, Object *ob, float mat[][4], i
        dob->origlay= ob->lay;
        dob->index= index;
        dob->type= type;
+       dob->animated= (type == OB_DUPLIGROUP) && animated;
        ob->lay= lay;
        
        return dob;
 }
 
-static void group_duplilist(ListBase *lb, Object *ob, int level)
+static void group_duplilist(ListBase *lb, Object *ob, int level, int animated)
 {
        DupliObject *dob;
        Group *group;
@@ -316,25 +317,26 @@ static void group_duplilist(ListBase *lb, Object *ob, int level)
        /* handles animated groups, and */
        /* we need to check update for objects that are not in scene... */
        group_handle_recalc_and_update(ob, group);
+       animated= animated || group_is_animated(ob, group);
        
        for(go= group->gobject.first; go; go= go->next) {
                /* note, if you check on layer here, render goes wrong... it still deforms verts and uses parent imat */
                if(go->ob!=ob) {
                        
                        Mat4MulMat4(mat, go->ob->obmat, ob->obmat);
-                       dob= new_dupli_object(lb, go->ob, mat, ob->lay, 0, OB_DUPLIGROUP);
+                       dob= new_dupli_object(lb, go->ob, mat, ob->lay, 0, OB_DUPLIGROUP, animated);
                        dob->no_draw= (dob->origlay & group->layer)==0;
                        
                        if(go->ob->transflag & OB_DUPLI) {
                                Mat4CpyMat4(dob->ob->obmat, dob->mat);
-                               object_duplilist_recursive((ID *)group, go->ob, lb, ob->obmat, level+1);
+                               object_duplilist_recursive((ID *)group, go->ob, lb, ob->obmat, level+1, animated);
                                Mat4CpyMat4(dob->ob->obmat, dob->omat);
                        }
                }
        }
 }
 
-static void frames_duplilist(ListBase *lb, Object *ob, int level)
+static void frames_duplilist(ListBase *lb, Object *ob, int level, int animated)
 {
        extern int enable_cu_speed;     /* object.c */
        Object copyob;
@@ -361,7 +363,7 @@ static void frames_duplilist(ListBase *lb, Object *ob, int level)
                if(ok) {
                        do_ob_ipo(ob);
                        where_is_object_time(ob, (float)G.scene->r.cfra);
-                       new_dupli_object(lb, ob, ob->obmat, ob->lay, G.scene->r.cfra, OB_DUPLIFRAMES);
+                       new_dupli_object(lb, ob, ob->obmat, ob->lay, G.scene->r.cfra, OB_DUPLIFRAMES, animated);
                }
        }
 
@@ -373,6 +375,7 @@ static void frames_duplilist(ListBase *lb, Object *ob, int level)
 struct vertexDupliData {
        ID *id; /* scene or group, for recursive loops */
        int level;
+       int animated;
        ListBase *lb;
        float pmat[4][4];
        float obmat[4][4]; /* Only used for dupliverts inside dupligroups, where the ob->obmat is modified */
@@ -408,7 +411,7 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n
                Mat4CpyMat4(tmat, obmat);
                Mat4MulMat43(obmat, tmat, mat);
        }
-       dob= new_dupli_object(vdd->lb, vdd->ob, obmat, vdd->par->lay, index, OB_DUPLIVERTS);
+       dob= new_dupli_object(vdd->lb, vdd->ob, obmat, vdd->par->lay, index, OB_DUPLIVERTS, vdd->animated);
        if(vdd->orco)
                VECCOPY(dob->orco, vdd->orco[index]);
        
@@ -416,12 +419,12 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n
                float tmpmat[4][4];
                Mat4CpyMat4(tmpmat, vdd->ob->obmat);
                Mat4CpyMat4(vdd->ob->obmat, obmat); /* pretend we are really this mat */
-               object_duplilist_recursive((ID *)vdd->id, vdd->ob, vdd->lb, obmat, vdd->level+1);
+               object_duplilist_recursive((ID *)vdd->id, vdd->ob, vdd->lb, obmat, vdd->level+1, vdd->animated);
                Mat4CpyMat4(vdd->ob->obmat, tmpmat);
        }
 }
 
-static void vertex_duplilist(ListBase *lb, ID *id, Object *par, float par_space_mat[][4], int level)
+static void vertex_duplilist(ListBase *lb, ID *id, Object *par, float par_space_mat[][4], int level, int animated)
 {
        Object *ob, *ob_iter;
        Mesh *me;
@@ -493,6 +496,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Object *par, float par_space_
 
                                        vdd.id= id;
                                        vdd.level= level;
+                                       vdd.animated= animated;
                                        vdd.lb= lb;
                                        vdd.ob= ob;
                                        vdd.par= par;
@@ -527,7 +531,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Object *par, float par_space_
        dm->release(dm);
 }
 
-static void face_duplilist(ListBase *lb, ID *id, Object *par, float par_space_mat[][4], int level)
+static void face_duplilist(ListBase *lb, ID *id, Object *par, float par_space_mat[][4], int level, int animated)
 {
        Object *ob, *ob_iter;
        Base *base = NULL;
@@ -663,7 +667,7 @@ static void face_duplilist(ListBase *lb, ID *id, Object *par, float par_space_ma
                                                Mat4CpyMat4(tmat, obmat);
                                                Mat4MulMat43(obmat, tmat, mat);
                                                
-                                               dob= new_dupli_object(lb, ob, obmat, lay, a, OB_DUPLIFACES);
+                                               dob= new_dupli_object(lb, ob, obmat, lay, a, OB_DUPLIFACES, animated);
                                                if(G.rendering) {
                                                        w= (mv4)? 0.25f: 1.0f/3.0f;
 
@@ -694,7 +698,7 @@ static void face_duplilist(ListBase *lb, ID *id, Object *par, float par_space_ma
                                                        float tmpmat[4][4];
                                                        Mat4CpyMat4(tmpmat, ob->obmat);
                                                        Mat4CpyMat4(ob->obmat, obmat); /* pretend we are really this mat */
-                                                       object_duplilist_recursive((ID *)id, ob, lb, ob->obmat, level+1);
+                                                       object_duplilist_recursive((ID *)id, ob, lb, ob->obmat, level+1, animated);
                                                        Mat4CpyMat4(ob->obmat, tmpmat);
                                                }
                                        }
@@ -719,7 +723,7 @@ static void face_duplilist(ListBase *lb, ID *id, Object *par, float par_space_ma
        dm->release(dm);
 }
 
-static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_space_mat[][4], ParticleSystem *psys, int level)
+static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_space_mat[][4], ParticleSystem *psys, int level, int animated)
 {
        GroupObject *go;
        Object *ob=0, **oblist=0;
@@ -868,7 +872,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_
                                                else
                                                        Mat4CpyMat4(mat, tmat);
 
-                                               dob= new_dupli_object(lb, go->ob, mat, par->lay, counter, OB_DUPLIPARTS);
+                                               dob= new_dupli_object(lb, go->ob, mat, par->lay, counter, OB_DUPLIPARTS, animated);
                                                if(G.rendering)
                                                        psys_get_dupli_texture(par, part, psmd, pa, cpa, dob->uv, dob->orco);
                                        }
@@ -894,7 +898,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Object *par, float par_
                                        else
                                                Mat4CpyMat4(mat, tmat);
 
-                                       dob= new_dupli_object(lb, ob, mat, par->lay, counter, OB_DUPLIPARTS);
+                                       dob= new_dupli_object(lb, ob, mat, par->lay, counter, OB_DUPLIPARTS, animated);
                                        if(G.rendering)
                                                psys_get_dupli_texture(par, part, psmd, pa, cpa, dob->uv, dob->orco);
                                }
@@ -935,7 +939,7 @@ static Object *find_family_object(Object **obar, char *family, char ch)
 }
 
 
-static void font_duplilist(ListBase *lb, Object *par, int level)
+static void font_duplilist(ListBase *lb, Object *par, int level, int animated)
 {
        Object *ob, *obar[256];
        Curve *cu;
@@ -976,16 +980,15 @@ static void font_duplilist(ListBase *lb, Object *par, int level)
                        Mat4CpyMat4(obmat, par->obmat);
                        VECCOPY(obmat[3], vec);
                        
-                       new_dupli_object(lb, ob, obmat, par->lay, a, OB_DUPLIVERTS);
+                       new_dupli_object(lb, ob, obmat, par->lay, a, OB_DUPLIVERTS, animated);
                }
-               
        }
        
        MEM_freeN(chartransdata);
 }
 
 /* ***************************** */
-static void object_duplilist_recursive(ID *id, Object *ob, ListBase *duplilist, float par_space_mat[][4], int level)
+static void object_duplilist_recursive(ID *id, Object *ob, ListBase *duplilist, float par_space_mat[][4], int level, int animated)
 {      
        if((ob->transflag & OB_DUPLI)==0)
                return;
@@ -1004,30 +1007,30 @@ static void object_duplilist_recursive(ID *id, Object *ob, ListBase *duplilist,
        if(ob->transflag & OB_DUPLIPARTS) {
                ParticleSystem *psys = ob->particlesystem.first;
                for(; psys; psys=psys->next)
-                       new_particle_duplilist(duplilist, id, ob, par_space_mat, psys, level+1);
+                       new_particle_duplilist(duplilist, id, ob, par_space_mat, psys, level+1, animated);
        }
        else if(ob->transflag & OB_DUPLIVERTS) {
                if(ob->type==OB_MESH) {
-                       vertex_duplilist(duplilist, id, ob, par_space_mat, level+1);
+                       vertex_duplilist(duplilist, id, ob, par_space_mat, level+1, animated);
                }
                else if(ob->type==OB_FONT) {
                        if (GS(id->name)==ID_SCE) { /* TODO - support dupligroups */
-                               font_duplilist(duplilist, ob, level+1);
+                               font_duplilist(duplilist, ob, level+1, animated);
                        }
                }
        }
        else if(ob->transflag & OB_DUPLIFACES) {
                if(ob->type==OB_MESH)
-                       face_duplilist(duplilist, id, ob, par_space_mat, level+1);
+                       face_duplilist(duplilist, id, ob, par_space_mat, level+1, animated);
        }
        else if(ob->transflag & OB_DUPLIFRAMES) {
                if (GS(id->name)==ID_SCE) { /* TODO - support dupligroups */
-                       frames_duplilist(duplilist, ob, level+1);
+                       frames_duplilist(duplilist, ob, level+1, animated);
                }
        } else if(ob->transflag & OB_DUPLIGROUP) {
                DupliObject *dob;
                
-               group_duplilist(duplilist, ob, level+1); /* now recursive */
+               group_duplilist(duplilist, ob, level+1, animated); /* now recursive */
 
                if (level==0) {
                        for(dob= duplilist->first; dob; dob= dob->next)
@@ -1042,7 +1045,7 @@ ListBase *object_duplilist(Scene *sce, Object *ob)
 {
        ListBase *duplilist= MEM_mallocN(sizeof(ListBase), "duplilist");
        duplilist->first= duplilist->last= NULL;
-       object_duplilist_recursive((ID *)sce, ob, duplilist, NULL, 0);
+       object_duplilist_recursive((ID *)sce, ob, duplilist, NULL, 0, 0);
        return duplilist;
 }
 
index b29cf63ab0b72492297eba34ccb2029d1507b0dd..a85f0f52ad282b8fe59dfd9348da1d12be0fa9af 100644 (file)
@@ -191,6 +191,20 @@ void group_tag_recalc(Group *group)
        }
 }
 
+int group_is_animated(Object *parent, Group *group)
+{
+       GroupObject *go;
+
+       if(give_timeoffset(parent) != 0.0f || parent->nlastrips.first)
+               return 1;
+
+       for(go= group->gobject.first; go; go= go->next)
+               if(go->ob && go->ob->proxy)
+                       return 1;
+
+       return 0;
+}
+
 /* only replaces object strips or action when parent nla instructs it */
 /* keep checking nla.c though, in case internal structure of strip changes */
 static void group_replaces_nla(Object *parent, Object *target, char mode)
@@ -231,7 +245,6 @@ static void group_replaces_nla(Object *parent, Object *target, char mode)
        }
 }
 
-
 /* puts all group members in local timing system, after this call
 you can draw everything, leaves tags in objects to signal it needs further updating */
 
index bf8d1e9d8aa949ab34bc5621f9a6fd9aacc03af4..9cfc7e9dafe97044253add78190a753e3db28e50 100644 (file)
@@ -318,6 +318,16 @@ void psys_free_path_cache(ParticleSystem *psys)
        }
        free_child_path_cache(psys);
 }
+void psys_free_children(ParticleSystem *psys)
+{
+       if(psys->child) {
+               MEM_freeN(psys->child);
+               psys->child=0;
+               psys->totchild=0;
+       }
+
+       free_child_path_cache(psys);
+}
 /* free everything */
 void psys_free(Object *ob, ParticleSystem * psys)
 {
index 94cfdadbb16a13c0e8d34ecfb255bb814c5ae0f4..5f481f94b61d25ac36ab72fe0a9153abb7f58f26 100644 (file)
@@ -2058,6 +2058,47 @@ static int get_particles_from_cache(Object *ob, ParticleSystem *psys, int cfra)
 /************************************************/
 /*                     Effectors                                                       */
 /************************************************/
+static float particle_falloff(PartDeflect *pd, float fac)
+{
+       float mindist= (pd->flag & PFIELD_USEMIN)? pd->mindist: 0.0f;
+
+#if 0
+       if(distance<=mindist) fallof= 1.0f;
+       else if(pd->flag & PFIELD_USEMAX) {
+               if(distance>pd->maxdist || mindist>=pd->maxdist) fallof= 0.0f;
+               else {
+                       fallof= 1.0f - (distance-mindist)/(pd->maxdist - mindist);
+                       if(ffall_val!=0.0f)
+                               fallof = (float)pow(fallof, ffall_val+1.0);
+               }
+       }
+       else {
+               fallof= 1.0f/(1.0f + distance-mindist);
+               if(ffall_val!=0.0f)
+                       fallof = (float)pow(fallof, ffall_val+1.0);
+       }
+
+       fac=VecLength(vec_to_part);
+#endif
+
+       if(fac < mindist) {
+               return 1.0f;
+       }
+       else if(pd->flag & PFIELD_USEMAX) {
+               if(fac>pd->maxdist || (pd->maxdist-mindist)<=0.0f)
+                       return 0.0f;
+
+               fac= 1.0f - (fac-mindist)/(pd->maxdist-mindist);
+               printf("fac %f^%f\n", fac, pd->f_power);
+               return (float)pow((double)fac, (double)pd->f_power);
+       }
+       else {
+               fac+=1.0f-pd->mindist;
+
+               return (float)pow((double)fac,(double)-pd->f_power);
+       }
+}
+
 static float effector_falloff(PartDeflect *pd, float *eff_velocity, float *vec_to_part)
 {
        float eff_dir[3], temp[3];
@@ -2071,6 +2112,8 @@ static float effector_falloff(PartDeflect *pd, float *eff_velocity, float *vec_t
        else switch(pd->falloff){
                case PFIELD_FALL_SPHERE:
                        fac=VecLength(vec_to_part);
+                       falloff= particle_falloff(pd, fac);
+#if 0
                        if(pd->flag&PFIELD_USEMAX && fac>pd->maxdist){
                                falloff=0.0f;
                                break;
@@ -2086,6 +2129,7 @@ static float effector_falloff(PartDeflect *pd, float *eff_velocity, float *vec_t
                                fac=0.001f;
 
                        falloff=1.0f/(float)pow((double)fac,(double)pd->f_power);
+#endif
                        break;
 
                case PFIELD_FALL_TUBE:
@@ -4468,9 +4512,11 @@ static void system_step(Object *ob, ParticleSystem *psys, ParticleSystemModifier
 
                        distribute_particles(ob, psys, part->from);
 
-                       if(!(psys->part->type == PART_HAIR) || (psys->flag & PSYS_HAIR_DONE))
-                               if(get_alloc_child_particles_tot(psys))
-                                       distribute_particles(ob, psys, PART_FROM_CHILD);
+                       if((psys->part->type == PART_HAIR) && !(psys->flag & PSYS_HAIR_DONE))
+                               /* don't generate children while growing hair - waste of time */
+                               psys_free_children(psys);
+                       else if(get_alloc_child_particles_tot(psys))
+                               distribute_particles(ob, psys, PART_FROM_CHILD);
                }
                initialize_all_particles(ob, psys, psmd);
 
index fed513d32796350590565a3a5570714fcbfb4889..4fc4241e6dca94a6b87c10be80efefcafb03fa2b 100644 (file)
@@ -272,6 +272,7 @@ int BLI_getInstallationDir(char *str);
                
 /* BLI_storage.h */
 int    BLI_filesize(int file);
+int    BLI_filepathsize(const char *path);
 double BLI_diskfree(char *dir);
 char *BLI_getwdN(char *dir);
 void BLI_hide_dot_files(int set);
index 4812cad033df664fd3a7380526f097c34b32eaa3..ac2f3235646f82df790ffdb9e3ae674e7e1faed7 100644 (file)
@@ -36,6 +36,13 @@ SET(INC
   ${ZLIB_INC}
 )
 
+IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+SET(INC
+  ${INC}
+  ${BINRELOC_INC}
+)
+ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+
 IF(WITH_VERSE)
   ADD_DEFINITIONS(-DWITH_VERSE)
   SET(INC ${INC} ${VERSE_INC})
index a6c71a836f59d9f3aa0944feaaa04fbb0b8b6c09..219ca424df870a0d77a50d6655899f6cd7fc50a0 100644 (file)
@@ -458,7 +458,6 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char
 {
        /* file searching stuff */
        DIR *dir;
-       int file = 0;
        struct dirent *de;
        struct stat status;
        char path[FILE_MAX];
@@ -485,14 +484,10 @@ static int findFileRecursive(char *filename_new, const char *dirname, const char
                if (S_ISREG(status.st_mode)) { /* is file */
                        if (strncmp(filename, de->d_name, FILE_MAX)==0) { /* name matches */
                                /* open the file to read its size */
-                               file = open(path, O_BINARY|O_RDONLY);
-                               if (file >=0 ) {
-                                       size = BLI_filesize(file);
-                                       if (size > *filesize) { /* find the biggest file */
-                                               *filesize = size;
-                                               BLI_strncpy(filename_new, path, FILE_MAX);
-                                       }
-                                       close(file);
+                               size = BLI_filepathsize(path);
+                               if ((size > 0) && (size > *filesize)) { /* find the biggest file */
+                                       *filesize = size;
+                                       BLI_strncpy(filename_new, path, FILE_MAX);
                                }
                        }
                } else if (S_ISDIR(status.st_mode)) { /* is subdir */
index 1d46679cbf243e52578125bb0ac2e1ab6f5402ed..c6011bb6fd999dac80e6c6312793449bd51b5939 100644 (file)
@@ -472,6 +472,17 @@ int BLI_filesize(int file)
        return (buf.st_size);
 }
 
+int BLI_filepathsize(const char *path)
+{
+       int size, file = open(path, O_BINARY|O_RDONLY);
+       
+       if (file <= 0)
+               return -1;
+       
+       size = BLI_filesize(file);
+       close(file);
+       return size;
+}
 
 
 int BLI_exist(char *name)
index b3e402daa3005b546322692081f5541a8196446b..2f105dccf72950d7dbd22097d290b2b99228635d 100644 (file)
@@ -108,6 +108,7 @@ enum {
 struct bAction;
 struct bActionChannel;
 struct bActionGroup;
+struct bPose;
 struct bPoseChannel;
 struct Object;
 struct Ipo;
@@ -142,8 +143,7 @@ void paste_actdata(void);
 /* Group/Channel Operations */
 struct bActionGroup *get_active_actiongroup(struct bAction *act);
 void set_active_actiongroup(struct bAction *act, struct bActionGroup *agrp, short select);
-void unique_name_actiongroup(struct ListBase *lb, struct bActionGroup *agrp);
-// <--- add some func to add group for action-channel based on corresponding pchan's grouping 
+void verify_pchan2achan_grouping(struct bAction *act, struct bPose *pose, char name[]); 
 void action_groups_group(short add_group);
 void action_groups_ungroup(void);
 
index 9192b217f4f0987f5e68694bbc2a66df32285bdd..d47bd82332f4df4170b961319cef1a563d6737a8 100644 (file)
@@ -44,6 +44,7 @@ void  borderselect(void);
 void   circle_select(void);
 void   deselectall(void);
 void   selectswap(void);
+void   selectrandom(void);
 void   selectall_type(short obtype);
 void   selectall_layer(unsigned int layernum);
 void   draw_sel_circle(short *mval, short *mvalo, float rad, float rado, int selecting);
index ec7df157b0653214e5052fca02741d2c7891eead..f356c9d664cb9a06d385ca6b98807f19ca5f1024 100644 (file)
@@ -35,6 +35,7 @@
 
 
 struct Object;
+struct bPose;
 struct bPoseChannel;
 
 void enter_posemode(void);
@@ -60,6 +61,13 @@ void paste_posebuf (int flip);
 
 void pose_adds_vgroups(struct Object *meshobj, int heatweights);
 
+void pose_add_posegroup(void);
+void pose_remove_posegroup(void);
+char *build_posegroups_menustr(struct bPose *pose, short for_pupmenu);
+void pose_assign_to_posegroup(void);
+void pose_remove_from_posegroups(void);
+void pgroup_operation_with_menu(void);
+
 void pose_calculate_path(struct Object *ob);
 void pose_recalculate_paths(struct Object *ob);
 void pose_clear_paths(struct Object *ob);
index 07f116d8d67b5f3c5abb646c0eb6a11c2551f715..2053f41a1780572d4afd323fbc08eb8590efaeec 100644 (file)
@@ -55,6 +55,7 @@ void ipoco_to_areaco_noclip   (struct View2D *v2d, float *vec, short *mval);
 
 void view2d_do_locks           (struct ScrArea *cursa, int flag);
 void view2d_zoom                       (struct View2D *v2d, float factor, int winx, int winy);
+void view2d_getscale           (struct View2D *v2d, float *x, float *y);
 void test_view2d                       (struct View2D *v2d, int winx, int winy);
 void calc_scrollrcts           (struct ScrArea *sa, struct View2D *v2d, int winx, int winy);
 
index d13ec7df8ca40acc57f3d12af5c6564cbfb2bfde..b5c0afe59d7e6a9dd2f75a651281820765852e01 100644 (file)
@@ -202,7 +202,8 @@ typedef struct NodeBlurData {
        float fac, percentx, percenty;
        short filtertype;
        char bokeh, gamma;
-       int pad;
+       short curved;
+       short pad;
        int image_in_width, image_in_height; /* needed for absolute/relative conversions */
 } NodeBlurData;
 
index 81592becf4b8865fc4e94ba09798b7e0bbe7f840..b954e876ea1ee1b4114177365497958b3b32c9bc 100644 (file)
@@ -107,9 +107,8 @@ static void node_composit_exec_bilateralblur(void *data, bNode *node, bNodeStack
        step= pix * imgx;
 
        if(refimg) {
-               refimg= img;
                if(refimg->x == imgx && refimg->y == imgy) {
-                       if(refimg->type == CB_VEC2 || refimg->type == CB_VEC3) {
+                       if(ELEM3(refimg->type, CB_VAL, CB_VEC2, CB_VEC3)) {
                                refimg= typecheck_compbuf(in[1]->data, CB_RGBA);
                                found_determinator= 1;
                        }
index 7884ea506597eebabd227a67d1724e37070eeb2b..7b6f4950c76b6af60f53a708b1fcc74c68d582db 100644 (file)
@@ -18,7 +18,7 @@ which module is supported in the end.
 Example::
        import bpy
 
-       scn= bpy.scenes.active                            # get current scene
+       scn= bpy.data.scenes.active                       # get current scene
        lib = bpy.libraries.load('//file.blend')          # open file.blend
        ob = scn.objects.link(lib.objects.append('Cube')) # append Cube object from library to current scene
        mat = lib.objects.link('Material')                # get a link to a material
@@ -103,17 +103,17 @@ class LibData:
                B{Note}: Blender Objects cannot be appended or linked without linking
                them to a scene.  For this reason, lib.objects.append() returns a
                special "wrapper object" which must be passed to Scene.objects.link()
-               or bpy.scenes.active.link() in order to actually create the object.
+               or bpy.data.scenes.active.link() in order to actually create the object.
                So the following code will not create a new object::
                        import bpy
 
-                       scn= bpy.scenes.active                            # get current scene
+                       scn= bpy.data.scenes.active                       # get current scene
                        lib = bpy.libraries.load('//file.blend')          # open file.blend
                        pseudoOb = lib.objects.append('Cube'))            # get an object wrapper
                But this code will::
                        import bpy
 
-                       scn= bpy.scenes.active                            # get current scene
+                       scn= bpy.data.scenes.active                       # get current scene
                        lib = bpy.libraries.load('//file.blend')          # open file.blend
                        pseudoOb = lib.objects.append('Cube'))            # get an object wrapper
                        ob = scn.objects.link(pseudoOb)                                   # link to scene
index 39bf2be4256c7461ab19f08f855b7e1954f84fcf..aec1c69b3dca9cfce1689cf3d0f8bbd8f927145e 100644 (file)
@@ -89,7 +89,7 @@ typedef struct Isect {
 /* function callbacks for face type abstraction */
 typedef void (*RayCoordsFunc)(RayFace *face,
        float **v1, float **v2, float **v3, float **v4);
-typedef int (*RayCheckFunc)(Isect *is, RayFace *face);
+typedef int (*RayCheckFunc)(Isect *is, int ob, RayFace *face);
 typedef float *(*RayObjectTransformFunc)(void *userdata, int ob);
 
 /* tree building and freeing */
index 6124870d63ea57448872eb85d00e31ebac4e470f..05d8324dfc6e8a54c47de2d09aa2563c1a545dd2 100644 (file)
@@ -244,7 +244,7 @@ typedef struct ObjectRen {
        struct ObjectRen *next, *prev;
        struct Object *ob, *par;
        struct Scene *sce;
-       int index, psysindex;
+       int index, psysindex, flag;
 
        int totvert, totvlak, totstrand, tothalo;
        int vertnodeslen, vlaknodeslen, strandnodeslen, blohalen;
@@ -257,6 +257,8 @@ typedef struct ObjectRen {
        char (*mtface)[32];
        char (*mcol)[32];
        int  actmtface, actmcol;
+
+       float obmat[4][4];      /* only used in convertblender.c, for instancing */
 } ObjectRen;
 
 typedef struct ObjectInstanceRen {
@@ -313,7 +315,6 @@ typedef struct VlakRen {
        char puno;
        char flag, ec;
        RadFace *radface;
-       ObjectRen *obr;
        int index;
 } VlakRen;
 
@@ -487,6 +488,9 @@ typedef struct LampRen {
 #define R_STRAND_BSPLINE       1
 #define R_STRAND_B_UNITS       2
 
+/* objectren->flag */
+#define R_INSTANCEABLE         1
+
 /* objectinstance->flag */
 #define R_DUPLI_TRANSFORMED    1
 #define R_ENV_TRANSFORMED      2
index 293b367a04933fe9a1803201c0616ef4ed5a21b3..3faaec4c00cdccee1bfde8b0ccda8d9add21dbcf 100644 (file)
@@ -1042,7 +1042,6 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, flo
        if(line) {
                vlr= RE_findOrAddVlak(obr, obr->totvlak++);
                vlr->flag= flag;
-               vlr->obr= obr;
                vlr->v1= RE_findOrAddVert(obr, obr->totvert++);
                vlr->v2= RE_findOrAddVert(obr, obr->totvert++);
                vlr->v3= RE_findOrAddVert(obr, obr->totvert++);
@@ -1132,7 +1131,6 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, flo
                if(adapt==0 || second){
                        vlr= RE_findOrAddVlak(obr, obr->totvlak++);
                        vlr->flag= flag;
-                       vlr->obr= obr;
                        vlr->v1= v1;
                        vlr->v2= v2;
                        vlr->v3= RE_findOrAddVert(obr, obr->totvert++);
@@ -1162,7 +1160,6 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, flo
                        if(Inpf(anor,nor)<adapt_angle && w>adapt_pix){
                                vlr= RE_findOrAddVlak(obr, obr->totvlak++);
                                vlr->flag= flag;
-                               vlr->obr= obr;
                                vlr->v1= v1;
                                vlr->v2= v2;
                                vlr->v3= RE_findOrAddVert(obr, obr->totvert++);
@@ -1232,7 +1229,6 @@ static void static_particle_wire(ObjectRen *obr, Material *ma, float *vec, float
 
        if(line) {
                vlr= RE_findOrAddVlak(obr, obr->totvlak++);
-               vlr->obr= obr;
                vlr->v1= RE_findOrAddVert(obr, obr->totvert++);
                vlr->v2= RE_findOrAddVert(obr, obr->totvert++);
                vlr->v3= vlr->v2;
@@ -1257,7 +1253,6 @@ static void static_particle_wire(ObjectRen *obr, Material *ma, float *vec, float
        }
        else {
                vlr= RE_findOrAddVlak(obr, obr->totvlak++);
-               vlr->obr= obr;
                vlr->v1= v1;
                vlr->v2= RE_findOrAddVert(obr, obr->totvert++);
                vlr->v3= vlr->v2;
@@ -1289,7 +1284,6 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Object
                onevec[align]=1.0f;
 
        vlr= RE_findOrAddVlak(obr, obr->totvlak++);
-       vlr->obr= obr;
        vlr->v1= RE_findOrAddVert(obr, obr->totvert++);
        vlr->v2= RE_findOrAddVert(obr, obr->totvert++);
        vlr->v3= RE_findOrAddVert(obr, obr->totvert++);
@@ -2159,7 +2153,7 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve
        return;
 }
 
-static void displace_render_face(Render *re, VlakRen *vlr, float *scale)
+static void displace_render_face(Render *re, ObjectRen *obr, VlakRen *vlr, float *scale)
 {
        ShadeInput shi;
 
@@ -2178,17 +2172,17 @@ static void displace_render_face(Render *re, VlakRen *vlr, float *scale)
        
        /* Displace the verts, flag is set when done */
        if (!vlr->v1->flag)
-               displace_render_vert(re, vlr->obr, &shi, vlr->v1,0,  scale);
+               displace_render_vert(re, obr, &shi, vlr->v1,0,  scale);
        
        if (!vlr->v2->flag)
-               displace_render_vert(re, vlr->obr, &shi, vlr->v2, 1, scale);
+               displace_render_vert(re, obr, &shi, vlr->v2, 1, scale);
 
        if (!vlr->v3->flag)
-               displace_render_vert(re, vlr->obr, &shi, vlr->v3, 2, scale);
+               displace_render_vert(re, obr, &shi, vlr->v3, 2, scale);
 
        if (vlr->v4) {
                if (!vlr->v4->flag)
-                       displace_render_vert(re, vlr->obr, &shi, vlr->v4, 3, scale);
+                       displace_render_vert(re, obr, &shi, vlr->v4, 3, scale);
 
                /*      closest in displace value.  This will help smooth edges.   */ 
                if ( fabs(vlr->v1->accum - vlr->v3->accum) > fabs(vlr->v2->accum - vlr->v4->accum)) 
@@ -2230,7 +2224,7 @@ static void do_displacement(Render *re, ObjectRen *obr)
 
        for(i=0; i<obr->totvlak; i++){
                vlr=RE_findOrAddVlak(obr, i);
-               displace_render_face(re, vlr, scale);
+               displace_render_face(re, obr, vlr, scale);
        }
        
        /* Recalc vertex normals */
@@ -2297,7 +2291,6 @@ static void init_render_mball(Render *re, ObjectRen *obr)
        for(a=0; a<dl->parts; a++, index+=4) {
 
                vlr= RE_findOrAddVlak(obr, obr->totvlak++);
-               vlr->obr= obr;
                vlr->v1= RE_findOrAddVert(obr, index[0]);
                vlr->v2= RE_findOrAddVert(obr, index[1]);
                vlr->v3= RE_findOrAddVert(obr, index[2]);
@@ -2420,7 +2413,6 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
                        v4= RE_findOrAddVert(obr, p4);
                        
                        vlr= RE_findOrAddVlak(obr, obr->totvlak++);
-                       vlr->obr= obr;
                        vlr->v1= v1; vlr->v2= v2; vlr->v3= v3; vlr->v4= v4;
                        
                        flen= CalcNormFloat4(vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co, n1);
@@ -2642,7 +2634,6 @@ static void init_render_curve(Render *re, ObjectRen *obr, int only_verts)
                                for(a=0; a<dl->parts; a++, index+=3) {
 
                                        vlr= RE_findOrAddVlak(obr, obr->totvlak++);
-                                       vlr->obr = obr;
                                        vlr->v1= RE_findOrAddVert(obr, startvert+index[0]);
                                        vlr->v2= RE_findOrAddVert(obr, startvert+index[1]);
                                        vlr->v3= RE_findOrAddVert(obr, startvert+index[2]);
@@ -2706,7 +2697,6 @@ static void init_render_curve(Render *re, ObjectRen *obr, int only_verts)
 
                                                for(; b<dl->nr; b++) {
                                                        vlr= RE_findOrAddVlak(obr, obr->totvlak++);
-                                                       vlr->obr= obr;
                                                        vlr->v1= RE_findOrAddVert(obr, p2);
                                                        vlr->v2= RE_findOrAddVert(obr, p1);
                                                        vlr->v3= RE_findOrAddVert(obr, p3);
@@ -3086,7 +3076,6 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int only_verts)
                                                        flag= mface->flag & ME_SMOOTH;
 
                                                        vlr= RE_findOrAddVlak(obr, obr->totvlak++);
-                                                       vlr->obr= obr;
                                                        vlr->v1= RE_findOrAddVert(obr, vertofs+v1);
                                                        vlr->v2= RE_findOrAddVert(obr, vertofs+v2);
                                                        vlr->v3= RE_findOrAddVert(obr, vertofs+v3);
@@ -3167,7 +3156,6 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int only_verts)
                                                MVert *v1 = &mvert[medge->v2];
 
                                                vlr= RE_findOrAddVlak(obr, obr->totvlak++);
-                                               vlr->obr= obr;
                                                vlr->v1= RE_findOrAddVert(obr, vertofs+medge->v1);
                                                vlr->v2= RE_findOrAddVert(obr, vertofs+medge->v2);
                                                vlr->v3= vlr->v2;
@@ -3894,8 +3882,9 @@ static void find_dupli_instances(Render *re, ObjectRen *obr)
 {
        ObjectInstanceRen *obi;
        float imat[4][4], obmat[4][4], obimat[4][4], nmat[3][3];
+       int first = 1;
 
-       Mat4MulMat4(obmat, obr->ob->obmat, re->viewmat);
+       Mat4MulMat4(obmat, obr->obmat, re->viewmat);
        Mat4Invert(imat, obmat);
 
        for(obi=re->instancetable.last; obi; obi=obi->prev) {
@@ -3909,10 +3898,53 @@ static void find_dupli_instances(Render *re, ObjectRen *obr)
 
                        Mat3CpyMat4(nmat, obi->mat);
                        Mat3Inv(obi->imat, nmat);
+
+                       if(!first) {
+                               re->totvert += obr->totvert;
+                               re->totvlak += obr->totvlak;
+                               re->tothalo += obr->tothalo;
+                               re->totstrand += obr->totstrand;
+                       }
+                       else
+                               first= 0;
                }
        }
 }
 
+static void assign_dupligroup_dupli(Render *re, ObjectInstanceRen *obi, ObjectRen *obr)
+{
+       float imat[4][4], obmat[4][4], obimat[4][4], nmat[3][3];
+
+       Mat4MulMat4(obmat, obr->obmat, re->viewmat);
+       Mat4Invert(imat, obmat);
+
+       obi->obr= obr;
+
+       /* compute difference between object matrix and
+        * object matrix with dupli transform, in viewspace */
+       Mat4CpyMat4(obimat, obi->mat);
+       Mat4MulMat4(obi->mat, imat, obimat);
+
+       Mat3CpyMat4(nmat, obi->mat);
+       Mat3Inv(obi->imat, nmat);
+
+       re->totvert += obr->totvert;
+       re->totvlak += obr->totvlak;
+       re->tothalo += obr->tothalo;
+       re->totstrand += obr->totstrand;
+}
+
+static ObjectRen *find_dupligroup_dupli(Render *re, Object *ob, int psysindex)
+{
+       ObjectRen *obr;
+
+       for(obr=re->objecttable.first; obr; obr=obr->next)
+               if(obr->ob == ob && obr->psysindex == psysindex && (obr->flag & R_INSTANCEABLE))
+                       return obr;
+       
+       return NULL;
+}
+
 static void init_render_object_data(Render *re, ObjectRen *obr, int only_verts)
 {
        Object *ob= obr->ob;
@@ -3952,7 +3984,7 @@ static void init_render_object_data(Render *re, ObjectRen *obr, int only_verts)
        re->totstrand += obr->totstrand;
 }
 
-static void add_render_object(Render *re, Object *ob, Object *par, int index, int only_verts)
+static void add_render_object(Render *re, Object *ob, Object *par, int index, int only_verts, int instanceable)
 {
        ObjectRen *obr;
        ParticleSystem *psys;
@@ -3975,6 +4007,10 @@ static void add_render_object(Render *re, Object *ob, Object *par, int index, in
        /* one render object for the data itself */
        if(allow_render) {
                obr= RE_addRenderObject(re, ob, par, index, 0);
+               if(instanceable) {
+                       obr->flag |= R_INSTANCEABLE;
+                       Mat4CpyMat4(obr->obmat, ob->obmat);
+               }
                init_render_object_data(re, obr, only_verts);
 
                /* only add instance for objects that have not been used for dupli */
@@ -3989,6 +4025,10 @@ static void add_render_object(Render *re, Object *ob, Object *par, int index, in
                psysindex= 1;
                for(psys=ob->particlesystem.first; psys; psys=psys->next, psysindex++) {
                        obr= RE_addRenderObject(re, ob, par, index, psysindex);
+                       if(instanceable) {
+                               obr->flag |= R_INSTANCEABLE;
+                               Mat4CpyMat4(obr->obmat, ob->obmat);
+                       }
                        init_render_object_data(re, obr, only_verts);
                        psys_render_restore(ob, psys);
 
@@ -4003,7 +4043,7 @@ static void add_render_object(Render *re, Object *ob, Object *par, int index, in
 
 /* par = pointer to duplicator parent, needed for object lookup table */
 /* index = when duplicater copies same object (particle), the counter */
-static void init_render_object(Render *re, Object *ob, Object *par, int index, int only_verts)
+static void init_render_object(Render *re, Object *ob, Object *par, int index, int only_verts, int instanceable)
 {
        static double lasttime= 0.0;
        double time;
@@ -4012,7 +4052,7 @@ static void init_render_object(Render *re, Object *ob, Object *par, int index, i
        if(ob->type==OB_LAMP)
                add_render_lamp(re, ob);
        else if(render_object_type(ob->type))
-               add_render_object(re, ob, par, index, only_verts);
+               add_render_object(re, ob, par, index, only_verts, instanceable);
        else {
                MTC_Mat4MulMat4(mat, ob->obmat, re->viewmat);
                MTC_Mat4Invert(ob->imat, mat);
@@ -4141,7 +4181,7 @@ static int allow_render_object(Object *ob, int nolamps, int onlyselected, Object
 static int allow_render_dupli_instance(Render *re, DupliObject *dob, Object *obd)
 {
        return (render_object_type(obd->type) &&
-               (!(dob->type == OB_DUPLIGROUP)) &&
+               (!(dob->type == OB_DUPLIGROUP) || !dob->animated) &&
                !(re->r.mode & R_RADIO));
 }
 
@@ -4214,7 +4254,7 @@ static void database_init_objects(Render *re, unsigned int lay, int nolamps, int
                if(ob->flag & OB_DONE) {
                        if(ob->transflag & OB_RENDER_DUPLI)
                                if(allow_render_object(ob, nolamps, onlyselected, actob))
-                                       init_render_object(re, ob, NULL, 0, only_verts);
+                                       init_render_object(re, ob, NULL, 0, only_verts, 1);
                }
                else if((base->lay & lay) || (ob->type==OB_LAMP && (base->lay & re->scene->lay)) ) {
                        if((ob->transflag & OB_DUPLI) && (ob->type!=OB_MBALL)) {
@@ -4245,38 +4285,56 @@ static void database_init_objects(Render *re, unsigned int lay, int nolamps, int
 
                                        if(allow_render_dupli_instance(re, dob, obd)) {
                                                ParticleSystem *psys;
+                                               ObjectRen *obr = NULL;
                                                int psysindex;
                                                float mat[4][4];
 
-                                               Mat4MulMat4(mat, dob->mat, re->viewmat);
-                                               obi= RE_addRenderInstance(re, NULL, obd, ob, dob->index, 0, mat);
-                                               VECCOPY(obi->dupliorco, dob->orco);
-                                               obi->dupliuv[0]= dob->uv[0];
-                                               obi->dupliuv[1]= dob->uv[1];
+                                               if(dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, obd, 0))) {
+                                                       Mat4MulMat4(mat, dob->mat, re->viewmat);
+                                                       obi= RE_addRenderInstance(re, NULL, obd, ob, dob->index, 0, mat);
+
+                                                       if(dob->type != OB_DUPLIGROUP) {
+                                                               VECCOPY(obi->dupliorco, dob->orco);
+                                                               obi->dupliuv[0]= dob->uv[0];
+                                                               obi->dupliuv[1]= dob->uv[1];
+                                                       }
+                                                       else
+                                                               assign_dupligroup_dupli(re, obi, obr);
+                                               }
+                                               else
+                                                       init_render_object(re, obd, ob, dob->index, only_verts, !dob->animated);
 
                                                psysindex= 1;
                                                for(psys=obd->particlesystem.first; psys; psys=psys->next) {
-                                                       RE_addRenderInstance(re, NULL, obd, ob, dob->index, psysindex++, mat);
-                                                       VECCOPY(obi->dupliorco, dob->orco);
-                                                       obi->dupliuv[0]= dob->uv[0];
-                                                       obi->dupliuv[1]= dob->uv[1];
+                                                       if(dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, ob, psysindex))) {
+                                                               obi= RE_addRenderInstance(re, NULL, obd, ob, dob->index, psysindex++, mat);
+                                                               if(dob->type != OB_DUPLIGROUP) {
+                                                                       VECCOPY(obi->dupliorco, dob->orco);
+                                                                       obi->dupliuv[0]= dob->uv[0];
+                                                                       obi->dupliuv[1]= dob->uv[1];
+                                                               }
+                                                               else
+                                                                       assign_dupligroup_dupli(re, obi, obr);
+                                                       }
                                                }
                                                
-                                               obd->flag |= OB_DONE;
-                                               obd->transflag |= OB_RENDER_DUPLI;
+                                               if(dob->type != OB_DUPLIGROUP) {
+                                                       obd->flag |= OB_DONE;
+                                                       obd->transflag |= OB_RENDER_DUPLI;
+                                               }
                                        }
                                        else
-                                               init_render_object(re, obd, ob, dob->index, only_verts);
+                                               init_render_object(re, obd, ob, dob->index, only_verts, !dob->animated);
                                        
                                        if(re->test_break()) break;
                                }
                                free_object_duplilist(lb);
 
                                if(allow_render_object(ob, nolamps, onlyselected, actob))
-                                       init_render_object(re, ob, NULL, 0, only_verts);
+                                       init_render_object(re, ob, NULL, 0, only_verts, 0);
                        }
                        else if(allow_render_object(ob, nolamps, onlyselected, actob))
-                               init_render_object(re, ob, NULL, 0, only_verts);
+                               init_render_object(re, ob, NULL, 0, only_verts, 0);
                }
 
                if(re->test_break()) break;
index bcd6ed3aa0da9825e9cad81351dac0b1d8aa91a5..7d7ed5bcdce1992afbbf59974bc716956be97df7 100644 (file)
@@ -297,6 +297,7 @@ static void occ_face(const OccFace *face, float *co, float *normal, float *area)
 {
        ObjectInstanceRen *obi;
        VlakRen *vlr;
+       float v1[3], v2[3], v3[3], v4[3];
 
        obi= &R.objectinstance[face->obi];
        vlr= RE_findOrAddVlak(obi->obr, face->facenr);
@@ -330,11 +331,23 @@ static void occ_face(const OccFace *face, float *co, float *normal, float *area)
        }
 
        if(area) {
+               VECCOPY(v1, vlr->v1->co);
+               VECCOPY(v2, vlr->v2->co);
+               VECCOPY(v3, vlr->v3->co);
+               if(vlr->v4) VECCOPY(v4, vlr->v4->co);
+
+               if(obi->flag & R_TRANSFORMED) {
+                       Mat4MulVecfl(obi->mat, v1);
+                       Mat4MulVecfl(obi->mat, v2);
+                       Mat4MulVecfl(obi->mat, v3);
+                       if(vlr->v4) Mat4MulVecfl(obi->mat, v4);
+               }
+
                /* todo: correct area for instances */
                if(vlr->v4)
-                       *area= AreaQ3Dfl(vlr->v1->co, vlr->v2->co, vlr->v3->co, vlr->v4->co);
+                       *area= AreaQ3Dfl(v1, v2, v3, v4);
                else
-                       *area= AreaT3Dfl(vlr->v1->co, vlr->v2->co, vlr->v3->co);
+                       *area= AreaT3Dfl(v1, v2, v3);
        }
 }
 
@@ -458,6 +471,10 @@ static void occ_build_8_split(OcclusionTree *tree, int begin, int end, int *offs
 
        occ_build_split(tree, begin, end, &splitx);
 
+       /* force split if none found, to deal with degenerate geometry */
+       if(splitx == begin || splitx == end)
+               splitx= (begin+end)/2;
+
        occ_build_split(tree, begin, splitx, &splity[0]);
        occ_build_split(tree, splitx, end, &splity[1]);
 
@@ -576,9 +593,6 @@ static OcclusionTree *occ_tree_build(Render *re)
        /* count */
        totface= 0;
        for(obi=re->instancetable.first; obi; obi=obi->next) {
-               if(obi->flag & R_TRANSFORMED)
-                       continue;
-
                obr= obi->obr;
                for(a=0; a<obr->totvlak; a++) {
                        if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
@@ -612,9 +626,6 @@ static OcclusionTree *occ_tree_build(Render *re)
 
        /* make array of face pointers */
        for(b=0, c=0, obi=re->instancetable.first; obi; obi=obi->next, c++) {
-               if(obi->flag & R_TRANSFORMED)
-                       continue; /* temporary to avoid slow renders with loads of duplis */
-
                obr= obi->obr;
                for(a=0; a<obr->totvlak; a++) {
                        if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
index b8e3091ae4a55bde4c60a82fee689bf253f0c032..43f0a0d13e7d25443ac7fa8c66a563ccec896aa8 100644 (file)
@@ -2369,7 +2369,14 @@ void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra)
                                do_write_image_or_movie(re, scene, mh);
                        }
                
-                       if(G.afbreek==1) break;
+                       if(G.afbreek==1) {
+                               /* remove touched file */
+                               if (scene->r.mode & R_TOUCH && BLI_exist(name) && BLI_filepathsize(name) == 0) {
+                                       BLI_delete(name, 0, 0);
+                               }
+                               
+                               break;
+                       }
                }
        }
        
index 5038518e71ae6f5c51ce56fe64f703ffd8e53b15..e67cf6de6a1e3f7d022a499e9935d83061bc785a 100644 (file)
@@ -77,7 +77,7 @@ static void vlr_face_coords(RayFace *face, float **v1, float **v2, float **v3, f
        *v4 = (vlr->v4)? vlr->v4->co: NULL;
 }
 
-static int vlr_check_intersect(Isect *is, RayFace *face)
+static int vlr_check_intersect(Isect *is, int ob, RayFace *face)
 {
        VlakRen *vlr = (VlakRen*)face;
 
index 54e8e4cfab51a0d002371b636b23a1452f591e91..d18e22c3bfbdba5153a0012de20f582477cccb8f 100644 (file)
@@ -983,7 +983,7 @@ static int testnode(Octree *oc, Isect *is, Node *no, OcVal ocval, RayCheckFunc c
                
                        if(!(is->faceorig == face && is->oborig == ob)) {
 
-                               if(checkfunc(is, face)) {
+                               if(checkfunc(is, ob, face)) {
                                        
                                        ov= no->ov+nr;
                                        if( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) ) { 
@@ -1023,7 +1023,7 @@ static int testnode(Octree *oc, Isect *is, Node *no, OcVal ocval, RayCheckFunc c
                while(face) {
 
                        if(!(is->faceorig == face && is->oborig == ob)) {
-                               if(checkfunc(is, face)) {
+                               if(checkfunc(is, ob, face)) {
                                        ov= no->ov+nr;
                                        if( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) ) { 
                                                //accepted++;
@@ -1205,7 +1205,7 @@ int RE_ray_tree_intersect_check(RayTree *tree, Isect *is, RayCheckFunc checkfunc
        
                /* check with last intersected shadow face */
                if(is->face_last!=NULL && !(is->face_last==is->faceorig && is->ob_last==is->oborig)) {
-                       if(checkfunc(is, is->face_last)) {
+                       if(checkfunc(is, is->ob_last, is->face_last)) {
                                is->ob= is->ob_last;
                                is->face= is->face_last;
                                VECSUB(is->vec, is->end, is->start);
index e151151b0d21fa45749cbeadf0381c634984432b..46f94c81c63e06603892aa0fc612bbd36cbb6058 100644 (file)
@@ -1911,15 +1911,14 @@ static void bake_displacement(void *handle, ShadeInput *shi, Isect *isec, int di
        }
 }
 
-static int bake_check_intersect(Isect *is, RayFace *face)
+static int bake_check_intersect(Isect *is, int ob, RayFace *face)
 {
-       VlakRen *vlr = (VlakRen*)face;
        BakeShade *bs = (BakeShade*)is->userdata;
        
        /* no direction checking for now, doesn't always improve the result
         * (INPR(shi->facenor, bs->dir) > 0.0f); */
 
-       return (vlr->obr->ob != bs->actob);
+       return (R.objectinstance[ob].obr->ob != bs->actob);
 }
 
 static int bake_intersect_tree(RayTree* raytree, Isect* isect, float *dir, float sign, float *hitco)
index 34fd5b0154a44242af3a9430b804d20fbd5fc754..42086d078f67c7e04943f6d0bf1456bbd885bd0f 100644 (file)
@@ -288,7 +288,7 @@ static void shadowbuf_autoclip(Render *re, LampRen *lar)
        Material *ma= NULL;
        float minz, maxz, vec[3], viewmat[4][4], obviewmat[4][4];
        unsigned int lay = -1;
-       int i, a, ok= 1;
+       int i, a, maxtotvert, ok= 1;
        char *clipflag;
        
        minz= 1.0e30f; maxz= -1.0e30f;
@@ -296,7 +296,11 @@ static void shadowbuf_autoclip(Render *re, LampRen *lar)
        
        if(lar->mode & LA_LAYER) lay= lar->lay;
 
-       clipflag= MEM_callocN(sizeof(char)*re->totvert, "autoclipflag");
+       maxtotvert= 0;
+       for(obr=re->objecttable.first; obr; obr=obr->next)
+               maxtotvert= MAX2(obr->totvert, maxtotvert);
+
+       clipflag= MEM_callocN(sizeof(char)*maxtotvert, "autoclipflag");
 
        /* set clip in vertices when face visible */
        for(i=0, obi=re->instancetable.first; obi; i++, obi=obi->next) {
index 0ba7c09cdd8c53c179beb1d087d39ad701f0b011..1498683baab82d96349a2f269cdc0799500d5f45 100644 (file)
@@ -1228,6 +1228,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
                        Crossf(nstrand, vn, cross);
 
                        blend= INPR(nstrand, shi->surfnor);
+                       blend= 1.0f - blend;
                        CLAMP(blend, 0.0f, 1.0f);
 
                        VecLerpf(vnor, nstrand, shi->surfnor, blend);
index 605b381cdc06911a94512e524c9fb5a8222ad3ed..3a4f44b11d3eec4c50bbe0f905b9755d772783fe 100644 (file)
@@ -687,7 +687,6 @@ static void strand_shade_point(Render *re, ShadeSample *ssamp, StrandSegment *ss
        memset(&vlr, 0, sizeof(vlr));
        vlr.flag= R_SMOOTH;
        vlr.lay= sseg->strand->buffer->lay;
-       vlr.obr= sseg->strand->buffer->obr;
        if(sseg->buffer->ma->mode & MA_TANGENT_STR)
                vlr.flag |= R_TANGENT;
 
index be248ddda3f89d530650e13581a85eae44eb395f..612d7a2e0e784b069e2e13f25dc64f43e9fc9d8d 100644 (file)
@@ -1796,8 +1796,8 @@ void do_material_tex(ShadeInput *shi)
                                                                Mat4Mul3Vecfl(R.viewmat, nor);
                                                        }
                                                        else if(mtex->normapspace == MTEX_NSPACE_OBJECT) {
-                                                               if(shi->vlr && shi->vlr->obr->ob)
-                                                                       Mat4Mul3Vecfl(shi->vlr->obr->ob->obmat, nor);
+                                                               if(shi->obr && shi->obr->ob)
+                                                                       Mat4Mul3Vecfl(shi->obr->ob->obmat, nor);
                                                                Mat4Mul3Vecfl(R.viewmat, nor);
                                                        }
 
index 3779f2381028cc991e4b99681a45ab4283bdf6b6..2ad1f6bac5328af5840fcf18adf09e6a18e91fa7 100644 (file)
@@ -2762,6 +2762,37 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove)
        }
 }
 
+/* in: two vectors, first vector points from origin back in time, 2nd vector points to future */
+/* we make this into 3 points, center point is (0,0) */
+/* and offset the center point just enough to make curve go through midpoint */
+
+static void quad_bezier_2d(float *result, float *v1, float *v2, float *ipodata)
+{
+       float p1[2], p2[2], p3[2];
+       
+       p3[0]= -v2[0];
+       p3[1]= -v2[1];
+       
+       p1[0]= v1[0];
+       p1[1]= v1[1];
+       
+       /* official formula 2*p2 - .5*p1 - .5*p3 */
+       p2[0]= -0.5*p1[0] - 0.5*p3[0];
+       p2[1]= -0.5*p1[1] - 0.5*p3[1];
+       
+       result[0]= ipodata[0]*p1[0] + ipodata[1]*p2[0] + ipodata[2]*p3[0];
+       result[1]= ipodata[0]*p1[1] + ipodata[1]*p2[1] + ipodata[2]*p3[1];
+}
+
+static void set_quad_bezier_ipo(float fac, float *data)
+{
+       float mfac= (1.0f-fac);
+       
+       data[0]= mfac*mfac;
+       data[1]= 2.0f*mfac*fac;
+       data[2]= fac*fac;
+}
+
 void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *newrect, float *imgrect, float *vecbufrect, float *zbufrect)
 {
        ZSpan zspan;
@@ -2960,7 +2991,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
        samples/= 2;
        for(step= 1; step<=samples; step++) {
                float speedfac= 0.5f*nbd->fac*(float)step/(float)(samples+1);
-               float blendfac= 1.0f/(ABS(step)+1);
+               float blendfac= 1.0f/(ABS(step)+1), ipodata[4];
                int side, z= 4;
                
                for(side=0; side<2; side++) {
@@ -2985,23 +3016,41 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
                        dz2= rectvz + 5*(xsize + 1);
                        
                        if(side) {
-                               dz1+= 2;
-                               dz2+= 2;
-                               z= 2;
+                               if(nbd->curved==0) {
+                                       dz1+= 2;
+                                       dz2+= 2;
+                                       z= 2;
+                               }
                                speedfac= -speedfac;
                        }
-
+                       
+                       set_quad_bezier_ipo(0.5f + 0.5f*speedfac, ipodata);
+                       
                        for(fy= -0.5f+jit[step & 15][0], y=0; y<ysize; y++, fy+=1.0f) {
                                for(fx= -0.5f+jit[step & 15][1], x=0; x<xsize; x++, fx+=1.0f, dimg+=4, dz1+=5, dz2+=5, dm++) {
                                        if(*dm>1) {
                                                DrawBufPixel col;
                                                
                                                /* make vertices */
-                                               v1[0]= speedfac*dz1[0]+fx;                      v1[1]= speedfac*dz1[1]+fy;                      v1[2]= dz1[z];
-                                               v2[0]= speedfac*dz1[5]+fx+1.0f;         v2[1]= speedfac*dz1[6]+fy;                      v2[2]= dz1[z+5];
-                                               v3[0]= speedfac*dz2[5]+fx+1.0f;         v3[1]= speedfac*dz2[6]+fy+1.0f;         v3[2]= dz2[z+5];
-                                               v4[0]= speedfac*dz2[0]+fx;                      v4[1]= speedfac*dz2[1]+fy+1.0f;         v4[2]= dz2[z];
-                                               
+                                               if(nbd->curved) {       /* curved */
+                                                       quad_bezier_2d(v1, dz1, dz1+2, ipodata);
+                                                       v1[0]+= fx; v1[1]+= fy; v1[2]= dz1[4];
+
+                                                       quad_bezier_2d(v2, dz1+5, dz1+5+2, ipodata);
+                                                       v2[0]+= fx+1.0f; v2[1]+= fy; v2[2]= dz1[4+5];
+
+                                                       quad_bezier_2d(v3, dz2+5, dz2+5+2, ipodata);
+                                                       v3[0]+= fx+1.0f; v3[1]+= fy+1.0f; v3[2]= dz1[4+5];
+                                                       
+                                                       quad_bezier_2d(v4, dz2, dz2+2, ipodata);
+                                                       v4[0]+= fx; v4[1]+= fy+1.0f; v4[2]= dz2[4];
+                                               }
+                                               else {
+                                                       v1[0]= speedfac*dz1[0]+fx;                      v1[1]= speedfac*dz1[1]+fy;                      v1[2]= dz1[z];
+                                                       v2[0]= speedfac*dz1[5]+fx+1.0f;         v2[1]= speedfac*dz1[6]+fy;                      v2[2]= dz1[z+5];
+                                                       v3[0]= speedfac*dz2[5]+fx+1.0f;         v3[1]= speedfac*dz2[6]+fy+1.0f;         v3[2]= dz2[z+5];
+                                                       v4[0]= speedfac*dz2[0]+fx;                      v4[1]= speedfac*dz2[1]+fy+1.0f;         v4[2]= dz2[z];
+                                               }
                                                if(*dm==255) col.alpha= 1.0f;
                                                else if(*dm<2) col.alpha= 0.0f;
                                                else col.alpha= ((float)*dm)/255.0f;
index 0cacb98490bd7f663789e3e7655b482e4d43f920..ddecbac1b8d3be0e8bea0dfb5706ff9c739d90fe 100644 (file)
@@ -3868,42 +3868,18 @@ void do_armbuts(unsigned short event)
                        }
                }
                break;
+               
        case B_POSEGRP_RECALC:
                allqueue(REDRAWVIEW3D, 0);
                allqueue(REDRAWBUTSEDIT, 0);
                break;
        case B_POSEGRP_ADD:
-               if (ob && ob->pose) {
-                       bPose *pose= ob->pose;
-                       bActionGroup *grp;
-                       
-                       grp= MEM_callocN(sizeof(bActionGroup), "PoseGroup");
-                       strcpy(grp->name, "Group");
-                       BLI_addtail(&pose->agroups, grp);
-                       BLI_uniquename(&pose->agroups, grp, "Group", offsetof(bActionGroup, name), 32);
-                       
-                       pose->active_group= BLI_countlist(&pose->agroups);
-                       
-                       BIF_undo_push("Add Pose Group");
-                       allqueue(REDRAWBUTSEDIT, 0);
-                       allqueue(REDRAWVIEW3D, 0);
-               }
+               if (ob && ob->pose)
+                       pose_add_posegroup();
                break;
        case B_POSEGRP_REMOVE:
-               if (ob && ob->pose && ob->pose->active_group) {
-                       bPose *pose= ob->pose;
-                       bActionGroup *grp= NULL;
-                       
-                       grp= BLI_findlink(&pose->agroups, pose->active_group-1);
-                       if (grp) {
-                               BLI_freelinkN(&pose->agroups, grp);
-                               pose->active_group= 0;
-                       }
-                       
-                       BIF_undo_push("Remove Pose Group");
-                       allqueue(REDRAWBUTSEDIT, 0);
-                       allqueue(REDRAWVIEW3D, 0);
-               }
+               if (ob && ob->pose)
+                       pose_remove_posegroup();
                break;
        }
 }
@@ -4335,37 +4311,6 @@ static int ob_arm_bone_pchan_lock(Object *ob, bArmature *arm, Bone *bone, bPoseC
        return 0;
 }
 
-static char *build_posegroups_menustr(bPose *pose)
-{
-       DynStr *pupds= BLI_dynstr_new();
-       bActionGroup *agrp;
-       char *str;
-       char buf[16];
-       int i;
-       
-       /* add title first (and the "none" entry) */
-       BLI_dynstr_append(pupds, "Pose Group%t|");
-       BLI_dynstr_append(pupds, "BG: [None]%x0");
-       
-       /* loop through markers, adding them */
-       for (agrp= pose->agroups.first, i=1; agrp; agrp=agrp->next, i++) {
-               BLI_dynstr_append(pupds, "BG: ");
-               BLI_dynstr_append(pupds, agrp->name);
-               
-               sprintf(buf, "%%x%d", i);
-               BLI_dynstr_append(pupds, buf);
-               
-               if (agrp->next)
-                       BLI_dynstr_append(pupds, "|");
-       }
-       
-       /* convert to normal MEM_malloc'd string */
-       str= BLI_dynstr_get_cstring(pupds);
-       BLI_dynstr_free(pupds);
-       
-       return str;
-}
-
 static void editing_panel_pose_bones(Object *ob, bArmature *arm)
 {
        uiBlock         *block;
@@ -4400,8 +4345,8 @@ static void editing_panel_pose_bones(Object *ob, bArmature *arm)
                        uiButSetCompleteFunc(but, autocomplete_bone, (void *)ob);
                        
                        /* Bone custom drawing */
-                       menustr= build_posegroups_menustr(ob->pose);
-                       uiDefButS(block, MENU,REDRAWVIEW3D, menustr, 107,by,105,19, &pchan->agrp_index, 0.0, 0.0, 0.0, 0.0, "Change the Pose Group this Bone belongs to");
+                       menustr= build_posegroups_menustr(ob->pose, 0);
+                       uiDefButS(block, MENU,REDRAWVIEW3D, menustr, 107,by,105,19, &pchan->agrp_index, 0, 0.0, 0.0, 0.0, "Change the Pose Group this Bone belongs to");
                        MEM_freeN(menustr);
                        
                        ob_arm_bone_pchan_lock(ob, arm, curBone, pchan);
@@ -5223,7 +5168,7 @@ static void editing_panel_links(Object *ob)
                                uiBlockBeginAlign(block);
                                        /* currently 'active' group - browse groups */
                                        count= BLI_countlist(&pose->agroups);
-                                       menustr= build_posegroups_menustr(pose);
+                                       menustr= build_posegroups_menustr(pose, 0);
                                        uiDefButI(block, MENU, B_POSEGRP_RECALC, menustr, xco, 85,18,20, &pose->active_group, 1, count, 0, 0, "Browses Pose Groups available for Armature. Click to change.");
                                        MEM_freeN(menustr);
                                        
@@ -5232,7 +5177,7 @@ static void editing_panel_links(Object *ob)
                                                bActionGroup *grp= (bActionGroup *)BLI_findlink(&pose->agroups, pose->active_group-1);
                                                
                                                /* active group */
-                                               but= uiDefBut(block, TEX, REDRAWBUTSEDIT,"",            xco+18,85,140-18-20,20, grp->name, 0, 63, 0, 0, "Displays current Pose Group name. Click to change.");
+                                               but= uiDefBut(block, TEX, REDRAWBUTSEDIT,"",            xco+18,85,140-18-20,20, grp->name, 0, 31, 0, 0, "Displays current Pose Group name. Click to change.");
                                                uiButSetFunc(but, verify_posegroup_groupname, pose, grp); 
                                                uiDefIconBut(block, BUT, B_POSEGRP_REMOVE, VICON_X, xco+140-20, 85, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Remove this Pose Group");
                                                
index 90f7dab0a588b15c65e50447942201bc946ecd54..7f62c5b3308af8efdc9b77695b741681b988a145 100644 (file)
@@ -1346,7 +1346,7 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
                                bRotLimitConstraint *data = con->data;
                                int normButWidth = (width/3);
                                
-                               height = 106; 
+                               height = 136; 
                                
                                uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, ""); 
                                
@@ -1369,8 +1369,11 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
                                        uiDefButF(block, NUM, B_CONSTRAINT_TEST, "max:", *xco+(normButWidth * 2), *yco-72, normButWidth, 18, &(data->zmax), -360, 360, 0.1,0.5,"Highest z value to allow"); 
                                uiBlockEndAlign(block); 
                                
+                               /* special option(s) */
+                               uiDefButBitS(block, TOG, LIMIT_TRANSFORM, B_CONSTRAINT_TEST, "For Transform", *xco+(width/4), *yco-100, (width/2), 18, &data->flag2, 0, 24, 0, 0, "Transforms are affected by this constraint as well"); 
+                               
                                /* constraint space settings */
-                               draw_constraint_spaceselect(block, con, *xco, *yco-100, is_armature_owner(ob), -1);
+                               draw_constraint_spaceselect(block, con, *xco, *yco-130, is_armature_owner(ob), -1);
                        }
                        break;
                case CONSTRAINT_TYPE_SIZELIMIT:
@@ -2445,9 +2448,16 @@ static void object_panel_object(Object *ob)
                uiNewPanelHeight(block, 204 - (120-yco));
 }
 
+static void object_panel_anim_timeoffset_callback( void *data, void *timeoffset_ui) {
+       Object *ob = (Object *)data;
+       ob->sf = (*(float *)timeoffset_ui) - (give_timeoffset(ob) - ob->sf);
+}
+
 static void object_panel_anim(Object *ob)
 {
        uiBlock *block;
+       uiBut *but;
+       static float timeoffset_ui;
        char str[32];
        
        block= uiNewBlock(&curarea->uiblocks, "object_panel_anim", UI_EMBOSS, UI_HELV, curarea->win);
@@ -2499,7 +2509,11 @@ static void object_panel_anim(Object *ob)
        uiBlockEndAlign(block);
        
        uiBlockBeginAlign(block);
-       uiDefButF(block, NUM, REDRAWALL, "TimeOffset:",                 24,35,115,20, &ob->sf, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Animation offset in frames for ipo's and dupligroup instances");
+       
+       timeoffset_ui = give_timeoffset(ob);
+       but = uiDefButF(block, NUM, REDRAWALL, "TimeOffset:",                   24,35,115,20, &timeoffset_ui, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Animation offset in frames for ipo's and dupligroup instances");
+       uiButSetFunc(but, object_panel_anim_timeoffset_callback, ob, &timeoffset_ui);
+       
        uiDefBut(block, BUT, B_AUTOTIMEOFS, "Auto",     139,35,34,20, 0, 0, 0, 0, 0, "Assign selected objects a timeoffset within a range, starting from the active object");
        uiDefBut(block, BUT, B_OFSTIMEOFS, "Ofs",       173,35,34,20, 0, 0, 0, 0, 0, "Offset selected objects timeoffset");
        uiDefBut(block, BUT, B_RANDTIMEOFS, "Rand",     207,35,34,20, 0, 0, 0, 0, 0, "Randomize selected objects timeoffset");
index c3209dfa8148819726d1bed85d480344a9defd6f..0dc6c485db5eeaf24029b6f3ddbd96eb328dae3a 100644 (file)
@@ -1837,8 +1837,8 @@ static void render_panel_output(void)
        uiBlockEndAlign(block);
        
        uiBlockBeginAlign(block);
-       uiDefButBitI(block, TOG, R_NO_OVERWRITE, B_NOP, "No Overwrite", 10, 142, 90, 20, &G.scene->r.mode, 0.0, 0.0, 0, 0, "Skip rendering frames when the file exists (image output only)");
-       uiDefButBitI(block, TOG, R_TOUCH, B_NOP, "Touch", 100, 142, 50, 20, &G.scene->r.mode, 0.0, 0.0, 0, 0, "Create an empty file before rendering each frame");
+       uiDefButBitI(block, TOG, R_TOUCH, B_NOP, "Touch", 10, 142, 50, 20, &G.scene->r.mode, 0.0, 0.0, 0, 0, "Create an empty file before rendering each frame, remove if cancelled (and empty)");
+       uiDefButBitI(block, TOG, R_NO_OVERWRITE, B_NOP, "No Overwrite", 60, 142, 90, 20, &G.scene->r.mode, 0.0, 0.0, 0, 0, "Skip rendering frames when the file exists (image output only)");
        uiBlockEndAlign(block);
        
        /* SET BUTTON */
@@ -1873,6 +1873,8 @@ static void render_panel_output(void)
        uiDefButS(block, MENU, B_REDR, "Render Display %t|Render Window %x1|Image Editor %x0|Full Screen %x2",  
                                        72, 10, 120, 19, &G.displaymode, 0.0, (float)R_DISPLAYWIN, 0, 0, "Sets render output display");
 
+       uiDefButBitS(block, TOG, R_EXTENSION, B_NOP, "Extensions", 205, 10, 105, 19, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Adds filetype extensions to the filename when rendering animations");
+       
        /* Dither control */
        uiDefButF(block, NUM,B_DIFF, "Dither:",         205,31,105,19, &G.scene->r.dither_intensity, 0.0, 2.0, 0, 0, "The amount of dithering noise present in the output image (0.0 = no dithering)");
        
index 6a1744dccac1e806b3679a76abd82234642289ca..c94df84c7f7c8f10294c77c37043eec9f427006f 100644 (file)
@@ -521,6 +521,10 @@ void view2d_zoom(View2D *v2d, float factor, int winx, int winy)
        view2d_do_locks(curarea, V2D_LOCK_COPY);
 }
 
+void view2d_getscale(View2D *v2d, float *x, float *y) {
+       if (x) *x = (G.v2d->mask.xmax-G.v2d->mask.xmin)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
+       if (y) *y = (G.v2d->mask.ymax-G.v2d->mask.ymin)/(G.v2d->cur.ymax-G.v2d->cur.ymin);
+}
 
 void test_view2d(View2D *v2d, int winx, int winy)
 {
index 3e93b46c1cbe71a58d1e56761f437ab3f2c9442f..3f2326a9a93043d782e1aabb9967b42a28255e09 100644 (file)
@@ -1429,19 +1429,23 @@ static int node_composit_buts_vecblur(uiBlock *block, bNodeTree *ntree, bNode *n
                
                uiBlockBeginAlign(block);
                uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Samples:",
-                                butr->xmin, dy+57, dx, 19, 
+                                butr->xmin, dy+76, dx, 19, 
                                 &nbd->samples, 1, 256, 0, 0, "Amount of samples");
                uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "MinSpeed:",
-                                 butr->xmin, dy+38, dx, 19, 
+                                 butr->xmin, dy+57, dx, 19, 
                                  &nbd->minspeed, 0, 1024, 0, 0, "Minimum speed for a pixel to be blurred, used to separate background from foreground");
                uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "MaxSpeed:",
-                                 butr->xmin, dy+19, dx, 19, 
+                                 butr->xmin, dy+38, dx, 19, 
                                  &nbd->maxspeed, 0, 1024, 0, 0, "If not zero, maximum speed in pixels");
                uiDefButF(block, NUM, B_NODE_EXEC+node->nr, "BlurFac:",
-                                 butr->xmin, dy, dx, 19, 
+                                 butr->xmin, dy+19, dx, 19, 
                                  &nbd->fac, 0.0f, 2.0f, 10, 2, "Scaling factor for motion vectors, actually 'shutter speed' in frames");
+               uiDefButS(block, TOG, B_NODE_EXEC+node->nr, "Curved",
+                                 butr->xmin, dy, dx, 19, 
+                                 &nbd->curved, 0.0f, 2.0f, 10, 2, "Interpolate between frames in a bezier curve, rather than linearly");
+               uiBlockEndAlign(block);
        }
-       return 76;
+       return 95;
 }
 
 static int node_composit_buts_filter(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
index 52aba50c9cdf604f75ade4721567205129f0eefa..ea1ea5a68b110af60e9620891e2461ed09a2f29a 100644 (file)
@@ -132,8 +132,7 @@ static void draw_cfra_time(SpaceTime *stime)
                glColor4ub(0, 0, 0, 0);
                BIF_ThemeColor(TH_TEXT);
                
-               xscale = (G.v2d->mask.xmax-G.v2d->mask.xmin)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
-               yscale = (G.v2d->mask.ymax-G.v2d->mask.ymin)/(G.v2d->cur.ymax-G.v2d->cur.ymin);
+               view2d_getscale(G.v2d, &xscale, &yscale);
                
                /* because the frame number text is subject to the same scaling as the contents of the view */
                glScalef( 1.0/xscale, 1.0/yscale, 1.0);
@@ -157,9 +156,8 @@ static void draw_marker(TimeMarker *marker, int flag)
        /* no time correction for framelen! space is drawn with old values */
        
        ypixels= G.v2d->mask.ymax-G.v2d->mask.ymin;
-       xscale = (G.v2d->mask.xmax-G.v2d->mask.xmin)/(G.v2d->cur.xmax-G.v2d->cur.xmin);
-       yscale = (G.v2d->mask.ymax-G.v2d->mask.ymin)/(G.v2d->cur.ymax-G.v2d->cur.ymin);
-
+       view2d_getscale(G.v2d, &xscale, &yscale);
+       
        glScalef( 1.0/xscale, 1.0/yscale, 1.0);
        
        glEnable(GL_BLEND);
index cb436e8bff167d4a385df2df68e82cc2f9709b88..95192e42a5d436062f7e4a5ca16faabe734d8920 100644 (file)
@@ -812,6 +812,17 @@ static void action_groups_addachan (bAction *act, bActionGroup *agrp, bActionCha
        if (ELEM3(NULL, act, agrp, achan))
                return;
        
+       /* if no channels, just add to two lists at the same time */
+       if (act->chanbase.first == NULL) {
+               achan->next = achan->prev = NULL;
+               
+               agrp->channels.first = agrp->channels.last = achan;
+               act->chanbase.first = act->chanbase.last = achan;
+               
+               achan->grp= agrp;
+               return;
+       }
+       
        /* try to find a channel to slot this in before/after */
        for (chan= act->chanbase.first; chan; chan= chan->next) {
                /* if channel has no group, then we have ungrouped channels, which should always occur after groups */
@@ -970,12 +981,14 @@ void action_groups_group (short add_group)
                
                /* make sure not already in new-group */
                if (achan->grp != agrp) {
-                       if (VISIBLE_ACHAN(achan) && SEL_ACHAN(achan)) {
-                               /* unlink from everything else */
-                               action_groups_removeachan(act, achan);
-                               
-                               /* add to end of group's channels */
-                               action_groups_addachan(act, agrp, achan);
+                       if ((achan->grp) && (EXPANDED_AGRP(achan->grp))) { 
+                               if (VISIBLE_ACHAN(achan) && SEL_ACHAN(achan)) {
+                                       /* unlink from everything else */
+                                       action_groups_removeachan(act, achan);
+                                       
+                                       /* add to end of group's channels */
+                                       action_groups_addachan(act, agrp, achan);
+                               }
                        }
                }
        }
@@ -1025,6 +1038,59 @@ void action_groups_ungroup (void)
        allqueue(REDRAWACTION, 0);
 }
 
+/* This function is used when inserting keyframes for pose-channels. It assigns the
+ * action-channel with the nominated name to a group with the same name as that of 
+ * the pose-channel with the nominated name.
+ *
+ * Note: this function calls validate_action_channel if action channel doesn't exist 
+ */
+void verify_pchan2achan_grouping (bAction *act, bPose *pose, char name[])
+{
+       bActionChannel *achan;
+       bPoseChannel *pchan;
+       
+       /* sanity checks */
+       if (ELEM3(NULL, act, pose, name))
+               return;
+       if (name[0] == 0)
+               return;
+               
+       /* try to get the channels */
+       pchan= get_pose_channel(pose, name);
+       if (pchan == NULL) return;
+       achan= verify_action_channel(act, name);
+       
+       /* check if pchan has a group */
+       if ((pchan->agrp_index) && (achan->grp == NULL)) {
+               bActionGroup *agrp, *grp=NULL;
+               
+               /* get group to try to be like */
+               agrp= (bActionGroup *)BLI_findlink(&pose->agroups, (pchan->agrp_index - 1));
+               if (agrp == NULL) {
+                       error("PoseChannel has invalid group!");
+                       return;
+               }
+               
+               /* try to find a group which is similar to the one we want (or add one) */
+               for (grp= act->groups.first; grp; grp= grp->next) {
+                       if (!strcmp(grp->name, agrp->name))
+                               break;
+               }
+               if (grp == NULL) {
+                       grp= MEM_callocN(sizeof(bActionGroup), "bActionGroup");
+                       
+                       grp->flag |= (AGRP_ACTIVE|AGRP_SELECTED|AGRP_EXPANDED);
+                       sprintf(grp->name, agrp->name);
+                       
+                       BLI_addtail(&act->groups, grp);
+               }
+               
+               /* make sure this channel is definitely not connected to anything before adding to group */
+               action_groups_removeachan(act, achan);
+               action_groups_addachan(act, grp, achan);
+       }
+}
+
 /* **************************************************** */
 /* TRANSFORM TOOLS */
 
@@ -3494,6 +3560,7 @@ void rearrange_action_channels (short mode)
        short datatype;
        
        short (*rearrange_func)(ListBase *, Link *, short);
+       short do_channels = 1;
        char undostr[60];
        
        /* Get the active action, exit if none are selected */
@@ -3527,7 +3594,7 @@ void rearrange_action_channels (short mode)
        /* make sure we're only operating with groups */
        split_groups_action_temp(act, &tgrp);
        
-       /* rearrange groups, and channels */
+       /* rearrange groups first (and then, only consider channels if the groups weren't moved) */
        #define GET_FIRST(list) ((mode > 0) ? (list.first) : (list.last))
        #define GET_NEXT(item) ((mode > 0) ? (item->next) : (item->prev))
        
@@ -3536,18 +3603,27 @@ void rearrange_action_channels (short mode)
                grp= GET_NEXT(agrp);
                
                /* try to do group first */
-               if (rearrange_func(&act->groups, (Link *)agrp, ACTTYPE_GROUP))
+               if (rearrange_func(&act->groups, (Link *)agrp, ACTTYPE_GROUP)) {
+                       do_channels= 0;
                        agrp->flag |= AGRP_MOVED;
+               }
+       }
+       
+       if (do_channels) {
+               for (agrp= GET_FIRST(act->groups); agrp; agrp= grp) {
+                       /* Get next group to consider */
+                       grp= GET_NEXT(agrp);
                        
-               /* only consider action-channels if they're visible (group expanded) */
-               if (EXPANDED_AGRP(agrp)) {
-                       for (achan= GET_FIRST(agrp->channels); achan; achan= chan) {
-                               /* Get next channel to consider */
-                               chan= GET_NEXT(achan);
-                               
-                               /* Try to do channel */
-                               if (rearrange_func(&agrp->channels, (Link *)achan, ACTTYPE_ACHAN))
-                                       achan->flag |= ACHAN_MOVED;
+                       /* only consider action-channels if they're visible (group expanded) */
+                       if (EXPANDED_AGRP(agrp)) {
+                               for (achan= GET_FIRST(agrp->channels); achan; achan= chan) {
+                                       /* Get next channel to consider */
+                                       chan= GET_NEXT(achan);
+                                       
+                                       /* Try to do channel */
+                                       if (rearrange_func(&agrp->channels, (Link *)achan, ACTTYPE_ACHAN))
+                                               achan->flag |= ACHAN_MOVED;
+                               }
                        }
                }
        }
index 612d9f59b9252e3fe9a7346da2af66a48731bf43..93ddb57ea66a414c88988350b253e2f8752ba9da 100644 (file)
@@ -1477,10 +1477,10 @@ void mouse_select_ipo(void)
        
        if(G.sipo->showkey) {
                float pixelwidth;
-               pixelwidth= (G.v2d->cur.xmax-G.v2d->cur.xmin)/(G.v2d->mask.xmax-G.v2d->mask.xmin); /* could make a generic function */
                
-               getmouseco_areawin(mval);
+               view2d_getscale(G.v2d, &pixelwidth, NULL);
                
+               getmouseco_areawin(mval);
                areamouseco_to_ipoco(G.v2d, mval, &x, &y);
                actik= 0;
                mindist= 1000.0;
@@ -1802,6 +1802,10 @@ Ipo *verify_ipo(ID *from, short blocktype, char *actname, char *constname, char
                achan= verify_action_channel(ob->action, actname);
                
                if(achan) {
+                       /* automatically assign achan to act-group based on pchan's grouping */
+                       if (blocktype == ID_PO)
+                       verify_pchan2achan_grouping(ob->action, ob->pose, actname);
+                       
                        /* constraint exception */
                        if(blocktype==ID_CO) {
                                bConstraintChannel *conchan= verify_constraint_channel(&achan->constraintChannels, constname);
index d07d733ce90c4ccdf6e2610f668eb97c98bf3f51..5d511b3563334a1959993721e4e18f7909179e59 100644 (file)
@@ -3690,7 +3690,7 @@ void seq_mute_sel(int mute) {
        Sequence *seq;
        
        ed= G.scene->ed;
-       if(!ed) return NULL;
+       if(!ed) return;
        
        for(seq= ed->seqbasep->first; seq; seq= seq->next) {
                if ((seq->flag & SELECT) && (seq->flag & SEQ_LOCK)==0) {
index 6e3686259da14b23a553d9227033e4bee94a9e0c..93e39cba6eb83ac2eed58318e78af46caff22593 100644 (file)
@@ -64,6 +64,7 @@
 #include "BLI_blenlib.h"
 #include "BLI_arithb.h"
 #include "BLI_editVert.h"
+#include "BLI_rand.h" /* random object selection */
 
 #include "BKE_armature.h"
 #include "BKE_depsgraph.h"
@@ -1046,6 +1047,31 @@ void selectswap(void)
        BIF_undo_push("Select Inverse");
 }
 
+/* inverts object selection */
+void selectrandom(void)
+{
+       Base *base;
+       static short randfac = 50;
+       if(button(&randfac,0, 100,"Percentage:")==0) return;
+       
+       for(base= FIRSTBASE; base; base= base->next) {
+               if(base->lay & G.vd->lay &&
+                 (base->object->restrictflag & OB_RESTRICT_VIEW)==0
+               ) {
+                       if (!TESTBASE(base) && ( (BLI_frand() * 100) < randfac)) {
+                               select_base_v3d(base, BA_SELECT);
+                               base->object->flag= base->flag;
+                       }
+               }
+       }
+
+       allqueue(REDRAWVIEW3D, 0);
+       allqueue(REDRAWDATASELECT, 0);
+       allqueue(REDRAWNLA, 0);
+       
+       countall();
+       BIF_undo_push("Select Random");
+}
 
 /* selects all objects of a particular type, on currently visible layers */
 void selectall_type(short obtype) 
index 1c39d286989eb326619e05540ec6dde370e38378..f7cf9dd22cd840c6ee914ee832bced41c2851f93 100644 (file)
@@ -914,6 +914,9 @@ void do_view3d_select_objectmenu(void *arg, int event)
        case 2: /* inverse */
                selectswap();
                break;
+       case 3: /* random */
+               selectrandom();
+               break;
        }
        allqueue(REDRAWVIEW3D, 0);
 }
@@ -932,6 +935,8 @@ static uiBlock *view3d_select_objectmenu(void *arg_unused)
        
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A",                  0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Inverse",                                                0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Random",                                                 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
+       
        uiDefIconTextBlockBut(block, view3d_select_object_layermenu, NULL, ICON_RIGHTARROW_THIN, "Select All by Layer", 0, yco-=20, 120, 19, "");
        uiDefIconTextBlockBut(block, view3d_select_object_typemenu, NULL, ICON_RIGHTARROW_THIN, "Select All by Type", 0, yco-=20, 120, 19, "");
                
@@ -4039,6 +4044,42 @@ static uiBlock *view3d_pose_armature_constraintsmenu(void *arg_unused)
        return block;
 }
 
+static void do_view3d_pose_armature_groupmenu(void *arg, int event)
+{
+       switch (event) {
+               case 1:
+                       pose_assign_to_posegroup();
+                       break;
+               case 2:
+                       pose_add_posegroup();
+                       break;
+               case 3:
+                       pose_remove_from_posegroups();
+                       break;
+               case 4:
+                       pose_remove_posegroup();
+                       break;
+       }
+}
+
+static uiBlock *view3d_pose_armature_groupmenu(void *arg_unused)
+{
+       uiBlock *block;
+       short yco = 20, menuwidth = 120;
+       
+       block= uiNewBlock(&curarea->uiblocks, "view3d_pose_armature_groupmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
+       uiBlockSetButmFunc(block, do_view3d_pose_armature_groupmenu, NULL);
+       
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Selected to Group|Ctrl G, 1",        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add New Group|Ctrl G, 2",        0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Remove from All Groups|Ctrl G, 3",       0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Remove Active Group|Ctrl G, 4",  0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
+       
+       uiBlockSetDirection(block, UI_RIGHT);
+       uiTextBoundsBlock(block, 60);
+       return block;
+}
+
 static void do_view3d_pose_armature_motionpathsmenu(void *arg, int event)
 {
        
@@ -4193,6 +4234,8 @@ static uiBlock *view3d_pose_armaturemenu(void *arg_unused)
        
        uiDefIconTextBlockBut(block, view3d_pose_armature_poselibmenu, NULL, ICON_RIGHTARROW_THIN, "Pose Library", 0, yco-=20, 120, 19, "");
        uiDefIconTextBlockBut(block, view3d_pose_armature_motionpathsmenu, NULL, ICON_RIGHTARROW_THIN, "Motion Paths", 0, yco-=20, 120, 19, "");
+       uiDefIconTextBlockBut(block, view3d_pose_armature_groupmenu, NULL, ICON_RIGHTARROW_THIN, "Bone Groups", 0, yco-=20, 120, 19, "");
+       uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
        uiDefIconTextBlockBut(block, view3d_pose_armature_ikmenu, NULL, ICON_RIGHTARROW_THIN, "Inverse Kinematics", 0, yco-=20, 120, 19, "");
        uiDefIconTextBlockBut(block, view3d_pose_armature_constraintsmenu, NULL, ICON_RIGHTARROW_THIN, "Constraints", 0, yco-=20, 120, 19, "");
        
index 5907d3cd7c3db7a50a7438ccf4db36bb7aed6c07..2fa85c56b04c0e39889005037f89c0bf871afc1a 100644 (file)
@@ -398,7 +398,7 @@ static void heat_ray_coords_func(RayFace *face, float **v1, float **v2, float **
        *v4= (mface->v4)? verts[mface->v4]: NULL;
 }
 
-static int heat_ray_check_func(Isect *is, RayFace *face)
+static int heat_ray_check_func(Isect *is, int ob, RayFace *face)
 {
        float *v1, *v2, *v3, *v4, nor[3];
 
index ed910607040842c98588df4a110cec2b53c2cfac..63f39608f5d75ff052b396851c83f5f449198857 100644 (file)
@@ -1919,7 +1919,7 @@ static int do_outliner_mouse_event(SpaceOops *soops, TreeElement *te, short even
                        /* activate a name button? */
                        if(event==LEFTMOUSE) {
                        
-                               if (G.qual & LR_CTRLKEY) {
+                               if (G.qual == LR_CTRLKEY) {
                                        if(ELEM8(tselem->type, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE, TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_R_LAYER_BASE, TSE_R_PASS)) 
                                                error("Cannot edit builtin name");
                                        else if(tselem->id->lib) {
@@ -1930,12 +1930,6 @@ static int do_outliner_mouse_event(SpaceOops *soops, TreeElement *te, short even
                                                tselem->flag |= TSE_TEXTBUT;
                                        }
                                } else {
-                                       
-                                       if (G.qual & LR_SHIFTKEY) {
-                                               if(tselem->id->lib && tselem->type==0) {
-                                                       notice(tselem->id->lib->name);
-                                               }
-                                       }
                                        /* always makes active object */
                                        tree_element_active_object(soops, te);
                                        
index cdcb86af23927092e48bff856175ed66f0a5fd93..42640465e1201e5234673cdc5af76b7d0bd008d1 100644 (file)
  */
 
 #include <stdlib.h>
+#include <stddef.h>
 #include <string.h>
 
 #include "MEM_guardedalloc.h"
 
 #include "BLI_arithb.h"
 #include "BLI_blenlib.h"
+#include "BLI_dynstr.h"
 
 #include "DNA_action_types.h"
 #include "DNA_armature_types.h"
@@ -909,6 +911,218 @@ void pose_adds_vgroups(Object *meshobj, int heatweights)
 
 /* ********************************************** */
 
+/* adds a new pose-group */
+void pose_add_posegroup ()
+{
+       Object *ob= OBACT;
+       bPose *pose= (ob) ? ob->pose : NULL;
+       bActionGroup *grp;
+       
+       if (ELEM(NULL, ob, ob->pose))
+               return;
+       
+       grp= MEM_callocN(sizeof(bActionGroup), "PoseGroup");
+       strcpy(grp->name, "Group");
+       BLI_addtail(&pose->agroups, grp);
+       BLI_uniquename(&pose->agroups, grp, "Group", offsetof(bActionGroup, name), 32);
+       
+       pose->active_group= BLI_countlist(&pose->agroups);
+       
+       BIF_undo_push("Add Bone Group");
+       
+       allqueue(REDRAWBUTSEDIT, 0);
+       allqueue(REDRAWVIEW3D, 0);
+}
+
+/* Remove the active bone-group */
+void pose_remove_posegroup ()
+{
+       Object *ob= OBACT;
+       bPose *pose= (ob) ? ob->pose : NULL;
+       bActionGroup *grp = NULL;
+       bPoseChannel *pchan;
+       
+       /* sanity checks */
+       if (ELEM(NULL, ob, pose))
+               return;
+       if (pose->active_group <= 0)
+               return;
+       
+       /* get group to remove */
+       grp= BLI_findlink(&pose->agroups, pose->active_group-1);
+       if (grp) {
+               /* firstly, make sure nothing references it */
+               for (pchan= pose->chanbase.first; pchan; pchan= pchan->next) {
+                       if (pchan->agrp_index == pose->active_group)
+                               pchan->agrp_index= 0;
+               }
+               
+               /* now, remove it from the pose */
+               BLI_freelinkN(&pose->agroups, grp);
+               pose->active_group= 0;
+               
+               BIF_undo_push("Remove Bone Group");
+       }
+       
+       allqueue(REDRAWBUTSEDIT, 0);
+       allqueue(REDRAWVIEW3D, 0);
+}
+
+char *build_posegroups_menustr (bPose *pose, short for_pupmenu)
+{
+       DynStr *pupds= BLI_dynstr_new();
+       bActionGroup *grp;
+       char *str;
+       char buf[16];
+       int i;
+       
+       /* add title first (and the "none" entry) */
+       BLI_dynstr_append(pupds, "Bone Group%t|");
+       if (for_pupmenu)
+               BLI_dynstr_append(pupds, "Add New%x0|");
+       else
+               BLI_dynstr_append(pupds, "BG: [None]%x0|");
+       
+       /* loop through markers, adding them */
+       for (grp= pose->agroups.first, i=1; grp; grp=grp->next, i++) {
+               if (for_pupmenu == 0)
+                       BLI_dynstr_append(pupds, "BG: ");
+               BLI_dynstr_append(pupds, grp->name);
+               
+               sprintf(buf, "%%x%d", i);
+               BLI_dynstr_append(pupds, buf);
+               
+               if (grp->next)
+                       BLI_dynstr_append(pupds, "|");
+       }
+       
+       /* convert to normal MEM_malloc'd string */
+       str= BLI_dynstr_get_cstring(pupds);
+       BLI_dynstr_free(pupds);
+       
+       return str;
+}
+
+/* Assign selected pchans to the bone group that the user selects */
+void pose_assign_to_posegroup ()
+{
+       Object *ob= OBACT;
+       bArmature *arm= (ob) ? ob->data : NULL;
+       bPose *pose= (ob) ? ob->pose : NULL;
+       bPoseChannel *pchan;
+       char *menustr;
+       int nr;
+       short done= 0;
+       
+       /* sanity checks */
+       if (ELEM3(NULL, ob, pose, arm))
+               return;
+
+       /* get group to affect */
+       menustr= build_posegroups_menustr(pose, 1);
+       nr= pupmenu(menustr);
+       MEM_freeN(menustr);
+       
+       if (nr < 0) 
+               return;
+       else if (nr == 0) {
+               /* add new - note: this does an undo push and sets active group */
+               pose_add_posegroup();
+       }
+       else
+               pose->active_group= nr;
+       
+       /* add selected bones to group then */
+       for (pchan= pose->chanbase.first; pchan; pchan= pchan->next) {
+               if ((pchan->bone->flag & BONE_SELECTED) && (pchan->bone->layer & arm->layer)) {
+                       pchan->agrp_index= pose->active_group;
+                       done= 1;
+               }
+       }
+       
+       if (done)
+               BIF_undo_push("Add Bones To Group");
+               
+       allqueue(REDRAWBUTSEDIT, 0);
+       allqueue(REDRAWVIEW3D, 0);
+}
+
+/* Remove selected pchans from their bone groups */
+void pose_remove_from_posegroups ()
+{
+       Object *ob= OBACT;
+       bArmature *arm= (ob) ? ob->data : NULL;
+       bPose *pose= (ob) ? ob->pose : NULL;
+       bPoseChannel *pchan;
+       short done= 0;
+       
+       /* sanity checks */
+       if (ELEM3(NULL, ob, pose, arm))
+               return;
+       
+       /* remove selected bones from their groups */
+       for (pchan= pose->chanbase.first; pchan; pchan= pchan->next) {
+               if ((pchan->bone->flag & BONE_SELECTED) && (pchan->bone->layer & arm->layer)) {
+                       if (pchan->agrp_index) {
+                               pchan->agrp_index= 0;
+                               done= 1;
+                       }
+               }
+       }
+       
+       if (done)
+               BIF_undo_push("Remove Bones From Groups");
+               
+       allqueue(REDRAWBUTSEDIT, 0);
+       allqueue(REDRAWVIEW3D, 0);
+}
+
+/* Ctrl-G in 3D-View while in PoseMode */
+void pgroup_operation_with_menu (void)
+{
+       Object *ob= OBACT;
+       bArmature *arm= (ob) ? ob->data : NULL;
+       bPose *pose= (ob) ? ob->pose : NULL;
+       bPoseChannel *pchan= NULL;
+       int mode;
+       
+       /* sanity checks */
+       if (ELEM3(NULL, ob, pose, arm))
+               return;
+       
+       /* check that something is selected */
+       for (pchan= pose->chanbase.first; pchan; pchan= pchan->next) {
+               if ((pchan->bone->flag & BONE_SELECTED) && (pchan->bone->layer & arm->layer)) 
+                       break;
+       }
+       if (pchan == NULL)
+               return;
+       
+       /* get mode of action */
+       if (pchan)
+               mode= pupmenu("Bone Groups%t|Add Selected to Group%x1|Add New Group%x2|Remove Selected From Groups%x3|Remove Active Group%x4");
+       else
+               mode= pupmenu("Bone Groups%t|Add New Group%x2|Remove Active Group%x4");
+               
+       /* handle mode */
+       switch (mode) {
+               case 1:
+                       pose_assign_to_posegroup();
+                       break;
+               case 2:
+                       pose_add_posegroup();
+                       break;
+               case 3:
+                       pose_remove_from_posegroups();
+                       break;
+               case 4:
+                       pose_remove_posegroup();
+                       break;
+       }
+}
+
+/* ********************************************** */
+
 /* context active object */
 void pose_flip_names(void)
 {
index 55626be8cfa25576bdd43b4d8e1a6fa1d5dfa0ac..9e1fa16a44c4422f69cb7c3b5fe90df348d433d9 100644 (file)
@@ -1474,6 +1474,8 @@ void sculpt(void)
        short spacing= 32000;
        int scissor_box[4];
        float offsetRot;
+       int smooth_stroke = 0;
+
        if(!(G.f & G_SCULPTMODE) || G.obedit || !ob || ob->id.lib || !get_mesh(ob) || (get_mesh(ob)->totface == 0))
                return;
        if(!(ob->lay & G.vd->lay))
@@ -1490,7 +1492,9 @@ void sculpt(void)
                ss= sd->session;
        }
 
-       if(sd->flags & SCULPT_INPUT_SMOOTH)
+       smooth_stroke = (sd->flags & SCULPT_INPUT_SMOOTH) && (sd->brush_type != GRAB_BRUSH);
+
+       if(smooth_stroke)
                sculpt_stroke_new(256);
 
        ss->damaged_rects.first = ss->damaged_rects.last = NULL;
@@ -1569,7 +1573,7 @@ void sculpt(void)
                if(firsttime || mouse[0]!=mvalo[0] || mouse[1]!=mvalo[1] || sculptmode_brush()->airbrush) {
                        firsttime= 0;
 
-                       if(sd->flags & SCULPT_INPUT_SMOOTH)
+                       if(smooth_stroke)
                                sculpt_stroke_add_point(mouse[0], mouse[1]);
 
                        spacing+= sqrt(pow(mvalo[0]-mouse[0],2)+pow(mvalo[1]-mouse[1],2));
@@ -1578,7 +1582,7 @@ void sculpt(void)
                                ss->vertexcosnos= mesh_get_mapped_verts_nors(ob);
 
                        if(G.scene->sculptdata.brush_type != GRAB_BRUSH) {
-                               if(sd->flags & SCULPT_INPUT_SMOOTH) {
+                               if(smooth_stroke) {
                                        sculpt_stroke_apply(&e);
                                }
                                else if(sd->spacing==0 || spacing>sd->spacing) {
@@ -1619,7 +1623,7 @@ void sculpt(void)
                                /* Draw cursor */
                                if(sculpt_data()->flags & SCULPT_DRAW_BRUSH)
                                        fdrawXORcirc((float)mouse[0],(float)mouse[1],sculptmode_brush()->size);
-                               if(sculpt_data()->flags & SCULPT_INPUT_SMOOTH)
+                               if(smooth_stroke)
                                        sculpt_stroke_draw();
                                
                                myswapbuffers();
@@ -1643,7 +1647,7 @@ void sculpt(void)
        /* Set the rotation of the brush back to what it was before any rake */
        set_tex_angle(offsetRot);
        
-       if(sd->flags & SCULPT_INPUT_SMOOTH) {
+       if(smooth_stroke) {
                sculpt_stroke_apply_all(&e);
                calc_damaged_verts(&ss->damaged_verts,e.grabdata);
                BLI_freelistN(&ss->damaged_rects);
index 1e764d98e9e82ba1f0a3c5348db78b65be43872b..582fa662e7e491385eae76b5ca51f1f5b4925e4a 100644 (file)
@@ -1940,6 +1940,8 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                                if(ELEM(G.obedit->type, OB_MESH, OB_LATTICE))
                                                        vgroup_assign_with_menu();
                                        }
+                                       else if(ob && (ob->flag & OB_POSEMODE))
+                                               pgroup_operation_with_menu();
                                        else
                                                group_operation_with_menu();
                                }
@@ -1953,7 +1955,10 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        if(G.obedit) {
                                                if(G.obedit->type==OB_MESH)
                                                        select_mesh_group_menu();
-                                       } else
+                                       } 
+                                       else if(ob && (ob->flag & OB_POSEMODE))
+                                               puts("Shift-G menu for PoseMode - Not Implemented!");
+                                       else
                                                select_object_grouped_menu();
                                else if((G.obedit==0) && G.qual==LR_ALTKEY) {
                                        if(okee("Clear location")) {
index 401b36d45879c3693786be93cca95c6b3a4e6b8f..fde3c56ceab7144dd7d6098af88278374d334536 100644 (file)
@@ -923,6 +923,7 @@ static TBitem tb_object_select[]= {
 {      0, "SEPR",                              0, NULL},
 {      0, "Select/Deselect All|A",     1, NULL},
 {      0, "Inverse",                   2, NULL},
+{      0, "Random",                    3, NULL},
 {      0, "Select All by Layer",       0,              tb_object_select_layer},
 {      0, "Select All by Type",        0,              tb_object_select_type},
 {      0, "SEPR",                              0, NULL},
index 22b10e0a3f00b425a67c2cb47991cad307f9a516..bbb5e5149423fca29d74cad84443f5f2a0564dbe 100644 (file)
@@ -1704,8 +1704,8 @@ static void constraintTransLim(TransInfo *t, TransData *td)
 
 static void constraintRotLim(TransInfo *t, TransData *td)
 {
-       if (td->con && td->ext) {
-               bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_SIZELIMIT);
+       if (td->con) {
+               bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_ROTLIMIT);
                bConstraintOb cob;
                bConstraint *con;
                
@@ -1714,13 +1714,37 @@ static void constraintRotLim(TransInfo *t, TransData *td)
                 *      - current space should be local
                 */
                memset(&cob, 0, sizeof(bConstraintOb));
-               // FIXME: todo
+               if (td->flag & TD_USEQUAT) {
+                       /* quats */
+                       if (td->ext)
+                               QuatToMat4(td->ext->quat, cob.matrix);
+                       else
+                               return;
+               }
+               else if (td->tdi) {
+                       /* ipo-keys eulers */
+                       TransDataIpokey *tdi= td->tdi;
+                       float eul[3];
+                       
+                       eul[0]= tdi->rotx[0];
+                       eul[1]= tdi->roty[0];
+                       eul[2]= tdi->rotz[0];
+                       
+                       EulToMat4(eul, cob.matrix);
+               }
+               else {
+                       /* eulers */
+                       if (td->ext)
+                               EulToMat4(td->ext->rot, cob.matrix);
+                       else
+                               return;
+               }
                        
                /* Evaluate valid constraints */
                for (con= td->con; con; con= con->next) {
                        /* we're only interested in Limit-Scale constraints */
-                       if (con->type == CONSTRAINT_TYPE_SIZELIMIT) {
-                               bSizeLimitConstraint *data= con->data;
+                       if (con->type == CONSTRAINT_TYPE_ROTLIMIT) {
+                               bRotLimitConstraint *data= con->data;
                                float tmat[4][4];
                                
                                /* only use it if it's tagged for this purpose */
@@ -1751,7 +1775,25 @@ static void constraintRotLim(TransInfo *t, TransData *td)
                }
                
                /* copy results from cob->matrix */
-               // fixme: todo
+               if (td->flag & TD_USEQUAT) {
+                       /* quats */
+                       Mat4ToQuat(cob.matrix, td->ext->quat);
+               }
+               else if (td->tdi) {
+                       /* ipo-keys eulers */
+                       TransDataIpokey *tdi= td->tdi;
+                       float eul[3];
+                       
+                       Mat4ToEul(cob.matrix, eul);
+                       
+                       tdi->rotx[0]= eul[0];
+                       tdi->roty[0]= eul[1];
+                       tdi->rotz[0]= eul[2];
+               }
+               else {
+                       /* eulers */
+                       Mat4ToEul(cob.matrix, td->ext->rot);
+               }
        }
 }
 
@@ -2541,10 +2583,10 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3]) {
                if(td->flag & TD_USEQUAT) {
                        Mat3MulSerie(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
                        Mat3ToQuat(fmat, quat); // Actual transform
-
+                       
                        if(td->ext->quat){
                                QuatMul(td->ext->quat, quat, td->ext->iquat);
-
+                               
                                /* is there a reason not to have this here? -jahka */
                                protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat);
                        }
@@ -2587,29 +2629,32 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3]) {
 
                VecAddf(td->loc, td->iloc, vec);
                
+               constraintTransLim(t, td);
+               
                /* rotation */
                if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't rotate objects itself
                        Mat3MulSerie(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
-
+                       
                        Mat3ToQuat(fmat, quat); // Actual transform
                        
                        QuatMul(td->ext->quat, quat, td->ext->iquat);
                        /* this function works on end result */
                        protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat);
+                       
+                       constraintRotLim(t, td);
                }
        }
        else {
                /* translation */
-               
                VecSubf(vec, td->center, t->center);
                Mat3MulVecfl(mat, vec);
                VecAddf(vec, vec, t->center);
                /* vec now is the location where the object has to be */
                VecSubf(vec, vec, td->center);
                Mat3MulVecfl(td->smtx, vec);
-
+               
                protectedTransBits(td->protectflag, vec);
-
+               
                if(td->tdi) {
                        TransDataIpokey *tdi= td->tdi;
                        add_tdi_poin(tdi->locx, tdi->oldloc, vec[0]);
@@ -2617,10 +2662,11 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3]) {
                        add_tdi_poin(tdi->locz, tdi->oldloc+2, vec[2]);
                }
                else VecAddf(td->loc, td->iloc, vec);
+               
+               constraintTransLim(t, td);
 
                /* rotation */
                if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't rotate objects itself
-               
                        if(td->flag & TD_USEQUAT) {
                                Mat3MulSerie(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
                                Mat3ToQuat(fmat, quat); // Actual transform
@@ -2682,6 +2728,8 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3]) {
                                        VECCOPY(td->ext->rot, eul);
                                }
                        }
+                       
+                       constraintRotLim(t, td);
                }
        }
 }
index 48e4f26717745fbaa9038cf79627b8ad70097925..73b30105b27014dd3577072ed7d1b23f821afd80 100644 (file)
@@ -1188,7 +1188,7 @@ void yafrayFileRender_t::writeMaterialsAndModulators()
 }
 
 
-void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_list, const float obmat[4][4])
+void yafrayFileRender_t::writeObject(Object* obj, ObjectRen *obr, const vector<VlakRen*> &VLR_list, const float obmat[4][4])
 {
        ostr.str("");
        // transform first (not necessarily actual obj->obmat, can be duplivert see below)
@@ -1230,7 +1230,6 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
        string matname(face0mat->id.name);
        // use name in imgtex_shader list if 'TexFace' enabled for this material
        if (face0mat->mode & MA_FACETEXTURE) {
-               ObjectRen *obr = face0->obr;
                MTFace* tface = RE_vlakren_get_tface(obr, face0, obr->actmtface, NULL, 0);
                if (tface) {
                        Image* fimg = (Image*)tface->tpage;
@@ -1408,7 +1407,6 @@ void yafrayFileRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_li
                                fci2!=VLR_list.end();++fci2)
        {
                VlakRen* vlr = *fci2;
-               ObjectRen *obr = vlr->obr;
                Material* fmat = vlr->mat;
                bool EXPORT_VCOL = ((fmat->mode & (MA_VERTEXCOL|MA_VERTEXCOLP))!=0);
                string fmatname(fmat->id.name);
@@ -1510,13 +1508,13 @@ void yafrayFileRender_t::writeAllObjects()
 {
 
        // first all objects except dupliverts (and main instance object for dups)
-       for (map<Object*, vector<VlakRen*> >::const_iterator obi=all_objects.begin();
+       for (map<Object*, yafrayObjectRen >::const_iterator obi=all_objects.begin();
                        obi!=all_objects.end(); ++obi)
        {
                // skip main duplivert object if in dupliMtx_list, written later
                Object* obj = obi->first;
                if (dupliMtx_list.find(string(obj->id.name))!=dupliMtx_list.end()) continue;
-               writeObject(obj, obi->second, obj->obmat);
+               writeObject(obj, obi->second.obr, obi->second.faces, obj->obmat);
        }
 
        // Now all duplivert objects (if any) as instances of main object
@@ -1536,7 +1534,7 @@ void yafrayFileRender_t::writeAllObjects()
 
                // first object written as normal (but with transform of first duplivert)
                Object* obj = dup_srcob[dupMtx->first];
-               writeObject(obj, all_objects[obj], obmat);
+               writeObject(obj, all_objects[obj].obr, all_objects[obj].faces, obmat);
 
                // all others instances of first
                for (unsigned int curmtx=16;curmtx<dupMtx->second.size();curmtx+=16) {  // number of 4x4 matrices
index 5d2e0c53a21d7ecc2a94c23cc4ab0d11005a8997..0eb1bfec1ed98adeefdae6b257748e6d88cb77c9 100644 (file)
@@ -18,7 +18,7 @@ class yafrayFileRender_t : public yafrayRender_t
                virtual void writeTextures();
                virtual void writeShader(const std::string &shader_name, Material* matr, const std::string &facetexname="");
                virtual void writeMaterialsAndModulators();
-               virtual void writeObject(Object* obj, const std::vector<VlakRen*> &VLR_list, const float obmat[4][4]);
+               virtual void writeObject(Object* obj, ObjectRen *obr, const std::vector<VlakRen*> &VLR_list, const float obmat[4][4]);
                virtual void writeAllObjects();
                virtual void writeAreaLamp(LampRen* lamp, int num, float iview[4][4]);
                virtual void writeLamps();
index cccd6b1ab8d761e80c70ce2c605f893a5296807c..c8d20180f8c7d87728d82e8a73ffa6030269c538 100644 (file)
@@ -1079,7 +1079,7 @@ void yafrayPluginRender_t::writeMaterialsAndModulators()
 
 }
 
-void yafrayPluginRender_t::genUVcoords(vector<yafray::GFLOAT> &uvcoords, VlakRen *vlr, MTFace* uvc, bool comple)
+void yafrayPluginRender_t::genUVcoords(vector<yafray::GFLOAT> &uvcoords, ObjectRen *obr, VlakRen *vlr, MTFace* uvc, bool comple)
 {
        if (uvc) 
        {
@@ -1107,9 +1107,8 @@ void yafrayPluginRender_t::genUVcoords(vector<yafray::GFLOAT> &uvcoords, VlakRen
        }
 }
 
-void yafrayPluginRender_t::genVcol(vector<yafray::CFLOAT> &vcol, VlakRen *vlr, bool comple)
+void yafrayPluginRender_t::genVcol(vector<yafray::CFLOAT> &vcol, ObjectRen *obr, VlakRen *vlr, bool comple)
 {
-       ObjectRen *obr= vlr->obr;
        MCol *mcol= RE_vlakren_get_mcol(obr, vlr, obr->actmcol, NULL, 0);
 
        if (mcol)
@@ -1143,10 +1142,9 @@ void yafrayPluginRender_t::genVcol(vector<yafray::CFLOAT> &vcol, VlakRen *vlr, b
 
 void yafrayPluginRender_t::genFace(vector<int> &faces,vector<string> &shaders,vector<int> &faceshader,
                                                                                                                vector<yafray::GFLOAT> &uvcoords,vector<yafray::CFLOAT> &vcol,
-                                                                                                               map<VertRen*, int> &vert_idx,VlakRen *vlr,
+                                                                                                               map<VertRen*, int> &vert_idx,ObjectRen *obr,VlakRen *vlr,
                                                                                                                int has_orco,bool has_uv)
 {
-       ObjectRen *obr= vlr->obr;
        Material* fmat = vlr->mat;
        bool EXPORT_VCOL = ((fmat->mode & (MA_VERTEXCOL|MA_VERTEXCOLP))!=0);
        string fmatname(fmat->id.name);
@@ -1185,16 +1183,15 @@ void yafrayPluginRender_t::genFace(vector<int> &faces,vector<string> &shaders,ve
 
        faces.push_back(idx1);  faces.push_back(idx2);  faces.push_back(idx3);
 
-       if(has_uv) genUVcoords(uvcoords, vlr, uvc);
-       if (EXPORT_VCOL) genVcol(vcol, vlr);
+       if(has_uv) genUVcoords(uvcoords, obr, vlr, uvc);
+       if (EXPORT_VCOL) genVcol(vcol, obr, vlr);
 }
 
 void yafrayPluginRender_t::genCompleFace(vector<int> &faces,/*vector<string> &shaders,*/vector<int> &faceshader,
                                                                                                                vector<yafray::GFLOAT> &uvcoords,vector<yafray::CFLOAT> &vcol,
-                                                                                                               map<VertRen*, int> &vert_idx,VlakRen *vlr,
+                                                                                                               map<VertRen*, int> &vert_idx,ObjectRen *obr,VlakRen *vlr,
                                                                                                                int has_orco,bool has_uv)
 {
-       ObjectRen *obr= vlr->obr;
        Material* fmat = vlr->mat;
        bool EXPORT_VCOL = ((fmat->mode & (MA_VERTEXCOL|MA_VERTEXCOLP))!=0);
 
@@ -1210,12 +1207,12 @@ void yafrayPluginRender_t::genCompleFace(vector<int> &faces,/*vector<string> &sh
 
        faces.push_back(idx1);  faces.push_back(idx2);  faces.push_back(idx3);
 
-       if (has_uv) genUVcoords(uvcoords, vlr, uvc, true);
-       if (EXPORT_VCOL) genVcol(vcol, vlr, true);
+       if (has_uv) genUVcoords(uvcoords, obr, vlr, uvc, true);
+       if (EXPORT_VCOL) genVcol(vcol, obr, vlr, true);
 }
 
 void yafrayPluginRender_t::genVertices(vector<yafray::point3d_t> &verts, int &vidx,
-                                                                                                                                                        map<VertRen*, int> &vert_idx, VlakRen* vlr, int has_orco, Object* obj)
+                                                                                                                                                        map<VertRen*, int> &vert_idx, ObjectRen *obr, VlakRen* vlr, int has_orco, Object* obj)
 {
        VertRen* ver;
        float tvec[3];  // for back2world transform
@@ -1280,7 +1277,7 @@ void yafrayPluginRender_t::genVertices(vector<yafray::point3d_t> &verts, int &vi
        }
 }
 
-void yafrayPluginRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_list, const float obmat[4][4])
+void yafrayPluginRender_t::writeObject(Object* obj, ObjectRen *obr, const vector<VlakRen*> &VLR_list, const float obmat[4][4])
 {
        float mtr[4*4];
        mtr[0*4+0]=obmat[0][0];  mtr[0*4+1]=obmat[1][0];  mtr[0*4+2]=obmat[2][0];  mtr[0*4+3]=obmat[3][0];
@@ -1341,8 +1338,7 @@ void yafrayPluginRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_
                                fci!=VLR_list.end();++fci)
        {
                VlakRen* vlr = *fci;
-               ObjectRen *obr = vlr->obr;
-               genVertices(verts, vidx, vert_idx, vlr, has_orco, obj);
+               genVertices(verts, vidx, vert_idx, obr, vlr, has_orco, obj);
                if(RE_vlakren_get_tface(obr, vlr, obr->actmtface, NULL, 0)) has_uv=true;
        }
        // all faces using the index list created above
@@ -1354,9 +1350,9 @@ void yafrayPluginRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_
                                fci2!=VLR_list.end();++fci2)
        {
                VlakRen* vlr = *fci2;
-               genFace(faces, shaders, faceshader, uvcoords, vcol, vert_idx, vlr, has_orco, has_uv);
+               genFace(faces, shaders, faceshader, uvcoords, vcol, vert_idx, obr, vlr, has_orco, has_uv);
                if (vlr->v4) 
-                       genCompleFace(faces, faceshader, uvcoords, vcol, vert_idx, vlr, has_orco, has_uv);
+                       genCompleFace(faces, faceshader, uvcoords, vcol, vert_idx, obr, vlr, has_orco, has_uv);
        }
 
        // using the ObjectRen database, contruct a new name if object has a parent.
@@ -1387,13 +1383,13 @@ void yafrayPluginRender_t::writeObject(Object* obj, const vector<VlakRen*> &VLR_
 void yafrayPluginRender_t::writeAllObjects()
 {
        // first all objects except dupliverts (and main instance object for dups)
-       for (map<Object*, vector<VlakRen*> >::const_iterator obi=all_objects.begin();
+       for (map<Object*, yafrayObjectRen >::const_iterator obi=all_objects.begin();
                        obi!=all_objects.end(); ++obi)
        {
          // skip main duplivert object if in dupliMtx_list, written later
                Object* obj = obi->first;
                if (dupliMtx_list.find(string(obj->id.name))!=dupliMtx_list.end()) continue;
-               writeObject(obj, obi->second, obj->obmat);
+               writeObject(obj, obi->second.obr, obi->second.faces, obj->obmat);
        }
 
        // Now all duplivert objects (if any) as instances of main object
@@ -1411,7 +1407,7 @@ void yafrayPluginRender_t::writeAllObjects()
 
                // first object written as normal (but with transform of first duplivert)
                Object* obj = dup_srcob[dupMtx->first];
-               writeObject(obj, all_objects[obj], obmat);
+               writeObject(obj, all_objects[obj].obr, all_objects[obj].faces, obmat);
 
                // all others instances of first
                for (unsigned int curmtx=16;curmtx<dupMtx->second.size();curmtx+=16) 
index 1ce4988a2602f34fcc5ada5910623da3ba587c59..660271daf968f2d47e96020a74c5e29e9ba16954 100644 (file)
@@ -35,7 +35,7 @@ class yafrayPluginRender_t : public yafrayRender_t
                virtual void writeTextures();
                virtual void writeShader(const std::string &shader_name, Material* matr, const std::string &facetexname="");
                virtual void writeMaterialsAndModulators();
-               virtual void writeObject(Object* obj,
+               virtual void writeObject(Object* obj, ObjectRen *obr,
                                const std::vector<VlakRen*> &VLR_list, const float obmat[4][4]);
                virtual void writeAllObjects();
                virtual void writeAreaLamp(LampRen* lamp, int num, float iview[4][4]);
@@ -48,18 +48,18 @@ class yafrayPluginRender_t : public yafrayRender_t
                virtual bool initExport();
                virtual bool finishExport();
 
-               void genUVcoords(std::vector<yafray::GFLOAT> &uvcoords,VlakRen *vlr,MTFace* uvc, bool comple=false);
-               void genVcol(std::vector<yafray::CFLOAT> &vcol, VlakRen *vlr, bool comple=false);
+               void genUVcoords(std::vector<yafray::GFLOAT> &uvcoords,ObjectRen *obr,VlakRen *vlr,MTFace* uvc, bool comple=false);
+               void genVcol(std::vector<yafray::CFLOAT> &vcol, ObjectRen *obr, VlakRen *vlr, bool comple=false);
                void genFace(std::vector<int> &faces,std::vector<std::string> &shaders,std::vector<int> &faceshader,
                                std::vector<yafray::GFLOAT> &uvcoords,std::vector<yafray::CFLOAT> &vcol,
-                               std::map<VertRen*, int> &vert_idx,VlakRen *vlr,
+                               std::map<VertRen*, int> &vert_idx,ObjectRen *obr,VlakRen *vlr,
                                int has_orco,bool has_uv);
                void genCompleFace(std::vector<int> &faces,/*std::vector<std::string> &shaders,*/std::vector<int> &faceshader,
                                std::vector<yafray::GFLOAT> &uvcoords,std::vector<yafray::CFLOAT> &vcol,
-                               std::map<VertRen*, int> &vert_idx,VlakRen *vlr,
+                               std::map<VertRen*, int> &vert_idx,ObjectRen *obr, VlakRen *vlr,
                                int has_orco,bool has_uv);
                void genVertices(std::vector<yafray::point3d_t> &verts, int &vidx,
-                                                                                std::map<VertRen*, int> &vert_idx, VlakRen* vlr, int has_orco, Object* obj);
+                                                                                std::map<VertRen*, int> &vert_idx, ObjectRen *obr, VlakRen* vlr, int has_orco, Object* obj);
 };
 
 class blenderYafrayOutput_t : public yafray::colorOutput_t
index fa7c61072f4a46eb22db9ea3c9803c4bd071b963..d9d421e07200c0a22f8a8440c5fac603d3ff9515 100644 (file)
@@ -141,15 +141,15 @@ bool yafrayRender_t::getAllMatTexObs()
                        // Make list of faces per object, ignore <3 vert faces, duplicate vertex sorting done later.
                        // ignore null object pointers.
                        // Also make list of facetexture images (material 'TexFace').
-                       if (vlr->obr->ob) {
+                       if (obr->ob) {
                                int nv = 0;     // number of vertices
                                MTFace *tface;
 
                                if (vlr->v4) nv=4; else if (vlr->v3) nv=3;
                                if (nv) {
-                                       ObjectRen *obr= vlr->obr;
                                        renderobs[obr->ob->id.name] = obr->ob;
-                                       all_objects[obr->ob].push_back(vlr);
+                                       all_objects[obr->ob].obr= obr;
+                                       all_objects[obr->ob].faces.push_back(vlr);
 
                                        tface= RE_vlakren_get_tface(obr, vlr, obr->actmtface, NULL, 0);
                                        if (tface && tface->tpage) {
@@ -184,7 +184,7 @@ bool yafrayRender_t::getAllMatTexObs()
        // in all_objects with the name given in dupliMtx_list
        if (!dupliMtx_list.empty()) {
 
-               for (map<Object*, vector<VlakRen*> >::const_iterator obn=all_objects.begin();
+               for (map<Object*, yafrayObjectRen>::const_iterator obn=all_objects.begin();
                        obn!=all_objects.end();++obn)
                {
                        Object* obj = obn->first;
index 0debb0009fae92aee6d7bef2faff7317dc6a9bf2..43d2c6c602abada47055a2cf77a167742a76ec6a 100644 (file)
@@ -52,6 +52,12 @@ extern void error (char *fmt, ...);
 #include <vector>
 #include <set>
 
+class yafrayObjectRen {
+       public:
+               std::vector<VlakRen*> faces;
+               ObjectRen *obr;
+};
+
 class yafrayRender_t
 {
        public:
@@ -72,7 +78,7 @@ class yafrayRender_t
 
                bool hasworld;
 
-               std::map<Object*, std::vector<VlakRen*> > all_objects;
+               std::map<Object*, yafrayObjectRen> all_objects;
                std::map<std::string, Material*> used_materials;
                std::map<std::string, MTex*> used_textures;
                std::map<std::string, std::vector<float> > dupliMtx_list;
@@ -86,7 +92,7 @@ class yafrayRender_t
                virtual void writeTextures()=0;
                virtual void writeShader(const std::string &shader_name, Material* matr, const std::string &facetexname)=0;
                virtual void writeMaterialsAndModulators()=0;
-               virtual void writeObject(Object* obj, const std::vector<VlakRen*> &VLR_list, const float obmat[4][4])=0;
+               virtual void writeObject(Object* obj, ObjectRen *obr, const std::vector<VlakRen*> &VLR_list, const float obmat[4][4])=0;
                virtual void writeAllObjects()=0;
                virtual void writeLamps()=0;
                virtual void writeCamera()=0;
index 7b9da71a5019fab00348f6a78f544233c5c24837..2b566d77a297dff9c999c7334df3874a16806409 100644 (file)
@@ -42,16 +42,18 @@ INCLUDE_DIRECTORIES(../../intern/guardedalloc
   ../blender/makesdna
   ../kernel/gen_messaging
   ../kernel/gen_system
-  ../../extern/binreloc/include
 )
 
+
+
 IF(WITH_QUICKTIME)
   ADD_DEFINITIONS(-DWITH_QUICKTIME)
 ENDIF(WITH_QUICKTIME)
 
-IF(WITH_BINRELOC)
+IF(LINUX)
   ADD_DEFINITIONS(-DWITH_BINRELOC)
-endif(WITH_VINRELOC)
+  INCLUDE_DIRECTORIES(${BINRELOC_INC})
+endif(LINUX)
 
 IF(YESIAMSTUPID)
   ADD_DEFINITIONS(-DYESIAMSTUPID)
@@ -196,6 +198,10 @@ FILE(READ ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt BLENDER_LINK_LIBS)
 
 SET(BLENDER_LINK_LIBS bf_nodes ${BLENDER_LINK_LIBS} src blender_python blender_render blender_radiosity blender_IK bf_elbeem)
 
+IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+  SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} extern_binreloc)
+ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+
 IF(UNIX)
   # Sort libraries
   SET(BLENDER_SORTED_LIBS
@@ -259,6 +265,7 @@ IF(UNIX)
     bf_moto 
     blender_python
     bf_quicktime
+    extern_binreloc
   )
 
   FOREACH(SORTLIB ${BLENDER_SORTED_LIBS})